@scalar/api-client 2.14.1 → 2.17.0

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 (293) hide show
  1. package/CHANGELOG.md +176 -0
  2. package/dist/hooks/useResponseBody.js +6 -6
  3. package/dist/libs/errors.d.ts +1 -0
  4. package/dist/libs/errors.d.ts.map +1 -1
  5. package/dist/libs/errors.js +1 -0
  6. package/dist/libs/send-request/create-request-operation.d.ts.map +1 -1
  7. package/dist/libs/send-request/create-request-operation.js +41 -35
  8. package/dist/style.css +1 -1
  9. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +28 -38
  10. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  11. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +81 -65
  12. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -23
  13. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  14. package/dist/v2/blocks/operation-block/components/Header.vue.js +3 -3
  15. package/dist/v2/blocks/operation-block/components/Header.vue2.js +29 -38
  16. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts +10 -0
  17. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -0
  18. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +22 -0
  19. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +31 -0
  20. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +1 -0
  21. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +31 -0
  22. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +3 -9
  23. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
  24. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +56 -0
  25. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +10 -3
  26. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
  27. package/dist/v2/blocks/operation-block/helpers/build-request-security.js +46 -0
  28. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +45 -0
  29. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -0
  30. package/dist/v2/blocks/operation-block/helpers/build-request.js +66 -0
  31. package/dist/v2/blocks/operation-block/helpers/decode-buffer.js +9 -0
  32. package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.d.ts +16 -0
  33. package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.d.ts.map +1 -0
  34. package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.js +4 -0
  35. package/dist/v2/blocks/operation-block/helpers/get-delimiter.js +17 -0
  36. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts +9 -3
  37. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  38. package/dist/v2/blocks/operation-block/helpers/get-example.js +21 -0
  39. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +53 -0
  40. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -0
  41. package/dist/v2/blocks/operation-block/helpers/send-request.js +120 -0
  42. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts +1 -1
  43. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -1
  44. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  45. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  46. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +89 -110
  47. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +2 -2
  48. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts.map +1 -1
  49. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +8 -13
  50. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts.map +1 -1
  51. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +22 -28
  52. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +19 -8
  53. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
  54. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +30 -24
  55. package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts +12 -0
  56. package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts.map +1 -0
  57. package/dist/v2/blocks/operation-code-sample/helpers/get-clients.js +20 -0
  58. package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts +10 -0
  59. package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts.map +1 -0
  60. package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.js +4 -0
  61. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +14 -12
  62. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -1
  63. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +191 -169
  64. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  65. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +10 -10
  66. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +2 -1
  67. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
  68. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +15 -19
  69. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +2 -2
  70. package/dist/v2/blocks/operation-code-sample/index.d.ts +1 -1
  71. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
  72. package/dist/v2/blocks/operation-code-sample/types.d.ts +16 -0
  73. package/dist/v2/blocks/operation-code-sample/types.d.ts.map +1 -1
  74. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +15 -10
  75. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  76. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  77. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +202 -160
  78. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts +2 -0
  79. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  80. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  81. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +60 -51
  82. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts +8 -0
  83. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -0
  84. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +127 -0
  85. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue2.js +4 -0
  86. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts +2 -2
  87. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  88. package/dist/v2/blocks/request-block/components/RequestParams.vue.js +24 -23
  89. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -4
  90. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  91. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  92. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +3 -2
  93. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  94. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +146 -147
  95. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts +1 -0
  96. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
  97. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js +1 -1
  98. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue2.js +28 -27
  99. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts +1 -1
  100. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts.map +1 -1
  101. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js +21 -15
  102. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts +3 -2
  103. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts.map +1 -1
  104. package/dist/v2/blocks/request-block/helpers/get-request-body-example.js +13 -3
  105. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +4 -4
  106. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  107. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +3 -3
  108. package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +41 -45
  109. package/dist/v2/blocks/response-block/components/Headers.vue.d.ts.map +1 -1
  110. package/dist/v2/blocks/response-block/components/Headers.vue.js +27 -27
  111. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js +1 -1
  112. package/dist/v2/blocks/response-block/helpers/parse-set-cookie.d.ts +18 -0
  113. package/dist/v2/blocks/response-block/helpers/parse-set-cookie.d.ts.map +1 -0
  114. package/dist/v2/blocks/response-block/helpers/parse-set-cookie.js +12 -0
  115. package/dist/v2/blocks/response-block/helpers/process-response-body.js +2 -2
  116. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +4 -15
  117. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  118. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  119. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +117 -71
  120. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts +19 -0
  121. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts.map +1 -0
  122. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.js +24 -0
  123. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +3 -2
  124. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  125. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +59 -56
  126. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +1 -1
  127. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  128. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +3 -1
  129. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  130. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +26 -24
  131. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +2 -1
  132. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  133. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +44 -43
  134. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts +4 -0
  135. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts.map +1 -0
  136. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js +7 -0
  137. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +4 -4
  138. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  139. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -2
  140. package/dist/v2/components/code-input/CodeInput.vue.d.ts +16 -6
  141. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  142. package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
  143. package/dist/v2/components/code-input/CodeInput.vue2.js +81 -65
  144. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +2 -2
  145. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
  146. package/dist/v2/components/data-table/DataTableInputSelect.vue.js +44 -44
  147. package/dist/v2/components/resize/index.d.ts +0 -1
  148. package/dist/v2/components/resize/index.d.ts.map +1 -1
  149. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +9 -5
  150. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  151. package/dist/v2/components/sidebar/Sidebar.vue.js +51 -46
  152. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +1 -1
  153. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  154. package/dist/v2/features/app/App.vue.d.ts +3 -0
  155. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  156. package/dist/v2/features/app/App.vue.js +130 -143
  157. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +3 -3
  158. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  159. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  160. package/dist/v2/features/app/components/AppSidebar.vue2.js +216 -106
  161. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +1 -1
  162. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  163. package/dist/v2/features/app/components/ItemDecorator.vue.d.ts +22 -0
  164. package/dist/v2/features/app/components/ItemDecorator.vue.d.ts.map +1 -0
  165. package/dist/v2/features/app/components/ItemDecorator.vue.js +138 -0
  166. package/dist/v2/features/app/components/ItemDecorator.vue2.js +4 -0
  167. package/dist/v2/features/app/components/WebTopNav.vue.d.ts +1 -1
  168. package/dist/v2/features/app/components/WebTopNav.vue.d.ts.map +1 -1
  169. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +2 -2
  170. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  171. package/dist/v2/features/app/helpers/create-api-client-app.js +8 -8
  172. package/dist/v2/features/app/helpers/routes.d.ts +32 -6
  173. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  174. package/dist/v2/features/app/helpers/routes.js +25 -16
  175. package/dist/v2/{hooks/use-sidebar-state.d.ts → features/app/hooks/use-app-sidebar.d.ts} +10 -11
  176. package/dist/v2/features/app/hooks/use-app-sidebar.d.ts.map +1 -0
  177. package/dist/v2/{hooks/use-sidebar-state.js → features/app/hooks/use-app-sidebar.js} +19 -19
  178. package/dist/v2/features/app/hooks/use-document-watcher.d.ts.map +1 -0
  179. package/dist/v2/{hooks → features/app/hooks}/use-sync-path.d.ts +2 -2
  180. package/dist/v2/features/app/hooks/use-sync-path.d.ts.map +1 -0
  181. package/dist/v2/features/app/hooks/use-sync-path.js +52 -0
  182. package/dist/v2/{hooks → features/app/hooks}/use-tabs.d.ts +2 -2
  183. package/dist/v2/features/app/hooks/use-tabs.d.ts.map +1 -0
  184. package/dist/v2/{hooks → features/app/hooks}/use-tabs.js +1 -1
  185. package/dist/v2/{hooks/use-workspace-client-events.d.ts → features/app/hooks/use-workspace-client-app-events.d.ts} +5 -5
  186. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +1 -0
  187. package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +156 -0
  188. package/dist/v2/features/app/hooks/use-workspace-selector.d.ts.map +1 -0
  189. package/dist/v2/{hooks → features/app/hooks}/use-workspace-selector.js +1 -1
  190. package/dist/v2/features/collection/DocumentCollection.vue.js +92 -2
  191. package/dist/v2/features/collection/DocumentCollection.vue2.js +2 -91
  192. package/dist/v2/features/collection/WorkspaceCollection.vue.js +42 -2
  193. package/dist/v2/features/collection/WorkspaceCollection.vue2.js +2 -41
  194. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  195. package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
  196. package/dist/v2/features/collection/components/Authentication.vue2.js +14 -12
  197. package/dist/v2/features/collection/components/Cookies.vue.js +30 -1
  198. package/dist/v2/features/collection/components/Cookies.vue2.js +1 -29
  199. package/dist/v2/features/collection/components/Environment.vue.js +32 -1
  200. package/dist/v2/features/collection/components/Environment.vue2.js +1 -31
  201. package/dist/v2/features/collection/components/Overview.vue2.js +5 -4
  202. package/dist/v2/features/collection/components/Servers.vue.js +142 -2
  203. package/dist/v2/features/collection/components/Servers.vue2.js +2 -141
  204. package/dist/v2/features/collection/components/Settings.vue.js +58 -2
  205. package/dist/v2/features/collection/components/Settings.vue2.js +2 -57
  206. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +8 -0
  207. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -1
  208. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +76 -68
  209. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +8 -0
  210. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -1
  211. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +83 -75
  212. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +4 -0
  213. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -1
  214. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +32 -34
  215. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +16 -0
  216. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
  217. package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +24 -21
  218. package/dist/v2/features/modal/Modal.vue.d.ts +23 -1
  219. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  220. package/dist/v2/features/modal/Modal.vue.js +1 -1
  221. package/dist/v2/features/modal/Modal.vue2.js +118 -31
  222. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +18 -32
  223. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  224. package/dist/v2/features/modal/helpers/create-api-client-modal.js +46 -26
  225. package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts +55 -0
  226. package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts.map +1 -0
  227. package/dist/v2/features/modal/helpers/resolve-route-parameters.js +29 -0
  228. package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts +42 -0
  229. package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts.map +1 -0
  230. package/dist/v2/features/modal/hooks/use-modal-sidebar.js +93 -0
  231. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts +18 -0
  232. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +1 -0
  233. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +30 -0
  234. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  235. package/dist/v2/features/operation/Operation.vue.js +59 -28
  236. package/dist/v2/features/operation/helpers/get-operation-header.d.ts +17 -0
  237. package/dist/v2/features/operation/helpers/get-operation-header.d.ts.map +1 -0
  238. package/dist/v2/features/operation/helpers/get-operation-header.js +12 -0
  239. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +1 -1
  240. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +1 -1
  241. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +7 -0
  242. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -0
  243. package/dist/v2/features/operation/helpers/get-selected-security.js +19 -0
  244. package/dist/v2/features/operation/index.d.ts +0 -1
  245. package/dist/v2/features/operation/index.d.ts.map +1 -1
  246. package/dist/v2/features/search/components/SearchModal.vue.d.ts.map +1 -1
  247. package/dist/v2/features/search/components/SearchModal.vue.js +3 -3
  248. package/dist/v2/features/search/components/SearchModal.vue2.js +45 -44
  249. package/dist/v2/features/settings/DocumentSettings.vue.js +2 -2
  250. package/dist/v2/features/settings/DocumentSettings.vue2.js +1 -1
  251. package/dist/v2/helpers/generate-location-id.d.ts +19 -0
  252. package/dist/v2/helpers/generate-location-id.d.ts.map +1 -0
  253. package/dist/v2/helpers/generate-location-id.js +10 -0
  254. package/dist/v2/helpers/get-active-environment.d.ts +5 -0
  255. package/dist/v2/helpers/get-active-environment.d.ts.map +1 -0
  256. package/dist/v2/helpers/get-active-environment.js +22 -0
  257. package/dist/v2/helpers/get-tab-details.d.ts +2 -2
  258. package/dist/v2/helpers/get-tab-details.d.ts.map +1 -1
  259. package/dist/v2/helpers/handle-hotkeys.js +1 -1
  260. package/dist/v2/helpers/plugins.d.ts +59 -0
  261. package/dist/v2/helpers/plugins.d.ts.map +1 -0
  262. package/dist/v2/helpers/plugins.js +11 -0
  263. package/dist/v2/helpers/storage.d.ts.map +1 -1
  264. package/dist/v2/helpers/storage.js +5 -5
  265. package/dist/v2/hooks/use-scroll-lock.d.ts +28 -0
  266. package/dist/v2/hooks/use-scroll-lock.d.ts.map +1 -0
  267. package/dist/v2/hooks/use-scroll-lock.js +21 -0
  268. package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts +2 -0
  269. package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts.map +1 -1
  270. package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +1 -1
  271. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts +0 -1
  272. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts.map +1 -1
  273. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  274. package/package.json +19 -19
  275. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts +0 -7
  276. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts.map +0 -1
  277. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.js +0 -28
  278. package/dist/v2/blocks/request-block/helpers/get-parameter-example.d.ts +0 -6
  279. package/dist/v2/blocks/request-block/helpers/get-parameter-example.d.ts.map +0 -1
  280. package/dist/v2/blocks/request-block/helpers/get-parameter-example.js +0 -12
  281. package/dist/v2/hooks/use-document-watcher.d.ts.map +0 -1
  282. package/dist/v2/hooks/use-sidebar-state.d.ts.map +0 -1
  283. package/dist/v2/hooks/use-sync-path.d.ts.map +0 -1
  284. package/dist/v2/hooks/use-sync-path.js +0 -51
  285. package/dist/v2/hooks/use-tabs.d.ts.map +0 -1
  286. package/dist/v2/hooks/use-workspace-client-events.d.ts.map +0 -1
  287. package/dist/v2/hooks/use-workspace-client-events.js +0 -112
  288. package/dist/v2/hooks/use-workspace-selector.d.ts.map +0 -1
  289. package/dist/v2/plugins.d.ts +0 -44
  290. package/dist/v2/plugins.d.ts.map +0 -1
  291. /package/dist/v2/{hooks → features/app/hooks}/use-document-watcher.d.ts +0 -0
  292. /package/dist/v2/{hooks → features/app/hooks}/use-document-watcher.js +0 -0
  293. /package/dist/v2/{hooks → features/app/hooks}/use-workspace-selector.d.ts +0 -0
@@ -0,0 +1,31 @@
1
+ import { replaceEnvVariables as n } from "@scalar/helpers/regex/replace-variables";
2
+ import { xScalarCookieSchema as l } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
3
+ import { coerceValue as d } from "@scalar/workspace-store/schemas/typebox-coerce";
4
+ import { matchesDomain as f } from "../../../../libs/send-request/set-request-cookies.js";
5
+ const c = "We're using a `X-Scalar-Cookie` custom header to the request. The proxy will forward this as a `Cookie` header. We do this to avoid the browser omitting the `Cookie` header for cross-origin requests for security reasons.", b = `We're trying to add a Cookie header, but browsers often omit them for cross-origin requests for various security reasons. If it's not working, that's probably why. Here are the requirements for it to work:
6
+
7
+ - The browser URL must be on the same domain as the server URL.
8
+ - The connection must be made over HTTPS.
9
+ `, p = (a, o) => {
10
+ const r = a.map((t) => `${t.name}=${t.value}`).join("; ");
11
+ return o && r ? `${o}; ${r}` : o || r || "";
12
+ }, R = ({
13
+ paramCookies: a,
14
+ globalCookies: o,
15
+ env: r,
16
+ path: t,
17
+ originalCookieHeader: i,
18
+ url: m,
19
+ useCustomCookieHeader: u
20
+ }) => {
21
+ const h = o.flatMap((e) => e.isDisabled || !e.name || e.domain && !f(m, e.domain) || e.path && !t.startsWith(e.path) ? [] : d(l, {
22
+ ...e,
23
+ name: n(e.name, r),
24
+ value: n(e.value, r)
25
+ })), s = p([...h, ...a], i);
26
+ return s ? u ? (console.warn(c), { name: "X-Scalar-Cookie", value: s }) : (console.warn(b), { name: "Cookie", value: s }) : null;
27
+ };
28
+ export {
29
+ R as buildRequestCookieHeader,
30
+ p as getCookieHeader
31
+ };
@@ -1,5 +1,5 @@
1
1
  import { type XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
2
- import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ import type { ParameterObject, ReferenceType } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
3
  /**
4
4
  * Converts the parameters into a set of headers, cookies and url params while
5
5
  * replacing environment variables and extracting example values. Also builds up a record of the path
@@ -14,17 +14,11 @@ import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/stric
14
14
  */
15
15
  export declare const buildRequestParameters: (
16
16
  /** All parameters */
17
- parameters?: ParameterObject[],
17
+ parameters?: ReferenceType<ParameterObject>[],
18
18
  /** Environment variables flattened into a key-value object */
19
19
  env?: Record<string, string>,
20
20
  /** The key of the current example */
21
- exampleKey?: string,
22
- /**
23
- * Content type for content based parameters
24
- *
25
- * @see https://spec.openapis.org/oas/latest.html#fixed-fields-for-use-with-content
26
- */
27
- contentType?: string) => {
21
+ exampleKey?: string) => {
28
22
  cookies: XScalarCookie[];
29
23
  headers: Record<string, string>;
30
24
  pathVariables: Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-parameters.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAKnG;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,eAAe,EAAO;AAClC,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qCAAqC;AACrC,aAAY,MAAkB;AAC9B;;;;GAIG;AACH,cAAa,MAA2B,KACvC;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,SAAS,EAAE,eAAe,CAAA;CAkFzB,CAAA"}
1
+ {"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-parameters.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAKlH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qCAAqC;AACrC,aAAY,MAAkB,KAC7B;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,SAAS,EAAE,eAAe,CAAA;CAsG3B,CAAA"}
@@ -0,0 +1,56 @@
1
+ import { replaceEnvVariables as m } from "@scalar/helpers/regex/replace-variables";
2
+ import { getResolvedRef as u } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ import { xScalarCookieSchema as P } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
4
+ import { coerceValue as y } from "@scalar/workspace-store/schemas/typebox-coerce";
5
+ import { getDelimiter as c } from "./get-delimiter.js";
6
+ import { getExample as v } from "./get-example.js";
7
+ const $ = (f = [], n = {}, l = "default") => {
8
+ const a = [];
9
+ let i = "application/json";
10
+ for (const t of f) {
11
+ const e = u(t);
12
+ a.push(e), e.in === "header" && e.name.toLowerCase() === "content-type" && "examples" in e && (i = u(e?.examples?.[l])?.value ?? i);
13
+ }
14
+ return a.reduce(
15
+ (t, e) => {
16
+ const s = v(e, l, i);
17
+ if (!s || s["x-disabled"])
18
+ return t;
19
+ const r = typeof s.value == "string" ? m(s.value, n) : s.value, o = m(e.name, n);
20
+ if (e.in === "header") {
21
+ if (o.toLowerCase() === "content-type" && r === "multipart/form-data")
22
+ return t;
23
+ t.headers[o] ? t.headers[o] += `,${r}` : t.headers[o] = r;
24
+ }
25
+ if (e.in === "path" && (t.pathVariables[o] = encodeURIComponent(r)), e.in === "query") {
26
+ const p = "explode" in e && e.explode !== void 0 ? e.explode : !0, h = "style" in e && e.style ? e.style : "form";
27
+ if (p)
28
+ t.urlParams.append(o, r);
29
+ else {
30
+ const d = t.urlParams.get(o);
31
+ if (d) {
32
+ const x = c(h);
33
+ t.urlParams.set(o, `${d}${x}${r}`);
34
+ } else
35
+ t.urlParams.set(o, r);
36
+ }
37
+ }
38
+ return e.in === "cookie" && t.cookies.push(
39
+ y(P, {
40
+ name: o,
41
+ value: r,
42
+ path: "/"
43
+ })
44
+ ), t;
45
+ },
46
+ {
47
+ cookies: [],
48
+ headers: {},
49
+ pathVariables: {},
50
+ urlParams: new URLSearchParams()
51
+ }
52
+ );
53
+ };
54
+ export {
55
+ $ as buildRequestParameters
56
+ };
@@ -1,12 +1,19 @@
1
1
  import { type XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
2
- import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ import type { OpenApiDocument, SecurityRequirementObject, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ /**
4
+ * Get the selected security schemes from the selected security.
5
+ * Takes security requirement objects and resolves them to actual security scheme objects.
6
+ */
7
+ export declare const getSelectedSecuritySchemes: (securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"], selectedSecurity: SecurityRequirementObject[]) => SecuritySchemeObject[];
3
8
  /**
4
9
  * Generates the headers, cookies and query params for selected security schemes
5
10
  * In the future we can add customization for where the security is applied
6
11
  */
7
12
  export declare const buildRequestSecurity: (
8
- /** Applicable security schemes */
9
- securitySchemes?: SecuritySchemeObject[],
13
+ /** Document defined security schemes */
14
+ securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"],
15
+ /** Currently selected security for the current operation */
16
+ selectedSecurity: SecurityRequirementObject[],
10
17
  /** Environment variables flattened into a key-value object */
11
18
  env?: Record<string, string>,
12
19
  /** Include this parameter to set the placeholder for empty tokens */
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAGxG;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,kCAAkC;AAClC,kBAAiB,oBAAoB,EAAO;AAC5C,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qEAAqE;AACrE,8BAA0B,KACzB;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAmDzF,CAAA"}
1
+ {"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAGrE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GACrC,iBAAiB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAC9E,kBAAkB,yBAAyB,EAAE,KAC5C,oBAAoB,EAUd,CAAA;AAET;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,wCAAwC;AACxC,iBAAiB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;AAC9E,4DAA4D;AAC5D,kBAAkB,yBAAyB,EAAE;AAC7C,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qEAAqE;AACrE,8BAA0B,KACzB;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CA0DzF,CAAA"}
@@ -0,0 +1,46 @@
1
+ import { isDefined as p } from "@scalar/helpers/array/is-defined";
2
+ import { objectKeys as m } from "@scalar/helpers/object/object-keys";
3
+ import { replaceEnvVariables as s } from "@scalar/helpers/regex/replace-variables";
4
+ import { getResolvedRef as d } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
+ import { xScalarCookieSchema as S } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
6
+ import { coerceValue as x } from "@scalar/workspace-store/schemas/typebox-coerce";
7
+ import { encode as y } from "js-base64";
8
+ const k = (n, f) => f.flatMap(
9
+ (r) => m(r).flatMap((i) => {
10
+ const o = d(n?.[i]);
11
+ return o || [];
12
+ })
13
+ ) ?? [], g = (n, f, r = {}, i = "") => {
14
+ const o = {}, u = [], l = new URLSearchParams();
15
+ return k(n, f).forEach((t) => {
16
+ if (t.type === "apiKey") {
17
+ const e = s(t.name, r), a = s(t["x-scalar-secret-token"], r) || i;
18
+ t.in === "header" && (o[e] = a), t.in === "query" && l.append(e, a), t.in === "cookie" && u.push(
19
+ x(S, {
20
+ name: e,
21
+ value: a,
22
+ path: "/"
23
+ })
24
+ );
25
+ }
26
+ if (t.type === "http")
27
+ if (t.scheme === "basic") {
28
+ const e = s(t["x-scalar-secret-username"], r), a = s(t["x-scalar-secret-password"], r), c = `${e}:${a}`;
29
+ o.Authorization = `Basic ${c === ":" ? "username:password" : y(c)}`;
30
+ } else {
31
+ const e = s(t["x-scalar-secret-token"], r);
32
+ o.Authorization = `Bearer ${e || i}`;
33
+ }
34
+ if (t.type === "oauth2") {
35
+ const e = Object.values(t.flows), a = s(
36
+ e.filter(p).find((c) => c["x-scalar-secret-token"])?.["x-scalar-secret-token"] ?? "",
37
+ r
38
+ );
39
+ o.Authorization = `Bearer ${a || i}`;
40
+ }
41
+ }), { headers: o, cookies: u, urlParams: l };
42
+ };
43
+ export {
44
+ g as buildRequestSecurity,
45
+ k as getSelectedSecuritySchemes
46
+ };
@@ -0,0 +1,45 @@
1
+ import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
+ import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
3
+ import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
4
+ import type { OpenApiDocument, SecurityRequirementObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
5
+ import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
6
+ import { type ErrorResponse } from '../../../../libs/errors.js';
7
+ /**
8
+ * Builds a fully configured Request object ready for execution.
9
+ *
10
+ * This function processes an OpenAPI operation and constructs a fetch-compatible
11
+ * Request by resolving environment variables, applying security schemes, building
12
+ * headers and cookies, handling proxy redirection, and preparing the request body.
13
+ *
14
+ * The function handles special cases like Electron environments and proxy usage
15
+ * where custom cookie headers are required.
16
+ *
17
+ * @returns A tuple containing either an error or the request object with an abort controller
18
+ */
19
+ export declare const buildRequest: ({ environment, exampleKey, globalCookies, method, operation, path, proxyUrl, server, securitySchemes, selectedSecurity, }: {
20
+ /** For environment variables in the inputs */
21
+ environment: XScalarEnvironment;
22
+ /** The key of the current example */
23
+ exampleKey: string;
24
+ /** Workspace + document cookies */
25
+ globalCookies: XScalarCookie[];
26
+ /** The HTTP method of the operation */
27
+ method: HttpMethod;
28
+ /** The operation object */
29
+ operation: OperationObject;
30
+ /** The path of the operation */
31
+ path: string;
32
+ /** The proxy URL for cookie domain determination */
33
+ proxyUrl: string;
34
+ /** Document defined security schemes */
35
+ securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"];
36
+ /** Currently selected security for the current operation */
37
+ selectedSecurity: SecurityRequirementObject[];
38
+ /** The server object */
39
+ server: ServerObject | null;
40
+ }) => ErrorResponse<{
41
+ controller: AbortController;
42
+ request: Request;
43
+ isUsingProxy: boolean;
44
+ }>;
45
+ //# sourceMappingURL=build-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAKnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAO1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,2HAW1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,eAAe,EAAE,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAA;IAC9E,4DAA4D;IAC5D,gBAAgB,EAAE,yBAAyB,EAAE,CAAA;IAC7C,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;CAC5B,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CAwFA,CAAA"}
@@ -0,0 +1,66 @@
1
+ import { replaceVariables as U } from "@scalar/helpers/regex/replace-variables";
2
+ import { mergeUrls as x } from "@scalar/helpers/url/merge-urls";
3
+ import { shouldUseProxy as I, redirectToProxy as T } from "@scalar/oas-utils/helpers";
4
+ import { getResolvedRef as V } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
+ import { objectEntries as _ } from "@vueuse/core";
6
+ import { isElectron as k } from "../../../../libs/electron.js";
7
+ import { ERRORS as q, normalizeError as D } from "../../../../libs/errors.js";
8
+ import { buildRequestBody as j } from "./build-request-body.js";
9
+ import { buildRequestCookieHeader as z } from "./build-request-cookie-header.js";
10
+ import { buildRequestParameters as F } from "./build-request-parameters.js";
11
+ import { buildRequestSecurity as G } from "./build-request-security.js";
12
+ const ee = ({
13
+ environment: y,
14
+ exampleKey: u = "default",
15
+ globalCookies: h,
16
+ method: v,
17
+ operation: m,
18
+ path: a,
19
+ proxyUrl: c,
20
+ server: d,
21
+ securitySchemes: E,
22
+ selectedSecurity: C
23
+ }) => {
24
+ try {
25
+ const e = y.variables.reduce(
26
+ (t, o) => (t[o.name] = typeof o.value == "string" ? o.value : o.value.default, t),
27
+ {}
28
+ ), A = _(d?.variables ?? {}).reduce(
29
+ (t, [o, P]) => (P.default && (t[o] = P.default), t),
30
+ {}
31
+ ), i = U(d?.url ?? "", { ...e, ...A }), H = V(m.requestBody);
32
+ if (!i && !a)
33
+ throw q.URL_EMPTY;
34
+ const s = F(m.parameters ?? [], e, u), S = j(H, e, u), n = G(E, C, e), r = { ...s.headers, ...n.headers }, w = new URLSearchParams([...s.urlParams, ...n.urlParams]), f = U(a, { ...e, ...s.pathVariables }), p = x(i, f, w), R = I(c, p), B = T(c, p), b = r["User-Agent"] || r["user-agent"];
35
+ k() && b && (r["X-Scalar-User-Agent"] = b);
36
+ const l = z({
37
+ paramCookies: [...s.cookies, ...n.cookies],
38
+ globalCookies: h,
39
+ env: e,
40
+ path: f,
41
+ originalCookieHeader: r.Cookie || r.cookie,
42
+ url: i || a,
43
+ useCustomCookieHeader: k() || R
44
+ });
45
+ l && (r[l.name] = l.value);
46
+ const g = new AbortController(), L = new Request(B, {
47
+ method: v,
48
+ headers: r,
49
+ signal: g.signal,
50
+ body: S
51
+ });
52
+ return [
53
+ null,
54
+ {
55
+ controller: g,
56
+ isUsingProxy: R,
57
+ request: L
58
+ }
59
+ ];
60
+ } catch (e) {
61
+ return [D(e, q.BUILDING_REQUEST_FAILED), null];
62
+ }
63
+ };
64
+ export {
65
+ ee as buildRequest
66
+ };
@@ -0,0 +1,9 @@
1
+ import t from "whatwg-mimetype";
2
+ import { isTextMediaType as c } from "../../../../views/Request/consts/mediaTypes.js";
3
+ const m = (r, o) => {
4
+ const e = new t(o);
5
+ return c(e.essence) ? new TextDecoder(e.parameters.get("charset")).decode(r) : new Blob([r], { type: e.essence });
6
+ };
7
+ export {
8
+ m as decodeBuffer
9
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Safely extract cookie header keys from response headers.
3
+ * Modern browsers support getSetCookie() which returns an array of Set-Cookie values.
4
+ *
5
+ * Note: Set-Cookie headers are often hidden from JavaScript due to security restrictions.
6
+ * The browser's network tab may show Set-Cookie headers that are not accessible via the
7
+ * Fetch API Headers object. This is intentional browser behavior to prevent JavaScript
8
+ * from accessing HttpOnly cookies and other sensitive cookie data.
9
+ *
10
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Headers/getSetCookie
11
+ *
12
+ * @param headers - The response headers object
13
+ * @returns Array of cookie header keys or empty array if not supported or restricted
14
+ */
15
+ export declare const getCookieHeaderKeys: (headers: Headers) => string[];
16
+ //# sourceMappingURL=get-cookie-header-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-cookie-header-keys.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-cookie-header-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,OAAO,KAAG,MAAM,EAE5D,CAAA"}
@@ -0,0 +1,4 @@
1
+ const o = (e) => "getSetCookie" in e && typeof e.getSetCookie == "function" ? e.getSetCookie() : [];
2
+ export {
3
+ o as getCookieHeaderKeys
4
+ };
@@ -0,0 +1,17 @@
1
+ const t = (e) => {
2
+ switch (e) {
3
+ // color=blue black brown
4
+ case "spaceDelimited":
5
+ return " ";
6
+ // color=blue|black|brown
7
+ case "pipeDelimited":
8
+ return "|";
9
+ // color=blue,black,brown
10
+ case "form":
11
+ default:
12
+ return ",";
13
+ }
14
+ };
15
+ export {
16
+ t as getDelimiter
17
+ };
@@ -1,4 +1,10 @@
1
- import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
- /** Grabs the example from both schema based and content based parameters */
3
- export declare const getExample: (param: ParameterObject, exampleKey: string, contentType: string) => import("@scalar/workspace-store/schemas/v3.1/strict/example").ExampleObject | undefined;
1
+ import type { ExampleObject, ParameterObject, RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /**
3
+ * Resolve an example value for a parameter or requestBody from either `examples` or `content.*.examples`.
4
+ * Or the [deprecated] `example` field.
5
+ * If no exampleKey is provided it will fallback to the first example in the examples object then the [deprecated]
6
+ * `example` field.
7
+ * Used both for send-request and generating code snippets.
8
+ */
9
+ export declare const getExample: (param: ParameterObject | RequestBodyObject, exampleKey: string | undefined, contentType: string | undefined) => ExampleObject | undefined;
4
10
  //# sourceMappingURL=get-example.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,4EAA4E;AAC5E,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,EAAE,YAAY,MAAM,EAAE,aAAa,MAAM,4FAQzF,CAAA"}
1
+ {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAIrE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,EAC1C,YAAY,MAAM,GAAG,SAAS,EAC9B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SA+ClB,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { getResolvedRef as d } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
+ import { getResolvedRefDeep as o } from "../../operation-code-sample/helpers/get-resolved-ref-deep.js";
3
+ const m = (e, s, l) => {
4
+ if ("content" in e) {
5
+ const t = e.content?.[l ?? Object.keys(e.content)[0] ?? ""], f = t?.examples ?? {}, c = s ?? Object.keys(f)[0] ?? "", i = o(f[c]);
6
+ return typeof i < "u" ? i : typeof s > "u" && t?.example ? { value: o(t.example) } : void 0;
7
+ }
8
+ if ("examples" in e || "example" in e) {
9
+ const t = d(e.examples) ?? {}, f = s ?? Object.keys(t)[0] ?? "", c = o(t?.[f]);
10
+ if (typeof c < "u")
11
+ return c;
12
+ if (typeof s > "u" && e.example)
13
+ return { value: o(e.example) };
14
+ }
15
+ const n = o(e);
16
+ if ("schema" in n && n.schema && "default" in n.schema && typeof n.schema.default < "u")
17
+ return { value: n.schema.default };
18
+ };
19
+ export {
20
+ m as getExample
21
+ };
@@ -0,0 +1,53 @@
1
+ import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
+ import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ import { type ErrorResponse } from '../../../../libs/errors.js';
4
+ import { type ClientPlugin } from '../../../../v2/helpers/plugins.js';
5
+ /** A single set of populated values for a sent request */
6
+ export type ResponseInstance = Omit<Response, 'headers'> & {
7
+ /** Store headers as an object to match what we had with axios */
8
+ headers: Record<string, string>;
9
+ /** Keys of headers which set cookies */
10
+ cookieHeaderKeys: string[];
11
+ /** Time in ms the request took */
12
+ duration: number;
13
+ /** The response status */
14
+ status: number;
15
+ /** The response status text */
16
+ statusText: string;
17
+ /** The response method */
18
+ method: HttpMethod;
19
+ /** The request path */
20
+ path: string;
21
+ } & ({
22
+ /** The response data */
23
+ data: string | Blob;
24
+ /** The response size in bytes */
25
+ size: number;
26
+ } | {
27
+ /** A stream reader for a streamable response body */
28
+ reader: ReadableStreamDefaultReader<Uint8Array>;
29
+ });
30
+ /**
31
+ * Execute the built fetch request and return a structured response.
32
+ *
33
+ * This function handles the complete request lifecycle including plugin hooks,
34
+ * response processing, streaming detection, and error handling. It supports both
35
+ * standard responses and server-sent event streams.
36
+ *
37
+ * @param request - The request built by the buildRequest helper
38
+ * @param operation - The OpenAPI operation being executed
39
+ * @param plugins - Array of client plugins to execute hooks
40
+ * @param isUsingProxy - Whether the request is being proxied for header handling
41
+ * @returns A tuple with either an error or the response data
42
+ */
43
+ export declare const sendRequest: ({ isUsingProxy, operation, request, plugins, }: {
44
+ isUsingProxy: boolean;
45
+ operation: OperationObject;
46
+ plugins: ClientPlugin[];
47
+ request: Request;
48
+ }) => Promise<ErrorResponse<{
49
+ response: ResponseInstance;
50
+ request: Request;
51
+ timestamp: number;
52
+ }>>;
53
+ //# sourceMappingURL=send-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/send-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAE1E,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,sBAAsB,CAAA;AAKrE,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG;IACzD,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,wCAAwC;IACxC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,0BAA0B;IAC1B,MAAM,EAAE,UAAU,CAAA;IAClB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,CACE;IACE,wBAAwB;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,qDAAqD;IACrD,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAA;CAChD,CACJ,CAAA;AAKH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAU,gDAK/B;IACD,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CACT,aAAa,CAAC;IACZ,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAC,CA0DH,CAAA"}
@@ -0,0 +1,120 @@
1
+ import { httpStatusCodes as S } from "@scalar/helpers/http/http-status-codes";
2
+ import { normalizeError as b, ERRORS as x } from "../../../../libs/errors.js";
3
+ import { normalizeHeaders as D } from "../../../../libs/normalize-headers.js";
4
+ import { executeHook as f } from "../../../helpers/plugins.js";
5
+ import { decodeBuffer as E } from "./decode-buffer.js";
6
+ import { getCookieHeaderKeys as T } from "./get-cookie-header-keys.js";
7
+ const H = [204, 205, 304], v = async ({
8
+ isUsingProxy: t,
9
+ operation: o,
10
+ request: i,
11
+ plugins: n
12
+ }) => {
13
+ try {
14
+ const s = await f(i, "beforeRequest", n), m = Date.now(), e = await fetch(s), a = Date.now(), c = a - m, d = e.headers.get("content-type"), r = D(e.headers, t), u = new URL(e.url), h = u.pathname + u.search, p = e.statusText || S[e.status]?.name || "", l = s.method, y = H.includes(e.status);
15
+ return d?.startsWith("text/event-stream") && e.body ? k({
16
+ response: e,
17
+ modifiedRequest: s,
18
+ operation: o,
19
+ plugins: n,
20
+ endTime: a,
21
+ duration: c,
22
+ responseHeaders: r,
23
+ statusText: p,
24
+ method: l,
25
+ fullPath: h
26
+ }) : q({
27
+ response: e,
28
+ modifiedRequest: s,
29
+ operation: o,
30
+ plugins: n,
31
+ endTime: a,
32
+ duration: c,
33
+ responseHeaders: r,
34
+ statusText: p,
35
+ method: l,
36
+ fullPath: h,
37
+ contentType: d,
38
+ shouldSkipBody: y
39
+ });
40
+ } catch (s) {
41
+ return [b(s, x.REQUEST_FAILED), null];
42
+ }
43
+ }, k = async ({
44
+ response: t,
45
+ modifiedRequest: o,
46
+ operation: i,
47
+ plugins: n,
48
+ endTime: s,
49
+ duration: m,
50
+ responseHeaders: e,
51
+ statusText: a,
52
+ method: c,
53
+ fullPath: d
54
+ }) => {
55
+ const r = new Response(null, {
56
+ status: t.status,
57
+ statusText: a,
58
+ headers: t.headers
59
+ });
60
+ await f({ response: r, request: o, operation: i }, "responseReceived", n);
61
+ const u = T(r.headers);
62
+ return [
63
+ null,
64
+ {
65
+ timestamp: s,
66
+ request: o,
67
+ response: {
68
+ ...r,
69
+ headers: e,
70
+ cookieHeaderKeys: u,
71
+ reader: t.body.getReader(),
72
+ duration: m,
73
+ method: c,
74
+ path: d
75
+ }
76
+ }
77
+ ];
78
+ }, q = async ({
79
+ response: t,
80
+ modifiedRequest: o,
81
+ operation: i,
82
+ plugins: n,
83
+ endTime: s,
84
+ duration: m,
85
+ responseHeaders: e,
86
+ statusText: a,
87
+ method: c,
88
+ fullPath: d,
89
+ contentType: r,
90
+ shouldSkipBody: u
91
+ }) => {
92
+ const p = await t.clone().arrayBuffer(), y = E(p, r ?? "text/plain;charset=UTF-8"), R = new Response(u ? null : p, {
93
+ status: t.status,
94
+ statusText: a,
95
+ headers: t.headers
96
+ });
97
+ await f({ response: R, request: o, operation: i }, "responseReceived", n);
98
+ const w = T(R.headers);
99
+ return [
100
+ null,
101
+ {
102
+ timestamp: s,
103
+ request: o,
104
+ response: {
105
+ ...R,
106
+ headers: e,
107
+ cookieHeaderKeys: w,
108
+ data: y,
109
+ size: p.byteLength,
110
+ duration: m,
111
+ method: c,
112
+ status: t.status,
113
+ path: d
114
+ }
115
+ }
116
+ ];
117
+ };
118
+ export {
119
+ v as sendRequest
120
+ };
@@ -1,6 +1,6 @@
1
1
  import type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
2
  type __VLS_Props = {
3
- examples?: MediaTypeObject['examples'];
3
+ examples?: MediaTypeObject['examples'] | Record<string, string>;
4
4
  };
5
5
  type __VLS_PublicProps = __VLS_Props & {
6
6
  modelValue: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/ExamplePicker.vue"],"names":[],"mappings":"AA4DA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAGnG,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAA;CACvC,CAAC;AAwBF,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,UAAU,EAAE,MAAM,CAAC;CAClB,CAAC;;;;;;AA0GF,wBAOG"}
1
+ {"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/ExamplePicker.vue"],"names":[],"mappings":"AA4DA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAGnG,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChE,CAAC;AAwBF,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,UAAU,EAAE,MAAM,CAAC;CAClB,CAAC;;;;;;AA0GF,wBAOG"}
@@ -1 +1 @@
1
- {"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"AA4eA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,kBAAkB,CAAA;AAGvE,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AASrE,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,yCAAyC,CAAA;AAKhD,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,eAAe,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;GAQG;;YAkBO,MAAM,OAAO;YACb,MAAM,OAAO;;AAlBvB,wBA6jBC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"AA4bA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGxD,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AASrE,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,yCAAyC,CAAA;AAMhD,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,eAAe,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;GAQG;;YAkBO,MAAM,OAAO;YACb,MAAM,OAAO;;AAlBvB,wBA2gBC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./OperationCodeSample.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-13b785c0"]]);
4
+ const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-6c4b269b"]]);
5
5
  export {
6
6
  e as default
7
7
  };