@redocly/redoc 0.131.0-next.6 → 0.131.0-next.8

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 (210) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/cli/stats/collectors/openapi.js +1 -1
  3. package/dist/cli/telemetry/index.js +1 -1
  4. package/dist/client/App.js +1 -1
  5. package/dist/client/app/hooks/useAutoScroll.js +1 -1
  6. package/dist/client/app/hooks/utils/pathname-matches-active-section.d.ts +6 -0
  7. package/dist/client/app/hooks/utils/pathname-matches-active-section.js +1 -0
  8. package/dist/client/app/markdoc/custom-components/html-script.js +1 -0
  9. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -0
  10. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -0
  11. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -0
  12. package/dist/client/app/markdoc/hooks/use-store.js +1 -0
  13. package/dist/{server/plugins/asyncapi-docs/template → client/templates/asyncapi-docs}/helpers.d.ts +3 -3
  14. package/dist/client/templates/asyncapi-docs/helpers.js +1 -0
  15. package/dist/{server/plugins/asyncapi-docs/template/AsyncApiDocs.d.ts → client/templates/asyncapi-docs/template.d.ts} +1 -1
  16. package/dist/client/templates/asyncapi-docs/template.js +11 -0
  17. package/dist/client/templates/openapi-docs/helpers.js +5 -0
  18. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.d.ts → client/templates/openapi-docs/template.d.ts} +1 -1
  19. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.js → client/templates/openapi-docs/template.js} +1 -1
  20. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-inner-text.d.ts +1 -1
  21. package/dist/markdoc/helpers/get-inner-text.js +2 -0
  22. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-variable.d.ts +2 -2
  23. package/dist/markdoc/helpers/get-variable.js +1 -0
  24. package/dist/markdoc/nodes/fence/index.js +1 -0
  25. package/dist/markdoc/nodes/heading.js +1 -0
  26. package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.d.ts +6 -6
  27. package/dist/markdoc/tags/json-example.d.ts +3 -0
  28. package/dist/markdoc/tags/json-schema.d.ts +3 -0
  29. package/dist/markdoc/tags/openapi-code-sample.d.ts +3 -0
  30. package/dist/markdoc/tags/openapi-example.d.ts +3 -0
  31. package/dist/markdoc/tags/openapi-response-sample.d.ts +3 -0
  32. package/dist/markdoc/tags/replay-openapi.d.ts +3 -0
  33. package/dist/markdoc/types.d.ts +8 -0
  34. package/dist/markdoc/types.js +0 -0
  35. package/dist/server/config/env-schema.d.ts +3 -0
  36. package/dist/server/config/env-schemas/organization-project.d.ts +3 -0
  37. package/dist/server/config/env-schemas/organization-project.js +1 -1
  38. package/dist/server/plugins/analytics/amplitude/index.js +1 -1
  39. package/dist/server/plugins/asyncapi-docs/index.js +1 -1
  40. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +2 -2
  41. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
  42. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
  43. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +1 -1
  44. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  45. package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.js +1 -1
  46. package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.js +1 -1
  47. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.js +1 -1
  48. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.js +1 -1
  49. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.js +1 -1
  50. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.js +1 -1
  51. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
  52. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.js +1 -1
  53. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  54. package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.js +1 -1
  55. package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.js +1 -1
  56. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
  57. package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.js +1 -1
  58. package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.js +1 -1
  59. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.js +1 -1
  60. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.js +1 -1
  61. package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.js +1 -1
  62. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
  63. package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
  64. package/dist/server/plugins/markdown/markdoc/plugins/headings.js +1 -1
  65. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  66. package/dist/server/plugins/markdown/runtime-transform.js +1 -1
  67. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  68. package/dist/server/plugins/markdown/search/get-search-documents.js +2 -2
  69. package/dist/server/plugins/markdown/search/nodes/section-node.js +1 -1
  70. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  71. package/dist/server/plugins/markdown/search/to-markdown.js +1 -1
  72. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  73. package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.js +1 -1
  74. package/dist/server/plugins/openapi-docs/index.js +1 -1
  75. package/dist/server/plugins/scorecards/database/scorecards-config-service.js +1 -1
  76. package/dist/server/plugins/sidebars/index.js +2 -2
  77. package/dist/server/ssr/render.js +1 -1
  78. package/dist/server/telemetry/index.js +1 -1
  79. package/dist/server/types/plugins/markdown.d.ts +0 -7
  80. package/dist/server/utils/fs.js +1 -1
  81. package/dist/server/utils/index.d.ts +2 -2
  82. package/dist/server/utils/index.js +1 -1
  83. package/dist/{server/utils → utils}/slugger.d.ts +13 -0
  84. package/package.json +8 -8
  85. package/dist/server/plugins/asyncapi-docs/template/AsyncApiDocs.js +0 -11
  86. package/dist/server/plugins/asyncapi-docs/template/helpers.js +0 -1
  87. package/dist/server/plugins/markdown/markdoc/custom-components/html-script.js +0 -1
  88. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-code-sample.js +0 -1
  89. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-response-sample.js +0 -1
  90. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/replay-openapi.js +0 -1
  91. package/dist/server/plugins/markdown/markdoc/helpers/get-inner-text.js +0 -2
  92. package/dist/server/plugins/markdown/markdoc/helpers/get-variable.js +0 -1
  93. package/dist/server/plugins/markdown/markdoc/hooks/use-store.js +0 -1
  94. package/dist/server/plugins/markdown/markdoc/nodes/fence/index.js +0 -1
  95. package/dist/server/plugins/markdown/markdoc/nodes/heading.js +0 -1
  96. package/dist/server/plugins/markdown/markdoc/tags/json-example.d.ts +0 -3
  97. package/dist/server/plugins/markdown/markdoc/tags/json-schema.d.ts +0 -3
  98. package/dist/server/plugins/markdown/markdoc/tags/openapi-code-sample.d.ts +0 -3
  99. package/dist/server/plugins/markdown/markdoc/tags/openapi-example.d.ts +0 -3
  100. package/dist/server/plugins/markdown/markdoc/tags/openapi-response-sample.d.ts +0 -3
  101. package/dist/server/plugins/markdown/markdoc/tags/replay-openapi.d.ts +0 -3
  102. package/dist/server/plugins/openapi-docs/template/helpers.js +0 -5
  103. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/html-script.d.ts +0 -0
  104. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.d.ts +0 -0
  105. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.js +0 -0
  106. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.d.ts +0 -0
  107. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.js +0 -0
  108. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.d.ts +0 -0
  109. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.js +0 -0
  110. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.d.ts +0 -0
  111. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.js +0 -0
  112. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.d.ts +0 -0
  113. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.js +0 -0
  114. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.d.ts +0 -0
  115. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.js +0 -0
  116. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.d.ts +0 -0
  117. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.js +0 -0
  118. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.d.ts +0 -0
  119. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.js +0 -0
  120. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.d.ts +0 -0
  121. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.js +0 -0
  122. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.d.ts +0 -0
  123. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.js +0 -0
  124. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.d.ts +0 -0
  125. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.js +0 -0
  126. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.d.ts +0 -0
  127. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.js +0 -0
  128. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.d.ts +0 -0
  129. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.js +0 -0
  130. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-code-sample.d.ts +0 -0
  131. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.d.ts +0 -0
  132. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.js +0 -0
  133. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-response-sample.d.ts +0 -0
  134. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/replay-openapi.d.ts +0 -0
  135. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.d.ts +0 -0
  136. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.js +0 -0
  137. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.d.ts +0 -0
  138. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.js +0 -0
  139. /package/dist/{server/plugins/markdown → client/app}/markdoc/hooks/use-store.d.ts +0 -0
  140. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/helpers.d.ts +0 -0
  141. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.d.ts +0 -0
  142. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.js +0 -0
  143. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.d.ts +0 -0
  144. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.js +0 -0
  145. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.d.ts +0 -0
  146. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.js +0 -0
  147. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.d.ts +0 -0
  148. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.js +0 -0
  149. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.d.ts +0 -0
  150. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.js +0 -0
  151. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.d.ts +0 -0
  152. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.js +0 -0
  153. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.d.ts +0 -0
  154. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.js +0 -0
  155. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.d.ts +0 -0
  156. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.js +0 -0
  157. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.d.ts +0 -0
  158. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.js +0 -0
  159. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.d.ts +0 -0
  160. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.js +0 -0
  161. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.d.ts +0 -0
  162. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.js +0 -0
  163. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.d.ts +0 -0
  164. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.js +0 -0
  165. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.d.ts +0 -0
  166. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.js +0 -0
  167. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.d.ts +0 -0
  168. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.js +0 -0
  169. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.d.ts +0 -0
  170. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.js +0 -0
  171. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.d.ts +0 -0
  172. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.js +0 -0
  173. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.d.ts +0 -0
  174. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.js +0 -0
  175. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.d.ts +0 -0
  176. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.js +0 -0
  177. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.d.ts +0 -0
  178. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.js +0 -0
  179. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.d.ts +0 -0
  180. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.js +0 -0
  181. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.d.ts +0 -0
  182. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.js +0 -0
  183. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.d.ts +0 -0
  184. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.js +0 -0
  185. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.d.ts +0 -0
  186. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.js +0 -0
  187. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.d.ts +0 -0
  188. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.js +0 -0
  189. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.d.ts +0 -0
  190. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.js +0 -0
  191. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/index.d.ts +0 -0
  192. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.d.ts +0 -0
  193. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.js +0 -0
  194. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/heading.d.ts +0 -0
  195. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.d.ts +0 -0
  196. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.js +0 -0
  197. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.d.ts +0 -0
  198. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.js +0 -0
  199. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.d.ts +0 -0
  200. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.js +0 -0
  201. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.js +0 -0
  202. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-example.js +0 -0
  203. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-schema.js +0 -0
  204. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-code-sample.js +0 -0
  205. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-example.js +0 -0
  206. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-response-sample.js +0 -0
  207. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/replay-openapi.js +0 -0
  208. /package/dist/{server/utils → utils}/conflict-resolvers.d.ts +0 -0
  209. /package/dist/{server/utils → utils}/conflict-resolvers.js +0 -0
  210. /package/dist/{server/utils → utils}/slugger.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @redocly/redoc
2
2
 
3
+ ## 0.131.0-next.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 130c111688: Fixed security vulnerability CVE-2026-26996 in minimatch by upgrading to version 10.2.1.
8
+ - 32c0b1683b: Fixed an issue where schemas using `allOf` with a `$ref` had their own `title` overridden by the referenced schema's title.
9
+ - 2641586046: Fixed an issue where navigating to a referenced field resulted in a `404` in GraphQL Docs.
10
+ - Updated dependencies [32c0b1683b]
11
+ - Updated dependencies [2641586046]
12
+ - @redocly/openapi-docs@3.19.0-next.5
13
+ - @redocly/graphql-docs@1.8.0-next.4
14
+ - @redocly/asyncapi-docs@1.8.0-next.5
15
+ - @redocly/portal-plugin-mock-server@0.16.0-next.5
16
+
17
+ ## 0.131.0-next.7
18
+
19
+ ### Patch Changes
20
+
21
+ - d0b99c0768: Fixed URL fragment duplication when opening docs for endpoints with path parameters (e.g. `/foo/{id}/bar`).
22
+ - Updated dependencies [377e39138a]
23
+ - @redocly/realm-asyncapi-sdk@0.9.0-next.2
24
+ - @redocly/theme@0.63.0-next.3
25
+
26
+ ## 0.130.4
27
+
28
+ ### Patch Changes
29
+
30
+ - 5b1e533559: Fixed security vulnerability CVE-2026-25128 in fast-xml-parser by upgrading openapi-sampler to version 1.7.0.
31
+ - Updated dependencies [5b1e533559]
32
+ - @redocly/portal-plugin-mock-server@0.15.2
33
+ - @redocly/asyncapi-docs@1.7.2
34
+ - @redocly/openapi-docs@3.18.2
35
+ - @redocly/theme@0.62.1
36
+ - @redocly/graphql-docs@1.7.1
37
+
38
+ ## 0.130.3
39
+
40
+ ### Patch Changes
41
+
42
+ - 0beb1adad0: Fixed a bug where AI search events were not tracked for project analytics.
43
+ - Updated dependencies [e7708a15f1]
44
+ - Updated dependencies [e7708a15f1]
45
+ - @redocly/portal-plugin-mock-server@0.15.1
46
+ - @redocly/asyncapi-docs@1.7.1
47
+ - @redocly/openapi-docs@3.18.1
48
+
3
49
  ## 0.131.0-next.6
4
50
 
5
51
  ### Patch Changes
@@ -1 +1 @@
1
- import{detectSpec as m,getTypes as f,normalizeTypes as d,normalizeVisitors as u,resolveDocument as w,BaseResolver as h,Stats as S,walkDocument as y}from"@redocly/openapi-core";import{logger as l}from"../../../server/tools/notifiers/logger.js";import{telemetryTraceStep as g}from"../../telemetry/helpers/trace-step.js";import{telemetry as D}from"../../telemetry/index.js";const t={refs:{metric:"References",total:0,color:"red",items:new Set},externalDocs:{metric:"External Documents",total:0,color:"magenta"},schemas:{metric:"Schemas",total:0,color:"white"},parameters:{metric:"Parameters",total:0,color:"yellow",items:new Set},links:{metric:"Links",total:0,color:"cyan",items:new Set},pathItems:{metric:"Path Items",total:0,color:"green"},webhooks:{metric:"Webhooks",total:0,color:"green"},operations:{metric:"Operations",total:0,color:"yellow"},tags:{metric:"Tags",total:0,color:"white",items:new Set}};async function x(a,r){await g("stats.openapi",async()=>{l.info("OpenAPI collector: start processing documents...");const s=(await a.cache.load(".","load-oas-docs")).data,e=[];for(const o of s)if(!o.isVirtual){const n=await b(o);e.push(n)}D.sendStatsOpenapiCollectedMessage([{object:"openapi_stats",openapiStats:e.map(o=>JSON.stringify(o))}]),r||console.table(e),l.info("OpenAPI collector: openapi docments processing completed.")})}async function b(a){const r=a.definition,s=m(r),e=d(f(s)),o=u([{severity:"warn",ruleId:"openapi_stats",visitor:S(t)}],e),n={problems:[],specVersion:s,visitorsData:{}},c={source:{absoluteRef:""},parsed:r},i=e.Root;if(!i)throw new Error("Root type not found in OpenAPI spec types");const p=await w({rootDocument:c,rootType:i,externalRefResolver:new h});return y({rootType:i,normalizedVisitors:o,resolvedRefMap:p,document:c,ctx:n}),{path:a.relativePath,refs:t.refs.total,externalDocs:t.externalDocs.total,schemas:t.schemas.total,parameters:t.parameters.total,links:t.links.total,pathItems:t.pathItems.total,webhooks:t.webhooks.total,operations:t.operations.total,tags:t.tags.total,version:s}}export{x as collectOpenapiDocumentsStatistics};
1
+ import{detectSpec as m,getTypes as f,normalizeTypes as d,normalizeVisitors as u,resolveDocument as w,BaseResolver as h,Stats as y,walkDocument as S}from"@redocly/openapi-core";import{logger as l}from"../../../server/tools/notifiers/logger.js";import{envConfig as g}from"../../../server/config/env-config.js";import{telemetryTraceStep as D}from"../../telemetry/helpers/trace-step.js";import{telemetry as I}from"../../telemetry/index.js";const t={refs:{metric:"References",total:0,color:"red",items:new Set},externalDocs:{metric:"External Documents",total:0,color:"magenta"},schemas:{metric:"Schemas",total:0,color:"white"},parameters:{metric:"Parameters",total:0,color:"yellow",items:new Set},links:{metric:"Links",total:0,color:"cyan",items:new Set},pathItems:{metric:"Path Items",total:0,color:"green"},webhooks:{metric:"Webhooks",total:0,color:"green"},operations:{metric:"Operations",total:0,color:"yellow"},tags:{metric:"Tags",total:0,color:"white",items:new Set}};async function T(s,a){await D("stats.openapi",async()=>{l.info("OpenAPI collector: start processing documents...");const e=(await s.cache.load(".","load-oas-docs")).data,o=[];for(const r of e)if(!r.isVirtual){const n=await v(r);o.push(n),I.sendStatsOpenapiCollectedMessage([{...n,projectBuildId:g.PROJECT_BUILD_ID||""}])}a||console.table(o),l.info("OpenAPI collector: openapi docments processing completed.")})}async function v(s){const a=s.definition,e=m(a),o=d(f(e)),r=u([{severity:"warn",ruleId:"openapi_stats",visitor:y(t)}],o),n={problems:[],specVersion:e,visitorsData:{}},c={source:{absoluteRef:""},parsed:a},i=o.Root;if(!i)throw new Error("Root type not found in OpenAPI spec types");const p=await w({rootDocument:c,rootType:i,externalRefResolver:new h});return S({rootType:i,normalizedVisitors:r,resolvedRefMap:p,document:c,ctx:n}),{path:s.relativePath,refs:t.refs.total,externalDocs:t.externalDocs.total,schemas:t.schemas.total,parameters:t.parameters.total,links:t.links.total,pathItems:t.pathItems.total,webhooks:t.webhooks.total,operations:t.operations.total,tags:t.tags.total,version:e}}export{T as collectOpenapiDocumentsStatistics};
@@ -1 +1 @@
1
- import{AsyncApiRealmCLI as c}from"@redocly/realm-asyncapi-sdk";import{TELEMETRY_ENABLED as i}from"../../server/constants/common.js";import{shutdowner as a}from"../../server/tools/shutdowner.js";import{envConfig as o}from"../../server/config/env-config.js";import{PACKAGE_NAME as l}from"../../config/product-gates.js";class n extends c.Telemetry{#e=new Map;constructor(){super(),this.updateCloudEventData(()=>({organization:{id:o.ORGANIZATION_ID||"",slug:o.ORGANIZATION_SLUG||""},project:{id:o.PROJECT_ID||"",slug:""},productType:"cli",sourceDetails:{id:"Anonymous",object:"user",uri:""},source:"cli"}))}initialize(e,t,r){const s=t!==void 0?!(t&&i):!i;this.init({otel:{serviceName:"realm-cli",serviceVersion:`${l}@${e}`,collectorTraceUrl:o.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:o.isProductionEnv,version:"1.0",tracerName:"cli-telemetry"},disabled:s,verbose:r}),a.registerShutdownCallback(this.#t.bind(this))}addTraceStepCallbacks(e,{error:t,end:r}){this.#e.set(e,{error:t,end:r})}removeTraceStepCallbacks(e){this.#e.delete(e)}async#t(e){for(const[,{error:t,end:r}]of this.#e)e&&t(e),r();this.#e.clear(),await this.forceFlush(),await this.shutdown()}}const d=new n,f=d.tracer;export{d as telemetry,f as telemetryTracer};
1
+ import{AsyncApiRealmCLI as c}from"@redocly/realm-asyncapi-sdk";import{ulid as l}from"ulid";import{TELEMETRY_ENABLED as i}from"../../server/constants/common.js";import{shutdowner as s}from"../../server/tools/shutdowner.js";import{envConfig as t}from"../../server/config/env-config.js";import{PACKAGE_NAME as n}from"../../config/product-gates.js";class d extends c.Telemetry{#e=new Map;constructor(){super(),this.updateCloudEventData(()=>({organizationId:t.ORGANIZATION_ID||"",organizationSlug:t.ORGANIZATION_SLUG||"",projectId:t.PROJECT_ID||"",projectSlug:t.PROJECT_SLUG||"",origin:"realmCli",actor:{id:`ann_${l()}`,object:"user",uri:""},source:"cli"}))}initialize(e,r,o){const a=r!==void 0?!(r&&i):!i;this.init({otel:{serviceName:"realm-cli",serviceVersion:`${n}@${e}`,collectorTraceUrl:t.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:t.isProductionEnv,version:"1.0",tracerName:"cli-telemetry"},disabled:a,verbose:o}),s.registerShutdownCallback(this.#r.bind(this))}addTraceStepCallbacks(e,{error:r,end:o}){this.#e.set(e,{error:r,end:o})}removeTraceStepCallbacks(e){this.#e.delete(e)}async#r(e){for(const[,{error:r,end:o}]of this.#e)e&&r(e),o();this.#e.clear(),await this.forceFlush(),await this.shutdown()}}const m=new d,A=m.tracer;export{m as telemetry,A as telemetryTracer};
@@ -1 +1 @@
1
- import*as o from"react";import{useEffect as l}from"react";import{Outlet as E,useLocation as g,useNavigate as d}from"react-router-dom";import{components as h}from"@redocly-markdoc/components";import P from"@markdoc/markdoc/dist/react";import{withoutPathPrefix as T}from"@redocly/theme/core/utils";import{InternalServerErrorLayout as D}from"@redocly/theme/layouts/InternalServerErrorLayout";import{RootLayout as S}from"@redocly/theme/layouts/RootLayout";import{PageLayout as L}from"@redocly/theme/layouts/PageLayout";import{components as i}from"@redocly/theme/markdoc/default";import{Sidebar as _}from"./app/Sidebar/Sidebar";import{loadAndNavigate as v}from"./app/utils/loadAndNavigate";import{useActions as C}from"./app/Sidebar/useActions";import{useScrollTracker as A}from"./app/hooks/useScrollTracker";import{useAutoScroll as y}from"./app/hooks/useAutoScroll";import{OPENAPI_DOCS_TEMPLATE_ID as O,ASYNC_API_DOCS_TEMPLATE_ID as R,GRAPHQL_TEMPLATE_ID as N}from"../constants/common";import{removeTrailingSlash as I}from"../utils/url/remove-trailing-slash";import{removeLeadingSlash as b}from"../utils/url/remove-leading-slash";import*as k from"../server/plugins/markdown/markdoc/custom-components/index";import{DefaultStyles as M}from"./styling/default-styles";import{ThemeDataProvider as x}from"./providers/theme/ThemeDataProvider";import{PageDataContext as B}from"./providers/page-data/PageDataContext";import{SeoTags as G}from"./app/seo/SeoTags";import{useRouterForLocalLinks as V,useRunningEnvironmentCheck as F}from"./providers/hooks";import{usePageData as $,usePageDataLoader as w}from"./providers/page-data/hooks";import{ErrorBoundary as H}from"./ErrorBoundary";import{ErrorDetails as c,Loader as Q}from"./server-entry";import"@styles";import{useRouteChangeTracker as U}from"./app/hooks/useRouteChangeTracker";import{isInIframe as Y}from"./utils";import{useL10n as j}from"./app/l10n";import{PostMessageProvider as q}from"./providers/post-message/PostMessageProvider";import{ScriptLoader as z}from"./ScriptLoader";import{clientRoutes as J}from"./runtime/generated/routes.js";import{DevModeFloatingBar as K}from"./app/DevModeFloatingBar";import{usePageTimeTracker as W}from"./app/hooks/usePageTimeTracker";globalThis.__LOADER.markdocComponents={...k,...i};function ke(){const e=w(),[t,n]=o.useState(e),r=g(),m=d();j(),l(()=>{e?n(e):v({navigate:m,to:r.pathname+r.search+r.hash}).then(()=>n(Q.loadSync(r.pathname)))},[r,m]),V();const a=F();return a?(console.log(a),o.createElement(c,{error:{message:a,name:""}})):t?o.createElement(H,null,o.createElement(M,null),o.createElement(B.Provider,{value:e||t},o.createElement(x,null,o.createElement(q,{enabled:process.env.NODE_ENV==="development"||Y()},o.createElement(E,null))))):null}function u(){U(),W(),A(),y();const e=$(),t=C(),{layout:n}=t,r={layout:n},m=process.env.NODE_ENV!=="production",a=globalThis.SSR_OMIT_SUSPENSE,s=e?.props.ast&&e.props.ast.$$mdtype==="Tag"?P(e.props.ast,o,{components:{...globalThis.__LOADER.markdocComponents,...i,...h}}):null,f=I(e?.slug||"");if(l(()=>{document.documentElement.classList.add("ready")},[]),e?.props.pagePropGetterError?.message)return m?o.createElement(c,{error:{...e?.props?.pagePropGetterError}}):o.createElement(D,null);if(!!e?.props?.compilationErrors?.length)return e?.Template?o.createElement(e.Template,{pageProps:e?.props,children:s}):null;const p=()=>o.createElement(S,null,o.createElement(L,{sidebar:o.createElement(_,{layoutControls:t})},o.createElement(G,{seo:e?.props.seo,slug:f}),e?.Template?o.createElement(e.Template,{pageProps:[O,R,N].includes(e.templateId)?{...e.props,apiOptions:r}:e?.props,children:s}):null),process.env.NODE_ENV!=="production"&&o.createElement(K,null),o.createElement(z,null));return a?p():o.createElement(o.Suspense,null,p())}const Me=[...J.map(e=>({Component:u,path:b(T(e).substring(1)+"/*")})),{Component:u,path:"*"}];export{ke as App,u as Page,Me as routes};
1
+ import*as o from"react";import{useEffect as l}from"react";import{Outlet as E,useLocation as g,useNavigate as d}from"react-router-dom";import{components as h}from"@redocly-markdoc/components";import P from"@markdoc/markdoc/dist/react";import{withoutPathPrefix as T}from"@redocly/theme/core/utils";import{InternalServerErrorLayout as D}from"@redocly/theme/layouts/InternalServerErrorLayout";import{RootLayout as S}from"@redocly/theme/layouts/RootLayout";import{PageLayout as L}from"@redocly/theme/layouts/PageLayout";import{components as i}from"@redocly/theme/markdoc/default";import{Sidebar as _}from"./app/Sidebar/Sidebar";import{loadAndNavigate as v}from"./app/utils/loadAndNavigate";import{useActions as C}from"./app/Sidebar/useActions";import{useScrollTracker as A}from"./app/hooks/useScrollTracker";import{useAutoScroll as y}from"./app/hooks/useAutoScroll";import{OPENAPI_DOCS_TEMPLATE_ID as O,ASYNC_API_DOCS_TEMPLATE_ID as R,GRAPHQL_TEMPLATE_ID as N}from"../constants/common";import{removeTrailingSlash as I}from"../utils/url/remove-trailing-slash";import{removeLeadingSlash as b}from"../utils/url/remove-leading-slash";import*as k from"./app/markdoc/custom-components/index";import{DefaultStyles as M}from"./styling/default-styles";import{ThemeDataProvider as x}from"./providers/theme/ThemeDataProvider";import{PageDataContext as B}from"./providers/page-data/PageDataContext";import{SeoTags as G}from"./app/seo/SeoTags";import{useRouterForLocalLinks as V,useRunningEnvironmentCheck as F}from"./providers/hooks";import{usePageData as $,usePageDataLoader as w}from"./providers/page-data/hooks";import{ErrorBoundary as H}from"./ErrorBoundary";import{ErrorDetails as c,Loader as Q}from"./server-entry";import"@styles";import{useRouteChangeTracker as U}from"./app/hooks/useRouteChangeTracker";import{isInIframe as Y}from"./utils";import{useL10n as j}from"./app/l10n";import{PostMessageProvider as q}from"./providers/post-message/PostMessageProvider";import{ScriptLoader as z}from"./ScriptLoader";import{clientRoutes as J}from"./runtime/generated/routes.js";import{DevModeFloatingBar as K}from"./app/DevModeFloatingBar";import{usePageTimeTracker as W}from"./app/hooks/usePageTimeTracker";globalThis.__LOADER.markdocComponents={...k,...i};function ke(){const e=w(),[t,n]=o.useState(e),r=g(),m=d();j(),l(()=>{e?n(e):v({navigate:m,to:r.pathname+r.search+r.hash}).then(()=>n(Q.loadSync(r.pathname)))},[r,m]),V();const a=F();return a?(console.log(a),o.createElement(c,{error:{message:a,name:""}})):t?o.createElement(H,null,o.createElement(M,null),o.createElement(B.Provider,{value:e||t},o.createElement(x,null,o.createElement(q,{enabled:process.env.NODE_ENV==="development"||Y()},o.createElement(E,null))))):null}function u(){U(),W(),A(),y();const e=$(),t=C(),{layout:n}=t,r={layout:n},m=process.env.NODE_ENV!=="production",a=globalThis.SSR_OMIT_SUSPENSE,s=e?.props.ast&&e.props.ast.$$mdtype==="Tag"?P(e.props.ast,o,{components:{...globalThis.__LOADER.markdocComponents,...i,...h}}):null,f=I(e?.slug||"");if(l(()=>{document.documentElement.classList.add("ready")},[]),e?.props.pagePropGetterError?.message)return m?o.createElement(c,{error:{...e?.props?.pagePropGetterError}}):o.createElement(D,null);if(!!e?.props?.compilationErrors?.length)return e?.Template?o.createElement(e.Template,{pageProps:e?.props,children:s}):null;const p=()=>o.createElement(S,null,o.createElement(L,{sidebar:o.createElement(_,{layoutControls:t})},o.createElement(G,{seo:e?.props.seo,slug:f}),e?.Template?o.createElement(e.Template,{pageProps:[O,R,N].includes(e.templateId)?{...e.props,apiOptions:r}:e?.props,children:s}):null),process.env.NODE_ENV!=="production"&&o.createElement(K,null),o.createElement(z,null));return a?p():o.createElement(o.Suspense,null,p())}const Me=[...J.map(e=>({Component:u,path:b(T(e).substring(1)+"/*")})),{Component:u,path:"*"}];export{ke as App,u as Page,Me as routes};
@@ -1 +1 @@
1
- import{useLocation as i,useNavigate as r}from"react-router-dom";import{useEffect as s,useRef as u}from"react";import{useActiveSectionId as f}from"@redocly/theme/core/hooks";import{isBrowser as h}from"../../../utils/env/is-browser";let n=!0;function v(){const t=i(),o=r(),e=f(t,!1,!1),a=u(null);s(()=>{if(e&&n){n=!1,a.current=e;return}const c=a.current!==e;h()&&e&&!t.hash&&c&&!window.location.pathname.includes(e)&&o({pathname:t.pathname,search:t.search,hash:`#${e}`},{replace:!0}),a.current=e},[e,t.pathname,t.search,t.hash,o])}export{v as useAutoScroll};
1
+ import{useLocation as i,useNavigate as s}from"react-router-dom";import{useEffect as h,useRef as m}from"react";import{useActiveSectionId as u}from"@redocly/theme/core/hooks";import{isBrowser as f}from"../../../utils/env/is-browser";import{pathnameMatchesActiveSection as p}from"./utils/pathname-matches-active-section.js";let c=!0;function g(){const t=i(),o=s(),e=u(t,!1,!1),a=m(null);h(()=>{if(e&&c){c=!1,a.current=e;return}const n=a.current!==e,r=p(window.location.pathname,e);f()&&e&&!t.hash&&n&&!r&&o({pathname:t.pathname,search:t.search,hash:`#${e}`},{replace:!0}),a.current=e},[e,t.pathname,t.search,t.hash,o])}export{g as useAutoScroll};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * True when pathname (after decode) already identifies the same section as activeSectionId.
3
+ * Used to avoid adding redundant hash when URL path already matches (e.g. encoded %7b/%7d vs logical {}).
4
+ */
5
+ export declare function pathnameMatchesActiveSection(pathname: string, activeSectionId: string): boolean;
6
+ //# sourceMappingURL=pathname-matches-active-section.d.ts.map
@@ -0,0 +1 @@
1
+ import{normalizeRouteSlug as t}from"../../../../utils/path/normalize-route-slug";function c(e,o){return t(e).toLowerCase().includes(o.toLowerCase())}export{c as pathnameMatchesActiveSection};
@@ -0,0 +1 @@
1
+ import*as s from"react";import{loadScriptFromReactAsync as l,loadScriptFromReactSync as i}from"../../../ScriptLoader";function u(n){let r=!1;const{children:c,src:e,async:o,...t}=n;return typeof document<"u"&&(r=!!(e?document.querySelector(`script[src="${e}"]`):null)),s.useEffect(()=>{r||(e?o?l(e,t):i(e,!1,t):c&&i(c.toString(),!0,t))},[e]),null}export{u as HtmlScript};
@@ -0,0 +1 @@
1
+ import*as o from"react";import{StoreProvider as v,RequestSamples as y,normalizeOptions as E}from"@redocly/openapi-docs";import{ErrorMessage as O,OpenApiComponentWrap as M}from"../styled.elements";import{useStore as b}from"../../hooks/use-store";import{getOperation as C}from"./get-operation/index";import{getMockServerDocsConfig as k}from"../../../../templates/openapi-docs/mock-server-config.js";function P(u){const{descriptionFile:d,operationId:a,pointer:m,exampleKey:s,mimeType:l,language:r,requestBody:f,parameters:g,environment:t,environments:n}=u,{store:e,error:S,baseSlug:c}=b(d),i=o.useMemo(()=>({...e?.options,...(r||null)&&{codeSamples:{languages:[{lang:r??""}]},mockServer:k(e?.options?.mockServer,c||"")}}),[r,e?.options,c]),p=o.useMemo(()=>{if(e)return C(e,{operationId:a,pointer:m},E(i),{exampleKey:s,mimeType:l,environments:n,environment:t})},[s,i,l,a,m,e,n,t]);return e?p?o.createElement(M,{"data-testid":"openapi-code-sample"},o.createElement(v,{options:i,definition:e.definition,withState:{environments:n,environment:t,operation:{pointer:p.pointer,state:{requestValues:{body:f,...g}}}}},o.createElement(y,{operation:p,disableFooter:!0}))):o.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation by operationId or pointer"):o.createElement(O,null,S)}export{P as OpenApiCodeSample};
@@ -0,0 +1 @@
1
+ import*as e from"react";import{StoreProvider as S,ResponseSamples as v,normalizeOptions as g}from"@redocly/openapi-docs";import{ErrorMessage as b,OpenApiComponentWrap as E}from"../styled.elements";import{useStore as R}from"../../hooks/use-store";import{getOperation as C}from"./get-operation/index";import{getMockServerDocsConfig as O}from"../../../../templates/openapi-docs/mock-server-config.js";function x(a){const{descriptionFile:m,operationId:i,pointer:p,exampleKey:t}=a,{store:o,error:c,baseSlug:s}=R(m),[l,f]=e.useState(),r=e.useMemo(()=>({...o?.options,mockServer:O(o?.options?.mockServer,s||"")}),[o?.options,s]),n=e.useMemo(()=>{if(o)return C(o,{operationId:i,pointer:p},g(r),{exampleKey:t})},[t,r,i,p,o]),d=e.useCallback(u=>{f(u)},[]);return o?n?e.createElement(E,{"data-testid":"openapi-response-sample"},e.createElement(S,{options:r,definition:o.definition,withState:{operation:{pointer:n.pointer,state:{activeExampleName:t}}}},e.createElement(v,{operation:n,activeResponseTab:l,onTabChange:d}))):e.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation by operationId or pointer"):e.createElement(b,null,c)}export{x as OpenApiResponseSample};
@@ -0,0 +1 @@
1
+ import o from"react";import{EmbeddedReplay as E,StoreProvider as M}from"@redocly/openapi-docs";import{useLocation as b}from"react-router-dom";import{Admonition as k}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{ErrorMessage as A,OpenApiComponentWrap as I}from"../styled.elements.js";import{useStore as P}from"../../hooks/use-store.js";import{getOperation as x}from"./get-operation/index.js";import{getMockServerDocsConfig as R}from"../../../../templates/openapi-docs/mock-server-config.js";const L=y=>{const{descriptionFile:n,operationId:i,pointer:p,exampleKey:d,mimeType:l,requestBody:a,parameters:S,options:m,environment:t,environments:s,hideOtherSecuritySchemes:O}=y,h=b(),{store:e,error:v,baseSlug:u}=P(n),c=o.useMemo(()=>({...e?.options,...m}),[m,e?.options]),f=o.useMemo(()=>{const{mockServer:C,...g}=c;return g},[c]),r=o.useMemo(()=>{if(e)return x(e,{operationId:i,pointer:p},f,{exampleKey:d,mimeType:l,environments:s,environment:t,requestBody:a})},[d,f,l,i,p,e,s,t,a]);return e?r?o.createElement(I,{"data-testid":"replay-openapi"},o.createElement(M,{key:`${h.pathname}-${n}-${i||p}`,options:{...m,disableRouter:!0,routingBasePath:u,mockServer:R(c.mockServer,u)},definition:e.definition,withState:{environments:s,allowedEnvironments:t?[t]:void 0,operation:{pointer:r.pointer,state:{requestValues:{body:a,...S}}}}},o.createElement(E,{activeOperationId:r.operationId||"",fullOpenApi:e.definition,corsProxyUrl:e.options.corsProxyUrl,pointer:r.pointer,hideOtherSecuritySchemes:O}))):o.createElement(k,{type:"danger"},"Cannot find OpenAPI operation by operationId or pointer in ",n):o.createElement(A,null,v)};export{L as ReplayOpenApi};
@@ -0,0 +1 @@
1
+ import{usePageSharedData as t}from"../../../providers/page-data/hooks";function n(r){const e=t(r||"");return e?{store:e,error:null,baseSlug:e.baseSlug}:{store:void 0,error:"Incorrect OpenAPI file path"}}export{n as useStore};
@@ -3,9 +3,7 @@ export declare function useCollectMarkdocOptions({ markdown }: PageProps): {
3
3
  partials: Record<string, import("@markdoc/markdoc").Node | import("@markdoc/markdoc").Node[]> | undefined;
4
4
  variables?: Record<string, any>;
5
5
  tags: {
6
- [x: string]: (import("@markdoc/markdoc").Schema & {
7
- dynamicComponentLib: string;
8
- }) | (import("@markdoc/markdoc").Schema<Readonly<Partial<{
6
+ [x: string]: (import("@markdoc/markdoc").Schema<Readonly<Partial<{
9
7
  nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
10
8
  tags: Record<string, import("@markdoc/markdoc").Schema>;
11
9
  variables: Record<string, any>;
@@ -20,6 +18,8 @@ export declare function useCollectMarkdocOptions({ markdown }: PageProps): {
20
18
  attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
21
19
  resolver?: string;
22
20
  }>;
21
+ }) | (import("@markdoc/markdoc").Schema & {
22
+ dynamicComponentLib?: string;
23
23
  });
24
24
  };
25
25
  nodes: {
@@ -0,0 +1 @@
1
+ import{useMemo as t}from"react";import{components as s}from"@redocly-markdoc/components";import{tags as m,components as r}from"@redocly/theme/markdoc/default";import*as n from"../../app/markdoc/custom-components/index.js";import*as e from"../../../markdoc/nodes/index.js";import p from"../../../markdoc/tags/index.js";import{parsePartials as a}from"../../templates/openapi-docs/helpers.js";function C({markdown:o}){return t(()=>({tags:{...p,...m},nodes:{...e},components:{...n,...r,...s,...globalThis.__LOADER.markdocComponents},...o,partials:a(o?.partials)}),[o])}export{C as useCollectMarkdocOptions};
@@ -12,4 +12,4 @@ type TemplateProps = {
12
12
  };
13
13
  export default function AsyncApiDocs({ pageProps }: TemplateProps): React.JSX.Element;
14
14
  export {};
15
- //# sourceMappingURL=AsyncApiDocs.d.ts.map
15
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1,11 @@
1
+ import l from"styled-components";import*as o from"react";import{RedoclyAsyncAPIDocs as d}from"@redocly/asyncapi-docs";import{withPathPrefix as m}from"@redocly/theme/core/utils";import{usePageSharedData as p}from"../../providers/page-data/hooks";import{useCollectMarkdocOptions as f}from"./helpers.js";function h({pageProps:t}){const a=p("AsyncApiDefinition"),{document:i,apiItems:r,protocol:e,downloadUrls:n}=a,c=m(t?.settings?.baseUrlPath),s=f(t);return o.createElement(u,null,o.createElement(d,{pageProps:t,document:i,apiItems:r,routingBasePath:c,protocol:e,downloadUrls:n,markdocOptions:s}))}const u=l.div`
2
+ a[id],
3
+ a[data-section-id],
4
+ div[data-section-id] {
5
+ scroll-margin-top: calc(
6
+ var(--navbar-height) + var(--banner-height) + var(--panel-gap-vertical)
7
+ );
8
+ }
9
+
10
+ --sidebar-width: 0px;
11
+ `;export{h as default};
@@ -0,0 +1,5 @@
1
+ import{useMemo as u}from"react";import{components as f}from"@redocly-markdoc/components";import{Ast as g}from"@markdoc/markdoc";import{PageNavigation as d}from"@redocly/theme/components/PageNavigation/PageNavigation";import{tags as _,components as h}from"@redocly/theme/markdoc/default";import{Breadcrumbs as y}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{withPathPrefix as c}from"@redocly/theme/core/utils";import{OPENAPI_DOCS_TEMPLATE_ID as P,ServerRoutes as m}from"../../../constants/common.js";import{isBrowser as w}from"../../../utils/env/is-browser.js";import*as S from"../../../markdoc/nodes/index.js";import O from"../../../markdoc/tags/index.js";import*as v from"../../app/markdoc/custom-components/index.js";import{usePageData as C,useSidebarSiblingsData as x}from"../../providers/page-data/hooks";import{telemetry as A}from"../../app/telemetry/index.js";import{getMockServerDocsConfig as E}from"./mock-server-config.js";function V(o="",r="",t="/"){return o.endsWith(t)&&(o=o.slice(0,-t.length)),r.startsWith(t)&&(r=r.slice(t.length)),!o||!r?o+r:o+t+r}function R(o){if(o)return Object.entries(o).reduce((r,[t,n])=>(r[t]=g.fromJSON(JSON.stringify(n)),r),{})}function Y(o,{markdown:r,baseSlug:t}){return u(()=>{const i=w();if(o.options.oAuth2RedirectURI=i?`${window.location.origin}${c(m.REPLAY_OAUTH2_CALLBACK)}`:null,o.options.routingBasePath=c(t),o.options.mockServer=E(o.options.mockServer,t),!o.options.corsProxyUrl){const e=c(`${m.CORS_PROXY}/`);o.options.corsProxyUrl=i?new URL(e,window.location.origin).toString():e}o.options.scrollYOffset=i?parseInt(getComputedStyle(document.documentElement).getPropertyValue("--navbar-height"),10):0,o.options.markdocOptions={tags:{...O,..._},nodes:{...S},components:{...v,...h,...f,...globalThis.__LOADER.markdocComponents},...r,partials:R(r?.partials)},o.options.unstable_hooks={...o.options.unstable_hooks,MiddlePanelFooter:()=>{const{templateId:e}=C()||{},{nextPage:s,prevPage:a}=x()||{};return e===P?null:d({nextPage:s,prevPage:a})},MiddlePanelHeader:()=>y({})};const l={codeSamplesLanguageSwitch:"samples_language_switch",codeSamplesCopy:"code_samples_copy",panelToggle:"panel_toggle",targetServerSwitch:"target_server_switch",tryItOpen:"try_it_toggle",tryItSent:"try_it_sent"},p={};for(const[e,s]of Object.entries(l)){const a=T(o.options.events?.[e]);p[e]=b(a,s)}return o.options.events=p,o},[o,r,t])}function T(o){if(typeof window>"u")return null;if(typeof o=="function")return o;if(typeof o!="string")return null;try{const r=o.trim();if(!r.match(/^(\([^)]*\)\s*=>\s*.+|[a-zA-Z_$][\w$]*\s*=>\s*.+)$/))throw new Error("Invalid function format. Only arrow functions allowed.");if(["eval","Function","constructor","prototype","__proto__","import","require","process","global","window","document"].some(i=>r.includes(i)))throw new Error("Function contains prohibited keywords");return new Function("event",`
2
+ 'use strict';
3
+ const userFn = ${r};
4
+ return userFn(event);
5
+ `)}catch(r){return console.error("Function parsing error:",r),null}}function b(o,r){return t=>{if(o)try{o(t)}catch(n){console.error("User event handler error:",n)}if(r)try{A.sendOpenapiDocsMessage([{object:"openapi_docs",eventType:r,operationHttpVerb:t.operationHttpVerb,operationPath:t.operationPath,lang:"lang"in t?t.lang:void 0,action:t.action,state:"state"in t?t.state:void 0,serverUrl:"serverUrl"in t?t.serverUrl:void 0}])}catch{}}}export{V as joinWithSeparator,b as mergeEvents,R as parsePartials,T as safeParseFunction,Y as usePatchedStore};
@@ -3,4 +3,4 @@ import { type PageProps } from '@redocly/config';
3
3
  export default function OpenAPIDocs({ pageProps }: {
4
4
  pageProps: PageProps;
5
5
  }): React.JSX.Element | "Something went wrong";
6
- //# sourceMappingURL=OpenAPIDocs.d.ts.map
6
+ //# sourceMappingURL=template.d.ts.map
@@ -1,4 +1,4 @@
1
- import*as a from"react";import i from"styled-components";import{RedoclyOpenAPIDocs as c}from"@redocly/openapi-docs";import{LayoutVariant as s}from"@redocly/config";import{ThreePanelLayout as m}from"@redocly/theme/layouts/ThreePanelLayout";import{CatalogClassicInfoBlock as p}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{useUserClaims as h}from"../../../../client/app/hooks";import{usePageSharedData as u}from"../../../../client/providers/page-data/hooks";import{usePatchedStore as d}from"./helpers.js";function f({pageProps:t}){const o=h(),e=u("openAPIDocsStore"),n=a.useMemo(()=>({layout:t.apiOptions?.layout,userClaims:o}),[t.apiOptions?.layout,o]),r=d(e,t);if(!e)return"Something went wrong";const l=t.apiOptions?.layout;return a.createElement(g,null,a.createElement(v,{layout:l},a.createElement(p,{metadata:t.metadata})),a.createElement(c,{store:{options:r.options,definition:r.definition,withState:n}}))}const v=i(m)`
1
+ import*as a from"react";import i from"styled-components";import{RedoclyOpenAPIDocs as c}from"@redocly/openapi-docs";import{LayoutVariant as s}from"@redocly/config";import{ThreePanelLayout as m}from"@redocly/theme/layouts/ThreePanelLayout";import{CatalogClassicInfoBlock as p}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{useUserClaims as h}from"../../app/hooks";import{usePageSharedData as u}from"../../providers/page-data/hooks";import{usePatchedStore as d}from"./helpers.js";function f({pageProps:t}){const o=h(),e=u("openAPIDocsStore"),n=a.useMemo(()=>({layout:t.apiOptions?.layout,userClaims:o}),[t.apiOptions?.layout,o]),r=d(e,t);if(!e)return"Something went wrong";const l=t.apiOptions?.layout;return a.createElement(g,null,a.createElement(v,{layout:l},a.createElement(p,{metadata:t.metadata})),a.createElement(c,{store:{options:r.options,definition:r.definition,withState:n}}))}const v=i(m)`
2
2
  && {
3
3
  padding-right: ${({layout:t})=>t===s.THREE_PANEL?"calc(var(--panel-gap-horizontal) * 2)":"var(--panel-gap-horizontal)"};
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import type { Function, Node, RenderableTreeNode, Variable } from '@markdoc/markdoc';
2
- import type { GetInnerContentFnOptions } from '../../../../../types/index.js';
2
+ import type { GetInnerContentFnOptions } from '../../types/index.js';
3
3
  /**
4
4
  * Extracts and concatenates the inner text content from a tree of renderable nodes.
5
5
  *
@@ -0,0 +1,2 @@
1
+ import{isPrimitive as n}from"../../utils/guards/is-primitive.js";import{getNodeAttribute as o}from"./get-node-attribute.js";import{getVariable as p}from"./get-variable.js";import{isNode as a}from"./guards/is-node.js";import{isTag as l}from"./guards/is-tag.js";import{isCodeNode as c}from"./guards/is-code-node.js";import{isConditionalNode as d}from"./guards/is-conditional-node.js";import{isExampleNode as u}from"./guards/is-example-node.js";import{isFenceNode as h}from"./guards/is-fence-node.js";import{isTextNode as N}from"./guards/is-text-node.js";import{isFunction as b}from"./guards/is-function.js";import{isVariable as g}from"./guards/is-variable.js";function t(m,r={}){const{isTrim:s=!0}=r,i=[];for(const e of m){if(n(e))i.push(String(e));else if(a(e))if(e.type==="tr"&&i.push(`
2
+ `),N(e)||c(e)||h(e))i.push(t([o(e,"content")],r));else if(u(e))i.push(t(e.children.map(f=>o(f,"content")),r));else{if(d(e)&&r.skipConditionals)continue;i.push(t(e.children,r))}else l(e)&&e.name==="code"?i.push(t(e.children,r)):b(e)&&i.push(t(Object.values(e.parameters),r));g(e)&&i.push(t([p(e,r.variables)],r))}return s?i.map(e=>e.trim()).join(" ").trim():i.join(" ")}export{t as getInnerText};
@@ -3,7 +3,7 @@ import type { Variable } from '@markdoc/markdoc';
3
3
  * Resolves the value of a Markdoc `Variable` node.
4
4
  *
5
5
  * If the variable path starts with `"env"`, the value is read from the environment
6
- * variables using `readEnvVariable`. Otherwise, the value is retrieved from the
6
+ * variables using process.env. Otherwise, the value is retrieved from the
7
7
  * provided `variables` object using `getValueDeep`.
8
8
  *
9
9
  * @param node - The `Variable` node to resolve.
@@ -19,5 +19,5 @@ import type { Variable } from '@markdoc/markdoc';
19
19
  * getVariable(node2, { user: { name: 'John' } }); // "John"
20
20
  * ```
21
21
  */
22
- export declare function getVariable(node: Variable, variables?: Record<string, any>): string;
22
+ export declare function getVariable(node: Variable, variables?: Record<string, unknown>): string;
23
23
  //# sourceMappingURL=get-variable.d.ts.map
@@ -0,0 +1 @@
1
+ import{getValueDeep as n}from"../../utils/object/get-value-deep.js";function i(t,e){if(t?.path?.[0]==="env")return process.env[t.path[1]]??"";const{value:r}=n(e,t.path);return r??""}export{i as getVariable};
@@ -0,0 +1 @@
1
+ import a from"@markdoc/markdoc";import{isPrimitive as m}from"../../../utils/guards/is-primitive.js";import{isStringNode as s}from"../../helpers/guards/is-string-node.js";import{isTag as u}from"../../helpers/guards/is-tag.js";const g=a.nodes.fence,w={...g,attributes:{...g.attributes,label:{type:String,render:"data-label"},title:{type:String,render:"data-title"},highlight:{type:String,render:"data-highlight"}},transform(r,i){const e=r.transformAttributes(i);let t=r.transformChildren(i);const o=e["data-language"],l=e["data-title"];switch(r.attributes.process===!1&&(t=[r.attributes.content]),o){case"mermaid":return s(t[0])?new a.Tag("Mermaid",{...e,diagramSource:t[0]},t):new a.Tag(r.tag,e,t);default:const c=t.map(n=>m(n)?n.toString():u(n)?n?.attributes?.rawtag:"").join("");return s(t[0])?new a.Tag("CodeBlock",{...e,header:{title:l,controls:{copy:{}}},source:c,lang:o},[]):new a.Tag(r.tag,e,t)}}};export{w as fence};
@@ -0,0 +1 @@
1
+ import s from"@markdoc/markdoc";import{slugger as l}from"../../utils/slugger.js";import{getInnerText as a}from"../helpers/get-inner-text.js";const d={children:["inline"],attributes:{id:{type:String},level:{type:Number,required:!0,default:1},__idx:{type:Number}},transform(e,r){const t=e.transformAttributes(r),i=e.transformChildren(r),n=typeof t.id=="string"?t.id:l.slug(a(i),{replaceDots:!0,replaceSlashes:!0});return new s.Tag("Heading",{...t,id:n,level:e.attributes.level},i)}};export{d as heading};
@@ -6,22 +6,22 @@ import { openApiResponseSample } from './openapi-response-sample.js';
6
6
  import { jsonExample } from './json-example.js';
7
7
  declare const _default: {
8
8
  [jsonSchema.tagName]: import("@markdoc/markdoc").Schema & {
9
- dynamicComponentLib: string;
9
+ dynamicComponentLib?: string;
10
10
  };
11
11
  [openApiCodeSample.tagName]: import("@markdoc/markdoc").Schema & {
12
- dynamicComponentLib: string;
12
+ dynamicComponentLib?: string;
13
13
  };
14
14
  [openApiExample.tagName]: import("@markdoc/markdoc").Schema & {
15
- dynamicComponentLib: string;
15
+ dynamicComponentLib?: string;
16
16
  };
17
17
  [replayOpenApi.tagName]: import("@markdoc/markdoc").Schema & {
18
- dynamicComponentLib: string;
18
+ dynamicComponentLib?: string;
19
19
  };
20
20
  [openApiResponseSample.tagName]: import("@markdoc/markdoc").Schema & {
21
- dynamicComponentLib: string;
21
+ dynamicComponentLib?: string;
22
22
  };
23
23
  [jsonExample.tagName]: import("@markdoc/markdoc").Schema & {
24
- dynamicComponentLib: string;
24
+ dynamicComponentLib?: string;
25
25
  };
26
26
  };
27
27
  export default _default;
@@ -0,0 +1,3 @@
1
+ import type { CustomMarkdocTag } from '../types.js';
2
+ export declare const jsonExample: CustomMarkdocTag;
3
+ //# sourceMappingURL=json-example.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { CustomMarkdocTag } from '../types.js';
2
+ export declare const jsonSchema: CustomMarkdocTag;
3
+ //# sourceMappingURL=json-schema.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { CustomMarkdocTag } from '../types.js';
2
+ export declare const openApiCodeSample: CustomMarkdocTag;
3
+ //# sourceMappingURL=openapi-code-sample.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { CustomMarkdocTag } from '../types.js';
2
+ export declare const openApiExample: CustomMarkdocTag;
3
+ //# sourceMappingURL=openapi-example.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { CustomMarkdocTag } from '../types.js';
2
+ export declare const openApiResponseSample: CustomMarkdocTag;
3
+ //# sourceMappingURL=openapi-response-sample.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { CustomMarkdocTag } from '../types.js';
2
+ export declare const replayOpenApi: CustomMarkdocTag;
3
+ //# sourceMappingURL=replay-openapi.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { Schema } from '@markdoc/markdoc';
2
+ export type CustomMarkdocTag = {
3
+ schema: Schema & {
4
+ dynamicComponentLib?: string;
5
+ };
6
+ tagName: string;
7
+ };
8
+ //# sourceMappingURL=types.d.ts.map
File without changes
@@ -27,6 +27,7 @@ export declare const envSchema: z.ZodObject<{
27
27
  PROJECT_ID: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
28
28
  PROJECT_SLUG: z.ZodOptional<z.ZodString>;
29
29
  PROJECT_URL: z.ZodOptional<z.ZodString>;
30
+ PROJECT_BUILD_ID: z.ZodOptional<z.ZodString>;
30
31
  PUBLIC_REDOCLY_BRANCH_NAME: z.ZodOptional<z.ZodString>;
31
32
  } & {
32
33
  JWT_SECRET_KEY: z.ZodOptional<z.ZodString>;
@@ -106,6 +107,7 @@ export declare const envSchema: z.ZodObject<{
106
107
  PROJECT_ID: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
107
108
  PROJECT_SLUG: z.ZodOptional<z.ZodString>;
108
109
  PROJECT_URL: z.ZodOptional<z.ZodString>;
110
+ PROJECT_BUILD_ID: z.ZodOptional<z.ZodString>;
109
111
  PUBLIC_REDOCLY_BRANCH_NAME: z.ZodOptional<z.ZodString>;
110
112
  } & {
111
113
  JWT_SECRET_KEY: z.ZodOptional<z.ZodString>;
@@ -185,6 +187,7 @@ export declare const envSchema: z.ZodObject<{
185
187
  PROJECT_ID: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
186
188
  PROJECT_SLUG: z.ZodOptional<z.ZodString>;
187
189
  PROJECT_URL: z.ZodOptional<z.ZodString>;
190
+ PROJECT_BUILD_ID: z.ZodOptional<z.ZodString>;
188
191
  PUBLIC_REDOCLY_BRANCH_NAME: z.ZodOptional<z.ZodString>;
189
192
  } & {
190
193
  JWT_SECRET_KEY: z.ZodOptional<z.ZodString>;
@@ -6,6 +6,7 @@ export declare const organizationProjectSchema: z.ZodObject<{
6
6
  PROJECT_ID: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
7
7
  PROJECT_SLUG: z.ZodOptional<z.ZodString>;
8
8
  PROJECT_URL: z.ZodOptional<z.ZodString>;
9
+ PROJECT_BUILD_ID: z.ZodOptional<z.ZodString>;
9
10
  PUBLIC_REDOCLY_BRANCH_NAME: z.ZodOptional<z.ZodString>;
10
11
  }, "strip", z.ZodTypeAny, {
11
12
  ORGANIZATION_ID?: string | undefined;
@@ -14,6 +15,7 @@ export declare const organizationProjectSchema: z.ZodObject<{
14
15
  PROJECT_ID?: string | undefined;
15
16
  PROJECT_SLUG?: string | undefined;
16
17
  PROJECT_URL?: string | undefined;
18
+ PROJECT_BUILD_ID?: string | undefined;
17
19
  PUBLIC_REDOCLY_BRANCH_NAME?: string | undefined;
18
20
  }, {
19
21
  ORGANIZATION_ID?: string | undefined;
@@ -22,6 +24,7 @@ export declare const organizationProjectSchema: z.ZodObject<{
22
24
  PROJECT_ID?: string | undefined;
23
25
  PROJECT_SLUG?: string | undefined;
24
26
  PROJECT_URL?: string | undefined;
27
+ PROJECT_BUILD_ID?: string | undefined;
25
28
  PUBLIC_REDOCLY_BRANCH_NAME?: string | undefined;
26
29
  }>;
27
30
  //# sourceMappingURL=organization-project.d.ts.map
@@ -1 +1 @@
1
- import{z as t}from"zod";const o="org_",n="prj_",s=t.object({ORGANIZATION_ID:t.string().optional().refine(i=>i===void 0||i.startsWith(o),{message:`ORGANIZATION_ID must start with "${o}"`}),ORGANIZATION_SLUG:t.string().optional(),ORG_SLUG:t.string().optional(),PROJECT_ID:t.string().optional().refine(i=>i===void 0||i.startsWith(n),{message:`PROJECT_ID must start with "${n}"`}),PROJECT_SLUG:t.string().optional(),PROJECT_URL:t.string().url().optional(),PUBLIC_REDOCLY_BRANCH_NAME:t.string().optional()});export{s as organizationProjectSchema};
1
+ import{z as t}from"zod";const o="org_",n="prj_",s=t.object({ORGANIZATION_ID:t.string().optional().refine(i=>i===void 0||i.startsWith(o),{message:`ORGANIZATION_ID must start with "${o}"`}),ORGANIZATION_SLUG:t.string().optional(),ORG_SLUG:t.string().optional(),PROJECT_ID:t.string().optional().refine(i=>i===void 0||i.startsWith(n),{message:`PROJECT_ID must start with "${n}"`}),PROJECT_SLUG:t.string().optional(),PROJECT_URL:t.string().url().optional(),PROJECT_BUILD_ID:t.string().optional(),PUBLIC_REDOCLY_BRANCH_NAME:t.string().optional()});export{s as organizationProjectSchema};
@@ -1 +1 @@
1
- import{Minimatch as p}from"minimatch";import{envConfig as m}from"../../../config/env-config.js";import{buildScripts as a}from"./build-scripts.js";import{resolveBrowserHooksPath as l}from"./resolve-browser-hooks.js";async function h(){return{id:"Amplitude Analytics",requiredEntitlements:["analytics"],async processContent(n,{getConfig:t}){const e=(await t())?.analytics?.amplitude;if(!e?.apiKey||!m.isProductionEnv&&!e.includeInDevelopment)return;let o=[];typeof e.exclude<"u"&&e.exclude.map(r=>{const d=new p(r);o.push(d.makeRe())});const{headComponents:i,postBodyComponents:s}=a(e,o);n.addSsrComponents(i,"head"),n.addSsrComponents(s,"postBody"),n.addBrowserPlugin(l())}}}export{h as amplitudeAnalyticsPlugin};
1
+ import{Minimatch as p}from"minimatch";import{envConfig as d}from"../../../config/env-config.js";import{buildScripts as a}from"./build-scripts.js";import{resolveBrowserHooksPath as c}from"./resolve-browser-hooks.js";async function C(){return{id:"Amplitude Analytics",requiredEntitlements:["analytics"],async processContent(n,{getConfig:i}){const e=(await i())?.analytics?.amplitude;if(!e?.apiKey||!d.isProductionEnv&&!e.includeInDevelopment)return;let o=[];typeof e.exclude<"u"&&e.exclude.map(m=>{const t=new p(m).makeRe();t&&o.push(t)});const{headComponents:s,postBodyComponents:r}=a(e,o);n.addSsrComponents(s,"head"),n.addSsrComponents(r,"postBody"),n.addBrowserPlugin(c())}}}export{C as amplitudeAnalyticsPlugin};
@@ -1 +1 @@
1
- import A from"path";import{simplifyAstStructure as E}from"@redocly/openapi-docs/lib/utils/simplifyAstStructure.js";import{buildMenuItems as $}from"@redocly/asyncapi-docs/lib/utils/build-menu-items.js";import{findFirstBinding as T}from"@redocly/asyncapi-docs/lib/utils/find-first-binding.js";import{ASYNC_API_DOCS_TEMPLATE_ID as v}from"../../../constants/common.js";import{combineUrls as D}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as b}from"../../constants/common.js";import{logger as x}from"../../tools/notifiers/logger.js";import{getTemplatePath as R}from"./get-template-path.js";import{storeDefinitionBundles as O}from"./store-definition-bundles.js";import{asyncapiDocLoader as F,asyncapiDocsLoader as N}from"./asyncapi-doc-loader.js";import{searchResolver as j}from"./search/search-resolver.js";import{getAiDocumentsStore as L}from"./search/get-ai-search-documents.js";import{telemetryTraceStep as G}from"../../../cli/telemetry/helpers/trace-step.js";const _="asyncapi-docs-";async function tt(d){let p=[],u=new Set;return{id:"asyncapi",requiredEntitlements:["asyncapi"],loaders:{"asyncapi-doc":F,"asyncapi-docs":N},processContent:async(e,a)=>{await G("build.plugin.asyncapi_docs",async()=>{if((await a.getConfig()).plugins?.some(l=>l.startsWith("@redocly/portal-plugin-async-api/"))){x.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");return}const c=e.createTemplate(v,R("./template/AsyncApiDocs.js")),g=e.registerServerPropsGetter(v,R("./get-server-props.js"));for(const l of await a.fs.scan(/(\.ya?ml|\.json)$/))if(!await a.isPathIgnored(l.relativePath))try{const{data:s,compoundHash:w}=await a.cache.load(l.realRelativePath,"asyncapi-doc");if(!s?.length)continue;p=s.map(({markdocChunks:t,relativePath:o,isVirtual:m,customOutputRelativeFile:f,realRelativePath:y})=>({chunks:t,relativePath:o,realRelativePath:y,isVirtual:f!=null||l.isVirtual||m})),O(s,e.outdir,w);for(const t of s){const o=`${_}${t.relativePath}`,m=T(t.document),{navItems:f,apiItems:y}=$({asyncApiDoc:t.document,protocol:m||""}),I=[{url:D(b,`${C(t.relativePath,".json")}?download`)},{url:D(b,`${C(t.relativePath,".yaml")}?download`)}];await e.createSharedData(o,{document:t.document,apiItems:y,protocol:m,downloadUrls:I}),f.forEach(r=>{const n={fsPath:t.relativePath,slugSuffix:`/${r.link}`,templateId:c,sharedData:[{key:"AsyncApiDefinition",id:o}],getStaticData:S(a.withPathPrefix,r.label),serverPropsGetterIds:[g]};e.addRoute(n),r.items&&r.items.forEach(i=>{e.addRoute({...n,slugSuffix:`/${i.link}`,getStaticData:S(a.withPathPrefix,i.label)}),i.items&&i.items.forEach(h=>{e.addRoute({...n,slugSuffix:`/${h.link}`,getStaticData:S(a.withPathPrefix,i.label)})})})}),e.addRoute({fsPath:t.customOutputRelativeFile||t.relativePath,templateId:c,hasClientRoutes:!0,getSidebar:r=>{const n=i=>{const h={...i};return i.link&&(h.routeSlug=D(r.slug,i.link),h.link=D(r.slug,i.link)),i.items&&(h.items=i.items.map(n)),h};return[{type:"link",label:t.document.info?.title??"AsyncAPI Overview",routeSlug:r.slug,link:r.slug},...f.map(n)]},getSearchDocuments:j(e,t.document),getStaticData:S(a.withPathPrefix,t.document.info?.title??"AsyncAPI Docs"),getAiDocumentsStore:L({actions:e,document:t.document,metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}}}),metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}},sharedData:[{key:"AsyncApiDefinition",id:o}]})}}catch(s){console.error(s)}})},afterRoutesCreated:async(e,a)=>{const P=new Set;for(const{chunks:c,relativePath:g,isVirtual:l,realRelativePath:s}of p){const w=e.getAllRoutes().filter(o=>o.fsPath===g).map(o=>o.slug),t=(await a.cache.load(s,"asyncapi-doc")).compoundHash;await a.cache.load(g,{loader:async function(){for(const{node:m,markdown:f,pointer:y,key:I,relativePath:r}of c){const{ast:n}=await e.parseMarkdoc({content:f,relativePath:y,isVirtual:l},a,{sharedDataIds:[`${_}${r}`],routeSlugs:w});m[`x-parsed-md-${I}`]={result:E(n)}}},name:"asyncapi-markdoc-inline-parser"},[t]);for(const{pointer:o}of c)P.add(o)}const k=u.difference(P);for(const c of k)a.cache.delete(c);u=P}}}function S(d,p){return async function(u,e){return{props:{settings:{baseUrlPath:d(u.baseSlug)},disableAutoScroll:!0,seo:{title:p}}}}}function C(d,p){const u=A.posix.dirname(d),e=A.posix.basename(d,A.posix.extname(d))+p;return A.posix.join(u,e)}export{tt as asyncAPIDocsPlugin};
1
+ import A from"path";import{simplifyAstStructure as E}from"@redocly/openapi-docs/lib/utils/simplifyAstStructure.js";import{buildMenuItems as $}from"@redocly/asyncapi-docs/lib/utils/build-menu-items.js";import{findFirstBinding as T}from"@redocly/asyncapi-docs/lib/utils/find-first-binding.js";import{ASYNC_API_DOCS_TEMPLATE_ID as v}from"../../../constants/common.js";import{combineUrls as D}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as b}from"../../constants/common.js";import{logger as x}from"../../tools/notifiers/logger.js";import{getTemplatePath as R}from"./get-template-path.js";import{storeDefinitionBundles as O}from"./store-definition-bundles.js";import{asyncapiDocLoader as F,asyncapiDocsLoader as N}from"./asyncapi-doc-loader.js";import{searchResolver as j}from"./search/search-resolver.js";import{getAiDocumentsStore as L}from"./search/get-ai-search-documents.js";import{telemetryTraceStep as G}from"../../../cli/telemetry/helpers/trace-step.js";const _="asyncapi-docs-";async function tt(d){let p=[],u=new Set;return{id:"asyncapi",requiredEntitlements:["asyncapi"],loaders:{"asyncapi-doc":F,"asyncapi-docs":N},processContent:async(e,a)=>{await G("build.plugin.asyncapi_docs",async()=>{if((await a.getConfig()).plugins?.some(l=>l.startsWith("@redocly/portal-plugin-async-api/"))){x.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");return}const c=e.createTemplate(v,R("../../../client/templates/asyncapi-docs/template.js")),g=e.registerServerPropsGetter(v,R("./get-server-props.js"));for(const l of await a.fs.scan(/(\.ya?ml|\.json)$/))if(!await a.isPathIgnored(l.relativePath))try{const{data:s,compoundHash:w}=await a.cache.load(l.realRelativePath,"asyncapi-doc");if(!s?.length)continue;p=s.map(({markdocChunks:t,relativePath:o,isVirtual:m,customOutputRelativeFile:f,realRelativePath:y})=>({chunks:t,relativePath:o,realRelativePath:y,isVirtual:f!=null||l.isVirtual||m})),O(s,e.outdir,w);for(const t of s){const o=`${_}${t.relativePath}`,m=T(t.document),{navItems:f,apiItems:y}=$({asyncApiDoc:t.document,protocol:m||""}),I=[{url:D(b,`${C(t.relativePath,".json")}?download`)},{url:D(b,`${C(t.relativePath,".yaml")}?download`)}];await e.createSharedData(o,{document:t.document,apiItems:y,protocol:m,downloadUrls:I}),f.forEach(r=>{const n={fsPath:t.relativePath,slugSuffix:`/${r.link}`,templateId:c,sharedData:[{key:"AsyncApiDefinition",id:o}],getStaticData:S(a.withPathPrefix,r.label),serverPropsGetterIds:[g]};e.addRoute(n),r.items&&r.items.forEach(i=>{e.addRoute({...n,slugSuffix:`/${i.link}`,getStaticData:S(a.withPathPrefix,i.label)}),i.items&&i.items.forEach(h=>{e.addRoute({...n,slugSuffix:`/${h.link}`,getStaticData:S(a.withPathPrefix,i.label)})})})}),e.addRoute({fsPath:t.customOutputRelativeFile||t.relativePath,templateId:c,hasClientRoutes:!0,getSidebar:r=>{const n=i=>{const h={...i};return i.link&&(h.routeSlug=D(r.slug,i.link),h.link=D(r.slug,i.link)),i.items&&(h.items=i.items.map(n)),h};return[{type:"link",label:t.document.info?.title??"AsyncAPI Overview",routeSlug:r.slug,link:r.slug},...f.map(n)]},getSearchDocuments:j(e,t.document),getStaticData:S(a.withPathPrefix,t.document.info?.title??"AsyncAPI Docs"),getAiDocumentsStore:L({actions:e,document:t.document,metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}}}),metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}},sharedData:[{key:"AsyncApiDefinition",id:o}]})}}catch(s){console.error(s)}})},afterRoutesCreated:async(e,a)=>{const P=new Set;for(const{chunks:c,relativePath:g,isVirtual:l,realRelativePath:s}of p){const w=e.getAllRoutes().filter(o=>o.fsPath===g).map(o=>o.slug),t=(await a.cache.load(s,"asyncapi-doc")).compoundHash;await a.cache.load(g,{loader:async function(){for(const{node:m,markdown:f,pointer:y,key:I,relativePath:r}of c){const{ast:n}=await e.parseMarkdoc({content:f,relativePath:y,isVirtual:l},a,{sharedDataIds:[`${_}${r}`],routeSlugs:w});m[`x-parsed-md-${I}`]={result:E(n)}}},name:"asyncapi-markdoc-inline-parser"},[t]);for(const{pointer:o}of c)P.add(o)}const k=u.difference(P);for(const c of k)a.cache.delete(c);u=P}}}function S(d,p){return async function(u,e){return{props:{settings:{baseUrlPath:d(u.baseSlug)},disableAutoScroll:!0,seo:{title:p}}}}}function C(d,p){const u=A.posix.dirname(d),e=A.posix.basename(d,A.posix.extname(d))+p;return A.posix.join(u,e)}export{tt as asyncAPIDocsPlugin};
@@ -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 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,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};