@redocly/openapi-docs 3.12.0-rc.7 → 3.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/dist/redocly-openapi-docs.min.js +2153 -1963
  2. package/lib/components/ApiInfo/ApiInfo.js +29 -1
  3. package/lib/components/ApiInfo/Metadata.js +29 -1
  4. package/lib/components/ApiInfo/index.js +2 -1
  5. package/lib/components/ApiInfo/styled.js +17 -8
  6. package/lib/components/CallbackSamples/CallbackSamples.js +25 -4
  7. package/lib/components/CallbackSamples/index.js +2 -1
  8. package/lib/components/Callbacks/CallbackDetails.js +17 -3
  9. package/lib/components/Callbacks/CallbackOperation.js +24 -3
  10. package/lib/components/Callbacks/CallbackSummary.js +19 -3
  11. package/lib/components/Callbacks/CallbacksList.js +16 -1
  12. package/lib/components/Callbacks/index.js +4 -1
  13. package/lib/components/Callbacks/styled.js +6 -3
  14. package/lib/components/Content/Content.js +10 -1
  15. package/lib/components/Content/index.js +2 -1
  16. package/lib/components/Content/useAutoScroll.js +50 -1
  17. package/lib/components/ContentItem/ContentItem.js +31 -1
  18. package/lib/components/ContentItem/index.js +2 -1
  19. package/lib/components/ContentItem/useIsExpanded.js +33 -1
  20. package/lib/components/ContentItems/ContentItems.js +19 -1
  21. package/lib/components/ContentItems/Items.js +13 -1
  22. package/lib/components/ContentItems/VirtualList.js +35 -1
  23. package/lib/components/ContentItems/helpers.js +49 -1
  24. package/lib/components/ContentItems/index.js +2 -1
  25. package/lib/components/ContentItems/useScrollOnRender.js +26 -1
  26. package/lib/components/Discriminator/Discriminator.js +27 -2
  27. package/lib/components/Discriminator/index.js +2 -1
  28. package/lib/components/Download/DownloadSpecification.js +46 -4
  29. package/lib/components/Download/index.js +2 -1
  30. package/lib/components/Download/types.js +2 -0
  31. package/lib/components/Download/useDownloadInfo.js +42 -1
  32. package/lib/components/ErrorBoundary/ErrorBoundary.js +22 -2
  33. package/lib/components/ErrorBoundary/index.js +2 -1
  34. package/lib/components/ExpandAllButton/ExpandAllButton.js +31 -2
  35. package/lib/components/ExpandAllButton/index.js +2 -1
  36. package/lib/components/ExternalDocumentation/ExternalDocumentation.js +18 -4
  37. package/lib/components/ExternalDocumentation/index.js +2 -1
  38. package/lib/components/Language/LanguageDropdown.js +21 -1
  39. package/lib/components/Language/LanguageItem.js +33 -1
  40. package/lib/components/Language/LanguageList.js +93 -1
  41. package/lib/components/Language/_tests_/LanguageDropdown.test.js +23 -1
  42. package/lib/components/Language/constants.js +3 -1
  43. package/lib/components/Language/index.js +4 -1
  44. package/lib/components/Language/styled.js +29 -15
  45. package/lib/components/Markdown/Markdown.js +64 -1
  46. package/lib/components/Markdown/index.js +3 -1
  47. package/lib/components/Markdown/types.js +2 -0
  48. package/lib/components/MediaTypeSwitch/MediaTypesSwitch.js +51 -1
  49. package/lib/components/MediaTypeSwitch/index.js +2 -1
  50. package/lib/components/OperationItem/Description.d.ts +1 -4
  51. package/lib/components/OperationItem/Description.js +9 -1
  52. package/lib/components/OperationItem/OperationItem.js +70 -5
  53. package/lib/components/OperationItem/_tests_/OperationItem.test.js +70 -1
  54. package/lib/components/OperationItem/_tests_/__mocks__/mock-intersection-observer.js +40 -1
  55. package/lib/components/OperationItem/index.js +2 -1
  56. package/lib/components/OperationItem/types.js +2 -0
  57. package/lib/components/Overlay.js +48 -3
  58. package/lib/components/Overview/Overview.js +20 -1
  59. package/lib/components/Overview/index.js +2 -1
  60. package/lib/components/PageFooter/PageFooter.js +19 -1
  61. package/lib/components/PageFooter/index.js +2 -1
  62. package/lib/components/Panel/ResponsePanel.js +12 -6
  63. package/lib/components/Panel/Trigger.js +4 -2
  64. package/lib/components/Panel/index.js +3 -1
  65. package/lib/components/PanelItem/PanelItem.js +6 -1
  66. package/lib/components/PanelItem/index.js +3 -1
  67. package/lib/components/PanelItem/styled.js +20 -10
  68. package/lib/components/PayloadSamples/Example.js +6 -1
  69. package/lib/components/PayloadSamples/ExampleValue.js +30 -1
  70. package/lib/components/PayloadSamples/MediaTypeSamples.js +36 -2
  71. package/lib/components/PayloadSamples/PayloadSamples.js +26 -1
  72. package/lib/components/PayloadSamples/index.js +7 -1
  73. package/lib/components/PayloadSamples/styled.js +9 -4
  74. package/lib/components/PayloadSamples/types.js +2 -0
  75. package/lib/components/PropertyDetails/DescriptionEnums.js +19 -3
  76. package/lib/components/PropertyDetails/EnumValues.js +37 -1
  77. package/lib/components/PropertyDetails/Examples.js +26 -1
  78. package/lib/components/PropertyDetails/Extensions.js +17 -2
  79. package/lib/components/PropertyDetails/FieldDetail.js +15 -2
  80. package/lib/components/PropertyDetails/FieldDetails.js +51 -6
  81. package/lib/components/PropertyDetails/Pattern.js +21 -1
  82. package/lib/components/PropertyDetails/PlusCircleIcon.js +10 -4
  83. package/lib/components/PropertyDetails/PropertyDetails.js +22 -5
  84. package/lib/components/PropertyDetails/SchemaTypeInfo.js +10 -2
  85. package/lib/components/PropertyDetails/SimpleEnums.js +13 -2
  86. package/lib/components/PropertyDetails/cycleColorsByLevel.js +18 -1
  87. package/lib/components/PropertyDetails/index.js +4 -1
  88. package/lib/components/PropertyDetails/styled.js +15 -7
  89. package/lib/components/PropertyDetails/types.js +2 -0
  90. package/lib/components/RedoclyOpenAPIDocs/Providers.js +114 -1
  91. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +57 -1
  92. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +86 -1
  93. package/lib/components/RedoclyOpenAPIDocs/index.js +5 -1
  94. package/lib/components/RedoclyOpenAPIDocs/styled.js +4 -2
  95. package/lib/components/RedoclyOpenAPIDocs/types.js +2 -0
  96. package/lib/components/RedoclyOpenAPIDocs/utils.js +33 -1
  97. package/lib/components/RenderHook/RenderHook.js +17 -1
  98. package/lib/components/RenderHook/index.js +2 -1
  99. package/lib/components/Replay/EmbeddedReplay.js +41 -3
  100. package/lib/components/Replay/Replay.js +99 -1
  101. package/lib/components/Replay/index.js +3 -1
  102. package/lib/components/Replay/utils.js +208 -1
  103. package/lib/components/Request/RequestDetails.js +33 -2
  104. package/lib/components/Request/types.js +2 -0
  105. package/lib/components/RequestParameters/Body.js +8 -1
  106. package/lib/components/RequestParameters/ParametersGroup.js +19 -4
  107. package/lib/components/RequestParameters/RequestParameters.js +40 -1
  108. package/lib/components/RequestParameters/index.js +4 -1
  109. package/lib/components/RequestSamples/CodeSample.js +55 -2
  110. package/lib/components/RequestSamples/Example.js +37 -1
  111. package/lib/components/RequestSamples/RequestSamples.js +89 -5
  112. package/lib/components/RequestSamples/index.js +3 -1
  113. package/lib/components/RequestSamples/useCodeSamples.js +92 -1
  114. package/lib/components/ResponseSamples/ResponseSamples.js +47 -1
  115. package/lib/components/ResponseSamples/Summary.js +9 -1
  116. package/lib/components/ResponseSamples/index.js +2 -1
  117. package/lib/components/Responses/OperationResponseList.js +42 -2
  118. package/lib/components/Responses/ResponseDetails.js +18 -1
  119. package/lib/components/Responses/ResponseHeaders.js +15 -1
  120. package/lib/components/Responses/index.js +6 -1
  121. package/lib/components/Responses/styled.js +14 -6
  122. package/lib/components/Responses/types.js +2 -0
  123. package/lib/components/RightPanel/RightPanel.js +21 -1
  124. package/lib/components/RightPanel/index.js +2 -1
  125. package/lib/components/Samples/ExampleSwitch.js +33 -1
  126. package/lib/components/Samples/index.js +3 -1
  127. package/lib/components/Samples/use-example-key.js +12 -1
  128. package/lib/components/Schema/ArraySchema.js +45 -1
  129. package/lib/components/Schema/ObjectSchema.js +29 -1
  130. package/lib/components/Schema/OneOfSchema.js +47 -3
  131. package/lib/components/Schema/RecursiveSchema.js +10 -1
  132. package/lib/components/Schema/Schema.js +63 -2
  133. package/lib/components/Schema/SubSchema.js +20 -1
  134. package/lib/components/Schema/helpers.js +16 -1
  135. package/lib/components/Schema/index.js +5 -1
  136. package/lib/components/Schema/types.js +2 -0
  137. package/lib/components/Schema/useOneOfLocationIdx.js +11 -1
  138. package/lib/components/SchemaDefinition/SchemaDefinition.js +65 -2
  139. package/lib/components/SchemaDefinition/index.js +2 -1
  140. package/lib/components/SectionContent/SectionContent.js +49 -6
  141. package/lib/components/SectionContent/index.js +2 -1
  142. package/lib/components/SectionItem/SectionItem.js +14 -1
  143. package/lib/components/SectionItem/index.js +2 -1
  144. package/lib/components/Security/Divider.js +9 -2
  145. package/lib/components/Security/OAuthFlow.js +11 -1
  146. package/lib/components/Security/OAuthScopes.js +59 -9
  147. package/lib/components/Security/Security.js +15 -1
  148. package/lib/components/Security/SecurityButton.js +31 -7
  149. package/lib/components/Security/SecurityFlow.js +28 -4
  150. package/lib/components/Security/SecurityModal.js +34 -5
  151. package/lib/components/Security/SecuritySchemeItem.js +15 -4
  152. package/lib/components/Security/helper.js +16 -1
  153. package/lib/components/Security/index.js +11 -1
  154. package/lib/components/Security/styled.js +6 -3
  155. package/lib/components/SelectOrLabel/SelectOrLabel.js +12 -2
  156. package/lib/components/SelectOrLabel/index.js +2 -1
  157. package/lib/components/ServerList/ServerList.js +36 -10
  158. package/lib/components/ServerList/index.js +2 -1
  159. package/lib/components/ServerList/types.js +2 -0
  160. package/lib/components/ServerListDropdown/ServerListDropdown.js +54 -1
  161. package/lib/components/ServerListDropdown/index.js +2 -1
  162. package/lib/components/ServerListDropdown/styled.js +15 -6
  163. package/lib/components/SideMenu/SideMenu.js +13 -2
  164. package/lib/components/SideMenu/hooks/useMenuItems.js +110 -1
  165. package/lib/components/SideMenu/index.js +2 -1
  166. package/lib/components/SideMenu/types.js +2 -0
  167. package/lib/components/StickySidebar/SidebarActions.js +14 -2
  168. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +37 -7
  169. package/lib/components/StickySidebar/index.js +2 -1
  170. package/lib/components/Tabs/Tabs.js +16 -5
  171. package/lib/components/Tabs/index.js +3 -1
  172. package/lib/components/Tabs/useTabsState.js +22 -1
  173. package/lib/components/TagItem/OperationNavigationItems.js +18 -4
  174. package/lib/components/TagItem/OperationsNavigation.js +46 -2
  175. package/lib/components/TagItem/TagItem.js +41 -8
  176. package/lib/components/TagItem/index.js +2 -1
  177. package/lib/components/TagItem/styled.js +5 -2
  178. package/lib/components/TagItem/types.js +2 -0
  179. package/lib/components/ViewNested/ViewNested.js +42 -9
  180. package/lib/components/ViewNested/index.js +2 -1
  181. package/lib/components/common/Badges.js +21 -5
  182. package/lib/components/common/BodyContent/BodyContent.js +31 -4
  183. package/lib/components/common/BodyContent/index.js +2 -1
  184. package/lib/components/common/ClearButton/ClearButton.js +5 -1
  185. package/lib/components/common/ClearButton/index.js +3 -1
  186. package/lib/components/common/ClearButton/styled.js +5 -2
  187. package/lib/components/common/ClearButton/types.js +2 -0
  188. package/lib/components/common/CodeBlockPanel.js +7 -3
  189. package/lib/components/common/ConstraintsView.js +14 -2
  190. package/lib/components/common/Dropdown/Dropdown.js +22 -4
  191. package/lib/components/common/Dropdown/index.js +2 -1
  192. package/lib/components/common/ExpandableExample/ExpandableExample.js +24 -3
  193. package/lib/components/common/ExpandableExample/index.js +2 -1
  194. package/lib/components/common/Extensions.js +17 -2
  195. package/lib/components/common/Fields/fields-layout.js +76 -51
  196. package/lib/components/common/Fields/fields.js +39 -17
  197. package/lib/components/common/Fields/index.js +3 -1
  198. package/lib/components/common/LinkToField.js +33 -6
  199. package/lib/components/common/OperationItemTitle.d.ts +1 -0
  200. package/lib/components/common/OperationItemTitle.js +16 -5
  201. package/lib/components/common/SchemaSelection/SchemaSelection.js +51 -1
  202. package/lib/components/common/SchemaSelection/index.js +2 -1
  203. package/lib/components/common/Select/Select.js +21 -1
  204. package/lib/components/common/Select/index.js +3 -1
  205. package/lib/components/common/Select/styled.js +17 -9
  206. package/lib/components/common/Select/types.js +2 -0
  207. package/lib/components/common/Skeleton/LanguageListSkeleton.js +16 -6
  208. package/lib/components/common/Skeleton/Skeleton.js +15 -5
  209. package/lib/components/common/Skeleton/index.js +3 -1
  210. package/lib/components/common/headers.js +4 -2
  211. package/lib/components/common/index.js +14 -1
  212. package/lib/components/common/linkify.js +28 -4
  213. package/lib/components/common/mixins.js +4 -2
  214. package/lib/components/common/panels.js +58 -33
  215. package/lib/components/common/schema.js +16 -8
  216. package/lib/components/common/styled.js +15 -7
  217. package/lib/components/index.js +25 -1
  218. package/lib/components/pluggable/RedocExample.js +20 -1
  219. package/lib/components/pluggable/RedocSchema.js +22 -1
  220. package/lib/components/pluggable/index.js +3 -1
  221. package/lib/components/pluggable/styled.components.js +9 -4
  222. package/lib/constants.js +30 -1
  223. package/lib/empty.js +7 -1
  224. package/lib/events/codeSampleCopy.js +19 -1
  225. package/lib/events/creator.js +5 -1
  226. package/lib/events/index.js +8 -1
  227. package/lib/events/languageSwitch.js +18 -1
  228. package/lib/events/panelToggle.js +16 -1
  229. package/lib/events/serverSwitch.js +13 -1
  230. package/lib/events/tryItOpen.js +12 -1
  231. package/lib/events/tryItSent.js +12 -1
  232. package/lib/events/types.js +11 -1
  233. package/lib/hoc/types.js +2 -0
  234. package/lib/hoc/utils.js +4 -1
  235. package/lib/hoc/withRouter.js +17 -1
  236. package/lib/hoc/withStore.js +28 -1
  237. package/lib/hooks/index.js +9 -1
  238. package/lib/hooks/useActivateExample.js +35 -1
  239. package/lib/hooks/useActiveWithFallback.js +12 -1
  240. package/lib/hooks/useContentItems.js +10 -1
  241. package/lib/hooks/useLicense.js +17 -1
  242. package/lib/hooks/usePerformanceMetrics.js +26 -1
  243. package/lib/hooks/useRouter.js +17 -1
  244. package/lib/hooks/useTelemetry.js +5 -1
  245. package/lib/hooks/useTranslate.js +6 -1
  246. package/lib/hooks/useUppercase2LowercaseRedirect.js +12 -1
  247. package/lib/icons/CSharpIcon/CSharpIcon.js +7 -1
  248. package/lib/icons/CSharpIcon/index.js +2 -1
  249. package/lib/icons/CurlIcon/CurlIcon.js +8 -2
  250. package/lib/icons/CurlIcon/index.js +2 -1
  251. package/lib/icons/GOIcon/GOIcon.js +7 -1
  252. package/lib/icons/GOIcon/index.js +2 -1
  253. package/lib/icons/JavaIcon/JavaIcon.js +7 -1
  254. package/lib/icons/JavaIcon/index.js +2 -1
  255. package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +7 -1
  256. package/lib/icons/JavaScriptIcon/index.js +2 -1
  257. package/lib/icons/NodeJSIcon/NodeJSIcon.js +7 -1
  258. package/lib/icons/NodeJSIcon/index.js +2 -1
  259. package/lib/icons/PHPIcon/PHPIcon.js +7 -1
  260. package/lib/icons/PHPIcon/index.js +2 -1
  261. package/lib/icons/PayloadIcon/PayloadIcon.js +7 -1
  262. package/lib/icons/PayloadIcon/index.js +2 -1
  263. package/lib/icons/PythonIcon/PythonIcon.js +7 -1
  264. package/lib/icons/PythonIcon/index.js +2 -1
  265. package/lib/icons/RIcon/RIcon.js +7 -1
  266. package/lib/icons/RIcon/index.js +2 -1
  267. package/lib/icons/RubyIcon/RubyIcon.js +7 -1
  268. package/lib/icons/RubyIcon/index.js +2 -1
  269. package/lib/index.js +49 -1
  270. package/lib/jotai/app.js +113 -1
  271. package/lib/jotai/operation.js +28 -1
  272. package/lib/jotai/replay.js +5 -1
  273. package/lib/jotai/store.js +8 -1
  274. package/lib/jotai/use-write-atom.js +9 -1
  275. package/lib/models/callback.js +28 -1
  276. package/lib/models/code-sample-options.js +2 -0
  277. package/lib/models/example.js +17 -1
  278. package/lib/models/field.js +109 -1
  279. package/lib/models/group.js +38 -1
  280. package/lib/models/index.js +14 -1
  281. package/lib/models/mediaContent.js +26 -1
  282. package/lib/models/mediaType.js +153 -1
  283. package/lib/models/operation.js +166 -1
  284. package/lib/models/request.js +25 -1
  285. package/lib/models/response.js +46 -1
  286. package/lib/models/schema.js +474 -2
  287. package/lib/models/security.js +84 -1
  288. package/lib/models/tab.js +2 -0
  289. package/lib/models/types.js +2 -0
  290. package/lib/services/OpenAPIParser.js +321 -1
  291. package/lib/services/check.js +104 -1
  292. package/lib/services/code-samples/constants.js +16 -1
  293. package/lib/services/code-samples/generator.js +540 -1
  294. package/lib/services/code-samples/httpsnippet/helpers/code-builder.d.ts +5 -1
  295. package/lib/services/code-samples/httpsnippet/helpers/code-builder.js +252 -3
  296. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +2 -2
  297. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +90 -2
  298. package/lib/services/code-samples/httpsnippet/helpers/constants.js +28 -1
  299. package/lib/services/code-samples/httpsnippet/helpers/lodash-int.js +173 -1
  300. package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +76 -37
  301. package/lib/services/code-samples/httpsnippet/helpers/reducer.js +16 -1
  302. package/lib/services/code-samples/httpsnippet/helpers/shell.js +20 -1
  303. package/lib/services/code-samples/httpsnippet/helpers/string-utility.js +19 -1
  304. package/lib/services/code-samples/httpsnippet/index.js +166 -1
  305. package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +2340 -146
  306. package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +227 -2
  307. package/lib/services/code-samples/httpsnippet/targets/csharp/index.js +11 -1
  308. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +185 -2
  309. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +11 -1
  310. package/lib/services/code-samples/httpsnippet/targets/go/index.js +11 -1
  311. package/lib/services/code-samples/httpsnippet/targets/go/native.js +222 -3
  312. package/lib/services/code-samples/httpsnippet/targets/index.js +28 -1
  313. package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +184 -3
  314. package/lib/services/code-samples/httpsnippet/targets/java/index.js +11 -1
  315. package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +223 -2
  316. package/lib/services/code-samples/httpsnippet/targets/java8/index.js +11 -1
  317. package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +147 -1
  318. package/lib/services/code-samples/httpsnippet/targets/javascript/index.js +11 -1
  319. package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +199 -1
  320. package/lib/services/code-samples/httpsnippet/targets/node/index.js +11 -1
  321. package/lib/services/code-samples/httpsnippet/targets/php/curl.js +203 -5
  322. package/lib/services/code-samples/httpsnippet/targets/php/index.js +11 -1
  323. package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
  324. package/lib/services/code-samples/httpsnippet/targets/php/utils.js +106 -5
  325. package/lib/services/code-samples/httpsnippet/targets/python/index.js +11 -1
  326. package/lib/services/code-samples/httpsnippet/targets/python/requests.js +185 -6
  327. package/lib/services/code-samples/httpsnippet/targets/r/httr.js +111 -1
  328. package/lib/services/code-samples/httpsnippet/targets/r/index.js +11 -1
  329. package/lib/services/code-samples/httpsnippet/targets/r/utils.js +18 -6
  330. package/lib/services/code-samples/httpsnippet/targets/ruby/index.js +11 -1
  331. package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +169 -1
  332. package/lib/services/code-samples/httpsnippet/targets/shell/curl.js +94 -6
  333. package/lib/services/code-samples/httpsnippet/targets/shell/index.js +11 -1
  334. package/lib/services/code-samples/index.js +3 -1
  335. package/lib/services/code-samples/types.js +2 -0
  336. package/lib/services/config-options/helpers.js +49 -1
  337. package/lib/services/config-options/index.js +3 -1
  338. package/lib/services/config-options/normalizeOptions.js +83 -1
  339. package/lib/services/config-options/types.js +2 -0
  340. package/lib/services/history/helpers.js +63 -1
  341. package/lib/services/history/index.js +2 -1
  342. package/lib/services/index.js +9 -1
  343. package/lib/services/menu/builder.js +47 -1
  344. package/lib/services/menu/index.js +2 -1
  345. package/lib/services/menu/markdown.js +93 -1
  346. package/lib/services/menu/operation.js +50 -1
  347. package/lib/services/menu/tags.js +166 -1
  348. package/lib/services/types.d.ts +0 -3
  349. package/lib/services/types.js +2 -0
  350. package/lib/services/utils.js +83 -1
  351. package/lib/standalone.js +68 -1
  352. package/lib/styled-components.js +6 -1
  353. package/lib/types/app.js +2 -0
  354. package/lib/types/index.js +4 -1
  355. package/lib/types/open-api.d.ts +1 -0
  356. package/lib/types/open-api.js +2 -0
  357. package/lib/types/security.js +2 -0
  358. package/lib/utils/JsonPointer.js +84 -1
  359. package/lib/utils/areArraysEqual.js +4 -1
  360. package/lib/utils/argValuesHelpers.js +35 -1
  361. package/lib/utils/compose.js +2 -1
  362. package/lib/utils/configure-helpers.js +223 -1
  363. package/lib/utils/convertSwagger2OpenAPI.js +14 -1
  364. package/lib/utils/cookies.js +73 -1
  365. package/lib/utils/debounce.js +22 -1
  366. package/lib/utils/debug.js +11 -1
  367. package/lib/utils/dom.js +65 -1
  368. package/lib/utils/environments.js +13 -1
  369. package/lib/utils/helpers.js +222 -12
  370. package/lib/utils/index.js +25 -1
  371. package/lib/utils/isMobile.js +13 -1
  372. package/lib/utils/loadAndBundleSpec.js +32 -1
  373. package/lib/utils/local-storage.js +12 -1
  374. package/lib/utils/object.js +31 -1
  375. package/lib/utils/openapi.js +592 -1
  376. package/lib/utils/parameters.js +13 -1
  377. package/lib/utils/path.js +22 -1
  378. package/lib/utils/queryString.js +60 -1
  379. package/lib/utils/replaceVariables.js +14 -1
  380. package/lib/utils/saveTextBeforeHeading.js +35 -1
  381. package/lib/utils/security-details.js +49 -1
  382. package/lib/utils/session-storage.js +12 -1
  383. package/lib/utils/simplifyAstStructure.js +22 -1
  384. package/lib/utils/sort.js +21 -1
  385. package/lib/utils/string.js +65 -1
  386. package/lib/utils/telemetry.js +7 -1
  387. package/lib/utils/test-utils.js +26 -1
  388. package/lib/utils/theme-helpers.js +24 -3
  389. package/lib/utils/url.js +38 -1
  390. package/package.json +5 -5
@@ -1,3 +1,252 @@
1
- import*as S from"util";import{Lang as i,NamingVariableConventions as l,VariableType as c}from"./constants.js";import o from"./string-utility.js";const p={[i.NODEJS]:l.CAMEL_CASE,[i.JAVASCRIPT]:l.CAMEL_CASE,[i.PYTHON]:l.UNDER_SCORES,[i.JAVA8]:l.CAMEL_CASE,[i.JAVA]:l.CAMEL_CASE,[i.CSHARP]:l.PASCAL_CASE,[i.CSHARPNEWTONSOFT]:l.PASCAL_CASE,[i.CURL]:l.CAMEL_CASE,[i.GO]:l.CAMEL_CASE,[i.PHP]:l.CAMEL_CASE,[i.RUBY]:l.UNDER_SCORES,[i.R]:l.UNDER_SCORES},u={default:{joinSymbol:"",variableWrapperFn:a=>a,stringLiteral:a=>a,variableDeclaration:a=>a,urlFieldName:"url"},[i.CSHARP]:{joinSymbol:" + ",stringLiteral:a=>`"${a}"`,variableDeclaration:a=>`var ${a} = "%s";`,urlFieldName:"fullUrl"},[i.CSHARPNEWTONSOFT]:{joinSymbol:" + ",stringLiteral:a=>`"${a}"`,variableDeclaration:a=>`var ${a} = "%s";`,urlFieldName:"fullUrl"},[i.GO]:{joinSymbol:" + ",stringLiteral:a=>`"${a}"`,variableDeclaration:a=>`${a} := "%s";`},[i.JAVA]:{joinSymbol:" + ",stringLiteral:a=>`"${a}"`,variableDeclaration:a=>`var ${a} = "%s";`,urlFieldName:"pathname"},[i.JAVA8]:{joinSymbol:" + ",stringLiteral:a=>`"${a}"`,variableDeclaration:a=>`String ${a} = "%s";`,urlFieldName:"fullUrl"},[i.JAVASCRIPT]:{variableWrapperFn:a=>"${"+a+"}",variableDeclaration:a=>`const ${a} = '%s';`},[i.NODEJS]:{variableWrapperFn:a=>"${"+a+"}",variableDeclaration:a=>`const ${a} = '%s';`},[i.PHP]:{joinSymbol:" . ",stringLiteral:a=>`"${a}"`,variableDeclaration:a=>`const ${a} = "%s";`},[i.PYTHON]:{stringLiteral:a=>`"${a}"`,joinSymbol:" + ",variableDeclaration:a=>`${a} = "%s"`},[i.RUBY]:{joinSymbol:" + ",stringLiteral:a=>`'${a}'`,variableDeclaration:a=>`${a} = '%s'`},[i.CURL]:{variableWrapperFn:(a,e)=>e||`{${a}}`,urlFieldName:"fullUrl",rawName:!0},[i.R]:{joinSymbol:" %&% ",variableDeclaration:a=>`${a} = "%s"`,urlFieldName:"fullUrl",stringLiteral:a=>`"${a}"`,variableWrapperFn:a=>`${a}`}},C=["response","request","requests","data","url","payload","main","accessToken","resp","Program","client","postData","App","httpClient","params","pathname","host","body","fetch","query"];class h{code;indentation;variablesPrefix;lineJoin;capitalize;lang;langOptions;constructor({indentation:e,lineJoin:t=`
2
- `,variablesPrefix:r="",capitalize:n=!1,lang:s=i.CURL}){this.code=[],this.indentation=e,this.variablesPrefix=r,this.lineJoin=t||`
3
- `,this.capitalize=n,this.lang=s,this.langOptions={...u.default,...u[s]}}buildLine(e,t){let r="",n=2;if(typeof e=="string")n=1,t=e,e=0;else if(e===null)return null;for(;e;)r+=this.indentation,e--;const s=Array.prototype.slice.call(arguments,n,arguments.length);return s.unshift(r+t),S.format.apply(this,s)}unshift(...e){return this.code.unshift(this.buildLine.apply(this,e)),this}push(...e){return this.code.push(this.buildLine.apply(this,e)),this}blank(){return this.code.push(null),this}join(){return this.code.join(this.lineJoin)}clean(){this.code.splice(1)}var(e,t=c.CUSTOM){if(t===c.PATH){let r=this.variablesPrefix+e;switch(C.includes(r)&&(r=`${r}_path`),p[this.lang]){case l.UNDER_SCORES:r=o.toSnakeCase(r);break;case l.PASCAL_CASE:r=o.toPascalCase(r);break;case l.CAMEL_CASE:default:r=o.toCamelCase(r);break}return r}return this.variablesPrefix?this.variablesPrefix+(this.capitalize?o.toPascalCase(e):e):e}}export{h as CodeBuilder};
1
+ import * as util from 'util';
2
+ import { Lang, NamingVariableConventions, VariableType } from './constants.js';
3
+ import StringUtility from './string-utility.js';
4
+ const langToVarNameConvention = {
5
+ [Lang.NODEJS]: NamingVariableConventions.CAMEL_CASE,
6
+ [Lang.JAVASCRIPT]: NamingVariableConventions.CAMEL_CASE,
7
+ [Lang.PYTHON]: NamingVariableConventions.UNDER_SCORES,
8
+ [Lang.JAVA8]: NamingVariableConventions.CAMEL_CASE,
9
+ [Lang.JAVA]: NamingVariableConventions.CAMEL_CASE,
10
+ [Lang.CSHARP]: NamingVariableConventions.PASCAL_CASE,
11
+ [Lang.CSHARPNEWTONSOFT]: NamingVariableConventions.PASCAL_CASE,
12
+ [Lang.CURL]: NamingVariableConventions.CAMEL_CASE,
13
+ [Lang.GO]: NamingVariableConventions.CAMEL_CASE,
14
+ [Lang.PHP]: NamingVariableConventions.CAMEL_CASE,
15
+ [Lang.RUBY]: NamingVariableConventions.UNDER_SCORES,
16
+ [Lang.R]: NamingVariableConventions.UNDER_SCORES,
17
+ };
18
+ const langOptions = {
19
+ default: {
20
+ joinSymbol: '',
21
+ variableWrapperFn: (v) => v,
22
+ stringLiteral: (t) => t,
23
+ variableDeclaration: (n) => n,
24
+ urlFieldName: 'url',
25
+ },
26
+ [Lang.CSHARP]: {
27
+ joinSymbol: ' + ',
28
+ stringLiteral: (t) => `"${t}"`,
29
+ variableDeclaration: (n) => `var ${n} = %s;`,
30
+ urlFieldName: 'fullUrl',
31
+ },
32
+ [Lang.CSHARPNEWTONSOFT]: {
33
+ joinSymbol: ' + ',
34
+ stringLiteral: (t) => `"${t}"`,
35
+ variableDeclaration: (n) => `var ${n} = %s;`,
36
+ urlFieldName: 'fullUrl',
37
+ },
38
+ [Lang.GO]: {
39
+ joinSymbol: ' + ',
40
+ stringLiteral: (t) => `"${t}"`,
41
+ variableDeclaration: (n) => `${n} := %s;`,
42
+ },
43
+ [Lang.JAVA]: {
44
+ joinSymbol: ' + ',
45
+ stringLiteral: (t) => `"${t}"`,
46
+ variableDeclaration: (n) => `var ${n} = %s;`,
47
+ urlFieldName: 'pathname',
48
+ },
49
+ [Lang.JAVA8]: {
50
+ joinSymbol: ' + ',
51
+ stringLiteral: (t) => `"${t}"`,
52
+ variableDeclaration: (n) => `String ${n} = %s;`,
53
+ urlFieldName: 'fullUrl',
54
+ },
55
+ [Lang.JAVASCRIPT]: {
56
+ variableWrapperFn: (v) => '${' + v + '}',
57
+ variableDeclaration: (n, options) => `const ${n} = ${options?.hasVariableInterpolation ? '`%s`' : "'%s'"};`,
58
+ },
59
+ [Lang.NODEJS]: {
60
+ variableWrapperFn: (v) => '${' + v + '}',
61
+ variableDeclaration: (n, options) => `const ${n} = ${options?.hasVariableInterpolation ? '`%s`' : "'%s'"};`,
62
+ },
63
+ [Lang.PHP]: {
64
+ joinSymbol: ' . ',
65
+ stringLiteral: (t) => `"${t}"`,
66
+ variableDeclaration: (n) => `const ${n} = %s;`,
67
+ },
68
+ [Lang.PYTHON]: {
69
+ stringLiteral: (t) => `"${t}"`,
70
+ joinSymbol: ' + ',
71
+ variableDeclaration: (n) => `${n} = %s`,
72
+ },
73
+ [Lang.RUBY]: {
74
+ joinSymbol: ' + ',
75
+ stringLiteral: (t) => `'${t}'`,
76
+ variableDeclaration: (n) => `${n} = %s`,
77
+ },
78
+ [Lang.CURL]: {
79
+ variableWrapperFn: (name, value) => value || `{${name}}`,
80
+ urlFieldName: 'fullUrl',
81
+ rawName: true,
82
+ },
83
+ [Lang.R]: {
84
+ joinSymbol: ' %&% ',
85
+ variableDeclaration: (n) => `${n} = %s`,
86
+ urlFieldName: 'fullUrl',
87
+ stringLiteral: (t) => `"${t}"`,
88
+ variableWrapperFn: (name) => `${name}`,
89
+ },
90
+ };
91
+ const reservedVariableNames = [
92
+ 'response',
93
+ 'request',
94
+ 'requests',
95
+ 'data',
96
+ 'url',
97
+ 'payload',
98
+ 'main',
99
+ 'accessToken',
100
+ 'resp',
101
+ 'Program',
102
+ 'client',
103
+ 'postData',
104
+ 'App',
105
+ 'httpClient',
106
+ 'params',
107
+ 'pathname',
108
+ 'host',
109
+ 'body',
110
+ 'fetch',
111
+ 'query',
112
+ ];
113
+ /**
114
+ * Helper object to format and aggragate lines of code.
115
+ * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
116
+ *
117
+ * @param {string} indentation Desired indentation character for aggregated lines of code
118
+ * @param {string} lineJoin Desired character to join each line of code
119
+ */
120
+ export class CodeBuilder {
121
+ code;
122
+ indentation;
123
+ variablesPrefix;
124
+ lineJoin;
125
+ capitalize;
126
+ lang;
127
+ langOptions;
128
+ constructor({ indentation, lineJoin = '\n', variablesPrefix = '', capitalize = false, lang = Lang.CURL, }) {
129
+ this.code = [];
130
+ this.indentation = indentation;
131
+ this.variablesPrefix = variablesPrefix;
132
+ this.lineJoin = lineJoin || '\n';
133
+ this.capitalize = capitalize;
134
+ this.lang = lang;
135
+ this.langOptions = {
136
+ ...langOptions.default,
137
+ ...langOptions[lang],
138
+ };
139
+ }
140
+ /**
141
+ * Add given indentation level to given string and format the string (variadic)
142
+ * @param {number} [indentationLevel=0] - Desired level of indentation for this line
143
+ * @param {string} line - Line of code. Can contain formatting placeholders
144
+ * @param rest
145
+ * @param {...object} - Parameter to bind to `line`'s formatting placeholders
146
+ * @return {string}
147
+ *
148
+ * @example
149
+ * const builder = CodeBuilder('\t')
150
+ *
151
+ * builder.buildLine('console.log("hello world")')
152
+ * // returns: 'console.log("hello world")'
153
+ *
154
+ * builder.buildLine(2, 'console.log("hello world")')
155
+ * // returns: 'console.log("\t\thello world")'
156
+ *
157
+ * builder.buildLine(2, 'console.log("%s %s")', 'hello', 'world')
158
+ * // returns: 'console.log("\t\thello world")'
159
+ */
160
+ buildLine(indentationLevel, line) {
161
+ let lineIndentation = '';
162
+ let slice = 2;
163
+ if (typeof indentationLevel === 'string') {
164
+ slice = 1;
165
+ line = indentationLevel;
166
+ indentationLevel = 0;
167
+ }
168
+ else if (indentationLevel === null) {
169
+ return null;
170
+ }
171
+ while (indentationLevel) {
172
+ lineIndentation += this.indentation;
173
+ indentationLevel--;
174
+ }
175
+ // eslint-disable-next-line prefer-rest-params
176
+ const format = Array.prototype.slice.call(arguments, slice, arguments.length);
177
+ format.unshift(lineIndentation + line);
178
+ return util.format.apply(this, format);
179
+ }
180
+ /**
181
+ * Invoke buildLine() and add the line at the top of current lines
182
+ * @return {this}
183
+ * @param args
184
+ */
185
+ unshift(...args) {
186
+ // @ts-ignore
187
+ // eslint-disable-next-line prefer-spread
188
+ this.code.unshift(this.buildLine.apply(this, args));
189
+ return this;
190
+ }
191
+ /**
192
+ * Invoke buildLine() and add the line at the bottom of current lines
193
+ * @return {this}
194
+ * @param args
195
+ */
196
+ push(...args) {
197
+ // @ts-ignore
198
+ // eslint-disable-next-line prefer-spread
199
+ this.code.push(this.buildLine.apply(this, args));
200
+ return this;
201
+ }
202
+ /**
203
+ * Add an empty line at the end of current lines
204
+ * @return {this}
205
+ */
206
+ blank() {
207
+ this.code.push(null);
208
+ return this;
209
+ }
210
+ /**
211
+ * Concatenate all current lines using the given lineJoin
212
+ * @return {string}
213
+ */
214
+ join() {
215
+ return this.code.join(this.lineJoin);
216
+ }
217
+ clean() {
218
+ this.code.splice(1);
219
+ }
220
+ /**
221
+ * Get variable name, use variablesPrefix if specified
222
+ * @param {string} name
223
+ * @param {VariableType} type
224
+ * @return {string}
225
+ */
226
+ var(name, type = VariableType.CUSTOM) {
227
+ if (type === VariableType.PATH) {
228
+ let value = this.variablesPrefix + name;
229
+ if (reservedVariableNames.includes(value)) {
230
+ value = `${value}_path`;
231
+ }
232
+ switch (langToVarNameConvention[this.lang]) {
233
+ case NamingVariableConventions.UNDER_SCORES:
234
+ value = StringUtility.toSnakeCase(value);
235
+ break;
236
+ case NamingVariableConventions.PASCAL_CASE:
237
+ value = StringUtility.toPascalCase(value);
238
+ break;
239
+ case NamingVariableConventions.CAMEL_CASE:
240
+ default:
241
+ value = StringUtility.toCamelCase(value);
242
+ break;
243
+ }
244
+ return value;
245
+ }
246
+ // TODO remove, once we refactor all variables in code-samples
247
+ return this.variablesPrefix
248
+ ? this.variablesPrefix + (this.capitalize ? StringUtility.toPascalCase(name) : name)
249
+ : name;
250
+ }
251
+ }
252
+ //# sourceMappingURL=code-builder.js.map
@@ -24,5 +24,5 @@ export type CodeOperand = {
24
24
  * parseUrlIntoOperands("/url/:test/", {test: 1})
25
25
  **/
26
26
  export declare function parseUrlIntoOperands(url: string, params: Record<string, unknown>): CodeOperand[];
27
- export declare function buildUrlExpression(source: SnippetRequest, code: CodeBuilder): string;
28
- export declare function printUrlVariablesDeclarations({ pathParameters, serverVariables }: SnippetRequest, code: CodeBuilder, indentationLevel?: number): void;
27
+ export declare function buildUrlExpression(source: SnippetRequest, code: CodeBuilder, url?: string): string;
28
+ export declare function printUrlVariablesDeclarations(source: SnippetRequest, code: CodeBuilder, indentationLevel?: number): void;
@@ -1,2 +1,90 @@
1
- import{VariableType as p}from"./constants.js";function g({body:a,authorizationHeader:s}){return function(r,i,e){return a&&i==="body"&&typeof r.body=="string"?r.body:s&&i==="Authorization"&&typeof r.Authorization=="string"?r.Authorization:e}}function h(a,{level:s=0,indent:r=" ",firstLine:i=!0}={}){const e=r.repeat(s),n=a.replace(/(\r\n|\n|\r)/gm,`
2
- ${e}`);return i?e.concat(n):n}function m(a,s){const i=Object.keys(s).map(t=>({name:t,idx:a.indexOf(`{${t}}`)})).filter(({idx:t})=>t>-1).sort((t,o)=>t.idx-o.idx),e=[];let n=0;for(const{name:t,idx:o}of i)o>n&&e.push({type:"string",value:a.substring(n,o)}),e.push({type:"variable",name:t}),n=o+t.length+2;return n<a.length&&e.push({type:"string",value:a.substring(n)}),e}function x(a,s){const{joinSymbol:r,variableWrapperFn:i,stringLiteral:e,urlFieldName:n,rawName:t}=s.langOptions,{pathParameters:o={},serverVariables:f={}}=a,u={...o,...f};return m(a[n]||"",u).map(l=>{if(l.type==="variable"){const b=u[l.name],c=t?l.name:s.var(l.name,p.PATH);return i(c,b)}else return e(l.value)}).join(r)}function d({pathParameters:a={},serverVariables:s={}},r,i){Object.entries({...a,...s}).forEach(([e,n])=>{if(e==="server")return;const t=n||`YOUR_${e}_PARAMETER`,o=r.var(e,p.PATH);i!==void 0?r.push(i,r.langOptions.variableDeclaration(o),t):r.push(r.langOptions.variableDeclaration(o),t)})}export{h as addIndentation,x as buildUrlExpression,g as getPreserveTransformer,m as parseUrlIntoOperands,d as printUrlVariablesDeclarations};
1
+ import { VariableType } from './constants.js';
2
+ export function getPreserveTransformer({ body, authorizationHeader, }) {
3
+ return function (input, prop, originalResult) {
4
+ if (body) {
5
+ // Keep original body without extra stringifying (assume that body already stringified)
6
+ if (prop === 'body' && typeof input.body === 'string') {
7
+ return input.body;
8
+ }
9
+ }
10
+ if (authorizationHeader) {
11
+ // Keep original Authorization header without stringifying (for basic auth code)
12
+ if (prop === 'Authorization' && typeof input.Authorization === 'string') {
13
+ return input.Authorization;
14
+ }
15
+ }
16
+ return originalResult;
17
+ };
18
+ }
19
+ export function addIndentation(str, { level = 0, indent = ' ', firstLine = true } = {}) {
20
+ const indentation = indent.repeat(level);
21
+ // TODO: keep original indentaion type
22
+ const strWithExtraIndentation = str.replace(/(\r\n|\n|\r)/gm, `\n${indentation}`);
23
+ if (firstLine) {
24
+ return indentation.concat(strWithExtraIndentation);
25
+ }
26
+ return strWithExtraIndentation;
27
+ }
28
+ /**
29
+ * Parse url with arguments into concatenation operands array so it can be manipulated easily language-independently
30
+ *
31
+ * @example
32
+ * // returns [{type: 'string', value: '/var/'}, {type: 'variable', name: 'test'}, {type: "string", value: "/"}]
33
+ * parseUrlIntoOperands("/url/:test/", {test: 1})
34
+ **/
35
+ export function parseUrlIntoOperands(url, params) {
36
+ const paramNames = Object.keys(params);
37
+ const paramNamesInOrder = paramNames
38
+ .map((name) => ({ name, idx: url.indexOf(`{${name}}`) }))
39
+ .filter(({ idx }) => idx > -1) // filter out unused
40
+ .sort((a, b) => a.idx - b.idx);
41
+ const operands = [];
42
+ let prevIdx = 0;
43
+ for (const { name, idx } of paramNamesInOrder) {
44
+ if (idx > prevIdx) {
45
+ operands.push({ type: 'string', value: url.substring(prevIdx, idx) });
46
+ }
47
+ operands.push({ type: 'variable', name });
48
+ prevIdx = idx + name.length + 2; // 2 for curly braces
49
+ }
50
+ if (prevIdx < url.length)
51
+ operands.push({ type: 'string', value: url.substring(prevIdx) });
52
+ return operands;
53
+ }
54
+ export function buildUrlExpression(source, code, url) {
55
+ const { joinSymbol, variableWrapperFn, stringLiteral, urlFieldName, rawName } = code.langOptions;
56
+ const { pathParameters = {}, serverVariables = {} } = source;
57
+ const variablesData = { ...pathParameters, ...serverVariables };
58
+ return parseUrlIntoOperands(url ?? source[urlFieldName] ?? '', variablesData)
59
+ .map((operand) => {
60
+ if (operand.type === 'variable') {
61
+ const variableValue = variablesData[operand.name];
62
+ const variableName = rawName ? operand.name : code.var(operand.name, VariableType.PATH);
63
+ return variableWrapperFn(variableName, variableValue);
64
+ }
65
+ else {
66
+ // string
67
+ return stringLiteral(operand.value);
68
+ }
69
+ })
70
+ .join(joinSymbol);
71
+ }
72
+ export function printUrlVariablesDeclarations(source, code, indentationLevel) {
73
+ const variablesData = { ...source.pathParameters, ...source.serverVariables };
74
+ Object.entries(variablesData).forEach(([key, value]) => {
75
+ if (key === 'server')
76
+ return; // special case for environment variable called server
77
+ const variableValue = value || `YOUR_${key}_PARAMETER`;
78
+ const variableName = code.var(key, VariableType.PATH);
79
+ const operands = parseUrlIntoOperands(variableValue, variablesData);
80
+ const hasVariableInterpolation = operands.some((operand) => operand.type === 'variable');
81
+ const expression = buildUrlExpression(source, code, variableValue);
82
+ if (indentationLevel !== undefined) {
83
+ code.push(indentationLevel, code.langOptions.variableDeclaration(variableName, { hasVariableInterpolation }), expression);
84
+ }
85
+ else {
86
+ code.push(code.langOptions.variableDeclaration(variableName, { hasVariableInterpolation }), expression);
87
+ }
88
+ });
89
+ }
90
+ //# sourceMappingURL=code-helpers.js.map
@@ -1 +1,28 @@
1
- var C;(function(A){A.NODEJS="Node.js",A.JAVASCRIPT="javascript",A.PYTHON="Python",A.JAVA8="Java8+Apache",A.JAVA="Java",A.CSHARP="C#",A.CSHARPNEWTONSOFT="C#+Newtonsoft",A.CURL="curl",A.GO="Go",A.PHP="PHP",A.RUBY="Ruby",A.R="R"})(C||(C={}));var P;(function(A){A.UNDER_SCORES="under_scores",A.CAMEL_CASE="camelCase",A.PASCAL_CASE="PascalCase"})(P||(P={}));var o;(function(A){A.IMPORT="import",A.CUSTOM="custom",A.PATH="path"})(o||(o={}));export{C as Lang,P as NamingVariableConventions,o as VariableType};
1
+ export var Lang;
2
+ (function (Lang) {
3
+ Lang["NODEJS"] = "Node.js";
4
+ Lang["JAVASCRIPT"] = "javascript";
5
+ Lang["PYTHON"] = "Python";
6
+ Lang["JAVA8"] = "Java8+Apache";
7
+ Lang["JAVA"] = "Java";
8
+ Lang["CSHARP"] = "C#";
9
+ Lang["CSHARPNEWTONSOFT"] = "C#+Newtonsoft";
10
+ Lang["CURL"] = "curl";
11
+ Lang["GO"] = "Go";
12
+ Lang["PHP"] = "PHP";
13
+ Lang["RUBY"] = "Ruby";
14
+ Lang["R"] = "R";
15
+ })(Lang || (Lang = {}));
16
+ export var NamingVariableConventions;
17
+ (function (NamingVariableConventions) {
18
+ NamingVariableConventions["UNDER_SCORES"] = "under_scores";
19
+ NamingVariableConventions["CAMEL_CASE"] = "camelCase";
20
+ NamingVariableConventions["PASCAL_CASE"] = "PascalCase";
21
+ })(NamingVariableConventions || (NamingVariableConventions = {}));
22
+ export var VariableType;
23
+ (function (VariableType) {
24
+ VariableType["IMPORT"] = "import";
25
+ VariableType["CUSTOM"] = "custom";
26
+ VariableType["PATH"] = "path";
27
+ })(VariableType || (VariableType = {}));
28
+ //# sourceMappingURL=constants.js.map
@@ -1 +1,173 @@
1
- const c="\\ud800-\\udfff",k="\\u0300-\\u036f",N="\\ufe20-\\ufe2f",D="\\u20d0-\\u20ff",W="\\u1ab0-\\u1aff",F="\\u1dc0-\\u1dff",l=k+N+D+W+F,x="\\u2700-\\u27bf",b="a-z\\xdf-\\xf6\\xf8-\\xff",H="\\xac\\xb1\\xd7\\xf7",I="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",V="\\u2000-\\u206f",_=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",g="A-Z\\xc0-\\xd6\\xd8-\\xde",R="\\ufe0e\\ufe0f",m=H+I+V+_,B=/['\u2019]/g,C="['\u2019]",A=`[${m}]`,i=`[${l}]`,S="\\d",J=`[${x}]`,j=`[${b}]`,y=`[^${c}${m+S+x+b+g}]`,a="\\ud83c[\\udffb-\\udfff]",P=`(?:${i}|${a})`,U=`[^${c}]`,d="(?:\\ud83c[\\udde6-\\uddff]){2}",$="[\\ud800-\\udbff][\\udc00-\\udfff]",r=`[${g}]`,h="\\u200d",M=`(?:${j}|${y})`,q=`(?:${r}|${y})`,L=`(?:${C}(?:d|ll|m|re|s|t|ve))?`,w=`(?:${C}(?:D|LL|M|RE|S|T|VE))?`,O=`${P}?`,z=`[${R}]?`,Q=`(?:${h}(?:${[U,d,$].join("|")})${z+O})*`,Y="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",G="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",E=z+O+Q,K=`(?:${[J,d,$].join("|")})${E}`,X=RegExp([`${r}?${j}+${L}(?=${[A,r,"$"].join("|")})`,`${q}+${w}(?=${[A,r+M,"$"].join("|")})`,`${r}?${M}+${L}`,`${r}+${w}`,G,Y,`${S}+`,K].join("|"),"g"),v=o=>o.match(X),oo=RegExp(`[${h+c+l+R}]`),T=o=>oo.test(o),so=`[${c}]`,no=`${U}${i}?`,to=`(?:${[no,i,d,$,so].join("|")})`,ro=RegExp(`${a}(?=${a})|${to+E}`,"g"),eo=o=>o.match(ro)||[],co=o=>o.split(""),uo=o=>{const s=Object.prototype.toString;return o==null?o===void 0?"[object Undefined]":"[object Null]":s.call(o)},fo=o=>{const s=typeof o;return s=="symbol"||s==="object"&&o!=null&&uo(o)=="[object Symbol]"},io=1/0,u=o=>{if(o==null)return"";if(typeof o=="string")return o;if(Array.isArray(o))return`${o.map(n=>n==null?n:u(n))}`;if(fo(o))return o.toString();const s=`${o}`;return s=="0"&&1/o==-io?"-0":s},ao=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/),$o=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,po=o=>o.match($o),lo=(o,s,n)=>{let t=o==null?0:o.length;if(!t)return[];s=s??0,n=n===void 0?t:n,s<0&&(s=-s>t?0:t+s),n=n>t?t:n,n<0&&(n+=t),t=s>n?0:n-s>>>0,s>>>=0;let e=-1;const p=new Array(t);for(;++e<t;)p[e]=o[e+s];return p},f=o=>(ao(o)?v(o):po(o))||[],xo=(o,s)=>{const{length:n}=o,t=n;return!s&&t>=n?o:lo(o,s,t)},bo=o=>T(o)?eo(o):co(o),go=o=>s=>{if(!s)return"";const n=T(s)?bo(s):void 0,t=n?n[0]:s[0],e=n?xo(n,1).join(""):s.slice(1);return t[o]()+e},Z=go("toUpperCase"),Ro=o=>f(u(o).replace(/['\u2019]/g,"")).reduce((s,n,t)=>(n=n.toLowerCase(),s+(t?Z(n):n)),""),mo=o=>f(u(o).replace(B,"")).reduce((s,n,t)=>s+(t?" ":"")+n.toLowerCase(),""),Co=o=>f(u(o).replace(/['\u2019]/g,"")).reduce((s,n,t)=>s+(t?"_":"")+n.toLowerCase(),""),Ao=o=>f(`${o}`.replace(/['\u2019]/g,"")).reduce((s,n,t)=>s+(t?" ":"")+Z(n),"");export{Ro as camelCase,mo as lowerCase,Co as snakeCase,Ao as startCase};
1
+ /* Functions in this file are copied from lodash */
2
+ /** Used to compose unicode character classes. */
3
+ const rsAstralRange = '\\ud800-\\udfff';
4
+ const rsComboMarksRange = '\\u0300-\\u036f';
5
+ const reComboHalfMarksRange = '\\ufe20-\\ufe2f';
6
+ const rsComboSymbolsRange = '\\u20d0-\\u20ff';
7
+ const rsComboMarksExtendedRange = '\\u1ab0-\\u1aff';
8
+ const rsComboMarksSupplementRange = '\\u1dc0-\\u1dff';
9
+ const rsComboRange = rsComboMarksRange +
10
+ reComboHalfMarksRange +
11
+ rsComboSymbolsRange +
12
+ rsComboMarksExtendedRange +
13
+ rsComboMarksSupplementRange;
14
+ const rsDingbatRange = '\\u2700-\\u27bf';
15
+ const rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff';
16
+ const rsMathOpRange = '\\xac\\xb1\\xd7\\xf7';
17
+ const rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf';
18
+ const rsPunctuationRange = '\\u2000-\\u206f';
19
+ const rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000';
20
+ const rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde';
21
+ const rsVarRange = '\\ufe0e\\ufe0f';
22
+ const rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
23
+ const reQuotes = /['\u2019]/g;
24
+ /** Used to compose unicode capture groups. */
25
+ const rsApos = "['\u2019]";
26
+ const rsBreak = `[${rsBreakRange}]`;
27
+ const rsCombo = `[${rsComboRange}]`;
28
+ const rsDigit = '\\d';
29
+ const rsDingbat = `[${rsDingbatRange}]`;
30
+ const rsLower = `[${rsLowerRange}]`;
31
+ const rsMisc = `[^${rsAstralRange}${rsBreakRange + rsDigit + rsDingbatRange + rsLowerRange + rsUpperRange}]`;
32
+ const rsFitz = '\\ud83c[\\udffb-\\udfff]';
33
+ const rsModifier = `(?:${rsCombo}|${rsFitz})`;
34
+ const rsNonAstral = `[^${rsAstralRange}]`;
35
+ const rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}';
36
+ const rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]';
37
+ const rsUpper = `[${rsUpperRange}]`;
38
+ const rsZWJ = '\\u200d';
39
+ /** Used to compose unicode regexes. */
40
+ const rsMiscLower = `(?:${rsLower}|${rsMisc})`;
41
+ const rsMiscUpper = `(?:${rsUpper}|${rsMisc})`;
42
+ const rsOptContrLower = `(?:${rsApos}(?:d|ll|m|re|s|t|ve))?`;
43
+ const rsOptContrUpper = `(?:${rsApos}(?:D|LL|M|RE|S|T|VE))?`;
44
+ const reOptMod = `${rsModifier}?`;
45
+ const rsOptVar = `[${rsVarRange}]?`;
46
+ const rsOptJoin = `(?:${rsZWJ}(?:${[rsNonAstral, rsRegional, rsSurrPair].join('|')})${rsOptVar + reOptMod})*`;
47
+ const rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])';
48
+ const rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])';
49
+ const rsSeq = rsOptVar + reOptMod + rsOptJoin;
50
+ const rsEmoji = `(?:${[rsDingbat, rsRegional, rsSurrPair].join('|')})${rsSeq}`;
51
+ const reUnicodeWords = RegExp(
52
+ // eslint-disable-next-line no-misleading-character-class
53
+ [
54
+ `${rsUpper}?${rsLower}+${rsOptContrLower}(?=${[rsBreak, rsUpper, '$'].join('|')})`,
55
+ `${rsMiscUpper}+${rsOptContrUpper}(?=${[rsBreak, rsUpper + rsMiscLower, '$'].join('|')})`,
56
+ `${rsUpper}?${rsMiscLower}+${rsOptContrLower}`,
57
+ `${rsUpper}+${rsOptContrUpper}`,
58
+ rsOrdUpper,
59
+ rsOrdLower,
60
+ `${rsDigit}+`,
61
+ rsEmoji,
62
+ ].join('|'), 'g');
63
+ const unicodeWords = (string) => string.match(reUnicodeWords);
64
+ /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
65
+ // eslint-disable-next-line no-misleading-character-class
66
+ const reHasUnicode = RegExp(`[${rsZWJ + rsAstralRange + rsComboRange + rsVarRange}]`);
67
+ /**
68
+ * Checks if `string` contains Unicode symbols.
69
+ *
70
+ * @private
71
+ * @param {string} string The string to inspect.
72
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
73
+ */
74
+ const hasUnicode = (string) => reHasUnicode.test(string);
75
+ /** Used to compose unicode capture groups. */
76
+ const rsAstral = `[${rsAstralRange}]`;
77
+ const rsNonAstralCombo = `${rsNonAstral}${rsCombo}?`;
78
+ const rsSymbol = `(?:${[rsNonAstralCombo, rsCombo, rsRegional, rsSurrPair, rsAstral].join('|')})`;
79
+ /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
80
+ // eslint-disable-next-line no-misleading-character-class
81
+ const reUnicode = RegExp(`${rsFitz}(?=${rsFitz})|${rsSymbol + rsSeq}`, 'g');
82
+ const unicodeToArray = (string) => string.match(reUnicode) || [];
83
+ const asciiToArray = (string) => string.split('');
84
+ const getTag = (value) => {
85
+ const toString = Object.prototype.toString;
86
+ if (value == null) {
87
+ return value === undefined ? '[object Undefined]' : '[object Null]';
88
+ }
89
+ return toString.call(value);
90
+ };
91
+ const isSymbol = (value) => {
92
+ const type = typeof value;
93
+ return (type == 'symbol' || (type === 'object' && value != null && getTag(value) == '[object Symbol]'));
94
+ };
95
+ /** Used as references for various `Number` constants. */
96
+ const INFINITY = 1 / 0;
97
+ const toString = (value) => {
98
+ if (value == null) {
99
+ return '';
100
+ }
101
+ // Exit early for strings to avoid a performance hit in some environments.
102
+ if (typeof value === 'string') {
103
+ return value;
104
+ }
105
+ if (Array.isArray(value)) {
106
+ // Recursively convert values (susceptible to call stack limits).
107
+ return `${value.map((other) => (other == null ? other : toString(other)))}`;
108
+ }
109
+ if (isSymbol(value)) {
110
+ return value.toString();
111
+ }
112
+ const result = `${value}`;
113
+ return result == '0' && 1 / value == -INFINITY ? '-0' : result;
114
+ };
115
+ const hasUnicodeWord = RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);
116
+ /** Used to match words composed of alphanumeric characters. */
117
+ // eslint-disable-next-line no-control-regex
118
+ const reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
119
+ const asciiWords = (string) => string.match(reAsciiWord);
120
+ const slice = (array, start, end) => {
121
+ let length = array == null ? 0 : array.length;
122
+ if (!length) {
123
+ return [];
124
+ }
125
+ start = start == null ? 0 : start;
126
+ end = end === undefined ? length : end;
127
+ if (start < 0) {
128
+ start = -start > length ? 0 : length + start;
129
+ }
130
+ end = end > length ? length : end;
131
+ if (end < 0) {
132
+ end += length;
133
+ }
134
+ length = start > end ? 0 : (end - start) >>> 0;
135
+ start >>>= 0;
136
+ let index = -1;
137
+ const result = new Array(length);
138
+ while (++index < length) {
139
+ result[index] = array[index + start];
140
+ }
141
+ return result;
142
+ };
143
+ const words = (string) => {
144
+ const result = hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
145
+ return result || [];
146
+ };
147
+ const castSlice = (array, start) => {
148
+ const { length } = array;
149
+ const end = length;
150
+ return !start && end >= length ? array : slice(array, start, end);
151
+ };
152
+ const stringToArray = (string) => hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
153
+ const createCaseFirst = (methodName) => {
154
+ return (string) => {
155
+ if (!string) {
156
+ return '';
157
+ }
158
+ const strSymbols = hasUnicode(string) ? stringToArray(string) : undefined;
159
+ const chr = strSymbols ? strSymbols[0] : string[0];
160
+ const trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1);
161
+ return chr[methodName]() + trailing;
162
+ };
163
+ };
164
+ const upperFirst = createCaseFirst('toUpperCase');
165
+ const camelCase = (string) => words(toString(string).replace(/['\u2019]/g, '')).reduce((result, word, index) => {
166
+ word = word.toLowerCase();
167
+ return result + (index ? upperFirst(word) : word);
168
+ }, '');
169
+ const lowerCase = (string) => words(toString(string).replace(reQuotes, '')).reduce((result, word, index) => result + (index ? ' ' : '') + word.toLowerCase(), '');
170
+ const snakeCase = (string) => words(toString(string).replace(/['\u2019]/g, '')).reduce((result, word, index) => result + (index ? '_' : '') + word.toLowerCase(), '');
171
+ const startCase = (string) => words(`${string}`.replace(/['\u2019]/g, '')).reduce((result, word, index) => result + (index ? ' ' : '') + upperFirst(word), '');
172
+ export { camelCase, lowerCase, snakeCase, startCase };
173
+ //# sourceMappingURL=lodash-int.js.map