@scalar/api-client 2.15.0 → 2.17.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 +150 -0
- package/dist/hooks/useResponseBody.js +6 -6
- package/dist/libs/errors.d.ts +1 -0
- package/dist/libs/errors.d.ts.map +1 -1
- package/dist/libs/errors.js +1 -0
- package/dist/libs/send-request/create-request-operation.d.ts.map +1 -1
- package/dist/libs/send-request/create-request-operation.js +41 -35
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +28 -38
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +84 -45
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -11
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
- package/dist/v2/blocks/operation-block/components/Header.vue2.js +28 -35
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts +10 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js +22 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +31 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +31 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +3 -9
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +56 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +10 -3
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-security.js +46 -0
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +45 -0
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/build-request.js +66 -0
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.js +9 -0
- package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.d.ts +16 -0
- package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.js +4 -0
- package/dist/v2/blocks/operation-block/helpers/get-delimiter.js +17 -0
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts +9 -3
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/get-example.js +21 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +53 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.js +120 -0
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +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.vue2.js +89 -110
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +2 -2
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +8 -13
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +22 -28
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +19 -8
- 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 +30 -24
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts +12 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.js +20 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts +10 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.js +4 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +14 -12
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +191 -169
- 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 +10 -10
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +2 -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 +15 -19
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +2 -2
- package/dist/v2/blocks/operation-code-sample/index.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/types.d.ts +16 -0
- package/dist/v2/blocks/operation-code-sample/types.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +15 -10
- 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.vue2.js +158 -125
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
- package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +59 -50
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts +8 -0
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -0
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +127 -0
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue2.js +4 -0
- package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.js +24 -23
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +1 -0
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +148 -149
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts +1 -0
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue2.js +28 -27
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts +3 -2
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.js +13 -3
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +4 -4
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +3 -3
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +41 -45
- package/dist/v2/blocks/response-block/components/Headers.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.js +27 -27
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js +1 -1
- package/dist/v2/blocks/response-block/helpers/parse-set-cookie.d.ts +18 -0
- package/dist/v2/blocks/response-block/helpers/parse-set-cookie.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/parse-set-cookie.js +12 -0
- package/dist/v2/blocks/response-block/helpers/process-response-body.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +0 -2
- 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 +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +97 -87
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts +19 -0
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.js +24 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +3 -2
- 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 +59 -56
- 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/RequestAuthDataTable.vue.d.ts +3 -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 +26 -24
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +2 -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 +44 -43
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js +7 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +4 -4
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -2
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +7 -6
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
- package/dist/v2/components/code-input/CodeInput.vue2.js +61 -59
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +2 -2
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.js +44 -44
- package/dist/v2/components/resize/index.d.ts +0 -1
- package/dist/v2/components/resize/index.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -5
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +49 -47
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.d.ts +3 -0
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +128 -139
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts +3 -3
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +2 -2
- package/dist/v2/features/app/components/AppSidebar.vue2.js +103 -80
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/WebTopNav.vue.d.ts +1 -1
- package/dist/v2/features/app/components/WebTopNav.vue.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts +2 -2
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.js +8 -8
- package/dist/v2/features/app/helpers/routes.d.ts +32 -6
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +25 -16
- package/dist/v2/{hooks/use-sidebar-state.d.ts → features/app/hooks/use-app-sidebar.d.ts} +10 -11
- package/dist/v2/features/app/hooks/use-app-sidebar.d.ts.map +1 -0
- package/dist/v2/{hooks/use-sidebar-state.js → features/app/hooks/use-app-sidebar.js} +19 -19
- package/dist/v2/features/app/hooks/use-document-watcher.d.ts.map +1 -0
- package/dist/v2/{hooks → features/app/hooks}/use-sync-path.d.ts +2 -2
- package/dist/v2/features/app/hooks/use-sync-path.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-sync-path.js +52 -0
- package/dist/v2/{hooks → features/app/hooks}/use-tabs.d.ts +2 -2
- package/dist/v2/features/app/hooks/use-tabs.d.ts.map +1 -0
- package/dist/v2/{hooks → features/app/hooks}/use-tabs.js +1 -1
- package/dist/v2/{hooks/use-workspace-client-events.d.ts → features/app/hooks/use-workspace-client-app-events.d.ts} +5 -5
- package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +1 -0
- package/dist/v2/{hooks/use-workspace-client-events.js → features/app/hooks/use-workspace-client-app-events.js} +48 -45
- package/dist/v2/features/app/hooks/use-workspace-selector.d.ts.map +1 -0
- package/dist/v2/{hooks → features/app/hooks}/use-workspace-selector.js +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.js +92 -2
- package/dist/v2/features/collection/DocumentCollection.vue2.js +2 -91
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +42 -2
- package/dist/v2/features/collection/WorkspaceCollection.vue2.js +2 -41
- package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
- package/dist/v2/features/collection/components/Authentication.vue2.js +14 -12
- package/dist/v2/features/collection/components/Cookies.vue.js +30 -1
- package/dist/v2/features/collection/components/Cookies.vue2.js +1 -29
- package/dist/v2/features/collection/components/Environment.vue.js +32 -1
- package/dist/v2/features/collection/components/Environment.vue2.js +1 -31
- package/dist/v2/features/collection/components/Overview.vue2.js +5 -4
- package/dist/v2/features/collection/components/Servers.vue.js +142 -2
- package/dist/v2/features/collection/components/Servers.vue2.js +2 -141
- package/dist/v2/features/collection/components/Settings.vue.js +58 -2
- package/dist/v2/features/collection/components/Settings.vue2.js +2 -57
- package/dist/v2/features/modal/Modal.vue.d.ts +23 -1
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js +1 -1
- package/dist/v2/features/modal/Modal.vue2.js +118 -31
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +18 -32
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +46 -26
- package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts +55 -0
- package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts.map +1 -0
- package/dist/v2/features/modal/helpers/resolve-route-parameters.js +29 -0
- package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts +42 -0
- package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts.map +1 -0
- package/dist/v2/features/modal/hooks/use-modal-sidebar.js +93 -0
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts +18 -0
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +1 -0
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +30 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +59 -28
- package/dist/v2/features/operation/helpers/get-operation-header.d.ts +17 -0
- package/dist/v2/features/operation/helpers/get-operation-header.d.ts.map +1 -0
- package/dist/v2/features/operation/helpers/get-operation-header.js +12 -0
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +1 -1
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +1 -1
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts +7 -0
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -0
- package/dist/v2/features/operation/helpers/get-selected-security.js +19 -0
- package/dist/v2/features/operation/index.d.ts +0 -1
- package/dist/v2/features/operation/index.d.ts.map +1 -1
- package/dist/v2/features/search/components/SearchModal.vue.d.ts.map +1 -1
- package/dist/v2/features/search/components/SearchModal.vue.js +3 -3
- package/dist/v2/features/search/components/SearchModal.vue2.js +45 -44
- package/dist/v2/helpers/generate-location-id.d.ts +19 -0
- package/dist/v2/helpers/generate-location-id.d.ts.map +1 -0
- package/dist/v2/helpers/generate-location-id.js +10 -0
- package/dist/v2/helpers/get-active-environment.d.ts +5 -0
- package/dist/v2/helpers/get-active-environment.d.ts.map +1 -0
- package/dist/v2/helpers/get-active-environment.js +22 -0
- package/dist/v2/helpers/get-tab-details.d.ts +2 -2
- package/dist/v2/helpers/get-tab-details.d.ts.map +1 -1
- package/dist/v2/helpers/handle-hotkeys.js +1 -1
- package/dist/v2/helpers/plugins.d.ts +59 -0
- package/dist/v2/helpers/plugins.d.ts.map +1 -0
- package/dist/v2/helpers/plugins.js +11 -0
- package/dist/v2/hooks/use-scroll-lock.d.ts +28 -0
- package/dist/v2/hooks/use-scroll-lock.d.ts.map +1 -0
- package/dist/v2/hooks/use-scroll-lock.js +21 -0
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts +2 -0
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts.map +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/index.d.ts +0 -1
- package/dist/views/Request/RequestSection/RequestAuth/index.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +18 -18
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts +0 -7
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.js +0 -28
- package/dist/v2/blocks/request-block/helpers/get-parameter-example.d.ts +0 -6
- package/dist/v2/blocks/request-block/helpers/get-parameter-example.d.ts.map +0 -1
- package/dist/v2/blocks/request-block/helpers/get-parameter-example.js +0 -12
- package/dist/v2/hooks/use-document-watcher.d.ts.map +0 -1
- package/dist/v2/hooks/use-sidebar-state.d.ts.map +0 -1
- package/dist/v2/hooks/use-sync-path.d.ts.map +0 -1
- package/dist/v2/hooks/use-sync-path.js +0 -51
- package/dist/v2/hooks/use-tabs.d.ts.map +0 -1
- package/dist/v2/hooks/use-workspace-client-events.d.ts.map +0 -1
- package/dist/v2/hooks/use-workspace-selector.d.ts.map +0 -1
- package/dist/v2/plugins.d.ts +0 -44
- package/dist/v2/plugins.d.ts.map +0 -1
- /package/dist/v2/{hooks → features/app/hooks}/use-document-watcher.d.ts +0 -0
- /package/dist/v2/{hooks → features/app/hooks}/use-document-watcher.js +0 -0
- /package/dist/v2/{hooks → features/app/hooks}/use-workspace-selector.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
2
|
-
import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
+
import type { ParameterObject, ReferenceType } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
3
3
|
/**
|
|
4
4
|
* Converts the parameters into a set of headers, cookies and url params while
|
|
5
5
|
* replacing environment variables and extracting example values. Also builds up a record of the path
|
|
@@ -14,17 +14,11 @@ import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/stric
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const buildRequestParameters: (
|
|
16
16
|
/** All parameters */
|
|
17
|
-
parameters?: ParameterObject[],
|
|
17
|
+
parameters?: ReferenceType<ParameterObject>[],
|
|
18
18
|
/** Environment variables flattened into a key-value object */
|
|
19
19
|
env?: Record<string, string>,
|
|
20
20
|
/** The key of the current example */
|
|
21
|
-
exampleKey?: string
|
|
22
|
-
/**
|
|
23
|
-
* Content type for content based parameters
|
|
24
|
-
*
|
|
25
|
-
* @see https://spec.openapis.org/oas/latest.html#fixed-fields-for-use-with-content
|
|
26
|
-
*/
|
|
27
|
-
contentType?: string) => {
|
|
21
|
+
exampleKey?: string) => {
|
|
28
22
|
cookies: XScalarCookie[];
|
|
29
23
|
headers: Record<string, string>;
|
|
30
24
|
pathVariables: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-parameters.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAKlH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qCAAqC;AACrC,aAAY,MAAkB,KAC7B;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,SAAS,EAAE,eAAe,CAAA;CAsG3B,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { replaceEnvVariables as m } from "@scalar/helpers/regex/replace-variables";
|
|
2
|
+
import { getResolvedRef as u } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
|
+
import { xScalarCookieSchema as P } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
|
|
4
|
+
import { coerceValue as y } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
5
|
+
import { getDelimiter as c } from "./get-delimiter.js";
|
|
6
|
+
import { getExample as v } from "./get-example.js";
|
|
7
|
+
const $ = (f = [], n = {}, l = "default") => {
|
|
8
|
+
const a = [];
|
|
9
|
+
let i = "application/json";
|
|
10
|
+
for (const t of f) {
|
|
11
|
+
const e = u(t);
|
|
12
|
+
a.push(e), e.in === "header" && e.name.toLowerCase() === "content-type" && "examples" in e && (i = u(e?.examples?.[l])?.value ?? i);
|
|
13
|
+
}
|
|
14
|
+
return a.reduce(
|
|
15
|
+
(t, e) => {
|
|
16
|
+
const s = v(e, l, i);
|
|
17
|
+
if (!s || s["x-disabled"])
|
|
18
|
+
return t;
|
|
19
|
+
const r = typeof s.value == "string" ? m(s.value, n) : s.value, o = m(e.name, n);
|
|
20
|
+
if (e.in === "header") {
|
|
21
|
+
if (o.toLowerCase() === "content-type" && r === "multipart/form-data")
|
|
22
|
+
return t;
|
|
23
|
+
t.headers[o] ? t.headers[o] += `,${r}` : t.headers[o] = r;
|
|
24
|
+
}
|
|
25
|
+
if (e.in === "path" && (t.pathVariables[o] = encodeURIComponent(r)), e.in === "query") {
|
|
26
|
+
const p = "explode" in e && e.explode !== void 0 ? e.explode : !0, h = "style" in e && e.style ? e.style : "form";
|
|
27
|
+
if (p)
|
|
28
|
+
t.urlParams.append(o, r);
|
|
29
|
+
else {
|
|
30
|
+
const d = t.urlParams.get(o);
|
|
31
|
+
if (d) {
|
|
32
|
+
const x = c(h);
|
|
33
|
+
t.urlParams.set(o, `${d}${x}${r}`);
|
|
34
|
+
} else
|
|
35
|
+
t.urlParams.set(o, r);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return e.in === "cookie" && t.cookies.push(
|
|
39
|
+
y(P, {
|
|
40
|
+
name: o,
|
|
41
|
+
value: r,
|
|
42
|
+
path: "/"
|
|
43
|
+
})
|
|
44
|
+
), t;
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
cookies: [],
|
|
48
|
+
headers: {},
|
|
49
|
+
pathVariables: {},
|
|
50
|
+
urlParams: new URLSearchParams()
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
$ as buildRequestParameters
|
|
56
|
+
};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { type XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
2
|
-
import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
+
import type { OpenApiDocument, SecurityRequirementObject, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
3
|
+
/**
|
|
4
|
+
* Get the selected security schemes from the selected security.
|
|
5
|
+
* Takes security requirement objects and resolves them to actual security scheme objects.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getSelectedSecuritySchemes: (securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"], selectedSecurity: SecurityRequirementObject[]) => SecuritySchemeObject[];
|
|
3
8
|
/**
|
|
4
9
|
* Generates the headers, cookies and query params for selected security schemes
|
|
5
10
|
* In the future we can add customization for where the security is applied
|
|
6
11
|
*/
|
|
7
12
|
export declare const buildRequestSecurity: (
|
|
8
|
-
/**
|
|
9
|
-
securitySchemes
|
|
13
|
+
/** Document defined security schemes */
|
|
14
|
+
securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"],
|
|
15
|
+
/** Currently selected security for the current operation */
|
|
16
|
+
selectedSecurity: SecurityRequirementObject[],
|
|
10
17
|
/** Environment variables flattened into a key-value object */
|
|
11
18
|
env?: Record<string, string>,
|
|
12
19
|
/** Include this parameter to set the placeholder for empty tokens */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAGrE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GACrC,iBAAiB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAC9E,kBAAkB,yBAAyB,EAAE,KAC5C,oBAAoB,EAUd,CAAA;AAET;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,wCAAwC;AACxC,iBAAiB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;AAC9E,4DAA4D;AAC5D,kBAAkB,yBAAyB,EAAE;AAC7C,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qEAAqE;AACrE,8BAA0B,KACzB;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CA0DzF,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isDefined as p } from "@scalar/helpers/array/is-defined";
|
|
2
|
+
import { objectKeys as m } from "@scalar/helpers/object/object-keys";
|
|
3
|
+
import { replaceEnvVariables as s } from "@scalar/helpers/regex/replace-variables";
|
|
4
|
+
import { getResolvedRef as d } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
5
|
+
import { xScalarCookieSchema as S } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
|
|
6
|
+
import { coerceValue as x } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
7
|
+
import { encode as y } from "js-base64";
|
|
8
|
+
const k = (n, f) => f.flatMap(
|
|
9
|
+
(r) => m(r).flatMap((i) => {
|
|
10
|
+
const o = d(n?.[i]);
|
|
11
|
+
return o || [];
|
|
12
|
+
})
|
|
13
|
+
) ?? [], g = (n, f, r = {}, i = "") => {
|
|
14
|
+
const o = {}, u = [], l = new URLSearchParams();
|
|
15
|
+
return k(n, f).forEach((t) => {
|
|
16
|
+
if (t.type === "apiKey") {
|
|
17
|
+
const e = s(t.name, r), a = s(t["x-scalar-secret-token"], r) || i;
|
|
18
|
+
t.in === "header" && (o[e] = a), t.in === "query" && l.append(e, a), t.in === "cookie" && u.push(
|
|
19
|
+
x(S, {
|
|
20
|
+
name: e,
|
|
21
|
+
value: a,
|
|
22
|
+
path: "/"
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
if (t.type === "http")
|
|
27
|
+
if (t.scheme === "basic") {
|
|
28
|
+
const e = s(t["x-scalar-secret-username"], r), a = s(t["x-scalar-secret-password"], r), c = `${e}:${a}`;
|
|
29
|
+
o.Authorization = `Basic ${c === ":" ? "username:password" : y(c)}`;
|
|
30
|
+
} else {
|
|
31
|
+
const e = s(t["x-scalar-secret-token"], r);
|
|
32
|
+
o.Authorization = `Bearer ${e || i}`;
|
|
33
|
+
}
|
|
34
|
+
if (t.type === "oauth2") {
|
|
35
|
+
const e = Object.values(t.flows), a = s(
|
|
36
|
+
e.filter(p).find((c) => c["x-scalar-secret-token"])?.["x-scalar-secret-token"] ?? "",
|
|
37
|
+
r
|
|
38
|
+
);
|
|
39
|
+
o.Authorization = `Bearer ${a || i}`;
|
|
40
|
+
}
|
|
41
|
+
}), { headers: o, cookies: u, urlParams: l };
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
g as buildRequestSecurity,
|
|
45
|
+
k as getSelectedSecuritySchemes
|
|
46
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { OpenApiDocument, SecurityRequirementObject, 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
|
+
/**
|
|
8
|
+
* Builds a fully configured Request object ready for execution.
|
|
9
|
+
*
|
|
10
|
+
* This function processes an OpenAPI operation and constructs a fetch-compatible
|
|
11
|
+
* Request by resolving environment variables, applying security schemes, building
|
|
12
|
+
* headers and cookies, handling proxy redirection, and preparing the request body.
|
|
13
|
+
*
|
|
14
|
+
* The function handles special cases like Electron environments and proxy usage
|
|
15
|
+
* where custom cookie headers are required.
|
|
16
|
+
*
|
|
17
|
+
* @returns A tuple containing either an error or the request object with an abort controller
|
|
18
|
+
*/
|
|
19
|
+
export declare const buildRequest: ({ environment, exampleKey, globalCookies, method, operation, path, proxyUrl, server, securitySchemes, selectedSecurity, }: {
|
|
20
|
+
/** For environment variables in the inputs */
|
|
21
|
+
environment: XScalarEnvironment;
|
|
22
|
+
/** The key of the current example */
|
|
23
|
+
exampleKey: string;
|
|
24
|
+
/** Workspace + document cookies */
|
|
25
|
+
globalCookies: XScalarCookie[];
|
|
26
|
+
/** The HTTP method of the operation */
|
|
27
|
+
method: HttpMethod;
|
|
28
|
+
/** The operation object */
|
|
29
|
+
operation: OperationObject;
|
|
30
|
+
/** The path of the operation */
|
|
31
|
+
path: string;
|
|
32
|
+
/** The proxy URL for cookie domain determination */
|
|
33
|
+
proxyUrl: string;
|
|
34
|
+
/** Document defined security schemes */
|
|
35
|
+
securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"];
|
|
36
|
+
/** Currently selected security for the current operation */
|
|
37
|
+
selectedSecurity: SecurityRequirementObject[];
|
|
38
|
+
/** The server object */
|
|
39
|
+
server: ServerObject | null;
|
|
40
|
+
}) => ErrorResponse<{
|
|
41
|
+
controller: AbortController;
|
|
42
|
+
request: Request;
|
|
43
|
+
isUsingProxy: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
//# sourceMappingURL=build-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAKnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAO1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,2HAW1B;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,wCAAwC;IACxC,eAAe,EAAE,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAA;IAC9E,4DAA4D;IAC5D,gBAAgB,EAAE,yBAAyB,EAAE,CAAA;IAC7C,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;CAC5B,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CAwFA,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { replaceVariables as U } from "@scalar/helpers/regex/replace-variables";
|
|
2
|
+
import { mergeUrls as x } from "@scalar/helpers/url/merge-urls";
|
|
3
|
+
import { shouldUseProxy as I, redirectToProxy as T } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { getResolvedRef as V } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
5
|
+
import { objectEntries as _ } from "@vueuse/core";
|
|
6
|
+
import { isElectron as k } from "../../../../libs/electron.js";
|
|
7
|
+
import { ERRORS as q, normalizeError as D } from "../../../../libs/errors.js";
|
|
8
|
+
import { buildRequestBody as j } from "./build-request-body.js";
|
|
9
|
+
import { buildRequestCookieHeader as z } from "./build-request-cookie-header.js";
|
|
10
|
+
import { buildRequestParameters as F } from "./build-request-parameters.js";
|
|
11
|
+
import { buildRequestSecurity as G } from "./build-request-security.js";
|
|
12
|
+
const ee = ({
|
|
13
|
+
environment: y,
|
|
14
|
+
exampleKey: u = "default",
|
|
15
|
+
globalCookies: h,
|
|
16
|
+
method: v,
|
|
17
|
+
operation: m,
|
|
18
|
+
path: a,
|
|
19
|
+
proxyUrl: c,
|
|
20
|
+
server: d,
|
|
21
|
+
securitySchemes: E,
|
|
22
|
+
selectedSecurity: C
|
|
23
|
+
}) => {
|
|
24
|
+
try {
|
|
25
|
+
const e = y.variables.reduce(
|
|
26
|
+
(t, o) => (t[o.name] = typeof o.value == "string" ? o.value : o.value.default, t),
|
|
27
|
+
{}
|
|
28
|
+
), A = _(d?.variables ?? {}).reduce(
|
|
29
|
+
(t, [o, P]) => (P.default && (t[o] = P.default), t),
|
|
30
|
+
{}
|
|
31
|
+
), i = U(d?.url ?? "", { ...e, ...A }), H = V(m.requestBody);
|
|
32
|
+
if (!i && !a)
|
|
33
|
+
throw q.URL_EMPTY;
|
|
34
|
+
const s = F(m.parameters ?? [], e, u), S = j(H, e, u), n = G(E, C, e), r = { ...s.headers, ...n.headers }, w = new URLSearchParams([...s.urlParams, ...n.urlParams]), f = U(a, { ...e, ...s.pathVariables }), p = x(i, f, w), R = I(c, p), B = T(c, p), b = r["User-Agent"] || r["user-agent"];
|
|
35
|
+
k() && b && (r["X-Scalar-User-Agent"] = b);
|
|
36
|
+
const l = z({
|
|
37
|
+
paramCookies: [...s.cookies, ...n.cookies],
|
|
38
|
+
globalCookies: h,
|
|
39
|
+
env: e,
|
|
40
|
+
path: f,
|
|
41
|
+
originalCookieHeader: r.Cookie || r.cookie,
|
|
42
|
+
url: i || a,
|
|
43
|
+
useCustomCookieHeader: k() || R
|
|
44
|
+
});
|
|
45
|
+
l && (r[l.name] = l.value);
|
|
46
|
+
const g = new AbortController(), L = new Request(B, {
|
|
47
|
+
method: v,
|
|
48
|
+
headers: r,
|
|
49
|
+
signal: g.signal,
|
|
50
|
+
body: S
|
|
51
|
+
});
|
|
52
|
+
return [
|
|
53
|
+
null,
|
|
54
|
+
{
|
|
55
|
+
controller: g,
|
|
56
|
+
isUsingProxy: R,
|
|
57
|
+
request: L
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return [D(e, q.BUILDING_REQUEST_FAILED), null];
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
ee as buildRequest
|
|
66
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import t from "whatwg-mimetype";
|
|
2
|
+
import { isTextMediaType as c } from "../../../../views/Request/consts/mediaTypes.js";
|
|
3
|
+
const m = (r, o) => {
|
|
4
|
+
const e = new t(o);
|
|
5
|
+
return c(e.essence) ? new TextDecoder(e.parameters.get("charset")).decode(r) : new Blob([r], { type: e.essence });
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
m as decodeBuffer
|
|
9
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely extract cookie header keys from response headers.
|
|
3
|
+
* Modern browsers support getSetCookie() which returns an array of Set-Cookie values.
|
|
4
|
+
*
|
|
5
|
+
* Note: Set-Cookie headers are often hidden from JavaScript due to security restrictions.
|
|
6
|
+
* The browser's network tab may show Set-Cookie headers that are not accessible via the
|
|
7
|
+
* Fetch API Headers object. This is intentional browser behavior to prevent JavaScript
|
|
8
|
+
* from accessing HttpOnly cookies and other sensitive cookie data.
|
|
9
|
+
*
|
|
10
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Headers/getSetCookie
|
|
11
|
+
*
|
|
12
|
+
* @param headers - The response headers object
|
|
13
|
+
* @returns Array of cookie header keys or empty array if not supported or restricted
|
|
14
|
+
*/
|
|
15
|
+
export declare const getCookieHeaderKeys: (headers: Headers) => string[];
|
|
16
|
+
//# sourceMappingURL=get-cookie-header-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cookie-header-keys.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-cookie-header-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,OAAO,KAAG,MAAM,EAE5D,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const t = (e) => {
|
|
2
|
+
switch (e) {
|
|
3
|
+
// color=blue black brown
|
|
4
|
+
case "spaceDelimited":
|
|
5
|
+
return " ";
|
|
6
|
+
// color=blue|black|brown
|
|
7
|
+
case "pipeDelimited":
|
|
8
|
+
return "|";
|
|
9
|
+
// color=blue,black,brown
|
|
10
|
+
case "form":
|
|
11
|
+
default:
|
|
12
|
+
return ",";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
t as getDelimiter
|
|
17
|
+
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
-
/**
|
|
3
|
-
|
|
1
|
+
import type { ExampleObject, 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, exampleKey: string | undefined, contentType: string | undefined) => ExampleObject | undefined;
|
|
4
10
|
//# sourceMappingURL=get-example.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAIrE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,EAC1C,YAAY,MAAM,GAAG,SAAS,EAC9B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SA+ClB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getResolvedRef as d } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
+
import { getResolvedRefDeep as o } from "../../operation-code-sample/helpers/get-resolved-ref-deep.js";
|
|
3
|
+
const m = (e, s, l) => {
|
|
4
|
+
if ("content" in e) {
|
|
5
|
+
const t = e.content?.[l ?? Object.keys(e.content)[0] ?? ""], f = t?.examples ?? {}, c = s ?? Object.keys(f)[0] ?? "", i = o(f[c]);
|
|
6
|
+
return typeof i < "u" ? i : typeof s > "u" && t?.example ? { value: o(t.example) } : void 0;
|
|
7
|
+
}
|
|
8
|
+
if ("examples" in e || "example" in e) {
|
|
9
|
+
const t = d(e.examples) ?? {}, f = s ?? Object.keys(t)[0] ?? "", c = o(t?.[f]);
|
|
10
|
+
if (typeof c < "u")
|
|
11
|
+
return c;
|
|
12
|
+
if (typeof s > "u" && e.example)
|
|
13
|
+
return { value: o(e.example) };
|
|
14
|
+
}
|
|
15
|
+
const n = o(e);
|
|
16
|
+
if ("schema" in n && n.schema && "default" in n.schema && typeof n.schema.default < "u")
|
|
17
|
+
return { value: n.schema.default };
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
m as getExample
|
|
21
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
+
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
3
|
+
import { type ErrorResponse } from '../../../../libs/errors.js';
|
|
4
|
+
import { type ClientPlugin } from '../../../../v2/helpers/plugins.js';
|
|
5
|
+
/** A single set of populated values for a sent request */
|
|
6
|
+
export type ResponseInstance = Omit<Response, 'headers'> & {
|
|
7
|
+
/** Store headers as an object to match what we had with axios */
|
|
8
|
+
headers: Record<string, string>;
|
|
9
|
+
/** Keys of headers which set cookies */
|
|
10
|
+
cookieHeaderKeys: string[];
|
|
11
|
+
/** Time in ms the request took */
|
|
12
|
+
duration: number;
|
|
13
|
+
/** The response status */
|
|
14
|
+
status: number;
|
|
15
|
+
/** The response status text */
|
|
16
|
+
statusText: string;
|
|
17
|
+
/** The response method */
|
|
18
|
+
method: HttpMethod;
|
|
19
|
+
/** The request path */
|
|
20
|
+
path: string;
|
|
21
|
+
} & ({
|
|
22
|
+
/** The response data */
|
|
23
|
+
data: string | Blob;
|
|
24
|
+
/** The response size in bytes */
|
|
25
|
+
size: number;
|
|
26
|
+
} | {
|
|
27
|
+
/** A stream reader for a streamable response body */
|
|
28
|
+
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Execute the built fetch request and return a structured response.
|
|
32
|
+
*
|
|
33
|
+
* This function handles the complete request lifecycle including plugin hooks,
|
|
34
|
+
* response processing, streaming detection, and error handling. It supports both
|
|
35
|
+
* standard responses and server-sent event streams.
|
|
36
|
+
*
|
|
37
|
+
* @param request - The request built by the buildRequest helper
|
|
38
|
+
* @param operation - The OpenAPI operation being executed
|
|
39
|
+
* @param plugins - Array of client plugins to execute hooks
|
|
40
|
+
* @param isUsingProxy - Whether the request is being proxied for header handling
|
|
41
|
+
* @returns A tuple with either an error or the response data
|
|
42
|
+
*/
|
|
43
|
+
export declare const sendRequest: ({ isUsingProxy, operation, request, plugins, }: {
|
|
44
|
+
isUsingProxy: boolean;
|
|
45
|
+
operation: OperationObject;
|
|
46
|
+
plugins: ClientPlugin[];
|
|
47
|
+
request: Request;
|
|
48
|
+
}) => Promise<ErrorResponse<{
|
|
49
|
+
response: ResponseInstance;
|
|
50
|
+
request: Request;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
}>>;
|
|
53
|
+
//# sourceMappingURL=send-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/send-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAE1E,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,sBAAsB,CAAA;AAKrE,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG;IACzD,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,wCAAwC;IACxC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,0BAA0B;IAC1B,MAAM,EAAE,UAAU,CAAA;IAClB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,CACE;IACE,wBAAwB;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,qDAAqD;IACrD,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAA;CAChD,CACJ,CAAA;AAKH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAU,gDAK/B;IACD,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CACT,aAAa,CAAC;IACZ,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAC,CA0DH,CAAA"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { httpStatusCodes as S } from "@scalar/helpers/http/http-status-codes";
|
|
2
|
+
import { normalizeError as b, ERRORS as x } from "../../../../libs/errors.js";
|
|
3
|
+
import { normalizeHeaders as D } from "../../../../libs/normalize-headers.js";
|
|
4
|
+
import { executeHook as f } from "../../../helpers/plugins.js";
|
|
5
|
+
import { decodeBuffer as E } from "./decode-buffer.js";
|
|
6
|
+
import { getCookieHeaderKeys as T } from "./get-cookie-header-keys.js";
|
|
7
|
+
const H = [204, 205, 304], v = async ({
|
|
8
|
+
isUsingProxy: t,
|
|
9
|
+
operation: o,
|
|
10
|
+
request: i,
|
|
11
|
+
plugins: n
|
|
12
|
+
}) => {
|
|
13
|
+
try {
|
|
14
|
+
const s = await f(i, "beforeRequest", n), m = Date.now(), e = await fetch(s), a = Date.now(), c = a - m, d = e.headers.get("content-type"), r = D(e.headers, t), u = new URL(e.url), h = u.pathname + u.search, p = e.statusText || S[e.status]?.name || "", l = s.method, y = H.includes(e.status);
|
|
15
|
+
return d?.startsWith("text/event-stream") && e.body ? k({
|
|
16
|
+
response: e,
|
|
17
|
+
modifiedRequest: s,
|
|
18
|
+
operation: o,
|
|
19
|
+
plugins: n,
|
|
20
|
+
endTime: a,
|
|
21
|
+
duration: c,
|
|
22
|
+
responseHeaders: r,
|
|
23
|
+
statusText: p,
|
|
24
|
+
method: l,
|
|
25
|
+
fullPath: h
|
|
26
|
+
}) : q({
|
|
27
|
+
response: e,
|
|
28
|
+
modifiedRequest: s,
|
|
29
|
+
operation: o,
|
|
30
|
+
plugins: n,
|
|
31
|
+
endTime: a,
|
|
32
|
+
duration: c,
|
|
33
|
+
responseHeaders: r,
|
|
34
|
+
statusText: p,
|
|
35
|
+
method: l,
|
|
36
|
+
fullPath: h,
|
|
37
|
+
contentType: d,
|
|
38
|
+
shouldSkipBody: y
|
|
39
|
+
});
|
|
40
|
+
} catch (s) {
|
|
41
|
+
return [b(s, x.REQUEST_FAILED), null];
|
|
42
|
+
}
|
|
43
|
+
}, k = async ({
|
|
44
|
+
response: t,
|
|
45
|
+
modifiedRequest: o,
|
|
46
|
+
operation: i,
|
|
47
|
+
plugins: n,
|
|
48
|
+
endTime: s,
|
|
49
|
+
duration: m,
|
|
50
|
+
responseHeaders: e,
|
|
51
|
+
statusText: a,
|
|
52
|
+
method: c,
|
|
53
|
+
fullPath: d
|
|
54
|
+
}) => {
|
|
55
|
+
const r = new Response(null, {
|
|
56
|
+
status: t.status,
|
|
57
|
+
statusText: a,
|
|
58
|
+
headers: t.headers
|
|
59
|
+
});
|
|
60
|
+
await f({ response: r, request: o, operation: i }, "responseReceived", n);
|
|
61
|
+
const u = T(r.headers);
|
|
62
|
+
return [
|
|
63
|
+
null,
|
|
64
|
+
{
|
|
65
|
+
timestamp: s,
|
|
66
|
+
request: o,
|
|
67
|
+
response: {
|
|
68
|
+
...r,
|
|
69
|
+
headers: e,
|
|
70
|
+
cookieHeaderKeys: u,
|
|
71
|
+
reader: t.body.getReader(),
|
|
72
|
+
duration: m,
|
|
73
|
+
method: c,
|
|
74
|
+
path: d
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
}, q = async ({
|
|
79
|
+
response: t,
|
|
80
|
+
modifiedRequest: o,
|
|
81
|
+
operation: i,
|
|
82
|
+
plugins: n,
|
|
83
|
+
endTime: s,
|
|
84
|
+
duration: m,
|
|
85
|
+
responseHeaders: e,
|
|
86
|
+
statusText: a,
|
|
87
|
+
method: c,
|
|
88
|
+
fullPath: d,
|
|
89
|
+
contentType: r,
|
|
90
|
+
shouldSkipBody: u
|
|
91
|
+
}) => {
|
|
92
|
+
const p = await t.clone().arrayBuffer(), y = E(p, r ?? "text/plain;charset=UTF-8"), R = new Response(u ? null : p, {
|
|
93
|
+
status: t.status,
|
|
94
|
+
statusText: a,
|
|
95
|
+
headers: t.headers
|
|
96
|
+
});
|
|
97
|
+
await f({ response: R, request: o, operation: i }, "responseReceived", n);
|
|
98
|
+
const w = T(R.headers);
|
|
99
|
+
return [
|
|
100
|
+
null,
|
|
101
|
+
{
|
|
102
|
+
timestamp: s,
|
|
103
|
+
request: o,
|
|
104
|
+
response: {
|
|
105
|
+
...R,
|
|
106
|
+
headers: e,
|
|
107
|
+
cookieHeaderKeys: w,
|
|
108
|
+
data: y,
|
|
109
|
+
size: p.byteLength,
|
|
110
|
+
duration: m,
|
|
111
|
+
method: c,
|
|
112
|
+
status: t.status,
|
|
113
|
+
path: d
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
];
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
v as sendRequest
|
|
120
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
examples?: MediaTypeObject['examples']
|
|
3
|
+
examples?: MediaTypeObject['examples'] | Record<string, string>;
|
|
4
4
|
};
|
|
5
5
|
type __VLS_PublicProps = __VLS_Props & {
|
|
6
6
|
modelValue: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/ExamplePicker.vue"],"names":[],"mappings":"AA4DA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAGnG,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/ExamplePicker.vue"],"names":[],"mappings":"AA4DA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAGnG,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChE,CAAC;AAwBF,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,UAAU,EAAE,MAAM,CAAC;CAClB,CAAC;;;;;;AA0GF,wBAOG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"AA4bA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGxD,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AASrE,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,yCAAyC,CAAA;AAMhD,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,eAAe,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;GAQG;;YAkBO,MAAM,OAAO;YACb,MAAM,OAAO;;AAlBvB,wBA2gBC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./OperationCodeSample.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-6c4b269b"]]);
|
|
5
5
|
export {
|
|
6
6
|
e as default
|
|
7
7
|
};
|