@scalar/api-client 3.14.0 → 3.15.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 (349) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/assets/computer.ascii.virtual.js.map +1 -1
  3. package/dist/components/HelpfulLink.vue.script.js +1 -1
  4. package/dist/components/HelpfulLink.vue.script.js.map +1 -1
  5. package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
  6. package/dist/components/HttpMethod/HttpMethod.vue.script.js +1 -1
  7. package/dist/components/HttpMethod/HttpMethod.vue.script.js.map +1 -1
  8. package/dist/components/ScalarAsciiArt/ScalarAsciiArt.vue.js +1 -1
  9. package/dist/components/ScalarAsciiArt/ScalarAsciiArt.vue.script.js +1 -1
  10. package/dist/components/ScalarAsciiArt/ScalarAsciiArt.vue.script.js.map +1 -1
  11. package/dist/components/SectionFilter.vue.d.ts +1 -1
  12. package/dist/components/SectionFilter.vue.d.ts.map +1 -1
  13. package/dist/components/SectionFilter.vue.js +1 -1
  14. package/dist/components/SectionFilter.vue.script.js +2 -2
  15. package/dist/components/SectionFilter.vue.script.js.map +1 -1
  16. package/dist/components/SectionFilterButton.vue.script.js +1 -1
  17. package/dist/components/SectionFilterButton.vue.script.js.map +1 -1
  18. package/dist/components/Server/ServerVariablesForm.vue.d.ts.map +1 -1
  19. package/dist/components/Server/ServerVariablesForm.vue.script.js +1 -1
  20. package/dist/components/Server/ServerVariablesForm.vue.script.js.map +1 -1
  21. package/dist/components/Server/ServerVariablesSelect.vue.script.js +1 -1
  22. package/dist/components/Server/ServerVariablesSelect.vue.script.js.map +1 -1
  23. package/dist/components/Server/ServerVariablesTextbox.vue.script.js +1 -1
  24. package/dist/components/Server/ServerVariablesTextbox.vue.script.js.map +1 -1
  25. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts.map +1 -1
  26. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js +1 -1
  27. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js.map +1 -1
  28. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  29. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js +1 -1
  30. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js.map +1 -1
  31. package/dist/components/ViewLayout/ViewLayout.vue.script.js +1 -1
  32. package/dist/components/ViewLayout/ViewLayout.vue.script.js.map +1 -1
  33. package/dist/components/ViewLayout/ViewLayoutContent.vue.js +1 -1
  34. package/dist/components/ViewLayout/ViewLayoutContent.vue.js.map +1 -1
  35. package/dist/components/ViewLayout/ViewLayoutSection.vue.script.js +1 -1
  36. package/dist/components/ViewLayout/ViewLayoutSection.vue.script.js.map +1 -1
  37. package/dist/hooks/use-file-dialog.js +2 -1
  38. package/dist/hooks/use-file-dialog.js.map +1 -1
  39. package/dist/plugins/posthog/index.js.map +1 -1
  40. package/dist/plugins/posthog/sanitize-event-payload.js +1 -1
  41. package/dist/plugins/posthog/sanitize-event-payload.js.map +1 -1
  42. package/dist/style.css +296 -273
  43. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  44. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  45. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +4 -2
  46. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  47. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  48. package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
  49. package/dist/v2/blocks/operation-block/components/Header.vue.script.js +1 -1
  50. package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
  51. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js +1 -1
  52. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js +1 -1
  53. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js.map +1 -1
  54. package/dist/v2/blocks/operation-block/helpers/decode-buffer.js.map +1 -1
  55. package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.js.map +1 -1
  56. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js.map +1 -1
  57. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.js.map +1 -1
  58. package/dist/v2/blocks/operation-block/helpers/persist-response-cookies.js.map +1 -1
  59. package/dist/v2/blocks/operation-block/helpers/response-cache.js.map +1 -1
  60. package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
  61. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js.map +1 -1
  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 +58 -29
  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.script.js +1 -1
  70. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  71. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts.map +1 -1
  72. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.script.js +1 -1
  73. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.script.js.map +1 -1
  74. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.d.ts.map +1 -1
  75. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js +1 -1
  76. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js.map +1 -1
  77. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js +1 -1
  78. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js.map +1 -1
  79. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  80. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +1 -1
  81. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  82. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts +2 -0
  83. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  84. package/dist/v2/blocks/request-block/components/RequestParams.vue.js.map +1 -1
  85. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js +5 -3
  86. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js.map +1 -1
  87. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -0
  88. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  89. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  90. package/dist/v2/blocks/request-block/components/RequestTable.vue.js.map +1 -1
  91. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js +6 -3
  92. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js.map +1 -1
  93. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +8 -0
  94. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  95. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  96. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +29 -16
  97. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  98. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js +1 -1
  99. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js.map +1 -1
  100. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js.map +1 -1
  101. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js +1 -1
  102. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js.map +1 -1
  103. package/dist/v2/blocks/request-block/helpers/files.js.map +1 -1
  104. package/dist/v2/blocks/request-block/helpers/fold-structured-body-rows.js.map +1 -1
  105. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +10 -5
  106. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
  107. package/dist/v2/blocks/request-block/helpers/get-parameter-content.js.map +1 -1
  108. package/dist/v2/blocks/request-block/helpers/get-parameter-schema.js.map +1 -1
  109. package/dist/v2/blocks/request-block/helpers/get-structured-body-rows.js.map +1 -1
  110. package/dist/v2/blocks/request-block/helpers/group-by.js.map +1 -1
  111. package/dist/v2/blocks/request-block/helpers/group-global-cookies.d.ts +54 -0
  112. package/dist/v2/blocks/request-block/helpers/group-global-cookies.d.ts.map +1 -0
  113. package/dist/v2/blocks/request-block/helpers/group-global-cookies.js +56 -0
  114. package/dist/v2/blocks/request-block/helpers/group-global-cookies.js.map +1 -0
  115. package/dist/v2/blocks/request-block/helpers/structured-body-codec.js +1 -1
  116. package/dist/v2/blocks/request-block/helpers/structured-body-codec.js.map +1 -1
  117. package/dist/v2/blocks/request-block/helpers/validate-parameter.js.map +1 -1
  118. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  119. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  120. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +1 -1
  121. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
  122. package/dist/v2/blocks/response-block/components/Headers.vue.script.js +1 -1
  123. package/dist/v2/blocks/response-block/components/Headers.vue.script.js.map +1 -1
  124. package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +1 -1
  125. package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js +1 -1
  126. package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js.map +1 -1
  127. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js +1 -1
  128. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js.map +1 -1
  129. package/dist/v2/blocks/response-block/components/ResponseBodyInfo.vue.js +1 -1
  130. package/dist/v2/blocks/response-block/components/ResponseBodyInfo.vue.js.map +1 -1
  131. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js +1 -1
  132. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js +1 -1
  133. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js.map +1 -1
  134. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.js +1 -1
  135. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.script.js +1 -1
  136. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.script.js.map +1 -1
  137. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
  138. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js +1 -1
  139. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js.map +1 -1
  140. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js +1 -1
  141. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js.map +1 -1
  142. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js +1 -1
  143. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js.map +1 -1
  144. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js +1 -1
  145. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js.map +1 -1
  146. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
  147. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js +1 -1
  148. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js.map +1 -1
  149. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
  150. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +1 -1
  151. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js +1 -1
  152. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js.map +1 -1
  153. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js +1 -1
  154. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js.map +1 -1
  155. package/dist/v2/blocks/response-block/helpers/extract-filename.js.map +1 -1
  156. package/dist/v2/blocks/response-block/helpers/get-content-length.js.map +1 -1
  157. package/dist/v2/blocks/response-block/helpers/media-types.js.map +1 -1
  158. package/dist/v2/blocks/response-block/helpers/parse-set-cookie.js.map +1 -1
  159. package/dist/v2/blocks/response-block/helpers/prettify-jsonc-string.js.map +1 -1
  160. package/dist/v2/blocks/response-block/helpers/process-response-body.js.map +1 -1
  161. package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.js.map +1 -1
  162. package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.js +7 -1
  163. package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.js.map +1 -1
  164. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  165. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  166. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +1 -1
  167. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  168. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
  169. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
  170. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +1 -1
  171. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
  172. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
  173. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +1 -1
  174. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
  175. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.js +3 -1
  176. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.js.map +1 -1
  177. package/dist/v2/blocks/scalar-address-bar-block/helpers/is-placeholder-path.js.map +1 -1
  178. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.js.map +1 -1
  179. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.js.map +1 -1
  180. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-path-masking.js.map +1 -1
  181. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  182. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +1 -1
  183. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  184. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -1
  185. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js +1 -1
  186. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js.map +1 -1
  187. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  188. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +1 -1
  189. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  190. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
  191. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js +1 -1
  192. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js.map +1 -1
  193. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
  194. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js +1 -1
  195. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map +1 -1
  196. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -1
  197. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js +1 -1
  198. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map +1 -1
  199. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  200. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js +1 -1
  201. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -1
  202. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +1 -1
  203. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.script.js +3 -3
  204. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.script.js.map +1 -1
  205. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  206. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +1 -1
  207. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
  208. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js.map +1 -1
  209. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +5 -0
  210. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js.map +1 -1
  211. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-callback.js +1 -1
  212. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-callback.js.map +1 -1
  213. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +2 -2
  214. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
  215. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js.map +1 -1
  216. package/dist/v2/blocks/scalar-auth-selector-block/helpers/resolve-default-oauth2-redirect-url.js.map +1 -1
  217. package/dist/v2/blocks/scalar-auth-selector-block/helpers/run-oauth2-authorize.js.map +1 -1
  218. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
  219. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  220. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  221. package/dist/v2/components/code-input/CodeInput.vue.script.js +6 -1
  222. package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
  223. package/dist/v2/components/code-input/CodeInputLite.vue.d.ts.map +1 -1
  224. package/dist/v2/components/code-input/CodeInputLite.vue.js +1 -1
  225. package/dist/v2/components/code-input/CodeInputLite.vue.script.js +5 -1
  226. package/dist/v2/components/code-input/CodeInputLite.vue.script.js.map +1 -1
  227. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js +1 -1
  228. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js.map +1 -1
  229. package/dist/v2/components/code-input/code-variable-widget.js +1 -0
  230. package/dist/v2/components/code-input/code-variable-widget.js.map +1 -1
  231. package/dist/v2/components/code-input/helpers/build-pill-context.js.map +1 -1
  232. package/dist/v2/components/code-input/helpers/lookup-variable-value.js.map +1 -1
  233. package/dist/v2/components/code-input/helpers/pill-signature.js.map +1 -1
  234. package/dist/v2/components/code-input/helpers/serialize-value.js.map +1 -1
  235. package/dist/v2/components/context-menu/ContextMenu.vue.script.js +1 -1
  236. package/dist/v2/components/context-menu/ContextMenu.vue.script.js.map +1 -1
  237. package/dist/v2/components/data-table/DataTable.vue.script.js +1 -1
  238. package/dist/v2/components/data-table/DataTable.vue.script.js.map +1 -1
  239. package/dist/v2/components/data-table/DataTableCell.vue.script.js +1 -1
  240. package/dist/v2/components/data-table/DataTableCell.vue.script.js.map +1 -1
  241. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js +1 -1
  242. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js.map +1 -1
  243. package/dist/v2/components/data-table/DataTableHeader.vue.script.js +1 -1
  244. package/dist/v2/components/data-table/DataTableHeader.vue.script.js.map +1 -1
  245. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  246. package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
  247. package/dist/v2/components/data-table/DataTableInput.vue.script.js +1 -1
  248. package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
  249. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
  250. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js +3 -2
  251. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js.map +1 -1
  252. package/dist/v2/components/data-table/DataTableRow.vue.js +1 -1
  253. package/dist/v2/components/data-table/DataTableRow.vue.js.map +1 -1
  254. package/dist/v2/components/data-table/DataTableText.vue.script.js +1 -1
  255. package/dist/v2/components/data-table/DataTableText.vue.script.js.map +1 -1
  256. package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -1
  257. package/dist/v2/components/forms/ConfirmationForm.vue.script.js +1 -1
  258. package/dist/v2/components/forms/ConfirmationForm.vue.script.js.map +1 -1
  259. package/dist/v2/components/layout/CollapsibleSection.vue.d.ts.map +1 -1
  260. package/dist/v2/components/layout/CollapsibleSection.vue.script.js +1 -1
  261. package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
  262. package/dist/v2/components/layout/ValueEmitter.vue.d.ts +1 -1
  263. package/dist/v2/components/layout/ValueEmitter.vue.d.ts.map +1 -1
  264. package/dist/v2/components/layout/ValueEmitter.vue.script.js +1 -1
  265. package/dist/v2/components/layout/ValueEmitter.vue.script.js.map +1 -1
  266. package/dist/v2/components/modals/DeleteModal.vue.d.ts.map +1 -1
  267. package/dist/v2/components/modals/DeleteModal.vue.script.js +1 -1
  268. package/dist/v2/components/modals/DeleteModal.vue.script.js.map +1 -1
  269. package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
  270. package/dist/v2/components/modals/ModalClientContainer.vue.script.js +1 -1
  271. package/dist/v2/components/modals/ModalClientContainer.vue.script.js.map +1 -1
  272. package/dist/v2/components/resize/Resize.vue.js +1 -1
  273. package/dist/v2/components/resize/Resize.vue.script.js +1 -1
  274. package/dist/v2/components/resize/Resize.vue.script.js.map +1 -1
  275. package/dist/v2/components/resize/use-split-resize.js +4 -2
  276. package/dist/v2/components/resize/use-split-resize.js.map +1 -1
  277. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
  278. package/dist/v2/components/server/ServerDropdown.vue.script.js +1 -1
  279. package/dist/v2/components/server/ServerDropdown.vue.script.js.map +1 -1
  280. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts.map +1 -1
  281. package/dist/v2/components/server/ServerDropdownItem.vue.js +1 -1
  282. package/dist/v2/components/server/ServerDropdownItem.vue.script.js +1 -1
  283. package/dist/v2/components/server/ServerDropdownItem.vue.script.js.map +1 -1
  284. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  285. package/dist/v2/components/sidebar/Sidebar.vue.script.js +3 -3
  286. package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
  287. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  288. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js +1 -1
  289. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js.map +1 -1
  290. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js +1 -1
  291. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js.map +1 -1
  292. package/dist/v2/constants.js +1 -1
  293. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js +1 -1
  294. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js.map +1 -1
  295. package/dist/v2/features/command-palette/components/CommandActionInput.vue.script.js +1 -1
  296. package/dist/v2/features/command-palette/components/CommandActionInput.vue.script.js.map +1 -1
  297. package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
  298. package/dist/v2/features/environments/EnvironmentsList.vue.script.js +1 -1
  299. package/dist/v2/features/environments/EnvironmentsList.vue.script.js.map +1 -1
  300. package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
  301. package/dist/v2/features/environments/components/Environment.vue.script.js +1 -1
  302. package/dist/v2/features/environments/components/Environment.vue.script.js.map +1 -1
  303. package/dist/v2/features/environments/components/EnvironmentColors.vue.script.js +3 -2
  304. package/dist/v2/features/environments/components/EnvironmentColors.vue.script.js.map +1 -1
  305. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.d.ts.map +1 -1
  306. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js +1 -1
  307. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js.map +1 -1
  308. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts.map +1 -1
  309. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js +1 -1
  310. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js.map +1 -1
  311. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
  312. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +1 -1
  313. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
  314. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.d.ts.map +1 -1
  315. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +1 -1
  316. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js +1 -1
  317. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js.map +1 -1
  318. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  319. package/dist/v2/features/modal/Modal.vue.script.js +1 -1
  320. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  321. package/dist/v2/features/modal/helpers/create-api-client-modal.js +11 -0
  322. package/dist/v2/features/modal/helpers/create-api-client-modal.js.map +1 -1
  323. package/dist/v2/features/modal/helpers/map-hidden-clients-config.js.map +1 -1
  324. package/dist/v2/features/modal/helpers/resolve-route-parameters.js +1 -1
  325. package/dist/v2/features/modal/helpers/resolve-route-parameters.js.map +1 -1
  326. package/dist/v2/features/modal/hooks/use-modal-sidebar.js.map +1 -1
  327. package/dist/v2/features/modal/modal-events.js.map +1 -1
  328. package/dist/v2/features/operation/Operation.vue.script.js +1 -1
  329. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  330. package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -1
  331. package/dist/v2/features/search/components/DocumentSearchModal.vue.js +1 -1
  332. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +1 -1
  333. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -1
  334. package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -1
  335. package/dist/v2/features/search/components/SearchResult.vue.script.js +1 -1
  336. package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -1
  337. package/dist/v2/features/search/helpers/create-fuse-instance.js.map +1 -1
  338. package/dist/v2/features/search/helpers/create-search-index.js.map +1 -1
  339. package/dist/v2/features/search/hooks/use-document-search.js.map +1 -1
  340. package/dist/v2/features/search/hooks/use-search-index.js.map +1 -1
  341. package/dist/v2/helpers/generate-location-id.js.map +1 -1
  342. package/dist/v2/helpers/handle-hotkeys.js +1 -1
  343. package/dist/v2/helpers/handle-hotkeys.js.map +1 -1
  344. package/dist/v2/helpers/test-utils.js.map +1 -1
  345. package/dist/v2/hooks/use-global-hot-keys.js.map +1 -1
  346. package/dist/v2/hooks/use-scroll-lock.js.map +1 -1
  347. package/dist/v2/workspace-events.js.map +1 -1
  348. package/dist/vue-styles.css +227 -234
  349. package/package.json +20 -20
@@ -1 +1 @@
1
- {"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/bloc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AClC,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;IACxD,6CAA6C;IAC7C,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAChC,CAAA;AACD,QAAA,MAAM,YAAY,kTAwnBd,CAAC"}
1
+ {"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"AA4oBA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AACrF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAA;AAG/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,EAML,KAAK,qBAAqB,EAE1B,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,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MAAM,CAAC,EAAE,SAAS,GAAG,eAAe,CAAA;IACpC,uBAAuB;IACvB,SAAS,EAAE,eAAe,CAAA;IAC1B,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,2CAA2C;IAC3C,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;IACxD,6CAA6C;IAC7C,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAChC,CAAA;AACD,QAAA,MAAM,YAAY,kTA6nBd,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 /** Application version */\n appVersion: string\n /** Openapi document */\n document: OpenApiDocument\n /** Openapi document slug */\n documentSlug: 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 /** Subset of config options for the modal */\n options?: ModalProps['options']\n}\n</script>\n<script setup lang=\"ts\">\nimport { generateClientOptions } from '@scalar/blocks/code-example'\nimport { ERRORS } from '@scalar/helpers/errors/normalize-error'\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport { buildSafeBodyRequest } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\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 createVariablesStoreForRequest,\n getEnvironmentVariables,\n requestFactory,\n resolveExecutableRequestUrl,\n type MergedSecuritySchemes,\n type RequestPayload,\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, toValue, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\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 getCookieRequestUrl,\n getResponseCookieActions,\n} from '@/v2/blocks/operation-block/helpers/persist-response-cookies'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport {\n sendRequest,\n type ResponseInstance,\n} from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n document,\n documentSlug,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n layout,\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n options,\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()\nconst { copyToClipboard } = useClipboard()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst requestPayload = ref<RequestPayload | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/**\n * Persist server-set cookies from a response into the document cookie jar.\n *\n * Scalar keeps its own cookie jar because browsers hide `Set-Cookie` from `fetch`.\n * Mirroring browser behavior, cookies are stored scoped to the request host and\n * path and removed when the server expires them, so a value like a Django CSRF\n * token stays available for later PUT/PATCH requests after a page reload.\n */\nconst persistResponseCookies = (sendResult: {\n response: ResponseInstance\n requestPayload: RequestPayload\n}) => {\n const actions = getResponseCookieActions({\n cookieHeaderKeys: sendResult.response.cookieHeaderKeys ?? [],\n documentCookies,\n requestUrl: getCookieRequestUrl(String(sendResult.requestPayload[0])),\n })\n\n for (const action of actions) {\n if (action.type === 'delete') {\n eventBus.emit('cookie:delete:cookie', {\n collectionType: 'document',\n cookieName: action.cookieName,\n index: action.index,\n })\n continue\n }\n\n eventBus.emit('cookie:upsert:cookie', {\n collectionType: 'document',\n payload: action.cookie,\n ...(action.index === undefined ? {} : { index: action.index }),\n })\n }\n}\n\n/**\n * Copy the executable URL — same pipeline as Send (`requestFactory` +\n * `resolveExecutableRequestUrl`), including security query params.\n */\nconst copyAddressBarUrl = async (): Promise<void> => {\n const { request } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies: [...workspaceCookies, ...documentCookies],\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n await copyToClipboard(\n resolveExecutableRequestUrl(request, getEnvironmentVariables(environment)),\n )\n}\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n eventBus.flushDebouncedEmits?.()\n\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 const variablesStore = createVariablesStoreForRequest()\n\n // Execute the beforeRequest hook (plugins receive RequestFactory, not fetch Request)\n await executeHook(\n {\n requestBuilder,\n document,\n operation,\n variablesStore,\n },\n 'beforeRequest',\n plugins,\n )\n\n const envVariables = {\n ...getEnvironmentVariables(environment),\n ...variablesStore.getVariables(),\n }\n\n // Build the fetch Request after hooks may have mutated the factory\n const built = buildRequest(requestBuilder, {\n envVariables,\n allowMissingRequestServerBase: layout === 'modal',\n })\n if (!built.ok) {\n toast(built.message ?? built.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = built.data.controller\n\n // Build the fetch Request once so the requestBuilt hook observes the exact bytes that are\n // sent. Rebuilding it later would generate a different multipart boundary, which breaks\n // plugins that hash the body (for example, request signing).\n const request = buildSafeBodyRequest(...built.data.requestPayload)\n\n // Execute the requestBuilt hook (plugins receive the exact fetch Request that will be sent)\n await executeHook(\n {\n request,\n requestBuilder,\n document,\n operation,\n variablesStore,\n },\n 'requestBuilt',\n plugins,\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: built.data.isUsingProxy,\n requestPayload: built.data.requestPayload,\n request,\n plugins,\n customFetch: toValue(options)?.customFetch,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n requestBuilder,\n request: buildSafeBodyRequest(...sendResult.requestPayload),\n document,\n operation,\n variablesStore,\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 requestPayload: sendResult.requestPayload,\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 requestPayload.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 requestPayload.value = sendResult.requestPayload\n\n // Persist server-set cookies into the document jar so values like a CSRF token\n // survive a page reload and get replayed on the next request, like a browser would.\n persistResponseCookies(sendResult)\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 requestPayload: sendResult.requestPayload,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n eventBus.on('copy-url:address-bar', copyAddressBarUrl)\n\n // Let plugins warm up per-operation resources (e.g. the scripts sandbox) so the first request\n // does not pay their cold-start cost.\n void executeHook({ document, operation }, 'onRequestMount', plugins)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n eventBus.off('copy-url:address-bar', copyAddressBarUrl)\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 requestPayload.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\nconst handleNavigateSettings = () => {\n eventBus.emit('ui:navigate', {\n page: 'operation',\n path: 'overview',\n operationPath: path,\n method,\n })\n}\n\n/**\n * When the path, method, or example key changes, restore the response panel\n * for the new operation from the best available source:\n *\n * 1. `responseCache` — in-memory, populated on every successful send.\n * Has the live response object (including streams) so it wins.\n * 2. `history` — persisted in the workspace store. Used as a fallback when\n * the in-memory cache is empty (page reload, fresh app session, etc.)\n * so navigating to an operation that has been called before shows the\n * last response instead of an empty panel.\n * 3. Otherwise clear.\n *\n * Only the response is restored from history — the user's request inputs are\n * left alone, so we never silently overwrite an in-progress draft.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const cached = responseCache.get(\n getOperationExampleKey(newMethod, newPath, newExampleKey),\n )\n\n if (cached) {\n response.value = cached.response\n requestPayload.value = cached.requestPayload\n } else {\n // History is keyed only by document/path/method but each entry carries\n // the example it came from, so we walk from the end and pick the most\n // recent entry that matches the active example. Otherwise a cache miss\n // on example B would restore example A's response. Only runs on a\n // cache miss — the common case (in-session navigation) skips it.\n const latest = (() => {\n for (let i = history.length - 1; i >= 0; i--) {\n const entry = history[i]\n if (entry?.meta.example === newExampleKey) {\n return entry\n }\n }\n return undefined\n })()\n\n if (latest) {\n response.value = harToFetchResponse({\n harResponse: latest.response,\n url: latest.request.url,\n method: newMethod,\n path: newPath,\n duration: latest.time,\n })\n requestPayload.value = null\n } else {\n response.value = null\n requestPayload.value = null\n }\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 :documentSlug\n :documentUrl\n :environment\n :environments\n :eventBus\n :exampleKey\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 @navigate:settings=\"handleNavigateSettings\"\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 :options=\"toValue(options)\"\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 :requestPayload\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 /** Openapi document */\n document: OpenApiDocument\n /** Openapi document slug */\n documentSlug: 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 /** Subset of config options for the modal */\n options?: ModalProps['options']\n}\n</script>\n<script setup lang=\"ts\">\nimport { generateClientOptions } from '@scalar/blocks/code-example'\nimport { ERRORS } from '@scalar/helpers/errors/normalize-error'\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport { buildSafeBodyRequest } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\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 createVariablesStoreForRequest,\n getEnvironmentVariables,\n requestFactory,\n resolveExecutableRequestUrl,\n type MergedSecuritySchemes,\n type RequestPayload,\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, toValue, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\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 getCookieRequestUrl,\n getResponseCookieActions,\n} from '@/v2/blocks/operation-block/helpers/persist-response-cookies'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport {\n sendRequest,\n type ResponseInstance,\n} from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n document,\n documentSlug,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n layout,\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n options,\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()\nconst { copyToClipboard } = useClipboard()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst requestPayload = ref<RequestPayload | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/**\n * Persist server-set cookies from a response into the document cookie jar.\n *\n * Scalar keeps its own cookie jar because browsers hide `Set-Cookie` from `fetch`.\n * Mirroring browser behavior, cookies are stored scoped to the request host and\n * path and removed when the server expires them, so a value like a Django CSRF\n * token stays available for later PUT/PATCH requests after a page reload.\n */\nconst persistResponseCookies = (sendResult: {\n response: ResponseInstance\n requestPayload: RequestPayload\n}) => {\n const actions = getResponseCookieActions({\n cookieHeaderKeys: sendResult.response.cookieHeaderKeys ?? [],\n documentCookies,\n requestUrl: getCookieRequestUrl(String(sendResult.requestPayload[0])),\n })\n\n for (const action of actions) {\n if (action.type === 'delete') {\n eventBus.emit('cookie:delete:cookie', {\n collectionType: 'document',\n cookieName: action.cookieName,\n index: action.index,\n })\n continue\n }\n\n eventBus.emit('cookie:upsert:cookie', {\n collectionType: 'document',\n payload: action.cookie,\n ...(action.index === undefined ? {} : { index: action.index }),\n })\n }\n}\n\n/**\n * Copy the executable URL — same pipeline as Send (`requestFactory` +\n * `resolveExecutableRequestUrl`), including security query params.\n */\nconst copyAddressBarUrl = async (): Promise<void> => {\n const { request } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies: [...workspaceCookies, ...documentCookies],\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n await copyToClipboard(\n resolveExecutableRequestUrl(request, getEnvironmentVariables(environment)),\n )\n}\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n eventBus.flushDebouncedEmits?.()\n\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 const variablesStore = createVariablesStoreForRequest()\n\n // Execute the beforeRequest hook (plugins receive RequestFactory, not fetch Request)\n await executeHook(\n {\n requestBuilder,\n document,\n operation,\n variablesStore,\n server,\n customFetch: toValue(options)?.customFetch,\n },\n 'beforeRequest',\n plugins,\n )\n\n const envVariables = {\n ...getEnvironmentVariables(environment),\n ...variablesStore.getVariables(),\n }\n\n // Build the fetch Request after hooks may have mutated the factory\n const built = buildRequest(requestBuilder, {\n envVariables,\n allowMissingRequestServerBase: layout === 'modal',\n })\n if (!built.ok) {\n toast(built.message ?? built.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = built.data.controller\n\n // Build the fetch Request once so the requestBuilt hook observes the exact bytes that are\n // sent. Rebuilding it later would generate a different multipart boundary, which breaks\n // plugins that hash the body (for example, request signing).\n const request = buildSafeBodyRequest(...built.data.requestPayload)\n\n // Execute the requestBuilt hook (plugins receive the exact fetch Request that will be sent)\n await executeHook(\n {\n request,\n requestBuilder,\n document,\n operation,\n variablesStore,\n },\n 'requestBuilt',\n plugins,\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: built.data.isUsingProxy,\n requestPayload: built.data.requestPayload,\n request,\n plugins,\n customFetch: toValue(options)?.customFetch,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n requestBuilder,\n request: buildSafeBodyRequest(...sendResult.requestPayload),\n document,\n operation,\n variablesStore,\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 requestPayload: sendResult.requestPayload,\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 requestPayload.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 requestPayload.value = sendResult.requestPayload\n\n // Persist server-set cookies into the document jar so values like a CSRF token\n // survive a page reload and get replayed on the next request, like a browser would.\n persistResponseCookies(sendResult)\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 requestPayload: sendResult.requestPayload,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n eventBus.on('copy-url:address-bar', copyAddressBarUrl)\n\n // Let plugins warm up per-operation resources (e.g. the scripts sandbox) so the first request\n // does not pay their cold-start cost.\n void executeHook({ document, operation }, 'onRequestMount', plugins)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n eventBus.off('copy-url:address-bar', copyAddressBarUrl)\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 requestPayload.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\nconst handleNavigateSettings = () => {\n eventBus.emit('ui:navigate', {\n page: 'operation',\n path: 'overview',\n operationPath: path,\n method,\n })\n}\n\n/**\n * When the path, method, or example key changes, restore the response panel\n * for the new operation from the best available source:\n *\n * 1. `responseCache` — in-memory, populated on every successful send.\n * Has the live response object (including streams) so it wins.\n * 2. `history` — persisted in the workspace store. Used as a fallback when\n * the in-memory cache is empty (page reload, fresh app session, etc.)\n * so navigating to an operation that has been called before shows the\n * last response instead of an empty panel.\n * 3. Otherwise clear.\n *\n * Only the response is restored from history — the user's request inputs are\n * left alone, so we never silently overwrite an in-progress draft.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const cached = responseCache.get(\n getOperationExampleKey(newMethod, newPath, newExampleKey),\n )\n\n if (cached) {\n response.value = cached.response\n requestPayload.value = cached.requestPayload\n } else {\n // History is keyed only by document/path/method but each entry carries\n // the example it came from, so we walk from the end and pick the most\n // recent entry that matches the active example. Otherwise a cache miss\n // on example B would restore example A's response. Only runs on a\n // cache miss — the common case (in-session navigation) skips it.\n const latest = (() => {\n for (let i = history.length - 1; i >= 0; i--) {\n const entry = history[i]\n if (entry?.meta.example === newExampleKey) {\n return entry\n }\n }\n return undefined\n })()\n\n if (latest) {\n response.value = harToFetchResponse({\n harResponse: latest.response,\n url: latest.request.url,\n method: newMethod,\n path: newPath,\n duration: latest.time,\n })\n requestPayload.value = null\n } else {\n response.value = null\n requestPayload.value = null\n }\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 :documentSlug\n :documentUrl\n :environment\n :environments\n :eventBus\n :exampleKey\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 @navigate:settings=\"handleNavigateSettings\"\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 :options=\"toValue(options)\"\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 :requestPayload\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":""}
@@ -22,7 +22,7 @@ import { useToasts } from "@scalar/use-toasts";
22
22
  //#region src/v2/blocks/operation-block/OperationBlock.vue?vue&type=script&setup=true&lang.ts
23
23
  var _hoisted_1 = { class: "bg-b-1 flex h-full flex-col" };
24
24
  var _hoisted_2 = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" };
25
- var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
25
+ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
26
26
  name: "OperationBlock",
27
27
  props: {
28
28
  eventBus: {},
@@ -149,7 +149,9 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
149
149
  requestBuilder,
150
150
  document: __props.document,
151
151
  operation: __props.operation,
152
- variablesStore
152
+ variablesStore,
153
+ server: __props.server,
154
+ customFetch: toValue(__props.options)?.customFetch
153
155
  }, "beforeRequest", __props.plugins);
154
156
  const built = buildRequest(requestBuilder, {
155
157
  envVariables: {
@@ -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 /** Application version */\n appVersion: string\n /** Openapi document */\n document: OpenApiDocument\n /** Openapi document slug */\n documentSlug: 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 /** Subset of config options for the modal */\n options?: ModalProps['options']\n}\n</script>\n<script setup lang=\"ts\">\nimport { generateClientOptions } from '@scalar/blocks/code-example'\nimport { ERRORS } from '@scalar/helpers/errors/normalize-error'\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport { buildSafeBodyRequest } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\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 createVariablesStoreForRequest,\n getEnvironmentVariables,\n requestFactory,\n resolveExecutableRequestUrl,\n type MergedSecuritySchemes,\n type RequestPayload,\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, toValue, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\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 getCookieRequestUrl,\n getResponseCookieActions,\n} from '@/v2/blocks/operation-block/helpers/persist-response-cookies'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport {\n sendRequest,\n type ResponseInstance,\n} from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n document,\n documentSlug,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n layout,\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n options,\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()\nconst { copyToClipboard } = useClipboard()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst requestPayload = ref<RequestPayload | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/**\n * Persist server-set cookies from a response into the document cookie jar.\n *\n * Scalar keeps its own cookie jar because browsers hide `Set-Cookie` from `fetch`.\n * Mirroring browser behavior, cookies are stored scoped to the request host and\n * path and removed when the server expires them, so a value like a Django CSRF\n * token stays available for later PUT/PATCH requests after a page reload.\n */\nconst persistResponseCookies = (sendResult: {\n response: ResponseInstance\n requestPayload: RequestPayload\n}) => {\n const actions = getResponseCookieActions({\n cookieHeaderKeys: sendResult.response.cookieHeaderKeys ?? [],\n documentCookies,\n requestUrl: getCookieRequestUrl(String(sendResult.requestPayload[0])),\n })\n\n for (const action of actions) {\n if (action.type === 'delete') {\n eventBus.emit('cookie:delete:cookie', {\n collectionType: 'document',\n cookieName: action.cookieName,\n index: action.index,\n })\n continue\n }\n\n eventBus.emit('cookie:upsert:cookie', {\n collectionType: 'document',\n payload: action.cookie,\n ...(action.index === undefined ? {} : { index: action.index }),\n })\n }\n}\n\n/**\n * Copy the executable URL — same pipeline as Send (`requestFactory` +\n * `resolveExecutableRequestUrl`), including security query params.\n */\nconst copyAddressBarUrl = async (): Promise<void> => {\n const { request } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies: [...workspaceCookies, ...documentCookies],\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n await copyToClipboard(\n resolveExecutableRequestUrl(request, getEnvironmentVariables(environment)),\n )\n}\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n eventBus.flushDebouncedEmits?.()\n\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 const variablesStore = createVariablesStoreForRequest()\n\n // Execute the beforeRequest hook (plugins receive RequestFactory, not fetch Request)\n await executeHook(\n {\n requestBuilder,\n document,\n operation,\n variablesStore,\n },\n 'beforeRequest',\n plugins,\n )\n\n const envVariables = {\n ...getEnvironmentVariables(environment),\n ...variablesStore.getVariables(),\n }\n\n // Build the fetch Request after hooks may have mutated the factory\n const built = buildRequest(requestBuilder, {\n envVariables,\n allowMissingRequestServerBase: layout === 'modal',\n })\n if (!built.ok) {\n toast(built.message ?? built.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = built.data.controller\n\n // Build the fetch Request once so the requestBuilt hook observes the exact bytes that are\n // sent. Rebuilding it later would generate a different multipart boundary, which breaks\n // plugins that hash the body (for example, request signing).\n const request = buildSafeBodyRequest(...built.data.requestPayload)\n\n // Execute the requestBuilt hook (plugins receive the exact fetch Request that will be sent)\n await executeHook(\n {\n request,\n requestBuilder,\n document,\n operation,\n variablesStore,\n },\n 'requestBuilt',\n plugins,\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: built.data.isUsingProxy,\n requestPayload: built.data.requestPayload,\n request,\n plugins,\n customFetch: toValue(options)?.customFetch,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n requestBuilder,\n request: buildSafeBodyRequest(...sendResult.requestPayload),\n document,\n operation,\n variablesStore,\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 requestPayload: sendResult.requestPayload,\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 requestPayload.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 requestPayload.value = sendResult.requestPayload\n\n // Persist server-set cookies into the document jar so values like a CSRF token\n // survive a page reload and get replayed on the next request, like a browser would.\n persistResponseCookies(sendResult)\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 requestPayload: sendResult.requestPayload,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n eventBus.on('copy-url:address-bar', copyAddressBarUrl)\n\n // Let plugins warm up per-operation resources (e.g. the scripts sandbox) so the first request\n // does not pay their cold-start cost.\n void executeHook({ document, operation }, 'onRequestMount', plugins)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n eventBus.off('copy-url:address-bar', copyAddressBarUrl)\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 requestPayload.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\nconst handleNavigateSettings = () => {\n eventBus.emit('ui:navigate', {\n page: 'operation',\n path: 'overview',\n operationPath: path,\n method,\n })\n}\n\n/**\n * When the path, method, or example key changes, restore the response panel\n * for the new operation from the best available source:\n *\n * 1. `responseCache` — in-memory, populated on every successful send.\n * Has the live response object (including streams) so it wins.\n * 2. `history` — persisted in the workspace store. Used as a fallback when\n * the in-memory cache is empty (page reload, fresh app session, etc.)\n * so navigating to an operation that has been called before shows the\n * last response instead of an empty panel.\n * 3. Otherwise clear.\n *\n * Only the response is restored from history — the user's request inputs are\n * left alone, so we never silently overwrite an in-progress draft.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const cached = responseCache.get(\n getOperationExampleKey(newMethod, newPath, newExampleKey),\n )\n\n if (cached) {\n response.value = cached.response\n requestPayload.value = cached.requestPayload\n } else {\n // History is keyed only by document/path/method but each entry carries\n // the example it came from, so we walk from the end and pick the most\n // recent entry that matches the active example. Otherwise a cache miss\n // on example B would restore example A's response. Only runs on a\n // cache miss — the common case (in-session navigation) skips it.\n const latest = (() => {\n for (let i = history.length - 1; i >= 0; i--) {\n const entry = history[i]\n if (entry?.meta.example === newExampleKey) {\n return entry\n }\n }\n return undefined\n })()\n\n if (latest) {\n response.value = harToFetchResponse({\n harResponse: latest.response,\n url: latest.request.url,\n method: newMethod,\n path: newPath,\n duration: latest.time,\n })\n requestPayload.value = null\n } else {\n response.value = null\n requestPayload.value = null\n }\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 :documentSlug\n :documentUrl\n :environment\n :environments\n :eventBus\n :exampleKey\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 @navigate:settings=\"handleNavigateSettings\"\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 :options=\"toValue(options)\"\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 :requestPayload\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;CAeE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6KR,MAAM,gBAAgB,eAAe,sBAAsB,QAAA,YAAY,CAAA;EAEvE,MAAM,EAAE,UAAU,WAAU;EAC5B,MAAM,EAAE,oBAAoB,cAAa;EAGzC,MAAM,kBAAkB,IAA4B,KAAI;EACxD,MAAM,WAAW,IAA6B,KAAI;EAClD,MAAM,iBAAiB,IAA2B,KAAI;;EAGtD,MAAM,sBAAsB,gBAAgB,OAAO,MAAM,OAAO,gBAAe;;;;;;;;;EAU/E,MAAM,0BAA0B,eAG1B;GACJ,MAAM,UAAU,yBAAyB;IACvC,kBAAkB,WAAW,SAAS,oBAAoB,EAAE;IAC5D,iBAAc,QAAA;IACd,YAAY,oBAAoB,OAAO,WAAW,eAAe,GAAG,CAAC;IACtE,CAAA;AAED,QAAK,MAAM,UAAU,SAAS;AAC5B,QAAI,OAAO,SAAS,UAAU;AAC5B,aAAA,SAAS,KAAK,wBAAwB;MACpC,gBAAgB;MAChB,YAAY,OAAO;MACnB,OAAO,OAAO;MACf,CAAA;AACD;;AAGF,YAAA,SAAS,KAAK,wBAAwB;KACpC,gBAAgB;KAChB,SAAS,OAAO;KAChB,GAAI,OAAO,UAAU,KAAA,IAAY,EAAE,GAAG,EAAE,OAAO,OAAO,OAAO;KAC9D,CAAA;;;;;;;EAQL,MAAM,oBAAoB,YAA2B;GACnD,MAAM,EAAE,YAAY,eAAe;IACjC,gBAAa,QAAA;IACb,aAAU,QAAA;IACV,aAAa,QAAA;IACb,eAAe,CAAC,GAAG,QAAA,kBAAkB,GAAG,QAA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tBtB,YAsBsB,MAAA,qBAAA,EAAA;MArBnB,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,SAAS,QAAQ,QAAA,QAAO;MACxB,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,gBAAA,eAAA;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 /** Openapi document */\n document: OpenApiDocument\n /** Openapi document slug */\n documentSlug: 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 /** Subset of config options for the modal */\n options?: ModalProps['options']\n}\n</script>\n<script setup lang=\"ts\">\nimport { generateClientOptions } from '@scalar/blocks/code-example'\nimport { ERRORS } from '@scalar/helpers/errors/normalize-error'\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport { buildSafeBodyRequest } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\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 createVariablesStoreForRequest,\n getEnvironmentVariables,\n requestFactory,\n resolveExecutableRequestUrl,\n type MergedSecuritySchemes,\n type RequestPayload,\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, toValue, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\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 getCookieRequestUrl,\n getResponseCookieActions,\n} from '@/v2/blocks/operation-block/helpers/persist-response-cookies'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport {\n sendRequest,\n type ResponseInstance,\n} from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n document,\n documentSlug,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n layout,\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n options,\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()\nconst { copyToClipboard } = useClipboard()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst requestPayload = ref<RequestPayload | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/**\n * Persist server-set cookies from a response into the document cookie jar.\n *\n * Scalar keeps its own cookie jar because browsers hide `Set-Cookie` from `fetch`.\n * Mirroring browser behavior, cookies are stored scoped to the request host and\n * path and removed when the server expires them, so a value like a Django CSRF\n * token stays available for later PUT/PATCH requests after a page reload.\n */\nconst persistResponseCookies = (sendResult: {\n response: ResponseInstance\n requestPayload: RequestPayload\n}) => {\n const actions = getResponseCookieActions({\n cookieHeaderKeys: sendResult.response.cookieHeaderKeys ?? [],\n documentCookies,\n requestUrl: getCookieRequestUrl(String(sendResult.requestPayload[0])),\n })\n\n for (const action of actions) {\n if (action.type === 'delete') {\n eventBus.emit('cookie:delete:cookie', {\n collectionType: 'document',\n cookieName: action.cookieName,\n index: action.index,\n })\n continue\n }\n\n eventBus.emit('cookie:upsert:cookie', {\n collectionType: 'document',\n payload: action.cookie,\n ...(action.index === undefined ? {} : { index: action.index }),\n })\n }\n}\n\n/**\n * Copy the executable URL — same pipeline as Send (`requestFactory` +\n * `resolveExecutableRequestUrl`), including security query params.\n */\nconst copyAddressBarUrl = async (): Promise<void> => {\n const { request } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies: [...workspaceCookies, ...documentCookies],\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n await copyToClipboard(\n resolveExecutableRequestUrl(request, getEnvironmentVariables(environment)),\n )\n}\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n eventBus.flushDebouncedEmits?.()\n\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 const variablesStore = createVariablesStoreForRequest()\n\n // Execute the beforeRequest hook (plugins receive RequestFactory, not fetch Request)\n await executeHook(\n {\n requestBuilder,\n document,\n operation,\n variablesStore,\n server,\n customFetch: toValue(options)?.customFetch,\n },\n 'beforeRequest',\n plugins,\n )\n\n const envVariables = {\n ...getEnvironmentVariables(environment),\n ...variablesStore.getVariables(),\n }\n\n // Build the fetch Request after hooks may have mutated the factory\n const built = buildRequest(requestBuilder, {\n envVariables,\n allowMissingRequestServerBase: layout === 'modal',\n })\n if (!built.ok) {\n toast(built.message ?? built.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = built.data.controller\n\n // Build the fetch Request once so the requestBuilt hook observes the exact bytes that are\n // sent. Rebuilding it later would generate a different multipart boundary, which breaks\n // plugins that hash the body (for example, request signing).\n const request = buildSafeBodyRequest(...built.data.requestPayload)\n\n // Execute the requestBuilt hook (plugins receive the exact fetch Request that will be sent)\n await executeHook(\n {\n request,\n requestBuilder,\n document,\n operation,\n variablesStore,\n },\n 'requestBuilt',\n plugins,\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: built.data.isUsingProxy,\n requestPayload: built.data.requestPayload,\n request,\n plugins,\n customFetch: toValue(options)?.customFetch,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n requestBuilder,\n request: buildSafeBodyRequest(...sendResult.requestPayload),\n document,\n operation,\n variablesStore,\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 requestPayload: sendResult.requestPayload,\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 requestPayload.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 requestPayload.value = sendResult.requestPayload\n\n // Persist server-set cookies into the document jar so values like a CSRF token\n // survive a page reload and get replayed on the next request, like a browser would.\n persistResponseCookies(sendResult)\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 requestPayload: sendResult.requestPayload,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n eventBus.on('copy-url:address-bar', copyAddressBarUrl)\n\n // Let plugins warm up per-operation resources (e.g. the scripts sandbox) so the first request\n // does not pay their cold-start cost.\n void executeHook({ document, operation }, 'onRequestMount', plugins)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n eventBus.off('copy-url:address-bar', copyAddressBarUrl)\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 requestPayload.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\nconst handleNavigateSettings = () => {\n eventBus.emit('ui:navigate', {\n page: 'operation',\n path: 'overview',\n operationPath: path,\n method,\n })\n}\n\n/**\n * When the path, method, or example key changes, restore the response panel\n * for the new operation from the best available source:\n *\n * 1. `responseCache` — in-memory, populated on every successful send.\n * Has the live response object (including streams) so it wins.\n * 2. `history` — persisted in the workspace store. Used as a fallback when\n * the in-memory cache is empty (page reload, fresh app session, etc.)\n * so navigating to an operation that has been called before shows the\n * last response instead of an empty panel.\n * 3. Otherwise clear.\n *\n * Only the response is restored from history — the user's request inputs are\n * left alone, so we never silently overwrite an in-progress draft.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const cached = responseCache.get(\n getOperationExampleKey(newMethod, newPath, newExampleKey),\n )\n\n if (cached) {\n response.value = cached.response\n requestPayload.value = cached.requestPayload\n } else {\n // History is keyed only by document/path/method but each entry carries\n // the example it came from, so we walk from the end and pick the most\n // recent entry that matches the active example. Otherwise a cache miss\n // on example B would restore example A's response. Only runs on a\n // cache miss — the common case (in-session navigation) skips it.\n const latest = (() => {\n for (let i = history.length - 1; i >= 0; i--) {\n const entry = history[i]\n if (entry?.meta.example === newExampleKey) {\n return entry\n }\n }\n return undefined\n })()\n\n if (latest) {\n response.value = harToFetchResponse({\n harResponse: latest.response,\n url: latest.request.url,\n method: newMethod,\n path: newPath,\n duration: latest.time,\n })\n requestPayload.value = null\n } else {\n response.value = null\n requestPayload.value = null\n }\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 :documentSlug\n :documentUrl\n :environment\n :environments\n :eventBus\n :exampleKey\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 @navigate:settings=\"handleNavigateSettings\"\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 :options=\"toValue(options)\"\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 :requestPayload\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;CAeE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6KR,MAAM,gBAAgB,eAAe,sBAAsB,QAAA,WAAW,CAAC;EAEvE,MAAM,EAAE,UAAU,UAAU;EAC5B,MAAM,EAAE,oBAAoB,aAAa;EAGzC,MAAM,kBAAkB,IAA4B,IAAI;EACxD,MAAM,WAAW,IAA6B,IAAI;EAClD,MAAM,iBAAiB,IAA2B,IAAI;;EAGtD,MAAM,sBAAsB,gBAAgB,OAAO,MAAM,OAAO,eAAe;;;;;;;;;EAU/E,MAAM,0BAA0B,eAG1B;GACJ,MAAM,UAAU,yBAAyB;IACvC,kBAAkB,WAAW,SAAS,oBAAoB,CAAC;IAC3D,iBAAc,QAAA;IACd,YAAY,oBAAoB,OAAO,WAAW,eAAe,EAAE,CAAC;GACtE,CAAC;GAED,KAAK,MAAM,UAAU,SAAS;IAC5B,IAAI,OAAO,SAAS,UAAU;KAC5B,QAAA,SAAS,KAAK,wBAAwB;MACpC,gBAAgB;MAChB,YAAY,OAAO;MACnB,OAAO,OAAO;KAChB,CAAC;KACD;IACF;IAEA,QAAA,SAAS,KAAK,wBAAwB;KACpC,gBAAgB;KAChB,SAAS,OAAO;KAChB,GAAI,OAAO,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,OAAO,MAAM;IAC9D,CAAC;GACH;EACF;;;;;EAMA,MAAM,oBAAoB,YAA2B;GACnD,MAAM,EAAE,YAAY,eAAe;IACjC,gBAAa,QAAA;IACb,aAAU,QAAA;IACV,aAAa,QAAA;IACb,eAAe,CAAC,GAAG,QAAA,kBAAkB,GAAG,QAAA,eAAe;IACvD,Q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;;;;;;;;;;;;;;;;;;SAG1B,YAqCa,oBAAA,EArCD,OAAM,WAAU,GAAA;2BAoCN,CAnCpB,YAmCoB,2BAAA,EAnCD,OAAM,SAAQ,GAAA;4BAwBT,CAtBtB,YAsBsB,MAAA,oBAAA,GAAA;MArBnB,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,SAAS,QAAQ,QAAA,OAAO;MACxB,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,qBAAA,GAAA;MANnD,YAAA,QAAA;MACA,UAAA,QAAA;MACA,QAAA,QAAA;MACA,SAAA,QAAA;MACA,gBAAA,eAAA;MACA,UAAA,SAAA;MACA,wBAAwB,iBAAA,MAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Header.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"names":[],"mappings":"AA+MA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAE/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAKrD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,UAAU,CAAA;IAClB,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oBAAoB;IACpB,MAAM,CAAC,EAAE,SAAS,GAAG,eAAe,CAAA;IACpC,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mDAAmD;IACnD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,uBAAuB;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,qCAAqC;IACrC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,4BAA4B;IAC5B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,sCAAsC;IACtC,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;wBACoB,OAAO,YAAY;AAAxC,wBAAyC;AACzC,QAAA,MAAM,YAAY;;eAc6B,MAAM;;;;;;;eAAN,MAAM;;;;;kFAuSjD,CAAC"}
1
+ {"version":3,"file":"Header.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"names":[],"mappings":"AA+MA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EACV,UAAU,EACV,i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C;AACzC,QAAA,MAAM,YAAY;;eAc6B,MAAM;;;;;;;eAAN,MAAM;;;;;kFA6SjD,CAAC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
2
2
  import Header_vue_vue_type_script_setup_true_lang_default from "./Header.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/blocks/operation-block/components/Header.vue
5
- var Header_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Header_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-42c563b3"]]);
5
+ var Header_default = /*#__PURE__*/ _plugin_vue_export_helper_default(Header_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-42c563b3"]]);
6
6
  //#endregion
7
7
  export { Header_default as default };
8
8
 
@@ -8,7 +8,7 @@ import { ScalarIconButton } from "@scalar/components/icon-button";
8
8
  //#region src/v2/blocks/operation-block/components/Header.vue?vue&type=script&setup=true&lang.ts
9
9
  var _hoisted_1 = { class: "lg:min-h-header t-app__top-container @container flex w-full flex-wrap items-center justify-center p-2" };
10
10
  var _hoisted_2 = { class: "mb-2 flex flex-1 items-center justify-end gap-2 @3xl:mb-0" };
11
- var Header_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
11
+ var Header_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
12
12
  __name: "Header",
13
13
  props: {
14
14
  path: {},
@@ -1 +1 @@
1
- {"version":3,"file":"Header.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n Operation block header: address bar, environment selector, and modal controls.\n\n Renders the top bar for the API client operation view: URL/method (AddressBar),\n optional environment selector, optional \"Open API Client\" button in modal layout,\n and close button for modal. Layout and visibility depend on `layout` and `source` props.\n */\nexport type HeaderProps = {\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethod\n /** Client layout */\n layout: ClientLayout\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document slug */\n documentSlug: string\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Currently selected server */\n server: ServerObject | null\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** List of request history */\n history: History[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** Environment variables */\n environment: XScalarEnvironment\n /** Meta information for the server */\n serverMeta: ServerMeta\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { ScalarIconGearSix } from '@scalar/icons'\nimport type {\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 { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { AddressBar, type History } from '@/v2/blocks/scalar-address-bar-block'\nimport EnvironmentSelector from '@/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport OpenApiClientButton from './OpenApiClientButton.vue'\n\nconst {\n hideClientButton = false,\n eventBus,\n exampleKey,\n documentSlug,\n} = defineProps<HeaderProps>()\n\nconst emit = defineEmits<{\n /** Execute the current operation example */\n (e: 'execute'): void\n /** Select a request history item by index */\n (e: 'select:history:item', payload: { index: number }): void\n /** Add a new environment */\n (e: 'add:environment'): void\n /** Navigate to the settings page for the current entity */\n (e: 'navigate:settings'): void\n}>()\n\nconst handleSelectEnvironment = (environmentName: string) => {\n eventBus.emit('workspace:update:active-environment', environmentName)\n}\n\nconst handleAddEnvironment = () => {\n eventBus.emit('ui:navigate', { page: 'document', path: 'environment' })\n}\n</script>\n\n<template>\n <!--\n `@container` declares an unnamed container so the AddressBar can\n adapt to the right column's actual width (which shrinks when the\n sidebar opens) instead of the viewport. The query is declared here\n on the parent rather than on the AddressBar itself so the bar's\n `w-full` mobile state cannot feed back into its own breakpoint.\n -->\n <div\n class=\"lg:min-h-header t-app__top-container @container flex w-full flex-wrap items-center justify-center p-2\">\n <!-- Left spacer to center bar -->\n <div class=\"flex flex-1\"></div>\n <AddressBar\n :activeEnvironment\n :documentSlug\n :environment\n :environments\n :eventBus\n :exampleKey\n :history\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n @add:environment=\"emit('add:environment')\"\n @execute=\"emit('execute')\"\n @select:history:item=\"\n (payload) => emit('select:history:item', payload)\n \" />\n\n <div class=\"mb-2 flex flex-1 items-center justify-end gap-2 @3xl:mb-0\">\n <!--\n Environment Selector\n Hidden for `modal` layout\n -->\n <EnvironmentSelector\n v-if=\"layout !== 'modal'\"\n :activeEnvironment=\"activeEnvironment\"\n :environments=\"environments\"\n @add:environment=\"handleAddEnvironment\"\n @select:environment=\"handleSelectEnvironment\" />\n <!-- Operation settings -->\n <ScalarIconButton\n v-if=\"layout !== 'modal'\"\n :icon=\"ScalarIconGearSix\"\n label=\"Operation settings\"\n size=\"sm\"\n weight=\"bold\"\n @click=\"emit('navigate:settings')\" />\n <!--\n Open API Client Button\n\n Only shown in `modal` layout\n -->\n <OpenApiClientButton\n v-if=\"layout === 'modal' && documentUrl && !hideClientButton\"\n buttonSource=\"modal\"\n class=\"!w-fit lg:-mr-1\"\n :integration=\"integration ?? null\"\n :operationMethod=\"method\"\n :operationPath=\"path\"\n :source=\"source ?? 'api-reference'\"\n :url=\"documentUrl\" />\n\n <!--\n Close Button\n\n Only shown in `modal` layout and hidden for GitBook Integration\n -->\n <button\n v-if=\"layout === 'modal' && source !== 'gitbook'\"\n class=\"app-exit-button zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"lg\"\n thickness=\"2\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n\n <!--\n Close Button for GitBook Integration\n\n Hidden by default and visible for GitBook Integration in `modal` layout\n -->\n <button\n v-if=\"layout === 'modal' && source === 'gitbook'\"\n class=\"text-c-1 hover:bg-b-2 active:text-c-1 -mr-1.5 rounded p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"md\"\n thickness=\"1.75\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n </div>\n </div>\n</template>\n<style scoped>\n.app-exit-button {\n color: white;\n background: rgba(0, 0, 0, 0.1);\n}\n.app-exit-button:hover {\n background: rgba(255, 255, 255, 0.1);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuEA,MAAM,OAAO;EAWb,MAAM,2BAA2B,oBAA4B;AAC3D,WAAA,SAAS,KAAK,uCAAuC,gBAAe;;EAGtE,MAAM,6BAA6B;AACjC,WAAA,SAAS,KAAK,eAAe;IAAE,MAAM;IAAY,MAAM;IAAe,CAAA;;;uBAYtE,mBA4FM,OA5FN,YA4FM;8BAzFJ,mBAA+B,OAAA,EAA1B,OAAM,eAAa,EAAA,MAAA,GAAA;IACxB,YAkBM,MAAA,mBAAA,EAAA;KAjBH,mBAAA,QAAA;KACA,cAAA,QAAA;KACA,aAAA,QAAA;KACA,cAAA,QAAA;KACA,UAAA,QAAA;KACA,YAAA,QAAA;KACA,SAAA,QAAA;KACA,QAAA,QAAA;KACA,QAAA,QAAA;KACA,MAAA,QAAA;KACA,QAAA,QAAA;KACA,YAAA,QAAA;KACA,SAAA,QAAA;KACA,qBAAe,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,kBAAA;KACrB,WAAO,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,UAAA;KACb,yBAAmB,OAA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,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"Header.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n Operation block header: address bar, environment selector, and modal controls.\n\n Renders the top bar for the API client operation view: URL/method (AddressBar),\n optional environment selector, optional \"Open API Client\" button in modal layout,\n and close button for modal. Layout and visibility depend on `layout` and `source` props.\n */\nexport type HeaderProps = {\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethod\n /** Client layout */\n layout: ClientLayout\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document slug */\n documentSlug: string\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Currently selected server */\n server: ServerObject | null\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** List of request history */\n history: History[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** Environment variables */\n environment: XScalarEnvironment\n /** Meta information for the server */\n serverMeta: ServerMeta\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { ScalarIconGearSix } from '@scalar/icons'\nimport type {\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 { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { AddressBar, type History } from '@/v2/blocks/scalar-address-bar-block'\nimport EnvironmentSelector from '@/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport OpenApiClientButton from './OpenApiClientButton.vue'\n\nconst {\n hideClientButton = false,\n eventBus,\n exampleKey,\n documentSlug,\n} = defineProps<HeaderProps>()\n\nconst emit = defineEmits<{\n /** Execute the current operation example */\n (e: 'execute'): void\n /** Select a request history item by index */\n (e: 'select:history:item', payload: { index: number }): void\n /** Add a new environment */\n (e: 'add:environment'): void\n /** Navigate to the settings page for the current entity */\n (e: 'navigate:settings'): void\n}>()\n\nconst handleSelectEnvironment = (environmentName: string) => {\n eventBus.emit('workspace:update:active-environment', environmentName)\n}\n\nconst handleAddEnvironment = () => {\n eventBus.emit('ui:navigate', { page: 'document', path: 'environment' })\n}\n</script>\n\n<template>\n <!--\n `@container` declares an unnamed container so the AddressBar can\n adapt to the right column's actual width (which shrinks when the\n sidebar opens) instead of the viewport. The query is declared here\n on the parent rather than on the AddressBar itself so the bar's\n `w-full` mobile state cannot feed back into its own breakpoint.\n -->\n <div\n class=\"lg:min-h-header t-app__top-container @container flex w-full flex-wrap items-center justify-center p-2\">\n <!-- Left spacer to center bar -->\n <div class=\"flex flex-1\"></div>\n <AddressBar\n :activeEnvironment\n :documentSlug\n :environment\n :environments\n :eventBus\n :exampleKey\n :history\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n @add:environment=\"emit('add:environment')\"\n @execute=\"emit('execute')\"\n @select:history:item=\"\n (payload) => emit('select:history:item', payload)\n \" />\n\n <div class=\"mb-2 flex flex-1 items-center justify-end gap-2 @3xl:mb-0\">\n <!--\n Environment Selector\n Hidden for `modal` layout\n -->\n <EnvironmentSelector\n v-if=\"layout !== 'modal'\"\n :activeEnvironment=\"activeEnvironment\"\n :environments=\"environments\"\n @add:environment=\"handleAddEnvironment\"\n @select:environment=\"handleSelectEnvironment\" />\n <!-- Operation settings -->\n <ScalarIconButton\n v-if=\"layout !== 'modal'\"\n :icon=\"ScalarIconGearSix\"\n label=\"Operation settings\"\n size=\"sm\"\n weight=\"bold\"\n @click=\"emit('navigate:settings')\" />\n <!--\n Open API Client Button\n\n Only shown in `modal` layout\n -->\n <OpenApiClientButton\n v-if=\"layout === 'modal' && documentUrl && !hideClientButton\"\n buttonSource=\"modal\"\n class=\"!w-fit lg:-mr-1\"\n :integration=\"integration ?? null\"\n :operationMethod=\"method\"\n :operationPath=\"path\"\n :source=\"source ?? 'api-reference'\"\n :url=\"documentUrl\" />\n\n <!--\n Close Button\n\n Only shown in `modal` layout and hidden for GitBook Integration\n -->\n <button\n v-if=\"layout === 'modal' && source !== 'gitbook'\"\n class=\"app-exit-button zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"lg\"\n thickness=\"2\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n\n <!--\n Close Button for GitBook Integration\n\n Hidden by default and visible for GitBook Integration in `modal` layout\n -->\n <button\n v-if=\"layout === 'modal' && source === 'gitbook'\"\n class=\"text-c-1 hover:bg-b-2 active:text-c-1 -mr-1.5 rounded p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"md\"\n thickness=\"1.75\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n </div>\n </div>\n</template>\n<style scoped>\n.app-exit-button {\n color: white;\n background: rgba(0, 0, 0, 0.1);\n}\n.app-exit-button:hover {\n background: rgba(255, 255, 255, 0.1);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuEA,MAAM,OAAO;EAWb,MAAM,2BAA2B,oBAA4B;GAC3D,QAAA,SAAS,KAAK,uCAAuC,eAAe;EACtE;EAEA,MAAM,6BAA6B;GACjC,QAAA,SAAS,KAAK,eAAe;IAAE,MAAM;IAAY,MAAM;GAAc,CAAC;EACxE;;uBAWE,mBA4FM,OA5FN,YA4FM;8BAzFJ,mBAA+B,OAAA,EAA1B,OAAM,cAAa,GAAA,MAAA,EAAA;IAC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AA,EAAnC,OAAM,UAAS,GAAC,gBAAY,EAAA,EAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;KAS5B,QAAA,WAAM,WAAgB,QAAA,WAAM,aAAA,UAAA,GADpC,mBAUS,UAAA;;MARP,OAAM;MACN,MAAK;MACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,SAAS,KAAI,uBAAA;SACrB,YAGqB,MAAA,UAAA,GAAA;MAFnB,MAAK;MACL,MAAK;MACL,WAAU;mCACZ,mBAAyC,QAAA,EAAnC,OAAM,UAAS,GAAC,gBAAY,EAAA,EAAA,CAAA,KAAA,mBAAA,IAAA,IAAA"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
2
2
  import OpenApiClientButton_vue_vue_type_script_setup_true_lang_default from "./OpenApiClientButton.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/blocks/operation-block/components/OpenApiClientButton.vue
5
- var OpenApiClientButton_default = /* @__PURE__ */ _plugin_vue_export_helper_default(OpenApiClientButton_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-cd067f84"]]);
5
+ var OpenApiClientButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(OpenApiClientButton_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-cd067f84"]]);
6
6
  //#endregion
7
7
  export { OpenApiClientButton_default as default };
8
8
 
@@ -3,7 +3,7 @@ import { ScalarIconArrowUpRight } from "@scalar/icons";
3
3
  import { makeUrlAbsolute } from "@scalar/helpers/url/make-url-absolute";
4
4
  //#region src/v2/blocks/operation-block/components/OpenApiClientButton.vue?vue&type=script&setup=true&lang.ts
5
5
  var _hoisted_1 = ["href"];
6
- var OpenApiClientButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
6
+ var OpenApiClientButton_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
7
7
  __name: "OpenApiClientButton",
8
8
  props: {
9
9
  buttonSource: {},
@@ -1 +1 @@
1
- {"version":3,"file":"OpenApiClientButton.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/components/OpenApiClientButton.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { makeUrlAbsolute } from '@scalar/helpers/url/make-url-absolute'\nimport { ScalarIconArrowUpRight } from '@scalar/icons'\nimport { computed } from 'vue'\n\nconst {\n integration,\n isDevelopment,\n url,\n operationPath,\n operationMethod,\n buttonSource,\n source = 'api-reference',\n} = defineProps<{\n buttonSource: 'sidebar' | 'modal'\n source?: 'api-reference' | 'gitbook'\n isDevelopment?: boolean\n integration?: string | null\n url?: string\n /** Operation path to open in the client after import */\n operationPath?: string\n /** HTTP method for the operation to open in the client after import */\n operationMethod?: string\n}>()\n\n/** Link to import an OpenAPI document */\nconst href = computed((): string | undefined => {\n /**\n * The URL we want to pass to client.scalar.com for the import.\n * Might be an OpenAPI document URL, but could also just be the URL of the API reference.\n */\n const urlToImportFrom =\n url ?? (typeof window !== 'undefined' ? window.location.href : undefined)\n\n if (!urlToImportFrom) {\n return undefined\n }\n\n const absoluteUrl = makeUrlAbsolute(urlToImportFrom)\n\n if (!absoluteUrl?.length) {\n return undefined\n }\n\n // Base URL\n const link = new URL(\n isDevelopment ? 'http://localhost:5065' : 'https://client.scalar.com',\n )\n\n // URL that we'd like to import\n link.searchParams.set('url', absoluteUrl)\n\n if (operationPath?.length && operationMethod?.length) {\n link.searchParams.set('operation_path', operationPath)\n link.searchParams.set('operation_method', operationMethod.toLowerCase())\n }\n\n // Integration identifier\n if (integration !== null) {\n link.searchParams.set('integration', integration ?? 'vue')\n }\n\n // UTM Source\n link.searchParams.set('utm_source', 'api-reference')\n link.searchParams.set('utm_medium', 'button')\n link.searchParams.set('utm_campaign', buttonSource)\n\n // Special for gitbook, set the source and grab the logos (hacky)\n if (source === 'gitbook') {\n link.searchParams.set('utm_source', 'gitbook')\n\n const darkLogo = document.querySelector(\"img.dark\\\\:block[alt='Logo']\")\n const lightLogo = document.querySelector(\"img.dark\\\\:hidden[alt='Logo']\")\n\n if (darkLogo && darkLogo instanceof HTMLImageElement) {\n link.searchParams.set('dark_logo', encodeURIComponent(darkLogo.src))\n }\n if (lightLogo && lightLogo instanceof HTMLImageElement) {\n link.searchParams.set('light_logo', encodeURIComponent(lightLogo.src))\n }\n }\n\n return link.toString()\n})\n</script>\n\n<template>\n <a\n v-if=\"href\"\n class=\"open-api-client-button\"\n :href=\"href\"\n target=\"_blank\">\n <ScalarIconArrowUpRight\n class=\"size-3\"\n weight=\"regular\" />\n Open API Client\n </a>\n</template>\n\n<style scoped>\n.open-api-client-button {\n cursor: pointer;\n width: 100%;\n padding: 9px 12px;\n height: 31px;\n display: block;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n white-space: nowrap;\n font-size: var(--scalar-small);\n line-height: 1.385;\n text-decoration: none;\n border-radius: var(--scalar-radius);\n box-shadow: 0 0 0 0.5px var(--scalar-border-color);\n gap: 6px;\n color: var(--scalar-sidebar-color-1);\n}\n\n.open-api-client-button:hover {\n background: var(\n --scalar-sidebar-item-hover-background,\n var(--scalar-background-2)\n );\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;EA0BA,MAAM,OAAO,eAAmC;;;;;GAK9C,MAAM,kBACJ,QAAA,QAAQ,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO,KAAA;AAEjE,OAAI,CAAC,gBACH;GAGF,MAAM,cAAc,gBAAgB,gBAAe;AAEnD,OAAI,CAAC,aAAa,OAChB;GAIF,MAAM,OAAO,IAAI,IACf,QAAA,gBAAgB,0BAA0B,4BAC5C;AAGA,QAAK,aAAa,IAAI,OAAO,YAAW;AAExC,OAAI,QAAA,eAAe,UAAU,QAAA,iBAAiB,QAAQ;AACpD,SAAK,aAAa,IAAI,kBAAkB,QAAA,cAAa;AACrD,SAAK,aAAa,IAAI,oBAAoB,QAAA,gBAAgB,aAAa,CAAA;;AAIzE,OAAI,QAAA,gBAAgB,KAClB,MAAK,aAAa,IAAI,eAAe,QAAA,eAAe,MAAK;AAI3D,QAAK,aAAa,IAAI,cAAc,gBAAe;AACnD,QAAK,aAAa,IAAI,cAAc,SAAQ;AAC5C,QAAK,aAAa,IAAI,gBAAgB,QAAA,aAAY;AAGlD,OAAI,QAAA,WAAW,WAAW;AACxB,SAAK,aAAa,IAAI,cAAc,UAAS;IAE7C,MAAM,WAAW,SAAS,cAAc,+BAA8B;IACtE,MAAM,YAAY,SAAS,cAAc,gCAA+B;AAExE,QAAI,YAAY,oBAAoB,iBAClC,MAAK,aAAa,IAAI,aAAa,mBAAmB,SAAS,IAAI,CAAA;AAErE,QAAI,aAAa,qBAAqB,iBACpC,MAAK,aAAa,IAAI,cAAc,mBAAmB,UAAU,IAAI,CAAA;;AAIzE,UAAO,KAAK,UAAS;IACtB;;UAKS,KAAA,SAAA,WAAA,EADR,mBASI,KAAA;;IAPF,OAAM;IACL,MAAM,KAAA;IACP,QAAO;OACP,YAEqB,MAAA,uBAAA,EAAA;IADnB,OAAM;IACN,QAAO;iDAAY,qBAEvB,GAAA,EAAA,EAAA,GAAA,WAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"OpenApiClientButton.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/components/OpenApiClientButton.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { makeUrlAbsolute } from '@scalar/helpers/url/make-url-absolute'\nimport { ScalarIconArrowUpRight } from '@scalar/icons'\nimport { computed } from 'vue'\n\nconst {\n integration,\n isDevelopment,\n url,\n operationPath,\n operationMethod,\n buttonSource,\n source = 'api-reference',\n} = defineProps<{\n buttonSource: 'sidebar' | 'modal'\n source?: 'api-reference' | 'gitbook'\n isDevelopment?: boolean\n integration?: string | null\n url?: string\n /** Operation path to open in the client after import */\n operationPath?: string\n /** HTTP method for the operation to open in the client after import */\n operationMethod?: string\n}>()\n\n/** Link to import an OpenAPI document */\nconst href = computed((): string | undefined => {\n /**\n * The URL we want to pass to client.scalar.com for the import.\n * Might be an OpenAPI document URL, but could also just be the URL of the API reference.\n */\n const urlToImportFrom =\n url ?? (typeof window !== 'undefined' ? window.location.href : undefined)\n\n if (!urlToImportFrom) {\n return undefined\n }\n\n const absoluteUrl = makeUrlAbsolute(urlToImportFrom)\n\n if (!absoluteUrl?.length) {\n return undefined\n }\n\n // Base URL\n const link = new URL(\n isDevelopment ? 'http://localhost:5065' : 'https://client.scalar.com',\n )\n\n // URL that we'd like to import\n link.searchParams.set('url', absoluteUrl)\n\n if (operationPath?.length && operationMethod?.length) {\n link.searchParams.set('operation_path', operationPath)\n link.searchParams.set('operation_method', operationMethod.toLowerCase())\n }\n\n // Integration identifier\n if (integration !== null) {\n link.searchParams.set('integration', integration ?? 'vue')\n }\n\n // UTM Source\n link.searchParams.set('utm_source', 'api-reference')\n link.searchParams.set('utm_medium', 'button')\n link.searchParams.set('utm_campaign', buttonSource)\n\n // Special for gitbook, set the source and grab the logos (hacky)\n if (source === 'gitbook') {\n link.searchParams.set('utm_source', 'gitbook')\n\n const darkLogo = document.querySelector(\"img.dark\\\\:block[alt='Logo']\")\n const lightLogo = document.querySelector(\"img.dark\\\\:hidden[alt='Logo']\")\n\n if (darkLogo && darkLogo instanceof HTMLImageElement) {\n link.searchParams.set('dark_logo', encodeURIComponent(darkLogo.src))\n }\n if (lightLogo && lightLogo instanceof HTMLImageElement) {\n link.searchParams.set('light_logo', encodeURIComponent(lightLogo.src))\n }\n }\n\n return link.toString()\n})\n</script>\n\n<template>\n <a\n v-if=\"href\"\n class=\"open-api-client-button\"\n :href=\"href\"\n target=\"_blank\">\n <ScalarIconArrowUpRight\n class=\"size-3\"\n weight=\"regular\" />\n Open API Client\n </a>\n</template>\n\n<style scoped>\n.open-api-client-button {\n cursor: pointer;\n width: 100%;\n padding: 9px 12px;\n height: 31px;\n display: block;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n white-space: nowrap;\n font-size: var(--scalar-small);\n line-height: 1.385;\n text-decoration: none;\n border-radius: var(--scalar-radius);\n box-shadow: 0 0 0 0.5px var(--scalar-border-color);\n gap: 6px;\n color: var(--scalar-sidebar-color-1);\n}\n\n.open-api-client-button:hover {\n background: var(\n --scalar-sidebar-item-hover-background,\n var(--scalar-background-2)\n );\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;EA0BA,MAAM,OAAO,eAAmC;;;;;GAK9C,MAAM,kBACJ,QAAA,QAAQ,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO,KAAA;GAEjE,IAAI,CAAC,iBACH;GAGF,MAAM,cAAc,gBAAgB,eAAe;GAEnD,IAAI,CAAC,aAAa,QAChB;GAIF,MAAM,OAAO,IAAI,IACf,QAAA,gBAAgB,0BAA0B,2BAC5C;GAGA,KAAK,aAAa,IAAI,OAAO,WAAW;GAExC,IAAI,QAAA,eAAe,UAAU,QAAA,iBAAiB,QAAQ;IACpD,KAAK,aAAa,IAAI,kBAAkB,QAAA,aAAa;IACrD,KAAK,aAAa,IAAI,oBAAoB,QAAA,gBAAgB,YAAY,CAAC;GACzE;GAGA,IAAI,QAAA,gBAAgB,MAClB,KAAK,aAAa,IAAI,eAAe,QAAA,eAAe,KAAK;GAI3D,KAAK,aAAa,IAAI,cAAc,eAAe;GACnD,KAAK,aAAa,IAAI,cAAc,QAAQ;GAC5C,KAAK,aAAa,IAAI,gBAAgB,QAAA,YAAY;GAGlD,IAAI,QAAA,WAAW,WAAW;IACxB,KAAK,aAAa,IAAI,cAAc,SAAS;IAE7C,MAAM,WAAW,SAAS,cAAc,8BAA8B;IACtE,MAAM,YAAY,SAAS,cAAc,+BAA+B;IAExE,IAAI,YAAY,oBAAoB,kBAClC,KAAK,aAAa,IAAI,aAAa,mBAAmB,SAAS,GAAG,CAAC;IAErE,IAAI,aAAa,qBAAqB,kBACpC,KAAK,aAAa,IAAI,cAAc,mBAAmB,UAAU,GAAG,CAAC;GAEzE;GAEA,OAAO,KAAK,SAAS;EACvB,CAAC;;UAKS,KAAA,SAAA,UAAA,GADR,mBASI,KAAA;;IAPF,OAAM;IACL,MAAM,KAAA;IACP,QAAO;OACP,YAEqB,MAAA,sBAAA,GAAA;IADnB,OAAM;IACN,QAAO;iDAAY,qBAEvB,EAAA,EAAA,GAAA,GAAA,UAAA,KAAA,mBAAA,IAAA,IAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"decode-buffer.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/decode-buffer.ts"],"sourcesContent":["import { parseMimeType } from '@scalar/helpers/http/mime-type'\nimport type { ResponseBodyHandler } from '@scalar/oas-utils/helpers'\n\nimport { isTextMediaType } from '@/v2/blocks/response-block/helpers/media-types'\n\n/**\n * Decode the buffer according to its content-type.\n * When a plugin handler with a custom `decode` function is provided, it takes priority\n * over the default text/binary decoding.\n *\n * @returns The decoded string or Blob\n */\nexport const decodeBuffer = async (\n buffer: ArrayBuffer,\n contentType: string,\n pluginHandler?: ResponseBodyHandler,\n): Promise<string | Blob> => {\n const mimeType = parseMimeType(contentType)\n\n if (pluginHandler?.decode) {\n return await pluginHandler.decode(buffer, contentType)\n }\n\n // Text\n if (isTextMediaType(mimeType.essence)) {\n const decoder = new TextDecoder(mimeType.parameters.get('charset'))\n return decoder.decode(buffer)\n }\n\n // Binary\n return new Blob([buffer], { type: mimeType.essence })\n}\n"],"mappings":";;;;;;;;;;AAYA,IAAa,eAAe,OAC1B,QACA,aACA,kBAC2B;CAC3B,MAAM,WAAW,cAAc,YAAY;AAE3C,KAAI,eAAe,OACjB,QAAO,MAAM,cAAc,OAAO,QAAQ,YAAY;AAIxD,KAAI,gBAAgB,SAAS,QAAQ,CAEnC,QADgB,IAAI,YAAY,SAAS,WAAW,IAAI,UAAU,CAAC,CACpD,OAAO,OAAO;AAI/B,QAAO,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,MAAM,SAAS,SAAS,CAAC"}
1
+ {"version":3,"file":"decode-buffer.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/decode-buffer.ts"],"sourcesContent":["import { parseMimeType } from '@scalar/helpers/http/mime-type'\nimport type { ResponseBodyHandler } from '@scalar/oas-utils/helpers'\n\nimport { isTextMediaType } from '@/v2/blocks/response-block/helpers/media-types'\n\n/**\n * Decode the buffer according to its content-type.\n * When a plugin handler with a custom `decode` function is provided, it takes priority\n * over the default text/binary decoding.\n *\n * @returns The decoded string or Blob\n */\nexport const decodeBuffer = async (\n buffer: ArrayBuffer,\n contentType: string,\n pluginHandler?: ResponseBodyHandler,\n): Promise<string | Blob> => {\n const mimeType = parseMimeType(contentType)\n\n if (pluginHandler?.decode) {\n return await pluginHandler.decode(buffer, contentType)\n }\n\n // Text\n if (isTextMediaType(mimeType.essence)) {\n const decoder = new TextDecoder(mimeType.parameters.get('charset'))\n return decoder.decode(buffer)\n }\n\n // Binary\n return new Blob([buffer], { type: mimeType.essence })\n}\n"],"mappings":";;;;;;;;;;AAYA,IAAa,eAAe,OAC1B,QACA,aACA,kBAC2B;CAC3B,MAAM,WAAW,cAAc,WAAW;CAE1C,IAAI,eAAe,QACjB,OAAO,MAAM,cAAc,OAAO,QAAQ,WAAW;CAIvD,IAAI,gBAAgB,SAAS,OAAO,GAElC,OAAO,IADa,YAAY,SAAS,WAAW,IAAI,SAAS,CAC1D,CAAA,CAAQ,OAAO,MAAM;CAI9B,OAAO,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,MAAM,SAAS,QAAQ,CAAC;AACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-cookie-header-keys.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/get-cookie-header-keys.ts"],"sourcesContent":["/**\n * Safely extract cookie header keys from response headers.\n * Modern browsers support getSetCookie() which returns an array of Set-Cookie values.\n *\n * Note: Set-Cookie headers are often hidden from JavaScript due to security restrictions.\n * The browser's network tab may show Set-Cookie headers that are not accessible via the\n * Fetch API Headers object. This is intentional browser behavior to prevent JavaScript\n * from accessing HttpOnly cookies and other sensitive cookie data.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Headers/getSetCookie\n *\n * @param headers - The response headers object\n * @returns Array of cookie header keys or empty array if not supported or restricted\n */\nexport const getCookieHeaderKeys = (headers: Headers): string[] => {\n return 'getSetCookie' in headers && typeof headers.getSetCookie === 'function' ? headers.getSetCookie() : []\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAa,uBAAuB,YAA+B;AACjE,QAAO,kBAAkB,WAAW,OAAO,QAAQ,iBAAiB,aAAa,QAAQ,cAAc,GAAG,EAAE"}
1
+ {"version":3,"file":"get-cookie-header-keys.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/get-cookie-header-keys.ts"],"sourcesContent":["/**\n * Safely extract cookie header keys from response headers.\n * Modern browsers support getSetCookie() which returns an array of Set-Cookie values.\n *\n * Note: Set-Cookie headers are often hidden from JavaScript due to security restrictions.\n * The browser's network tab may show Set-Cookie headers that are not accessible via the\n * Fetch API Headers object. This is intentional browser behavior to prevent JavaScript\n * from accessing HttpOnly cookies and other sensitive cookie data.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Headers/getSetCookie\n *\n * @param headers - The response headers object\n * @returns Array of cookie header keys or empty array if not supported or restricted\n */\nexport const getCookieHeaderKeys = (headers: Headers): string[] => {\n return 'getSetCookie' in headers && typeof headers.getSetCookie === 'function' ? headers.getSetCookie() : []\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAa,uBAAuB,YAA+B;CACjE,OAAO,kBAAkB,WAAW,OAAO,QAAQ,iBAAiB,aAAa,QAAQ,aAAa,IAAI,CAAC;AAC7G"}
@@ -1 +1 @@
1
- {"version":3,"file":"har-to-fetch-request.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/har-to-fetch-request.ts"],"sourcesContent":["import type { HarRequest } from '@scalar/snippetz'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\n\ntype HarToFetchRequestProps = {\n /** The HAR Request object to convert */\n harRequest: HarRequest\n}\n\n/**\n * Converts a HAR (HTTP Archive) Request to a RequestPayload [url, RequestInit] tuple for use with fetch().\n *\n * This function is the reverse of fetchRequestToHar - it takes a HAR request\n * and converts it into a [url, RequestInit] tuple that maps directly to the fetch() argument list.\n *\n * The conversion handles:\n * - Request method and URL reconstruction\n * - Headers reconstruction from HAR headers array\n * - Cookies conversion to Cookie header\n * - Form data (params) conversion to FormData or URLSearchParams\n * - Body decoding\n * - Content-Type and other header restoration\n * - Query parameters (already embedded in the URL)\n *\n * Use cases:\n * - Replaying recorded HTTP requests\n * - Creating mock requests from HAR files\n * - Testing with fixtures\n * - Request caching and restoration\n * - Re-executing historical API calls\n *\n * Note: Query parameters are expected to be already part of the URL in the HAR.\n *\n * @see https://w3c.github.io/web-performance/specs/HAR/Overview.html\n * @see https://developer.mozilla.org/en-US/docs/Web/API/fetch\n *\n * @example\n * const harRequest = { method: 'POST', url: 'https://api.example.com', ... }\n * const [url, init] = harToFetchRequest({ harRequest })\n * const response = await fetch(url, init)\n */\nexport const harToFetchRequest = ({ harRequest }: HarToFetchRequestProps): RequestPayload => {\n const headers = buildHeaders(harRequest)\n const body = buildBody(harRequest.postData)\n\n return [\n harRequest.url,\n {\n method: harRequest.method,\n headers,\n body,\n },\n ]\n}\n\n/**\n * Builds Headers object from HAR request headers and cookies.\n */\nconst buildHeaders = (harRequest: HarRequest): Headers => {\n const headers = new Headers()\n\n // Add all headers from HAR\n harRequest.headers.forEach(({ name, value }) => {\n headers.append(name, value)\n })\n\n // Convert cookies to Cookie header\n if (harRequest.cookies?.length) {\n const cookieString = harRequest.cookies.map(({ name, value }) => `${name}=${value}`).join('; ')\n headers.append('Cookie', cookieString)\n }\n\n return headers\n}\n\n/**\n * Builds request body from HAR postData.\n * Returns FormData for multipart forms, URLSearchParams for URL-encoded forms,\n * or encoded text for other content types.\n */\nconst buildBody = (postData: HarRequest['postData']): BodyInit | null => {\n if (!postData) {\n return null\n }\n\n const { params, text, mimeType } = postData\n\n // Handle form data parameters\n if (params?.length) {\n const isMultipart = mimeType?.includes('multipart/form-data')\n const form = isMultipart ? new FormData() : new URLSearchParams()\n\n params.forEach(({ name, value }) => {\n form.append(name, value || '')\n })\n\n return form\n }\n\n // Handle text body\n if (text) {\n return new TextEncoder().encode(text)\n }\n\n return null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,qBAAqB,EAAE,iBAAyD;CAC3F,MAAM,UAAU,aAAa,WAAW;CACxC,MAAM,OAAO,UAAU,WAAW,SAAS;AAE3C,QAAO,CACL,WAAW,KACX;EACE,QAAQ,WAAW;EACnB;EACA;EACD,CACF;;;;;AAMH,IAAM,gBAAgB,eAAoC;CACxD,MAAM,UAAU,IAAI,SAAS;AAG7B,YAAW,QAAQ,SAAS,EAAE,MAAM,YAAY;AAC9C,UAAQ,OAAO,MAAM,MAAM;GAC3B;AAGF,KAAI,WAAW,SAAS,QAAQ;EAC9B,MAAM,eAAe,WAAW,QAAQ,KAAK,EAAE,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,CAAC,KAAK,KAAK;AAC/F,UAAQ,OAAO,UAAU,aAAa;;AAGxC,QAAO;;;;;;;AAQT,IAAM,aAAa,aAAsD;AACvE,KAAI,CAAC,SACH,QAAO;CAGT,MAAM,EAAE,QAAQ,MAAM,aAAa;AAGnC,KAAI,QAAQ,QAAQ;EAElB,MAAM,OADc,UAAU,SAAS,sBAAsB,GAClC,IAAI,UAAU,GAAG,IAAI,iBAAiB;AAEjE,SAAO,SAAS,EAAE,MAAM,YAAY;AAClC,QAAK,OAAO,MAAM,SAAS,GAAG;IAC9B;AAEF,SAAO;;AAIT,KAAI,KACF,QAAO,IAAI,aAAa,CAAC,OAAO,KAAK;AAGvC,QAAO"}
1
+ {"version":3,"file":"har-to-fetch-request.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/har-to-fetch-request.ts"],"sourcesContent":["import type { HarRequest } from '@scalar/snippetz'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\n\ntype HarToFetchRequestProps = {\n /** The HAR Request object to convert */\n harRequest: HarRequest\n}\n\n/**\n * Converts a HAR (HTTP Archive) Request to a RequestPayload [url, RequestInit] tuple for use with fetch().\n *\n * This function is the reverse of fetchRequestToHar - it takes a HAR request\n * and converts it into a [url, RequestInit] tuple that maps directly to the fetch() argument list.\n *\n * The conversion handles:\n * - Request method and URL reconstruction\n * - Headers reconstruction from HAR headers array\n * - Cookies conversion to Cookie header\n * - Form data (params) conversion to FormData or URLSearchParams\n * - Body decoding\n * - Content-Type and other header restoration\n * - Query parameters (already embedded in the URL)\n *\n * Use cases:\n * - Replaying recorded HTTP requests\n * - Creating mock requests from HAR files\n * - Testing with fixtures\n * - Request caching and restoration\n * - Re-executing historical API calls\n *\n * Note: Query parameters are expected to be already part of the URL in the HAR.\n *\n * @see https://w3c.github.io/web-performance/specs/HAR/Overview.html\n * @see https://developer.mozilla.org/en-US/docs/Web/API/fetch\n *\n * @example\n * const harRequest = { method: 'POST', url: 'https://api.example.com', ... }\n * const [url, init] = harToFetchRequest({ harRequest })\n * const response = await fetch(url, init)\n */\nexport const harToFetchRequest = ({ harRequest }: HarToFetchRequestProps): RequestPayload => {\n const headers = buildHeaders(harRequest)\n const body = buildBody(harRequest.postData)\n\n return [\n harRequest.url,\n {\n method: harRequest.method,\n headers,\n body,\n },\n ]\n}\n\n/**\n * Builds Headers object from HAR request headers and cookies.\n */\nconst buildHeaders = (harRequest: HarRequest): Headers => {\n const headers = new Headers()\n\n // Add all headers from HAR\n harRequest.headers.forEach(({ name, value }) => {\n headers.append(name, value)\n })\n\n // Convert cookies to Cookie header\n if (harRequest.cookies?.length) {\n const cookieString = harRequest.cookies.map(({ name, value }) => `${name}=${value}`).join('; ')\n headers.append('Cookie', cookieString)\n }\n\n return headers\n}\n\n/**\n * Builds request body from HAR postData.\n * Returns FormData for multipart forms, URLSearchParams for URL-encoded forms,\n * or encoded text for other content types.\n */\nconst buildBody = (postData: HarRequest['postData']): BodyInit | null => {\n if (!postData) {\n return null\n }\n\n const { params, text, mimeType } = postData\n\n // Handle form data parameters\n if (params?.length) {\n const isMultipart = mimeType?.includes('multipart/form-data')\n const form = isMultipart ? new FormData() : new URLSearchParams()\n\n params.forEach(({ name, value }) => {\n form.append(name, value || '')\n })\n\n return form\n }\n\n // Handle text body\n if (text) {\n return new TextEncoder().encode(text)\n }\n\n return null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,qBAAqB,EAAE,iBAAyD;CAC3F,MAAM,UAAU,aAAa,UAAU;CACvC,MAAM,OAAO,UAAU,WAAW,QAAQ;CAE1C,OAAO,CACL,WAAW,KACX;EACE,QAAQ,WAAW;EACnB;EACA;CACF,CACF;AACF;;;;AAKA,IAAM,gBAAgB,eAAoC;CACxD,MAAM,UAAU,IAAI,QAAQ;CAG5B,WAAW,QAAQ,SAAS,EAAE,MAAM,YAAY;EAC9C,QAAQ,OAAO,MAAM,KAAK;CAC5B,CAAC;CAGD,IAAI,WAAW,SAAS,QAAQ;EAC9B,MAAM,eAAe,WAAW,QAAQ,KAAK,EAAE,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,CAAC,CAAC,KAAK,IAAI;EAC9F,QAAQ,OAAO,UAAU,YAAY;CACvC;CAEA,OAAO;AACT;;;;;;AAOA,IAAM,aAAa,aAAsD;CACvE,IAAI,CAAC,UACH,OAAO;CAGT,MAAM,EAAE,QAAQ,MAAM,aAAa;CAGnC,IAAI,QAAQ,QAAQ;EAElB,MAAM,OADc,UAAU,SAAS,qBAAqB,IACjC,IAAI,SAAS,IAAI,IAAI,gBAAgB;EAEhE,OAAO,SAAS,EAAE,MAAM,YAAY;GAClC,KAAK,OAAO,MAAM,SAAS,EAAE;EAC/B,CAAC;EAED,OAAO;CACT;CAGA,IAAI,MACF,OAAO,IAAI,YAAY,CAAC,CAAC,OAAO,IAAI;CAGtC,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"har-to-fetch-response.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/har-to-fetch-response.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { HarResponse } from '@scalar/snippetz'\n\nimport { getCookieHeaderKeys } from '@/v2/blocks/operation-block/helpers/get-cookie-header-keys'\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\n\ntype HarToFetchResponseProps = {\n /** The HAR Response object to convert */\n harResponse: HarResponse\n /** Optional URL to set on the Response object */\n url?: string\n /** The HTTP method used for the request */\n method: HttpMethod\n /** The request path */\n path: string\n /** Time in ms the request took */\n duration?: number\n}\n\ntype ProcessedBody = {\n /** ArrayBuffer for Response body */\n body: ArrayBuffer | null\n /** Data for ResponseInstance (string or Blob) */\n data: string | Blob\n /** Size in bytes */\n size: number\n}\n\n/**\n * Converts a HAR (HTTP Archive) Response back to a ResponseInstance object.\n *\n * This function is the reverse of fetchResponseToHar - it takes a HAR response\n * and converts it back into a ResponseInstance object that includes both the\n * standard Fetch API Response properties and additional metadata.\n *\n * The conversion handles:\n * - Status code and status text restoration\n * - Headers reconstruction from HAR headers array\n * - Body decoding\n * - Content-Type and other header restoration\n * - URL property setting (if provided)\n * - Cookie header detection\n * - Duration tracking\n * - Response size calculation in bytes\n *\n * Body Handling:\n * - Plain text (no encoding): Text-based responses under 1MB from fetchResponseToHar\n * - Base64 encoded: Binary or legacy data (note: new HAR files won't contain binary data)\n * - Empty: Streaming responses, large responses (>1MB), or responses without bodies\n *\n * Use cases:\n * - Replaying recorded HTTP responses\n * - Creating mock responses from HAR files\n * - Testing with fixtures\n * - Response caching and restoration\n *\n * Note: The Fetch API Response object does not support setting the HTTP version,\n * so that information from the HAR is not preserved in the returned Response.\n * The URL property is set using Object.defineProperty since it is read-only\n * in the standard Response constructor.\n *\n * @see https://w3c.github.io/web-performance/specs/HAR/Overview.html\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Response\n *\n * @example\n * const harResponse = { status: 200, statusText: 'OK', ... }\n * const response = harToFetchResponse({\n * harResponse,\n * url: 'https://api.example.com',\n * method: 'GET',\n * path: '/users',\n * duration: 250\n * })\n * console.log(response.url) // 'https://api.example.com'\n * console.log(response.duration) // 250\n */\nexport const harToFetchResponse = ({\n harResponse,\n url = '',\n method,\n path,\n duration = 0,\n}: HarToFetchResponseProps): ResponseInstance => {\n const headers = buildHeaders(harResponse)\n const { body, data, size } = processBody(harResponse)\n const cookieHeaderKeys = getCookieHeaderKeys(headers)\n\n const response = new Response(body, {\n status: harResponse.status,\n statusText: harResponse.statusText,\n headers,\n })\n\n return {\n ...response,\n headers: Object.fromEntries(headers.entries()),\n cookieHeaderKeys,\n duration,\n status: harResponse.status,\n statusText: harResponse.statusText,\n method,\n path,\n data,\n size,\n url,\n }\n}\n\n/**\n * Builds Headers object and record from HAR response headers.\n */\nconst buildHeaders = (harResponse: HarResponse) => {\n const headers = new Headers()\n\n harResponse.headers.forEach(({ name, value }) => {\n headers.append(name, value)\n })\n\n return headers\n}\n\n/**\n * Processes HAR response body content.\n * Returns body, data and size for ResponseInstance.\n */\nconst processBody = (harResponse: HarResponse): ProcessedBody => {\n if (!harResponse.content.text) {\n return { body: null, data: '', size: 0 }\n }\n\n const { text, encoding } = harResponse.content\n\n if (encoding) {\n return { body: null, data: text, size: text.length }\n }\n\n const body = new TextEncoder().encode(text).buffer\n\n return { body, data: text, size: body.byteLength }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,IAAa,sBAAsB,EACjC,aACA,MAAM,IACN,QACA,MACA,WAAW,QACoC;CAC/C,MAAM,UAAU,aAAa,YAAY;CACzC,MAAM,EAAE,MAAM,MAAM,SAAS,YAAY,YAAY;CACrD,MAAM,mBAAmB,oBAAoB,QAAQ;AAQrD,QAAO;EACL,GAPe,IAAI,SAAS,MAAM;GAClC,QAAQ,YAAY;GACpB,YAAY,YAAY;GACxB;GACD,CAAC;EAIA,SAAS,OAAO,YAAY,QAAQ,SAAS,CAAC;EAC9C;EACA;EACA,QAAQ,YAAY;EACpB,YAAY,YAAY;EACxB;EACA;EACA;EACA;EACA;EACD;;;;;AAMH,IAAM,gBAAgB,gBAA6B;CACjD,MAAM,UAAU,IAAI,SAAS;AAE7B,aAAY,QAAQ,SAAS,EAAE,MAAM,YAAY;AAC/C,UAAQ,OAAO,MAAM,MAAM;GAC3B;AAEF,QAAO;;;;;;AAOT,IAAM,eAAe,gBAA4C;AAC/D,KAAI,CAAC,YAAY,QAAQ,KACvB,QAAO;EAAE,MAAM;EAAM,MAAM;EAAI,MAAM;EAAG;CAG1C,MAAM,EAAE,MAAM,aAAa,YAAY;AAEvC,KAAI,SACF,QAAO;EAAE,MAAM;EAAM,MAAM;EAAM,MAAM,KAAK;EAAQ;CAGtD,MAAM,OAAO,IAAI,aAAa,CAAC,OAAO,KAAK,CAAC;AAE5C,QAAO;EAAE;EAAM,MAAM;EAAM,MAAM,KAAK;EAAY"}
1
+ {"version":3,"file":"har-to-fetch-response.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/har-to-fetch-response.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { HarResponse } from '@scalar/snippetz'\n\nimport { getCookieHeaderKeys } from '@/v2/blocks/operation-block/helpers/get-cookie-header-keys'\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\n\ntype HarToFetchResponseProps = {\n /** The HAR Response object to convert */\n harResponse: HarResponse\n /** Optional URL to set on the Response object */\n url?: string\n /** The HTTP method used for the request */\n method: HttpMethod\n /** The request path */\n path: string\n /** Time in ms the request took */\n duration?: number\n}\n\ntype ProcessedBody = {\n /** ArrayBuffer for Response body */\n body: ArrayBuffer | null\n /** Data for ResponseInstance (string or Blob) */\n data: string | Blob\n /** Size in bytes */\n size: number\n}\n\n/**\n * Converts a HAR (HTTP Archive) Response back to a ResponseInstance object.\n *\n * This function is the reverse of fetchResponseToHar - it takes a HAR response\n * and converts it back into a ResponseInstance object that includes both the\n * standard Fetch API Response properties and additional metadata.\n *\n * The conversion handles:\n * - Status code and status text restoration\n * - Headers reconstruction from HAR headers array\n * - Body decoding\n * - Content-Type and other header restoration\n * - URL property setting (if provided)\n * - Cookie header detection\n * - Duration tracking\n * - Response size calculation in bytes\n *\n * Body Handling:\n * - Plain text (no encoding): Text-based responses under 1MB from fetchResponseToHar\n * - Base64 encoded: Binary or legacy data (note: new HAR files won't contain binary data)\n * - Empty: Streaming responses, large responses (>1MB), or responses without bodies\n *\n * Use cases:\n * - Replaying recorded HTTP responses\n * - Creating mock responses from HAR files\n * - Testing with fixtures\n * - Response caching and restoration\n *\n * Note: The Fetch API Response object does not support setting the HTTP version,\n * so that information from the HAR is not preserved in the returned Response.\n * The URL property is set using Object.defineProperty since it is read-only\n * in the standard Response constructor.\n *\n * @see https://w3c.github.io/web-performance/specs/HAR/Overview.html\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Response\n *\n * @example\n * const harResponse = { status: 200, statusText: 'OK', ... }\n * const response = harToFetchResponse({\n * harResponse,\n * url: 'https://api.example.com',\n * method: 'GET',\n * path: '/users',\n * duration: 250\n * })\n * console.log(response.url) // 'https://api.example.com'\n * console.log(response.duration) // 250\n */\nexport const harToFetchResponse = ({\n harResponse,\n url = '',\n method,\n path,\n duration = 0,\n}: HarToFetchResponseProps): ResponseInstance => {\n const headers = buildHeaders(harResponse)\n const { body, data, size } = processBody(harResponse)\n const cookieHeaderKeys = getCookieHeaderKeys(headers)\n\n const response = new Response(body, {\n status: harResponse.status,\n statusText: harResponse.statusText,\n headers,\n })\n\n return {\n ...response,\n headers: Object.fromEntries(headers.entries()),\n cookieHeaderKeys,\n duration,\n status: harResponse.status,\n statusText: harResponse.statusText,\n method,\n path,\n data,\n size,\n url,\n }\n}\n\n/**\n * Builds Headers object and record from HAR response headers.\n */\nconst buildHeaders = (harResponse: HarResponse) => {\n const headers = new Headers()\n\n harResponse.headers.forEach(({ name, value }) => {\n headers.append(name, value)\n })\n\n return headers\n}\n\n/**\n * Processes HAR response body content.\n * Returns body, data and size for ResponseInstance.\n */\nconst processBody = (harResponse: HarResponse): ProcessedBody => {\n if (!harResponse.content.text) {\n return { body: null, data: '', size: 0 }\n }\n\n const { text, encoding } = harResponse.content\n\n if (encoding) {\n return { body: null, data: text, size: text.length }\n }\n\n const body = new TextEncoder().encode(text).buffer\n\n return { body, data: text, size: body.byteLength }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,IAAa,sBAAsB,EACjC,aACA,MAAM,IACN,QACA,MACA,WAAW,QACoC;CAC/C,MAAM,UAAU,aAAa,WAAW;CACxC,MAAM,EAAE,MAAM,MAAM,SAAS,YAAY,WAAW;CACpD,MAAM,mBAAmB,oBAAoB,OAAO;CAQpD,OAAO;EACL,GAAG,IAPgB,SAAS,MAAM;GAClC,QAAQ,YAAY;GACpB,YAAY,YAAY;GACxB;EACF,CAGK;EACH,SAAS,OAAO,YAAY,QAAQ,QAAQ,CAAC;EAC7C;EACA;EACA,QAAQ,YAAY;EACpB,YAAY,YAAY;EACxB;EACA;EACA;EACA;EACA;CACF;AACF;;;;AAKA,IAAM,gBAAgB,gBAA6B;CACjD,MAAM,UAAU,IAAI,QAAQ;CAE5B,YAAY,QAAQ,SAAS,EAAE,MAAM,YAAY;EAC/C,QAAQ,OAAO,MAAM,KAAK;CAC5B,CAAC;CAED,OAAO;AACT;;;;;AAMA,IAAM,eAAe,gBAA4C;CAC/D,IAAI,CAAC,YAAY,QAAQ,MACvB,OAAO;EAAE,MAAM;EAAM,MAAM;EAAI,MAAM;CAAE;CAGzC,MAAM,EAAE,MAAM,aAAa,YAAY;CAEvC,IAAI,UACF,OAAO;EAAE,MAAM;EAAM,MAAM;EAAM,MAAM,KAAK;CAAO;CAGrD,MAAM,OAAO,IAAI,YAAY,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC;CAE5C,OAAO;EAAE;EAAM,MAAM;EAAM,MAAM,KAAK;CAAW;AACnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"persist-response-cookies.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/persist-response-cookies.ts"],"sourcesContent":["import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport { parseSetCookie } from 'set-cookie-parser'\n\n/**\n * A single change to apply to the persisted document cookie jar in response to a\n * server's `Set-Cookie` headers. This mirrors how a browser stores server-set\n * cookies so that values like a Django CSRF token survive a page reload and get\n * replayed on the next request.\n */\ntype ResponseCookieAction =\n | {\n type: 'upsert'\n /** The cookie fields to store. Merged over the existing cookie when `index` is set. */\n cookie: Pick<XScalarCookie, 'name' | 'value' | 'domain' | 'path'>\n /** Index of the existing cookie to update, or undefined to add a new one. */\n index?: number\n }\n | {\n type: 'delete'\n cookieName: string\n /** Index of the existing cookie to remove. */\n index: number\n }\n\n/**\n * Resolve the real target URL a request was sent to, so cookies are scoped to\n * the API host rather than the proxy. When a request is proxied, the target URL\n * is carried in the `scalar_url` query parameter; otherwise the URL is used as-is.\n */\nexport const getCookieRequestUrl = (payloadUrl: string): string => {\n try {\n // Fall back to the proxied URL when `scalar_url` is missing or empty, so an\n // empty query value never scopes cookies against a placeholder host.\n return new URL(payloadUrl).searchParams.get('scalar_url') || payloadUrl\n } catch {\n return payloadUrl\n }\n}\n\n/**\n * Compute the default cookie path from a request pathname, following the browser\n * default-path algorithm (RFC 6265, section 5.1.4): the request path up to, but\n * not including, its rightmost slash — or \"/\" when there is nothing before it.\n */\nconst getDefaultPath = (pathname: string): string => {\n if (!pathname.startsWith('/')) {\n return '/'\n }\n\n const lastSlash = pathname.lastIndexOf('/')\n\n return lastSlash <= 0 ? '/' : pathname.slice(0, lastSlash)\n}\n\n/**\n * Derive the host and default path a cookie should be scoped to from the request\n * URL. The URL is parsed defensively: `getCookieRequestUrl` may hand back a value\n * that is not a valid URL (for example a malformed `scalar_url`), and a throw here\n * would otherwise abort persistence after an otherwise successful request.\n */\nconst getRequestScope = (requestUrl: string): { hostname: string; defaultPath: string } => {\n try {\n const { hostname, pathname } = new URL(requestUrl, 'https://example.com')\n\n return { hostname, defaultPath: getDefaultPath(pathname) }\n } catch {\n return { hostname: '', defaultPath: '/' }\n }\n}\n\n/** Two stored cookies share an identity when name, domain, and path all match. */\nconst isSameCookie = (a: Pick<XScalarCookie, 'name' | 'domain' | 'path'>, b: XScalarCookie): boolean =>\n a.name === b.name && (a.domain ?? '') === (b.domain ?? '') && (a.path ?? '') === (b.path ?? '')\n\n/**\n * Translate a response's `Set-Cookie` headers into a list of changes for the\n * document cookie jar.\n *\n * Scalar sends requests through a proxy and reads `Set-Cookie` from a custom\n * header because browsers hide it from `fetch`, so it has to maintain its own\n * cookie jar instead of relying on the browser. This function is that jar's\n * write path: it decides which cookies to add, update, or remove.\n *\n * Cookies are scoped like a browser would scope them — using the `Set-Cookie`\n * `Domain`/`Path` attributes, or falling back to the request host and default\n * path — so they are only replayed on matching requests. Expired cookies (an\n * `Expires` in the past or a non-positive `Max-Age`) remove the matching cookie,\n * matching how a server deletes a cookie.\n *\n * @param cookieHeaderKeys - Serialized `Set-Cookie` values from the response\n * @param documentCookies - The current persisted document cookies (order matches the store)\n * @param requestUrl - The request URL, used to derive the default domain and path\n * @param now - Current time in ms, injectable for testing\n */\nexport const getResponseCookieActions = ({\n cookieHeaderKeys,\n documentCookies,\n requestUrl,\n now = Date.now(),\n}: {\n cookieHeaderKeys: string[]\n documentCookies: XScalarCookie[]\n requestUrl: string\n now?: number\n}): ResponseCookieAction[] => {\n const { hostname, defaultPath } = getRequestScope(requestUrl)\n\n /**\n * Collapse the response's `Set-Cookie` headers into one final state per cookie\n * identity. A browser applies them in order, so a later header for the same\n * name/domain/path wins — whether it sets a new value or expires the cookie.\n * Resolving this first also keeps a single action per identity, so the same\n * stored cookie never gets a conflicting upsert and delete on the same index.\n */\n const resolved = new Map<\n string,\n { cookie: Pick<XScalarCookie, 'name' | 'value' | 'domain' | 'path'>; expired: boolean }\n >()\n\n for (const header of cookieHeaderKeys) {\n // Each header holds a single Set-Cookie value, so take the first parsed cookie.\n const [parsed] = parseSetCookie(header)\n\n if (!parsed?.name) {\n continue\n }\n\n // Scope the cookie the way a browser would, so it is only replayed on matching requests.\n const domain = parsed.domain || hostname\n const path = parsed.path || defaultPath\n\n // A cookie is deleted when it is already expired via Expires or Max-Age.\n const expired =\n (parsed.maxAge !== undefined && parsed.maxAge <= 0) ||\n (parsed.expires instanceof Date && parsed.expires.getTime() <= now)\n\n resolved.set(`${parsed.name}\\n${domain}\\n${path}`, {\n cookie: { name: parsed.name, value: parsed.value, domain, path },\n expired,\n })\n }\n\n const upserts: ResponseCookieAction[] = []\n const deletes: ResponseCookieAction[] = []\n\n for (const { cookie, expired } of resolved.values()) {\n const index = documentCookies.findIndex((existing) => isSameCookie(cookie, existing))\n\n if (expired) {\n if (index !== -1) {\n deletes.push({ type: 'delete', cookieName: cookie.name, index })\n }\n continue\n }\n\n upserts.push({\n type: 'upsert',\n cookie,\n ...(index === -1 ? {} : { index }),\n })\n }\n\n /**\n * Apply index-based changes (updates and deletes) before appends, and process\n * deletes from the highest index down, so earlier indices stay valid as the\n * underlying array shrinks.\n */\n const indexed = [...upserts.filter((action) => action.index !== undefined), ...deletes].sort(\n (a, b) => (b.index ?? 0) - (a.index ?? 0),\n )\n const appends = upserts.filter((action) => action.index === undefined)\n\n return [...indexed, ...appends]\n}\n"],"mappings":";;;;;;;AA6BA,IAAa,uBAAuB,eAA+B;AACjE,KAAI;AAGF,SAAO,IAAI,IAAI,WAAW,CAAC,aAAa,IAAI,aAAa,IAAI;SACvD;AACN,SAAO;;;;;;;;AASX,IAAM,kBAAkB,aAA6B;AACnD,KAAI,CAAC,SAAS,WAAW,IAAI,CAC3B,QAAO;CAGT,MAAM,YAAY,SAAS,YAAY,IAAI;AAE3C,QAAO,aAAa,IAAI,MAAM,SAAS,MAAM,GAAG,UAAU;;;;;;;;AAS5D,IA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GACN;GACA,GAAI,UAAU,KAAK,EAAE,GAAG,EAAE,OAAO;GAClC,CAAC;;;;;;;CAQJ,MAAM,UAAU,CAAC,GAAG,QAAQ,QAAQ,WAAW,OAAO,UAAU,KAAA,EAAU,EAAE,GAAG,QAAQ,CAAC,MACrF,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,SAAS,GACxC;CACD,MAAM,UAAU,QAAQ,QAAQ,WAAW,OAAO,UAAU,KAAA,EAAU;AAEtE,QAAO,CAAC,GAAG,SAAS,GAAG,QAAQ"}
1
+ {"version":3,"file":"persist-response-cookies.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/persist-response-cookies.ts"],"sourcesContent":["import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport { parseSetCookie } from 'set-cookie-parser'\n\n/**\n * A single change to apply to the persisted document cookie jar in response to a\n * server's `Set-Cookie` headers. This mirrors how a browser stores server-set\n * cookies so that values like a Django CSRF token survive a page reload and get\n * replayed on the next request.\n */\ntype ResponseCookieAction =\n | {\n type: 'upsert'\n /** The cookie fields to store. Merged over the existing cookie when `index` is set. */\n cookie: Pick<XScalarCookie, 'name' | 'value' | 'domain' | 'path'>\n /** Index of the existing cookie to update, or undefined to add a new one. */\n index?: number\n }\n | {\n type: 'delete'\n cookieName: string\n /** Index of the existing cookie to remove. */\n index: number\n }\n\n/**\n * Resolve the real target URL a request was sent to, so cookies are scoped to\n * the API host rather than the proxy. When a request is proxied, the target URL\n * is carried in the `scalar_url` query parameter; otherwise the URL is used as-is.\n */\nexport const getCookieRequestUrl = (payloadUrl: string): string => {\n try {\n // Fall back to the proxied URL when `scalar_url` is missing or empty, so an\n // empty query value never scopes cookies against a placeholder host.\n return new URL(payloadUrl).searchParams.get('scalar_url') || payloadUrl\n } catch {\n return payloadUrl\n }\n}\n\n/**\n * Compute the default cookie path from a request pathname, following the browser\n * default-path algorithm (RFC 6265, section 5.1.4): the request path up to, but\n * not including, its rightmost slash — or \"/\" when there is nothing before it.\n */\nconst getDefaultPath = (pathname: string): string => {\n if (!pathname.startsWith('/')) {\n return '/'\n }\n\n const lastSlash = pathname.lastIndexOf('/')\n\n return lastSlash <= 0 ? '/' : pathname.slice(0, lastSlash)\n}\n\n/**\n * Derive the host and default path a cookie should be scoped to from the request\n * URL. The URL is parsed defensively: `getCookieRequestUrl` may hand back a value\n * that is not a valid URL (for example a malformed `scalar_url`), and a throw here\n * would otherwise abort persistence after an otherwise successful request.\n */\nconst getRequestScope = (requestUrl: string): { hostname: string; defaultPath: string } => {\n try {\n const { hostname, pathname } = new URL(requestUrl, 'https://example.com')\n\n return { hostname, defaultPath: getDefaultPath(pathname) }\n } catch {\n return { hostname: '', defaultPath: '/' }\n }\n}\n\n/** Two stored cookies share an identity when name, domain, and path all match. */\nconst isSameCookie = (a: Pick<XScalarCookie, 'name' | 'domain' | 'path'>, b: XScalarCookie): boolean =>\n a.name === b.name && (a.domain ?? '') === (b.domain ?? '') && (a.path ?? '') === (b.path ?? '')\n\n/**\n * Translate a response's `Set-Cookie` headers into a list of changes for the\n * document cookie jar.\n *\n * Scalar sends requests through a proxy and reads `Set-Cookie` from a custom\n * header because browsers hide it from `fetch`, so it has to maintain its own\n * cookie jar instead of relying on the browser. This function is that jar's\n * write path: it decides which cookies to add, update, or remove.\n *\n * Cookies are scoped like a browser would scope them — using the `Set-Cookie`\n * `Domain`/`Path` attributes, or falling back to the request host and default\n * path — so they are only replayed on matching requests. Expired cookies (an\n * `Expires` in the past or a non-positive `Max-Age`) remove the matching cookie,\n * matching how a server deletes a cookie.\n *\n * @param cookieHeaderKeys - Serialized `Set-Cookie` values from the response\n * @param documentCookies - The current persisted document cookies (order matches the store)\n * @param requestUrl - The request URL, used to derive the default domain and path\n * @param now - Current time in ms, injectable for testing\n */\nexport const getResponseCookieActions = ({\n cookieHeaderKeys,\n documentCookies,\n requestUrl,\n now = Date.now(),\n}: {\n cookieHeaderKeys: string[]\n documentCookies: XScalarCookie[]\n requestUrl: string\n now?: number\n}): ResponseCookieAction[] => {\n const { hostname, defaultPath } = getRequestScope(requestUrl)\n\n /**\n * Collapse the response's `Set-Cookie` headers into one final state per cookie\n * identity. A browser applies them in order, so a later header for the same\n * name/domain/path wins — whether it sets a new value or expires the cookie.\n * Resolving this first also keeps a single action per identity, so the same\n * stored cookie never gets a conflicting upsert and delete on the same index.\n */\n const resolved = new Map<\n string,\n { cookie: Pick<XScalarCookie, 'name' | 'value' | 'domain' | 'path'>; expired: boolean }\n >()\n\n for (const header of cookieHeaderKeys) {\n // Each header holds a single Set-Cookie value, so take the first parsed cookie.\n const [parsed] = parseSetCookie(header)\n\n if (!parsed?.name) {\n continue\n }\n\n // Scope the cookie the way a browser would, so it is only replayed on matching requests.\n const domain = parsed.domain || hostname\n const path = parsed.path || defaultPath\n\n // A cookie is deleted when it is already expired via Expires or Max-Age.\n const expired =\n (parsed.maxAge !== undefined && parsed.maxAge <= 0) ||\n (parsed.expires instanceof Date && parsed.expires.getTime() <= now)\n\n resolved.set(`${parsed.name}\\n${domain}\\n${path}`, {\n cookie: { name: parsed.name, value: parsed.value, domain, path },\n expired,\n })\n }\n\n const upserts: ResponseCookieAction[] = []\n const deletes: ResponseCookieAction[] = []\n\n for (const { cookie, expired } of resolved.values()) {\n const index = documentCookies.findIndex((existing) => isSameCookie(cookie, existing))\n\n if (expired) {\n if (index !== -1) {\n deletes.push({ type: 'delete', cookieName: cookie.name, index })\n }\n continue\n }\n\n upserts.push({\n type: 'upsert',\n cookie,\n ...(index === -1 ? {} : { index }),\n })\n }\n\n /**\n * Apply index-based changes (updates and deletes) before appends, and process\n * deletes from the highest index down, so earlier indices stay valid as the\n * underlying array shrinks.\n */\n const indexed = [...upserts.filter((action) => action.index !== undefined), ...deletes].sort(\n (a, b) => (b.index ?? 0) - (a.index ?? 0),\n )\n const appends = upserts.filter((action) => action.index === undefined)\n\n return [...indexed, ...appends]\n}\n"],"mappings":";;;;;;;AA6BA,IAAa,uBAAuB,eAA+B;CACjE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F,CAAC;CACH;CAEA,MAAM,UAAkC,CAAC;CACzC,MAAM,UAAkC,CAAC;CAEzC,KAAK,MAAM,EAAE,QAAQ,aAAa,SAAS,OAAO,GAAG;EACnD,MAAM,QAAQ,gBAAgB,WAAW,aAAa,aAAa,QAAQ,QAAQ,CAAC;EAEpF,IAAI,SAAS;GACX,IAAI,UAAU,IACZ,QAAQ,KAAK;IAAE,MAAM;IAAU,YAAY,OAAO;IAAM;GAAM,CAAC;GAEjE;EACF;EAEA,QAAQ,KAAK;GACX,MAAM;GACN;GACA,GAAI,UAAU,KAAK,CAAC,IAAI,EAAE,MAAM;EAClC,CAAC;CACH;;;;;;CAOA,MAAM,UAAU,CAAC,GAAG,QAAQ,QAAQ,WAAW,OAAO,UAAU,KAAA,CAAS,GAAG,GAAG,OAAO,CAAC,CAAC,MACrF,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,SAAS,EACzC;CACA,MAAM,UAAU,QAAQ,QAAQ,WAAW,OAAO,UAAU,KAAA,CAAS;CAErE,OAAO,CAAC,GAAG,SAAS,GAAG,OAAO;AAChC"}
@@ -1 +1 @@
1
- {"version":3,"file":"response-cache.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/response-cache.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\n\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\n\n/**\n * In-memory cache of operation example id → { response, request }.\n * Restores the last response when navigating back to an operation until\n * the user refreshes the page or makes a new request.\n */\nexport const responseCache = new Map<string, { response: ResponseInstance; requestPayload: RequestPayload }>()\n\n/**\n * Constructs a unique cache key for a specific operation/example.\n * The key is composed of the HTTP method, request path, and the example key,\n * delimited by \"|\", e.g. \"GET|/pets|123\".\n *\n * @param method - HTTP method (e.g., \"GET\", \"POST\")\n * @param path - The request path (e.g., \"/pets\")\n * @param exampleKey - A unique key identifying the example/request variant\n * @param documentSlug - Optionally add the document slug to the key\n * @returns The constructed cache key string\n */\nexport function getOperationExampleKey(\n method: string,\n path: string,\n exampleKey: string,\n documentSlug?: string,\n): string {\n return [documentSlug, method, path, exampleKey].filter(isDefined).join('|')\n}\n\n/**\n * Determines if a response is a streaming response (e.g., server-sent events).\n * Assumes streaming responses include a 'reader' property.\n *\n * @param response - The response instance to check\n * @returns True if response is streaming, otherwise false\n */\nexport function isStreamingResponse(response: ResponseInstance): boolean {\n return 'reader' in response\n}\n"],"mappings":";;;;;;;AAUA,IAAa,gCAAgB,IAAI,KAA6E;;;;;;;;;;;;AAa9G,SAAgB,uBACd,QACA,MACA,YACA,cACQ;AACR,QAAO;EAAC;EAAc;EAAQ;EAAM;EAAW,CAAC,OAAO,UAAU,CAAC,KAAK,IAAI;;;;;;;;;AAU7E,SAAgB,oBAAoB,UAAqC;AACvE,QAAO,YAAY"}
1
+ {"version":3,"file":"response-cache.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/response-cache.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\n\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\n\n/**\n * In-memory cache of operation example id → { response, request }.\n * Restores the last response when navigating back to an operation until\n * the user refreshes the page or makes a new request.\n */\nexport const responseCache = new Map<string, { response: ResponseInstance; requestPayload: RequestPayload }>()\n\n/**\n * Constructs a unique cache key for a specific operation/example.\n * The key is composed of the HTTP method, request path, and the example key,\n * delimited by \"|\", e.g. \"GET|/pets|123\".\n *\n * @param method - HTTP method (e.g., \"GET\", \"POST\")\n * @param path - The request path (e.g., \"/pets\")\n * @param exampleKey - A unique key identifying the example/request variant\n * @param documentSlug - Optionally add the document slug to the key\n * @returns The constructed cache key string\n */\nexport function getOperationExampleKey(\n method: string,\n path: string,\n exampleKey: string,\n documentSlug?: string,\n): string {\n return [documentSlug, method, path, exampleKey].filter(isDefined).join('|')\n}\n\n/**\n * Determines if a response is a streaming response (e.g., server-sent events).\n * Assumes streaming responses include a 'reader' property.\n *\n * @param response - The response instance to check\n * @returns True if response is streaming, otherwise false\n */\nexport function isStreamingResponse(response: ResponseInstance): boolean {\n return 'reader' in response\n}\n"],"mappings":";;;;;;;AAUA,IAAa,gCAAgB,IAAI,IAA4E;;;;;;;;;;;;AAa7G,SAAgB,uBACd,QACA,MACA,YACA,cACQ;CACR,OAAO;EAAC;EAAc;EAAQ;EAAM;CAAU,CAAC,CAAC,OAAO,SAAS,CAAC,CAAC,KAAK,GAAG;AAC5E;;;;;;;;AASA,SAAgB,oBAAoB,UAAqC;CACvE,OAAO,YAAY;AACrB"}