@scalar/api-client 2.18.4 → 2.19.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 +37 -0
- package/dist/components/AddressBar/AddressBar.vue2.js +5 -5
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +6 -6
- package/dist/components/ImportCollection/DropEventListener.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/DropEventListener.vue.js +26 -28
- package/dist/components/ImportCollection/utils/get-openapi-version.d.ts.map +1 -1
- package/dist/components/ImportCollection/utils/import-collection.d.ts +1 -1
- package/dist/components/ImportCollection/utils/import-collection.d.ts.map +1 -1
- package/dist/components/Search/useSearch.d.ts.map +1 -1
- package/dist/components/Search/useSearch.js +16 -16
- package/dist/components/Server/index.d.ts +1 -1
- package/dist/components/Server/index.d.ts.map +1 -1
- package/dist/components/Server/index.js +6 -6
- package/dist/components/SideNav/SideNav.vue.js +3 -3
- package/dist/components/Sidebar/index.d.ts +1 -2
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useResponseBody.d.ts +1 -1
- package/dist/hooks/useResponseBody.d.ts.map +1 -1
- package/dist/hooks/useResponseBody.js +4 -4
- package/dist/hooks/useSidebar.d.ts +1 -1
- package/dist/hooks/useSidebar.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/layouts/App/ApiClientApp.vue.js +5 -5
- package/dist/layouts/App/MainLayout.vue.js +4 -4
- package/dist/layouts/App/create-api-client-app.d.ts +12 -12
- package/dist/layouts/App/index.d.ts +1 -1
- package/dist/layouts/App/index.d.ts.map +1 -1
- package/dist/layouts/Web/ApiClientWeb.vue.js +6 -6
- package/dist/layouts/Web/create-api-client-web.d.ts +12 -12
- package/dist/layouts/Web/index.d.ts +1 -1
- package/dist/layouts/Web/index.d.ts.map +1 -1
- package/dist/libs/create-client.d.ts +12 -12
- package/dist/libs/get-request-uid-by-path-method.d.ts +1 -1
- package/dist/libs/get-request-uid-by-path-method.d.ts.map +1 -1
- package/dist/libs/hot-keys.d.ts +2 -2
- package/dist/libs/hot-keys.d.ts.map +1 -1
- package/dist/libs/importers/curl.d.ts.map +1 -1
- package/dist/libs/index.d.ts +14 -15
- package/dist/libs/index.d.ts.map +1 -1
- package/dist/libs/index.js +33 -33
- package/dist/libs/parse-curl.js +4 -4
- package/dist/libs/send-request/create-fetch-body.d.ts +1 -1
- package/dist/libs/send-request/create-fetch-body.d.ts.map +1 -1
- package/dist/libs/send-request/create-fetch-body.js +1 -1
- package/dist/libs/send-request/create-fetch-headers.d.ts.map +1 -1
- package/dist/libs/send-request/create-fetch-query-params.d.ts.map +1 -1
- package/dist/libs/send-request/create-fetch-query-params.js +2 -1
- package/dist/libs/send-request/index.d.ts +1 -1
- package/dist/libs/send-request/index.d.ts.map +1 -1
- package/dist/libs/send-request/index.js +4 -4
- package/dist/libs/send-request/set-request-cookies.d.ts.map +1 -1
- package/dist/libs/send-request/set-request-cookies.js +4 -4
- package/dist/store/active-entities.d.ts +1 -1
- package/dist/store/collections.d.ts +1 -1
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/collections.js +4 -4
- package/dist/store/environment.d.ts +1 -1
- package/dist/store/environment.d.ts.map +1 -1
- package/dist/store/environment.js +4 -4
- package/dist/store/import-spec.d.ts +2 -2
- package/dist/store/import-spec.d.ts.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/request-example.d.ts +1 -1
- package/dist/store/request-example.d.ts.map +1 -1
- package/dist/store/request-example.js +6 -6
- package/dist/store/requests.d.ts +1 -1
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/requests.js +8 -8
- package/dist/store/security-schemes.d.ts +1 -1
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/security-schemes.js +4 -4
- package/dist/store/servers.d.ts +1 -1
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/servers.js +4 -4
- package/dist/store/store.d.ts +12 -12
- package/dist/store/tags.d.ts +1 -1
- package/dist/store/tags.d.ts.map +1 -1
- package/dist/store/tags.js +5 -5
- package/dist/store/workspace.d.ts +13 -13
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +7 -7
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +4 -5
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +17 -16
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +3 -3
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +22 -22
- 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 +14 -13
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.js +43 -41
- package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts +14 -0
- package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.js +14 -0
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts +25 -0
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.js +17 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +10 -0
- 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 +29 -25
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +6 -1
- 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 +27 -23
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +10 -1
- 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 +48 -39
- 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 +49 -46
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +6 -2
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +2 -2
- package/dist/v2/blocks/request-block/RequestBlock.vue2.js +200 -115
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts +4 -4
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +21 -17
- package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts +16 -10
- package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.js +32 -45
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +16 -13
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js +4 -4
- package/dist/v2/blocks/request-block/components/RequestTable.vue2.js +32 -33
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +33 -18
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +106 -106
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts +10 -5
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js +60 -31
- package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts +41 -0
- package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -0
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +25 -0
- package/dist/v2/blocks/request-block/helpers/group-by.d.ts +1 -1
- package/dist/v2/blocks/request-block/helpers/group-by.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/group-by.js +6 -3
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts +13 -0
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts.map +1 -0
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.js +7 -0
- 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.vue2.js +61 -63
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +1 -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/OAuth2.vue.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +1 -2
- 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/RequestAuthTab.vue.d.ts +2 -2
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +2 -0
- 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 +57 -51
- package/dist/v2/features/app/App.vue.js +6 -6
- package/dist/v2/features/app/app-events.d.ts +5 -9
- package/dist/v2/features/app/app-events.d.ts.map +1 -1
- package/dist/v2/features/app/app-events.js +146 -120
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +69 -71
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue2.js +5 -5
- 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 +21 -22
- package/dist/v2/features/modal/index.d.ts +1 -1
- package/dist/v2/features/modal/index.d.ts.map +1 -1
- package/dist/v2/features/modal/index.js +4 -4
- package/dist/v2/features/modal/modal-events.d.ts +13 -0
- package/dist/v2/features/modal/modal-events.d.ts.map +1 -0
- package/dist/v2/features/modal/modal-events.js +31 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +30 -43
- package/dist/v2/workspace-events.d.ts +25 -0
- package/dist/v2/workspace-events.d.ts.map +1 -0
- package/dist/v2/workspace-events.js +202 -0
- package/dist/views/Components/CodeSnippet/helpers/convert-to-har-request.d.ts.map +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts.map +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +3 -3
- package/dist/views/Environment/handle-drag.d.ts +1 -1
- package/dist/views/Environment/handle-drag.d.ts.map +1 -1
- package/dist/views/Request/RequestRoot.vue2.js +9 -9
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue2.js +4 -4
- package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +4 -4
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +5 -5
- package/dist/views/Request/RequestSection/helpers/update-scheme.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue2.js +6 -6
- package/dist/views/Request/RequestSidebarItem.vue2.js +6 -6
- package/dist/views/Request/RequestSubpageHeader.vue2.js +4 -4
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/ResponseSection/index.d.ts +1 -1
- package/dist/views/Request/ResponseSection/index.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/index.js +4 -4
- package/dist/views/Request/consts/index.d.ts +2 -3
- package/dist/views/Request/consts/index.d.ts.map +1 -1
- package/dist/views/Request/consts/new-auth-options.d.ts +1 -1
- package/dist/views/Request/consts/new-auth-options.d.ts.map +1 -1
- package/dist/views/Request/handle-drag.d.ts +1 -1
- package/dist/views/Request/handle-drag.d.ts.map +1 -1
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -1
- package/dist/views/Request/hooks/useOpenApiWatcher.js +14 -14
- package/dist/views/Request/libs/auth.d.ts +1 -1
- package/dist/views/Request/libs/auth.d.ts.map +1 -1
- package/dist/views/Request/libs/index.d.ts +3 -3
- package/dist/views/Request/libs/index.d.ts.map +1 -1
- package/dist/views/Request/libs/oauth2.js +1 -1
- package/dist/views/Request/libs/watch-mode.js +6 -6
- package/dist/views/Request/types/index.d.ts +1 -1
- package/dist/views/Request/types/index.d.ts.map +1 -1
- package/package.json +13 -13
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts +0 -18
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +0 -1
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +0 -39
- package/dist/v2/features/operation/helpers/get-operation-header.js +0 -12
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods';
|
|
2
2
|
import { type AvailableClients } from '@scalar/types/snippetz';
|
|
3
3
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
4
|
-
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
5
|
-
import type { AuthMeta } from '@scalar/workspace-store/mutators';
|
|
4
|
+
import type { AuthMeta, WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
6
5
|
import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
|
|
7
|
-
import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
8
6
|
import type { OpenApiDocument, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
9
7
|
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
|
|
10
8
|
import type { ClientLayout } from '../../../hooks/index.js';
|
|
9
|
+
import type { ExtendedScalarCookie } from '../../../v2/blocks/request-block/RequestBlock.vue.js';
|
|
11
10
|
import { type History } from '../../../v2/blocks/scalar-address-bar-block/index.js';
|
|
12
11
|
import type { MergedSecuritySchemes } from '../../../v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js';
|
|
13
12
|
import { type ClientPlugin } from '../../../v2/helpers/plugins.js';
|
|
@@ -34,7 +33,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
34
33
|
/** Application version */
|
|
35
34
|
appVersion: string;
|
|
36
35
|
/** Workspace/document cookies */
|
|
37
|
-
globalCookies:
|
|
36
|
+
globalCookies: ExtendedScalarCookie[];
|
|
38
37
|
/** Current request path */
|
|
39
38
|
path: string;
|
|
40
39
|
/** Current request method */
|
|
@@ -89,7 +88,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
89
88
|
/** Application version */
|
|
90
89
|
appVersion: string;
|
|
91
90
|
/** Workspace/document cookies */
|
|
92
|
-
globalCookies:
|
|
91
|
+
globalCookies: ExtendedScalarCookie[];
|
|
93
92
|
/** Current request path */
|
|
94
93
|
path: string;
|
|
95
94
|
/** Current request method */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as C, computed as r, ref as a, onMounted as R, onBeforeUnmount as k, watch as U, createElementBlock as b, openBlock as E, createElementVNode as O, createVNode as n, withCtx as g, unref as c } from "vue";
|
|
2
2
|
import { AVAILABLE_CLIENTS as V } from "@scalar/types/snippetz";
|
|
3
3
|
import { useToasts as K } from "@scalar/use-toasts";
|
|
4
4
|
import w from "../../../components/ViewLayout/ViewLayout.vue.js";
|
|
@@ -16,7 +16,7 @@ import H from "../request-block/RequestBlock.vue.js";
|
|
|
16
16
|
import Q from "../response-block/ResponseBlock.vue.js";
|
|
17
17
|
const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" }, G = {
|
|
18
18
|
name: "OperationBlock"
|
|
19
|
-
}, ae = /* @__PURE__ */
|
|
19
|
+
}, ae = /* @__PURE__ */ C({
|
|
20
20
|
...G,
|
|
21
21
|
props: {
|
|
22
22
|
eventBus: {},
|
|
@@ -47,8 +47,8 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
|
|
|
47
47
|
proxyUrl: {}
|
|
48
48
|
},
|
|
49
49
|
emits: ["update:servers"],
|
|
50
|
-
setup(e, { emit:
|
|
51
|
-
const x =
|
|
50
|
+
setup(e, { emit: B }) {
|
|
51
|
+
const x = B, q = r(() => $(e.httpClients)), m = r(
|
|
52
52
|
() => j(e.documentSecurity, e.operation.security)
|
|
53
53
|
), d = r(
|
|
54
54
|
() => D(
|
|
@@ -59,7 +59,7 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
|
|
|
59
59
|
)
|
|
60
60
|
), v = r(
|
|
61
61
|
() => T(e.securitySchemes, d.value.selectedSchemes)
|
|
62
|
-
), { toast: y } = K(), h = a(null),
|
|
62
|
+
), { toast: y } = K(), h = a(null), l = a(null), u = a(null), f = () => h.value?.abort(M.REQUEST_ABORTED), o = async () => {
|
|
63
63
|
const [s, t] = L({
|
|
64
64
|
environment: e.environment,
|
|
65
65
|
exampleKey: e.exampleKey,
|
|
@@ -86,15 +86,15 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
|
|
|
86
86
|
y(i.message, "error");
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
l.value = S.response, u.value = S.request;
|
|
90
90
|
};
|
|
91
|
-
return
|
|
91
|
+
return R(() => {
|
|
92
92
|
e.eventBus.on("operation:send:request:hotkey", o), e.eventBus.on("operation:cancel:request", f);
|
|
93
|
-
}),
|
|
93
|
+
}), k(() => {
|
|
94
94
|
e.eventBus.off("operation:send:request:hotkey", o), e.eventBus.off("operation:cancel:request", f);
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
}), (s, t) => (
|
|
95
|
+
}), U([() => e.path, () => e.method, () => e.exampleKey], () => {
|
|
96
|
+
l.value = null, u.value = null;
|
|
97
|
+
}), (s, t) => (E(), b("div", z, [
|
|
98
98
|
O("div", F, [
|
|
99
99
|
n(I, {
|
|
100
100
|
documentUrl: e.documentUrl,
|
|
@@ -114,15 +114,16 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
|
|
|
114
114
|
}, null, 8, ["documentUrl", "environment", "eventBus", "hideClientButton", "history", "integration", "layout", "method", "path", "server", "servers", "source"])
|
|
115
115
|
]),
|
|
116
116
|
n(w, { class: "border-t" }, {
|
|
117
|
-
default:
|
|
117
|
+
default: g(() => [
|
|
118
118
|
n(P, { class: "flex-1" }, {
|
|
119
|
-
default:
|
|
119
|
+
default: g(() => [
|
|
120
120
|
n(c(H), {
|
|
121
121
|
authMeta: e.authMeta,
|
|
122
122
|
clientOptions: q.value,
|
|
123
123
|
environment: e.environment,
|
|
124
124
|
eventBus: e.eventBus,
|
|
125
125
|
exampleKey: e.exampleKey,
|
|
126
|
+
globalCookies: e.globalCookies,
|
|
126
127
|
layout: e.layout,
|
|
127
128
|
method: e.method,
|
|
128
129
|
operation: e.operation,
|
|
@@ -135,15 +136,15 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
|
|
|
135
136
|
selectedSecurity: d.value,
|
|
136
137
|
selectedSecuritySchemes: v.value,
|
|
137
138
|
server: e.server
|
|
138
|
-
}, null, 8, ["authMeta", "clientOptions", "environment", "eventBus", "exampleKey", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securityRequirements", "securitySchemes", "selectedClient", "selectedSecurity", "selectedSecuritySchemes", "server"]),
|
|
139
|
+
}, null, 8, ["authMeta", "clientOptions", "environment", "eventBus", "exampleKey", "globalCookies", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securityRequirements", "securitySchemes", "selectedClient", "selectedSecurity", "selectedSecuritySchemes", "server"]),
|
|
139
140
|
n(c(Q), {
|
|
140
141
|
appVersion: e.appVersion,
|
|
141
142
|
eventBus: e.eventBus,
|
|
142
143
|
events: c(A)(),
|
|
143
144
|
layout: e.layout,
|
|
144
145
|
plugins: e.plugins,
|
|
145
|
-
request:
|
|
146
|
-
response:
|
|
146
|
+
request: u.value,
|
|
147
|
+
response: l.value,
|
|
147
148
|
totalPerformedRequests: e.totalPerformedRequests,
|
|
148
149
|
onSendRequest: o
|
|
149
150
|
}, null, 8, ["appVersion", "eventBus", "events", "layout", "plugins", "request", "response", "totalPerformedRequests"])
|
|
@@ -6,15 +6,13 @@ export declare const getCookieHeader: (cookieParams: XScalarCookie[], originalCo
|
|
|
6
6
|
/**
|
|
7
7
|
* Build out the cookies header taking in global, param and security scheme cookies
|
|
8
8
|
*/
|
|
9
|
-
export declare const buildRequestCookieHeader: ({ paramCookies, globalCookies, env,
|
|
9
|
+
export declare const buildRequestCookieHeader: ({ paramCookies, globalCookies, env, originalCookieHeader, url, useCustomCookieHeader, disabledGlobalCookies, }: {
|
|
10
10
|
/** Parsed/replaced cookies from the parameters and security schemes */
|
|
11
11
|
paramCookies: XScalarCookie[];
|
|
12
12
|
/** Raw global cookies from the workspace/document */
|
|
13
13
|
globalCookies: XScalarCookie[];
|
|
14
14
|
/** Environment variables flattened into a key-value object */
|
|
15
15
|
env: Record<string, string>;
|
|
16
|
-
/** The path of the request used to filter global cookies by path */
|
|
17
|
-
path: string;
|
|
18
16
|
/** Cookie header that previously exists from the spec OR from the user */
|
|
19
17
|
originalCookieHeader: string | undefined;
|
|
20
18
|
/** The url of the request used to filter global cookies by domain */
|
|
@@ -24,6 +22,8 @@ export declare const buildRequestCookieHeader: ({ paramCookies, globalCookies, e
|
|
|
24
22
|
* that's then forwarded as a `Cookie` header.
|
|
25
23
|
*/
|
|
26
24
|
useCustomCookieHeader: boolean;
|
|
25
|
+
/** The disabled global cookies for the current example */
|
|
26
|
+
disabledGlobalCookies: Record<string, boolean>;
|
|
27
27
|
}) => null | {
|
|
28
28
|
name: string;
|
|
29
29
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request-cookie-header.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-cookie-header.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAa5E;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,aAAa,EAAE,EAAE,sBAAsB,MAAM,GAAG,SAAS,KAAG,MAWzG,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI
|
|
1
|
+
{"version":3,"file":"build-request-cookie-header.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-cookie-header.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAa5E;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,aAAa,EAAE,EAAE,sBAAsB,MAAM,GAAG,SAAS,KAAG,MAWzG,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,gHAQtC;IACD,uEAAuE;IACvE,YAAY,EAAE,aAAa,EAAE,CAAA;IAC7B,qDAAqD;IACrD,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,0EAA0E;IAC1E,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAA;IAC9B,0DAA0D;IAC1D,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/C,KAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CA4BvC,CAAA"}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { replaceEnvVariables as
|
|
2
|
-
import { xScalarCookieSchema as
|
|
3
|
-
import { coerceValue as
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
1
|
+
import { replaceEnvVariables as i } from "@scalar/helpers/regex/replace-variables";
|
|
2
|
+
import { xScalarCookieSchema as c } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
|
|
3
|
+
import { coerceValue as h } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
4
|
+
import { filterGlobalCookie as f } from "./filter-global-cookies.js";
|
|
5
|
+
const d = "We're using a `X-Scalar-Cookie` custom header to the request. The proxy will forward this as a `Cookie` header. We do this to avoid the browser omitting the `Cookie` header for cross-origin requests for security reasons.", b = `We're trying to add a Cookie header, but browsers often omit them for cross-origin requests for various security reasons. If it's not working, that's probably why. Here are the requirements for it to work:
|
|
6
6
|
|
|
7
7
|
- The browser URL must be on the same domain as the server URL.
|
|
8
8
|
- The connection must be made over HTTPS.
|
|
9
|
-
`,
|
|
10
|
-
const
|
|
11
|
-
return o &&
|
|
12
|
-
},
|
|
9
|
+
`, C = (a, o) => {
|
|
10
|
+
const e = a.map((t) => `${t.name}=${t.value}`).join("; ");
|
|
11
|
+
return o && e ? `${o}; ${e}` : o || e || "";
|
|
12
|
+
}, E = ({
|
|
13
13
|
paramCookies: a,
|
|
14
14
|
globalCookies: o,
|
|
15
|
-
env:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
env: e,
|
|
16
|
+
originalCookieHeader: t,
|
|
17
|
+
url: n,
|
|
18
|
+
useCustomCookieHeader: u,
|
|
19
|
+
disabledGlobalCookies: m
|
|
20
20
|
}) => {
|
|
21
|
-
const
|
|
22
|
-
...
|
|
23
|
-
name:
|
|
24
|
-
value:
|
|
25
|
-
})), s =
|
|
26
|
-
return s ? u ? (console.warn(
|
|
21
|
+
const l = o.filter((r) => f({ cookie: r, url: n, disabledGlobalCookies: m })).map((r) => h(c, {
|
|
22
|
+
...r,
|
|
23
|
+
name: i(r.name, e),
|
|
24
|
+
value: i(r.value, e)
|
|
25
|
+
})), s = C([...l, ...a], t);
|
|
26
|
+
return s ? u ? (console.warn(d), { name: "X-Scalar-Cookie", value: s }) : (console.warn(b), { name: "Cookie", value: s }) : null;
|
|
27
27
|
};
|
|
28
28
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
E as buildRequestCookieHeader,
|
|
30
|
+
C as getCookieHeader
|
|
31
31
|
};
|
|
@@ -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":"AAEA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;
|
|
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;AAOlH;;;;;;;;;;;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"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { replaceEnvVariables as
|
|
1
|
+
import { replaceEnvVariables as f } from "@scalar/helpers/regex/replace-variables";
|
|
2
2
|
import { getResolvedRef as u } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
3
|
import { xScalarCookieSchema as P } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
|
|
4
4
|
import { coerceValue as y } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { isParamDisabled as c } from "../../request-block/helpers/is-param-disabled.js";
|
|
6
|
+
import { getDelimiter as v } from "./get-delimiter.js";
|
|
7
|
+
import { getExample as R } from "./get-example.js";
|
|
8
|
+
const L = (d = [], n = {}, l = "default") => {
|
|
8
9
|
const a = [];
|
|
9
10
|
let i = "application/json";
|
|
10
|
-
for (const t of
|
|
11
|
+
for (const t of d) {
|
|
11
12
|
const e = u(t);
|
|
12
13
|
a.push(e), e.in === "header" && e.name.toLowerCase() === "content-type" && "examples" in e && (i = u(e?.examples?.[l])?.value ?? i);
|
|
13
14
|
}
|
|
14
15
|
return a.reduce(
|
|
15
16
|
(t, e) => {
|
|
16
|
-
const s =
|
|
17
|
-
if (!s || s
|
|
17
|
+
const s = R(e, l, i);
|
|
18
|
+
if (!s || c(e, s))
|
|
18
19
|
return t;
|
|
19
|
-
const r = typeof s.value == "string" ?
|
|
20
|
+
const r = typeof s.value == "string" ? f(s.value, n) : s.value, o = f(e.name, n);
|
|
20
21
|
if (e.in === "header") {
|
|
21
22
|
if (o.toLowerCase() === "content-type" && r === "multipart/form-data")
|
|
22
23
|
return t;
|
|
@@ -27,10 +28,10 @@ const $ = (f = [], n = {}, l = "default") => {
|
|
|
27
28
|
if (p)
|
|
28
29
|
t.urlParams.append(o, r);
|
|
29
30
|
else {
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
const x =
|
|
33
|
-
t.urlParams.set(o, `${
|
|
31
|
+
const m = t.urlParams.get(o);
|
|
32
|
+
if (m) {
|
|
33
|
+
const x = v(h);
|
|
34
|
+
t.urlParams.set(o, `${m}${x}${r}`);
|
|
34
35
|
} else
|
|
35
36
|
t.urlParams.set(o, r);
|
|
36
37
|
}
|
|
@@ -52,5 +53,5 @@ const $ = (f = [], n = {}, l = "default") => {
|
|
|
52
53
|
);
|
|
53
54
|
};
|
|
54
55
|
export {
|
|
55
|
-
|
|
56
|
+
L as buildRequestParameters
|
|
56
57
|
};
|
|
@@ -1 +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;
|
|
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;AAGnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACtH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAG5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAU1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,iHAU1B;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,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,8DAA8D;IAC9D,uBAAuB,EAAE,oBAAoB,EAAE,CAAA;CAChD,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CAoFA,CAAA"}
|
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
proxyUrl: l,
|
|
1
|
+
import { shouldUseProxy as v, redirectToProxy as A } from "@scalar/oas-utils/helpers";
|
|
2
|
+
import { getResolvedRef as S } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
|
+
import { isElectron as p } from "../../../../libs/electron.js";
|
|
4
|
+
import { ERRORS as g, normalizeError as w } from "../../../../libs/errors.js";
|
|
5
|
+
import { getEnvironmentVariables as B } from "./get-environment-variables.js";
|
|
6
|
+
import { getResolvedUrl as D } from "./get-resolved-url.js";
|
|
7
|
+
import { getDefaultHeaders as L } from "../../request-block/helpers/get-default-headers.js";
|
|
8
|
+
import { buildRequestBody as V } from "./build-request-body.js";
|
|
9
|
+
import { buildRequestCookieHeader as I } from "./build-request-cookie-header.js";
|
|
10
|
+
import { buildRequestParameters as T } from "./build-request-parameters.js";
|
|
11
|
+
import { buildRequestSecurity as _ } from "./build-request-security.js";
|
|
12
|
+
const W = ({
|
|
13
|
+
environment: d,
|
|
14
|
+
exampleKey: o = "default",
|
|
15
|
+
globalCookies: k,
|
|
16
|
+
method: n,
|
|
17
|
+
operation: s,
|
|
18
|
+
path: U,
|
|
19
|
+
proxyUrl: m,
|
|
21
20
|
server: h,
|
|
22
|
-
selectedSecuritySchemes:
|
|
21
|
+
selectedSecuritySchemes: q
|
|
23
22
|
}) => {
|
|
24
23
|
try {
|
|
25
|
-
const r =
|
|
26
|
-
|
|
24
|
+
const r = B(d), C = S(s.requestBody), t = T(s.parameters ?? [], r, o), H = V(C, r, o), l = _(q, r), e = { ...L({ method: n, operation: s, exampleKey: o, hideDisabledHeaders: !0 }).filter((i) => !i.isOverridden).reduce(
|
|
25
|
+
(i, R) => (i[R.name] = R.defaultValue, i),
|
|
26
|
+
{}
|
|
27
|
+
), ...t.headers, ...l.headers }, P = new URLSearchParams([...t.urlParams, ...l.urlParams]), a = D({ environment: d, server: h, path: U, pathVariables: t.pathVariables, urlParams: P });
|
|
28
|
+
if (!a)
|
|
27
29
|
throw g.URL_EMPTY;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
paramCookies: [...
|
|
32
|
-
globalCookies:
|
|
30
|
+
const c = v(m, a), E = A(m, a), f = e["User-Agent"] || e["user-agent"];
|
|
31
|
+
p() && f && (e["X-Scalar-User-Agent"] = f);
|
|
32
|
+
const u = I({
|
|
33
|
+
paramCookies: [...t.cookies, ...l.cookies],
|
|
34
|
+
globalCookies: k,
|
|
33
35
|
env: r,
|
|
34
|
-
path: c,
|
|
35
36
|
originalCookieHeader: e.Cookie || e.cookie,
|
|
36
|
-
url:
|
|
37
|
-
useCustomCookieHeader:
|
|
37
|
+
url: a,
|
|
38
|
+
useCustomCookieHeader: p() || c,
|
|
39
|
+
disabledGlobalCookies: s["x-scalar-disable-parameters"]?.["global-cookies"]?.[o] ?? {}
|
|
38
40
|
});
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
+
u && (e[u.name] = u.value);
|
|
42
|
+
const b = new AbortController(), y = new Request(E, {
|
|
41
43
|
/**
|
|
42
44
|
* Ensure that all methods are uppercased (though only needed for patch)
|
|
43
45
|
*
|
|
44
46
|
* @see https://github.com/whatwg/fetch/issues/50
|
|
45
47
|
*/
|
|
46
|
-
method:
|
|
48
|
+
method: n.toUpperCase(),
|
|
47
49
|
headers: e,
|
|
48
|
-
signal:
|
|
49
|
-
body:
|
|
50
|
+
signal: b.signal,
|
|
51
|
+
body: H
|
|
50
52
|
});
|
|
51
53
|
return [
|
|
52
54
|
null,
|
|
53
55
|
{
|
|
54
|
-
controller:
|
|
55
|
-
isUsingProxy:
|
|
56
|
-
request:
|
|
56
|
+
controller: b,
|
|
57
|
+
isUsingProxy: c,
|
|
58
|
+
request: y
|
|
57
59
|
}
|
|
58
60
|
];
|
|
59
61
|
} catch (r) {
|
|
60
|
-
return [
|
|
62
|
+
return [w(r, g.BUILDING_REQUEST_FAILED), null];
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
65
|
export {
|
|
64
|
-
|
|
66
|
+
W as buildRequest
|
|
65
67
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { matchesDomain as n } from "../../../../libs/send-request/set-request-cookies.js";
|
|
2
|
+
const m = ({
|
|
3
|
+
cookie: t,
|
|
4
|
+
url: a,
|
|
5
|
+
disabledGlobalCookies: e
|
|
6
|
+
}) => {
|
|
7
|
+
if (t.isDisabled || e[t.name.toLowerCase()] === !0 || !t.name)
|
|
8
|
+
return !1;
|
|
9
|
+
const r = new URL(a, "https://example.com");
|
|
10
|
+
return !(t.domain && !n(a, t.domain) || t.path && !r.pathname.startsWith(t.path));
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
m as filterGlobalCookie
|
|
14
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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, urlParams, }: {
|
|
19
|
+
environment: XScalarEnvironment;
|
|
20
|
+
server: ServerObject | null;
|
|
21
|
+
path: string;
|
|
22
|
+
pathVariables: Record<string, string>;
|
|
23
|
+
urlParams?: URLSearchParams;
|
|
24
|
+
}) => string;
|
|
25
|
+
//# sourceMappingURL=get-resolved-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AAKtF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,GAAI,0DAM5B;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,SAAS,CAAC,EAAE,eAAe,CAAA;CAC5B,WAKA,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { replaceVariables as a } from "@scalar/helpers/regex/replace-variables";
|
|
2
|
+
import { mergeUrls as l } from "@scalar/helpers/url/merge-urls";
|
|
3
|
+
import { getEnvironmentVariables as p } from "./get-environment-variables.js";
|
|
4
|
+
import { getServerUrl as c } from "./get-server-url.js";
|
|
5
|
+
const U = ({
|
|
6
|
+
environment: e,
|
|
7
|
+
server: t,
|
|
8
|
+
path: o,
|
|
9
|
+
pathVariables: i,
|
|
10
|
+
urlParams: m
|
|
11
|
+
}) => {
|
|
12
|
+
const r = p(e), n = c(t, r), s = a(o, { ...r, ...i });
|
|
13
|
+
return l(n, s, m);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
U as getResolvedUrl
|
|
17
|
+
};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods';
|
|
2
2
|
import { type AvailableClients } from '@scalar/snippetz';
|
|
3
3
|
import { type WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
4
|
+
import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
4
5
|
import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
5
6
|
import type { ClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types';
|
|
6
7
|
export type OperationCodeSampleProps = {
|
|
8
|
+
/**
|
|
9
|
+
* Integration type: determines if the code sample is displayed in a client environment
|
|
10
|
+
* or in an API reference environment.
|
|
11
|
+
*/
|
|
12
|
+
integration?: 'client' | 'reference';
|
|
7
13
|
/**
|
|
8
14
|
* List of all http clients formatted into option groups for the client selector
|
|
9
15
|
*/
|
|
@@ -86,6 +92,10 @@ export type OperationCodeSampleProps = {
|
|
|
86
92
|
* If true, render this as a webhook request example
|
|
87
93
|
*/
|
|
88
94
|
isWebhook?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Workspace + document cookies
|
|
97
|
+
*/
|
|
98
|
+
globalCookies?: XScalarCookie[];
|
|
89
99
|
};
|
|
90
100
|
/**
|
|
91
101
|
* Request Example
|
|
@@ -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":"AAwcA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,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;;;OAGG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;IACpC;;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,IAAI,CAAA;IACpC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;OAEG;IACH,eAAe,EAAE,oBAAoB,EAAE,CAAA;IACvC;;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;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;CAChC,CAAA;AAED;;;;;;;;GAQG;;YAqBO,MAAM,OAAO;YACb,MAAM,OAAO;;AArBvB,wBA2fC;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-59889f40"]]);
|
|
5
5
|
export {
|
|
6
6
|
e as default
|
|
7
7
|
};
|