@scalar/api-client 2.39.4 → 2.40.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 (330) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/components/AddressBar/AddressBarHistory.vue.d.ts.map +1 -1
  3. package/dist/components/AddressBar/AddressBarHistory.vue.js +1 -1
  4. package/dist/components/AddressBar/AddressBarHistory.vue.js.map +1 -1
  5. package/dist/components/AddressBar/AddressBarHistory.vue.script.js +2 -2
  6. package/dist/components/AddressBar/AddressBarHistory.vue.script.js.map +1 -1
  7. package/dist/hooks/useClientConfig.d.ts +12 -0
  8. package/dist/hooks/useClientConfig.d.ts.map +1 -1
  9. package/dist/hooks/useClientConfig.js +14 -1
  10. package/dist/hooks/useClientConfig.js.map +1 -1
  11. package/dist/libs/index.d.ts +0 -1
  12. package/dist/libs/index.d.ts.map +1 -1
  13. package/dist/libs/index.js +1 -2
  14. package/dist/style.css +207 -248
  15. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +14 -10
  16. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  17. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  18. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +57 -35
  19. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  20. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -5
  21. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  22. package/dist/v2/blocks/operation-block/helpers/send-request.js +18 -33
  23. package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
  24. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.d.ts.map +1 -1
  25. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js +1 -1
  26. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js.map +1 -1
  27. package/dist/v2/blocks/operation-block/index.d.ts +0 -3
  28. package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
  29. package/dist/v2/blocks/operation-block/index.js +1 -4
  30. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +1 -1
  31. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  32. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  33. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js.map +1 -1
  34. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js +3 -1
  35. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js.map +1 -1
  36. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +4 -2
  37. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
  38. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +3 -2
  39. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js.map +1 -1
  40. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +1 -1
  41. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +1 -1
  42. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts.map +1 -1
  43. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.js.map +1 -1
  44. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +7 -2
  45. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  46. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +4 -3
  47. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js.map +1 -1
  48. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
  49. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +2 -3
  50. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js.map +1 -1
  51. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts +3 -1
  52. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
  53. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +5 -8
  54. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js.map +1 -1
  55. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +1 -1
  56. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts.map +1 -1
  57. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js.map +1 -1
  58. package/dist/v2/blocks/operation-code-sample/index.d.ts +0 -1
  59. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
  60. package/dist/v2/blocks/operation-code-sample/index.js +2 -3
  61. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +7 -9
  62. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  63. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  64. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  65. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +49 -42
  66. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  67. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  68. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  69. package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
  70. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +2 -3
  71. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  72. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  73. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
  74. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +1 -0
  75. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  76. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  77. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  78. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +1 -1
  79. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  80. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +1 -1
  81. package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts +1 -1
  82. package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts.map +1 -1
  83. package/dist/v2/blocks/request-block/helpers/is-param-disabled.js +2 -1
  84. package/dist/v2/blocks/request-block/helpers/is-param-disabled.js.map +1 -1
  85. package/dist/v2/blocks/response-block/helpers/get-content-length.d.ts.map +1 -1
  86. package/dist/v2/blocks/response-block/helpers/get-content-length.js +2 -2
  87. package/dist/v2/blocks/response-block/helpers/get-content-length.js.map +1 -1
  88. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  89. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  90. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
  91. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +76 -25
  92. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  93. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
  94. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
  95. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js.map +1 -1
  96. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +2 -2
  97. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
  98. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +1 -1
  99. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  100. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
  101. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +1 -1
  102. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  103. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +1 -1
  104. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  105. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
  106. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +8 -4
  107. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  108. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +1 -1
  109. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  110. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map +1 -1
  111. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -1
  112. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +1 -1
  113. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  114. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js.map +1 -1
  115. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
  116. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts +1 -1
  117. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  118. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +1 -1
  119. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +1 -1
  120. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  121. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +6 -2
  122. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
  123. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +0 -3
  124. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
  125. package/dist/v2/blocks/scalar-auth-selector-block/index.js +1 -3
  126. package/dist/v2/components/code-input/CodeInput.vue.d.ts +8 -6
  127. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  128. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  129. package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
  130. package/dist/v2/components/code-input/CodeInput.vue.script.js +11 -9
  131. package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
  132. package/dist/v2/constants.js +1 -1
  133. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  134. package/dist/v2/features/app/App.vue.js.map +1 -1
  135. package/dist/v2/features/app/App.vue.script.js +1 -5
  136. package/dist/v2/features/app/App.vue.script.js.map +1 -1
  137. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  138. package/dist/v2/features/app/app-events.js +1 -1
  139. package/dist/v2/features/app/app-events.js.map +1 -1
  140. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  141. package/dist/v2/features/app/app-state.js +2 -2
  142. package/dist/v2/features/app/app-state.js.map +1 -1
  143. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  144. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  145. package/dist/v2/features/app/components/AppSidebar.vue.js.map +1 -1
  146. package/dist/v2/features/app/components/AppSidebar.vue.script.js +1 -1
  147. package/dist/v2/features/app/components/AppSidebar.vue.script.js.map +1 -1
  148. package/dist/v2/features/app/helpers/routes.d.ts +0 -3
  149. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  150. package/dist/v2/features/app/helpers/routes.js +1 -1
  151. package/dist/v2/features/app/helpers/routes.js.map +1 -1
  152. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  153. package/dist/v2/features/collection/DocumentCollection.vue.js.map +1 -1
  154. package/dist/v2/features/collection/DocumentCollection.vue.script.js +30 -52
  155. package/dist/v2/features/collection/DocumentCollection.vue.script.js.map +1 -1
  156. package/dist/v2/features/collection/OperationCollection.vue.script.js +0 -1
  157. package/dist/v2/features/collection/OperationCollection.vue.script.js.map +1 -1
  158. package/dist/v2/features/collection/WorkspaceCollection.vue.script.js +0 -1
  159. package/dist/v2/features/collection/WorkspaceCollection.vue.script.js.map +1 -1
  160. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  161. package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
  162. package/dist/v2/features/collection/components/Authentication.vue.js.map +1 -1
  163. package/dist/v2/features/collection/components/Authentication.vue.script.js +6 -8
  164. package/dist/v2/features/collection/components/Authentication.vue.script.js.map +1 -1
  165. package/dist/v2/features/collection/components/Cookies.vue.script.js +0 -1
  166. package/dist/v2/features/collection/components/Cookies.vue.script.js.map +1 -1
  167. package/dist/v2/features/collection/components/Editor/Editor.vue.script.js +0 -1
  168. package/dist/v2/features/collection/components/Editor/Editor.vue.script.js.map +1 -1
  169. package/dist/v2/features/collection/components/Environment.vue.script.js +0 -1
  170. package/dist/v2/features/collection/components/Environment.vue.script.js.map +1 -1
  171. package/dist/v2/features/collection/components/Overview.vue.script.js +0 -1
  172. package/dist/v2/features/collection/components/Overview.vue.script.js.map +1 -1
  173. package/dist/v2/features/collection/components/Servers.vue.script.js +0 -1
  174. package/dist/v2/features/collection/components/Servers.vue.script.js.map +1 -1
  175. package/dist/v2/features/collection/components/Settings.vue.js.map +1 -1
  176. package/dist/v2/features/collection/components/Settings.vue.script.js +2 -3
  177. package/dist/v2/features/collection/components/Settings.vue.script.js.map +1 -1
  178. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +1 -1
  179. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
  180. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
  181. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +1 -1
  182. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
  183. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  184. package/dist/v2/features/modal/Modal.vue.js.map +1 -1
  185. package/dist/v2/features/modal/Modal.vue.script.js +3 -4
  186. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  187. package/dist/v2/features/modal/helpers/map-hidden-clients-config.js +1 -1
  188. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  189. package/dist/v2/features/operation/Operation.vue.js.map +1 -1
  190. package/dist/v2/features/operation/Operation.vue.script.js +50 -84
  191. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  192. package/dist/v2/features/operation/index.d.ts +0 -4
  193. package/dist/v2/features/operation/index.d.ts.map +1 -1
  194. package/dist/v2/features/operation/index.js +1 -5
  195. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  196. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js.map +1 -1
  197. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.script.js +11 -1
  198. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.script.js.map +1 -1
  199. package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
  200. package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
  201. package/dist/views/Request/RequestSection/RequestTable.vue.js.map +1 -1
  202. package/dist/views/Request/RequestSection/RequestTable.vue.script.js +1 -1
  203. package/dist/views/Request/RequestSection/RequestTable.vue.script.js.map +1 -1
  204. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.script.js +1 -1
  205. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.d.ts.map +1 -1
  206. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js.map +1 -1
  207. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.script.js +2 -2
  208. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.script.js.map +1 -1
  209. package/dist/views/Request/libs/oauth2.js +1 -1
  210. package/dist/views/Request/libs/oauth2.js.map +1 -1
  211. package/package.json +24 -30
  212. package/dist/libs/formatters.d.ts +0 -12
  213. package/dist/libs/formatters.d.ts.map +0 -1
  214. package/dist/libs/formatters.js +0 -36
  215. package/dist/libs/formatters.js.map +0 -1
  216. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts +0 -6
  217. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts.map +0 -1
  218. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.js +0 -58
  219. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.js.map +0 -1
  220. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts +0 -12
  221. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +0 -1
  222. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +0 -65
  223. package/dist/v2/blocks/operation-block/helpers/build-request-body.js.map +0 -1
  224. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +0 -31
  225. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +0 -1
  226. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +0 -55
  227. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js.map +0 -1
  228. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +0 -27
  229. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +0 -1
  230. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +0 -159
  231. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js.map +0 -1
  232. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +0 -25
  233. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +0 -1
  234. package/dist/v2/blocks/operation-block/helpers/build-request-security.js +0 -53
  235. package/dist/v2/blocks/operation-block/helpers/build-request-security.js.map +0 -1
  236. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +0 -46
  237. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +0 -1
  238. package/dist/v2/blocks/operation-block/helpers/build-request.js +0 -102
  239. package/dist/v2/blocks/operation-block/helpers/build-request.js.map +0 -1
  240. package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts +0 -4
  241. package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts.map +0 -1
  242. package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.js +0 -41
  243. package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.js.map +0 -1
  244. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts +0 -14
  245. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts.map +0 -1
  246. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.js +0 -20
  247. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.js.map +0 -1
  248. package/dist/v2/blocks/operation-block/helpers/get-delimiter.d.ts +0 -8
  249. package/dist/v2/blocks/operation-block/helpers/get-delimiter.d.ts.map +0 -1
  250. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts +0 -9
  251. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts.map +0 -1
  252. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js +0 -17
  253. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js.map +0 -1
  254. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts +0 -10
  255. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +0 -1
  256. package/dist/v2/blocks/operation-block/helpers/get-example.js +0 -41
  257. package/dist/v2/blocks/operation-block/helpers/get-example.js.map +0 -1
  258. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts +0 -26
  259. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts.map +0 -1
  260. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.js +0 -32
  261. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.js.map +0 -1
  262. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts +0 -10
  263. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts.map +0 -1
  264. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js +0 -15
  265. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js.map +0 -1
  266. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts +0 -3
  267. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts.map +0 -1
  268. package/dist/v2/blocks/operation-block/helpers/get-server-url.js +0 -18
  269. package/dist/v2/blocks/operation-block/helpers/get-server-url.js.map +0 -1
  270. package/dist/v2/blocks/operation-block/helpers/serialize-parameter.d.ts +0 -96
  271. package/dist/v2/blocks/operation-block/helpers/serialize-parameter.d.ts.map +0 -1
  272. package/dist/v2/blocks/operation-block/helpers/serialize-parameter.js +0 -160
  273. package/dist/v2/blocks/operation-block/helpers/serialize-parameter.js.map +0 -1
  274. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +0 -40
  275. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +0 -1
  276. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +0 -437
  277. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js.map +0 -1
  278. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts +0 -6
  279. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts.map +0 -1
  280. package/dist/v2/blocks/request-block/helpers/get-request-body-example.js +0 -25
  281. package/dist/v2/blocks/request-block/helpers/get-request-body-example.js.map +0 -1
  282. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +0 -141
  283. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js.map +0 -1
  284. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts +0 -4
  285. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts.map +0 -1
  286. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js +0 -10
  287. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js.map +0 -1
  288. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts +0 -9
  289. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts.map +0 -1
  290. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +0 -27
  291. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js.map +0 -1
  292. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +0 -25
  293. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +0 -1
  294. package/dist/v2/components/callout/Callout.vue.js +0 -9
  295. package/dist/v2/components/callout/Callout.vue.js.map +0 -1
  296. package/dist/v2/components/callout/Callout.vue.script.js +0 -35
  297. package/dist/v2/components/callout/Callout.vue.script.js.map +0 -1
  298. package/dist/v2/features/operation/helpers/combine-params.d.ts +0 -4
  299. package/dist/v2/features/operation/helpers/combine-params.d.ts.map +0 -1
  300. package/dist/v2/features/operation/helpers/combine-params.js +0 -20
  301. package/dist/v2/features/operation/helpers/combine-params.js.map +0 -1
  302. package/dist/v2/features/operation/helpers/get-operation-header.d.ts +0 -17
  303. package/dist/v2/features/operation/helpers/get-operation-header.d.ts.map +0 -1
  304. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +0 -12
  305. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +0 -1
  306. package/dist/v2/features/operation/helpers/get-security-requirements.js +0 -17
  307. package/dist/v2/features/operation/helpers/get-security-requirements.js.map +0 -1
  308. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +0 -15
  309. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +0 -1
  310. package/dist/v2/features/operation/helpers/get-selected-security.js +0 -41
  311. package/dist/v2/features/operation/helpers/get-selected-security.js.map +0 -1
  312. package/dist/v2/features/operation/helpers/get-selected-server.d.ts +0 -13
  313. package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +0 -1
  314. package/dist/v2/features/operation/helpers/get-selected-server.js +0 -21
  315. package/dist/v2/features/operation/helpers/get-selected-server.js.map +0 -1
  316. package/dist/v2/helpers/get-active-environment.d.ts +0 -5
  317. package/dist/v2/helpers/get-active-environment.d.ts.map +0 -1
  318. package/dist/v2/helpers/get-active-environment.js +0 -19
  319. package/dist/v2/helpers/get-active-environment.js.map +0 -1
  320. package/dist/v2/helpers/get-active-proxy-url.d.ts +0 -18
  321. package/dist/v2/helpers/get-active-proxy-url.d.ts.map +0 -1
  322. package/dist/v2/helpers/get-active-proxy-url.js +0 -26
  323. package/dist/v2/helpers/get-active-proxy-url.js.map +0 -1
  324. package/dist/v2/helpers/get-servers.d.ts +0 -23
  325. package/dist/v2/helpers/get-servers.d.ts.map +0 -1
  326. package/dist/v2/helpers/get-servers.js +0 -106
  327. package/dist/v2/helpers/get-servers.js.map +0 -1
  328. package/dist/v2/helpers/index.d.ts +0 -3
  329. package/dist/v2/helpers/index.d.ts.map +0 -1
  330. package/dist/v2/helpers/index.js +0 -3
@@ -5,12 +5,12 @@ import type { WorkspaceStore } from '@scalar/workspace-store/client';
5
5
  import type { SelectedSecurity } from '@scalar/workspace-store/entities/auth';
6
6
  import type { HistoryEntry } from '@scalar/workspace-store/entities/history/schema';
7
7
  import type { AuthMeta, ServerMeta, WorkspaceEventBus } from '@scalar/workspace-store/events';
8
+ import { type MergedSecuritySchemes, type SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example';
8
9
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
10
+ import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
9
11
  import type { OpenApiDocument, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
10
12
  import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
11
13
  import type { ClientLayout } from '../../../hooks/index.js';
12
- import type { ExtendedScalarCookie } from '../../../v2/blocks/request-block/RequestBlock.vue.js';
13
- import type { MergedSecuritySchemes } from '../../../v2/blocks/scalar-auth-selector-block/helpers/merge-security.js';
14
14
  /**
15
15
  * OperationBlock
16
16
  *
@@ -29,14 +29,12 @@ export default _default;
29
29
  export type OperationBlockProps = {
30
30
  /** Event bus */
31
31
  eventBus: WorkspaceEventBus;
32
- /** Document defined security */
33
- documentSecurity: OpenApiDocument['security'];
34
- /** Document selected security */
35
- documentSelectedSecurity: SelectedSecurity | undefined;
36
32
  /** Application version */
37
33
  appVersion: string;
38
- /** Workspace/document cookies */
39
- globalCookies: ExtendedScalarCookie[];
34
+ /** Workspace cookies */
35
+ workspaceCookies: XScalarCookie[];
36
+ /** Document cookies */
37
+ documentCookies: XScalarCookie[];
40
38
  /** Current request path */
41
39
  path: string;
42
40
  /** Current request method */
@@ -65,8 +63,6 @@ export type OperationBlockProps = {
65
63
  source?: 'gitbook' | 'api-reference';
66
64
  /** Operation object */
67
65
  operation: OperationObject;
68
- /** Operation selected security */
69
- operationSelectedSecurity: SelectedSecurity | undefined;
70
66
  /** Currently selected example key for the current operation */
71
67
  exampleKey: string;
72
68
  /** Meta information for the auth update */
@@ -83,6 +79,14 @@ export type OperationBlockProps = {
83
79
  environment: XScalarEnvironment;
84
80
  /** The proxy URL for sending requests */
85
81
  proxyUrl: string;
82
+ /** Currently selected security */
83
+ selectedSecurity: SelectedSecurity;
84
+ /** Currently selected security schemes */
85
+ selectedSecuritySchemes: SecuritySchemeObjectSecret[];
86
+ /** Security requirements */
87
+ securityRequirements: OpenApiDocument['security'];
88
+ /** Default headers */
89
+ defaultHeaders: Record<string, string>;
86
90
  /** Selected anyOf/oneOf request-body variants keyed by schema path */
87
91
  requestBodyCompositionSelection?: Record<string, number>;
88
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"AA6bA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAA;AACnF,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAK5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAe3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AAGtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAA;AAS1G;;;;;;;;;;;;GAYG;wBACkB,OAAO,YAAY;AAAxC,w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,wCAAwC;IACxC,eAAe,EAAE,qBAAqB,CAAA;IACtC,qBAAqB;IACrB,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,uBAAuB;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,qCAAqC;IACrC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB,sEAAsE;IACtE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzD,CAAA;AACD,QAAA,MAAM,YAAY,kTA8bd,CAAC"}
1
+ {"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"AA6dA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAA;AACnF,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAChC,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAA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QAAQ,EAAE,QAAQ,CAAA;IAClB,wCAAwC;IACxC,eAAe,EAAE,qBAAqB,CAAA;IACtC,qBAAqB;IACrB,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,uBAAuB;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,qCAAqC;IACrC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,0CAA0C;IAC1C,uBAAuB,EAAE,0BAA0B,EAAE,CAAA;IACrD,4BAA4B;IAC5B,oBAAoB,EAAE,eAAe,CAAC,UAAU,CAAC,CAAA;IACjD,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,sEAAsE;IACtE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzD,CAAA;AACD,QAAA,MAAM,YAAY,kTAwdd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"OperationBlock.vue.js","names":[],"sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * OperationBlock\n *\n * Orchestrates the operation view by wiring together the Header, OperationBlock,\n * and ResponseBlock. Forwards user interactions to the workspace event bus and\n * passes through configuration such as auth, servers, plugins, and environment.\n * This component keeps the Operation page lean by centralizing event emission\n * and prop wiring between the blocks.\n *\n * Notable behavior:\n * - Uses operation['x-scalar-method'] and operation['x-scalar-path'] to provide\n * draft overrides for the UI when present.\n */\nexport default {\n name: 'OperationBlock',\n}\n\nexport type OperationBlockProps = {\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Document defined security */\n documentSecurity: OpenApiDocument['security']\n /** Document selected security */\n documentSelectedSecurity: SelectedSecurity | undefined\n /** Application version */\n appVersion: string\n /** Workspace/document cookies */\n globalCookies: ExtendedScalarCookie[]\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethodType\n /** HTTP clients */\n httpClients: AvailableClients\n /** The history for the operation */\n history?: HistoryEntry[]\n /** Client layout */\n layout: ClientLayout\n /** Currently selected server */\n server: ServerObject | null\n /** Currently selected client */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** Meta information for the server */\n serverMeta: ServerMeta\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Operation object */\n operation: OperationObject\n /** Operation selected security */\n operationSelectedSecurity: SelectedSecurity | undefined\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Meta information for the auth update */\n authMeta: AuthMeta\n /** Document defined security schemes */\n securitySchemes: MergedSecuritySchemes\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The proxy URL for sending requests */\n proxyUrl: string\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n}\n</script>\n<script setup lang=\"ts\">\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport type { ResponseInstance } from '@scalar/oas-utils/entities/spec'\nimport { type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { HistoryEntry } from '@scalar/workspace-store/entities/history/schema'\nimport type {\n AuthMeta,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n OpenApiDocument,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\nimport type { ClientLayout } from '@/hooks'\nimport { ERRORS } from '@/libs/errors'\nimport { buildRequest } from '@/v2/blocks/operation-block/helpers/build-request'\nimport { getSecuritySchemes } from '@/v2/blocks/operation-block/helpers/build-request-security'\nimport { harToFetchRequest } from '@/v2/blocks/operation-block/helpers/har-to-fetch-request'\nimport { harToFetchResponse } from '@/v2/blocks/operation-block/helpers/har-to-fetch-response'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport { sendRequest } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { generateClientOptions } from '@/v2/blocks/operation-code-sample'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport type { ExtendedScalarCookie } from '@/v2/blocks/request-block/RequestBlock.vue'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\nimport type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block/helpers/merge-security'\nimport {\n getSecurityRequirements,\n getSelectedSecurity,\n} from '@/v2/features/operation'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n documentSecurity,\n documentSelectedSecurity,\n eventBus,\n exampleKey,\n globalCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n method,\n operation,\n operationSelectedSecurity,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n activeEnvironment,\n serverMeta,\n} = defineProps<OperationBlockProps>()\n\n/** Hoist up client generation so it doesn't get re-generated on every operation */\nconst clientOptions = computed(() => generateClientOptions(httpClients))\n\n/** Compute what the security requirements should be for an operation */\nconst securityRequirements = computed(() =>\n getSecurityRequirements(documentSecurity, operation.security),\n)\n\n/** The selected security for the operation or document */\nconst selectedSecurity = computed(() =>\n getSelectedSecurity(\n documentSelectedSecurity,\n operationSelectedSecurity,\n securityRequirements.value,\n securitySchemes,\n ),\n)\n\n/** The above selected requirements in scheme form */\nconst selectedSecuritySchemes = computed(() =>\n getSecuritySchemes(securitySchemes, selectedSecurity.value.selectedSchemes),\n)\n\nconst { toast } = useToasts()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst request = ref<Request | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n const pathValidation = validatePathParameters(\n operation.parameters ?? [],\n exampleKey,\n )\n if (pathValidation.ok === false) {\n toast('Path parameters must have values.', 'error')\n return\n }\n\n const [error, result] = buildRequest({\n environment,\n exampleKey,\n globalCookies,\n method,\n operation,\n path,\n selectedSecuritySchemes: selectedSecuritySchemes.value,\n server,\n proxyUrl,\n requestBodyCompositionSelection,\n })\n\n // Toast the error\n if (error) {\n toast(error.message, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = result.controller\n\n // Stop any previous streaming response\n if (response.value && 'reader' in response.value) {\n response.value.reader.cancel()\n }\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n /** Execute the request */\n const [sendError, sendResult] = await sendRequest({\n isUsingProxy: result.isUsingProxy,\n operation,\n plugins,\n request: result.request,\n })\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:complete', {\n payload: sendResult\n ? {\n response: sendResult.originalResponse,\n request: sendResult.request.clone(),\n duration: sendResult.response.duration,\n timestamp: sendResult.timestamp,\n }\n : undefined,\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n // Toast the execute error\n if (sendError) {\n toast(sendError.message, 'error')\n return\n }\n\n // Store the response\n response.value = sendResult.response\n request.value = sendResult.request\n\n // Cache non-streaming responses so they can be restored when navigating back\n if (!isStreamingResponse(sendResult.response)) {\n responseCache.set(getOperationExampleKey(method, path, exampleKey), {\n response: sendResult.response,\n request: sendResult.request,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n})\n\nconst operationHistory = computed<History[]>(() =>\n history\n .map((entry) => ({\n method: entry.request.method as HttpMethodType,\n path: entry.request.url,\n duration: entry.time,\n status: entry.response.status,\n }))\n .reverse(),\n)\n\nconst handleSelectHistoryItem = ({ index }: { index: number }) => {\n const transformedIndex = (history.length ?? 0) - index - 1\n const historyItem = history[transformedIndex]\n if (!historyItem) {\n return\n }\n\n const navigate = () =>\n eventBus.emit('ui:navigate', {\n page: 'example',\n method,\n path,\n exampleName: 'draft',\n callback: (status) => {\n // Do not replace the response if the navigation was not successful\n if (status !== 'success') {\n return\n }\n // Reconstruct the response\n const fetchResponse = harToFetchResponse({\n harResponse: historyItem.response,\n url: historyItem.request.url,\n method,\n path,\n duration: historyItem.time,\n })\n\n // Reconstruct the request\n const fetchRequest = harToFetchRequest({\n harRequest: historyItem.request,\n })\n\n // Update the response and request\n response.value = fetchResponse\n request.value = fetchRequest\n },\n })\n\n eventBus.emit('operation:reload:history', {\n meta: {\n path,\n method,\n },\n index: transformedIndex,\n callback: navigate,\n })\n}\n\n/**\n * When the path, method, or example key changes: save current response to\n * cache (so it can be restored when navigating back), then restore from cache\n * for the new operation or clear if no cached response. Response is only\n * cleared on page refresh or when making a new request for that operation.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const newKey = getOperationExampleKey(newMethod, newPath, newExampleKey)\n const cached = responseCache.get(newKey)\n if (cached) {\n response.value = cached.response\n request.value = cached.request\n } else {\n response.value = null\n request.value = null\n }\n\n // Cancel any in-flight request\n cancelRequest()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n // We cancel the request if the component is unmounted\n cancelRequest()\n})\n</script>\n<template>\n <div class=\"bg-b-1 flex h-full flex-col\">\n <div\n class=\"lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0\">\n <!-- Address Bar -->\n <Header\n :activeEnvironment\n :documentUrl\n :environment\n :environments\n :eventBus\n :hideClientButton\n :history=\"operationHistory\"\n :integration\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n :source\n @execute=\"handleExecute\"\n @select:history:item=\"handleSelectHistoryItem\" />\n </div>\n\n <ViewLayout class=\"border-t\">\n <ViewLayoutContent class=\"flex-1\">\n <!-- Request Section -->\n <RequestBlock\n :authMeta\n :clientOptions\n :environment\n :eventBus\n :exampleKey\n :globalCookies\n :layout\n :method\n :operation\n :path\n :plugins\n :proxyUrl\n :requestBodyCompositionSelection\n :securityRequirements\n :securitySchemes\n :selectedClient\n :selectedSecurity\n :selectedSecuritySchemes\n :server />\n\n <!-- Response Section -->\n <ResponseBlock\n :appVersion\n :eventBus\n :layout\n :plugins\n :request\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"OperationBlock.vue.js","names":[],"sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * OperationBlock\n *\n * Orchestrates the operation view by wiring together the Header, OperationBlock,\n * and ResponseBlock. Forwards user interactions to the workspace event bus and\n * passes through configuration such as auth, servers, plugins, and environment.\n * This component keeps the Operation page lean by centralizing event emission\n * and prop wiring between the blocks.\n *\n * Notable behavior:\n * - Uses operation['x-scalar-method'] and operation['x-scalar-path'] to provide\n * draft overrides for the UI when present.\n */\nexport default {\n name: 'OperationBlock',\n}\n\nexport type OperationBlockProps = {\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Application version */\n appVersion: string\n /** Workspace cookies */\n workspaceCookies: XScalarCookie[]\n /** Document cookies */\n documentCookies: XScalarCookie[]\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethodType\n /** HTTP clients */\n httpClients: AvailableClients\n /** The history for the operation */\n history?: HistoryEntry[]\n /** Client layout */\n layout: ClientLayout\n /** Currently selected server */\n server: ServerObject | null\n /** Currently selected client */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** Meta information for the server */\n serverMeta: ServerMeta\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Operation object */\n operation: OperationObject\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Meta information for the auth update */\n authMeta: AuthMeta\n /** Document defined security schemes */\n securitySchemes: MergedSecuritySchemes\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The proxy URL for sending requests */\n proxyUrl: string\n /** Currently selected security */\n selectedSecurity: SelectedSecurity\n /** Currently selected security schemes */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n /** Security requirements */\n securityRequirements: OpenApiDocument['security']\n /** Default headers */\n defaultHeaders: Record<string, string>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n}\n</script>\n<script setup lang=\"ts\">\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport type { ResponseInstance } from '@scalar/oas-utils/entities/spec'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { HistoryEntry } from '@scalar/workspace-store/entities/history/schema'\nimport type {\n AuthMeta,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport {\n buildRequest,\n getEnvironmentVariables,\n requestFactory,\n type MergedSecuritySchemes,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OpenApiDocument,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\nimport type { ClientLayout } from '@/hooks'\nimport { isElectron } from '@/libs/electron'\nimport { ERRORS } from '@/libs/errors'\nimport { harToFetchRequest } from '@/v2/blocks/operation-block/helpers/har-to-fetch-request'\nimport { harToFetchResponse } from '@/v2/blocks/operation-block/helpers/har-to-fetch-response'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport { sendRequest } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { generateClientOptions } from '@/v2/blocks/operation-code-sample'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n activeEnvironment,\n serverMeta,\n selectedSecurity,\n selectedSecuritySchemes,\n securityRequirements,\n defaultHeaders,\n} = defineProps<OperationBlockProps>()\n\n/** Hoist up client generation so it doesn't get re-generated on every operation */\nconst clientOptions = computed(() => generateClientOptions(httpClients))\n\nconst { toast } = useToasts()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst request = ref<Request | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n const pathValidation = validatePathParameters(\n operation.parameters ?? [],\n exampleKey,\n )\n if (pathValidation.ok === false) {\n toast('Path parameters must have values.', 'error')\n return\n }\n\n const globalCookies = [...workspaceCookies, ...documentCookies]\n\n const { request: requestBuilder } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies,\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n // Stop any previous streaming response\n if (response.value && 'reader' in response.value) {\n response.value.reader.cancel()\n }\n\n // Build the actual request we will send\n const requestResult = (() => {\n try {\n return {\n ok: true,\n result: buildRequest(requestBuilder, {\n envVariables: getEnvironmentVariables(environment),\n }),\n } as const\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return {\n ok: false,\n error: message,\n } as const\n }\n })()\n\n if (requestResult.ok === false) {\n toast(requestResult.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = requestResult.result.controller\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n // Execute the beforeRequest hook\n const { request: finalRequest } = await executeHook(\n { request: requestResult.result.request },\n 'beforeRequest',\n plugins,\n )\n\n /** Execute the request */\n const [sendError, sendResult] = await sendRequest({\n isUsingProxy: requestResult.result.isUsingProxy,\n request: finalRequest,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n request: sendResult.request.clone(),\n operation,\n },\n 'responseReceived',\n plugins,\n )\n }\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:complete', {\n payload: sendResult\n ? {\n response: sendResult.originalResponse.clone(),\n request: sendResult.request.clone(),\n duration: sendResult.response.duration,\n timestamp: sendResult.timestamp,\n }\n : undefined,\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n if (sendError) {\n // clean up the response and request\n response.value = null\n request.value = null\n abortController.value = null\n\n toast(sendError.message, 'error')\n return\n }\n\n // Store the response\n response.value = sendResult.response\n request.value = sendResult.request\n\n // Cache non-streaming responses so they can be restored when navigating back\n if (!isStreamingResponse(sendResult.response)) {\n responseCache.set(getOperationExampleKey(method, path, exampleKey), {\n response: sendResult.response,\n request: sendResult.request,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n})\n\nconst operationHistory = computed<History[]>(() =>\n history\n .map((entry) => ({\n method: entry.request.method as HttpMethodType,\n path: entry.request.url,\n duration: entry.time,\n status: entry.response.status,\n }))\n .reverse(),\n)\n\nconst handleSelectHistoryItem = ({ index }: { index: number }) => {\n const transformedIndex = (history.length ?? 0) - index - 1\n const historyItem = history[transformedIndex]\n if (!historyItem) {\n return\n }\n\n const navigate = () =>\n eventBus.emit('ui:navigate', {\n page: 'example',\n method,\n path,\n exampleName: 'draft',\n callback: (status) => {\n // Do not replace the response if the navigation was not successful\n if (status !== 'success') {\n return\n }\n // Reconstruct the response\n const fetchResponse = harToFetchResponse({\n harResponse: historyItem.response,\n url: historyItem.request.url,\n method,\n path,\n duration: historyItem.time,\n })\n\n // Reconstruct the request\n const fetchRequest = harToFetchRequest({\n harRequest: historyItem.request,\n })\n\n // Update the response and request\n response.value = fetchResponse\n request.value = fetchRequest\n },\n })\n\n eventBus.emit('operation:reload:history', {\n meta: {\n path,\n method,\n },\n index: transformedIndex,\n callback: navigate,\n })\n}\n\n/**\n * When the path, method, or example key changes: save current response to\n * cache (so it can be restored when navigating back), then restore from cache\n * for the new operation or clear if no cached response. Response is only\n * cleared on page refresh or when making a new request for that operation.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const newKey = getOperationExampleKey(newMethod, newPath, newExampleKey)\n const cached = responseCache.get(newKey)\n if (cached) {\n response.value = cached.response\n request.value = cached.request\n } else {\n response.value = null\n request.value = null\n }\n\n // Cancel any in-flight request\n cancelRequest()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n // We cancel the request if the component is unmounted\n cancelRequest()\n})\n</script>\n<template>\n <div class=\"bg-b-1 flex h-full flex-col\">\n <div\n class=\"lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0\">\n <!-- Address Bar -->\n <Header\n :activeEnvironment\n :documentUrl\n :environment\n :environments\n :eventBus\n :hideClientButton\n :history=\"operationHistory\"\n :integration\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n :source\n @execute=\"handleExecute\"\n @select:history:item=\"handleSelectHistoryItem\" />\n </div>\n\n <ViewLayout class=\"border-t\">\n <ViewLayoutContent class=\"flex-1\">\n <!-- Request Section -->\n <RequestBlock\n :authMeta\n :clientOptions\n :defaultHeaders\n :documentCookies\n :environment\n :eventBus\n :exampleKey\n :layout\n :method\n :operation\n :path\n :plugins\n :proxyUrl\n :requestBodyCompositionSelection\n :securityRequirements\n :securitySchemes\n :selectedClient\n :selectedSecurity\n :selectedSecuritySchemes\n :server\n :workspaceCookies />\n\n <!-- Response Section -->\n <ResponseBlock\n :appVersion\n :eventBus\n :layout\n :plugins\n :request\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":""}
@@ -1,8 +1,7 @@
1
1
  import { ERRORS } from "../../../libs/errors.js";
2
- import { getSecuritySchemes } from "./helpers/build-request-security.js";
2
+ import { isElectron } from "../../../libs/electron.js";
3
3
  import ViewLayout_default from "../../../components/ViewLayout/ViewLayout.vue.js";
4
4
  import ViewLayoutContent_default from "../../../components/ViewLayout/ViewLayoutContent.vue.js";
5
- import { buildRequest } from "./helpers/build-request.js";
6
5
  import { harToFetchRequest } from "./helpers/har-to-fetch-request.js";
7
6
  import { harToFetchResponse } from "./helpers/har-to-fetch-response.js";
8
7
  import { getOperationExampleKey, isStreamingResponse, responseCache } from "./helpers/response-cache.js";
@@ -11,12 +10,12 @@ import { validatePathParameters } from "./helpers/validate-path-parameters.js";
11
10
  import { generateClientOptions } from "../operation-code-sample/helpers/generate-client-options.js";
12
11
  import RequestBlock_default from "../request-block/RequestBlock.vue.js";
13
12
  import ResponseBlock_default from "../response-block/ResponseBlock.vue.js";
14
- import { getSecurityRequirements } from "../../features/operation/helpers/get-security-requirements.js";
15
- import { getSelectedSecurity } from "../../features/operation/helpers/get-selected-security.js";
16
13
  import Header_default from "./components/Header.vue.js";
17
14
  import { computed, createElementBlock, createElementVNode, createVNode, defineComponent, onBeforeUnmount, onMounted, openBlock, ref, unref, watch, withCtx } from "vue";
18
15
  import { useToasts } from "@scalar/use-toasts";
16
+ import { executeHook } from "@scalar/oas-utils/helpers";
19
17
  import { AVAILABLE_CLIENTS } from "@scalar/types/snippetz";
18
+ import { buildRequest, getEnvironmentVariables, requestFactory } from "@scalar/workspace-store/request-example";
20
19
  //#region src/v2/blocks/operation-block/OperationBlock.vue?vue&type=script&setup=true&lang.ts
21
20
  var _hoisted_1 = { class: "bg-b-1 flex h-full flex-col" };
22
21
  var _hoisted_2 = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" };
@@ -24,10 +23,9 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
24
23
  name: "OperationBlock",
25
24
  props: {
26
25
  eventBus: {},
27
- documentSecurity: {},
28
- documentSelectedSecurity: {},
29
26
  appVersion: {},
30
- globalCookies: { default: () => [] },
27
+ workspaceCookies: { default: () => [] },
28
+ documentCookies: { default: () => [] },
31
29
  path: {},
32
30
  method: {},
33
31
  httpClients: { default: () => AVAILABLE_CLIENTS },
@@ -42,7 +40,6 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
42
40
  documentUrl: {},
43
41
  source: {},
44
42
  operation: {},
45
- operationSelectedSecurity: {},
46
43
  exampleKey: {},
47
44
  authMeta: {},
48
45
  securitySchemes: {},
@@ -51,17 +48,15 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
51
48
  activeEnvironment: {},
52
49
  environment: {},
53
50
  proxyUrl: {},
51
+ selectedSecurity: {},
52
+ selectedSecuritySchemes: {},
53
+ securityRequirements: {},
54
+ defaultHeaders: {},
54
55
  requestBodyCompositionSelection: {}
55
56
  },
56
57
  setup(__props) {
57
58
  /** Hoist up client generation so it doesn't get re-generated on every operation */
58
59
  const clientOptions = computed(() => generateClientOptions(__props.httpClients));
59
- /** Compute what the security requirements should be for an operation */
60
- const securityRequirements = computed(() => getSecurityRequirements(__props.documentSecurity, __props.operation.security));
61
- /** The selected security for the operation or document */
62
- const selectedSecurity = computed(() => getSelectedSecurity(__props.documentSelectedSecurity, __props.operationSelectedSecurity, securityRequirements.value, __props.securitySchemes));
63
- /** The above selected requirements in scheme form */
64
- const selectedSecuritySchemes = computed(() => getSecuritySchemes(__props.securitySchemes, selectedSecurity.value.selectedSchemes));
65
60
  const { toast } = useToasts();
66
61
  const abortController = ref(null);
67
62
  const response = ref(null);
@@ -74,39 +69,59 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
74
69
  toast("Path parameters must have values.", "error");
75
70
  return;
76
71
  }
77
- const [error, result] = buildRequest({
72
+ const globalCookies = [...__props.workspaceCookies, ...__props.documentCookies];
73
+ const { request: requestBuilder } = requestFactory({
74
+ defaultHeaders: __props.defaultHeaders,
78
75
  environment: __props.environment,
79
- exampleKey: __props.exampleKey,
80
- globalCookies: __props.globalCookies,
76
+ exampleName: __props.exampleKey,
77
+ globalCookies,
81
78
  method: __props.method,
82
79
  operation: __props.operation,
83
80
  path: __props.path,
84
- selectedSecuritySchemes: selectedSecuritySchemes.value,
85
- server: __props.server,
86
81
  proxyUrl: __props.proxyUrl,
82
+ server: __props.server,
83
+ selectedSecuritySchemes: __props.selectedSecuritySchemes,
84
+ isElectron: isElectron(),
87
85
  requestBodyCompositionSelection: __props.requestBodyCompositionSelection
88
86
  });
89
- if (error) {
90
- toast(error.message, "error");
87
+ if (response.value && "reader" in response.value) response.value.reader.cancel();
88
+ const requestResult = (() => {
89
+ try {
90
+ return {
91
+ ok: true,
92
+ result: buildRequest(requestBuilder, { envVariables: getEnvironmentVariables(__props.environment) })
93
+ };
94
+ } catch (error) {
95
+ return {
96
+ ok: false,
97
+ error: error instanceof Error ? error.message : String(error)
98
+ };
99
+ }
100
+ })();
101
+ if (requestResult.ok === false) {
102
+ toast(requestResult.error, "error");
91
103
  return;
92
104
  }
93
- abortController.value = result.controller;
94
- if (response.value && "reader" in response.value) response.value.reader.cancel();
105
+ abortController.value = requestResult.result.controller;
95
106
  __props.eventBus.emit("hooks:on:request:sent", { meta: {
96
107
  method: __props.method,
97
108
  path: __props.path,
98
109
  exampleKey: __props.exampleKey
99
110
  } });
111
+ const { request: finalRequest } = await executeHook({ request: requestResult.result.request }, "beforeRequest", __props.plugins);
100
112
  /** Execute the request */
101
113
  const [sendError, sendResult] = await sendRequest({
102
- isUsingProxy: result.isUsingProxy,
103
- operation: __props.operation,
104
- plugins: __props.plugins,
105
- request: result.request
114
+ isUsingProxy: requestResult.result.isUsingProxy,
115
+ request: finalRequest
106
116
  });
117
+ if (sendResult) await executeHook({
118
+ response: sendResult.originalResponse.clone(),
119
+ request: sendResult.request.clone(),
120
+ operation: __props.operation
121
+ }, "responseReceived", __props.plugins);
107
122
  __props.eventBus.emit("hooks:on:request:complete", {
108
123
  payload: sendResult ? {
109
- response: sendResult.originalResponse,
124
+ response: sendResult.originalResponse.clone(),
110
125
  request: sendResult.request.clone(),
111
126
  duration: sendResult.response.duration,
112
127
  timestamp: sendResult.timestamp
@@ -118,6 +133,9 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
118
133
  }
119
134
  });
120
135
  if (sendError) {
136
+ response.value = null;
137
+ request.value = null;
138
+ abortController.value = null;
121
139
  toast(sendError.message, "error");
122
140
  return;
123
141
  }
@@ -239,10 +257,11 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
239
257
  default: withCtx(() => [createVNode(unref(RequestBlock_default), {
240
258
  authMeta: __props.authMeta,
241
259
  clientOptions: clientOptions.value,
260
+ defaultHeaders: __props.defaultHeaders,
261
+ documentCookies: __props.documentCookies,
242
262
  environment: __props.environment,
243
263
  eventBus: __props.eventBus,
244
264
  exampleKey: __props.exampleKey,
245
- globalCookies: __props.globalCookies,
246
265
  layout: __props.layout,
247
266
  method: __props.method,
248
267
  operation: __props.operation,
@@ -250,19 +269,21 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
250
269
  plugins: __props.plugins,
251
270
  proxyUrl: __props.proxyUrl,
252
271
  requestBodyCompositionSelection: __props.requestBodyCompositionSelection,
253
- securityRequirements: securityRequirements.value,
272
+ securityRequirements: __props.securityRequirements,
254
273
  securitySchemes: __props.securitySchemes,
255
274
  selectedClient: __props.selectedClient,
256
- selectedSecurity: selectedSecurity.value,
257
- selectedSecuritySchemes: selectedSecuritySchemes.value,
258
- server: __props.server
275
+ selectedSecurity: __props.selectedSecurity,
276
+ selectedSecuritySchemes: __props.selectedSecuritySchemes,
277
+ server: __props.server,
278
+ workspaceCookies: __props.workspaceCookies
259
279
  }, null, 8, [
260
280
  "authMeta",
261
281
  "clientOptions",
282
+ "defaultHeaders",
283
+ "documentCookies",
262
284
  "environment",
263
285
  "eventBus",
264
286
  "exampleKey",
265
- "globalCookies",
266
287
  "layout",
267
288
  "method",
268
289
  "operation",
@@ -275,7 +296,8 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
275
296
  "selectedClient",
276
297
  "selectedSecurity",
277
298
  "selectedSecuritySchemes",
278
- "server"
299
+ "server",
300
+ "workspaceCookies"
279
301
  ]), createVNode(unref(ResponseBlock_default), {
280
302
  appVersion: __props.appVersion,
281
303
  eventBus: __props.eventBus,
@@ -1 +1 @@
1
- {"version":3,"file":"OperationBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * OperationBlock\n *\n * Orchestrates the operation view by wiring together the Header, OperationBlock,\n * and ResponseBlock. Forwards user interactions to the workspace event bus and\n * passes through configuration such as auth, servers, plugins, and environment.\n * This component keeps the Operation page lean by centralizing event emission\n * and prop wiring between the blocks.\n *\n * Notable behavior:\n * - Uses operation['x-scalar-method'] and operation['x-scalar-path'] to provide\n * draft overrides for the UI when present.\n */\nexport default {\n name: 'OperationBlock',\n}\n\nexport type OperationBlockProps = {\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Document defined security */\n documentSecurity: OpenApiDocument['security']\n /** Document selected security */\n documentSelectedSecurity: SelectedSecurity | undefined\n /** Application version */\n appVersion: string\n /** Workspace/document cookies */\n globalCookies: ExtendedScalarCookie[]\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethodType\n /** HTTP clients */\n httpClients: AvailableClients\n /** The history for the operation */\n history?: HistoryEntry[]\n /** Client layout */\n layout: ClientLayout\n /** Currently selected server */\n server: ServerObject | null\n /** Currently selected client */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** Meta information for the server */\n serverMeta: ServerMeta\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Operation object */\n operation: OperationObject\n /** Operation selected security */\n operationSelectedSecurity: SelectedSecurity | undefined\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Meta information for the auth update */\n authMeta: AuthMeta\n /** Document defined security schemes */\n securitySchemes: MergedSecuritySchemes\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The proxy URL for sending requests */\n proxyUrl: string\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n}\n</script>\n<script setup lang=\"ts\">\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport type { ResponseInstance } from '@scalar/oas-utils/entities/spec'\nimport { type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { HistoryEntry } from '@scalar/workspace-store/entities/history/schema'\nimport type {\n AuthMeta,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n OpenApiDocument,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\nimport type { ClientLayout } from '@/hooks'\nimport { ERRORS } from '@/libs/errors'\nimport { buildRequest } from '@/v2/blocks/operation-block/helpers/build-request'\nimport { getSecuritySchemes } from '@/v2/blocks/operation-block/helpers/build-request-security'\nimport { harToFetchRequest } from '@/v2/blocks/operation-block/helpers/har-to-fetch-request'\nimport { harToFetchResponse } from '@/v2/blocks/operation-block/helpers/har-to-fetch-response'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport { sendRequest } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { generateClientOptions } from '@/v2/blocks/operation-code-sample'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport type { ExtendedScalarCookie } from '@/v2/blocks/request-block/RequestBlock.vue'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\nimport type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block/helpers/merge-security'\nimport {\n getSecurityRequirements,\n getSelectedSecurity,\n} from '@/v2/features/operation'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n documentSecurity,\n documentSelectedSecurity,\n eventBus,\n exampleKey,\n globalCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n method,\n operation,\n operationSelectedSecurity,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n activeEnvironment,\n serverMeta,\n} = defineProps<OperationBlockProps>()\n\n/** Hoist up client generation so it doesn't get re-generated on every operation */\nconst clientOptions = computed(() => generateClientOptions(httpClients))\n\n/** Compute what the security requirements should be for an operation */\nconst securityRequirements = computed(() =>\n getSecurityRequirements(documentSecurity, operation.security),\n)\n\n/** The selected security for the operation or document */\nconst selectedSecurity = computed(() =>\n getSelectedSecurity(\n documentSelectedSecurity,\n operationSelectedSecurity,\n securityRequirements.value,\n securitySchemes,\n ),\n)\n\n/** The above selected requirements in scheme form */\nconst selectedSecuritySchemes = computed(() =>\n getSecuritySchemes(securitySchemes, selectedSecurity.value.selectedSchemes),\n)\n\nconst { toast } = useToasts()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst request = ref<Request | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n const pathValidation = validatePathParameters(\n operation.parameters ?? [],\n exampleKey,\n )\n if (pathValidation.ok === false) {\n toast('Path parameters must have values.', 'error')\n return\n }\n\n const [error, result] = buildRequest({\n environment,\n exampleKey,\n globalCookies,\n method,\n operation,\n path,\n selectedSecuritySchemes: selectedSecuritySchemes.value,\n server,\n proxyUrl,\n requestBodyCompositionSelection,\n })\n\n // Toast the error\n if (error) {\n toast(error.message, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = result.controller\n\n // Stop any previous streaming response\n if (response.value && 'reader' in response.value) {\n response.value.reader.cancel()\n }\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n /** Execute the request */\n const [sendError, sendResult] = await sendRequest({\n isUsingProxy: result.isUsingProxy,\n operation,\n plugins,\n request: result.request,\n })\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:complete', {\n payload: sendResult\n ? {\n response: sendResult.originalResponse,\n request: sendResult.request.clone(),\n duration: sendResult.response.duration,\n timestamp: sendResult.timestamp,\n }\n : undefined,\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n // Toast the execute error\n if (sendError) {\n toast(sendError.message, 'error')\n return\n }\n\n // Store the response\n response.value = sendResult.response\n request.value = sendResult.request\n\n // Cache non-streaming responses so they can be restored when navigating back\n if (!isStreamingResponse(sendResult.response)) {\n responseCache.set(getOperationExampleKey(method, path, exampleKey), {\n response: sendResult.response,\n request: sendResult.request,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n})\n\nconst operationHistory = computed<History[]>(() =>\n history\n .map((entry) => ({\n method: entry.request.method as HttpMethodType,\n path: entry.request.url,\n duration: entry.time,\n status: entry.response.status,\n }))\n .reverse(),\n)\n\nconst handleSelectHistoryItem = ({ index }: { index: number }) => {\n const transformedIndex = (history.length ?? 0) - index - 1\n const historyItem = history[transformedIndex]\n if (!historyItem) {\n return\n }\n\n const navigate = () =>\n eventBus.emit('ui:navigate', {\n page: 'example',\n method,\n path,\n exampleName: 'draft',\n callback: (status) => {\n // Do not replace the response if the navigation was not successful\n if (status !== 'success') {\n return\n }\n // Reconstruct the response\n const fetchResponse = harToFetchResponse({\n harResponse: historyItem.response,\n url: historyItem.request.url,\n method,\n path,\n duration: historyItem.time,\n })\n\n // Reconstruct the request\n const fetchRequest = harToFetchRequest({\n harRequest: historyItem.request,\n })\n\n // Update the response and request\n response.value = fetchResponse\n request.value = fetchRequest\n },\n })\n\n eventBus.emit('operation:reload:history', {\n meta: {\n path,\n method,\n },\n index: transformedIndex,\n callback: navigate,\n })\n}\n\n/**\n * When the path, method, or example key changes: save current response to\n * cache (so it can be restored when navigating back), then restore from cache\n * for the new operation or clear if no cached response. Response is only\n * cleared on page refresh or when making a new request for that operation.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const newKey = getOperationExampleKey(newMethod, newPath, newExampleKey)\n const cached = responseCache.get(newKey)\n if (cached) {\n response.value = cached.response\n request.value = cached.request\n } else {\n response.value = null\n request.value = null\n }\n\n // Cancel any in-flight request\n cancelRequest()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n // We cancel the request if the component is unmounted\n cancelRequest()\n})\n</script>\n<template>\n <div class=\"bg-b-1 flex h-full flex-col\">\n <div\n class=\"lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0\">\n <!-- Address Bar -->\n <Header\n :activeEnvironment\n :documentUrl\n :environment\n :environments\n :eventBus\n :hideClientButton\n :history=\"operationHistory\"\n :integration\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n :source\n @execute=\"handleExecute\"\n @select:history:item=\"handleSelectHistoryItem\" />\n </div>\n\n <ViewLayout class=\"border-t\">\n <ViewLayoutContent class=\"flex-1\">\n <!-- Request Section -->\n <RequestBlock\n :authMeta\n :clientOptions\n :environment\n :eventBus\n :exampleKey\n :globalCookies\n :layout\n :method\n :operation\n :path\n :plugins\n :proxyUrl\n :requestBodyCompositionSelection\n :securityRequirements\n :securitySchemes\n :selectedClient\n :selectedSecurity\n :selectedSecuritySchemes\n :server />\n\n <!-- Response Section -->\n <ResponseBlock\n :appVersion\n :eventBus\n :layout\n :plugins\n :request\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;CAeE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgJR,MAAM,gBAAgB,eAAe,sBAAsB,QAAA,YAAY,CAAA;;EAGvE,MAAM,uBAAuB,eAC3B,wBAAwB,QAAA,kBAAkB,QAAA,UAAU,SAAS,CAC/D;;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;MACA,MAAA,QAAA;MACA,SAAA,QAAA;MACA,UAAA,QAAA;MACA,iCAAA,QAAA;MACA,sBAAA,qBAAA;MACA,iBAAA,QAAA;MACA,gBAAA,QAAA;MACA,kBAAA,iBAAA;MACA,yBAAA,wBAAA;MACA,QAAA,QAAA;;;;;;;;;;;;;;;;;;;;;SAGH,YAOsD,MAAA,sBAAA,EAAA;MANnD,YAAA,QAAA;MACA,UAAA,QAAA;MACA,QAAA,QAAA;MACA,SAAA,QAAA;MACA,SAAA,QAAA;MACA,UAAA,SAAA;MACA,wBAAwB,iBAAA,MAAiB"}
1
+ {"version":3,"file":"OperationBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * OperationBlock\n *\n * Orchestrates the operation view by wiring together the Header, OperationBlock,\n * and ResponseBlock. Forwards user interactions to the workspace event bus and\n * passes through configuration such as auth, servers, plugins, and environment.\n * This component keeps the Operation page lean by centralizing event emission\n * and prop wiring between the blocks.\n *\n * Notable behavior:\n * - Uses operation['x-scalar-method'] and operation['x-scalar-path'] to provide\n * draft overrides for the UI when present.\n */\nexport default {\n name: 'OperationBlock',\n}\n\nexport type OperationBlockProps = {\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Application version */\n appVersion: string\n /** Workspace cookies */\n workspaceCookies: XScalarCookie[]\n /** Document cookies */\n documentCookies: XScalarCookie[]\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethodType\n /** HTTP clients */\n httpClients: AvailableClients\n /** The history for the operation */\n history?: HistoryEntry[]\n /** Client layout */\n layout: ClientLayout\n /** Currently selected server */\n server: ServerObject | null\n /** Currently selected client */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** Meta information for the server */\n serverMeta: ServerMeta\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Operation object */\n operation: OperationObject\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Meta information for the auth update */\n authMeta: AuthMeta\n /** Document defined security schemes */\n securitySchemes: MergedSecuritySchemes\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The proxy URL for sending requests */\n proxyUrl: string\n /** Currently selected security */\n selectedSecurity: SelectedSecurity\n /** Currently selected security schemes */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n /** Security requirements */\n securityRequirements: OpenApiDocument['security']\n /** Default headers */\n defaultHeaders: Record<string, string>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n}\n</script>\n<script setup lang=\"ts\">\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport type { ResponseInstance } from '@scalar/oas-utils/entities/spec'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { HistoryEntry } from '@scalar/workspace-store/entities/history/schema'\nimport type {\n AuthMeta,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport {\n buildRequest,\n getEnvironmentVariables,\n requestFactory,\n type MergedSecuritySchemes,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OpenApiDocument,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\nimport type { ClientLayout } from '@/hooks'\nimport { isElectron } from '@/libs/electron'\nimport { ERRORS } from '@/libs/errors'\nimport { harToFetchRequest } from '@/v2/blocks/operation-block/helpers/har-to-fetch-request'\nimport { harToFetchResponse } from '@/v2/blocks/operation-block/helpers/har-to-fetch-response'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport { sendRequest } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { generateClientOptions } from '@/v2/blocks/operation-code-sample'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n activeEnvironment,\n serverMeta,\n selectedSecurity,\n selectedSecuritySchemes,\n securityRequirements,\n defaultHeaders,\n} = defineProps<OperationBlockProps>()\n\n/** Hoist up client generation so it doesn't get re-generated on every operation */\nconst clientOptions = computed(() => generateClientOptions(httpClients))\n\nconst { toast } = useToasts()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst request = ref<Request | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n const pathValidation = validatePathParameters(\n operation.parameters ?? [],\n exampleKey,\n )\n if (pathValidation.ok === false) {\n toast('Path parameters must have values.', 'error')\n return\n }\n\n const globalCookies = [...workspaceCookies, ...documentCookies]\n\n const { request: requestBuilder } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies,\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n // Stop any previous streaming response\n if (response.value && 'reader' in response.value) {\n response.value.reader.cancel()\n }\n\n // Build the actual request we will send\n const requestResult = (() => {\n try {\n return {\n ok: true,\n result: buildRequest(requestBuilder, {\n envVariables: getEnvironmentVariables(environment),\n }),\n } as const\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return {\n ok: false,\n error: message,\n } as const\n }\n })()\n\n if (requestResult.ok === false) {\n toast(requestResult.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = requestResult.result.controller\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n // Execute the beforeRequest hook\n const { request: finalRequest } = await executeHook(\n { request: requestResult.result.request },\n 'beforeRequest',\n plugins,\n )\n\n /** Execute the request */\n const [sendError, sendResult] = await sendRequest({\n isUsingProxy: requestResult.result.isUsingProxy,\n request: finalRequest,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n request: sendResult.request.clone(),\n operation,\n },\n 'responseReceived',\n plugins,\n )\n }\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:complete', {\n payload: sendResult\n ? {\n response: sendResult.originalResponse.clone(),\n request: sendResult.request.clone(),\n duration: sendResult.response.duration,\n timestamp: sendResult.timestamp,\n }\n : undefined,\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n if (sendError) {\n // clean up the response and request\n response.value = null\n request.value = null\n abortController.value = null\n\n toast(sendError.message, 'error')\n return\n }\n\n // Store the response\n response.value = sendResult.response\n request.value = sendResult.request\n\n // Cache non-streaming responses so they can be restored when navigating back\n if (!isStreamingResponse(sendResult.response)) {\n responseCache.set(getOperationExampleKey(method, path, exampleKey), {\n response: sendResult.response,\n request: sendResult.request,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n})\n\nconst operationHistory = computed<History[]>(() =>\n history\n .map((entry) => ({\n method: entry.request.method as HttpMethodType,\n path: entry.request.url,\n duration: entry.time,\n status: entry.response.status,\n }))\n .reverse(),\n)\n\nconst handleSelectHistoryItem = ({ index }: { index: number }) => {\n const transformedIndex = (history.length ?? 0) - index - 1\n const historyItem = history[transformedIndex]\n if (!historyItem) {\n return\n }\n\n const navigate = () =>\n eventBus.emit('ui:navigate', {\n page: 'example',\n method,\n path,\n exampleName: 'draft',\n callback: (status) => {\n // Do not replace the response if the navigation was not successful\n if (status !== 'success') {\n return\n }\n // Reconstruct the response\n const fetchResponse = harToFetchResponse({\n harResponse: historyItem.response,\n url: historyItem.request.url,\n method,\n path,\n duration: historyItem.time,\n })\n\n // Reconstruct the request\n const fetchRequest = harToFetchRequest({\n harRequest: historyItem.request,\n })\n\n // Update the response and request\n response.value = fetchResponse\n request.value = fetchRequest\n },\n })\n\n eventBus.emit('operation:reload:history', {\n meta: {\n path,\n method,\n },\n index: transformedIndex,\n callback: navigate,\n })\n}\n\n/**\n * When the path, method, or example key changes: save current response to\n * cache (so it can be restored when navigating back), then restore from cache\n * for the new operation or clear if no cached response. Response is only\n * cleared on page refresh or when making a new request for that operation.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const newKey = getOperationExampleKey(newMethod, newPath, newExampleKey)\n const cached = responseCache.get(newKey)\n if (cached) {\n response.value = cached.response\n request.value = cached.request\n } else {\n response.value = null\n request.value = null\n }\n\n // Cancel any in-flight request\n cancelRequest()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n // We cancel the request if the component is unmounted\n cancelRequest()\n})\n</script>\n<template>\n <div class=\"bg-b-1 flex h-full flex-col\">\n <div\n class=\"lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0\">\n <!-- Address Bar -->\n <Header\n :activeEnvironment\n :documentUrl\n :environment\n :environments\n :eventBus\n :hideClientButton\n :history=\"operationHistory\"\n :integration\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n :source\n @execute=\"handleExecute\"\n @select:history:item=\"handleSelectHistoryItem\" />\n </div>\n\n <ViewLayout class=\"border-t\">\n <ViewLayoutContent class=\"flex-1\">\n <!-- Request Section -->\n <RequestBlock\n :authMeta\n :clientOptions\n :defaultHeaders\n :documentCookies\n :environment\n :eventBus\n :exampleKey\n :layout\n :method\n :operation\n :path\n :plugins\n :proxyUrl\n :requestBodyCompositionSelection\n :securityRequirements\n :securitySchemes\n :selectedClient\n :selectedSecurity\n :selectedSecuritySchemes\n :server\n :workspaceCookies />\n\n <!-- Response Section -->\n <ResponseBlock\n :appVersion\n :eventBus\n :layout\n :plugins\n :request\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;CAeE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuJR,MAAM,gBAAgB,eAAe,sBAAsB,QAAA,YAAY,CAAA;EAEvE,MAAM,EAAE,UAAU,WAAU;EAG5B,MAAM,kBAAkB,IAA4B,KAAI;EACxD,MAAM,WAAW,IAA6B,KAAI;EAClD,MAAM,UAAU,IAAoB,KAAI;;EAGxC,MAAM,sBAAsB,gBAAgB,OAAO,MAAM,OAAO,g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,YAAU,EAAA;2BAmCN,CAlCpB,YAkCoB,2BAAA,EAlCD,OAAM,UAAQ,EAAA;4BAuBT,CArBtB,YAqBsB,MAAA,qBAAA,EAAA;MApBnB,UAAA,QAAA;MACA,eAAA,cAAA;MACA,gBAAA,QAAA;MACA,iBAAA,QAAA;MACA,aAAA,QAAA;MACA,UAAA,QAAA;MACA,YAAA,QAAA;MACA,QAAA,QAAA;MACA,QAAA,QAAA;MACA,WAAA,QAAA;MACA,MAAA,QAAA;MACA,SAAA,QAAA;MACA,UAAA,QAAA;MACA,iCAAA,QAAA;MACA,sBAAA,QAAA;MACA,iBAAA,QAAA;MACA,gBAAA,QAAA;MACA,kBAAA,QAAA;MACA,yBAAA,QAAA;MACA,QAAA,QAAA;MACA,kBAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;SAGH,YAOsD,MAAA,sBAAA,EAAA;MANnD,YAAA,QAAA;MACA,UAAA,QAAA;MACA,QAAA,QAAA;MACA,SAAA,QAAA;MACA,SAAA,QAAA;MACA,UAAA,SAAA;MACA,wBAAwB,iBAAA,MAAiB"}
@@ -1,6 +1,4 @@
1
1
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
- import { type ClientPlugin } from '@scalar/oas-utils/helpers';
3
- import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
2
  import { type ErrorResponse } from '../../../../libs/errors.js';
5
3
  /** A single set of populated values for a sent request */
6
4
  export type ResponseInstance = Omit<Response, 'headers'> & {
@@ -40,10 +38,8 @@ export type ResponseInstance = Omit<Response, 'headers'> & {
40
38
  * @param isUsingProxy - Whether the request is being proxied for header handling
41
39
  * @returns A tuple with either an error or the response data
42
40
  */
43
- export declare const sendRequest: ({ isUsingProxy, operation, request, plugins, }: {
41
+ export declare const sendRequest: ({ isUsingProxy, request, }: {
44
42
  isUsingProxy: boolean;
45
- operation: OperationObject;
46
- plugins: ClientPlugin[];
47
43
  request: Request;
48
44
  }) => Promise<ErrorResponse<{
49
45
  response: ResponseInstance;
@@ -1 +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,EAAE,KAAK,YAAY,EAAe,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAM1E,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;IACjB,gBAAgB,EAAE,QAAQ,CAAA;CAC3B,CAAC,CA0DH,CAAA"}
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;AAGnE,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAM1E,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,4BAG/B;IACD,YAAY,EAAE,OAAO,CAAA;IACrB,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;IACjB,gBAAgB,EAAE,QAAQ,CAAA;CAC3B,CAAC,CAoDH,CAAA"}
@@ -2,8 +2,7 @@ import { ERRORS, normalizeError } from "../../../../libs/errors.js";
2
2
  import { normalizeHeaders } from "../../../../libs/normalize-headers.js";
3
3
  import { getCookieHeaderKeys } from "./get-cookie-header-keys.js";
4
4
  import { decodeBuffer } from "./decode-buffer.js";
5
- import { executeHook } from "@scalar/oas-utils/helpers";
6
- import { httpStatusCodes as httpStatusCodes$1 } from "@scalar/helpers/http/http-status-codes";
5
+ import { httpStatusCodes } from "@scalar/helpers/http/http-status-codes";
7
6
  //#region src/v2/blocks/operation-block/helpers/send-request.ts
8
7
  /** HTTP status codes that should not include a response body */
9
8
  var NO_BODY_STATUS_CODES = [
@@ -24,19 +23,19 @@ var NO_BODY_STATUS_CODES = [
24
23
  * @param isUsingProxy - Whether the request is being proxied for header handling
25
24
  * @returns A tuple with either an error or the response data
26
25
  */
27
- var sendRequest = async ({ isUsingProxy, operation, request, plugins }) => {
26
+ var sendRequest = async ({ isUsingProxy, request }) => {
28
27
  try {
29
- const { request: modifiedRequest } = await executeHook({ request }, "beforeRequest", plugins);
30
- const startTime = Date.now();
31
- const response = await fetch(modifiedRequest.clone());
32
- const endTime = Date.now();
28
+ const startTime = performance.now();
29
+ const response = await fetch(request.clone());
30
+ const endTime = performance.now();
31
+ const timestamp = Date.now();
33
32
  const duration = endTime - startTime;
34
33
  const contentType = response.headers.get("content-type");
35
34
  const responseHeaders = normalizeHeaders(response.headers, isUsingProxy);
36
35
  const responseUrl = new URL(response.url);
37
36
  const fullPath = responseUrl.pathname + responseUrl.search;
38
- const statusText = response.statusText || httpStatusCodes$1[response.status]?.name || "";
39
- const method = modifiedRequest.method;
37
+ const statusText = response.statusText || httpStatusCodes[response.status]?.name || "";
38
+ const method = request.method;
40
39
  const shouldSkipBody = NO_BODY_STATUS_CODES.includes(response.status);
41
40
  /**
42
41
  * Handle server-sent event streams separately.
@@ -45,10 +44,8 @@ var sendRequest = async ({ isUsingProxy, operation, request, plugins }) => {
45
44
  */
46
45
  if (contentType?.startsWith("text/event-stream") && response.body) return buildStreamingResponse({
47
46
  response,
48
- modifiedRequest,
49
- operation,
50
- plugins,
51
- endTime,
47
+ request,
48
+ timestamp,
52
49
  duration,
53
50
  responseHeaders,
54
51
  statusText,
@@ -57,10 +54,8 @@ var sendRequest = async ({ isUsingProxy, operation, request, plugins }) => {
57
54
  });
58
55
  return buildStandardResponse({
59
56
  response,
60
- modifiedRequest,
61
- operation,
62
- plugins,
63
- endTime,
57
+ request,
58
+ timestamp,
64
59
  duration,
65
60
  responseHeaders,
66
61
  statusText,
@@ -77,21 +72,16 @@ var sendRequest = async ({ isUsingProxy, operation, request, plugins }) => {
77
72
  * Build a streaming response for server-sent events.
78
73
  * Streaming responses use a reader instead of buffering the entire body.
79
74
  */
80
- var buildStreamingResponse = async ({ response, modifiedRequest, operation, plugins, endTime, duration, responseHeaders, statusText, method, fullPath }) => {
75
+ var buildStreamingResponse = ({ response, request, timestamp, duration, responseHeaders, statusText, method, fullPath }) => {
81
76
  const normalizedResponse = new Response(null, {
82
77
  status: response.status,
83
78
  statusText,
84
79
  headers: response.headers
85
80
  });
86
- await executeHook({
87
- response: normalizedResponse,
88
- request: modifiedRequest,
89
- operation
90
- }, "responseReceived", plugins);
91
81
  const cookieHeaderKeys = getCookieHeaderKeys(normalizedResponse.headers);
92
82
  return [null, {
93
- timestamp: endTime,
94
- request: modifiedRequest,
83
+ timestamp,
84
+ request,
95
85
  response: {
96
86
  ...normalizedResponse,
97
87
  headers: responseHeaders,
@@ -108,7 +98,7 @@ var buildStreamingResponse = async ({ response, modifiedRequest, operation, plug
108
98
  * Build a standard response with buffered body data.
109
99
  * This handles all non-streaming responses including JSON, text, and binary data.
110
100
  */
111
- var buildStandardResponse = async ({ response, modifiedRequest, operation, plugins, endTime, duration, responseHeaders, statusText, method, fullPath, contentType, shouldSkipBody }) => {
101
+ var buildStandardResponse = async ({ response, request, timestamp, duration, responseHeaders, statusText, method, fullPath, contentType, shouldSkipBody }) => {
112
102
  const arrayBuffer = await response.clone().arrayBuffer();
113
103
  const responseData = decodeBuffer(arrayBuffer, contentType ?? "text/plain;charset=UTF-8");
114
104
  /**
@@ -120,15 +110,10 @@ var buildStandardResponse = async ({ response, modifiedRequest, operation, plugi
120
110
  statusText,
121
111
  headers: response.headers
122
112
  });
123
- await executeHook({
124
- response: normalizedResponse,
125
- request: modifiedRequest,
126
- operation
127
- }, "responseReceived", plugins);
128
113
  const cookieHeaderKeys = getCookieHeaderKeys(normalizedResponse.headers);
129
114
  return [null, {
130
- timestamp: endTime,
131
- request: modifiedRequest,
115
+ timestamp,
116
+ request,
132
117
  response: {
133
118
  ...normalizedResponse,
134
119
  headers: responseHeaders,