@scalar/api-client 2.39.3 → 2.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/components/AddressBar/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue.js +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue.js.map +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue.script.js +2 -2
- package/dist/components/AddressBar/AddressBarHistory.vue.script.js.map +1 -1
- package/dist/hooks/useClientConfig.d.ts +12 -0
- package/dist/hooks/useClientConfig.d.ts.map +1 -1
- package/dist/hooks/useClientConfig.js +14 -1
- package/dist/hooks/useClientConfig.js.map +1 -1
- package/dist/hooks/useResponseBody.js +2 -2
- package/dist/hooks/useResponseBody.js.map +1 -1
- package/dist/libs/index.d.ts +0 -1
- package/dist/libs/index.d.ts.map +1 -1
- package/dist/libs/index.js +1 -2
- package/dist/libs/send-request/decode-buffer.js +2 -2
- package/dist/libs/send-request/decode-buffer.js.map +1 -1
- package/dist/style.css +222 -263
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +14 -10
- 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 +57 -35
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.js +2 -2
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -5
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +18 -33
- package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js +1 -1
- package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js.map +1 -1
- package/dist/v2/blocks/operation-block/index.d.ts +0 -3
- package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/index.js +1 -4
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js +3 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +4 -2
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +3 -2
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +7 -2
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +4 -3
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +2 -3
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts +3 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +5 -8
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts +0 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/index.js +2 -3
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +7 -9
- 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 +49 -42
- 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 +2 -3
- package/dist/v2/blocks/request-block/components/RequestBody.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 +1 -0
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
- 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 +11 -9
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +1 -1
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts +1 -1
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.js +2 -1
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.js.map +1 -1
- package/dist/v2/blocks/response-block/helpers/get-content-length.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/helpers/get-content-length.js +2 -2
- package/dist/v2/blocks/response-block/helpers/get-content-length.js.map +1 -1
- package/dist/v2/blocks/response-block/helpers/process-response-body.js +2 -2
- package/dist/v2/blocks/response-block/helpers/process-response-body.js.map +1 -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 +76 -25
- 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.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 +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +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 +1 -1
- 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/OAuth2.vue.d.ts +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 +8 -4
- 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/RequestAuthDataTable.vue.d.ts +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.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +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.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts +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-openid-connect-discovery.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +1 -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 +6 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +0 -3
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/index.js +1 -3
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +16 -8
- 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 +15 -10
- package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js.map +1 -1
- package/dist/v2/features/app/App.vue.script.js +1 -5
- package/dist/v2/features/app/App.vue.script.js.map +1 -1
- package/dist/v2/features/app/app-events.d.ts.map +1 -1
- package/dist/v2/features/app/app-events.js +1 -1
- package/dist/v2/features/app/app-events.js.map +1 -1
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +2 -2
- package/dist/v2/features/app/app-state.js.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.script.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.script.js.map +1 -1
- package/dist/v2/features/app/helpers/routes.d.ts +0 -3
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +1 -1
- package/dist/v2/features/app/helpers/routes.js.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.js.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.script.js +30 -52
- package/dist/v2/features/collection/DocumentCollection.vue.script.js.map +1 -1
- package/dist/v2/features/collection/OperationCollection.vue.script.js +0 -1
- package/dist/v2/features/collection/OperationCollection.vue.script.js.map +1 -1
- package/dist/v2/features/collection/WorkspaceCollection.vue.script.js +0 -1
- package/dist/v2/features/collection/WorkspaceCollection.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.script.js +6 -8
- package/dist/v2/features/collection/components/Authentication.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Cookies.vue.script.js +0 -1
- package/dist/v2/features/collection/components/Cookies.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Editor/Editor.vue.script.js +0 -1
- package/dist/v2/features/collection/components/Editor/Editor.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Environment.vue.script.js +0 -1
- package/dist/v2/features/collection/components/Environment.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Overview.vue.script.js +0 -1
- package/dist/v2/features/collection/components/Overview.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Servers.vue.script.js +0 -1
- package/dist/v2/features/collection/components/Servers.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.js.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.script.js +2 -3
- package/dist/v2/features/collection/components/Settings.vue.script.js.map +1 -1
- package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +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 +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
- 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 +3 -4
- package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
- package/dist/v2/features/modal/helpers/map-hidden-clients-config.js +1 -1
- 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 -84
- package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
- package/dist/v2/features/operation/index.d.ts +0 -4
- package/dist/v2/features/operation/index.d.ts.map +1 -1
- package/dist/v2/features/operation/index.js +1 -5
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.script.js +11 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.script.js.map +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.js.map +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.script.js +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.script.js.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.script.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.script.js +2 -2
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.script.js.map +1 -1
- package/dist/views/Request/libs/oauth2.js +1 -1
- package/dist/views/Request/libs/oauth2.js.map +1 -1
- package/package.json +25 -31
- package/dist/libs/formatters.d.ts +0 -12
- package/dist/libs/formatters.d.ts.map +0 -1
- package/dist/libs/formatters.js +0 -36
- package/dist/libs/formatters.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts +0 -6
- package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.js +0 -58
- package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts +0 -12
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js +0 -65
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +0 -31
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +0 -55
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +0 -27
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +0 -159
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +0 -25
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-security.js +0 -53
- package/dist/v2/blocks/operation-block/helpers/build-request-security.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +0 -46
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.js +0 -102
- package/dist/v2/blocks/operation-block/helpers/build-request.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts +0 -4
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.js +0 -41
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts +0 -14
- package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.js +0 -20
- package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-delimiter.d.ts +0 -8
- package/dist/v2/blocks/operation-block/helpers/get-delimiter.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts +0 -9
- package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js +0 -17
- package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts +0 -10
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-example.js +0 -41
- package/dist/v2/blocks/operation-block/helpers/get-example.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts +0 -26
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.js +0 -32
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts +0 -10
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js +0 -15
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts +0 -3
- package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/get-server-url.js +0 -18
- package/dist/v2/blocks/operation-block/helpers/get-server-url.js.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/serialize-parameter.d.ts +0 -96
- package/dist/v2/blocks/operation-block/helpers/serialize-parameter.d.ts.map +0 -1
- package/dist/v2/blocks/operation-block/helpers/serialize-parameter.js +0 -160
- package/dist/v2/blocks/operation-block/helpers/serialize-parameter.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +0 -40
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +0 -437
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js.map +0 -1
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts +0 -6
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts.map +0 -1
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.js +0 -25
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.js.map +0 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +0 -141
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js.map +0 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts.map +0 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js +0 -10
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js.map +0 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts +0 -9
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts.map +0 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +0 -27
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js.map +0 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +0 -25
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +0 -1
- package/dist/v2/components/callout/Callout.vue.js +0 -9
- package/dist/v2/components/callout/Callout.vue.js.map +0 -1
- package/dist/v2/components/callout/Callout.vue.script.js +0 -35
- package/dist/v2/components/callout/Callout.vue.script.js.map +0 -1
- package/dist/v2/features/operation/helpers/combine-params.d.ts +0 -4
- package/dist/v2/features/operation/helpers/combine-params.d.ts.map +0 -1
- package/dist/v2/features/operation/helpers/combine-params.js +0 -20
- package/dist/v2/features/operation/helpers/combine-params.js.map +0 -1
- package/dist/v2/features/operation/helpers/get-operation-header.d.ts +0 -17
- package/dist/v2/features/operation/helpers/get-operation-header.d.ts.map +0 -1
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +0 -12
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +0 -1
- package/dist/v2/features/operation/helpers/get-security-requirements.js +0 -17
- package/dist/v2/features/operation/helpers/get-security-requirements.js.map +0 -1
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts +0 -15
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +0 -1
- package/dist/v2/features/operation/helpers/get-selected-security.js +0 -41
- package/dist/v2/features/operation/helpers/get-selected-security.js.map +0 -1
- package/dist/v2/features/operation/helpers/get-selected-server.d.ts +0 -13
- package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +0 -1
- package/dist/v2/features/operation/helpers/get-selected-server.js +0 -21
- package/dist/v2/features/operation/helpers/get-selected-server.js.map +0 -1
- package/dist/v2/helpers/get-active-environment.d.ts +0 -5
- package/dist/v2/helpers/get-active-environment.d.ts.map +0 -1
- package/dist/v2/helpers/get-active-environment.js +0 -19
- package/dist/v2/helpers/get-active-environment.js.map +0 -1
- package/dist/v2/helpers/get-active-proxy-url.d.ts +0 -18
- package/dist/v2/helpers/get-active-proxy-url.d.ts.map +0 -1
- package/dist/v2/helpers/get-active-proxy-url.js +0 -26
- package/dist/v2/helpers/get-active-proxy-url.js.map +0 -1
- package/dist/v2/helpers/get-servers.d.ts +0 -23
- package/dist/v2/helpers/get-servers.d.ts.map +0 -1
- package/dist/v2/helpers/get-servers.js +0 -106
- package/dist/v2/helpers/get-servers.js.map +0 -1
- package/dist/v2/helpers/index.d.ts +0 -3
- package/dist/v2/helpers/index.d.ts.map +0 -1
- package/dist/v2/helpers/index.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.vue.js","names":[],"sources":["../../../../src/v2/features/modal/Modal.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type ModalProps = {\n /** The workspace store must be initialized and passed in */\n workspaceStore: WorkspaceStore\n /** The document must be initialized and passed in */\n document: ComputedRef<WorkspaceDocument | null>\n /** The path must be initialized and passed in */\n path: ComputedRef<string | undefined>\n /** The event bus for handling all events */\n eventBus: WorkspaceEventBus\n /** The method must be initialized and passed in */\n method: ComputedRef<HttpMethod | undefined>\n /** The example name must be initialized and passed in */\n exampleName: ComputedRef<string | undefined>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection: Ref<Record<string, number>>\n /** Controls the visibility of the modal */\n modalState: ModalState\n /** The sidebar state must be initialized and passed in */\n sidebarState: UseModalSidebarReturn\n /** Api client plugins to include in the modal */\n plugins: ClientPlugin[]\n /** Subset of the configuration options for the modal */\n options: MaybeRefOrGetter<\n Partial<\n Pick<\n ApiReferenceConfigurationRaw,\n | 'authentication'\n | 'baseServerURL'\n | 'hideClientButton'\n | 'hiddenClients'\n | 'servers'\n >\n >\n >\n}\n\n/**\n * Scalar Api Client Modal\n *\n * This component is used to render the API Client Modal\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { type ModalState, type ScalarListboxOption } from '@scalar/components'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas'\nimport {\n computed,\n onBeforeUnmount,\n ref,\n toValue,\n watch,\n type ComputedRef,\n type MaybeRefOrGetter,\n type Ref,\n} from 'vue'\n\nimport
|
|
1
|
+
{"version":3,"file":"Modal.vue.js","names":[],"sources":["../../../../src/v2/features/modal/Modal.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type ModalProps = {\n /** The workspace store must be initialized and passed in */\n workspaceStore: WorkspaceStore\n /** The document must be initialized and passed in */\n document: ComputedRef<WorkspaceDocument | null>\n /** The path must be initialized and passed in */\n path: ComputedRef<string | undefined>\n /** The event bus for handling all events */\n eventBus: WorkspaceEventBus\n /** The method must be initialized and passed in */\n method: ComputedRef<HttpMethod | undefined>\n /** The example name must be initialized and passed in */\n exampleName: ComputedRef<string | undefined>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection: Ref<Record<string, number>>\n /** Controls the visibility of the modal */\n modalState: ModalState\n /** The sidebar state must be initialized and passed in */\n sidebarState: UseModalSidebarReturn\n /** Api client plugins to include in the modal */\n plugins: ClientPlugin[]\n /** Subset of the configuration options for the modal */\n options: MaybeRefOrGetter<\n Partial<\n Pick<\n ApiReferenceConfigurationRaw,\n | 'authentication'\n | 'baseServerURL'\n | 'hideClientButton'\n | 'hiddenClients'\n | 'servers'\n >\n >\n >\n}\n\n/**\n * Scalar Api Client Modal\n *\n * This component is used to render the API Client Modal\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { type ModalState, type ScalarListboxOption } from '@scalar/components'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport {\n getActiveEnvironment,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas'\nimport {\n computed,\n onBeforeUnmount,\n ref,\n toValue,\n watch,\n type ComputedRef,\n type MaybeRefOrGetter,\n type Ref,\n} from 'vue'\n\nimport ModalClientContainer from '@/v2/components/modals/ModalClientContainer.vue'\nimport { Sidebar, SidebarToggle } from '@/v2/components/sidebar'\nimport { type UseModalSidebarReturn } from '@/v2/features/modal/hooks/use-modal-sidebar'\nimport { initializeModalEvents } from '@/v2/features/modal/modal-events'\nimport Operation from '@/v2/features/operation/Operation.vue'\nimport { useGlobalHotKeys } from '@/v2/hooks/use-global-hot-keys'\nimport { useScrollLock } from '@/v2/hooks/use-scroll-lock'\n\nconst {\n document,\n eventBus,\n modalState,\n options,\n plugins,\n requestBodyCompositionSelection,\n sidebarState,\n workspaceStore,\n} = defineProps<ModalProps>()\n\nconst activeWorkspace: ScalarListboxOption = {\n label: 'default',\n id: 'default',\n}\n\n/** Controls the visibility of the sidebar. */\nconst isSidebarOpen = ref(false)\n\n/** Initialize modal events */\ninitializeModalEvents({\n eventBus,\n isSidebarOpen,\n requestBodyCompositionSelection,\n sidebarState,\n modalState,\n store: workspaceStore,\n})\n\n/** Register global hotkeys for the app, passing the workspace event bus and layout state */\nuseGlobalHotKeys(eventBus, 'modal', () => !modalState.open)\n\n/** Clean up on close */\nconst cleanUp = () => {\n eventBus.emit('operation:cancel:request')\n}\n\nconst isLocked = useScrollLock(() => {\n if (typeof window !== 'undefined') {\n return window.document.body\n }\n return null\n})\n\nwatch(\n () => modalState.open,\n (open) => {\n // Make sure scrolling is locked or unlocked when the modal is opened or closed\n isLocked.value = open\n\n if (!open) {\n cleanUp()\n }\n },\n)\n\n// Ensure we add our scalar wrapper class to the headless ui root\nonBeforeUnmount(() => cleanUp())\n\n/** Default sidebar width in pixels. */\nconst DEFAULT_SIDEBAR_WIDTH = 288\n\n/** Width of the sidebar, with fallback to default. */\nconst sidebarWidth = computed(\n () =>\n workspaceStore?.workspace?.['x-scalar-sidebar-width'] ??\n DEFAULT_SIDEBAR_WIDTH,\n)\n\n/** Handler for sidebar width changes. */\nconst handleSidebarWidthUpdate = (width: number) =>\n workspaceStore?.update('x-scalar-sidebar-width', width)\n\n/**\n * Merged environment variables from workspace and document levels.\n * Variables from both sources are combined, with document variables\n * taking precedence in case of naming conflicts.\n */\nconst environment = computed(\n () => getActiveEnvironment(workspaceStore, document.value).environment,\n)\n\n/** Merge authentication config with the document security schemes */\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document.value?.components?.securitySchemes,\n toValue(options)?.authentication?.securitySchemes,\n workspaceStore.auth,\n document.value?.['x-scalar-navigation']?.name ?? '',\n ),\n)\n\ndefineExpose({\n sidebarWidth,\n environment,\n})\n</script>\n\n<template>\n <ModalClientContainer :modalState>\n <!-- Toasts -->\n <ScalarToasts />\n\n <!-- If we have a document, path and method, render the operation -->\n <main\n v-if=\"document.value && path?.value && method?.value\"\n class=\"relative flex h-full min-h-0 w-full flex-1\">\n <SidebarToggle\n v-model=\"isSidebarOpen\"\n class=\"absolute top-2 left-3 z-2\" />\n <Sidebar\n v-show=\"isSidebarOpen\"\n v-model:sidebarWidth=\"sidebarWidth\"\n :activeWorkspace=\"activeWorkspace\"\n class=\"h-full max-md:absolute! max-md:w-full!\"\n :documents=\"[document.value]\"\n :eventBus\n :isDroppable=\"() => false\"\n layout=\"modal\"\n :sidebarState=\"sidebarState.state\"\n :workspaces=\"[]\"\n @selectItem=\"sidebarState.handleSelectItem\"\n @update:sidebarWidth=\"handleSidebarWidthUpdate\" />\n <Operation\n :activeWorkspace=\"activeWorkspace\"\n class=\"flex-1\"\n :document=\"document.value\"\n :documentSlug=\"document.value['x-scalar-navigation']?.id ?? ''\"\n :environment\n :eventBus\n :exampleName=\"exampleName?.value\"\n layout=\"modal\"\n :method=\"method?.value\"\n :options\n :path=\"path?.value\"\n :plugins\n :requestBodyCompositionSelection=\"requestBodyCompositionSelection.value\"\n :securitySchemes\n :workspaceStore />\n </main>\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span class=\"text-c-3\">No document selected</span>\n </div>\n </ModalClientContainer>\n</template>\n"],"mappings":""}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import ModalClientContainer_default from "../../components/modals/ModalClientContainer.vue.js";
|
|
2
|
-
import { mergeSecurity } from "../../blocks/scalar-auth-selector-block/helpers/merge-security.js";
|
|
3
|
-
import Operation_default from "../operation/Operation.vue.js";
|
|
4
2
|
import Sidebar_default from "../../components/sidebar/Sidebar.vue.js";
|
|
5
3
|
import SidebarToggle_default from "../../components/sidebar/SidebarToggle.vue.js";
|
|
6
|
-
import { getActiveEnvironment } from "../../helpers/get-active-environment.js";
|
|
7
4
|
import { useGlobalHotKeys } from "../../hooks/use-global-hot-keys.js";
|
|
5
|
+
import Operation_default from "../operation/Operation.vue.js";
|
|
8
6
|
import { initializeModalEvents } from "./modal-events.js";
|
|
9
7
|
import { useScrollLock } from "../../hooks/use-scroll-lock.js";
|
|
10
8
|
import { computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, onBeforeUnmount, openBlock, ref, toValue, unref, vShow, watch, withCtx, withDirectives } from "vue";
|
|
11
9
|
import { ScalarToasts } from "@scalar/use-toasts";
|
|
10
|
+
import { getActiveEnvironment, mergeSecurity } from "@scalar/workspace-store/request-example";
|
|
12
11
|
//#region src/v2/features/modal/Modal.vue?vue&type=script&setup=true&lang.ts
|
|
13
12
|
var _hoisted_1 = {
|
|
14
13
|
key: 0,
|
|
@@ -75,7 +74,7 @@ var Modal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
75
74
|
* Variables from both sources are combined, with document variables
|
|
76
75
|
* taking precedence in case of naming conflicts.
|
|
77
76
|
*/
|
|
78
|
-
const environment = computed(() => getActiveEnvironment(__props.workspaceStore, __props.document.value));
|
|
77
|
+
const environment = computed(() => getActiveEnvironment(__props.workspaceStore, __props.document.value).environment);
|
|
79
78
|
/** Merge authentication config with the document security schemes */
|
|
80
79
|
const securitySchemes = computed(() => mergeSecurity(__props.document.value?.components?.securitySchemes, toValue(__props.options)?.authentication?.securitySchemes, __props.workspaceStore.auth, __props.document.value?.["x-scalar-navigation"]?.name ?? ""));
|
|
81
80
|
__expose({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.vue.script.js","names":[],"sources":["../../../../src/v2/features/modal/Modal.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type ModalProps = {\n /** The workspace store must be initialized and passed in */\n workspaceStore: WorkspaceStore\n /** The document must be initialized and passed in */\n document: ComputedRef<WorkspaceDocument | null>\n /** The path must be initialized and passed in */\n path: ComputedRef<string | undefined>\n /** The event bus for handling all events */\n eventBus: WorkspaceEventBus\n /** The method must be initialized and passed in */\n method: ComputedRef<HttpMethod | undefined>\n /** The example name must be initialized and passed in */\n exampleName: ComputedRef<string | undefined>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection: Ref<Record<string, number>>\n /** Controls the visibility of the modal */\n modalState: ModalState\n /** The sidebar state must be initialized and passed in */\n sidebarState: UseModalSidebarReturn\n /** Api client plugins to include in the modal */\n plugins: ClientPlugin[]\n /** Subset of the configuration options for the modal */\n options: MaybeRefOrGetter<\n Partial<\n Pick<\n ApiReferenceConfigurationRaw,\n | 'authentication'\n | 'baseServerURL'\n | 'hideClientButton'\n | 'hiddenClients'\n | 'servers'\n >\n >\n >\n}\n\n/**\n * Scalar Api Client Modal\n *\n * This component is used to render the API Client Modal\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { type ModalState, type ScalarListboxOption } from '@scalar/components'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas'\nimport {\n computed,\n onBeforeUnmount,\n ref,\n toValue,\n watch,\n type ComputedRef,\n type MaybeRefOrGetter,\n type Ref,\n} from 'vue'\n\nimport
|
|
1
|
+
{"version":3,"file":"Modal.vue.script.js","names":[],"sources":["../../../../src/v2/features/modal/Modal.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type ModalProps = {\n /** The workspace store must be initialized and passed in */\n workspaceStore: WorkspaceStore\n /** The document must be initialized and passed in */\n document: ComputedRef<WorkspaceDocument | null>\n /** The path must be initialized and passed in */\n path: ComputedRef<string | undefined>\n /** The event bus for handling all events */\n eventBus: WorkspaceEventBus\n /** The method must be initialized and passed in */\n method: ComputedRef<HttpMethod | undefined>\n /** The example name must be initialized and passed in */\n exampleName: ComputedRef<string | undefined>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection: Ref<Record<string, number>>\n /** Controls the visibility of the modal */\n modalState: ModalState\n /** The sidebar state must be initialized and passed in */\n sidebarState: UseModalSidebarReturn\n /** Api client plugins to include in the modal */\n plugins: ClientPlugin[]\n /** Subset of the configuration options for the modal */\n options: MaybeRefOrGetter<\n Partial<\n Pick<\n ApiReferenceConfigurationRaw,\n | 'authentication'\n | 'baseServerURL'\n | 'hideClientButton'\n | 'hiddenClients'\n | 'servers'\n >\n >\n >\n}\n\n/**\n * Scalar Api Client Modal\n *\n * This component is used to render the API Client Modal\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { type ModalState, type ScalarListboxOption } from '@scalar/components'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport {\n getActiveEnvironment,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas'\nimport {\n computed,\n onBeforeUnmount,\n ref,\n toValue,\n watch,\n type ComputedRef,\n type MaybeRefOrGetter,\n type Ref,\n} from 'vue'\n\nimport ModalClientContainer from '@/v2/components/modals/ModalClientContainer.vue'\nimport { Sidebar, SidebarToggle } from '@/v2/components/sidebar'\nimport { type UseModalSidebarReturn } from '@/v2/features/modal/hooks/use-modal-sidebar'\nimport { initializeModalEvents } from '@/v2/features/modal/modal-events'\nimport Operation from '@/v2/features/operation/Operation.vue'\nimport { useGlobalHotKeys } from '@/v2/hooks/use-global-hot-keys'\nimport { useScrollLock } from '@/v2/hooks/use-scroll-lock'\n\nconst {\n document,\n eventBus,\n modalState,\n options,\n plugins,\n requestBodyCompositionSelection,\n sidebarState,\n workspaceStore,\n} = defineProps<ModalProps>()\n\nconst activeWorkspace: ScalarListboxOption = {\n label: 'default',\n id: 'default',\n}\n\n/** Controls the visibility of the sidebar. */\nconst isSidebarOpen = ref(false)\n\n/** Initialize modal events */\ninitializeModalEvents({\n eventBus,\n isSidebarOpen,\n requestBodyCompositionSelection,\n sidebarState,\n modalState,\n store: workspaceStore,\n})\n\n/** Register global hotkeys for the app, passing the workspace event bus and layout state */\nuseGlobalHotKeys(eventBus, 'modal', () => !modalState.open)\n\n/** Clean up on close */\nconst cleanUp = () => {\n eventBus.emit('operation:cancel:request')\n}\n\nconst isLocked = useScrollLock(() => {\n if (typeof window !== 'undefined') {\n return window.document.body\n }\n return null\n})\n\nwatch(\n () => modalState.open,\n (open) => {\n // Make sure scrolling is locked or unlocked when the modal is opened or closed\n isLocked.value = open\n\n if (!open) {\n cleanUp()\n }\n },\n)\n\n// Ensure we add our scalar wrapper class to the headless ui root\nonBeforeUnmount(() => cleanUp())\n\n/** Default sidebar width in pixels. */\nconst DEFAULT_SIDEBAR_WIDTH = 288\n\n/** Width of the sidebar, with fallback to default. */\nconst sidebarWidth = computed(\n () =>\n workspaceStore?.workspace?.['x-scalar-sidebar-width'] ??\n DEFAULT_SIDEBAR_WIDTH,\n)\n\n/** Handler for sidebar width changes. */\nconst handleSidebarWidthUpdate = (width: number) =>\n workspaceStore?.update('x-scalar-sidebar-width', width)\n\n/**\n * Merged environment variables from workspace and document levels.\n * Variables from both sources are combined, with document variables\n * taking precedence in case of naming conflicts.\n */\nconst environment = computed(\n () => getActiveEnvironment(workspaceStore, document.value).environment,\n)\n\n/** Merge authentication config with the document security schemes */\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document.value?.components?.securitySchemes,\n toValue(options)?.authentication?.securitySchemes,\n workspaceStore.auth,\n document.value?.['x-scalar-navigation']?.name ?? '',\n ),\n)\n\ndefineExpose({\n sidebarWidth,\n environment,\n})\n</script>\n\n<template>\n <ModalClientContainer :modalState>\n <!-- Toasts -->\n <ScalarToasts />\n\n <!-- If we have a document, path and method, render the operation -->\n <main\n v-if=\"document.value && path?.value && method?.value\"\n class=\"relative flex h-full min-h-0 w-full flex-1\">\n <SidebarToggle\n v-model=\"isSidebarOpen\"\n class=\"absolute top-2 left-3 z-2\" />\n <Sidebar\n v-show=\"isSidebarOpen\"\n v-model:sidebarWidth=\"sidebarWidth\"\n :activeWorkspace=\"activeWorkspace\"\n class=\"h-full max-md:absolute! max-md:w-full!\"\n :documents=\"[document.value]\"\n :eventBus\n :isDroppable=\"() => false\"\n layout=\"modal\"\n :sidebarState=\"sidebarState.state\"\n :workspaces=\"[]\"\n @selectItem=\"sidebarState.handleSelectItem\"\n @update:sidebarWidth=\"handleSidebarWidthUpdate\" />\n <Operation\n :activeWorkspace=\"activeWorkspace\"\n class=\"flex-1\"\n :document=\"document.value\"\n :documentSlug=\"document.value['x-scalar-navigation']?.id ?? ''\"\n :environment\n :eventBus\n :exampleName=\"exampleName?.value\"\n layout=\"modal\"\n :method=\"method?.value\"\n :options\n :path=\"path?.value\"\n :plugins\n :requestBodyCompositionSelection=\"requestBodyCompositionSelection.value\"\n :securitySchemes\n :workspaceStore />\n </main>\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span class=\"text-c-3\">No document selected</span>\n </div>\n </ModalClientContainer>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwFA,MAAM,kBAAuC;GAC3C,OAAO;GACP,IAAI;GACN;;EAGA,MAAM,gBAAgB,IAAI,MAAK;;AAG/B,wBAAsB;GACpB,UAAO,QAAA;GACP;GACA,iCAA8B,QAAA;GAC9B,cAAW,QAAA;GACX,YAAS,QAAA;GACT,OAAO,QAAA;GACR,CAAA;;AAGD,mBAAiB,QAAA,UAAU,eAAe,CAAC,QAAA,WAAW,KAAI;;EAG1D,MAAM,gBAAgB;AACpB,WAAA,SAAS,KAAK,2BAA0B;;EAG1C,MAAM,WAAW,oBAAoB;AACnC,OAAI,OAAO,WAAW,YACpB,QAAO,OAAO,SAAS;AAEzB,UAAO;IACR;AAED,cACQ,QAAA,WAAW,OAChB,SAAS;AAER,YAAS,QAAQ;AAEjB,OAAI,CAAC,KACH,UAAQ;IAGd;AAGA,wBAAsB,SAAS,CAAA;;EAG/B,MAAM,wBAAwB;;EAG9B,MAAM,eAAe,eAEjB,QAAA,gBAAgB,YAAY,6BAC5B,sBACJ;;EAGA,MAAM,4BAA4B,UAChC,QAAA,gBAAgB,OAAO,0BAA0B,MAAK;;;;;;EAOxD,MAAM,cAAc,eACZ,qBAAqB,QAAA,gBAAgB,QAAA,SAAS,MAAM,CAAC,YAC7D;;EAGA,MAAM,kBAAkB,eACtB,cACE,QAAA,SAAS,OAAO,YAAY,iBAC5B,QAAQ,QAAA,QAAQ,EAAE,gBAAgB,iBAClC,QAAA,eAAe,MACf,QAAA,SAAS,QAAQ,wBAAwB,QAAQ,GAClD,CACH;AAEA,WAAa;GACX;GACA;GACD,CAAA;;uBAIC,YA+CuB,8BAAA,EA/CA,YAAA,QAAA,YAAU,EAAA;2BAEf,CAAhB,YAAgB,MAAA,aAAA,CAAA,EAIR,QAAA,SAAS,SAAS,QAAA,MAAM,SAAS,QAAA,QAAQ,SAAA,WAAA,EADjD,mBAmCO,QAnCP,YAmCO;KAhCL,YAEsC,MAAA,sBAAA,EAAA;kBAD3B,cAAA;iFAAa,QAAA;MACtB,OAAM;;oBACR,YAYoD,MAAA,gBAAA,EAAA;MAV1C,cAAc,aAAA;mFAAY,QAAA,SAUZ,yBAAA;MATJ;MAClB,OAAM;MACL,WAAS,CAAG,QAAA,SAAS,MAAK;MAC1B,UAAA,QAAA;MACA,mBAAa;MACd,QAAO;MACN,cAAc,QAAA,aAAa;MAC3B,YAAY,EAAE;MACd,cAAY,QAAA,aAAa;;;;;;;kBAVlB,cAAA,MAAa,CAAA,CAAA;KAYvB,YAeoB,mBAAA;MAdA;MAClB,OAAM;MACL,UAAU,QAAA,SAAS;MACnB,cAAc,QAAA,SAAS,MAAK,wBAAyB,MAAE;MACvD,aAAA,YAAA;MACA,UAAA,QAAA;MACA,aAAa,QAAA,aAAa;MAC3B,QAAO;MACN,QAAQ,QAAA,QAAQ;MAChB,SAAA,QAAA;MACA,MAAM,QAAA,MAAM;MACZ,SAAA,QAAA;MACA,iCAAiC,QAAA,gCAAgC;MACjE,iBAAA,gBAAA;MACA,gBAAA,QAAA;;;;;;;;;;;;;;;wBAGL,mBAIM,OAJN,YAIM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CADJ,mBAAkD,QAAA,EAA5C,OAAM,YAAU,EAAC,wBAAoB,GAAA,CAAA,EAAA,CAAA,EAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { objectKeys } from "@scalar/helpers/object/object-keys";
|
|
2
1
|
import { AVAILABLE_CLIENTS, GROUPED_CLIENTS } from "@scalar/types/snippetz";
|
|
2
|
+
import { objectKeys } from "@scalar/helpers/object/object-keys";
|
|
3
3
|
//#region src/v2/features/modal/helpers/map-hidden-clients-config.ts
|
|
4
4
|
/**
|
|
5
5
|
* Map the old hiddenClients config to the new httpClients config.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AAiMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAG/D;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEd,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;IAC/B,sEAAsE;sCACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;IAHxD,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;IAC/B,sEAAsE;sCACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;iGAoPxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport
|
|
1
|
+
{"version":3,"file":"Operation.vue.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n getActiveProxyUrl,\n getRequestExampleContext,\n} from '@scalar/workspace-store/request-example'\nimport { computed, toValue } from 'vue'\n\nimport { isElectron } from '@/libs/electron'\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport { APP_VERSION } from '@/v2/constants'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\n\nconst {\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n workspaceStore,\n plugins,\n documentSlug,\n} = defineProps<\n RouteProps & {\n /** Subset of config options for the modal */\n options?: ModalProps['options']\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n }\n>()\n\n/**\n * Shared request-example context (operation, servers, auth scope, cookies). Recomputed when any\n * underlying workspace or route input changes — same reactivity as the previous local computeds.\n */\nconst requestExample = computed(() => {\n if (!path || !method || !exampleName || !document) {\n return null\n }\n\n const result = getRequestExampleContext(\n workspaceStore,\n documentSlug,\n { path, method, exampleName },\n {\n baseServerUrl: toValue(options)?.baseServerURL,\n fallbackDocument: document,\n isElectron: isElectron(),\n layout: layout === 'web' ? 'web' : 'other',\n servers: toValue(options)?.servers,\n appVersion: APP_VERSION,\n },\n )\n\n return result.ok ? result.data : null\n})\n\nconst operation = computed(() => requestExample.value?.operation ?? null)\nconst workspaceCookies = computed(\n () => requestExample.value?.cookies.workspace ?? [],\n)\nconst documentCookies = computed(\n () => requestExample.value?.cookies.document ?? [],\n)\nconst servers = computed(() => requestExample.value?.servers.list ?? [])\nconst selectedServer = computed(\n () => requestExample.value?.servers.selected ?? null,\n)\nconst serverMeta = computed(\n () => requestExample.value?.servers.meta ?? { type: 'document' as const },\n)\n\nconst securitySchemes = computed(\n () => requestExample.value?.security.schemes ?? {},\n)\n\nconst selectedSecurity = computed(\n () =>\n requestExample.value?.security.selected ?? {\n selectedIndex: -1,\n selectedSchemes: [],\n },\n)\nconst selectedSecuritySchemes = computed(\n () => requestExample.value?.security.selectedSchemes ?? [],\n)\nconst securityRequirements = computed(\n () => requestExample.value?.security.requirements ?? [],\n)\nconst authMeta = computed(\n () => requestExample.value?.security.meta ?? { type: 'document' as const },\n)\n\nconst defaultHeaders = computed(\n () => requestExample.value?.headers.default ?? {},\n)\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation\">\n <OperationBlock\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :defaultHeaders\n :documentCookies\n :documentSecurity=\"document?.security ?? []\"\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :layout\n :method\n :operation\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? ''\n \"\n :requestBodyCompositionSelection\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :selectedSecurity=\"selectedSecurity\"\n :selectedSecuritySchemes=\"selectedSecuritySchemes\"\n :server=\"selectedServer\"\n :serverMeta\n :servers\n :workspaceCookies />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span class=\"text-c-3\">Select an operation to view details</span>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
+
import { isElectron } from "../../../libs/electron.js";
|
|
1
2
|
import { APP_VERSION } from "../../constants.js";
|
|
2
|
-
import { combineParams } from "./helpers/combine-params.js";
|
|
3
|
-
import { getSelectedServer } from "./helpers/get-selected-server.js";
|
|
4
|
-
import { mapHiddenClientsConfig } from "../modal/helpers/map-hidden-clients-config.js";
|
|
5
|
-
import { getActiveProxyUrl } from "../../helpers/get-active-proxy-url.js";
|
|
6
|
-
import { getServers } from "../../helpers/get-servers.js";
|
|
7
3
|
import OperationBlock_default from "../../blocks/operation-block/OperationBlock.vue.js";
|
|
4
|
+
import { mapHiddenClientsConfig } from "../modal/helpers/map-hidden-clients-config.js";
|
|
8
5
|
import { computed, createBlock, createElementBlock, createElementVNode, defineComponent, openBlock, toValue, unref } from "vue";
|
|
9
|
-
import {
|
|
6
|
+
import { getActiveProxyUrl, getRequestExampleContext } from "@scalar/workspace-store/request-example";
|
|
10
7
|
//#region src/v2/features/operation/Operation.vue?vue&type=script&setup=true&lang.ts
|
|
11
8
|
var _hoisted_1 = {
|
|
12
9
|
key: 1,
|
|
@@ -23,7 +20,6 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
23
20
|
method: {},
|
|
24
21
|
exampleName: {},
|
|
25
22
|
environment: {},
|
|
26
|
-
securitySchemes: {},
|
|
27
23
|
workspaceStore: {},
|
|
28
24
|
activeWorkspace: {},
|
|
29
25
|
plugins: {},
|
|
@@ -37,77 +33,41 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
37
33
|
requestBodyCompositionSelection: {}
|
|
38
34
|
},
|
|
39
35
|
setup(__props) {
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const parameters = combineParams(pathItem.value.parameters, operation.parameters);
|
|
52
|
-
return {
|
|
53
|
-
...operation,
|
|
54
|
-
parameters
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
/** Combine the workspace and document cookies */
|
|
58
|
-
const globalCookies = computed(() => [...(__props.workspaceStore.workspace?.["x-scalar-cookies"] ?? []).map((it) => ({
|
|
59
|
-
...it,
|
|
60
|
-
location: "workspace"
|
|
61
|
-
})), ...(__props.document?.["x-scalar-cookies"] ?? []).map((it) => ({
|
|
62
|
-
...it,
|
|
63
|
-
location: "document"
|
|
64
|
-
}))]);
|
|
65
|
-
/** Compute the servers for the operation */
|
|
66
|
-
const servers = computed(() => {
|
|
67
|
-
return getServers(toValue(__props.options)?.servers ?? operation.value?.servers ?? __props.document?.servers, {
|
|
36
|
+
/**
|
|
37
|
+
* Shared request-example context (operation, servers, auth scope, cookies). Recomputed when any
|
|
38
|
+
* underlying workspace or route input changes — same reactivity as the previous local computeds.
|
|
39
|
+
*/
|
|
40
|
+
const requestExample = computed(() => {
|
|
41
|
+
if (!__props.path || !__props.method || !__props.exampleName || !__props.document) return null;
|
|
42
|
+
const result = getRequestExampleContext(__props.workspaceStore, __props.documentSlug, {
|
|
43
|
+
path: __props.path,
|
|
44
|
+
method: __props.method,
|
|
45
|
+
exampleName: __props.exampleName
|
|
46
|
+
}, {
|
|
68
47
|
baseServerUrl: toValue(__props.options)?.baseServerURL,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (toValue(__props.options)?.servers != null) return __props.document?.["x-scalar-selected-server"];
|
|
75
|
-
if (operation.value?.servers != null) return operation.value["x-scalar-selected-server"];
|
|
76
|
-
return __props.document?.["x-scalar-selected-server"];
|
|
77
|
-
});
|
|
78
|
-
/** Selected server for the operation (document-level or operation-level servers) */
|
|
79
|
-
const selectedServer = computed(() => getSelectedServer(servers.value, selectedServerUrl.value));
|
|
80
|
-
const serverMeta = computed(() => {
|
|
81
|
-
if (operation.value?.servers != null) return {
|
|
82
|
-
type: "operation",
|
|
83
|
-
path: __props.path ?? "",
|
|
84
|
-
method: __props.method ?? "get"
|
|
85
|
-
};
|
|
86
|
-
return { type: "document" };
|
|
87
|
-
});
|
|
88
|
-
const documentSelectedSecurity = computed(() => {
|
|
89
|
-
return __props.workspaceStore.auth.getAuthSelectedSchemas({
|
|
90
|
-
type: "document",
|
|
91
|
-
documentName: __props.documentSlug
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
const operationSelectedSecurity = computed(() => {
|
|
95
|
-
return __props.workspaceStore.auth.getAuthSelectedSchemas({
|
|
96
|
-
type: "operation",
|
|
97
|
-
documentName: __props.documentSlug,
|
|
98
|
-
path: __props.path ?? "",
|
|
99
|
-
method: __props.method ?? "get"
|
|
48
|
+
fallbackDocument: __props.document,
|
|
49
|
+
isElectron: isElectron(),
|
|
50
|
+
layout: __props.layout === "web" ? "web" : "other",
|
|
51
|
+
servers: toValue(__props.options)?.servers,
|
|
52
|
+
appVersion: APP_VERSION
|
|
100
53
|
});
|
|
54
|
+
return result.ok ? result.data : null;
|
|
101
55
|
});
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
56
|
+
const operation = computed(() => requestExample.value?.operation ?? null);
|
|
57
|
+
const workspaceCookies = computed(() => requestExample.value?.cookies.workspace ?? []);
|
|
58
|
+
const documentCookies = computed(() => requestExample.value?.cookies.document ?? []);
|
|
59
|
+
const servers = computed(() => requestExample.value?.servers.list ?? []);
|
|
60
|
+
const selectedServer = computed(() => requestExample.value?.servers.selected ?? null);
|
|
61
|
+
const serverMeta = computed(() => requestExample.value?.servers.meta ?? { type: "document" });
|
|
62
|
+
const securitySchemes = computed(() => requestExample.value?.security.schemes ?? {});
|
|
63
|
+
const selectedSecurity = computed(() => requestExample.value?.security.selected ?? {
|
|
64
|
+
selectedIndex: -1,
|
|
65
|
+
selectedSchemes: []
|
|
110
66
|
});
|
|
67
|
+
const selectedSecuritySchemes = computed(() => requestExample.value?.security.selectedSchemes ?? []);
|
|
68
|
+
const securityRequirements = computed(() => requestExample.value?.security.requirements ?? []);
|
|
69
|
+
const authMeta = computed(() => requestExample.value?.security.meta ?? { type: "document" });
|
|
70
|
+
const defaultHeaders = computed(() => requestExample.value?.headers.default ?? {});
|
|
111
71
|
/** Combine environments from document and workspace into a unique array of environment names */
|
|
112
72
|
const environments = computed(() => {
|
|
113
73
|
return Array.from(new Set(Object.keys({
|
|
@@ -123,58 +83,64 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
123
83
|
activeEnvironment: __props.workspaceStore.workspace["x-scalar-active-environment"],
|
|
124
84
|
appVersion: unref(APP_VERSION),
|
|
125
85
|
authMeta: authMeta.value,
|
|
86
|
+
defaultHeaders: defaultHeaders.value,
|
|
87
|
+
documentCookies: documentCookies.value,
|
|
126
88
|
documentSecurity: __props.document?.security ?? [],
|
|
127
|
-
documentSelectedSecurity: documentSelectedSecurity.value,
|
|
128
89
|
documentUrl: __props.document?.["x-scalar-original-source-url"],
|
|
129
90
|
environment: __props.environment,
|
|
130
91
|
environments: environments.value,
|
|
131
92
|
eventBus: __props.eventBus,
|
|
132
93
|
exampleKey: __props.exampleName,
|
|
133
|
-
globalCookies: globalCookies.value,
|
|
134
94
|
hideClientButton: toValue(__props.options)?.hideClientButton ?? false,
|
|
135
95
|
history: __props.workspaceStore.history.getHistory(__props.documentSlug, __props.path, __props.method),
|
|
136
96
|
httpClients: httpClients.value,
|
|
137
97
|
layout: __props.layout,
|
|
138
98
|
method: __props.method,
|
|
139
99
|
operation: operation.value,
|
|
140
|
-
operationSelectedSecurity: operationSelectedSecurity.value,
|
|
141
100
|
path: __props.path,
|
|
142
101
|
plugins: __props.plugins,
|
|
143
|
-
proxyUrl: unref(getActiveProxyUrl)(__props.workspaceStore.workspace["x-scalar-active-proxy"], __props.layout) ?? "",
|
|
102
|
+
proxyUrl: unref(getActiveProxyUrl)(__props.workspaceStore.workspace["x-scalar-active-proxy"], __props.layout === "web" ? "web" : "other") ?? "",
|
|
144
103
|
requestBodyCompositionSelection: __props.requestBodyCompositionSelection,
|
|
145
|
-
|
|
104
|
+
securityRequirements: securityRequirements.value,
|
|
105
|
+
securitySchemes: securitySchemes.value,
|
|
146
106
|
selectedClient: __props.workspaceStore.workspace["x-scalar-default-client"],
|
|
107
|
+
selectedSecurity: selectedSecurity.value,
|
|
108
|
+
selectedSecuritySchemes: selectedSecuritySchemes.value,
|
|
147
109
|
server: selectedServer.value,
|
|
148
110
|
serverMeta: serverMeta.value,
|
|
149
|
-
servers: servers.value
|
|
111
|
+
servers: servers.value,
|
|
112
|
+
workspaceCookies: workspaceCookies.value
|
|
150
113
|
}, null, 8, [
|
|
151
114
|
"activeEnvironment",
|
|
152
115
|
"appVersion",
|
|
153
116
|
"authMeta",
|
|
117
|
+
"defaultHeaders",
|
|
118
|
+
"documentCookies",
|
|
154
119
|
"documentSecurity",
|
|
155
|
-
"documentSelectedSecurity",
|
|
156
120
|
"documentUrl",
|
|
157
121
|
"environment",
|
|
158
122
|
"environments",
|
|
159
123
|
"eventBus",
|
|
160
124
|
"exampleKey",
|
|
161
|
-
"globalCookies",
|
|
162
125
|
"hideClientButton",
|
|
163
126
|
"history",
|
|
164
127
|
"httpClients",
|
|
165
128
|
"layout",
|
|
166
129
|
"method",
|
|
167
130
|
"operation",
|
|
168
|
-
"operationSelectedSecurity",
|
|
169
131
|
"path",
|
|
170
132
|
"plugins",
|
|
171
133
|
"proxyUrl",
|
|
172
134
|
"requestBodyCompositionSelection",
|
|
135
|
+
"securityRequirements",
|
|
173
136
|
"securitySchemes",
|
|
174
137
|
"selectedClient",
|
|
138
|
+
"selectedSecurity",
|
|
139
|
+
"selectedSecuritySchemes",
|
|
175
140
|
"server",
|
|
176
141
|
"serverMeta",
|
|
177
|
-
"servers"
|
|
142
|
+
"servers",
|
|
143
|
+
"workspaceCookies"
|
|
178
144
|
])) : (openBlock(), createElementBlock("div", _hoisted_1, [..._cache[0] || (_cache[0] = [createElementVNode("span", { class: "text-c-3" }, "Select an operation to view details", -1)])]));
|
|
179
145
|
};
|
|
180
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.script.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport
|
|
1
|
+
{"version":3,"file":"Operation.vue.script.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n getActiveProxyUrl,\n getRequestExampleContext,\n} from '@scalar/workspace-store/request-example'\nimport { computed, toValue } from 'vue'\n\nimport { isElectron } from '@/libs/electron'\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport { APP_VERSION } from '@/v2/constants'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\n\nconst {\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n workspaceStore,\n plugins,\n documentSlug,\n} = defineProps<\n RouteProps & {\n /** Subset of config options for the modal */\n options?: ModalProps['options']\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n }\n>()\n\n/**\n * Shared request-example context (operation, servers, auth scope, cookies). Recomputed when any\n * underlying workspace or route input changes — same reactivity as the previous local computeds.\n */\nconst requestExample = computed(() => {\n if (!path || !method || !exampleName || !document) {\n return null\n }\n\n const result = getRequestExampleContext(\n workspaceStore,\n documentSlug,\n { path, method, exampleName },\n {\n baseServerUrl: toValue(options)?.baseServerURL,\n fallbackDocument: document,\n isElectron: isElectron(),\n layout: layout === 'web' ? 'web' : 'other',\n servers: toValue(options)?.servers,\n appVersion: APP_VERSION,\n },\n )\n\n return result.ok ? result.data : null\n})\n\nconst operation = computed(() => requestExample.value?.operation ?? null)\nconst workspaceCookies = computed(\n () => requestExample.value?.cookies.workspace ?? [],\n)\nconst documentCookies = computed(\n () => requestExample.value?.cookies.document ?? [],\n)\nconst servers = computed(() => requestExample.value?.servers.list ?? [])\nconst selectedServer = computed(\n () => requestExample.value?.servers.selected ?? null,\n)\nconst serverMeta = computed(\n () => requestExample.value?.servers.meta ?? { type: 'document' as const },\n)\n\nconst securitySchemes = computed(\n () => requestExample.value?.security.schemes ?? {},\n)\n\nconst selectedSecurity = computed(\n () =>\n requestExample.value?.security.selected ?? {\n selectedIndex: -1,\n selectedSchemes: [],\n },\n)\nconst selectedSecuritySchemes = computed(\n () => requestExample.value?.security.selectedSchemes ?? [],\n)\nconst securityRequirements = computed(\n () => requestExample.value?.security.requirements ?? [],\n)\nconst authMeta = computed(\n () => requestExample.value?.security.meta ?? { type: 'document' as const },\n)\n\nconst defaultHeaders = computed(\n () => requestExample.value?.headers.default ?? {},\n)\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation\">\n <OperationBlock\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :defaultHeaders\n :documentCookies\n :documentSecurity=\"document?.security ?? []\"\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :layout\n :method\n :operation\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? ''\n \"\n :requestBodyCompositionSelection\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :selectedSecurity=\"selectedSecurity\"\n :selectedSecuritySchemes=\"selectedSecuritySchemes\"\n :server=\"selectedServer\"\n :serverMeta\n :servers\n :workspaceCookies />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span class=\"text-c-3\">Select an operation to view details</span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDA,MAAM,iBAAiB,eAAe;AACpC,OAAI,CAAC,QAAA,QAAQ,CAAC,QAAA,UAAU,CAAC,QAAA,eAAe,CAAC,QAAA,SACvC,QAAO;GAGT,MAAM,SAAS,yBACb,QAAA,gBACA,QAAA,cACA;IAAE,MAAG,QAAA;IAAG,QAAK,QAAA;IAAG,aAAU,QAAA;IAAG,EAC7B;IACE,eAAe,QAAQ,QAAA,QAAQ,EAAE;IACjC,kBAAkB,QAAA;IAClB,YAAY,YAAY;IACxB,QAAQ,QAAA,WAAW,QAAQ,QAAQ;IACnC,SAAS,QAAQ,QAAA,QAAQ,EAAE;IAC3B,YAAY;IACb,CACH;AAEA,UAAO,OAAO,KAAK,OAAO,OAAO;IAClC;EAED,MAAM,YAAY,eAAe,eAAe,OAAO,aAAa,KAAI;EACxE,MAAM,mBAAmB,eACjB,eAAe,OAAO,QAAQ,aAAa,EAAE,CACrD;EACA,MAAM,kBAAkB,eAChB,eAAe,OAAO,QAAQ,YAAY,EAAE,CACpD;EACA,MAAM,UAAU,eAAe,eAAe,OAAO,QAAQ,QAAQ,EAAE,CAAA;EACvE,MAAM,iBAAiB,eACf,eAAe,OAAO,QAAQ,YAAY,KAClD;EACA,MAAM,aAAa,eACX,eAAe,OAAO,QAAQ,QAAQ,EAAE,MAAM,YAAqB,CAC3E;EAEA,MAAM,kBAAkB,eAChB,eAAe,OAAO,SAAS,WAAW,EAAE,CACpD;EAEA,MAAM,mBAAmB,eAErB,eAAe,OAAO,SAAS,YAAY;GACzC,eAAe;GACf,iBAAiB,EAAE;GACpB,CACL;EACA,MAAM,0BAA0B,eACxB,eAAe,OAAO,SAAS,mBAAmB,EAAE,CAC5D;EACA,MAAM,uBAAuB,eACrB,eAAe,OAAO,SAAS,gBAAgB,EAAE,CACzD;EACA,MAAM,WAAW,eACT,eAAe,OAAO,SAAS,QAAQ,EAAE,MAAM,YAAqB,CAC5E;EAEA,MAAM,iBAAiB,eACf,eAAe,OAAO,QAAQ,WAAW,EAAE,CACnD;;EAGA,MAAM,eAAe,eAAe;AAClC,UAAO,MAAM,KACX,IAAI,IACF,OAAO,KAAK;IACV,GAAG,QAAA,WAAW;IACd,GAAG,QAAA,eAAe,UAAU;IAC7B,CAAC,CACH,CACH;IACD;;EAGD,MAAM,cAAc,eAClB,uBAAuB,QAAQ,QAAA,QAAQ,EAAE,cAAc,CACzD;;UAKkB,QAAA,QAAQ,QAAA,UAAU,QAAA,eAAe,UAAA,SAAA,WAAA,EAC/C,YAqCsB,MAAA,uBAAA,EAAA;;IApCnB,mBAA4B,QAAA,eAAe,UAAS;IAGpD,YAAY,MAAA,YAAW;IACvB,UAAA,SAAA;IACA,gBAAA,eAAA;IACA,iBAAA,gBAAA;IACA,kBAAkB,QAAA,UAAU,YAAQ,EAAA;IACpC,aAAa,QAAA,WAAQ;IACrB,aAAA,QAAA;IACA,cAAA,aAAA;IACA,UAAA,QAAA;IACA,YAAY,QAAA;IACZ,kBAAkB,QAAQ,QAAA,QAAO,EAAG,oBAAgB;IACpD,SAAS,QAAA,eAAe,QAAQ,WAAW,QAAA,cAAc,QAAA,MAAM,QAAA,OAAM;IACrE,aAAA,YAAA;IACA,QAAA,QAAA;IACA,QAAA,QAAA;IACA,WAAA,UAAA;IACA,MAAA,QAAA;IACA,SAAS,QAAA;IACT,UAAmB,MAAA,kBAAiB,CAAY,QAAA,eAAe,UAAS,0BAAqC,QAAA,WAAM,QAAA,QAAA,QAAA,IAAA;IAMnH,iCAAA,QAAA;IACA,sBAAsB,qBAAA;IACtB,iBAAA,gBAAA;IACA,gBAAgB,QAAA,eAAe,UAAS;IACxC,kBAAkB,iBAAA;IAClB,yBAAyB,wBAAA;IACzB,QAAQ,eAAA;IACR,YAAA,WAAA;IACA,SAAA,QAAA;IACA,kBAAA,iBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAIL,mBAIM,OAJN,YAIM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CADJ,mBAAiE,QAAA,EAA3D,OAAM,YAAU,EAAC,uCAAmC,GAAA,CAAA,EAAA,CAAA"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export { combineParams } from './helpers/combine-params.js';
|
|
2
|
-
export { getSecurityRequirements } from './helpers/get-security-requirements.js';
|
|
3
|
-
export { getSelectedSecurity } from './helpers/get-selected-security.js';
|
|
4
|
-
export { getSelectedServer } from './helpers/get-selected-server.js';
|
|
5
1
|
export { default as Operation } from './Operation.vue.js';
|
|
6
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import { combineParams } from "./helpers/combine-params.js";
|
|
2
|
-
import { getSecurityRequirements } from "./helpers/get-security-requirements.js";
|
|
3
|
-
import { getSelectedSecurity } from "./helpers/get-selected-security.js";
|
|
4
|
-
import { getSelectedServer } from "./helpers/get-selected-server.js";
|
|
5
1
|
import Operation_default from "./Operation.vue.js";
|
|
6
|
-
export { Operation_default as Operation
|
|
2
|
+
export { Operation_default as Operation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/OAuth2.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/OAuth2.vue"],"names":[],"mappings":"AAyTA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,MAAM,EACZ,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AASrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAQ1D,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,IAAI,EAAE,UAAU,CAAA;IAChB,WAAW,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;AAkBF,KAAK,WAAW,GAAG;IACjB,eAAe,CAAC,EAAE,MAAM,OAAO,CAAA;CAChC,CAAC;AAylBF,QAAA,MAAM,UAAU;;;;kFAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2.vue.js","names":[],"sources":["../../../../../src/views/Request/RequestSection/RequestAuth/OAuth2.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton, useLoadingState } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n pkceOptions,\n type Collection,\n type Oauth2Flow,\n type SecuritySchemeOauth2,\n type Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { useToasts } from '@scalar/use-toasts'\n\nimport { DataTableRow } from '@/components/DataTable'\nimport type { EnvVariable } from '@/store/active-entities'\nimport { useWorkspace, type UpdateScheme } from '@/store/store'\nimport { authorizeOauth2 } from '@/views/Request/libs'\nimport { updateScheme as _updateScheme } from '@/views/Request/RequestSection/helpers/update-scheme'\n\nimport OAuthScopesInput from './OAuthScopesInput.vue'\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n collection,\n environment,\n envVariables,\n flow,\n persistAuth = false,\n scheme,\n server,\n workspace,\n} = defineProps<{\n collection: Collection\n environment: Environment\n envVariables: EnvVariable[]\n flow: Oauth2Flow\n persistAuth: boolean\n scheme: SecuritySchemeOauth2\n server: Server | undefined\n workspace: Workspace\n}>()\n\nconst emits = defineEmits<{\n authorized: []\n}>()\n\ndefineSlots<{\n 'oauth-actions'?: () => unknown\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\nconst storeContext = useWorkspace()\n\n/** Update the current scheme */\nconst updateScheme: UpdateScheme = (path, value) =>\n _updateScheme(scheme.uid, path, value, storeContext, persistAuth)\n\n/** Authorize the user using specified flow */\nconst handleAuthorize = async () => {\n if (loader.isActive || !collection?.uid) {\n return\n }\n if (!server) {\n toast('No server selected', 'error')\n return\n }\n loader.start()\n\n const [error, accessToken] = await authorizeOauth2(\n flow,\n server,\n workspace?.proxyUrl,\n )\n\n await loader.clear()\n\n if (accessToken) {\n updateScheme(`flows.${flow.type}.token`, accessToken)\n emits('authorized')\n } else {\n console.error(error)\n toast(error?.message ?? 'Failed to authorize', 'error')\n }\n}\n\n/** To make prop drilling a little easier */\nconst dataTableInputProps = {\n environment,\n envVariables,\n workspace,\n}\n</script>\n\n<template>\n <!-- Access Token Granted -->\n <template v-if=\"flow.token\">\n <DataTableRow>\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n class=\"border-r-transparent\"\n :modelValue=\"flow.token\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @update:modelValue=\"(v) => updateScheme(`flows.${flow.type}.token`, v)\">\n Access Token\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-1 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"updateScheme(`flows.${flow.type}.token`, '')\">\n Clear\n </ScalarButton>\n <slot name=\"oauth-actions\" />\n </div>\n </DataTableRow>\n </template>\n\n <template v-else>\n <DataTableRow>\n <!-- Auth URL -->\n <RequestAuthDataTableInput\n v-if=\"'authorizationUrl' in flow\"\n v-bind=\"dataTableInputProps\"\n containerClass=\"border-r-0\"\n :modelValue=\"flow.authorizationUrl\"\n placeholder=\"https://galaxy.scalar.com/authorize\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.authorizationUrl`, v)\n \">\n Auth URL\n </RequestAuthDataTableInput>\n\n <!-- Token URL -->\n <RequestAuthDataTableInput\n v-if=\"'tokenUrl' in flow\"\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow.tokenUrl\"\n placeholder=\"https://galaxy.scalar.com/token\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.tokenUrl`, v)\n \">\n Token URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-scalar-redirect-uri' in flow\">\n <!-- Redirect URI -->\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow['x-scalar-redirect-uri']\"\n placeholder=\"https://galaxy.scalar.com/callback\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.x-scalar-redirect-uri`, v)\n \">\n Redirect URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Username and password -->\n <template v-if=\"flow.type === 'password'\">\n <DataTableRow>\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n class=\"text-c-2\"\n :modelValue=\"flow.username\"\n placeholder=\"janedoe\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.username`, v)\n \">\n Username\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow.password\"\n placeholder=\"********\"\n type=\"password\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.password`, v)\n \">\n Password\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <!-- Client ID -->\n <DataTableRow>\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow['x-scalar-client-id']\"\n placeholder=\"12345\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.x-scalar-client-id`, v)\n \">\n Client ID\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Client Secret (Authorization Code / Client Credentials / Password (optional)) -->\n <DataTableRow v-if=\"'clientSecret' in flow\">\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow.clientSecret\"\n placeholder=\"XYZ123\"\n type=\"password\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.clientSecret`, v)\n \">\n Client Secret\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- PKCE -->\n <DataTableRow v-if=\"'x-usePkce' in flow\">\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :enum=\"pkceOptions\"\n :modelValue=\"flow['x-usePkce']\"\n readOnly\n @update:modelValue=\"\n (v) =>\n updateScheme(\n `flows.${flow.type}.x-usePkce`,\n v as (typeof pkceOptions)[number],\n )\n \">\n Use PKCE\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Scopes -->\n <DataTableRow v-if=\"Object.keys(flow.scopes ?? {}).length\">\n <OAuthScopesInput\n :flow=\"flow\"\n :updateScheme=\"updateScheme\" />\n </DataTableRow>\n\n <!-- Open ID Connect -->\n <!-- <DataTableRow -->\n <!-- v-else-if=\"activeScheme?.type === 'openIdConnect'\" -->\n <!-- class=\"border-r-transparent\"> -->\n <!-- <DataTableInput -->\n <!-- v-model=\"password\" -->\n <!-- placeholder=\"Token\"> -->\n <!-- TODO -->\n <!-- </DataTableInput> -->\n <!-- <DataTableCell class=\"flex items-center\"> -->\n <!-- <ScalarButton size=\"sm\"> Authorize </ScalarButton> -->\n <!-- </DataTableCell> -->\n <!-- </DataTableRow> -->\n </template>\n <template v-if=\"!flow.token\">\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleAuthorize\">\n Authorize\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"OAuth2.vue.js","names":[],"sources":["../../../../../src/views/Request/RequestSection/RequestAuth/OAuth2.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton, useLoadingState } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n pkceOptions,\n type Collection,\n type Oauth2Flow,\n type SecuritySchemeOauth2,\n type Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { useToasts } from '@scalar/use-toasts'\nimport { computed, ref, watch } from 'vue'\n\nimport { DataTableRow } from '@/components/DataTable'\nimport {\n resolveDefaultOAuth2RedirectUri,\n useClientConfig,\n} from '@/hooks/useClientConfig'\nimport type { EnvVariable } from '@/store/active-entities'\nimport { useWorkspace, type UpdateScheme } from '@/store/store'\nimport { authorizeOauth2 } from '@/views/Request/libs'\nimport { updateScheme as _updateScheme } from '@/views/Request/RequestSection/helpers/update-scheme'\n\nimport OAuthScopesInput from './OAuthScopesInput.vue'\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n collection,\n environment,\n envVariables,\n flow,\n persistAuth = false,\n scheme,\n server,\n workspace,\n} = defineProps<{\n collection: Collection\n environment: Environment\n envVariables: EnvVariable[]\n flow: Oauth2Flow\n persistAuth: boolean\n scheme: SecuritySchemeOauth2\n server: Server | undefined\n workspace: Workspace\n}>()\n\nconst emits = defineEmits<{\n authorized: []\n}>()\n\ndefineSlots<{\n 'oauth-actions'?: () => unknown\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\nconst storeContext = useWorkspace()\nconst config = useClientConfig()\n\n/** Update the current scheme */\nconst updateScheme: UpdateScheme = (path, value) =>\n _updateScheme(scheme.uid, path, value, storeContext, persistAuth)\n\nconst hasPrefilledRedirectUri = ref(false)\nconst defaultRedirectUri = computed<string>(() =>\n resolveDefaultOAuth2RedirectUri(config.value),\n)\n\nwatch(\n () =>\n 'x-scalar-redirect-uri' in flow ? flow['x-scalar-redirect-uri'] : undefined,\n (currentRedirectUri) => {\n if (\n !('x-scalar-redirect-uri' in flow) ||\n hasPrefilledRedirectUri.value ||\n currentRedirectUri\n ) {\n return\n }\n\n if (!defaultRedirectUri.value) {\n return\n }\n\n hasPrefilledRedirectUri.value = true\n updateScheme(\n `flows.${flow.type}.x-scalar-redirect-uri`,\n defaultRedirectUri.value,\n )\n },\n { immediate: true },\n)\n\n/** Authorize the user using specified flow */\nconst handleAuthorize = async () => {\n if (loader.isActive || !collection?.uid) {\n return\n }\n if (!server) {\n toast('No server selected', 'error')\n return\n }\n loader.start()\n\n const [error, accessToken] = await authorizeOauth2(\n flow,\n server,\n workspace?.proxyUrl,\n )\n\n await loader.clear()\n\n if (accessToken) {\n updateScheme(`flows.${flow.type}.token`, accessToken)\n emits('authorized')\n } else {\n console.error(error)\n toast(error?.message ?? 'Failed to authorize', 'error')\n }\n}\n\n/** To make prop drilling a little easier */\nconst dataTableInputProps = {\n environment,\n envVariables,\n workspace,\n}\n</script>\n\n<template>\n <!-- Access Token Granted -->\n <template v-if=\"flow.token\">\n <DataTableRow>\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n class=\"border-r-transparent\"\n :modelValue=\"flow.token\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @update:modelValue=\"(v) => updateScheme(`flows.${flow.type}.token`, v)\">\n Access Token\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-1 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"updateScheme(`flows.${flow.type}.token`, '')\">\n Clear\n </ScalarButton>\n <slot name=\"oauth-actions\" />\n </div>\n </DataTableRow>\n </template>\n\n <template v-else>\n <DataTableRow>\n <!-- Auth URL -->\n <RequestAuthDataTableInput\n v-if=\"'authorizationUrl' in flow\"\n v-bind=\"dataTableInputProps\"\n containerClass=\"border-r-0\"\n :modelValue=\"flow.authorizationUrl\"\n placeholder=\"https://galaxy.scalar.com/authorize\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.authorizationUrl`, v)\n \">\n Auth URL\n </RequestAuthDataTableInput>\n\n <!-- Token URL -->\n <RequestAuthDataTableInput\n v-if=\"'tokenUrl' in flow\"\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow.tokenUrl\"\n placeholder=\"https://galaxy.scalar.com/token\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.tokenUrl`, v)\n \">\n Token URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-scalar-redirect-uri' in flow\">\n <!-- Redirect URI -->\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow['x-scalar-redirect-uri']\"\n placeholder=\"https://galaxy.scalar.com/callback\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.x-scalar-redirect-uri`, v)\n \">\n Redirect URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Username and password -->\n <template v-if=\"flow.type === 'password'\">\n <DataTableRow>\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n class=\"text-c-2\"\n :modelValue=\"flow.username\"\n placeholder=\"janedoe\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.username`, v)\n \">\n Username\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow.password\"\n placeholder=\"********\"\n type=\"password\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.password`, v)\n \">\n Password\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <!-- Client ID -->\n <DataTableRow>\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow['x-scalar-client-id']\"\n placeholder=\"12345\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.x-scalar-client-id`, v)\n \">\n Client ID\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Client Secret (Authorization Code / Client Credentials / Password (optional)) -->\n <DataTableRow v-if=\"'clientSecret' in flow\">\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :modelValue=\"flow.clientSecret\"\n placeholder=\"XYZ123\"\n type=\"password\"\n @update:modelValue=\"\n (v) => updateScheme(`flows.${flow.type}.clientSecret`, v)\n \">\n Client Secret\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- PKCE -->\n <DataTableRow v-if=\"'x-usePkce' in flow\">\n <RequestAuthDataTableInput\n v-bind=\"dataTableInputProps\"\n :enum=\"pkceOptions\"\n :modelValue=\"flow['x-usePkce']\"\n readOnly\n @update:modelValue=\"\n (v) =>\n updateScheme(\n `flows.${flow.type}.x-usePkce`,\n v as (typeof pkceOptions)[number],\n )\n \">\n Use PKCE\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Scopes -->\n <DataTableRow v-if=\"Object.keys(flow.scopes ?? {}).length\">\n <OAuthScopesInput\n :flow=\"flow\"\n :updateScheme=\"updateScheme\" />\n </DataTableRow>\n\n <!-- Open ID Connect -->\n <!-- <DataTableRow -->\n <!-- v-else-if=\"activeScheme?.type === 'openIdConnect'\" -->\n <!-- class=\"border-r-transparent\"> -->\n <!-- <DataTableInput -->\n <!-- v-model=\"password\" -->\n <!-- placeholder=\"Token\"> -->\n <!-- TODO -->\n <!-- </DataTableInput> -->\n <!-- <DataTableCell class=\"flex items-center\"> -->\n <!-- <ScalarButton size=\"sm\"> Authorize </ScalarButton> -->\n <!-- </DataTableCell> -->\n <!-- </DataTableRow> -->\n </template>\n <template v-if=\"!flow.token\">\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleAuthorize\">\n Authorize\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n</template>\n"],"mappings":""}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { resolveDefaultOAuth2RedirectUri, useClientConfig } from "../../../../hooks/useClientConfig.js";
|
|
1
2
|
import { useWorkspace } from "../../../../store/store.js";
|
|
2
3
|
import DataTableRow_default from "../../../../components/DataTable/DataTableRow.vue.js";
|
|
3
4
|
import { authorizeOauth2 } from "../../libs/oauth2.js";
|
|
4
5
|
import { updateScheme } from "../helpers/update-scheme.js";
|
|
5
6
|
import OAuthScopesInput_default from "./OAuthScopesInput.vue.js";
|
|
6
7
|
import RequestAuthDataTableInput_default from "./RequestAuthDataTableInput.vue.js";
|
|
7
|
-
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, openBlock, renderSlot, unref, withCtx } from "vue";
|
|
8
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, unref, watch, withCtx } from "vue";
|
|
8
9
|
import { ScalarButton, useLoadingState } from "@scalar/components";
|
|
9
10
|
import { useToasts } from "@scalar/use-toasts";
|
|
10
11
|
import { pkceOptions } from "@scalar/oas-utils/entities/spec";
|
|
@@ -32,8 +33,17 @@ var OAuth2_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
32
33
|
const loader = useLoadingState();
|
|
33
34
|
const { toast } = useToasts();
|
|
34
35
|
const storeContext = useWorkspace();
|
|
36
|
+
const config = useClientConfig();
|
|
35
37
|
/** Update the current scheme */
|
|
36
38
|
const updateScheme$1 = (path, value) => updateScheme(__props.scheme.uid, path, value, storeContext, __props.persistAuth);
|
|
39
|
+
const hasPrefilledRedirectUri = ref(false);
|
|
40
|
+
const defaultRedirectUri = computed(() => resolveDefaultOAuth2RedirectUri(config.value));
|
|
41
|
+
watch(() => "x-scalar-redirect-uri" in __props.flow ? __props.flow["x-scalar-redirect-uri"] : void 0, (currentRedirectUri) => {
|
|
42
|
+
if (!("x-scalar-redirect-uri" in __props.flow) || hasPrefilledRedirectUri.value || currentRedirectUri) return;
|
|
43
|
+
if (!defaultRedirectUri.value) return;
|
|
44
|
+
hasPrefilledRedirectUri.value = true;
|
|
45
|
+
updateScheme$1(`flows.${__props.flow.type}.x-scalar-redirect-uri`, defaultRedirectUri.value);
|
|
46
|
+
}, { immediate: true });
|
|
37
47
|
/** Authorize the user using specified flow */
|
|
38
48
|
const handleAuthorize = async () => {
|
|
39
49
|
if (loader.isActive || !__props.collection?.uid) return;
|