@redocly/openapi-docs 3.24.0-next.9 → 3.24.1

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 (314) hide show
  1. package/dist/{redocly-openapi-docs.min.AiChatProvider-DcsGB2gP.js → redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js} +3 -3
  2. package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-wCZA4usG.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js} +1 -1
  3. package/dist/{redocly-openapi-docs.min.AiPanel-jo7fqtSt.js → redocly-openapi-docs.min.AiPanel-DTzHqAiI.js} +116 -116
  4. package/dist/redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js +1 -0
  5. package/dist/redocly-openapi-docs.min.Observable-D6wKbFwB.js +1 -0
  6. package/dist/redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js +1 -0
  7. package/dist/{redocly-openapi-docs.min.SqliteDBStorage-B_f6WR8o.js → redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js} +1 -1
  8. package/dist/redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js +1 -0
  9. package/dist/redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js +1 -0
  10. package/dist/redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js +1 -0
  11. package/dist/redocly-openapi-docs.min.core-BYyFOtMX.js +1 -0
  12. package/dist/redocly-openapi-docs.min.external-resolver-BkceRyB4.js +2 -0
  13. package/dist/redocly-openapi-docs.min.index-BCcol5vU.js +1 -0
  14. package/dist/redocly-openapi-docs.min.index-C6uU_v-b.js +1 -0
  15. package/dist/redocly-openapi-docs.min.index-CmXZfuiZ.js +7730 -0
  16. package/dist/redocly-openapi-docs.min.index-DVWw0ICA.js +1 -0
  17. package/dist/redocly-openapi-docs.min.index-YnvLQkG_.js +1 -0
  18. package/dist/redocly-openapi-docs.min.index-xl_tBaHD.js +1 -0
  19. package/dist/redocly-openapi-docs.min.js +1 -1
  20. package/dist/{redocly-openapi-docs.min.lint-C-zlwxhp.js → redocly-openapi-docs.min.lint-2YpbCz3r.js} +69 -69
  21. package/dist/{redocly-openapi-docs.min.lint-graphql-qEh9cZHx.js → redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js} +1 -1
  22. package/dist/redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js +1 -0
  23. package/dist/redocly-openapi-docs.min.promise-map-limit-Db_42GvV.js +1 -0
  24. package/dist/{redocly-openapi-docs.min.respect-run-hfNPYQ9x.js → redocly-openapi-docs.min.respect-run-Ct8taisL.js} +1 -1
  25. package/dist/redocly-openapi-docs.min.standalone-BPCdJgtH.js +11995 -0
  26. package/dist/redocly-openapi-docs.min.tauri-path-CmqBCxGb.js +1 -0
  27. package/dist/{redocly-openapi-docs.min.useAiChatQueries-DgSsCKMW.js → redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js} +80 -80
  28. package/lib/components/ApiInfo/__tests__/ApiInfo.test.d.ts +1 -0
  29. package/lib/components/ApiInfo/__tests__/ApiInfo.test.js +46 -0
  30. package/lib/components/Callbacks/CallbackOperation.js +1 -1
  31. package/lib/components/Callbacks/__tests__/Callbacks.test.d.ts +1 -0
  32. package/lib/components/Callbacks/__tests__/Callbacks.test.js +46 -0
  33. package/lib/components/Content/__tests__/useAutoScroll.test.d.ts +1 -0
  34. package/lib/components/Content/__tests__/useAutoScroll.test.js +88 -0
  35. package/lib/components/Content/useAutoScroll.js +1 -1
  36. package/lib/components/ContentItem/__tests__/useIsExpanded.test.d.ts +1 -0
  37. package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +123 -0
  38. package/lib/components/ContentItem/useIsExpanded.js +1 -1
  39. package/lib/components/ContentItems/ContentItems.js +1 -1
  40. package/lib/components/ContentItems/VirtualList.js +1 -1
  41. package/lib/components/ContentItems/__tests__/Items.test.d.ts +1 -0
  42. package/lib/components/ContentItems/__tests__/Items.test.js +66 -0
  43. package/lib/components/ContentItems/__tests__/VirtualList.test.d.ts +1 -0
  44. package/lib/components/ContentItems/__tests__/VirtualList.test.js +135 -0
  45. package/lib/components/ContentItems/useScrollOnRender.js +1 -1
  46. package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.d.ts +1 -0
  47. package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.js +63 -0
  48. package/lib/components/Download/__tests__/DownloadSpecification.test.d.ts +1 -0
  49. package/lib/components/Download/__tests__/DownloadSpecification.test.js +52 -0
  50. package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.d.ts +1 -0
  51. package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.js +60 -0
  52. package/lib/components/ExpandAllButton/__tests__/helpers.test.d.ts +1 -0
  53. package/lib/components/ExpandAllButton/__tests__/helpers.test.js +133 -0
  54. package/lib/components/Language/__tests__/LanguageDropdown.test.d.ts +1 -0
  55. package/lib/components/Language/__tests__/LanguageDropdown.test.js +23 -0
  56. package/lib/components/Markdown/__tests__/Markdown.test.d.ts +1 -0
  57. package/lib/components/Markdown/__tests__/Markdown.test.js +34 -0
  58. package/lib/components/McpOverview/__tests__/McpOverview.test.d.ts +1 -0
  59. package/lib/components/McpOverview/__tests__/McpOverview.test.js +66 -0
  60. package/lib/components/McpTool/__tests__/McpPrompt.test.d.ts +1 -0
  61. package/lib/components/McpTool/__tests__/McpPrompt.test.js +57 -0
  62. package/lib/components/McpTool/__tests__/McpResource.test.d.ts +1 -0
  63. package/lib/components/McpTool/__tests__/McpResource.test.js +81 -0
  64. package/lib/components/McpTool/__tests__/McpTool.test.d.ts +1 -0
  65. package/lib/components/McpTool/__tests__/McpTool.test.js +82 -0
  66. package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.d.ts +1 -0
  67. package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.js +79 -0
  68. package/lib/components/OperationItem/__tests__/OperationItem.test.d.ts +1 -0
  69. package/lib/components/OperationItem/__tests__/OperationItem.test.js +70 -0
  70. package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.d.ts +16 -0
  71. package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.js +42 -0
  72. package/lib/components/Overview/__tests__/Overview.test.d.ts +1 -0
  73. package/lib/components/Overview/__tests__/Overview.test.js +59 -0
  74. package/lib/components/PayloadSamples/__tests__/Example.test.d.ts +1 -0
  75. package/lib/components/PayloadSamples/__tests__/Example.test.js +36 -0
  76. package/lib/components/PayloadSamples/__tests__/ExampleValue.test.d.ts +1 -0
  77. package/lib/components/PayloadSamples/__tests__/ExampleValue.test.js +197 -0
  78. package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.d.ts +1 -0
  79. package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.js +38 -0
  80. package/lib/components/PropertyDetails/__tests__/Extensions.test.d.ts +1 -0
  81. package/lib/components/PropertyDetails/__tests__/Extensions.test.js +21 -0
  82. package/lib/components/PropertyDetails/__tests__/FieldDetail.test.d.ts +1 -0
  83. package/lib/components/PropertyDetails/__tests__/FieldDetail.test.js +52 -0
  84. package/lib/components/PropertyDetails/__tests__/FieldDetails.test.d.ts +1 -0
  85. package/lib/components/PropertyDetails/__tests__/FieldDetails.test.js +191 -0
  86. package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.d.ts +1 -0
  87. package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.js +365 -0
  88. package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.d.ts +1 -0
  89. package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.js +23 -0
  90. package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.d.ts +1 -0
  91. package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.js +16 -0
  92. package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.d.ts +1 -0
  93. package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.js +104 -0
  94. package/lib/components/RenderHook/__tests__/RenderHook.test.d.ts +1 -0
  95. package/lib/components/RenderHook/__tests__/RenderHook.test.js +15 -0
  96. package/lib/components/Replay/__tests__/utils.test.d.ts +1 -0
  97. package/lib/components/Replay/__tests__/utils.test.js +526 -0
  98. package/lib/components/Request/__tests__/RequestDetails.test.d.ts +1 -0
  99. package/lib/components/Request/__tests__/RequestDetails.test.js +98 -0
  100. package/lib/components/RequestSamples/__tests__/Example.test.d.ts +1 -0
  101. package/lib/components/RequestSamples/__tests__/Example.test.js +384 -0
  102. package/lib/components/RequestSamples/__tests__/RequestSamples.test.d.ts +1 -0
  103. package/lib/components/RequestSamples/__tests__/RequestSamples.test.js +226 -0
  104. package/lib/components/RequestSamples/__tests__/useCodeSamples.test.d.ts +1 -0
  105. package/lib/components/RequestSamples/__tests__/useCodeSamples.test.js +64 -0
  106. package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.d.ts +1 -0
  107. package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.js +29 -0
  108. package/lib/components/Responses/OperationResponseList.js +1 -1
  109. package/lib/components/Responses/__tests__/OperationResponseList.test.d.ts +1 -0
  110. package/lib/components/Responses/__tests__/OperationResponseList.test.js +89 -0
  111. package/lib/components/Responses/__tests__/ResponseDetails.test.d.ts +1 -0
  112. package/lib/components/Responses/__tests__/ResponseDetails.test.js +111 -0
  113. package/lib/components/Responses/__tests__/ResponsesHeaders.test.d.ts +1 -0
  114. package/lib/components/Responses/__tests__/ResponsesHeaders.test.js +26 -0
  115. package/lib/components/Schema/Schema.js +1 -1
  116. package/lib/components/Schema/SubSchema.js +1 -1
  117. package/lib/components/Schema/__tests__/ArraySchema.test.d.ts +1 -0
  118. package/lib/components/Schema/__tests__/ArraySchema.test.js +93 -0
  119. package/lib/components/Schema/__tests__/ObjectSchema.test.d.ts +1 -0
  120. package/lib/components/Schema/__tests__/ObjectSchema.test.js +115 -0
  121. package/lib/components/Schema/__tests__/OneOfSchema.test.d.ts +1 -0
  122. package/lib/components/Schema/__tests__/OneOfSchema.test.js +33 -0
  123. package/lib/components/Schema/__tests__/Schema.test.d.ts +1 -0
  124. package/lib/components/Schema/__tests__/Schema.test.js +67 -0
  125. package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.d.ts +1 -0
  126. package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.js +22 -0
  127. package/lib/components/Schema/useOneOfLocationIdx.js +1 -1
  128. package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.d.ts +1 -0
  129. package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.js +95 -0
  130. package/lib/components/Security/__tests__/Security.test.d.ts +1 -0
  131. package/lib/components/Security/__tests__/Security.test.js +38 -0
  132. package/lib/components/Security/__tests__/SecurityButton.test.d.ts +1 -0
  133. package/lib/components/Security/__tests__/SecurityButton.test.js +92 -0
  134. package/lib/components/Security/__tests__/SecurityModal.test.d.ts +1 -0
  135. package/lib/components/Security/__tests__/SecurityModal.test.js +172 -0
  136. package/lib/components/ServerList/__tests__/ServerList.test.d.ts +1 -0
  137. package/lib/components/ServerList/__tests__/ServerList.test.js +83 -0
  138. package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
  139. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +1 -1
  140. package/lib/components/Tabs/__tests__/Tabs.test.d.ts +1 -0
  141. package/lib/components/Tabs/__tests__/Tabs.test.js +27 -0
  142. package/lib/components/TagItem/OperationsNavigation.js +1 -1
  143. package/lib/components/TagItem/TagItem.js +1 -1
  144. package/lib/components/ViewNested/__tests__/ViewNested.test.d.ts +1 -0
  145. package/lib/components/ViewNested/__tests__/ViewNested.test.js +42 -0
  146. package/lib/components/__tests__/Samples/ExampleSwitch.test.d.ts +1 -0
  147. package/lib/components/__tests__/Samples/ExampleSwitch.test.js +45 -0
  148. package/lib/components/__tests__/Samples/use-example-key.test.d.ts +1 -0
  149. package/lib/components/__tests__/Samples/use-example-key.test.js +28 -0
  150. package/lib/components/__tests__/common/ClearButton.test.d.ts +1 -0
  151. package/lib/components/__tests__/common/ClearButton.test.js +18 -0
  152. package/lib/components/__tests__/common/Dropdown.test.d.ts +1 -0
  153. package/lib/components/__tests__/common/Dropdown.test.js +52 -0
  154. package/lib/components/__tests__/mocks/examples.d.ts +4 -0
  155. package/lib/components/__tests__/mocks/examples.js +115 -0
  156. package/lib/components/common/LinkToField.js +1 -1
  157. package/lib/components/common/__tests__/Dropdown.test.d.ts +1 -0
  158. package/lib/components/common/__tests__/Dropdown.test.js +129 -0
  159. package/lib/components/common/__tests__/LinkToField.test.d.ts +1 -0
  160. package/lib/components/common/__tests__/LinkToField.test.js +39 -0
  161. package/lib/components/common/linkify.js +1 -1
  162. package/lib/hooks/useRouter.js +1 -1
  163. package/lib/hooks/useUppercase2LowercaseRedirect.js +1 -1
  164. package/lib/jotai/__tests__/app.test.d.ts +1 -0
  165. package/lib/jotai/__tests__/app.test.js +53 -0
  166. package/lib/models/__tests__/Callback.test.d.ts +1 -0
  167. package/lib/models/__tests__/Callback.test.js +15 -0
  168. package/lib/models/__tests__/FieldModel.test.d.ts +1 -0
  169. package/lib/models/__tests__/FieldModel.test.js +117 -0
  170. package/lib/models/__tests__/MediaContent.test.d.ts +1 -0
  171. package/lib/models/__tests__/MediaContent.test.js +105 -0
  172. package/lib/models/__tests__/Operation.test.d.ts +1 -0
  173. package/lib/models/__tests__/Operation.test.js +459 -0
  174. package/lib/models/__tests__/Response.test.d.ts +1 -0
  175. package/lib/models/__tests__/Response.test.js +221 -0
  176. package/lib/models/__tests__/Schema.circular.test.d.ts +1 -0
  177. package/lib/models/__tests__/Schema.circular.test.js +694 -0
  178. package/lib/models/__tests__/Schema.test.d.ts +1 -0
  179. package/lib/models/__tests__/Schema.test.js +1395 -0
  180. package/lib/models/__tests__/example.test.d.ts +1 -0
  181. package/lib/models/__tests__/example.test.js +90 -0
  182. package/lib/models/__tests__/group.test.d.ts +1 -0
  183. package/lib/models/__tests__/group.test.js +52 -0
  184. package/lib/models/__tests__/helpers.d.ts +5 -0
  185. package/lib/models/__tests__/helpers.js +62 -0
  186. package/lib/models/__tests__/request.test.d.ts +1 -0
  187. package/lib/models/__tests__/request.test.js +119 -0
  188. package/lib/services/__tests__/OpenAPIParser.test.d.ts +1 -0
  189. package/lib/services/__tests__/OpenAPIParser.test.js +80 -0
  190. package/lib/services/__tests__/check.test.d.ts +1 -0
  191. package/lib/services/__tests__/check.test.js +22 -0
  192. package/lib/services/__tests__/utils.test.d.ts +1 -0
  193. package/lib/services/__tests__/utils.test.js +42 -0
  194. package/lib/services/code-samples/__tests__/apply-environments.test.d.ts +1 -0
  195. package/lib/services/code-samples/__tests__/apply-environments.test.js +64 -0
  196. package/lib/services/code-samples/__tests__/build-code-samples.test.d.ts +1 -0
  197. package/lib/services/code-samples/__tests__/build-code-samples.test.js +70 -0
  198. package/lib/services/code-samples/__tests__/convertSampleToString.test.d.ts +1 -0
  199. package/lib/services/code-samples/__tests__/convertSampleToString.test.js +116 -0
  200. package/lib/services/code-samples/__tests__/generator-data-value.test.d.ts +1 -0
  201. package/lib/services/code-samples/__tests__/generator-data-value.test.js +277 -0
  202. package/lib/services/code-samples/__tests__/generator-serialized-value.test.d.ts +1 -0
  203. package/lib/services/code-samples/__tests__/generator-serialized-value.test.js +258 -0
  204. package/lib/services/code-samples/__tests__/generator-value.test.d.ts +1 -0
  205. package/lib/services/code-samples/__tests__/generator-value.test.js +273 -0
  206. package/lib/services/code-samples/__tests__/generator.test.d.ts +249 -0
  207. package/lib/services/code-samples/__tests__/generator.test.js +1201 -0
  208. package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.d.ts +1 -0
  209. package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.js +31 -0
  210. package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.d.ts +1 -0
  211. package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.js +222 -0
  212. package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.d.ts +1 -0
  213. package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.js +129 -0
  214. package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.d.ts +1 -0
  215. package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.js +49 -0
  216. package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.d.ts +1 -0
  217. package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.js +172 -0
  218. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.d.ts +1 -0
  219. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.js +172 -0
  220. package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.d.ts +1 -0
  221. package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.js +130 -0
  222. package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.d.ts +1 -0
  223. package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.js +191 -0
  224. package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.d.ts +1 -0
  225. package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.js +172 -0
  226. package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.d.ts +1 -0
  227. package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.js +85 -0
  228. package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.d.ts +1 -0
  229. package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.js +85 -0
  230. package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.d.ts +1 -0
  231. package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.js +126 -0
  232. package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.d.ts +1 -0
  233. package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.js +105 -0
  234. package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.d.ts +1 -0
  235. package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.js +126 -0
  236. package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.d.ts +1 -0
  237. package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.js +129 -0
  238. package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.d.ts +1 -0
  239. package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.js +129 -0
  240. package/lib/services/config-options/__tests__/helpers.test.d.ts +1 -0
  241. package/lib/services/config-options/__tests__/helpers.test.js +234 -0
  242. package/lib/services/history/__tests__/helpers.test.d.ts +1 -0
  243. package/lib/services/history/__tests__/helpers.test.js +19 -0
  244. package/lib/services/menu/__tests__/buildNestedTagsItems.test.d.ts +1 -0
  245. package/lib/services/menu/__tests__/buildNestedTagsItems.test.js +109 -0
  246. package/lib/services/menu/__tests__/builder.test.d.ts +1 -0
  247. package/lib/services/menu/__tests__/builder.test.js +307 -0
  248. package/lib/services/menu/__tests__/operation.test.d.ts +1 -0
  249. package/lib/services/menu/__tests__/operation.test.js +240 -0
  250. package/lib/services/menu/__tests__/tags.test.d.ts +1 -0
  251. package/lib/services/menu/__tests__/tags.test.js +71 -0
  252. package/lib/telemetry/RedocTelemetry.js +31 -1
  253. package/lib/telemetry/__tests__/RedocTelemetry.test.d.ts +1 -0
  254. package/lib/telemetry/__tests__/RedocTelemetry.test.js +107 -0
  255. package/lib/testProviders.d.ts +6 -0
  256. package/lib/testProviders.js +14 -0
  257. package/lib/utils/__tests__/areArraysEqual.test.d.ts +1 -0
  258. package/lib/utils/__tests__/areArraysEqual.test.js +33 -0
  259. package/lib/utils/__tests__/argValuesHelpers.d.ts +1 -0
  260. package/lib/utils/__tests__/argValuesHelpers.js +56 -0
  261. package/lib/utils/__tests__/calculateMaxLength.test.d.ts +1 -0
  262. package/lib/utils/__tests__/calculateMaxLength.test.js +119 -0
  263. package/lib/utils/__tests__/configure-helpers.test.d.ts +1 -0
  264. package/lib/utils/__tests__/configure-helpers.test.js +356 -0
  265. package/lib/utils/__tests__/convertSwagger2OpenAPI.test.d.ts +1 -0
  266. package/lib/utils/__tests__/convertSwagger2OpenAPI.test.js +392 -0
  267. package/lib/utils/__tests__/debounce.test.d.ts +1 -0
  268. package/lib/utils/__tests__/debounce.test.js +54 -0
  269. package/lib/utils/__tests__/debug.test.d.ts +1 -0
  270. package/lib/utils/__tests__/debug.test.js +23 -0
  271. package/lib/utils/__tests__/dom.test.d.ts +1 -0
  272. package/lib/utils/__tests__/dom.test.js +108 -0
  273. package/lib/utils/__tests__/getBreadcrumbs.test.d.ts +1 -0
  274. package/lib/utils/__tests__/getBreadcrumbs.test.js +98 -0
  275. package/lib/utils/__tests__/hasNestedFields.test.d.ts +1 -0
  276. package/lib/utils/__tests__/hasNestedFields.test.js +147 -0
  277. package/lib/utils/__tests__/helpers.test.d.ts +1 -0
  278. package/lib/utils/__tests__/helpers.test.js +174 -0
  279. package/lib/utils/__tests__/isMobile.test.d.ts +1 -0
  280. package/lib/utils/__tests__/isMobile.test.js +28 -0
  281. package/lib/utils/__tests__/loadAndBundleSpec.test.d.ts +1 -0
  282. package/lib/utils/__tests__/loadAndBundleSpec.test.js +22 -0
  283. package/lib/utils/__tests__/local-storage.test.d.ts +1 -0
  284. package/lib/utils/__tests__/local-storage.test.js +48 -0
  285. package/lib/utils/__tests__/object.test.d.ts +1 -0
  286. package/lib/utils/__tests__/object.test.js +45 -0
  287. package/lib/utils/__tests__/openapi.test.d.ts +1 -0
  288. package/lib/utils/__tests__/openapi.test.js +1378 -0
  289. package/lib/utils/__tests__/path.test.d.ts +1 -0
  290. package/lib/utils/__tests__/path.test.js +16 -0
  291. package/lib/utils/__tests__/queryString.test.d.ts +1 -0
  292. package/lib/utils/__tests__/queryString.test.js +60 -0
  293. package/lib/utils/__tests__/replaceVariables.test.d.ts +1 -0
  294. package/lib/utils/__tests__/replaceVariables.test.js +46 -0
  295. package/lib/utils/__tests__/simplifyAstStructure.test.d.ts +1 -0
  296. package/lib/utils/__tests__/simplifyAstStructure.test.js +26 -0
  297. package/lib/utils/__tests__/sort.test.d.ts +1 -0
  298. package/lib/utils/__tests__/sort.test.js +16 -0
  299. package/lib/utils/__tests__/string.test.d.ts +1 -0
  300. package/lib/utils/__tests__/string.test.js +16 -0
  301. package/lib/utils/__tests__/theme-helpers.test.d.ts +1 -0
  302. package/lib/utils/__tests__/theme-helpers.test.js +24 -0
  303. package/lib/utils/__tests__/url.test.d.ts +1 -0
  304. package/lib/utils/__tests__/url.test.js +134 -0
  305. package/lib/utils/path.d.ts +1 -1
  306. package/package.json +12 -12
  307. package/dist/redocly-openapi-docs.min.ai-chat-mappers-MY79QAeW.js +0 -1
  308. package/dist/redocly-openapi-docs.min.external-resolver-3KMJv7SC.js +0 -2
  309. package/dist/redocly-openapi-docs.min.index-BYVMr_la.js +0 -1
  310. package/dist/redocly-openapi-docs.min.index-CsqzTi3Z.js +0 -7586
  311. package/dist/redocly-openapi-docs.min.index-D8F7x0S6.js +0 -1
  312. package/dist/redocly-openapi-docs.min.index-qqKTpI_q.js +0 -1
  313. package/dist/redocly-openapi-docs.min.standalone-Ci6886Cr.js +0 -12114
  314. package/dist/redocly-openapi-docs.min.tauri-path-Bs1-AQjc.js +0 -1
@@ -0,0 +1,109 @@
1
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
+ import { buildNestedTagsItems } from '../tags.js';
3
+ import { normalizeOptions } from '../../config-options/index.js';
4
+ import { DEFAULT_WEBHOOKS_TAG_NAME } from '../../../constants.js';
5
+ vi.mock('../operation.js', async (importOriginal) => {
6
+ const actual = await importOriginal();
7
+ return {
8
+ ...actual,
9
+ getOperationsItems: vi.fn((_parent, tag) => {
10
+ if (tag.operations && tag.operations.length > 0) {
11
+ return [
12
+ {
13
+ id: 'test-operation',
14
+ type: 'operation',
15
+ name: 'Test Operation',
16
+ httpVerb: tag.operations[0].httpVerb || 'get',
17
+ path: tag.operations[0].pathName || '/test',
18
+ depth: 1,
19
+ items: [],
20
+ deprecated: false,
21
+ isWebhook: tag.operations[0].isWebhook || false,
22
+ isAdditionalOperation: tag.operations[0].isAdditionalOperation || false,
23
+ operationDefinition: tag.operations[0],
24
+ href: '/test-operation',
25
+ },
26
+ ];
27
+ }
28
+ return [];
29
+ }),
30
+ };
31
+ });
32
+ vi.mock('../markdown.js', () => ({
33
+ addMarkdownItems: vi.fn(() => []),
34
+ }));
35
+ describe('buildNestedTagsItems', () => {
36
+ let parser;
37
+ let options;
38
+ let tagsMap;
39
+ beforeEach(() => {
40
+ parser = {
41
+ definition: {
42
+ components: {
43
+ schemas: {},
44
+ },
45
+ },
46
+ };
47
+ options = normalizeOptions({});
48
+ tagsMap = {};
49
+ });
50
+ it('should filter tags by kind (only include undefined or nav)', () => {
51
+ tagsMap = {
52
+ tag1: { name: 'tag1', operations: [] },
53
+ tag2: { name: 'tag2', operations: [], kind: 'nav' },
54
+ tag3: { name: 'tag3', operations: [], kind: 'badge' },
55
+ };
56
+ const result = buildNestedTagsItems(parser, tagsMap, undefined, options);
57
+ const tagNames = result.map((item) => item.name);
58
+ expect(tagNames).toContain('tag1');
59
+ expect(tagNames).toContain('tag2');
60
+ expect(tagNames).not.toContain('tag3');
61
+ });
62
+ it('should build nested structure with parent-child relationships', () => {
63
+ tagsMap = {
64
+ parent: { name: 'parent', operations: [] },
65
+ child: { name: 'child', operations: [], parent: 'parent' },
66
+ };
67
+ const result = buildNestedTagsItems(parser, tagsMap, undefined, options);
68
+ expect(result).toHaveLength(1);
69
+ expect(result[0].name).toBe('parent');
70
+ expect(result[0].items.some((item) => item.name === 'child')).toBe(true);
71
+ });
72
+ it('should respect MAX_NESTING_LEVELS limit', () => {
73
+ tagsMap = {
74
+ level1: { name: 'level1', operations: [] },
75
+ level2: { name: 'level2', operations: [], parent: 'level1' },
76
+ level3: { name: 'level3', operations: [], parent: 'level2' },
77
+ level4: { name: 'level4', operations: [], parent: 'level3' },
78
+ level5: { name: 'level5', operations: [], parent: 'level4' },
79
+ level6: { name: 'level6', operations: [], parent: 'level5' },
80
+ };
81
+ const result = buildNestedTagsItems(parser, tagsMap, undefined, options);
82
+ const findTagByName = (items, name) => {
83
+ for (const item of items) {
84
+ if (item.name === name)
85
+ return item;
86
+ if (item.items) {
87
+ const found = findTagByName(item.items, name);
88
+ if (found)
89
+ return found;
90
+ }
91
+ }
92
+ return null;
93
+ };
94
+ expect(findTagByName(result, 'level1')).toBeDefined();
95
+ expect(findTagByName(result, 'level5')).toBeDefined();
96
+ expect(findTagByName(result, 'level6')).toBeNull();
97
+ });
98
+ it('should filter out default webhooks tag if it has no items', () => {
99
+ tagsMap = {
100
+ [DEFAULT_WEBHOOKS_TAG_NAME]: { name: DEFAULT_WEBHOOKS_TAG_NAME, operations: [] },
101
+ regularTag: { name: 'regularTag', operations: [] },
102
+ };
103
+ const result = buildNestedTagsItems(parser, tagsMap, undefined, options);
104
+ const webhookTag = result.find((item) => item.name === DEFAULT_WEBHOOKS_TAG_NAME);
105
+ expect(webhookTag).toBeUndefined();
106
+ expect(result.some((item) => item.name === 'regularTag')).toBe(true);
107
+ });
108
+ });
109
+ //# sourceMappingURL=buildNestedTagsItems.test.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,307 @@
1
+ import { normalizeOptions } from '../../config-options/index.js';
2
+ import { OpenAPIParser } from '../../OpenAPIParser.js';
3
+ import { buildMenuStructure } from '../builder.js';
4
+ import { addMarkdownItems } from '../markdown.js';
5
+ const opts = normalizeOptions({});
6
+ describe('Menu', () => {
7
+ describe('builder', () => {
8
+ let parser;
9
+ test('should resolve pathItems', async () => {
10
+ const spec = (await import('./fixtures/pathItems.json'))
11
+ .default;
12
+ parser = new OpenAPIParser(spec, undefined, opts);
13
+ const contentItems = buildMenuStructure(parser, opts);
14
+ expect(contentItems).toHaveLength(3);
15
+ expect(contentItems[1].items).toHaveLength(1);
16
+ expect(contentItems[1].id).toEqual('pet2');
17
+ expect(contentItems[1].name).toEqual('pet2');
18
+ expect(contentItems[1].type).toEqual('tag');
19
+ expect(contentItems[2].items).toHaveLength(1);
20
+ expect(contentItems[2].id).toEqual('pet');
21
+ expect(contentItems[2].name).toEqual('pet');
22
+ expect(contentItems[2].type).toEqual('tag');
23
+ });
24
+ test('should include operations from additionalOperations', () => {
25
+ const spec = {
26
+ openapi: '3.2.0',
27
+ info: { title: 'Test API', version: '1.0.0' },
28
+ tags: [{ name: 'operations' }],
29
+ paths: {
30
+ '/test': {
31
+ get: {
32
+ summary: 'Get test',
33
+ tags: ['operations'],
34
+ responses: { '200': { description: 'Success' } },
35
+ },
36
+ additionalOperations: {
37
+ test: {
38
+ summary: 'Custom TEST method',
39
+ tags: ['operations'],
40
+ responses: { '200': { description: 'Success' } },
41
+ },
42
+ },
43
+ },
44
+ },
45
+ };
46
+ parser = new OpenAPIParser(spec, undefined, opts);
47
+ const contentItems = buildMenuStructure(parser, opts);
48
+ const operationsTag = contentItems.find((item) => item.id === 'operations');
49
+ expect(operationsTag).toBeDefined();
50
+ expect(operationsTag?.items).toHaveLength(2);
51
+ const getOperation = operationsTag?.items.find((item) => item.type === 'operation' && item.httpVerb === 'get');
52
+ expect(getOperation).toBeDefined();
53
+ expect(getOperation.type).toBe('operation');
54
+ const testOperation = operationsTag?.items.find((item) => item.type === 'operation' && item.httpVerb === 'test');
55
+ expect(testOperation).toBeDefined();
56
+ expect(testOperation.type).toBe('operation');
57
+ expect(testOperation.name).toContain('TEST');
58
+ });
59
+ test('should handle paths with only additionalOperations', () => {
60
+ const spec = {
61
+ openapi: '3.2.0',
62
+ info: { title: 'Test API', version: '1.0.0' },
63
+ tags: [{ name: 'custom' }],
64
+ paths: {
65
+ '/custom-only': {
66
+ additionalOperations: {
67
+ greet: {
68
+ summary: 'Custom GREET method',
69
+ tags: ['custom'],
70
+ responses: { '200': { description: 'Success' } },
71
+ },
72
+ wave: {
73
+ summary: 'Custom WAVE method',
74
+ tags: ['custom'],
75
+ responses: { '200': { description: 'Success' } },
76
+ },
77
+ },
78
+ },
79
+ },
80
+ };
81
+ parser = new OpenAPIParser(spec, undefined, opts);
82
+ const contentItems = buildMenuStructure(parser, opts);
83
+ const customTag = contentItems.find((item) => item.id === 'custom');
84
+ expect(customTag).toBeDefined();
85
+ expect(customTag?.items).toHaveLength(2);
86
+ const greetOperation = customTag?.items.find((item) => item.type === 'operation' && item.httpVerb === 'greet');
87
+ expect(greetOperation).toBeDefined();
88
+ const waveOperation = customTag?.items.find((item) => item.type === 'operation' && item.httpVerb === 'wave');
89
+ expect(waveOperation).toBeDefined();
90
+ });
91
+ test('should not fail when additionalOperations is empty', () => {
92
+ const spec = {
93
+ openapi: '3.2.0',
94
+ info: { title: 'Test API', version: '1.0.0' },
95
+ tags: [{ name: 'operations' }],
96
+ paths: {
97
+ '/test': {
98
+ get: {
99
+ summary: 'Get test',
100
+ tags: ['operations'],
101
+ responses: { '200': { description: 'Success' } },
102
+ },
103
+ additionalOperations: {},
104
+ },
105
+ },
106
+ };
107
+ parser = new OpenAPIParser(spec, undefined, opts);
108
+ const contentItems = buildMenuStructure(parser, opts);
109
+ const operationsTag = contentItems.find((item) => item.id === 'operations');
110
+ expect(operationsTag).toBeDefined();
111
+ expect(operationsTag?.items).toHaveLength(1);
112
+ });
113
+ describe('hasNestedTags logic', () => {
114
+ test('should use buildNestedTagsItems when tags have parent property', () => {
115
+ const spec = {
116
+ openapi: '3.2.0',
117
+ info: { title: 'Test API', version: '1.0.0' },
118
+ tags: [{ name: 'parent-tag' }, { name: 'child-tag', parent: 'parent-tag' }],
119
+ paths: {
120
+ '/parent': {
121
+ get: {
122
+ summary: 'Parent operation',
123
+ tags: ['parent-tag'],
124
+ responses: { '200': { description: 'Success' } },
125
+ },
126
+ },
127
+ '/child': {
128
+ get: {
129
+ summary: 'Child operation',
130
+ tags: ['child-tag'],
131
+ responses: { '200': { description: 'Success' } },
132
+ },
133
+ },
134
+ },
135
+ };
136
+ parser = new OpenAPIParser(spec, undefined, opts);
137
+ const contentItems = buildMenuStructure(parser, opts);
138
+ const parentTag = contentItems.find((item) => item.id === 'parent-tag');
139
+ expect(parentTag).toBeDefined();
140
+ expect(parentTag?.type).toBe('tag');
141
+ const childTagInParent = parentTag?.items?.find((item) => item.id === 'parent-tag/child-tag');
142
+ expect(childTagInParent).toBeDefined();
143
+ expect(childTagInParent?.type).toBe('tag');
144
+ });
145
+ test('should use getTagGroupsItems when tags do not have parent property but x-tagGroups exists', () => {
146
+ const spec = {
147
+ openapi: '3.2.0',
148
+ info: { title: 'Test API', version: '1.0.0' },
149
+ tags: [{ name: 'tag1' }, { name: 'tag2' }],
150
+ 'x-tagGroups': [
151
+ {
152
+ name: 'Group 1',
153
+ tags: ['tag1', 'tag2'],
154
+ },
155
+ ],
156
+ paths: {
157
+ '/test1': {
158
+ get: {
159
+ summary: 'Test 1',
160
+ tags: ['tag1'],
161
+ responses: { '200': { description: 'Success' } },
162
+ },
163
+ },
164
+ '/test2': {
165
+ get: {
166
+ summary: 'Test 2',
167
+ tags: ['tag2'],
168
+ responses: { '200': { description: 'Success' } },
169
+ },
170
+ },
171
+ },
172
+ };
173
+ parser = new OpenAPIParser(spec, undefined, opts);
174
+ const contentItems = buildMenuStructure(parser, opts);
175
+ const group = contentItems.find((item) => item.name === 'Group 1');
176
+ expect(group).toBeDefined();
177
+ expect(group?.type).toBe('group');
178
+ const tag1 = group?.items?.find((item) => item.id === 'tag1');
179
+ const tag2 = group?.items?.find((item) => item.id === 'tag2');
180
+ expect(tag1).toBeDefined();
181
+ expect(tag1?.type).toBe('tag');
182
+ expect(tag2).toBeDefined();
183
+ expect(tag2?.type).toBe('tag');
184
+ });
185
+ test('should use getTagsItems when tags do not have parent property and no x-tagGroups', () => {
186
+ const spec = {
187
+ openapi: '3.2.0',
188
+ info: { title: 'Test API', version: '1.0.0' },
189
+ tags: [{ name: 'tag1' }, { name: 'tag2' }],
190
+ paths: {
191
+ '/test1': {
192
+ get: {
193
+ summary: 'Test 1',
194
+ tags: ['tag1'],
195
+ responses: { '200': { description: 'Success' } },
196
+ },
197
+ },
198
+ '/test2': {
199
+ get: {
200
+ summary: 'Test 2',
201
+ tags: ['tag2'],
202
+ responses: { '200': { description: 'Success' } },
203
+ },
204
+ },
205
+ },
206
+ };
207
+ parser = new OpenAPIParser(spec, undefined, opts);
208
+ const contentItems = buildMenuStructure(parser, opts);
209
+ const tag1 = contentItems.find((item) => item.id === 'tag1');
210
+ const tag2 = contentItems.find((item) => item.id === 'tag2');
211
+ expect(tag1).toBeDefined();
212
+ expect(tag1?.type).toBe('tag');
213
+ expect(tag2).toBeDefined();
214
+ expect(tag2?.type).toBe('tag');
215
+ expect(tag1?.items?.some((item) => item.id === 'tag2')).toBeFalsy();
216
+ });
217
+ test('should prioritize nested tags over x-tagGroups when both exist', () => {
218
+ const spec = {
219
+ openapi: '3.2.0',
220
+ info: { title: 'Test API', version: '1.0.0' },
221
+ tags: [{ name: 'parent-tag' }, { name: 'child-tag', parent: 'parent-tag' }],
222
+ 'x-tagGroups': [
223
+ {
224
+ name: 'Group 1',
225
+ tags: ['parent-tag', 'child-tag'],
226
+ },
227
+ ],
228
+ paths: {
229
+ '/parent': {
230
+ get: {
231
+ summary: 'Parent operation',
232
+ tags: ['parent-tag'],
233
+ responses: { '200': { description: 'Success' } },
234
+ },
235
+ },
236
+ '/child': {
237
+ get: {
238
+ summary: 'Child operation',
239
+ tags: ['child-tag'],
240
+ responses: { '200': { description: 'Success' } },
241
+ },
242
+ },
243
+ },
244
+ };
245
+ parser = new OpenAPIParser(spec, undefined, opts);
246
+ const contentItems = buildMenuStructure(parser, opts);
247
+ const parentTag = contentItems.find((item) => item.id === 'parent-tag');
248
+ expect(parentTag).toBeDefined();
249
+ expect(parentTag?.type).toBe('tag');
250
+ const group = contentItems.find((item) => item.name === 'Group 1');
251
+ expect(group).toBeUndefined();
252
+ const childTagInParent = parentTag?.items?.find((item) => item.id === 'parent-tag/child-tag');
253
+ expect(childTagInParent).toBeDefined();
254
+ expect(childTagInParent?.type).toBe('tag');
255
+ });
256
+ });
257
+ });
258
+ describe('addMarkdownItems', () => {
259
+ test('should resolve heading with children', () => {
260
+ const markdown = `# [Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team `;
261
+ const contentItems = addMarkdownItems(markdown, undefined, 1);
262
+ expect(contentItems[0].name).toEqual('Petstore sample');
263
+ });
264
+ test('should resolve headings with custom id', () => {
265
+ const markdown = `# Petstore sample team {% #my-id %}`;
266
+ const contentItems = addMarkdownItems(markdown, undefined, 1);
267
+ expect(contentItems[0].name).toEqual('Petstore sample team ');
268
+ expect(contentItems[0].id).toEqual('my-id');
269
+ });
270
+ test('should create a menu item from a level 2 header', () => {
271
+ const markdown = `## Custom section 1 \n Nullam pretium erat ut augue mollis, id varius orci pretium.`;
272
+ const contentItems = addMarkdownItems(markdown, {
273
+ id: 'pet',
274
+ type: 'tag',
275
+ items: [],
276
+ name: 'user',
277
+ level: 1,
278
+ depth: 1,
279
+ href: 'pet',
280
+ }, 2);
281
+ expect(contentItems[0]?.['ast']?.length).toEqual(2);
282
+ });
283
+ test.each([['# Users'], ['## Users'], ['### Users'], ['#### Users'], ['##### Users']])('should handle identical headers of different levels across different tag descriptions %s', (markdown) => {
284
+ const resultA = addMarkdownItems(markdown, {
285
+ id: 'tag-a',
286
+ type: 'tag',
287
+ items: [],
288
+ name: 'Tag A',
289
+ level: 1,
290
+ depth: 1,
291
+ href: 'tag-a',
292
+ }, 0);
293
+ const resultB = addMarkdownItems(markdown, {
294
+ id: 'tag-b',
295
+ type: 'tag',
296
+ items: [],
297
+ name: 'Tag B',
298
+ level: 1,
299
+ depth: 1,
300
+ href: 'tag-b',
301
+ }, 0);
302
+ expect(resultA[0].id).toEqual('tag-a/users');
303
+ expect(resultB[0].id).toEqual('tag-b/users');
304
+ });
305
+ });
306
+ });
307
+ //# sourceMappingURL=builder.test.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,240 @@
1
+ import { getOperationsItems } from '../operation.js';
2
+ vi.mock('../../../utils/index.js', () => ({
3
+ encodeBackSlashes: vi.fn((str) => str.toLowerCase()),
4
+ getOperationId: vi.fn((operation, parent) => `${parent?.id || 'root'}-${operation.httpVerb}-${operation.pathName}`),
5
+ getOperationName: vi.fn((operation) => operation.summary || `${operation.httpVerb.toUpperCase()} ${operation.pathName}`),
6
+ }));
7
+ describe('getOperationsItems sorting logic', () => {
8
+ const mockParent = {
9
+ id: 'test-tag',
10
+ name: 'Test Tag',
11
+ type: 'tag',
12
+ items: [],
13
+ depth: 1,
14
+ level: 1,
15
+ href: '/test-tag',
16
+ };
17
+ const createMockOperation = (overrides = {}) => ({
18
+ httpVerb: 'get',
19
+ pathName: '/test',
20
+ summary: 'Test operation',
21
+ deprecated: false,
22
+ isAdditionalOperation: false,
23
+ isWebhook: false,
24
+ operationId: 'test-operation',
25
+ 'x-badges': [],
26
+ ...overrides,
27
+ });
28
+ const createMockTag = (operations) => ({
29
+ name: 'test-tag',
30
+ operations,
31
+ });
32
+ test('should sort non-deprecated operations before deprecated ones', () => {
33
+ const operations = [
34
+ createMockOperation({ httpVerb: 'post', summary: 'Deprecated POST', deprecated: true }),
35
+ createMockOperation({ httpVerb: 'get', summary: 'Active GET', deprecated: false }),
36
+ createMockOperation({ httpVerb: 'put', summary: 'Deprecated PUT', deprecated: true }),
37
+ createMockOperation({ httpVerb: 'delete', summary: 'Active DELETE', deprecated: false }),
38
+ ];
39
+ const tag = createMockTag(operations);
40
+ const result = getOperationsItems(mockParent, tag, 1);
41
+ expect(result).toHaveLength(4);
42
+ expect(result[0].httpVerb).toBe('get');
43
+ expect(result[0].deprecated).toBe(false);
44
+ expect(result[1].httpVerb).toBe('delete');
45
+ expect(result[1].deprecated).toBe(false);
46
+ expect(result[2].httpVerb).toBe('post');
47
+ expect(result[2].deprecated).toBe(true);
48
+ expect(result[3].httpVerb).toBe('put');
49
+ expect(result[3].deprecated).toBe(true);
50
+ });
51
+ test('should apply combined sorting: non-deprecated regular, non-deprecated additional, deprecated regular, deprecated additional', () => {
52
+ const operations = [
53
+ createMockOperation({
54
+ httpVerb: 'deprecated-additional',
55
+ summary: 'Deprecated additional operation',
56
+ isAdditionalOperation: true,
57
+ deprecated: true,
58
+ }),
59
+ createMockOperation({
60
+ httpVerb: 'active-regular',
61
+ summary: 'Active regular operation',
62
+ isAdditionalOperation: false,
63
+ deprecated: false,
64
+ }),
65
+ createMockOperation({
66
+ httpVerb: 'deprecated-regular',
67
+ summary: 'Deprecated regular operation',
68
+ isAdditionalOperation: false,
69
+ deprecated: true,
70
+ }),
71
+ createMockOperation({
72
+ httpVerb: 'active-additional',
73
+ summary: 'Active additional operation',
74
+ isAdditionalOperation: true,
75
+ deprecated: false,
76
+ }),
77
+ ];
78
+ const tag = createMockTag(operations);
79
+ const result = getOperationsItems(mockParent, tag, 1);
80
+ expect(result).toHaveLength(4);
81
+ expect(result[0].httpVerb).toBe('active-regular');
82
+ expect(result[0].deprecated).toBe(false);
83
+ expect(result[0].isAdditionalOperation).toBe(false);
84
+ expect(result[1].httpVerb).toBe('active-additional');
85
+ expect(result[1].deprecated).toBe(false);
86
+ expect(result[1].isAdditionalOperation).toBe(true);
87
+ expect(result[2].httpVerb).toBe('deprecated-regular');
88
+ expect(result[2].deprecated).toBe(true);
89
+ expect(result[2].isAdditionalOperation).toBe(false);
90
+ expect(result[3].httpVerb).toBe('deprecated-additional');
91
+ expect(result[3].deprecated).toBe(true);
92
+ expect(result[3].isAdditionalOperation).toBe(true);
93
+ });
94
+ });
95
+ describe('getOperationsItems badge tags functionality', () => {
96
+ const mockParent = {
97
+ id: 'test-tag',
98
+ name: 'Test Tag',
99
+ type: 'tag',
100
+ items: [],
101
+ depth: 1,
102
+ level: 1,
103
+ href: '/test-tag',
104
+ };
105
+ const createMockOperation = (overrides = {}) => ({
106
+ httpVerb: 'get',
107
+ pathName: '/test',
108
+ summary: 'Test operation',
109
+ deprecated: false,
110
+ isAdditionalOperation: false,
111
+ isWebhook: false,
112
+ operationId: 'test-operation',
113
+ 'x-badges': [],
114
+ ...overrides,
115
+ });
116
+ const createMockTag = (operations) => ({
117
+ name: 'test-tag',
118
+ operations,
119
+ });
120
+ test('should collect badge tags from tagsMap when kind is badge', () => {
121
+ const tagsMap = {
122
+ 'beta-tag': {
123
+ name: 'beta-tag',
124
+ kind: 'badge',
125
+ summary: 'Beta Feature',
126
+ operations: [],
127
+ },
128
+ 'regular-tag': {
129
+ name: 'regular-tag',
130
+ operations: [],
131
+ },
132
+ };
133
+ const operation = createMockOperation({ tags: ['beta-tag'] });
134
+ const tag = createMockTag([operation]);
135
+ const result = getOperationsItems(mockParent, tag, 1, tagsMap);
136
+ expect(result).toHaveLength(1);
137
+ expect(result[0].badges).toEqual([
138
+ {
139
+ name: 'Beta Feature',
140
+ color: 'blue',
141
+ position: 'after',
142
+ icon: undefined,
143
+ },
144
+ ]);
145
+ });
146
+ test('should collect badge tags from tagsMap when kind is audience', () => {
147
+ const tagsMap = {
148
+ 'developers-tag': {
149
+ name: 'developers-tag',
150
+ kind: 'audience',
151
+ summary: 'For Developers',
152
+ operations: [],
153
+ },
154
+ };
155
+ const operation = createMockOperation({ tags: ['developers-tag'] });
156
+ const tag = createMockTag([operation]);
157
+ const result = getOperationsItems(mockParent, tag, 1, tagsMap);
158
+ expect(result).toHaveLength(1);
159
+ expect(result[0].badges).toEqual([
160
+ {
161
+ name: 'For Developers',
162
+ color: 'grey',
163
+ position: 'after',
164
+ icon: 'user-group',
165
+ },
166
+ ]);
167
+ });
168
+ test('should preserve existing x-badges and add tag-based badges', () => {
169
+ const tagsMap = {
170
+ 'beta-tag': {
171
+ name: 'beta-tag',
172
+ kind: 'badge',
173
+ summary: 'Beta Feature',
174
+ operations: [],
175
+ },
176
+ };
177
+ const existingBadges = [
178
+ {
179
+ name: 'Custom Badge',
180
+ color: 'green',
181
+ position: 'before',
182
+ },
183
+ ];
184
+ const operation = createMockOperation({
185
+ tags: ['beta-tag'],
186
+ 'x-badges': existingBadges,
187
+ });
188
+ const tag = createMockTag([operation]);
189
+ const result = getOperationsItems(mockParent, tag, 1, tagsMap);
190
+ expect(result).toHaveLength(1);
191
+ expect(result[0].badges).toEqual([
192
+ {
193
+ name: 'Custom Badge',
194
+ color: 'green',
195
+ position: 'before',
196
+ },
197
+ {
198
+ name: 'Beta Feature',
199
+ color: 'blue',
200
+ position: 'after',
201
+ icon: undefined,
202
+ },
203
+ ]);
204
+ });
205
+ test('should add multiple badges when operation has multiple matching tags', () => {
206
+ const tagsMap = {
207
+ 'beta-tag': {
208
+ name: 'beta-tag',
209
+ kind: 'badge',
210
+ summary: 'Beta Feature',
211
+ operations: [],
212
+ },
213
+ 'developers-tag': {
214
+ name: 'developers-tag',
215
+ kind: 'audience',
216
+ summary: 'For Developers',
217
+ operations: [],
218
+ },
219
+ };
220
+ const operation = createMockOperation({ tags: ['beta-tag', 'developers-tag'] });
221
+ const tag = createMockTag([operation]);
222
+ const result = getOperationsItems(mockParent, tag, 1, tagsMap);
223
+ expect(result).toHaveLength(1);
224
+ expect(result[0].badges).toEqual([
225
+ {
226
+ name: 'Beta Feature',
227
+ position: 'after',
228
+ color: 'blue',
229
+ icon: undefined,
230
+ },
231
+ {
232
+ name: 'For Developers',
233
+ position: 'after',
234
+ color: 'grey',
235
+ icon: 'user-group',
236
+ },
237
+ ]);
238
+ });
239
+ });
240
+ //# sourceMappingURL=operation.test.js.map
@@ -0,0 +1 @@
1
+ export {};