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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/cli/develop.js +1 -1
  4. package/dist/cli/eject/resolveTheme.d.ts +1 -1
  5. package/dist/cli/eject/resolveTheme.js +1 -1
  6. package/dist/cli/prepare/copy-env-files.js +1 -1
  7. package/dist/cli/prepare/index.js +1 -1
  8. package/dist/cli/stats/collectors/openapi.js +1 -1
  9. package/dist/cli/telemetry/index.js +1 -1
  10. package/dist/client/App.js +1 -1
  11. package/dist/client/ErrorBoundary.js +1 -1
  12. package/dist/client/app/DevModeFloatingBar/index.d.ts +3 -0
  13. package/dist/client/app/DevModeFloatingBar/index.js +43 -0
  14. package/dist/client/app/Feedback/useSubmitFeedback.js +1 -1
  15. package/dist/client/app/Sidebar/InstancePicker.d.ts +10 -0
  16. package/dist/client/app/Sidebar/InstancePicker.js +48 -0
  17. package/dist/client/app/Sidebar/Sidebar.js +11 -3
  18. package/dist/client/app/Sidebar/useBreadcrumbs.js +1 -1
  19. package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
  20. package/dist/client/app/hooks/catalog/useCatalogClassic.js +1 -1
  21. package/dist/client/app/hooks/useAutoScroll.js +1 -1
  22. package/dist/client/app/hooks/useRouteChangeTracker.js +1 -1
  23. package/dist/client/app/hooks/utils/pathname-matches-active-section.d.ts +6 -0
  24. package/dist/client/app/hooks/utils/pathname-matches-active-section.js +1 -0
  25. package/dist/client/app/markdoc/custom-components/html-script.js +1 -0
  26. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -0
  27. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -0
  28. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -0
  29. package/dist/client/app/markdoc/hooks/use-store.js +1 -0
  30. package/dist/client/browser-entry.js +5 -5
  31. package/dist/client/constants/common.d.ts +2 -0
  32. package/dist/client/constants/common.js +1 -0
  33. package/dist/client/providers/hooks.js +1 -1
  34. package/dist/client/runtime/loader.js +1 -1
  35. package/dist/client/runtime/useSocketMessages.js +1 -1
  36. package/dist/{server/plugins/asyncapi-docs/template → client/templates/asyncapi-docs}/helpers.d.ts +3 -3
  37. package/dist/client/templates/asyncapi-docs/helpers.js +1 -0
  38. package/dist/{server/plugins/asyncapi-docs/template/AsyncApiDocs.d.ts → client/templates/asyncapi-docs/template.d.ts} +1 -1
  39. package/dist/{server/plugins/asyncapi-docs/template/AsyncApiDocs.js → client/templates/asyncapi-docs/template.js} +1 -1
  40. package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/helpers.d.ts +14 -1
  41. package/dist/client/templates/openapi-docs/helpers.js +5 -0
  42. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.d.ts → client/templates/openapi-docs/template.d.ts} +1 -1
  43. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.js → client/templates/openapi-docs/template.js} +1 -1
  44. package/dist/client/utils/catalog/inject-catalog-items.d.ts +1 -1
  45. package/dist/client/utils/catalog/inject-catalog-items.js +1 -1
  46. package/dist/constants/catalog-entities.d.ts +12 -0
  47. package/dist/constants/catalog-entities.js +1 -0
  48. package/dist/constants/common.d.ts +2 -2
  49. package/dist/constants/common.js +1 -1
  50. package/dist/constants/l10n/langs/ar.js +1 -1
  51. package/dist/constants/l10n/langs/de.js +1 -1
  52. package/dist/constants/l10n/langs/en.js +1 -1
  53. package/dist/constants/l10n/langs/es.js +1 -1
  54. package/dist/constants/l10n/langs/fr.js +1 -1
  55. package/dist/constants/l10n/langs/hi.js +1 -1
  56. package/dist/constants/l10n/langs/it.js +1 -1
  57. package/dist/constants/l10n/langs/ja.js +1 -1
  58. package/dist/constants/l10n/langs/ko.js +1 -1
  59. package/dist/constants/l10n/langs/pl.js +1 -1
  60. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  61. package/dist/constants/l10n/langs/pt.js +1 -1
  62. package/dist/constants/l10n/langs/ru.js +1 -1
  63. package/dist/constants/l10n/langs/uk.js +1 -1
  64. package/dist/constants/l10n/langs/zh.js +1 -1
  65. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-inner-text.d.ts +1 -1
  66. package/dist/markdoc/helpers/get-inner-text.js +2 -0
  67. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-variable.d.ts +2 -2
  68. package/dist/markdoc/helpers/get-variable.js +1 -0
  69. package/dist/markdoc/nodes/fence/index.js +1 -0
  70. package/dist/markdoc/nodes/heading.js +1 -0
  71. package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.d.ts +6 -6
  72. package/dist/markdoc/tags/json-example.d.ts +3 -0
  73. package/dist/markdoc/tags/json-schema.d.ts +3 -0
  74. package/dist/markdoc/tags/openapi-code-sample.d.ts +3 -0
  75. package/dist/markdoc/tags/openapi-example.d.ts +3 -0
  76. package/dist/markdoc/tags/openapi-response-sample.d.ts +3 -0
  77. package/dist/markdoc/tags/replay-openapi.d.ts +3 -0
  78. package/dist/markdoc/types.d.ts +8 -0
  79. package/dist/markdoc/types.js +0 -0
  80. package/dist/server/api-routes/import-api-routes-handlers.js +1 -1
  81. package/dist/server/api-routes/run-api-routes-worker.js +1 -1
  82. package/dist/server/config/env-config.js +1 -0
  83. package/dist/{config → server/config}/env-schema.d.ts +6 -3
  84. package/dist/{config → server/config}/env-schemas/database.d.ts +1 -1
  85. package/dist/server/config/env-schemas/database.js +1 -0
  86. package/dist/{config → server/config}/env-schemas/organization-project.d.ts +3 -0
  87. package/dist/{config → server/config}/env-schemas/organization-project.js +1 -1
  88. package/dist/server/constants/common.d.ts +3 -0
  89. package/dist/server/constants/common.js +1 -1
  90. package/dist/server/constants/feedback.d.ts +6 -0
  91. package/dist/server/constants/feedback.js +1 -0
  92. package/dist/server/constants/plugins/catalog-entities.d.ts +0 -11
  93. package/dist/server/constants/plugins/catalog-entities.js +1 -1
  94. package/dist/server/entitlements/entitlements-provider.js +1 -1
  95. package/dist/server/esbuild/esbuild-logger.js +1 -1
  96. package/dist/server/esbuild/esbuild.js +1 -1
  97. package/dist/server/esbuild/plugins/assets-resolver.js +1 -1
  98. package/dist/server/esbuild/plugins/esbuild-compile-resolver.js +1 -1
  99. package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
  100. package/dist/server/esbuild/plugins/themes-resolver.js +2 -2
  101. package/dist/server/{config/external-plugins.d.ts → external-plugins/resolve-external-plugins.d.ts} +2 -2
  102. package/dist/server/external-plugins/resolve-external-plugins.js +1 -0
  103. package/dist/server/fs/cache.js +1 -1
  104. package/dist/server/fs/fast-mtime.js +3 -3
  105. package/dist/server/fs/last-modified-tracker.js +1 -1
  106. package/dist/server/fs/utils/is-loader-cache-enabled.js +1 -1
  107. package/dist/server/node-bundle-entry.js +1 -1
  108. package/dist/server/plugins/analytics/adobe/index.js +1 -1
  109. package/dist/server/plugins/analytics/amplitude/index.js +1 -1
  110. package/dist/server/plugins/analytics/fullstory/index.js +1 -1
  111. package/dist/server/plugins/analytics/ga/index.js +1 -1
  112. package/dist/server/plugins/analytics/gtm/browser-hooks.js +1 -1
  113. package/dist/server/plugins/analytics/gtm/index.js +1 -1
  114. package/dist/server/plugins/analytics/heap/index.js +1 -1
  115. package/dist/server/plugins/analytics/rudderstack/index.js +1 -1
  116. package/dist/server/plugins/analytics/segment/index.js +1 -1
  117. package/dist/server/plugins/asyncapi-docs/index.js +1 -1
  118. package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.js +27 -27
  119. package/dist/server/plugins/catalog-classic/get-server-props.js +1 -1
  120. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
  121. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +2 -2
  122. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
  123. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
  124. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
  125. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
  126. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +1 -1
  127. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  128. package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.js +1 -1
  129. package/dist/server/plugins/catalog-entities/plugin.js +1 -1
  130. package/dist/server/plugins/config-parser/loaders/redocly-config-loader.js +1 -1
  131. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  132. package/dist/server/plugins/default-theme/index.js +1 -1
  133. package/dist/server/plugins/entitlements/index.js +1 -1
  134. package/dist/server/plugins/graphql-docs/index.js +1 -1
  135. package/dist/server/plugins/lifecycle.js +1 -1
  136. package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.js +1 -1
  137. package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.js +1 -1
  138. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.js +1 -1
  139. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.js +1 -1
  140. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.js +1 -1
  141. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.js +1 -1
  142. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
  143. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.js +1 -1
  144. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  145. package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.js +1 -1
  146. package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.js +1 -1
  147. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
  148. package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.js +1 -1
  149. package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.js +1 -1
  150. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.js +1 -1
  151. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.js +1 -1
  152. package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.js +1 -1
  153. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
  154. package/dist/server/plugins/markdown/markdoc/import-user-tags.js +1 -1
  155. package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
  156. package/dist/server/plugins/markdown/markdoc/partials.js +1 -1
  157. package/dist/server/plugins/markdown/markdoc/plugins/headings.js +1 -1
  158. package/dist/server/plugins/markdown/markdoc/plugins/render-mermaid.js +1 -1
  159. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  160. package/dist/server/plugins/markdown/runtime-transform.js +1 -1
  161. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  162. package/dist/server/plugins/markdown/search/get-search-documents.js +2 -2
  163. package/dist/server/plugins/markdown/search/nodes/section-node.js +1 -1
  164. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  165. package/dist/server/plugins/markdown/search/to-markdown.js +17 -13
  166. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  167. package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.js +1 -1
  168. package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.d.ts +5 -1
  169. package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.js +1 -1
  170. package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
  171. package/dist/server/plugins/mcp/docs-mcp/tools/search.d.ts +3 -2
  172. package/dist/server/plugins/mcp/docs-mcp/tools/search.js +6 -1
  173. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  174. package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
  175. package/dist/server/plugins/mcp/servers/docs-server.d.ts +9 -2
  176. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  177. package/dist/server/plugins/mcp/types.d.ts +20 -1
  178. package/dist/server/plugins/openapi-docs/decorators.js +1 -1
  179. package/dist/server/plugins/openapi-docs/get-server-props-custom-fields.js +1 -1
  180. package/dist/server/plugins/openapi-docs/index.js +1 -1
  181. package/dist/server/plugins/openapi-docs/instances.d.ts +33 -0
  182. package/dist/server/plugins/openapi-docs/instances.js +1 -0
  183. package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +20 -20
  184. package/dist/server/plugins/openapi-docs/search-indexer.js +1 -1
  185. package/dist/server/plugins/scorecard-classic/compute-scorecard.js +4 -4
  186. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  187. package/dist/server/plugins/scorecard-classic/lint.js +1 -1
  188. package/dist/server/plugins/scorecard-classic/template/Grid/Grid.d.ts +2 -1
  189. package/dist/server/plugins/scorecard-classic/template/Grid/Grid.js +3 -3
  190. package/dist/server/plugins/scorecard-classic/template/Grid/GridHeader.js +15 -9
  191. package/dist/server/plugins/scorecard-classic/template/Grid/GridRow.js +1 -1
  192. package/dist/server/plugins/scorecard-classic/template/index.styles.js +5 -6
  193. package/dist/server/plugins/scorecard-classic/template/views.js +1 -1
  194. package/dist/server/plugins/scorecards/database/scorecards-config-service.js +1 -1
  195. package/dist/server/plugins/scorecards/plugin.js +1 -1
  196. package/dist/server/plugins/scorecards/workers/run-scorecards-worker.js +1 -1
  197. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.d.ts +11 -0
  198. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -0
  199. package/dist/server/plugins/search/documents/search-documents.js +1 -1
  200. package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
  201. package/dist/server/plugins/search/engines/typesense/index.js +1 -1
  202. package/dist/server/plugins/search/index.js +1 -1
  203. package/dist/server/plugins/search/llmstxt/index.js +1 -1
  204. package/dist/server/plugins/search/utils.d.ts +2 -0
  205. package/dist/server/plugins/search/utils.js +2 -2
  206. package/dist/server/plugins/sidebars/index.js +2 -2
  207. package/dist/server/plugins/sso/index.js +1 -1
  208. package/dist/server/providers/database/base-repository.js +1 -1
  209. package/dist/server/providers/database/database-connection-factory.js +1 -1
  210. package/dist/server/providers/database/database-preconnect-service.js +1 -1
  211. package/dist/server/providers/database/databases/sqld-sqlite/drizzle.config.js +1 -1
  212. package/dist/server/ssr/render.js +1 -1
  213. package/dist/server/ssr/server-side-props/get-server-props-from-user-handler.js +1 -1
  214. package/dist/server/ssr/utils.js +1 -1
  215. package/dist/server/store.d.ts +3 -1
  216. package/dist/server/store.js +1 -1
  217. package/dist/server/telemetry/index.js +1 -1
  218. package/dist/server/tools/notifiers/formatter.js +1 -1
  219. package/dist/server/tools/notifiers/helpers/colors.js +1 -1
  220. package/dist/server/tools/notifiers/logger.js +1 -1
  221. package/dist/server/tools/notifiers/reporter.js +1 -1
  222. package/dist/server/tools/notifiers/terminal-manager.js +1 -1
  223. package/dist/server/types/plugins/common.d.ts +1 -0
  224. package/dist/server/types/plugins/markdown.d.ts +0 -7
  225. package/dist/server/utils/ai-agent-detection.d.ts +16 -0
  226. package/dist/server/utils/ai-agent-detection.js +1 -0
  227. package/dist/server/utils/envs/load-env-variables.js +1 -1
  228. package/dist/server/utils/fs.js +1 -1
  229. package/dist/server/utils/index.d.ts +2 -2
  230. package/dist/server/utils/index.js +1 -1
  231. package/dist/server/utils/is-catalog-entities-enabled.js +1 -1
  232. package/dist/server/utils/is-scorecards-enabled.js +1 -1
  233. package/dist/server/utils/report-all-errors.js +1 -1
  234. package/dist/server/version.js +1 -1
  235. package/dist/server/web-server/auth.d.ts +2 -0
  236. package/dist/server/web-server/auth.js +4 -4
  237. package/dist/server/web-server/handle-api-route-request.js +1 -1
  238. package/dist/server/web-server/http.js +2 -2
  239. package/dist/server/web-server/middleware/apiKeyMiddleware.js +1 -1
  240. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  241. package/dist/server/web-server/middleware/corsMiddleware.js +1 -1
  242. package/dist/server/web-server/middleware/dynamic-middleware/dynamic-middleware.js +1 -1
  243. package/dist/server/web-server/middleware/idleTimeoutMiddleware.js +1 -1
  244. package/dist/server/web-server/middleware/responseHeadersMiddleware.js +1 -1
  245. package/dist/server/web-server/mime-types.js +1 -1
  246. package/dist/server/web-server/routes/auth.js +1 -1
  247. package/dist/server/web-server/routes/cors-proxy.d.ts +5 -0
  248. package/dist/server/web-server/routes/cors-proxy.js +2 -0
  249. package/dist/server/web-server/routes/dynamic-route.js +1 -1
  250. package/dist/server/web-server/routes/error.js +1 -1
  251. package/dist/server/web-server/routes/feedback.js +1 -1
  252. package/dist/server/web-server/routes/helpers/get-md-asset-pathname.d.ts +2 -0
  253. package/dist/server/web-server/routes/helpers/get-md-asset-pathname.js +1 -0
  254. package/dist/server/web-server/routes/index.js +1 -1
  255. package/dist/server/web-server/routes/info.js +1 -1
  256. package/dist/server/web-server/routes/mcp-oauth.js +1 -1
  257. package/dist/server/web-server/routes/otel/otel.js +1 -1
  258. package/dist/server/web-server/routes/page-data.js +1 -1
  259. package/dist/server/web-server/routes/path-prefix-redirect.js +1 -1
  260. package/dist/server/web-server/routes/resolve-route.js +1 -1
  261. package/dist/server/web-server/routes/semantic-search.d.ts +4 -0
  262. package/dist/server/web-server/routes/semantic-search.js +1 -0
  263. package/dist/server/workers/worker-pool.js +1 -1
  264. package/dist/{server/utils → utils}/slugger.d.ts +13 -0
  265. package/package.json +11 -11
  266. package/dist/client/app/ErrorBubble/index.d.ts +0 -3
  267. package/dist/client/app/ErrorBubble/index.js +0 -59
  268. package/dist/client/app/PageCounter/index.d.ts +0 -3
  269. package/dist/client/app/PageCounter/index.js +0 -64
  270. package/dist/config/env-config.js +0 -1
  271. package/dist/config/env-schemas/database.js +0 -1
  272. package/dist/server/config/external-plugins.js +0 -1
  273. package/dist/server/plugins/asyncapi-docs/template/helpers.js +0 -1
  274. package/dist/server/plugins/markdown/markdoc/custom-components/html-script.js +0 -1
  275. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-code-sample.js +0 -1
  276. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-response-sample.js +0 -1
  277. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/replay-openapi.js +0 -1
  278. package/dist/server/plugins/markdown/markdoc/helpers/get-inner-text.js +0 -2
  279. package/dist/server/plugins/markdown/markdoc/helpers/get-variable.js +0 -1
  280. package/dist/server/plugins/markdown/markdoc/hooks/use-store.js +0 -1
  281. package/dist/server/plugins/markdown/markdoc/nodes/fence/index.js +0 -1
  282. package/dist/server/plugins/markdown/markdoc/nodes/heading.js +0 -1
  283. package/dist/server/plugins/markdown/markdoc/tags/json-example.d.ts +0 -3
  284. package/dist/server/plugins/markdown/markdoc/tags/json-schema.d.ts +0 -3
  285. package/dist/server/plugins/markdown/markdoc/tags/openapi-code-sample.d.ts +0 -3
  286. package/dist/server/plugins/markdown/markdoc/tags/openapi-example.d.ts +0 -3
  287. package/dist/server/plugins/markdown/markdoc/tags/openapi-response-sample.d.ts +0 -3
  288. package/dist/server/plugins/markdown/markdoc/tags/replay-openapi.d.ts +0 -3
  289. package/dist/server/plugins/openapi-docs/template/helpers.js +0 -5
  290. package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.d.ts +0 -6
  291. package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.js +0 -1
  292. /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.d.ts +0 -0
  293. /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.js +0 -0
  294. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/html-script.d.ts +0 -0
  295. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.d.ts +0 -0
  296. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.js +0 -0
  297. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.d.ts +0 -0
  298. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.js +0 -0
  299. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.d.ts +0 -0
  300. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.js +0 -0
  301. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.d.ts +0 -0
  302. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.js +0 -0
  303. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.d.ts +0 -0
  304. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.js +0 -0
  305. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.d.ts +0 -0
  306. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.js +0 -0
  307. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.d.ts +0 -0
  308. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.js +0 -0
  309. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.d.ts +0 -0
  310. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.js +0 -0
  311. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.d.ts +0 -0
  312. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.js +0 -0
  313. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.d.ts +0 -0
  314. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.js +0 -0
  315. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.d.ts +0 -0
  316. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.js +0 -0
  317. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.d.ts +0 -0
  318. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.js +0 -0
  319. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.d.ts +0 -0
  320. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.js +0 -0
  321. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-code-sample.d.ts +0 -0
  322. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.d.ts +0 -0
  323. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.js +0 -0
  324. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-response-sample.d.ts +0 -0
  325. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/replay-openapi.d.ts +0 -0
  326. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.d.ts +0 -0
  327. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.js +0 -0
  328. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.d.ts +0 -0
  329. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.js +0 -0
  330. /package/dist/{server/plugins/markdown → client/app}/markdoc/hooks/use-store.d.ts +0 -0
  331. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.d.ts +0 -0
  332. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.js +0 -0
  333. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.d.ts +0 -0
  334. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.js +0 -0
  335. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.d.ts +0 -0
  336. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.js +0 -0
  337. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.d.ts +0 -0
  338. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.js +0 -0
  339. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.d.ts +0 -0
  340. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.js +0 -0
  341. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.d.ts +0 -0
  342. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.js +0 -0
  343. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.d.ts +0 -0
  344. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.js +0 -0
  345. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.d.ts +0 -0
  346. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.js +0 -0
  347. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.d.ts +0 -0
  348. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.js +0 -0
  349. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.d.ts +0 -0
  350. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.js +0 -0
  351. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.d.ts +0 -0
  352. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.js +0 -0
  353. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.d.ts +0 -0
  354. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.js +0 -0
  355. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.d.ts +0 -0
  356. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.js +0 -0
  357. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.d.ts +0 -0
  358. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.js +0 -0
  359. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.d.ts +0 -0
  360. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.js +0 -0
  361. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.d.ts +0 -0
  362. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.js +0 -0
  363. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.d.ts +0 -0
  364. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.js +0 -0
  365. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.d.ts +0 -0
  366. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.js +0 -0
  367. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.d.ts +0 -0
  368. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.js +0 -0
  369. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.d.ts +0 -0
  370. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.js +0 -0
  371. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.d.ts +0 -0
  372. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.js +0 -0
  373. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.d.ts +0 -0
  374. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.js +0 -0
  375. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.d.ts +0 -0
  376. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.js +0 -0
  377. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.d.ts +0 -0
  378. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.js +0 -0
  379. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.d.ts +0 -0
  380. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.js +0 -0
  381. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/index.d.ts +0 -0
  382. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.d.ts +0 -0
  383. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.js +0 -0
  384. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/heading.d.ts +0 -0
  385. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.d.ts +0 -0
  386. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.js +0 -0
  387. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.d.ts +0 -0
  388. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.js +0 -0
  389. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.d.ts +0 -0
  390. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.js +0 -0
  391. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.js +0 -0
  392. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-example.js +0 -0
  393. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-schema.js +0 -0
  394. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-code-sample.js +0 -0
  395. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-example.js +0 -0
  396. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-response-sample.js +0 -0
  397. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/replay-openapi.js +0 -0
  398. /package/dist/{config → server/config}/env-config.d.ts +0 -0
  399. /package/dist/{config → server/config}/env-schema.js +0 -0
  400. /package/dist/{config → server/config}/env-schemas/api-urls.d.ts +0 -0
  401. /package/dist/{config → server/config}/env-schemas/api-urls.js +0 -0
  402. /package/dist/{config → server/config}/env-schemas/auth.d.ts +0 -0
  403. /package/dist/{config → server/config}/env-schemas/auth.js +0 -0
  404. /package/dist/{config → server/config}/env-schemas/catalog.d.ts +0 -0
  405. /package/dist/{config → server/config}/env-schemas/catalog.js +0 -0
  406. /package/dist/{config → server/config}/env-schemas/environment-detection.d.ts +0 -0
  407. /package/dist/{config → server/config}/env-schemas/environment-detection.js +0 -0
  408. /package/dist/{config → server/config}/env-schemas/feature-flags.d.ts +0 -0
  409. /package/dist/{config → server/config}/env-schemas/feature-flags.js +0 -0
  410. /package/dist/{config → server/config}/env-schemas/scorecards.d.ts +0 -0
  411. /package/dist/{config → server/config}/env-schemas/scorecards.js +0 -0
  412. /package/dist/{config → server/config}/env-schemas/search.d.ts +0 -0
  413. /package/dist/{config → server/config}/env-schemas/search.js +0 -0
  414. /package/dist/{config → server/config}/env-schemas/server-config.d.ts +0 -0
  415. /package/dist/{config → server/config}/env-schemas/server-config.js +0 -0
  416. /package/dist/{config → server/config}/env-schemas/site.d.ts +0 -0
  417. /package/dist/{config → server/config}/env-schemas/site.js +0 -0
  418. /package/dist/{config → server/config}/env-schemas/ssr.d.ts +0 -0
  419. /package/dist/{config → server/config}/env-schemas/ssr.js +0 -0
  420. /package/dist/{config → server/config}/env-schemas/telemetry.d.ts +0 -0
  421. /package/dist/{config → server/config}/env-schemas/telemetry.js +0 -0
  422. /package/dist/{config → server/config}/env-schemas/test.d.ts +0 -0
  423. /package/dist/{config → server/config}/env-schemas/test.js +0 -0
  424. /package/dist/server/{config → external-plugins}/resolve-module.d.ts +0 -0
  425. /package/dist/server/{config → external-plugins}/resolve-module.js +0 -0
  426. /package/dist/{server/utils → utils}/conflict-resolvers.d.ts +0 -0
  427. /package/dist/{server/utils → utils}/conflict-resolvers.js +0 -0
  428. /package/dist/{server/utils → utils}/slugger.js +0 -0
@@ -1,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
@@ -0,0 +1 @@
1
+ import{existsSync as f}from"node:fs";import n from"node:path";import{resolvePlugins as F}from"@redocly/openapi-core";import{logger as d}from"@redocly/openapi-core";import{DEFAULT_PROJECT_PLUGIN_PATHS as m,DEFAULT_THEME_PLUGIN_PATH as P,STYLES_FILE as D}from"../constants/common.js";import{GATED_PLUGINS as h}from"../constants/entitlements.js";import{isDefined as I}from"../../utils/guards/is-defined.js";import{reporter as C}from"../tools/notifiers/reporter.js";import{sha as L}from"../utils/crypto/sha.js";import{resolveModule as _}from"./resolve-module.js";import{EntitlementsProvider as A}from"../entitlements/entitlements-provider.js";const u={sha:"",value:Promise.resolve({resolvedPlugins:[],errors:[]})},g="Deprecated plugin format detected:",p=new Set,v=d.info.bind(d);d.info=e=>{if(!e.startsWith(g)){v(e);return}const t=e.slice(g.length).trim();p.has(t)||(p.add(t),v(e))};async function B(e,t=[]){const r=L(JSON.stringify(t));if(u.sha!==r){u.sha=r;const s=T(e,t),l=await F(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=>S(i))).then(i=>{const c=i.filter(I),E=c.filter(a=>a?.type&&["error","warning"].includes(a.type)),y=c.filter(a=>a.type==="resolvedPlugin");return{errors:E,resolvedPlugins:y}})}const o=await u.value;if(o.errors.length)for(let s=0;s<o.errors.length;s++)await C.panicOnBuildContentError(o.errors[s].error);return o.resolvedPlugins}function T(e,t=[]){const r=[...t];for(const o of m)!r.includes(o)&&f(n.join(e,o))&&r.push(o);return r.includes(P)||r.unshift(P),r}async function S(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}=k(e);return{name:n.dirname(e.path),type:"resolvedPlugin",isNpmPackage:j(e.path),pluginDirAbsolutePath:t,lifecyclePlugin:r,config:o,stylesFile:n.resolve(t,D),markdoc:N(t)}}function j(e){const t=n.dirname(e);return _(n.join(t,"package.json"))!=null}function k(e){const t=A.instance(),r=e.path||"",o=!t.canAccessFeature("customPlugins")&&!h.includes(r),s=e.requiredEntitlements&&h.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 N(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{B 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 w}from"./utils/async-storage.js";import{isLoaderCacheEnabled as L}from"./utils/is-loader-cache-enabled.js";import{LoadError as y}from"./load-error.js";import{createLifecycleContext as S}from"../plugins/lifecycle.js";function p(v,t){return v+":"+t}class q{fs;errors=new Map;#t=new F;#i=new Map;#e=new Map;#s=new Map;#a=new F;#r;#o={};#n=new Map;constructor(t){this.fs=t,this.#r=S(t,this),this.#d()}async load(t,s,i){let e,h;typeof s=="string"?(e=s,h=this.#o[s]):(e=s.name,h=s.loader);const o=p(e,t);if(this.#n.has(o))return this.#n.get(o);const n=i?.join(""),r=n!==void 0?n.length>30?M(n):n:void 0,c=w.getStore()??[],I=!this.#h(t,e,r),g=this.#t.get(e,t);if(I&&g)return c.push({type:"load",loaderId:e,resource:t,hash:g.compoundHash}),g;const d=Promise.withResolvers();this.#n.set(o,d.promise),r!==void 0&&this.#e.set(o,r);const{status:C,value:l}=await this.#l(t,e,async()=>{let u;const P=w.getStore()||[],m=[],E=a=>m.push(a);try{u=await h(t,this.#r,E),m.length>0?this.errors.set(o,m):this.errors.delete(o)}catch(a){const f=this.#t.get(e,t)?.data,H=e==="redocly-config"||e==="nearest-redocly-config"?!1:(await this.load(t,"is-ignored")).data;if(!(a instanceof y)&&!H&&this.errors.set(o,[a]),!f)return{status:"error",value:a instanceof y?a:new y(a.message,{cause:a,loaderId:e})};u=f}const R=M(t+(r??"")+P.map(a=>a.hash).sort((a,f)=>a.localeCompare(f)).join(""));return c.push({type:"load",loaderId:e,resource:t,hash:R}),{status:"success",value:{data:u,compoundHash:R}}});return C==="error"?d.reject(l):(this.#c(t),L(e)&&this.#t.set(e,t,l),this.#i.set(o,l.compoundHash),d.resolve(l)),this.#n.delete(o),d.promise}setLoaders(t){this.#o={...this.#o,...t}}delete(t,s){if(s){const i=p(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 h of e)this.delete(h,s);this.#s.delete(t)}this.#a.delete(s,t)}else for(const i of this.#t.keys())this.delete(t,i)}#c(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]))}#d(){this.fs.watch(async t=>{for(const s of t)s.event==="unlink"&&this.delete(s.path)})}#h(t,s,i){const e=p(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 r=p(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)}})}#l(t,s,i){const e=[];return this.#a.set(s,t,e),w.run(e,i)}}export{q as Cache};
1
+ import{sha1 as M}from"../utils/crypto/sha1.js";import{NestedMap as H}from"./utils/nested-map.js";import{trackAccessStore as y}from"./utils/async-storage.js";import{isLoaderCacheEnabled as S}from"./utils/is-loader-cache-enabled.js";import{LoadError as v}from"./load-error.js";import{createLifecycleContext as k}from"../plugins/lifecycle.js";function p(C,t){return C+":"+t}class z{fs;errors=new Map;#t=new Map;#n=new Map;#e=new Map;#s=new Map;#i=new H;#r;#o={};#a=new Map;constructor(t){this.fs=t,this.#r=k(t,this),this.#f()}#c(t){let e=this.#t.get(t);return e||(e=new Map,this.#t.set(t,e)),e}async load(t,e,n){let s,h;typeof e=="string"?(s=e,h=this.#o[e]):(s=e.name,h=e.loader);const o=p(s,t);if(this.#a.has(o))return this.#a.get(o);const a=n?.join(""),r=a!==void 0?a.length>30?M(a):a:void 0,c=y.getStore()??[],F=!this.#h(t,s,r),g=this.#c(s),u=g.get(t);if(F&&u)return c.push({type:"load",loaderId:s,resource:t,hash:u.compoundHash}),u;const d=Promise.withResolvers();this.#a.set(o,d.promise),r!==void 0&&this.#e.set(o,r);const{status:L,value:l}=await this.#p(t,s,async()=>{let m;const I=y.getStore()||[],w=[],P=i=>w.push(i);try{m=await h(t,this.#r,P),w.length>0?this.errors.set(o,w):this.errors.delete(o)}catch(i){const f=g.get(t)?.data,E=s==="redocly-config"||s==="nearest-redocly-config"?!1:(await this.load(t,"is-ignored")).data;if(!(i instanceof v)&&!E&&this.errors.set(o,[i]),!f)return{status:"error",value:i instanceof v?i:new v(i.message,{cause:i,loaderId:s})};m=f}const R=M(t+(r??"")+I.map(i=>i.hash).sort((i,f)=>i.localeCompare(f)).join(""));return c.push({type:"load",loaderId:s,resource:t,hash:R}),{status:"success",value:{data:m,compoundHash:R}}});return L==="error"?d.reject(l):(this.#l(t),S(s)&&g.set(t,l),this.#n.set(o,l.compoundHash),d.resolve(l)),this.#a.delete(o),d.promise}setLoaders(t){this.#o={...this.#o,...t}}delete(t,e){if(e){const n=p(e,t);this.#d(t,e),this.errors.delete(n),this.#n.delete(n),this.#e.delete(n);const s=this.#s.get(t);if(s){for(const h of s)this.delete(h,e);this.#s.delete(t)}this.#i.delete(e,t)}else for(const n of this.#t.keys())this.delete(t,n)}#d(t,e){const n=this.#t.get(e);n&&n.delete(t)}#l(t){const[e,n]=t.split("#");if(!n)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,n){const s=p(e,t);return n!==void 0&&this.#e.get(s)!==n?!0:(this.#i.get(e,t)??[]).some(a=>{switch(a.type){case"load":const r=p(a.loaderId,a.resource);return this.#n.get(r)!==a.hash||this.#h(a.resource,a.loaderId,this.#e.get(r));case"read":return a.hash!==this.fs.getFileInfo(a.path)?.hash;case"exists":const c=this.fs.getFileInfo(a.path);return a.hash!==(c&&!c.isVirtual?"t":"f");case"scan":return a.hash!==this.fs.getPatternScanHash(a.pattern)}})}#p(t,e,n){const s=[];return this.#i.set(e,t,s),y.run(s,n)}}export{z as Cache};
@@ -1,3 +1,3 @@
1
- import{spawn as h}from"child_process";import w from"path";async function v(a,l){if(!l)return new Map;let r,c;try{const t=await l.revparse(["--show-toplevel"]);r=new Set((await l.raw("ls-files",a)).split(`
2
- `).map(s=>s.trim()));const e=t&&w.relative(t,a);c=e&&e.length&&e.length+1||0}catch(t){if(t.message.includes("not a git repository"))return new Map;throw t}return new Promise(t=>{const e=new Map;let s=0;const o=h("git",["whatchanged","--pretty=%at","--",a],{stdio:"pipe"});let p="";function u(f){p+=String(f);const m=p.split(`
3
- `);p=m.pop()||"",m.forEach(i=>{if(i=i.trim(),!!i){if(i.startsWith(":")){const n=i.split(" ").slice(-1)[0].slice(c);if(e.has(n))return;r.has(n)&&r.delete(n),e.set(n,new Date(s*1e3).toISOString())}else s=Number(i);r.size===0&&(o.kill(),t(e))}})}o.stdout.on("data",f=>{u(f)}),o.stdout.on("end",()=>{u(""),o.kill(),t(e)})})}export{v as fastMtime};
1
+ import{spawn as m}from"child_process";import w from"path";async function v(a,l){if(!l)return new Map;let s,c;try{const t=await l.revparse(["--show-toplevel"]);s=new Set((await l.raw("ls-files",a)).split(`
2
+ `).map(r=>r.trim()));const e=t&&w.relative(t,a);c=e&&e.length&&e.length+1||0}catch(t){if(t.message.includes("not a git repository"))return new Map;throw t}return new Promise(t=>{const e=new Map;let r=0;const o=m("git",["whatchanged","--i-still-use-this","--pretty=%at","--",a],{stdio:"pipe"});let p="";function u(f){p+=String(f);const h=p.split(`
3
+ `);p=h.pop()||"",h.forEach(i=>{if(i=i.trim(),!!i){if(i.startsWith(":")){const n=i.split(" ").slice(-1)[0].slice(c);if(e.has(n))return;s.has(n)&&s.delete(n),e.set(n,new Date(r*1e3).toISOString())}else r=Number(i);s.size===0&&(o.kill(),t(e))}})}o.stdout.on("data",f=>{u(f)}),o.stdout.on("end",()=>{u(""),o.kill(),t(e)})})}export{v as fastMtime};
@@ -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 n}from"../../../config/env-config.js";const r=[];function o(e){return n.isBuildMode?!r.includes(e):!0}export{o as isLoaderCacheEnabled};
1
+ import{envConfig as n}from"../../config/env-config.js";const r=[];function o(e){return n.isBuildMode?!r.includes(e):!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 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 +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
- 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 S from"path";import{simplifyAstStructure as O}from"@redocly/openapi-docs/lib/utils/simplifyAstStructure.js";import{buildMenuItems as $}from"@redocly/asyncapi-docs/lib/utils/build-menu-items.js";import{findFirstBinding as F}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 I}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as R}from"../../constants/common.js";import{logger as x}from"../../tools/notifiers/logger.js";import{getTemplatePath as E}from"./get-template-path.js";import{storeDefinitionBundles as N}from"./store-definition-bundles.js";import{asyncapiDocLoader as G,asyncapiDocsLoader as L}from"./asyncapi-doc-loader.js";import{searchResolver as j}from"./search/search-resolver.js";import{getAiDocumentsStore as M}from"./search/get-ai-search-documents.js";import{OPENAPI_CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as b}from"../../constants/plugins/openapi-docs.js";import{telemetryTraceStep as U}from"../../../cli/telemetry/helpers/trace-step.js";const C="asyncapi-docs-";async function ot(c){let l=[],d=new Set;return{id:"asyncapi",requiredEntitlements:["asyncapi"],loaders:{"asyncapi-doc":G,"asyncapi-docs":L},processContent:async(e,a)=>{await U("build.plugin.asyncapi_docs",async()=>{const u=await a.getConfig(),D=!!u.rules?.["custom-fields-schema"];if(u.plugins?.some(r=>r.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 g=e.createTemplate(v,E("./template/AsyncApiDocs.js")),p=e.registerServerPropsGetter(v,E("./get-server-props.js"));for(const r of await a.fs.scan(/(\.ya?ml|\.json)$/))if(!await a.isPathIgnored(r.relativePath))try{const{data:s,compoundHash:k}=await a.cache.load(r.realRelativePath,"asyncapi-doc");if(!s?.length)continue;l=s.map(({markdocChunks:t,relativePath:n,isVirtual:m,customOutputRelativeFile:f,realRelativePath:A})=>({chunks:t,relativePath:n,realRelativePath:A,isVirtual:f!=null||r.isVirtual||m})),N(s,e.outdir,k);for(const t of s){const n=`${C}${t.relativePath}`,m=F(t.document),{navItems:f,apiItems:A}=$({asyncApiDoc:t.document,protocol:m||""}),_=[{url:I(R,`${T(t.relativePath,".json")}?download`)},{url:I(R,`${T(t.relativePath,".yaml")}?download`)}];await e.createSharedData(n,{document:t.document,apiItems:A,protocol:m,downloadUrls:_,fsPath:t.relativePath}),f.forEach(i=>{const h={fsPath:t.relativePath,slugSuffix:`/${i.link}`,templateId:g,sharedData:[{key:"AsyncApiDefinition",id:n}],getStaticData:w(a.withPathPrefix,i.label),serverPropsGetterIds:D?[p,b]:[p]};e.addRoute(h),i.items&&i.items.forEach(o=>{e.addRoute({...h,slugSuffix:`/${o.link}`,getStaticData:w(a.withPathPrefix,o.label)}),o.items&&o.items.forEach(P=>{e.addRoute({...h,slugSuffix:`/${P.link}`,getStaticData:w(a.withPathPrefix,o.label)})})})}),e.addRoute({fsPath:t.customOutputRelativeFile||t.relativePath,templateId:g,hasClientRoutes:!0,getSidebar:i=>{const h=o=>{const P={...o};return o.link&&(P.routeSlug=I(i.slug,o.link),P.link=I(i.slug,o.link)),o.items&&(P.items=o.items.map(h)),P};return[{type:"link",label:t.document.info?.title??"AsyncAPI Overview",routeSlug:i.slug,link:i.slug},...f.map(h)]},getSearchDocuments:j(e,t.document),getStaticData:w(a.withPathPrefix,t.document.info?.title??"AsyncAPI Docs"),getAiDocumentsStore:M({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"]??{}}}),serverPropsGetterIds:D?[p,b]:[p],metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}},sharedData:[{key:"AsyncApiDefinition",id:n}]})}}catch(s){console.error(s)}})},afterRoutesCreated:async(e,a)=>{const u=new Set;for(const{chunks:y,relativePath:g,isVirtual:p,realRelativePath:r}of l){const s=e.getAllRoutes().filter(t=>t.fsPath===g).map(t=>t.slug),k=(await a.cache.load(r,"asyncapi-doc")).compoundHash;await a.cache.load(g,{loader:async function(){for(const{node:n,markdown:m,pointer:f,key:A,relativePath:_}of y||[]){const{ast:i}=await e.parseMarkdoc({content:m,relativePath:f,isVirtual:p},a,{sharedDataIds:[`${C}${_}`],routeSlugs:s});n[`x-parsed-md-${A}`]={result:O(i)}}},name:"asyncapi-markdoc-inline-parser"},[k]);for(const{pointer:t}of y)u.add(t)}const D=d.difference(u);for(const y of D)a.cache.delete(y);d=u}}}function w(c,l){return async function(d,e){return{props:{settings:{baseUrlPath:c(d.baseSlug)},disableAutoScroll:!0,seo:{title:l}}}}}function T(c,l){const d=S.posix.dirname(c),e=S.posix.basename(c,S.posix.extname(c))+l;return S.posix.join(d,e)}export{ot as asyncAPIDocsPlugin};
1
+ import I from"path";import{simplifyAstStructure as O}from"@redocly/openapi-docs/lib/utils/simplifyAstStructure.js";import{buildMenuItems as $}from"@redocly/asyncapi-docs/lib/utils/build-menu-items.js";import{findFirstBinding as F}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 w}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as E}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 N}from"./store-definition-bundles.js";import{asyncapiDocLoader as G,asyncapiDocsLoader as L}from"./asyncapi-doc-loader.js";import{searchResolver as j}from"./search/search-resolver.js";import{getAiDocumentsStore as M}from"./search/get-ai-search-documents.js";import{OPENAPI_CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as b}from"../../constants/plugins/openapi-docs.js";import{telemetryTraceStep as U}from"../../../cli/telemetry/helpers/trace-step.js";const C="asyncapi-docs-";async function ot(c){let l=[],d=new Set;return{id:"asyncapi",requiredEntitlements:["asyncapi"],loaders:{"asyncapi-doc":G,"asyncapi-docs":L},processContent:async(e,a)=>{await U("build.plugin.asyncapi_docs",async()=>{const p=await a.getConfig(),A=!!p.rules?.["custom-fields-schema"];if(p.plugins?.some(r=>r.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 D=e.createTemplate(v,R("../../../client/templates/asyncapi-docs/template.js")),u=e.registerServerPropsGetter(v,R("./get-server-props.js"));for(const r of await a.fs.scan(/(\.ya?ml|\.json)$/))if(!await a.isPathIgnored(r.relativePath))try{const{data:s,compoundHash:S}=await a.cache.load(r.realRelativePath,"asyncapi-doc");if(!s?.length)continue;l=s.map(({markdocChunks:t,relativePath:n,isVirtual:m,customOutputRelativeFile:f,realRelativePath:g})=>({chunks:t,relativePath:n,realRelativePath:g,isVirtual:f!=null||r.isVirtual||m})),N(s,e.outdir,S);for(const t of s){const n=`${C}${t.relativePath}`,m=F(t.document),{navItems:f,apiItems:g}=$({asyncApiDoc:t.document,protocol:m||""}),_=[{url:w(E,`${T(t.relativePath,".json")}?download`)},{url:w(E,`${T(t.relativePath,".yaml")}?download`)}];await e.createSharedData(n,{document:t.document,apiItems:g,protocol:m,downloadUrls:_,fsPath:t.relativePath}),f.forEach(i=>{const h={fsPath:t.relativePath,slugSuffix:`/${i.link}`,templateId:D,sharedData:[{key:"AsyncApiDefinition",id:n}],getStaticData:k(a.withPathPrefix,i.label),serverPropsGetterIds:A?[u,b]:[u]};e.addRoute(h),i.items&&i.items.forEach(o=>{e.addRoute({...h,slugSuffix:`/${o.link}`,getStaticData:k(a.withPathPrefix,o.label)}),o.items&&o.items.forEach(P=>{e.addRoute({...h,slugSuffix:`/${P.link}`,getStaticData:k(a.withPathPrefix,o.label)})})})}),e.addRoute({fsPath:t.customOutputRelativeFile||t.relativePath,templateId:D,hasClientRoutes:!0,getSidebar:i=>{const h=o=>{const P={...o};return o.link&&(P.routeSlug=w(i.slug,o.link),P.link=w(i.slug,o.link)),o.items&&(P.items=o.items.map(h)),P};return[{type:"link",label:t.document.info?.title??"AsyncAPI Overview",routeSlug:i.slug,link:i.slug},...f.map(h)]},getSearchDocuments:j(e,t.document),getStaticData:k(a.withPathPrefix,t.document.info?.title??"AsyncAPI Docs"),getAiDocumentsStore:M({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"]??{}}}),serverPropsGetterIds:A?[u,b]:[u],metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}},sharedData:[{key:"AsyncApiDefinition",id:n}]})}}catch(s){console.error(s)}})},afterRoutesCreated:async(e,a)=>{const p=new Set;for(const{chunks:y,relativePath:D,isVirtual:u,realRelativePath:r}of l){const s=(await a.cache.load(r,"asyncapi-doc")).compoundHash;await a.cache.load(D,{loader:async function(){for(const{node:t,markdown:n,pointer:m,key:f,relativePath:g}of y||[]){const{ast:_}=await e.parseMarkdoc({content:n,relativePath:m,isVirtual:u},a,{sharedDataIds:[`${C}${g}`]});t[`x-parsed-md-${f}`]={result:O(_)}}},name:"asyncapi-markdoc-inline-parser"},[s]);for(const{pointer:S}of y)p.add(S)}const A=d.difference(p);for(const y of A)a.cache.delete(y);d=p}}}function k(c,l){return async function(d,e){return{props:{settings:{baseUrlPath:c(d.baseSlug)},disableAutoScroll:!0,seo:{title:l}}}}}function T(c,l){const d=I.posix.dirname(c),e=I.posix.basename(c,I.posix.extname(c))+l;return I.posix.join(d,e)}export{ot as asyncAPIDocsPlugin};
@@ -1,25 +1,25 @@
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 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:n,document:t,metadata:i})=>async(e,s,o)=>{const a=e.getSidebar?.(e)||[],c=await o.getConfig(),{allSearchDocuments:r,publiclyAccessibleSearchDocuments:l}=b(e,a,t,n,i,c);if(r.length)return{async getLLMsTxts(){return l.map(f=>({slug:f.url,fsPath:e.fsPath,title:f.title,content:f.content,includeInLLMsTxt:f.includeInLLMsTxt}))},async getSearchDocuments(){return r}}};function b(n,t,i,e,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(n,l.items||[],i,e,s,o,h);c.push(...D),r.push(...S)}const f=k(n,l,i,e,s,o);f&&(c.push(f),q(l,o,a)&&r.push(f))}return{allSearchDocuments:c,publiclyAccessibleSearchDocuments:r}}function k(n,t,i,e,s,o){const a=F(t,i);if(!a)return null;const c=t.link||"",r=t.httpVerb||"",l=P(n.fsPath),f=A(e,s),h=M(n,t,i,a,r,c,o);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:!t.apiItemData}}function M(n,t,i,e,s,o,a){let c="";const r=m(e.title||""),l=m(e.description||"")+m(e.summary||"");return r&&(c+=`# ${r}
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+=I(i),c+=O(i),t.type==="link"&&!t.apiItemData&&(c+=v(n,a)),t.apiItemData?.type==="channel"&&(c+=T(t,i,o,n)),t.apiItemData?.type==="operation"&&(c+=N(t,i)),c}function I(n){let t="";return n.info?.version&&(t+=`Version: ${n.info.version}
7
+ `),n.info?.license?.name&&(t+=`License: ${n.info.license.name}
8
+ `),t}function O(n){if(!n.servers||Object.keys(n.servers).length===0)return"";let t=`
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}
11
+ `;for(const[i,e]of Object.entries(n.servers))t+=`### ${i}
12
+ `,e.description&&(t+=`${e.description}
13
+ `),t+=`Host: ${e.host}
14
+ `,t+=`Protocol: ${e.protocol}
15
+ `,e.protocolVersion&&(t+=`Protocol Version: ${e.protocolVersion}
16
+ `),e.pathname&&(t+=`Path: ${e.pathname}
17
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}
18
+ `;return t}function v(n,t){const i=n.getSidebar?.(n)||[],e=$(i,t);if(Object.keys(e).length===0)return"";let s="";for(const[,o]of Object.entries(e))if(o.length>0)for(const a of o){const c=a.label||"Untitled",r=a.link||a.routeSlug||"";s+=`#### ${c}
19
19
 
20
20
  `,r&&(s+=` - ${L({title:c,description:void 0,slug:j(r)})}
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 T(n,t,i,e){const s=n.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
23
23
 
24
24
  `;for(const[c,r]of Object.entries(o.parameters))a+=`### ${c}
25
25
  `,typeof r=="object"&&r!==null&&"description"in r&&r.description&&(a+=`${r.description}
@@ -28,29 +28,29 @@ import{basename as C}from"node:path";import{REDOCLY_TEAMS_RBAC as y}from"@redocl
28
28
  `),a+=`
29
29
  `}if(o.messages&&Object.keys(o.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,r]of Object.entries(o.messages))a+=x(r,c,i,e)}return a}function x(n,t,i,e){let o=`### ${n.title||n.name||t}
32
+ `;if(n.description&&(o+=`${n.description}
33
+ `),n.summary&&(o+=`${n.summary}
34
+ `),n.payload){const a=d(n.payload,"message payload",i.replace(e.slug+"/","").replace(/^\//,""),t);a.length>0&&(o+=`
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
+ `,o+=g(a))}if(n.headers){const a=d(n.headers,"message headers",i.replace(e.slug+"/","").replace(/^\//,""),t);a.length>0&&(o+=`
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(", ")}
40
+ `,o+=g(a))}return o}function g(n){let t="";for(const i of n)if(typeof i=="object"&&i!==null&&"name"in i&&"type"in i){const e=i;t+=`- **${e.name}** (${e.type}${e.required?", required":""})
41
+ `,e.description&&(t+=` ${e.description}
42
+ `),e.enum&&Array.isArray(e.enum)&&e.enum.length>0&&(t+=` Enum: ${e.enum.join(", ")}
43
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
44
+ `}return t}function N(n,t){const i=n.apiItemData?.id;if(!i)return"";const e=t.operations?.[i];if(!e)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(e.action&&(s+=`Action: ${e.action}
47
+ `),e.description&&(s+=`${e.description}
48
+ `),e.summary&&(s+=`${e.summary}
49
+ `),e.messages&&e.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}
52
+ `;for(const o of e.messages){const a=o.title||o.name||"Message";s+=`#### ${a}
53
53
  `,o.description&&(s+=`${o.description}
54
54
  `),o.summary&&(s+=`${o.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,t){const i={};for(const e of n)e.type==="group"?e.apiItemData?.type==="channel"?R(e,i,t):V(e,i,t):e.apiItemData?.type==="channel"&&E(e,i,t);return i}function R(n,t,i){const e=n.label||"Channel";if(u(p(n),i)&&(t[e]||(t[e]=[]),t[e].push(n),n.items))for(const s of n.items)s.apiItemData?.type==="operation"&&u(p(s),i)&&t[e].push(s)}function V(n,t,i){if(n.items){const e=$(n.items,i);for(const[s,o]of Object.entries(e))t[s]||(t[s]=[]),t[s].push(...o)}}function E(n,t,i){const e=n.label||"Channel";if(u(p(n),i)&&(t[e]||(t[e]=[]),t[e].push(n),n.items))for(const s of n.items)s.apiItemData?.type==="operation"&&u(p(s),i)&&t[e].push(s)}function F(n,t){const{apiItemData:i,type:e}=n;return i?.type?w(i,t):e==="link"?_(t):null}function w(n,t){switch(n.type){case"channel":return t.channels?.[n.id]||null;case"operation":return t.operations?.[n.id]||null;default:return null}}function _(n){return{description:n.info?.description||"",title:n.info?.title||"",summary:""}}function q(n,t,i){const e=u(p(n),t);if(n.apiItemData?.type==="operation"&&i){const s=u(p(i),t);return e&&s}return e}function p(n){return{slug:n.link||"",[y]:n[y]}}export{W as getAiDocumentsStore};
@@ -1 +1 @@
1
- import{REGISTRY_APIS_API_URL as r}from"../../constants/common.js";import{logger as e}from"../../tools/notifiers/logger.js";let c=null;async function f(){try{const s=process.env.REGISTRY_API_KEY||"";if(!s){e.warnProd("Cannot fetch custom fields: API key not found in env");return}const i=await(await fetch(r+"?limit=5000&fields=id,contentPath,customFields",{headers:{Authorization:`Bearer ${s}`}})).json();c={};for(const o of i.items)c[o.contentPath]=o.customFields||{};e.info("Refreshed cached API fields")}catch(s){console.log("error",s),e.warnProd("Failed to refresh cached API fields: "+s.message)}}f(),setInterval(f,1e3*60*5);async function m(s,t,i){const o=process.env.REDOCLY_LOCAL_DEV_TOKEN||i.variables.idpAccessToken;if(!o)return e.warnProd("Cannot fetch custom fields: access token not found"),t.props||{};if(!r)return e.warnProd("Cannot fetch custom fields: API URL not found in env"),t.props||{};const u=c||await l();return{...t.props,customFields:u};async function l(){try{const n=await fetch(r+"?limit=5000&fields=id,contentPath,customFields",{headers:{Cookie:`accessToken=${o}`}});if(n.status!==200)return e.warnProd(`Failed to fetch custom fields. API response status: ${n.status}. Request URL: ${r}`),t.props;const p=await n.json(),a={};for(const d of p.items)a[d.contentPath]=d.customFields||{};return a}catch(n){return e.warnProd("Failed to fetch custom fields: "+n.message),{}}}}export{m as default};
1
+ import{REGISTRY_APIS_API_URL as r}from"../../constants/common.js";import{logger as e}from"../../tools/notifiers/logger.js";let c=null;async function f(){try{const s=process.env.REGISTRY_API_KEY||"";if(!s){e.warnProd("Cannot fetch custom fields: API key not found in env");return}const i=await(await fetch(r+"?limit=6000&fields=id,contentPath,customFields",{headers:{Authorization:`Bearer ${s}`}})).json();c={};for(const o of i.items)c[o.contentPath]=o.customFields||{};e.info("Refreshed cached API fields")}catch(s){console.log("error",s),e.warnProd("Failed to refresh cached API fields: "+s.message)}}f(),setInterval(f,1e3*60*5);async function m(s,t,i){const o=process.env.REDOCLY_LOCAL_DEV_TOKEN||i.variables.idpAccessToken;if(!o)return e.warnProd("Cannot fetch custom fields: access token not found"),t.props||{};if(!r)return e.warnProd("Cannot fetch custom fields: API URL not found in env"),t.props||{};const u=c||await l();return{...t.props,customFields:u};async function l(){try{const n=await fetch(r+"?limit=6000&fields=id,contentPath,customFields",{headers:{Cookie:`accessToken=${o}`}});if(n.status!==200)return e.warnProd(`Failed to fetch custom fields. API response status: ${n.status}. Request URL: ${r}`),t.props;const p=await n.json(),a={};for(const d of p.items)a[d.contentPath]=d.customFields||{};return a}catch(n){return e.warnProd("Failed to fetch custom fields: "+n.message),{}}}}export{m as default};
@@ -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};
@@ -1 +1 @@
1
- import{entityRelationFileSchema as g}from"@redocly/config";import{FileHashStatus as c}from"../../../../../persistence/file-hashes/types.js";import{promiseMapLimit as m}from"../../../../../utils/async/promise-map-limit.js";import{OPERATORS as u}from"../../../../../providers/database/pagination/constants.js";import{VERSION_NOT_SPECIFIED as p}from"@redocly/theme/core/constants";import{getRbacTeamsListForResource as v}from"../../../../../utils/rbac.js";import{envConfig as h}from"../../../../../../config/env-config.js";import{resolveEntityVersion as y}from"../../../utils/resolve-entity-version.js";import{catalogDataCollector as f}from"../../../utils/catalog-data-collector.js";import{createValidator as d}from"../../../utils/ajv-validator.js";const R=3;class x{type="api-description";specType;fileType;actions;context;catalogEntitiesService;fileHashManager;entitySources={};#e;constructor(t,e){this.specType=t,this.fileType=e.fileType,this.actions=e.actions,this.context=e.context,this.catalogEntitiesService=e.catalogEntitiesService,this.fileHashManager=e.fileHashManager,this.#e=e.shouldCalculateEntities??!1}async extract(){const t=await this.loadApiDescriptions();await this.fileHashManager.markAllAsOutdated(this.fileType),t.length&&f.addExtractor(this.specType),await m(t,R,async e=>{try{if(e.isVirtual||!e.hash)return;if(!((await this.fileHashManager.getByPath(e.realRelativePath))?.hash!==e.hash||this.#e||h.FORCE_CATALOG_CACHE_REVALIDATE==="true")){f.increaseSkippedFilesCount(),await this.fileHashManager.upsert(this.fileType,e.realRelativePath,e.hash,c.UP_TO_DATE);return}const a=await this.catalogEntitiesService.getEntityKeysAndVersionsBySourceFile(e.realRelativePath);h.FORCE_CATALOG_CACHE_REVALIDATE==="true"&&(await this.catalogEntitiesService.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:Array.from(a).map(o=>o.split(":")[0])}),a.clear());const s=new Date().toISOString(),n=this.#a(e);await this.processApiDescription(e,s,n,a),await this.#i(a,e.realRelativePath,s,e.hash),f.increaseProcessedFilesCount(),await this.fileHashManager.upsert(this.fileType,e.realRelativePath,e.hash,c.UP_TO_DATE)}catch(i){this.context.logger.warn(`Error extracting entities from ${this.specType} description: ${e.realRelativePath}`),this.context.logger.warn(i)}}),await this.#t()}#t=async()=>{const t=await this.fileHashManager.getAllOutdated(this.fileType);if(!t||t.length===0)return;const e=await this.catalogEntitiesService.getEntities({paginationParams:{limit:1e3,filter:{op:"AND",conditions:[{field:"source_file",operator:"in",value:t.map(({filePath:i})=>i)},{field:"is_current",operator:"equal",value:!0}]}}});e&&e.items.length>0&&await this.catalogEntitiesService.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:e.items.map(({key:i})=>i)}),await this.fileHashManager.deleteFileHashes({op:"AND",conditions:[{field:"file_type",operator:"equal",value:this.fileType},{field:"status",operator:"equal",value:c.OUTDATED}]})};#i=async(t,e,i,r)=>{if(t.size===0||h.FORCE_CATALOG_CACHE_REVALIDATE==="true")return;const a=Array.from(t).map(o=>{const[l,E]=o.split(":");return{key:l,version:E}}),s=Array.from(new Set(a.map(({key:o})=>o))),n=a.map(({key:o,version:l})=>({op:u.AND,conditions:[{field:"key",operator:"equal",value:o},{field:"version",operator:"equal",value:l}]}));await this.catalogEntitiesService.softDeleteEntitiesInLocalDatabase({revision:i,fileHash:r,filter:{op:"AND",conditions:[{field:"key",operator:"in",value:s},{op:u.OR,conditions:n},{field:"source",operator:"equal",value:"file"},{field:"source_file",operator:"equal",value:e}]}})};#a(t){const e=t.document?.info?.version??t.definition?.info?.version??null,i=y(e,t.realRelativePath);return i.success?i.version??p:p}validateEntityRelationFileSchema(t){d(g,{errorPrefix:"Entity relation validation failed:",dataVar:"relation"})(t)}getRbacTeamsForDefinition(t){const e=this.actions.getConfig().rbac,i=this.actions.getRouteByFsPath(t);return v(i||{fsPath:t},e||{})}}export{x as BaseApiEntitiesExtractor};
1
+ import{entityRelationFileSchema as g}from"@redocly/config";import{FileHashStatus as c}from"../../../../../persistence/file-hashes/types.js";import{promiseMapLimit as m}from"../../../../../utils/async/promise-map-limit.js";import{OPERATORS as u}from"../../../../../providers/database/pagination/constants.js";import{VERSION_NOT_SPECIFIED as p}from"@redocly/theme/core/constants";import{getRbacTeamsListForResource as v}from"../../../../../utils/rbac.js";import{envConfig as h}from"../../../../../config/env-config.js";import{resolveEntityVersion as y}from"../../../utils/resolve-entity-version.js";import{catalogDataCollector as f}from"../../../utils/catalog-data-collector.js";import{createValidator as d}from"../../../utils/ajv-validator.js";const R=3;class x{type="api-description";specType;fileType;actions;context;catalogEntitiesService;fileHashManager;entitySources={};#e;constructor(t,e){this.specType=t,this.fileType=e.fileType,this.actions=e.actions,this.context=e.context,this.catalogEntitiesService=e.catalogEntitiesService,this.fileHashManager=e.fileHashManager,this.#e=e.shouldCalculateEntities??!1}async extract(){const t=await this.loadApiDescriptions();await this.fileHashManager.markAllAsOutdated(this.fileType),t.length&&f.addExtractor(this.specType),await m(t,R,async e=>{try{if(e.isVirtual||!e.hash)return;if(!((await this.fileHashManager.getByPath(e.realRelativePath))?.hash!==e.hash||this.#e||h.FORCE_CATALOG_CACHE_REVALIDATE==="true")){f.increaseSkippedFilesCount(),await this.fileHashManager.upsert(this.fileType,e.realRelativePath,e.hash,c.UP_TO_DATE);return}const a=await this.catalogEntitiesService.getEntityKeysAndVersionsBySourceFile(e.realRelativePath);h.FORCE_CATALOG_CACHE_REVALIDATE==="true"&&(await this.catalogEntitiesService.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:Array.from(a).map(o=>o.split(":")[0])}),a.clear());const s=new Date().toISOString(),n=this.#a(e);await this.processApiDescription(e,s,n,a),await this.#i(a,e.realRelativePath,s,e.hash),f.increaseProcessedFilesCount(),await this.fileHashManager.upsert(this.fileType,e.realRelativePath,e.hash,c.UP_TO_DATE)}catch(i){this.context.logger.warn(`Error extracting entities from ${this.specType} description: ${e.realRelativePath}`),this.context.logger.warn(i)}}),await this.#t()}#t=async()=>{const t=await this.fileHashManager.getAllOutdated(this.fileType);if(!t||t.length===0)return;const e=await this.catalogEntitiesService.getEntities({paginationParams:{limit:1e3,filter:{op:"AND",conditions:[{field:"source_file",operator:"in",value:t.map(({filePath:i})=>i)},{field:"is_current",operator:"equal",value:!0}]}}});e&&e.items.length>0&&await this.catalogEntitiesService.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:e.items.map(({key:i})=>i)}),await this.fileHashManager.deleteFileHashes({op:"AND",conditions:[{field:"file_type",operator:"equal",value:this.fileType},{field:"status",operator:"equal",value:c.OUTDATED}]})};#i=async(t,e,i,r)=>{if(t.size===0||h.FORCE_CATALOG_CACHE_REVALIDATE==="true")return;const a=Array.from(t).map(o=>{const[l,E]=o.split(":");return{key:l,version:E}}),s=Array.from(new Set(a.map(({key:o})=>o))),n=a.map(({key:o,version:l})=>({op:u.AND,conditions:[{field:"key",operator:"equal",value:o},{field:"version",operator:"equal",value:l}]}));await this.catalogEntitiesService.softDeleteEntitiesInLocalDatabase({revision:i,fileHash:r,filter:{op:"AND",conditions:[{field:"key",operator:"in",value:s},{op:u.OR,conditions:n},{field:"source",operator:"equal",value:"file"},{field:"source_file",operator:"equal",value:e}]}})};#a(t){const e=t.document?.info?.version??t.definition?.info?.version??null,i=y(e,t.realRelativePath);return i.success?i.version??p:p}validateEntityRelationFileSchema(t){d(g,{errorPrefix:"Entity relation validation failed:",dataVar:"relation"})(t)}getRbacTeamsForDefinition(t){const e=this.actions.getConfig().rbac,i=this.actions.getRouteByFsPath(t);return v(i||{fsPath:t},e||{})}}export{x as BaseApiEntitiesExtractor};
@@ -1,3 +1,3 @@
1
- import{buildSchema as O,isObjectType as T,isScalarType as D,isEnumType as v,isInterfaceType as w,isUnionType as E,isInputObjectType as b,getNamedType as u,printType as L}from"graphql";import{removeLeadingSlash as A}from"@redocly/theme/core/utils";import{toKebabCase as g}from"../../../../../../utils/string/to-kebab-case.js";import{capitalize as j}from"../../../../../../utils/string/capitalize.js";import{promiseMapLimit as d}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as $}from"../../../../../utils/async/promise-map-limit-with-status.js";import{sha1 as K}from"../../../../../utils/crypto/sha1.js";import{removeMarkdocTags as F}from"../../../../markdown/markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as N}from"./base.js";const R=15,I=15,P=new Set(["String","ID","Int","Float","Boolean","DateTime","Date","Time","URL","URI","JSON","JSONObject","BigInt","BigDecimal"]);class U extends N{#t;constructor(t){super("graphql",t),this.#t=t.context.logger}async loadApiDescriptions(){const t=[];for(const{relativePath:e}of this.context.fs.scan(/(\.gql|\.graphql)$/))try{if(e.includes("@l10n")||await this.context.isPathIgnored(e))continue;const a=await this.context.cache.load(e,"graphql-doc");if(!a.data)continue;const{content:i,metadata:r}=a.data,s=O(i),n=K(i);t.push({realRelativePath:e,relativePath:e,isVirtual:!1,hash:n,schema:s,content:i,metadata:r})}catch(a){this.#t.warn(`Failed to load GraphQL schema from ${e}: ${a instanceof Error?a.message:"Unknown error"}`)}return t}mapApiDescriptionToEntity(t,e){const a=A(t.realRelativePath),i=t.relativePath.replace(/\.(gql|graphql)$/,""),r=this.#s(i.split("/").pop()||"GraphQL Schema"),s=a.replace(/\.(gql|graphql)$/,""),n=g(s.replace(/[\\/]/g,"-")),p=this.#c(t.metadata?.tags),o=t.metadata?.["x-redocly-catalog-key"],l=typeof o=="string"&&o.trim()?g(o.trim()):n;return{type:this.type,key:l,title:r,summary:t.metadata?.description||null,tags:p.concat("graphql"),metadata:{specType:this.specType,descriptionFile:a},version:e}}async processApiDescription(t,e,a,i){const{schema:r}=t;if(!r)return;const s=this.getRbacTeamsForDefinition(t.relativePath),n=this.mapApiDescriptionToEntity(t,a);await this.catalogEntitiesService.createEntityInLocalDatabase({entity:n,sourceFile:t.realRelativePath,fileHash:t.hash,isRootEntity:!0,revision:e,rbacTeams:s}),i.delete(`${n.key}:${a}`),await Promise.all([this.#a(t,n.key,n.version,a,e,i,s),this.#y(t,n.key,n.version,a,e,i,s)])}#a=async(t,e,a,i,r,s,n)=>{const{schema:p}=t,o=p.getTypeMap(),l=this.#i(p),c=Object.entries(o).filter(([y])=>!y.startsWith("__")&&!P.has(y)&&!l.has(y));if(c.length===0)return;const h=await $(c,I,async([y,m])=>{const f=await this.#l({typeName:y,type:m,description:t,parentKey:e,parentVersion:a,parentRevision:r,rbacTeams:n});s.delete(`${f.entityKey}:${i}`),f.result==="created"&&await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:e,type:"uses",targetKey:f.entityKey,fileHash:t.hash,sourceVersion:a,targetVersion:a,sourceRevision:r,targetRevision:r})},this.#t);h.count.failed>0&&this.#t.warn(`Schema processing completed with ${h.count.failed} failures out of ${c.length} types for ${t.realRelativePath}`),await this.#h({description:t,descriptionUniqueKey:e,userTypes:c,parentRevision:r})};#s=t=>{const e=t.replace(/[^A-Za-z0-9]+/g," ").trim();return e?e.split(" ").map(a=>a&&j(a)).join(" "):"GraphQL Schema"};#e=(t,e)=>`${e}-${g(t)}`;#n=t=>T(t)?"object":w(t)?"interface":E(t)?"union":v(t)?"enum":b(t)?"input":D(t)?"scalar":"unknown";#i=t=>{const e=new Set,a=t.getQueryType();a&&e.add(a.name);const i=t.getMutationType();i&&e.add(i.name);const r=t.getSubscriptionType();return r&&e.add(r.name),e};#r(t){const e=[],a=t.getQueryType();if(a){const s=a.getFields();for(const[n,p]of Object.entries(s))e.push({fieldName:n,field:p,operationType:"QUERY",rootTypeName:a.name})}const i=t.getMutationType();if(i){const s=i.getFields();for(const[n,p]of Object.entries(s))e.push({fieldName:n,field:p,operationType:"MUTATION",rootTypeName:i.name})}const r=t.getSubscriptionType();if(r){const s=r.getFields();for(const[n,p]of Object.entries(s))e.push({fieldName:n,field:p,operationType:"SUBSCRIBE",rootTypeName:r.name})}return e}#o=(t,e)=>{const a=[];if(t.args)for(const s of t.args){const n=u(s.type);n&&!n.name.startsWith("__")&&a.push(this.#e(n.name,e))}const i=[],r=u(t.type);return r&&!r.name.startsWith("__")&&i.push(this.#e(r.name,e)),{inputTypes:a,returnTypes:i}};#c=t=>{if(Array.isArray(t))return t.map(e=>String(e)).map(e=>e.trim()).filter(e=>e.length>0);if(typeof t=="string"){const e=t.trim();return e?[e]:[]}return[]};#l=async({typeName:t,type:e,description:a,parentKey:i,parentVersion:r,parentRevision:s,rbacTeams:n})=>{const p=this.#e(t,i),o=e.description??null,l=this.#n(e),c={type:"data-schema",key:p,title:t,summary:o,tags:["graphql"],metadata:{specType:this.specType,typeKind:l,sdl:this.#p(e,a.schema)},version:r};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:c,sourceFile:a.realRelativePath,fileHash:a.hash,revision:s,rbacTeams:n})};#p=(t,e)=>{const a=new Set,i=[],r=new Set(["String","ID","Int","Float","Boolean"]),s=o=>{if(!o)return;const l=o.name;if(l.startsWith("__")||r.has(l)||a.has(l))return;const c=e.getType(l);c&&(a.add(l),i.push(c))};for(s(t);i.length>0;){const o=i.pop();if(T(o)){for(const c of o.getInterfaces?.()??[])s(c);const l=o.getFields();for(const c of Object.values(l)){s(u(c.type));for(const h of c.args??[])s(u(h.type))}}else if(w(o)){const l=o.getFields();for(const c of Object.values(l))s(u(c.type))}else if(E(o))for(const l of o.getTypes())s(l);else if(b(o)){const l=o.getFields();for(const c of Object.values(l))s(u(c.type))}}const n=[t.name,...[...a].filter(o=>o!==t.name)],p=[];for(const o of n){const l=e.getType(o);l&&p.push(L(l))}return p.join(`
1
+ import{buildSchema as O,isObjectType as T,isScalarType as D,isEnumType as v,isInterfaceType as w,isUnionType as E,isInputObjectType as b,getNamedType as u,printType as L}from"graphql";import{removeLeadingSlash as A}from"@redocly/theme/core/utils";import{toKebabCase as g}from"../../../../../../utils/string/to-kebab-case.js";import{capitalize as j}from"../../../../../../utils/string/capitalize.js";import{promiseMapLimit as d}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as $}from"../../../../../utils/async/promise-map-limit-with-status.js";import{sha1 as K}from"../../../../../utils/crypto/sha1.js";import{removeMarkdocTags as F}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as N}from"./base.js";const R=15,I=15,P=new Set(["String","ID","Int","Float","Boolean","DateTime","Date","Time","URL","URI","JSON","JSONObject","BigInt","BigDecimal"]);class U extends N{#t;constructor(t){super("graphql",t),this.#t=t.context.logger}async loadApiDescriptions(){const t=[];for(const{relativePath:e}of this.context.fs.scan(/(\.gql|\.graphql)$/))try{if(e.includes("@l10n")||await this.context.isPathIgnored(e))continue;const a=await this.context.cache.load(e,"graphql-doc");if(!a.data)continue;const{content:i,metadata:r}=a.data,s=O(i),n=K(i);t.push({realRelativePath:e,relativePath:e,isVirtual:!1,hash:n,schema:s,content:i,metadata:r})}catch(a){this.#t.warn(`Failed to load GraphQL schema from ${e}: ${a instanceof Error?a.message:"Unknown error"}`)}return t}mapApiDescriptionToEntity(t,e){const a=A(t.realRelativePath),i=t.relativePath.replace(/\.(gql|graphql)$/,""),r=this.#s(i.split("/").pop()||"GraphQL Schema"),s=a.replace(/\.(gql|graphql)$/,""),n=g(s.replace(/[\\/]/g,"-")),p=this.#c(t.metadata?.tags),o=t.metadata?.["x-redocly-catalog-key"],l=typeof o=="string"&&o.trim()?g(o.trim()):n;return{type:this.type,key:l,title:r,summary:t.metadata?.description||null,tags:p.concat("graphql"),metadata:{specType:this.specType,descriptionFile:a},version:e}}async processApiDescription(t,e,a,i){const{schema:r}=t;if(!r)return;const s=this.getRbacTeamsForDefinition(t.relativePath),n=this.mapApiDescriptionToEntity(t,a);await this.catalogEntitiesService.createEntityInLocalDatabase({entity:n,sourceFile:t.realRelativePath,fileHash:t.hash,isRootEntity:!0,revision:e,rbacTeams:s}),i.delete(`${n.key}:${a}`),await Promise.all([this.#a(t,n.key,n.version,a,e,i,s),this.#y(t,n.key,n.version,a,e,i,s)])}#a=async(t,e,a,i,r,s,n)=>{const{schema:p}=t,o=p.getTypeMap(),l=this.#i(p),c=Object.entries(o).filter(([y])=>!y.startsWith("__")&&!P.has(y)&&!l.has(y));if(c.length===0)return;const h=await $(c,I,async([y,m])=>{const f=await this.#l({typeName:y,type:m,description:t,parentKey:e,parentVersion:a,parentRevision:r,rbacTeams:n});s.delete(`${f.entityKey}:${i}`),f.result==="created"&&await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:e,type:"uses",targetKey:f.entityKey,fileHash:t.hash,sourceVersion:a,targetVersion:a,sourceRevision:r,targetRevision:r})},this.#t);h.count.failed>0&&this.#t.warn(`Schema processing completed with ${h.count.failed} failures out of ${c.length} types for ${t.realRelativePath}`),await this.#h({description:t,descriptionUniqueKey:e,userTypes:c,parentRevision:r})};#s=t=>{const e=t.replace(/[^A-Za-z0-9]+/g," ").trim();return e?e.split(" ").map(a=>a&&j(a)).join(" "):"GraphQL Schema"};#e=(t,e)=>`${e}-${g(t)}`;#n=t=>T(t)?"object":w(t)?"interface":E(t)?"union":v(t)?"enum":b(t)?"input":D(t)?"scalar":"unknown";#i=t=>{const e=new Set,a=t.getQueryType();a&&e.add(a.name);const i=t.getMutationType();i&&e.add(i.name);const r=t.getSubscriptionType();return r&&e.add(r.name),e};#r(t){const e=[],a=t.getQueryType();if(a){const s=a.getFields();for(const[n,p]of Object.entries(s))e.push({fieldName:n,field:p,operationType:"QUERY",rootTypeName:a.name})}const i=t.getMutationType();if(i){const s=i.getFields();for(const[n,p]of Object.entries(s))e.push({fieldName:n,field:p,operationType:"MUTATION",rootTypeName:i.name})}const r=t.getSubscriptionType();if(r){const s=r.getFields();for(const[n,p]of Object.entries(s))e.push({fieldName:n,field:p,operationType:"SUBSCRIBE",rootTypeName:r.name})}return e}#o=(t,e)=>{const a=[];if(t.args)for(const s of t.args){const n=u(s.type);n&&!n.name.startsWith("__")&&a.push(this.#e(n.name,e))}const i=[],r=u(t.type);return r&&!r.name.startsWith("__")&&i.push(this.#e(r.name,e)),{inputTypes:a,returnTypes:i}};#c=t=>{if(Array.isArray(t))return t.map(e=>String(e)).map(e=>e.trim()).filter(e=>e.length>0);if(typeof t=="string"){const e=t.trim();return e?[e]:[]}return[]};#l=async({typeName:t,type:e,description:a,parentKey:i,parentVersion:r,parentRevision:s,rbacTeams:n})=>{const p=this.#e(t,i),o=e.description??null,l=this.#n(e),c={type:"data-schema",key:p,title:t,summary:o,tags:["graphql"],metadata:{specType:this.specType,typeKind:l,sdl:this.#p(e,a.schema)},version:r};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:c,sourceFile:a.realRelativePath,fileHash:a.hash,revision:s,rbacTeams:n})};#p=(t,e)=>{const a=new Set,i=[],r=new Set(["String","ID","Int","Float","Boolean"]),s=o=>{if(!o)return;const l=o.name;if(l.startsWith("__")||r.has(l)||a.has(l))return;const c=e.getType(l);c&&(a.add(l),i.push(c))};for(s(t);i.length>0;){const o=i.pop();if(T(o)){for(const c of o.getInterfaces?.()??[])s(c);const l=o.getFields();for(const c of Object.values(l)){s(u(c.type));for(const h of c.args??[])s(u(h.type))}}else if(w(o)){const l=o.getFields();for(const c of Object.values(l))s(u(c.type))}else if(E(o))for(const l of o.getTypes())s(l);else if(b(o)){const l=o.getFields();for(const c of Object.values(l))s(u(c.type))}}const n=[t.name,...[...a].filter(o=>o!==t.name)],p=[];for(const o of n){const l=e.getType(o);l&&p.push(L(l))}return p.join(`
2
2
 
3
3
  `)};#h=async({description:t,descriptionUniqueKey:e,userTypes:a,parentRevision:i})=>{const r=a.filter(([,s])=>T(s));r.length!==0&&await d(r,I,async([s,n])=>{const o=n.getInterfaces?.()??[];if(!o.length)return;const l=this.#e(s,e);await d([...o],5,async c=>{const h=this.#e(c.name,e);try{await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:l,type:"implements",targetKey:h,fileHash:t.hash,sourceRevision:i,targetRevision:i})}catch(y){this.#t.warn(`Failed to create 'implements' relation ${l} -> ${h}: ${y instanceof Error?y.message:"Unknown error"}`)}})})};#y=async(t,e,a,i,r,s,n)=>{const{schema:p}=t,o=this.#r(p);if(o.length===0)return;const c=(await $(o,R,async({fieldName:h,field:y,operationType:m,rootTypeName:f})=>{const S=await this.#f(h,y,m,f,t,e,a,r,n);S&&s.delete(`${S}:${i}`)},this.#t)).count.failed;c>0&&this.#t.warn(`Operation extraction completed with ${c} failures out of ${o.length} operations for ${e}`)};#f=async(t,e,a,i,r,s,n,p,o)=>{const{inputTypes:l,returnTypes:c}=this.#o(e,s),h=await this.#u({fieldName:t,field:e,operationType:a,rootTypeName:i,inputTypes:l,returnTypes:c,description:r,descriptionUniqueKey:s,descriptionVersion:n,parentRevision:p,rbacTeams:o});return h.result==="created"&&await this.#m({apiOperationKey:h.entityKey,inputTypes:l,returnTypes:c,descriptionUniqueKey:s,description:r,descriptionVersion:n,parentRevision:p}),h.entityKey??null};#u=async({fieldName:t,field:e,operationType:a,rootTypeName:i,inputTypes:r,returnTypes:s,description:n,descriptionUniqueKey:p,descriptionVersion:o,parentRevision:l,rbacTeams:c})=>{const h=t,m={type:"api-operation",key:`${p}-${g(`${a.toLowerCase()}-${t}`)}`,title:h,summary:e.description?F(e.description):null,tags:["graphql"],metadata:{method:a,path:`${i}.${t}`,payload:r,responses:s},version:o};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:m,sourceFile:n.realRelativePath,fileHash:n.hash,revision:l,rbacTeams:c})};#m=async({apiOperationKey:t,inputTypes:e,returnTypes:a,descriptionUniqueKey:i,description:r,descriptionVersion:s,parentRevision:n})=>{await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:t,type:"partOf",targetKey:i,fileHash:r.hash,sourceVersion:s,targetVersion:s,sourceRevision:n,targetRevision:n});const p=[...new Set(e)],o=[...new Set(a)],l=[...p.map(c=>({key:c,relationType:"uses"})),...o.map(c=>({key:c,relationType:"returns"}))];await d(l,R,async({key:c,relationType:h})=>{try{await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:t,type:h,targetKey:c,fileHash:r.hash,sourceVersion:s,targetVersion:s,sourceRevision:n,targetRevision:n})}catch(y){this.#t.warn(`Failed to create relation between operation ${t} and type ${c} (${h}): ${y instanceof Error?y.message:"Unknown error"}`)}})}}export{U as GraphqlEntitiesExtractor};