@scalar/api-client 2.5.32 → 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 +20 -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,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarButton as
|
|
3
|
-
import { ScalarIconWarning as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { useWorkspace as
|
|
10
|
-
const
|
|
1
|
+
import { defineComponent as W, ref as m, computed as h, watch as R, onMounted as $, createBlock as b, openBlock as f, withCtx as i, createVNode as c, createElementBlock as D, createTextVNode as E, Fragment as O, renderList as j, normalizeClass as F, createSlots as A, unref as V, createCommentVNode as J, withModifiers as L, nextTick as g } from "vue";
|
|
2
|
+
import { ScalarButton as q } from "@scalar/components";
|
|
3
|
+
import { ScalarIconWarning as G, ScalarIconTrash as H } from "@scalar/icons";
|
|
4
|
+
import K from "../../../components/CodeInput/CodeInput.vue.js";
|
|
5
|
+
import P from "../../../components/DataTable/DataTable.vue.js";
|
|
6
|
+
import T from "../../../components/DataTable/DataTableCell.vue.js";
|
|
7
|
+
import U from "../../../components/DataTable/DataTableHeader.vue.js";
|
|
8
|
+
import z from "../../../components/DataTable/DataTableRow.vue.js";
|
|
9
|
+
import { useWorkspace as Q } from "../../../store/store.js";
|
|
10
|
+
const oe = /* @__PURE__ */ W({
|
|
11
11
|
__name: "EnvironmentForm",
|
|
12
12
|
props: {
|
|
13
13
|
collection: {},
|
|
@@ -15,181 +15,177 @@ const re = /* @__PURE__ */ $({
|
|
|
15
15
|
workspace: {},
|
|
16
16
|
envVariables: {}
|
|
17
17
|
},
|
|
18
|
-
setup(
|
|
19
|
-
const { collectionMutators:
|
|
20
|
-
|
|
21
|
-
if (!((e = o.environment) != null && e.value))
|
|
18
|
+
setup(l) {
|
|
19
|
+
const { collectionMutators: d } = Q(), o = m([]), y = m(/* @__PURE__ */ new Set()), k = m(/* @__PURE__ */ new Map()), u = m(!1), M = h(() => {
|
|
20
|
+
if (!l.environment?.value)
|
|
22
21
|
return [{ key: "", value: "" }];
|
|
23
22
|
try {
|
|
24
|
-
const
|
|
23
|
+
const e = JSON.parse(l.environment.value), a = Object.entries(e).map(([t, n]) => ({
|
|
25
24
|
key: t,
|
|
26
|
-
value: String(
|
|
25
|
+
value: String(n)
|
|
27
26
|
}));
|
|
28
|
-
return
|
|
27
|
+
return a.length === 0 ? [{ key: "", value: "" }] : a;
|
|
29
28
|
} catch {
|
|
30
29
|
return [{ key: "", value: "" }];
|
|
31
30
|
}
|
|
32
|
-
}),
|
|
33
|
-
const e =
|
|
34
|
-
return e ? e.key || e.value ? [...
|
|
35
|
-
}),
|
|
31
|
+
}), x = h(() => {
|
|
32
|
+
const e = o.value[o.value.length - 1];
|
|
33
|
+
return e ? e.key || e.value ? [...o.value, { key: "", value: "" }] : o.value : [{ key: "", value: "" }];
|
|
34
|
+
}), p = h(() => {
|
|
36
35
|
const e = /* @__PURE__ */ new Map();
|
|
37
|
-
return
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
|
|
36
|
+
return o.value.forEach((a, t) => {
|
|
37
|
+
if (a.key) {
|
|
38
|
+
const n = e.get(a.key) || [];
|
|
39
|
+
n.push(t), e.set(a.key, n);
|
|
41
40
|
}
|
|
42
|
-
}),
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
|
|
41
|
+
}), k.value.forEach((a, t) => {
|
|
42
|
+
if (a) {
|
|
43
|
+
const n = e.get(a) || [];
|
|
44
|
+
n.push(t), e.set(a, n);
|
|
46
45
|
}
|
|
47
|
-
}), Array.from(e.values()).filter((
|
|
46
|
+
}), Array.from(e.values()).filter((a) => a.length > 1).flat();
|
|
48
47
|
});
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
R(
|
|
49
|
+
M,
|
|
51
50
|
(e) => {
|
|
52
|
-
|
|
51
|
+
o.value = [...e], y.value = new Set(e.map((a) => a.key).filter(Boolean));
|
|
53
52
|
},
|
|
54
53
|
{ immediate: !0 }
|
|
55
54
|
);
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (s && a.delete(s.key), a.has(l))
|
|
55
|
+
const C = async (e, a, t) => {
|
|
56
|
+
if (!u.value) {
|
|
57
|
+
if (a === "key") {
|
|
58
|
+
k.value.set(e, t);
|
|
59
|
+
const n = new Set(y.value), r = o.value[e];
|
|
60
|
+
if (r && n.delete(r.key), n.has(t))
|
|
63
61
|
return;
|
|
64
62
|
}
|
|
65
|
-
|
|
63
|
+
u.value = !0;
|
|
66
64
|
try {
|
|
67
|
-
const
|
|
68
|
-
if (!
|
|
65
|
+
const n = [...o.value], r = n[e];
|
|
66
|
+
if (!r)
|
|
69
67
|
return;
|
|
70
|
-
|
|
71
|
-
key:
|
|
72
|
-
value:
|
|
73
|
-
}, !
|
|
74
|
-
const
|
|
75
|
-
(
|
|
68
|
+
n[e] = {
|
|
69
|
+
key: a === "key" ? t : r.key,
|
|
70
|
+
value: a === "value" ? t : r.value
|
|
71
|
+
}, !n[e].key && !n[e].value && e !== n.length - 1 && n.splice(e, 1);
|
|
72
|
+
const v = n.reduce(
|
|
73
|
+
(s, { key: B, value: I }) => ((B || I) && (s[B] = I), s),
|
|
76
74
|
{}
|
|
77
75
|
);
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
...
|
|
81
|
-
[
|
|
82
|
-
...
|
|
83
|
-
variables:
|
|
76
|
+
if (l.collection) {
|
|
77
|
+
const s = {
|
|
78
|
+
...l.collection["x-scalar-environments"],
|
|
79
|
+
[l.environment.name]: {
|
|
80
|
+
...l.collection["x-scalar-environments"]?.[l.environment.name],
|
|
81
|
+
variables: v
|
|
84
82
|
}
|
|
85
83
|
};
|
|
86
|
-
await
|
|
87
|
-
|
|
84
|
+
await d.edit(
|
|
85
|
+
l.collection.uid,
|
|
88
86
|
"x-scalar-environments",
|
|
89
|
-
|
|
87
|
+
s
|
|
90
88
|
);
|
|
91
89
|
}
|
|
92
|
-
if (e ===
|
|
93
|
-
const
|
|
94
|
-
|
|
90
|
+
if (e === o.value.length - 1) {
|
|
91
|
+
const s = n[n.length - 1];
|
|
92
|
+
s && (s.key || s.value) && await w();
|
|
95
93
|
}
|
|
96
|
-
await
|
|
97
|
-
|
|
98
|
-
),
|
|
94
|
+
await g(), o.value = n, a === "key" && (y.value = new Set(
|
|
95
|
+
n.map((s) => s.key).filter(Boolean)
|
|
96
|
+
), k.value.delete(e));
|
|
99
97
|
} finally {
|
|
100
|
-
|
|
98
|
+
u.value = !1;
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
c.value = !0;
|
|
101
|
+
}, w = async () => {
|
|
102
|
+
if (!u.value) {
|
|
103
|
+
u.value = !0;
|
|
107
104
|
try {
|
|
108
|
-
const
|
|
109
|
-
(t, { key:
|
|
105
|
+
const e = [...o.value, { key: "", value: "" }], a = e.reduce(
|
|
106
|
+
(t, { key: n, value: r }) => ((n || r) && (t[n] = r), t),
|
|
110
107
|
{}
|
|
111
108
|
);
|
|
112
|
-
if (
|
|
109
|
+
if (l.collection) {
|
|
113
110
|
const t = {
|
|
114
|
-
...
|
|
115
|
-
[
|
|
116
|
-
...
|
|
117
|
-
variables:
|
|
111
|
+
...l.collection["x-scalar-environments"],
|
|
112
|
+
[l.environment.name]: {
|
|
113
|
+
...l.collection["x-scalar-environments"]?.[l.environment.name],
|
|
114
|
+
variables: a
|
|
118
115
|
}
|
|
119
116
|
};
|
|
120
|
-
await
|
|
121
|
-
|
|
117
|
+
await d.edit(
|
|
118
|
+
l.collection.uid,
|
|
122
119
|
"x-scalar-environments",
|
|
123
120
|
t
|
|
124
121
|
);
|
|
125
122
|
}
|
|
126
|
-
await
|
|
123
|
+
await g(), o.value = e;
|
|
127
124
|
} finally {
|
|
128
|
-
|
|
125
|
+
u.value = !1;
|
|
129
126
|
}
|
|
130
127
|
}
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
c.value = !0;
|
|
128
|
+
}, N = async (e) => {
|
|
129
|
+
if (!u.value) {
|
|
130
|
+
u.value = !0;
|
|
135
131
|
try {
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
const t =
|
|
139
|
-
(
|
|
132
|
+
const a = [...o.value];
|
|
133
|
+
a.splice(e, 1);
|
|
134
|
+
const t = a.reduce(
|
|
135
|
+
(n, { key: r, value: v }) => ((r || v) && (n[r] = v), n),
|
|
140
136
|
{}
|
|
141
137
|
);
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
144
|
-
...
|
|
145
|
-
[
|
|
146
|
-
...
|
|
138
|
+
if (l.collection) {
|
|
139
|
+
const n = {
|
|
140
|
+
...l.collection["x-scalar-environments"],
|
|
141
|
+
[l.environment.name]: {
|
|
142
|
+
...l.collection["x-scalar-environments"]?.[l.environment.name],
|
|
147
143
|
variables: t
|
|
148
144
|
}
|
|
149
145
|
};
|
|
150
|
-
await
|
|
151
|
-
|
|
146
|
+
await d.edit(
|
|
147
|
+
l.collection.uid,
|
|
152
148
|
"x-scalar-environments",
|
|
153
|
-
|
|
149
|
+
n
|
|
154
150
|
);
|
|
155
151
|
}
|
|
156
|
-
await
|
|
152
|
+
await g(), o.value = a;
|
|
157
153
|
} finally {
|
|
158
|
-
|
|
154
|
+
u.value = !1;
|
|
159
155
|
}
|
|
160
156
|
}
|
|
161
|
-
},
|
|
162
|
-
if (
|
|
163
|
-
await
|
|
164
|
-
else if (
|
|
165
|
-
const e =
|
|
166
|
-
e && (e.key || e.value) && await
|
|
157
|
+
}, S = async () => {
|
|
158
|
+
if (o.value.length === 0)
|
|
159
|
+
await w();
|
|
160
|
+
else if (o.value.length >= 1) {
|
|
161
|
+
const e = o.value[o.value.length - 1];
|
|
162
|
+
e && (e.key || e.value) && await w();
|
|
167
163
|
}
|
|
168
164
|
};
|
|
169
|
-
return
|
|
170
|
-
|
|
171
|
-
}),
|
|
172
|
-
() =>
|
|
165
|
+
return $(() => {
|
|
166
|
+
S();
|
|
167
|
+
}), R(
|
|
168
|
+
() => o.value,
|
|
173
169
|
() => {
|
|
174
|
-
|
|
170
|
+
S();
|
|
175
171
|
}
|
|
176
|
-
), (e,
|
|
172
|
+
), (e, a) => (f(), b(P, {
|
|
177
173
|
class: "group/table flex-1",
|
|
178
174
|
columns: ["", ""]
|
|
179
175
|
}, {
|
|
180
|
-
default:
|
|
181
|
-
|
|
182
|
-
default:
|
|
183
|
-
|
|
184
|
-
default:
|
|
185
|
-
|
|
176
|
+
default: i(() => [
|
|
177
|
+
c(z, { class: "sr-only !block" }, {
|
|
178
|
+
default: i(() => [
|
|
179
|
+
c(U, null, {
|
|
180
|
+
default: i(() => a[0] || (a[0] = [
|
|
181
|
+
E("Key")
|
|
186
182
|
])),
|
|
187
183
|
_: 1,
|
|
188
184
|
__: [0]
|
|
189
185
|
}),
|
|
190
|
-
|
|
191
|
-
default:
|
|
192
|
-
|
|
186
|
+
c(U, null, {
|
|
187
|
+
default: i(() => a[1] || (a[1] = [
|
|
188
|
+
E("Value")
|
|
193
189
|
])),
|
|
194
190
|
_: 1,
|
|
195
191
|
__: [1]
|
|
@@ -197,31 +193,31 @@ const re = /* @__PURE__ */ $({
|
|
|
197
193
|
]),
|
|
198
194
|
_: 1
|
|
199
195
|
}),
|
|
200
|
-
(
|
|
201
|
-
key:
|
|
202
|
-
class:
|
|
203
|
-
error:
|
|
196
|
+
(f(!0), D(O, null, j(x.value, (t, n) => (f(), b(z, {
|
|
197
|
+
key: n,
|
|
198
|
+
class: F({
|
|
199
|
+
error: p.value.includes(n)
|
|
204
200
|
})
|
|
205
201
|
}, {
|
|
206
|
-
default:
|
|
207
|
-
|
|
208
|
-
default:
|
|
209
|
-
|
|
202
|
+
default: i(() => [
|
|
203
|
+
c(T, null, {
|
|
204
|
+
default: i(() => [
|
|
205
|
+
c(K, {
|
|
210
206
|
disableCloseBrackets: "",
|
|
211
207
|
disableEnter: "",
|
|
212
208
|
disableTabIndent: "",
|
|
213
209
|
lineWrapping: "",
|
|
214
210
|
environment: e.environment,
|
|
215
211
|
envVariables: e.envVariables,
|
|
216
|
-
modelValue:
|
|
212
|
+
modelValue: t.key,
|
|
217
213
|
placeholder: "Key",
|
|
218
214
|
workspace: e.workspace,
|
|
219
|
-
"onUpdate:modelValue": (
|
|
220
|
-
},
|
|
221
|
-
|
|
215
|
+
"onUpdate:modelValue": (r) => C(n, "key", r)
|
|
216
|
+
}, A({ _: 2 }, [
|
|
217
|
+
p.value.includes(n) ? {
|
|
222
218
|
name: "icon",
|
|
223
|
-
fn:
|
|
224
|
-
|
|
219
|
+
fn: i(() => [
|
|
220
|
+
c(V(G), { class: "text-red mr-0.75 size-3.5 brightness-[.9]" })
|
|
225
221
|
]),
|
|
226
222
|
key: "0"
|
|
227
223
|
} : void 0
|
|
@@ -229,9 +225,9 @@ const re = /* @__PURE__ */ $({
|
|
|
229
225
|
]),
|
|
230
226
|
_: 2
|
|
231
227
|
}, 1024),
|
|
232
|
-
|
|
233
|
-
default:
|
|
234
|
-
|
|
228
|
+
c(T, null, {
|
|
229
|
+
default: i(() => [
|
|
230
|
+
c(K, {
|
|
235
231
|
class: "pr-6 group-hover:pr-10 group-has-[.cm-focused]:pr-10",
|
|
236
232
|
disableCloseBrackets: "",
|
|
237
233
|
disableEnter: "",
|
|
@@ -239,24 +235,24 @@ const re = /* @__PURE__ */ $({
|
|
|
239
235
|
lineWrapping: "",
|
|
240
236
|
environment: e.environment,
|
|
241
237
|
envVariables: e.envVariables,
|
|
242
|
-
modelValue:
|
|
238
|
+
modelValue: t.value,
|
|
243
239
|
placeholder: "Value",
|
|
244
240
|
workspace: e.workspace,
|
|
245
|
-
"onUpdate:modelValue": (
|
|
241
|
+
"onUpdate:modelValue": (r) => C(n, "value", r)
|
|
246
242
|
}, {
|
|
247
|
-
icon:
|
|
248
|
-
|
|
243
|
+
icon: i(() => [
|
|
244
|
+
t.key || t.value ? (f(), b(V(q), {
|
|
249
245
|
key: 0,
|
|
250
246
|
class: "text-c-2 hover:text-c-1 hover:bg-b-2 z-context hidden h-fit rounded p-1 group-hover:flex group-has-[.cm-focused]:flex",
|
|
251
247
|
size: "sm",
|
|
252
248
|
variant: "ghost",
|
|
253
|
-
onClick:
|
|
249
|
+
onClick: L((r) => N(n), ["stop"])
|
|
254
250
|
}, {
|
|
255
|
-
default:
|
|
256
|
-
|
|
251
|
+
default: i(() => [
|
|
252
|
+
c(V(H), { class: "size-3.5" })
|
|
257
253
|
]),
|
|
258
254
|
_: 2
|
|
259
|
-
}, 1032, ["onClick"])) :
|
|
255
|
+
}, 1032, ["onClick"])) : J("", !0)
|
|
260
256
|
]),
|
|
261
257
|
_: 2
|
|
262
258
|
}, 1032, ["environment", "envVariables", "modelValue", "workspace", "onUpdate:modelValue"])
|
|
@@ -272,5 +268,5 @@ const re = /* @__PURE__ */ $({
|
|
|
272
268
|
}
|
|
273
269
|
});
|
|
274
270
|
export {
|
|
275
|
-
|
|
271
|
+
oe as default
|
|
276
272
|
};
|
|
@@ -17,8 +17,7 @@ const B = { class: "flex h-full w-full flex-col gap-2 pt-8" }, C = { class: "fle
|
|
|
17
17
|
const g = k, t = p("preview"), m = p(null);
|
|
18
18
|
w(t, (l) => {
|
|
19
19
|
l === "edit" && x(() => {
|
|
20
|
-
|
|
21
|
-
(e = m.value) == null || e.focus();
|
|
20
|
+
m.value?.focus();
|
|
22
21
|
});
|
|
23
22
|
});
|
|
24
23
|
const V = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as c, computed as a, createElementBlock as s, createBlock as m, createCommentVNode as
|
|
1
|
+
import { defineComponent as c, computed as a, createElementBlock as s, createBlock as m, createCommentVNode as f, openBlock as o, toDisplayString as d, unref as p } from "vue";
|
|
2
2
|
import { ScalarCodeBlock as v } from "@scalar/components";
|
|
3
3
|
import { isDefined as y } from "@scalar/oas-utils/helpers";
|
|
4
4
|
import { encode as g } from "js-base64";
|
|
@@ -7,7 +7,7 @@ import { getSnippet as k } from "./helpers/get-snippet.js";
|
|
|
7
7
|
const S = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "text-c-3 flex min-h-16 items-center justify-center px-4 text-sm"
|
|
10
|
-
},
|
|
10
|
+
}, q = /* @__PURE__ */ c({
|
|
11
11
|
__name: "CodeSnippet",
|
|
12
12
|
props: {
|
|
13
13
|
target: {},
|
|
@@ -19,32 +19,32 @@ const S = {
|
|
|
19
19
|
environment: {}
|
|
20
20
|
},
|
|
21
21
|
setup(t) {
|
|
22
|
-
const
|
|
23
|
-
() => t.securitySchemes.flatMap((e) => e.type === "apiKey" ? e.value :
|
|
22
|
+
const l = a(
|
|
23
|
+
() => t.securitySchemes.flatMap((e) => e.type === "apiKey" ? e.value : e?.type === "http" ? [
|
|
24
24
|
e.token,
|
|
25
25
|
e.password,
|
|
26
26
|
g(`${e.username}:${e.password}`)
|
|
27
|
-
] : e.type === "oauth2" ? Object.values(e.flows).map((
|
|
28
|
-
),
|
|
27
|
+
] : e.type === "oauth2" ? Object.values(e.flows).map((n) => n?.token).filter(y) : [])
|
|
28
|
+
), r = a(() => {
|
|
29
29
|
const e = x({
|
|
30
30
|
operation: t.operation,
|
|
31
31
|
example: t.example,
|
|
32
32
|
server: t.server,
|
|
33
33
|
securitySchemes: t.securitySchemes,
|
|
34
34
|
environment: t.environment
|
|
35
|
-
}), [
|
|
36
|
-
return { error:
|
|
37
|
-
}),
|
|
38
|
-
return (e,
|
|
35
|
+
}), [n, u] = k(t.target, t.client, e);
|
|
36
|
+
return { error: n, payload: u };
|
|
37
|
+
}), i = a(() => t.target === "shell" && t.client === "curl" ? "curl" : t.target ?? "plaintext");
|
|
38
|
+
return (e, n) => r.value.error ? (o(), s("div", S, d(r.value.error.message), 1)) : r.value.payload ? (o(), m(p(v), {
|
|
39
39
|
key: 1,
|
|
40
40
|
class: "w-full",
|
|
41
|
-
content:
|
|
42
|
-
hideCredentials:
|
|
43
|
-
lang:
|
|
41
|
+
content: r.value.payload,
|
|
42
|
+
hideCredentials: l.value,
|
|
43
|
+
lang: i.value,
|
|
44
44
|
lineNumbers: ""
|
|
45
|
-
}, null, 8, ["content", "hideCredentials", "lang"])) :
|
|
45
|
+
}, null, 8, ["content", "hideCredentials", "lang"])) : f("", !0);
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
q as default
|
|
50
50
|
};
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { mergeUrls as
|
|
2
|
-
const
|
|
3
|
-
baseUrl:
|
|
4
|
-
method:
|
|
1
|
+
import { mergeUrls as g } from "@scalar/oas-utils/helpers";
|
|
2
|
+
const v = ({
|
|
3
|
+
baseUrl: l = "",
|
|
4
|
+
method: s,
|
|
5
5
|
body: a,
|
|
6
|
-
path:
|
|
6
|
+
path: c,
|
|
7
7
|
cookies: p,
|
|
8
8
|
headers: n,
|
|
9
9
|
query: m
|
|
10
10
|
}) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
url: g.toString(),
|
|
11
|
+
const f = g(l, c, void 0, !0), r = {
|
|
12
|
+
method: s.toUpperCase(),
|
|
13
|
+
url: f.toString(),
|
|
15
14
|
httpVersion: "HTTP/1.1",
|
|
16
15
|
headers: [],
|
|
17
16
|
queryString: [],
|
|
@@ -30,20 +29,20 @@ const D = ({
|
|
|
30
29
|
value: t
|
|
31
30
|
}))), a)
|
|
32
31
|
try {
|
|
33
|
-
const e =
|
|
32
|
+
const e = n.find((t) => t.key.toLowerCase() === "content-type")?.value;
|
|
34
33
|
if (a.activeBody === "formData" && a.formData) {
|
|
35
34
|
const t = [];
|
|
36
|
-
a.formData.value.forEach(({ key: o, value:
|
|
37
|
-
|
|
35
|
+
a.formData.value.forEach(({ key: o, value: u, file: i, enabled: d }) => {
|
|
36
|
+
d && (i ? t.push({
|
|
38
37
|
name: o || "blob",
|
|
39
38
|
value: "BINARY",
|
|
40
39
|
fileName: i.name,
|
|
41
40
|
contentType: i.type || "application/octet-stream"
|
|
42
41
|
}) : t.push({
|
|
43
42
|
name: o,
|
|
44
|
-
value:
|
|
43
|
+
value: u
|
|
45
44
|
}));
|
|
46
|
-
}),
|
|
45
|
+
}), a.formData?.encoding === "urlencoded" ? r.postData = {
|
|
47
46
|
mimeType: e || "application/x-www-form-urlencoded",
|
|
48
47
|
params: t
|
|
49
48
|
} : r.postData = {
|
|
@@ -52,12 +51,12 @@ const D = ({
|
|
|
52
51
|
};
|
|
53
52
|
} else a.activeBody === "raw" && a.raw && (r.postData = {
|
|
54
53
|
mimeType: e || "application/json",
|
|
55
|
-
text:
|
|
54
|
+
text: a.raw?.value ?? ""
|
|
56
55
|
});
|
|
57
56
|
} catch {
|
|
58
57
|
}
|
|
59
58
|
return r;
|
|
60
59
|
};
|
|
61
60
|
export {
|
|
62
|
-
|
|
61
|
+
v as convertToHarRequest
|
|
63
62
|
};
|