@redocly/redoc 0.131.0-next.0 → 0.131.0-next.10

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 (465) hide show
  1. package/CHANGELOG.md +200 -0
  2. package/dist/bin.d.ts +1 -0
  3. package/dist/bin.js +1 -1
  4. package/dist/cli/build/copy-env-files.js +1 -0
  5. package/dist/cli/{prepare → build}/index.d.ts +2 -2
  6. package/dist/cli/build/index.js +1 -0
  7. package/dist/cli/develop.js +1 -1
  8. package/dist/cli/eject/resolveTheme.d.ts +1 -1
  9. package/dist/cli/eject/resolveTheme.js +1 -1
  10. package/dist/cli/stats/collectors/{openapi.d.ts → openapi/index.d.ts} +2 -2
  11. package/dist/cli/stats/collectors/openapi/index.js +1 -0
  12. package/dist/cli/stats/collectors/openapi/oas32.d.ts +15 -0
  13. package/dist/cli/stats/collectors/openapi/oas32.js +1 -0
  14. package/dist/cli/stats/index.js +1 -1
  15. package/dist/cli/telemetry/index.js +1 -1
  16. package/dist/cli/utils/listen-stdin.d.ts +10 -0
  17. package/dist/cli/utils/listen-stdin.js +2 -0
  18. package/dist/client/App.js +1 -1
  19. package/dist/client/ErrorBoundary.js +1 -1
  20. package/dist/client/TestProvider.js +1 -1
  21. package/dist/client/app/DevModeFloatingBar/index.d.ts +3 -0
  22. package/dist/client/app/DevModeFloatingBar/index.js +43 -0
  23. package/dist/client/app/Feedback/useSubmitFeedback.js +1 -1
  24. package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
  25. package/dist/client/app/hooks/index.d.ts +1 -0
  26. package/dist/client/app/hooks/index.js +1 -1
  27. package/dist/client/app/hooks/useAnchorPositioning.d.ts +6 -0
  28. package/dist/client/app/hooks/useAnchorPositioning.js +1 -0
  29. package/dist/client/app/hooks/useAutoScroll.js +1 -1
  30. package/dist/client/app/hooks/useRouteChangeTracker.js +1 -1
  31. package/dist/client/app/hooks/utils/pathname-matches-active-section.d.ts +6 -0
  32. package/dist/client/app/hooks/utils/pathname-matches-active-section.js +1 -0
  33. package/dist/client/app/markdoc/custom-components/html-script.js +1 -0
  34. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -0
  35. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -0
  36. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -0
  37. package/dist/client/app/markdoc/hooks/use-store.js +1 -0
  38. package/dist/client/app/search/useAiSearch.js +1 -1
  39. package/dist/client/app/search/useSearch.js +1 -1
  40. package/dist/client/browser-entry.js +5 -5
  41. package/dist/client/constants/common.d.ts +2 -0
  42. package/dist/client/constants/common.js +1 -0
  43. package/dist/client/providers/hooks.js +1 -1
  44. package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
  45. package/dist/client/runtime/loader.js +1 -1
  46. package/dist/client/runtime/useSocketMessages.js +1 -1
  47. package/dist/{server/plugins/asyncapi-docs/template → client/templates/asyncapi-docs}/helpers.d.ts +3 -3
  48. package/dist/client/templates/asyncapi-docs/helpers.js +1 -0
  49. package/dist/{server/plugins/asyncapi-docs/template/AsyncApiDocs.d.ts → client/templates/asyncapi-docs/template.d.ts} +1 -1
  50. package/dist/client/templates/asyncapi-docs/template.js +11 -0
  51. package/dist/client/templates/openapi-docs/helpers.js +5 -0
  52. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.d.ts → client/templates/openapi-docs/template.d.ts} +1 -1
  53. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.js → client/templates/openapi-docs/template.js} +1 -1
  54. package/dist/client/utils/catalog/inject-catalog-items.d.ts +1 -1
  55. package/dist/client/utils/catalog/inject-catalog-items.js +1 -1
  56. package/dist/constants/catalog-entities.d.ts +12 -0
  57. package/dist/constants/catalog-entities.js +1 -0
  58. package/dist/constants/common.d.ts +2 -2
  59. package/dist/constants/common.js +1 -1
  60. package/dist/constants/l10n/langs/ar.js +1 -1
  61. package/dist/constants/l10n/langs/de.js +1 -1
  62. package/dist/constants/l10n/langs/en.js +1 -1
  63. package/dist/constants/l10n/langs/es.js +1 -1
  64. package/dist/constants/l10n/langs/fr.js +1 -1
  65. package/dist/constants/l10n/langs/hi.js +1 -1
  66. package/dist/constants/l10n/langs/it.js +1 -1
  67. package/dist/constants/l10n/langs/ja.js +1 -1
  68. package/dist/constants/l10n/langs/ko.js +1 -1
  69. package/dist/constants/l10n/langs/pl.js +1 -1
  70. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  71. package/dist/constants/l10n/langs/pt.js +1 -1
  72. package/dist/constants/l10n/langs/ru.js +1 -1
  73. package/dist/constants/l10n/langs/uk.js +1 -1
  74. package/dist/constants/l10n/langs/zh.js +1 -1
  75. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-inner-text.d.ts +1 -1
  76. package/dist/markdoc/helpers/get-inner-text.js +2 -0
  77. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-variable.d.ts +2 -2
  78. package/dist/markdoc/helpers/get-variable.js +1 -0
  79. package/dist/markdoc/nodes/fence/index.js +1 -0
  80. package/dist/markdoc/nodes/heading.js +1 -0
  81. package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.d.ts +6 -6
  82. package/dist/markdoc/tags/json-example.d.ts +3 -0
  83. package/dist/markdoc/tags/json-schema.d.ts +3 -0
  84. package/dist/markdoc/tags/openapi-code-sample.d.ts +3 -0
  85. package/dist/markdoc/tags/openapi-example.d.ts +3 -0
  86. package/dist/markdoc/tags/openapi-response-sample.d.ts +3 -0
  87. package/dist/markdoc/tags/replay-openapi.d.ts +3 -0
  88. package/dist/markdoc/types.d.ts +8 -0
  89. package/dist/markdoc/types.js +0 -0
  90. package/dist/server/api-routes/import-api-routes-handlers.js +1 -1
  91. package/dist/server/api-routes/run-api-routes-worker.js +1 -1
  92. package/dist/server/config/env-config.js +1 -0
  93. package/dist/{config → server/config}/env-schema.d.ts +9 -6
  94. package/dist/{config → server/config}/env-schemas/database.d.ts +1 -1
  95. package/dist/server/config/env-schemas/database.js +1 -0
  96. package/dist/{config → server/config}/env-schemas/environment-detection.d.ts +2 -2
  97. package/dist/{config → server/config}/env-schemas/organization-project.d.ts +3 -0
  98. package/dist/{config → server/config}/env-schemas/organization-project.js +1 -1
  99. package/dist/{config → server/config}/env-schemas/search.d.ts +2 -2
  100. package/dist/server/config/env-schemas/search.js +1 -0
  101. package/dist/server/constants/common.d.ts +3 -0
  102. package/dist/server/constants/common.js +1 -1
  103. package/dist/server/constants/feedback.d.ts +6 -0
  104. package/dist/server/constants/feedback.js +1 -0
  105. package/dist/server/constants/plugins/catalog-entities.d.ts +0 -11
  106. package/dist/server/constants/plugins/catalog-entities.js +1 -1
  107. package/dist/server/constants/plugins/search.d.ts +0 -4
  108. package/dist/server/constants/plugins/search.js +1 -1
  109. package/dist/server/entitlements/entitlements-provider.js +1 -1
  110. package/dist/server/esbuild/esbuild-logger.js +1 -1
  111. package/dist/server/esbuild/esbuild.js +1 -1
  112. package/dist/server/esbuild/plugins/assets-resolver.js +1 -1
  113. package/dist/server/esbuild/plugins/esbuild-compile-resolver.js +1 -1
  114. package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
  115. package/dist/server/esbuild/plugins/themes-resolver.js +2 -2
  116. package/dist/server/{config/external-plugins.d.ts → external-plugins/resolve-external-plugins.d.ts} +2 -2
  117. package/dist/server/{config/external-plugins.js → external-plugins/resolve-external-plugins.js} +1 -1
  118. package/dist/server/fs/cache.js +1 -1
  119. package/dist/server/fs/last-modified-tracker.js +1 -1
  120. package/dist/server/fs/utils/is-loader-cache-enabled.js +1 -1
  121. package/dist/server/node-bundle-entry.js +1 -1
  122. package/dist/server/plugins/analytics/adobe/index.js +1 -1
  123. package/dist/server/plugins/analytics/amplitude/index.js +1 -1
  124. package/dist/server/plugins/analytics/fullstory/index.js +1 -1
  125. package/dist/server/plugins/analytics/ga/index.js +1 -1
  126. package/dist/server/plugins/analytics/gtm/browser-hooks.js +1 -1
  127. package/dist/server/plugins/analytics/gtm/index.js +1 -1
  128. package/dist/server/plugins/analytics/heap/index.js +1 -1
  129. package/dist/server/plugins/analytics/rudderstack/index.js +1 -1
  130. package/dist/server/plugins/analytics/segment/browser-hooks.js +1 -1
  131. package/dist/server/plugins/analytics/segment/build-script.js +5 -2
  132. package/dist/server/plugins/analytics/segment/index.js +1 -1
  133. package/dist/server/plugins/asyncapi-docs/index.js +1 -1
  134. package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.js +37 -37
  135. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
  136. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +2 -2
  137. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
  138. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
  139. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
  140. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
  141. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +1 -1
  142. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  143. package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.js +1 -1
  144. package/dist/server/plugins/catalog-entities/plugin.js +1 -1
  145. package/dist/server/plugins/config-parser/loaders/redocly-config-loader.js +1 -1
  146. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  147. package/dist/server/plugins/default-theme/index.js +1 -1
  148. package/dist/server/plugins/entitlements/index.js +1 -1
  149. package/dist/server/plugins/lifecycle.js +2 -2
  150. package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.js +1 -1
  151. package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.js +1 -1
  152. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.js +1 -1
  153. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.js +1 -1
  154. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.js +1 -1
  155. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.js +1 -1
  156. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
  157. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.js +1 -1
  158. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  159. package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.js +1 -1
  160. package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.js +1 -1
  161. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
  162. package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.js +1 -1
  163. package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.js +1 -1
  164. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.js +1 -1
  165. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.js +1 -1
  166. package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.js +1 -1
  167. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
  168. package/dist/server/plugins/markdown/markdoc/import-user-tags.js +1 -1
  169. package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
  170. package/dist/server/plugins/markdown/markdoc/partials.js +1 -1
  171. package/dist/server/plugins/markdown/markdoc/plugins/headings.js +1 -1
  172. package/dist/server/plugins/markdown/markdoc/plugins/render-mermaid.js +1 -1
  173. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  174. package/dist/server/plugins/markdown/runtime-transform.js +1 -1
  175. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  176. package/dist/server/plugins/markdown/search/get-search-documents.js +2 -2
  177. package/dist/server/plugins/markdown/search/nodes/section-node.js +1 -1
  178. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  179. package/dist/server/plugins/markdown/search/to-markdown.js +17 -13
  180. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  181. package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.js +1 -1
  182. package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.d.ts +1 -0
  183. package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.js +1 -1
  184. package/dist/server/plugins/mcp/docs-mcp/tools/search.d.ts +3 -2
  185. package/dist/server/plugins/mcp/docs-mcp/tools/search.js +6 -1
  186. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  187. package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
  188. package/dist/server/plugins/mcp/servers/docs-server.d.ts +3 -1
  189. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  190. package/dist/server/plugins/mcp/types.d.ts +7 -0
  191. package/dist/server/plugins/openapi-docs/index.js +1 -1
  192. package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +29 -29
  193. package/dist/server/plugins/openapi-docs/search-indexer.js +1 -1
  194. package/dist/server/plugins/scorecard-classic/get-scorecard-config.d.ts +1 -1
  195. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  196. package/dist/server/plugins/scorecard-classic/lint.js +1 -1
  197. package/dist/server/plugins/scorecards/database/scorecards-config-service.js +1 -1
  198. package/dist/server/plugins/scorecards/plugin.js +1 -1
  199. package/dist/server/plugins/scorecards/workers/run-scorecards-worker.js +1 -1
  200. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.d.ts +11 -0
  201. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -0
  202. package/dist/server/plugins/search/documents/search-documents.js +1 -1
  203. package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
  204. package/dist/server/plugins/search/engines/typesense/index.js +1 -1
  205. package/dist/server/plugins/search/index.js +1 -1
  206. package/dist/server/plugins/search/llmstxt/index.js +1 -1
  207. package/dist/server/plugins/search/utils.d.ts +2 -0
  208. package/dist/server/plugins/search/utils.js +2 -2
  209. package/dist/server/plugins/sidebars/index.js +2 -2
  210. package/dist/server/plugins/sso/index.js +1 -1
  211. package/dist/server/providers/database/base-repository.js +1 -1
  212. package/dist/server/providers/database/database-connection-factory.js +1 -1
  213. package/dist/server/providers/database/database-preconnect-service.js +1 -1
  214. package/dist/server/providers/database/databases/sqld-sqlite/drizzle.config.js +1 -1
  215. package/dist/server/ssr/render.js +1 -1
  216. package/dist/server/ssr/server-side-props/get-server-props-from-user-handler.js +1 -1
  217. package/dist/server/ssr/utils.js +1 -1
  218. package/dist/server/store.d.ts +1 -1
  219. package/dist/server/store.js +1 -1
  220. package/dist/server/telemetry/index.js +1 -1
  221. package/dist/server/tools/notifiers/formatter.js +1 -1
  222. package/dist/server/tools/notifiers/helpers/colors.js +1 -1
  223. package/dist/server/tools/notifiers/logger.js +1 -1
  224. package/dist/server/tools/notifiers/reporter.d.ts +0 -1
  225. package/dist/server/tools/notifiers/reporter.js +6 -7
  226. package/dist/server/tools/notifiers/terminal-manager.js +5 -4
  227. package/dist/server/types/plugins/markdown.d.ts +0 -7
  228. package/dist/server/utils/ai-agent-detection.d.ts +16 -0
  229. package/dist/server/utils/ai-agent-detection.js +1 -0
  230. package/dist/server/utils/envs/load-env-variables.js +1 -1
  231. package/dist/server/utils/fs.js +1 -1
  232. package/dist/server/utils/index.d.ts +2 -2
  233. package/dist/server/utils/index.js +1 -1
  234. package/dist/server/utils/is-catalog-entities-enabled.js +1 -1
  235. package/dist/server/utils/is-scorecards-enabled.js +1 -1
  236. package/dist/server/utils/lifecycle-hooks.d.ts +2 -2
  237. package/dist/server/utils/lifecycle-hooks.js +1 -1
  238. package/dist/server/utils/rbac.js +1 -1
  239. package/dist/server/utils/report-all-errors.js +1 -1
  240. package/dist/server/utils/set-execution-mode.d.ts +5 -0
  241. package/dist/server/utils/set-execution-mode.js +1 -0
  242. package/dist/server/version.js +1 -1
  243. package/dist/server/web-server/auth.d.ts +2 -0
  244. package/dist/server/web-server/auth.js +4 -4
  245. package/dist/server/web-server/handle-api-route-request.js +1 -1
  246. package/dist/server/web-server/http.js +2 -2
  247. package/dist/server/web-server/middleware/apiKeyMiddleware.js +1 -1
  248. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  249. package/dist/server/web-server/middleware/corsMiddleware.js +1 -1
  250. package/dist/server/web-server/middleware/dynamic-middleware/dynamic-middleware.js +1 -1
  251. package/dist/server/web-server/middleware/idleTimeoutMiddleware.js +1 -1
  252. package/dist/server/web-server/middleware/responseHeadersMiddleware.js +1 -1
  253. package/dist/server/web-server/mime-types.js +1 -1
  254. package/dist/server/web-server/routes/auth.js +1 -1
  255. package/dist/server/web-server/routes/cors-proxy.d.ts +5 -0
  256. package/dist/server/web-server/routes/cors-proxy.js +2 -0
  257. package/dist/server/web-server/routes/dynamic-route.js +1 -1
  258. package/dist/server/web-server/routes/error.js +1 -1
  259. package/dist/server/web-server/routes/feedback.js +1 -1
  260. package/dist/server/web-server/routes/helpers/get-md-asset-pathname.d.ts +2 -0
  261. package/dist/server/web-server/routes/helpers/get-md-asset-pathname.js +1 -0
  262. package/dist/server/web-server/routes/index.js +1 -1
  263. package/dist/server/web-server/routes/info.js +1 -1
  264. package/dist/server/web-server/routes/mcp-oauth.js +1 -1
  265. package/dist/server/web-server/routes/otel/otel.js +1 -1
  266. package/dist/server/web-server/routes/page-data.js +1 -1
  267. package/dist/server/web-server/routes/path-prefix-redirect.js +1 -1
  268. package/dist/server/web-server/routes/resolve-route.js +1 -1
  269. package/dist/server/web-server/routes/semantic-search.d.ts +4 -0
  270. package/dist/server/web-server/routes/semantic-search.js +1 -0
  271. package/dist/server/workers/worker-pool.js +1 -1
  272. package/dist/{server/utils → utils}/slugger.d.ts +13 -0
  273. package/package.json +13 -13
  274. package/dist/cli/prepare/copy-env-files.js +0 -1
  275. package/dist/cli/prepare/index.js +0 -1
  276. package/dist/cli/stats/collectors/openapi.js +0 -1
  277. package/dist/client/app/ErrorBubble/index.d.ts +0 -3
  278. package/dist/client/app/ErrorBubble/index.js +0 -59
  279. package/dist/client/app/PageCounter/index.d.ts +0 -3
  280. package/dist/client/app/PageCounter/index.js +0 -64
  281. package/dist/config/env-config.js +0 -1
  282. package/dist/config/env-schemas/database.js +0 -1
  283. package/dist/config/env-schemas/search.js +0 -1
  284. package/dist/server/plugins/asyncapi-docs/template/AsyncApiDocs.js +0 -11
  285. package/dist/server/plugins/asyncapi-docs/template/helpers.js +0 -1
  286. package/dist/server/plugins/markdown/markdoc/custom-components/html-script.js +0 -1
  287. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-code-sample.js +0 -1
  288. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-response-sample.js +0 -1
  289. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/replay-openapi.js +0 -1
  290. package/dist/server/plugins/markdown/markdoc/helpers/get-inner-text.js +0 -2
  291. package/dist/server/plugins/markdown/markdoc/helpers/get-variable.js +0 -1
  292. package/dist/server/plugins/markdown/markdoc/hooks/use-store.js +0 -1
  293. package/dist/server/plugins/markdown/markdoc/nodes/fence/index.js +0 -1
  294. package/dist/server/plugins/markdown/markdoc/nodes/heading.js +0 -1
  295. package/dist/server/plugins/markdown/markdoc/tags/json-example.d.ts +0 -3
  296. package/dist/server/plugins/markdown/markdoc/tags/json-schema.d.ts +0 -3
  297. package/dist/server/plugins/markdown/markdoc/tags/openapi-code-sample.d.ts +0 -3
  298. package/dist/server/plugins/markdown/markdoc/tags/openapi-example.d.ts +0 -3
  299. package/dist/server/plugins/markdown/markdoc/tags/openapi-response-sample.d.ts +0 -3
  300. package/dist/server/plugins/markdown/markdoc/tags/replay-openapi.d.ts +0 -3
  301. package/dist/server/plugins/openapi-docs/template/helpers.js +0 -5
  302. package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.d.ts +0 -6
  303. package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.js +0 -1
  304. /package/dist/cli/{prepare → build}/analytics/collect-analytics.d.ts +0 -0
  305. /package/dist/cli/{prepare → build}/analytics/collect-analytics.js +0 -0
  306. /package/dist/cli/{prepare → build}/analytics/collectors/get-api-functions-usage.d.ts +0 -0
  307. /package/dist/cli/{prepare → build}/analytics/collectors/get-api-functions-usage.js +0 -0
  308. /package/dist/cli/{prepare → build}/analytics/collectors/get-async-api-usage.d.ts +0 -0
  309. /package/dist/cli/{prepare → build}/analytics/collectors/get-async-api-usage.js +0 -0
  310. /package/dist/cli/{prepare → build}/analytics/collectors/get-config-stats-usage.d.ts +0 -0
  311. /package/dist/cli/{prepare → build}/analytics/collectors/get-config-stats-usage.js +0 -0
  312. /package/dist/cli/{prepare → build}/analytics/collectors/get-file-extensions-usage.d.ts +0 -0
  313. /package/dist/cli/{prepare → build}/analytics/collectors/get-file-extensions-usage.js +0 -0
  314. /package/dist/cli/{prepare → build}/analytics/collectors/get-frontmatter-usage.d.ts +0 -0
  315. /package/dist/cli/{prepare → build}/analytics/collectors/get-frontmatter-usage.js +0 -0
  316. /package/dist/cli/{prepare → build}/analytics/collectors/get-markdoc-usage.d.ts +0 -0
  317. /package/dist/cli/{prepare → build}/analytics/collectors/get-markdoc-usage.js +0 -0
  318. /package/dist/cli/{prepare → build}/analytics/collectors/get-nested-configs-usage.d.ts +0 -0
  319. /package/dist/cli/{prepare → build}/analytics/collectors/get-nested-configs-usage.js +0 -0
  320. /package/dist/cli/{prepare → build}/analytics/collectors/get-processed-config-stats-usage.d.ts +0 -0
  321. /package/dist/cli/{prepare → build}/analytics/collectors/get-processed-config-stats-usage.js +0 -0
  322. /package/dist/cli/{prepare → build}/analytics/collectors/get-refs-usage.d.ts +0 -0
  323. /package/dist/cli/{prepare → build}/analytics/collectors/get-refs-usage.js +0 -0
  324. /package/dist/cli/{prepare → build}/analytics/collectors/get-theme-folder-usage.d.ts +0 -0
  325. /package/dist/cli/{prepare → build}/analytics/collectors/get-theme-folder-usage.js +0 -0
  326. /package/dist/cli/{prepare → build}/copy-env-files.d.ts +0 -0
  327. /package/dist/cli/{prepare → build}/libsql/copy-prebuilt-binary.d.ts +0 -0
  328. /package/dist/cli/{prepare → build}/libsql/copy-prebuilt-binary.js +0 -0
  329. /package/dist/cli/{prepare → build}/libsql/get-current-platform.d.ts +0 -0
  330. /package/dist/cli/{prepare → build}/libsql/get-current-platform.js +0 -0
  331. /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.d.ts +0 -0
  332. /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.js +0 -0
  333. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/html-script.d.ts +0 -0
  334. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.d.ts +0 -0
  335. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.js +0 -0
  336. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.d.ts +0 -0
  337. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.js +0 -0
  338. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.d.ts +0 -0
  339. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.js +0 -0
  340. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.d.ts +0 -0
  341. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.js +0 -0
  342. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.d.ts +0 -0
  343. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.js +0 -0
  344. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.d.ts +0 -0
  345. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.js +0 -0
  346. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.d.ts +0 -0
  347. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.js +0 -0
  348. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.d.ts +0 -0
  349. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.js +0 -0
  350. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.d.ts +0 -0
  351. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.js +0 -0
  352. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.d.ts +0 -0
  353. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.js +0 -0
  354. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.d.ts +0 -0
  355. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.js +0 -0
  356. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.d.ts +0 -0
  357. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.js +0 -0
  358. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.d.ts +0 -0
  359. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.js +0 -0
  360. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-code-sample.d.ts +0 -0
  361. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.d.ts +0 -0
  362. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.js +0 -0
  363. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-response-sample.d.ts +0 -0
  364. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/replay-openapi.d.ts +0 -0
  365. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.d.ts +0 -0
  366. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.js +0 -0
  367. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.d.ts +0 -0
  368. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.js +0 -0
  369. /package/dist/{server/plugins/markdown → client/app}/markdoc/hooks/use-store.d.ts +0 -0
  370. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/helpers.d.ts +0 -0
  371. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.d.ts +0 -0
  372. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.js +0 -0
  373. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.d.ts +0 -0
  374. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.js +0 -0
  375. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.d.ts +0 -0
  376. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.js +0 -0
  377. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.d.ts +0 -0
  378. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.js +0 -0
  379. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.d.ts +0 -0
  380. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.js +0 -0
  381. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.d.ts +0 -0
  382. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.js +0 -0
  383. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.d.ts +0 -0
  384. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.js +0 -0
  385. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.d.ts +0 -0
  386. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.js +0 -0
  387. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.d.ts +0 -0
  388. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.js +0 -0
  389. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.d.ts +0 -0
  390. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.js +0 -0
  391. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.d.ts +0 -0
  392. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.js +0 -0
  393. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.d.ts +0 -0
  394. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.js +0 -0
  395. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.d.ts +0 -0
  396. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.js +0 -0
  397. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.d.ts +0 -0
  398. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.js +0 -0
  399. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.d.ts +0 -0
  400. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.js +0 -0
  401. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.d.ts +0 -0
  402. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.js +0 -0
  403. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.d.ts +0 -0
  404. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.js +0 -0
  405. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.d.ts +0 -0
  406. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.js +0 -0
  407. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.d.ts +0 -0
  408. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.js +0 -0
  409. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.d.ts +0 -0
  410. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.js +0 -0
  411. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.d.ts +0 -0
  412. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.js +0 -0
  413. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.d.ts +0 -0
  414. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.js +0 -0
  415. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.d.ts +0 -0
  416. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.js +0 -0
  417. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.d.ts +0 -0
  418. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.js +0 -0
  419. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.d.ts +0 -0
  420. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.js +0 -0
  421. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/index.d.ts +0 -0
  422. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.d.ts +0 -0
  423. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.js +0 -0
  424. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/heading.d.ts +0 -0
  425. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.d.ts +0 -0
  426. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.js +0 -0
  427. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.d.ts +0 -0
  428. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.js +0 -0
  429. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.d.ts +0 -0
  430. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.js +0 -0
  431. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.js +0 -0
  432. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-example.js +0 -0
  433. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-schema.js +0 -0
  434. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-code-sample.js +0 -0
  435. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-example.js +0 -0
  436. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-response-sample.js +0 -0
  437. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/replay-openapi.js +0 -0
  438. /package/dist/{config → server/config}/env-config.d.ts +0 -0
  439. /package/dist/{config → server/config}/env-schema.js +0 -0
  440. /package/dist/{config → server/config}/env-schemas/api-urls.d.ts +0 -0
  441. /package/dist/{config → server/config}/env-schemas/api-urls.js +0 -0
  442. /package/dist/{config → server/config}/env-schemas/auth.d.ts +0 -0
  443. /package/dist/{config → server/config}/env-schemas/auth.js +0 -0
  444. /package/dist/{config → server/config}/env-schemas/catalog.d.ts +0 -0
  445. /package/dist/{config → server/config}/env-schemas/catalog.js +0 -0
  446. /package/dist/{config → server/config}/env-schemas/environment-detection.js +0 -0
  447. /package/dist/{config → server/config}/env-schemas/feature-flags.d.ts +0 -0
  448. /package/dist/{config → server/config}/env-schemas/feature-flags.js +0 -0
  449. /package/dist/{config → server/config}/env-schemas/scorecards.d.ts +0 -0
  450. /package/dist/{config → server/config}/env-schemas/scorecards.js +0 -0
  451. /package/dist/{config → server/config}/env-schemas/server-config.d.ts +0 -0
  452. /package/dist/{config → server/config}/env-schemas/server-config.js +0 -0
  453. /package/dist/{config → server/config}/env-schemas/site.d.ts +0 -0
  454. /package/dist/{config → server/config}/env-schemas/site.js +0 -0
  455. /package/dist/{config → server/config}/env-schemas/ssr.d.ts +0 -0
  456. /package/dist/{config → server/config}/env-schemas/ssr.js +0 -0
  457. /package/dist/{config → server/config}/env-schemas/telemetry.d.ts +0 -0
  458. /package/dist/{config → server/config}/env-schemas/telemetry.js +0 -0
  459. /package/dist/{config → server/config}/env-schemas/test.d.ts +0 -0
  460. /package/dist/{config → server/config}/env-schemas/test.js +0 -0
  461. /package/dist/server/{config → external-plugins}/resolve-module.d.ts +0 -0
  462. /package/dist/server/{config → external-plugins}/resolve-module.js +0 -0
  463. /package/dist/{server/utils → utils}/conflict-resolvers.d.ts +0 -0
  464. /package/dist/{server/utils → utils}/conflict-resolvers.js +0 -0
  465. /package/dist/{server/utils → utils}/slugger.js +0 -0
@@ -1,3 +1,3 @@
1
- import{context as m}from"esbuild";import{mkdirSync as j,writeFileSync as b,existsSync as M}from"node:fs";import*as a from"node:path";import{RUNTIME_RESOURCES_DIR as Y,TELEMETRY_ENABLED as k}from"../constants/common.js";import{fromCurrentDir as r}from"../utils/paths.js";import{NodeBrowserPlugin as P}from"./plugins/node-browser.js";import{PortalImport as l}from"./plugins/portal-import.js";import{ThemesResolver as u}from"./plugins/themes-resolver.js";import{AssetsResolver as E}from"./plugins/assets-resolver.js";import{EsbuildErrorCollector as _}from"./plugins/esbuild-compile-resolver.js";import{OpenapiDocsModuleReplacer as R}from"./plugins/openapi-docs-module-replacer/index.js";import{ServerPropsResolver as f}from"./plugins/server-props-resolver.js";import{StyledComponentsSSR as v}from"./plugins/styled-components-ssr.js";import{DependencyResolver as d}from"./plugins/dependency-resolver.js";import{YamlLoader as D}from"./plugins/yaml-loader.js";import{ApiRequestHandlersResolver as S}from"./plugins/api-request-handlers-resolver.js";import{MiddlewareResolver as A}from"./plugins/middleware-resolver.js";import{OnRebuild as N}from"./plugins/on-rebuild.js";import{getPublicEnvVariables as V}from"../utils/envs/get-public-env-variables.js";import{PORTAL_VERSION as I}from"../version.js";import{AsyncApiPatch as L}from"./plugins/async-api-patch.js";import{telemetryTraceStep as T}from"../../cli/telemetry/helpers/trace-step.js";const O={bundle:!0,format:"esm",chunkNames:"chunks/[name]-[hash]"};function C(e){const o=a.join(e,"tsconfig.json");return M(o)?o:void 0}const p=new Set;async function ie(){await Promise.all([...p].map(e=>e.dispose())),p.clear()}async function ce(e,o,t="production",n){return await T("build.create_client_compiler",async()=>{const c=V(),i={};Object.entries(c).map(([g,h])=>i[`process.env.${g}`]=JSON.stringify(h));const s=[...n?[N(n)]:[],P({path:"path-browserify",fs:"{}",tty:"tty-browserify",os:"os-browserify",http:"stream-http",https:"stream-http",readline:"{}",crypto:"{}",stream:"{}",zlib:"{}","https-proxy-agent":"{}"}),u(e,e.contentDir),E(e,e.contentDir),_(e,e.contentDir),f(e),d(),l(),D(),L(),v(),R()],w=[r(import.meta.url,"../../client/browser-entry.js"),r(import.meta.url,"../../client/user-tags-entry.js")],y=await m({...O,entryPoints:w,outdir:a.join(o,Y),sourcemap:t!=="production"&&process.env.ENABLE_SOURCE_MAPS==="true",plugins:s,tsconfig:C(e.contentDir),mainFields:["browser","module","main"],metafile:t!=="production",minify:t==="production",splitting:!0,external:["constants","zlib","stream","https","vm","module","worker_threads","child_process","@swc/core"],inject:[process.env.INSPECT_MODE==="true"?r(import.meta.url,"../../client/inspect-mode-hooks.js"):"",r(import.meta.url,"./web-shim.js")].filter(Boolean),define:{...i,"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`,"process.env.SERVER_EDITOR_APP_URL":`"${process.env.SERVER_EDITOR_APP_URL}"`,"process.env.ENABLE_COMMENTS":`"${process.env.ENABLE_COMMENTS}"`,"process.env.REDOCLY_TELEMETRY":k?'""':'"off"',"process.env.REDOCLY_PORTAL_VERSION":`"${I}"`,"process.env":`{"NODE_ENV": "${t}"}`,"process.platform":'"browser"',"process.browser":"true","module.hot":"false",global:"{}",...process.env.REDOCLY_PREFIX_PATHS&&{"process.env.REDOCLY_PREFIX_PATHS":`"${process.env.REDOCLY_PREFIX_PATHS}"`},...process.env.INSPECT_MODE==="true"&&{"process.env.INSPECT_MODE":`${process.env.INSPECT_MODE}`},...process.env.MAIN_API_URL&&{"process.env.MAIN_API_URL":`"${process.env.MAIN_API_URL}"`}},logLevel:"silent"});return p.add(y),y})}async function pe(e,o,t="development",n){j(o,{recursive:!0}),b(a.join(o,"package.json"),JSON.stringify({name:"@redocly/portal/server-cache",type:"module"}));const c=[...n?[N(n)]:[],u(e,e.contentDir),E(e,e.contentDir),_(e,e.contentDir),f(e),S(e),A(e),d(),l(),D(),L(),v(),R()],i=[r(import.meta.url,"../../client/server-entry.js"),r(import.meta.url,"../../client/user-tags-entry.js"),r(import.meta.url,"../../client/server-props-entry.js"),r(import.meta.url,"../../client/api-request-handlers-entry.js"),r(import.meta.url,"../../client/middleware-entry.js")],s=await m({...O,entryPoints:i,outdir:o,plugins:c,sourcemap:t!=="production"&&process.env.ENABLE_SOURCE_MAPS==="true",minify:t==="production",tsconfig:C(e.contentDir),mainFields:["module","main"],splitting:!0,external:["react","react-router-dom","@dr.pogodin/react-helmet","@swc/core","pnpapi","canvas"],banner:{js:`import { createRequire as topLevelCreateRequire } from 'module';
1
+ import{context as m}from"esbuild";import{mkdirSync as j,writeFileSync as b,existsSync as M}from"node:fs";import*as a from"node:path";import{RUNTIME_RESOURCES_DIR as Y,TELEMETRY_ENABLED as k}from"../constants/common.js";import{fromCurrentDir as r}from"../utils/paths.js";import{NodeBrowserPlugin as P}from"./plugins/node-browser.js";import{PortalImport as l}from"./plugins/portal-import.js";import{ThemesResolver as u}from"./plugins/themes-resolver.js";import{AssetsResolver as E}from"./plugins/assets-resolver.js";import{EsbuildErrorCollector as _}from"./plugins/esbuild-compile-resolver.js";import{OpenapiDocsModuleReplacer as R}from"./plugins/openapi-docs-module-replacer/index.js";import{ServerPropsResolver as f}from"./plugins/server-props-resolver.js";import{StyledComponentsSSR as v}from"./plugins/styled-components-ssr.js";import{DependencyResolver as d}from"./plugins/dependency-resolver.js";import{YamlLoader as D}from"./plugins/yaml-loader.js";import{ApiRequestHandlersResolver as S}from"./plugins/api-request-handlers-resolver.js";import{MiddlewareResolver as A}from"./plugins/middleware-resolver.js";import{OnRebuild as N}from"./plugins/on-rebuild.js";import{getPublicEnvVariables as V}from"../utils/envs/get-public-env-variables.js";import{PORTAL_VERSION as I}from"../version.js";import{AsyncApiPatch as L}from"./plugins/async-api-patch.js";import{telemetryTraceStep as T}from"../../cli/telemetry/helpers/trace-step.js";const O={bundle:!0,format:"esm",chunkNames:"chunks/[name]-[hash]"};function C(e){const o=a.join(e,"tsconfig.json");return M(o)?o:void 0}const p=new Set;async function ie(){await Promise.all([...p].map(e=>e.dispose())),p.clear()}async function ce(e,o,t="production",n){return await T("build.create_client_compiler",async()=>{const c=V(),i={};Object.entries(c).map(([g,h])=>i[`process.env.${g}`]=JSON.stringify(h));const s=[...n?[N(n)]:[],P({path:"path-browserify",fs:"{}",tty:"tty-browserify",os:"os-browserify",http:"stream-http",https:"stream-http",readline:"{}",crypto:"{}",stream:"{}",zlib:"{}","https-proxy-agent":"{}"}),u(e,e.contentDir),E(e,e.contentDir),_(e,e.contentDir),f(e),d(),l(),D(),L(),v(),R()],w=[r(import.meta.url,"../../client/browser-entry.js"),r(import.meta.url,"../../client/user-tags-entry.js")],y=await m({...O,entryPoints:w,outdir:a.join(o,Y),sourcemap:t!=="production"&&process.env.ENABLE_SOURCE_MAPS==="true",plugins:s,tsconfig:C(e.contentDir),mainFields:["browser","module","main"],metafile:t!=="production",minify:t==="production",splitting:!0,external:["constants","zlib","stream","https","vm","module","worker_threads","child_process","@swc/core"],inject:[process.env.INSPECT_MODE==="true"?r(import.meta.url,"../../client/inspect-mode-hooks.js"):"",r(import.meta.url,"./web-shim.js")].filter(Boolean),define:{...i,"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`,"process.env.SERVER_EDITOR_APP_URL":`"${process.env.SERVER_EDITOR_APP_URL}"`,"process.env.ENABLE_COMMENTS":`"${process.env.ENABLE_COMMENTS}"`,"process.env.REDOCLY_TELEMETRY":k?'"on"':'"off"',"process.env.REDOCLY_PORTAL_VERSION":`"${I}"`,"process.env":`{"NODE_ENV": "${t}"}`,"process.platform":'"browser"',"process.browser":"true","module.hot":"false",global:"{}",...process.env.REDOCLY_PREFIX_PATHS&&{"process.env.REDOCLY_PREFIX_PATHS":`"${process.env.REDOCLY_PREFIX_PATHS}"`},...process.env.INSPECT_MODE==="true"&&{"process.env.INSPECT_MODE":`${process.env.INSPECT_MODE}`},...process.env.MAIN_API_URL&&{"process.env.MAIN_API_URL":`"${process.env.MAIN_API_URL}"`}},logLevel:"silent"});return p.add(y),y})}async function pe(e,o,t="development",n){j(o,{recursive:!0}),b(a.join(o,"package.json"),JSON.stringify({name:"@redocly/portal/server-cache",type:"module"}));const c=[...n?[N(n)]:[],u(e,e.contentDir),E(e,e.contentDir),_(e,e.contentDir),f(e),S(e),A(e),d(),l(),D(),L(),v(),R()],i=[r(import.meta.url,"../../client/server-entry.js"),r(import.meta.url,"../../client/user-tags-entry.js"),r(import.meta.url,"../../client/server-props-entry.js"),r(import.meta.url,"../../client/api-request-handlers-entry.js"),r(import.meta.url,"../../client/middleware-entry.js")],s=await m({...O,entryPoints:i,outdir:o,plugins:c,sourcemap:t!=="production"&&process.env.ENABLE_SOURCE_MAPS==="true",minify:t==="production",tsconfig:C(e.contentDir),mainFields:["module","main"],splitting:!0,external:["react","react-router-dom","@dr.pogodin/react-helmet","@swc/core","pnpapi","canvas"],banner:{js:`import { createRequire as topLevelCreateRequire } from 'module';
2
2
  const require = topLevelCreateRequire(import.meta.url);`},platform:"node",define:{"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`,"module.hot":"false"},logLevel:"silent"});return p.add(s),s}async function me(e,o,t="production",n){return await T("build.create_server_compiler",async()=>{const c=[...n?[N(n)]:[],P({"node-fetch":"{}",webpack:"{}",swagger2openapi:"{}"}),u(e,e.contentDir),E(e,e.contentDir),_(e,e.contentDir),f(e),S(e),A(e),d(),l(),D(),L(),v(),R()],i=[{in:r(import.meta.url,"../node-bundle-entry.js"),out:"index"},{in:r(import.meta.url,"../../client/user-tags-entry.js"),out:"user-tags-entry"},{in:r(import.meta.url,"../workers/api-routes-worker.js"),out:"api-routes-worker"},{in:r(import.meta.url,"../workers/scorecards-worker.js"),out:"scorecards-worker"},{in:r(import.meta.url,"../workers/mcp-tool-worker.js"),out:"mcp-tool-worker"}],s=await m({...O,entryPoints:i,outExtension:{".js":".mjs"},outdir:o,platform:"node",plugins:c,tsconfig:C(e.contentDir),mainFields:["module","main"],metafile:t!=="production",minify:t==="production",splitting:!1,define:{"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`,"process.env.REDOCLY_EXECUTION_MODE":'"runtime"',"process.env.REDOCLY_PORTAL_VERSION":`"${I}"`,"module.hot":"false",...process.env.REDOCLY_PREFIX_PATHS&&{"process.env.REDOCLY_PREFIX_PATHS":`"${process.env.REDOCLY_PREFIX_PATHS}"`}},banner:{js:`import { createRequire as topLevelCreateRequire } from 'module';
3
3
  const require = topLevelCreateRequire(import.meta.url);`},logLevel:"silent"});return p.add(s),s})}export{ce as createClientCompiler,me as createNodeBundleCompiler,pe as createServerCompiler,ie as stopAllCompilers};
@@ -1 +1 @@
1
- import*as i from"path";import{existsSync as d,readFileSync as v}from"fs";import{USER_THEME_ALIAS as w}from"../../../constants/common.js";import{setMapValue as m}from"../../../utils/collection/set-map-value.js";import{isLocalLink as S}from"../../../utils/path/is-local-link.js";import{reporter as E}from"../../tools/notifiers/reporter.js";import{envConfig as P}from"../../../config/env-config.js";import{copyStaticFile as x}from"../../utils/index.js";import{reportEsbuildError as y}from"../esbuild-logger.js";const f=/\.(gif|jpe?g|tiff?|png|webp|bmp|eot|otf|woff|woff2|ttf|pdf|svg|mp4|webm)$/i,A=["require-call","dynamic-import"],L=(u,n)=>{const l=i.resolve(n,w),t=new Map,r=new Map;return{name:"esbuild-redocly-custom-assets-resolver",setup:a=>{a.onStart(()=>{r.clear(),E.clearEsbuildProblems()}),a.onResolve({filter:f},async e=>{if(!S(e.path))return{external:!0};const o=i.resolve(e.resolveDir,e.path);if(!d(o)){if(P.isDevelopMode&&!A.includes(e.kind)){r.has(e.importer)||r.set(e.importer,v(e.importer,"utf-8"));const p=r.get(e.importer),h=i.relative(n,e.importer);return y(`Could not resolve asset: ${e.path}`,h,p,{lineText:e.path}),{external:!0}}return}const s=e.kind+":"+o;if(t.has(s))return t.get(s);const c=await x(e.resolveDir,o,u.outdir);if(e.kind==="url-token")return m(t,s,{external:!0,path:c,watchDirs:[l]});{const p=i.relative(n,o);return m(t,s,{namespace:"assets-ns",path:p,pluginData:{assetPath:c},watchDirs:[l]})}}),a.onLoad({filter:f,namespace:"assets-ns"},({pluginData:e})=>({contents:e.assetPath,loader:"text"}))}}};export{L as AssetsResolver};
1
+ import*as i from"path";import{existsSync as d,readFileSync as v}from"fs";import{USER_THEME_ALIAS as w}from"../../../constants/common.js";import{setMapValue as m}from"../../../utils/collection/set-map-value.js";import{isLocalLink as S}from"../../../utils/path/is-local-link.js";import{reporter as E}from"../../tools/notifiers/reporter.js";import{envConfig as P}from"../../config/env-config.js";import{copyStaticFile as x}from"../../utils/index.js";import{reportEsbuildError as y}from"../esbuild-logger.js";const f=/\.(gif|jpe?g|tiff?|png|webp|bmp|eot|otf|woff|woff2|ttf|pdf|svg|mp4|webm)$/i,A=["require-call","dynamic-import"],L=(u,n)=>{const l=i.resolve(n,w),t=new Map,r=new Map;return{name:"esbuild-redocly-custom-assets-resolver",setup:a=>{a.onStart(()=>{r.clear(),E.clearEsbuildProblems()}),a.onResolve({filter:f},async e=>{if(!S(e.path))return{external:!0};const o=i.resolve(e.resolveDir,e.path);if(!d(o)){if(P.isDevelopMode&&!A.includes(e.kind)){r.has(e.importer)||r.set(e.importer,v(e.importer,"utf-8"));const p=r.get(e.importer),h=i.relative(n,e.importer);return y(`Could not resolve asset: ${e.path}`,h,p,{lineText:e.path}),{external:!0}}return}const s=e.kind+":"+o;if(t.has(s))return t.get(s);const c=await x(e.resolveDir,o,u.outdir);if(e.kind==="url-token")return m(t,s,{external:!0,path:c,watchDirs:[l]});{const p=i.relative(n,o);return m(t,s,{namespace:"assets-ns",path:p,pluginData:{assetPath:c},watchDirs:[l]})}}),a.onLoad({filter:f,namespace:"assets-ns"},({pluginData:e})=>({contents:e.assetPath,loader:"text"}))}}};export{L as AssetsResolver};
@@ -1 +1 @@
1
- import{relative as p,resolve as d}from"node:path";import{readFileSync as E}from"node:fs";import{envConfig as b}from"../../../config/env-config.js";import{reportEsbuildError as c}from"../esbuild-logger.js";import{babelCache as h}from"../babel-cache.js";const M=(i,r)=>({name:"esbuild-error-collector",setup:a=>{a.onEnd(l=>{if(!b.isDevelopMode)return;const m=l.errors.map(o=>{const e=o?.location?.file||"",t=p(r,e),f=E(e,"utf8"),n=c(o.text,t,f,o?.location);if(!n?.hasMatched){const u=d(r,t),s=h.get(u)?.contents;if(s)return c(o.text,t,s,o?.location)}return n});i.compilationErrors=m})}});export{M as EsbuildErrorCollector};
1
+ import{relative as p,resolve as d}from"node:path";import{readFileSync as E}from"node:fs";import{envConfig as b}from"../../config/env-config.js";import{reportEsbuildError as c}from"../esbuild-logger.js";import{babelCache as h}from"../babel-cache.js";const M=(i,r)=>({name:"esbuild-error-collector",setup:a=>{a.onEnd(l=>{if(!b.isDevelopMode)return;const m=l.errors.map(o=>{const e=o?.location?.file||"",t=p(r,e),f=E(e,"utf8"),n=c(o.text,t,f,o?.location);if(!n?.hasMatched){const u=d(r,t),s=h.get(u)?.contents;if(s)return c(o.text,t,s,o?.location)}return n});i.compilationErrors=m})}});export{M as EsbuildErrorCollector};
@@ -1 +1 @@
1
- import f from"@babel/core";import h from"node:fs";import r from"node:path";import d from"babel-plugin-styled-components";import u from"crypto";import{envConfig as m}from"../../../config/env-config.js";import{babelCache as i}from"../babel-cache.js";const A=()=>({name:"styled-components-ssr",setup:c=>{const l=process.cwd();c.onLoad({filter:/\.[tj]sx?$/},async t=>{if(new RegExp(`${r.sep}replay-[A-Za-z0-9_-]+.js$`).test(t.path)||t.path.endsWith(`${r.sep}replay.js`)||t.path.includes(`${r.sep}replay-index-`)&&t.path.endsWith(".js")||t.path.includes(`${r.sep}replay-tauri-path-`)&&t.path.endsWith(".js"))return;let e=t.path.split(".").pop();const s=i.get(t.path);if(s&&t.path.includes("/node_modules/"))return{contents:s.contents,loader:e};let p=["importMeta","topLevelAwait","classProperties","classPrivateProperties","classPrivateMethods","jsx"];(e==="tsx"||e==="ts")&&p.push("typescript");let o=await h.promises.readFile(t.path,"utf8");if(o.indexOf("styled-components")===-1)return{contents:o,loader:e};const a=u.createHash("sha1").update(o).digest("base64");if(s&&s.hash===a)return{contents:s.contents,loader:e};try{const n=(await f.transformAsync(o,{babelrc:!1,configFile:!1,ast:!1,root:l,filename:t.path,parserOpts:{allowAwaitOutsideFunction:!0,plugins:p},generatorOpts:{decoratorsBeforeExport:!0},plugins:[d],sourceMaps:!1}))?.code||void 0;return i.set(t.path,{contents:n,hash:a}),{contents:n,loader:e}}catch(n){if(!m.isDevelopMode)throw n;return{contents:o,loader:e}}})}});export{A as StyledComponentsSSR};
1
+ import f from"@babel/core";import h from"node:fs";import r from"node:path";import d from"babel-plugin-styled-components";import u from"crypto";import{envConfig as m}from"../../config/env-config.js";import{babelCache as i}from"../babel-cache.js";const A=()=>({name:"styled-components-ssr",setup:c=>{const l=process.cwd();c.onLoad({filter:/\.[tj]sx?$/},async t=>{if(new RegExp(`${r.sep}replay-[A-Za-z0-9_-]+.js$`).test(t.path)||t.path.endsWith(`${r.sep}replay.js`)||t.path.includes(`${r.sep}replay-index-`)&&t.path.endsWith(".js")||t.path.includes(`${r.sep}replay-tauri-path-`)&&t.path.endsWith(".js"))return;let e=t.path.split(".").pop();const s=i.get(t.path);if(s&&t.path.includes("/node_modules/"))return{contents:s.contents,loader:e};let p=["importMeta","topLevelAwait","classProperties","classPrivateProperties","classPrivateMethods","jsx"];(e==="tsx"||e==="ts")&&p.push("typescript");let o=await h.promises.readFile(t.path,"utf8");if(o.indexOf("styled-components")===-1)return{contents:o,loader:e};const a=u.createHash("sha1").update(o).digest("base64");if(s&&s.hash===a)return{contents:s.contents,loader:e};try{const n=(await f.transformAsync(o,{babelrc:!1,configFile:!1,ast:!1,root:l,filename:t.path,parserOpts:{allowAwaitOutsideFunction:!0,plugins:p},generatorOpts:{decoratorsBeforeExport:!0},plugins:[d],sourceMaps:!1}))?.code||void 0;return i.set(t.path,{contents:n,hash:a}),{contents:n,loader:e}}catch(n){if(!m.isDevelopMode)throw n;return{contents:o,loader:e}}})}});export{A as StyledComponentsSSR};
@@ -1,2 +1,2 @@
1
- import*as c from"node:path";import{CONFIG_FILE_NAME as x}from"../../../constants/common.js";import{DEFAULT_THEME_NAME as D,USER_THEME_ALIAS as v}from"../../../constants/common.js";import{isDefined as u}from"../../../utils/guards/is-defined.js";import{slash as M}from"../../../utils/path/slash.js";import{resolvePlugins as p}from"../../config/external-plugins.js";import{generateMarkdocComponentsEntry as R,generateMarkdocSchemasEntry as T}from"./codegen/index.js";const d=new Map,N=(a,n)=>{const h=c.resolve(n,v),i=c.resolve(n,x),k=["components","core","layouts","markdoc","icons","config","ext"],w="@redocly\\/theme\\/",F=k.map(t=>`${w}${t}`).join("|"),E=new RegExp(`^(@redocly/theme$|${F})`);return{name:"esbuild-redocly-custom-themes-resolver",setup:t=>{t.onResolve({filter:/@redocly-markdoc\/schema/},async e=>{const s=(await p(n,a.config.plugins)).flatMap(r=>r.markdoc?.schemaFile).filter(u);return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...s,i],watchDirs:[c.resolve(h,"markdoc")],pluginData:{schemaFiles:s}}}),t.onLoad({filter:/@redocly-markdoc\/schema/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:T(e),resolveDir:"/",loader:"ts"})),t.onResolve({filter:/@redocly-markdoc\/components/},async e=>{const s=[...(await p(n,a.config.plugins)).map(r=>r.markdoc?.componentsFile).filter(u)];return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...s,i],pluginData:{componentsFiles:s},watchDirs:[c.resolve(h,"markdoc")]}}),t.onLoad({filter:/@redocly-markdoc\/components/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:R(e),resolveDir:"/",loader:"ts"})),t.onResolve({filter:/@styles/},async e=>{const s=(await p(n,a.config.plugins)).map(r=>r.stylesFile).filter(Boolean);return{namespace:"user-styles-ns",path:e.path,watchFiles:[...s,i],pluginData:{styleFiles:s},watchDirs:[h]}}),t.onLoad({filter:/@styles/,namespace:"user-styles-ns"},async({pluginData:e})=>{const{styleFiles:o}=e;return{contents:o.map(r=>`@import url("${M(c.relative(n,r))}");`).join(`
2
- `),loader:"css",resolveDir:n}}),t.onResolve({filter:/(^|\/)styles\.css$/},async({path:e,...o})=>{if(o.pluginData==="missing-styles-ns")return;const s=await t.resolve(e,{...o,pluginData:"missing-styles-ns"});return s.errors.length&&s.errors.some(r=>r.text.match(/^Could not resolve .*?\bstyles.css\b/))?{namespace:"missing-styles-ns",path:e}:s}),t.onLoad({filter:/(^|\/)styles\.css$/,namespace:"missing-styles-ns"},async()=>({contents:"",loader:"css"})),t.onResolve({filter:E},async e=>{if(e.resolveDir==="")return;const o=`${e.path}:${e.importer}`;if(d.has(o))return d.get(o);const{path:s,...r}=e,l=await p(n,a.config.plugins),f=e.path.replace(D,"")||"index";for(let m=l.length-1;m>=0;m--){const $=l[m].isNpmPackage?[c.join(l[m].name,"src",f),{...r,resolveDir:n}]:[`./${f}`,{...r,resolveDir:l[m].pluginDirAbsolutePath}],y=A(await t.resolve(...$));if("path"in y&&y.path!==e.importer){const g={...y,watchFiles:[i,c.join(n,v,f+".tsx")]};return l[m].name===v||d.set(o,g),g}}})}}};function A(a){return a.errors.length?{errors:a.errors}:a}export{N as ThemesResolver,d as resolveCache};
1
+ import*as c from"node:path";import{CONFIG_FILE_NAME as $}from"../../../constants/common.js";import{DEFAULT_THEME_NAME as D,USER_THEME_ALIAS as v}from"../../../constants/common.js";import{isDefined as u}from"../../../utils/guards/is-defined.js";import{slash as M}from"../../../utils/path/slash.js";import{resolveExternalPlugins as p}from"../../external-plugins/resolve-external-plugins.js";import{generateMarkdocComponentsEntry as R,generateMarkdocSchemasEntry as T}from"./codegen/index.js";const d=new Map,N=(a,n)=>{const h=c.resolve(n,v),i=c.resolve(n,$),k=["components","core","layouts","markdoc","icons","config","ext"],w="@redocly\\/theme\\/",E=k.map(t=>`${w}${t}`).join("|"),F=new RegExp(`^(@redocly/theme$|${E})`);return{name:"esbuild-redocly-custom-themes-resolver",setup:t=>{t.onResolve({filter:/@redocly-markdoc\/schema/},async e=>{const s=(await p(n,a.config.plugins)).flatMap(r=>r.markdoc?.schemaFile).filter(u);return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...s,i],watchDirs:[c.resolve(h,"markdoc")],pluginData:{schemaFiles:s}}}),t.onLoad({filter:/@redocly-markdoc\/schema/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:T(e),resolveDir:"/",loader:"ts"})),t.onResolve({filter:/@redocly-markdoc\/components/},async e=>{const s=[...(await p(n,a.config.plugins)).map(r=>r.markdoc?.componentsFile).filter(u)];return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...s,i],pluginData:{componentsFiles:s},watchDirs:[c.resolve(h,"markdoc")]}}),t.onLoad({filter:/@redocly-markdoc\/components/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:R(e),resolveDir:"/",loader:"ts"})),t.onResolve({filter:/@styles/},async e=>{const s=(await p(n,a.config.plugins)).map(r=>r.stylesFile).filter(Boolean);return{namespace:"user-styles-ns",path:e.path,watchFiles:[...s,i],pluginData:{styleFiles:s},watchDirs:[h]}}),t.onLoad({filter:/@styles/,namespace:"user-styles-ns"},async({pluginData:e})=>{const{styleFiles:o}=e;return{contents:o.map(r=>`@import url("${M(c.relative(n,r))}");`).join(`
2
+ `),loader:"css",resolveDir:n}}),t.onResolve({filter:/(^|\/)styles\.css$/},async({path:e,...o})=>{if(o.pluginData==="missing-styles-ns")return;const s=await t.resolve(e,{...o,pluginData:"missing-styles-ns"});return s.errors.length&&s.errors.some(r=>r.text.match(/^Could not resolve .*?\bstyles.css\b/))?{namespace:"missing-styles-ns",path:e}:s}),t.onLoad({filter:/(^|\/)styles\.css$/,namespace:"missing-styles-ns"},async()=>({contents:"",loader:"css"})),t.onResolve({filter:F},async e=>{if(e.resolveDir==="")return;const o=`${e.path}:${e.importer}`;if(d.has(o))return d.get(o);const{path:s,...r}=e,l=await p(n,a.config.plugins),f=e.path.replace(D,"")||"index";for(let m=l.length-1;m>=0;m--){const x=l[m].isNpmPackage?[c.join(l[m].name,"src",f),{...r,resolveDir:n}]:[`./${f}`,{...r,resolveDir:l[m].pluginDirAbsolutePath}],y=A(await t.resolve(...x));if("path"in y&&y.path!==e.importer){const g={...y,watchFiles:[i,c.join(n,v,f+".tsx")]};return l[m].name===v||d.set(o,g),g}}})}}};function A(a){return a.errors.length?{errors:a.errors}:a}export{N as ThemesResolver,d as resolveCache};
@@ -16,5 +16,5 @@ export type ResolvedPlugin = {
16
16
  componentsFile: string | undefined;
17
17
  } | null;
18
18
  };
19
- export declare function resolvePlugins(contentDir: string, pluginPaths?: string[]): Promise<ResolvedPlugin[]>;
20
- //# sourceMappingURL=external-plugins.d.ts.map
19
+ export declare function resolveExternalPlugins(contentDir: string, pluginPaths?: string[]): Promise<ResolvedPlugin[]>;
20
+ //# sourceMappingURL=resolve-external-plugins.d.ts.map
@@ -1 +1 @@
1
- import{existsSync as f}from"node:fs";import n from"node:path";import{resolvePlugins as g}from"@redocly/openapi-core";import{DEFAULT_PROJECT_PLUGIN_PATHS as m,DEFAULT_THEME_PLUGIN_PATH as d,STYLES_FILE as p}from"../constants/common.js";import{GATED_PLUGINS as P}from"../constants/entitlements.js";import{isDefined as y}from"../../utils/guards/is-defined.js";import{reporter as E}from"../tools/notifiers/reporter.js";import{sha as F}from"../utils/crypto/sha.js";import{resolveModule as C}from"./resolve-module.js";import{EntitlementsProvider as D}from"../entitlements/entitlements-provider.js";const u={sha:"",value:Promise.resolve({resolvedPlugins:[],errors:[]})};async function M(e,t=[]){const r=F(JSON.stringify(t));if(u.sha!==r){u.sha=r;const s=j(e,t),l=await g(s,e)||[];if(!s.some(i=>m.includes(i))){const i=m[0],c=n.join(e,i);l.push({id:"",absolutePath:c,path:i})}u.value=Promise.all(l.map(i=>A(i))).then(i=>{const c=i.filter(y),h=c.filter(a=>a?.type&&["error","warning"].includes(a.type)),v=c.filter(a=>a.type==="resolvedPlugin");return{errors:h,resolvedPlugins:v}})}const o=await u.value;if(o.errors.length)for(let s=0;s<o.errors.length;s++)await E.panicOnBuildContentError(o.errors[s].error);return o.resolvedPlugins}function j(e,t=[]){const r=[...t];for(const o of m)!r.includes(o)&&f(n.join(e,o))&&r.push(o);return r.includes(d)||r.unshift(d),r}async function A(e){if(!e.absolutePath||!e.path)return{type:"error",error:`Plugin with path "${e}" not found`};const t=n.dirname(e.absolutePath),{lifecyclePlugin:r,config:o}=L(e);return{name:n.dirname(e.path),type:"resolvedPlugin",isNpmPackage:I(e.path),pluginDirAbsolutePath:t,lifecyclePlugin:r,config:o,stylesFile:n.resolve(t,p),markdoc:S(t)}}function I(e){const t=n.dirname(e);return C(n.join(t,"package.json"))!=null}function L(e){const t=D.instance(),r=e.path||"",o=!t.canAccessFeature("customPlugins")&&!P.includes(r),s=e.requiredEntitlements&&P.includes(r)&&!e.requiredEntitlements.every(l=>t.canAccessFeature(l));return o||s?{lifecyclePlugin:{id:e.id},config:{}}:{lifecyclePlugin:{id:e.id,processContent:e.processContent,afterRoutesCreated:e.afterRoutesCreated,loaders:e.loaders,requiredEntitlements:e.requiredEntitlements},config:{schema:e.redoclyConfigSchema,ejectIgnore:e.ejectIgnore}}}function S(e){const t=n.resolve(e,"markdoc"),r=n.join(t,"schema.ts");if(!f(r))return null;const o=n.join(t,"components.tsx");return{schemaFile:r,componentsFile:f(o)?o:void 0}}export{M as resolvePlugins};
1
+ import{existsSync as f}from"node:fs";import n from"node:path";import{resolvePlugins as g}from"@redocly/openapi-core";import{DEFAULT_PROJECT_PLUGIN_PATHS as m,DEFAULT_THEME_PLUGIN_PATH as d,STYLES_FILE as p}from"../constants/common.js";import{GATED_PLUGINS as P}from"../constants/entitlements.js";import{isDefined as y}from"../../utils/guards/is-defined.js";import{reporter as E}from"../tools/notifiers/reporter.js";import{sha as F}from"../utils/crypto/sha.js";import{resolveModule as C}from"./resolve-module.js";import{EntitlementsProvider as D}from"../entitlements/entitlements-provider.js";const u={sha:"",value:Promise.resolve({resolvedPlugins:[],errors:[]})};async function M(e,t=[]){const r=F(JSON.stringify(t));if(u.sha!==r){u.sha=r;const s=j(e,t),l=await g(s,e)||[];if(!s.some(i=>m.includes(i))){const i=m[0],a=n.join(e,i);l.push({id:"",absolutePath:a,path:i})}u.value=Promise.all(l.map(i=>A(i))).then(i=>{const a=i.filter(y),h=a.filter(c=>c?.type&&["error","warning"].includes(c.type)),v=a.filter(c=>c.type==="resolvedPlugin");return{errors:h,resolvedPlugins:v}})}const o=await u.value;if(o.errors.length)for(let s=0;s<o.errors.length;s++)await E.panicOnBuildContentError(o.errors[s].error);return o.resolvedPlugins}function j(e,t=[]){const r=[...t];for(const o of m)!r.includes(o)&&f(n.join(e,o))&&r.push(o);return r.includes(d)||r.unshift(d),r}async function A(e){if(!e.absolutePath||!e.path)return{type:"error",error:`Plugin with path "${e}" not found`};const t=n.dirname(e.absolutePath),{lifecyclePlugin:r,config:o}=L(e);return{name:n.dirname(e.path),type:"resolvedPlugin",isNpmPackage:I(e.path),pluginDirAbsolutePath:t,lifecyclePlugin:r,config:o,stylesFile:n.resolve(t,p),markdoc:S(t)}}function I(e){const t=n.dirname(e);return C(n.join(t,"package.json"))!=null}function L(e){const t=D.instance(),r=e.path||"",o=!t.canAccessFeature("customPlugins")&&!P.includes(r),s=e.requiredEntitlements&&P.includes(r)&&!e.requiredEntitlements.every(l=>t.canAccessFeature(l));return o||s?{lifecyclePlugin:{id:e.id},config:{}}:{lifecyclePlugin:{id:e.id,processContent:e.processContent,afterRoutesCreated:e.afterRoutesCreated,loaders:e.loaders,requiredEntitlements:e.requiredEntitlements},config:{schema:e.redoclyConfigSchema,ejectIgnore:e.ejectIgnore}}}function S(e){const t=n.resolve(e,"markdoc"),r=n.join(t,"schema.ts");if(!f(r))return null;const o=n.join(t,"components.tsx");return{schemaFile:r,componentsFile:f(o)?o:void 0}}export{M as resolveExternalPlugins};
@@ -1 +1 @@
1
- import{sha1 as M}from"../utils/crypto/sha1.js";import{NestedMap as F}from"./utils/nested-map.js";import{trackAccessStore as m}from"./utils/async-storage.js";import{isLoaderCacheEnabled as L}from"./utils/is-loader-cache-enabled.js";import{LoadError as w}from"./load-error.js";import{createLifecycleContext as S}from"../plugins/lifecycle.js";function f(y,t){return y+":"+t}class q{fs;errors=new Map;#t=new F;#i=new Map;#e=new Map;#s=new Map;#a=new F;#h;#o={};#n=new Map;constructor(t){this.fs=t,this.#h=S(t,this),this.#c()}async load(t,s,i){let e,r;typeof s=="string"?(e=s,r=this.#o[s]):(e=s.name,r=s.loader);const a=f(e,t);if(this.#n.has(a))return this.#n.get(a);const n=i?.join(""),h=n!==void 0?n.length>30?M(n):n:void 0,d=m.getStore()??[],I=!this.#r(t,e,h),p=this.#t.get(e,t);if(I&&p)return d.push({type:"load",loaderId:e,resource:t,hash:p.compoundHash}),p;const c=Promise.withResolvers();this.#n.set(a,c.promise),h!==void 0&&this.#e.set(a,h);const{status:P,value:l}=await this.#l(t,e,async()=>{let g;const C=m.getStore()||[],u=[],E=o=>u.push(o);try{g=await r(t,this.#h,E),u.length>0?this.errors.set(a,u):this.errors.delete(a)}catch(o){const R=this.#t.get(e,t)?.data,H=e==="redocly-config"||e==="nearest-redocly-config"?!1:(await this.load(t,"is-ignored")).data;if(!(o instanceof w)&&!H&&this.errors.set(a,[o]),!R)return{status:"error",value:o instanceof w?o:new w(o.message,{cause:o,loaderId:e})};g=R}const v=M(t+(h??"")+C.map(o=>o.hash).join(""));return d.push({type:"load",loaderId:e,resource:t,hash:v}),{status:"success",value:{data:g,compoundHash:v}}});return P==="error"?c.reject(l):(this.#d(t),L(e)&&this.#t.set(e,t,l),this.#i.set(a,l.compoundHash),c.resolve(l)),this.#n.delete(a),c.promise}setLoaders(t){this.#o={...this.#o,...t}}delete(t,s){if(s){const i=f(s,t);this.#t.delete(s,t),this.errors.delete(i),this.#i.delete(i),this.#e.delete(i);const e=this.#s.get(t);if(e){for(const r of e)this.delete(r,s);this.#s.delete(t)}this.#a.delete(s,t)}else for(const i of this.#t.keys())this.delete(t,i)}#d(t){const[s,i]=t.split("#");if(!i)return;const e=this.#s.get(s);e?e.add(t):this.#s.set(s,new Set([t]))}#c(){this.fs.watch(async t=>{for(const s of t)s.event==="unlink"&&this.delete(s.path)})}#r(t,s,i){const e=f(s,t);return i!==void 0&&this.#e.get(e)!==i?!0:(this.#a.get(s,t)??[]).some(n=>{switch(n.type){case"load":const h=f(n.loaderId,n.resource);return this.#i.get(h)!==n.hash||this.#r(n.resource,n.loaderId,this.#e.get(h));case"read":return n.hash!==this.fs.getFileInfo(n.path)?.hash;case"exists":const d=this.fs.getFileInfo(n.path);return n.hash!==(d&&!d.isVirtual?"t":"f");case"scan":return n.hash!==this.fs.getPatternScanHash(n.pattern)}})}#l(t,s,i){const e=[];return this.#a.set(s,t,e),m.run(e,i)}}export{q as Cache};
1
+ import{LRUCache as H}from"lru-cache";import{sha1 as M}from"../utils/crypto/sha1.js";import{envConfig as S}from"../config/env-config.js";import{NestedMap as x}from"./utils/nested-map.js";import{trackAccessStore as w}from"./utils/async-storage.js";import{isLoaderCacheEnabled as k}from"./utils/is-loader-cache-enabled.js";import{LoadError as v}from"./load-error.js";import{createLifecycleContext as D}from"../plugins/lifecycle.js";function f(y,t){return y+":"+t}class J{fs;errors=new Map;#t=new Map;#i=new Map;#e=new Map;#s=new Map;#a=new x;#r;#o={};#n=new Map;constructor(t){this.fs=t,this.#r=D(t,this),this.#f()}#c(t){let e=this.#t.get(t);return e||(e=new H({max:S.isBuildMode?1e3:1e6}),this.#t.set(t,e)),e}async load(t,e,i){let s,h;typeof e=="string"?(s=e,h=this.#o[e]):(s=e.name,h=e.loader);const a=f(s,t);if(this.#n.has(a))return this.#n.get(a);const n=i?.join(""),r=n!==void 0?n.length>30?M(n):n:void 0,c=w.getStore()??[],F=!this.#h(t,s,r),p=this.#c(s),g=p.get(t);if(F&&g)return c.push({type:"load",loaderId:s,resource:t,hash:g.compoundHash}),g;const d=Promise.withResolvers();this.#n.set(a,d.promise),r!==void 0&&this.#e.set(a,r);const{status:L,value:l}=await this.#p(t,s,async()=>{let m;const I=w.getStore()||[],u=[],P=o=>u.push(o);try{m=await h(t,this.#r,P),u.length>0?this.errors.set(a,u):this.errors.delete(a)}catch(o){const R=p.get(t)?.data,E=s==="redocly-config"||s==="nearest-redocly-config"?!1:(await this.load(t,"is-ignored")).data;if(!(o instanceof v)&&!E&&this.errors.set(a,[o]),!R)return{status:"error",value:o instanceof v?o:new v(o.message,{cause:o,loaderId:s})};m=R}const C=M(t+(r??"")+I.map(o=>o.hash).join(""));return c.push({type:"load",loaderId:s,resource:t,hash:C}),{status:"success",value:{data:m,compoundHash:C}}});return L==="error"?d.reject(l):(this.#l(t),k(s)&&p.set(t,l),this.#i.set(a,l.compoundHash),d.resolve(l)),this.#n.delete(a),d.promise}setLoaders(t){this.#o={...this.#o,...t}}delete(t,e){if(e){const i=f(e,t);this.#d(t,e),this.errors.delete(i),this.#i.delete(i),this.#e.delete(i);const s=this.#s.get(t);if(s){for(const h of s)this.delete(h,e);this.#s.delete(t)}this.#a.delete(e,t)}else for(const i of this.#t.keys())this.delete(t,i)}#d(t,e){const i=this.#t.get(e);i&&i.delete(t)}#l(t){const[e,i]=t.split("#");if(!i)return;const s=this.#s.get(e);s?s.add(t):this.#s.set(e,new Set([t]))}#f(){this.fs.watch(async t=>{for(const e of t)e.event==="unlink"&&this.delete(e.path)})}#h(t,e,i){const s=f(e,t);return i!==void 0&&this.#e.get(s)!==i?!0:(this.#a.get(e,t)??[]).some(n=>{switch(n.type){case"load":const r=f(n.loaderId,n.resource);return this.#i.get(r)!==n.hash||this.#h(n.resource,n.loaderId,this.#e.get(r));case"read":return n.hash!==this.fs.getFileInfo(n.path)?.hash;case"exists":const c=this.fs.getFileInfo(n.path);return n.hash!==(c&&!c.isVirtual?"t":"f");case"scan":return n.hash!==this.fs.getPatternScanHash(n.pattern)}})}#p(t,e,i){const s=[];return this.#a.set(e,t,s),w.run(s,i)}}export{J as Cache};
@@ -1 +1 @@
1
- import n from"path";import{simpleGit as r}from"simple-git";import{statSync as h}from"node:fs";import{envConfig as o}from"../../config/env-config.js";import{fastMtime as a}from"./fast-mtime.js";class p{fs;#e;#i=void 0;#t=null;#s=new Map;#n=".";constructor(t){this.fs=t,t.watch(i=>{for(const e of i)e.event!=="code-updated"&&(e.event==="unlink"?this.#s.delete(e.path):this.#s.set(e.path,new Date().toISOString()))})}#o(){return this.#e?this.#e:(this.#e=new Promise(t=>{const i=r(this.fs.cwd,{binary:"git"});i.version().then(e=>{e.installed||t(void 0),i.revparse(["--show-toplevel"]).then(s=>{this.#n=s,t(i)}).catch(()=>{t(void 0)})})}),this.#e)}async#h(){return this.#i||(this.#i=this.#o().then(t=>{if(t)return a(this.fs.cwd,t)})),this.#i}async#a(){return this.#t||(this.#t=this.#o().then(async t=>{if(!t)return new Set;try{const i=!o.isDevelopMode,e=await t?.status(i?["--untracked-files=no"]:void 0);return new Set(e?.files.map(s=>n.posix.normalize(n.relative(this.fs.cwd,n.resolve(this.#n,s.path))))??[])}catch{return new Set}}),this.#t.then(()=>{o.isDevelopMode&&setTimeout(()=>{this.#t=null},5e3)})),this.#t}#r(t){return this.#s.get(t)||h(n.resolve(this.fs.cwd,t)).mtime.toISOString()}async getLastModified(t){const i=await this.#h(),e=await this.#a();try{if(e?.has(t))return this.#r(t);const s=i?.get(t);return s||this.#r(t)}catch{return null}}}export{p as LastModifiedTracker};
1
+ import n from"path";import{simpleGit as r}from"simple-git";import{statSync as h}from"node:fs";import{envConfig as o}from"../config/env-config.js";import{fastMtime as a}from"./fast-mtime.js";class p{fs;#e;#i=void 0;#t=null;#s=new Map;#n=".";constructor(t){this.fs=t,t.watch(i=>{for(const e of i)e.event!=="code-updated"&&(e.event==="unlink"?this.#s.delete(e.path):this.#s.set(e.path,new Date().toISOString()))})}#o(){return this.#e?this.#e:(this.#e=new Promise(t=>{const i=r(this.fs.cwd,{binary:"git"});i.version().then(e=>{e.installed||t(void 0),i.revparse(["--show-toplevel"]).then(s=>{this.#n=s,t(i)}).catch(()=>{t(void 0)})})}),this.#e)}async#h(){return this.#i||(this.#i=this.#o().then(t=>{if(t)return a(this.fs.cwd,t)})),this.#i}async#a(){return this.#t||(this.#t=this.#o().then(async t=>{if(!t)return new Set;try{const i=!o.isDevelopMode,e=await t?.status(i?["--untracked-files=no"]:void 0);return new Set(e?.files.map(s=>n.posix.normalize(n.relative(this.fs.cwd,n.resolve(this.#n,s.path))))??[])}catch{return new Set}}),this.#t.then(()=>{o.isDevelopMode&&setTimeout(()=>{this.#t=null},5e3)})),this.#t}#r(t){return this.#s.get(t)||h(n.resolve(this.fs.cwd,t)).mtime.toISOString()}async getLastModified(t){const i=await this.#h(),e=await this.#a();try{if(e?.has(t))return this.#r(t);const s=i?.get(t);return s||this.#r(t)}catch{return null}}}export{p as LastModifiedTracker};
@@ -1 +1 @@
1
- import{envConfig as e}from"../../../config/env-config.js";const r=["is-ignored-inline-loader","graphql-doc","wsdl","content-slugs","markdown-inline-parser","openapi-markdoc-inline-parser","asyncapi-markdoc-inline-parser"];function o(n){return e.isBuildMode?!r.includes(n):!0}export{o as isLoaderCacheEnabled};
1
+ import{envConfig as e}from"../../config/env-config.js";const r=["is-ignored-inline-loader","graphql-doc","wsdl","content-slugs","markdown-inline-parser","openapi-markdoc-inline-parser","asyncapi-markdoc-inline-parser"];function o(n){return e.isBuildMode?!r.includes(n):!0}export{o as isLoaderCacheEnabled};
@@ -1 +1 @@
1
- import{resolve as n,dirname as l}from"node:path";import{fileURLToPath as d}from"node:url";import{readFile as u}from"fs/promises";import{createReadStream as v}from"fs";import{envConfig as s}from"../config/env-config.js";import{telemetry as S}from"./telemetry/index.js";import{createRouter as g}from"./web-server/router.js";import{installProdRoutes as D}from"./web-server/routes/index.js";import{Store as E}from"./store.js";import{loadEnvVariables as w}from"./utils/envs/load-env-variables.js";import{startHttpServer as P}from"./web-server/http.js";import{readStaticData as b}from"./utils/static-data.js";import{startIdleTimeout as R}from"./web-server/middleware/idleTimeoutMiddleware.js";import{reporter as x}from"./tools/notifiers/reporter.js";import{EntitlementsProvider as I}from"./entitlements/entitlements-provider.js";import{DatabasePreconnectService as y}from"./providers/database/database-preconnect-service.js";import{KvService as N}from"./persistence/kv/services/kv-service.js";import{runScorecardsWorker as O}from"./plugins/scorecards/workers/run-scorecards-worker.js";import{isCatalogEntitiesEnabled as T}from"./utils/is-catalog-entities-enabled.js";import{isScorecardsEnabled as h}from"./utils/is-scorecards-enabled.js";import{renderPage as $}from"./ssr/index.js";if(!s.isBuildMode){let f=function(){const r=process.argv.findIndex(i=>i==="--port"||i==="-p");if(r===-1)return null;const o=process.argv[r+1];if(o.startsWith("-"))return null;const e=parseInt(o,10);return isNaN(e)?null:e};const t=l(d(import.meta.url));await w(t);const m=JSON.parse(await u(n(t,"./store.json"),"utf-8")),c=E.fromJson(m,{outdir:n(t,"../client"),serverOutDir:t,serverMode:!0,contentDir:""});if(await I.instance().init({ignoreTokenExpiration:!0}),T()){await y.init(t);const r=await N.getInstance({baseDbDir:t});setInterval(()=>r.clearExpired(),300*1e3)}p(c).catch(r=>{console.error(r)});async function p(r){S.initialize();const o=await g();D(o,r,{readStaticAsset:async a=>v(a),resolveRouteData:async a=>b(a.slug,r.outdir)}),x.printErrors();const e=f(),i=s.PORT;return await P(o,e??i??4e3),R(),h(r.config)&&O(r.serverOutDir,r.config.scorecards),o}}export{$ as renderPage};
1
+ import{resolve as n,dirname as l}from"node:path";import{fileURLToPath as d}from"node:url";import{readFile as u}from"fs/promises";import{createReadStream as v}from"fs";import{envConfig as s}from"./config/env-config.js";import{telemetry as S}from"./telemetry/index.js";import{createRouter as g}from"./web-server/router.js";import{installProdRoutes as D}from"./web-server/routes/index.js";import{Store as E}from"./store.js";import{loadEnvVariables as w}from"./utils/envs/load-env-variables.js";import{startHttpServer as P}from"./web-server/http.js";import{readStaticData as b}from"./utils/static-data.js";import{startIdleTimeout as R}from"./web-server/middleware/idleTimeoutMiddleware.js";import{reporter as x}from"./tools/notifiers/reporter.js";import{EntitlementsProvider as I}from"./entitlements/entitlements-provider.js";import{DatabasePreconnectService as y}from"./providers/database/database-preconnect-service.js";import{KvService as N}from"./persistence/kv/services/kv-service.js";import{runScorecardsWorker as O}from"./plugins/scorecards/workers/run-scorecards-worker.js";import{isCatalogEntitiesEnabled as T}from"./utils/is-catalog-entities-enabled.js";import{isScorecardsEnabled as h}from"./utils/is-scorecards-enabled.js";import{renderPage as $}from"./ssr/index.js";if(!s.isBuildMode){let f=function(){const r=process.argv.findIndex(i=>i==="--port"||i==="-p");if(r===-1)return null;const o=process.argv[r+1];if(o.startsWith("-"))return null;const e=parseInt(o,10);return isNaN(e)?null:e};const t=l(d(import.meta.url));await w(t);const m=JSON.parse(await u(n(t,"./store.json"),"utf-8")),c=E.fromJson(m,{outdir:n(t,"../client"),serverOutDir:t,serverMode:!0,contentDir:""});if(await I.instance().init({ignoreTokenExpiration:!0}),T()){await y.init(t);const r=await N.getInstance({baseDbDir:t});setInterval(()=>r.clearExpired(),300*1e3)}p(c).catch(r=>{console.error(r)});async function p(r){S.initialize();const o=await g();D(o,r,{readStaticAsset:async a=>v(a),resolveRouteData:async a=>b(a.slug,r.outdir)}),x.printErrors();const e=f(),i=s.PORT;return await P(o,e??i??4e3),R(),h(r.config)&&O(r.serverOutDir,r.config.scorecards),o}}export{$ as renderPage};
@@ -1 +1 @@
1
- import{envConfig as r}from"../../../../config/env-config.js";import{buildScript as t}from"./build-script.js";import{resolveBrowserHooksPath as e}from"./resolve-browser-hooks.js";async function d(){return{id:"Adobe Analytics",requiredEntitlements:["analytics"],async processContent(o,{getConfig:i}){const n=(await i())?.analytics?.adobe;!n?.scriptUrl||!r.isProductionEnv&&!n.includeInDevelopment||(o.addSsrComponents([t(n.scriptUrl)],"head"),o.addBrowserPlugin(e()))}}}export{d as adobeAnalyticsPlugin};
1
+ import{envConfig as r}from"../../../config/env-config.js";import{buildScript as t}from"./build-script.js";import{resolveBrowserHooksPath as e}from"./resolve-browser-hooks.js";async function d(){return{id:"Adobe Analytics",requiredEntitlements:["analytics"],async processContent(o,{getConfig:i}){const n=(await i())?.analytics?.adobe;!n?.scriptUrl||!r.isProductionEnv&&!n.includeInDevelopment||(o.addSsrComponents([t(n.scriptUrl)],"head"),o.addBrowserPlugin(e()))}}}export{d as adobeAnalyticsPlugin};
@@ -1 +1 @@
1
- import{Minimatch as p}from"minimatch";import{envConfig as m}from"../../../../config/env-config.js";import{buildScripts as a}from"./build-scripts.js";import{resolveBrowserHooksPath as l}from"./resolve-browser-hooks.js";async function h(){return{id:"Amplitude Analytics",requiredEntitlements:["analytics"],async processContent(n,{getConfig:t}){const e=(await t())?.analytics?.amplitude;if(!e?.apiKey||!m.isProductionEnv&&!e.includeInDevelopment)return;let o=[];typeof e.exclude<"u"&&e.exclude.map(r=>{const d=new p(r);o.push(d.makeRe())});const{headComponents:i,postBodyComponents:s}=a(e,o);n.addSsrComponents(i,"head"),n.addSsrComponents(s,"postBody"),n.addBrowserPlugin(l())}}}export{h as amplitudeAnalyticsPlugin};
1
+ import{Minimatch as p}from"minimatch";import{envConfig as d}from"../../../config/env-config.js";import{buildScripts as a}from"./build-scripts.js";import{resolveBrowserHooksPath as c}from"./resolve-browser-hooks.js";async function C(){return{id:"Amplitude Analytics",requiredEntitlements:["analytics"],async processContent(n,{getConfig:i}){const e=(await i())?.analytics?.amplitude;if(!e?.apiKey||!d.isProductionEnv&&!e.includeInDevelopment)return;let o=[];typeof e.exclude<"u"&&e.exclude.map(m=>{const t=new p(m).makeRe();t&&o.push(t)});const{headComponents:s,postBodyComponents:r}=a(e,o);n.addSsrComponents(s,"head"),n.addSsrComponents(r,"postBody"),n.addBrowserPlugin(c())}}}export{C as amplitudeAnalyticsPlugin};
@@ -1 +1 @@
1
- import{envConfig as r}from"../../../../config/env-config.js";import{buildScript as s}from"./build-script.js";async function a(){return{id:"Fullstory Analytics",requiredEntitlements:["analytics"],async processContent(t,{getConfig:o}){const n=(await o())?.analytics?.fullstory;if(!n?.orgId||!r.isProductionEnv&&!n.includeInDevelopment)return;const i=[s(n.orgId)];t.addSsrComponents(i,"head")}}}export{a as fullstoryAnalyticsPlugin};
1
+ import{envConfig as r}from"../../../config/env-config.js";import{buildScript as s}from"./build-script.js";async function a(){return{id:"Fullstory Analytics",requiredEntitlements:["analytics"],async processContent(t,{getConfig:o}){const n=(await o())?.analytics?.fullstory;if(!n?.orgId||!r.isProductionEnv&&!n.includeInDevelopment)return;const i=[s(n.orgId)];t.addSsrComponents(i,"head")}}}export{a as fullstoryAnalyticsPlugin};
@@ -1 +1 @@
1
- import{withPathPrefix as s}from"@redocly/theme/core/utils";import{envConfig as c}from"../../../../config/env-config.js";import{buildScripts as l}from"./build-scripts.js";import{resolveBrowserHooksPath as g}from"./resolve-browser-hooks.js";async function I(){const r=c.isProductionEnv;return{id:"Google Analytics",requiredEntitlements:["analytics"],afterRoutesCreated(t){const n=t.getGlobalData()||{},o=n.analytics?.ga||{trackingId:""};o?.exclude||(o.exclude=[]),o.trackers={};for(const i of Object.values(n.products||{})){const e=i.configOverride?.analytics?.ga;!e||!r&&!e.includeInDevelopment||(e.exclude?.length&&o.exclude.push(...e.exclude),o.trackers[i.slug]=e)}if(o.trackingId&&(r||o.includeInDevelopment)&&(o.trackers[s("/")]={trackingId:o.trackingId,conversionId:o.conversionId,floodlightId:o.floodlightId,optimizeId:o.optimizeId}),t.setGlobalData({...n,analytics:{...n?.analytics,ga:o}}),!Object.keys(o.trackers).length)return;const{headComponents:a,postBodyComponents:d}=l(o);t.addSsrComponents(a,"head"),t.addSsrComponents(d,"postBody"),t.addBrowserPlugin(g())}}}export{I as googleAnalyticsPlugin};
1
+ import{withPathPrefix as s}from"@redocly/theme/core/utils";import{envConfig as c}from"../../../config/env-config.js";import{buildScripts as l}from"./build-scripts.js";import{resolveBrowserHooksPath as g}from"./resolve-browser-hooks.js";async function I(){const r=c.isProductionEnv;return{id:"Google Analytics",requiredEntitlements:["analytics"],afterRoutesCreated(t){const n=t.getGlobalData()||{},o=n.analytics?.ga||{trackingId:""};o?.exclude||(o.exclude=[]),o.trackers={};for(const i of Object.values(n.products||{})){const e=i.configOverride?.analytics?.ga;!e||!r&&!e.includeInDevelopment||(e.exclude?.length&&o.exclude.push(...e.exclude),o.trackers[i.slug]=e)}if(o.trackingId&&(r||o.includeInDevelopment)&&(o.trackers[s("/")]={trackingId:o.trackingId,conversionId:o.conversionId,floodlightId:o.floodlightId,optimizeId:o.optimizeId}),t.setGlobalData({...n,analytics:{...n?.analytics,ga:o}}),!Object.keys(o.trackers).length)return;const{headComponents:a,postBodyComponents:d}=l(o);t.addSsrComponents(a,"head"),t.addSsrComponents(d,"postBody"),t.addBrowserPlugin(g())}}}export{I as googleAnalyticsPlugin};
@@ -1 +1 @@
1
- import{onCLS as d,onFID as u,onLCP as m}from"web-vitals";import{envConfig as p}from"../../../../config/env-config.js";import{debounce as r}from"../../../../utils/time/debounce.js";const c=new Set,v=(n,t)=>{const e=t?.analytics?.gtm;if(!e||p.NODE_ENV!=="production"&&!e.includeInDevelopment)return;e.enableWebVitalsTracking&&!n.prevLocation&&w(e.dataLayerName);const o=e.dataLayerName?window[e.dataLayerName]:window.dataLayer,a=e.pageViewEventName?e.pageViewEventName:"pageView";o.push({event:a})};function w(n="dataLayer"){const t=window;function e(i){c.has(i.name)||(c.add(i.name),f(i,t[n]))}const o=r(e,3e3),a=e,s=r(e,3e3);d(o),u(a),m(s)}function f({name:n,value:t,id:e},o){o.push({event:"core-web-vitals",webVitalsMeasurement:{name:n,id:e,value:Math.round(n==="CLS"?t*1e3:t),nonInteraction:!0}})}export{v as onRouteChange};
1
+ import{onCLS as d,onFID as u,onLCP as m}from"web-vitals";import{envConfig as p}from"../../../config/env-config.js";import{debounce as r}from"../../../../utils/time/debounce.js";const c=new Set,v=(n,t)=>{const e=t?.analytics?.gtm;if(!e||p.NODE_ENV!=="production"&&!e.includeInDevelopment)return;e.enableWebVitalsTracking&&!n.prevLocation&&w(e.dataLayerName);const o=e.dataLayerName?window[e.dataLayerName]:window.dataLayer,a=e.pageViewEventName?e.pageViewEventName:"pageView";o.push({event:a})};function w(n="dataLayer"){const t=window;function e(i){c.has(i.name)||(c.add(i.name),f(i,t[n]))}const o=r(e,3e3),a=e,s=r(e,3e3);d(o),u(a),m(s)}function f({name:n,value:t,id:e},o){o.push({event:"core-web-vitals",webVitalsMeasurement:{name:n,id:e,value:Math.round(n==="CLS"?t*1e3:t),nonInteraction:!0}})}export{v as onRouteChange};
@@ -1 +1 @@
1
- import{envConfig as i}from"../../../../config/env-config.js";import{buildScripts as s}from"./build-scripts.js";import{resolveBrowserHooksPath as a}from"./resolve-browser-hooks.js";async function l(){return{id:"Google Tag Manager Analytics",requiredEntitlements:["analytics"],async processContent(n,{getConfig:t}){const o=(await t())?.analytics?.gtm;if(!o?.trackingId||!i.isProductionEnv&&!o.includeInDevelopment)return;const{headComponents:e,preBodyComponents:r}=s(o);n.addSsrComponents(e,"head"),n.addSsrComponents(r,"preBody"),n.addBrowserPlugin(a())}}}export{l as gtmAnalyticsPlugin};
1
+ import{envConfig as i}from"../../../config/env-config.js";import{buildScripts as s}from"./build-scripts.js";import{resolveBrowserHooksPath as a}from"./resolve-browser-hooks.js";async function l(){return{id:"Google Tag Manager Analytics",requiredEntitlements:["analytics"],async processContent(n,{getConfig:t}){const o=(await t())?.analytics?.gtm;if(!o?.trackingId||!i.isProductionEnv&&!o.includeInDevelopment)return;const{headComponents:e,preBodyComponents:r}=s(o);n.addSsrComponents(e,"head"),n.addSsrComponents(r,"preBody"),n.addBrowserPlugin(a())}}}export{l as gtmAnalyticsPlugin};
@@ -1 +1 @@
1
- import{envConfig as t}from"../../../../config/env-config.js";import{resolveBrowserHooksPath as e}from"./resolve-browser-hooks.js";async function c(){return{id:"Heap Analytics",requiredEntitlements:["analytics"],async processContent(i,{getConfig:o}){const n=(await o())?.analytics?.heap;!n?.appId||!t.isProductionEnv&&!n.includeInDevelopment||i.addBrowserPlugin(e())}}}export{c as heapAnalyticsPlugin};
1
+ import{envConfig as t}from"../../../config/env-config.js";import{resolveBrowserHooksPath as e}from"./resolve-browser-hooks.js";async function c(){return{id:"Heap Analytics",requiredEntitlements:["analytics"],async processContent(i,{getConfig:o}){const n=(await o())?.analytics?.heap;!n?.appId||!t.isProductionEnv&&!n.includeInDevelopment||i.addBrowserPlugin(e())}}}export{c as heapAnalyticsPlugin};
@@ -1 +1 @@
1
- import{envConfig as e}from"../../../../config/env-config.js";import{buildScript as i}from"./build-script.js";import{resolveBrowserHooksPath as o}from"./resolve-browser-hooks.js";async function u(){return{id:"Rudderstack Analytics",requiredEntitlements:["analytics"],async processContent(r,{getConfig:t}){const n=(await t())?.analytics?.rudderstack;!n?.writeKey||!e.isProductionEnv&&!n.includeInDevelopment||(r.addSsrComponents([i(n)],"head"),r.addBrowserPlugin(o()))}}}export{u as rudderstackAnalyticsPlugin};
1
+ import{envConfig as e}from"../../../config/env-config.js";import{buildScript as i}from"./build-script.js";import{resolveBrowserHooksPath as o}from"./resolve-browser-hooks.js";async function u(){return{id:"Rudderstack Analytics",requiredEntitlements:["analytics"],async processContent(r,{getConfig:t}){const n=(await t())?.analytics?.rudderstack;!n?.writeKey||!e.isProductionEnv&&!n.includeInDevelopment||(r.addSsrComponents([i(n)],"head"),r.addBrowserPlugin(o()))}}}export{u as rudderstackAnalyticsPlugin};
@@ -1 +1 @@
1
- const o=(n,t)=>{if(!t?.analytics?.segment)return;function e(){window.segmentPageviewCaller?.(!!n.prevLocation)}window.portalPluginSegmentSnippetLoader?window.portalPluginSegmentSnippetLoader(e):e()};export{o as onRouteChange};
1
+ const a=(t,o)=>{const e=o?.analytics?.segment;if(!e||e?.trackPage===!1)return;function n(){window.segmentPageviewCaller?.(!!t.prevLocation)}window.portalPluginSegmentSnippetLoader?window.portalPluginSegmentSnippetLoader(n):n()};export{a as onRouteChange};
@@ -1,6 +1,9 @@
1
- import c from"react";const d=a=>{const{writeKey:t,trackPage:n,host:i="https://cdn.segment.io",includeTitleInPageCall:r=!0}=a,l=`(function () {
1
+ import c from"react";const d=n=>{const{writeKey:t,trackPage:a,host:i="https://cdn.segment.io",includeTitleInPageCall:r=!0}=n,l=`(function () {
2
2
  let segmentPageviewCalledAlready = false;
3
3
  window.segmentPageviewCaller = function (force) {
4
+
5
+ ${a!==!1?"":"return;"}
6
+
4
7
  if (!window.analytics) {
5
8
  return
6
9
  }
@@ -12,7 +15,7 @@ import c from"react";const d=a=>{const{writeKey:t,trackPage:n,host:i="https://cd
12
15
  };
13
16
  })();`;let e=`(function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var key=analytics.methods[e];analytics[key]=analytics.factory(key)}analytics.load=function(key,e){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src="${i}/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=e};analytics._writeKey="${t}";analytics.SNIPPET_VERSION="4.15.3";
14
17
  analytics.load('${t}');
15
- `;n!==!1&&(e+="window.segmentPageviewCaller();"),e+="}})();";const s=`
18
+ `;a!==!1&&(e+="window.segmentPageviewCaller();"),e+="}})();";const s=`
16
19
  (function () {
17
20
  ${l}
18
21
  ${e}
@@ -1 +1 @@
1
- import{envConfig as i}from"../../../../config/env-config.js";import{buildScript as o}from"./build-script.js";import{resolveBrowserHooksPath as r}from"./resolve-browser-hooks.js";async function m(){return{id:"Segment Analytics",requiredEntitlements:["analytics"],async processContent(e,{getConfig:t}){const n=(await t())?.analytics?.segment;!n?.writeKey||!i.isProductionEnv&&!n.includeInDevelopment||(e.addSsrComponents([o(n)],"head"),e.addBrowserPlugin(r()))}}}export{m as segmentAnalyticsPlugin};
1
+ import{envConfig as i}from"../../../config/env-config.js";import{buildScript as o}from"./build-script.js";import{resolveBrowserHooksPath as r}from"./resolve-browser-hooks.js";async function m(){return{id:"Segment Analytics",requiredEntitlements:["analytics"],async processContent(e,{getConfig:t}){const n=(await t())?.analytics?.segment;!n?.writeKey||!i.isProductionEnv&&!n.includeInDevelopment||(e.addSsrComponents([o(n)],"head"),e.addBrowserPlugin(r()))}}}export{m as segmentAnalyticsPlugin};
@@ -1 +1 @@
1
- import A from"path";import{simplifyAstStructure as E}from"@redocly/openapi-docs/lib/utils/simplifyAstStructure.js";import{buildMenuItems as $}from"@redocly/asyncapi-docs/lib/utils/build-menu-items.js";import{findFirstBinding as T}from"@redocly/asyncapi-docs/lib/utils/find-first-binding.js";import{ASYNC_API_DOCS_TEMPLATE_ID as v}from"../../../constants/common.js";import{combineUrls as D}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as b}from"../../constants/common.js";import{logger as x}from"../../tools/notifiers/logger.js";import{getTemplatePath as R}from"./get-template-path.js";import{storeDefinitionBundles as O}from"./store-definition-bundles.js";import{asyncapiDocLoader as F,asyncapiDocsLoader as N}from"./asyncapi-doc-loader.js";import{searchResolver as j}from"./search/search-resolver.js";import{getAiDocumentsStore as L}from"./search/get-ai-search-documents.js";import{telemetryTraceStep as G}from"../../../cli/telemetry/helpers/trace-step.js";const _="asyncapi-docs-";async function tt(d){let p=[],u=new Set;return{id:"asyncapi",requiredEntitlements:["asyncapi"],loaders:{"asyncapi-doc":F,"asyncapi-docs":N},processContent:async(e,a)=>{await G("build.plugin.asyncapi_docs",async()=>{if((await a.getConfig()).plugins?.some(l=>l.startsWith("@redocly/portal-plugin-async-api/"))){x.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");return}const c=e.createTemplate(v,R("./template/AsyncApiDocs.js")),g=e.registerServerPropsGetter(v,R("./get-server-props.js"));for(const l of await a.fs.scan(/(\.ya?ml|\.json)$/))if(!await a.isPathIgnored(l.relativePath))try{const{data:s,compoundHash:w}=await a.cache.load(l.realRelativePath,"asyncapi-doc");if(!s?.length)continue;p=s.map(({markdocChunks:t,relativePath:o,isVirtual:m,customOutputRelativeFile:f,realRelativePath:y})=>({chunks:t,relativePath:o,realRelativePath:y,isVirtual:f!=null||l.isVirtual||m})),O(s,e.outdir,w);for(const t of s){const o=`${_}${t.relativePath}`,m=T(t.document),{navItems:f,apiItems:y}=$({asyncApiDoc:t.document,protocol:m||""}),I=[{url:D(b,`${C(t.relativePath,".json")}?download`)},{url:D(b,`${C(t.relativePath,".yaml")}?download`)}];await e.createSharedData(o,{document:t.document,apiItems:y,protocol:m,downloadUrls:I}),f.forEach(r=>{const n={fsPath:t.relativePath,slugSuffix:`/${r.link}`,templateId:c,sharedData:[{key:"AsyncApiDefinition",id:o}],getStaticData:S(a.withPathPrefix,r.label),serverPropsGetterIds:[g]};e.addRoute(n),r.items&&r.items.forEach(i=>{e.addRoute({...n,slugSuffix:`/${i.link}`,getStaticData:S(a.withPathPrefix,i.label)}),i.items&&i.items.forEach(h=>{e.addRoute({...n,slugSuffix:`/${h.link}`,getStaticData:S(a.withPathPrefix,i.label)})})})}),e.addRoute({fsPath:t.customOutputRelativeFile||t.relativePath,templateId:c,hasClientRoutes:!0,getSidebar:r=>{const n=i=>{const h={...i};return i.link&&(h.routeSlug=D(r.slug,i.link),h.link=D(r.slug,i.link)),i.items&&(h.items=i.items.map(n)),h};return[{type:"link",label:t.document.info?.title??"AsyncAPI Overview",routeSlug:r.slug,link:r.slug},...f.map(n)]},getSearchDocuments:j(e,t.document),getStaticData:S(a.withPathPrefix,t.document.info?.title??"AsyncAPI Docs"),getAiDocumentsStore:L({actions:e,document:t.document,metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}}}),metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}},sharedData:[{key:"AsyncApiDefinition",id:o}]})}}catch(s){console.error(s)}})},afterRoutesCreated:async(e,a)=>{const P=new Set;for(const{chunks:c,relativePath:g,isVirtual:l,realRelativePath:s}of p){const w=e.getAllRoutes().filter(o=>o.fsPath===g).map(o=>o.slug),t=(await a.cache.load(s,"asyncapi-doc")).compoundHash;await a.cache.load(g,{loader:async function(){for(const{node:m,markdown:f,pointer:y,key:I,relativePath:r}of c){const{ast:n}=await e.parseMarkdoc({content:f,relativePath:y,isVirtual:l},a,{sharedDataIds:[`${_}${r}`],routeSlugs:w});m[`x-parsed-md-${I}`]={result:E(n)}}},name:"asyncapi-markdoc-inline-parser"},[t]);for(const{pointer:o}of c)P.add(o)}const k=u.difference(P);for(const c of k)a.cache.delete(c);u=P}}}function S(d,p){return async function(u,e){return{props:{settings:{baseUrlPath:d(u.baseSlug)},disableAutoScroll:!0,seo:{title:p}}}}}function C(d,p){const u=A.posix.dirname(d),e=A.posix.basename(d,A.posix.extname(d))+p;return A.posix.join(u,e)}export{tt as asyncAPIDocsPlugin};
1
+ import A from"path";import{simplifyAstStructure as E}from"@redocly/openapi-docs/lib/utils/simplifyAstStructure.js";import{buildMenuItems as $}from"@redocly/asyncapi-docs/lib/utils/build-menu-items.js";import{findFirstBinding as T}from"@redocly/asyncapi-docs/lib/utils/find-first-binding.js";import{ASYNC_API_DOCS_TEMPLATE_ID as v}from"../../../constants/common.js";import{combineUrls as D}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as b}from"../../constants/common.js";import{logger as x}from"../../tools/notifiers/logger.js";import{getTemplatePath as R}from"./get-template-path.js";import{storeDefinitionBundles as O}from"./store-definition-bundles.js";import{asyncapiDocLoader as F,asyncapiDocsLoader as N}from"./asyncapi-doc-loader.js";import{searchResolver as j}from"./search/search-resolver.js";import{getAiDocumentsStore as L}from"./search/get-ai-search-documents.js";import{telemetryTraceStep as G}from"../../../cli/telemetry/helpers/trace-step.js";const _="asyncapi-docs-";async function tt(d){let p=[],u=new Set;return{id:"asyncapi",requiredEntitlements:["asyncapi"],loaders:{"asyncapi-doc":F,"asyncapi-docs":N},processContent:async(e,a)=>{await G("build.plugin.asyncapi_docs",async()=>{if((await a.getConfig()).plugins?.some(l=>l.startsWith("@redocly/portal-plugin-async-api/"))){x.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");return}const c=e.createTemplate(v,R("../../../client/templates/asyncapi-docs/template.js")),g=e.registerServerPropsGetter(v,R("./get-server-props.js"));for(const l of await a.fs.scan(/(\.ya?ml|\.json)$/))if(!await a.isPathIgnored(l.relativePath))try{const{data:s,compoundHash:w}=await a.cache.load(l.realRelativePath,"asyncapi-doc");if(!s?.length)continue;p=s.map(({markdocChunks:t,relativePath:o,isVirtual:m,customOutputRelativeFile:f,realRelativePath:y})=>({chunks:t,relativePath:o,realRelativePath:y,isVirtual:f!=null||l.isVirtual||m})),O(s,e.outdir,w);for(const t of s){const o=`${_}${t.relativePath}`,m=T(t.document),{navItems:f,apiItems:y}=$({asyncApiDoc:t.document,protocol:m||""}),I=[{url:D(b,`${C(t.relativePath,".json")}?download`)},{url:D(b,`${C(t.relativePath,".yaml")}?download`)}];await e.createSharedData(o,{document:t.document,apiItems:y,protocol:m,downloadUrls:I}),f.forEach(r=>{const n={fsPath:t.relativePath,slugSuffix:`/${r.link}`,templateId:c,sharedData:[{key:"AsyncApiDefinition",id:o}],getStaticData:S(a.withPathPrefix,r.label),serverPropsGetterIds:[g]};e.addRoute(n),r.items&&r.items.forEach(i=>{e.addRoute({...n,slugSuffix:`/${i.link}`,getStaticData:S(a.withPathPrefix,i.label)}),i.items&&i.items.forEach(h=>{e.addRoute({...n,slugSuffix:`/${h.link}`,getStaticData:S(a.withPathPrefix,i.label)})})})}),e.addRoute({fsPath:t.customOutputRelativeFile||t.relativePath,templateId:c,hasClientRoutes:!0,getSidebar:r=>{const n=i=>{const h={...i};return i.link&&(h.routeSlug=D(r.slug,i.link),h.link=D(r.slug,i.link)),i.items&&(h.items=i.items.map(n)),h};return[{type:"link",label:t.document.info?.title??"AsyncAPI Overview",routeSlug:r.slug,link:r.slug},...f.map(n)]},getSearchDocuments:j(e,t.document),getStaticData:S(a.withPathPrefix,t.document.info?.title??"AsyncAPI Docs"),getAiDocumentsStore:L({actions:e,document:t.document,metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}}}),metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}},sharedData:[{key:"AsyncApiDefinition",id:o}]})}}catch(s){console.error(s)}})},afterRoutesCreated:async(e,a)=>{const P=new Set;for(const{chunks:c,relativePath:g,isVirtual:l,realRelativePath:s}of p){const w=e.getAllRoutes().filter(o=>o.fsPath===g).map(o=>o.slug),t=(await a.cache.load(s,"asyncapi-doc")).compoundHash;await a.cache.load(g,{loader:async function(){for(const{node:m,markdown:f,pointer:y,key:I,relativePath:r}of c){const{ast:n}=await e.parseMarkdoc({content:f,relativePath:y,isVirtual:l},a,{sharedDataIds:[`${_}${r}`],routeSlugs:w});m[`x-parsed-md-${I}`]={result:E(n)}}},name:"asyncapi-markdoc-inline-parser"},[t]);for(const{pointer:o}of c)P.add(o)}const k=u.difference(P);for(const c of k)a.cache.delete(c);u=P}}}function S(d,p){return async function(u,e){return{props:{settings:{baseUrlPath:d(u.baseSlug)},disableAutoScroll:!0,seo:{title:p}}}}}function C(d,p){const u=A.posix.dirname(d),e=A.posix.basename(d,A.posix.extname(d))+p;return A.posix.join(u,e)}export{tt as asyncAPIDocsPlugin};
@@ -1,56 +1,56 @@
1
- import{basename as C}from"node:path";import{REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{isResourcePubliclyAccessible as u}from"../../../utils/rbac.js";import{getLocaleFromRelativePath as P}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as A}from"./search-facets.js";import{removeMarkdownLinks as m}from"../../openapi-docs/utils.js";import{processSchema as d}from"./schema-processor.js";import{llmsTxtLink as L,getLLMsTxtMdSlug as j}from"../../search/llmstxt/index.js";const W=({actions:e,document:t,metadata:i})=>async(n,s,o)=>{const a=n.getSidebar?.(n)||[],c=await o.getConfig(),{allSearchDocuments:r,publiclyAccessibleSearchDocuments:l}=b(n,a,t,e,i,c);if(r.length)return{async getLLMsTxts(){return l.map(f=>({slug:f.url,fsPath:n.fsPath,title:f.title,content:f.content,includeInLLMsTxt:f.includeInLLMsTxt}))},async getSearchDocuments(){return r}}};function b(e,t,i,n,s,o,a){const c=[],r=[];for(const l of t){if(l.type==="group"){const h=l.apiItemData?.type==="channel"?l:a,{allSearchDocuments:D,publiclyAccessibleSearchDocuments:S}=b(e,l.items||[],i,n,s,o,h);c.push(...D),r.push(...S)}const f=k(e,l,i,n,s,o);f&&(c.push(f),q(l,o,a)&&r.push(f))}return{allSearchDocuments:c,publiclyAccessibleSearchDocuments:r}}function k(e,t,i,n,s,o){const a=F(t,i);if(!a)return null;const c=t.link||"",r=t.httpVerb||"",l=P(e.fsPath),f=A(n,s),h=M(e,t,i,a,r,c,o);return{url:c||e.slug,fsPath:e.fsPath,content:h.trim(),title:m(a.title||"")||C(e.fsPath),locale:l,facets:f,includeInLLMsTxt:!t.apiItemData}}function M(e,t,i,n,s,o,a){let c="";const r=m(n.title||""),l=m(n.description||"")+m(n.summary||"");return r&&(c+=`# ${r}
1
+ import{basename as C}from"node:path";import{REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{isResourcePubliclyAccessible as P}from"../../../utils/rbac.js";import{getLocaleFromRelativePath as A}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as L}from"./search-facets.js";import{removeMarkdownLinks as m}from"../../openapi-docs/utils.js";import{processSchema as d}from"./schema-processor.js";import{llmsTxtLink as j,getLLMsTxtMdSlug as k}from"../../search/llmstxt/index.js";const X=({actions:n,document:e,metadata:i})=>async(t,s,r)=>{const a=t.getSidebar?.(t)||[],c=await r.getConfig(),{allSearchDocuments:o,publiclyAccessibleSearchDocuments:l}=b(t,a,e,n,i,c);if(o.length)return{async getLLMsTxts(){return l.map(f=>({slug:f.url,fsPath:t.fsPath,title:f.title,content:f.content,includeInLLMsTxt:f.includeInLLMsTxt}))},async getSearchDocuments(){return o}}};function b(n,e,i,t,s,r,a){const c=[],o=[];for(const l of e){if(l.type==="group"){const h=l.apiItemData?.type==="channel"?l:a,{allSearchDocuments:D,publiclyAccessibleSearchDocuments:S}=b(n,l.items||[],i,t,s,r,h);c.push(...D),o.push(...S)}const f=M(n,l,i,t,s,r);f&&(c.push(f),G(l,r,a)&&o.push(f))}return{allSearchDocuments:c,publiclyAccessibleSearchDocuments:o}}function M(n,e,i,t,s,r){const a=q(e,i);if(!a)return null;const c=e.link||"",o=e.httpVerb||"",l=A(n.fsPath),f=L(t,s),h=I(n,e,i,a,o,c,r);return{url:c||n.slug,fsPath:n.fsPath,content:h.trim(),title:m(a.title||"")||C(n.fsPath),locale:l,product:n.product?.name,facets:f,includeInLLMsTxt:!e.apiItemData}}function I(n,e,i,t,s,r,a){let c="";const o=m(t.title||""),l=m(t.description||"")+m(t.summary||"");return o&&(c+=`# ${o}
2
2
 
3
3
  `),l&&(c+=`${l}
4
4
 
5
5
  `),s&&(c+=`Method: ${s.toUpperCase()}
6
- `),c+=I(i),c+=O(i),t.type==="link"&&!t.apiItemData&&(c+=v(e,a)),t.apiItemData?.type==="channel"&&(c+=T(t,i,o,e)),t.apiItemData?.type==="operation"&&(c+=N(t,i)),c}function I(e){let t="";return e.info?.version&&(t+=`Version: ${e.info.version}
7
- `),e.info?.license?.name&&(t+=`License: ${e.info.license.name}
8
- `),t}function O(e){if(!e.servers||Object.keys(e.servers).length===0)return"";let t=`
6
+ `),c+=O(i),c+=v(i),e.type==="link"&&!e.apiItemData&&(c+=T(n,a)),e.apiItemData?.type==="channel"&&(c+=x(e,i,r,n)),e.apiItemData?.type==="operation"&&(c+=N(e,i)),c}function O(n){let e="";return n.info?.version&&(e+=`Version: ${n.info.version}
7
+ `),n.info?.license?.name&&(e+=`License: ${n.info.license.name}
8
+ `),e}function v(n){if(!n.servers||Object.keys(n.servers).length===0)return"";let e=`
9
9
  ## Servers
10
10
 
11
- `;for(const[i,n]of Object.entries(e.servers))t+=`### ${i}
12
- `,n.description&&(t+=`${n.description}
13
- `),t+=`Host: ${n.host}
14
- `,t+=`Protocol: ${n.protocol}
15
- `,n.protocolVersion&&(t+=`Protocol Version: ${n.protocolVersion}
16
- `),n.pathname&&(t+=`Path: ${n.pathname}
17
- `),t+=`
18
- `;return t}function v(e,t){const i=e.getSidebar?.(e)||[],n=$(i,t);if(Object.keys(n).length===0)return"";let s="";for(const[,o]of Object.entries(n))if(o.length>0)for(const a of o){const c=a.label||"Untitled",r=a.link||a.routeSlug||"";s+=`#### ${c}
11
+ `;for(const[i,t]of Object.entries(n.servers))e+=`### ${i}
12
+ `,t.description&&(e+=`${t.description}
13
+ `),e+=`Host: ${t.host}
14
+ `,e+=`Protocol: ${t.protocol}
15
+ `,t.protocolVersion&&(e+=`Protocol Version: ${t.protocolVersion}
16
+ `),t.pathname&&(e+=`Path: ${t.pathname}
17
+ `),e+=`
18
+ `;return e}function T(n,e){const i=n.getSidebar?.(n)||[],t=$(i,e);if(Object.keys(t).length===0)return"";let s="";for(const[,r]of Object.entries(t))if(r.length>0)for(const a of r){const c=a.label||"Untitled",o=a.link||a.routeSlug||"";s+=`#### ${c}
19
19
 
20
- `,r&&(s+=` - ${L({title:c,description:void 0,slug:j(r)})}
20
+ `,o&&(s+=` - ${j({title:c,description:void 0,slug:k(o)})}
21
21
 
22
- `)}return s}function T(e,t,i,n){const s=e.apiItemData?.id;if(!s)return"";const o=t.channels?.[s];if(!o)return"";let a="";if(o.parameters&&Object.keys(o.parameters).length>0){a+=`## Parameters
22
+ `)}return s}function x(n,e,i,t){const s=n.apiItemData?.id;if(!s)return"";const r=e.channels?.[s];if(!r)return"";let a="";if(r.parameters&&Object.keys(r.parameters).length>0){a+=`## Parameters
23
23
 
24
- `;for(const[c,r]of Object.entries(o.parameters))a+=`### ${c}
25
- `,typeof r=="object"&&r!==null&&"description"in r&&r.description&&(a+=`${r.description}
26
- `),typeof r=="object"&&r!==null&&"enum"in r&&Array.isArray(r.enum)&&r.enum.length>0&&(a+=`Enum: ${r.enum.join(", ")}
27
- `),typeof r=="object"&&r!==null&&"default"in r&&r.default&&(a+=`Default: ${r.default}
24
+ `;for(const[c,o]of Object.entries(r.parameters))a+=`### ${c}
25
+ `,typeof o=="object"&&o!==null&&"description"in o&&o.description&&(a+=`${o.description}
26
+ `),typeof o=="object"&&o!==null&&"enum"in o&&Array.isArray(o.enum)&&o.enum.length>0&&(a+=`Enum: ${o.enum.join(", ")}
27
+ `),typeof o=="object"&&o!==null&&"default"in o&&o.default&&(a+=`Default: ${o.default}
28
28
  `),a+=`
29
- `}if(o.messages&&Object.keys(o.messages).length>0){a+=`## Messages
29
+ `}if(r.messages&&Object.keys(r.messages).length>0){a+=`## Messages
30
30
 
31
- `;for(const[c,r]of Object.entries(o.messages))a+=x(r,c,i,n)}return a}function x(e,t,i,n){let o=`### ${e.title||e.name||t}
32
- `;if(e.description&&(o+=`${e.description}
33
- `),e.summary&&(o+=`${e.summary}
34
- `),e.payload){const a=d(e.payload,"message payload",i.replace(n.slug+"/","").replace(/^\//,""),t);a.length>0&&(o+=`
31
+ `;for(const[c,o]of Object.entries(r.messages))a+=R(o,c,i,t)}return a}function R(n,e,i,t){let r=`### ${n.title||n.name||e}
32
+ `;if(n.description&&(r+=`${n.description}
33
+ `),n.summary&&(r+=`${n.summary}
34
+ `),n.payload){const a=d(n.payload,"message payload",i.replace(t.slug+"/","").replace(/^\//,""),e);a.length>0&&(r+=`
35
35
  #### Payload Schema
36
36
 
37
- `,o+=g(a))}if(e.headers){const a=d(e.headers,"message headers",i.replace(n.slug+"/","").replace(/^\//,""),t);a.length>0&&(o+=`
37
+ `,r+=g(a))}if(n.headers){const a=d(n.headers,"message headers",i.replace(t.slug+"/","").replace(/^\//,""),e);a.length>0&&(r+=`
38
38
  #### Headers Schema
39
39
 
40
- `,o+=g(a))}return o}function g(e){let t="";for(const i of e)if(typeof i=="object"&&i!==null&&"name"in i&&"type"in i){const n=i;t+=`- **${n.name}** (${n.type}${n.required?", required":""})
41
- `,n.description&&(t+=` ${n.description}
42
- `),n.enum&&Array.isArray(n.enum)&&n.enum.length>0&&(t+=` Enum: ${n.enum.join(", ")}
43
- `),t+=`
44
- `}return t}function N(e,t){const i=e.apiItemData?.id;if(!i)return"";const n=t.operations?.[i];if(!n)return"";let s=`## Operation Details
40
+ `,r+=g(a))}return r}function g(n){let e="";for(const i of n)if(typeof i=="object"&&i!==null&&"name"in i&&"type"in i){const t=i;e+=`- **${t.name}** (${t.type}${t.required?", required":""})
41
+ `,t.description&&(e+=` ${t.description}
42
+ `),t.enum&&Array.isArray(t.enum)&&t.enum.length>0&&(e+=` Enum: ${t.enum.join(", ")}
43
+ `),e+=`
44
+ `}return e}function N(n,e){const i=n.apiItemData?.id;if(!i)return"";const t=e.operations?.[i];if(!t)return"";let s=`## Operation Details
45
45
 
46
- `;if(n.action&&(s+=`Action: ${n.action}
47
- `),n.description&&(s+=`${n.description}
48
- `),n.summary&&(s+=`${n.summary}
49
- `),n.messages&&n.messages.length>0){s+=`
46
+ `;if(t.action&&(s+=`Action: ${t.action}
47
+ `),t.description&&(s+=`${t.description}
48
+ `),t.summary&&(s+=`${t.summary}
49
+ `),t.messages&&t.messages.length>0){s+=`
50
50
  ### Messages
51
51
 
52
- `;for(const o of n.messages){const a=o.title||o.name||"Message";s+=`#### ${a}
53
- `,o.description&&(s+=`${o.description}
54
- `),o.summary&&(s+=`${o.summary}
52
+ `;for(const r of t.messages){const a=r.title||r.name||"Message";s+=`#### ${a}
53
+ `,r.description&&(s+=`${r.description}
54
+ `),r.summary&&(s+=`${r.summary}
55
55
  `),s+=`
56
- `}}return s}function $(e,t){const i={};for(const n of e)n.type==="group"?n.apiItemData?.type==="channel"?R(n,i,t):V(n,i,t):n.apiItemData?.type==="channel"&&E(n,i,t);return i}function R(e,t,i){const n=e.label||"Channel";if(u(p(e),i)&&(t[n]||(t[n]=[]),t[n].push(e),e.items))for(const s of e.items)s.apiItemData?.type==="operation"&&u(p(s),i)&&t[n].push(s)}function V(e,t,i){if(e.items){const n=$(e.items,i);for(const[s,o]of Object.entries(n))t[s]||(t[s]=[]),t[s].push(...o)}}function E(e,t,i){const n=e.label||"Channel";if(u(p(e),i)&&(t[n]||(t[n]=[]),t[n].push(e),e.items))for(const s of e.items)s.apiItemData?.type==="operation"&&u(p(s),i)&&t[n].push(s)}function F(e,t){const{apiItemData:i,type:n}=e;return i?.type?w(i,t):n==="link"?_(t):null}function w(e,t){switch(e.type){case"channel":return t.channels?.[e.id]||null;case"operation":return t.operations?.[e.id]||null;default:return null}}function _(e){return{description:e.info?.description||"",title:e.info?.title||"",summary:""}}function q(e,t,i){const n=u(p(e),t);if(e.apiItemData?.type==="operation"&&i){const s=u(p(i),t);return n&&s}return n}function p(e){return{slug:e.link||"",[y]:e[y]}}export{W as getAiDocumentsStore};
56
+ `}}return s}function $(n,e){const i={};for(const t of n)t.type==="group"?t.apiItemData?.type==="channel"?V(t,i,e):E(t,i,e):t.apiItemData?.type==="channel"&&F(t,i,e);return i}function V(n,e,i){const t=n.label||"Channel";if(p(u(n),i)&&(e[t]||(e[t]=[]),e[t].push(n),n.items))for(const s of n.items)s.apiItemData?.type==="operation"&&p(u(s),i)&&e[t].push(s)}function E(n,e,i){if(n.items){const t=$(n.items,i);for(const[s,r]of Object.entries(t))e[s]||(e[s]=[]),e[s].push(...r)}}function F(n,e,i){const t=n.label||"Channel";if(p(u(n),i)&&(e[t]||(e[t]=[]),e[t].push(n),n.items))for(const s of n.items)s.apiItemData?.type==="operation"&&p(u(s),i)&&e[t].push(s)}function q(n,e){const{apiItemData:i,type:t}=n;return i?.type?w(i,e):t==="link"?_(e):null}function w(n,e){switch(n.type){case"channel":return e.channels?.[n.id]||null;case"operation":return e.operations?.[n.id]||null;default:return null}}function _(n){return{description:n.info?.description||"",title:n.info?.title||"",summary:""}}function G(n,e,i){const t=p(u(n),e);if(n.apiItemData?.type==="operation"&&i){const s=p(u(i),e);return t&&s}return t}function u(n){return{slug:n.link||"",[y]:n[y]}}function p(n,e){return e.requiresLogin?!0:P(n,e)}export{X as getAiDocumentsStore};
@@ -1 +1 @@
1
- import{promiseMapLimit as u}from"../../../utils/async/promise-map-limit.js";import{logger as c}from"../../../tools/notifiers/logger.js";import{envConfig as r}from"../../../../config/env-config.js";import{CatalogEntitiesLocalRepository as w}from"./repositories/local/catalog-entities-local-repository.js";import{CatalogEntitiesRemoteRepository as p}from"./repositories/remote/catalog-entities-remote-repository.js";import{prepareListResponse as l}from"../../../web-server/utils/prepare-list-response.js";import{ENTITY_RELATION_FROM_DATABASE as d}from"./mappers/field-transformations.js";import{hasOptionsChanged as m}from"../utils/has-options-changed.js";const h=15;class n{static#a;static#i;#t;#e;constructor(t,e){this.#t=t,this.#e=e}static async#n(t){const[e,a]=await Promise.all([w.getInstance(t),t.runOnlyLocalDatabase?null:p.getInstance(t)]),i=new n(e,a);a&&(r.isDevelopMode&&c.info("Attaching remote database to local database"),await i.#t.attachDatabase(a.path)),n.#a=i,n.#i=t}static async getInstance(t){return t.runOnlyLocalDatabase===void 0&&(t.runOnlyLocalDatabase=r.isDevelopMode),t.removeExisting===void 0&&(t.removeExisting=!1),(!n.#a||m(n.#i,t))&&await n.#n(t),n.#a}async transaction(...t){return this.#t.transactionsManager.transaction(...t)}async getEntities({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i}){await this.#e?.sync();const{items:s,total:o,hasMore:y}=await this.#t.getEntities({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i});return l({data:s,params:t,totalCount:o,hasMore:y})}async getEntityById(t,e){return await this.#e?.sync(),await this.#t.getEntityById(t,e)}async getEntityKeysAndVersionsBySourceFile(t){return await this.#e?.sync(),this.#t.getEntityKeysAndVersionsBySourceFile(t)}async getEntitiesCountByTypes(){return await this.#e?.sync(),this.#t.getEntitiesCountByTypes()}async getCatalogFilters(t){return await this.#e?.sync(),this.#t.getCatalogFilters(t)}async createEntity(t){if(r.isDevelopMode)throw new Error("Entity creation is not supported in the develop mode");return this.#e?this.#e.createEntity(t):(c.warn("No remote database found"),null)}async createEntities(t){if(r.isDevelopMode)throw new Error("Entity creation is not supported in the develop mode");const e=this.#e;return e?await u(t,h,async a=>e.createEntity(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.key,status:"error",error:i}))):(c.warn("No remote database found"),[])}getEntitySources(){return this.#t.getEntitySources()}async createEntityInLocalDatabase(t){return this.#t.createEntity(t)}async createEntitiesInLocalDatabase(t){await this.#t.createEntities(t)}async createEntityRelationInLocalDatabase(t){await this.#t.createEntityRelation(t)}async createEntityRelationsInLocalDatabase(t){await this.#t.createEntityRelations(t)}async updateEntity(t,e){if(r.isDevelopMode)throw new Error("Entity update is not supported in the develop mode");return await this.#e?.updateEntity(t,e)}async deleteEntity(t){if(r.isDevelopMode)throw new Error("Entity deletion is not supported in the develop mode");return await this.#e?.deleteEntity(t)}async deleteEntitiesInLocalDatabase(t){await this.#t.deleteEntities(t)}async getEntityRelationById(t){return await this.#e?.sync(),await this.#t.getEntityRelationById(t)}async getEntitiesRelations(t={}){await this.#e?.sync();const{items:e,total:a,hasMore:i}=await this.#t.getEntitiesRelations(t);return l({data:e,params:t,totalCount:a,nameTransformationsFromDatabase:d,hasMore:i})}async createEntityRelation(t){return this.#e?.createEntityRelation(t)}async createEntitiesRelations(t){const e=this.#e;return e?await u(t,h,async a=>e.createEntityRelation(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.sourceKey,status:"error",error:i}))):(c.warn("No remote database found"),[])}async updateEntityRelation(t,e){const a={...e,...t,type:t.type??e.type};return this.#e?.createEntityRelation(a)}async deleteEntityRelation(t){let e=await this.#e?.deleteEntityRelation(t);return e||(e=await this.#t.deleteEntityRelation(t)),e}async deleteEntityRelationsInLocalDatabase(t){await this.#t.deleteEntityRelations(t)}async getEntitiesWithRelations({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i}){await this.#e?.sync();const{items:s,total:o,hasMore:y}=await this.#t.getEntitiesWithRelations({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i});return l({data:s,params:t,totalCount:o,hasMore:y})}async getEntityWithRelationsByKey({entityKey:t,filter:e,rbacTeams:a,excludedTypes:i,excludedEntities:s}){return this.#t.getEntityWithRelationsByKey({entityKey:t,filter:e,rbacTeams:a,excludedTypes:i,excludedEntities:s})}async getRelatedEntities({entityKey:t,paginationParams:e,rbacTeams:a,excludedTypes:i,excludedEntities:s}){await this.#e?.sync();const{items:o,total:y,hasMore:E}=await this.#t.getRelatedEntities({key:t,paginationParams:e,rbacTeams:a,excludedTypes:i,excludedEntities:s});return l({data:o,params:e,totalCount:y,nameTransformationsFromDatabase:d,hasMore:E})}async softDeleteEntitiesInLocalDatabase({filter:t,revision:e,fileHash:a}){await this.#t.softDeleteEntities({filter:t,revision:e,fileHash:a})}async listEntityRevisions(t,e){return await this.#e?.sync(),this.#t.listEntityRevisions(t,e)}async updateEntityScorecardsStatus(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatus(t,e)}async updateEntityScorecardsStatusIfCalculating(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatusIfCalculating(t,e)}async getOutdatedEntities(t){return await this.#e?.sync(),this.#t.getOutdatedEntities(t)}async setEntitiesAsOutdated(t){await this.#e?.sync(),await this.#t.setEntitiesAsOutdated(t)}}export{n as CatalogEntitiesService};
1
+ import{promiseMapLimit as u}from"../../../utils/async/promise-map-limit.js";import{logger as c}from"../../../tools/notifiers/logger.js";import{envConfig as r}from"../../../config/env-config.js";import{CatalogEntitiesLocalRepository as w}from"./repositories/local/catalog-entities-local-repository.js";import{CatalogEntitiesRemoteRepository as p}from"./repositories/remote/catalog-entities-remote-repository.js";import{prepareListResponse as l}from"../../../web-server/utils/prepare-list-response.js";import{ENTITY_RELATION_FROM_DATABASE as d}from"./mappers/field-transformations.js";import{hasOptionsChanged as m}from"../utils/has-options-changed.js";const h=15;class n{static#a;static#i;#t;#e;constructor(t,e){this.#t=t,this.#e=e}static async#n(t){const[e,a]=await Promise.all([w.getInstance(t),t.runOnlyLocalDatabase?null:p.getInstance(t)]),i=new n(e,a);a&&(r.isDevelopMode&&c.info("Attaching remote database to local database"),await i.#t.attachDatabase(a.path)),n.#a=i,n.#i=t}static async getInstance(t){return t.runOnlyLocalDatabase===void 0&&(t.runOnlyLocalDatabase=r.isDevelopMode),t.removeExisting===void 0&&(t.removeExisting=!1),(!n.#a||m(n.#i,t))&&await n.#n(t),n.#a}async transaction(...t){return this.#t.transactionsManager.transaction(...t)}async getEntities({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i}){await this.#e?.sync();const{items:s,total:o,hasMore:y}=await this.#t.getEntities({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i});return l({data:s,params:t,totalCount:o,hasMore:y})}async getEntityById(t,e){return await this.#e?.sync(),await this.#t.getEntityById(t,e)}async getEntityKeysAndVersionsBySourceFile(t){return await this.#e?.sync(),this.#t.getEntityKeysAndVersionsBySourceFile(t)}async getEntitiesCountByTypes(){return await this.#e?.sync(),this.#t.getEntitiesCountByTypes()}async getCatalogFilters(t){return await this.#e?.sync(),this.#t.getCatalogFilters(t)}async createEntity(t){if(r.isDevelopMode)throw new Error("Entity creation is not supported in the develop mode");return this.#e?this.#e.createEntity(t):(c.warn("No remote database found"),null)}async createEntities(t){if(r.isDevelopMode)throw new Error("Entity creation is not supported in the develop mode");const e=this.#e;return e?await u(t,h,async a=>e.createEntity(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.key,status:"error",error:i}))):(c.warn("No remote database found"),[])}getEntitySources(){return this.#t.getEntitySources()}async createEntityInLocalDatabase(t){return this.#t.createEntity(t)}async createEntitiesInLocalDatabase(t){await this.#t.createEntities(t)}async createEntityRelationInLocalDatabase(t){await this.#t.createEntityRelation(t)}async createEntityRelationsInLocalDatabase(t){await this.#t.createEntityRelations(t)}async updateEntity(t,e){if(r.isDevelopMode)throw new Error("Entity update is not supported in the develop mode");return await this.#e?.updateEntity(t,e)}async deleteEntity(t){if(r.isDevelopMode)throw new Error("Entity deletion is not supported in the develop mode");return await this.#e?.deleteEntity(t)}async deleteEntitiesInLocalDatabase(t){await this.#t.deleteEntities(t)}async getEntityRelationById(t){return await this.#e?.sync(),await this.#t.getEntityRelationById(t)}async getEntitiesRelations(t={}){await this.#e?.sync();const{items:e,total:a,hasMore:i}=await this.#t.getEntitiesRelations(t);return l({data:e,params:t,totalCount:a,nameTransformationsFromDatabase:d,hasMore:i})}async createEntityRelation(t){return this.#e?.createEntityRelation(t)}async createEntitiesRelations(t){const e=this.#e;return e?await u(t,h,async a=>e.createEntityRelation(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.sourceKey,status:"error",error:i}))):(c.warn("No remote database found"),[])}async updateEntityRelation(t,e){const a={...e,...t,type:t.type??e.type};return this.#e?.createEntityRelation(a)}async deleteEntityRelation(t){let e=await this.#e?.deleteEntityRelation(t);return e||(e=await this.#t.deleteEntityRelation(t)),e}async deleteEntityRelationsInLocalDatabase(t){await this.#t.deleteEntityRelations(t)}async getEntitiesWithRelations({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i}){await this.#e?.sync();const{items:s,total:o,hasMore:y}=await this.#t.getEntitiesWithRelations({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i});return l({data:s,params:t,totalCount:o,hasMore:y})}async getEntityWithRelationsByKey({entityKey:t,filter:e,rbacTeams:a,excludedTypes:i,excludedEntities:s}){return this.#t.getEntityWithRelationsByKey({entityKey:t,filter:e,rbacTeams:a,excludedTypes:i,excludedEntities:s})}async getRelatedEntities({entityKey:t,paginationParams:e,rbacTeams:a,excludedTypes:i,excludedEntities:s}){await this.#e?.sync();const{items:o,total:y,hasMore:E}=await this.#t.getRelatedEntities({key:t,paginationParams:e,rbacTeams:a,excludedTypes:i,excludedEntities:s});return l({data:o,params:e,totalCount:y,nameTransformationsFromDatabase:d,hasMore:E})}async softDeleteEntitiesInLocalDatabase({filter:t,revision:e,fileHash:a}){await this.#t.softDeleteEntities({filter:t,revision:e,fileHash:a})}async listEntityRevisions(t,e){return await this.#e?.sync(),this.#t.listEntityRevisions(t,e)}async updateEntityScorecardsStatus(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatus(t,e)}async updateEntityScorecardsStatusIfCalculating(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatusIfCalculating(t,e)}async getOutdatedEntities(t){return await this.#e?.sync(),this.#t.getOutdatedEntities(t)}async setEntitiesAsOutdated(t){await this.#e?.sync(),await this.#t.setEntitiesAsOutdated(t)}}export{n as CatalogEntitiesService};
@@ -57,10 +57,10 @@ export declare class CatalogEntitiesLocalRepository extends BaseRepository {
57
57
  createEntities(createEntitiesParams: CreateEntityParams[]): Promise<void>;
58
58
  createEntityRelation(entityRelation: EntityRelationDtoSchema): Promise<{
59
59
  id: string;
60
- createdAt: string;
61
- updatedAt: string;
62
60
  organizationId: string;
63
61
  projectId: string;
62
+ createdAt: string;
63
+ updatedAt: string;
64
64
  sourceFile: string | null;
65
65
  isDeleted: boolean | null;
66
66
  fileHash: string | null;
@@ -1 +1 @@
1
- import{and as m,eq as c,isNull as v,or as T,sql as F}from"drizzle-orm";import{logger as u}from"../../../../../tools/notifiers/logger.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{sha1 as O}from"../../../../../utils/crypto/sha1.js";import{envConfig as V}from"../../../../../../config/env-config.js";import{VERSION_NOT_SPECIFIED as U}from"@redocly/theme/core/constants";import{entitiesAttributesTable as I}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-attributes-table.js";import{createEntityDbRecord as b}from"../../mappers/create-entity-db-record.js";import{createEntityRelationDbRecordFromFileSchema as K}from"../../mappers/create-entity-relation-db-record-from-file-schema.js";import{entitiesTable as r}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-table.js";import{entitiesRelationsTable as i}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-relations-table.js";import{convertFilterToWhereCondition as C}from"../../../../../providers/database/pagination/filter.js";import{createEntityAttributesDbRecord as z}from"../../mappers/create-entity-attributes-db-record.js";import{RevisionRepository as L}from"../common/revision-repository.js";import{VersionRepository as P}from"../common/version-repository.js";const w=15;class re{#e;#t;#r;#i;#s;constructor(e,t,s){this.#e=e,this.#t=t,this.#r=s,this.#i=new L(e),this.#s=new P(e)}async createEntity({entity:e,fileHash:t,sourceFile:s,revision:a=new Date().toISOString(),isRootEntity:o=!1,isDeleted:n=!1,rbacTeams:d}){try{const{relations:l=[],...f}=e,p=O(JSON.stringify(f)),y=e.version??U,g=await this.#i.shouldSkipRevisionCreation(e.key,y,p,o,n);if(Array.isArray(d)&&await this.#o({entityKey:e.key,rbacTeams:d}),g)return{result:"skipped",entityKey:e.key};const h=await this.#i.shouldSetNewCurrentRevision({key:e.key,version:y,revision:a}),R=b({entity:{...e,revision:a,hash:p,isCurrent:h,isDefaultVersion:h,isDeleted:n,version:y},sourceFile:s,organizationId:this.#t,projectId:this.#r,source:"file",fileHash:t}),{key:D,source:x,...S}=R;if(h&&(await this.#i.markAllRevisionsAsNotCurrent(D),await this.#s.markAllVersionsAsNotDefault(D)),V.isDevelopMode&&V.REDOCLY_INTERNAL_DEV!=="true")return await this.#n(R,l),{result:"created",entityKey:e.key,entityRevision:a,entityVersion:y};const A=this.#e.client.insert(r).values(R).onConflictDoUpdate({target:[r.key,r.source,r.revision,r.version],set:S}),N=l?.length&&l.length>0?this.#e.client.insert(i).values(l.map(k=>K({relation:k,sourceFile:s,fileHash:t,sourceKey:e.key,sourceVersion:y,sourceRevision:a??null,organizationId:this.#t,projectId:this.#r}))).onConflictDoNothing({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation]}).run():Promise.resolve();return await E([A,N],w,async k=>k),{result:"created",entityKey:e.key,entityRevision:a,entityVersion:y}}catch(l){return u.error("Error adding entity",l),{result:"error",entityKey:e.key}}}async deleteEntity(e){try{return await this.#e.client.delete(r).where(c(r.key,e)),e}catch(t){return u.error("Error deleting entity",t),null}}async deleteEntities(e){try{const t=C(e);if(!t)return!1;const s=await this.#e.client.delete(r).where(t).returning({key:r.key,source:r.source,isCurrent:r.isCurrent,isDefaultVersion:r.isDefaultVersion,version:r.version});if(s.length===0)return!0;const a=s.reduce((o,n)=>((n.isCurrent||n.isDefaultVersion)&&o.add(n.key),o),new Set);if(a.size===0)return!0;await E(Array.from(a),w,async o=>this.#i.ensureDefaultAndCurrentRevisionForKey(o));for(const o of s)await this.#e.client.delete(i).where(T(m(c(i.sourceKey,o.key),...o.version?[c(i.sourceVersion,o.version)]:[v(i.sourceVersion)]),m(c(i.targetKey,o.key),...o.version?[c(i.targetVersion,o.version)]:[v(i.targetVersion)])));return!0}catch(t){return u.error("Error deleting entities",t),!1}}async deleteEntityRelation(e){try{return await this.#e.client.delete(i).where(c(i.id,e)),e}catch{return null}}async softDeleteEntities(e,t,s){try{const a=e.map(n=>{const d={type:n.type,key:n.key,title:n.title,summary:n.summary??void 0,tags:n.tags??void 0,metadata:n.metadata??void 0,git:n.git??void 0,contact:n.contact??void 0,links:n.links??void 0,version:n.version??void 0};return this.createEntity({entity:d,revision:t,sourceFile:n.sourceFile??"",fileHash:s,isDeleted:!0})});return await E(a,w,async n=>n)}catch(a){return u.error("Error soft deleting entities",a),[]}}async deleteEntityRelations(e){try{const t=C(e);return t?(await this.#e.client.delete(i).where(t),!0):!1}catch(t){return u.error("Error deleting entity relations",t),!1}}async upsertEntityRelation(e){if(!e)return null;try{const{sourceKey:t,targetKey:s,sourceVersion:a,targetVersion:o,sourceRevision:n,targetRevision:d,...l}=e,f=await this.#e.client.insert(i).values(e).onConflictDoUpdate({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation],set:l}).returning();return f?.length?f[0]:null}catch(t){return u.error("Error creating entity relation",t),null}}async#n(e,t){const{key:s,source:a,version:o,isDefaultVersion:n,...d}=e,p=(await this.#e.client.select({id:r.id}).from(r).where(m(c(r.key,s),c(r.source,a??"file"),o?c(r.version,o):v(r.version))).limit(1).run()).rows.length>0?this.#e.client.update(r).set(d).where(m(c(r.key,s),c(r.source,a??"file"),o?c(r.version,o):v(r.version))).run():this.#e.client.insert(r).values(e).onConflictDoUpdate({target:[r.key,r.source,r.revision,r.version],set:d}).run(),y=t?.map(g=>{const h=K({relation:g,sourceFile:e.sourceFile??"",fileHash:e.fileHash??"",sourceKey:e.key,sourceVersion:e.version??null,sourceRevision:e.revision??null,organizationId:this.#t,projectId:this.#r});return this.#e.client.insert(i).values(h).onConflictDoUpdate({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation],set:h}).run()})??[];await E([p,...y],w,async g=>g)}async updateEntityScorecardsStatus(e,t){try{return(await this.#e.client.update(r).set({scorecardsStatus:t}).where(c(r.id,e)).returning()).length>0}catch(s){return u.error("Error updating entity scorecards status",s),!1}}async updateEntityScorecardsStatusIfCalculating(e,t){try{return(await this.#e.client.update(r).set({scorecardsStatus:t}).where(F`${r.id} = ${e} AND ${r.scorecardsStatus} = 'CALCULATING'`).returning()).length>0}catch(s){return u.error("Error updating entity scorecards status if calculating",s),!1}}async#o({entityKey:e,rbacTeams:t}){try{await this.#e.client.insert(I).values(z({rbacTeams:t,entityKey:e,organizationId:this.#t,projectId:this.#r})).onConflictDoUpdate({target:[I.entityKey],set:{rbacTeams:JSON.stringify(t)}}).run()}catch(s){u.error("Error saving entity attributes",s)}}async setEntitiesAsOutdated(e){try{const t=C(e);await this.#e.client.update(r).set({scorecardsStatus:"OUTDATED"}).where(t)}catch(t){u.error("Error updating entities as outdated",t)}}}export{re as CatalogEntitiesLocalWriteRepository};
1
+ import{and as m,eq as c,isNull as v,or as T,sql as F}from"drizzle-orm";import{logger as u}from"../../../../../tools/notifiers/logger.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{sha1 as O}from"../../../../../utils/crypto/sha1.js";import{envConfig as V}from"../../../../../config/env-config.js";import{VERSION_NOT_SPECIFIED as U}from"@redocly/theme/core/constants";import{entitiesAttributesTable as I}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-attributes-table.js";import{createEntityDbRecord as b}from"../../mappers/create-entity-db-record.js";import{createEntityRelationDbRecordFromFileSchema as K}from"../../mappers/create-entity-relation-db-record-from-file-schema.js";import{entitiesTable as r}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-table.js";import{entitiesRelationsTable as i}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-relations-table.js";import{convertFilterToWhereCondition as C}from"../../../../../providers/database/pagination/filter.js";import{createEntityAttributesDbRecord as z}from"../../mappers/create-entity-attributes-db-record.js";import{RevisionRepository as L}from"../common/revision-repository.js";import{VersionRepository as P}from"../common/version-repository.js";const w=15;class re{#e;#t;#r;#i;#s;constructor(e,t,s){this.#e=e,this.#t=t,this.#r=s,this.#i=new L(e),this.#s=new P(e)}async createEntity({entity:e,fileHash:t,sourceFile:s,revision:a=new Date().toISOString(),isRootEntity:o=!1,isDeleted:n=!1,rbacTeams:d}){try{const{relations:l=[],...f}=e,p=O(JSON.stringify(f)),y=e.version??U,g=await this.#i.shouldSkipRevisionCreation(e.key,y,p,o,n);if(Array.isArray(d)&&await this.#o({entityKey:e.key,rbacTeams:d}),g)return{result:"skipped",entityKey:e.key};const h=await this.#i.shouldSetNewCurrentRevision({key:e.key,version:y,revision:a}),R=b({entity:{...e,revision:a,hash:p,isCurrent:h,isDefaultVersion:h,isDeleted:n,version:y},sourceFile:s,organizationId:this.#t,projectId:this.#r,source:"file",fileHash:t}),{key:D,source:x,...S}=R;if(h&&(await this.#i.markAllRevisionsAsNotCurrent(D),await this.#s.markAllVersionsAsNotDefault(D)),V.isDevelopMode&&V.REDOCLY_INTERNAL_DEV!=="true")return await this.#n(R,l),{result:"created",entityKey:e.key,entityRevision:a,entityVersion:y};const A=this.#e.client.insert(r).values(R).onConflictDoUpdate({target:[r.key,r.source,r.revision,r.version],set:S}),N=l?.length&&l.length>0?this.#e.client.insert(i).values(l.map(k=>K({relation:k,sourceFile:s,fileHash:t,sourceKey:e.key,sourceVersion:y,sourceRevision:a??null,organizationId:this.#t,projectId:this.#r}))).onConflictDoNothing({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation]}).run():Promise.resolve();return await E([A,N],w,async k=>k),{result:"created",entityKey:e.key,entityRevision:a,entityVersion:y}}catch(l){return u.error("Error adding entity",l),{result:"error",entityKey:e.key}}}async deleteEntity(e){try{return await this.#e.client.delete(r).where(c(r.key,e)),e}catch(t){return u.error("Error deleting entity",t),null}}async deleteEntities(e){try{const t=C(e);if(!t)return!1;const s=await this.#e.client.delete(r).where(t).returning({key:r.key,source:r.source,isCurrent:r.isCurrent,isDefaultVersion:r.isDefaultVersion,version:r.version});if(s.length===0)return!0;const a=s.reduce((o,n)=>((n.isCurrent||n.isDefaultVersion)&&o.add(n.key),o),new Set);if(a.size===0)return!0;await E(Array.from(a),w,async o=>this.#i.ensureDefaultAndCurrentRevisionForKey(o));for(const o of s)await this.#e.client.delete(i).where(T(m(c(i.sourceKey,o.key),...o.version?[c(i.sourceVersion,o.version)]:[v(i.sourceVersion)]),m(c(i.targetKey,o.key),...o.version?[c(i.targetVersion,o.version)]:[v(i.targetVersion)])));return!0}catch(t){return u.error("Error deleting entities",t),!1}}async deleteEntityRelation(e){try{return await this.#e.client.delete(i).where(c(i.id,e)),e}catch{return null}}async softDeleteEntities(e,t,s){try{const a=e.map(n=>{const d={type:n.type,key:n.key,title:n.title,summary:n.summary??void 0,tags:n.tags??void 0,metadata:n.metadata??void 0,git:n.git??void 0,contact:n.contact??void 0,links:n.links??void 0,version:n.version??void 0};return this.createEntity({entity:d,revision:t,sourceFile:n.sourceFile??"",fileHash:s,isDeleted:!0})});return await E(a,w,async n=>n)}catch(a){return u.error("Error soft deleting entities",a),[]}}async deleteEntityRelations(e){try{const t=C(e);return t?(await this.#e.client.delete(i).where(t),!0):!1}catch(t){return u.error("Error deleting entity relations",t),!1}}async upsertEntityRelation(e){if(!e)return null;try{const{sourceKey:t,targetKey:s,sourceVersion:a,targetVersion:o,sourceRevision:n,targetRevision:d,...l}=e,f=await this.#e.client.insert(i).values(e).onConflictDoUpdate({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation],set:l}).returning();return f?.length?f[0]:null}catch(t){return u.error("Error creating entity relation",t),null}}async#n(e,t){const{key:s,source:a,version:o,isDefaultVersion:n,...d}=e,p=(await this.#e.client.select({id:r.id}).from(r).where(m(c(r.key,s),c(r.source,a??"file"),o?c(r.version,o):v(r.version))).limit(1).run()).rows.length>0?this.#e.client.update(r).set(d).where(m(c(r.key,s),c(r.source,a??"file"),o?c(r.version,o):v(r.version))).run():this.#e.client.insert(r).values(e).onConflictDoUpdate({target:[r.key,r.source,r.revision,r.version],set:d}).run(),y=t?.map(g=>{const h=K({relation:g,sourceFile:e.sourceFile??"",fileHash:e.fileHash??"",sourceKey:e.key,sourceVersion:e.version??null,sourceRevision:e.revision??null,organizationId:this.#t,projectId:this.#r});return this.#e.client.insert(i).values(h).onConflictDoUpdate({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation],set:h}).run()})??[];await E([p,...y],w,async g=>g)}async updateEntityScorecardsStatus(e,t){try{return(await this.#e.client.update(r).set({scorecardsStatus:t}).where(c(r.id,e)).returning()).length>0}catch(s){return u.error("Error updating entity scorecards status",s),!1}}async updateEntityScorecardsStatusIfCalculating(e,t){try{return(await this.#e.client.update(r).set({scorecardsStatus:t}).where(F`${r.id} = ${e} AND ${r.scorecardsStatus} = 'CALCULATING'`).returning()).length>0}catch(s){return u.error("Error updating entity scorecards status if calculating",s),!1}}async#o({entityKey:e,rbacTeams:t}){try{await this.#e.client.insert(I).values(z({rbacTeams:t,entityKey:e,organizationId:this.#t,projectId:this.#r})).onConflictDoUpdate({target:[I.entityKey],set:{rbacTeams:JSON.stringify(t)}}).run()}catch(s){u.error("Error saving entity attributes",s)}}async setEntitiesAsOutdated(e){try{const t=C(e);await this.#e.client.update(r).set({scorecardsStatus:"OUTDATED"}).where(t)}catch(t){u.error("Error updating entities as outdated",t)}}}export{re as CatalogEntitiesLocalWriteRepository};
@@ -1 +1 @@
1
- import y from"node:path";import{removeLeadingSlash as f}from"@redocly/theme/core/utils";import{toKebabCase as m}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as g}from"../../../../../utils/async/promise-map-limit.js";import{removeMarkdocTags as w}from"../../../../markdown/markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as E}from"./base.js";const d=15;class D extends E{constructor(t){super("arazzo",t)}mapApiDescriptionToEntity(t,i){const a=f(t.realRelativePath),h=t.document.info.title,r=a.replace(/\.[^.]+$/,""),o=m(r.replace(/[\\/]/g,"-")),n=t.document["x-redocly-catalog-key"],e=typeof n=="string"&&n.trim()?m(n.trim()):o;return{type:this.type,key:e,title:h,summary:t.document.info.description?w(t.document.info.description):null,tags:["arazzo"],metadata:{specType:this.specType,descriptionFile:a},version:i}}async loadApiDescriptions(){return(await this.context.cache.load(".","arazzo-docs")).data}async processApiDescription(t,i,a,h){if(!this.#t(t)){this.context.logger.warn(`Skipping Arazzo description without source descriptions: ${t.realRelativePath}`);return}const r=this.getRbacTeamsForDefinition(t.relativePath),o=this.mapApiDescriptionToEntity(t,a);await this.catalogEntitiesService.createEntityInLocalDatabase({entity:o,sourceFile:t.realRelativePath,fileHash:t.hash,isRootEntity:!0,revision:i,rbacTeams:r}),h.delete(`${o.key}:${a}`),await this.#e(t,o.key,o.version,a,i,h,r);const n=t.document.sourceDescriptions||[];await g(n,d,async e=>{if(!(e.type!=="openapi"||!e.url))try{const c=this.resolveSourceDescriptionUrl(e.url,t.realRelativePath);if(!c){!e.url.startsWith("http://")&&!e.url.startsWith("https://")&&this.context.logger.warn(`Could not resolve URL to local path: ${e.url}`);return}const l=await this.context.cache.load(c,"load-oas");if(!(l.data&&Array.isArray(l.data)&&l.data.length>0)){this.context.logger.warn(`No OpenAPI definition found at path: ${c}`);return}const p=l.data[0],u=m(f(p.realRelativePath).replace(/\.[^.]+$/,"").replace(/[\\/]/g,"-"));await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:o.key,type:"relatesTo",targetKey:u,fileHash:t.hash}),await this.#r(t,e.name,p,o.key,u,o.version,i)}catch(c){this.context.logger.warn(`Failed to create relation to OpenAPI source "${e.url}": ${c instanceof Error?c.message:"Unknown error"}`)}})}#t=t=>!!t?.document?.sourceDescriptions&&t.document.sourceDescriptions.length>0;#e=async(t,i,a,h,r,o,n)=>{try{const e=t.document.components?.inputs,c=e?Object.entries(e):[],l=[];for(const[s,p]of c)l.push(async()=>{const u=await this.#a({schemaName:s,schema:p,description:t,parentKey:i,parentVersion:a,parentRevision:r,rbacTeams:n});o.delete(`${u.entityKey}:${h}`),u.result==="created"&&await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:i,type:"uses",targetKey:u.entityKey,fileHash:t.hash,sourceVersion:a,targetVersion:a,sourceRevision:r,targetRevision:r})});if(l.length===0)return;await g(l,d,s=>s())}catch(e){this.context.logger.warn(`Failed to create data schema entities for Arazzo description: ${e instanceof Error?e.message:"Unknown error"}`)}};#a=async({schemaName:t,schema:i,description:a,parentKey:h,parentVersion:r,parentRevision:o,rbacTeams:n})=>{const e={type:"data-schema",key:`${h}-${m(t)}`,title:t,summary:i.description||i.title||null,tags:["arazzo"],metadata:{specType:this.specType,descriptionFile:a.realRelativePath,schema:"{}"},version:r};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:e,sourceFile:a.realRelativePath,fileHash:a.hash,revision:o,rbacTeams:n})};#r=async(t,i,a,h,r,o,n)=>{const e=t.document.workflows||[];if(e.length===0)return;const c=new Set;for(const l of e)for(const s of l.steps||[]){if(!s.operationId)continue;const p=s.operationId.startsWith(`${i}.`)?s.operationId.substring(`${i}.`.length):s.operationId;p&&c.add(p)}c.size!==0&&await g(Array.from(c),d,async l=>{try{const s=`${r}-${m(l)}`;await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:h,type:"uses",targetKey:s,fileHash:t.hash,sourceVersion:o,targetVersion:o,sourceRevision:n,targetRevision:n})}catch(s){this.context.logger.warn(`Failed to create relation to operation "${l}": ${s instanceof Error?s.message:"Unknown error"}`)}})};resolveSourceDescriptionUrl(t,i){try{const a=t.trim(),h=a.startsWith("@")?a.slice(1):a,[r]=h.split("#");if(r.startsWith("http://")||r.startsWith("https://"))return null;if(r.startsWith("/"))return f(y.posix.normalize(r));const o=y.posix.dirname(i);return r.startsWith(o+"/")?y.posix.normalize(r):y.posix.normalize(y.posix.join(o,r))}catch{return this.context.logger.warn(`Failed to resolve URL: ${t}`),null}}}export{D as ArazzoEntitiesExtractor};
1
+ import y from"node:path";import{removeLeadingSlash as f}from"@redocly/theme/core/utils";import{toKebabCase as m}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as g}from"../../../../../utils/async/promise-map-limit.js";import{removeMarkdocTags as w}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as E}from"./base.js";const d=15;class D extends E{constructor(t){super("arazzo",t)}mapApiDescriptionToEntity(t,i){const a=f(t.realRelativePath),h=t.document.info.title,r=a.replace(/\.[^.]+$/,""),o=m(r.replace(/[\\/]/g,"-")),n=t.document["x-redocly-catalog-key"],e=typeof n=="string"&&n.trim()?m(n.trim()):o;return{type:this.type,key:e,title:h,summary:t.document.info.description?w(t.document.info.description):null,tags:["arazzo"],metadata:{specType:this.specType,descriptionFile:a},version:i}}async loadApiDescriptions(){return(await this.context.cache.load(".","arazzo-docs")).data}async processApiDescription(t,i,a,h){if(!this.#t(t)){this.context.logger.warn(`Skipping Arazzo description without source descriptions: ${t.realRelativePath}`);return}const r=this.getRbacTeamsForDefinition(t.relativePath),o=this.mapApiDescriptionToEntity(t,a);await this.catalogEntitiesService.createEntityInLocalDatabase({entity:o,sourceFile:t.realRelativePath,fileHash:t.hash,isRootEntity:!0,revision:i,rbacTeams:r}),h.delete(`${o.key}:${a}`),await this.#e(t,o.key,o.version,a,i,h,r);const n=t.document.sourceDescriptions||[];await g(n,d,async e=>{if(!(e.type!=="openapi"||!e.url))try{const c=this.resolveSourceDescriptionUrl(e.url,t.realRelativePath);if(!c){!e.url.startsWith("http://")&&!e.url.startsWith("https://")&&this.context.logger.warn(`Could not resolve URL to local path: ${e.url}`);return}const l=await this.context.cache.load(c,"load-oas");if(!(l.data&&Array.isArray(l.data)&&l.data.length>0)){this.context.logger.warn(`No OpenAPI definition found at path: ${c}`);return}const p=l.data[0],u=m(f(p.realRelativePath).replace(/\.[^.]+$/,"").replace(/[\\/]/g,"-"));await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:o.key,type:"relatesTo",targetKey:u,fileHash:t.hash}),await this.#r(t,e.name,p,o.key,u,o.version,i)}catch(c){this.context.logger.warn(`Failed to create relation to OpenAPI source "${e.url}": ${c instanceof Error?c.message:"Unknown error"}`)}})}#t=t=>!!t?.document?.sourceDescriptions&&t.document.sourceDescriptions.length>0;#e=async(t,i,a,h,r,o,n)=>{try{const e=t.document.components?.inputs,c=e?Object.entries(e):[],l=[];for(const[s,p]of c)l.push(async()=>{const u=await this.#a({schemaName:s,schema:p,description:t,parentKey:i,parentVersion:a,parentRevision:r,rbacTeams:n});o.delete(`${u.entityKey}:${h}`),u.result==="created"&&await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:i,type:"uses",targetKey:u.entityKey,fileHash:t.hash,sourceVersion:a,targetVersion:a,sourceRevision:r,targetRevision:r})});if(l.length===0)return;await g(l,d,s=>s())}catch(e){this.context.logger.warn(`Failed to create data schema entities for Arazzo description: ${e instanceof Error?e.message:"Unknown error"}`)}};#a=async({schemaName:t,schema:i,description:a,parentKey:h,parentVersion:r,parentRevision:o,rbacTeams:n})=>{const e={type:"data-schema",key:`${h}-${m(t)}`,title:t,summary:i.description||i.title||null,tags:["arazzo"],metadata:{specType:this.specType,descriptionFile:a.realRelativePath,schema:"{}"},version:r};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:e,sourceFile:a.realRelativePath,fileHash:a.hash,revision:o,rbacTeams:n})};#r=async(t,i,a,h,r,o,n)=>{const e=t.document.workflows||[];if(e.length===0)return;const c=new Set;for(const l of e)for(const s of l.steps||[]){if(!s.operationId)continue;const p=s.operationId.startsWith(`${i}.`)?s.operationId.substring(`${i}.`.length):s.operationId;p&&c.add(p)}c.size!==0&&await g(Array.from(c),d,async l=>{try{const s=`${r}-${m(l)}`;await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:h,type:"uses",targetKey:s,fileHash:t.hash,sourceVersion:o,targetVersion:o,sourceRevision:n,targetRevision:n})}catch(s){this.context.logger.warn(`Failed to create relation to operation "${l}": ${s instanceof Error?s.message:"Unknown error"}`)}})};resolveSourceDescriptionUrl(t,i){try{const a=t.trim(),h=a.startsWith("@")?a.slice(1):a,[r]=h.split("#");if(r.startsWith("http://")||r.startsWith("https://"))return null;if(r.startsWith("/"))return f(y.posix.normalize(r));const o=y.posix.dirname(i);return r.startsWith(o+"/")?y.posix.normalize(r):y.posix.normalize(y.posix.join(o,r))}catch{return this.context.logger.warn(`Failed to resolve URL: ${t}`),null}}}export{D as ArazzoEntitiesExtractor};
@@ -1 +1 @@
1
- import{removeLeadingSlash as d}from"@redocly/theme/core/utils";import{toKebabCase as m}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as p}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as $}from"../../../../../utils/async/promise-map-limit-with-status.js";import{removeMarkdocTags as R}from"../../../../markdown/markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as E}from"./base.js";import{extractPartsFromComponentsRef as f}from"../../../utils/extract-parts-from-components-ref.js";import{extractPartsFromChannelsMessageRef as w}from"../../../utils/extract-parts-from-channels-message-ref.js";const u=15;class N extends E{constructor(e){super("asyncapi",e)}mapApiDescriptionToEntity(e,a){const s=d(e.realRelativePath),r=e.document.info.title,t=s.replace(/\.[^.]+$/,""),n=m(t.replace(/[\\/]/g,"-")),c=e.document["x-redocly-catalog-key"],o=typeof c=="string"&&c.trim()?m(c.trim()):n;return{type:this.type,key:o,title:r,summary:R(e.document.info.description),tags:e.document.info.tags?.map(i=>i.name),metadata:{specType:this.specType,descriptionFile:s},version:a}}async loadApiDescriptions(){return(await this.context.cache.load(".","asyncapi-docs")).data}async processApiDescription(e,a,s,r){const t=this.getRbacTeamsForDefinition(e.relativePath),n=this.mapApiDescriptionToEntity(e,s);await this.catalogEntitiesService.createEntityInLocalDatabase({entity:n,sourceFile:e.realRelativePath,fileHash:e.hash,isRootEntity:!0,revision:a,rbacTeams:t}),r.delete(`${n.key}:${s}`);const c=this.#a(e),[o,i]=await Promise.allSettled([this.#s(e,n.key,n.version,s,a,r,t),this.#r(c,e,n.key,n.version,s,a,r,t)]);o.status!=="fulfilled"&&this.context.logger.error("Schema processing failed:",o.reason),i.status!=="fulfilled"&&this.context.logger.error("Operation processing failed:",i.reason)}#a=e=>{const a=e.documentWithReferences.operations;return a?Object.entries(a).map(([s,r])=>({operationName:s,operation:r})):[]};#s=async(e,a,s,r,t,n,c)=>{const o=e.document.components?.schemas;if(!o)return;const i=Object.entries(o);if(i.length===0)return;const l=await $(i,u,async([h,y])=>{const g=await this.#n({schemaName:h,schema:y,description:e,parentKey:a,parentVersion:s,parentRevision:t,rbacTeams:c});n.delete(`${g.entityKey}:${r}`),g.result==="created"&&await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:a,type:"uses",targetKey:g.entityKey,fileHash:e.hash,sourceVersion:s,targetVersion:s,sourceRevision:t,targetRevision:t})},this.context.logger);l.count.failed>0&&this.context.logger.warn(`Schema processing completed with ${l.count.failed} failures out of ${i.length} schemas for ${e.realRelativePath}`)};#n=async({schemaName:e,schema:a,description:s,parentKey:r,parentVersion:t,parentRevision:n,rbacTeams:c})=>{const o=`${r}-${m(e)}`,i="title"in a?a.title??a.description:null,l=JSON.stringify(a),h={type:"data-schema",key:o,title:e,summary:i,tags:[],metadata:{specType:this.specType,schema:l},version:t};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:h,sourceFile:s.realRelativePath,fileHash:s.hash,revision:n,rbacTeams:c})};#r=async(e,a,s,r,t,n,c,o)=>{if(!e.length)return;const i=await $(e,u,async({operationName:l,operation:h})=>{const y=await this.#c(h,l,a,s,r,n,o);y&&c.delete(`${y}:${t}`)},this.context.logger);i.count.failed>0&&this.context.logger.warn(`Operation processing completed with ${i.count.failed} failures out of ${e.length} operations for ${a.realRelativePath}`)};#c=async(e,a,s,r,t,n,c)=>{const o=await this.#o(e.messages??[],s,r),i=await this.#i(a,e,o,s,r,t,n,c);return i.result==="created"&&await this.#l({apiOperationKey:i.entityKey,operation:e,descriptionUniqueKey:r,description:s,descriptionVersion:t,parentRevision:n}),i.entityKey??null};#o=async(e,a,s)=>{if(!e||e.length===0)return[];const r=new Set;for(const t of e){let n=null;if("$ref"in t){const c=t.$ref.startsWith("#/channels/")?this.#e(t.$ref,a):t.$ref;if(c){const o=f(c);if(o?.componentName&&o.componentType==="messages"){const i=a.documentWithReferences.components?.messages[o.componentName];i?.payload&&"$ref"in i.payload&&i.payload.$ref&&(n=i.payload.$ref)}}}else t.payload&&"$ref"in t.payload&&t.payload.$ref&&(n=t.payload.$ref);if(n){const c=f(n);c?.componentName&&c.componentType==="schemas"&&r.add(`${s}-${m(c.componentName)}`)}}return Array.from(r)};#i=async(e,a,s,r,t,n,c,o)=>{const i={type:"api-operation",key:`${t}-${m(e)}`,title:a.title||e,summary:a.summary??"",tags:a.tags?.map(h=>h.name)??[],metadata:{method:a.action==="send"?"PUBLISH":"SUBSCRIBE",path:a.channel.address??"",payload:a.action==="receive"?s:[],responses:a.action==="send"?s:[]},version:n};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:i,sourceFile:r.realRelativePath,fileHash:r.hash,revision:c,rbacTeams:o})};#l=async({apiOperationKey:e,operation:a,descriptionUniqueKey:s,description:r,descriptionVersion:t,parentRevision:n})=>(await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:e,type:"partOf",targetKey:s,fileHash:r.hash,sourceVersion:t,targetVersion:t,sourceRevision:n,targetRevision:n}),await this.#h(a,e,t,n),!Array.isArray(a.messages)||!a.messages?.length?[]:await this.#m(a.messages,e,r,s,t,n));#h=async(e,a,s,r)=>{e["x-catalog-relations"]?.length&&await p(e["x-catalog-relations"],u,async t=>{try{this.validateEntityRelationFileSchema(t),await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:a,type:t.type,targetKey:t.key,sourceVersion:s,targetVersion:"",sourceRevision:r,targetRevision:""})}catch(n){this.context.logger.warn(`Error creating entity relation for operation ${a} based on custom property: ${n instanceof Error?n.message:"Unknown error"}`)}})};#m=async(e,a,s,r,t,n)=>e.length===0?[]:(await p(e,u,async o=>await this.#y(o,a,s,r,t,n)??"")).filter(o=>!!o);#y=async(e,a,s,r,t,n)=>"$ref"in e?this.#f(e,a,s,r,t,n):e.payload?this.#u(e,a,s,r,t,n):null;#f=async(e,a,s,r,t,n)=>{const c=e.$ref.startsWith("#/channels/")?this.#e(e.$ref,s):e.$ref;if(!c)return null;const o=f(c);if(!o||!o.componentName||o.componentType!=="messages")return null;const i=s.documentWithReferences.components?.messages[o.componentName];return!i?.payload||!("$ref"in i.payload)||!i.payload.$ref?null:this.#t(i.payload.$ref,a,s,r,t,n)};#e=(e,a)=>{const s=w(e);if(!s||!s.channelName||!s.messageName)return null;const r=a.documentWithReferences.channels?.[s.channelName];if(!r?.messages)return null;const t=r.messages[s.messageName];return!t||!("$ref"in t)||typeof t.$ref!="string"||!t.$ref.startsWith("#/components/messages/")?null:t.$ref};#u=async(e,a,s,r,t,n)=>!e.payload||!("$ref"in e.payload)||!e.payload.$ref?null:this.#t(e.payload.$ref,a,s,r,t,n);#t=async(e,a,s,r,t,n)=>{const c=f(e);if(!c||!c.componentName||c.componentType!=="schemas")return null;const o=`${r}-${m(c.componentName)}`;return await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:a,type:"uses",targetKey:o,fileHash:s.hash,sourceVersion:t,targetVersion:t,sourceRevision:n,targetRevision:n}),o}}export{N as AsyncApiEntitiesExtractor};
1
+ import{removeLeadingSlash as d}from"@redocly/theme/core/utils";import{toKebabCase as m}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as p}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as $}from"../../../../../utils/async/promise-map-limit-with-status.js";import{removeMarkdocTags as R}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as E}from"./base.js";import{extractPartsFromComponentsRef as f}from"../../../utils/extract-parts-from-components-ref.js";import{extractPartsFromChannelsMessageRef as w}from"../../../utils/extract-parts-from-channels-message-ref.js";const u=15;class N extends E{constructor(e){super("asyncapi",e)}mapApiDescriptionToEntity(e,a){const s=d(e.realRelativePath),r=e.document.info.title,t=s.replace(/\.[^.]+$/,""),n=m(t.replace(/[\\/]/g,"-")),c=e.document["x-redocly-catalog-key"],o=typeof c=="string"&&c.trim()?m(c.trim()):n;return{type:this.type,key:o,title:r,summary:R(e.document.info.description),tags:e.document.info.tags?.map(i=>i.name),metadata:{specType:this.specType,descriptionFile:s},version:a}}async loadApiDescriptions(){return(await this.context.cache.load(".","asyncapi-docs")).data}async processApiDescription(e,a,s,r){const t=this.getRbacTeamsForDefinition(e.relativePath),n=this.mapApiDescriptionToEntity(e,s);await this.catalogEntitiesService.createEntityInLocalDatabase({entity:n,sourceFile:e.realRelativePath,fileHash:e.hash,isRootEntity:!0,revision:a,rbacTeams:t}),r.delete(`${n.key}:${s}`);const c=this.#a(e),[o,i]=await Promise.allSettled([this.#s(e,n.key,n.version,s,a,r,t),this.#r(c,e,n.key,n.version,s,a,r,t)]);o.status!=="fulfilled"&&this.context.logger.error("Schema processing failed:",o.reason),i.status!=="fulfilled"&&this.context.logger.error("Operation processing failed:",i.reason)}#a=e=>{const a=e.documentWithReferences.operations;return a?Object.entries(a).map(([s,r])=>({operationName:s,operation:r})):[]};#s=async(e,a,s,r,t,n,c)=>{const o=e.document.components?.schemas;if(!o)return;const i=Object.entries(o);if(i.length===0)return;const l=await $(i,u,async([h,y])=>{const g=await this.#n({schemaName:h,schema:y,description:e,parentKey:a,parentVersion:s,parentRevision:t,rbacTeams:c});n.delete(`${g.entityKey}:${r}`),g.result==="created"&&await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:a,type:"uses",targetKey:g.entityKey,fileHash:e.hash,sourceVersion:s,targetVersion:s,sourceRevision:t,targetRevision:t})},this.context.logger);l.count.failed>0&&this.context.logger.warn(`Schema processing completed with ${l.count.failed} failures out of ${i.length} schemas for ${e.realRelativePath}`)};#n=async({schemaName:e,schema:a,description:s,parentKey:r,parentVersion:t,parentRevision:n,rbacTeams:c})=>{const o=`${r}-${m(e)}`,i="title"in a?a.title??a.description:null,l=JSON.stringify(a),h={type:"data-schema",key:o,title:e,summary:i,tags:[],metadata:{specType:this.specType,schema:l},version:t};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:h,sourceFile:s.realRelativePath,fileHash:s.hash,revision:n,rbacTeams:c})};#r=async(e,a,s,r,t,n,c,o)=>{if(!e.length)return;const i=await $(e,u,async({operationName:l,operation:h})=>{const y=await this.#c(h,l,a,s,r,n,o);y&&c.delete(`${y}:${t}`)},this.context.logger);i.count.failed>0&&this.context.logger.warn(`Operation processing completed with ${i.count.failed} failures out of ${e.length} operations for ${a.realRelativePath}`)};#c=async(e,a,s,r,t,n,c)=>{const o=await this.#o(e.messages??[],s,r),i=await this.#i(a,e,o,s,r,t,n,c);return i.result==="created"&&await this.#l({apiOperationKey:i.entityKey,operation:e,descriptionUniqueKey:r,description:s,descriptionVersion:t,parentRevision:n}),i.entityKey??null};#o=async(e,a,s)=>{if(!e||e.length===0)return[];const r=new Set;for(const t of e){let n=null;if("$ref"in t){const c=t.$ref.startsWith("#/channels/")?this.#e(t.$ref,a):t.$ref;if(c){const o=f(c);if(o?.componentName&&o.componentType==="messages"){const i=a.documentWithReferences.components?.messages[o.componentName];i?.payload&&"$ref"in i.payload&&i.payload.$ref&&(n=i.payload.$ref)}}}else t.payload&&"$ref"in t.payload&&t.payload.$ref&&(n=t.payload.$ref);if(n){const c=f(n);c?.componentName&&c.componentType==="schemas"&&r.add(`${s}-${m(c.componentName)}`)}}return Array.from(r)};#i=async(e,a,s,r,t,n,c,o)=>{const i={type:"api-operation",key:`${t}-${m(e)}`,title:a.title||e,summary:a.summary??"",tags:a.tags?.map(h=>h.name)??[],metadata:{method:a.action==="send"?"PUBLISH":"SUBSCRIBE",path:a.channel.address??"",payload:a.action==="receive"?s:[],responses:a.action==="send"?s:[]},version:n};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:i,sourceFile:r.realRelativePath,fileHash:r.hash,revision:c,rbacTeams:o})};#l=async({apiOperationKey:e,operation:a,descriptionUniqueKey:s,description:r,descriptionVersion:t,parentRevision:n})=>(await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:e,type:"partOf",targetKey:s,fileHash:r.hash,sourceVersion:t,targetVersion:t,sourceRevision:n,targetRevision:n}),await this.#h(a,e,t,n),!Array.isArray(a.messages)||!a.messages?.length?[]:await this.#m(a.messages,e,r,s,t,n));#h=async(e,a,s,r)=>{e["x-catalog-relations"]?.length&&await p(e["x-catalog-relations"],u,async t=>{try{this.validateEntityRelationFileSchema(t),await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:a,type:t.type,targetKey:t.key,sourceVersion:s,targetVersion:"",sourceRevision:r,targetRevision:""})}catch(n){this.context.logger.warn(`Error creating entity relation for operation ${a} based on custom property: ${n instanceof Error?n.message:"Unknown error"}`)}})};#m=async(e,a,s,r,t,n)=>e.length===0?[]:(await p(e,u,async o=>await this.#y(o,a,s,r,t,n)??"")).filter(o=>!!o);#y=async(e,a,s,r,t,n)=>"$ref"in e?this.#f(e,a,s,r,t,n):e.payload?this.#u(e,a,s,r,t,n):null;#f=async(e,a,s,r,t,n)=>{const c=e.$ref.startsWith("#/channels/")?this.#e(e.$ref,s):e.$ref;if(!c)return null;const o=f(c);if(!o||!o.componentName||o.componentType!=="messages")return null;const i=s.documentWithReferences.components?.messages[o.componentName];return!i?.payload||!("$ref"in i.payload)||!i.payload.$ref?null:this.#t(i.payload.$ref,a,s,r,t,n)};#e=(e,a)=>{const s=w(e);if(!s||!s.channelName||!s.messageName)return null;const r=a.documentWithReferences.channels?.[s.channelName];if(!r?.messages)return null;const t=r.messages[s.messageName];return!t||!("$ref"in t)||typeof t.$ref!="string"||!t.$ref.startsWith("#/components/messages/")?null:t.$ref};#u=async(e,a,s,r,t,n)=>!e.payload||!("$ref"in e.payload)||!e.payload.$ref?null:this.#t(e.payload.$ref,a,s,r,t,n);#t=async(e,a,s,r,t,n)=>{const c=f(e);if(!c||!c.componentName||c.componentType!=="schemas")return null;const o=`${r}-${m(c.componentName)}`;return await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:a,type:"uses",targetKey:o,fileHash:s.hash,sourceVersion:t,targetVersion:t,sourceRevision:n,targetRevision:n}),o}}export{N as AsyncApiEntitiesExtractor};