@redocly/openapi-docs 3.4.0-rc.5 → 3.4.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 (407) hide show
  1. package/dist/redocly-openapi-docs.min.js +1565 -1366
  2. package/lib/components/ApiInfo/ApiInfo.js +1 -1
  3. package/lib/components/ApiInfo/Metadata.d.ts +3 -1
  4. package/lib/components/ApiInfo/Metadata.js +1 -1
  5. package/lib/components/CallbackSamples/CallbackSamples.d.ts +2 -1
  6. package/lib/components/CallbackSamples/CallbackSamples.js +1 -1
  7. package/lib/components/Callbacks/CallbackDetails.d.ts +2 -1
  8. package/lib/components/Callbacks/CallbackDetails.js +1 -1
  9. package/lib/components/Callbacks/CallbackOperation.js +1 -1
  10. package/lib/components/Callbacks/CallbackSummary.d.ts +3 -2
  11. package/lib/components/Callbacks/CallbackSummary.js +1 -1
  12. package/lib/components/Callbacks/CallbacksList.d.ts +0 -1
  13. package/lib/components/Callbacks/styled.d.ts +1 -1
  14. package/lib/components/Content/Content.d.ts +0 -1
  15. package/lib/components/Content/useAutoScroll.js +1 -1
  16. package/lib/components/ContentItem/ContentItem.d.ts +0 -1
  17. package/lib/components/ContentItem/useIsExpanded.js +1 -1
  18. package/lib/components/ContentItems/ContentItems.d.ts +0 -1
  19. package/lib/components/ContentItems/helpers.js +1 -1
  20. package/lib/components/Discriminator/Discriminator.d.ts +2 -1
  21. package/lib/components/Discriminator/Discriminator.js +1 -1
  22. package/lib/components/ExpandAllButton/ExpandAllButton.js +1 -1
  23. package/lib/components/ExpandAllButton/getAllNestedSchema.d.ts +4 -4
  24. package/lib/components/ExpandAllButton/useUpdateExpandedFields.js +1 -1
  25. package/lib/components/ExternalDocumentation/ExternalDocumentation.d.ts +0 -1
  26. package/lib/components/Language/LanguageList.d.ts +0 -1
  27. package/lib/components/Language/styled.d.ts +12 -13
  28. package/lib/components/MediaTypeSwitch/MediaTypesSwitch.js +1 -1
  29. package/lib/components/OperationItem/Description.js +1 -1
  30. package/lib/components/OperationItem/OperationItem.d.ts +0 -1
  31. package/lib/components/OperationItem/OperationItem.js +2 -2
  32. package/lib/components/Overview/Overview.d.ts +8 -3
  33. package/lib/components/Overview/Overview.js +1 -1
  34. package/lib/components/PageFooter/PageFooter.d.ts +0 -1
  35. package/lib/components/PageFooter/PageFooter.js +1 -1
  36. package/lib/components/PanelItem/styled.d.ts +5 -6
  37. package/lib/components/PayloadSamples/Example.js +1 -1
  38. package/lib/components/PayloadSamples/ExampleValue.d.ts +0 -1
  39. package/lib/components/PayloadSamples/ExampleValue.js +1 -1
  40. package/lib/components/PayloadSamples/ExternalExample.js +1 -1
  41. package/lib/components/PayloadSamples/MediaTypeSamples.d.ts +0 -1
  42. package/lib/components/PayloadSamples/MediaTypeSamples.js +1 -1
  43. package/lib/components/PayloadSamples/PayloadSamples.d.ts +0 -1
  44. package/lib/components/PayloadSamples/PayloadSamples.js +1 -1
  45. package/lib/components/PayloadSamples/useExternalExample.js +1 -1
  46. package/lib/components/PropertyDetails/DescriptionEnums.d.ts +1 -1
  47. package/lib/components/PropertyDetails/DescriptionEnums.js +2 -2
  48. package/lib/components/PropertyDetails/EnumValues.d.ts +0 -1
  49. package/lib/components/PropertyDetails/EnumValues.js +1 -1
  50. package/lib/components/PropertyDetails/Examples.js +1 -1
  51. package/lib/components/PropertyDetails/Extensions.d.ts +0 -1
  52. package/lib/components/PropertyDetails/FieldDetail.d.ts +1 -1
  53. package/lib/components/PropertyDetails/FieldDetail.js +1 -1
  54. package/lib/components/PropertyDetails/FieldDetails.d.ts +0 -1
  55. package/lib/components/PropertyDetails/FieldDetails.js +4 -3
  56. package/lib/components/PropertyDetails/Pattern.js +1 -1
  57. package/lib/components/PropertyDetails/PlusCircleIcon.js +1 -1
  58. package/lib/components/PropertyDetails/PropertyDetails.d.ts +0 -1
  59. package/lib/components/PropertyDetails/SchemaTypeInfo.js +1 -1
  60. package/lib/components/PropertyDetails/SimpleEnums.d.ts +1 -1
  61. package/lib/components/PropertyDetails/SimpleEnums.js +1 -1
  62. package/lib/components/PropertyDetails/styled.d.ts +1 -10
  63. package/lib/components/PropertyDetails/types.d.ts +3 -0
  64. package/lib/components/RedoclyOpenAPIDocs/Providers.js +1 -1
  65. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
  66. package/lib/components/RedoclyOpenAPIDocs/styled.d.ts +0 -4
  67. package/lib/components/RedoclyOpenAPIDocs/styled.js +1 -30
  68. package/lib/components/RedoclyOpenAPIDocs/types.d.ts +0 -3
  69. package/lib/components/RedoclyOpenAPIDocs/utils.js +1 -1
  70. package/lib/components/RenderHook/RenderHook.js +1 -1
  71. package/lib/components/Replay/EmbeddedReplay.d.ts +0 -1
  72. package/lib/components/Replay/EmbeddedReplay.js +1 -1
  73. package/lib/components/Replay/Replay.d.ts +0 -1
  74. package/lib/components/Replay/Replay.js +2 -9
  75. package/lib/components/Replay/utils.js +1 -1
  76. package/lib/components/Request/RequestDetails.d.ts +0 -1
  77. package/lib/components/Request/RequestDetails.js +1 -1
  78. package/lib/components/Request/types.d.ts +2 -0
  79. package/lib/components/RequestParameters/Body.d.ts +0 -1
  80. package/lib/components/RequestParameters/ParametersGroup.d.ts +0 -1
  81. package/lib/components/RequestParameters/RequestParameters.js +1 -1
  82. package/lib/components/RequestSamples/CodeSample.d.ts +0 -1
  83. package/lib/components/RequestSamples/RequestSamples.d.ts +0 -1
  84. package/lib/components/RequestSamples/useCodeSamples.js +1 -1
  85. package/lib/components/ResponseSamples/Summary.js +1 -1
  86. package/lib/components/Responses/OperationResponseList.js +1 -1
  87. package/lib/components/Responses/ResponseDetails.d.ts +0 -1
  88. package/lib/components/Responses/ResponseHeaders.d.ts +0 -1
  89. package/lib/components/Responses/ResponseHeaders.js +1 -1
  90. package/lib/components/Responses/styled.d.ts +1 -2
  91. package/lib/components/RightPanel/RightPanel.js +1 -1
  92. package/lib/components/Samples/use-example-key.js +1 -1
  93. package/lib/components/Schema/ArraySchema.d.ts +0 -1
  94. package/lib/components/Schema/ObjectSchema.d.ts +0 -1
  95. package/lib/components/Schema/ObjectSchema.js +1 -1
  96. package/lib/components/Schema/OneOfSchema.d.ts +0 -1
  97. package/lib/components/Schema/OneOfSchema.js +1 -1
  98. package/lib/components/Schema/RecursiveSchema.d.ts +0 -1
  99. package/lib/components/Schema/RecursiveSchema.js +1 -1
  100. package/lib/components/Schema/Schema.d.ts +0 -1
  101. package/lib/components/Schema/SubSchema.js +1 -1
  102. package/lib/components/Schema/helpers.d.ts +1 -1
  103. package/lib/components/Schema/helpers.js +1 -1
  104. package/lib/components/Schema/useOneOfLocationIdx.js +1 -1
  105. package/lib/components/SchemaDefinition/SchemaDefinition.d.ts +0 -1
  106. package/lib/components/SectionContent/SectionContent.js +1 -1
  107. package/lib/components/SectionItem/SectionItem.d.ts +0 -1
  108. package/lib/components/Security/Divider.js +1 -1
  109. package/lib/components/Security/OAuthFlow.js +1 -1
  110. package/lib/components/Security/Security.js +1 -1
  111. package/lib/components/Security/SecurityButton.js +1 -1
  112. package/lib/components/Security/SecurityFlow.js +1 -1
  113. package/lib/components/Security/SecurityModal.js +1 -1
  114. package/lib/components/Security/SecuritySchemeItem.js +1 -1
  115. package/lib/components/Security/helper.js +1 -1
  116. package/lib/components/SelectOrLabel/SelectOrLabel.js +2 -2
  117. package/lib/components/ServerList/ServerList.d.ts +1 -1
  118. package/lib/components/ServerList/ServerList.js +1 -1
  119. package/lib/components/ServerList/types.d.ts +4 -1
  120. package/lib/components/ServerListDropdown/ServerListDropdown.js +1 -1
  121. package/lib/components/ServerListDropdown/styled.d.ts +0 -1
  122. package/lib/components/SideMenu/SideMenu.d.ts +0 -1
  123. package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
  124. package/lib/components/Tabs/Tabs.js +1 -1
  125. package/lib/components/Tabs/useTabsState.js +1 -1
  126. package/lib/components/TagItem/OperationNavigationItems.d.ts +9 -0
  127. package/lib/components/TagItem/OperationNavigationItems.js +37 -0
  128. package/lib/components/TagItem/OperationsNavigation.d.ts +1 -7
  129. package/lib/components/TagItem/OperationsNavigation.js +1 -40
  130. package/lib/components/TagItem/TagItem.js +1 -1
  131. package/lib/components/TagItem/styled.d.ts +1 -0
  132. package/lib/components/TagItem/styled.js +6 -0
  133. package/lib/components/TagItem/types.d.ts +5 -0
  134. package/lib/components/TagItem/types.js +2 -0
  135. package/lib/components/common/Badges.d.ts +2 -2
  136. package/lib/components/common/BodyContent/BodyContent.d.ts +0 -1
  137. package/lib/components/common/BodyContent/BodyContent.js +1 -1
  138. package/lib/components/common/ClearButton/ClearButton.d.ts +0 -1
  139. package/lib/components/common/ClearButton/styled.d.ts +0 -1
  140. package/lib/components/common/ConstraintsView.d.ts +0 -1
  141. package/lib/components/common/ExpandableExample/ExpandableExample.js +1 -1
  142. package/lib/components/common/Extensions.d.ts +0 -1
  143. package/lib/components/common/Fields/fields-layout.d.ts +3 -3
  144. package/lib/components/common/Fields/fields.d.ts +1 -2
  145. package/lib/components/common/LinkToField.js +1 -1
  146. package/lib/components/common/Select/Select.d.ts +0 -1
  147. package/lib/components/common/Select/styled.d.ts +11 -12
  148. package/lib/components/common/Skeleton/Skeleton.d.ts +1 -1
  149. package/lib/components/common/Skeleton/Skeleton.js +2 -2
  150. package/lib/components/common/linkify.js +2 -2
  151. package/lib/components/common/panels.d.ts +7 -7
  152. package/lib/components/common/panels.js +2 -2
  153. package/lib/components/pluggable/styled.components.d.ts +3 -3
  154. package/lib/events/creator.js +1 -1
  155. package/lib/hoc/utils.js +1 -1
  156. package/lib/hoc/withRouter.js +1 -1
  157. package/lib/hoc/withStore.js +1 -1
  158. package/lib/hooks/index.d.ts +1 -0
  159. package/lib/hooks/index.js +1 -1
  160. package/lib/hooks/useActivateExample.js +1 -1
  161. package/lib/hooks/useActiveWithFallback.js +1 -1
  162. package/lib/hooks/useDimensions.js +1 -1
  163. package/lib/hooks/useLicense.js +1 -1
  164. package/lib/hooks/usePrevious.js +1 -1
  165. package/lib/hooks/useRouter.d.ts +1 -1
  166. package/lib/hooks/useTranslate.d.ts +2 -0
  167. package/lib/hooks/useTranslate.js +2 -0
  168. package/lib/hooks/useUppercase2LowercaseRedirect.js +1 -1
  169. package/lib/index.js +1 -1
  170. package/lib/jotai/app.d.ts +2 -4
  171. package/lib/jotai/app.js +1 -1
  172. package/lib/jotai/operation.js +1 -1
  173. package/lib/models/callback.js +1 -1
  174. package/lib/models/example.js +1 -1
  175. package/lib/models/field.js +1 -1
  176. package/lib/models/group.js +1 -1
  177. package/lib/models/mediaContent.js +1 -1
  178. package/lib/models/mediaType.js +1 -1
  179. package/lib/models/operation.js +1 -1
  180. package/lib/models/request.js +1 -1
  181. package/lib/models/response.js +1 -1
  182. package/lib/models/schema.js +1 -1
  183. package/lib/models/security.js +1 -1
  184. package/lib/models/tab.d.ts +1 -1
  185. package/lib/services/OpenAPIParser.js +1 -1
  186. package/lib/services/check.js +1 -1
  187. package/lib/services/code-samples/generator.d.ts +3 -1
  188. package/lib/services/code-samples/generator.js +1 -1
  189. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +1 -1
  190. package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.d.ts +46 -0
  191. package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +1 -1
  192. package/lib/services/code-samples/httpsnippet/targets/index.d.ts +2 -2
  193. package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +1 -1
  194. package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +1 -1
  195. package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +1 -1
  196. package/lib/services/code-samples/httpsnippet/targets/javascript/index.d.ts +1 -1
  197. package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +1 -1
  198. package/lib/services/code-samples/httpsnippet/targets/php/utils.js +1 -1
  199. package/lib/services/code-samples/httpsnippet/targets/python/requests.js +1 -1
  200. package/lib/services/code-samples/httpsnippet/targets/r/utils.js +1 -1
  201. package/lib/services/code-samples/httpsnippet/targets/shell/index.d.ts +1 -1
  202. package/lib/services/config-options/helpers.js +1 -1
  203. package/lib/services/config-options/normalizeOptions.js +1 -1
  204. package/lib/services/history/helpers.js +1 -1
  205. package/lib/services/menu/builder.js +1 -1
  206. package/lib/services/menu/markdown.js +1 -1
  207. package/lib/services/menu/operation.js +1 -1
  208. package/lib/services/menu/tags.js +1 -1
  209. package/lib/services/utils.js +1 -1
  210. package/lib/standalone.js +1 -1
  211. package/lib/utils/areArraysEqual.js +1 -1
  212. package/lib/utils/argValuesHelpers.js +1 -1
  213. package/lib/utils/compose.d.ts +1 -1
  214. package/lib/utils/convertExamplesFormat.d.ts +2 -0
  215. package/lib/utils/convertExamplesFormat.js +2 -0
  216. package/lib/utils/cookies.js +1 -1
  217. package/lib/utils/createParsedDocument.js +1 -1
  218. package/lib/utils/debounce.js +1 -1
  219. package/lib/utils/debug.js +1 -1
  220. package/lib/utils/dom.js +1 -1
  221. package/lib/utils/environments.js +1 -1
  222. package/lib/utils/helpers.d.ts +2 -2
  223. package/lib/utils/helpers.js +1 -1
  224. package/lib/utils/highlight.js +1 -1
  225. package/lib/utils/isMobile.js +1 -1
  226. package/lib/utils/loadAndBundleSpec.js +1 -1
  227. package/lib/utils/local-storage.js +1 -1
  228. package/lib/utils/object.js +1 -1
  229. package/lib/utils/openapi.d.ts +2 -1
  230. package/lib/utils/openapi.js +1 -1
  231. package/lib/utils/parameters.js +1 -1
  232. package/lib/utils/path.js +1 -1
  233. package/lib/utils/replaceVariables.js +1 -1
  234. package/lib/utils/saveTextBeforeHeading.js +1 -1
  235. package/lib/utils/security-details.js +1 -1
  236. package/lib/utils/session-storage.js +1 -1
  237. package/lib/utils/sort.js +1 -1
  238. package/lib/utils/string.js +1 -1
  239. package/lib/utils/test-utils.js +1 -1
  240. package/lib/utils/theme-helpers.js +2 -2
  241. package/lib-esm/components/ApiInfo/ApiInfo.js +1 -1
  242. package/lib-esm/components/ApiInfo/Metadata.d.ts +3 -1
  243. package/lib-esm/components/ApiInfo/Metadata.js +1 -1
  244. package/lib-esm/components/CallbackSamples/CallbackSamples.d.ts +2 -1
  245. package/lib-esm/components/CallbackSamples/CallbackSamples.js +1 -1
  246. package/lib-esm/components/Callbacks/CallbackDetails.d.ts +2 -1
  247. package/lib-esm/components/Callbacks/CallbackDetails.js +1 -1
  248. package/lib-esm/components/Callbacks/CallbackOperation.js +1 -1
  249. package/lib-esm/components/Callbacks/CallbackSummary.d.ts +3 -2
  250. package/lib-esm/components/Callbacks/CallbackSummary.js +1 -1
  251. package/lib-esm/components/Callbacks/CallbacksList.d.ts +0 -1
  252. package/lib-esm/components/Callbacks/styled.d.ts +1 -1
  253. package/lib-esm/components/Content/Content.d.ts +0 -1
  254. package/lib-esm/components/ContentItem/ContentItem.d.ts +0 -1
  255. package/lib-esm/components/ContentItems/ContentItems.d.ts +0 -1
  256. package/lib-esm/components/Discriminator/Discriminator.d.ts +2 -1
  257. package/lib-esm/components/Discriminator/Discriminator.js +1 -1
  258. package/lib-esm/components/ExpandAllButton/ExpandAllButton.js +1 -1
  259. package/lib-esm/components/ExpandAllButton/getAllNestedSchema.d.ts +4 -4
  260. package/lib-esm/components/ExternalDocumentation/ExternalDocumentation.d.ts +0 -1
  261. package/lib-esm/components/Language/LanguageList.d.ts +0 -1
  262. package/lib-esm/components/Language/styled.d.ts +12 -13
  263. package/lib-esm/components/MediaTypeSwitch/MediaTypesSwitch.js +1 -1
  264. package/lib-esm/components/OperationItem/OperationItem.d.ts +0 -1
  265. package/lib-esm/components/OperationItem/OperationItem.js +2 -2
  266. package/lib-esm/components/Overview/Overview.d.ts +8 -3
  267. package/lib-esm/components/Overview/Overview.js +1 -1
  268. package/lib-esm/components/PageFooter/PageFooter.d.ts +0 -1
  269. package/lib-esm/components/PanelItem/styled.d.ts +5 -6
  270. package/lib-esm/components/PayloadSamples/Example.js +1 -1
  271. package/lib-esm/components/PayloadSamples/ExampleValue.d.ts +0 -1
  272. package/lib-esm/components/PayloadSamples/MediaTypeSamples.d.ts +0 -1
  273. package/lib-esm/components/PayloadSamples/MediaTypeSamples.js +1 -1
  274. package/lib-esm/components/PayloadSamples/PayloadSamples.d.ts +0 -1
  275. package/lib-esm/components/PayloadSamples/PayloadSamples.js +1 -1
  276. package/lib-esm/components/PropertyDetails/DescriptionEnums.d.ts +1 -1
  277. package/lib-esm/components/PropertyDetails/DescriptionEnums.js +1 -1
  278. package/lib-esm/components/PropertyDetails/EnumValues.d.ts +0 -1
  279. package/lib-esm/components/PropertyDetails/EnumValues.js +1 -1
  280. package/lib-esm/components/PropertyDetails/Examples.js +1 -1
  281. package/lib-esm/components/PropertyDetails/Extensions.d.ts +0 -1
  282. package/lib-esm/components/PropertyDetails/FieldDetail.d.ts +1 -1
  283. package/lib-esm/components/PropertyDetails/FieldDetail.js +1 -1
  284. package/lib-esm/components/PropertyDetails/FieldDetails.d.ts +0 -1
  285. package/lib-esm/components/PropertyDetails/FieldDetails.js +4 -3
  286. package/lib-esm/components/PropertyDetails/Pattern.js +1 -1
  287. package/lib-esm/components/PropertyDetails/PropertyDetails.d.ts +0 -1
  288. package/lib-esm/components/PropertyDetails/SimpleEnums.d.ts +1 -1
  289. package/lib-esm/components/PropertyDetails/SimpleEnums.js +1 -1
  290. package/lib-esm/components/PropertyDetails/styled.d.ts +1 -10
  291. package/lib-esm/components/PropertyDetails/types.d.ts +3 -0
  292. package/lib-esm/components/RedoclyOpenAPIDocs/Providers.js +1 -1
  293. package/lib-esm/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
  294. package/lib-esm/components/RedoclyOpenAPIDocs/styled.d.ts +0 -4
  295. package/lib-esm/components/RedoclyOpenAPIDocs/styled.js +1 -30
  296. package/lib-esm/components/RedoclyOpenAPIDocs/types.d.ts +0 -3
  297. package/lib-esm/components/Replay/EmbeddedReplay.d.ts +0 -1
  298. package/lib-esm/components/Replay/EmbeddedReplay.js +1 -1
  299. package/lib-esm/components/Replay/Replay.d.ts +0 -1
  300. package/lib-esm/components/Replay/Replay.js +2 -9
  301. package/lib-esm/components/Request/RequestDetails.d.ts +0 -1
  302. package/lib-esm/components/Request/RequestDetails.js +1 -1
  303. package/lib-esm/components/Request/types.d.ts +2 -0
  304. package/lib-esm/components/RequestParameters/Body.d.ts +0 -1
  305. package/lib-esm/components/RequestParameters/ParametersGroup.d.ts +0 -1
  306. package/lib-esm/components/RequestParameters/RequestParameters.js +1 -1
  307. package/lib-esm/components/RequestSamples/CodeSample.d.ts +0 -1
  308. package/lib-esm/components/RequestSamples/RequestSamples.d.ts +0 -1
  309. package/lib-esm/components/RequestSamples/useCodeSamples.js +1 -1
  310. package/lib-esm/components/ResponseSamples/Summary.js +1 -1
  311. package/lib-esm/components/Responses/OperationResponseList.js +1 -1
  312. package/lib-esm/components/Responses/ResponseDetails.d.ts +0 -1
  313. package/lib-esm/components/Responses/ResponseHeaders.d.ts +0 -1
  314. package/lib-esm/components/Responses/ResponseHeaders.js +1 -1
  315. package/lib-esm/components/Responses/styled.d.ts +1 -2
  316. package/lib-esm/components/RightPanel/RightPanel.js +1 -1
  317. package/lib-esm/components/Schema/ArraySchema.d.ts +0 -1
  318. package/lib-esm/components/Schema/ObjectSchema.d.ts +0 -1
  319. package/lib-esm/components/Schema/ObjectSchema.js +1 -1
  320. package/lib-esm/components/Schema/OneOfSchema.d.ts +0 -1
  321. package/lib-esm/components/Schema/OneOfSchema.js +1 -1
  322. package/lib-esm/components/Schema/RecursiveSchema.d.ts +0 -1
  323. package/lib-esm/components/Schema/RecursiveSchema.js +1 -1
  324. package/lib-esm/components/Schema/Schema.d.ts +0 -1
  325. package/lib-esm/components/Schema/SubSchema.js +1 -1
  326. package/lib-esm/components/Schema/helpers.d.ts +1 -1
  327. package/lib-esm/components/Schema/helpers.js +1 -1
  328. package/lib-esm/components/SchemaDefinition/SchemaDefinition.d.ts +0 -1
  329. package/lib-esm/components/SectionItem/SectionItem.d.ts +0 -1
  330. package/lib-esm/components/Security/OAuthFlow.js +1 -1
  331. package/lib-esm/components/Security/SecurityFlow.js +1 -1
  332. package/lib-esm/components/Security/SecurityModal.js +1 -1
  333. package/lib-esm/components/ServerList/ServerList.d.ts +1 -1
  334. package/lib-esm/components/ServerList/ServerList.js +1 -1
  335. package/lib-esm/components/ServerList/types.d.ts +4 -1
  336. package/lib-esm/components/ServerListDropdown/ServerListDropdown.js +1 -1
  337. package/lib-esm/components/ServerListDropdown/styled.d.ts +0 -1
  338. package/lib-esm/components/SideMenu/SideMenu.d.ts +0 -1
  339. package/lib-esm/components/TagItem/OperationNavigationItems.d.ts +9 -0
  340. package/lib-esm/components/TagItem/OperationNavigationItems.js +37 -0
  341. package/lib-esm/components/TagItem/OperationsNavigation.d.ts +1 -7
  342. package/lib-esm/components/TagItem/OperationsNavigation.js +1 -40
  343. package/lib-esm/components/TagItem/TagItem.js +2 -2
  344. package/lib-esm/components/TagItem/styled.d.ts +1 -0
  345. package/lib-esm/components/TagItem/styled.js +6 -0
  346. package/lib-esm/components/TagItem/types.d.ts +5 -0
  347. package/lib-esm/components/TagItem/types.js +2 -0
  348. package/lib-esm/components/common/Badges.d.ts +2 -2
  349. package/lib-esm/components/common/BodyContent/BodyContent.d.ts +0 -1
  350. package/lib-esm/components/common/BodyContent/BodyContent.js +1 -1
  351. package/lib-esm/components/common/ClearButton/ClearButton.d.ts +0 -1
  352. package/lib-esm/components/common/ClearButton/styled.d.ts +0 -1
  353. package/lib-esm/components/common/ConstraintsView.d.ts +0 -1
  354. package/lib-esm/components/common/ExpandableExample/ExpandableExample.js +1 -1
  355. package/lib-esm/components/common/Extensions.d.ts +0 -1
  356. package/lib-esm/components/common/Fields/fields-layout.d.ts +3 -3
  357. package/lib-esm/components/common/Fields/fields.d.ts +1 -2
  358. package/lib-esm/components/common/Select/Select.d.ts +0 -1
  359. package/lib-esm/components/common/Select/styled.d.ts +11 -12
  360. package/lib-esm/components/common/Skeleton/Skeleton.d.ts +1 -1
  361. package/lib-esm/components/common/panels.d.ts +7 -7
  362. package/lib-esm/components/common/panels.js +2 -2
  363. package/lib-esm/components/pluggable/styled.components.d.ts +3 -3
  364. package/lib-esm/hooks/index.d.ts +1 -0
  365. package/lib-esm/hooks/index.js +1 -1
  366. package/lib-esm/hooks/useRouter.d.ts +1 -1
  367. package/lib-esm/hooks/useTranslate.d.ts +2 -0
  368. package/lib-esm/hooks/useTranslate.js +2 -0
  369. package/lib-esm/jotai/app.d.ts +2 -4
  370. package/lib-esm/jotai/app.js +1 -1
  371. package/lib-esm/models/mediaType.js +1 -1
  372. package/lib-esm/models/tab.d.ts +1 -1
  373. package/lib-esm/services/code-samples/generator.d.ts +3 -1
  374. package/lib-esm/services/code-samples/generator.js +1 -1
  375. package/lib-esm/services/code-samples/httpsnippet/targets/__mocks__/mock.d.ts +46 -0
  376. package/lib-esm/services/code-samples/httpsnippet/targets/__mocks__/mock.js +1 -1
  377. package/lib-esm/services/code-samples/httpsnippet/targets/index.d.ts +2 -2
  378. package/lib-esm/services/code-samples/httpsnippet/targets/java/httpclient.js +1 -1
  379. package/lib-esm/services/code-samples/httpsnippet/targets/java8/apachehttp.js +1 -1
  380. package/lib-esm/services/code-samples/httpsnippet/targets/javascript/fetch.js +1 -1
  381. package/lib-esm/services/code-samples/httpsnippet/targets/javascript/index.d.ts +1 -1
  382. package/lib-esm/services/code-samples/httpsnippet/targets/node/fetch.js +1 -1
  383. package/lib-esm/services/code-samples/httpsnippet/targets/python/requests.js +1 -1
  384. package/lib-esm/services/code-samples/httpsnippet/targets/shell/index.d.ts +1 -1
  385. package/lib-esm/utils/compose.d.ts +1 -1
  386. package/lib-esm/utils/convertExamplesFormat.d.ts +2 -0
  387. package/lib-esm/utils/convertExamplesFormat.js +2 -0
  388. package/lib-esm/utils/helpers.d.ts +2 -2
  389. package/lib-esm/utils/openapi.d.ts +2 -1
  390. package/lib-esm/utils/openapi.js +1 -1
  391. package/package.json +15 -14
  392. package/lib/components/UnsupportedFeatureScreen/UnsupportedFeatureScreen.d.ts +0 -1
  393. package/lib/components/UnsupportedFeatureScreen/UnsupportedFeatureScreen.js +0 -18
  394. package/lib/components/UnsupportedFeatureScreen/index.d.ts +0 -1
  395. package/lib/components/UnsupportedFeatureScreen/index.js +0 -2
  396. package/lib/setupTests.d.ts +0 -2
  397. package/lib/setupTests.js +0 -2
  398. package/lib/testProviders.d.ts +0 -3
  399. package/lib/testProviders.js +0 -2
  400. package/lib-esm/components/UnsupportedFeatureScreen/UnsupportedFeatureScreen.d.ts +0 -1
  401. package/lib-esm/components/UnsupportedFeatureScreen/UnsupportedFeatureScreen.js +0 -18
  402. package/lib-esm/components/UnsupportedFeatureScreen/index.d.ts +0 -1
  403. package/lib-esm/components/UnsupportedFeatureScreen/index.js +0 -2
  404. package/lib-esm/setupTests.d.ts +0 -2
  405. package/lib-esm/setupTests.js +0 -2
  406. package/lib-esm/testProviders.d.ts +0 -3
  407. package/lib-esm/testProviders.js +0 -2
@@ -0,0 +1,37 @@
1
+ import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{joinWithSeparator}from"../../services";import{encodeBackSlashes}from"../../utils";import{HttpVerb,NavigationBadge}from"../common";import{StyledButton}from"./styled";function OperationNavigationItemsComponent({title:e,items:t,onClick:a,routingBasePath:r,translate:o}){return _jsxs(_Fragment,{children:[_jsx(Heading,{children:e}),t.map((({id:e,href:t,httpVerb:i,path:n,deprecated:s,badges:l})=>_jsx(Item,{variant:"outlined",size:"large",onClick:()=>a(joinWithSeparator(r,encodeBackSlashes(t))),children:_jsxs("span",{children:[_jsx(HttpVerb,{color:s?"http-deprecated":i,children:i}),_jsx(Path,{children:n}),s&&_jsx(NavigationBadge,{deprecated:!0,children:o("openapi.badges.deprecated","Deprecated")}),null==l?void 0:l.map((({name:e,color:t})=>_jsx(NavigationBadge,{color:t,children:e},e)))]})},e)))]})}export const OperationNavigationItems=memo(OperationNavigationItemsComponent);const Heading=styled.span`
2
+ font-size: var(--font-size-base);
3
+ line-height: var(--line-height-base);
4
+ font-weight: var(--font-weight-bold);
5
+ color: var(--text-color-primary);
6
+ margin: var(--spacing-sm) 0 var(--spacing-xxs) 0;
7
+ `,Item=styled(StyledButton)`
8
+ border-radius: var(--border-radius);
9
+ background: var(--bg-color);
10
+ justify-content: space-between;
11
+
12
+ & > span {
13
+ display: flex;
14
+ align-items: baseline;
15
+ gap: var(--spacing-unit);
16
+ overflow-x: hidden;
17
+ }
18
+
19
+ &:hover {
20
+ background: var(--bg-color);
21
+ }
22
+
23
+ &:hover::after {
24
+ content: '→';
25
+ line-height: var(--line-height-base);
26
+ }
27
+ `,Path=styled.span`
28
+ font-family: var(--font-family-base);
29
+ font-size: var(--font-size-base);
30
+ line-height: var(--line-height-base);
31
+ color: var(--text-color-primary);
32
+ text-decoration: none;
33
+ white-space: nowrap;
34
+ text-overflow: ellipsis;
35
+ overflow-x: hidden;
36
+ `;
37
+ //# sourceMappingURL=OperationNavigationItems.js.map
@@ -1,9 +1,3 @@
1
- /// <reference types="react" />
2
- import type { OperationMenuItem } from '../../models';
3
- type OperationsNavigationProps = {
4
- items: OperationMenuItem[];
5
- routingBasePath: string;
6
- };
1
+ import type { OperationsNavigationProps } from './types';
7
2
  export declare function OperationsNavigationComponent({ items, routingBasePath, }: OperationsNavigationProps): import("react/jsx-runtime").JSX.Element | null;
8
3
  export declare const OperationsNavigation: import("react").NamedExoticComponent<OperationsNavigationProps>;
9
- export {};
@@ -1,46 +1,7 @@
1
- import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useMemo,memo,useState}from"react";import{useNavigate}from"react-router-dom";import{Button,LayoutVariant}from"@redocly/theme";import styled from"styled-components";import{useAtomValue}from"jotai/index";import{HttpVerb,NavigationBadge,SamplesPanel}from"../common";import{encodeBackSlashes}from"../../utils";import{joinWithSeparator}from"../../services";import{layoutAtom}from"../../jotai/app";const MAX_OPERATIONS=8;export function OperationsNavigationComponent({items:e,routingBasePath:t}){const[o,a]=useState(!1),r=useNavigate(),i=useAtomValue(layoutAtom)===LayoutVariant.STACKED,{operations:n,webhooks:s,count:l}=useMemo((()=>{const t=e.filter((e=>"operation"===e.type)),a=o?t:t.slice(0,MAX_OPERATIONS),{operations:r,webhooks:i}=a.reduce(((e,t)=>t.isWebhook?Object.assign(Object.assign({},e),{webhooks:[...e.webhooks,t]}):Object.assign(Object.assign({},e),{operations:[...e.operations,t]})),{operations:[],webhooks:[]});return{operations:r,webhooks:i,count:!o&&t.length>MAX_OPERATIONS?t.length-MAX_OPERATIONS:0}}),[o,e]);if(!n.length&&!s.length)return null;const p=e=>{r(e)};return _jsxs(Wrapper,{isStacked:i,"data-testid":"operation-navigation-list",children:[n.length>0&&_jsxs(_Fragment,{children:[_jsx(Heading,{children:"Operations"}),n.map((({id:e,href:o,httpVerb:a,path:r,deprecated:i,badges:n})=>_jsx(Item,{variant:"outlined",size:"large",onClick:()=>p(joinWithSeparator(t,encodeBackSlashes(o))),children:_jsxs("span",{children:[_jsx(HttpVerb,{color:i?"http-deprecated":a,children:a}),_jsx(Path,{children:r}),i&&_jsx(NavigationBadge,{deprecated:!0,children:"Deprecated"}),n&&n.map((({name:e,color:t})=>_jsx(NavigationBadge,{color:t,children:e},e)))]})},e)))]}),s.length>0&&_jsxs(_Fragment,{children:[_jsx(Heading,{children:"Webhooks"}),s.map((({id:e,href:o,httpVerb:a,path:r})=>_jsx(Item,{variant:"outlined",size:"large",onClick:()=>p(joinWithSeparator(t,encodeBackSlashes(o))),children:_jsxs("span",{children:[_jsx(HttpVerb,{color:a,children:a}),_jsx(Path,{children:r})]})},e)))]}),!o&&Boolean(l)&&_jsxs(StyledButton,{variant:"link",size:"large","data-testid":"show-more-operations",fullWidth:!0,onClick:()=>a(!0),children:["Show ",l," more..."]})]})}export const OperationsNavigation=memo(OperationsNavigationComponent);const Wrapper=styled(SamplesPanel)`
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useMemo,memo,useState,useCallback}from"react";import{useNavigate}from"react-router-dom";import{LayoutVariant}from"@redocly/theme";import styled from"styled-components";import{useAtomValue}from"jotai/index";import{SamplesPanel}from"../common";import{layoutAtom}from"../../jotai/app";import{OperationNavigationItems}from"./OperationNavigationItems";import{StyledButton}from"./styled";import{useTranslate}from"../../hooks";const MAX_OPERATIONS=8;export function OperationsNavigationComponent({items:o,routingBasePath:t}){const e=useTranslate(),[a,s]=useState(!1),i=useNavigate(),n=useAtomValue(layoutAtom)===LayoutVariant.STACKED,{operations:r,webhooks:p,count:m}=useMemo((()=>{const t=o.filter((o=>"operation"===o.type)),e=a?t:t.slice(0,MAX_OPERATIONS),{operations:s,webhooks:i}=e.reduce(((o,t)=>t.isWebhook?Object.assign(Object.assign({},o),{webhooks:[...o.webhooks,t]}):Object.assign(Object.assign({},o),{operations:[...o.operations,t]})),{operations:[],webhooks:[]});return{operations:s,webhooks:i,count:!a&&t.length>MAX_OPERATIONS?t.length-MAX_OPERATIONS:0}}),[a,o]),l=useCallback((o=>i(o)),[i]);return r.length||p.length?_jsxs(Wrapper,{isStacked:n,"data-testid":"operation-navigation-list",children:[r.length>0&&_jsx(OperationNavigationItems,{items:r,onClick:l,routingBasePath:t,translate:e,title:e("openapi.operations","Operations")}),p.length>0&&_jsx(OperationNavigationItems,{items:p,onClick:l,routingBasePath:t,translate:e,title:e("openapi.webhooks","Webhooks")}),!a&&Boolean(m)&&_jsxs(StyledButton,{variant:"link",size:"large","data-testid":"show-more-operations",fullWidth:!0,onClick:()=>s(!0),children:[e("openapi.actions.show","Show")," ",m," ",e("openapi.actions.more","more"),"..."]})]}):null}export const OperationsNavigation=memo(OperationsNavigationComponent);const Wrapper=styled(SamplesPanel)`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: var(--spacing-xxs);
5
5
  padding-top: var(--spacing-xxl);
6
- `,Heading=styled.span`
7
- font-size: var(--font-size-base);
8
- line-height: var(--line-height-base);
9
- font-weight: var(--font-weight-bold);
10
- color: var(--text-color-primary);
11
- margin: var(--spacing-sm) 0 var(--spacing-xxs) 0;
12
- `,StyledButton=styled(Button)`
13
- & + & {
14
- margin-left: 0;
15
- }
16
- `,Item=styled(StyledButton)`
17
- border-radius: var(--border-radius);
18
- background: var(--bg-color);
19
- justify-content: space-between;
20
-
21
- & > span {
22
- display: flex;
23
- align-items: baseline;
24
- gap: var(--spacing-unit);
25
- overflow-x: hidden;
26
- }
27
-
28
- &:hover {
29
- background: var(--bg-color);
30
- }
31
-
32
- &:hover::after {
33
- content: '→';
34
- line-height: var(--line-height-base);
35
- }
36
- `,Path=styled.span`
37
- font-family: var(--font-family-base);
38
- font-size: var(--font-size-base);
39
- line-height: var(--line-height-base);
40
- color: var(--text-color-primary);
41
- text-decoration: none;
42
- white-space: nowrap;
43
- text-overflow: ellipsis;
44
- overflow-x: hidden;
45
6
  `;
46
7
  //# sourceMappingURL=OperationsNavigation.js.map
@@ -1,6 +1,6 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo,useCallback}from"react";import{breakpoints,Button,H2,LayoutVariant,LinkIcon}from"@redocly/theme";import{useNavigate}from"react-router-dom";import styled from"styled-components";import{useAtomValue}from"jotai";import{Row,SamplesMiddlePanel,ShareLink}from"../common";import{Markdown}from"../Markdown";import{OperationsNavigation}from"./OperationsNavigation";import{layoutAtom}from"../../jotai/app";export function TagItemComponent({item:t,routingBasePath:a="",isExpanded:o}){const{description:i,name:e,href:n}=t,r=useNavigate(),m=useAtomValue(layoutAtom),s=useCallback((()=>{r(a+t.href)}),[t.href,r,a]),d=Boolean(t.items.length),l=m===LayoutVariant.STACKED;return _jsxs(Wrapper,{expanded:o,children:[_jsxs(Row,{layout:m,children:[_jsxs(SamplesMiddlePanel,{fullWidth:!d,isStacked:l,children:[_jsxs(Heading,{children:[_jsx(ShareLink,{to:n,"aria-label":`link to ${e}`}),e]}),_jsx(Markdown,{source:i})]}),d&&_jsx(OperationsNavigation,{items:t.items,routingBasePath:a})]}),d&&!o&&_jsx(ShowButton,{type:"button",variant:"text",size:"medium",onClick:s,children:"+ Show"})]})}export const TagItem=memo(TagItemComponent);const Wrapper=styled.div`
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo,useCallback}from"react";import{breakpoints,Button,H2,LayoutVariant,LinkIcon}from"@redocly/theme";import{useNavigate}from"react-router-dom";import styled from"styled-components";import{useAtomValue}from"jotai";import{Row,SamplesMiddlePanel,ShareLink}from"../common";import{Markdown}from"../Markdown";import{OperationsNavigation}from"./OperationsNavigation";import{layoutAtom}from"../../jotai/app";import{useTranslate}from"../../hooks";export function TagItemComponent({item:a,routingBasePath:t="",isExpanded:o}){const e=useTranslate(),{description:i,name:n,href:r}=a,s=useNavigate(),m=useAtomValue(layoutAtom),d=useCallback((()=>{s(t+a.href)}),[a.href,s,t]),l=Boolean(a.items.length),p=m===LayoutVariant.STACKED;return _jsxs(Wrapper,{expanded:o,children:[_jsxs(Row,{layout:m,children:[_jsxs(SamplesMiddlePanel,{fullWidth:!l,isStacked:p,children:[_jsxs(Heading,{children:[_jsx(ShareLink,{to:r,"aria-label":`link to ${n}`}),n]}),_jsx(Markdown,{source:i})]}),l&&_jsx(OperationsNavigation,{items:a.items,routingBasePath:t})]}),l&&!o&&_jsxs(ShowButton,{type:"button",variant:"text",size:"medium",onClick:d,children:["+ ",e("openapi.actions.show","Show")]})]})}export const TagItem=memo(TagItemComponent);const Wrapper=styled.div`
2
2
  padding-top: var(--spacing-lg);
3
- padding-bottom: ${({expanded:t})=>t?"var(--spacing-xxl)":""};
3
+ padding-bottom: ${({expanded:a})=>a?"var(--spacing-xxl)":""};
4
4
  `,ShowButton=styled(Button)`
5
5
  margin: var(--spacing-md) var(--spacing-xl) var(--spacing-xxs);
6
6
  width: calc(100% - var(--spacing-xl) * 2);
@@ -0,0 +1 @@
1
+ export declare const StyledButton: import("styled-components").StyledComponent<import("react").FC<import("@redocly/theme").ButtonProps>, any, import("@redocly/theme").ButtonProps, never>;
@@ -0,0 +1,6 @@
1
+ import styled from"styled-components";import{Button}from"@redocly/theme";export const StyledButton=styled(Button)`
2
+ & + & {
3
+ margin-left: 0;
4
+ }
5
+ `;
6
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,5 @@
1
+ import type { OperationMenuItem } from '../../models';
2
+ export type OperationsNavigationProps = {
3
+ items: OperationMenuItem[];
4
+ routingBasePath: string;
5
+ };
@@ -0,0 +1,2 @@
1
+ export{};
2
+ //# sourceMappingURL=types.js.map
@@ -7,7 +7,7 @@ interface CustomBadgesProps {
7
7
  export declare const CustomBadges: import("react").NamedExoticComponent<PropsWithChildren<CustomBadgesProps>>;
8
8
  export declare const StyledBadge: import("styled-components").StyledComponent<typeof Badge, any, {}, never>;
9
9
  export declare const NavigationBadge: import("styled-components").StyledComponent<typeof Badge, any, {
10
- deprecated?: boolean | undefined;
11
- color?: string | undefined;
10
+ deprecated?: boolean;
11
+ color?: string;
12
12
  }, never>;
13
13
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MediaContentModel } from '../../../models';
3
2
  interface BodyContentProps {
4
3
  skipReadOnly?: boolean;
@@ -1,4 +1,4 @@
1
- import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{useAtom}from"jotai";import{LinkIcon}from"@redocly/theme";import{Dropdown}from"../Dropdown";import{RequiredLabel}from"../Fields";import{ConstraintsView}from"../ConstraintsView";import{Schema}from"../../Schema";import{getActiveMediaType}from"../../../models";import{Markdown}from"../../Markdown";import{activeMimeNameAtom}from"../../../jotai/app";import{LinkToField}from"../LinkToField";function BodyContentComponent({required:e,skipReadOnly:o,skipWriteOnly:i,description:t,content:n,deepLink:r}){const[a,s]=useAtom(activeMimeNameAtom);if(!n)return null;const{schema:m,examples:l,operation:p,name:d}=getActiveMediaType(n,a),c=n.mediaTypes.map((({name:e})=>({label:e,value:e})));return _jsxs(_Fragment,{children:[_jsxs(Title,{children:[r&&_jsx(LinkToField,{to:r}),"Body",_jsx(Dropdown,{options:c,value:d,triggerVariant:"ghost",triggerSize:"large",onChange:({value:e})=>s(e)})]}),e&&_jsx(RequiredLabel,{children:"required"}),_jsx(StyledMarkdown,{source:t}),"object"===(null==m?void 0:m.type)&&(null==m?void 0:m.constraints)&&_jsx(ConstraintsView,{constraints:(null==m?void 0:m.constraints)||[]}),_jsx(Schema,{skipReadOnly:o,skipWriteOnly:i,schema:m,examples:l,operation:p,level:1,disableDeepLinks:!r},"schema")]})}export const BodyContent=memo(BodyContentComponent);const StyledMarkdown=styled(Markdown)`
1
+ import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{useAtom}from"jotai";import{LinkIcon}from"@redocly/theme";import{Dropdown}from"../Dropdown";import{RequiredLabel}from"../Fields";import{ConstraintsView}from"../ConstraintsView";import{Schema}from"../../Schema";import{getActiveMediaType}from"../../../models";import{Markdown}from"../../Markdown";import{activeMimeNameAtom}from"../../../jotai/app";import{LinkToField}from"../LinkToField";import{useTranslate}from"../../../hooks";function BodyContentComponent({required:e,skipReadOnly:o,skipWriteOnly:i,description:t,content:n,deepLink:r}){const a=useTranslate(),[s,m]=useAtom(activeMimeNameAtom);if(!n)return null;const{schema:l,examples:p,operation:d,name:c}=getActiveMediaType(n,s),g=n.mediaTypes.map((({name:e})=>({label:e,value:e})));return _jsxs(_Fragment,{children:[_jsxs(Title,{children:[r&&_jsx(LinkToField,{to:r}),a("openapi.body","Body"),_jsx(Dropdown,{options:g,value:c,triggerVariant:"ghost",triggerSize:"large",onChange:({value:e})=>m(e)})]}),e&&_jsx(RequiredLabel,{children:a("openapi.badges.required","required")}),_jsx(StyledMarkdown,{source:t}),"object"===(null==l?void 0:l.type)&&(null==l?void 0:l.constraints)&&_jsx(ConstraintsView,{constraints:(null==l?void 0:l.constraints)||[]}),_jsx(Schema,{skipReadOnly:o,skipWriteOnly:i,schema:l,examples:p,operation:d,level:1,disableDeepLinks:!r},"schema")]})}export const BodyContent=memo(BodyContentComponent);const StyledMarkdown=styled(Markdown)`
2
2
  margin: var(--spacing-xxs) 0 0;
3
3
  `,Title=styled.span`
4
4
  position: relative;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { ClearButtonProps } from './types';
3
2
  export declare const ClearButton: import("react").NamedExoticComponent<ClearButtonProps>;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ClearButton: import("styled-components").StyledComponent<import("react").NamedExoticComponent<import("./types").ClearButtonProps>, any, {}, never>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface ConstraintsViewProps {
3
2
  constraints: string[];
4
3
  }
@@ -1,4 +1,4 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import styled from"styled-components";import{Button}from"@redocly/theme";import{useMemo,useState}from"react";import{Markdown}from"../../Markdown";import{ExampleValue}from"../Fields";const MAX_EXAMPLE_LENGTH=150;export function ExpandableExample({value:e}){const[t,s]=useState(!1),n=useMemo((()=>e.slice(0,MAX_EXAMPLE_LENGTH)),[e]);return _jsxs(Container,{children:[_jsx(Markdown,{source:t?e:n}),(e!==n||t)&&_jsx(ButtonWrap,{children:_jsx(Button,{variant:"link",size:"small",onClick:()=>{s(!t)},children:t?"Hide example":"Show example"})})]})}const Container=styled(ExampleValue)`
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import styled from"styled-components";import{Button}from"@redocly/theme";import{useMemo,useState}from"react";import{Markdown}from"../../Markdown";import{ExampleValue}from"../Fields";import{useTranslate}from"../../../hooks";const MAX_EXAMPLE_LENGTH=150;export function ExpandableExample({value:e}){const s=useTranslate(),[o,a]=useState(!1),t=useMemo((()=>e.slice(0,MAX_EXAMPLE_LENGTH)),[e]);return _jsxs(Container,{children:[_jsx(Markdown,{source:o?e:t}),(e!==t||o)&&_jsx(ButtonWrap,{children:_jsx(Button,{variant:"link",size:"small",onClick:()=>{a(!o)},children:o?s("openapi.hideExample","Hide example"):s("openapi.showExample","Show example")})})]})}const Container=styled(ExampleValue)`
2
2
  display: inline;
3
3
 
4
4
  & * {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface ExtensionsProps {
3
2
  extensions: {
4
3
  [k: string]: string | Record<string, unknown>;
@@ -1,13 +1,13 @@
1
1
  export declare const getCssVariable: (variable: string) => string;
2
2
  export declare const PropertiesTableCaption: import("styled-components").StyledComponent<"caption", any, {}, never>;
3
3
  export declare const PropertyCell: import("styled-components").StyledComponent<"td", any, {
4
- kind?: string | undefined;
4
+ kind?: string;
5
5
  }, never>;
6
6
  export declare const PropertyCellWithInner: import("styled-components").StyledComponent<"td", any, {
7
- kind?: string | undefined;
7
+ kind?: string;
8
8
  }, never>;
9
9
  export declare const PropertyNameCell: import("styled-components").StyledComponent<"td", any, {
10
- kind?: string | undefined;
10
+ kind?: string;
11
11
  }, never>;
12
12
  export declare const PropertyDetailsCell: import("styled-components").StyledComponent<"td", any, {}, never>;
13
13
  export declare const PropertyBullet: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const FieldLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
3
2
  export declare const TypePrefix: import("styled-components").StyledComponent<"span", any, {}, never>;
4
3
  export declare const TypeName: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -36,4 +35,4 @@ export declare const ConstraintItem: import("styled-components").StyledComponent
36
35
  export declare const ToggleButton: import("styled-components").StyledComponent<import("react").FC<import("@redocly/theme").ButtonProps>, any, import("@redocly/theme").ButtonProps & {
37
36
  variant: "link";
38
37
  size: "small";
39
- }, "variant" | "size">;
38
+ }, "size" | "variant">;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { SelectProps } from './types';
3
2
  export declare const Select: import("react").NamedExoticComponent<SelectProps>;
@@ -1,23 +1,22 @@
1
- /// <reference types="react" />
2
1
  import type { SelectProps } from './types';
3
2
  export declare const Select: import("styled-components").StyledComponent<import("react").NamedExoticComponent<SelectProps>, any, SelectProps & {
4
- fullWidth?: boolean | undefined;
5
- variant?: "dark" | "light" | undefined;
3
+ fullWidth?: boolean;
4
+ variant?: "dark" | "light";
6
5
  }, never>;
7
6
  export declare const SimpleSelect: import("styled-components").StyledComponent<import("react").NamedExoticComponent<SelectProps>, any, SelectProps & {
8
- fullWidth?: boolean | undefined;
9
- variant?: "dark" | "light" | undefined;
7
+ fullWidth?: boolean;
8
+ variant?: "dark" | "light";
10
9
  }, never>;
11
10
  export declare const CollapsingSelect: import("styled-components").StyledComponent<import("react").NamedExoticComponent<SelectProps>, any, SelectProps & {
12
- fullWidth?: boolean | undefined;
13
- variant?: "dark" | "light" | undefined;
11
+ fullWidth?: boolean;
12
+ variant?: "dark" | "light";
14
13
  } & {
15
- active?: boolean | undefined;
14
+ active?: boolean;
16
15
  }, never>;
17
- export declare const Arrow: import("styled-components").StyledComponent<(props: import("@redocly/theme/lib/icons/types").IconProps) => import("react").JSX.Element, any, {
16
+ export declare const Arrow: import("styled-components").StyledComponent<(props: import("@redocly/theme/lib/icons/types").IconProps) => React.JSX.Element, any, {
18
17
  'data-component-name': string;
19
18
  } & {
20
- color?: string | undefined;
21
- size?: string | undefined;
22
- className?: string | undefined;
19
+ color?: string;
20
+ size?: string;
21
+ className?: string;
23
22
  } & import("react").SVGProps<SVGSVGElement>, "data-component-name">;
@@ -1,5 +1,5 @@
1
1
  import type { ReactElement } from 'react';
2
2
  export declare const SkeletonBox: import("styled-components").StyledComponent<"div", any, {
3
- width?: string | undefined;
3
+ width?: string;
4
4
  }, never>;
5
5
  export declare function Skeleton(): ReactElement;
@@ -1,17 +1,17 @@
1
1
  import { LayoutVariant } from '@redocly/theme';
2
2
  export declare const SamplesMiddlePanel: import("styled-components").StyledComponent<"div", any, {
3
- compact?: boolean | undefined;
4
- isStacked?: boolean | undefined;
5
- fullWidth?: boolean | undefined;
3
+ compact?: boolean;
4
+ isStacked?: boolean;
5
+ fullWidth?: boolean;
6
6
  }, never>;
7
7
  export declare const Section: import("styled-components").StyledComponent<"div", any, {
8
- underlined?: boolean | undefined;
9
- sectionId?: string | undefined;
10
- expanded?: boolean | undefined;
8
+ underlined?: boolean;
9
+ sectionId?: string;
10
+ expanded?: boolean;
11
11
  }, never>;
12
12
  export declare const SamplesPanel: import("styled-components").StyledComponent<"div", any, {
13
13
  isStacked: boolean;
14
14
  }, never>;
15
15
  export declare const Row: import("styled-components").StyledComponent<"div", any, {
16
- layout?: LayoutVariant | undefined;
16
+ layout?: LayoutVariant;
17
17
  }, never>;
@@ -10,7 +10,7 @@ import{H2,LayoutVariant,breakpoints,Markdown}from"@redocly/theme";import styled,
10
10
  }
11
11
 
12
12
  @media screen and (min-width: ${breakpoints.large}) {
13
- width: ${t?"100%":"calc(100% - var(--panel-samples-width))"};
13
+ width: ${t||i?"100%":"calc(100% - var(--panel-samples-width))"};
14
14
  padding-left: ${i?"var(--panel-gap-horizontal)":"calc(var(--panel-gap-horizontal) * 2)"};
15
15
  padding-right: ${i?"var(--panel-gap-vertical)":"var(--panel-gap-horizontal)"};
16
16
  padding-top: 0;
@@ -93,7 +93,7 @@ import{H2,LayoutVariant,breakpoints,Markdown}from"@redocly/theme";import styled,
93
93
  }
94
94
 
95
95
  @media screen and (min-width: ${breakpoints.large}) {
96
- width: var(--panel-samples-width);
96
+ width: ${({isStacked:a})=>a?"100%":"var(--panel-samples-width)"};
97
97
  padding-top: 0;
98
98
  padding-bottom: 0;
99
99
  padding-left: ${({isStacked:a})=>a?"var(--panel-gap-vertical)":"var(--panel-gap-horizontal)"};
@@ -1,7 +1,7 @@
1
1
  export declare const SamplesWrap: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const ExamplesWrap: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const FullWidthPanel: import("styled-components").StyledComponent<"div", any, {
4
- compact?: boolean | undefined;
5
- isStacked?: boolean | undefined;
6
- fullWidth?: boolean | undefined;
4
+ compact?: boolean;
5
+ isStacked?: boolean;
6
+ fullWidth?: boolean;
7
7
  }, never>;
@@ -5,3 +5,4 @@ export { useRouter } from './useRouter';
5
5
  export { useContentItems } from './useContentItems';
6
6
  export { useActiveWithFallback } from './useActiveWithFallback';
7
7
  export { useUppercase2LowercaseRedirect } from './useUppercase2LowercaseRedirect';
8
+ export { useTranslate } from './useTranslate';
@@ -1,2 +1,2 @@
1
- export{useDimensions}from"./useDimensions";export{usePrevious}from"./usePrevious";export{useActivateExample}from"./useActivateExample";export{useRouter}from"./useRouter";export{useContentItems}from"./useContentItems";export{useActiveWithFallback}from"./useActiveWithFallback";export{useUppercase2LowercaseRedirect}from"./useUppercase2LowercaseRedirect";
1
+ export{useDimensions}from"./useDimensions";export{usePrevious}from"./usePrevious";export{useActivateExample}from"./useActivateExample";export{useRouter}from"./useRouter";export{useContentItems}from"./useContentItems";export{useActiveWithFallback}from"./useActiveWithFallback";export{useUppercase2LowercaseRedirect}from"./useUppercase2LowercaseRedirect";export{useTranslate}from"./useTranslate";
2
2
  //# sourceMappingURL=index.js.map
@@ -6,7 +6,7 @@ interface RouterProps {
6
6
  }
7
7
  export declare const useRouter: (router: RouterType, basePath: string) => {
8
8
  Router: ComponentType<{
9
- children?: import("react").ReactNode;
9
+ children?: import("react").ReactNode | undefined;
10
10
  }>;
11
11
  routerProps: RouterProps;
12
12
  };
@@ -0,0 +1,2 @@
1
+ import type { TFunction } from '@redocly/theme';
2
+ export declare function useTranslate(): TFunction;
@@ -0,0 +1,2 @@
1
+ import{useThemeHooks}from"@redocly/theme";export function useTranslate(){const{translate:e}=useThemeHooks().useTranslate();return e}
2
+ //# sourceMappingURL=useTranslate.js.map
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { LayoutVariant } from '@redocly/theme';
3
2
  import type { AsyncLocalStorage } from 'node:async_hooks';
4
3
  import type { TabType } from '../models/tab';
@@ -30,8 +29,8 @@ export declare const appStoreOverrideAtom: import("jotai").PrimitiveAtom<Partial
30
29
  };
31
30
  export declare const environmentsAtom: import("jotai").Atom<import("../utils/environments").EnvironmentData>;
32
31
  export declare const environmentAtom: import("jotai").WritableAtom<[Record<string, string>, string], [{
33
- environment?: string | undefined;
34
- environments?: Record<string, Record<string, string>> | undefined;
32
+ environment?: string;
33
+ environments?: Record<string, Record<string, string>>;
35
34
  }], void>;
36
35
  export declare const isSidebarOpenedAtom: import("jotai").WritableAtom<boolean, boolean[], void>;
37
36
  export declare const activeMimeNameAtom: import("jotai").WritableAtom<string, [string], void>;
@@ -46,5 +45,4 @@ export declare function getLangKey({ lang, label }: {
46
45
  label?: string;
47
46
  }): string;
48
47
  export declare const languageAtom: import("jotai").WritableAtom<LanguageAtom, [string], void>;
49
- export declare const unsupportedFeatureScreenAtom: import("jotai").WritableAtom<boolean, boolean[], void>;
50
48
  export {};
@@ -1,2 +1,2 @@
1
- var __rest=this&&this.__rest||function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o};import{atom}from"jotai";import{atomWithStorage,createJSONStorage}from"jotai/utils";import{LayoutVariant,IS_BROWSER}from"@redocly/theme";import{getCookie,setCookie,removeCookie}from"../utils/cookies";import{globalOptionsAtom}from"./store";import{mergeEnvData}from"../utils/environments";import{fromSessionStorage,safeJsonParse,toSessionStorage}from"../utils";const defaultAppStoreValue={isSidebarOpened:!0,activeMimeName:"",layout:LayoutVariant.THREE_PANEL,language:"",environment:"",environments:{}},customStorage={getItem:e=>{var t,o;const n=safeJsonParse(getCookie(e,null===(o=null===(t=globalThis.redoclyCookieStorage)||void 0===t?void 0:t.getStore)||void 0===o?void 0:o.call(t))),r=safeJsonParse(fromSessionStorage(e));return Object.assign(Object.assign(Object.assign({},defaultAppStoreValue),r),n)},setItem:(e,t)=>{const{environments:o,layout:n}=t,r=__rest(t,["environments","layout"]),a={environments:o};setCookie(e,JSON.stringify(r)),toSessionStorage(e,JSON.stringify(a))},removeItem:e=>{removeCookie(e),sessionStorage.removeItem(e)}};export const appStore=atomWithStorage("redoc.appStore",defaultAppStoreValue,customStorage);export const appStoreOverrideAtom=atom({});export const environmentsAtom=atom((e=>{const t=e(appStore),o=e(appStoreOverrideAtom);return mergeEnvData(t.environments,(null==o?void 0:o.environments)||{})}));export const environmentAtom=atom((e=>{const t=e(appStore),o=e(appStoreOverrideAtom),n=mergeEnvData(t.environments,(null==o?void 0:o.environments)||{}),r=(null==o?void 0:o.environment)||t.environment,a=n[r]?r:Object.keys(n)[0];return[n[a]||{},a||""]}),((e,t,{environment:o,environments:n})=>{const r=e(appStore);t(appStore,Object.assign(Object.assign({},r),{environment:o||r.environment,environments:mergeEnvData(r.environments||{},n)}))}));export const isSidebarOpenedAtom=atom((e=>e(appStore).isSidebarOpened),((e,t,o)=>{const n=e(appStore);t(appStore,Object.assign(Object.assign({},n),{isSidebarOpened:o}))}));export const activeMimeNameAtom=atom((e=>e(appStore).activeMimeName),((e,t,o)=>{const n=e(appStore);t(appStore,Object.assign(Object.assign({},n),{activeMimeName:o}))}));export const layoutAtom=atom((e=>e(appStore).layout),((e,t,o=LayoutVariant.STACKED)=>{const n=e(appStore);t(appStore,Object.assign(Object.assign({},n),{layout:o}))}));export const appSessionStore=atomWithStorage("redoc.appSessionStore",{collapsedSidebar:!1,unsupportedFeatureScreen:!1},IS_BROWSER?createJSONStorage((()=>sessionStorage)):void 0);export const collapsedSidebarAtom=atom((e=>e(appSessionStore).collapsedSidebar),((e,t,o)=>{const n=e(appSessionStore);t(appSessionStore,Object.assign(Object.assign({},n),{collapsedSidebar:o}))}));export function getLangKey({lang:e,label:t}){return(t||e).toLowerCase()}export const languageAtom=atom((e=>{var t;const{codeSamples:o}=e(globalOptionsAtom),n=o.languages.map((({lang:e,label:t},o)=>({key:getLangKey({lang:e,label:t}),lang:e,title:t||e,order:o}))),r=e(appStore).language||n[0].key;return{languages:n,activeLanguage:(null===(t=n.find((({key:e})=>e===r)))||void 0===t?void 0:t.key)||n[0].key}}),((e,t,o)=>{const n=e(appStore);t(appStore,Object.assign(Object.assign({},n),{language:o}))}));export const unsupportedFeatureScreenAtom=atom((e=>e(appSessionStore).unsupportedFeatureScreen),((e,t,o)=>{const n=e(appSessionStore);t(appSessionStore,Object.assign(Object.assign({},n),{unsupportedFeatureScreen:o}))}));
1
+ var __rest=this&&this.__rest||function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o};import{atom}from"jotai";import{atomWithStorage,createJSONStorage}from"jotai/utils";import{IS_BROWSER,LayoutVariant}from"@redocly/theme";import{getCookie,removeCookie,setCookie}from"../utils/cookies";import{globalOptionsAtom}from"./store";import{mergeEnvData}from"../utils/environments";import{fromSessionStorage,safeJsonParse,toSessionStorage}from"../utils";const defaultAppStoreValue={isSidebarOpened:!0,activeMimeName:"",layout:LayoutVariant.THREE_PANEL,language:"",environment:"",environments:{}},customStorage={getItem:e=>{var t,o;const n=safeJsonParse(getCookie(e,null===(o=null===(t=globalThis.redoclyCookieStorage)||void 0===t?void 0:t.getStore)||void 0===o?void 0:o.call(t))),r=safeJsonParse(fromSessionStorage(e));return Object.assign(Object.assign(Object.assign({},defaultAppStoreValue),r),n)},setItem:(e,t)=>{const{environments:o}=t,n=__rest(t,["environments"]),r={environments:o};setCookie(e,JSON.stringify(n)),toSessionStorage(e,JSON.stringify(r))},removeItem:e=>{removeCookie(e),sessionStorage.removeItem(e)}};export const appStore=atomWithStorage("redoc.appStore",defaultAppStoreValue,customStorage);export const appStoreOverrideAtom=atom({});export const environmentsAtom=atom((e=>{const t=e(appStore),o=e(appStoreOverrideAtom);return mergeEnvData(t.environments,(null==o?void 0:o.environments)||{})}));export const environmentAtom=atom((e=>{const t=e(appStore),o=e(appStoreOverrideAtom),n=mergeEnvData(t.environments,(null==o?void 0:o.environments)||{}),r=(null==o?void 0:o.environment)||t.environment,a=n[r]?r:Object.keys(n)[0];return[n[a]||{},a||""]}),((e,t,{environment:o,environments:n})=>{const r=e(appStore);t(appStore,Object.assign(Object.assign({},r),{environment:o||r.environment,environments:mergeEnvData(r.environments||{},n)}))}));export const isSidebarOpenedAtom=atom((e=>e(appStore).isSidebarOpened),((e,t,o)=>{const n=e(appStore);t(appStore,Object.assign(Object.assign({},n),{isSidebarOpened:o}))}));export const activeMimeNameAtom=atom((e=>e(appStore).activeMimeName),((e,t,o)=>{const n=e(appStore);t(appStore,Object.assign(Object.assign({},n),{activeMimeName:o}))}));export const layoutAtom=atom((e=>e(appStore).layout),((e,t,o=LayoutVariant.STACKED)=>{const n=e(appStore);t(appStore,Object.assign(Object.assign({},n),{layout:o}))}));export const appSessionStore=atomWithStorage("redoc.appSessionStore",{collapsedSidebar:!1,unsupportedFeatureScreen:!1},IS_BROWSER?createJSONStorage((()=>sessionStorage)):void 0);export const collapsedSidebarAtom=atom((e=>e(appSessionStore).collapsedSidebar),((e,t,o)=>{const n=e(appSessionStore);t(appSessionStore,Object.assign(Object.assign({},n),{collapsedSidebar:o}))}));export function getLangKey({lang:e,label:t}){return(t||e).toLowerCase()}export const languageAtom=atom((e=>{var t;const{codeSamples:o}=e(globalOptionsAtom),n=o.languages.map((({lang:e,label:t},o)=>({key:getLangKey({lang:e,label:t}),lang:e,title:t||e,order:o}))),r=e(appStore).language||n[0].key;return{languages:n,activeLanguage:(null===(t=n.find((({key:e})=>e===r)))||void 0===t?void 0:t.key)||n[0].key}}),((e,t,o)=>{const n=e(appStore);t(appStore,Object.assign(Object.assign({},n),{language:o}))}));
2
2
  //# sourceMappingURL=app.js.map
@@ -1,2 +1,2 @@
1
- import*as Sampler from"openapi-sampler";import{getSchema}from"./schema";import{isFormUrlEncoded,isJsonLike,isMultipartFormData,JsonPointer,mapValues}from"../utils";import{getExamples}from"./example";function generateExamples({parser:e,info:{encoding:a,schema:s},schema:i,mime:r,isRequestType:n,onlyRequiredInSamples:o,generatedSamplesMaxDepth:t}){const m={skipReadOnly:n,skipWriteOnly:!n,skipNonRequired:n&&o,maxSampleDepth:t,quiet:!0};let p={};if(i&&i.oneOf)for(const s of i.oneOf){const n=Sampler.sample(s.rawSchema,m,e.definition);i.discriminatorProp&&"object"==typeof n&&n&&n[i.discriminatorProp]&&(n[i.discriminatorProp]=s.title),p[s.title]=getExamples({parser:e,infoOrRef:{value:n},mime:r,encoding:a})}else p=i?{default:getExamples({parser:e,infoOrRef:{value:Sampler.sample(s,m,e.definition)},mime:r,encoding:a})}:{default:{value:null,rawValue:"null"}};return p}export function getMediaType(e,a,s,i,r,{operation:n,type:o,response:t,absolutePointer:m=""}){let p,l;const d=i.schema&&getSchema({parser:e,schemaOrRef:i.schema,pointer:"",absolutePointer:JsonPointer.join(m,["content",a,"schema"]),options:r,deps:{operation:n,type:o,response:t}}),{onlyRequiredInSamples:u,generatedSamplesMaxDepth:c}=r,{encoding:f,examples:g,example:x}=i;return r.unstable_skipSamples||(void 0!==g?p=mapValues(g,(s=>getExamples({parser:e,infoOrRef:s,mime:a,encoding:f}))):void 0!==x?p={default:getExamples({parser:e,infoOrRef:{value:e.deref(x).resolved},mime:a,encoding:f})}:isJsonLike(a)?p=generateExamples({parser:e,info:i,schema:d,mime:a,isRequestType:s,onlyRequiredInSamples:u,generatedSamplesMaxDepth:c}):(isFormUrlEncoded(a)||isMultipartFormData(a))&&(l=generateExamples({parser:e,info:i,schema:d,mime:a,isRequestType:s,onlyRequiredInSamples:u,generatedSamplesMaxDepth:c}))),{examples:p,schema:d,name:a,isRequestType:s,formExamples:l,onlyRequiredInSamples:u,operation:n}}
1
+ import*as Sampler from"openapi-sampler";import{getSchema}from"./schema";import{isFormUrlEncoded,isJsonLike,isXmlLike,isMultipartFormData,JsonPointer,mapValues}from"../utils";import{getExamples}from"./example";function generateExamples({parser:e,info:{encoding:a,schema:i},schema:s,mime:r,isRequestType:n,onlyRequiredInSamples:o,generatedSamplesMaxDepth:m}){const t={skipReadOnly:n,skipWriteOnly:!n,skipNonRequired:n&&o,maxSampleDepth:m,quiet:!0};let p={};if(s&&s.oneOf)for(const i of s.oneOf){const n=Sampler.sample(i.rawSchema,t,e.definition);s.discriminatorProp&&"object"==typeof n&&n&&n[s.discriminatorProp]&&(n[s.discriminatorProp]=i.title),p[i.title]=getExamples({parser:e,infoOrRef:{value:n},mime:r,encoding:a})}else p=s?{default:getExamples({parser:e,infoOrRef:{value:Sampler.sample(i,t,e.definition)},mime:r,encoding:a})}:{default:{value:null,rawValue:"null"}};return p}export function getMediaType(e,a,i,s,r,{operation:n,type:o,response:m,absolutePointer:t=""}){let p,l;const d=s.schema&&getSchema({parser:e,schemaOrRef:s.schema,pointer:"",absolutePointer:JsonPointer.join(t,["content",a,"schema"]),options:r,deps:{operation:n,type:o,response:m}}),{onlyRequiredInSamples:u,generatedSamplesMaxDepth:c}=r,{encoding:f,examples:g,example:x}=s;return r.unstable_skipSamples||(void 0!==g?p=mapValues(g,(i=>getExamples({parser:e,infoOrRef:i,mime:a,encoding:f}))):void 0!==x?p={default:getExamples({parser:e,infoOrRef:{value:e.deref(x).resolved},mime:a,encoding:f})}:isJsonLike(a)||isXmlLike(a)?p=generateExamples({parser:e,info:s,schema:d,mime:a,isRequestType:i,onlyRequiredInSamples:u,generatedSamplesMaxDepth:c}):(isFormUrlEncoded(a)||isMultipartFormData(a))&&(l=generateExamples({parser:e,info:s,schema:d,mime:a,isRequestType:i,onlyRequiredInSamples:u,generatedSamplesMaxDepth:c}))),{examples:p,schema:d,name:a,isRequestType:i,formExamples:l,onlyRequiredInSamples:u,operation:n}}
2
2
  //# sourceMappingURL=mediaType.js.map
@@ -1,4 +1,4 @@
1
- export type TabType<T extends Object = {}> = {
1
+ export type TabType<T extends object = object> = {
2
2
  title: string;
3
3
  key: string;
4
4
  } & T;
@@ -1,6 +1,7 @@
1
1
  import type { OperationModel } from '../../models';
2
2
  import type * as HAR from './har';
3
3
  import type { Languages } from './types';
4
+ import type { TFunction } from '@redocly/theme';
4
5
  export type CustomHAR = HAR.Request & {
5
6
  securityOAuth2ExtraCalls?: HAR.Request[];
6
7
  basicAuth?: {
@@ -13,7 +14,7 @@ export type CustomHAR = HAR.Request & {
13
14
  serverVariables?: Record<string, string>;
14
15
  allResponseCodes?: string[];
15
16
  };
16
- export declare function getCodeSample({ lang, operation, exampleName, pathParams, properties, options, environment, }: {
17
+ export declare function getCodeSample({ lang, operation, exampleName, pathParams, properties, options, environment, translate, }: {
17
18
  lang: Languages;
18
19
  operation: OperationModel;
19
20
  exampleName?: string;
@@ -21,6 +22,7 @@ export declare function getCodeSample({ lang, operation, exampleName, pathParams
21
22
  properties?: GenericObject;
22
23
  options?: GenericObject;
23
24
  environment: Record<string, string>;
25
+ translate: TFunction;
24
26
  }): string;
25
27
  export declare function isDefined<T>(arg?: T): arg is T;
26
28
  export declare function capitalizeFirst(str: string): string;
@@ -1,2 +1,2 @@
1
- import*as Sampler from"openapi-sampler";import merge from"deepmerge";import{areArraysEqual,serializeParameterValue,getSecurityDetails,getParameterValue,queryString,isArrayOfObjects,deleteEmptyArrayItem}from"../../utils";import{normalizeMimeType,arrayMergeStrategy}from"../utils";import{MediaTypes}from"../../constants";import{HTTPSnippet}from"./httpsnippet";import{getActiveMediaType}from"../../models/mediaContent";import StringUtility from"./httpsnippet/helpers/string-utility";function getSelectedSecurityScheme(e,t){return e.find((e=>{const a=e.schemes.map((e=>e.id));return areArraysEqual(a,t||[])}))}function mapOperationToHAR(e,{exampleName:t="",skipOptionalParameters:a=!1,withOAuth2Call:r=!1,spec:s,generatedPayloadSamplesMaxDepth:i=8,pathParams:n={},properties:o={}},{environment:l,requestValues:u,activeSecuritySchemeIds:p}){var c,d,m;const h=l.server,y=e.servers.find((e=>e.url===h))||e.servers[0],f=getSelectedSecurityScheme(e.security,p),{securityHeaders:g,securityCookies:v,securityQueries:O,securityOAuth2ExtraCalls:S,basicAuth:T}=getSecurityData(f||(null===(c=e.security)||void 0===c?void 0:c[0]),r,l),C=(null===(d=null==e?void 0:e.requestBody)||void 0===d?void 0:d.content)&&getActiveMediaType(e.requestBody.content),b={skipNonRequired:a,skipReadOnly:!0,maxSampleDepth:i,quiet:!0},E=u;let _=!1;const A=e.parameters.filter((e=>"header"===e.in)).filter((e=>!(a&&!e.required))).map((e=>{var t;return{name:e.name,value:(null===(t=E.header)||void 0===t?void 0:t[e.name])||getParameterValue("header",e.name)||serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,b,s))}})).map((e=>((null==C?void 0:C.name)&&"content-type"===e.name.toLowerCase()&&(_=!0,e.value=C.name),e))).concat(g);!_&&(null==C?void 0:C.name)&&A.unshift({name:"Content-Type",value:null==C?void 0:C.name});const k=e.parameters.filter((e=>"cookie"===e.in)).filter((e=>!(a&&!e.required))).map((e=>queryString.parse(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,b,s))))).reduce(((e,t)=>{var a;for(const[r,s]of Object.entries(t))e.push({name:r,value:String((null===(a=E.cookie)||void 0===a?void 0:a[r])||s)});return e}),[]).concat(v),P=e.parameters.filter((e=>"query"===e.in)).filter((e=>!(a&&!e.required))).map((e=>queryString.parse(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,b,s))))).reduce(((e,t)=>{var a,r,s;for(const[i,n]of Object.entries(t))e.push({name:i,value:isArrayOfObjects(null===(a=E.query)||void 0===a?void 0:a[i])&&JSON.stringify(deleteEmptyArrayItem(null===(r=E.query)||void 0===r?void 0:r[i]))||String((null===(s=E.query)||void 0===s?void 0:s[i])||n)});return e}),[]).concat(O),j=`${null==y?void 0:y.url.replace(/\/$/,"")}/${e.path.replace(/^\//,"")}`,w=e.parameters.filter((e=>"path"===e.in)).reduce(((e,t)=>{var a;const{in:r,name:s}=t;return e[s]=(null===(a=E.path)||void 0===a?void 0:a[s])||n[s]||getParameterValue(r,s),e}),{}),R=null===(m=null==C?void 0:C.examples)||void 0===m?void 0:m[t],D=(null==C?void 0:C.examples)||{},[q]=Object.values(D),M=(null==E?void 0:E.body)||(null==R?void 0:R.value)||(null==q?void 0:q.value)||(null==C?void 0:C.schema)&&Sampler.sample(null==C?void 0:C.schema.rawSchema,b,s),H=null==C?void 0:C.name.toLowerCase();let N="",x=[];switch(normalizeMimeType(H)){case MediaTypes.JSON:case MediaTypes.XML:N=JSON.stringify(getDataRequest(M,o));break;case MediaTypes.URL_ENCODED:case MediaTypes.MULTIPART:N=queryString.stringify(getDataRequest(M,o)),x=objectToHarParams(getDataRequest(M,o));break;default:N=String(M||"")}const U=N?{mimeType:(null==C?void 0:C.name)||MediaTypes.OCTET_STREAM,text:N,params:x}:void 0,z=e.responses.map((e=>e.code));return{method:e.httpVerb,url:j,httpVersion:"HTTP/1.1",cookies:k,headers:A,queryString:P,postData:U,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:S,basicAuth:T,pathParameters:w,serverVariables:l,allResponseCodes:z}}const defaultOptions={withImports:!0,withComments:!1},langToSnippetConfig={curl:{code:"shell",defaultTarget:"curl",defaultOptions:Object.assign(Object.assign({},defaultOptions),{short:!0})},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:Object.assign(Object.assign({},defaultOptions),{withImports:!1})},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:Object.assign({},defaultOptions)},Python:{code:"python",defaultTarget:"requests",defaultOptions:Object.assign({},defaultOptions)},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:Object.assign({},defaultOptions)},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#+Newtonsoft":{code:"csharpNewtonsoft",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:Object.assign({},defaultOptions)},PHP:{code:"php",defaultTarget:"curl",defaultOptions:Object.assign({},defaultOptions)},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:Object.assign({},defaultOptions)},R:{code:"r",defaultTarget:"httr",defaultOptions:Object.assign({},defaultOptions)}};export function getCodeSample({lang:e,operation:t,exampleName:a,pathParams:r,properties:s,options:i={},environment:n}){try{const{skipOptionalParameters:o,withOAuth2Call:l,spec:u,generatedPayloadSamplesMaxDepth:p,store:c}=i,d=mapOperationToHAR(t,{exampleName:a,pathParams:r,properties:s,skipOptionalParameters:o,withOAuth2Call:l,spec:u,generatedPayloadSamplesMaxDepth:p},{environment:n,requestValues:c.requestValues,activeSecuritySchemeIds:c.activeSecuritySchemeIds}),m=new HTTPSnippet(d);return langToSnippetConfig[e]?m.convert(langToSnippetConfig[e].code,langToSnippetConfig[e].defaultTarget,Object.assign(Object.assign({},langToSnippetConfig[e].defaultOptions),i)):"Language is not supported."}catch(e){return console.error(e),"Failed to generate code sample."}}function getSecurityData(e,t,a){var r,s,i,n,o;const l={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0};for(const u of(null==e?void 0:e.schemes)||[]){const e=getSecurityDetails(u.id,a);switch(u.type){case"openIdConnect":null===(r=l.securityHeaders)||void 0===r||r.push({name:"Authorization",value:e.token?`${e.token.token_type||"Bearer"} ${e.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":{const a=e.token?`${e.token.token_type||"Bearer"} ${e.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>";u.flows.clientCredentials&&t?l.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(u.flows.clientCredentials,u.scopes,e)):u.flows.password&&t&&l.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(u.flows.password,u.scopes,e)),null===(s=l.securityHeaders)||void 0===s||s.push({name:"Authorization",value:a});break}case"apiKey":{const t=e.raw||"YOUR_API_KEY_HERE";"header"===u.in&&(null===(i=l.securityHeaders)||void 0===i||i.push({name:u.name,value:t})),"cookie"===u.in&&l.securityCookies.push({name:u.name,value:t}),"query"===u.in&&l.securityQueries.push({name:u.name,value:t});break}case"http":if("basic"===u.scheme)l.basicAuth={username:e.username||`<${StringUtility.toSnakeCase("Username")}>`,password:e.password||`<${StringUtility.toSnakeCase("Password")}>`};else{const t=(null===(n=e.token)||void 0===n?void 0:n.access_token)||`<YOUR_${u.bearerFormat||"TOKEN"}_HERE>`;null===(o=l.securityHeaders)||void 0===o||o.push({name:"Authorization",value:`${capitalizeFirst(u.scheme||"bearer")} ${t}`})}}}return l}function getOAuth2PasswordCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:a.username||"<username>"},{name:"password",value:a.password||"<password>"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getOAuth2ClientCredsCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getDataRequest(e,t){if(e){if("object"==typeof e)return merge(e,t,{arrayMerge:arrayMergeStrategy});try{return merge(JSON.parse(e),t,{arrayMerge:arrayMergeStrategy})}catch(e){return!1}}return!1}function objectToHarParams(e,t=""){const a=[];for(const[r,s]of Object.entries(e)){const e=t?`${t}[${r}]`:r;"object"==typeof s&&null!==s?a.push(...objectToHarParams(s,e)):a.push({name:e,value:String(s)})}return a}export function isDefined(e){return void 0!==e}export function capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}
1
+ import*as Sampler from"openapi-sampler";import merge from"deepmerge";import{toXML}from"jstoxml";import{areArraysEqual,serializeParameterValue,getSecurityDetails,getParameterValue,queryString,isArrayOfObjects,deleteEmptyArrayItem}from"../../utils";import{normalizeMimeType,arrayMergeStrategy}from"../utils";import{MediaTypes}from"../../constants";import{HTTPSnippet}from"./httpsnippet";import{getActiveMediaType}from"../../models/mediaContent";import StringUtility from"./httpsnippet/helpers/string-utility";function getSelectedSecurityScheme(e,t){return e.find((e=>{const a=e.schemes.map((e=>e.id));return areArraysEqual(a,t||[])}))}function mapOperationToHAR(e,{exampleName:t="",skipOptionalParameters:a=!1,withOAuth2Call:r=!1,spec:s,generatedPayloadSamplesMaxDepth:i=8,pathParams:n={},properties:o={}},{environment:l,requestValues:u,activeSecuritySchemeIds:p}){var c,d,m;const h=l.server,y=e.servers.find((e=>e.url===h))||e.servers[0],f=getSelectedSecurityScheme(e.security,p),{securityHeaders:g,securityCookies:v,securityQueries:O,securityOAuth2ExtraCalls:S,basicAuth:T}=getSecurityData(f||(null===(c=e.security)||void 0===c?void 0:c[0]),r,l),C=(null===(d=null==e?void 0:e.requestBody)||void 0===d?void 0:d.content)&&getActiveMediaType(e.requestBody.content),b={skipNonRequired:a,skipReadOnly:!0,maxSampleDepth:i,quiet:!0},E=u;let _=!1;const A=e.parameters.filter((e=>"header"===e.in)).filter((e=>!(a&&!e.required))).map((e=>{var t;return{name:e.name,value:(null===(t=E.header)||void 0===t?void 0:t[e.name])||getParameterValue("header",e.name)||serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,b,s))}})).map((e=>((null==C?void 0:C.name)&&"content-type"===e.name.toLowerCase()&&(_=!0,e.value=C.name),e))).concat(g);!_&&(null==C?void 0:C.name)&&A.unshift({name:"Content-Type",value:null==C?void 0:C.name});const k=e.parameters.filter((e=>"cookie"===e.in)).filter((e=>!(a&&!e.required))).map((e=>queryString.parse(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,b,s))))).reduce(((e,t)=>{var a;for(const[r,s]of Object.entries(t))e.push({name:r,value:String((null===(a=E.cookie)||void 0===a?void 0:a[r])||s)});return e}),[]).concat(v),j=e.parameters.filter((e=>"query"===e.in)).filter((e=>!(a&&!e.required))).map((e=>queryString.parse(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,b,s))))).reduce(((e,t)=>{var a,r,s;for(const[i,n]of Object.entries(t))e.push({name:i,value:isArrayOfObjects(null===(a=E.query)||void 0===a?void 0:a[i])&&JSON.stringify(deleteEmptyArrayItem(null===(r=E.query)||void 0===r?void 0:r[i]))||String((null===(s=E.query)||void 0===s?void 0:s[i])||n)});return e}),[]).concat(O),P=`${null==y?void 0:y.url.replace(/\/$/,"")}/${e.path.replace(/^\//,"")}`,w=e.parameters.filter((e=>"path"===e.in)).reduce(((e,t)=>{var a;const{in:r,name:s}=t;return e[s]=(null===(a=E.path)||void 0===a?void 0:a[s])||n[s]||getParameterValue(r,s),e}),{}),R=null===(m=null==C?void 0:C.examples)||void 0===m?void 0:m[t],D=(null==C?void 0:C.examples)||{},[q]=Object.values(D),M=(null==E?void 0:E.body)||(null==R?void 0:R.value)||(null==q?void 0:q.value)||(null==C?void 0:C.schema)&&Sampler.sample(null==C?void 0:C.schema.rawSchema,b,s),H=null==C?void 0:C.name.toLowerCase();let N="",x=[];switch(normalizeMimeType(H)){case MediaTypes.JSON:N=JSON.stringify(getDataRequest(M,o));break;case MediaTypes.XML:N="object"==typeof M?toXML(getDataRequest(M,o),{indent:" "}):M;break;case MediaTypes.URL_ENCODED:case MediaTypes.MULTIPART:N=queryString.stringify(getDataRequest(M,o)),x=objectToHarParams(getDataRequest(M,o));break;default:N=String(M||"")}const U=N?{mimeType:(null==C?void 0:C.name)||MediaTypes.OCTET_STREAM,text:N,params:x}:void 0,z=e.responses.map((e=>e.code));return{method:e.httpVerb,url:P,httpVersion:"HTTP/1.1",cookies:k,headers:A,queryString:j,postData:U,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:S,basicAuth:T,pathParameters:w,serverVariables:l,allResponseCodes:z}}const defaultOptions={withImports:!0,withComments:!1},langToSnippetConfig={curl:{code:"shell",defaultTarget:"curl",defaultOptions:Object.assign(Object.assign({},defaultOptions),{short:!0})},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:Object.assign(Object.assign({},defaultOptions),{withImports:!1})},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:Object.assign({},defaultOptions)},Python:{code:"python",defaultTarget:"requests",defaultOptions:Object.assign({},defaultOptions)},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:Object.assign({},defaultOptions)},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#+Newtonsoft":{code:"csharpNewtonsoft",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:Object.assign({},defaultOptions)},PHP:{code:"php",defaultTarget:"curl",defaultOptions:Object.assign({},defaultOptions)},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:Object.assign({},defaultOptions)},R:{code:"r",defaultTarget:"httr",defaultOptions:Object.assign({},defaultOptions)}};export function getCodeSample({lang:e,operation:t,exampleName:a,pathParams:r,properties:s,options:i={},environment:n,translate:o}){try{const{skipOptionalParameters:l,withOAuth2Call:u,spec:p,generatedPayloadSamplesMaxDepth:c,store:d}=i,m=mapOperationToHAR(t,{exampleName:a,pathParams:r,properties:s,skipOptionalParameters:l,withOAuth2Call:u,spec:p,generatedPayloadSamplesMaxDepth:c},{environment:n,requestValues:d.requestValues,activeSecuritySchemeIds:d.activeSecuritySchemeIds}),h=new HTTPSnippet(m);return langToSnippetConfig[e]?h.convert(langToSnippetConfig[e].code,langToSnippetConfig[e].defaultTarget,Object.assign(Object.assign({},langToSnippetConfig[e].defaultOptions),i)):o("openapi.unsupportedLanguage","Language is not supported.")}catch(e){return console.error(e),o("openapi.failedToGenerateCodeSample","Failed to generate code sample.")}}function getSecurityData(e,t,a){var r,s,i,n,o;const l={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0};for(const u of(null==e?void 0:e.schemes)||[]){const e=getSecurityDetails(u.id,a);switch(u.type){case"openIdConnect":null===(r=l.securityHeaders)||void 0===r||r.push({name:"Authorization",value:e.token?`${e.token.token_type||"Bearer"} ${e.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":{const a=e.token?`${e.token.token_type||"Bearer"} ${e.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>";u.flows.clientCredentials&&t?l.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(u.flows.clientCredentials,u.scopes,e)):u.flows.password&&t&&l.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(u.flows.password,u.scopes,e)),null===(s=l.securityHeaders)||void 0===s||s.push({name:"Authorization",value:a});break}case"apiKey":{const t=e.raw||"YOUR_API_KEY_HERE";"header"===u.in&&(null===(i=l.securityHeaders)||void 0===i||i.push({name:u.name,value:t})),"cookie"===u.in&&l.securityCookies.push({name:u.name,value:t}),"query"===u.in&&l.securityQueries.push({name:u.name,value:t});break}case"http":if("basic"===u.scheme)l.basicAuth={username:e.username||`<${StringUtility.toSnakeCase("Username")}>`,password:e.password||`<${StringUtility.toSnakeCase("Password")}>`};else{const t=(null===(n=e.token)||void 0===n?void 0:n.access_token)||`<YOUR_${u.bearerFormat||"TOKEN"}_HERE>`;null===(o=l.securityHeaders)||void 0===o||o.push({name:"Authorization",value:`${capitalizeFirst(u.scheme||"bearer")} ${t}`})}}}return l}function getOAuth2PasswordCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:a.username||"<username>"},{name:"password",value:a.password||"<password>"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getOAuth2ClientCredsCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getDataRequest(e,t){if(e){if("object"==typeof e)return merge(e,t,{arrayMerge:arrayMergeStrategy});try{return merge(JSON.parse(e),t,{arrayMerge:arrayMergeStrategy})}catch(e){return!1}}return!1}function objectToHarParams(e,t=""){const a=[];for(const[r,s]of Object.entries(e)){const e=t?`${t}[${r}]`:r;"object"==typeof s&&null!==s?a.push(...objectToHarParams(s,e)):a.push({name:e,value:String(s)})}return a}export function isDefined(e){return void 0!==e}export function capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}
2
2
  //# sourceMappingURL=generator.js.map
@@ -2004,6 +2004,52 @@ export declare const source: {
2004
2004
  };
2005
2005
  fullUrl: string;
2006
2006
  };
2007
+ "POST http://petstore.swagger.io/v2/uploadImage": {
2008
+ httpVersion: string;
2009
+ queryString: never[];
2010
+ basicAuth: {
2011
+ username: string;
2012
+ password: string;
2013
+ };
2014
+ headersSize: number;
2015
+ bodySize: number;
2016
+ securityOAuth2ExtraCalls: never[];
2017
+ pathParameters: {};
2018
+ queryObj: {};
2019
+ headersObj: {};
2020
+ cookiesObj: {};
2021
+ allHeaders: {};
2022
+ serverVariables: {};
2023
+ cookies: {
2024
+ name: string;
2025
+ value: string;
2026
+ }[];
2027
+ uriObj: {
2028
+ protocol: string;
2029
+ slashes: boolean;
2030
+ auth: null;
2031
+ host: string;
2032
+ port: null;
2033
+ hostname: string;
2034
+ hash: null;
2035
+ search: string;
2036
+ query: {};
2037
+ pathname: string;
2038
+ path: string;
2039
+ href: string;
2040
+ };
2041
+ fullUrl: string;
2042
+ method: string;
2043
+ url: string;
2044
+ headers: never[];
2045
+ postData: {
2046
+ mimeType: string;
2047
+ params: {
2048
+ name: string;
2049
+ value: string;
2050
+ }[];
2051
+ };
2052
+ };
2007
2053
  };
2008
2054
  export declare const serverVariablesOptions: {
2009
2055
  withImports: boolean;