@scalar/api-client 3.19.2 → 3.20.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.
- package/CHANGELOG.md +64 -0
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
- package/dist/components/SectionFilter.vue.d.ts +2 -0
- package/dist/components/SectionFilter.vue.d.ts.map +1 -1
- package/dist/components/SectionFilter.vue.js +1 -1
- package/dist/components/SectionFilter.vue.js.map +1 -1
- package/dist/components/SectionFilter.vue.script.js +11 -8
- package/dist/components/SectionFilter.vue.script.js.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.d.ts.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.js.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.script.js +5 -3
- package/dist/components/Server/ServerVariablesSelect.vue.script.js.map +1 -1
- package/dist/components/Server/ServerVariablesTextbox.vue.d.ts.map +1 -1
- package/dist/components/Server/ServerVariablesTextbox.vue.js.map +1 -1
- package/dist/components/Server/ServerVariablesTextbox.vue.script.js +6 -3
- package/dist/components/Server/ServerVariablesTextbox.vue.script.js.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js +4 -2
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js +3 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js.map +1 -1
- package/dist/style.css +159 -135
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +10 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +46 -5
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +2 -0
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js +15 -8
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js +4 -2
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +4 -3
- package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +2 -0
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +51 -26
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +28 -8
- package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js +9 -3
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js +6 -4
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +3 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js +7 -5
- package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -2
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js +40 -7
- package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +12 -12
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +24 -20
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js +6 -4
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-rows.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +5 -4
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +2 -0
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +37 -13
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.d.ts +3 -3
- package/dist/v2/blocks/response-block/components/Headers.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.script.js +5 -3
- package/dist/v2/blocks/response-block/components/Headers.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js +3 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js +11 -3
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js +8 -6
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts +1 -0
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js +109 -56
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js +5 -3
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js +6 -3
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js +7 -5
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +4 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js +22 -14
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js +4 -2
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js +11 -6
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts +4 -0
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js +100 -0
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js.map +1 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.d.ts +13 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.js +97 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.js.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +3 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +42 -29
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +6 -6
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +7 -4
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +21 -16
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +7 -5
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js +7 -5
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +105 -40
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js +10 -8
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js +14 -9
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js +6 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js +3 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +40 -40
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts +108 -7
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +12 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js +8 -5
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts +3 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js +8 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts +3 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js +11 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts +19 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js +117 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +15 -11
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js +8 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +6 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +8 -6
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +4 -4
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.script.js +10 -10
- package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.d.ts +4 -4
- package/dist/v2/components/code-input/CodeInputLite.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.js.map +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.script.js +8 -5
- package/dist/v2/components/code-input/CodeInputLite.vue.script.js.map +1 -1
- package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts +4 -0
- package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/PillTooltipHost.vue.js.map +1 -1
- package/dist/v2/components/code-input/PillTooltipHost.vue.script.js +7 -3
- package/dist/v2/components/code-input/PillTooltipHost.vue.script.js.map +1 -1
- package/dist/v2/components/code-input/code-variable-widget.d.ts +3 -0
- package/dist/v2/components/code-input/code-variable-widget.d.ts.map +1 -1
- package/dist/v2/components/code-input/code-variable-widget.js +6 -3
- package/dist/v2/components/code-input/code-variable-widget.js.map +1 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts +0 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js +4 -2
- package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.script.js +5 -3
- package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js +12 -9
- package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.js.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.script.js +5 -3
- package/dist/v2/components/forms/ConfirmationForm.vue.script.js.map +1 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.d.ts.map +1 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.js.map +1 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.script.js +3 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
- package/dist/v2/components/modals/DeleteModal.vue.d.ts.map +1 -1
- package/dist/v2/components/modals/DeleteModal.vue.js.map +1 -1
- package/dist/v2/components/modals/DeleteModal.vue.script.js +3 -1
- package/dist/v2/components/modals/DeleteModal.vue.script.js.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.js.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.script.js +5 -2
- package/dist/v2/components/modals/ModalClientContainer.vue.script.js.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.js.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.script.js +9 -5
- package/dist/v2/components/server/ServerDropdown.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.script.js +4 -2
- package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.script.js +4 -2
- package/dist/v2/components/sidebar/SidebarMenu.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarToggle.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarToggle.vue.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarToggle.vue.script.js +4 -2
- package/dist/v2/components/sidebar/SidebarToggle.vue.script.js.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js +4 -2
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +2 -2
- package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/EnvironmentsList.vue.js.map +1 -1
- package/dist/v2/features/environments/EnvironmentsList.vue.script.js +4 -2
- package/dist/v2/features/environments/EnvironmentsList.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.js.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.script.js +12 -10
- package/dist/v2/features/environments/components/Environment.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js +5 -3
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js +9 -6
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +6 -4
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js +22 -10
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js.map +1 -1
- package/dist/v2/features/localization/index.d.ts +18 -0
- package/dist/v2/features/localization/index.d.ts.map +1 -0
- package/dist/v2/features/localization/index.js +35 -0
- package/dist/v2/features/localization/index.js.map +1 -0
- package/dist/v2/features/localization/locales/ar.d.ts +385 -0
- package/dist/v2/features/localization/locales/ar.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/ar.js +345 -0
- package/dist/v2/features/localization/locales/ar.js.map +1 -0
- package/dist/v2/features/localization/locales/de.d.ts +385 -0
- package/dist/v2/features/localization/locales/de.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/de.js +345 -0
- package/dist/v2/features/localization/locales/de.js.map +1 -0
- package/dist/v2/features/localization/locales/es.d.ts +385 -0
- package/dist/v2/features/localization/locales/es.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/es.js +345 -0
- package/dist/v2/features/localization/locales/es.js.map +1 -0
- package/dist/v2/features/localization/locales/fr.d.ts +385 -0
- package/dist/v2/features/localization/locales/fr.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/fr.js +345 -0
- package/dist/v2/features/localization/locales/fr.js.map +1 -0
- package/dist/v2/features/localization/locales/pt.d.ts +385 -0
- package/dist/v2/features/localization/locales/pt.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/pt.js +345 -0
- package/dist/v2/features/localization/locales/pt.js.map +1 -0
- package/dist/v2/features/localization/locales/ru.d.ts +385 -0
- package/dist/v2/features/localization/locales/ru.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/ru.js +345 -0
- package/dist/v2/features/localization/locales/ru.js.map +1 -0
- package/dist/v2/features/localization/locales/zh-cn.d.ts +385 -0
- package/dist/v2/features/localization/locales/zh-cn.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/zh-cn.js +345 -0
- package/dist/v2/features/localization/locales/zh-cn.js.map +1 -0
- package/dist/v2/features/localization/translations.d.ts +385 -0
- package/dist/v2/features/localization/translations.d.ts.map +1 -0
- package/dist/v2/features/localization/translations.js +345 -0
- package/dist/v2/features/localization/translations.js.map +1 -0
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js.map +1 -1
- package/dist/v2/features/modal/Modal.vue.script.js +17 -4
- package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
- package/dist/v2/features/modal/use-lazy-api-client.d.ts +11 -0
- package/dist/v2/features/modal/use-lazy-api-client.d.ts.map +1 -0
- package/dist/v2/features/modal/use-lazy-api-client.js +48 -0
- package/dist/v2/features/modal/use-lazy-api-client.js.map +1 -0
- package/dist/v2/features/operation/Operation.vue.d.ts +2 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js.map +1 -1
- package/dist/v2/features/operation/Operation.vue.script.js +50 -12
- package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +12 -8
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -1
- package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -1
- package/dist/v2/features/search/components/SearchResult.vue.js.map +1 -1
- package/dist/v2/features/search/components/SearchResult.vue.script.js +14 -10
- package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -1
- package/dist/v2/types/options.d.ts +1 -1
- package/dist/v2/types/options.d.ts.map +1 -1
- package/dist/v2/workspace-events.d.ts +2 -2
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +8 -1
- package/dist/v2/workspace-events.js.map +1 -1
- package/dist/vue-styles.css +124 -125
- package/package.json +22 -11
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocalization } from "../../features/localization/index.js";
|
|
1
2
|
import ViewLayoutSection_default from "../../../components/ViewLayout/ViewLayoutSection.vue.js";
|
|
2
3
|
import SectionFilter_default from "../../../components/SectionFilter.vue.js";
|
|
3
4
|
import { getStructuredBodyCodec } from "./helpers/structured-body-codec.js";
|
|
@@ -19,7 +20,7 @@ import { replaceEnvVariables } from "@scalar/helpers/regex/replace-variables";
|
|
|
19
20
|
import { unpackProxyObject } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
20
21
|
import { getUniqueExampleName } from "@scalar/workspace-store/navigation";
|
|
21
22
|
//#region src/v2/blocks/request-block/RequestBlock.vue?vue&type=script&setup=true&lang.ts
|
|
22
|
-
var _hoisted_1 = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
23
|
+
var _hoisted_1 = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:pe-24" };
|
|
23
24
|
var _hoisted_2 = ["for"];
|
|
24
25
|
var _hoisted_3 = [
|
|
25
26
|
"id",
|
|
@@ -31,8 +32,8 @@ var _hoisted_4 = {
|
|
|
31
32
|
class: "text-c-1 flex h-8 items-center"
|
|
32
33
|
};
|
|
33
34
|
var _hoisted_5 = ["id", "role"];
|
|
34
|
-
/** Base name for examples created by the "generate example from schema" button */
|
|
35
35
|
var GENERATED_EXAMPLE_NAME = "Generated from schema";
|
|
36
|
+
/** Operation metadata used across event emissions */
|
|
36
37
|
var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
37
38
|
__name: "RequestBlock",
|
|
38
39
|
props: {
|
|
@@ -47,6 +48,7 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
47
48
|
layout: {},
|
|
48
49
|
method: {},
|
|
49
50
|
operation: {},
|
|
51
|
+
sourceOperation: {},
|
|
50
52
|
path: {},
|
|
51
53
|
plugins: {},
|
|
52
54
|
proxyUrl: {},
|
|
@@ -62,7 +64,8 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
62
64
|
options: {}
|
|
63
65
|
},
|
|
64
66
|
setup(__props) {
|
|
65
|
-
|
|
67
|
+
const { translate } = useLocalization();
|
|
68
|
+
/** Base name for examples created by the "generate example from schema" button */
|
|
66
69
|
const meta = computed(() => ({
|
|
67
70
|
method: __props.method,
|
|
68
71
|
path: __props.path,
|
|
@@ -111,13 +114,18 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
111
114
|
};
|
|
112
115
|
};
|
|
113
116
|
/** Parameters grouped by type (path, query, header, cookie) */
|
|
114
|
-
const sections = computed(() => groupBy(__props.operation.parameters?.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
const sections = computed(() => groupBy(__props.operation.parameters?.flatMap((reference, index) => {
|
|
118
|
+
const param = getResolvedRef(reference);
|
|
119
|
+
if (!param) return [];
|
|
120
|
+
return createParameterRows(param, __props.exampleKey, {
|
|
121
|
+
hiddenValuePaths: param.in === "query" ? getHiddenValuePaths(param) : [],
|
|
122
|
+
renamedValuePaths: param.in === "query" ? getRenamedValuePaths(param) : []
|
|
123
|
+
}).map((row) => ({
|
|
124
|
+
...row,
|
|
125
|
+
originalParameter: getResolvedRef(__props.sourceOperation?.parameters?.[index]) ?? param,
|
|
126
|
+
in: param.in
|
|
127
|
+
}));
|
|
128
|
+
}) ?? [], "in", ({ in: _in, ...row }) => {
|
|
121
129
|
return row;
|
|
122
130
|
}));
|
|
123
131
|
const headersMap = computed(() => groupBy(sections.value.header?.map((it) => ({
|
|
@@ -255,7 +263,7 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
255
263
|
/** Get a sensible placeholder for the request name input */
|
|
256
264
|
const requestNamePlaceholder = computed(() => {
|
|
257
265
|
if (__props.operation.summary) return __props.operation.summary;
|
|
258
|
-
return __props.path.replace(REGEX.PROTOCOL, "") || "
|
|
266
|
+
return __props.path.replace(REGEX.PROTOCOL, "") || translate("apiClient.requestBlock.requestName");
|
|
259
267
|
});
|
|
260
268
|
/** Check if the section should be shown based on the selected filter */
|
|
261
269
|
const isSectionVisible = (section) => {
|
|
@@ -380,8 +388,17 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
380
388
|
payload,
|
|
381
389
|
meta: meta.value
|
|
382
390
|
});
|
|
391
|
+
const filterLabels = computed(() => ({
|
|
392
|
+
All: translate("apiClient.sectionFilter.all"),
|
|
393
|
+
Auth: translate("apiClient.sectionFilter.auth"),
|
|
394
|
+
Variables: translate("apiClient.sectionFilter.variables"),
|
|
395
|
+
Cookies: translate("apiClient.sectionFilter.cookies"),
|
|
396
|
+
Headers: translate("apiClient.sectionFilter.headers"),
|
|
397
|
+
Query: translate("apiClient.sectionFilter.query"),
|
|
398
|
+
Body: translate("apiClient.sectionFilter.body")
|
|
399
|
+
}));
|
|
383
400
|
return (_ctx, _cache) => {
|
|
384
|
-
return openBlock(), createBlock(ViewLayoutSection_default, { "aria-label":
|
|
401
|
+
return openBlock(), createBlock(ViewLayoutSection_default, { "aria-label": unref(translate)("apiClient.requestBlock.label", { name: __props.operation.summary ?? "" }) }, {
|
|
385
402
|
title: withCtx(() => [createElementVNode("div", _hoisted_1, [__props.layout !== "modal" ? (openBlock(), createElementBlock("label", {
|
|
386
403
|
key: 0,
|
|
387
404
|
class: "pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0",
|
|
@@ -397,11 +414,13 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
397
414
|
modelValue: selectedFilter.value,
|
|
398
415
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedFilter.value = $event),
|
|
399
416
|
filterIds: filterIds.value,
|
|
400
|
-
filters: filters.value
|
|
417
|
+
filters: filters.value,
|
|
418
|
+
labels: filterLabels.value
|
|
401
419
|
}, null, 8, [
|
|
402
420
|
"modelValue",
|
|
403
421
|
"filterIds",
|
|
404
|
-
"filters"
|
|
422
|
+
"filters",
|
|
423
|
+
"labels"
|
|
405
424
|
])]),
|
|
406
425
|
default: withCtx(() => [createElementVNode("div", {
|
|
407
426
|
id: filterIds.value.All,
|
|
@@ -422,7 +441,7 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
422
441
|
selectedSecurity: __props.selectedSecurity,
|
|
423
442
|
selectedSecuritySchemes: __props.selectedSecuritySchemes,
|
|
424
443
|
server: __props.server,
|
|
425
|
-
title: "
|
|
444
|
+
title: unref(translate)("apiClient.requestBlock.authentication")
|
|
426
445
|
}, null, 8, [
|
|
427
446
|
"id",
|
|
428
447
|
"createAnySecurityScheme",
|
|
@@ -436,7 +455,8 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
436
455
|
"securitySchemes",
|
|
437
456
|
"selectedSecurity",
|
|
438
457
|
"selectedSecuritySchemes",
|
|
439
|
-
"server"
|
|
458
|
+
"server",
|
|
459
|
+
"title"
|
|
440
460
|
]), [[vShow, isSectionVisible("Auth") && !isAuthHidden.value]]),
|
|
441
461
|
withDirectives(createVNode(RequestParams_default, mergeProps({
|
|
442
462
|
id: filterIds.value.Variables,
|
|
@@ -445,13 +465,14 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
445
465
|
exampleKey: __props.exampleKey,
|
|
446
466
|
rows: sections.value.path ?? [],
|
|
447
467
|
showAddRowPlaceholder: false,
|
|
448
|
-
title: "
|
|
468
|
+
title: unref(translate)("apiClient.requestBlock.variables")
|
|
449
469
|
}, toHandlers(parameterHandlers.value.path)), null, 16, [
|
|
450
470
|
"id",
|
|
451
471
|
"environment",
|
|
452
472
|
"eventBus",
|
|
453
473
|
"exampleKey",
|
|
454
|
-
"rows"
|
|
474
|
+
"rows",
|
|
475
|
+
"title"
|
|
455
476
|
]), [[vShow, isSectionVisible("Variables") && sections.value.path?.length]]),
|
|
456
477
|
withDirectives(createVNode(RequestParams_default, mergeProps({
|
|
457
478
|
id: filterIds.value.Cookies,
|
|
@@ -460,13 +481,14 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
460
481
|
exampleKey: __props.exampleKey,
|
|
461
482
|
rows: cookies.value ?? [],
|
|
462
483
|
showAddRowPlaceholder: true,
|
|
463
|
-
title: "
|
|
484
|
+
title: unref(translate)("apiClient.requestBlock.cookies")
|
|
464
485
|
}, toHandlers(parameterHandlers.value.cookie)), null, 16, [
|
|
465
486
|
"id",
|
|
466
487
|
"environment",
|
|
467
488
|
"eventBus",
|
|
468
489
|
"exampleKey",
|
|
469
|
-
"rows"
|
|
490
|
+
"rows",
|
|
491
|
+
"title"
|
|
470
492
|
]), [[vShow, isSectionVisible("Cookies")]]),
|
|
471
493
|
withDirectives(createVNode(RequestParams_default, mergeProps({
|
|
472
494
|
id: filterIds.value.Headers,
|
|
@@ -474,13 +496,14 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
474
496
|
eventBus: __props.eventBus,
|
|
475
497
|
exampleKey: __props.exampleKey,
|
|
476
498
|
rows: headers.value ?? [],
|
|
477
|
-
title: "
|
|
499
|
+
title: unref(translate)("apiClient.requestBlock.headers")
|
|
478
500
|
}, toHandlers(parameterHandlers.value.header)), null, 16, [
|
|
479
501
|
"id",
|
|
480
502
|
"environment",
|
|
481
503
|
"eventBus",
|
|
482
504
|
"exampleKey",
|
|
483
|
-
"rows"
|
|
505
|
+
"rows",
|
|
506
|
+
"title"
|
|
484
507
|
]), [[vShow, isSectionVisible("Headers")]]),
|
|
485
508
|
withDirectives(createVNode(RequestParams_default, mergeProps({
|
|
486
509
|
id: filterIds.value.Query,
|
|
@@ -488,13 +511,14 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
488
511
|
eventBus: __props.eventBus,
|
|
489
512
|
exampleKey: __props.exampleKey,
|
|
490
513
|
rows: sections.value.query ?? [],
|
|
491
|
-
title: "
|
|
514
|
+
title: unref(translate)("apiClient.requestBlock.queryParameters")
|
|
492
515
|
}, toHandlers(parameterHandlers.value.query)), null, 16, [
|
|
493
516
|
"id",
|
|
494
517
|
"environment",
|
|
495
518
|
"eventBus",
|
|
496
519
|
"exampleKey",
|
|
497
|
-
"rows"
|
|
520
|
+
"rows",
|
|
521
|
+
"title"
|
|
498
522
|
]), [[vShow, isSectionVisible("Query")]]),
|
|
499
523
|
withDirectives(createVNode(RequestBody_default, {
|
|
500
524
|
id: filterIds.value.Body,
|
|
@@ -503,7 +527,7 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
503
527
|
exampleKey: __props.exampleKey,
|
|
504
528
|
requestBody: unref(getResolvedRef)(__props.operation.requestBody),
|
|
505
529
|
requestBodyCompositionSelection: __props.requestBodyCompositionSelection,
|
|
506
|
-
title: "
|
|
530
|
+
title: unref(translate)("apiClient.requestBlock.requestBody"),
|
|
507
531
|
"onGenerate:example": handleGenerateExample,
|
|
508
532
|
"onUpdate:contentType": handleUpdateContentType,
|
|
509
533
|
"onUpdate:formValue": handleUpdateBodyFormValue,
|
|
@@ -514,7 +538,8 @@ var RequestBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
514
538
|
"environment",
|
|
515
539
|
"exampleKey",
|
|
516
540
|
"requestBody",
|
|
517
|
-
"requestBodyCompositionSelection"
|
|
541
|
+
"requestBodyCompositionSelection",
|
|
542
|
+
"title"
|
|
518
543
|
]), [[vShow, isSectionVisible("Body") && unref(canMethodHaveBody)(__props.method)]]),
|
|
519
544
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.plugins, (plugin, index) => {
|
|
520
545
|
return openBlock(), createBlock(unref(ScalarErrorBoundary), { key: index }, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/request-block/RequestBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ClientOptionGroup } from '@scalar/blocks/code-example'\nimport { ScalarErrorBoundary } from '@scalar/components/error-boundary'\nimport { canMethodHaveBody } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport { replaceEnvVariables } from '@scalar/helpers/regex/replace-variables'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport { getUniqueExampleName } from '@scalar/workspace-store/navigation'\nimport {\n filterGlobalCookie,\n getEnvironmentVariables,\n getResolvedUrl,\n getSchemaExampleFromBody,\n type MergedSecuritySchemes,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OpenApiDocument,\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref, useId, watch } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport RequestBody from '@/v2/blocks/request-block/components/RequestBody.vue'\nimport RequestCodeSnippet from '@/v2/blocks/request-block/components/RequestCodeSnippet.vue'\nimport RequestParams from '@/v2/blocks/request-block/components/RequestParams.vue'\nimport type { TableRow } from '@/v2/blocks/request-block/components/RequestTableRow.vue'\nimport { createParameterHandlers } from '@/v2/blocks/request-block/helpers/create-parameter-handlers'\nimport { createParameterRows } from '@/v2/blocks/request-block/helpers/create-parameter-rows'\nimport { groupBy } from '@/v2/blocks/request-block/helpers/group-by'\nimport { groupGlobalCookies } from '@/v2/blocks/request-block/helpers/group-global-cookies'\nimport { getStructuredBodyCodec } from '@/v2/blocks/request-block/helpers/structured-body-codec'\nimport { AuthSelector } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\n/** Base name for examples created by the \"generate example from schema\" button */\nconst GENERATED_EXAMPLE_NAME = 'Generated from schema'\n\ntype Filter =\n | 'All'\n | 'Auth'\n | 'Variables'\n | 'Cookies'\n | 'Headers'\n | 'Query'\n | 'Body'\n\nexport type RequestBlockProps = {\n authMeta: AuthMeta\n clientOptions: ClientOptionGroup[]\n environment: XScalarEnvironment\n eventBus: WorkspaceEventBus\n exampleKey: string\n workspaceCookies: XScalarCookie[]\n documentCookies: XScalarCookie[]\n /** Slug of the document the operation belongs to */\n documentSlug: string\n layout: ClientLayout\n method: HttpMethod\n operation: OperationObject\n path: string\n plugins: ClientPlugin[]\n proxyUrl: string\n securityRequirements: OpenApiDocument['security']\n securitySchemes: MergedSecuritySchemes\n requestBodyCompositionSelection?: Record<string, number>\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n selectedSecurity: SelectedSecurity\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n server: ServerObject | null\n defaultHeaders: Record<string, string>\n /** Initial view for structured request bodies, from the `x-scalar-default-request-body-view` document extension */\n defaultRequestBodyView?: 'form' | 'raw'\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n}\n\nconst {\n authMeta = { type: 'document' },\n clientOptions,\n environment,\n eventBus,\n exampleKey,\n workspaceCookies,\n documentCookies,\n documentSlug,\n layout,\n method,\n operation,\n path,\n plugins,\n proxyUrl,\n requestBodyCompositionSelection,\n securityRequirements,\n securitySchemes,\n selectedClient,\n selectedSecurity,\n selectedSecuritySchemes,\n server,\n defaultHeaders: autoGeneratedHeaders,\n defaultRequestBodyView = 'raw',\n} = defineProps<RequestBlockProps>()\n\n/** Operation metadata used across event emissions */\nconst meta = computed(() => ({\n method,\n path,\n exampleKey,\n}))\n\nconst deletedExpandedParameterPaths = ref<Record<string, string[][]>>({})\n\n/** Renamed expanded rows, tracked as old-schema-path -> typed-value-path per parameter. */\nconst renamedExpandedParameterPaths = ref<\n Record<string, { from: string[]; to: string[] }[]>\n>({})\n\nconst getExpandedParameterKey = (parameter: {\n in: string\n name: string\n}): string => `${parameter.in}:${parameter.name}`\n\nconst getHiddenValuePaths = (parameter: {\n in: string\n name: string\n}): string[][] =>\n deletedExpandedParameterPaths.value[getExpandedParameterKey(parameter)] ?? []\n\nconst getRenamedValuePaths = (parameter: {\n in: string\n name: string\n}): { from: string[]; to: string[] }[] =>\n renamedExpandedParameterPaths.value[getExpandedParameterKey(parameter)] ?? []\n\nconst pathsEqual = (a: string[], b: string[]): boolean =>\n a.length === b.length && a.every((segment, index) => segment === b[index])\n\n/**\n * Hides the schema path of an expanded row so it does not reappear as an empty suggestion. Used\n * both when a row is deleted and when its key is renamed (the old key should not pop back up).\n */\nconst hideExpandedRowPath = (row: TableRow): void => {\n if (!row.originalParameter || !row.sourceParameterValuePath) {\n return\n }\n\n const key = getExpandedParameterKey(row.originalParameter)\n deletedExpandedParameterPaths.value = {\n ...deletedExpandedParameterPaths.value,\n [key]: [\n ...(deletedExpandedParameterPaths.value[key] ?? []),\n row.sourceParameterValuePath,\n ],\n }\n}\n\n/**\n * Records that an expanded row was renamed from its current value path to the typed one, so the\n * read side can render the renamed key in the original property's slot instead of appending it to\n * the end of the table. Repeated renames of the same row stay anchored to the original schema path.\n */\nconst recordExpandedRowRename = (\n row: TableRow,\n newValuePath: string[],\n): void => {\n if (!row.originalParameter || !row.sourceParameterValuePath) {\n return\n }\n\n const from = row.sourceParameterValuePath\n const key = getExpandedParameterKey(row.originalParameter)\n const existing = renamedExpandedParameterPaths.value[key] ?? []\n\n // If this row was already renamed, the row's current path is the previous target. Re-anchor that\n // entry to the new target so a second rename does not create an orphaned mapping.\n const chained = existing.find((entry) => pathsEqual(entry.to, from))\n const next = chained\n ? existing.map((entry) =>\n entry === chained ? { from: entry.from, to: newValuePath } : entry,\n )\n : [...existing, { from, to: newValuePath }]\n\n renamedExpandedParameterPaths.value = {\n ...renamedExpandedParameterPaths.value,\n [key]: next,\n }\n}\n\n/** Parameters grouped by type (path, query, header, cookie) */\nconst sections = computed(() =>\n groupBy(\n operation.parameters\n ?.map((param) => getResolvedRef(param))\n .filter((param) => param !== undefined)\n .flatMap((param) =>\n createParameterRows(param, exampleKey, {\n hiddenValuePaths:\n param.in === 'query' ? getHiddenValuePaths(param) : [],\n renamedValuePaths:\n param.in === 'query' ? getRenamedValuePaths(param) : [],\n }).map((row) => ({\n ...row,\n in: param.in,\n })),\n ) ?? [],\n 'in',\n ({ in: _in, ...row }) => {\n return row\n },\n ),\n)\n\n// Generate a reverse map for fast lookup of headers by the name\nconst headersMap = computed(() =>\n groupBy(\n sections.value.header?.map((it) => ({\n ...it,\n name: it.name.toLowerCase(),\n })) ?? [],\n 'name',\n ),\n)\n\nconst defaultHeaders = computed(() => {\n const disableParameters =\n operation['x-scalar-disable-parameters']?.['default-headers']?.[\n exampleKey\n ] ?? {}\n\n const isOverridden = (name: string) => {\n const header = headersMap.value[name.toLowerCase()]?.[0]\n\n if (!header) {\n return false\n }\n\n return !header.isDisabled\n }\n\n return Object.entries(autoGeneratedHeaders).map(([name, value]) => {\n return {\n name,\n value,\n schema: undefined,\n isOverridden: isOverridden(name),\n isReadonly: true,\n isDisabled: disableParameters[name.toLowerCase()] ?? false,\n } satisfies TableRow\n })\n})\n\nconst headers = computed(() => [\n ...defaultHeaders.value,\n ...(sections.value.header ?? []),\n])\n\n/** Resolved request URL, used to filter global cookies by their domain and path. */\nconst requestCookieUrl = computed(() => {\n const environmentVariables = getEnvironmentVariables(environment)\n const resolvedUrl = getResolvedUrl({ server, path })\n return replaceEnvVariables(resolvedUrl, environmentVariables)\n})\n\n/**\n * Global cookies grouped by name. Same-named cookies collapse into a single logical cookie so\n * duplicate names no longer share one disabled state (which made toggling one toggle them all).\n * A name with multiple values becomes a preset the user can switch between.\n */\nconst globalCookieGroups = computed(() =>\n groupGlobalCookies({\n sources: [\n { location: 'workspace', cookies: workspaceCookies },\n { location: 'document', cookies: documentCookies },\n ],\n // Keep domain/path filtering but ignore the disabled flag, so a disabled preset value stays\n // selectable in the switcher (it is only hidden from the request, not from the dropdown).\n shouldInclude: (cookie) =>\n filterGlobalCookie({\n cookie: { ...cookie, isDisabled: false },\n url: requestCookieUrl.value,\n disabledGlobalCookies: {},\n }),\n }),\n)\n\nconst defaultCookies = computed<TableRow[]>(() => {\n const disabledGlobalCookies =\n operation['x-scalar-disable-parameters']?.['global-cookies']?.[\n exampleKey\n ] ?? {}\n\n return globalCookieGroups.value.map((group) => ({\n name: group.name,\n value: group.selectedValue,\n globalRoute: { page: group.location, path: 'cookies' } as const,\n isReadonly: true,\n isDisabled: disabledGlobalCookies[group.name.toLowerCase()] ?? false,\n presetOptions: group.isPreset ? group.options : undefined,\n }))\n})\n\n/**\n * Switch a grouped global cookie preset to the chosen value by enabling the matching sibling and\n * disabling the rest. Selection is written back to the source `x-scalar-cookies` list so it\n * persists, and the send path drops disabled cookies, so only the selected value is sent.\n */\nconst handleSelectCookiePreset = (index: number, value: string): void => {\n const group = globalCookieGroups.value[index]\n if (!group) {\n return\n }\n\n for (const sibling of group.siblings) {\n eventBus.emit('cookie:upsert:cookie', {\n collectionType: sibling.location,\n index: sibling.index,\n payload: { isDisabled: sibling.value !== value },\n })\n }\n}\n\nconst cookies = computed(() => [\n ...(defaultCookies.value ?? []),\n ...(sections.value.cookie ?? []),\n])\n\n/** Currently selected filter for the request sections */\nconst selectedFilter = ref<Filter>('All')\n\n/** Available operation sections */\nconst OPERATION_SECTIONS: readonly Filter[] = [\n 'Auth',\n 'Variables',\n 'Cookies',\n 'Headers',\n 'Query',\n 'Body',\n] as const\n\n/**\n * Pre-generated stable IDs for all possible filter sections.\n * These are created once at setup time to avoid regenerating IDs on re-render.\n */\nconst sectionIds: Record<Filter, string> = {\n All: useId(),\n Auth: useId(),\n Variables: useId(),\n Cookies: useId(),\n Headers: useId(),\n Query: useId(),\n Body: useId(),\n}\n\n/** Filters available based on operation state */\nconst filters = computed<Filter[]>(() => {\n const availableFilters = new Set<Filter>(['All', ...OPERATION_SECTIONS])\n\n if (!sections.value.path?.length) {\n availableFilters.delete('Variables')\n }\n if (!canMethodHaveBody(method)) {\n availableFilters.delete('Body')\n }\n if (isAuthHidden.value) {\n availableFilters.delete('Auth')\n }\n\n return [...availableFilters]\n})\n\n/**\n * Map available filters to their pre-generated stable IDs.\n * Only includes IDs for filters that are currently available.\n */\nconst filterIds = computed(() =>\n filters.value.reduce<Partial<Record<Filter, string>>>((ids, section) => {\n ids[section] = sectionIds[section]\n return ids\n }, {}),\n)\n\n/**\n * Hide auth selector in readonly mode when no security schemes are defined.\n * This keeps the UI clean when there are no authentication options available.\n */\nconst isAuthHidden = computed(\n () => layout === 'modal' && !Object.keys(securitySchemes ?? {}).length,\n)\n\n/**\n * Keep auth available for unauthenticated operations, but collapse it by default\n * in readonly modal layouts unless a requirement or manual selection exists.\n */\nconst isAuthDefaultOpen = computed(\n () =>\n layout !== 'modal' ||\n Boolean(\n securityRequirements?.length || selectedSecurity.selectedSchemes.length,\n ),\n)\n\n/** Get a sensible placeholder for the request name input */\nconst requestNamePlaceholder = computed(() => {\n if (operation.summary) {\n return operation.summary\n }\n const cleanPath = path.replace(REGEX.PROTOCOL, '')\n return cleanPath || 'Request Name'\n})\n\n/** Check if the section should be shown based on the selected filter */\nconst isSectionVisible = (section: Filter): boolean => {\n return selectedFilter.value === 'All' || selectedFilter.value === section\n}\n\n/**\n * Reset filter to 'All' if Body filter is selected but method changes to one that cannot have a body.\n * This prevents showing an empty Body section when switching methods.\n */\nwatch(\n () => method,\n (newMethod) => {\n if (selectedFilter.value === 'Body' && !canMethodHaveBody(newMethod)) {\n selectedFilter.value = 'All'\n }\n },\n)\n\n// Expanded-row bookkeeping is keyed by `in:name`, which is not unique across operations or\n// examples. Reset both maps when the operation or example changes so stale delete/rename mappings\n// do not leak onto another request that happens to share a query parameter name.\nwatch(\n () => [method, path, exampleKey],\n () => {\n deletedExpandedParameterPaths.value = {}\n renamedExpandedParameterPaths.value = {}\n },\n)\n\n/** Handle operation summary updates */\nconst handleSummaryUpdate = (event: Event): void => {\n if (!(event.target instanceof HTMLInputElement)) {\n return\n }\n const summary = event.target.value\n eventBus.emit('operation:update:meta', {\n meta: meta.value,\n payload: { summary: summary.trim() },\n })\n}\n\n/** Parameter handlers */\nconst parameterHandlers = computed(() => ({\n path: createParameterHandlers('path', eventBus, meta.value, {\n context: sections.value.path ?? [],\n }),\n cookie: {\n ...createParameterHandlers('cookie', eventBus, meta.value, {\n context: cookies.value ?? [],\n globalParameters: defaultCookies.value.length,\n }),\n selectPreset: handleSelectCookiePreset,\n },\n header: createParameterHandlers('header', eventBus, meta.value, {\n context: headers.value,\n defaultParameters: defaultHeaders.value.length,\n }),\n query: createParameterHandlers('query', eventBus, meta.value, {\n context: sections.value.query ?? [],\n onDeleteExpandedRow: hideExpandedRowPath,\n onRenameExpandedRow: recordExpandedRowRename,\n }),\n}))\n\n/** Handle request body content type update */\nconst handleUpdateContentType = (payload: { value: string }): void =>\n eventBus.emit('operation:update:requestBody:contentType', {\n payload: { contentType: payload.value },\n meta: meta.value,\n })\n\n/** Handle request body value update */\nconst handleUpdateBodyValue = ({\n payload,\n contentType,\n}: Pick<\n ApiReferenceEvents['operation:update:requestBody:value'],\n 'payload' | 'contentType'\n>): void => {\n const debounceKey =\n typeof payload === 'string'\n ? `update:requestBody:value-${contentType}`\n : undefined\n\n eventBus.emit(\n 'operation:update:requestBody:value',\n {\n payload,\n contentType,\n meta: meta.value,\n },\n {\n debounceKey,\n },\n )\n}\n\n/** Handle request body value update */\nconst handleUpdateBodyFormValue = ({\n payload,\n contentType,\n}: Pick<\n ApiReferenceEvents['operation:update:requestBody:formValue'],\n 'payload' | 'contentType'\n>): void => {\n const debounceKey = `update:requestBody:${contentType}-form-value`\n\n eventBus.emit(\n 'operation:update:requestBody:formValue',\n {\n payload: payload.map((row) => unpackProxyObject(row, { depth: 1 })),\n contentType,\n meta: meta.value,\n },\n {\n debounceKey,\n },\n )\n}\n\n/**\n * Create a new example seeded with values generated from the request body schema.\n *\n * Custom examples in the document otherwise hide the auto-generated fields entirely. Rather than\n * only rendering the generated body, we write it into a fresh example so the user can edit it and\n * so it survives an export of the document.\n */\nconst handleGenerateExample = ({\n contentType,\n}: {\n contentType: string\n}): void => {\n const requestBody = getResolvedRef(operation.requestBody)\n const codec = getStructuredBodyCodec(contentType)\n if (!requestBody || !codec) {\n return\n }\n\n const value = getSchemaExampleFromBody(\n requestBody,\n contentType,\n requestBodyCompositionSelection,\n )\n\n // A schema that generates nothing writable would leave the user on an empty new example.\n if (value === undefined || value === null) {\n return\n }\n\n const exampleName = getUniqueExampleName(operation, GENERATED_EXAMPLE_NAME)\n const exampleMeta = { path, method, exampleKey: exampleName }\n\n eventBus.emit('operation:create:draft-example', {\n documentName: documentSlug,\n meta: { path, method },\n exampleName,\n })\n\n // Carry over the content type the user was looking at, otherwise the new example opens on\n // whichever content type happens to come first on the request body.\n eventBus.emit('operation:update:requestBody:contentType', {\n payload: { contentType },\n meta: exampleMeta,\n })\n\n eventBus.emit('operation:update:requestBody:value', {\n payload: codec.stringify(value),\n contentType,\n meta: exampleMeta,\n })\n\n // The modal selects the example after its creation hook rebuilds the sidebar.\n if (layout === 'modal') {\n return\n }\n\n eventBus.emit('ui:navigate', {\n page: 'example',\n documentSlug,\n path,\n method,\n exampleName,\n })\n}\n\nconst labelRequestNameId = useId()\n\nconst globalCookies = computed(() => [...workspaceCookies, ...documentCookies])\n\n/** Allow updating the operation extensions for the plugins */\nconst updateOperationExtension = (\n payload: ApiReferenceEvents['operation:update:extension']['payload'],\n): void =>\n eventBus.emit('operation:update:extension', { payload, meta: meta.value })\n</script>\n<template>\n <ViewLayoutSection :aria-label=\"`Request: ${operation.summary}`\">\n <template #title>\n <div\n class=\"group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24\">\n <label\n v-if=\"layout !== 'modal'\"\n class=\"pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0\"\n :for=\"labelRequestNameId\" />\n <input\n v-if=\"layout !== 'modal'\"\n :id=\"labelRequestNameId\"\n class=\"text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25\"\n :placeholder=\"requestNamePlaceholder\"\n :value=\"operation.summary\"\n @blur=\"handleSummaryUpdate\" />\n <span\n v-else\n class=\"text-c-1 flex h-8 items-center\">\n {{ operation.summary }}\n </span>\n </div>\n <SectionFilter\n v-model=\"selectedFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </template>\n\n <div\n :id=\"filterIds.All\"\n class=\"request-section-content custom-scroll relative flex flex-1 flex-col\"\n :role=\"selectedFilter === 'All' ? 'tabpanel' : 'none'\">\n <!-- Auth Selector -->\n <AuthSelector\n v-show=\"isSectionVisible('Auth') && !isAuthHidden\"\n :id=\"filterIds.Auth\"\n :createAnySecurityScheme=\"layout !== 'modal'\"\n :defaultOpen=\"isAuthDefaultOpen\"\n :environment\n :eventBus\n :meta=\"authMeta\"\n :options\n :proxyUrl\n :securityRequirements\n :securitySchemes\n :selectedSecurity\n :selectedSecuritySchemes\n :server\n title=\"Authentication\" />\n\n <!-- Variables (Path Parameters) -->\n <RequestParams\n v-show=\"isSectionVisible('Variables') && sections.path?.length\"\n :id=\"filterIds.Variables\"\n :environment\n :eventBus\n :exampleKey\n :rows=\"sections.path ?? []\"\n :showAddRowPlaceholder=\"false\"\n title=\"Variables\"\n v-on=\"parameterHandlers.path\" />\n\n <!-- Cookies -->\n <RequestParams\n v-show=\"isSectionVisible('Cookies')\"\n :id=\"filterIds.Cookies\"\n :environment\n :eventBus\n :exampleKey\n :rows=\"cookies ?? []\"\n :showAddRowPlaceholder=\"true\"\n title=\"Cookies\"\n v-on=\"parameterHandlers.cookie\" />\n\n <!-- Headers -->\n <RequestParams\n v-show=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n :environment\n :eventBus\n :exampleKey\n :rows=\"headers ?? []\"\n title=\"Headers\"\n v-on=\"parameterHandlers.header\" />\n\n <!-- Query Parameters -->\n <RequestParams\n v-show=\"isSectionVisible('Query')\"\n :id=\"filterIds.Query\"\n :environment\n :eventBus\n :exampleKey\n :rows=\"sections.query ?? []\"\n title=\"Query Parameters\"\n v-on=\"parameterHandlers.query\" />\n\n <!-- Request Body -->\n <RequestBody\n v-show=\"isSectionVisible('Body') && canMethodHaveBody(method)\"\n :id=\"filterIds.Body\"\n :defaultView=\"defaultRequestBodyView\"\n :environment\n :exampleKey\n :requestBody=\"getResolvedRef(operation.requestBody)\"\n :requestBodyCompositionSelection\n title=\"Request Body\"\n @generate:example=\"handleGenerateExample\"\n @update:contentType=\"handleUpdateContentType\"\n @update:formValue=\"handleUpdateBodyFormValue\"\n @update:value=\"handleUpdateBodyValue\" />\n\n <!-- Inject request section plugin components -->\n <ScalarErrorBoundary\n v-for=\"(plugin, index) in plugins\"\n :key=\"index\">\n <component\n :is=\"plugin.components.request.component\"\n v-if=\"plugin?.components?.request\"\n v-show=\"selectedFilter === 'All'\"\n :operation\n v-bind=\"plugin.components.request.additionalProps\"\n @operation:update:extension=\"updateOperationExtension\" />\n </ScalarErrorBoundary>\n\n <!-- Spacer -->\n <div class=\"flex grow\" />\n <!-- Code Snippet -->\n <RequestCodeSnippet\n v-show=\"selectedFilter === 'All'\"\n :clientOptions\n :eventBus\n :globalCookies\n integration=\"client\"\n :method\n :operation\n :path\n :securitySchemes=\"selectedSecuritySchemes\"\n :selectedClient\n :selectedContentType=\"\n getResolvedRef(operation.requestBody)?.[\n 'x-scalar-selected-content-type'\n ]?.[exampleKey]\n \"\n :selectedServer=\"server ?? undefined\" />\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.request-section-content {\n --scalar-border-width: 0.5px;\n}\n.request-section-content-filter {\n box-shadow: 0 -10px 0 10px var(--scalar-background-1);\n}\n.request-item:focus-within .request-meta-buttons {\n opacity: 1;\n}\n.group-hover-input {\n border-width: var(--scalar-border-width);\n border-color: transparent;\n}\n.group:hover .group-hover-input {\n background: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n border-color: var(--scalar-border-color);\n}\n.group-hover-input:focus {\n background: transparent !important;\n border-color: var(--scalar-border-color) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoE/B,MAAM,OAAO,gBAAgB;GAC3B,QAAK,QAAA;GACL,MAAG,QAAA;GACH,YAAS,QAAA;EACX,EAAE;EAEF,MAAM,gCAAgC,IAAgC,CAAC,CAAC;;EAGxE,MAAM,gCAAgC,IAEpC,CAAC,CAAC;EAEJ,MAAM,2BAA2B,cAGnB,GAAG,UAAU,GAAG,GAAG,UAAU;EAE3C,MAAM,uBAAuB,cAI3B,8BAA8B,MAAM,wBAAwB,SAAS,MAAM,CAAC;EAE9E,MAAM,wBAAwB,cAI5B,8BAA8B,MAAM,wBAAwB,SAAS,MAAM,CAAC;EAE9E,MAAM,cAAc,GAAa,MAC/B,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,SAAS,UAAU,YAAY,EAAE,MAAM;;;;;EAM3E,MAAM,uBAAuB,QAAwB;GACnD,IAAI,CAAC,IAAI,qBAAqB,CAAC,IAAI,0BACjC;GAGF,MAAM,MAAM,wBAAwB,IAAI,iBAAiB;GACzD,8BAA8B,QAAQ;IACpC,GAAG,8BAA8B;KAChC,MAAM,CACL,GAAI,8BAA8B,MAAM,QAAQ,CAAC,GACjD,IAAI,wBACN;GACF;EACF;;;;;;EAOA,MAAM,2BACJ,KACA,iBACS;GACT,IAAI,CAAC,IAAI,qBAAqB,CAAC,IAAI,0BACjC;GAGF,MAAM,OAAO,IAAI;GACjB,MAAM,MAAM,wBAAwB,IAAI,iBAAiB;GACzD,MAAM,WAAW,8BAA8B,MAAM,QAAQ,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;MACjD,iCAAA,QAAA;MACD,OAAM;MACL,sBAAkB;MAClB,wBAAoB;MACpB,sBAAkB;MAClB,kBAAc;;;;;;;;kBAXP,iBAAgB,MAAA,KAAY,MAAA,iBAAA,CAAiB,CAAC,QAAA,MAAM,CAAA,CAAA,CAAA;uBAc9D,mBAUsB,UAAA,MAAA,WATM,QAAA,UAAlB,QAAQ,UAAK;0BADvB,YAUsB,MAAA,mBAAA,GAAA,EARnB,KAAK,MAAK,GAAA;+BAGH,QAAQ,YAAY,UAAA,gBAAA,UAAA,GAF5B,YAM2D,wBALpD,OAAO,WAAW,QAAQ,SAAS,GAD1C,WAM2D;;QAFxD,WAAA,QAAA;6BACO,OAAO,WAAW,QAAQ,iBAAe,EAChD,gCAA4B,yBAAwB,CAAA,GAAA,MAAA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,CAAA,OAH7C,eAAA,UAAc,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,IAAA,CAAA,CAAA;;;;+BAO1B,mBAAyB,OAAA,EAApB,OAAM,YAAW,GAAA,MAAA,EAAA;oBAEtB,YAgB0C,4BAAA;MAdvC,eAAA,QAAA;MACA,UAAA,QAAA;MACA,eAAA,cAAA;MACD,aAAY;MACX,QAAA,QAAA;MACA,WAAA,QAAA;MACA,MAAA,QAAA;MACA,iBAAiB,QAAA;MACjB,gBAAA,QAAA;MACA,qBAAgC,MAAA,cAAA,CAAc,CAAC,QAAA,UAAU,WAAW,CAAA,GAAA,iCAAA,GAAgE,QAAA;MAKpI,gBAAgB,QAAA,UAAU,KAAA;;;;;;;;;;;;kBAfnB,eAAA,UAAc,KAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"RequestBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/request-block/RequestBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ClientOptionGroup } from '@scalar/blocks/code-example'\nimport { ScalarErrorBoundary } from '@scalar/components/error-boundary'\nimport { canMethodHaveBody } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport { replaceEnvVariables } from '@scalar/helpers/regex/replace-variables'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport { getUniqueExampleName } from '@scalar/workspace-store/navigation'\nimport {\n filterGlobalCookie,\n getEnvironmentVariables,\n getResolvedUrl,\n getSchemaExampleFromBody,\n type MergedSecuritySchemes,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OpenApiDocument,\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref, useId, watch } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport RequestBody from '@/v2/blocks/request-block/components/RequestBody.vue'\nimport RequestCodeSnippet from '@/v2/blocks/request-block/components/RequestCodeSnippet.vue'\nimport RequestParams from '@/v2/blocks/request-block/components/RequestParams.vue'\nimport type { TableRow } from '@/v2/blocks/request-block/components/RequestTableRow.vue'\nimport { createParameterHandlers } from '@/v2/blocks/request-block/helpers/create-parameter-handlers'\nimport { createParameterRows } from '@/v2/blocks/request-block/helpers/create-parameter-rows'\nimport { groupBy } from '@/v2/blocks/request-block/helpers/group-by'\nimport { groupGlobalCookies } from '@/v2/blocks/request-block/helpers/group-global-cookies'\nimport { getStructuredBodyCodec } from '@/v2/blocks/request-block/helpers/structured-body-codec'\nimport { AuthSelector } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport { useLocalization } from '@/v2/features/localization'\nimport type { ClientLayout } from '@/v2/types/layout'\n\ntype Filter =\n | 'All'\n | 'Auth'\n | 'Variables'\n | 'Cookies'\n | 'Headers'\n | 'Query'\n | 'Body'\n\nexport type RequestBlockProps = {\n authMeta: AuthMeta\n clientOptions: ClientOptionGroup[]\n environment: XScalarEnvironment\n eventBus: WorkspaceEventBus\n exampleKey: string\n workspaceCookies: XScalarCookie[]\n documentCookies: XScalarCookie[]\n /** Slug of the document the operation belongs to */\n documentSlug: string\n layout: ClientLayout\n method: HttpMethod\n operation: OperationObject\n /** Operation before downloaded examples are overlaid, for parameter edit targets. */\n sourceOperation?: OperationObject\n path: string\n plugins: ClientPlugin[]\n proxyUrl: string\n securityRequirements: OpenApiDocument['security']\n securitySchemes: MergedSecuritySchemes\n requestBodyCompositionSelection?: Record<string, number>\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n selectedSecurity: SelectedSecurity\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n server: ServerObject | null\n defaultHeaders: Record<string, string>\n /** Initial view for structured request bodies, from the `x-scalar-default-request-body-view` document extension */\n defaultRequestBodyView?: 'form' | 'raw'\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n}\n\nconst {\n authMeta = { type: 'document' },\n clientOptions,\n environment,\n eventBus,\n exampleKey,\n workspaceCookies,\n documentCookies,\n documentSlug,\n layout,\n method,\n operation,\n sourceOperation,\n path,\n plugins,\n proxyUrl,\n requestBodyCompositionSelection,\n securityRequirements,\n securitySchemes,\n selectedClient,\n selectedSecurity,\n selectedSecuritySchemes,\n server,\n defaultHeaders: autoGeneratedHeaders,\n defaultRequestBodyView = 'raw',\n} = defineProps<RequestBlockProps>()\n\nconst { translate } = useLocalization()\n\n/** Base name for examples created by the \"generate example from schema\" button */\nconst GENERATED_EXAMPLE_NAME = 'Generated from schema'\n\n/** Operation metadata used across event emissions */\nconst meta = computed(() => ({\n method,\n path,\n exampleKey,\n}))\n\nconst deletedExpandedParameterPaths = ref<Record<string, string[][]>>({})\n\n/** Renamed expanded rows, tracked as old-schema-path -> typed-value-path per parameter. */\nconst renamedExpandedParameterPaths = ref<\n Record<string, { from: string[]; to: string[] }[]>\n>({})\n\nconst getExpandedParameterKey = (parameter: {\n in: string\n name: string\n}): string => `${parameter.in}:${parameter.name}`\n\nconst getHiddenValuePaths = (parameter: {\n in: string\n name: string\n}): string[][] =>\n deletedExpandedParameterPaths.value[getExpandedParameterKey(parameter)] ?? []\n\nconst getRenamedValuePaths = (parameter: {\n in: string\n name: string\n}): { from: string[]; to: string[] }[] =>\n renamedExpandedParameterPaths.value[getExpandedParameterKey(parameter)] ?? []\n\nconst pathsEqual = (a: string[], b: string[]): boolean =>\n a.length === b.length && a.every((segment, index) => segment === b[index])\n\n/**\n * Hides the schema path of an expanded row so it does not reappear as an empty suggestion. Used\n * both when a row is deleted and when its key is renamed (the old key should not pop back up).\n */\nconst hideExpandedRowPath = (row: TableRow): void => {\n if (!row.originalParameter || !row.sourceParameterValuePath) {\n return\n }\n\n const key = getExpandedParameterKey(row.originalParameter)\n deletedExpandedParameterPaths.value = {\n ...deletedExpandedParameterPaths.value,\n [key]: [\n ...(deletedExpandedParameterPaths.value[key] ?? []),\n row.sourceParameterValuePath,\n ],\n }\n}\n\n/**\n * Records that an expanded row was renamed from its current value path to the typed one, so the\n * read side can render the renamed key in the original property's slot instead of appending it to\n * the end of the table. Repeated renames of the same row stay anchored to the original schema path.\n */\nconst recordExpandedRowRename = (\n row: TableRow,\n newValuePath: string[],\n): void => {\n if (!row.originalParameter || !row.sourceParameterValuePath) {\n return\n }\n\n const from = row.sourceParameterValuePath\n const key = getExpandedParameterKey(row.originalParameter)\n const existing = renamedExpandedParameterPaths.value[key] ?? []\n\n // If this row was already renamed, the row's current path is the previous target. Re-anchor that\n // entry to the new target so a second rename does not create an orphaned mapping.\n const chained = existing.find((entry) => pathsEqual(entry.to, from))\n const next = chained\n ? existing.map((entry) =>\n entry === chained ? { from: entry.from, to: newValuePath } : entry,\n )\n : [...existing, { from, to: newValuePath }]\n\n renamedExpandedParameterPaths.value = {\n ...renamedExpandedParameterPaths.value,\n [key]: next,\n }\n}\n\n/** Parameters grouped by type (path, query, header, cookie) */\nconst sections = computed(() =>\n groupBy(\n operation.parameters?.flatMap((reference, index) => {\n const param = getResolvedRef(reference)\n if (!param) return []\n return createParameterRows(param, exampleKey, {\n hiddenValuePaths:\n param.in === 'query' ? getHiddenValuePaths(param) : [],\n renamedValuePaths:\n param.in === 'query' ? getRenamedValuePaths(param) : [],\n }).map((row) => ({\n ...row,\n // Overlays retain parameter order, but their downloaded values are read-only.\n originalParameter:\n getResolvedRef(sourceOperation?.parameters?.[index]) ?? param,\n in: param.in,\n }))\n }) ?? [],\n 'in',\n ({ in: _in, ...row }) => {\n return row\n },\n ),\n)\n\n// Generate a reverse map for fast lookup of headers by the name\nconst headersMap = computed(() =>\n groupBy(\n sections.value.header?.map((it) => ({\n ...it,\n name: it.name.toLowerCase(),\n })) ?? [],\n 'name',\n ),\n)\n\nconst defaultHeaders = computed(() => {\n const disableParameters =\n operation['x-scalar-disable-parameters']?.['default-headers']?.[\n exampleKey\n ] ?? {}\n\n const isOverridden = (name: string) => {\n const header = headersMap.value[name.toLowerCase()]?.[0]\n\n if (!header) {\n return false\n }\n\n return !header.isDisabled\n }\n\n return Object.entries(autoGeneratedHeaders).map(([name, value]) => {\n return {\n name,\n value,\n schema: undefined,\n isOverridden: isOverridden(name),\n isReadonly: true,\n isDisabled: disableParameters[name.toLowerCase()] ?? false,\n } satisfies TableRow\n })\n})\n\nconst headers = computed(() => [\n ...defaultHeaders.value,\n ...(sections.value.header ?? []),\n])\n\n/** Resolved request URL, used to filter global cookies by their domain and path. */\nconst requestCookieUrl = computed(() => {\n const environmentVariables = getEnvironmentVariables(environment)\n const resolvedUrl = getResolvedUrl({ server, path })\n return replaceEnvVariables(resolvedUrl, environmentVariables)\n})\n\n/**\n * Global cookies grouped by name. Same-named cookies collapse into a single logical cookie so\n * duplicate names no longer share one disabled state (which made toggling one toggle them all).\n * A name with multiple values becomes a preset the user can switch between.\n */\nconst globalCookieGroups = computed(() =>\n groupGlobalCookies({\n sources: [\n { location: 'workspace', cookies: workspaceCookies },\n { location: 'document', cookies: documentCookies },\n ],\n // Keep domain/path filtering but ignore the disabled flag, so a disabled preset value stays\n // selectable in the switcher (it is only hidden from the request, not from the dropdown).\n shouldInclude: (cookie) =>\n filterGlobalCookie({\n cookie: { ...cookie, isDisabled: false },\n url: requestCookieUrl.value,\n disabledGlobalCookies: {},\n }),\n }),\n)\n\nconst defaultCookies = computed<TableRow[]>(() => {\n const disabledGlobalCookies =\n operation['x-scalar-disable-parameters']?.['global-cookies']?.[\n exampleKey\n ] ?? {}\n\n return globalCookieGroups.value.map((group) => ({\n name: group.name,\n value: group.selectedValue,\n globalRoute: { page: group.location, path: 'cookies' } as const,\n isReadonly: true,\n isDisabled: disabledGlobalCookies[group.name.toLowerCase()] ?? false,\n presetOptions: group.isPreset ? group.options : undefined,\n }))\n})\n\n/**\n * Switch a grouped global cookie preset to the chosen value by enabling the matching sibling and\n * disabling the rest. Selection is written back to the source `x-scalar-cookies` list so it\n * persists, and the send path drops disabled cookies, so only the selected value is sent.\n */\nconst handleSelectCookiePreset = (index: number, value: string): void => {\n const group = globalCookieGroups.value[index]\n if (!group) {\n return\n }\n\n for (const sibling of group.siblings) {\n eventBus.emit('cookie:upsert:cookie', {\n collectionType: sibling.location,\n index: sibling.index,\n payload: { isDisabled: sibling.value !== value },\n })\n }\n}\n\nconst cookies = computed(() => [\n ...(defaultCookies.value ?? []),\n ...(sections.value.cookie ?? []),\n])\n\n/** Currently selected filter for the request sections */\nconst selectedFilter = ref<Filter>('All')\n\n/** Available operation sections */\nconst OPERATION_SECTIONS: readonly Filter[] = [\n 'Auth',\n 'Variables',\n 'Cookies',\n 'Headers',\n 'Query',\n 'Body',\n] as const\n\n/**\n * Pre-generated stable IDs for all possible filter sections.\n * These are created once at setup time to avoid regenerating IDs on re-render.\n */\nconst sectionIds: Record<Filter, string> = {\n All: useId(),\n Auth: useId(),\n Variables: useId(),\n Cookies: useId(),\n Headers: useId(),\n Query: useId(),\n Body: useId(),\n}\n\n/** Filters available based on operation state */\nconst filters = computed<Filter[]>(() => {\n const availableFilters = new Set<Filter>(['All', ...OPERATION_SECTIONS])\n\n if (!sections.value.path?.length) {\n availableFilters.delete('Variables')\n }\n if (!canMethodHaveBody(method)) {\n availableFilters.delete('Body')\n }\n if (isAuthHidden.value) {\n availableFilters.delete('Auth')\n }\n\n return [...availableFilters]\n})\n\n/**\n * Map available filters to their pre-generated stable IDs.\n * Only includes IDs for filters that are currently available.\n */\nconst filterIds = computed(() =>\n filters.value.reduce<Partial<Record<Filter, string>>>((ids, section) => {\n ids[section] = sectionIds[section]\n return ids\n }, {}),\n)\n\n/**\n * Hide auth selector in readonly mode when no security schemes are defined.\n * This keeps the UI clean when there are no authentication options available.\n */\nconst isAuthHidden = computed(\n () => layout === 'modal' && !Object.keys(securitySchemes ?? {}).length,\n)\n\n/**\n * Keep auth available for unauthenticated operations, but collapse it by default\n * in readonly modal layouts unless a requirement or manual selection exists.\n */\nconst isAuthDefaultOpen = computed(\n () =>\n layout !== 'modal' ||\n Boolean(\n securityRequirements?.length || selectedSecurity.selectedSchemes.length,\n ),\n)\n\n/** Get a sensible placeholder for the request name input */\nconst requestNamePlaceholder = computed(() => {\n if (operation.summary) {\n return operation.summary\n }\n const cleanPath = path.replace(REGEX.PROTOCOL, '')\n return cleanPath || translate('apiClient.requestBlock.requestName')\n})\n\n/** Check if the section should be shown based on the selected filter */\nconst isSectionVisible = (section: Filter): boolean => {\n return selectedFilter.value === 'All' || selectedFilter.value === section\n}\n\n/**\n * Reset filter to 'All' if Body filter is selected but method changes to one that cannot have a body.\n * This prevents showing an empty Body section when switching methods.\n */\nwatch(\n () => method,\n (newMethod) => {\n if (selectedFilter.value === 'Body' && !canMethodHaveBody(newMethod)) {\n selectedFilter.value = 'All'\n }\n },\n)\n\n// Expanded-row bookkeeping is keyed by `in:name`, which is not unique across operations or\n// examples. Reset both maps when the operation or example changes so stale delete/rename mappings\n// do not leak onto another request that happens to share a query parameter name.\nwatch(\n () => [method, path, exampleKey],\n () => {\n deletedExpandedParameterPaths.value = {}\n renamedExpandedParameterPaths.value = {}\n },\n)\n\n/** Handle operation summary updates */\nconst handleSummaryUpdate = (event: Event): void => {\n if (!(event.target instanceof HTMLInputElement)) {\n return\n }\n const summary = event.target.value\n eventBus.emit('operation:update:meta', {\n meta: meta.value,\n payload: { summary: summary.trim() },\n })\n}\n\n/** Parameter handlers */\nconst parameterHandlers = computed(() => ({\n path: createParameterHandlers('path', eventBus, meta.value, {\n context: sections.value.path ?? [],\n }),\n cookie: {\n ...createParameterHandlers('cookie', eventBus, meta.value, {\n context: cookies.value ?? [],\n globalParameters: defaultCookies.value.length,\n }),\n selectPreset: handleSelectCookiePreset,\n },\n header: createParameterHandlers('header', eventBus, meta.value, {\n context: headers.value,\n defaultParameters: defaultHeaders.value.length,\n }),\n query: createParameterHandlers('query', eventBus, meta.value, {\n context: sections.value.query ?? [],\n onDeleteExpandedRow: hideExpandedRowPath,\n onRenameExpandedRow: recordExpandedRowRename,\n }),\n}))\n\n/** Handle request body content type update */\nconst handleUpdateContentType = (payload: { value: string }): void =>\n eventBus.emit('operation:update:requestBody:contentType', {\n payload: { contentType: payload.value },\n meta: meta.value,\n })\n\n/** Handle request body value update */\nconst handleUpdateBodyValue = ({\n payload,\n contentType,\n}: Pick<\n ApiReferenceEvents['operation:update:requestBody:value'],\n 'payload' | 'contentType'\n>): void => {\n const debounceKey =\n typeof payload === 'string'\n ? `update:requestBody:value-${contentType}`\n : undefined\n\n eventBus.emit(\n 'operation:update:requestBody:value',\n {\n payload,\n contentType,\n meta: meta.value,\n },\n {\n debounceKey,\n },\n )\n}\n\n/** Handle request body value update */\nconst handleUpdateBodyFormValue = ({\n payload,\n contentType,\n}: Pick<\n ApiReferenceEvents['operation:update:requestBody:formValue'],\n 'payload' | 'contentType'\n>): void => {\n const debounceKey = `update:requestBody:${contentType}-form-value`\n\n eventBus.emit(\n 'operation:update:requestBody:formValue',\n {\n payload: payload.map((row) => unpackProxyObject(row, { depth: 1 })),\n contentType,\n meta: meta.value,\n },\n {\n debounceKey,\n },\n )\n}\n\n/**\n * Create a new example seeded with values generated from the request body schema.\n *\n * Custom examples in the document otherwise hide the auto-generated fields entirely. Rather than\n * only rendering the generated body, we write it into a fresh example so the user can edit it and\n * so it survives an export of the document.\n */\nconst handleGenerateExample = ({\n contentType,\n}: {\n contentType: string\n}): void => {\n const requestBody = getResolvedRef(operation.requestBody)\n const codec = getStructuredBodyCodec(contentType)\n if (!requestBody || !codec) {\n return\n }\n\n const value = getSchemaExampleFromBody(\n requestBody,\n contentType,\n requestBodyCompositionSelection,\n )\n\n // A schema that generates nothing writable would leave the user on an empty new example.\n if (value === undefined || value === null) {\n return\n }\n\n const exampleName = getUniqueExampleName(operation, GENERATED_EXAMPLE_NAME)\n const exampleMeta = { path, method, exampleKey: exampleName }\n\n eventBus.emit('operation:create:draft-example', {\n documentName: documentSlug,\n meta: { path, method },\n exampleName,\n })\n\n // Carry over the content type the user was looking at, otherwise the new example opens on\n // whichever content type happens to come first on the request body.\n eventBus.emit('operation:update:requestBody:contentType', {\n payload: { contentType },\n meta: exampleMeta,\n })\n\n eventBus.emit('operation:update:requestBody:value', {\n payload: codec.stringify(value),\n contentType,\n meta: exampleMeta,\n })\n\n // The modal selects the example after its creation hook rebuilds the sidebar.\n if (layout === 'modal') {\n return\n }\n\n eventBus.emit('ui:navigate', {\n page: 'example',\n documentSlug,\n path,\n method,\n exampleName,\n })\n}\n\nconst labelRequestNameId = useId()\n\nconst globalCookies = computed(() => [...workspaceCookies, ...documentCookies])\n\n/** Allow updating the operation extensions for the plugins */\nconst updateOperationExtension = (\n payload: ApiReferenceEvents['operation:update:extension']['payload'],\n): void =>\n eventBus.emit('operation:update:extension', { payload, meta: meta.value })\n\nconst filterLabels = computed(() => ({\n All: translate('apiClient.sectionFilter.all'),\n Auth: translate('apiClient.sectionFilter.auth'),\n Variables: translate('apiClient.sectionFilter.variables'),\n Cookies: translate('apiClient.sectionFilter.cookies'),\n Headers: translate('apiClient.sectionFilter.headers'),\n Query: translate('apiClient.sectionFilter.query'),\n Body: translate('apiClient.sectionFilter.body'),\n}))\n</script>\n<template>\n <ViewLayoutSection\n :aria-label=\"\n translate('apiClient.requestBlock.label', {\n name: operation.summary ?? '',\n })\n \">\n <template #title>\n <div\n class=\"group pointer-events-none flex flex-1 items-center gap-1 lg:pe-24\">\n <label\n v-if=\"layout !== 'modal'\"\n class=\"pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0\"\n :for=\"labelRequestNameId\" />\n <input\n v-if=\"layout !== 'modal'\"\n :id=\"labelRequestNameId\"\n class=\"text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25\"\n :placeholder=\"requestNamePlaceholder\"\n :value=\"operation.summary\"\n @blur=\"handleSummaryUpdate\" />\n <span\n v-else\n class=\"text-c-1 flex h-8 items-center\">\n {{ operation.summary }}\n </span>\n </div>\n <SectionFilter\n v-model=\"selectedFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\"\n :labels=\"filterLabels\" />\n </template>\n\n <div\n :id=\"filterIds.All\"\n class=\"request-section-content custom-scroll relative flex flex-1 flex-col\"\n :role=\"selectedFilter === 'All' ? 'tabpanel' : 'none'\">\n <!-- Auth Selector -->\n <AuthSelector\n v-show=\"isSectionVisible('Auth') && !isAuthHidden\"\n :id=\"filterIds.Auth\"\n :createAnySecurityScheme=\"layout !== 'modal'\"\n :defaultOpen=\"isAuthDefaultOpen\"\n :environment\n :eventBus\n :meta=\"authMeta\"\n :options\n :proxyUrl\n :securityRequirements\n :securitySchemes\n :selectedSecurity\n :selectedSecuritySchemes\n :server\n :title=\"translate('apiClient.requestBlock.authentication')\" />\n\n <!-- Variables (Path Parameters) -->\n <RequestParams\n v-show=\"isSectionVisible('Variables') && sections.path?.length\"\n :id=\"filterIds.Variables\"\n :environment\n :eventBus\n :exampleKey\n :rows=\"sections.path ?? []\"\n :showAddRowPlaceholder=\"false\"\n :title=\"translate('apiClient.requestBlock.variables')\"\n v-on=\"parameterHandlers.path\" />\n\n <!-- Cookies -->\n <RequestParams\n v-show=\"isSectionVisible('Cookies')\"\n :id=\"filterIds.Cookies\"\n :environment\n :eventBus\n :exampleKey\n :rows=\"cookies ?? []\"\n :showAddRowPlaceholder=\"true\"\n :title=\"translate('apiClient.requestBlock.cookies')\"\n v-on=\"parameterHandlers.cookie\" />\n\n <!-- Headers -->\n <RequestParams\n v-show=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n :environment\n :eventBus\n :exampleKey\n :rows=\"headers ?? []\"\n :title=\"translate('apiClient.requestBlock.headers')\"\n v-on=\"parameterHandlers.header\" />\n\n <!-- Query Parameters -->\n <RequestParams\n v-show=\"isSectionVisible('Query')\"\n :id=\"filterIds.Query\"\n :environment\n :eventBus\n :exampleKey\n :rows=\"sections.query ?? []\"\n :title=\"translate('apiClient.requestBlock.queryParameters')\"\n v-on=\"parameterHandlers.query\" />\n\n <!-- Request Body -->\n <RequestBody\n v-show=\"isSectionVisible('Body') && canMethodHaveBody(method)\"\n :id=\"filterIds.Body\"\n :defaultView=\"defaultRequestBodyView\"\n :environment\n :exampleKey\n :requestBody=\"getResolvedRef(operation.requestBody)\"\n :requestBodyCompositionSelection\n :title=\"translate('apiClient.requestBlock.requestBody')\"\n @generate:example=\"handleGenerateExample\"\n @update:contentType=\"handleUpdateContentType\"\n @update:formValue=\"handleUpdateBodyFormValue\"\n @update:value=\"handleUpdateBodyValue\" />\n\n <!-- Inject request section plugin components -->\n <ScalarErrorBoundary\n v-for=\"(plugin, index) in plugins\"\n :key=\"index\">\n <component\n :is=\"plugin.components.request.component\"\n v-if=\"plugin?.components?.request\"\n v-show=\"selectedFilter === 'All'\"\n :operation\n v-bind=\"plugin.components.request.additionalProps\"\n @operation:update:extension=\"updateOperationExtension\" />\n </ScalarErrorBoundary>\n\n <!-- Spacer -->\n <div class=\"flex grow\" />\n <!-- Code Snippet -->\n <RequestCodeSnippet\n v-show=\"selectedFilter === 'All'\"\n :clientOptions\n :eventBus\n :globalCookies\n integration=\"client\"\n :method\n :operation\n :path\n :securitySchemes=\"selectedSecuritySchemes\"\n :selectedClient\n :selectedContentType=\"\n getResolvedRef(operation.requestBody)?.[\n 'x-scalar-selected-content-type'\n ]?.[exampleKey]\n \"\n :selectedServer=\"server ?? undefined\" />\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.request-section-content {\n --scalar-border-width: 0.5px;\n}\n.request-section-content-filter {\n box-shadow: 0 -10px 0 10px var(--scalar-background-1);\n}\n.request-item:focus-within .request-meta-buttons {\n opacity: 1;\n}\n.group-hover-input {\n border-width: var(--scalar-border-width);\n border-color: transparent;\n}\n.group:hover .group-hover-input {\n background: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n border-color: var(--scalar-border-color);\n}\n.group-hover-input:focus {\n background: transparent !important;\n border-color: var(--scalar-border-color) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0HA,IAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAH/B,MAAM,EAAE,cAAc,gBAAgB;;EAMtC,MAAM,OAAO,gBAAgB;GAC3B,QAAK,QAAA;GACL,MAAG,QAAA;GACH,YAAS,QAAA;EACX,EAAE;EAEF,MAAM,gCAAgC,IAAgC,CAAC,CAAC;;EAGxE,MAAM,gCAAgC,I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v2/blocks/request-block/components/RequestBody.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestBody.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestBody.vue"],"names":[],"mappings":"AAqlBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,8DAA8D,CAAA;AAmBrE,KAAK,WAAW,GAAG;IACjB,mBAAmB;IACnB,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,sEAAsE;IACtE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxD;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;CAC7B,CAAC;AAm3BF,QAAA,MAAM,YAAY;;;;;;mBAl7BlB,CAzQQ;;;;;;;;;;;eAoVsC,MAAM;;;qBAuBF,MAAM;;;;;;;;mBAlGxD,CAzQQ;;;;;;;;;;;eAoVsC,MAAM;;;qBAuBF,MAAM;;kFAm1BtD,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
|
|
|
2
2
|
import RequestBody_vue_vue_type_script_setup_true_lang_default from "./RequestBody.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/v2/blocks/request-block/components/RequestBody.vue
|
|
5
|
-
var RequestBody_default = /*#__PURE__*/ _plugin_vue_export_helper_default(RequestBody_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var RequestBody_default = /*#__PURE__*/ _plugin_vue_export_helper_default(RequestBody_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-c8b034c3"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { RequestBody_default as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestBody.vue.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/components/RequestBody.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarCodeBlockCopy } from '@scalar/components/code-block'\nimport { ScalarCopyBackdrop } from '@scalar/components/copy'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarListbox } from '@scalar/components/listbox'\nimport { CONTENT_TYPES } from '@scalar/helpers/http/content-types'\nimport { parseMimeType } from '@scalar/helpers/http/mime-type'\nimport { isObject } from '@scalar/helpers/object/is-object'\nimport { objectEntries } from '@scalar/helpers/object/object-entries'\nimport { ScalarIconMagicWand } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n getExampleFromBody,\n getSchemaExampleFromBody,\n getSelectedBodyContentType,\n} from '@scalar/workspace-store/request-example'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n RequestBodyObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, ref, watch } from 'vue'\n\nimport { useFileDialog } from '@/hooks/use-file-dialog'\nimport RequestBodyForm from '@/v2/blocks/request-block/components/RequestBodyForm.vue'\nimport RequestBodyStructured from '@/v2/blocks/request-block/components/RequestBodyStructured.vue'\nimport RequestBodyViewToggle from '@/v2/blocks/request-block/components/RequestBodyViewToggle.vue'\nimport { getFileName } from '@/v2/blocks/request-block/helpers/files'\nimport { getStructuredBodyCodec } from '@/v2/blocks/request-block/helpers/structured-body-codec'\nimport { CodeInput } from '@/v2/components/code-input'\nimport {\n DataTable,\n DataTableHeader,\n DataTableRow,\n} from '@/v2/components/data-table'\nimport { CollapsibleSection } from '@/v2/components/layout'\n\nconst {\n requestBody,\n exampleKey,\n environment,\n requestBodyCompositionSelection,\n title,\n defaultView = 'raw',\n} = defineProps<{\n /** Request body */\n requestBody?: RequestBodyObject\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Display title */\n title: string\n /** Selected environment */\n environment: XScalarEnvironment\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n /**\n * Initial view for structured (JSON/YAML) bodies. Comes from the\n * `x-scalar-default-request-body-view` document extension and falls back to `raw`\n * whenever the body cannot be shown as a form.\n */\n defaultView?: 'form' | 'raw'\n}>()\n\nconst emits = defineEmits<{\n (e: 'update:contentType', payload: { value: string }): void\n /** We use this event to update raw values */\n (\n e: 'update:value',\n payload: Pick<\n ApiReferenceEvents['operation:update:requestBody:value'],\n 'payload' | 'contentType'\n >,\n ): void\n /** We use this event when updating form data only */\n (\n e: 'update:formValue',\n payload: Pick<\n ApiReferenceEvents['operation:update:requestBody:formValue'],\n 'payload' | 'contentType'\n >,\n ): void\n /**\n * Create a new example seeded with values generated from the request body schema.\n *\n * The block itself owns the document and operation identity needed to create an example, so we\n * only report the content type the user is currently looking at.\n */\n (e: 'generate:example', payload: { contentType: string }): void\n}>()\n\n// Map a content type to a language for the code editor\nconst contentTypeToLanguageMap = {\n 'application/json': 'json',\n 'application/xml': 'xml',\n 'application/yaml': 'yaml',\n} as const\n\n/** Selected content type with default */\nconst selectedContentType = computed(\n () => getSelectedBodyContentType(requestBody, exampleKey) ?? 'none',\n)\n\n/** Keep the editor and copy label aligned with the selected content type. */\nconst selectedLanguage = computed(\n () =>\n contentTypeToLanguageMap[\n selectedContentType.value as keyof typeof contentTypeToLanguageMap\n ] ?? 'plaintext',\n)\n\n/**\n * Strips MIME parameters (such as `charset=utf-8`) for dropdown labels, aligned with how we treat\n * media types elsewhere (see api-reference `normalizeMimeType` / WHATWG essence).\n */\nconst contentTypeLabel = (raw: string): string => parseMimeType(raw).essence\n\n/**\n * Build the dropdown options for the content type selector.\n *\n * The list is composed of two groups:\n * 1. The built-in content types we ship friendly labels for (JSON, XML, Multipart Form, etc.).\n * 2. Any additional content types defined on the OpenAPI request body that are not in the built-in list\n * (for example `text/csv`, `application/pdf`, vendor types like `application/vnd.api+json`, ...).\n *\n * The OpenAPI-defined extras are appended at the bottom so the well-known options stay on top, and\n * users can always pick the exact content type the operation actually accepts.\n */\nconst contentTypeOptions = computed<{ id: string; label: string }[]>(() => {\n const builtIn = objectEntries(CONTENT_TYPES).map(([id, label]) => ({\n id,\n label,\n }))\n\n const extras = Object.keys(requestBody?.content ?? {})\n .filter((type) => {\n if (type in CONTENT_TYPES) {\n return false\n }\n // Same essence as a built-in (e.g. `application/json; charset=utf-8`) — do not duplicate the row.\n return !(contentTypeLabel(type) in CONTENT_TYPES)\n })\n .map((type) => ({ id: type, label: contentTypeLabel(type) }))\n\n return [...builtIn, ...extras]\n})\n\nconst selectedContentTypeModel = computed<{ id: string; label: string }>({\n get: () => {\n const found = contentTypeOptions.value.find(\n (it) => it.id === selectedContentType.value,\n )\n if (found) {\n return found\n }\n\n const essence = contentTypeLabel(selectedContentType.value)\n const friendly =\n CONTENT_TYPES[essence as keyof typeof CONTENT_TYPES] ?? essence\n\n return {\n id: selectedContentType.value,\n label: friendly,\n }\n },\n set: (v) => {\n emits('update:contentType', { value: v.id })\n },\n})\n\nfunction handleFileUpload(callback: (file: File) => void) {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n callback(file)\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\n/** Dereferenced example */\nconst example = computed(\n () =>\n requestBody &&\n getExampleFromBody(\n requestBody,\n selectedContentType.value,\n exampleKey,\n requestBodyCompositionSelection,\n ),\n)\n\n/** Convert the example value to a string for the code editor */\nconst bodyValue = computed(() => {\n if (!example.value) {\n return ''\n }\n\n const value = example.value.value\n if (typeof value === 'string') {\n return value\n }\n\n return JSON.stringify(value, null, 2)\n})\n\n/** Resolved schema for the request body */\nconst bodySchema = computed<SchemaObject | undefined>(() => {\n return resolve.schema(\n requestBody?.content?.[selectedContentType.value]?.schema,\n )\n})\n\n/** Codec for structured (JSON/YAML) bodies, undefined for everything else */\nconst structuredCodec = computed(() =>\n selectedContentType.value === 'none'\n ? undefined\n : getStructuredBodyCodec(selectedContentType.value),\n)\n\n/** Parsed body value for the form view — `ok: false` when the raw text is not parseable */\nconst parsedBody = computed<{ ok: boolean; value?: unknown }>(() => {\n const codec = structuredCodec.value\n if (!codec) {\n return { ok: false }\n }\n\n const raw = example.value?.value\n // An empty body is still form-editable: rows come from the schema.\n if (raw === undefined || raw === null || raw === '') {\n return { ok: true, value: {} }\n }\n if (typeof raw === 'string') {\n try {\n return { ok: true, value: codec.parse(raw) }\n } catch {\n return { ok: false }\n }\n }\n // Spec-provided examples can be stored as objects directly.\n return { ok: true, value: raw }\n})\n\n/**\n * An edited example normally takes precedence over schema-generated data. When a different\n * composition branch is selected, however, keeping that example leaves the editor showing the\n * previous branch. Track the selection itself instead of inspecting discriminator fields so this\n * also works for compositions whose members are distinguished only by their shape.\n */\nconst compositionSelectionKey = computed(() =>\n JSON.stringify(requestBodyCompositionSelection ?? {}),\n)\n\n// Switching operations changes the body (and often the selection) at once, which is not a branch\n// change, so we only regenerate the body when the selection changes while the operation and example\n// stay the same. Watching all three together and comparing against the watcher's own previous values\n// keeps this correct regardless of the order in which props update or watchers flush.\nwatch(\n [() => requestBody, () => exampleKey, compositionSelectionKey],\n (\n [, , selection],\n [previousRequestBody, previousExampleKey, previousSelection],\n ) => {\n const operationChanged =\n requestBody !== previousRequestBody || exampleKey !== previousExampleKey\n const selectionChanged = selection !== previousSelection\n\n // Going from no selection to a populated one is the modal applying the reference's selection as\n // the panel opens, not the user switching branches. Resetting here would discard the body's named\n // example on the very first open (issue #10075), so only a change between two populated selections\n // counts as a real branch switch.\n const hadNoPreviousSelection = previousSelection === '{}'\n\n // Only a genuine branch switch within the same operation should reset the edited body. An empty\n // selection means there is no composition to switch between (or the selection was cleared on an\n // operation change), so there is nothing to reset.\n if (\n operationChanged ||\n !selectionChanged ||\n hadNoPreviousSelection ||\n Object.keys(requestBodyCompositionSelection ?? {}).length === 0\n ) {\n return\n }\n\n const codec = structuredCodec.value\n if (!requestBody || !codec) {\n return\n }\n\n // Regenerate through the same helper the initial example uses so a reset produces exactly the\n // value a fresh render of this branch would, rather than a hand-copied second code path.\n const selectedValue = getSchemaExampleFromBody(\n requestBody,\n selectedContentType.value,\n requestBodyCompositionSelection,\n )\n\n emits('update:value', {\n // A branch with no writable content generates `null`/`undefined`; clear the editor rather than\n // writing the literal text `null` or leaving the previously selected branch's body behind.\n payload: selectedValue == null ? '' : codec.stringify(selectedValue),\n contentType: selectedContentType.value,\n })\n },\n)\n\n/** The form view only works on an object-shaped body root */\nconst isFormViewAvailable = computed(\n () => parsedBody.value.ok && isObject(parsedBody.value.value),\n)\n\n/**\n * Show the Form/Raw toggle for structured bodies that are (or per schema should be)\n * an object at the root. Non-object roots (arrays, primitives) stay raw-only.\n */\nconst showBodyViewToggle = computed(\n () =>\n Boolean(structuredCodec.value) &&\n (isFormViewAvailable.value ||\n Boolean(bodySchema.value && isObjectSchema(bodySchema.value))),\n)\n\n/** Selected body view, seeded from the document default (raw unless configured) */\nconst bodyView = ref<'form' | 'raw'>(defaultView)\n\n// Fall back to raw when the form view stops being available (e.g. the content type\n// changed to a non-structured one, or an external edit made the body unparseable).\nwatch(isFormViewAvailable, (ok) => {\n if (!ok) {\n bodyView.value = 'raw'\n }\n})\n\n/**\n * Whether we can offer to generate a fresh example from the schema.\n *\n * Only structured (JSON/YAML) bodies qualify: they have a schema to generate from and a text\n * representation we can seed the new example with. Binary and form bodies have their own editors,\n * so the button would have nothing meaningful to write.\n */\nconst canGenerateExample = computed(() =>\n Boolean(structuredCodec.value && bodySchema.value),\n)\n</script>\n<template>\n <CollapsibleSection>\n <template #title>{{ title }}</template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableHeader\n class=\"relative col-span-full flex h-8 cursor-pointer items-center justify-between border-r-0 !p-0\">\n <ScalarListbox\n v-model=\"selectedContentTypeModel\"\n :options=\"contentTypeOptions\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-3 font-normal\"\n fullWidth\n variant=\"ghost\">\n <span>{{ selectedContentTypeModel.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n <div class=\"flex items-center gap-1\">\n <!--\n Generates a new example from the schema so the auto-generated fields stay reachable\n even once the document ships custom examples.\n -->\n <ScalarIconButton\n v-if=\"canGenerateExample\"\n aria-label=\"Generate example from schema\"\n :icon=\"ScalarIconMagicWand\"\n label=\"Generate example from schema\"\n size=\"sm\"\n tooltip\n @click.stop=\"\n emits('generate:example', { contentType: selectedContentType })\n \" />\n <RequestBodyViewToggle\n v-if=\"showBodyViewToggle\"\n :disabled=\"!isFormViewAvailable\"\n :modelValue=\"bodyView\"\n @update:modelValue=\"(v) => (bodyView = v)\" />\n </div>\n </DataTableHeader>\n <DataTableRow>\n <!-- No Body -->\n <template v-if=\"selectedContentType === 'none'\">\n <div\n class=\"text-c-3 flex min-h-10 w-full items-center justify-center border-t p-2 text-sm\">\n <span>No Body</span>\n </div>\n </template>\n\n <!-- Binary File -->\n <template\n v-else-if=\"selectedContentType === 'application/octet-stream'\">\n <div\n class=\"flex items-center justify-center overflow-hidden border-t p-1.5\">\n <template\n v-if=\"\n getFileName(unpackProxyObject(example?.value)) !== undefined\n \">\n <span\n class=\"text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap\">\n {{ getFileName(unpackProxyObject(example?.value)) }}\n </span>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 ml-1 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"\n emits('update:value', {\n payload: undefined,\n contentType: selectedContentType,\n })\n \">\n Delete\n </ScalarButton>\n </template>\n <template v-else>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"\n () =>\n handleFileUpload((file) =>\n emits('update:value', {\n payload: file,\n contentType: selectedContentType,\n }),\n )\n \">\n <span>Select File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </template>\n </div>\n </template>\n\n <!-- Form Data / URL Encoded -->\n <template\n v-else-if=\"\n selectedContentType === 'multipart/form-data' ||\n selectedContentType === 'application/x-www-form-urlencoded'\n \">\n <RequestBodyForm\n :bodySchema\n :environment\n :example\n :selectedContentType\n @update:formValue=\"\n (payload) =>\n emits('update:formValue', {\n payload,\n contentType: selectedContentType,\n })\n \" />\n </template>\n\n <!-- Code/Other -->\n <template v-else>\n <!-- Schema-driven form view for structured (JSON/YAML) bodies -->\n <RequestBodyStructured\n v-if=\"bodyView === 'form' && isFormViewAvailable\"\n :bodySchema\n :contentType=\"selectedContentType\"\n :environment\n :parsedValue=\"parsedBody.value\"\n @update:value=\"\n (value) =>\n emits('update:value', {\n payload: value,\n contentType: selectedContentType,\n })\n \" />\n <!-- Editable raw body with a copy button revealed on hover/focus -->\n <div\n v-else\n class=\"group/code-block relative border-t\">\n <CodeInput\n class=\"px-3\"\n content=\"\"\n :environment=\"environment\"\n :language=\"selectedLanguage\"\n lineNumbers\n lint\n :modelValue=\"bodyValue\"\n withFakeData\n @update:modelValue=\"\n (value) =>\n emits('update:value', {\n payload: value,\n contentType: selectedContentType,\n })\n \" />\n <ScalarCodeBlockCopy\n v-if=\"bodyValue\"\n class=\"absolute top-1.5 right-1.5\"\n :content=\"bodyValue\"\n :lang=\"selectedLanguage\"\n showLang>\n <template #backdrop>\n <ScalarCopyBackdrop class=\"-top-1 -right-1.5\" />\n </template>\n </ScalarCodeBlockCopy>\n </div>\n </template>\n </DataTableRow>\n </DataTable>\n </CollapsibleSection>\n</template>\n<style scoped>\n:deep(.cm-content) {\n font-size: var(--scalar-small);\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"RequestBody.vue.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/components/RequestBody.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarCodeBlockCopy } from '@scalar/components/code-block'\nimport { ScalarCopyBackdrop } from '@scalar/components/copy'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarListbox } from '@scalar/components/listbox'\nimport { CONTENT_TYPES } from '@scalar/helpers/http/content-types'\nimport { parseMimeType } from '@scalar/helpers/http/mime-type'\nimport { isObject } from '@scalar/helpers/object/is-object'\nimport { objectEntries } from '@scalar/helpers/object/object-entries'\nimport { ScalarIconMagicWand } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport {\n getExampleValue,\n getExplicitExampleText,\n} from '@scalar/workspace-store/helpers/get-example-value'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n getExampleFromBody,\n getSchemaExampleFromBody,\n getSelectedBodyContentType,\n} from '@scalar/workspace-store/request-example'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n RequestBodyObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, ref, watch } from 'vue'\n\nimport { useFileDialog } from '@/hooks/use-file-dialog'\nimport RequestBodyForm from '@/v2/blocks/request-block/components/RequestBodyForm.vue'\nimport RequestBodyStructured from '@/v2/blocks/request-block/components/RequestBodyStructured.vue'\nimport RequestBodyViewToggle from '@/v2/blocks/request-block/components/RequestBodyViewToggle.vue'\nimport { getFileName } from '@/v2/blocks/request-block/helpers/files'\nimport { getStructuredBodyCodec } from '@/v2/blocks/request-block/helpers/structured-body-codec'\nimport { CodeInput } from '@/v2/components/code-input'\nimport {\n DataTable,\n DataTableHeader,\n DataTableRow,\n} from '@/v2/components/data-table'\nimport { CollapsibleSection } from '@/v2/components/layout'\nimport { useLocalization } from '@/v2/features/localization'\n\nconst {\n requestBody,\n exampleKey,\n environment,\n requestBodyCompositionSelection,\n title,\n defaultView = 'raw',\n} = defineProps<{\n /** Request body */\n requestBody?: RequestBodyObject\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Display title */\n title: string\n /** Selected environment */\n environment: XScalarEnvironment\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n /**\n * Initial view for structured (JSON/YAML) bodies. Comes from the\n * `x-scalar-default-request-body-view` document extension and falls back to `raw`\n * whenever the body cannot be shown as a form.\n */\n defaultView?: 'form' | 'raw'\n}>()\n\nconst emits = defineEmits<{\n (e: 'update:contentType', payload: { value: string }): void\n /** We use this event to update raw values */\n (\n e: 'update:value',\n payload: Pick<\n ApiReferenceEvents['operation:update:requestBody:value'],\n 'payload' | 'contentType'\n >,\n ): void\n /** We use this event when updating form data only */\n (\n e: 'update:formValue',\n payload: Pick<\n ApiReferenceEvents['operation:update:requestBody:formValue'],\n 'payload' | 'contentType'\n >,\n ): void\n /**\n * Create a new example seeded with values generated from the request body schema.\n *\n * The block itself owns the document and operation identity needed to create an example, so we\n * only report the content type the user is currently looking at.\n */\n (e: 'generate:example', payload: { contentType: string }): void\n}>()\n\nconst { translate } = useLocalization()\n\n// Map a content type to a language for the code editor\nconst contentTypeToLanguageMap = {\n 'application/json': 'json',\n 'application/xml': 'xml',\n 'application/yaml': 'yaml',\n} as const\n\n/** Selected content type with default */\nconst selectedContentType = computed(\n () => getSelectedBodyContentType(requestBody, exampleKey) ?? 'none',\n)\n\n/** Keep the editor and copy label aligned with the selected content type. */\nconst selectedLanguage = computed(\n () =>\n contentTypeToLanguageMap[\n selectedContentType.value as keyof typeof contentTypeToLanguageMap\n ] ?? 'plaintext',\n)\n\n/**\n * Strips MIME parameters (such as `charset=utf-8`) for dropdown labels, aligned with how we treat\n * media types elsewhere (see api-reference `normalizeMimeType` / WHATWG essence).\n */\nconst contentTypeLabel = (raw: string): string => parseMimeType(raw).essence\n\n/**\n * Build the dropdown options for the content type selector.\n *\n * The list is composed of two groups:\n * 1. The built-in content types we ship friendly labels for (JSON, XML, Multipart Form, etc.).\n * 2. Any additional content types defined on the OpenAPI request body that are not in the built-in list\n * (for example `text/csv`, `application/pdf`, vendor types like `application/vnd.api+json`, ...).\n *\n * The OpenAPI-defined extras are appended at the bottom so the well-known options stay on top, and\n * users can always pick the exact content type the operation actually accepts.\n */\n/** MIME values remain stable while their human-readable labels follow the locale. */\nconst localizedContentTypes = computed(() => ({\n ...CONTENT_TYPES,\n 'multipart/form-data': translate('apiClient.requestBody.multipartForm'),\n 'application/x-www-form-urlencoded': translate(\n 'apiClient.requestBody.formUrlEncoded',\n ),\n 'application/octet-stream': translate('apiClient.requestBody.binaryFile'),\n 'other': translate('apiClient.requestBody.other'),\n 'none': translate('apiClient.requestBody.none'),\n}))\n\nconst contentTypeOptions = computed<{ id: string; label: string }[]>(() => {\n const builtIn = objectEntries(localizedContentTypes.value).map(\n ([id, label]) => ({\n id,\n label,\n }),\n )\n\n const extras = Object.keys(requestBody?.content ?? {})\n .filter((type) => {\n if (type in CONTENT_TYPES) {\n return false\n }\n // Same essence as a built-in (e.g. `application/json; charset=utf-8`) — do not duplicate the row.\n return !(contentTypeLabel(type) in CONTENT_TYPES)\n })\n .map((type) => ({ id: type, label: contentTypeLabel(type) }))\n\n return [...builtIn, ...extras]\n})\n\nconst selectedContentTypeModel = computed<{ id: string; label: string }>({\n get: () => {\n const found = contentTypeOptions.value.find(\n (it) => it.id === selectedContentType.value,\n )\n if (found) {\n return found\n }\n\n const essence = contentTypeLabel(selectedContentType.value)\n const friendly =\n localizedContentTypes.value[essence as keyof typeof CONTENT_TYPES] ??\n essence\n\n return {\n id: selectedContentType.value,\n label: friendly,\n }\n },\n set: (v) => {\n emits('update:contentType', { value: v.id })\n },\n})\n\nfunction handleFileUpload(callback: (file: File) => void) {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n callback(file)\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\n/** Dereferenced example */\nconst example = computed(\n () =>\n requestBody &&\n getExampleFromBody(\n requestBody,\n selectedContentType.value,\n exampleKey,\n requestBodyCompositionSelection,\n ),\n)\n\n/** Convert the example value to a string for the code editor */\nconst bodyValue = computed(() => {\n if (!example.value) {\n return ''\n }\n\n const selected = getExampleValue(example.value)\n const explicitText = getExplicitExampleText(\n selected,\n selectedContentType.value,\n 2,\n )\n if (explicitText !== undefined) {\n return explicitText\n }\n const value = selected?.value\n if (typeof value === 'string') {\n return value\n }\n\n return JSON.stringify(value, null, 2)\n})\n\n/** Resolved schema for the request body */\nconst bodySchema = computed<SchemaObject | undefined>(() => {\n return resolve.schema(\n requestBody?.content?.[selectedContentType.value]?.schema ??\n requestBody?.content?.[selectedContentType.value]?.itemSchema,\n )\n})\n\n/** Codec for structured (JSON/YAML) bodies, undefined for everything else */\nconst structuredCodec = computed(() =>\n selectedContentType.value === 'none'\n ? undefined\n : getStructuredBodyCodec(selectedContentType.value),\n)\n\n/** Parsed body value for the form view — `ok: false` when the raw text is not parseable */\nconst parsedBody = computed<{ ok: boolean; value?: unknown }>(() => {\n const codec = structuredCodec.value\n if (!codec) {\n return { ok: false }\n }\n\n const selected = getExampleValue(example.value ?? undefined)\n // Structured data is already parsed; parsing strings again changes the payload type.\n if (example.value?.dataValue !== undefined) {\n return { ok: true, value: example.value.dataValue }\n }\n const raw = selected?.value\n // An empty body is still form-editable: rows come from the schema.\n if (raw === undefined || raw === null || raw === '') {\n return { ok: true, value: {} }\n }\n if (typeof raw === 'string') {\n try {\n return { ok: true, value: codec.parse(raw) }\n } catch {\n return { ok: false }\n }\n }\n // Spec-provided examples can be stored as objects directly.\n return { ok: true, value: raw }\n})\n\n/**\n * An edited example normally takes precedence over schema-generated data. When a different\n * composition branch is selected, however, keeping that example leaves the editor showing the\n * previous branch. Track the selection itself instead of inspecting discriminator fields so this\n * also works for compositions whose members are distinguished only by their shape.\n */\nconst compositionSelectionKey = computed(() =>\n JSON.stringify(requestBodyCompositionSelection ?? {}),\n)\n\n// Switching operations changes the body (and often the selection) at once, which is not a branch\n// change, so we only regenerate the body when the selection changes while the operation and example\n// stay the same. Watching all three together and comparing against the watcher's own previous values\n// keeps this correct regardless of the order in which props update or watchers flush.\nwatch(\n [() => requestBody, () => exampleKey, compositionSelectionKey],\n (\n [, , selection],\n [previousRequestBody, previousExampleKey, previousSelection],\n ) => {\n const operationChanged =\n requestBody !== previousRequestBody || exampleKey !== previousExampleKey\n const selectionChanged = selection !== previousSelection\n\n // Going from no selection to a populated one is the modal applying the reference's selection as\n // the panel opens, not the user switching branches. Resetting here would discard the body's named\n // example on the very first open (issue #10075), so only a change between two populated selections\n // counts as a real branch switch.\n const hadNoPreviousSelection = previousSelection === '{}'\n\n // Only a genuine branch switch within the same operation should reset the edited body. An empty\n // selection means there is no composition to switch between (or the selection was cleared on an\n // operation change), so there is nothing to reset.\n if (\n operationChanged ||\n !selectionChanged ||\n hadNoPreviousSelection ||\n Object.keys(requestBodyCompositionSelection ?? {}).length === 0\n ) {\n return\n }\n\n const codec = structuredCodec.value\n if (!requestBody || !codec) {\n return\n }\n\n // Regenerate through the same helper the initial example uses so a reset produces exactly the\n // value a fresh render of this branch would, rather than a hand-copied second code path.\n const selectedValue = getSchemaExampleFromBody(\n requestBody,\n selectedContentType.value,\n requestBodyCompositionSelection,\n )\n\n emits('update:value', {\n // A branch with no writable content generates `null`/`undefined`; clear the editor rather than\n // writing the literal text `null` or leaving the previously selected branch's body behind.\n payload: selectedValue == null ? '' : codec.stringify(selectedValue),\n contentType: selectedContentType.value,\n })\n },\n)\n\n/** The form view only works on an object-shaped body root */\nconst isFormViewAvailable = computed(\n () => parsedBody.value.ok && isObject(parsedBody.value.value),\n)\n\n/**\n * Show the Form/Raw toggle for structured bodies that are (or per schema should be)\n * an object at the root. Non-object roots (arrays, primitives) stay raw-only.\n */\nconst showBodyViewToggle = computed(\n () =>\n Boolean(structuredCodec.value) &&\n (isFormViewAvailable.value ||\n Boolean(bodySchema.value && isObjectSchema(bodySchema.value))),\n)\n\n/** Selected body view, seeded from the document default (raw unless configured) */\nconst bodyView = ref<'form' | 'raw'>(defaultView)\n\n// Fall back to raw when the form view stops being available (e.g. the content type\n// changed to a non-structured one, or an external edit made the body unparseable).\nwatch(isFormViewAvailable, (ok) => {\n if (!ok) {\n bodyView.value = 'raw'\n }\n})\n\n/**\n * Whether we can offer to generate a fresh example from the schema.\n *\n * Only structured (JSON/YAML) bodies qualify: they have a schema to generate from and a text\n * representation we can seed the new example with. Binary and form bodies have their own editors,\n * so the button would have nothing meaningful to write.\n */\nconst canGenerateExample = computed(() =>\n Boolean(structuredCodec.value && bodySchema.value),\n)\n</script>\n<template>\n <CollapsibleSection>\n <template #title>{{ title }}</template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableHeader\n class=\"relative col-span-full flex h-8 cursor-pointer items-center justify-between border-r-0 !p-0\">\n <ScalarListbox\n v-model=\"selectedContentTypeModel\"\n :options=\"contentTypeOptions\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-3 font-normal\"\n fullWidth\n variant=\"ghost\">\n <span>{{ selectedContentTypeModel.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n <div class=\"flex items-center gap-1\">\n <!--\n Generates a new example from the schema so the auto-generated fields stay reachable\n even once the document ships custom examples.\n -->\n <ScalarIconButton\n v-if=\"canGenerateExample\"\n aria-label=\"Generate example from schema\"\n :icon=\"ScalarIconMagicWand\"\n label=\"Generate example from schema\"\n size=\"sm\"\n tooltip\n @click.stop=\"\n emits('generate:example', { contentType: selectedContentType })\n \" />\n <RequestBodyViewToggle\n v-if=\"showBodyViewToggle\"\n :disabled=\"!isFormViewAvailable\"\n :modelValue=\"bodyView\"\n @update:modelValue=\"(v) => (bodyView = v)\" />\n </div>\n </DataTableHeader>\n <DataTableRow>\n <!-- No Body -->\n <template v-if=\"selectedContentType === 'none'\">\n <div\n class=\"text-c-3 flex min-h-10 w-full items-center justify-center border-t p-2 text-sm\">\n <span>{{ translate('apiClient.requestBody.noBody') }}</span>\n </div>\n </template>\n\n <!-- Binary File -->\n <template\n v-else-if=\"selectedContentType === 'application/octet-stream'\">\n <div\n class=\"flex items-center justify-center overflow-hidden border-t p-1.5\">\n <template\n v-if=\"\n getFileName(unpackProxyObject(example?.value)) !== undefined\n \">\n <span\n class=\"text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap\">\n {{ getFileName(unpackProxyObject(example?.value)) }}\n </span>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 ml-1 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"\n emits('update:value', {\n payload: undefined,\n contentType: selectedContentType,\n })\n \">\n {{ translate('apiClient.requestBody.delete') }}\n </ScalarButton>\n </template>\n <template v-else>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"\n () =>\n handleFileUpload((file) =>\n emits('update:value', {\n payload: file,\n contentType: selectedContentType,\n }),\n )\n \">\n <span>{{ translate('apiClient.requestBody.selectFile') }}</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </template>\n </div>\n </template>\n\n <!-- Form Data / URL Encoded -->\n <template\n v-else-if=\"\n selectedContentType === 'multipart/form-data' ||\n selectedContentType === 'application/x-www-form-urlencoded'\n \">\n <RequestBodyForm\n :bodySchema\n :environment\n :example\n :selectedContentType\n @update:formValue=\"\n (payload) =>\n emits('update:formValue', {\n payload,\n contentType: selectedContentType,\n })\n \" />\n </template>\n\n <!-- Code/Other -->\n <template v-else>\n <!-- Schema-driven form view for structured (JSON/YAML) bodies -->\n <RequestBodyStructured\n v-if=\"bodyView === 'form' && isFormViewAvailable\"\n :bodySchema\n :contentType=\"selectedContentType\"\n :environment\n :parsedValue=\"parsedBody.value\"\n @update:value=\"\n (value) =>\n emits('update:value', {\n payload: value,\n contentType: selectedContentType,\n })\n \" />\n <!-- Editable raw body with a copy button revealed on hover/focus -->\n <div\n v-else\n class=\"group/code-block relative border-t\">\n <CodeInput\n class=\"px-3\"\n content=\"\"\n :environment=\"environment\"\n :language=\"selectedLanguage\"\n lineNumbers\n lint\n :modelValue=\"bodyValue\"\n withFakeData\n @update:modelValue=\"\n (value) =>\n emits('update:value', {\n payload: value,\n contentType: selectedContentType,\n })\n \" />\n <ScalarCodeBlockCopy\n v-if=\"bodyValue\"\n class=\"absolute top-1.5 right-1.5\"\n :content=\"bodyValue\"\n :lang=\"selectedLanguage\"\n showLang>\n <template #backdrop>\n <ScalarCopyBackdrop class=\"-top-1 -right-1.5\" />\n </template>\n </ScalarCodeBlockCopy>\n </div>\n </template>\n </DataTableRow>\n </DataTable>\n </CollapsibleSection>\n</template>\n<style scoped>\n:deep(.cm-content) {\n font-size: var(--scalar-small);\n}\n</style>\n"],"mappings":""}
|