@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,27 +1,26 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarButton as
|
|
3
|
-
import { LibraryIcon as
|
|
4
|
-
import { useToasts as
|
|
5
|
-
import
|
|
6
|
-
import { useActiveEntities as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { useWorkspace as
|
|
10
|
-
const D = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as p, ref as m, createBlock as v, openBlock as b, withCtx as l, createVNode as r, createTextVNode as _, unref as u } from "vue";
|
|
2
|
+
import { ScalarButton as k } from "@scalar/components";
|
|
3
|
+
import { LibraryIcon as C } from "@scalar/icons/library";
|
|
4
|
+
import { useToasts as V } from "@scalar/use-toasts";
|
|
5
|
+
import x from "../IconSelector.vue.js";
|
|
6
|
+
import { useActiveEntities as N } from "../../store/active-entities.js";
|
|
7
|
+
import B from "./CommandActionForm.vue.js";
|
|
8
|
+
import S from "./CommandActionInput.vue.js";
|
|
9
|
+
import { useWorkspace as $ } from "../../store/store.js";
|
|
10
|
+
const D = /* @__PURE__ */ p({
|
|
11
11
|
__name: "CommandPaletteCollection",
|
|
12
12
|
emits: ["close", "back"],
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
var n, e;
|
|
13
|
+
setup(w, { emit: c }) {
|
|
14
|
+
const n = c, { activeWorkspace: i } = N(), { collectionMutators: d } = $(), o = m(""), a = m("interface-content-folder"), { toast: s } = V(), f = () => {
|
|
16
15
|
if (!o.value) {
|
|
17
|
-
|
|
16
|
+
s("Please enter a name before creating a collection.", "error");
|
|
18
17
|
return;
|
|
19
18
|
}
|
|
20
|
-
if (!
|
|
21
|
-
|
|
19
|
+
if (!i.value?.uid) {
|
|
20
|
+
s("No active workspace found.", "error");
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
|
-
|
|
23
|
+
d.add(
|
|
25
24
|
{
|
|
26
25
|
openapi: "3.1.0",
|
|
27
26
|
info: {
|
|
@@ -30,26 +29,26 @@ const D = /* @__PURE__ */ v({
|
|
|
30
29
|
},
|
|
31
30
|
"x-scalar-icon": a.value
|
|
32
31
|
},
|
|
33
|
-
|
|
34
|
-
),
|
|
32
|
+
i.value?.uid
|
|
33
|
+
), n("close");
|
|
35
34
|
};
|
|
36
|
-
return (
|
|
35
|
+
return (I, e) => (b(), v(B, {
|
|
37
36
|
disabled: !o.value.trim(),
|
|
38
|
-
onSubmit:
|
|
37
|
+
onSubmit: f
|
|
39
38
|
}, {
|
|
40
39
|
options: l(() => [
|
|
41
|
-
r(
|
|
40
|
+
r(x, {
|
|
42
41
|
modelValue: a.value,
|
|
43
42
|
"onUpdate:modelValue": e[2] || (e[2] = (t) => a.value = t),
|
|
44
43
|
placement: "bottom-start"
|
|
45
44
|
}, {
|
|
46
45
|
default: l(() => [
|
|
47
|
-
r(
|
|
46
|
+
r(u(k), {
|
|
48
47
|
class: "aspect-square h-auto px-0",
|
|
49
48
|
variant: "outlined"
|
|
50
49
|
}, {
|
|
51
50
|
default: l(() => [
|
|
52
|
-
r(
|
|
51
|
+
r(u(C), {
|
|
53
52
|
class: "text-c-2 size-4 stroke-[1.75]",
|
|
54
53
|
src: a.value
|
|
55
54
|
}, null, 8, ["src"])
|
|
@@ -61,15 +60,15 @@ const D = /* @__PURE__ */ v({
|
|
|
61
60
|
}, 8, ["modelValue"])
|
|
62
61
|
]),
|
|
63
62
|
submit: l(() => e[3] || (e[3] = [
|
|
64
|
-
|
|
63
|
+
_(" Create Collection ")
|
|
65
64
|
])),
|
|
66
65
|
default: l(() => [
|
|
67
|
-
r(
|
|
66
|
+
r(S, {
|
|
68
67
|
modelValue: o.value,
|
|
69
68
|
"onUpdate:modelValue": e[0] || (e[0] = (t) => o.value = t),
|
|
70
69
|
label: "Collection Name",
|
|
71
70
|
placeholder: "Collection Name",
|
|
72
|
-
onOnDelete: e[1] || (e[1] = (t) =>
|
|
71
|
+
onOnDelete: e[1] || (e[1] = (t) => n("back", t))
|
|
73
72
|
}, null, 8, ["modelValue"])
|
|
74
73
|
]),
|
|
75
74
|
_: 1
|
|
@@ -1,71 +1,69 @@
|
|
|
1
|
-
import { defineComponent as q, ref as
|
|
2
|
-
import { ScalarDropdown as
|
|
3
|
-
import { isDefined as
|
|
4
|
-
import { useToasts as
|
|
5
|
-
import { useRouter as
|
|
6
|
-
import
|
|
7
|
-
import { PathId as
|
|
8
|
-
import { useActiveEntities as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { useWorkspace as
|
|
12
|
-
const
|
|
1
|
+
import { defineComponent as q, ref as v, computed as R, createBlock as x, createCommentVNode as B, openBlock as n, withCtx as l, createVNode as r, createTextVNode as u, unref as m, createElementVNode as b, toDisplayString as k, createElementBlock as P, Fragment as W, renderList as $ } from "vue";
|
|
2
|
+
import { ScalarDropdown as I, ScalarButton as j, ScalarIcon as z, ScalarDropdownItem as M } from "@scalar/components";
|
|
3
|
+
import { isDefined as T } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { useToasts as U } from "@scalar/use-toasts";
|
|
5
|
+
import { useRouter as A } from "vue-router";
|
|
6
|
+
import h from "../HttpMethod/HttpMethod.vue.js";
|
|
7
|
+
import { PathId as i } from "../../routes.js";
|
|
8
|
+
import { useActiveEntities as F } from "../../store/active-entities.js";
|
|
9
|
+
import H from "./CommandActionForm.vue.js";
|
|
10
|
+
import L from "./CommandActionInput.vue.js";
|
|
11
|
+
import { useWorkspace as O } from "../../store/store.js";
|
|
12
|
+
const G = { class: "flex items-center gap-2" }, J = { class: "custom-scroll max-h-40" }, me = /* @__PURE__ */ q({
|
|
13
13
|
__name: "CommandPaletteExample",
|
|
14
14
|
props: {
|
|
15
15
|
metaData: {}
|
|
16
16
|
},
|
|
17
17
|
emits: ["close", "back"],
|
|
18
|
-
setup(
|
|
19
|
-
|
|
20
|
-
const w = C, p = E, { push: D } = F(), { activeRequest: S, activeWorkspace: g, activeWorkspaceRequests: y } = H(), { requests: s, requestExampleMutators: N } = G(), { toast: d } = A(), m = x(""), a = x(
|
|
18
|
+
setup(_, { emit: C }) {
|
|
19
|
+
const E = _, c = C, { push: w } = A(), { activeRequest: D, activeWorkspace: S, activeWorkspaceRequests: g } = F(), { requests: p, requestExampleMutators: y } = O(), { toast: d } = U(), s = v(""), t = v(
|
|
21
20
|
// Ensure we pre-select the correct request
|
|
22
|
-
|
|
23
|
-
), f = (o) =>
|
|
24
|
-
|
|
25
|
-
if (!m.value) {
|
|
21
|
+
p[E.metaData?.itemUid ?? ""] ?? D.value
|
|
22
|
+
), f = (o) => t.value = o, N = () => {
|
|
23
|
+
if (!s.value) {
|
|
26
24
|
d("Please enter a name before creating an example.", "error");
|
|
27
25
|
return;
|
|
28
26
|
}
|
|
29
|
-
if (!
|
|
27
|
+
if (!t.value) {
|
|
30
28
|
d("Please select a request before creating an example.", "error");
|
|
31
29
|
return;
|
|
32
30
|
}
|
|
33
|
-
const o =
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const o = y.add(
|
|
32
|
+
t.value,
|
|
33
|
+
s.value
|
|
36
34
|
);
|
|
37
|
-
o && (
|
|
35
|
+
o && (w({
|
|
38
36
|
name: "request.examples",
|
|
39
37
|
params: {
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
38
|
+
[i.Workspace]: S.value?.uid,
|
|
39
|
+
[i.Request]: t.value.uid,
|
|
40
|
+
[i.Examples]: o.uid
|
|
43
41
|
}
|
|
44
|
-
}),
|
|
45
|
-
},
|
|
46
|
-
() =>
|
|
42
|
+
}), c("close"));
|
|
43
|
+
}, V = R(
|
|
44
|
+
() => g.value.map((o) => p?.[o]).filter(T)
|
|
47
45
|
);
|
|
48
|
-
return (o,
|
|
46
|
+
return (o, a) => t.value ? (n(), x(H, {
|
|
49
47
|
key: 0,
|
|
50
|
-
disabled: !
|
|
51
|
-
onSubmit:
|
|
48
|
+
disabled: !s.value.trim(),
|
|
49
|
+
onSubmit: N
|
|
52
50
|
}, {
|
|
53
51
|
options: l(() => [
|
|
54
|
-
r(
|
|
52
|
+
r(m(I), {
|
|
55
53
|
placement: "bottom",
|
|
56
54
|
resize: ""
|
|
57
55
|
}, {
|
|
58
56
|
items: l(() => [
|
|
59
|
-
|
|
60
|
-
(
|
|
61
|
-
key:
|
|
57
|
+
b("div", J, [
|
|
58
|
+
(n(!0), P(W, null, $(V.value, (e) => (n(), x(m(M), {
|
|
59
|
+
key: e.uid,
|
|
62
60
|
class: "flex h-7 w-full items-center justify-between px-1 pr-[26px]",
|
|
63
|
-
onClick: (
|
|
61
|
+
onClick: (K) => f(e)
|
|
64
62
|
}, {
|
|
65
63
|
default: l(() => [
|
|
66
|
-
u(
|
|
67
|
-
r(
|
|
68
|
-
method:
|
|
64
|
+
u(k(e.summary) + " ", 1),
|
|
65
|
+
r(h, {
|
|
66
|
+
method: e.method
|
|
69
67
|
}, null, 8, ["method"])
|
|
70
68
|
]),
|
|
71
69
|
_: 2
|
|
@@ -73,18 +71,18 @@ const J = { class: "flex items-center gap-2" }, K = { class: "custom-scroll max-
|
|
|
73
71
|
])
|
|
74
72
|
]),
|
|
75
73
|
default: l(() => [
|
|
76
|
-
r(
|
|
74
|
+
r(m(j), {
|
|
77
75
|
class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
|
|
78
76
|
variant: "outlined",
|
|
79
|
-
onClick:
|
|
77
|
+
onClick: a[2] || (a[2] = (e) => f(t.value))
|
|
80
78
|
}, {
|
|
81
79
|
default: l(() => [
|
|
82
|
-
u(
|
|
83
|
-
|
|
84
|
-
r(
|
|
85
|
-
method:
|
|
80
|
+
u(k(t.value.summary) + " ", 1),
|
|
81
|
+
b("div", G, [
|
|
82
|
+
r(h, {
|
|
83
|
+
method: t.value.method
|
|
86
84
|
}, null, 8, ["method"]),
|
|
87
|
-
r(
|
|
85
|
+
r(m(z), {
|
|
88
86
|
class: "text-c-3",
|
|
89
87
|
icon: "ChevronDown",
|
|
90
88
|
size: "md"
|
|
@@ -97,22 +95,22 @@ const J = { class: "flex items-center gap-2" }, K = { class: "custom-scroll max-
|
|
|
97
95
|
_: 1
|
|
98
96
|
})
|
|
99
97
|
]),
|
|
100
|
-
submit: l(() =>
|
|
98
|
+
submit: l(() => a[3] || (a[3] = [
|
|
101
99
|
u("Create Example")
|
|
102
100
|
])),
|
|
103
101
|
default: l(() => [
|
|
104
|
-
r(
|
|
105
|
-
modelValue:
|
|
106
|
-
"onUpdate:modelValue":
|
|
102
|
+
r(L, {
|
|
103
|
+
modelValue: s.value,
|
|
104
|
+
"onUpdate:modelValue": a[0] || (a[0] = (e) => s.value = e),
|
|
107
105
|
label: "Example Name",
|
|
108
106
|
placeholder: "Example Name",
|
|
109
|
-
onOnDelete:
|
|
107
|
+
onOnDelete: a[1] || (a[1] = (e) => c("back", e))
|
|
110
108
|
}, null, 8, ["modelValue"])
|
|
111
109
|
]),
|
|
112
110
|
_: 1
|
|
113
|
-
}, 8, ["disabled"])) :
|
|
111
|
+
}, 8, ["disabled"])) : B("", !0);
|
|
114
112
|
}
|
|
115
113
|
});
|
|
116
114
|
export {
|
|
117
|
-
|
|
115
|
+
me as default
|
|
118
116
|
};
|
|
@@ -1,151 +1,147 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLoadingState as
|
|
3
|
-
import { useToasts as
|
|
4
|
-
import { useRouter as
|
|
5
|
-
import { importCurlCommand as
|
|
6
|
-
import { useActiveEntities as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { isPostmanCollection as
|
|
11
|
-
import { getOpenApiDocumentDetails as
|
|
12
|
-
import { isUrl as
|
|
13
|
-
import { useFileDialog as
|
|
14
|
-
import { PathId as
|
|
15
|
-
import { useWorkspace as
|
|
16
|
-
const
|
|
1
|
+
import { defineComponent as J, ref as L, computed as x, watch as A, createBlock as I, openBlock as l, unref as r, withCtx as p, createElementBlock as d, Fragment as v, createElementVNode as U, createCommentVNode as Y, createVNode as w, createTextVNode as c, toDisplayString as R } from "vue";
|
|
2
|
+
import { useLoadingState as q, ScalarButton as _, ScalarCodeBlock as G, ScalarIcon as H, ScalarTooltip as K } from "@scalar/components";
|
|
3
|
+
import { useToasts as Q } from "@scalar/use-toasts";
|
|
4
|
+
import { useRouter as X } from "vue-router";
|
|
5
|
+
import { importCurlCommand as Z } from "../../libs/importers/curl.js";
|
|
6
|
+
import { useActiveEntities as ee } from "../../store/active-entities.js";
|
|
7
|
+
import te from "./CommandActionForm.vue.js";
|
|
8
|
+
import oe from "./CommandActionInput.vue.js";
|
|
9
|
+
import ae from "./WatchModeToggle.vue.js";
|
|
10
|
+
import { isPostmanCollection as P, getPostmanDocumentDetails as le, convertPostmanToOpenApi as D } from "../../libs/postman.js";
|
|
11
|
+
import { getOpenApiDocumentDetails as re } from "../../libs/getOpenApiDocumentDetails.js";
|
|
12
|
+
import { isUrl as h } from "../../libs/isUrl.js";
|
|
13
|
+
import { useFileDialog as ne } from "../../hooks/useFileDialog.js";
|
|
14
|
+
import { PathId as O } from "../../routes.js";
|
|
15
|
+
import { useWorkspace as ie } from "../../store/store.js";
|
|
16
|
+
const se = { class: "flex justify-between" }, ue = { class: "flex w-full flex-row items-center justify-between gap-3" }, Pe = /* @__PURE__ */ J({
|
|
17
17
|
__name: "CommandPaletteImport",
|
|
18
18
|
emits: ["close", "back"],
|
|
19
|
-
setup(
|
|
20
|
-
const
|
|
21
|
-
() =>
|
|
19
|
+
setup(ce, { emit: V }) {
|
|
20
|
+
const C = V, T = X(), { activeWorkspace: n, activeCollection: F } = ee(), { importSpecFile: k, importSpecFromUrl: W, events: N } = ie(), { toast: i } = Q(), s = q(), o = L(""), f = L(!0), a = x(() => P(o.value) ? le(o.value) : re(o.value)), S = x(
|
|
21
|
+
() => a.value ? a.value.type : "json"
|
|
22
22
|
);
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
t && $.push({
|
|
23
|
+
function g(e) {
|
|
24
|
+
e && T.push({
|
|
26
25
|
name: "collection",
|
|
27
26
|
params: {
|
|
28
|
-
[
|
|
29
|
-
[
|
|
27
|
+
[O.Workspace]: n.value?.uid,
|
|
28
|
+
[O.Collection]: e.uid
|
|
30
29
|
}
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
|
-
const
|
|
34
|
-
onChange: async (
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const o = (u = b.target) == null ? void 0 : u.result;
|
|
32
|
+
const y = x(() => h(o.value)), $ = x(() => !!a.value), { open: B } = ne({
|
|
33
|
+
onChange: async (e) => {
|
|
34
|
+
const t = e?.[0];
|
|
35
|
+
if (t) {
|
|
36
|
+
const u = new FileReader();
|
|
37
|
+
u.onload = async (E) => {
|
|
38
|
+
const b = E.target?.result;
|
|
41
39
|
try {
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
await
|
|
45
|
-
|
|
40
|
+
if (P(b)) {
|
|
41
|
+
const m = await k(
|
|
42
|
+
await D(b),
|
|
43
|
+
n.value?.uid ?? ""
|
|
46
44
|
);
|
|
47
|
-
|
|
45
|
+
g(m?.collection);
|
|
48
46
|
} else {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
const m = await k(
|
|
48
|
+
b,
|
|
49
|
+
n.value?.uid ?? ""
|
|
52
50
|
);
|
|
53
|
-
|
|
51
|
+
g(m?.collection);
|
|
54
52
|
}
|
|
55
|
-
|
|
56
|
-
} catch (
|
|
57
|
-
console.error(
|
|
58
|
-
const
|
|
59
|
-
|
|
53
|
+
i("Import successful", "info"), C("close");
|
|
54
|
+
} catch (m) {
|
|
55
|
+
console.error(m);
|
|
56
|
+
const z = m?.message || "Unknown error";
|
|
57
|
+
i(`Import failed: ${z}`, "error");
|
|
60
58
|
}
|
|
61
|
-
},
|
|
59
|
+
}, u.readAsText(t);
|
|
62
60
|
}
|
|
63
61
|
},
|
|
64
62
|
multiple: !1,
|
|
65
63
|
accept: ".json,.yaml,.yml"
|
|
66
64
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}),
|
|
70
|
-
|
|
65
|
+
A(y, (e) => {
|
|
66
|
+
e || (f.value = !1);
|
|
67
|
+
}), A(o, (e) => {
|
|
68
|
+
h(e) || (f.value = !1);
|
|
71
69
|
});
|
|
72
|
-
async function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
d.startLoading();
|
|
70
|
+
async function M() {
|
|
71
|
+
if (!(!o.value || s.isLoading)) {
|
|
72
|
+
s.startLoading();
|
|
76
73
|
try {
|
|
77
|
-
if (
|
|
78
|
-
const [
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
if (y.value) {
|
|
75
|
+
const [e, t] = await W(
|
|
76
|
+
o.value,
|
|
77
|
+
n.value?.uid ?? "",
|
|
81
78
|
{
|
|
82
|
-
proxyUrl:
|
|
83
|
-
watchMode:
|
|
79
|
+
proxyUrl: n.value?.proxyUrl,
|
|
80
|
+
watchMode: f.value
|
|
84
81
|
}
|
|
85
82
|
);
|
|
86
|
-
if (
|
|
87
|
-
|
|
83
|
+
if (g(t?.collection), e) {
|
|
84
|
+
i(
|
|
88
85
|
"There was a possible CORS error while importing your spec, please make sure this server is allowed in the CORS policy of your OpenAPI document.",
|
|
89
86
|
"error",
|
|
90
87
|
{ timeout: 5e3 }
|
|
91
|
-
),
|
|
88
|
+
), s.invalidate(2e3, !0);
|
|
92
89
|
return;
|
|
93
90
|
}
|
|
94
|
-
} else if (
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
await
|
|
98
|
-
|
|
91
|
+
} else if ($.value)
|
|
92
|
+
if (P(o.value)) {
|
|
93
|
+
const e = await k(
|
|
94
|
+
await D(o.value),
|
|
95
|
+
n.value?.uid ?? ""
|
|
99
96
|
);
|
|
100
|
-
|
|
97
|
+
g(e?.collection), i("Successfully converted Postman collection", "info");
|
|
101
98
|
} else {
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
const e = await k(
|
|
100
|
+
o.value,
|
|
101
|
+
n.value?.uid ?? ""
|
|
105
102
|
);
|
|
106
|
-
|
|
103
|
+
g(e?.collection);
|
|
107
104
|
}
|
|
108
105
|
else {
|
|
109
|
-
|
|
106
|
+
i("Import failed: Invalid URL or OpenAPI document", "error"), s.invalidate(2e3, !0);
|
|
110
107
|
return;
|
|
111
108
|
}
|
|
112
|
-
|
|
113
|
-
} catch (
|
|
114
|
-
console.error("[importCollection]",
|
|
115
|
-
const
|
|
116
|
-
|
|
109
|
+
s.clear(), C("close"), i("Import successful", "info");
|
|
110
|
+
} catch (e) {
|
|
111
|
+
console.error("[importCollection]", e);
|
|
112
|
+
const t = e?.message || "Unknown error";
|
|
113
|
+
s.invalidate(2e3, !0), i(`Import failed: ${t}`, "error");
|
|
117
114
|
}
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
j.commandPalette.emit({
|
|
117
|
+
const j = (e) => {
|
|
118
|
+
if (e.trim().toLowerCase().startsWith("curl")) {
|
|
119
|
+
N.commandPalette.emit({
|
|
124
120
|
commandName: "Import from cURL",
|
|
125
121
|
metaData: {
|
|
126
|
-
parsedCurl:
|
|
127
|
-
collectionUid:
|
|
122
|
+
parsedCurl: Z(e),
|
|
123
|
+
collectionUid: F.value?.uid
|
|
128
124
|
}
|
|
129
125
|
});
|
|
130
126
|
return;
|
|
131
127
|
}
|
|
132
|
-
|
|
128
|
+
o.value = e;
|
|
133
129
|
};
|
|
134
|
-
return (
|
|
135
|
-
disabled: !
|
|
136
|
-
loading: s
|
|
137
|
-
onSubmit:
|
|
130
|
+
return (e, t) => (l(), I(te, {
|
|
131
|
+
disabled: !o.value.trim(),
|
|
132
|
+
loading: r(s),
|
|
133
|
+
onSubmit: M
|
|
138
134
|
}, {
|
|
139
|
-
options:
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
options: p(() => [
|
|
136
|
+
U("div", ue, [
|
|
137
|
+
w(r(_), {
|
|
142
138
|
class: "hover:bg-b-2 relative max-h-8 gap-1.5 p-2 text-xs",
|
|
143
139
|
variant: "outlined",
|
|
144
|
-
onClick:
|
|
140
|
+
onClick: r(B)
|
|
145
141
|
}, {
|
|
146
|
-
default:
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
default: p(() => [
|
|
143
|
+
t[5] || (t[5] = c(" JSON, or YAML File ")),
|
|
144
|
+
w(r(H), {
|
|
149
145
|
class: "text-c-3",
|
|
150
146
|
icon: "Upload",
|
|
151
147
|
size: "md"
|
|
@@ -154,64 +150,64 @@ const me = { class: "flex justify-between" }, de = { class: "flex w-full flex-ro
|
|
|
154
150
|
_: 1,
|
|
155
151
|
__: [5]
|
|
156
152
|
}, 8, ["onClick"]),
|
|
157
|
-
|
|
158
|
-
content:
|
|
153
|
+
w(r(K), {
|
|
154
|
+
content: y.value ? "Watch mode automatically updates the API client when the OpenAPI URL content changes, ensuring your client remains up-to-date." : "Watch mode is only available for URL imports. When enabled it automatically updates the API client when the OpenAPI URL content changes.",
|
|
159
155
|
placement: "bottom"
|
|
160
156
|
}, {
|
|
161
|
-
default:
|
|
162
|
-
|
|
163
|
-
modelValue:
|
|
164
|
-
"onUpdate:modelValue":
|
|
165
|
-
disabled: !
|
|
157
|
+
default: p(() => [
|
|
158
|
+
w(ae, {
|
|
159
|
+
modelValue: f.value,
|
|
160
|
+
"onUpdate:modelValue": t[2] || (t[2] = (u) => f.value = u),
|
|
161
|
+
disabled: !y.value
|
|
166
162
|
}, null, 8, ["modelValue", "disabled"])
|
|
167
163
|
]),
|
|
168
164
|
_: 1
|
|
169
165
|
}, 8, ["content"])
|
|
170
166
|
])
|
|
171
167
|
]),
|
|
172
|
-
submit:
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
], 64)) :
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
], 64)) : (
|
|
180
|
-
|
|
168
|
+
submit: p(() => [
|
|
169
|
+
t[6] || (t[6] = c(" Import ")),
|
|
170
|
+
y.value ? (l(), d(v, { key: 0 }, [
|
|
171
|
+
c(" from URL ")
|
|
172
|
+
], 64)) : a.value && S.value ? (l(), d(v, { key: 1 }, [
|
|
173
|
+
a.value.title ? (l(), d(v, { key: 0 }, [
|
|
174
|
+
c(' "' + R(a.value.title) + '" ', 1)
|
|
175
|
+
], 64)) : (l(), d(v, { key: 1 }, [
|
|
176
|
+
c(R(a.value.version), 1)
|
|
181
177
|
], 64))
|
|
182
|
-
], 64)) : (
|
|
183
|
-
|
|
178
|
+
], 64)) : (l(), d(v, { key: 2 }, [
|
|
179
|
+
c(" Collection ")
|
|
184
180
|
], 64))
|
|
185
181
|
]),
|
|
186
|
-
default:
|
|
187
|
-
!
|
|
182
|
+
default: p(() => [
|
|
183
|
+
!a.value || r(h)(o.value) ? (l(), I(oe, {
|
|
188
184
|
key: 0,
|
|
189
|
-
modelValue:
|
|
185
|
+
modelValue: o.value,
|
|
190
186
|
placeholder: "OpenAPI/Swagger/Postman URL or cURL",
|
|
191
|
-
onOnDelete:
|
|
192
|
-
"onUpdate:modelValue":
|
|
193
|
-
}, null, 8, ["modelValue"])) : (
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
187
|
+
onOnDelete: t[0] || (t[0] = (u) => C("back", u)),
|
|
188
|
+
"onUpdate:modelValue": j
|
|
189
|
+
}, null, 8, ["modelValue"])) : (l(), d(v, { key: 1 }, [
|
|
190
|
+
U("div", se, [
|
|
191
|
+
t[4] || (t[4] = U("div", { class: "text-c-2 min-h-8 w-full py-2 pl-12 text-center text-xs" }, " Preview ", -1)),
|
|
192
|
+
w(r(_), {
|
|
197
193
|
class: "hover:bg-b-2 relative ml-auto max-h-8 gap-1.5 p-2 text-xs",
|
|
198
194
|
variant: "ghost",
|
|
199
|
-
onClick:
|
|
195
|
+
onClick: t[1] || (t[1] = (u) => o.value = "")
|
|
200
196
|
}, {
|
|
201
|
-
default:
|
|
202
|
-
|
|
197
|
+
default: p(() => t[3] || (t[3] = [
|
|
198
|
+
c(" Clear ")
|
|
203
199
|
])),
|
|
204
200
|
_: 1,
|
|
205
201
|
__: [3]
|
|
206
202
|
})
|
|
207
203
|
]),
|
|
208
|
-
|
|
204
|
+
a.value && !r(h)(o.value) ? (l(), I(r(G), {
|
|
209
205
|
key: 0,
|
|
210
206
|
class: "bg-b-2 mt-1 max-h-[40dvh] rounded border px-2 py-1 text-sm",
|
|
211
|
-
content:
|
|
207
|
+
content: o.value,
|
|
212
208
|
copy: !1,
|
|
213
|
-
lang:
|
|
214
|
-
}, null, 8, ["content", "lang"])) :
|
|
209
|
+
lang: S.value
|
|
210
|
+
}, null, 8, ["content", "lang"])) : Y("", !0)
|
|
215
211
|
], 64))
|
|
216
212
|
]),
|
|
217
213
|
_: 1
|
|
@@ -219,5 +215,5 @@ const me = { class: "flex justify-between" }, de = { class: "flex w-full flex-ro
|
|
|
219
215
|
}
|
|
220
216
|
});
|
|
221
217
|
export {
|
|
222
|
-
|
|
218
|
+
Pe as default
|
|
223
219
|
};
|