@scalar/api-client 2.39.4 → 2.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -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/libs/index.d.ts +0 -1
- package/dist/libs/index.d.ts.map +1 -1
- package/dist/libs/index.js +1 -2
- package/dist/style.css +207 -248
- 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/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 +1 -1
- 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/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 +8 -6
- 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 +11 -9
- 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 +24 -30
- 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,46 +0,0 @@
|
|
|
1
|
-
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
-
import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
|
|
3
|
-
import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
4
|
-
import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
5
|
-
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
|
|
6
|
-
import { type ErrorResponse } from '../../../../libs/errors.js';
|
|
7
|
-
import type { SecuritySchemeObjectSecret } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/secret-types';
|
|
8
|
-
/**
|
|
9
|
-
* Builds a fully configured Request object ready for execution.
|
|
10
|
-
*
|
|
11
|
-
* This function processes an OpenAPI operation and constructs a fetch-compatible
|
|
12
|
-
* Request by resolving environment variables, applying security schemes, building
|
|
13
|
-
* headers and cookies, handling proxy redirection, and preparing the request body.
|
|
14
|
-
*
|
|
15
|
-
* The function handles special cases like Electron environments and proxy usage
|
|
16
|
-
* where custom cookie headers are required.
|
|
17
|
-
*
|
|
18
|
-
* @returns A tuple containing either an error or the request object with an abort controller
|
|
19
|
-
*/
|
|
20
|
-
export declare const buildRequest: ({ environment, exampleKey, globalCookies, method, operation, path, proxyUrl, requestBodyCompositionSelection, server, selectedSecuritySchemes, }: {
|
|
21
|
-
/** For environment variables in the inputs */
|
|
22
|
-
environment: XScalarEnvironment;
|
|
23
|
-
/** The key of the current example */
|
|
24
|
-
exampleKey: string;
|
|
25
|
-
/** Workspace + document cookies */
|
|
26
|
-
globalCookies: XScalarCookie[];
|
|
27
|
-
/** The HTTP method of the operation */
|
|
28
|
-
method: HttpMethod;
|
|
29
|
-
/** The operation object */
|
|
30
|
-
operation: OperationObject;
|
|
31
|
-
/** The path of the operation */
|
|
32
|
-
path: string;
|
|
33
|
-
/** The proxy URL for cookie domain determination */
|
|
34
|
-
proxyUrl: string;
|
|
35
|
-
/** Selected anyOf/oneOf request-body variants keyed by schema path */
|
|
36
|
-
requestBodyCompositionSelection?: Record<string, number>;
|
|
37
|
-
/** The server object */
|
|
38
|
-
server: ServerObject | null;
|
|
39
|
-
/** The selected security schemes for the current operation */
|
|
40
|
-
selectedSecuritySchemes: SecuritySchemeObjectSecret[];
|
|
41
|
-
}) => ErrorResponse<{
|
|
42
|
-
controller: AbortController;
|
|
43
|
-
request: Request;
|
|
44
|
-
isUsingProxy: boolean;
|
|
45
|
-
}>;
|
|
46
|
-
//# sourceMappingURL=build-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAGnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAG5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAI1E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6DAA6D,CAAA;AAO7G;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,kJAW1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,sEAAsE;IACtE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxD,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,8DAA8D;IAC9D,uBAAuB,EAAE,0BAA0B,EAAE,CAAA;CACtD,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CA6GA,CAAA"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { ERRORS, normalizeError } from "../../../../libs/errors.js";
|
|
2
|
-
import { isElectron } from "../../../../libs/electron.js";
|
|
3
|
-
import { buildRequestSecurity } from "./build-request-security.js";
|
|
4
|
-
import { getEnvironmentVariables } from "./get-environment-variables.js";
|
|
5
|
-
import { getResolvedUrl } from "./get-resolved-url.js";
|
|
6
|
-
import { getDefaultHeaders } from "../../request-block/helpers/get-default-headers.js";
|
|
7
|
-
import { buildRequestBody } from "./build-request-body.js";
|
|
8
|
-
import { buildRequestCookieHeader } from "./build-request-cookie-header.js";
|
|
9
|
-
import { buildRequestParameters } from "./build-request-parameters.js";
|
|
10
|
-
import { redirectToProxy, shouldUseProxy } from "@scalar/helpers/url/redirect-to-proxy";
|
|
11
|
-
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
12
|
-
import { canMethodHaveBody } from "@scalar/helpers/http/can-method-have-body";
|
|
13
|
-
//#region src/v2/blocks/operation-block/helpers/build-request.ts
|
|
14
|
-
/**
|
|
15
|
-
* Builds a fully configured Request object ready for execution.
|
|
16
|
-
*
|
|
17
|
-
* This function processes an OpenAPI operation and constructs a fetch-compatible
|
|
18
|
-
* Request by resolving environment variables, applying security schemes, building
|
|
19
|
-
* headers and cookies, handling proxy redirection, and preparing the request body.
|
|
20
|
-
*
|
|
21
|
-
* The function handles special cases like Electron environments and proxy usage
|
|
22
|
-
* where custom cookie headers are required.
|
|
23
|
-
*
|
|
24
|
-
* @returns A tuple containing either an error or the request object with an abort controller
|
|
25
|
-
*/
|
|
26
|
-
var buildRequest = ({ environment, exampleKey = "default", globalCookies, method, operation, path, proxyUrl, requestBodyCompositionSelection, server, selectedSecuritySchemes }) => {
|
|
27
|
-
try {
|
|
28
|
-
const requestBody = getResolvedRef(operation.requestBody);
|
|
29
|
-
/** Flatten the environment variables array into a key-value object */
|
|
30
|
-
const env = getEnvironmentVariables(environment);
|
|
31
|
-
/** Build out the request parameters */
|
|
32
|
-
const params = buildRequestParameters(operation.parameters ?? [], env, exampleKey);
|
|
33
|
-
const security = buildRequestSecurity(selectedSecuritySchemes, env);
|
|
34
|
-
const defaultHeaders = getDefaultHeaders({
|
|
35
|
-
method,
|
|
36
|
-
operation,
|
|
37
|
-
exampleKey,
|
|
38
|
-
hideDisabledHeaders: true
|
|
39
|
-
}).filter((header) => !header.isOverridden).reduce((acc, header) => {
|
|
40
|
-
acc[header.name] = header.defaultValue;
|
|
41
|
-
return acc;
|
|
42
|
-
}, {});
|
|
43
|
-
const headers = new Headers({
|
|
44
|
-
...defaultHeaders,
|
|
45
|
-
...params.headers,
|
|
46
|
-
...security.headers
|
|
47
|
-
});
|
|
48
|
-
const urlParams = new URLSearchParams([...params.urlParams, ...security.urlParams]);
|
|
49
|
-
const body = canMethodHaveBody(method) ? buildRequestBody(requestBody, env, exampleKey, requestBodyCompositionSelection) : null;
|
|
50
|
-
if (body && (body instanceof FormData || body instanceof URLSearchParams)) headers.delete("Content-Type");
|
|
51
|
-
/** Combine the server url, path and url params into a single url */
|
|
52
|
-
const url = getResolvedUrl({
|
|
53
|
-
environment,
|
|
54
|
-
server,
|
|
55
|
-
path,
|
|
56
|
-
pathVariables: params.pathVariables,
|
|
57
|
-
allowReservedQueryParameters: params.allowReservedQueryParameters,
|
|
58
|
-
urlParams
|
|
59
|
-
});
|
|
60
|
-
if (!url) throw ERRORS.URL_EMPTY;
|
|
61
|
-
const isUsingProxy = shouldUseProxy(proxyUrl, url);
|
|
62
|
-
const proxiedUrl = redirectToProxy(proxyUrl, url);
|
|
63
|
-
const userAgentHeader = headers.get("User-Agent");
|
|
64
|
-
if (isElectron() && userAgentHeader) headers.set("X-Scalar-User-Agent", userAgentHeader);
|
|
65
|
-
/** Build out the cookies header */
|
|
66
|
-
const cookiesHeader = buildRequestCookieHeader({
|
|
67
|
-
paramCookies: [...params.cookies, ...security.cookies],
|
|
68
|
-
globalCookies,
|
|
69
|
-
env,
|
|
70
|
-
originalCookieHeader: headers.get("Cookie"),
|
|
71
|
-
url,
|
|
72
|
-
useCustomCookieHeader: isElectron() || isUsingProxy,
|
|
73
|
-
disabledGlobalCookies: operation["x-scalar-disable-parameters"]?.["global-cookies"]?.[exampleKey] ?? {}
|
|
74
|
-
});
|
|
75
|
-
if (cookiesHeader) headers.set(cookiesHeader.name, cookiesHeader.value);
|
|
76
|
-
/** Controller to allow aborting the request */
|
|
77
|
-
const controller = new AbortController();
|
|
78
|
-
const isSseAcceptHeader = headers.get("Accept")?.toLowerCase().includes("text/event-stream") ?? false;
|
|
79
|
-
const requestCacheMode = isSseAcceptHeader ? "no-store" : "default";
|
|
80
|
-
if (isSseAcceptHeader) {
|
|
81
|
-
headers.set("Cache-Control", "no-cache");
|
|
82
|
-
headers.set("Pragma", "no-cache");
|
|
83
|
-
}
|
|
84
|
-
return [null, {
|
|
85
|
-
controller,
|
|
86
|
-
isUsingProxy,
|
|
87
|
-
request: new Request(proxiedUrl, {
|
|
88
|
-
method: method.toUpperCase(),
|
|
89
|
-
headers,
|
|
90
|
-
signal: controller.signal,
|
|
91
|
-
body,
|
|
92
|
-
cache: requestCacheMode
|
|
93
|
-
})
|
|
94
|
-
}];
|
|
95
|
-
} catch (error) {
|
|
96
|
-
return [normalizeError(error, ERRORS.BUILDING_REQUEST_FAILED), null];
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
//#endregion
|
|
100
|
-
export { buildRequest };
|
|
101
|
-
|
|
102
|
-
//# sourceMappingURL=build-request.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-request.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"sourcesContent":["import { canMethodHaveBody } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { redirectToProxy, shouldUseProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\n\nimport { isElectron } from '@/libs/electron'\nimport { ERRORS, type ErrorResponse, normalizeError } from '@/libs/errors'\nimport { getEnvironmentVariables } from '@/v2/blocks/operation-block/helpers/get-environment-variables'\nimport { getResolvedUrl } from '@/v2/blocks/operation-block/helpers/get-resolved-url'\nimport { getDefaultHeaders } from '@/v2/blocks/request-block/helpers/get-default-headers'\nimport type { SecuritySchemeObjectSecret } from '@/v2/blocks/scalar-auth-selector-block/helpers/secret-types'\n\nimport { buildRequestBody } from './build-request-body'\nimport { buildRequestCookieHeader } from './build-request-cookie-header'\nimport { buildRequestParameters } from './build-request-parameters'\nimport { buildRequestSecurity } from './build-request-security'\n\n/**\n * Builds a fully configured Request object ready for execution.\n *\n * This function processes an OpenAPI operation and constructs a fetch-compatible\n * Request by resolving environment variables, applying security schemes, building\n * headers and cookies, handling proxy redirection, and preparing the request body.\n *\n * The function handles special cases like Electron environments and proxy usage\n * where custom cookie headers are required.\n *\n * @returns A tuple containing either an error or the request object with an abort controller\n */\nexport const buildRequest = ({\n environment,\n exampleKey = 'default',\n globalCookies,\n method,\n operation,\n path,\n proxyUrl,\n requestBodyCompositionSelection,\n server,\n selectedSecuritySchemes,\n}: {\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The key of the current example */\n exampleKey: string\n /** Workspace + document cookies */\n globalCookies: XScalarCookie[]\n /** The HTTP method of the operation */\n method: HttpMethod\n /** The operation object */\n operation: OperationObject\n /** The path of the operation */\n path: string\n /** The proxy URL for cookie domain determination */\n proxyUrl: string\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n /** The server object */\n server: ServerObject | null\n /** The selected security schemes for the current operation */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n}): ErrorResponse<{\n controller: AbortController\n request: Request\n isUsingProxy: boolean\n}> => {\n try {\n const requestBody = getResolvedRef(operation.requestBody)\n\n /** Flatten the environment variables array into a key-value object */\n const env = getEnvironmentVariables(environment)\n /** Build out the request parameters */\n const params = buildRequestParameters(operation.parameters ?? [], env, exampleKey)\n const security = buildRequestSecurity(selectedSecuritySchemes, env)\n\n // Combine the headers, cookies and url params\n const defaultHeaders = getDefaultHeaders({ method, operation, exampleKey, hideDisabledHeaders: true })\n .filter((header) => !header.isOverridden)\n .reduce(\n (acc, header) => {\n acc[header.name] = header.defaultValue\n return acc\n },\n {} as Record<string, string>,\n )\n const headers = new Headers({ ...defaultHeaders, ...params.headers, ...security.headers })\n const urlParams = new URLSearchParams([...params.urlParams, ...security.urlParams])\n\n // If the method can have a body, build the request body, otherwise set it to null\n const body = canMethodHaveBody(method)\n ? buildRequestBody(requestBody, env, exampleKey, requestBodyCompositionSelection)\n : null\n\n if (body && (body instanceof FormData || body instanceof URLSearchParams)) {\n // Delete the Content-Type header so the browser will set it automatically based on the request body\n headers.delete('Content-Type')\n }\n\n /** Combine the server url, path and url params into a single url */\n const url = getResolvedUrl({\n environment,\n server,\n path,\n pathVariables: params.pathVariables,\n allowReservedQueryParameters: params.allowReservedQueryParameters,\n urlParams,\n })\n\n // Throw for no server or path\n if (!url) {\n throw ERRORS.URL_EMPTY\n }\n\n const isUsingProxy = shouldUseProxy(proxyUrl, url)\n const proxiedUrl = redirectToProxy(proxyUrl, url)\n\n // If we are running in Electron, we need to add a custom header\n // that's then forwarded as a `User-Agent` header.\n const userAgentHeader = headers.get('User-Agent')\n if (isElectron() && userAgentHeader) {\n headers.set('X-Scalar-User-Agent', userAgentHeader)\n }\n\n /** Build out the cookies header */\n const cookiesHeader = buildRequestCookieHeader({\n paramCookies: [...params.cookies, ...security.cookies],\n globalCookies,\n env,\n originalCookieHeader: headers.get('Cookie'),\n url,\n useCustomCookieHeader: isElectron() || isUsingProxy,\n disabledGlobalCookies: operation['x-scalar-disable-parameters']?.['global-cookies']?.[exampleKey] ?? {},\n })\n\n if (cookiesHeader) {\n headers.set(cookiesHeader.name, cookiesHeader.value)\n }\n\n /** Controller to allow aborting the request */\n const controller = new AbortController()\n const acceptHeader = headers.get('Accept')\n const isSseAcceptHeader = acceptHeader?.toLowerCase().includes('text/event-stream') ?? false\n const requestCacheMode: RequestCache = isSseAcceptHeader ? 'no-store' : 'default'\n\n if (isSseAcceptHeader) {\n headers.set('Cache-Control', 'no-cache')\n headers.set('Pragma', 'no-cache')\n }\n\n /** Build the js request object */\n const request = new Request(proxiedUrl, {\n /**\n * Ensure that all methods are uppercased (though only needed for patch)\n *\n * @see https://github.com/whatwg/fetch/issues/50\n */\n method: method.toUpperCase(),\n headers,\n signal: controller.signal,\n body,\n cache: requestCacheMode,\n })\n\n return [\n null,\n {\n controller,\n isUsingProxy,\n request,\n },\n ]\n } catch (error) {\n return [normalizeError(error, ERRORS.BUILDING_REQUEST_FAILED), null]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,gBAAgB,EAC3B,aACA,aAAa,WACb,eACA,QACA,WACA,MACA,UACA,iCACA,QACA,8BA0BI;AACJ,KAAI;EACF,MAAM,cAAc,eAAe,UAAU,YAAY;;EAGzD,MAAM,MAAM,wBAAwB,YAAY;;EAEhD,MAAM,SAAS,uBAAuB,UAAU,cAAc,EAAE,EAAE,KAAK,WAAW;EAClF,MAAM,WAAW,qBAAqB,yBAAyB,IAAI;EAGnE,MAAM,iBAAiB,kBAAkB;GAAE;GAAQ;GAAW;GAAY,qBAAqB;GAAM,CAAC,CACnG,QAAQ,WAAW,CAAC,OAAO,aAAa,CACxC,QACE,KAAK,WAAW;AACf,OAAI,OAAO,QAAQ,OAAO;AAC1B,UAAO;KAET,EAAE,CACH;EACH,MAAM,UAAU,IAAI,QAAQ;GAAE,GAAG;GAAgB,GAAG,OAAO;GAAS,GAAG,SAAS;GAAS,CAAC;EAC1F,MAAM,YAAY,IAAI,gBAAgB,CAAC,GAAG,OAAO,WAAW,GAAG,SAAS,UAAU,CAAC;EAGnF,MAAM,OAAO,kBAAkB,OAAO,GAClC,iBAAiB,aAAa,KAAK,YAAY,gCAAgC,GAC/E;AAEJ,MAAI,SAAS,gBAAgB,YAAY,gBAAgB,iBAEvD,SAAQ,OAAO,eAAe;;EAIhC,MAAM,MAAM,eAAe;GACzB;GACA;GACA;GACA,eAAe,OAAO;GACtB,8BAA8B,OAAO;GACrC;GACD,CAAC;AAGF,MAAI,CAAC,IACH,OAAM,OAAO;EAGf,MAAM,eAAe,eAAe,UAAU,IAAI;EAClD,MAAM,aAAa,gBAAgB,UAAU,IAAI;EAIjD,MAAM,kBAAkB,QAAQ,IAAI,aAAa;AACjD,MAAI,YAAY,IAAI,gBAClB,SAAQ,IAAI,uBAAuB,gBAAgB;;EAIrD,MAAM,gBAAgB,yBAAyB;GAC7C,cAAc,CAAC,GAAG,OAAO,SAAS,GAAG,SAAS,QAAQ;GACtD;GACA;GACA,sBAAsB,QAAQ,IAAI,SAAS;GAC3C;GACA,uBAAuB,YAAY,IAAI;GACvC,uBAAuB,UAAU,iCAAiC,oBAAoB,eAAe,EAAE;GACxG,CAAC;AAEF,MAAI,cACF,SAAQ,IAAI,cAAc,MAAM,cAAc,MAAM;;EAItD,MAAM,aAAa,IAAI,iBAAiB;EAExC,MAAM,oBADe,QAAQ,IAAI,SAAS,EACF,aAAa,CAAC,SAAS,oBAAoB,IAAI;EACvF,MAAM,mBAAiC,oBAAoB,aAAa;AAExE,MAAI,mBAAmB;AACrB,WAAQ,IAAI,iBAAiB,WAAW;AACxC,WAAQ,IAAI,UAAU,WAAW;;AAiBnC,SAAO,CACL,MACA;GACE;GACA;GACA,SAlBY,IAAI,QAAQ,YAAY;IAMtC,QAAQ,OAAO,aAAa;IAC5B;IACA,QAAQ,WAAW;IACnB;IACA,OAAO;IACR,CAAC;GAQC,CACF;UACM,OAAO;AACd,SAAO,CAAC,eAAe,OAAO,OAAO,wBAAwB,EAAE,KAAK"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
-
/** Helper that de-serializes the example value based on the parameter type */
|
|
3
|
-
export declare const deSerializeParameter: (example: unknown, param: ParameterObject) => any;
|
|
4
|
-
//# sourceMappingURL=de-serialize-parameter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"de-serialize-parameter.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/de-serialize-parameter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAErE,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,EAAE,OAAO,eAAe,QAS5E,CAAA"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
-
//#region src/v2/blocks/operation-block/helpers/de-serialize-parameter.ts
|
|
3
|
-
/** Helper that de-serializes the example value based on the parameter type */
|
|
4
|
-
var deSerializeParameter = (example, param) => {
|
|
5
|
-
if ("content" in param) return deSerializeContentExample(example, Object.keys(param.content ?? {})[0] ?? "");
|
|
6
|
-
if ("schema" in param) return deSerializeSchemaExample(example, param.schema);
|
|
7
|
-
return example;
|
|
8
|
-
};
|
|
9
|
-
/** De-serialize the example value based on the content type */
|
|
10
|
-
var deSerializeContentExample = (example, contentType) => {
|
|
11
|
-
if (typeof example === "string" && contentType.includes("json")) try {
|
|
12
|
-
return JSON.parse(example);
|
|
13
|
-
} catch {}
|
|
14
|
-
return example;
|
|
15
|
-
};
|
|
16
|
-
/** Create a set of all the types we wish to parse as JSON */
|
|
17
|
-
var parseableTypesSet = new Set([
|
|
18
|
-
"array",
|
|
19
|
-
"object",
|
|
20
|
-
"boolean",
|
|
21
|
-
"number",
|
|
22
|
-
"integer",
|
|
23
|
-
"null"
|
|
24
|
-
]);
|
|
25
|
-
/** De-serialize the example value based on the schema type */
|
|
26
|
-
var deSerializeSchemaExample = (example, schema) => {
|
|
27
|
-
const resolvedSchema = getResolvedRef(schema);
|
|
28
|
-
if (typeof example === "string" && resolvedSchema && "type" in resolvedSchema) {
|
|
29
|
-
const type = Array.isArray(resolvedSchema.type) ? resolvedSchema.type[0] : resolvedSchema.type;
|
|
30
|
-
if (type && parseableTypesSet.has(type)) try {
|
|
31
|
-
return JSON.parse(example);
|
|
32
|
-
} catch {
|
|
33
|
-
if (type === "array") return example.split(/,\s?/).filter((v) => v !== "");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return example;
|
|
37
|
-
};
|
|
38
|
-
//#endregion
|
|
39
|
-
export { deSerializeParameter };
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=de-serialize-parameter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"de-serialize-parameter.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/de-serialize-parameter.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ParameterWithSchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/** Helper that de-serializes the example value based on the parameter type */\nexport const deSerializeParameter = (example: unknown, param: ParameterObject) => {\n if ('content' in param) {\n return deSerializeContentExample(example, Object.keys(param.content ?? {})[0] ?? '')\n }\n if ('schema' in param) {\n return deSerializeSchemaExample(example, param.schema)\n }\n\n return example\n}\n\n/** De-serialize the example value based on the content type */\nconst deSerializeContentExample = (example: unknown, contentType: string) => {\n if (typeof example === 'string' && contentType.includes('json')) {\n try {\n return JSON.parse(example)\n } catch {\n // Ignore the error and return the original example\n }\n }\n return example\n}\n\n/** Create a set of all the types we wish to parse as JSON */\nconst parseableTypesSet = new Set(['array', 'object', 'boolean', 'number', 'integer', 'null'])\n\n/** De-serialize the example value based on the schema type */\nconst deSerializeSchemaExample = (example: unknown, schema: ParameterWithSchemaObject['schema']) => {\n const resolvedSchema = getResolvedRef(schema)\n\n if (typeof example === 'string' && resolvedSchema && 'type' in resolvedSchema) {\n const type = Array.isArray(resolvedSchema.type) ? resolvedSchema.type[0] : resolvedSchema.type\n\n if (type && parseableTypesSet.has(type)) {\n try {\n return JSON.parse(example)\n } catch {\n // For array types, fall back to splitting comma-separated values.\n // Users commonly enter array values as \"foo,bar\" or \"foo, bar\" in the UI\n // text field, which is not valid JSON. Per the OpenAPI spec, the default\n // serialization for query array parameters is style=form + explode=true,\n // meaning each value should be sent as a separate query parameter.\n if (type === 'array') {\n return example.split(/,\\s?/).filter((v) => v !== '')\n }\n // Ignore the error and return the original example for other types\n }\n }\n }\n\n return example\n}\n"],"mappings":";;;AAOA,IAAa,wBAAwB,SAAkB,UAA2B;AAChF,KAAI,aAAa,MACf,QAAO,0BAA0B,SAAS,OAAO,KAAK,MAAM,WAAW,EAAE,CAAC,CAAC,MAAM,GAAG;AAEtF,KAAI,YAAY,MACd,QAAO,yBAAyB,SAAS,MAAM,OAAO;AAGxD,QAAO;;;AAIT,IAAM,6BAA6B,SAAkB,gBAAwB;AAC3E,KAAI,OAAO,YAAY,YAAY,YAAY,SAAS,OAAO,CAC7D,KAAI;AACF,SAAO,KAAK,MAAM,QAAQ;SACpB;AAIV,QAAO;;;AAIT,IAAM,oBAAoB,IAAI,IAAI;CAAC;CAAS;CAAU;CAAW;CAAU;CAAW;CAAO,CAAC;;AAG9F,IAAM,4BAA4B,SAAkB,WAAgD;CAClG,MAAM,iBAAiB,eAAe,OAAO;AAE7C,KAAI,OAAO,YAAY,YAAY,kBAAkB,UAAU,gBAAgB;EAC7E,MAAM,OAAO,MAAM,QAAQ,eAAe,KAAK,GAAG,eAAe,KAAK,KAAK,eAAe;AAE1F,MAAI,QAAQ,kBAAkB,IAAI,KAAK,CACrC,KAAI;AACF,UAAO,KAAK,MAAM,QAAQ;UACpB;AAMN,OAAI,SAAS,QACX,QAAO,QAAQ,MAAM,OAAO,CAAC,QAAQ,MAAM,MAAM,GAAG;;;AAO5D,QAAO"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
2
|
-
/**
|
|
3
|
-
* Filter a global cookie to determine if it should be included with a request to the given URL.
|
|
4
|
-
* - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.
|
|
5
|
-
* - Returns false if the domain does not match.
|
|
6
|
-
* - Returns false if the path is specified and does not match the URL pathname.
|
|
7
|
-
* - Returns true otherwise.
|
|
8
|
-
*/
|
|
9
|
-
export declare const filterGlobalCookie: ({ cookie, url, disabledGlobalCookies, }: {
|
|
10
|
-
cookie: XScalarCookie;
|
|
11
|
-
url: string;
|
|
12
|
-
disabledGlobalCookies: Record<string, boolean>;
|
|
13
|
-
}) => boolean;
|
|
14
|
-
//# sourceMappingURL=filter-global-cookies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter-global-cookies.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/filter-global-cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AAIxG;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,yCAIhC;IACD,MAAM,EAAE,aAAa,CAAA;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/C,KAAG,OAqBH,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { matchesDomain } from "../../../../libs/send-request/set-request-cookies.js";
|
|
2
|
-
//#region src/v2/blocks/operation-block/helpers/filter-global-cookies.ts
|
|
3
|
-
/**
|
|
4
|
-
* Filter a global cookie to determine if it should be included with a request to the given URL.
|
|
5
|
-
* - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.
|
|
6
|
-
* - Returns false if the domain does not match.
|
|
7
|
-
* - Returns false if the path is specified and does not match the URL pathname.
|
|
8
|
-
* - Returns true otherwise.
|
|
9
|
-
*/
|
|
10
|
-
var filterGlobalCookie = ({ cookie, url, disabledGlobalCookies }) => {
|
|
11
|
-
if (cookie.isDisabled || disabledGlobalCookies[cookie.name.toLowerCase()] === true || !cookie.name) return false;
|
|
12
|
-
const urlObject = new URL(url, "https://example.com");
|
|
13
|
-
if (cookie.domain && !matchesDomain(url, cookie.domain)) return false;
|
|
14
|
-
if (cookie.path && !urlObject.pathname.startsWith(cookie.path)) return false;
|
|
15
|
-
return true;
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { filterGlobalCookie };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=filter-global-cookies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter-global-cookies.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/filter-global-cookies.ts"],"sourcesContent":["import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\n\nimport { matchesDomain } from '@/libs/send-request/set-request-cookies'\n\n/**\n * Filter a global cookie to determine if it should be included with a request to the given URL.\n * - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.\n * - Returns false if the domain does not match.\n * - Returns false if the path is specified and does not match the URL pathname.\n * - Returns true otherwise.\n */\nexport const filterGlobalCookie = ({\n cookie,\n url,\n disabledGlobalCookies,\n}: {\n cookie: XScalarCookie\n url: string\n disabledGlobalCookies: Record<string, boolean>\n}): boolean => {\n // Filter out disabled cookies, those disabled globally, or those missing a name.\n if (cookie.isDisabled || disabledGlobalCookies[cookie.name.toLowerCase()] === true || !cookie.name) {\n return false\n }\n\n // Parse the URL to extract the pathname for path matching.\n const urlObject = new URL(url, 'https://example.com')\n\n // If a domain restriction exists, ensure the cookie is only sent for matching domains.\n if (cookie.domain && !matchesDomain(url, cookie.domain)) {\n return false\n }\n\n // If a path restriction exists, ensure the cookie is only sent for URLs with a matching prefix.\n if (cookie.path && !urlObject.pathname.startsWith(cookie.path)) {\n return false\n }\n\n // Cookie passed all checks; include it in the request.\n return true\n}\n"],"mappings":";;;;;;;;;AAWA,IAAa,sBAAsB,EACjC,QACA,KACA,4BAKa;AAEb,KAAI,OAAO,cAAc,sBAAsB,OAAO,KAAK,aAAa,MAAM,QAAQ,CAAC,OAAO,KAC5F,QAAO;CAIT,MAAM,YAAY,IAAI,IAAI,KAAK,sBAAsB;AAGrD,KAAI,OAAO,UAAU,CAAC,cAAc,KAAK,OAAO,OAAO,CACrD,QAAO;AAIT,KAAI,OAAO,QAAQ,CAAC,UAAU,SAAS,WAAW,OAAO,KAAK,CAC5D,QAAO;AAIT,QAAO"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the delimiter for the given parameter style
|
|
3
|
-
*
|
|
4
|
-
* @param style - The style of the parameter
|
|
5
|
-
* @returns The delimiter for the given style
|
|
6
|
-
*/
|
|
7
|
-
export declare const getDelimiter: (style: string) => string;
|
|
8
|
-
//# sourceMappingURL=get-delimiter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-delimiter.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-delimiter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,MAa5C,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
|
|
2
|
-
/**
|
|
3
|
-
* Flattens the environment variables array into a key-value object.
|
|
4
|
-
* If a variable value is a string, use it directly; otherwise, use its default value.
|
|
5
|
-
*
|
|
6
|
-
* @returns An object mapping variable names to their resolved values.
|
|
7
|
-
*/
|
|
8
|
-
export declare const getEnvironmentVariables: (environment: XScalarEnvironment) => Record<string, string>;
|
|
9
|
-
//# sourceMappingURL=get-environment-variables.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-environment-variables.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-environment-variables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAEnH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,aAAa,kBAAkB,2BAQtE,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//#region src/v2/blocks/operation-block/helpers/get-environment-variables.ts
|
|
2
|
-
/**
|
|
3
|
-
* Flattens the environment variables array into a key-value object.
|
|
4
|
-
* If a variable value is a string, use it directly; otherwise, use its default value.
|
|
5
|
-
*
|
|
6
|
-
* @returns An object mapping variable names to their resolved values.
|
|
7
|
-
*/
|
|
8
|
-
var getEnvironmentVariables = (environment) => {
|
|
9
|
-
return environment.variables.reduce((acc, curr) => {
|
|
10
|
-
acc[curr.name] = typeof curr.value === "string" ? curr.value : curr.value.default;
|
|
11
|
-
return acc;
|
|
12
|
-
}, {});
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
15
|
-
export { getEnvironmentVariables };
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=get-environment-variables.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-environment-variables.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/get-environment-variables.ts"],"sourcesContent":["import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\n\n/**\n * Flattens the environment variables array into a key-value object.\n * If a variable value is a string, use it directly; otherwise, use its default value.\n *\n * @returns An object mapping variable names to their resolved values.\n */\nexport const getEnvironmentVariables = (environment: XScalarEnvironment) => {\n return environment.variables.reduce(\n (acc, curr) => {\n acc[curr.name] = typeof curr.value === 'string' ? curr.value : curr.value.default\n return acc\n },\n {} as Record<string, string>,\n )\n}\n"],"mappings":";;;;;;;AAQA,IAAa,2BAA2B,gBAAoC;AAC1E,QAAO,YAAY,UAAU,QAC1B,KAAK,SAAS;AACb,MAAI,KAAK,QAAQ,OAAO,KAAK,UAAU,WAAW,KAAK,QAAQ,KAAK,MAAM;AAC1E,SAAO;IAET,EAAE,CACH"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ExampleObject, MediaTypeObject, ParameterObject, RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
-
/**
|
|
3
|
-
* Resolve an example value for a parameter or requestBody from either `examples` or `content.*.examples`.
|
|
4
|
-
* Or the [deprecated] `example` field.
|
|
5
|
-
* If no exampleKey is provided it will fallback to the first example in the examples object then the [deprecated]
|
|
6
|
-
* `example` field.
|
|
7
|
-
* Used both for send-request and generating code snippets.
|
|
8
|
-
*/
|
|
9
|
-
export declare const getExample: (param: ParameterObject | RequestBodyObject | MediaTypeObject, exampleKey: string | undefined, contentType: string | undefined) => ExampleObject | undefined;
|
|
10
|
-
//# sourceMappingURL=get-example.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAgCrE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,GAAG,eAAe,EAC5D,YAAY,MAAM,GAAG,SAAS,EAC9B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SA6ClB,CAAA"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { getResolvedRefDeep } from "../../operation-code-sample/helpers/get-resolved-ref-deep.js";
|
|
2
|
-
//#region src/v2/blocks/operation-block/helpers/get-example.ts
|
|
3
|
-
/** Helper to get example from examples object with fallback to example field */
|
|
4
|
-
var getExampleFromExamples = (examples, exampleField, exampleKey) => {
|
|
5
|
-
if (!examples && !exampleField) return;
|
|
6
|
-
const hasExamples = !!examples && Object.keys(examples).length > 0;
|
|
7
|
-
const key = exampleKey || Object.keys(examples ?? {})[0] || "";
|
|
8
|
-
const example = getResolvedRefDeep(examples?.[key]);
|
|
9
|
-
if (example !== void 0) return example;
|
|
10
|
-
if ((!hasExamples || !exampleKey) && exampleField !== void 0) return { value: getResolvedRefDeep(exampleField) };
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Resolve an example value for a parameter or requestBody from either `examples` or `content.*.examples`.
|
|
14
|
-
* Or the [deprecated] `example` field.
|
|
15
|
-
* If no exampleKey is provided it will fallback to the first example in the examples object then the [deprecated]
|
|
16
|
-
* `example` field.
|
|
17
|
-
* Used both for send-request and generating code snippets.
|
|
18
|
-
*/
|
|
19
|
-
var getExample = (param, exampleKey, contentType) => {
|
|
20
|
-
if ("content" in param) {
|
|
21
|
-
const content = param.content?.[contentType ?? Object.keys(param.content)[0] ?? ""];
|
|
22
|
-
const result = getExampleFromExamples(content?.examples, content?.example, exampleKey);
|
|
23
|
-
if (result !== void 0) return result;
|
|
24
|
-
}
|
|
25
|
-
if ("examples" in param || "example" in param) {
|
|
26
|
-
const result = getExampleFromExamples(param.examples, param.example, exampleKey);
|
|
27
|
-
if (result !== void 0) return result;
|
|
28
|
-
}
|
|
29
|
-
const resolvedParam = getResolvedRefDeep(param);
|
|
30
|
-
if ("schema" in resolvedParam && resolvedParam.schema) {
|
|
31
|
-
const schema = resolvedParam.schema;
|
|
32
|
-
if ("default" in schema && schema.default !== void 0) return { value: schema.default };
|
|
33
|
-
if ("enum" in schema && schema.enum?.[0] !== void 0) return { value: schema.enum[0] };
|
|
34
|
-
if ("examples" in schema && schema.examples?.[0] !== void 0) return { value: schema.examples[0] };
|
|
35
|
-
if ("example" in schema && schema.example !== void 0) return { value: schema.example };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
//#endregion
|
|
39
|
-
export { getExample };
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=get-example.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-example.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"sourcesContent":["import type {\n ExampleObject,\n MediaTypeObject,\n ParameterObject,\n RequestBodyObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { getResolvedRefDeep } from '@/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep'\n\n/** Helper to get example from examples object with fallback to example field */\nconst getExampleFromExamples = (\n examples: MediaTypeObject['examples'],\n exampleField: MediaTypeObject['example'],\n exampleKey: string | undefined,\n): ExampleObject | undefined => {\n if (!examples && !exampleField) {\n return undefined\n }\n\n const hasExamples = !!examples && Object.keys(examples).length > 0\n\n // Grab the example key\n const key = exampleKey || Object.keys(examples ?? {})[0] || ''\n const example = getResolvedRefDeep(examples?.[key])\n if (example !== undefined) {\n return example\n }\n\n // Fallback to example field when no examples map exists,\n // or when no specific example key was requested.\n if ((!hasExamples || !exampleKey) && exampleField !== undefined) {\n return { value: getResolvedRefDeep(exampleField) }\n }\n\n return undefined\n}\n\n/**\n * Resolve an example value for a parameter or requestBody from either `examples` or `content.*.examples`.\n * Or the [deprecated] `example` field.\n * If no exampleKey is provided it will fallback to the first example in the examples object then the [deprecated]\n * `example` field.\n * Used both for send-request and generating code snippets.\n */\nexport const getExample = (\n param: ParameterObject | RequestBodyObject | MediaTypeObject,\n exampleKey: string | undefined,\n contentType: string | undefined,\n): ExampleObject | undefined => {\n // Content based parameters\n if ('content' in param) {\n const content = param.content?.[contentType ?? Object.keys(param.content)[0] ?? '']\n const result = getExampleFromExamples(content?.examples, content?.example, exampleKey)\n if (result !== undefined) {\n return result\n }\n }\n\n // Schema based parameters\n if ('examples' in param || 'example' in param) {\n const result = getExampleFromExamples(param.examples, param.example, exampleKey)\n if (result !== undefined) {\n return result\n }\n }\n\n // Derive value from the schema\n const resolvedParam = getResolvedRefDeep(param)\n if ('schema' in resolvedParam && resolvedParam.schema) {\n const schema = resolvedParam.schema\n\n // Default value\n if ('default' in schema && schema.default !== undefined) {\n return { value: schema.default }\n }\n\n // Enum value\n if ('enum' in schema && schema.enum?.[0] !== undefined) {\n return { value: schema.enum[0] }\n }\n\n // Examples value\n if ('examples' in schema && schema.examples?.[0] !== undefined) {\n return { value: schema.examples[0] }\n }\n\n // Example value\n if ('example' in schema && schema.example !== undefined) {\n return { value: schema.example }\n }\n }\n\n return undefined\n}\n"],"mappings":";;;AAUA,IAAM,0BACJ,UACA,cACA,eAC8B;AAC9B,KAAI,CAAC,YAAY,CAAC,aAChB;CAGF,MAAM,cAAc,CAAC,CAAC,YAAY,OAAO,KAAK,SAAS,CAAC,SAAS;CAGjE,MAAM,MAAM,cAAc,OAAO,KAAK,YAAY,EAAE,CAAC,CAAC,MAAM;CAC5D,MAAM,UAAU,mBAAmB,WAAW,KAAK;AACnD,KAAI,YAAY,KAAA,EACd,QAAO;AAKT,MAAK,CAAC,eAAe,CAAC,eAAe,iBAAiB,KAAA,EACpD,QAAO,EAAE,OAAO,mBAAmB,aAAa,EAAE;;;;;;;;;AAatD,IAAa,cACX,OACA,YACA,gBAC8B;AAE9B,KAAI,aAAa,OAAO;EACtB,MAAM,UAAU,MAAM,UAAU,eAAe,OAAO,KAAK,MAAM,QAAQ,CAAC,MAAM;EAChF,MAAM,SAAS,uBAAuB,SAAS,UAAU,SAAS,SAAS,WAAW;AACtF,MAAI,WAAW,KAAA,EACb,QAAO;;AAKX,KAAI,cAAc,SAAS,aAAa,OAAO;EAC7C,MAAM,SAAS,uBAAuB,MAAM,UAAU,MAAM,SAAS,WAAW;AAChF,MAAI,WAAW,KAAA,EACb,QAAO;;CAKX,MAAM,gBAAgB,mBAAmB,MAAM;AAC/C,KAAI,YAAY,iBAAiB,cAAc,QAAQ;EACrD,MAAM,SAAS,cAAc;AAG7B,MAAI,aAAa,UAAU,OAAO,YAAY,KAAA,EAC5C,QAAO,EAAE,OAAO,OAAO,SAAS;AAIlC,MAAI,UAAU,UAAU,OAAO,OAAO,OAAO,KAAA,EAC3C,QAAO,EAAE,OAAO,OAAO,KAAK,IAAI;AAIlC,MAAI,cAAc,UAAU,OAAO,WAAW,OAAO,KAAA,EACnD,QAAO,EAAE,OAAO,OAAO,SAAS,IAAI;AAItC,MAAI,aAAa,UAAU,OAAO,YAAY,KAAA,EAC5C,QAAO,EAAE,OAAO,OAAO,SAAS"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
|
|
2
|
-
import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/server';
|
|
3
|
-
/**
|
|
4
|
-
* Resolves and constructs the final request URL using the provided environment, server, path,
|
|
5
|
-
* path variables, and optional query parameters.
|
|
6
|
-
*
|
|
7
|
-
* - Environment variables and path variables are used to replace placeholders in the path string.
|
|
8
|
-
* - The server URL is dynamically resolved (may apply env variables).
|
|
9
|
-
* - urlParams are optionally appended as the query string.
|
|
10
|
-
*
|
|
11
|
-
* @param environment The current environment containing variable values.
|
|
12
|
-
* @param server The selected server object; can be null.
|
|
13
|
-
* @param path The raw path string from the OpenAPI document (may contain variables).
|
|
14
|
-
* @param pathVariables Map of path variable values (e.g., { petId: '5' }).
|
|
15
|
-
* @param urlParams Optional query parameters as URLSearchParams.
|
|
16
|
-
* @returns Fully resolved URL as a string.
|
|
17
|
-
*/
|
|
18
|
-
export declare const getResolvedUrl: ({ environment, server, path, pathVariables, allowReservedQueryParameters, urlParams, }: {
|
|
19
|
-
environment: XScalarEnvironment;
|
|
20
|
-
server: ServerObject | null;
|
|
21
|
-
path: string;
|
|
22
|
-
pathVariables: Record<string, string>;
|
|
23
|
-
allowReservedQueryParameters?: Set<string>;
|
|
24
|
-
urlParams?: URLSearchParams;
|
|
25
|
-
}) => string;
|
|
26
|
-
//# sourceMappingURL=get-resolved-url.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-resolved-url.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-resolved-url.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AAMtF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,GAAI,wFAO5B;IACD,WAAW,EAAE,kBAAkB,CAAA;IAC/B,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,4BAA4B,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC1C,SAAS,CAAC,EAAE,eAAe,CAAA;CAC5B,WAMA,CAAA"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { applyAllowReservedToUrl } from "./apply-allow-reserved-to-url.js";
|
|
2
|
-
import { getEnvironmentVariables } from "./get-environment-variables.js";
|
|
3
|
-
import { getServerUrl } from "./get-server-url.js";
|
|
4
|
-
import { mergeUrls } from "@scalar/helpers/url/merge-urls";
|
|
5
|
-
import { replaceVariables } from "@scalar/helpers/regex/replace-variables";
|
|
6
|
-
//#region src/v2/blocks/operation-block/helpers/get-resolved-url.ts
|
|
7
|
-
/**
|
|
8
|
-
* Resolves and constructs the final request URL using the provided environment, server, path,
|
|
9
|
-
* path variables, and optional query parameters.
|
|
10
|
-
*
|
|
11
|
-
* - Environment variables and path variables are used to replace placeholders in the path string.
|
|
12
|
-
* - The server URL is dynamically resolved (may apply env variables).
|
|
13
|
-
* - urlParams are optionally appended as the query string.
|
|
14
|
-
*
|
|
15
|
-
* @param environment The current environment containing variable values.
|
|
16
|
-
* @param server The selected server object; can be null.
|
|
17
|
-
* @param path The raw path string from the OpenAPI document (may contain variables).
|
|
18
|
-
* @param pathVariables Map of path variable values (e.g., { petId: '5' }).
|
|
19
|
-
* @param urlParams Optional query parameters as URLSearchParams.
|
|
20
|
-
* @returns Fully resolved URL as a string.
|
|
21
|
-
*/
|
|
22
|
-
var getResolvedUrl = ({ environment, server, path, pathVariables, allowReservedQueryParameters, urlParams }) => {
|
|
23
|
-
const environmentVariables = getEnvironmentVariables(environment);
|
|
24
|
-
return applyAllowReservedToUrl(mergeUrls(getServerUrl(server, environmentVariables), replaceVariables(path, {
|
|
25
|
-
...environmentVariables,
|
|
26
|
-
...pathVariables
|
|
27
|
-
}), urlParams), allowReservedQueryParameters ?? /* @__PURE__ */ new Set());
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { getResolvedUrl };
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=get-resolved-url.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-resolved-url.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/get-resolved-url.ts"],"sourcesContent":["import { replaceVariables } from '@scalar/helpers/regex/replace-variables'\nimport { mergeUrls } from '@scalar/helpers/url/merge-urls'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/server'\n\nimport { applyAllowReservedToUrl } from '@/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url'\nimport { getEnvironmentVariables } from '@/v2/blocks/operation-block/helpers/get-environment-variables'\nimport { getServerUrl } from '@/v2/blocks/operation-block/helpers/get-server-url'\n\n/**\n * Resolves and constructs the final request URL using the provided environment, server, path,\n * path variables, and optional query parameters.\n *\n * - Environment variables and path variables are used to replace placeholders in the path string.\n * - The server URL is dynamically resolved (may apply env variables).\n * - urlParams are optionally appended as the query string.\n *\n * @param environment The current environment containing variable values.\n * @param server The selected server object; can be null.\n * @param path The raw path string from the OpenAPI document (may contain variables).\n * @param pathVariables Map of path variable values (e.g., { petId: '5' }).\n * @param urlParams Optional query parameters as URLSearchParams.\n * @returns Fully resolved URL as a string.\n */\nexport const getResolvedUrl = ({\n environment,\n server,\n path,\n pathVariables,\n allowReservedQueryParameters,\n urlParams,\n}: {\n environment: XScalarEnvironment\n server: ServerObject | null\n path: string\n pathVariables: Record<string, string>\n allowReservedQueryParameters?: Set<string>\n urlParams?: URLSearchParams\n}) => {\n const environmentVariables = getEnvironmentVariables(environment)\n const serverUrl = getServerUrl(server, environmentVariables)\n const pathWithVariables = replaceVariables(path, { ...environmentVariables, ...pathVariables })\n const mergedUrl = mergeUrls(serverUrl, pathWithVariables, urlParams)\n return applyAllowReservedToUrl(mergedUrl, allowReservedQueryParameters ?? new Set())\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,IAAa,kBAAkB,EAC7B,aACA,QACA,MACA,eACA,8BACA,gBAQI;CACJ,MAAM,uBAAuB,wBAAwB,YAAY;AAIjE,QAAO,wBADW,UAFA,aAAa,QAAQ,qBAAqB,EAClC,iBAAiB,MAAM;EAAE,GAAG;EAAsB,GAAG;EAAe,CAAC,EACrC,UAAU,EAC1B,gDAAgC,IAAI,KAAK,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/request-body';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the selected body content type for the given request body and exampleKey.
|
|
4
|
-
* Priority:
|
|
5
|
-
* 1. requestBody?.['x-scalar-selected-content-type']?.[exampleKey] (if set)
|
|
6
|
-
* 2. First key in requestBody?.content (if available)
|
|
7
|
-
* 3. null (if none available)
|
|
8
|
-
*/
|
|
9
|
-
export declare const getSelectedBodyContentType: (requestBody: RequestBodyObject | undefined, exampleKey?: string) => string | null;
|
|
10
|
-
//# sourceMappingURL=get-selected-body-content-type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-selected-body-content-type.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-selected-body-content-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAA;AAEjG;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACrC,aAAa,iBAAiB,GAAG,SAAS,EAC1C,aAAY,MAAkB,KAC7B,MAAM,GAAG,IAIX,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region src/v2/blocks/operation-block/helpers/get-selected-body-content-type.ts
|
|
2
|
-
/**
|
|
3
|
-
* Returns the selected body content type for the given request body and exampleKey.
|
|
4
|
-
* Priority:
|
|
5
|
-
* 1. requestBody?.['x-scalar-selected-content-type']?.[exampleKey] (if set)
|
|
6
|
-
* 2. First key in requestBody?.content (if available)
|
|
7
|
-
* 3. null (if none available)
|
|
8
|
-
*/
|
|
9
|
-
var getSelectedBodyContentType = (requestBody, exampleKey = "default") => {
|
|
10
|
-
return requestBody?.["x-scalar-selected-content-type"]?.[exampleKey] ?? Object.keys(requestBody?.content ?? {})[0] ?? null;
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
|
-
export { getSelectedBodyContentType };
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=get-selected-body-content-type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-selected-body-content-type.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/get-selected-body-content-type.ts"],"sourcesContent":["import type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/request-body'\n\n/**\n * Returns the selected body content type for the given request body and exampleKey.\n * Priority:\n * 1. requestBody?.['x-scalar-selected-content-type']?.[exampleKey] (if set)\n * 2. First key in requestBody?.content (if available)\n * 3. null (if none available)\n */\nexport const getSelectedBodyContentType = (\n requestBody: RequestBodyObject | undefined,\n exampleKey: string = 'default',\n): string | null => {\n return (\n requestBody?.['x-scalar-selected-content-type']?.[exampleKey] ?? Object.keys(requestBody?.content ?? {})[0] ?? null\n )\n}\n"],"mappings":";;;;;;;;AASA,IAAa,8BACX,aACA,aAAqB,cACH;AAClB,QACE,cAAc,oCAAoC,eAAe,OAAO,KAAK,aAAa,WAAW,EAAE,CAAC,CAAC,MAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-server-url.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-server-url.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AAGtF,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,GAAG,IAAI,EAAE,sBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WAarG,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { objectEntries } from "@vueuse/core";
|
|
2
|
-
import { replaceVariables } from "@scalar/helpers/regex/replace-variables";
|
|
3
|
-
//#region src/v2/blocks/operation-block/helpers/get-server-url.ts
|
|
4
|
-
var getServerUrl = (server, environmentVariables) => {
|
|
5
|
-
/** Extract the server variables default values*/
|
|
6
|
-
const serverVariables = objectEntries(server?.variables ?? {}).reduce((acc, [name, variable]) => {
|
|
7
|
-
if (variable.default) acc[name] = variable.default;
|
|
8
|
-
return acc;
|
|
9
|
-
}, {});
|
|
10
|
-
return replaceVariables(server?.url ?? "", {
|
|
11
|
-
...environmentVariables,
|
|
12
|
-
...serverVariables
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
export { getServerUrl };
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=get-server-url.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-server-url.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/helpers/get-server-url.ts"],"sourcesContent":["import { replaceVariables } from '@scalar/helpers/regex/replace-variables'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/server'\nimport { objectEntries } from '@vueuse/core'\n\nexport const getServerUrl = (server: ServerObject | null, environmentVariables: Record<string, string>) => {\n /** Extract the server variables default values*/\n const serverVariables = objectEntries(server?.variables ?? {}).reduce(\n (acc, [name, variable]) => {\n if (variable.default) {\n acc[name] = variable.default\n }\n return acc\n },\n {} as Record<string, string>,\n )\n\n return replaceVariables(server?.url ?? '', { ...environmentVariables, ...serverVariables })\n}\n"],"mappings":";;;AAIA,IAAa,gBAAgB,QAA6B,yBAAiD;;CAEzG,MAAM,kBAAkB,cAAc,QAAQ,aAAa,EAAE,CAAC,CAAC,QAC5D,KAAK,CAAC,MAAM,cAAc;AACzB,MAAI,SAAS,QACX,KAAI,QAAQ,SAAS;AAEvB,SAAO;IAET,EAAE,CACH;AAED,QAAO,iBAAiB,QAAQ,OAAO,IAAI;EAAE,GAAG;EAAsB,GAAG;EAAiB,CAAC"}
|