@scalar/api-client 2.5.31 → 2.5.33
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 +33 -0
- package/dist/components/AddressBar/AddressBar.vue.js +1 -1
- package/dist/components/AddressBar/AddressBar.vue2.js +120 -128
- package/dist/components/AddressBar/AddressBarHistory.vue.js +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue2.js +57 -63
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +143 -150
- package/dist/components/CodeInput/codeVariableWidget.js +70 -75
- package/dist/components/CommandPalette/CommandActionInput.vue.js +17 -19
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +26 -27
- package/dist/components/CommandPalette/CommandPaletteExample.vue.js +53 -55
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +129 -133
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue.js +1 -1
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue2.js +84 -98
- package/dist/components/CommandPalette/CommandPaletteServer.vue.js +64 -74
- package/dist/components/CommandPalette/CommandPaletteTag.vue.js +5 -11
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +164 -183
- package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInput.vue.js +4 -4
- package/dist/components/DataTable/DataTableInput.vue2.js +31 -31
- package/dist/components/DataTable/DataTableInputSelect.vue.js +1 -2
- package/dist/components/EmptyState.vue.js +1 -1
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +75 -84
- package/dist/components/Form/LabelInput.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue2.js +11 -11
- package/dist/components/ImportCollection/DropEventListener.vue.js +42 -44
- package/dist/components/ImportCollection/ImportCollectionListener.vue.js +22 -23
- package/dist/components/ImportCollection/ImportCollectionModal.vue.js +141 -149
- package/dist/components/ImportCollection/ImportCollectionModal.vue3.js +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +22 -23
- package/dist/components/ImportCollection/IntegrationLogo.vue.js +12 -13
- package/dist/components/ImportCollection/PasteEventListener.vue.js +11 -12
- package/dist/components/ImportCollection/WorkspaceSelector.vue.js +69 -76
- package/dist/components/ImportCollection/utils/get-openapi-version.js +8 -8
- package/dist/components/ImportCollection/utils/import-collection.js +14 -14
- package/dist/components/OpenApiClientButton.vue.js +1 -1
- package/dist/components/OpenApiClientButton.vue2.js +10 -10
- package/dist/components/ScalarAsciiArt.vue.js +1 -1
- package/dist/components/ScalarAsciiArt.vue2.js +19 -22
- package/dist/components/Search/useSearch.js +51 -61
- package/dist/components/SectionFilter.vue.js +1 -1
- package/dist/components/SectionFilter.vue2.js +26 -29
- package/dist/components/Server/ServerDropdown.vue.js +70 -96
- package/dist/components/Server/ServerDropdownItem.vue.js +1 -1
- package/dist/components/Server/ServerDropdownItem.vue2.js +57 -67
- package/dist/components/Server/ServerSelector.vue.js +44 -55
- package/dist/components/Server/ServerVariablesForm.vue.js +36 -42
- package/dist/components/Server/ServerVariablesSelect.vue.js +6 -6
- package/dist/components/SideNav/DownloadAppButton.vue.js +1 -1
- package/dist/components/SideNav/SideNav.vue.js +68 -74
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +1 -1
- package/dist/components/Sidebar/Sidebar.vue.js +1 -1
- package/dist/components/Sidebar/SidebarListElement.vue.js +2 -2
- package/dist/components/TopNav/TopNav.vue.js +107 -122
- package/dist/components/TopNav/TopNavItem.vue.js +1 -1
- package/dist/hooks/useFileDialog.js +12 -12
- package/dist/hooks/useResponseBody.js +14 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/layouts/App/ApiClientApp.vue.js +50 -56
- package/dist/layouts/App/ApiClientApp.vue3.js +1 -1
- package/dist/layouts/App/create-api-client-app.js +19 -20
- package/dist/layouts/App/index.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue2.js +18 -21
- package/dist/layouts/Web/ApiClientWeb.vue.js +45 -51
- package/dist/layouts/Web/ApiClientWeb.vue3.js +1 -1
- package/dist/layouts/Web/create-api-client-web.js +19 -20
- package/dist/layouts/Web/index.js +1 -1
- package/dist/libs/create-client.js +102 -109
- package/dist/libs/env-helpers.js +3 -3
- package/dist/libs/event-bus.js +15 -15
- package/dist/libs/extractAttachmentFilename.js +5 -6
- package/dist/libs/find-request.js +9 -10
- package/dist/libs/get-request-uid-by-path-method.js +12 -12
- package/dist/libs/getOpenApiDocumentDetails.js +7 -7
- package/dist/libs/importers/curl.js +3 -3
- package/dist/libs/normalize-headers.js +9 -10
- package/dist/libs/postman.js +15 -17
- package/dist/libs/send-request/build-request-security.js +9 -10
- package/dist/libs/send-request/create-fetch-body.js +11 -12
- package/dist/libs/send-request/create-fetch-query-params.js +13 -13
- package/dist/libs/send-request/create-request-operation.js +83 -84
- package/dist/libs/send-request/decode-buffer.d.ts.map +1 -1
- package/dist/libs/send-request/set-request-cookies.js +12 -12
- package/dist/libs/string-template.js +21 -21
- package/dist/libs/validate-parameters.js +5 -8
- package/dist/plugins/plugin-manager.js +11 -17
- package/dist/store/active-entities.js +90 -117
- package/dist/store/collections.js +41 -42
- package/dist/store/import-spec.js +25 -26
- package/dist/store/request-example.js +20 -24
- package/dist/store/requests.js +63 -81
- package/dist/store/router-params.js +7 -7
- package/dist/store/security-schemes.js +35 -36
- package/dist/store/store.js +2 -2
- package/dist/store/tags.js +20 -21
- package/dist/style.css +1 -1
- package/dist/views/Collection/Collection.vue2.js +21 -22
- package/dist/views/Collection/CollectionAuthentication.vue.js +1 -1
- package/dist/views/Collection/CollectionAuthentication.vue2.js +43 -47
- package/dist/views/Collection/CollectionEnvironment.vue.js +1 -1
- package/dist/views/Collection/CollectionEnvironment.vue2.js +196 -207
- package/dist/views/Collection/CollectionInfoForm.vue.js +1 -1
- package/dist/views/Collection/CollectionInfoForm.vue2.js +34 -41
- package/dist/views/Collection/CollectionNavigation.vue.js +116 -125
- package/dist/views/Collection/CollectionOverview.vue2.js +22 -25
- package/dist/views/Collection/CollectionServerForm.vue.js +39 -45
- package/dist/views/Collection/CollectionServers.vue2.js +88 -98
- package/dist/views/Collection/CollectionSettings.vue.js +1 -1
- package/dist/views/Collection/CollectionSettings.vue2.js +101 -108
- package/dist/views/Collection/components/EnvironmentForm.vue.js +1 -1
- package/dist/views/Collection/components/EnvironmentForm.vue2.js +141 -145
- package/dist/views/Collection/components/MarkdownInput.vue.js +1 -1
- package/dist/views/Collection/components/MarkdownInput.vue2.js +1 -2
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue.js +15 -15
- package/dist/views/Components/CodeSnippet/helpers/convert-to-har-request.js +15 -16
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +61 -64
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.js +9 -10
- package/dist/views/Cookies/CookieModal.vue.js +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +90 -93
- package/dist/views/Environment/Environment.vue2.js +267 -295
- package/dist/views/Environment/EnvironmentModal.vue.js +63 -70
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +38 -42
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +60 -67
- package/dist/views/Request/RequestRoot.vue.js +1 -1
- package/dist/views/Request/RequestRoot.vue2.js +78 -89
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +37 -44
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +44 -45
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +111 -127
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +120 -139
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +97 -97
- package/dist/views/Request/RequestSection/RequestBody.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue2.js +287 -310
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +86 -94
- package/dist/views/Request/RequestSection/RequestParams.vue.js +37 -38
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +36 -38
- package/dist/views/Request/RequestSection/RequestSection.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +28 -31
- package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue2.js +49 -52
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +1 -1
- package/dist/views/Request/RequestSection/helpers/filter-security-requirements.js +16 -16
- package/dist/views/Request/RequestSection/helpers/getting-started.js +7 -11
- package/dist/views/Request/RequestSection/helpers/update-scheme.js +7 -8
- package/dist/views/Request/RequestSidebar.vue.js +1 -1
- package/dist/views/Request/RequestSidebar.vue2.js +199 -211
- package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
- package/dist/views/Request/RequestSidebarItem.vue2.js +332 -349
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +210 -240
- package/dist/views/Request/RequestSubpageHeader.vue.js +1 -1
- package/dist/views/Request/ResponseSection/RequestHeaders.vue.js +38 -41
- package/dist/views/Request/ResponseSection/ResponseBody.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +58 -64
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.js +1 -2
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +20 -23
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue3.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +29 -30
- package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +38 -41
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js +28 -29
- package/dist/views/Request/ResponseSection/ResponseSection.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +128 -140
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +116 -124
- package/dist/views/Request/consts/mediaTypes.js +2 -3
- package/dist/views/Request/handle-drag.js +24 -28
- package/dist/views/Request/hooks/useOpenApiWatcher.js +26 -33
- package/dist/views/Request/libs/auth.js +37 -43
- package/dist/views/Request/libs/oauth2.js +30 -32
- package/dist/views/Request/libs/watch-mode.js +100 -103
- package/dist/views/Settings/SettingsGeneral.vue.js +206 -236
- package/package.json +22 -22
- package/dist/components/AddressBar/AddressBar.vue3.js +0 -4
- package/dist/components/AddressBar/AddressBarHistory.vue3.js +0 -4
- package/dist/components/CodeInput/CodeInput.vue3.js +0 -4
- package/dist/components/CodeInput/CodeInput.vue4.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue3.js +0 -4
- package/dist/components/CommandPalette/TheCommandPalette.vue3.js +0 -4
- package/dist/components/DataTable/DataTableInput.vue3.js +0 -4
- package/dist/components/EmptyState.vue3.js +0 -4
- package/dist/components/Form/LabelInput.vue3.js +0 -4
- package/dist/components/HttpMethod/HttpMethod.vue3.js +0 -4
- package/dist/components/ImportCollection/ImportCollectionModal.vue2.js +0 -4
- package/dist/components/OpenApiClientButton.vue3.js +0 -4
- package/dist/components/ScalarAsciiArt.vue3.js +0 -4
- package/dist/components/SectionFilter.vue3.js +0 -4
- package/dist/components/Server/ServerDropdownItem.vue3.js +0 -4
- package/dist/components/SideNav/DownloadAppButton.vue3.js +0 -4
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue3.js +0 -4
- package/dist/components/Sidebar/Sidebar.vue3.js +0 -4
- package/dist/components/Sidebar/SidebarListElement.vue3.js +0 -4
- package/dist/components/Sidebar/SidebarListElement.vue4.js +0 -4
- package/dist/components/TopNav/TopNavItem.vue3.js +0 -4
- package/dist/layouts/App/ApiClientApp.vue2.js +0 -4
- package/dist/layouts/Modal/ApiClientModal.vue3.js +0 -4
- package/dist/layouts/Web/ApiClientWeb.vue2.js +0 -4
- package/dist/style.css.js +0 -4
- package/dist/views/Collection/CollectionAuthentication.vue3.js +0 -4
- package/dist/views/Collection/CollectionEnvironment.vue3.js +0 -4
- package/dist/views/Collection/CollectionInfoForm.vue3.js +0 -4
- package/dist/views/Collection/CollectionSettings.vue3.js +0 -4
- package/dist/views/Collection/components/EnvironmentForm.vue3.js +0 -4
- package/dist/views/Collection/components/MarkdownInput.vue3.js +0 -4
- package/dist/views/Cookies/CookieModal.vue3.js +0 -4
- package/dist/views/Request/Request.vue3.js +0 -4
- package/dist/views/Request/RequestRoot.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestBody.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestCodeExample.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestSection.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestTable.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue3.js +0 -4
- package/dist/views/Request/RequestSidebar.vue3.js +0 -4
- package/dist/views/Request/RequestSidebarItem.vue3.js +0 -4
- package/dist/views/Request/RequestSidebarItem.vue4.js +0 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue3.js +0 -4
- package/dist/views/Request/RequestSubpageHeader.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBody.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseSection.vue3.js +0 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarCodeBlock as
|
|
3
|
-
import { snippetz as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useWorkspace as
|
|
9
|
-
const
|
|
1
|
+
import { defineComponent as $, computed as a, ref as E, createElementBlock as B, openBlock as y, createVNode as i, withCtx as c, createElementVNode as x, createBlock as K, unref as u, toDisplayString as V, createTextVNode as H } from "vue";
|
|
2
|
+
import { ScalarCodeBlock as U, ScalarCombobox as j, ScalarButton as D, ScalarIcon as N } from "@scalar/components";
|
|
3
|
+
import { snippetz as T } from "@scalar/snippetz";
|
|
4
|
+
import W from "../../../components/DataTable/DataTable.vue.js";
|
|
5
|
+
import z from "../../../components/DataTable/DataTableRow.vue.js";
|
|
6
|
+
import I from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
|
|
7
|
+
import O from "../../Components/CodeSnippet/CodeSnippet.vue.js";
|
|
8
|
+
import { useWorkspace as R } from "../../../store/store.js";
|
|
9
|
+
const q = { class: "w-full" }, M = { class: "flex flex-1" }, P = { class: "bg-b-1 flex items-center justify-center overflow-hidden border-t" }, Z = /* @__PURE__ */ $({
|
|
10
10
|
__name: "RequestCodeExample",
|
|
11
11
|
props: {
|
|
12
12
|
collection: {},
|
|
@@ -16,60 +16,56 @@ const F = { class: "w-full" }, G = { class: "flex flex-1" }, J = { class: "bg-b-
|
|
|
16
16
|
workspace: {},
|
|
17
17
|
environment: {}
|
|
18
18
|
},
|
|
19
|
-
setup(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}), d = c(
|
|
30
|
-
() => o.operation["x-codeSamples"] || o.operation["x-code-samples"] || o.operation["x-custom-examples"]
|
|
31
|
-
), m = U(
|
|
32
|
-
(K = d.value) != null && K.length ? {
|
|
19
|
+
setup(n) {
|
|
20
|
+
const { securitySchemes: b, workspaceMutators: h } = R(), f = a(() => m.value.targetKey === "custom" && d.value?.some(
|
|
21
|
+
(t) => t.lang === m.value.clientKey
|
|
22
|
+
) ? m.value : {
|
|
23
|
+
targetKey: n.workspace.selectedHttpClient?.targetKey ?? "js",
|
|
24
|
+
clientKey: n.workspace.selectedHttpClient?.clientKey ?? "fetch"
|
|
25
|
+
}), d = a(
|
|
26
|
+
() => n.operation["x-codeSamples"] || n.operation["x-code-samples"] || n.operation["x-custom-examples"]
|
|
27
|
+
), m = E(
|
|
28
|
+
d.value?.length ? {
|
|
33
29
|
targetKey: "custom",
|
|
34
|
-
clientKey:
|
|
30
|
+
clientKey: d.value[0]?.lang
|
|
35
31
|
} : {
|
|
36
|
-
targetKey:
|
|
37
|
-
clientKey:
|
|
32
|
+
targetKey: n.workspace.selectedHttpClient?.targetKey ?? "js",
|
|
33
|
+
clientKey: n.workspace.selectedHttpClient?.clientKey ?? "fetch"
|
|
38
34
|
}
|
|
39
|
-
),
|
|
40
|
-
const e = {}, t =
|
|
41
|
-
label:
|
|
42
|
-
options:
|
|
43
|
-
id: `${
|
|
35
|
+
), S = a(() => (n.operation.selectedSecuritySchemeUids || n.collection.selectedSecuritySchemeUids || []).flat().map((t) => b[t]).filter((t) => !!t)), v = a(() => {
|
|
36
|
+
const e = {}, t = T().clients().map((l) => ({
|
|
37
|
+
label: l.title,
|
|
38
|
+
options: l.clients.map((p) => (e[`${l.key},${p.client}`] = p.title, {
|
|
39
|
+
id: `${l.key},${p.client}`,
|
|
44
40
|
label: p.title
|
|
45
41
|
}))
|
|
46
|
-
})),
|
|
47
|
-
id: `custom,${
|
|
48
|
-
label:
|
|
49
|
-
})),
|
|
42
|
+
})), o = (n.operation["x-codeSamples"] || n.operation["x-code-samples"] || n.operation["x-custom-examples"] || []).map((l) => ({
|
|
43
|
+
id: `custom,${l.lang}`,
|
|
44
|
+
label: l.label || l.lang
|
|
45
|
+
})), r = o.length > 0 ? [
|
|
50
46
|
{
|
|
51
47
|
id: "customExamples",
|
|
52
48
|
label: "Code Examples",
|
|
53
|
-
options:
|
|
54
|
-
id:
|
|
55
|
-
label:
|
|
49
|
+
options: o.map((l) => ({
|
|
50
|
+
id: l.id,
|
|
51
|
+
label: l.label ?? l.id
|
|
56
52
|
}))
|
|
57
53
|
},
|
|
58
54
|
...t
|
|
59
55
|
] : t;
|
|
60
|
-
return
|
|
61
|
-
e[
|
|
56
|
+
return o.forEach((l) => {
|
|
57
|
+
e[l.id] = l.label ?? l.id;
|
|
62
58
|
}), {
|
|
63
|
-
options:
|
|
59
|
+
options: r,
|
|
64
60
|
dict: e
|
|
65
61
|
};
|
|
66
|
-
}),
|
|
62
|
+
}), s = a(() => {
|
|
67
63
|
const e = f.value;
|
|
68
64
|
if (e.targetKey === "custom") {
|
|
69
|
-
const
|
|
65
|
+
const o = `custom,${e.clientKey}`;
|
|
70
66
|
return {
|
|
71
|
-
id:
|
|
72
|
-
label: v.value.dict[
|
|
67
|
+
id: o,
|
|
68
|
+
label: v.value.dict[o] ?? "Unknown"
|
|
73
69
|
};
|
|
74
70
|
}
|
|
75
71
|
const t = `${e.targetKey},${e.clientKey}`;
|
|
@@ -77,60 +73,56 @@ const F = { class: "w-full" }, G = { class: "flex flex-1" }, J = { class: "bg-b-
|
|
|
77
73
|
id: t,
|
|
78
74
|
label: v.value.dict[t] ?? "Unknown"
|
|
79
75
|
};
|
|
80
|
-
}),
|
|
76
|
+
}), C = a(
|
|
81
77
|
() => f.value.targetKey
|
|
82
|
-
),
|
|
78
|
+
), k = a(
|
|
83
79
|
() => f.value.clientKey
|
|
84
|
-
),
|
|
80
|
+
), w = (e) => {
|
|
85
81
|
if (!e)
|
|
86
82
|
return;
|
|
87
|
-
const { id: t } = e, [
|
|
88
|
-
!
|
|
89
|
-
targetKey:
|
|
90
|
-
clientKey:
|
|
91
|
-
},
|
|
92
|
-
targetKey:
|
|
93
|
-
clientKey:
|
|
83
|
+
const { id: t } = e, [o, r] = t.split(",");
|
|
84
|
+
!o || !r || (m.value = {
|
|
85
|
+
targetKey: o,
|
|
86
|
+
clientKey: r
|
|
87
|
+
}, o !== "custom" && h.edit(n.workspace.uid, "selectedHttpClient", {
|
|
88
|
+
targetKey: o,
|
|
89
|
+
clientKey: r
|
|
94
90
|
}));
|
|
95
|
-
}, g =
|
|
96
|
-
|
|
97
|
-
if (!r.value.id.startsWith("custom,"))
|
|
91
|
+
}, g = a(() => {
|
|
92
|
+
if (!s.value.id.startsWith("custom,"))
|
|
98
93
|
return;
|
|
99
|
-
const e =
|
|
100
|
-
return
|
|
94
|
+
const e = s.value.id.split(",")[1];
|
|
95
|
+
return d.value?.find((o) => o.lang === e)?.source;
|
|
101
96
|
});
|
|
102
|
-
return (e, t) => (y(),
|
|
103
|
-
|
|
97
|
+
return (e, t) => (y(), B("div", q, [
|
|
98
|
+
i(I, {
|
|
104
99
|
class: "group/preview w-full border-b-0",
|
|
105
100
|
defaultOpen: !1
|
|
106
101
|
}, {
|
|
107
|
-
title:
|
|
108
|
-
|
|
102
|
+
title: c(() => t[0] || (t[0] = [
|
|
103
|
+
H("Code Snippet")
|
|
109
104
|
])),
|
|
110
|
-
actions:
|
|
111
|
-
x("div",
|
|
112
|
-
|
|
113
|
-
modelValue:
|
|
105
|
+
actions: c(() => [
|
|
106
|
+
x("div", M, [
|
|
107
|
+
i(u(j), {
|
|
108
|
+
modelValue: s.value,
|
|
114
109
|
options: v.value.options,
|
|
115
110
|
placement: "bottom-end",
|
|
116
|
-
"onUpdate:modelValue":
|
|
111
|
+
"onUpdate:modelValue": w
|
|
117
112
|
}, {
|
|
118
|
-
default:
|
|
119
|
-
|
|
113
|
+
default: c(() => [
|
|
114
|
+
i(u(D), {
|
|
120
115
|
class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-1.25 py-0.75 font-normal",
|
|
121
116
|
fullWidth: "",
|
|
122
117
|
variant: "ghost"
|
|
123
118
|
}, {
|
|
124
|
-
default:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
})
|
|
132
|
-
];
|
|
133
|
-
}),
|
|
119
|
+
default: c(() => [
|
|
120
|
+
x("span", null, V(s.value?.label), 1),
|
|
121
|
+
i(u(N), {
|
|
122
|
+
icon: "ChevronDown",
|
|
123
|
+
size: "md"
|
|
124
|
+
})
|
|
125
|
+
]),
|
|
134
126
|
_: 1
|
|
135
127
|
})
|
|
136
128
|
]),
|
|
@@ -138,27 +130,27 @@ const F = { class: "w-full" }, G = { class: "flex flex-1" }, J = { class: "bg-b-
|
|
|
138
130
|
}, 8, ["modelValue", "options"])
|
|
139
131
|
])
|
|
140
132
|
]),
|
|
141
|
-
default:
|
|
142
|
-
|
|
133
|
+
default: c(() => [
|
|
134
|
+
i(W, {
|
|
143
135
|
columns: [""],
|
|
144
136
|
presentational: ""
|
|
145
137
|
}, {
|
|
146
|
-
default:
|
|
147
|
-
|
|
148
|
-
default:
|
|
149
|
-
x("div",
|
|
150
|
-
g.value ? (y(),
|
|
138
|
+
default: c(() => [
|
|
139
|
+
i(z, null, {
|
|
140
|
+
default: c(() => [
|
|
141
|
+
x("div", P, [
|
|
142
|
+
g.value ? (y(), K(u(U), {
|
|
151
143
|
key: 0,
|
|
152
144
|
content: g.value,
|
|
153
|
-
lang:
|
|
154
|
-
}, null, 8, ["content", "lang"])) : (y(),
|
|
145
|
+
lang: s.value.id.split(",")[1] ?? "plaintext"
|
|
146
|
+
}, null, 8, ["content", "lang"])) : (y(), K(u(O), {
|
|
155
147
|
key: 1,
|
|
156
|
-
client:
|
|
148
|
+
client: k.value,
|
|
157
149
|
example: e.example,
|
|
158
150
|
operation: e.operation,
|
|
159
|
-
securitySchemes:
|
|
151
|
+
securitySchemes: S.value,
|
|
160
152
|
server: e.server,
|
|
161
|
-
target:
|
|
153
|
+
target: C.value,
|
|
162
154
|
environment: e.environment
|
|
163
155
|
}, null, 8, ["client", "example", "operation", "securitySchemes", "server", "target", "environment"]))
|
|
164
156
|
])
|
|
@@ -175,5 +167,5 @@ const F = { class: "w-full" }, G = { class: "flex flex-1" }, J = { class: "bg-b-
|
|
|
175
167
|
}
|
|
176
168
|
});
|
|
177
169
|
export {
|
|
178
|
-
|
|
170
|
+
Z as default
|
|
179
171
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarTooltip as
|
|
3
|
-
import { requestExampleParametersSchema as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useWorkspace as
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as O, computed as m, onMounted as S, nextTick as p, ref as N, watch as A, createBlock as d, openBlock as v, withCtx as i, createElementVNode as f, createCommentVNode as h, createVNode as k, normalizeClass as B, unref as g, withModifiers as M, createTextVNode as P, toDisplayString as R } from "vue";
|
|
2
|
+
import { ScalarTooltip as W, ScalarButton as z } from "@scalar/components";
|
|
3
|
+
import { requestExampleParametersSchema as w } from "@scalar/oas-utils/entities/spec";
|
|
4
|
+
import D from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
|
|
5
|
+
import V from "./RequestTable.vue.js";
|
|
6
|
+
import { useWorkspace as x } from "../../../store/store.js";
|
|
7
|
+
const G = { class: "text-c-2 request-meta-buttons flex whitespace-nowrap opacity-0 group-hover/params:opacity-100 has-[:focus-visible]:opacity-100" }, U = { class: "sr-only" }, Z = /* @__PURE__ */ O({
|
|
8
8
|
__name: "RequestParams",
|
|
9
9
|
props: {
|
|
10
10
|
example: {},
|
|
@@ -18,16 +18,16 @@ const U = { class: "text-c-2 request-meta-buttons flex whitespace-nowrap opacity
|
|
|
18
18
|
invalidParams: {}
|
|
19
19
|
},
|
|
20
20
|
setup(t) {
|
|
21
|
-
const { requestExampleMutators: s } =
|
|
22
|
-
|
|
21
|
+
const { requestExampleMutators: s } = x(), n = m(() => t.example.parameters[t.paramKey] ?? []);
|
|
22
|
+
S(() => {
|
|
23
23
|
p(() => {
|
|
24
24
|
y();
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
const o = () => {
|
|
28
|
-
const e =
|
|
28
|
+
const e = w.parse({ enabled: !1 }), a = [...n.value, e];
|
|
29
29
|
s.edit(t.example.uid, `parameters.${t.paramKey}`, a);
|
|
30
|
-
}, u =
|
|
30
|
+
}, u = N(null), C = (e, a, r) => {
|
|
31
31
|
const c = n.value;
|
|
32
32
|
if (c.length > e) {
|
|
33
33
|
const l = [...c];
|
|
@@ -39,27 +39,26 @@ const U = { class: "text-c-2 request-meta-buttons flex whitespace-nowrap opacity
|
|
|
39
39
|
l
|
|
40
40
|
);
|
|
41
41
|
} else {
|
|
42
|
-
const l = [
|
|
42
|
+
const l = [w.parse({ [a]: r })];
|
|
43
43
|
s.edit(t.example.uid, `parameters.${t.paramKey}`, l), p(() => {
|
|
44
|
-
var h;
|
|
45
44
|
if (!u.value)
|
|
46
45
|
return;
|
|
47
|
-
|
|
46
|
+
u.value.querySelectorAll("input")[a === "key" ? 0 : 1]?.focus();
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
49
|
e === c.length - 1 && o();
|
|
51
|
-
},
|
|
50
|
+
}, K = (e, a) => s.edit(
|
|
52
51
|
t.example.uid,
|
|
53
52
|
`parameters.${t.paramKey}.${e}.enabled`,
|
|
54
53
|
a
|
|
55
|
-
),
|
|
54
|
+
), $ = () => {
|
|
56
55
|
const e = n.value.filter((a) => a.required);
|
|
57
56
|
s.edit(
|
|
58
57
|
t.example.uid,
|
|
59
58
|
`parameters.${t.paramKey}`,
|
|
60
59
|
e
|
|
61
60
|
), p(() => o());
|
|
62
|
-
},
|
|
61
|
+
}, q = (e) => {
|
|
63
62
|
const a = n.value;
|
|
64
63
|
if (a.length > e) {
|
|
65
64
|
const r = [...a];
|
|
@@ -78,10 +77,10 @@ const U = { class: "text-c-2 request-meta-buttons flex whitespace-nowrap opacity
|
|
|
78
77
|
e && e.key !== "" && e.value !== "" && o();
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
const
|
|
80
|
+
const E = m(
|
|
82
81
|
() => n.value.filter((e) => e.key || e.value).length
|
|
83
|
-
),
|
|
84
|
-
|
|
82
|
+
), T = m(() => n.value.length > 1);
|
|
83
|
+
A(
|
|
85
84
|
() => t.example,
|
|
86
85
|
(e, a) => {
|
|
87
86
|
e !== a && y();
|
|
@@ -89,37 +88,37 @@ const U = { class: "text-c-2 request-meta-buttons flex whitespace-nowrap opacity
|
|
|
89
88
|
{ immediate: !0 }
|
|
90
89
|
);
|
|
91
90
|
const b = m(() => (t.readOnlyEntries ?? []).length > 0);
|
|
92
|
-
return (e, a) => (v(), d(
|
|
91
|
+
return (e, a) => (v(), d(D, {
|
|
93
92
|
class: "group/params",
|
|
94
|
-
itemCount:
|
|
93
|
+
itemCount: E.value
|
|
95
94
|
}, {
|
|
96
95
|
title: i(() => [
|
|
97
|
-
R(
|
|
96
|
+
P(R(e.title), 1)
|
|
98
97
|
]),
|
|
99
98
|
actions: i(() => [
|
|
100
|
-
f("div",
|
|
101
|
-
|
|
99
|
+
f("div", G, [
|
|
100
|
+
T.value ? (v(), d(g(W), {
|
|
102
101
|
key: 0,
|
|
103
102
|
content: "Clear optional parameters",
|
|
104
103
|
placement: "left"
|
|
105
104
|
}, {
|
|
106
105
|
default: i(() => [
|
|
107
|
-
g(
|
|
106
|
+
k(g(z), {
|
|
108
107
|
class: "pr-0.75 pl-1 transition-none",
|
|
109
108
|
size: "sm",
|
|
110
109
|
variant: "ghost",
|
|
111
|
-
onClick:
|
|
110
|
+
onClick: M($, ["stop"])
|
|
112
111
|
}, {
|
|
113
112
|
default: i(() => [
|
|
114
|
-
a[0] || (a[0] =
|
|
115
|
-
f("span",
|
|
113
|
+
a[0] || (a[0] = P(" Clear ")),
|
|
114
|
+
f("span", U, "All " + R(e.title), 1)
|
|
116
115
|
]),
|
|
117
116
|
_: 1,
|
|
118
117
|
__: [0]
|
|
119
118
|
})
|
|
120
119
|
]),
|
|
121
120
|
_: 1
|
|
122
|
-
})) :
|
|
121
|
+
})) : h("", !0)
|
|
123
122
|
])
|
|
124
123
|
]),
|
|
125
124
|
default: i(() => [
|
|
@@ -127,9 +126,9 @@ const U = { class: "text-c-2 request-meta-buttons flex whitespace-nowrap opacity
|
|
|
127
126
|
ref_key: "tableWrapperRef",
|
|
128
127
|
ref: u
|
|
129
128
|
}, [
|
|
130
|
-
b.value ? (v(), d(
|
|
129
|
+
b.value ? (v(), d(V, {
|
|
131
130
|
key: 0,
|
|
132
|
-
class:
|
|
131
|
+
class: B(["flex-1", { "bg-c-3/5": b.value }]),
|
|
133
132
|
columns: ["32px", "", ""],
|
|
134
133
|
envVariables: e.envVariables,
|
|
135
134
|
environment: e.environment,
|
|
@@ -139,8 +138,8 @@ const U = { class: "text-c-2 request-meta-buttons flex whitespace-nowrap opacity
|
|
|
139
138
|
items: e.readOnlyEntries,
|
|
140
139
|
label: e.label,
|
|
141
140
|
workspace: e.workspace
|
|
142
|
-
}, null, 8, ["class", "envVariables", "environment", "invalidParams", "items", "label", "workspace"])) :
|
|
143
|
-
|
|
141
|
+
}, null, 8, ["class", "envVariables", "environment", "invalidParams", "items", "label", "workspace"])) : h("", !0),
|
|
142
|
+
k(V, {
|
|
144
143
|
class: "flex-1",
|
|
145
144
|
columns: ["32px", "", ""],
|
|
146
145
|
envVariables: e.envVariables,
|
|
@@ -149,9 +148,9 @@ const U = { class: "text-c-2 request-meta-buttons flex whitespace-nowrap opacity
|
|
|
149
148
|
items: n.value,
|
|
150
149
|
label: e.label,
|
|
151
150
|
workspace: e.workspace,
|
|
152
|
-
onToggleRow:
|
|
153
|
-
onUpdateRow:
|
|
154
|
-
onDeleteRow:
|
|
151
|
+
onToggleRow: K,
|
|
152
|
+
onUpdateRow: C,
|
|
153
|
+
onDeleteRow: q
|
|
155
154
|
}, null, 8, ["envVariables", "environment", "invalidParams", "items", "label", "workspace"])
|
|
156
155
|
], 512)
|
|
157
156
|
]),
|
|
@@ -160,5 +159,5 @@ const U = { class: "text-c-2 request-meta-buttons flex whitespace-nowrap opacity
|
|
|
160
159
|
}
|
|
161
160
|
});
|
|
162
161
|
export {
|
|
163
|
-
|
|
162
|
+
Z as default
|
|
164
163
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { REGEX as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useWorkspace as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as k, computed as w, watch as R, createBlock as p, openBlock as u, withCtx as d, createCommentVNode as $, createTextVNode as K, toDisplayString as b } from "vue";
|
|
2
|
+
import { REGEX as x } from "@scalar/oas-utils/helpers";
|
|
3
|
+
import V from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
|
|
4
|
+
import C from "./RequestTable.vue.js";
|
|
5
|
+
import { useWorkspace as q } from "../../../store/store.js";
|
|
6
|
+
const B = /* @__PURE__ */ k({
|
|
7
7
|
__name: "RequestPathParams",
|
|
8
8
|
props: {
|
|
9
9
|
example: {},
|
|
@@ -16,83 +16,81 @@ const A = /* @__PURE__ */ R({
|
|
|
16
16
|
invalidParams: {}
|
|
17
17
|
},
|
|
18
18
|
setup(a) {
|
|
19
|
-
const { requestMutators:
|
|
19
|
+
const { requestMutators: c, requestExampleMutators: s } = q(), m = w(
|
|
20
20
|
() => a.example.parameters[a.paramKey].map((e) => ({
|
|
21
21
|
...e,
|
|
22
22
|
enum: e.enum
|
|
23
23
|
}))
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
const i = a.example.parameters[a.paramKey], o = (m = i[e]) == null ? void 0 : m.key;
|
|
24
|
+
), h = (e, r, n) => {
|
|
25
|
+
const i = a.example.parameters[a.paramKey], o = i[e]?.key;
|
|
27
26
|
if (o) {
|
|
28
27
|
if (r === "key") {
|
|
29
|
-
if (
|
|
28
|
+
if (i[e]?.required)
|
|
30
29
|
return;
|
|
31
30
|
if (n) {
|
|
32
|
-
const
|
|
33
|
-
|
|
31
|
+
const t = encodeURIComponent(o), l = encodeURIComponent(n), P = new RegExp(`(?<=/):${t}(?=[/?#]|$)`, "g"), g = a.operation.path.replace(P, `:${l}`);
|
|
32
|
+
c.edit(a.operation.uid, "path", g);
|
|
34
33
|
} else {
|
|
35
34
|
i.splice(e, 1);
|
|
36
|
-
const
|
|
37
|
-
|
|
35
|
+
const t = new RegExp(`/:${encodeURIComponent(o)}(?=[/?#]|$)`, "g"), l = a.operation.path.replace(t, "");
|
|
36
|
+
c.edit(a.operation.uid, "path", l);
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
|
|
39
|
+
s.edit(
|
|
41
40
|
a.example.uid,
|
|
42
41
|
`parameters.${a.paramKey}.${e}.${r}`,
|
|
43
42
|
n
|
|
44
43
|
);
|
|
45
44
|
}
|
|
46
|
-
},
|
|
47
|
-
const r =
|
|
45
|
+
}, f = (e) => {
|
|
46
|
+
const r = m.value;
|
|
48
47
|
if (r.length > e) {
|
|
49
48
|
const n = [...r];
|
|
50
|
-
n.splice(e, 1),
|
|
49
|
+
n.splice(e, 1), s.edit(
|
|
51
50
|
a.example.uid,
|
|
52
51
|
`parameters.${a.paramKey}`,
|
|
53
52
|
n
|
|
54
53
|
);
|
|
55
54
|
}
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
const r = ((m = e.match(C.PATH)) == null ? void 0 : m.map((t) => t.slice(1, -1))) || [], n = a.example.parameters[a.paramKey], i = new Map(n.map((t) => [t.key, t])), o = r.map(
|
|
55
|
+
}, v = (e) => {
|
|
56
|
+
const r = e.match(x.PATH)?.map((t) => t.slice(1, -1)) || [], n = a.example.parameters[a.paramKey], i = new Map(n.map((t) => [t.key, t])), o = r.map(
|
|
59
57
|
(t) => i.get(t) || { key: t, value: "", enabled: !0 }
|
|
60
58
|
);
|
|
61
59
|
n.forEach((t) => {
|
|
62
60
|
!r.includes(t.key) && (t.value || t.required) && o.push(t);
|
|
63
|
-
}), n.splice(0, n.length, ...o),
|
|
64
|
-
},
|
|
65
|
-
e &&
|
|
61
|
+
}), n.splice(0, n.length, ...o), s.edit(a.example.uid, `parameters.${a.paramKey}`, n);
|
|
62
|
+
}, y = (e) => {
|
|
63
|
+
e && v(e);
|
|
66
64
|
};
|
|
67
|
-
return
|
|
65
|
+
return R(
|
|
68
66
|
() => a.operation.path,
|
|
69
67
|
(e) => {
|
|
70
|
-
e &&
|
|
68
|
+
e && y(e);
|
|
71
69
|
}
|
|
72
|
-
), (e, r) => (
|
|
73
|
-
itemCount:
|
|
70
|
+
), (e, r) => (u(), p(V, {
|
|
71
|
+
itemCount: m.value.length
|
|
74
72
|
}, {
|
|
75
|
-
title:
|
|
76
|
-
|
|
73
|
+
title: d(() => [
|
|
74
|
+
K(b(e.title), 1)
|
|
77
75
|
]),
|
|
78
|
-
default:
|
|
79
|
-
|
|
76
|
+
default: d(() => [
|
|
77
|
+
m.value.length ? (u(), p(C, {
|
|
80
78
|
key: 0,
|
|
81
79
|
class: "flex-1",
|
|
82
80
|
columns: ["32px", "", ""],
|
|
83
81
|
envVariables: e.envVariables,
|
|
84
82
|
environment: e.environment,
|
|
85
83
|
invalidParams: e.invalidParams,
|
|
86
|
-
items:
|
|
84
|
+
items: m.value,
|
|
87
85
|
workspace: e.workspace,
|
|
88
|
-
onUpdateRow:
|
|
89
|
-
onDeleteRow:
|
|
90
|
-
}, null, 8, ["envVariables", "environment", "invalidParams", "items", "workspace"])) :
|
|
86
|
+
onUpdateRow: h,
|
|
87
|
+
onDeleteRow: f
|
|
88
|
+
}, null, 8, ["envVariables", "environment", "invalidParams", "items", "workspace"])) : $("", !0)
|
|
91
89
|
]),
|
|
92
90
|
_: 1
|
|
93
91
|
}, 8, ["itemCount"]));
|
|
94
92
|
}
|
|
95
93
|
});
|
|
96
94
|
export {
|
|
97
|
-
|
|
95
|
+
B as default
|
|
98
96
|
};
|