@redocly/openapi-docs 3.12.0-rc.7 → 3.12.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 (390) hide show
  1. package/dist/redocly-openapi-docs.min.js +2153 -1963
  2. package/lib/components/ApiInfo/ApiInfo.js +29 -1
  3. package/lib/components/ApiInfo/Metadata.js +29 -1
  4. package/lib/components/ApiInfo/index.js +2 -1
  5. package/lib/components/ApiInfo/styled.js +17 -8
  6. package/lib/components/CallbackSamples/CallbackSamples.js +25 -4
  7. package/lib/components/CallbackSamples/index.js +2 -1
  8. package/lib/components/Callbacks/CallbackDetails.js +17 -3
  9. package/lib/components/Callbacks/CallbackOperation.js +24 -3
  10. package/lib/components/Callbacks/CallbackSummary.js +19 -3
  11. package/lib/components/Callbacks/CallbacksList.js +16 -1
  12. package/lib/components/Callbacks/index.js +4 -1
  13. package/lib/components/Callbacks/styled.js +6 -3
  14. package/lib/components/Content/Content.js +10 -1
  15. package/lib/components/Content/index.js +2 -1
  16. package/lib/components/Content/useAutoScroll.js +50 -1
  17. package/lib/components/ContentItem/ContentItem.js +31 -1
  18. package/lib/components/ContentItem/index.js +2 -1
  19. package/lib/components/ContentItem/useIsExpanded.js +33 -1
  20. package/lib/components/ContentItems/ContentItems.js +19 -1
  21. package/lib/components/ContentItems/Items.js +13 -1
  22. package/lib/components/ContentItems/VirtualList.js +35 -1
  23. package/lib/components/ContentItems/helpers.js +49 -1
  24. package/lib/components/ContentItems/index.js +2 -1
  25. package/lib/components/ContentItems/useScrollOnRender.js +26 -1
  26. package/lib/components/Discriminator/Discriminator.js +27 -2
  27. package/lib/components/Discriminator/index.js +2 -1
  28. package/lib/components/Download/DownloadSpecification.js +46 -4
  29. package/lib/components/Download/index.js +2 -1
  30. package/lib/components/Download/types.js +2 -0
  31. package/lib/components/Download/useDownloadInfo.js +42 -1
  32. package/lib/components/ErrorBoundary/ErrorBoundary.js +22 -2
  33. package/lib/components/ErrorBoundary/index.js +2 -1
  34. package/lib/components/ExpandAllButton/ExpandAllButton.js +31 -2
  35. package/lib/components/ExpandAllButton/index.js +2 -1
  36. package/lib/components/ExternalDocumentation/ExternalDocumentation.js +18 -4
  37. package/lib/components/ExternalDocumentation/index.js +2 -1
  38. package/lib/components/Language/LanguageDropdown.js +21 -1
  39. package/lib/components/Language/LanguageItem.js +33 -1
  40. package/lib/components/Language/LanguageList.js +93 -1
  41. package/lib/components/Language/_tests_/LanguageDropdown.test.js +23 -1
  42. package/lib/components/Language/constants.js +3 -1
  43. package/lib/components/Language/index.js +4 -1
  44. package/lib/components/Language/styled.js +29 -15
  45. package/lib/components/Markdown/Markdown.js +64 -1
  46. package/lib/components/Markdown/index.js +3 -1
  47. package/lib/components/Markdown/types.js +2 -0
  48. package/lib/components/MediaTypeSwitch/MediaTypesSwitch.js +51 -1
  49. package/lib/components/MediaTypeSwitch/index.js +2 -1
  50. package/lib/components/OperationItem/Description.d.ts +1 -4
  51. package/lib/components/OperationItem/Description.js +9 -1
  52. package/lib/components/OperationItem/OperationItem.js +70 -5
  53. package/lib/components/OperationItem/_tests_/OperationItem.test.js +70 -1
  54. package/lib/components/OperationItem/_tests_/__mocks__/mock-intersection-observer.js +40 -1
  55. package/lib/components/OperationItem/index.js +2 -1
  56. package/lib/components/OperationItem/types.js +2 -0
  57. package/lib/components/Overlay.js +48 -3
  58. package/lib/components/Overview/Overview.js +20 -1
  59. package/lib/components/Overview/index.js +2 -1
  60. package/lib/components/PageFooter/PageFooter.js +19 -1
  61. package/lib/components/PageFooter/index.js +2 -1
  62. package/lib/components/Panel/ResponsePanel.js +12 -6
  63. package/lib/components/Panel/Trigger.js +4 -2
  64. package/lib/components/Panel/index.js +3 -1
  65. package/lib/components/PanelItem/PanelItem.js +6 -1
  66. package/lib/components/PanelItem/index.js +3 -1
  67. package/lib/components/PanelItem/styled.js +20 -10
  68. package/lib/components/PayloadSamples/Example.js +6 -1
  69. package/lib/components/PayloadSamples/ExampleValue.js +30 -1
  70. package/lib/components/PayloadSamples/MediaTypeSamples.js +36 -2
  71. package/lib/components/PayloadSamples/PayloadSamples.js +26 -1
  72. package/lib/components/PayloadSamples/index.js +7 -1
  73. package/lib/components/PayloadSamples/styled.js +9 -4
  74. package/lib/components/PayloadSamples/types.js +2 -0
  75. package/lib/components/PropertyDetails/DescriptionEnums.js +19 -3
  76. package/lib/components/PropertyDetails/EnumValues.js +37 -1
  77. package/lib/components/PropertyDetails/Examples.js +26 -1
  78. package/lib/components/PropertyDetails/Extensions.js +17 -2
  79. package/lib/components/PropertyDetails/FieldDetail.js +15 -2
  80. package/lib/components/PropertyDetails/FieldDetails.js +51 -6
  81. package/lib/components/PropertyDetails/Pattern.js +21 -1
  82. package/lib/components/PropertyDetails/PlusCircleIcon.js +10 -4
  83. package/lib/components/PropertyDetails/PropertyDetails.js +22 -5
  84. package/lib/components/PropertyDetails/SchemaTypeInfo.js +10 -2
  85. package/lib/components/PropertyDetails/SimpleEnums.js +13 -2
  86. package/lib/components/PropertyDetails/cycleColorsByLevel.js +18 -1
  87. package/lib/components/PropertyDetails/index.js +4 -1
  88. package/lib/components/PropertyDetails/styled.js +15 -7
  89. package/lib/components/PropertyDetails/types.js +2 -0
  90. package/lib/components/RedoclyOpenAPIDocs/Providers.js +114 -1
  91. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +57 -1
  92. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +86 -1
  93. package/lib/components/RedoclyOpenAPIDocs/index.js +5 -1
  94. package/lib/components/RedoclyOpenAPIDocs/styled.js +4 -2
  95. package/lib/components/RedoclyOpenAPIDocs/types.js +2 -0
  96. package/lib/components/RedoclyOpenAPIDocs/utils.js +33 -1
  97. package/lib/components/RenderHook/RenderHook.js +17 -1
  98. package/lib/components/RenderHook/index.js +2 -1
  99. package/lib/components/Replay/EmbeddedReplay.js +41 -3
  100. package/lib/components/Replay/Replay.js +99 -1
  101. package/lib/components/Replay/index.js +3 -1
  102. package/lib/components/Replay/utils.js +208 -1
  103. package/lib/components/Request/RequestDetails.js +33 -2
  104. package/lib/components/Request/types.js +2 -0
  105. package/lib/components/RequestParameters/Body.js +8 -1
  106. package/lib/components/RequestParameters/ParametersGroup.js +19 -4
  107. package/lib/components/RequestParameters/RequestParameters.js +40 -1
  108. package/lib/components/RequestParameters/index.js +4 -1
  109. package/lib/components/RequestSamples/CodeSample.js +55 -2
  110. package/lib/components/RequestSamples/Example.js +37 -1
  111. package/lib/components/RequestSamples/RequestSamples.js +89 -5
  112. package/lib/components/RequestSamples/index.js +3 -1
  113. package/lib/components/RequestSamples/useCodeSamples.js +92 -1
  114. package/lib/components/ResponseSamples/ResponseSamples.js +47 -1
  115. package/lib/components/ResponseSamples/Summary.js +9 -1
  116. package/lib/components/ResponseSamples/index.js +2 -1
  117. package/lib/components/Responses/OperationResponseList.js +42 -2
  118. package/lib/components/Responses/ResponseDetails.js +18 -1
  119. package/lib/components/Responses/ResponseHeaders.js +15 -1
  120. package/lib/components/Responses/index.js +6 -1
  121. package/lib/components/Responses/styled.js +14 -6
  122. package/lib/components/Responses/types.js +2 -0
  123. package/lib/components/RightPanel/RightPanel.js +21 -1
  124. package/lib/components/RightPanel/index.js +2 -1
  125. package/lib/components/Samples/ExampleSwitch.js +33 -1
  126. package/lib/components/Samples/index.js +3 -1
  127. package/lib/components/Samples/use-example-key.js +12 -1
  128. package/lib/components/Schema/ArraySchema.js +45 -1
  129. package/lib/components/Schema/ObjectSchema.js +29 -1
  130. package/lib/components/Schema/OneOfSchema.js +47 -3
  131. package/lib/components/Schema/RecursiveSchema.js +10 -1
  132. package/lib/components/Schema/Schema.js +63 -2
  133. package/lib/components/Schema/SubSchema.js +20 -1
  134. package/lib/components/Schema/helpers.js +16 -1
  135. package/lib/components/Schema/index.js +5 -1
  136. package/lib/components/Schema/types.js +2 -0
  137. package/lib/components/Schema/useOneOfLocationIdx.js +11 -1
  138. package/lib/components/SchemaDefinition/SchemaDefinition.js +65 -2
  139. package/lib/components/SchemaDefinition/index.js +2 -1
  140. package/lib/components/SectionContent/SectionContent.js +49 -6
  141. package/lib/components/SectionContent/index.js +2 -1
  142. package/lib/components/SectionItem/SectionItem.js +14 -1
  143. package/lib/components/SectionItem/index.js +2 -1
  144. package/lib/components/Security/Divider.js +9 -2
  145. package/lib/components/Security/OAuthFlow.js +11 -1
  146. package/lib/components/Security/OAuthScopes.js +59 -9
  147. package/lib/components/Security/Security.js +15 -1
  148. package/lib/components/Security/SecurityButton.js +31 -7
  149. package/lib/components/Security/SecurityFlow.js +28 -4
  150. package/lib/components/Security/SecurityModal.js +34 -5
  151. package/lib/components/Security/SecuritySchemeItem.js +15 -4
  152. package/lib/components/Security/helper.js +16 -1
  153. package/lib/components/Security/index.js +11 -1
  154. package/lib/components/Security/styled.js +6 -3
  155. package/lib/components/SelectOrLabel/SelectOrLabel.js +12 -2
  156. package/lib/components/SelectOrLabel/index.js +2 -1
  157. package/lib/components/ServerList/ServerList.js +36 -10
  158. package/lib/components/ServerList/index.js +2 -1
  159. package/lib/components/ServerList/types.js +2 -0
  160. package/lib/components/ServerListDropdown/ServerListDropdown.js +54 -1
  161. package/lib/components/ServerListDropdown/index.js +2 -1
  162. package/lib/components/ServerListDropdown/styled.js +15 -6
  163. package/lib/components/SideMenu/SideMenu.js +13 -2
  164. package/lib/components/SideMenu/hooks/useMenuItems.js +110 -1
  165. package/lib/components/SideMenu/index.js +2 -1
  166. package/lib/components/SideMenu/types.js +2 -0
  167. package/lib/components/StickySidebar/SidebarActions.js +14 -2
  168. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +37 -7
  169. package/lib/components/StickySidebar/index.js +2 -1
  170. package/lib/components/Tabs/Tabs.js +16 -5
  171. package/lib/components/Tabs/index.js +3 -1
  172. package/lib/components/Tabs/useTabsState.js +22 -1
  173. package/lib/components/TagItem/OperationNavigationItems.js +18 -4
  174. package/lib/components/TagItem/OperationsNavigation.js +46 -2
  175. package/lib/components/TagItem/TagItem.js +41 -8
  176. package/lib/components/TagItem/index.js +2 -1
  177. package/lib/components/TagItem/styled.js +5 -2
  178. package/lib/components/TagItem/types.js +2 -0
  179. package/lib/components/ViewNested/ViewNested.js +42 -9
  180. package/lib/components/ViewNested/index.js +2 -1
  181. package/lib/components/common/Badges.js +21 -5
  182. package/lib/components/common/BodyContent/BodyContent.js +31 -4
  183. package/lib/components/common/BodyContent/index.js +2 -1
  184. package/lib/components/common/ClearButton/ClearButton.js +5 -1
  185. package/lib/components/common/ClearButton/index.js +3 -1
  186. package/lib/components/common/ClearButton/styled.js +5 -2
  187. package/lib/components/common/ClearButton/types.js +2 -0
  188. package/lib/components/common/CodeBlockPanel.js +7 -3
  189. package/lib/components/common/ConstraintsView.js +14 -2
  190. package/lib/components/common/Dropdown/Dropdown.js +22 -4
  191. package/lib/components/common/Dropdown/index.js +2 -1
  192. package/lib/components/common/ExpandableExample/ExpandableExample.js +24 -3
  193. package/lib/components/common/ExpandableExample/index.js +2 -1
  194. package/lib/components/common/Extensions.js +17 -2
  195. package/lib/components/common/Fields/fields-layout.js +76 -51
  196. package/lib/components/common/Fields/fields.js +39 -17
  197. package/lib/components/common/Fields/index.js +3 -1
  198. package/lib/components/common/LinkToField.js +33 -6
  199. package/lib/components/common/OperationItemTitle.d.ts +1 -0
  200. package/lib/components/common/OperationItemTitle.js +16 -5
  201. package/lib/components/common/SchemaSelection/SchemaSelection.js +51 -1
  202. package/lib/components/common/SchemaSelection/index.js +2 -1
  203. package/lib/components/common/Select/Select.js +21 -1
  204. package/lib/components/common/Select/index.js +3 -1
  205. package/lib/components/common/Select/styled.js +17 -9
  206. package/lib/components/common/Select/types.js +2 -0
  207. package/lib/components/common/Skeleton/LanguageListSkeleton.js +16 -6
  208. package/lib/components/common/Skeleton/Skeleton.js +15 -5
  209. package/lib/components/common/Skeleton/index.js +3 -1
  210. package/lib/components/common/headers.js +4 -2
  211. package/lib/components/common/index.js +14 -1
  212. package/lib/components/common/linkify.js +28 -4
  213. package/lib/components/common/mixins.js +4 -2
  214. package/lib/components/common/panels.js +58 -33
  215. package/lib/components/common/schema.js +16 -8
  216. package/lib/components/common/styled.js +15 -7
  217. package/lib/components/index.js +25 -1
  218. package/lib/components/pluggable/RedocExample.js +20 -1
  219. package/lib/components/pluggable/RedocSchema.js +22 -1
  220. package/lib/components/pluggable/index.js +3 -1
  221. package/lib/components/pluggable/styled.components.js +9 -4
  222. package/lib/constants.js +30 -1
  223. package/lib/empty.js +7 -1
  224. package/lib/events/codeSampleCopy.js +19 -1
  225. package/lib/events/creator.js +5 -1
  226. package/lib/events/index.js +8 -1
  227. package/lib/events/languageSwitch.js +18 -1
  228. package/lib/events/panelToggle.js +16 -1
  229. package/lib/events/serverSwitch.js +13 -1
  230. package/lib/events/tryItOpen.js +12 -1
  231. package/lib/events/tryItSent.js +12 -1
  232. package/lib/events/types.js +11 -1
  233. package/lib/hoc/types.js +2 -0
  234. package/lib/hoc/utils.js +4 -1
  235. package/lib/hoc/withRouter.js +17 -1
  236. package/lib/hoc/withStore.js +28 -1
  237. package/lib/hooks/index.js +9 -1
  238. package/lib/hooks/useActivateExample.js +35 -1
  239. package/lib/hooks/useActiveWithFallback.js +12 -1
  240. package/lib/hooks/useContentItems.js +10 -1
  241. package/lib/hooks/useLicense.js +17 -1
  242. package/lib/hooks/usePerformanceMetrics.js +26 -1
  243. package/lib/hooks/useRouter.js +17 -1
  244. package/lib/hooks/useTelemetry.js +5 -1
  245. package/lib/hooks/useTranslate.js +6 -1
  246. package/lib/hooks/useUppercase2LowercaseRedirect.js +12 -1
  247. package/lib/icons/CSharpIcon/CSharpIcon.js +7 -1
  248. package/lib/icons/CSharpIcon/index.js +2 -1
  249. package/lib/icons/CurlIcon/CurlIcon.js +8 -2
  250. package/lib/icons/CurlIcon/index.js +2 -1
  251. package/lib/icons/GOIcon/GOIcon.js +7 -1
  252. package/lib/icons/GOIcon/index.js +2 -1
  253. package/lib/icons/JavaIcon/JavaIcon.js +7 -1
  254. package/lib/icons/JavaIcon/index.js +2 -1
  255. package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +7 -1
  256. package/lib/icons/JavaScriptIcon/index.js +2 -1
  257. package/lib/icons/NodeJSIcon/NodeJSIcon.js +7 -1
  258. package/lib/icons/NodeJSIcon/index.js +2 -1
  259. package/lib/icons/PHPIcon/PHPIcon.js +7 -1
  260. package/lib/icons/PHPIcon/index.js +2 -1
  261. package/lib/icons/PayloadIcon/PayloadIcon.js +7 -1
  262. package/lib/icons/PayloadIcon/index.js +2 -1
  263. package/lib/icons/PythonIcon/PythonIcon.js +7 -1
  264. package/lib/icons/PythonIcon/index.js +2 -1
  265. package/lib/icons/RIcon/RIcon.js +7 -1
  266. package/lib/icons/RIcon/index.js +2 -1
  267. package/lib/icons/RubyIcon/RubyIcon.js +7 -1
  268. package/lib/icons/RubyIcon/index.js +2 -1
  269. package/lib/index.js +49 -1
  270. package/lib/jotai/app.js +113 -1
  271. package/lib/jotai/operation.js +28 -1
  272. package/lib/jotai/replay.js +5 -1
  273. package/lib/jotai/store.js +8 -1
  274. package/lib/jotai/use-write-atom.js +9 -1
  275. package/lib/models/callback.js +28 -1
  276. package/lib/models/code-sample-options.js +2 -0
  277. package/lib/models/example.js +17 -1
  278. package/lib/models/field.js +109 -1
  279. package/lib/models/group.js +38 -1
  280. package/lib/models/index.js +14 -1
  281. package/lib/models/mediaContent.js +26 -1
  282. package/lib/models/mediaType.js +153 -1
  283. package/lib/models/operation.js +166 -1
  284. package/lib/models/request.js +25 -1
  285. package/lib/models/response.js +46 -1
  286. package/lib/models/schema.js +474 -2
  287. package/lib/models/security.js +84 -1
  288. package/lib/models/tab.js +2 -0
  289. package/lib/models/types.js +2 -0
  290. package/lib/services/OpenAPIParser.js +321 -1
  291. package/lib/services/check.js +104 -1
  292. package/lib/services/code-samples/constants.js +16 -1
  293. package/lib/services/code-samples/generator.js +540 -1
  294. package/lib/services/code-samples/httpsnippet/helpers/code-builder.d.ts +5 -1
  295. package/lib/services/code-samples/httpsnippet/helpers/code-builder.js +252 -3
  296. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +2 -2
  297. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +90 -2
  298. package/lib/services/code-samples/httpsnippet/helpers/constants.js +28 -1
  299. package/lib/services/code-samples/httpsnippet/helpers/lodash-int.js +173 -1
  300. package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +76 -37
  301. package/lib/services/code-samples/httpsnippet/helpers/reducer.js +16 -1
  302. package/lib/services/code-samples/httpsnippet/helpers/shell.js +20 -1
  303. package/lib/services/code-samples/httpsnippet/helpers/string-utility.js +19 -1
  304. package/lib/services/code-samples/httpsnippet/index.js +166 -1
  305. package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +2340 -146
  306. package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +227 -2
  307. package/lib/services/code-samples/httpsnippet/targets/csharp/index.js +11 -1
  308. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +185 -2
  309. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +11 -1
  310. package/lib/services/code-samples/httpsnippet/targets/go/index.js +11 -1
  311. package/lib/services/code-samples/httpsnippet/targets/go/native.js +222 -3
  312. package/lib/services/code-samples/httpsnippet/targets/index.js +28 -1
  313. package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +184 -3
  314. package/lib/services/code-samples/httpsnippet/targets/java/index.js +11 -1
  315. package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +223 -2
  316. package/lib/services/code-samples/httpsnippet/targets/java8/index.js +11 -1
  317. package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +147 -1
  318. package/lib/services/code-samples/httpsnippet/targets/javascript/index.js +11 -1
  319. package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +199 -1
  320. package/lib/services/code-samples/httpsnippet/targets/node/index.js +11 -1
  321. package/lib/services/code-samples/httpsnippet/targets/php/curl.js +203 -5
  322. package/lib/services/code-samples/httpsnippet/targets/php/index.js +11 -1
  323. package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
  324. package/lib/services/code-samples/httpsnippet/targets/php/utils.js +106 -5
  325. package/lib/services/code-samples/httpsnippet/targets/python/index.js +11 -1
  326. package/lib/services/code-samples/httpsnippet/targets/python/requests.js +185 -6
  327. package/lib/services/code-samples/httpsnippet/targets/r/httr.js +111 -1
  328. package/lib/services/code-samples/httpsnippet/targets/r/index.js +11 -1
  329. package/lib/services/code-samples/httpsnippet/targets/r/utils.js +18 -6
  330. package/lib/services/code-samples/httpsnippet/targets/ruby/index.js +11 -1
  331. package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +169 -1
  332. package/lib/services/code-samples/httpsnippet/targets/shell/curl.js +94 -6
  333. package/lib/services/code-samples/httpsnippet/targets/shell/index.js +11 -1
  334. package/lib/services/code-samples/index.js +3 -1
  335. package/lib/services/code-samples/types.js +2 -0
  336. package/lib/services/config-options/helpers.js +49 -1
  337. package/lib/services/config-options/index.js +3 -1
  338. package/lib/services/config-options/normalizeOptions.js +83 -1
  339. package/lib/services/config-options/types.js +2 -0
  340. package/lib/services/history/helpers.js +63 -1
  341. package/lib/services/history/index.js +2 -1
  342. package/lib/services/index.js +9 -1
  343. package/lib/services/menu/builder.js +47 -1
  344. package/lib/services/menu/index.js +2 -1
  345. package/lib/services/menu/markdown.js +93 -1
  346. package/lib/services/menu/operation.js +50 -1
  347. package/lib/services/menu/tags.js +166 -1
  348. package/lib/services/types.d.ts +0 -3
  349. package/lib/services/types.js +2 -0
  350. package/lib/services/utils.js +83 -1
  351. package/lib/standalone.js +68 -1
  352. package/lib/styled-components.js +6 -1
  353. package/lib/types/app.js +2 -0
  354. package/lib/types/index.js +4 -1
  355. package/lib/types/open-api.d.ts +1 -0
  356. package/lib/types/open-api.js +2 -0
  357. package/lib/types/security.js +2 -0
  358. package/lib/utils/JsonPointer.js +84 -1
  359. package/lib/utils/areArraysEqual.js +4 -1
  360. package/lib/utils/argValuesHelpers.js +35 -1
  361. package/lib/utils/compose.js +2 -1
  362. package/lib/utils/configure-helpers.js +223 -1
  363. package/lib/utils/convertSwagger2OpenAPI.js +14 -1
  364. package/lib/utils/cookies.js +73 -1
  365. package/lib/utils/debounce.js +22 -1
  366. package/lib/utils/debug.js +11 -1
  367. package/lib/utils/dom.js +65 -1
  368. package/lib/utils/environments.js +13 -1
  369. package/lib/utils/helpers.js +222 -12
  370. package/lib/utils/index.js +25 -1
  371. package/lib/utils/isMobile.js +13 -1
  372. package/lib/utils/loadAndBundleSpec.js +32 -1
  373. package/lib/utils/local-storage.js +12 -1
  374. package/lib/utils/object.js +31 -1
  375. package/lib/utils/openapi.js +592 -1
  376. package/lib/utils/parameters.js +13 -1
  377. package/lib/utils/path.js +22 -1
  378. package/lib/utils/queryString.js +60 -1
  379. package/lib/utils/replaceVariables.js +14 -1
  380. package/lib/utils/saveTextBeforeHeading.js +35 -1
  381. package/lib/utils/security-details.js +49 -1
  382. package/lib/utils/session-storage.js +12 -1
  383. package/lib/utils/simplifyAstStructure.js +22 -1
  384. package/lib/utils/sort.js +21 -1
  385. package/lib/utils/string.js +65 -1
  386. package/lib/utils/telemetry.js +7 -1
  387. package/lib/utils/test-utils.js +26 -1
  388. package/lib/utils/theme-helpers.js +24 -3
  389. package/lib/utils/url.js +38 -1
  390. package/package.json +5 -5
@@ -1,12 +1,222 @@
1
- import{isObject as i,isString as a,IS_BROWSER as u}from"@redocly/theme/core/openapi";import{isNamedDefinition as f}from"./openapi.js";import{JsonPointer as l}from"./JsonPointer.js";import{urlParse as c}from"./url.js";function w(r,e){const t=[];for(let n=0;n<r.length-1;n++)t.push(e(r[n],!1));return r.length!==0&&t.push(e(r[r.length-1],!0)),t}function O(r,e){const t={};for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=e(r[n],n,r));return t}function y(r,e){const t=[],n=o=>{for(const s of o)t.push(s),s[e]&&n(s[e])};return n(r),t}function p(r){return r.endsWith("/")?r.substring(0,r.length-1):r}function A(r){return!isNaN(parseFloat(r))&&isFinite(r)}function b(r,e,t){const n=new RegExp(`(^|\\n)#\\s?${e}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${e}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(r))return r.replace(o,`$1
2
-
3
- ${t}
4
- $4`);{const s=r===""||r.endsWith(`
5
-
6
- `)?"":r.endsWith(`
7
- `)?`
8
- `:`
9
-
10
- `;return`${r}${s}# ${e}
11
-
12
- ${t}`}}const E=r=>Array.isArray(r)&&r.some(e=>i(e)),R=r=>r.filter(e=>!!e),W=r=>i(r)&&!Array.isArray(r);function d(r){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(r)}function C(r,e){let t;if(e.startsWith("//"))t=`${c(r,!0)?.protocol||"https:"}${e}`;else if(d(e))t=e;else if(!e.startsWith("/"))t=p(r)+"/"+e;else{const n=c(r);n?(n.pathname=e,t=n.toString()):t=e}return p(t)}function I(r){return r.charAt(0).toUpperCase()+r.slice(1)}function L(r){try{if(!r)return"";const e=new URL(r);return e.search="",e.hash="",e.toString()}catch{return r}}function M(r){return r.replace(/["\\]/g,"\\$&")}function N(r){return r.replace(/&#(\d+);/g,(e,t)=>String.fromCharCode(parseInt(t,10))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}function P(r){return r&&r.replace(/#/g,"_").toLowerCase()}function T(r,e){return e||f(r)&&l.baseName(r)||""}function j(r={},e,t){return typeof e=="string"&&(e=e.split(".")),e.reduce((n,o)=>n&&n[o]?n[o]:t,r)}function x(r){return(...e)=>e.filter(Boolean).join(r)}const z=x(".");function D(r){return u?window?.REFERENCE_DOCS_OPTIONS?.[r]:null}function F(){if(!u)return"";const r=+new Date+Math.random();try{return(!document.currentScript||!(document.currentScript.async||document.currentScript.defer))&&document.write(`<script id="dummy${r}"></script>`),(document.getElementById("dummy"+r)?.previousSibling).src}catch{return""}}const _=r=>a(r)?r:r?.raw,B=(r,e)=>{const t=r?.[`x-parsed-md-${e}`]||r?.[e];if(!t)return;if(!r?.[`x-parsed-md-${e}`]&&e!=="x-enumDescriptions")return r?.[e];if(e!=="x-enumDescriptions")return g(r,e);let n={};for(const o in t)o.startsWith("x-parsed-md")||(n[o]=t?.[`x-parsed-md-${o}`]||t?.[o]);return Object.keys(n).length?n:t};function g(r,e){const t=r?.[`x-parsed-md-${e}`]||r?.[e];return t?.raw?t:{result:t?.result||r?.[e]?.result||r?.[e],raw:r?.[e]}}function H(r,e){return e===r.length-1}function U(r,e){const t=Object.keys(r);return t.indexOf(e)===t.length-1}export{b as appendToMdHeading,R as deleteEmptyArrayItem,z as dottedString,M as escapeHTMLAttrChars,y as flattenByProp,j as get,F as getJsUrl,B as getValueFromMdParsedExtension,D as getWindowReferenceOptions,d as isAbsoluteUrl,E as isArrayOfObjects,H as isLastInArray,U as isLastProperty,W as isMergeableObject,A as isNumeric,x as joinStringFactory,O as mapValues,w as mapWithLast,_ as normalizeText,L as removeQueryStringAndHash,C as resolveUrl,P as sanitizeItemId,p as stripTrailingSlash,I as titleize,N as unescapeHTMLChars,T as useSchemaTitle};
1
+ import { isObject, isString, IS_BROWSER } from '@redocly/theme/core/openapi';
2
+ import { isNamedDefinition } from './openapi.js';
3
+ import { JsonPointer } from './JsonPointer.js';
4
+ import { urlParse } from './url.js';
5
+ /**
6
+ * Maps over array passing `isLast` bool to iterator as the second argument
7
+ */
8
+ export function mapWithLast(array, iteratee) {
9
+ const res = [];
10
+ for (let i = 0; i < array.length - 1; i++) {
11
+ res.push(iteratee(array[i], false));
12
+ }
13
+ if (array.length !== 0) {
14
+ res.push(iteratee(array[array.length - 1], true));
15
+ }
16
+ return res;
17
+ }
18
+ /**
19
+ * Creates an object with the same keys as object and values generated by running each
20
+ * own enumerable string keyed property of object thru iteratee.
21
+ * The iteratee is invoked with three arguments: (value, key, object).
22
+ *
23
+ * @param object the object to iterate over
24
+ * @param iteratee the function invoked per iteration.
25
+ */
26
+ export function mapValues(object, iteratee) {
27
+ const res = {};
28
+ for (const key in object) {
29
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
30
+ res[key] = iteratee(object[key], key, object);
31
+ }
32
+ }
33
+ return res;
34
+ }
35
+ /**
36
+ * flattens collection using `prop` field as a children
37
+ * @param collectionItems collection items
38
+ * @param prop item property with child elements
39
+ */
40
+ export function flattenByProp(collectionItems, prop) {
41
+ const res = [];
42
+ const iterate = (items) => {
43
+ for (const item of items) {
44
+ res.push(item);
45
+ if (item[prop]) {
46
+ iterate(item[prop]);
47
+ }
48
+ }
49
+ };
50
+ iterate(collectionItems);
51
+ return res;
52
+ }
53
+ export function stripTrailingSlash(path) {
54
+ if (path.endsWith('/')) {
55
+ return path.substring(0, path.length - 1);
56
+ }
57
+ return path;
58
+ }
59
+ export function isNumeric(value) {
60
+ return !isNaN(parseFloat(value)) && isFinite(value);
61
+ }
62
+ export function appendToMdHeading(md, heading, content) {
63
+ // if heading is already in md and append to the end of it
64
+ const testRegex = new RegExp(`(^|\\n)#\\s?${heading}\\s*\\n`, 'i');
65
+ const replaceRegex = new RegExp(`((\\n|^)#\\s*${heading}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`, 'i');
66
+ if (testRegex.test(md)) {
67
+ return md.replace(replaceRegex, `$1\n\n${content}\n$4`);
68
+ }
69
+ else {
70
+ // else append heading itself
71
+ const br = md === '' || md.endsWith('\n\n') ? '' : md.endsWith('\n') ? '\n' : '\n\n';
72
+ return `${md}${br}# ${heading}\n\n${content}`;
73
+ }
74
+ }
75
+ export const isArrayOfObjects = (items) => {
76
+ return Array.isArray(items) && items.some((item) => isObject(item));
77
+ };
78
+ export const deleteEmptyArrayItem = (items) => {
79
+ return items.filter((item) => !!item);
80
+ };
81
+ export const isMergeableObject = (item) => {
82
+ return isObject(item) && !Array.isArray(item);
83
+ };
84
+ export function isAbsoluteUrl(url) {
85
+ return /(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(url);
86
+ }
87
+ /**
88
+ * simple resolve URL which doesn't break on strings with url fragments
89
+ * e.g. resolveUrl('http://test.com:{port}', 'path') results in http://test.com:{port}/path
90
+ */
91
+ export function resolveUrl(url, to) {
92
+ let res;
93
+ if (to.startsWith('//')) {
94
+ res = `${urlParse(url, true)?.protocol || 'https:'}${to}`;
95
+ }
96
+ else if (isAbsoluteUrl(to)) {
97
+ res = to;
98
+ }
99
+ else if (!to.startsWith('/')) {
100
+ res = stripTrailingSlash(url) + '/' + to;
101
+ }
102
+ else {
103
+ const parsedUrl = urlParse(url);
104
+ if (parsedUrl) {
105
+ parsedUrl.pathname = to;
106
+ res = parsedUrl.toString();
107
+ }
108
+ else {
109
+ res = to;
110
+ }
111
+ }
112
+ return stripTrailingSlash(res);
113
+ }
114
+ export function titleize(text) {
115
+ return text.charAt(0).toUpperCase() + text.slice(1);
116
+ }
117
+ export function removeQueryStringAndHash(serverUrl) {
118
+ try {
119
+ if (!serverUrl) {
120
+ return '';
121
+ }
122
+ const url = new URL(serverUrl);
123
+ url.search = '';
124
+ url.hash = '';
125
+ return url.toString();
126
+ }
127
+ catch {
128
+ // when using with redoc-cli serverUrl can be empty resulting in crash
129
+ return serverUrl;
130
+ }
131
+ }
132
+ export function escapeHTMLAttrChars(str) {
133
+ return str.replace(/["\\]/g, '\\$&');
134
+ }
135
+ export function unescapeHTMLChars(str) {
136
+ return str
137
+ .replace(/&#(\d+);/g, (_m, code) => String.fromCharCode(parseInt(code, 10)))
138
+ .replace(/&amp;/g, '&')
139
+ .replace(/&quot;/g, '"');
140
+ }
141
+ export function sanitizeItemId(id) {
142
+ // we probably need to replace other symbols too
143
+ return id && id.replace(/#/g, '_').toLowerCase();
144
+ }
145
+ export function useSchemaTitle(pointer, title) {
146
+ return title || (isNamedDefinition(pointer) && JsonPointer.baseName(pointer)) || '';
147
+ }
148
+ export function get(object = {}, path, defval) {
149
+ if (typeof path === 'string')
150
+ path = path.split('.');
151
+ return path.reduce((xs, x) => (xs && xs[x] ? xs[x] : defval), object);
152
+ }
153
+ export function joinStringFactory(separator) {
154
+ return (...args) => args.filter(Boolean).join(separator);
155
+ }
156
+ export const dottedString = joinStringFactory('.');
157
+ export function getWindowReferenceOptions(option) {
158
+ return IS_BROWSER ? window?.REFERENCE_DOCS_OPTIONS?.[option] : null;
159
+ }
160
+ export function getJsUrl() {
161
+ if (!IS_BROWSER) {
162
+ return '';
163
+ }
164
+ const id = +new Date() + Math.random();
165
+ try {
166
+ if (!document.currentScript || // IE doesn't have currentScript
167
+ !(document.currentScript.async ||
168
+ document.currentScript.defer)) {
169
+ // write empty script to the document. It will get placed directly after the current script
170
+ document.write(`<script id="dummy${id}"></script>`);
171
+ }
172
+ // find appended script and return src of the previous script which is the current script
173
+ return (document.getElementById('dummy' + id)?.previousSibling).src;
174
+ }
175
+ catch {
176
+ return '';
177
+ }
178
+ }
179
+ export const normalizeText = (text) => isString(text) ? text : text?.raw;
180
+ export const getValueFromMdParsedExtension = (item, key) => {
181
+ const value = item?.[`x-parsed-md-${key}`] || item?.[key];
182
+ if (!value) {
183
+ return;
184
+ }
185
+ if (!item?.[`x-parsed-md-${key}`] && key !== 'x-enumDescriptions') {
186
+ return item?.[key];
187
+ }
188
+ if (key !== 'x-enumDescriptions') {
189
+ return normalizeMarkdownValue(item, key);
190
+ }
191
+ let result = {};
192
+ for (const property in value) {
193
+ if (property.startsWith('x-parsed-md')) {
194
+ continue;
195
+ }
196
+ result[property] = value?.[`x-parsed-md-${property}`] || value?.[property];
197
+ }
198
+ if (Object.keys(result).length) {
199
+ return result;
200
+ }
201
+ return value;
202
+ };
203
+ // We need to normalize the value when running inside Realm which parses md to markdoc AST.
204
+ // The value can be a string or an object with result property (which contains AST)
205
+ function normalizeMarkdownValue(item, key) {
206
+ const value = item?.[`x-parsed-md-${key}`] || item?.[key];
207
+ if (value?.raw) {
208
+ return value;
209
+ }
210
+ return {
211
+ result: value?.result || item?.[key]?.result || item?.[key],
212
+ raw: item?.[key],
213
+ };
214
+ }
215
+ export function isLastInArray(arr, index) {
216
+ return index === arr.length - 1;
217
+ }
218
+ export function isLastProperty(obj, key) {
219
+ const objectKeys = Object.keys(obj);
220
+ return objectKeys.indexOf(key) === objectKeys.length - 1;
221
+ }
222
+ //# sourceMappingURL=helpers.js.map
@@ -1 +1,25 @@
1
- export*from"./JsonPointer.js";export*from"./openapi.js";export*from"./helpers.js";export*from"./dom.js";export*from"./debug.js";export*from"./sort.js";export*from"./argValuesHelpers.js";export*from"./theme-helpers.js";export*from"./debounce.js";export*from"./security-details.js";export*from"./session-storage.js";export*from"./local-storage.js";export*from"./parameters.js";export*from"./string.js";export*from"./test-utils.js";export*from"./compose.js";export*from"./saveTextBeforeHeading.js";export*from"./path.js";export*from"./queryString.js";export*from"./isMobile.js";export*from"./replaceVariables.js";export*from"./areArraysEqual.js";export*from"./configure-helpers.js";export*from"./telemetry.js";
1
+ export * from './JsonPointer.js';
2
+ export * from './openapi.js';
3
+ export * from './helpers.js';
4
+ export * from './dom.js';
5
+ export * from './debug.js';
6
+ export * from './sort.js';
7
+ export * from './argValuesHelpers.js';
8
+ export * from './theme-helpers.js';
9
+ export * from './debounce.js';
10
+ export * from './security-details.js';
11
+ export * from './session-storage.js';
12
+ export * from './local-storage.js';
13
+ export * from './parameters.js';
14
+ export * from './string.js';
15
+ export * from './test-utils.js';
16
+ export * from './compose.js';
17
+ export * from './saveTextBeforeHeading.js';
18
+ export * from './path.js';
19
+ export * from './queryString.js';
20
+ export * from './isMobile.js';
21
+ export * from './replaceVariables.js';
22
+ export * from './areArraysEqual.js';
23
+ export * from './configure-helpers.js';
24
+ export * from './telemetry.js';
25
+ //# sourceMappingURL=index.js.map
@@ -1 +1,13 @@
1
- function s(e={}){const o=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,i=/CrOS/,n=/android|ipad|playbook|silk/i,a=o.test(navigator.userAgent)&&!i.test(navigator.userAgent),t=e.tablet&&n.test(navigator.userAgent),r=e.tablet&&navigator.maxTouchPoints>1&&navigator.userAgent.indexOf("Macintosh")!==-1&&navigator.userAgent.indexOf("Safari")!==-1;return!!(a||t||r)}export{s as isMobile};
1
+ export function isMobile(opts = {}) {
2
+ const mobileRE = /(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i;
3
+ const notMobileRE = /CrOS/;
4
+ const tabletRE = /android|ipad|playbook|silk/i;
5
+ const isMobileUserAgent = mobileRE.test(navigator.userAgent) && !notMobileRE.test(navigator.userAgent);
6
+ const isTabletUserAgent = opts.tablet && tabletRE.test(navigator.userAgent);
7
+ const isMacSafariTablet = opts.tablet &&
8
+ navigator.maxTouchPoints > 1 &&
9
+ navigator.userAgent.indexOf('Macintosh') !== -1 &&
10
+ navigator.userAgent.indexOf('Safari') !== -1;
11
+ return !!(isMobileUserAgent || isTabletUserAgent || isMacSafariTablet);
12
+ }
13
+ //# sourceMappingURL=isMobile.js.map
@@ -1 +1,32 @@
1
- import{bundle as s,Config as f}from"@redocly/openapi-core";import{IS_BROWSER as i}from"@redocly/theme/core/openapi";import{convertSwagger2OpenAPI as r}from"./convertSwagger2OpenAPI.js";async function l(e){const t=new f({}),o={config:t,base:i?window.location.href:typeof globalThis.process<"u"?globalThis.process.cwd():""};i&&(t.resolve.http.customFetch=globalThis.fetch),typeof e=="object"&&e!==null?o.doc=a(e):o.ref=e;const{bundle:{parsed:n}}=await s(o);return n.swagger!==void 0?r(n):n}function a(e){return{source:{absoluteRef:""},parsed:e}}export{l as loadAndBundleDefinition};
1
+ import { bundle, Config } from '@redocly/openapi-core';
2
+ import { IS_BROWSER } from '@redocly/theme/core/openapi';
3
+ import { convertSwagger2OpenAPI } from './convertSwagger2OpenAPI.js';
4
+ export async function loadAndBundleDefinition(specUrlOrObject) {
5
+ const config = new Config({});
6
+ const bundleOpts = {
7
+ config,
8
+ base: IS_BROWSER
9
+ ? window.location.origin
10
+ : typeof globalThis.process !== 'undefined'
11
+ ? globalThis.process.cwd()
12
+ : '',
13
+ };
14
+ if (IS_BROWSER) {
15
+ config.resolve.http.customFetch = globalThis.fetch;
16
+ }
17
+ if (typeof specUrlOrObject === 'object' && specUrlOrObject !== null) {
18
+ bundleOpts['doc'] = createParsedDocument(specUrlOrObject);
19
+ }
20
+ else {
21
+ bundleOpts['ref'] = specUrlOrObject;
22
+ }
23
+ const { bundle: { parsed }, } = await bundle(bundleOpts);
24
+ return parsed.swagger !== undefined ? convertSwagger2OpenAPI(parsed) : parsed;
25
+ }
26
+ function createParsedDocument(specUrlOrObject) {
27
+ return {
28
+ source: { absoluteRef: '' },
29
+ parsed: specUrlOrObject,
30
+ };
31
+ }
32
+ //# sourceMappingURL=loadAndBundleSpec.js.map
@@ -1 +1,12 @@
1
- import{IS_BROWSER as t}from"@redocly/theme/core/openapi";function a(o,r){t&&window.localStorage.setItem("redoc."+o,r)}function c(o){return t&&window.localStorage.getItem("redoc."+o)||""}export{c as fromLocalStorage,a as toLocalStorage};
1
+ import { IS_BROWSER } from '@redocly/theme/core/openapi';
2
+ export function toLocalStorage(key, value) {
3
+ if (IS_BROWSER) {
4
+ window.localStorage.setItem('redoc.' + key, value);
5
+ }
6
+ }
7
+ export function fromLocalStorage(key) {
8
+ if (!IS_BROWSER)
9
+ return '';
10
+ return (window.localStorage.getItem('redoc.' + key) || '');
11
+ }
12
+ //# sourceMappingURL=local-storage.js.map
@@ -1 +1,31 @@
1
- function o(t,e){let r=e;return typeof e=="string"&&(r=e.split(".")),r.every(n=>typeof t!="object"||t===null||!(n in t)?!1:(t=t[n],!0))}function u(t,e,r){let n=e;typeof e=="string"&&(n=e.split("."));const f=n.length-1;for(let i=0;i<f;++i){const s=n[i];t=t[s]??(t[s]={})}const l=n[f];t[l]=r}function p(t,e){return Object.fromEntries(Object.entries(t).map(([r,n])=>[r,e(n,r)]))}export{p as mapObject,o as objectHas,u as objectSet};
1
+ export function objectHas(object, path) {
2
+ let _path = path;
3
+ if (typeof path === 'string') {
4
+ _path = path.split('.');
5
+ }
6
+ return _path.every((key) => {
7
+ if (typeof object != 'object' || object === null || !(key in object))
8
+ return false;
9
+ object = object[key];
10
+ return true;
11
+ });
12
+ }
13
+ export function objectSet(object, path, value) {
14
+ let _path = path;
15
+ if (typeof path === 'string') {
16
+ _path = path.split('.');
17
+ }
18
+ const limit = _path.length - 1;
19
+ for (let i = 0; i < limit; ++i) {
20
+ const key = _path[i];
21
+ object = object[key] ?? (object[key] = {});
22
+ }
23
+ const key = _path[limit];
24
+ object[key] = value;
25
+ }
26
+ export function mapObject(obj, fn) {
27
+ return Object.fromEntries(Object.entries(obj).map(([key, val]) => {
28
+ return [key, fn(val, key)];
29
+ }));
30
+ }
31
+ //# sourceMappingURL=object.js.map