@scalar/api-client 2.39.4 → 2.41.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 (337) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/components/AddressBar/AddressBarHistory.vue.d.ts.map +1 -1
  3. package/dist/components/AddressBar/AddressBarHistory.vue.js +1 -1
  4. package/dist/components/AddressBar/AddressBarHistory.vue.js.map +1 -1
  5. package/dist/components/AddressBar/AddressBarHistory.vue.script.js +2 -2
  6. package/dist/components/AddressBar/AddressBarHistory.vue.script.js.map +1 -1
  7. package/dist/hooks/useClientConfig.d.ts +12 -0
  8. package/dist/hooks/useClientConfig.d.ts.map +1 -1
  9. package/dist/hooks/useClientConfig.js +14 -1
  10. package/dist/hooks/useClientConfig.js.map +1 -1
  11. package/dist/libs/index.d.ts +0 -1
  12. package/dist/libs/index.d.ts.map +1 -1
  13. package/dist/libs/index.js +1 -2
  14. package/dist/style.css +207 -248
  15. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +14 -10
  16. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  17. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  18. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +57 -35
  19. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  20. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -5
  21. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  22. package/dist/v2/blocks/operation-block/helpers/send-request.js +18 -33
  23. package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
  24. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.d.ts.map +1 -1
  25. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js +1 -1
  26. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js.map +1 -1
  27. package/dist/v2/blocks/operation-block/index.d.ts +0 -3
  28. package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
  29. package/dist/v2/blocks/operation-block/index.js +1 -4
  30. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +1 -1
  31. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  32. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  33. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js.map +1 -1
  34. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js +3 -1
  35. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js.map +1 -1
  36. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +4 -2
  37. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
  38. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +3 -2
  39. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js.map +1 -1
  40. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +1 -1
  41. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +1 -1
  42. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts.map +1 -1
  43. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.js.map +1 -1
  44. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +7 -2
  45. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  46. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +4 -3
  47. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js.map +1 -1
  48. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
  49. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +2 -3
  50. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js.map +1 -1
  51. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts +3 -1
  52. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
  53. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +5 -8
  54. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js.map +1 -1
  55. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +1 -1
  56. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts.map +1 -1
  57. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js.map +1 -1
  58. package/dist/v2/blocks/operation-code-sample/index.d.ts +0 -1
  59. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
  60. package/dist/v2/blocks/operation-code-sample/index.js +2 -3
  61. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +7 -9
  62. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  63. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  64. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  65. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +49 -42
  66. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  67. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  68. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  69. package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
  70. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +2 -3
  71. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  72. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  73. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
  74. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +1 -0
  75. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  76. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  77. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  78. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +1 -1
  79. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  80. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +1 -1
  81. package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts +1 -1
  82. package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts.map +1 -1
  83. package/dist/v2/blocks/request-block/helpers/is-param-disabled.js +2 -1
  84. package/dist/v2/blocks/request-block/helpers/is-param-disabled.js.map +1 -1
  85. package/dist/v2/blocks/response-block/helpers/get-content-length.d.ts.map +1 -1
  86. package/dist/v2/blocks/response-block/helpers/get-content-length.js +2 -2
  87. package/dist/v2/blocks/response-block/helpers/get-content-length.js.map +1 -1
  88. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  89. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  90. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
  91. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +76 -25
  92. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  93. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
  94. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
  95. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js.map +1 -1
  96. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +2 -2
  97. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
  98. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +1 -1
  99. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  100. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
  101. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +1 -1
  102. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  103. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +1 -1
  104. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  105. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
  106. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +8 -4
  107. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  108. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +1 -1
  109. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  110. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map +1 -1
  111. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -1
  112. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +1 -1
  113. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  114. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js.map +1 -1
  115. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
  116. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts +1 -1
  117. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  118. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +1 -1
  119. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +1 -1
  120. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  121. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +6 -2
  122. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
  123. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +0 -3
  124. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
  125. package/dist/v2/blocks/scalar-auth-selector-block/index.js +1 -3
  126. package/dist/v2/components/code-input/CodeInput.vue.d.ts +8 -6
  127. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  128. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  129. package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
  130. package/dist/v2/components/code-input/CodeInput.vue.script.js +11 -9
  131. package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
  132. package/dist/v2/constants.js +1 -1
  133. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  134. package/dist/v2/features/app/App.vue.js.map +1 -1
  135. package/dist/v2/features/app/App.vue.script.js +1 -5
  136. package/dist/v2/features/app/App.vue.script.js.map +1 -1
  137. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  138. package/dist/v2/features/app/app-events.js +1 -1
  139. package/dist/v2/features/app/app-events.js.map +1 -1
  140. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  141. package/dist/v2/features/app/app-state.js +2 -2
  142. package/dist/v2/features/app/app-state.js.map +1 -1
  143. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  144. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  145. package/dist/v2/features/app/components/AppSidebar.vue.js.map +1 -1
  146. package/dist/v2/features/app/components/AppSidebar.vue.script.js +1 -1
  147. package/dist/v2/features/app/components/AppSidebar.vue.script.js.map +1 -1
  148. package/dist/v2/features/app/helpers/routes.d.ts +0 -3
  149. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  150. package/dist/v2/features/app/helpers/routes.js +1 -1
  151. package/dist/v2/features/app/helpers/routes.js.map +1 -1
  152. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  153. package/dist/v2/features/collection/DocumentCollection.vue.js.map +1 -1
  154. package/dist/v2/features/collection/DocumentCollection.vue.script.js +30 -52
  155. package/dist/v2/features/collection/DocumentCollection.vue.script.js.map +1 -1
  156. package/dist/v2/features/collection/OperationCollection.vue.script.js +0 -1
  157. package/dist/v2/features/collection/OperationCollection.vue.script.js.map +1 -1
  158. package/dist/v2/features/collection/WorkspaceCollection.vue.script.js +0 -1
  159. package/dist/v2/features/collection/WorkspaceCollection.vue.script.js.map +1 -1
  160. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  161. package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
  162. package/dist/v2/features/collection/components/Authentication.vue.js.map +1 -1
  163. package/dist/v2/features/collection/components/Authentication.vue.script.js +6 -8
  164. package/dist/v2/features/collection/components/Authentication.vue.script.js.map +1 -1
  165. package/dist/v2/features/collection/components/Cookies.vue.script.js +0 -1
  166. package/dist/v2/features/collection/components/Cookies.vue.script.js.map +1 -1
  167. package/dist/v2/features/collection/components/Editor/Editor.vue.script.js +0 -1
  168. package/dist/v2/features/collection/components/Editor/Editor.vue.script.js.map +1 -1
  169. package/dist/v2/features/collection/components/Environment.vue.script.js +0 -1
  170. package/dist/v2/features/collection/components/Environment.vue.script.js.map +1 -1
  171. package/dist/v2/features/collection/components/Overview.vue.script.js +0 -1
  172. package/dist/v2/features/collection/components/Overview.vue.script.js.map +1 -1
  173. package/dist/v2/features/collection/components/Servers.vue.script.js +0 -1
  174. package/dist/v2/features/collection/components/Servers.vue.script.js.map +1 -1
  175. package/dist/v2/features/collection/components/Settings.vue.js.map +1 -1
  176. package/dist/v2/features/collection/components/Settings.vue.script.js +2 -3
  177. package/dist/v2/features/collection/components/Settings.vue.script.js.map +1 -1
  178. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +1 -1
  179. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
  180. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
  181. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +1 -1
  182. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
  183. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  184. package/dist/v2/features/modal/Modal.vue.js.map +1 -1
  185. package/dist/v2/features/modal/Modal.vue.script.js +4 -9
  186. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  187. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  188. package/dist/v2/features/modal/helpers/create-api-client-modal.js +1 -17
  189. package/dist/v2/features/modal/helpers/create-api-client-modal.js.map +1 -1
  190. package/dist/v2/features/modal/helpers/map-hidden-clients-config.js +1 -1
  191. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  192. package/dist/v2/features/operation/Operation.vue.js.map +1 -1
  193. package/dist/v2/features/operation/Operation.vue.script.js +51 -84
  194. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  195. package/dist/v2/features/operation/index.d.ts +0 -4
  196. package/dist/v2/features/operation/index.d.ts.map +1 -1
  197. package/dist/v2/features/operation/index.js +1 -5
  198. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  199. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js.map +1 -1
  200. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.script.js +11 -1
  201. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.script.js.map +1 -1
  202. package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
  203. package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
  204. package/dist/views/Request/RequestSection/RequestTable.vue.js.map +1 -1
  205. package/dist/views/Request/RequestSection/RequestTable.vue.script.js +1 -1
  206. package/dist/views/Request/RequestSection/RequestTable.vue.script.js.map +1 -1
  207. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.script.js +1 -1
  208. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.d.ts.map +1 -1
  209. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js.map +1 -1
  210. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.script.js +2 -2
  211. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.script.js.map +1 -1
  212. package/dist/views/Request/libs/oauth2.js +1 -1
  213. package/dist/views/Request/libs/oauth2.js.map +1 -1
  214. package/package.json +24 -30
  215. package/dist/libs/formatters.d.ts +0 -12
  216. package/dist/libs/formatters.d.ts.map +0 -1
  217. package/dist/libs/formatters.js +0 -36
  218. package/dist/libs/formatters.js.map +0 -1
  219. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts +0 -6
  220. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts.map +0 -1
  221. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.js +0 -58
  222. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.js.map +0 -1
  223. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts +0 -12
  224. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +0 -1
  225. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +0 -65
  226. package/dist/v2/blocks/operation-block/helpers/build-request-body.js.map +0 -1
  227. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +0 -31
  228. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +0 -1
  229. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +0 -55
  230. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js.map +0 -1
  231. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +0 -27
  232. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +0 -1
  233. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +0 -159
  234. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js.map +0 -1
  235. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +0 -25
  236. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +0 -1
  237. package/dist/v2/blocks/operation-block/helpers/build-request-security.js +0 -53
  238. package/dist/v2/blocks/operation-block/helpers/build-request-security.js.map +0 -1
  239. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +0 -46
  240. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +0 -1
  241. package/dist/v2/blocks/operation-block/helpers/build-request.js +0 -102
  242. package/dist/v2/blocks/operation-block/helpers/build-request.js.map +0 -1
  243. package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts +0 -4
  244. package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts.map +0 -1
  245. package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.js +0 -41
  246. package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.js.map +0 -1
  247. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts +0 -14
  248. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts.map +0 -1
  249. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.js +0 -20
  250. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.js.map +0 -1
  251. package/dist/v2/blocks/operation-block/helpers/get-delimiter.d.ts +0 -8
  252. package/dist/v2/blocks/operation-block/helpers/get-delimiter.d.ts.map +0 -1
  253. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts +0 -9
  254. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts.map +0 -1
  255. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js +0 -17
  256. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js.map +0 -1
  257. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts +0 -10
  258. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +0 -1
  259. package/dist/v2/blocks/operation-block/helpers/get-example.js +0 -41
  260. package/dist/v2/blocks/operation-block/helpers/get-example.js.map +0 -1
  261. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts +0 -26
  262. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts.map +0 -1
  263. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.js +0 -32
  264. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.js.map +0 -1
  265. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts +0 -10
  266. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts.map +0 -1
  267. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js +0 -15
  268. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js.map +0 -1
  269. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts +0 -3
  270. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts.map +0 -1
  271. package/dist/v2/blocks/operation-block/helpers/get-server-url.js +0 -18
  272. package/dist/v2/blocks/operation-block/helpers/get-server-url.js.map +0 -1
  273. package/dist/v2/blocks/operation-block/helpers/serialize-parameter.d.ts +0 -96
  274. package/dist/v2/blocks/operation-block/helpers/serialize-parameter.d.ts.map +0 -1
  275. package/dist/v2/blocks/operation-block/helpers/serialize-parameter.js +0 -160
  276. package/dist/v2/blocks/operation-block/helpers/serialize-parameter.js.map +0 -1
  277. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +0 -40
  278. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +0 -1
  279. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +0 -437
  280. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js.map +0 -1
  281. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts +0 -6
  282. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts.map +0 -1
  283. package/dist/v2/blocks/request-block/helpers/get-request-body-example.js +0 -25
  284. package/dist/v2/blocks/request-block/helpers/get-request-body-example.js.map +0 -1
  285. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +0 -141
  286. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js.map +0 -1
  287. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts +0 -4
  288. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts.map +0 -1
  289. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js +0 -10
  290. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js.map +0 -1
  291. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts +0 -9
  292. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts.map +0 -1
  293. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +0 -27
  294. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js.map +0 -1
  295. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +0 -25
  296. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +0 -1
  297. package/dist/v2/components/callout/Callout.vue.js +0 -9
  298. package/dist/v2/components/callout/Callout.vue.js.map +0 -1
  299. package/dist/v2/components/callout/Callout.vue.script.js +0 -35
  300. package/dist/v2/components/callout/Callout.vue.script.js.map +0 -1
  301. package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts +0 -18
  302. package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts.map +0 -1
  303. package/dist/v2/features/modal/helpers/restore-workspace-state.js +0 -51
  304. package/dist/v2/features/modal/helpers/restore-workspace-state.js.map +0 -1
  305. package/dist/v2/features/operation/helpers/combine-params.d.ts +0 -4
  306. package/dist/v2/features/operation/helpers/combine-params.d.ts.map +0 -1
  307. package/dist/v2/features/operation/helpers/combine-params.js +0 -20
  308. package/dist/v2/features/operation/helpers/combine-params.js.map +0 -1
  309. package/dist/v2/features/operation/helpers/get-operation-header.d.ts +0 -17
  310. package/dist/v2/features/operation/helpers/get-operation-header.d.ts.map +0 -1
  311. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +0 -12
  312. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +0 -1
  313. package/dist/v2/features/operation/helpers/get-security-requirements.js +0 -17
  314. package/dist/v2/features/operation/helpers/get-security-requirements.js.map +0 -1
  315. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +0 -15
  316. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +0 -1
  317. package/dist/v2/features/operation/helpers/get-selected-security.js +0 -41
  318. package/dist/v2/features/operation/helpers/get-selected-security.js.map +0 -1
  319. package/dist/v2/features/operation/helpers/get-selected-server.d.ts +0 -13
  320. package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +0 -1
  321. package/dist/v2/features/operation/helpers/get-selected-server.js +0 -21
  322. package/dist/v2/features/operation/helpers/get-selected-server.js.map +0 -1
  323. package/dist/v2/helpers/get-active-environment.d.ts +0 -5
  324. package/dist/v2/helpers/get-active-environment.d.ts.map +0 -1
  325. package/dist/v2/helpers/get-active-environment.js +0 -19
  326. package/dist/v2/helpers/get-active-environment.js.map +0 -1
  327. package/dist/v2/helpers/get-active-proxy-url.d.ts +0 -18
  328. package/dist/v2/helpers/get-active-proxy-url.d.ts.map +0 -1
  329. package/dist/v2/helpers/get-active-proxy-url.js +0 -26
  330. package/dist/v2/helpers/get-active-proxy-url.js.map +0 -1
  331. package/dist/v2/helpers/get-servers.d.ts +0 -23
  332. package/dist/v2/helpers/get-servers.d.ts.map +0 -1
  333. package/dist/v2/helpers/get-servers.js +0 -106
  334. package/dist/v2/helpers/get-servers.js.map +0 -1
  335. package/dist/v2/helpers/index.d.ts +0 -3
  336. package/dist/v2/helpers/index.d.ts.map +0 -1
  337. package/dist/v2/helpers/index.js +0 -3
@@ -1,159 +0,0 @@
1
- import { getExample } from "./get-example.js";
2
- import { deSerializeParameter } from "./de-serialize-parameter.js";
3
- import { isParamDisabled } from "../../request-block/helpers/is-param-disabled.js";
4
- import { serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle } from "./serialize-parameter.js";
5
- import { isDefined } from "@scalar/helpers/array/is-defined";
6
- import { replaceEnvVariables } from "@scalar/helpers/regex/replace-variables";
7
- import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
8
- import { xScalarCookieSchema } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
9
- import { coerceValue } from "@scalar/workspace-store/schemas/typebox-coerce";
10
- import { isObject } from "@scalar/helpers/object/is-object";
11
- //#region src/v2/blocks/operation-block/helpers/build-request-parameters.ts
12
- /** Helper to get explode value with default */
13
- var getExplode = (param, defaultValue) => "explode" in param && param.explode !== void 0 ? param.explode : defaultValue;
14
- /**
15
- * Converts the parameters into a set of headers, cookies and url params while
16
- * replacing environment variables and extracting example values. Also builds up a record of the path
17
- * parameters which can then be used to replace variables in the path.
18
- * Also handles both content based and schema based parameters.
19
- *
20
- * @param parameters - Unfiltered parameters
21
- * @param env - Environment variables flattened into a key-value object
22
- * @param exampleKey - The key of the current example
23
- * @returns A set of headers, cookies and url params
24
- */
25
- var buildRequestParameters = (parameters = [], env = {}, exampleKey = "default") => {
26
- const result = {
27
- cookies: [],
28
- headers: {},
29
- pathVariables: {},
30
- allowReservedQueryParameters: /* @__PURE__ */ new Set(),
31
- urlParams: new URLSearchParams()
32
- };
33
- if (parameters.length === 0) return result;
34
- for (const referencedParam of parameters) {
35
- const param = getResolvedRef(referencedParam);
36
- const example = getExample(param, exampleKey, void 0);
37
- if (!example || isParamDisabled(param, example)) continue;
38
- /** De-serialize the example value if it is a string and matches the schema type */
39
- const deSerializedValue = deSerializeParameter(typeof example.value === "string" ? replaceEnvVariables(example.value, env) : example.value, param);
40
- const paramName = replaceEnvVariables(param.name, env);
41
- switch (param.in) {
42
- case "header": {
43
- if (paramName.toLowerCase() === "content-type" && deSerializedValue === "multipart/form-data") break;
44
- /** Headers only support simple style according to OpenAPI 3.1.1 */
45
- const serialized = serializeSimpleStyle(deSerializedValue, getExplode(param, false));
46
- if (!isDefined(serialized)) break;
47
- /** Headers can only be strings so we can cast numbers etc */
48
- const serializedString = String(serialized);
49
- if (result.headers[paramName]) result.headers[paramName] = `${result.headers[paramName]},${serializedString}`;
50
- else result.headers[paramName] = serializedString;
51
- break;
52
- }
53
- case "path": {
54
- const serialized = serializeSimpleStyle(deSerializedValue, getExplode(param, false));
55
- result.pathVariables[paramName] = encodeURIComponent(String(serialized));
56
- break;
57
- }
58
- case "query":
59
- processQueryParameter(param, paramName, deSerializedValue, result.urlParams, result.allowReservedQueryParameters);
60
- break;
61
- case "cookie":
62
- processCookieParameter(paramName, deSerializedValue, getExplode(param, true), result.cookies);
63
- break;
64
- }
65
- }
66
- return result;
67
- };
68
- /** Ensure we only apply the correcet style to the correct types */
69
- var getStyle = (param, replacedValue) => {
70
- if (!("style" in param) || !param.style) return "form";
71
- if (param.style === "deepObject") {
72
- if (isObject(replacedValue)) return "deepObject";
73
- return "form";
74
- }
75
- return param.style;
76
- };
77
- /** Whether the parameter allows reserved characters (from param or schema). */
78
- var isAllowReserved = (param) => {
79
- if ("allowReserved" in param && param.allowReserved !== void 0) return param.allowReserved;
80
- if ("schema" in param && param.schema && typeof param.schema === "object" && "allowReserved" in param.schema) return param.schema.allowReserved === true;
81
- return false;
82
- };
83
- /** When allowReserved is true, add keys to the set so reserved chars stay unescaped in the URL. */
84
- var trackReservedKeys = (allowReservedQueryParameters, allowReserved, ...keys) => {
85
- if (allowReserved) for (const key of keys) allowReservedQueryParameters.add(key);
86
- };
87
- /**
88
- * Helper function to process query parameters.
89
- * Extracted to reduce complexity in main function.
90
- */
91
- var processQueryParameter = (param, paramName, replacedValue, urlParams, allowReservedQueryParameters) => {
92
- /** If the parameter should be exploded, defaults to true for form style */
93
- const explodeParam = "explode" in param && param.explode !== void 0 ? param.explode : true;
94
- const allowReserved = isAllowReserved(param);
95
- /** Style of the parameter, defaults to form */
96
- const style = getStyle(param, replacedValue);
97
- if ("content" in param && param.content) {
98
- const serializedValue = serializeContentValue(replacedValue, Object.keys(param.content)[0] ?? "application/json");
99
- urlParams.set(paramName, serializedValue);
100
- trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName);
101
- return;
102
- }
103
- if (style === "deepObject" && explodeParam) {
104
- const entries = serializeDeepObjectStyle(paramName, replacedValue);
105
- for (const entry of entries) {
106
- urlParams.append(entry.key, entry.value);
107
- trackReservedKeys(allowReservedQueryParameters, allowReserved, entry.key);
108
- }
109
- return;
110
- }
111
- if (style === "spaceDelimited") {
112
- const serialized = serializeSpaceDelimitedStyle(replacedValue);
113
- const existingValue = urlParams.get(paramName);
114
- urlParams.set(paramName, existingValue ? `${existingValue} ${serialized}` : serialized);
115
- trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName);
116
- return;
117
- }
118
- if (style === "pipeDelimited") {
119
- const serialized = serializePipeDelimitedStyle(replacedValue);
120
- const existingValue = urlParams.get(paramName);
121
- urlParams.set(paramName, existingValue ? `${existingValue}|${serialized}` : serialized);
122
- trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName);
123
- return;
124
- }
125
- const serialized = serializeFormStyle(replacedValue, explodeParam);
126
- if (Array.isArray(serialized)) for (const entry of serialized) {
127
- const key = entry.key || paramName;
128
- urlParams.append(key, String(entry.value));
129
- trackReservedKeys(allowReservedQueryParameters, allowReserved, key);
130
- }
131
- else {
132
- urlParams.append(paramName, String(serialized));
133
- trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName);
134
- }
135
- };
136
- /**
137
- * Helper function to process cookie parameters.
138
- * Extracted to reduce complexity in main function.
139
- */
140
- var processCookieParameter = (paramName, replacedValue, explode, cookies) => {
141
- const serialized = serializeFormStyleForCookies(replacedValue, explode);
142
- if (Array.isArray(serialized)) for (const entry of serialized) {
143
- const key = entry.key || paramName;
144
- cookies.push(coerceValue(xScalarCookieSchema, {
145
- name: key,
146
- value: String(entry.value),
147
- path: "/"
148
- }));
149
- }
150
- else cookies.push(coerceValue(xScalarCookieSchema, {
151
- name: paramName,
152
- value: String(serialized),
153
- path: "/"
154
- }));
155
- };
156
- //#endregion
157
- export { buildRequestParameters };
158
-
159
- //# sourceMappingURL=build-request-parameters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-request-parameters.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-parameters.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { isObject } from '@scalar/helpers/object/is-object'\nimport { replaceEnvVariables } from '@scalar/helpers/regex/replace-variables'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n type XScalarCookie,\n xScalarCookieSchema,\n} from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\nimport type { ParameterObject, ReferenceType } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { deSerializeParameter } from '@/v2/blocks/operation-block/helpers/de-serialize-parameter'\nimport { isParamDisabled } from '@/v2/blocks/request-block/helpers/is-param-disabled'\n\nimport { getExample } from './get-example'\nimport {\n serializeContentValue,\n serializeDeepObjectStyle,\n serializeFormStyle,\n serializeFormStyleForCookies,\n serializePipeDelimitedStyle,\n serializeSimpleStyle,\n serializeSpaceDelimitedStyle,\n} from './serialize-parameter'\n\n/** Helper to get explode value with default */\nconst getExplode = (param: ParameterObject, defaultValue: boolean): boolean =>\n 'explode' in param && param.explode !== undefined ? param.explode : defaultValue\n\n/**\n * Converts the parameters into a set of headers, cookies and url params while\n * replacing environment variables and extracting example values. Also builds up a record of the path\n * parameters which can then be used to replace variables in the path.\n * Also handles both content based and schema based parameters.\n *\n * @param parameters - Unfiltered parameters\n * @param env - Environment variables flattened into a key-value object\n * @param exampleKey - The key of the current example\n * @returns A set of headers, cookies and url params\n */\nexport const buildRequestParameters = (\n /** All parameters */\n parameters: ReferenceType<ParameterObject>[] = [],\n /** Environment variables flattened into a key-value object */\n env: Record<string, string> = {},\n /** The key of the current example */\n exampleKey: string = 'default',\n): {\n cookies: XScalarCookie[]\n headers: Record<string, string>\n pathVariables: Record<string, string>\n allowReservedQueryParameters: Set<string>\n urlParams: URLSearchParams\n} => {\n const result = {\n cookies: [] as XScalarCookie[],\n headers: {} as Record<string, string>,\n pathVariables: {} as Record<string, string>,\n allowReservedQueryParameters: new Set<string>(),\n urlParams: new URLSearchParams(),\n }\n\n // Early return for empty parameters\n if (parameters.length === 0) {\n return result\n }\n\n // Second pass: process all parameters\n for (const referencedParam of parameters) {\n const param = getResolvedRef(referencedParam)\n const example = getExample(param, exampleKey, undefined)\n\n // Skip disabled examples\n if (!example || isParamDisabled(param, example)) {\n continue\n }\n\n /** Replace environment variables in the key and value */\n const replacedEnvValue = typeof example.value === 'string' ? replaceEnvVariables(example.value, env) : example.value\n\n /** De-serialize the example value if it is a string and matches the schema type */\n const deSerializedValue = deSerializeParameter(replacedEnvValue, param)\n const paramName = replaceEnvVariables(param.name, env)\n\n // Handle by parameter location\n switch (param.in) {\n case 'header': {\n // Filter out Content-Type header when it is multipart/form-data\n // The browser will automatically set this header with the proper boundary\n const lowerParamName = paramName.toLowerCase()\n if (lowerParamName === 'content-type' && deSerializedValue === 'multipart/form-data') {\n break\n }\n\n /** Headers only support simple style according to OpenAPI 3.1.1 */\n const serialized = serializeSimpleStyle(deSerializedValue, getExplode(param, false))\n\n // Remove undefined/null headers\n if (!isDefined(serialized)) {\n break\n }\n\n /** Headers can only be strings so we can cast numbers etc */\n const serializedString = String(serialized)\n\n // If the header already exists, append with comma\n if (result.headers[paramName]) {\n result.headers[paramName] = `${result.headers[paramName]},${serializedString}`\n } else {\n result.headers[paramName] = serializedString\n }\n break\n }\n\n case 'path': {\n // Path parameters use simple style by default\n const serialized = serializeSimpleStyle(deSerializedValue, getExplode(param, false))\n result.pathVariables[paramName] = encodeURIComponent(String(serialized))\n break\n }\n\n case 'query': {\n processQueryParameter(\n param,\n paramName,\n deSerializedValue,\n result.urlParams,\n result.allowReservedQueryParameters,\n )\n break\n }\n\n case 'cookie': {\n processCookieParameter(paramName, deSerializedValue, getExplode(param, true), result.cookies)\n break\n }\n }\n }\n\n return result\n}\n\n/** Ensure we only apply the correcet style to the correct types */\nconst getStyle = (param: ParameterObject, replacedValue: unknown): string => {\n if (!('style' in param) || !param.style) {\n return 'form'\n }\n\n // DeepObject can only apply to objects\n if (param.style === 'deepObject') {\n if (isObject(replacedValue)) {\n return 'deepObject'\n }\n return 'form'\n }\n\n return param.style\n}\n\n/** Whether the parameter allows reserved characters (from param or schema). */\nconst isAllowReserved = (param: ParameterObject): boolean => {\n if ('allowReserved' in param && param.allowReserved !== undefined) {\n return param.allowReserved\n }\n if ('schema' in param && param.schema && typeof param.schema === 'object' && 'allowReserved' in param.schema) {\n return (param.schema as { allowReserved?: boolean }).allowReserved === true\n }\n return false\n}\n\n/** When allowReserved is true, add keys to the set so reserved chars stay unescaped in the URL. */\nconst trackReservedKeys = (\n allowReservedQueryParameters: Set<string>,\n allowReserved: boolean,\n ...keys: string[]\n): void => {\n if (allowReserved) {\n for (const key of keys) {\n allowReservedQueryParameters.add(key)\n }\n }\n}\n\n/**\n * Helper function to process query parameters.\n * Extracted to reduce complexity in main function.\n */\nconst processQueryParameter = (\n param: ParameterObject,\n paramName: string,\n replacedValue: unknown,\n urlParams: URLSearchParams,\n allowReservedQueryParameters: Set<string>,\n): void => {\n /** If the parameter should be exploded, defaults to true for form style */\n const explodeParam = 'explode' in param && param.explode !== undefined ? param.explode : true\n const allowReserved = isAllowReserved(param)\n\n /** Style of the parameter, defaults to form */\n const style = getStyle(param, replacedValue)\n\n // Content type parameters should be serialized according to the parameter's own content type\n if ('content' in param && param.content) {\n // We grab the first for now but eventually we should support selecting the content type per parameter\n const paramContentType = Object.keys(param.content)[0] ?? 'application/json'\n const serializedValue = serializeContentValue(replacedValue, paramContentType)\n urlParams.set(paramName, serializedValue)\n trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName)\n return\n }\n\n // Handle deepObject style\n if (style === 'deepObject' && explodeParam) {\n const entries = serializeDeepObjectStyle(paramName, replacedValue)\n for (const entry of entries) {\n urlParams.append(entry.key, entry.value)\n trackReservedKeys(allowReservedQueryParameters, allowReserved, entry.key)\n }\n return\n }\n\n // Handle spaceDelimited style\n if (style === 'spaceDelimited') {\n const serialized = serializeSpaceDelimitedStyle(replacedValue)\n const existingValue = urlParams.get(paramName)\n urlParams.set(paramName, existingValue ? `${existingValue} ${serialized}` : serialized)\n trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName)\n return\n }\n\n // Handle pipeDelimited style\n if (style === 'pipeDelimited') {\n const serialized = serializePipeDelimitedStyle(replacedValue)\n const existingValue = urlParams.get(paramName)\n urlParams.set(paramName, existingValue ? `${existingValue}|${serialized}` : serialized)\n trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName)\n return\n }\n\n // Handle form style (default)\n const serialized = serializeFormStyle(replacedValue, explodeParam)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n // If key is empty, use paramName (for arrays)\n const key = entry.key || paramName\n urlParams.append(key, String(entry.value))\n trackReservedKeys(allowReservedQueryParameters, allowReserved, key)\n }\n } else {\n // Otherwise, convert to string for URLSearchParams\n urlParams.append(paramName, String(serialized))\n trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName)\n }\n}\n\n/**\n * Helper function to process cookie parameters.\n * Extracted to reduce complexity in main function.\n */\nconst processCookieParameter = (\n paramName: string,\n replacedValue: unknown,\n explode: boolean,\n cookies: XScalarCookie[],\n): void => {\n // Cookies only support form style according to OpenAPI 3.1.1\n const serialized = serializeFormStyleForCookies(replacedValue, explode)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || paramName\n cookies.push(\n coerceValue(xScalarCookieSchema, {\n name: key,\n value: String(entry.value),\n path: '/',\n }),\n )\n }\n } else {\n // Otherwise, convert to string for cookie value\n cookies.push(\n coerceValue(xScalarCookieSchema, {\n name: paramName,\n value: String(serialized),\n path: '/',\n }),\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,IAAM,cAAc,OAAwB,iBAC1C,aAAa,SAAS,MAAM,YAAY,KAAA,IAAY,MAAM,UAAU;;;;;;;;;;;;AAatE,IAAa,0BAEX,aAA+C,EAAE,EAEjD,MAA8B,EAAE,EAEhC,aAAqB,cAOlB;CACH,MAAM,SAAS;EACb,SAAS,EAAE;EACX,SAAS,EAAE;EACX,eAAe,EAAE;EACjB,8CAA8B,IAAI,KAAa;EAC/C,WAAW,IAAI,iBAAiB;EACjC;AAGD,KAAI,WAAW,WAAW,EACxB,QAAO;AAIT,MAAK,MAAM,mBAAmB,YAAY;EACxC,MAAM,QAAQ,eAAe,gBAAgB;EAC7C,MAAM,UAAU,WAAW,OAAO,YAAY,KAAA,EAAU;AAGxD,MAAI,CAAC,WAAW,gBAAgB,OAAO,QAAQ,CAC7C;;EAOF,MAAM,oBAAoB,qBAHD,OAAO,QAAQ,UAAU,WAAW,oBAAoB,QAAQ,OAAO,IAAI,GAAG,QAAQ,OAG9C,MAAM;EACvE,MAAM,YAAY,oBAAoB,MAAM,MAAM,IAAI;AAGtD,UAAQ,MAAM,IAAd;GACE,KAAK,UAAU;AAIb,QADuB,UAAU,aAAa,KACvB,kBAAkB,sBAAsB,sBAC7D;;IAIF,MAAM,aAAa,qBAAqB,mBAAmB,WAAW,OAAO,MAAM,CAAC;AAGpF,QAAI,CAAC,UAAU,WAAW,CACxB;;IAIF,MAAM,mBAAmB,OAAO,WAAW;AAG3C,QAAI,OAAO,QAAQ,WACjB,QAAO,QAAQ,aAAa,GAAG,OAAO,QAAQ,WAAW,GAAG;QAE5D,QAAO,QAAQ,aAAa;AAE9B;;GAGF,KAAK,QAAQ;IAEX,MAAM,aAAa,qBAAqB,mBAAmB,WAAW,OAAO,MAAM,CAAC;AACpF,WAAO,cAAc,aAAa,mBAAmB,OAAO,WAAW,CAAC;AACxE;;GAGF,KAAK;AACH,0BACE,OACA,WACA,mBACA,OAAO,WACP,OAAO,6BACR;AACD;GAGF,KAAK;AACH,2BAAuB,WAAW,mBAAmB,WAAW,OAAO,KAAK,EAAE,OAAO,QAAQ;AAC7F;;;AAKN,QAAO;;;AAIT,IAAM,YAAY,OAAwB,kBAAmC;AAC3E,KAAI,EAAE,WAAW,UAAU,CAAC,MAAM,MAChC,QAAO;AAIT,KAAI,MAAM,UAAU,cAAc;AAChC,MAAI,SAAS,cAAc,CACzB,QAAO;AAET,SAAO;;AAGT,QAAO,MAAM;;;AAIf,IAAM,mBAAmB,UAAoC;AAC3D,KAAI,mBAAmB,SAAS,MAAM,kBAAkB,KAAA,EACtD,QAAO,MAAM;AAEf,KAAI,YAAY,SAAS,MAAM,UAAU,OAAO,MAAM,WAAW,YAAY,mBAAmB,MAAM,OACpG,QAAQ,MAAM,OAAuC,kBAAkB;AAEzE,QAAO;;;AAIT,IAAM,qBACJ,8BACA,eACA,GAAG,SACM;AACT,KAAI,cACF,MAAK,MAAM,OAAO,KAChB,8BAA6B,IAAI,IAAI;;;;;;AAS3C,IAAM,yBACJ,OACA,WACA,eACA,WACA,iCACS;;CAET,MAAM,eAAe,aAAa,SAAS,MAAM,YAAY,KAAA,IAAY,MAAM,UAAU;CACzF,MAAM,gBAAgB,gBAAgB,MAAM;;CAG5C,MAAM,QAAQ,SAAS,OAAO,cAAc;AAG5C,KAAI,aAAa,SAAS,MAAM,SAAS;EAGvC,MAAM,kBAAkB,sBAAsB,eADrB,OAAO,KAAK,MAAM,QAAQ,CAAC,MAAM,mBACoB;AAC9E,YAAU,IAAI,WAAW,gBAAgB;AACzC,oBAAkB,8BAA8B,eAAe,UAAU;AACzE;;AAIF,KAAI,UAAU,gBAAgB,cAAc;EAC1C,MAAM,UAAU,yBAAyB,WAAW,cAAc;AAClE,OAAK,MAAM,SAAS,SAAS;AAC3B,aAAU,OAAO,MAAM,KAAK,MAAM,MAAM;AACxC,qBAAkB,8BAA8B,eAAe,MAAM,IAAI;;AAE3E;;AAIF,KAAI,UAAU,kBAAkB;EAC9B,MAAM,aAAa,6BAA6B,cAAc;EAC9D,MAAM,gBAAgB,UAAU,IAAI,UAAU;AAC9C,YAAU,IAAI,WAAW,gBAAgB,GAAG,cAAc,GAAG,eAAe,WAAW;AACvF,oBAAkB,8BAA8B,eAAe,UAAU;AACzE;;AAIF,KAAI,UAAU,iBAAiB;EAC7B,MAAM,aAAa,4BAA4B,cAAc;EAC7D,MAAM,gBAAgB,UAAU,IAAI,UAAU;AAC9C,YAAU,IAAI,WAAW,gBAAgB,GAAG,cAAc,GAAG,eAAe,WAAW;AACvF,oBAAkB,8BAA8B,eAAe,UAAU;AACzE;;CAIF,MAAM,aAAa,mBAAmB,eAAe,aAAa;AAGlE,KAAI,MAAM,QAAQ,WAAW,CAC3B,MAAK,MAAM,SAAS,YAAY;EAE9B,MAAM,MAAM,MAAM,OAAO;AACzB,YAAU,OAAO,KAAK,OAAO,MAAM,MAAM,CAAC;AAC1C,oBAAkB,8BAA8B,eAAe,IAAI;;MAEhE;AAEL,YAAU,OAAO,WAAW,OAAO,WAAW,CAAC;AAC/C,oBAAkB,8BAA8B,eAAe,UAAU;;;;;;;AAQ7E,IAAM,0BACJ,WACA,eACA,SACA,YACS;CAET,MAAM,aAAa,6BAA6B,eAAe,QAAQ;AAGvE,KAAI,MAAM,QAAQ,WAAW,CAC3B,MAAK,MAAM,SAAS,YAAY;EAC9B,MAAM,MAAM,MAAM,OAAO;AACzB,UAAQ,KACN,YAAY,qBAAqB;GAC/B,MAAM;GACN,OAAO,OAAO,MAAM,MAAM;GAC1B,MAAM;GACP,CAAC,CACH;;KAIH,SAAQ,KACN,YAAY,qBAAqB;EAC/B,MAAM;EACN,OAAO,OAAO,WAAW;EACzB,MAAM;EACP,CAAC,CACH"}
@@ -1,25 +0,0 @@
1
- import { type XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
2
- import type { SecurityRequirementObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
- import type { MergedSecuritySchemes } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/merge-security.js';
4
- import type { SecuritySchemeObjectSecret } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/secret-types';
5
- /**
6
- * Get the selected security schemes from security requirements.
7
- * Takes security requirement objects and resolves them to actual security scheme objects.
8
- */
9
- export declare const getSecuritySchemes: (securitySchemes: MergedSecuritySchemes, selectedSecurity: SecurityRequirementObject[]) => SecuritySchemeObjectSecret[];
10
- /**
11
- * Generates the headers, cookies and query params for selected security schemes
12
- * In the future we can add customization for where the security is applied
13
- */
14
- export declare const buildRequestSecurity: (
15
- /** Currently selected security for the current operation */
16
- selectedSecuritySchemes: SecuritySchemeObjectSecret[],
17
- /** Environment variables flattened into a key-value object */
18
- env?: Record<string, string>,
19
- /** Include this parameter to set the placeholder for empty tokens */
20
- emptyTokenPlaceholder?: string) => {
21
- headers: Record<string, string>;
22
- cookies: XScalarCookie[];
23
- urlParams: URLSearchParams;
24
- };
25
- //# sourceMappingURL=build-request-security.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8DAA8D,CAAA;AAG7G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAA;AAC1G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6DAA6D,CAAA;AAE7G;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,iBAAiB,qBAAqB,EACtC,kBAAkB,yBAAyB,EAAE,KAC5C,0BAA0B,EAUpB,CAAA;AAET;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,4DAA4D;AAC5D,yBAAyB,0BAA0B,EAAE;AACrD,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qEAAqE;AACrE,8BAA0B,KACzB;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAuDzF,CAAA"}
@@ -1,53 +0,0 @@
1
- import { encode } from "js-base64";
2
- import { isDefined } from "@scalar/helpers/array/is-defined";
3
- import { objectKeys } from "@scalar/helpers/object/object-keys";
4
- import { replaceEnvVariables } from "@scalar/helpers/regex/replace-variables";
5
- import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
6
- import { xScalarCookieSchema } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
7
- import { coerceValue } from "@scalar/workspace-store/schemas/typebox-coerce";
8
- //#region src/v2/blocks/operation-block/helpers/build-request-security.ts
9
- /**
10
- * Get the selected security schemes from security requirements.
11
- * Takes security requirement objects and resolves them to actual security scheme objects.
12
- */
13
- var getSecuritySchemes = (securitySchemes, selectedSecurity) => selectedSecurity.flatMap((scheme) => objectKeys(scheme).flatMap((key) => {
14
- const scheme = getResolvedRef(securitySchemes?.[key]);
15
- if (scheme) return scheme;
16
- return [];
17
- })) ?? [];
18
- /**
19
- * Generates the headers, cookies and query params for selected security schemes
20
- * In the future we can add customization for where the security is applied
21
- */
22
- var buildRequestSecurity = (selectedSecuritySchemes, env = {}, emptyTokenPlaceholder = "") => {
23
- const headers = {};
24
- const cookies = [];
25
- const urlParams = new URLSearchParams();
26
- selectedSecuritySchemes.forEach((scheme) => {
27
- if (scheme.type === "apiKey") {
28
- const name = replaceEnvVariables(scheme.name, env);
29
- const value = replaceEnvVariables(scheme["x-scalar-secret-token"], env) || emptyTokenPlaceholder;
30
- if (scheme.in === "header") headers[name] = value;
31
- if (scheme.in === "query") urlParams.append(name, value);
32
- if (scheme.in === "cookie") cookies.push(coerceValue(xScalarCookieSchema, {
33
- name,
34
- value,
35
- path: "/"
36
- }));
37
- }
38
- if (scheme.type === "http") if (scheme.scheme === "basic") {
39
- const value = `${replaceEnvVariables(scheme["x-scalar-secret-username"], env)}:${replaceEnvVariables(scheme["x-scalar-secret-password"], env)}`;
40
- headers["Authorization"] = `Basic ${value === ":" ? "username:password" : encode(value)}`;
41
- } else headers["Authorization"] = `Bearer ${replaceEnvVariables(scheme["x-scalar-secret-token"], env) || emptyTokenPlaceholder}`;
42
- if (scheme.type === "oauth2") headers["Authorization"] = `Bearer ${replaceEnvVariables(Object.values(scheme?.flows ?? {}).filter(isDefined).find((f) => f["x-scalar-secret-token"])?.["x-scalar-secret-token"] ?? "", env) || emptyTokenPlaceholder}`;
43
- });
44
- return {
45
- headers,
46
- cookies,
47
- urlParams
48
- };
49
- };
50
- //#endregion
51
- export { buildRequestSecurity, getSecuritySchemes };
52
-
53
- //# sourceMappingURL=build-request-security.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-request-security.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { objectKeys } from '@scalar/helpers/object/object-keys'\nimport { replaceEnvVariables } from '@scalar/helpers/regex/replace-variables'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n type XScalarCookie,\n xScalarCookieSchema,\n} from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\nimport type { SecurityRequirementObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { encode } from 'js-base64'\n\nimport type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block/helpers/merge-security'\nimport type { SecuritySchemeObjectSecret } from '@/v2/blocks/scalar-auth-selector-block/helpers/secret-types'\n\n/**\n * Get the selected security schemes from security requirements.\n * Takes security requirement objects and resolves them to actual security scheme objects.\n */\nexport const getSecuritySchemes = (\n securitySchemes: MergedSecuritySchemes,\n selectedSecurity: SecurityRequirementObject[],\n): SecuritySchemeObjectSecret[] =>\n selectedSecurity.flatMap((scheme) =>\n objectKeys(scheme).flatMap((key) => {\n const scheme = getResolvedRef(securitySchemes?.[key])\n if (scheme) {\n return scheme\n }\n\n return []\n }),\n ) ?? []\n\n/**\n * Generates the headers, cookies and query params for selected security schemes\n * In the future we can add customization for where the security is applied\n */\nexport const buildRequestSecurity = (\n /** Currently selected security for the current operation */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[],\n /** Environment variables flattened into a key-value object */\n env: Record<string, string> = {},\n /** Include this parameter to set the placeholder for empty tokens */\n emptyTokenPlaceholder = '',\n): { headers: Record<string, string>; cookies: XScalarCookie[]; urlParams: URLSearchParams } => {\n const headers: Record<string, string> = {}\n const cookies: XScalarCookie[] = []\n const urlParams = new URLSearchParams()\n\n selectedSecuritySchemes.forEach((scheme) => {\n // Api key\n if (scheme.type === 'apiKey') {\n const name = replaceEnvVariables(scheme.name, env)\n const value = replaceEnvVariables(scheme['x-scalar-secret-token'], env) || emptyTokenPlaceholder\n\n if (scheme.in === 'header') {\n headers[name] = value\n }\n if (scheme.in === 'query') {\n urlParams.append(name, value)\n }\n if (scheme.in === 'cookie') {\n cookies.push(\n coerceValue(xScalarCookieSchema, {\n name,\n value,\n path: '/',\n }),\n )\n }\n }\n\n // HTTP\n if (scheme.type === 'http') {\n if (scheme.scheme === 'basic') {\n const username = replaceEnvVariables(scheme['x-scalar-secret-username'], env)\n const password = replaceEnvVariables(scheme['x-scalar-secret-password'], env)\n const value = `${username}:${password}`\n\n headers['Authorization'] = `Basic ${value === ':' ? 'username:password' : encode(value)}`\n } else {\n const value = replaceEnvVariables(scheme['x-scalar-secret-token'], env)\n headers['Authorization'] = `Bearer ${value || emptyTokenPlaceholder}`\n }\n }\n\n // OAuth2\n if (scheme.type === 'oauth2') {\n const flows = Object.values(scheme?.flows ?? {})\n const token = replaceEnvVariables(\n flows.filter(isDefined).find((f) => f['x-scalar-secret-token'])?.['x-scalar-secret-token'] ?? '',\n env,\n )\n\n headers['Authorization'] = `Bearer ${token || emptyTokenPlaceholder}`\n }\n })\n\n return { headers, cookies, urlParams }\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAa,sBACX,iBACA,qBAEA,iBAAiB,SAAS,WACxB,WAAW,OAAO,CAAC,SAAS,QAAQ;CAClC,MAAM,SAAS,eAAe,kBAAkB,KAAK;AACrD,KAAI,OACF,QAAO;AAGT,QAAO,EAAE;EACT,CACH,IAAI,EAAE;;;;;AAMT,IAAa,wBAEX,yBAEA,MAA8B,EAAE,EAEhC,wBAAwB,OACsE;CAC9F,MAAM,UAAkC,EAAE;CAC1C,MAAM,UAA2B,EAAE;CACnC,MAAM,YAAY,IAAI,iBAAiB;AAEvC,yBAAwB,SAAS,WAAW;AAE1C,MAAI,OAAO,SAAS,UAAU;GAC5B,MAAM,OAAO,oBAAoB,OAAO,MAAM,IAAI;GAClD,MAAM,QAAQ,oBAAoB,OAAO,0BAA0B,IAAI,IAAI;AAE3E,OAAI,OAAO,OAAO,SAChB,SAAQ,QAAQ;AAElB,OAAI,OAAO,OAAO,QAChB,WAAU,OAAO,MAAM,MAAM;AAE/B,OAAI,OAAO,OAAO,SAChB,SAAQ,KACN,YAAY,qBAAqB;IAC/B;IACA;IACA,MAAM;IACP,CAAC,CACH;;AAKL,MAAI,OAAO,SAAS,OAClB,KAAI,OAAO,WAAW,SAAS;GAG7B,MAAM,QAAQ,GAFG,oBAAoB,OAAO,6BAA6B,IAAI,CAEnD,GADT,oBAAoB,OAAO,6BAA6B,IAAI;AAG7E,WAAQ,mBAAmB,SAAS,UAAU,MAAM,sBAAsB,OAAO,MAAM;QAGvF,SAAQ,mBAAmB,UADb,oBAAoB,OAAO,0BAA0B,IAAI,IACzB;AAKlD,MAAI,OAAO,SAAS,SAOlB,SAAQ,mBAAmB,UALb,oBADA,OAAO,OAAO,QAAQ,SAAS,EAAE,CAAC,CAExC,OAAO,UAAU,CAAC,MAAM,MAAM,EAAE,yBAAyB,GAAG,4BAA4B,IAC9F,IACD,IAE6C;GAEhD;AAEF,QAAO;EAAE;EAAS;EAAS;EAAW"}
@@ -1,46 +0,0 @@
1
- import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
- import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
3
- import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
4
- import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
5
- import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
6
- import { type ErrorResponse } from '../../../../libs/errors.js';
7
- import type { SecuritySchemeObjectSecret } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/secret-types';
8
- /**
9
- * Builds a fully configured Request object ready for execution.
10
- *
11
- * This function processes an OpenAPI operation and constructs a fetch-compatible
12
- * Request by resolving environment variables, applying security schemes, building
13
- * headers and cookies, handling proxy redirection, and preparing the request body.
14
- *
15
- * The function handles special cases like Electron environments and proxy usage
16
- * where custom cookie headers are required.
17
- *
18
- * @returns A tuple containing either an error or the request object with an abort controller
19
- */
20
- export declare const buildRequest: ({ environment, exampleKey, globalCookies, method, operation, path, proxyUrl, requestBodyCompositionSelection, server, selectedSecuritySchemes, }: {
21
- /** For environment variables in the inputs */
22
- environment: XScalarEnvironment;
23
- /** The key of the current example */
24
- exampleKey: string;
25
- /** Workspace + document cookies */
26
- globalCookies: XScalarCookie[];
27
- /** The HTTP method of the operation */
28
- method: HttpMethod;
29
- /** The operation object */
30
- operation: OperationObject;
31
- /** The path of the operation */
32
- path: string;
33
- /** The proxy URL for cookie domain determination */
34
- proxyUrl: string;
35
- /** Selected anyOf/oneOf request-body variants keyed by schema path */
36
- requestBodyCompositionSelection?: Record<string, number>;
37
- /** The server object */
38
- server: ServerObject | null;
39
- /** The selected security schemes for the current operation */
40
- selectedSecuritySchemes: SecuritySchemeObjectSecret[];
41
- }) => ErrorResponse<{
42
- controller: AbortController;
43
- request: Request;
44
- isUsingProxy: boolean;
45
- }>;
46
- //# sourceMappingURL=build-request.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAGnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAG5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAI1E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6DAA6D,CAAA;AAO7G;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,kJAW1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,sEAAsE;IACtE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxD,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,8DAA8D;IAC9D,uBAAuB,EAAE,0BAA0B,EAAE,CAAA;CACtD,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CA6GA,CAAA"}
@@ -1,102 +0,0 @@
1
- import { ERRORS, normalizeError } from "../../../../libs/errors.js";
2
- import { isElectron } from "../../../../libs/electron.js";
3
- import { buildRequestSecurity } from "./build-request-security.js";
4
- import { getEnvironmentVariables } from "./get-environment-variables.js";
5
- import { getResolvedUrl } from "./get-resolved-url.js";
6
- import { getDefaultHeaders } from "../../request-block/helpers/get-default-headers.js";
7
- import { buildRequestBody } from "./build-request-body.js";
8
- import { buildRequestCookieHeader } from "./build-request-cookie-header.js";
9
- import { buildRequestParameters } from "./build-request-parameters.js";
10
- import { redirectToProxy, shouldUseProxy } from "@scalar/helpers/url/redirect-to-proxy";
11
- import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
12
- import { canMethodHaveBody } from "@scalar/helpers/http/can-method-have-body";
13
- //#region src/v2/blocks/operation-block/helpers/build-request.ts
14
- /**
15
- * Builds a fully configured Request object ready for execution.
16
- *
17
- * This function processes an OpenAPI operation and constructs a fetch-compatible
18
- * Request by resolving environment variables, applying security schemes, building
19
- * headers and cookies, handling proxy redirection, and preparing the request body.
20
- *
21
- * The function handles special cases like Electron environments and proxy usage
22
- * where custom cookie headers are required.
23
- *
24
- * @returns A tuple containing either an error or the request object with an abort controller
25
- */
26
- var buildRequest = ({ environment, exampleKey = "default", globalCookies, method, operation, path, proxyUrl, requestBodyCompositionSelection, server, selectedSecuritySchemes }) => {
27
- try {
28
- const requestBody = getResolvedRef(operation.requestBody);
29
- /** Flatten the environment variables array into a key-value object */
30
- const env = getEnvironmentVariables(environment);
31
- /** Build out the request parameters */
32
- const params = buildRequestParameters(operation.parameters ?? [], env, exampleKey);
33
- const security = buildRequestSecurity(selectedSecuritySchemes, env);
34
- const defaultHeaders = getDefaultHeaders({
35
- method,
36
- operation,
37
- exampleKey,
38
- hideDisabledHeaders: true
39
- }).filter((header) => !header.isOverridden).reduce((acc, header) => {
40
- acc[header.name] = header.defaultValue;
41
- return acc;
42
- }, {});
43
- const headers = new Headers({
44
- ...defaultHeaders,
45
- ...params.headers,
46
- ...security.headers
47
- });
48
- const urlParams = new URLSearchParams([...params.urlParams, ...security.urlParams]);
49
- const body = canMethodHaveBody(method) ? buildRequestBody(requestBody, env, exampleKey, requestBodyCompositionSelection) : null;
50
- if (body && (body instanceof FormData || body instanceof URLSearchParams)) headers.delete("Content-Type");
51
- /** Combine the server url, path and url params into a single url */
52
- const url = getResolvedUrl({
53
- environment,
54
- server,
55
- path,
56
- pathVariables: params.pathVariables,
57
- allowReservedQueryParameters: params.allowReservedQueryParameters,
58
- urlParams
59
- });
60
- if (!url) throw ERRORS.URL_EMPTY;
61
- const isUsingProxy = shouldUseProxy(proxyUrl, url);
62
- const proxiedUrl = redirectToProxy(proxyUrl, url);
63
- const userAgentHeader = headers.get("User-Agent");
64
- if (isElectron() && userAgentHeader) headers.set("X-Scalar-User-Agent", userAgentHeader);
65
- /** Build out the cookies header */
66
- const cookiesHeader = buildRequestCookieHeader({
67
- paramCookies: [...params.cookies, ...security.cookies],
68
- globalCookies,
69
- env,
70
- originalCookieHeader: headers.get("Cookie"),
71
- url,
72
- useCustomCookieHeader: isElectron() || isUsingProxy,
73
- disabledGlobalCookies: operation["x-scalar-disable-parameters"]?.["global-cookies"]?.[exampleKey] ?? {}
74
- });
75
- if (cookiesHeader) headers.set(cookiesHeader.name, cookiesHeader.value);
76
- /** Controller to allow aborting the request */
77
- const controller = new AbortController();
78
- const isSseAcceptHeader = headers.get("Accept")?.toLowerCase().includes("text/event-stream") ?? false;
79
- const requestCacheMode = isSseAcceptHeader ? "no-store" : "default";
80
- if (isSseAcceptHeader) {
81
- headers.set("Cache-Control", "no-cache");
82
- headers.set("Pragma", "no-cache");
83
- }
84
- return [null, {
85
- controller,
86
- isUsingProxy,
87
- request: new Request(proxiedUrl, {
88
- method: method.toUpperCase(),
89
- headers,
90
- signal: controller.signal,
91
- body,
92
- cache: requestCacheMode
93
- })
94
- }];
95
- } catch (error) {
96
- return [normalizeError(error, ERRORS.BUILDING_REQUEST_FAILED), null];
97
- }
98
- };
99
- //#endregion
100
- export { buildRequest };
101
-
102
- //# sourceMappingURL=build-request.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-request.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"sourcesContent":["import { canMethodHaveBody } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { redirectToProxy, shouldUseProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\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 { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\n\nimport { isElectron } from '@/libs/electron'\nimport { ERRORS, type ErrorResponse, normalizeError } from '@/libs/errors'\nimport { getEnvironmentVariables } from '@/v2/blocks/operation-block/helpers/get-environment-variables'\nimport { getResolvedUrl } from '@/v2/blocks/operation-block/helpers/get-resolved-url'\nimport { getDefaultHeaders } from '@/v2/blocks/request-block/helpers/get-default-headers'\nimport type { SecuritySchemeObjectSecret } from '@/v2/blocks/scalar-auth-selector-block/helpers/secret-types'\n\nimport { buildRequestBody } from './build-request-body'\nimport { buildRequestCookieHeader } from './build-request-cookie-header'\nimport { buildRequestParameters } from './build-request-parameters'\nimport { buildRequestSecurity } from './build-request-security'\n\n/**\n * Builds a fully configured Request object ready for execution.\n *\n * This function processes an OpenAPI operation and constructs a fetch-compatible\n * Request by resolving environment variables, applying security schemes, building\n * headers and cookies, handling proxy redirection, and preparing the request body.\n *\n * The function handles special cases like Electron environments and proxy usage\n * where custom cookie headers are required.\n *\n * @returns A tuple containing either an error or the request object with an abort controller\n */\nexport const buildRequest = ({\n environment,\n exampleKey = 'default',\n globalCookies,\n method,\n operation,\n path,\n proxyUrl,\n requestBodyCompositionSelection,\n server,\n selectedSecuritySchemes,\n}: {\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The key of the current example */\n exampleKey: string\n /** Workspace + document cookies */\n globalCookies: XScalarCookie[]\n /** The HTTP method of the operation */\n method: HttpMethod\n /** The operation object */\n operation: OperationObject\n /** The path of the operation */\n path: string\n /** The proxy URL for cookie domain determination */\n proxyUrl: string\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n /** The server object */\n server: ServerObject | null\n /** The selected security schemes for the current operation */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n}): ErrorResponse<{\n controller: AbortController\n request: Request\n isUsingProxy: boolean\n}> => {\n try {\n const requestBody = getResolvedRef(operation.requestBody)\n\n /** Flatten the environment variables array into a key-value object */\n const env = getEnvironmentVariables(environment)\n /** Build out the request parameters */\n const params = buildRequestParameters(operation.parameters ?? [], env, exampleKey)\n const security = buildRequestSecurity(selectedSecuritySchemes, env)\n\n // Combine the headers, cookies and url params\n const defaultHeaders = getDefaultHeaders({ method, operation, exampleKey, hideDisabledHeaders: true })\n .filter((header) => !header.isOverridden)\n .reduce(\n (acc, header) => {\n acc[header.name] = header.defaultValue\n return acc\n },\n {} as Record<string, string>,\n )\n const headers = new Headers({ ...defaultHeaders, ...params.headers, ...security.headers })\n const urlParams = new URLSearchParams([...params.urlParams, ...security.urlParams])\n\n // If the method can have a body, build the request body, otherwise set it to null\n const body = canMethodHaveBody(method)\n ? buildRequestBody(requestBody, env, exampleKey, requestBodyCompositionSelection)\n : null\n\n if (body && (body instanceof FormData || body instanceof URLSearchParams)) {\n // Delete the Content-Type header so the browser will set it automatically based on the request body\n headers.delete('Content-Type')\n }\n\n /** Combine the server url, path and url params into a single url */\n const url = getResolvedUrl({\n environment,\n server,\n path,\n pathVariables: params.pathVariables,\n allowReservedQueryParameters: params.allowReservedQueryParameters,\n urlParams,\n })\n\n // Throw for no server or path\n if (!url) {\n throw ERRORS.URL_EMPTY\n }\n\n const isUsingProxy = shouldUseProxy(proxyUrl, url)\n const proxiedUrl = redirectToProxy(proxyUrl, url)\n\n // If we are running in Electron, we need to add a custom header\n // that's then forwarded as a `User-Agent` header.\n const userAgentHeader = headers.get('User-Agent')\n if (isElectron() && userAgentHeader) {\n headers.set('X-Scalar-User-Agent', userAgentHeader)\n }\n\n /** Build out the cookies header */\n const cookiesHeader = buildRequestCookieHeader({\n paramCookies: [...params.cookies, ...security.cookies],\n globalCookies,\n env,\n originalCookieHeader: headers.get('Cookie'),\n url,\n useCustomCookieHeader: isElectron() || isUsingProxy,\n disabledGlobalCookies: operation['x-scalar-disable-parameters']?.['global-cookies']?.[exampleKey] ?? {},\n })\n\n if (cookiesHeader) {\n headers.set(cookiesHeader.name, cookiesHeader.value)\n }\n\n /** Controller to allow aborting the request */\n const controller = new AbortController()\n const acceptHeader = headers.get('Accept')\n const isSseAcceptHeader = acceptHeader?.toLowerCase().includes('text/event-stream') ?? false\n const requestCacheMode: RequestCache = isSseAcceptHeader ? 'no-store' : 'default'\n\n if (isSseAcceptHeader) {\n headers.set('Cache-Control', 'no-cache')\n headers.set('Pragma', 'no-cache')\n }\n\n /** Build the js request object */\n const request = new Request(proxiedUrl, {\n /**\n * Ensure that all methods are uppercased (though only needed for patch)\n *\n * @see https://github.com/whatwg/fetch/issues/50\n */\n method: method.toUpperCase(),\n headers,\n signal: controller.signal,\n body,\n cache: requestCacheMode,\n })\n\n return [\n null,\n {\n controller,\n isUsingProxy,\n request,\n },\n ]\n } catch (error) {\n return [normalizeError(error, ERRORS.BUILDING_REQUEST_FAILED), null]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,gBAAgB,EAC3B,aACA,aAAa,WACb,eACA,QACA,WACA,MACA,UACA,iCACA,QACA,8BA0BI;AACJ,KAAI;EACF,MAAM,cAAc,eAAe,UAAU,YAAY;;EAGzD,MAAM,MAAM,wBAAwB,YAAY;;EAEhD,MAAM,SAAS,uBAAuB,UAAU,cAAc,EAAE,EAAE,KAAK,WAAW;EAClF,MAAM,WAAW,qBAAqB,yBAAyB,IAAI;EAGnE,MAAM,iBAAiB,kBAAkB;GAAE;GAAQ;GAAW;GAAY,qBAAqB;GAAM,CAAC,CACnG,QAAQ,WAAW,CAAC,OAAO,aAAa,CACxC,QACE,KAAK,WAAW;AACf,OAAI,OAAO,QAAQ,OAAO;AAC1B,UAAO;KAET,EAAE,CACH;EACH,MAAM,UAAU,IAAI,QAAQ;GAAE,GAAG;GAAgB,GAAG,OAAO;GAAS,GAAG,SAAS;GAAS,CAAC;EAC1F,MAAM,YAAY,IAAI,gBAAgB,CAAC,GAAG,OAAO,WAAW,GAAG,SAAS,UAAU,CAAC;EAGnF,MAAM,OAAO,kBAAkB,OAAO,GAClC,iBAAiB,aAAa,KAAK,YAAY,gCAAgC,GAC/E;AAEJ,MAAI,SAAS,gBAAgB,YAAY,gBAAgB,iBAEvD,SAAQ,OAAO,eAAe;;EAIhC,MAAM,MAAM,eAAe;GACzB;GACA;GACA;GACA,eAAe,OAAO;GACtB,8BAA8B,OAAO;GACrC;GACD,CAAC;AAGF,MAAI,CAAC,IACH,OAAM,OAAO;EAGf,MAAM,eAAe,eAAe,UAAU,IAAI;EAClD,MAAM,aAAa,gBAAgB,UAAU,IAAI;EAIjD,MAAM,kBAAkB,QAAQ,IAAI,aAAa;AACjD,MAAI,YAAY,IAAI,gBAClB,SAAQ,IAAI,uBAAuB,gBAAgB;;EAIrD,MAAM,gBAAgB,yBAAyB;GAC7C,cAAc,CAAC,GAAG,OAAO,SAAS,GAAG,SAAS,QAAQ;GACtD;GACA;GACA,sBAAsB,QAAQ,IAAI,SAAS;GAC3C;GACA,uBAAuB,YAAY,IAAI;GACvC,uBAAuB,UAAU,iCAAiC,oBAAoB,eAAe,EAAE;GACxG,CAAC;AAEF,MAAI,cACF,SAAQ,IAAI,cAAc,MAAM,cAAc,MAAM;;EAItD,MAAM,aAAa,IAAI,iBAAiB;EAExC,MAAM,oBADe,QAAQ,IAAI,SAAS,EACF,aAAa,CAAC,SAAS,oBAAoB,IAAI;EACvF,MAAM,mBAAiC,oBAAoB,aAAa;AAExE,MAAI,mBAAmB;AACrB,WAAQ,IAAI,iBAAiB,WAAW;AACxC,WAAQ,IAAI,UAAU,WAAW;;AAiBnC,SAAO,CACL,MACA;GACE;GACA;GACA,SAlBY,IAAI,QAAQ,YAAY;IAMtC,QAAQ,OAAO,aAAa;IAC5B;IACA,QAAQ,WAAW;IACnB;IACA,OAAO;IACR,CAAC;GAQC,CACF;UACM,OAAO;AACd,SAAO,CAAC,eAAe,OAAO,OAAO,wBAAwB,EAAE,KAAK"}
@@ -1,4 +0,0 @@
1
- import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
- /** Helper that de-serializes the example value based on the parameter type */
3
- export declare const deSerializeParameter: (example: unknown, param: ParameterObject) => any;
4
- //# sourceMappingURL=de-serialize-parameter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"de-serialize-parameter.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/de-serialize-parameter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAErE,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,EAAE,OAAO,eAAe,QAS5E,CAAA"}
@@ -1,41 +0,0 @@
1
- import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
- //#region src/v2/blocks/operation-block/helpers/de-serialize-parameter.ts
3
- /** Helper that de-serializes the example value based on the parameter type */
4
- var deSerializeParameter = (example, param) => {
5
- if ("content" in param) return deSerializeContentExample(example, Object.keys(param.content ?? {})[0] ?? "");
6
- if ("schema" in param) return deSerializeSchemaExample(example, param.schema);
7
- return example;
8
- };
9
- /** De-serialize the example value based on the content type */
10
- var deSerializeContentExample = (example, contentType) => {
11
- if (typeof example === "string" && contentType.includes("json")) try {
12
- return JSON.parse(example);
13
- } catch {}
14
- return example;
15
- };
16
- /** Create a set of all the types we wish to parse as JSON */
17
- var parseableTypesSet = new Set([
18
- "array",
19
- "object",
20
- "boolean",
21
- "number",
22
- "integer",
23
- "null"
24
- ]);
25
- /** De-serialize the example value based on the schema type */
26
- var deSerializeSchemaExample = (example, schema) => {
27
- const resolvedSchema = getResolvedRef(schema);
28
- if (typeof example === "string" && resolvedSchema && "type" in resolvedSchema) {
29
- const type = Array.isArray(resolvedSchema.type) ? resolvedSchema.type[0] : resolvedSchema.type;
30
- if (type && parseableTypesSet.has(type)) try {
31
- return JSON.parse(example);
32
- } catch {
33
- if (type === "array") return example.split(/,\s?/).filter((v) => v !== "");
34
- }
35
- }
36
- return example;
37
- };
38
- //#endregion
39
- export { deSerializeParameter };
40
-
41
- //# sourceMappingURL=de-serialize-parameter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"de-serialize-parameter.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/de-serialize-parameter.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ParameterWithSchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/** Helper that de-serializes the example value based on the parameter type */\nexport const deSerializeParameter = (example: unknown, param: ParameterObject) => {\n if ('content' in param) {\n return deSerializeContentExample(example, Object.keys(param.content ?? {})[0] ?? '')\n }\n if ('schema' in param) {\n return deSerializeSchemaExample(example, param.schema)\n }\n\n return example\n}\n\n/** De-serialize the example value based on the content type */\nconst deSerializeContentExample = (example: unknown, contentType: string) => {\n if (typeof example === 'string' && contentType.includes('json')) {\n try {\n return JSON.parse(example)\n } catch {\n // Ignore the error and return the original example\n }\n }\n return example\n}\n\n/** Create a set of all the types we wish to parse as JSON */\nconst parseableTypesSet = new Set(['array', 'object', 'boolean', 'number', 'integer', 'null'])\n\n/** De-serialize the example value based on the schema type */\nconst deSerializeSchemaExample = (example: unknown, schema: ParameterWithSchemaObject['schema']) => {\n const resolvedSchema = getResolvedRef(schema)\n\n if (typeof example === 'string' && resolvedSchema && 'type' in resolvedSchema) {\n const type = Array.isArray(resolvedSchema.type) ? resolvedSchema.type[0] : resolvedSchema.type\n\n if (type && parseableTypesSet.has(type)) {\n try {\n return JSON.parse(example)\n } catch {\n // For array types, fall back to splitting comma-separated values.\n // Users commonly enter array values as \"foo,bar\" or \"foo, bar\" in the UI\n // text field, which is not valid JSON. Per the OpenAPI spec, the default\n // serialization for query array parameters is style=form + explode=true,\n // meaning each value should be sent as a separate query parameter.\n if (type === 'array') {\n return example.split(/,\\s?/).filter((v) => v !== '')\n }\n // Ignore the error and return the original example for other types\n }\n }\n }\n\n return example\n}\n"],"mappings":";;;AAOA,IAAa,wBAAwB,SAAkB,UAA2B;AAChF,KAAI,aAAa,MACf,QAAO,0BAA0B,SAAS,OAAO,KAAK,MAAM,WAAW,EAAE,CAAC,CAAC,MAAM,GAAG;AAEtF,KAAI,YAAY,MACd,QAAO,yBAAyB,SAAS,MAAM,OAAO;AAGxD,QAAO;;;AAIT,IAAM,6BAA6B,SAAkB,gBAAwB;AAC3E,KAAI,OAAO,YAAY,YAAY,YAAY,SAAS,OAAO,CAC7D,KAAI;AACF,SAAO,KAAK,MAAM,QAAQ;SACpB;AAIV,QAAO;;;AAIT,IAAM,oBAAoB,IAAI,IAAI;CAAC;CAAS;CAAU;CAAW;CAAU;CAAW;CAAO,CAAC;;AAG9F,IAAM,4BAA4B,SAAkB,WAAgD;CAClG,MAAM,iBAAiB,eAAe,OAAO;AAE7C,KAAI,OAAO,YAAY,YAAY,kBAAkB,UAAU,gBAAgB;EAC7E,MAAM,OAAO,MAAM,QAAQ,eAAe,KAAK,GAAG,eAAe,KAAK,KAAK,eAAe;AAE1F,MAAI,QAAQ,kBAAkB,IAAI,KAAK,CACrC,KAAI;AACF,UAAO,KAAK,MAAM,QAAQ;UACpB;AAMN,OAAI,SAAS,QACX,QAAO,QAAQ,MAAM,OAAO,CAAC,QAAQ,MAAM,MAAM,GAAG;;;AAO5D,QAAO"}
@@ -1,14 +0,0 @@
1
- import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
2
- /**
3
- * Filter a global cookie to determine if it should be included with a request to the given URL.
4
- * - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.
5
- * - Returns false if the domain does not match.
6
- * - Returns false if the path is specified and does not match the URL pathname.
7
- * - Returns true otherwise.
8
- */
9
- export declare const filterGlobalCookie: ({ cookie, url, disabledGlobalCookies, }: {
10
- cookie: XScalarCookie;
11
- url: string;
12
- disabledGlobalCookies: Record<string, boolean>;
13
- }) => boolean;
14
- //# sourceMappingURL=filter-global-cookies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filter-global-cookies.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/filter-global-cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AAIxG;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,yCAIhC;IACD,MAAM,EAAE,aAAa,CAAA;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/C,KAAG,OAqBH,CAAA"}
@@ -1,20 +0,0 @@
1
- import { matchesDomain } from "../../../../libs/send-request/set-request-cookies.js";
2
- //#region src/v2/blocks/operation-block/helpers/filter-global-cookies.ts
3
- /**
4
- * Filter a global cookie to determine if it should be included with a request to the given URL.
5
- * - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.
6
- * - Returns false if the domain does not match.
7
- * - Returns false if the path is specified and does not match the URL pathname.
8
- * - Returns true otherwise.
9
- */
10
- var filterGlobalCookie = ({ cookie, url, disabledGlobalCookies }) => {
11
- if (cookie.isDisabled || disabledGlobalCookies[cookie.name.toLowerCase()] === true || !cookie.name) return false;
12
- const urlObject = new URL(url, "https://example.com");
13
- if (cookie.domain && !matchesDomain(url, cookie.domain)) return false;
14
- if (cookie.path && !urlObject.pathname.startsWith(cookie.path)) return false;
15
- return true;
16
- };
17
- //#endregion
18
- export { filterGlobalCookie };
19
-
20
- //# sourceMappingURL=filter-global-cookies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filter-global-cookies.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/filter-global-cookies.ts"],"sourcesContent":["import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\n\nimport { matchesDomain } from '@/libs/send-request/set-request-cookies'\n\n/**\n * Filter a global cookie to determine if it should be included with a request to the given URL.\n * - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.\n * - Returns false if the domain does not match.\n * - Returns false if the path is specified and does not match the URL pathname.\n * - Returns true otherwise.\n */\nexport const filterGlobalCookie = ({\n cookie,\n url,\n disabledGlobalCookies,\n}: {\n cookie: XScalarCookie\n url: string\n disabledGlobalCookies: Record<string, boolean>\n}): boolean => {\n // Filter out disabled cookies, those disabled globally, or those missing a name.\n if (cookie.isDisabled || disabledGlobalCookies[cookie.name.toLowerCase()] === true || !cookie.name) {\n return false\n }\n\n // Parse the URL to extract the pathname for path matching.\n const urlObject = new URL(url, 'https://example.com')\n\n // If a domain restriction exists, ensure the cookie is only sent for matching domains.\n if (cookie.domain && !matchesDomain(url, cookie.domain)) {\n return false\n }\n\n // If a path restriction exists, ensure the cookie is only sent for URLs with a matching prefix.\n if (cookie.path && !urlObject.pathname.startsWith(cookie.path)) {\n return false\n }\n\n // Cookie passed all checks; include it in the request.\n return true\n}\n"],"mappings":";;;;;;;;;AAWA,IAAa,sBAAsB,EACjC,QACA,KACA,4BAKa;AAEb,KAAI,OAAO,cAAc,sBAAsB,OAAO,KAAK,aAAa,MAAM,QAAQ,CAAC,OAAO,KAC5F,QAAO;CAIT,MAAM,YAAY,IAAI,IAAI,KAAK,sBAAsB;AAGrD,KAAI,OAAO,UAAU,CAAC,cAAc,KAAK,OAAO,OAAO,CACrD,QAAO;AAIT,KAAI,OAAO,QAAQ,CAAC,UAAU,SAAS,WAAW,OAAO,KAAK,CAC5D,QAAO;AAIT,QAAO"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Gets the delimiter for the given parameter style
3
- *
4
- * @param style - The style of the parameter
5
- * @returns The delimiter for the given style
6
- */
7
- export declare const getDelimiter: (style: string) => string;
8
- //# sourceMappingURL=get-delimiter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-delimiter.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-delimiter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,MAa5C,CAAA"}
@@ -1,9 +0,0 @@
1
- import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
2
- /**
3
- * Flattens the environment variables array into a key-value object.
4
- * If a variable value is a string, use it directly; otherwise, use its default value.
5
- *
6
- * @returns An object mapping variable names to their resolved values.
7
- */
8
- export declare const getEnvironmentVariables: (environment: XScalarEnvironment) => Record<string, string>;
9
- //# sourceMappingURL=get-environment-variables.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-environment-variables.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-environment-variables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAEnH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,aAAa,kBAAkB,2BAQtE,CAAA"}
@@ -1,17 +0,0 @@
1
- //#region src/v2/blocks/operation-block/helpers/get-environment-variables.ts
2
- /**
3
- * Flattens the environment variables array into a key-value object.
4
- * If a variable value is a string, use it directly; otherwise, use its default value.
5
- *
6
- * @returns An object mapping variable names to their resolved values.
7
- */
8
- var getEnvironmentVariables = (environment) => {
9
- return environment.variables.reduce((acc, curr) => {
10
- acc[curr.name] = typeof curr.value === "string" ? curr.value : curr.value.default;
11
- return acc;
12
- }, {});
13
- };
14
- //#endregion
15
- export { getEnvironmentVariables };
16
-
17
- //# sourceMappingURL=get-environment-variables.js.map