@redocly/openapi-docs 3.12.0 → 3.12.2

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 (384) hide show
  1. package/dist/redocly-openapi-docs.min.js +753 -750
  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 +16 -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.js +9 -1
  51. package/lib/components/OperationItem/OperationItem.js +70 -5
  52. package/lib/components/OperationItem/_tests_/OperationItem.test.js +70 -1
  53. package/lib/components/OperationItem/_tests_/__mocks__/mock-intersection-observer.js +40 -1
  54. package/lib/components/OperationItem/index.js +2 -1
  55. package/lib/components/OperationItem/types.js +2 -0
  56. package/lib/components/Overlay.js +48 -3
  57. package/lib/components/Overview/Overview.js +20 -1
  58. package/lib/components/Overview/index.js +2 -1
  59. package/lib/components/PageFooter/PageFooter.js +19 -1
  60. package/lib/components/PageFooter/index.js +2 -1
  61. package/lib/components/Panel/ResponsePanel.js +12 -6
  62. package/lib/components/Panel/Trigger.js +4 -2
  63. package/lib/components/Panel/index.js +3 -1
  64. package/lib/components/PanelItem/PanelItem.js +6 -1
  65. package/lib/components/PanelItem/index.js +3 -1
  66. package/lib/components/PanelItem/styled.js +20 -10
  67. package/lib/components/PayloadSamples/Example.js +6 -1
  68. package/lib/components/PayloadSamples/ExampleValue.js +30 -1
  69. package/lib/components/PayloadSamples/MediaTypeSamples.js +36 -2
  70. package/lib/components/PayloadSamples/PayloadSamples.js +26 -1
  71. package/lib/components/PayloadSamples/index.js +7 -1
  72. package/lib/components/PayloadSamples/styled.js +9 -4
  73. package/lib/components/PayloadSamples/types.js +2 -0
  74. package/lib/components/PropertyDetails/DescriptionEnums.js +19 -3
  75. package/lib/components/PropertyDetails/EnumValues.js +37 -1
  76. package/lib/components/PropertyDetails/Examples.js +26 -1
  77. package/lib/components/PropertyDetails/Extensions.js +17 -2
  78. package/lib/components/PropertyDetails/FieldDetail.js +15 -2
  79. package/lib/components/PropertyDetails/FieldDetails.js +51 -6
  80. package/lib/components/PropertyDetails/Pattern.js +21 -1
  81. package/lib/components/PropertyDetails/PlusCircleIcon.js +10 -4
  82. package/lib/components/PropertyDetails/PropertyDetails.js +22 -5
  83. package/lib/components/PropertyDetails/SchemaTypeInfo.js +10 -2
  84. package/lib/components/PropertyDetails/SimpleEnums.js +13 -2
  85. package/lib/components/PropertyDetails/cycleColorsByLevel.js +18 -1
  86. package/lib/components/PropertyDetails/index.js +4 -1
  87. package/lib/components/PropertyDetails/styled.js +15 -7
  88. package/lib/components/PropertyDetails/types.js +2 -0
  89. package/lib/components/RedoclyOpenAPIDocs/Providers.js +114 -1
  90. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +57 -1
  91. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +86 -1
  92. package/lib/components/RedoclyOpenAPIDocs/index.js +5 -1
  93. package/lib/components/RedoclyOpenAPIDocs/styled.js +4 -2
  94. package/lib/components/RedoclyOpenAPIDocs/types.js +2 -0
  95. package/lib/components/RedoclyOpenAPIDocs/utils.js +33 -1
  96. package/lib/components/RenderHook/RenderHook.js +17 -1
  97. package/lib/components/RenderHook/index.js +2 -1
  98. package/lib/components/Replay/EmbeddedReplay.js +41 -3
  99. package/lib/components/Replay/Replay.js +99 -1
  100. package/lib/components/Replay/index.js +3 -1
  101. package/lib/components/Replay/utils.js +208 -1
  102. package/lib/components/Request/RequestDetails.js +33 -2
  103. package/lib/components/Request/types.js +2 -0
  104. package/lib/components/RequestParameters/Body.js +8 -1
  105. package/lib/components/RequestParameters/ParametersGroup.js +19 -4
  106. package/lib/components/RequestParameters/RequestParameters.js +40 -1
  107. package/lib/components/RequestParameters/index.js +4 -1
  108. package/lib/components/RequestSamples/CodeSample.js +55 -2
  109. package/lib/components/RequestSamples/Example.js +37 -1
  110. package/lib/components/RequestSamples/RequestSamples.js +89 -5
  111. package/lib/components/RequestSamples/index.js +3 -1
  112. package/lib/components/RequestSamples/useCodeSamples.js +92 -1
  113. package/lib/components/ResponseSamples/ResponseSamples.js +47 -1
  114. package/lib/components/ResponseSamples/Summary.js +9 -1
  115. package/lib/components/ResponseSamples/index.js +2 -1
  116. package/lib/components/Responses/OperationResponseList.js +42 -2
  117. package/lib/components/Responses/ResponseDetails.js +18 -1
  118. package/lib/components/Responses/ResponseHeaders.js +15 -1
  119. package/lib/components/Responses/index.js +6 -1
  120. package/lib/components/Responses/styled.js +14 -6
  121. package/lib/components/Responses/types.js +2 -0
  122. package/lib/components/RightPanel/RightPanel.js +21 -1
  123. package/lib/components/RightPanel/index.js +2 -1
  124. package/lib/components/Samples/ExampleSwitch.js +33 -1
  125. package/lib/components/Samples/index.js +3 -1
  126. package/lib/components/Samples/use-example-key.js +12 -1
  127. package/lib/components/Schema/ArraySchema.js +45 -1
  128. package/lib/components/Schema/ObjectSchema.js +29 -1
  129. package/lib/components/Schema/OneOfSchema.js +47 -3
  130. package/lib/components/Schema/RecursiveSchema.js +10 -1
  131. package/lib/components/Schema/Schema.js +63 -2
  132. package/lib/components/Schema/SubSchema.js +20 -1
  133. package/lib/components/Schema/helpers.js +16 -1
  134. package/lib/components/Schema/index.js +5 -1
  135. package/lib/components/Schema/types.js +2 -0
  136. package/lib/components/Schema/useOneOfLocationIdx.js +11 -1
  137. package/lib/components/SchemaDefinition/SchemaDefinition.js +65 -2
  138. package/lib/components/SchemaDefinition/index.js +2 -1
  139. package/lib/components/SectionContent/SectionContent.js +49 -6
  140. package/lib/components/SectionContent/index.js +2 -1
  141. package/lib/components/SectionItem/SectionItem.js +14 -1
  142. package/lib/components/SectionItem/index.js +2 -1
  143. package/lib/components/Security/Divider.js +9 -2
  144. package/lib/components/Security/OAuthFlow.js +11 -1
  145. package/lib/components/Security/OAuthScopes.js +59 -9
  146. package/lib/components/Security/Security.js +15 -1
  147. package/lib/components/Security/SecurityButton.js +31 -7
  148. package/lib/components/Security/SecurityFlow.js +28 -4
  149. package/lib/components/Security/SecurityModal.js +34 -5
  150. package/lib/components/Security/SecuritySchemeItem.js +15 -4
  151. package/lib/components/Security/helper.js +16 -1
  152. package/lib/components/Security/index.js +11 -1
  153. package/lib/components/Security/styled.js +6 -3
  154. package/lib/components/SelectOrLabel/SelectOrLabel.js +12 -2
  155. package/lib/components/SelectOrLabel/index.js +2 -1
  156. package/lib/components/ServerList/ServerList.js +36 -10
  157. package/lib/components/ServerList/index.js +2 -1
  158. package/lib/components/ServerList/types.js +2 -0
  159. package/lib/components/ServerListDropdown/ServerListDropdown.js +54 -1
  160. package/lib/components/ServerListDropdown/index.js +2 -1
  161. package/lib/components/ServerListDropdown/styled.js +15 -6
  162. package/lib/components/SideMenu/SideMenu.js +13 -2
  163. package/lib/components/SideMenu/hooks/useMenuItems.js +110 -1
  164. package/lib/components/SideMenu/index.js +2 -1
  165. package/lib/components/SideMenu/types.js +2 -0
  166. package/lib/components/StickySidebar/SidebarActions.js +14 -2
  167. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +37 -7
  168. package/lib/components/StickySidebar/index.js +2 -1
  169. package/lib/components/Tabs/Tabs.js +16 -5
  170. package/lib/components/Tabs/index.js +3 -1
  171. package/lib/components/Tabs/useTabsState.js +22 -1
  172. package/lib/components/TagItem/OperationNavigationItems.js +18 -4
  173. package/lib/components/TagItem/OperationsNavigation.js +46 -2
  174. package/lib/components/TagItem/TagItem.js +40 -7
  175. package/lib/components/TagItem/index.js +2 -1
  176. package/lib/components/TagItem/styled.js +5 -2
  177. package/lib/components/TagItem/types.js +2 -0
  178. package/lib/components/ViewNested/ViewNested.js +42 -9
  179. package/lib/components/ViewNested/index.js +2 -1
  180. package/lib/components/common/Badges.js +21 -5
  181. package/lib/components/common/BodyContent/BodyContent.js +31 -4
  182. package/lib/components/common/BodyContent/index.js +2 -1
  183. package/lib/components/common/ClearButton/ClearButton.js +5 -1
  184. package/lib/components/common/ClearButton/index.js +3 -1
  185. package/lib/components/common/ClearButton/styled.js +5 -2
  186. package/lib/components/common/ClearButton/types.js +2 -0
  187. package/lib/components/common/CodeBlockPanel.js +7 -3
  188. package/lib/components/common/ConstraintsView.js +14 -2
  189. package/lib/components/common/Dropdown/Dropdown.js +22 -4
  190. package/lib/components/common/Dropdown/index.js +2 -1
  191. package/lib/components/common/ExpandableExample/ExpandableExample.js +24 -3
  192. package/lib/components/common/ExpandableExample/index.js +2 -1
  193. package/lib/components/common/Extensions.js +17 -2
  194. package/lib/components/common/Fields/fields-layout.js +76 -51
  195. package/lib/components/common/Fields/fields.js +39 -17
  196. package/lib/components/common/Fields/index.js +3 -1
  197. package/lib/components/common/LinkToField.js +33 -6
  198. package/lib/components/common/OperationItemTitle.js +12 -6
  199. package/lib/components/common/SchemaSelection/SchemaSelection.js +51 -1
  200. package/lib/components/common/SchemaSelection/index.js +2 -1
  201. package/lib/components/common/Select/Select.js +21 -1
  202. package/lib/components/common/Select/index.js +3 -1
  203. package/lib/components/common/Select/styled.js +17 -9
  204. package/lib/components/common/Select/types.js +2 -0
  205. package/lib/components/common/Skeleton/LanguageListSkeleton.js +16 -6
  206. package/lib/components/common/Skeleton/Skeleton.js +15 -5
  207. package/lib/components/common/Skeleton/index.js +3 -1
  208. package/lib/components/common/headers.js +4 -2
  209. package/lib/components/common/index.js +14 -1
  210. package/lib/components/common/linkify.js +28 -4
  211. package/lib/components/common/mixins.js +4 -2
  212. package/lib/components/common/panels.js +52 -29
  213. package/lib/components/common/schema.js +16 -8
  214. package/lib/components/common/styled.js +15 -7
  215. package/lib/components/index.js +25 -1
  216. package/lib/components/pluggable/RedocExample.js +20 -1
  217. package/lib/components/pluggable/RedocSchema.js +22 -1
  218. package/lib/components/pluggable/index.js +3 -1
  219. package/lib/components/pluggable/styled.components.js +9 -4
  220. package/lib/constants.js +30 -1
  221. package/lib/empty.js +7 -1
  222. package/lib/events/codeSampleCopy.js +19 -1
  223. package/lib/events/creator.js +5 -1
  224. package/lib/events/index.js +8 -1
  225. package/lib/events/languageSwitch.js +18 -1
  226. package/lib/events/panelToggle.js +16 -1
  227. package/lib/events/serverSwitch.js +13 -1
  228. package/lib/events/tryItOpen.js +12 -1
  229. package/lib/events/tryItSent.js +12 -1
  230. package/lib/events/types.js +11 -1
  231. package/lib/hoc/types.js +2 -0
  232. package/lib/hoc/utils.js +4 -1
  233. package/lib/hoc/withRouter.js +17 -1
  234. package/lib/hoc/withStore.js +28 -1
  235. package/lib/hooks/index.js +9 -1
  236. package/lib/hooks/useActivateExample.js +35 -1
  237. package/lib/hooks/useActiveWithFallback.js +12 -1
  238. package/lib/hooks/useContentItems.js +10 -1
  239. package/lib/hooks/useLicense.js +17 -1
  240. package/lib/hooks/usePerformanceMetrics.js +26 -1
  241. package/lib/hooks/useRouter.js +17 -1
  242. package/lib/hooks/useTelemetry.js +5 -1
  243. package/lib/hooks/useTranslate.js +6 -1
  244. package/lib/hooks/useUppercase2LowercaseRedirect.js +12 -1
  245. package/lib/icons/CSharpIcon/CSharpIcon.js +7 -1
  246. package/lib/icons/CSharpIcon/index.js +2 -1
  247. package/lib/icons/CurlIcon/CurlIcon.js +8 -2
  248. package/lib/icons/CurlIcon/index.js +2 -1
  249. package/lib/icons/GOIcon/GOIcon.js +7 -1
  250. package/lib/icons/GOIcon/index.js +2 -1
  251. package/lib/icons/JavaIcon/JavaIcon.js +7 -1
  252. package/lib/icons/JavaIcon/index.js +2 -1
  253. package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +7 -1
  254. package/lib/icons/JavaScriptIcon/index.js +2 -1
  255. package/lib/icons/NodeJSIcon/NodeJSIcon.js +7 -1
  256. package/lib/icons/NodeJSIcon/index.js +2 -1
  257. package/lib/icons/PHPIcon/PHPIcon.js +7 -1
  258. package/lib/icons/PHPIcon/index.js +2 -1
  259. package/lib/icons/PayloadIcon/PayloadIcon.js +7 -1
  260. package/lib/icons/PayloadIcon/index.js +2 -1
  261. package/lib/icons/PythonIcon/PythonIcon.js +7 -1
  262. package/lib/icons/PythonIcon/index.js +2 -1
  263. package/lib/icons/RIcon/RIcon.js +7 -1
  264. package/lib/icons/RIcon/index.js +2 -1
  265. package/lib/icons/RubyIcon/RubyIcon.js +7 -1
  266. package/lib/icons/RubyIcon/index.js +2 -1
  267. package/lib/index.js +49 -1
  268. package/lib/jotai/app.js +113 -1
  269. package/lib/jotai/operation.js +28 -1
  270. package/lib/jotai/replay.js +5 -1
  271. package/lib/jotai/store.js +8 -1
  272. package/lib/jotai/use-write-atom.js +9 -1
  273. package/lib/models/callback.js +28 -1
  274. package/lib/models/code-sample-options.js +2 -0
  275. package/lib/models/example.js +17 -1
  276. package/lib/models/field.js +109 -1
  277. package/lib/models/group.js +38 -1
  278. package/lib/models/index.js +14 -1
  279. package/lib/models/mediaContent.js +26 -1
  280. package/lib/models/mediaType.js +153 -1
  281. package/lib/models/operation.js +166 -1
  282. package/lib/models/request.js +25 -1
  283. package/lib/models/response.js +46 -1
  284. package/lib/models/schema.js +474 -2
  285. package/lib/models/security.js +84 -1
  286. package/lib/models/tab.js +2 -0
  287. package/lib/models/types.js +2 -0
  288. package/lib/services/OpenAPIParser.js +321 -1
  289. package/lib/services/check.js +104 -1
  290. package/lib/services/code-samples/constants.js +16 -1
  291. package/lib/services/code-samples/generator.js +540 -1
  292. package/lib/services/code-samples/httpsnippet/helpers/code-builder.js +252 -3
  293. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +90 -2
  294. package/lib/services/code-samples/httpsnippet/helpers/constants.js +28 -1
  295. package/lib/services/code-samples/httpsnippet/helpers/lodash-int.js +173 -1
  296. package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +76 -37
  297. package/lib/services/code-samples/httpsnippet/helpers/reducer.js +16 -1
  298. package/lib/services/code-samples/httpsnippet/helpers/shell.js +20 -1
  299. package/lib/services/code-samples/httpsnippet/helpers/string-utility.js +19 -1
  300. package/lib/services/code-samples/httpsnippet/index.js +166 -1
  301. package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +2340 -146
  302. package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +227 -2
  303. package/lib/services/code-samples/httpsnippet/targets/csharp/index.js +11 -1
  304. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +185 -2
  305. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +11 -1
  306. package/lib/services/code-samples/httpsnippet/targets/go/index.js +11 -1
  307. package/lib/services/code-samples/httpsnippet/targets/go/native.js +222 -3
  308. package/lib/services/code-samples/httpsnippet/targets/index.js +28 -1
  309. package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +184 -3
  310. package/lib/services/code-samples/httpsnippet/targets/java/index.js +11 -1
  311. package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +223 -2
  312. package/lib/services/code-samples/httpsnippet/targets/java8/index.js +11 -1
  313. package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +147 -1
  314. package/lib/services/code-samples/httpsnippet/targets/javascript/index.js +11 -1
  315. package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +199 -1
  316. package/lib/services/code-samples/httpsnippet/targets/node/index.js +11 -1
  317. package/lib/services/code-samples/httpsnippet/targets/php/curl.js +203 -5
  318. package/lib/services/code-samples/httpsnippet/targets/php/index.js +11 -1
  319. package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
  320. package/lib/services/code-samples/httpsnippet/targets/php/utils.js +106 -5
  321. package/lib/services/code-samples/httpsnippet/targets/python/index.js +11 -1
  322. package/lib/services/code-samples/httpsnippet/targets/python/requests.js +185 -6
  323. package/lib/services/code-samples/httpsnippet/targets/r/httr.js +111 -1
  324. package/lib/services/code-samples/httpsnippet/targets/r/index.js +11 -1
  325. package/lib/services/code-samples/httpsnippet/targets/r/utils.js +18 -6
  326. package/lib/services/code-samples/httpsnippet/targets/ruby/index.js +11 -1
  327. package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +169 -1
  328. package/lib/services/code-samples/httpsnippet/targets/shell/curl.js +94 -6
  329. package/lib/services/code-samples/httpsnippet/targets/shell/index.js +11 -1
  330. package/lib/services/code-samples/index.js +3 -1
  331. package/lib/services/code-samples/types.js +2 -0
  332. package/lib/services/config-options/helpers.js +49 -1
  333. package/lib/services/config-options/index.js +3 -1
  334. package/lib/services/config-options/normalizeOptions.js +83 -1
  335. package/lib/services/config-options/types.js +2 -0
  336. package/lib/services/history/helpers.js +63 -1
  337. package/lib/services/history/index.js +2 -1
  338. package/lib/services/index.js +9 -1
  339. package/lib/services/menu/builder.js +47 -1
  340. package/lib/services/menu/index.js +2 -1
  341. package/lib/services/menu/markdown.js +93 -1
  342. package/lib/services/menu/operation.js +50 -1
  343. package/lib/services/menu/tags.js +166 -1
  344. package/lib/services/types.js +2 -0
  345. package/lib/services/utils.js +83 -1
  346. package/lib/standalone.js +68 -1
  347. package/lib/styled-components.js +6 -1
  348. package/lib/types/app.js +2 -0
  349. package/lib/types/index.js +4 -1
  350. package/lib/types/open-api.js +2 -0
  351. package/lib/types/security.js +2 -0
  352. package/lib/utils/JsonPointer.js +84 -1
  353. package/lib/utils/areArraysEqual.js +4 -1
  354. package/lib/utils/argValuesHelpers.js +35 -1
  355. package/lib/utils/compose.js +2 -1
  356. package/lib/utils/configure-helpers.js +223 -1
  357. package/lib/utils/convertSwagger2OpenAPI.js +14 -1
  358. package/lib/utils/cookies.js +73 -1
  359. package/lib/utils/debounce.js +22 -1
  360. package/lib/utils/debug.js +11 -1
  361. package/lib/utils/dom.js +65 -1
  362. package/lib/utils/environments.js +13 -1
  363. package/lib/utils/helpers.js +222 -12
  364. package/lib/utils/index.js +25 -1
  365. package/lib/utils/isMobile.js +13 -1
  366. package/lib/utils/loadAndBundleSpec.js +32 -1
  367. package/lib/utils/local-storage.js +12 -1
  368. package/lib/utils/object.js +31 -1
  369. package/lib/utils/openapi.js +592 -1
  370. package/lib/utils/parameters.js +13 -1
  371. package/lib/utils/path.js +22 -1
  372. package/lib/utils/queryString.js +60 -1
  373. package/lib/utils/replaceVariables.js +14 -1
  374. package/lib/utils/saveTextBeforeHeading.js +35 -1
  375. package/lib/utils/security-details.js +49 -1
  376. package/lib/utils/session-storage.js +12 -1
  377. package/lib/utils/simplifyAstStructure.js +22 -1
  378. package/lib/utils/sort.js +21 -1
  379. package/lib/utils/string.js +65 -1
  380. package/lib/utils/telemetry.js +7 -1
  381. package/lib/utils/test-utils.js +26 -1
  382. package/lib/utils/theme-helpers.js +24 -3
  383. package/lib/utils/url.js +38 -1
  384. package/package.json +4 -4
@@ -1,37 +1,76 @@
1
- const a={pathParameters:{pathParam1:"pathParam1Value",pathParam2:"pathParam2Value"},serverVariables:{serverVariable1:"serverVariable1Value",serverVariable2:"serverVariable2Value"}},r={"Node.js":`const variablesPrefixpathParam1 = 'pathParam1Value';
2
- const variablesPrefixpathParam2 = 'pathParam2Value';
3
- const variablesPrefixserverVariable1 = 'serverVariable1Value';
4
- const variablesPrefixserverVariable2 = 'serverVariable2Value';`,javascript:`const variablesPrefixpathParam1 = 'pathParam1Value';
5
- const variablesPrefixpathParam2 = 'pathParam2Value';
6
- const variablesPrefixserverVariable1 = 'serverVariable1Value';
7
- const variablesPrefixserverVariable2 = 'serverVariable2Value';`,Python:`variables_prefixpath_param_1 = "pathParam1Value"
8
- variables_prefixpath_param_2 = "pathParam2Value"
9
- variables_prefixserver_variable_1 = "serverVariable1Value"
10
- variables_prefixserver_variable_2 = "serverVariable2Value"`,"Java8+Apache":`String variablesPrefixpathParam1 = "pathParam1Value";
11
- String variablesPrefixpathParam2 = "pathParam2Value";
12
- String variablesPrefixserverVariable1 = "serverVariable1Value";
13
- String variablesPrefixserverVariable2 = "serverVariable2Value";`,Java:`var variablesPrefixpathParam1 = "pathParam1Value";
14
- var variablesPrefixpathParam2 = "pathParam2Value";
15
- var variablesPrefixserverVariable1 = "serverVariable1Value";
16
- var variablesPrefixserverVariable2 = "serverVariable2Value";`,"C#":`var VariablesPrefixpathParam1 = "pathParam1Value";
17
- var VariablesPrefixpathParam2 = "pathParam2Value";
18
- var VariablesPrefixserverVariable1 = "serverVariable1Value";
19
- var VariablesPrefixserverVariable2 = "serverVariable2Value";`,"C#+Newtonsoft":`var VariablesPrefixpathParam1 = "pathParam1Value";
20
- var VariablesPrefixpathParam2 = "pathParam2Value";
21
- var VariablesPrefixserverVariable1 = "serverVariable1Value";
22
- var VariablesPrefixserverVariable2 = "serverVariable2Value";`,curl:`variablesPrefixpathParam1 pathParam1Value
23
- variablesPrefixpathParam2 pathParam2Value
24
- variablesPrefixserverVariable1 serverVariable1Value
25
- variablesPrefixserverVariable2 serverVariable2Value`,Go:`variablesPrefixpathParam1 := "pathParam1Value";
26
- variablesPrefixpathParam2 := "pathParam2Value";
27
- variablesPrefixserverVariable1 := "serverVariable1Value";
28
- variablesPrefixserverVariable2 := "serverVariable2Value";`,PHP:`const variablesPrefixpathParam1 = "pathParam1Value";
29
- const variablesPrefixpathParam2 = "pathParam2Value";
30
- const variablesPrefixserverVariable1 = "serverVariable1Value";
31
- const variablesPrefixserverVariable2 = "serverVariable2Value";`,Ruby:`variables_prefixpath_param_1 = 'pathParam1Value'
32
- variables_prefixpath_param_2 = 'pathParam2Value'
33
- variables_prefixserver_variable_1 = 'serverVariable1Value'
34
- variables_prefixserver_variable_2 = 'serverVariable2Value'`,R:`variables_prefixpath_param_1 = "pathParam1Value"
35
- variables_prefixpath_param_2 = "pathParam2Value"
36
- variables_prefixserver_variable_1 = "serverVariable1Value"
37
- variables_prefixserver_variable_2 = "serverVariable2Value"`},e={},i={"Node.js":"http://acme.com/${variablesPrefixpathParam1}/${variablesPrefixpathParam2}/${variablesPrefixserverVariable1}/${variablesPrefixserverVariable2}",javascript:"http://acme.com/${variablesPrefixpathParam1}/${variablesPrefixpathParam2}/${variablesPrefixserverVariable1}/${variablesPrefixserverVariable2}",Python:'"http://acme.com/" + variables_prefixpath_param_1 + "/" + variables_prefixpath_param_2 + "/" + variables_prefixserver_variable_1 + "/" + variables_prefixserver_variable_2',"Java8+Apache":'"http://acme.com/" + variablesPrefixpathParam1 + "/" + variablesPrefixpathParam2 + "/" + variablesPrefixserverVariable1 + "/" + variablesPrefixserverVariable2',Java:'"http://acme.com/" + variablesPrefixpathParam1 + "/" + variablesPrefixpathParam2 + "/" + variablesPrefixserverVariable1 + "/" + variablesPrefixserverVariable2',"C#":'"http://acme.com/" + VariablesPrefixpathParam1 + "/" + VariablesPrefixpathParam2 + "/" + VariablesPrefixserverVariable1 + "/" + VariablesPrefixserverVariable2',"C#+Newtonsoft":'"http://acme.com/" + VariablesPrefixpathParam1 + "/" + VariablesPrefixpathParam2 + "/" + VariablesPrefixserverVariable1 + "/" + VariablesPrefixserverVariable2',curl:"http://acme.com/pathParam1Value/pathParam2Value/serverVariable1Value/serverVariable2Value",Go:'"http://acme.com/" + variablesPrefixpathParam1 + "/" + variablesPrefixpathParam2 + "/" + variablesPrefixserverVariable1 + "/" + variablesPrefixserverVariable2',PHP:'"http://acme.com/" . variablesPrefixpathParam1 . "/" . variablesPrefixpathParam2 . "/" . variablesPrefixserverVariable1 . "/" . variablesPrefixserverVariable2',Ruby:"'http://acme.com/' + variables_prefixpath_param_1 + '/' + variables_prefixpath_param_2 + '/' + variables_prefixserver_variable_1 + '/' + variables_prefixserver_variable_2",R:'"http://acme.com/" %&% variables_prefixpath_param_1 %&% "/" %&% variables_prefixpath_param_2 %&% "/" %&% variables_prefixserver_variable_1 %&% "/" %&% variables_prefixserver_variable_2'};export{e as buildUrlExpressionCases,i as buildUrlExpressionData,a as commonVariablesInput,r as printUrlVariablesDeclarationsOutput};
1
+ export const commonVariablesInput = {
2
+ pathParameters: {
3
+ pathParam1: 'pathParam1Value',
4
+ pathParam2: 'pathParam2Value',
5
+ },
6
+ serverVariables: {
7
+ serverVariable1: 'serverVariable1Value',
8
+ serverVariable2: 'serverVariable2Value',
9
+ },
10
+ };
11
+ export const printUrlVariablesDeclarationsOutput = {
12
+ 'Node.js': "const variablesPrefixpathParam1 = 'pathParam1Value';\n" +
13
+ "const variablesPrefixpathParam2 = 'pathParam2Value';\n" +
14
+ "const variablesPrefixserverVariable1 = 'serverVariable1Value';\n" +
15
+ "const variablesPrefixserverVariable2 = 'serverVariable2Value';",
16
+ javascript: "const variablesPrefixpathParam1 = 'pathParam1Value';\n" +
17
+ "const variablesPrefixpathParam2 = 'pathParam2Value';\n" +
18
+ "const variablesPrefixserverVariable1 = 'serverVariable1Value';\n" +
19
+ "const variablesPrefixserverVariable2 = 'serverVariable2Value';",
20
+ Python: 'variables_prefixpath_param_1 = "pathParam1Value"\n' +
21
+ 'variables_prefixpath_param_2 = "pathParam2Value"\n' +
22
+ 'variables_prefixserver_variable_1 = "serverVariable1Value"\n' +
23
+ 'variables_prefixserver_variable_2 = "serverVariable2Value"',
24
+ 'Java8+Apache': 'String variablesPrefixpathParam1 = "pathParam1Value";\n' +
25
+ 'String variablesPrefixpathParam2 = "pathParam2Value";\n' +
26
+ 'String variablesPrefixserverVariable1 = "serverVariable1Value";\n' +
27
+ 'String variablesPrefixserverVariable2 = "serverVariable2Value";',
28
+ Java: 'var variablesPrefixpathParam1 = "pathParam1Value";\n' +
29
+ 'var variablesPrefixpathParam2 = "pathParam2Value";\n' +
30
+ 'var variablesPrefixserverVariable1 = "serverVariable1Value";\n' +
31
+ 'var variablesPrefixserverVariable2 = "serverVariable2Value";',
32
+ 'C#': 'var VariablesPrefixpathParam1 = "pathParam1Value";\n' +
33
+ 'var VariablesPrefixpathParam2 = "pathParam2Value";\n' +
34
+ 'var VariablesPrefixserverVariable1 = "serverVariable1Value";\n' +
35
+ 'var VariablesPrefixserverVariable2 = "serverVariable2Value";',
36
+ 'C#+Newtonsoft': 'var VariablesPrefixpathParam1 = "pathParam1Value";\n' +
37
+ 'var VariablesPrefixpathParam2 = "pathParam2Value";\n' +
38
+ 'var VariablesPrefixserverVariable1 = "serverVariable1Value";\n' +
39
+ 'var VariablesPrefixserverVariable2 = "serverVariable2Value";',
40
+ curl: 'variablesPrefixpathParam1 pathParam1Value\n' +
41
+ 'variablesPrefixpathParam2 pathParam2Value\n' +
42
+ 'variablesPrefixserverVariable1 serverVariable1Value\n' +
43
+ 'variablesPrefixserverVariable2 serverVariable2Value',
44
+ Go: 'variablesPrefixpathParam1 := "pathParam1Value";\n' +
45
+ 'variablesPrefixpathParam2 := "pathParam2Value";\n' +
46
+ 'variablesPrefixserverVariable1 := "serverVariable1Value";\n' +
47
+ 'variablesPrefixserverVariable2 := "serverVariable2Value";',
48
+ PHP: 'const variablesPrefixpathParam1 = "pathParam1Value";\n' +
49
+ 'const variablesPrefixpathParam2 = "pathParam2Value";\n' +
50
+ 'const variablesPrefixserverVariable1 = "serverVariable1Value";\n' +
51
+ 'const variablesPrefixserverVariable2 = "serverVariable2Value";',
52
+ Ruby: "variables_prefixpath_param_1 = 'pathParam1Value'\n" +
53
+ "variables_prefixpath_param_2 = 'pathParam2Value'\n" +
54
+ "variables_prefixserver_variable_1 = 'serverVariable1Value'\n" +
55
+ "variables_prefixserver_variable_2 = 'serverVariable2Value'",
56
+ R: 'variables_prefixpath_param_1 = "pathParam1Value"\n' +
57
+ 'variables_prefixpath_param_2 = "pathParam2Value"\n' +
58
+ 'variables_prefixserver_variable_1 = "serverVariable1Value"\n' +
59
+ 'variables_prefixserver_variable_2 = "serverVariable2Value"',
60
+ };
61
+ export const buildUrlExpressionCases = {};
62
+ export const buildUrlExpressionData = {
63
+ 'Node.js': 'http://acme.com/${variablesPrefixpathParam1}/${variablesPrefixpathParam2}/${variablesPrefixserverVariable1}/${variablesPrefixserverVariable2}',
64
+ javascript: 'http://acme.com/${variablesPrefixpathParam1}/${variablesPrefixpathParam2}/${variablesPrefixserverVariable1}/${variablesPrefixserverVariable2}',
65
+ Python: `"http://acme.com/" + variables_prefixpath_param_1 + "/" + variables_prefixpath_param_2 + "/" + variables_prefixserver_variable_1 + "/" + variables_prefixserver_variable_2`,
66
+ 'Java8+Apache': `"http://acme.com/" + variablesPrefixpathParam1 + "/" + variablesPrefixpathParam2 + "/" + variablesPrefixserverVariable1 + "/" + variablesPrefixserverVariable2`,
67
+ Java: `"http://acme.com/" + variablesPrefixpathParam1 + "/" + variablesPrefixpathParam2 + "/" + variablesPrefixserverVariable1 + "/" + variablesPrefixserverVariable2`,
68
+ 'C#': `"http://acme.com/" + VariablesPrefixpathParam1 + "/" + VariablesPrefixpathParam2 + "/" + VariablesPrefixserverVariable1 + "/" + VariablesPrefixserverVariable2`,
69
+ 'C#+Newtonsoft': `"http://acme.com/" + VariablesPrefixpathParam1 + "/" + VariablesPrefixpathParam2 + "/" + VariablesPrefixserverVariable1 + "/" + VariablesPrefixserverVariable2`,
70
+ curl: 'http://acme.com/pathParam1Value/pathParam2Value/serverVariable1Value/serverVariable2Value',
71
+ Go: `"http://acme.com/" + variablesPrefixpathParam1 + "/" + variablesPrefixpathParam2 + "/" + variablesPrefixserverVariable1 + "/" + variablesPrefixserverVariable2`,
72
+ PHP: `"http://acme.com/" . variablesPrefixpathParam1 . "/" . variablesPrefixpathParam2 . "/" . variablesPrefixserverVariable1 . "/" . variablesPrefixserverVariable2`,
73
+ Ruby: `'http://acme.com/' + variables_prefixpath_param_1 + '/' + variables_prefixpath_param_2 + '/' + variables_prefixserver_variable_1 + '/' + variables_prefixserver_variable_2`,
74
+ R: `\"http://acme.com/\" %&% variables_prefixpath_param_1 %&% \"/\" %&% variables_prefixpath_param_2 %&% \"/\" %&% variables_prefixserver_variable_1 %&% \"/\" %&% variables_prefixserver_variable_2`,
75
+ };
76
+ //# sourceMappingURL=code-helpers-mock.js.map
@@ -1 +1,16 @@
1
- function t(e,n){if(e[n.name]===void 0)return e[n.name]=n.value,e;if(e[n.name]instanceof Array)return e[n.name].push(n.value),e;const u=[e[n.name],n.value];return e[n.name]=u,e}export{t as default};
1
+ export default function (obj, pair) {
2
+ if (obj[pair.name] === undefined) {
3
+ obj[pair.name] = pair.value;
4
+ return obj;
5
+ }
6
+ // If we already have it as array just push the value
7
+ if (obj[pair.name] instanceof Array) {
8
+ obj[pair.name].push(pair.value);
9
+ return obj;
10
+ }
11
+ // convert to array
12
+ const arr = [obj[pair.name], pair.value];
13
+ obj[pair.name] = arr;
14
+ return obj;
15
+ }
16
+ //# sourceMappingURL=reducer.js.map
@@ -1 +1,20 @@
1
- import{format as r}from"util";var f={quote:function(e){return/^[a-z0-9-_/.@%^=:]+$/i.test(e)?e:r("'%s'",e.replace(/'/g,"'\\''"))},escape:function(e){return e.replace(/\r/g,"\\r").replace(/\n/g,"\\n")}};export{f as default};
1
+ import { format } from 'util';
2
+ export default {
3
+ /**
4
+ * Use 'strong quoting' using single quotes so that we only need
5
+ * to deal with nested single quote characters.
6
+ * http://wiki.bash-hackers.org/syntax/quoting#strong_quoting
7
+ */
8
+ quote: function (value) {
9
+ const safe = /^[a-z0-9-_/.@%^=:]+$/i;
10
+ // Unless `value` is a simple shell-safe string, quote it.
11
+ if (!safe.test(value)) {
12
+ return format("'%s'", value.replace(/'/g, "'\\''"));
13
+ }
14
+ return value;
15
+ },
16
+ escape: function (value) {
17
+ return value.replace(/\r/g, '\\r').replace(/\n/g, '\\n');
18
+ },
19
+ };
20
+ //# sourceMappingURL=shell.js.map
@@ -1 +1,19 @@
1
- import{camelCase as e,lowerCase as r,snakeCase as s,startCase as a}from"./lodash-int.js";class c{static toCamelCase(t){return e(t)}static toTitleCase(t){return a(e(t))}static toPascalCase(t){return a(e(t)).replace(/ /g,"")}static toLowerCase(t){return r(t).replace(/ /g,"")}static toSnakeCase(t){return s(t)}}export{c as default};
1
+ import { camelCase, lowerCase, snakeCase, startCase } from './lodash-int.js';
2
+ export default class StringUtility {
3
+ static toCamelCase(str) {
4
+ return camelCase(str);
5
+ }
6
+ static toTitleCase(str) {
7
+ return startCase(camelCase(str));
8
+ }
9
+ static toPascalCase(str) {
10
+ return startCase(camelCase(str)).replace(/ /g, '');
11
+ }
12
+ static toLowerCase(str) {
13
+ return lowerCase(str).replace(/ /g, '');
14
+ }
15
+ static toSnakeCase(str) {
16
+ return snakeCase(str);
17
+ }
18
+ }
19
+ //# sourceMappingURL=string-utility.js.map
@@ -1 +1,166 @@
1
- import{normalizeMimeType as b,unescapeServerVariables as p}from"../../utils.js";import{MediaTypes as s}from"../../../constants.js";import e from"./targets/index.js";import m from"./helpers/reducer.js";import{queryString as h}from"../../../utils/index.js";import{urlParse as j}from"../../../utils/url.js";class D{request;constructor(a){const r={...a};this.request=this.prepare({...r,httpVersion:r.httpVersion||"HTTP/1.1",queryString:r.queryString||[],headers:r.headers||[],cookies:r.cookies||[],postData:r.postData?{...r.postData,jsonObj:void 0,paramsObj:void 0}:void 0,bodySize:0,headersSize:0,queryObj:{},headersObj:{},cookiesObj:{},allHeaders:{},uriObj:{},fullUrl:"",pathParameters:r.pathParameters||{},serverVariables:r.serverVariables||{}})}prepare(a){if(a.queryString&&a.queryString.length&&(a.queryObj=a.queryString.reduce(m,{})),a.headers&&a.headers.length){const i=/^HTTP\/2/;a.headersObj=a.headers.reduce(function(t,c){let n=c.name;return a.httpVersion.match(i)&&(n=n.toLowerCase()),t[n]=c.value,t},{})}a.cookies&&a.cookies.length&&(a.cookiesObj=a.cookies.reduceRight(function(i,t){return i[t.name]=t.value,i},{}));const r=a.cookies.map(function(i){return encodeURIComponent(i.name)+"="+encodeURIComponent(i.value)});if(r.length&&(a.allHeaders.cookie=r.join("; ")),a.postData)switch(b(a.postData.mimeType)){case"multipart/mixed":case"multipart/related":case s.MULTIPART:case"multipart/alternative":break;case s.URL_ENCODED:a.postData?.params?(a.postData.paramsObj=a.postData.params.reduce(m,{}),a.postData.text=h.stringify(a.postData.paramsObj)):a.postData.text="";break;case"text/json":case"text/x-json":case s.JSON:case"application/x-json":if(a.postData.text)try{a.postData.jsonObj=JSON.parse(a.postData.text)}catch{a.postData.mimeType="text/plain"}break}if(a.allHeaders=Object.assign(a.allHeaders,a.headersObj),a.uriObj=j(a.url,!0),!a.uriObj)return{...a,uriObj:{protocol:"",path:"",queryObj:{},query:{}}};if(a.queryObj)for(const[i,t]of Object.entries(a.queryObj))a.uriObj.searchParams.has(i,t)||a.uriObj.searchParams.set(i,t);a.uriObj.query=Object.fromEntries(a.uriObj.searchParams.entries()),a.queryObj=a.uriObj.query,a.uriObj.path=a.uriObj.pathname=p(a.uriObj.pathname);const o=new URL(a.uriObj.toString());return o.search="",a.url=p(o.toString()),a.uriObj.search&&(a.uriObj.path=a.uriObj.pathname+"?"+a.uriObj.search),a.fullUrl=p(a.uriObj.toString()),a}convert(a,r,o){!o&&r&&(o=r);const i=this._matchTarget(a,r);if(i){const t=i(this.request,o,{target:a,client:r});return t.length===1?t[0]:t}throw new Error("Cannot match target")}_matchTarget(a,r){return Object.prototype.hasOwnProperty.call(e,a)?typeof r=="string"&&typeof e[a][r]=="function"?e[a][r]:e[a][e[a].info.default]:!1}}export{D as HTTPSnippet};
1
+ import { normalizeMimeType, unescapeServerVariables } from '../../utils.js';
2
+ import { MediaTypes } from '../../../constants.js';
3
+ import targets from './targets/index.js';
4
+ import reducer from './helpers/reducer.js';
5
+ import { queryString } from '../../../utils/index.js';
6
+ import { urlParse } from '../../../utils/url.js';
7
+ export class HTTPSnippet {
8
+ request;
9
+ constructor(data) {
10
+ const input = { ...data };
11
+ // prep the main container
12
+ this.request = this.prepare({
13
+ ...input,
14
+ // add optional properties to make validation successful
15
+ httpVersion: input.httpVersion || 'HTTP/1.1',
16
+ queryString: input.queryString || [],
17
+ headers: input.headers || [],
18
+ cookies: input.cookies || [],
19
+ postData: input.postData
20
+ ? {
21
+ ...input.postData,
22
+ jsonObj: undefined,
23
+ paramsObj: undefined,
24
+ }
25
+ : undefined,
26
+ bodySize: 0,
27
+ headersSize: 0,
28
+ queryObj: {},
29
+ headersObj: {},
30
+ cookiesObj: {},
31
+ allHeaders: {},
32
+ uriObj: {},
33
+ fullUrl: '',
34
+ pathParameters: input.pathParameters || {},
35
+ serverVariables: input.serverVariables || {},
36
+ });
37
+ }
38
+ prepare(request) {
39
+ // construct query objects
40
+ if (request.queryString && request.queryString.length) {
41
+ request.queryObj = request.queryString.reduce(reducer, {});
42
+ }
43
+ // construct headers objects
44
+ if (request.headers && request.headers.length) {
45
+ const http2VersionRegex = /^HTTP\/2/;
46
+ request.headersObj = request.headers.reduce(function (headers, header) {
47
+ let headerName = header.name;
48
+ if (request.httpVersion.match(http2VersionRegex)) {
49
+ headerName = headerName.toLowerCase();
50
+ }
51
+ headers[headerName] = header.value;
52
+ return headers;
53
+ }, {});
54
+ }
55
+ // construct headers objects
56
+ if (request.cookies && request.cookies.length) {
57
+ request.cookiesObj = request.cookies.reduceRight(function (cookies, cookie) {
58
+ cookies[cookie.name] = cookie.value;
59
+ return cookies;
60
+ }, {});
61
+ }
62
+ // construct Cookie header
63
+ const cookies = request.cookies.map(function (cookie) {
64
+ return encodeURIComponent(cookie.name) + '=' + encodeURIComponent(cookie.value);
65
+ });
66
+ if (cookies.length) {
67
+ request.allHeaders.cookie = cookies.join('; ');
68
+ }
69
+ if (request.postData) {
70
+ switch (normalizeMimeType(request.postData.mimeType)) {
71
+ case 'multipart/mixed':
72
+ case 'multipart/related':
73
+ case MediaTypes.MULTIPART:
74
+ case 'multipart/alternative':
75
+ break;
76
+ case MediaTypes.URL_ENCODED:
77
+ if (!request.postData?.params) {
78
+ request.postData.text = '';
79
+ }
80
+ else {
81
+ request.postData.paramsObj = request.postData.params.reduce(reducer, {});
82
+ // always overwrite
83
+ request.postData.text = queryString.stringify(request.postData.paramsObj);
84
+ }
85
+ break;
86
+ case 'text/json':
87
+ case 'text/x-json':
88
+ case MediaTypes.JSON:
89
+ case 'application/x-json':
90
+ if (request.postData.text) {
91
+ try {
92
+ request.postData.jsonObj = JSON.parse(request.postData.text);
93
+ }
94
+ catch {
95
+ // force back to text/plain
96
+ // if headers have proper content-type value, then this should also work
97
+ request.postData.mimeType = 'text/plain';
98
+ }
99
+ }
100
+ break;
101
+ }
102
+ }
103
+ // create allHeaders object
104
+ request.allHeaders = Object.assign(request.allHeaders, request.headersObj);
105
+ // deconstruct the uri
106
+ request.uriObj = urlParse(request.url, true);
107
+ if (!request.uriObj) {
108
+ return {
109
+ ...request,
110
+ uriObj: {
111
+ protocol: '',
112
+ path: '',
113
+ queryObj: {},
114
+ query: {},
115
+ },
116
+ };
117
+ }
118
+ // update the uri object
119
+ if (request.queryObj) {
120
+ for (const [key, value] of Object.entries(request.queryObj)) {
121
+ if (!request.uriObj.searchParams.has(key, value)) {
122
+ request.uriObj.searchParams.set(key, value);
123
+ }
124
+ }
125
+ }
126
+ request.uriObj.query = Object.fromEntries(request.uriObj.searchParams.entries());
127
+ // merge all possible queryString values
128
+ request.queryObj = request.uriObj.query;
129
+ // reset uriObj values for a clean url
130
+ request.uriObj.path = request.uriObj.pathname = unescapeServerVariables(request.uriObj.pathname);
131
+ const cleanUri = new URL(request.uriObj.toString());
132
+ cleanUri.search = '';
133
+ // keep the base url clean of queryString
134
+ request.url = unescapeServerVariables(cleanUri.toString());
135
+ if (request.uriObj.search) {
136
+ request.uriObj.path = request.uriObj.pathname + '?' + request.uriObj.search;
137
+ }
138
+ // construct a full url
139
+ request.fullUrl = unescapeServerVariables(request.uriObj.toString());
140
+ return request;
141
+ }
142
+ convert(target, client, opts) {
143
+ if (!opts && client) {
144
+ opts = client;
145
+ }
146
+ const func = this._matchTarget(target, client);
147
+ if (func) {
148
+ const results = func(this.request, opts, { target, client });
149
+ return results.length === 1 ? results[0] : results;
150
+ }
151
+ throw new Error('Cannot match target');
152
+ }
153
+ _matchTarget(target, client) {
154
+ // does it exist?
155
+ if (!Object.prototype.hasOwnProperty.call(targets, target)) {
156
+ return false;
157
+ }
158
+ // shorthand
159
+ if (typeof client === 'string' && typeof targets[target][client] === 'function') {
160
+ return targets[target][client];
161
+ }
162
+ // default target
163
+ return targets[target][targets[target].info.default];
164
+ }
165
+ }
166
+ //# sourceMappingURL=index.js.map