@scalar/api-client 2.23.3 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +8 -0
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +33 -29
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +6 -0
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
- package/dist/v2/blocks/operation-block/components/Header.vue2.js +46 -29
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts +15 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js +125 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue2.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts +5 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +61 -61
- package/dist/v2/components/sidebar/SidebarMenu.vue.js +6 -6
- package/dist/v2/features/app/App.vue.d.ts +5 -0
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +89 -108
- package/dist/v2/features/app/app-state.d.ts +5 -7
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +210 -205
- package/dist/v2/features/app/hooks/use-document-watcher.js +8 -8
- package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Environment.vue.js +12 -11
- package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.js +17 -25
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +115 -118
- package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +14 -4
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +5 -6
- package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts +16 -0
- package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/load-document-from-source.js +34 -0
- package/dist/v2/features/command-palette/index.d.ts +4 -0
- package/dist/v2/features/command-palette/index.d.ts.map +1 -0
- package/dist/v2/features/command-palette/index.js +8 -0
- package/dist/v2/features/environments/EnvironmentsList.vue.d.ts +4 -0
- package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/EnvironmentsList.vue.js +29 -27
- package/dist/v2/features/environments/components/Environment.vue.d.ts +1 -0
- package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.js +37 -24
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js +1 -1
- package/dist/v2/features/modal/Modal.vue2.js +35 -36
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +58 -41
- package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts +18 -0
- package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts.map +1 -0
- package/dist/v2/features/modal/helpers/restore-workspace-state.js +36 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +35 -26
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +7 -0
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +20 -20
- package/dist/v2/features/import-listener/ImportListener.vue.d.ts +0 -52
- package/dist/v2/features/import-listener/ImportListener.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/ImportListener.vue.js +0 -91
- package/dist/v2/features/import-listener/ImportListener.vue2.js +0 -4
- package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts +0 -7
- package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/components/DropEventListener.vue.js +0 -81
- package/dist/v2/features/import-listener/components/DropEventListener.vue2.js +0 -4
- package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts +0 -40
- package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/components/ImportModal.vue.js +0 -170
- package/dist/v2/features/import-listener/components/ImportModal.vue3.js +0 -5
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts +0 -29
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.js +0 -83
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue2.js +0 -4
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts +0 -8
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts.map +0 -1
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.js +0 -4
- package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts +0 -15
- package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts.map +0 -1
- package/dist/v2/features/import-listener/helpers/load-document-from-source.js +0 -28
- package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts +0 -15
- package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts.map +0 -1
- package/dist/v2/features/import-listener/helpers/wait-for-condition.js +0 -16
- package/dist/v2/features/import-listener/index.d.ts +0 -2
- package/dist/v2/features/import-listener/index.d.ts.map +0 -1
- package/dist/v2/features/import-listener/index.js +0 -4
- /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts +0 -0
- /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.js +0 -0
- /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts +0 -0
- /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.js +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
const y = /* @__PURE__ */ i({
|
|
1
|
+
import { defineComponent as u, createBlock as c, openBlock as a, unref as n } from "vue";
|
|
2
|
+
import i from "../../settings/DocumentSettings.vue.js";
|
|
3
|
+
import s from "../../settings/CollectionSettings.vue.js";
|
|
4
|
+
const f = /* @__PURE__ */ u({
|
|
6
5
|
__name: "Settings",
|
|
7
6
|
props: {
|
|
8
7
|
documentSlug: {},
|
|
@@ -20,41 +19,34 @@ const y = /* @__PURE__ */ i({
|
|
|
20
19
|
collectionType: {}
|
|
21
20
|
},
|
|
22
21
|
setup(e) {
|
|
23
|
-
const
|
|
22
|
+
const d = (t) => {
|
|
24
23
|
e.eventBus.emit("document:update:watch-mode", t);
|
|
25
|
-
},
|
|
24
|
+
}, m = (t) => {
|
|
26
25
|
e.eventBus.emit("workspace:update:theme", t);
|
|
27
|
-
},
|
|
26
|
+
}, r = (t) => {
|
|
28
27
|
e.eventBus.emit("workspace:update:active-proxy", t);
|
|
29
|
-
},
|
|
28
|
+
}, l = (t) => {
|
|
30
29
|
e.eventBus.emit("workspace:update:color-mode", t);
|
|
31
|
-
}, l = s(), u = () => {
|
|
32
|
-
e.workspaceStore.deleteDocument(e.documentSlug), l.push({
|
|
33
|
-
name: "workspace.environment",
|
|
34
|
-
params: {
|
|
35
|
-
workspaceSlug: e.activeWorkspace.id
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
30
|
};
|
|
39
|
-
return (t,
|
|
31
|
+
return (t, o) => e.collectionType === "document" ? (a(), c(n(i), {
|
|
40
32
|
key: 0,
|
|
41
33
|
documentUrl: e.document?.["x-scalar-original-source-url"],
|
|
42
34
|
isDraftDocument: e.documentSlug === "drafts",
|
|
43
35
|
title: e.document?.info.title ?? "",
|
|
44
|
-
watchMode: e.document?.["x-scalar-watch-mode"]
|
|
45
|
-
"onDelete:document":
|
|
46
|
-
"onUpdate:watchMode":
|
|
47
|
-
}, null, 8, ["documentUrl", "isDraftDocument", "title", "watchMode"])) : (
|
|
36
|
+
watchMode: e.document?.["x-scalar-watch-mode"],
|
|
37
|
+
"onDelete:document": o[0] || (o[0] = (h) => e.eventBus.emit("document:delete:document", { name: e.documentSlug })),
|
|
38
|
+
"onUpdate:watchMode": d
|
|
39
|
+
}, null, 8, ["documentUrl", "isDraftDocument", "title", "watchMode"])) : (a(), c(n(s), {
|
|
48
40
|
key: 1,
|
|
49
41
|
activeProxyUrl: e.workspaceStore.workspace["x-scalar-active-proxy"],
|
|
50
42
|
activeThemeId: e.workspaceStore.workspace["x-scalar-theme"] ?? "default",
|
|
51
43
|
colorMode: e.workspaceStore.workspace["x-scalar-color-mode"] ?? "system",
|
|
52
|
-
"onUpdate:colorMode":
|
|
53
|
-
"onUpdate:proxyUrl":
|
|
54
|
-
"onUpdate:themeId":
|
|
44
|
+
"onUpdate:colorMode": l,
|
|
45
|
+
"onUpdate:proxyUrl": r,
|
|
46
|
+
"onUpdate:themeId": m
|
|
55
47
|
}, null, 8, ["activeProxyUrl", "activeThemeId", "colorMode"]));
|
|
56
48
|
}
|
|
57
49
|
});
|
|
58
50
|
export {
|
|
59
|
-
|
|
51
|
+
f as default
|
|
60
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteImport.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteImport.vue"],"names":[],"mappings":"AA0UA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAiBvE;;;;;;;;;;;;;;;;;GAiBG;;IAGD,+CAA+C;oBAC/B,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;IAH3B,+CAA+C;oBAC/B,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;AAL7B,wBA2cC"}
|
|
@@ -1,111 +1,108 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLoadingState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { getPostmanDocumentDetails as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
1
|
+
import { defineComponent as E, ref as D, computed as v, watch as O, createBlock as g, openBlock as a, unref as r, withCtx as u, createElementBlock as c, Fragment as m, createElementVNode as b, createCommentVNode as _, createVNode as f, createTextVNode as s, toDisplayString as L } from "vue";
|
|
2
|
+
import { useLoadingState as $, ScalarButton as U, ScalarCodeBlock as j, ScalarIcon as M, ScalarTooltip as z } from "@scalar/components";
|
|
3
|
+
import { isLocalUrl as J } from "@scalar/helpers/url/is-local-url";
|
|
4
|
+
import { useToasts as Y } from "@scalar/use-toasts";
|
|
5
|
+
import { createWorkspaceStore as q } from "@scalar/workspace-store/client";
|
|
6
|
+
import { useRouter as G } from "vue-router";
|
|
7
|
+
import { getOpenApiDocumentDetails as H } from "../helpers/get-openapi-document-details.js";
|
|
8
|
+
import { getPostmanDocumentDetails as K } from "../helpers/get-postman-document-details.js";
|
|
9
|
+
import { importDocumentToWorkspace as Q } from "../helpers/import-document-to-workspace.js";
|
|
10
|
+
import { isPostmanCollection as X } from "../helpers/is-postman-collection.js";
|
|
11
|
+
import { loadDocumentFromSource as Z } from "../helpers/load-document-from-source.js";
|
|
12
|
+
import { isUrl as ee } from "../../../helpers/is-url.js";
|
|
13
|
+
import te from "./CommandActionForm.vue.js";
|
|
14
|
+
import oe from "./CommandActionInput.vue.js";
|
|
15
|
+
import ae from "./WatchModeToggle.vue.js";
|
|
16
|
+
import { useFileDialog as le } from "../../../../hooks/useFileDialog.js";
|
|
17
|
+
const ne = { class: "flex justify-between" }, re = { class: "flex w-full flex-row items-center justify-between gap-3" }, se = {
|
|
17
18
|
name: "CommandPaletteImport"
|
|
18
|
-
},
|
|
19
|
-
...
|
|
19
|
+
}, Ce = /* @__PURE__ */ E({
|
|
20
|
+
...se,
|
|
20
21
|
props: {
|
|
21
22
|
workspaceStore: {},
|
|
22
23
|
eventBus: {}
|
|
23
24
|
},
|
|
24
25
|
emits: ["close", "back"],
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
27
|
-
() =>
|
|
28
|
-
),
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
setup(k, { emit: I }) {
|
|
27
|
+
const x = I, { toast: P } = Y(), V = G(), p = $(), o = D(""), y = D(!1), i = v(() => ee(o.value)), A = v(
|
|
28
|
+
() => i.value && J(o.value)
|
|
29
|
+
), l = v(() => X(o.value) ? K(o.value) : H(o.value)), S = v(
|
|
30
|
+
() => l.value ? l.value.type : "json"
|
|
31
|
+
), R = v(() => !o.value.trim());
|
|
32
|
+
O(A, (t) => {
|
|
33
|
+
y.value = t;
|
|
31
34
|
});
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}), name: u } : (console.error("Failed to generate a unique name"), { success: !1 });
|
|
60
|
-
}, I = (e) => {
|
|
61
|
-
E.push({
|
|
35
|
+
const h = async (t) => {
|
|
36
|
+
console.error(t), P(t, "error"), await p.invalidate(), x("close");
|
|
37
|
+
}, C = async (t) => {
|
|
38
|
+
p.start();
|
|
39
|
+
const e = "drafts", n = q({
|
|
40
|
+
meta: {
|
|
41
|
+
/** Ensure we use the active proxy to fetch documents */
|
|
42
|
+
"x-scalar-active-proxy": k.workspaceStore.workspace["x-scalar-active-proxy"]
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (!await Z(
|
|
46
|
+
n,
|
|
47
|
+
t,
|
|
48
|
+
e,
|
|
49
|
+
y.value
|
|
50
|
+
))
|
|
51
|
+
return h("Failed to import document");
|
|
52
|
+
const d = await Q({
|
|
53
|
+
workspaceStore: k.workspaceStore,
|
|
54
|
+
workspaceState: n.exportWorkspace(),
|
|
55
|
+
name: e
|
|
56
|
+
});
|
|
57
|
+
if (!d.ok)
|
|
58
|
+
return h(d.error);
|
|
59
|
+
await p.validate(), T(d.slug), x("close");
|
|
60
|
+
}, T = (t) => {
|
|
61
|
+
V.push({
|
|
62
62
|
name: "document.overview",
|
|
63
|
-
params: { documentSlug:
|
|
63
|
+
params: { documentSlug: t }
|
|
64
64
|
});
|
|
65
|
-
}, { open:
|
|
66
|
-
onChange: (
|
|
67
|
-
const [
|
|
68
|
-
if (!
|
|
65
|
+
}, { open: B } = le({
|
|
66
|
+
onChange: (t) => {
|
|
67
|
+
const [e] = t ?? [];
|
|
68
|
+
if (!e)
|
|
69
69
|
return;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
p.start();
|
|
71
|
+
const n = async (d) => {
|
|
72
|
+
const W = d.target?.result;
|
|
73
|
+
await C(W);
|
|
74
|
+
}, w = new FileReader();
|
|
75
|
+
w.onload = n, w.readAsText(e);
|
|
75
76
|
},
|
|
76
77
|
multiple: !1,
|
|
77
78
|
accept: ".json,.yaml,.yml"
|
|
78
|
-
}),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
e.success ? (await w.clear(), I(e.name)) : await w.invalidate(), k("close");
|
|
82
|
-
}, W = (e) => {
|
|
83
|
-
if (e.trim().toLowerCase().startsWith("curl"))
|
|
84
|
-
return f.eventBus.emit("ui:open:command-palette", {
|
|
79
|
+
}), F = (t) => {
|
|
80
|
+
if (t.trim().toLowerCase().startsWith("curl"))
|
|
81
|
+
return k.eventBus.emit("ui:open:command-palette", {
|
|
85
82
|
action: "import-curl-command",
|
|
86
83
|
payload: {
|
|
87
|
-
inputValue:
|
|
84
|
+
inputValue: t
|
|
88
85
|
}
|
|
89
86
|
});
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
|
|
87
|
+
o.value = t;
|
|
88
|
+
}, N = (t) => {
|
|
89
|
+
x("back", t);
|
|
93
90
|
};
|
|
94
|
-
return (
|
|
95
|
-
disabled:
|
|
96
|
-
loader:
|
|
97
|
-
onSubmit:
|
|
91
|
+
return (t, e) => (a(), g(te, {
|
|
92
|
+
disabled: R.value,
|
|
93
|
+
loader: r(p),
|
|
94
|
+
onSubmit: e[2] || (e[2] = (n) => C(o.value))
|
|
98
95
|
}, {
|
|
99
|
-
options:
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
options: u(() => [
|
|
97
|
+
b("div", re, [
|
|
98
|
+
f(r(U), {
|
|
102
99
|
class: "hover:bg-b-2 relative max-h-8 gap-1.5 p-2 text-xs",
|
|
103
100
|
variant: "outlined",
|
|
104
|
-
onClick:
|
|
101
|
+
onClick: r(B)
|
|
105
102
|
}, {
|
|
106
|
-
default:
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
default: u(() => [
|
|
104
|
+
e[5] || (e[5] = s(" JSON, or YAML File ", -1)),
|
|
105
|
+
f(r(M), {
|
|
109
106
|
class: "text-c-3",
|
|
110
107
|
icon: "Upload",
|
|
111
108
|
size: "md"
|
|
@@ -113,14 +110,14 @@ const ce = { class: "flex justify-between" }, ue = { class: "flex w-full flex-ro
|
|
|
113
110
|
]),
|
|
114
111
|
_: 1
|
|
115
112
|
}, 8, ["onClick"]),
|
|
116
|
-
|
|
113
|
+
f(r(z), {
|
|
117
114
|
content: i.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.",
|
|
118
115
|
placement: "bottom"
|
|
119
116
|
}, {
|
|
120
|
-
default:
|
|
121
|
-
|
|
117
|
+
default: u(() => [
|
|
118
|
+
f(ae, {
|
|
122
119
|
modelValue: y.value,
|
|
123
|
-
"onUpdate:modelValue":
|
|
120
|
+
"onUpdate:modelValue": e[1] || (e[1] = (n) => y.value = n),
|
|
124
121
|
disabled: !i.value
|
|
125
122
|
}, null, 8, ["modelValue", "disabled"])
|
|
126
123
|
]),
|
|
@@ -128,48 +125,48 @@ const ce = { class: "flex justify-between" }, ue = { class: "flex w-full flex-ro
|
|
|
128
125
|
}, 8, ["content"])
|
|
129
126
|
])
|
|
130
127
|
]),
|
|
131
|
-
submit:
|
|
132
|
-
|
|
133
|
-
i.value ? (
|
|
134
|
-
|
|
135
|
-
], 64)) :
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
], 64)) : (
|
|
139
|
-
|
|
128
|
+
submit: u(() => [
|
|
129
|
+
e[6] || (e[6] = s(" Import ", -1)),
|
|
130
|
+
i.value ? (a(), c(m, { key: 0 }, [
|
|
131
|
+
s("from URL")
|
|
132
|
+
], 64)) : l.value && S.value ? (a(), c(m, { key: 1 }, [
|
|
133
|
+
l.value.title ? (a(), c(m, { key: 0 }, [
|
|
134
|
+
s(' "' + L(l.value.title) + '" ', 1)
|
|
135
|
+
], 64)) : (a(), c(m, { key: 1 }, [
|
|
136
|
+
s(L(l.value.version), 1)
|
|
140
137
|
], 64))
|
|
141
|
-
], 64)) : (
|
|
142
|
-
|
|
138
|
+
], 64)) : (a(), c(m, { key: 2 }, [
|
|
139
|
+
s("Collection")
|
|
143
140
|
], 64))
|
|
144
141
|
]),
|
|
145
|
-
default:
|
|
146
|
-
!
|
|
142
|
+
default: u(() => [
|
|
143
|
+
!l.value || i.value ? (a(), g(oe, {
|
|
147
144
|
key: 0,
|
|
148
|
-
modelValue:
|
|
145
|
+
modelValue: o.value,
|
|
149
146
|
placeholder: "OpenAPI/Swagger/Postman URL or cURL",
|
|
150
|
-
onDelete:
|
|
151
|
-
"onUpdate:modelValue":
|
|
152
|
-
}, null, 8, ["modelValue"])) : (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
onDelete: N,
|
|
148
|
+
"onUpdate:modelValue": F
|
|
149
|
+
}, null, 8, ["modelValue"])) : (a(), c(m, { key: 1 }, [
|
|
150
|
+
b("div", ne, [
|
|
151
|
+
e[4] || (e[4] = b("div", { class: "text-c-2 min-h-8 w-full py-2 pl-12 text-center text-xs" }, " Preview ", -1)),
|
|
152
|
+
f(r(U), {
|
|
156
153
|
class: "hover:bg-b-2 relative ml-auto max-h-8 gap-1.5 p-2 text-xs",
|
|
157
154
|
variant: "ghost",
|
|
158
|
-
onClick:
|
|
155
|
+
onClick: e[0] || (e[0] = (n) => o.value = "")
|
|
159
156
|
}, {
|
|
160
|
-
default:
|
|
161
|
-
|
|
157
|
+
default: u(() => [...e[3] || (e[3] = [
|
|
158
|
+
s(" Clear ", -1)
|
|
162
159
|
])]),
|
|
163
160
|
_: 1
|
|
164
161
|
})
|
|
165
162
|
]),
|
|
166
|
-
|
|
163
|
+
l.value && !i.value ? (a(), g(r(j), {
|
|
167
164
|
key: 0,
|
|
168
165
|
class: "bg-b-2 mt-1 max-h-[40dvh] rounded border px-2 py-1 text-sm",
|
|
169
|
-
content:
|
|
166
|
+
content: o.value,
|
|
170
167
|
copy: !1,
|
|
171
|
-
lang:
|
|
172
|
-
}, null, 8, ["content", "lang"])) :
|
|
168
|
+
lang: S.value
|
|
169
|
+
}, null, 8, ["content", "lang"])) : _("", !0)
|
|
173
170
|
], 64))
|
|
174
171
|
]),
|
|
175
172
|
_: 1
|
|
@@ -177,5 +174,5 @@ const ce = { class: "flex justify-between" }, ue = { class: "flex w-full flex-ro
|
|
|
177
174
|
}
|
|
178
175
|
});
|
|
179
176
|
export {
|
|
180
|
-
|
|
177
|
+
Ce as default
|
|
181
178
|
};
|
package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-unique-slug.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/
|
|
1
|
+
{"version":3,"file":"generate-unique-slug.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/generate-unique-slug.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAAU,cAAc,MAAM,GAAG,SAAS,EAAE,kBAAkB,GAAG,CAAC,MAAM,CAAC,gCAOvG,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
2
1
|
/**
|
|
3
2
|
* Converts a Postman collection JSON string to an OpenAPI specification document.
|
|
4
3
|
*
|
|
@@ -6,8 +5,19 @@ import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
|
6
5
|
* that can be used throughout the application. The convert function handles parsing
|
|
7
6
|
* and transformation internally.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
* due to invalid Postman collection structure
|
|
8
|
+
* Returns null if the conversion fails due to invalid Postman collection structure
|
|
11
9
|
*/
|
|
12
|
-
export declare const getOpenApiFromPostman: (postmanJson: string) =>
|
|
10
|
+
export declare const getOpenApiFromPostman: (postmanJson: string) => (Omit<Omit<import("@scalar/openapi-types").OpenAPIV3.Document<{}>, "components" | "paths">, keyof {
|
|
11
|
+
[customExtension: `x-${string}`]: any;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}> & {
|
|
14
|
+
openapi?: "3.1.0" | "3.1.1" | "3.1.2";
|
|
15
|
+
swagger?: never;
|
|
16
|
+
info?: import("@scalar/openapi-types").OpenAPIV3_1.InfoObject;
|
|
17
|
+
jsonSchemaDialect?: string;
|
|
18
|
+
servers?: import("@scalar/openapi-types").OpenAPIV3_1.ServerObject[];
|
|
19
|
+
} & Pick<import("@scalar/openapi-types").OpenAPIV3_1.PathsWebhooksComponents<{}>, "paths"> & Omit<Partial<import("@scalar/openapi-types").OpenAPIV3_1.PathsWebhooksComponents<{}>>, "paths"> & {
|
|
20
|
+
[customExtension: `x-${string}`]: any;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}) | null;
|
|
13
23
|
//# sourceMappingURL=get-openapi-from-postman.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-openapi-from-postman.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/get-openapi-from-postman.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-openapi-from-postman.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/get-openapi-from-postman.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM;;;;;;;;;;;;SAOxD,CAAA"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { convert as t } from "@scalar/postman-to-openapi";
|
|
2
|
-
const
|
|
2
|
+
const o = (r) => {
|
|
3
3
|
try {
|
|
4
|
-
return t(
|
|
5
|
-
} catch
|
|
6
|
-
|
|
7
|
-
throw new Error(`Failed to convert Postman collection to OpenAPI: ${e}`);
|
|
4
|
+
return t(r);
|
|
5
|
+
} catch {
|
|
6
|
+
return null;
|
|
8
7
|
}
|
|
9
8
|
};
|
|
10
9
|
export {
|
|
11
|
-
|
|
10
|
+
o as getOpenApiFromPostman
|
|
12
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-document-to-workspace.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/
|
|
1
|
+
{"version":3,"file":"import-document-to-workspace.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/import-document-to-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAI3F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,yBAAyB,GAAU,2CAI7C;IACD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,cAAc,EAAE,iBAAiB,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,KAAG,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAwDpE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
/**
|
|
3
|
+
* Attempts to add a document to the workspace from a given source, which may be a URL or raw content.
|
|
4
|
+
*
|
|
5
|
+
* - If the source is a URL, adds the document by its URL and includes a watch mode flag as metadata.
|
|
6
|
+
* - If the source is a Postman collection, transforms it to OpenAPI and adds it as a document.
|
|
7
|
+
* - For other raw sources (such as pasted JSON or YAML), attempts to normalize and add them as a document.
|
|
8
|
+
*
|
|
9
|
+
* @param workspaceStore The workspace store where the document will be added.
|
|
10
|
+
* @param source The document source (URL, Postman Collection, JSON, or YAML string).
|
|
11
|
+
* @param name The display name for the new document.
|
|
12
|
+
* @param watchMode Whether to enable watch mode (applies only to URL sources).
|
|
13
|
+
* @returns Promise resolving to true if the document was successfully added, or false if the operation failed.
|
|
14
|
+
*/
|
|
15
|
+
export declare const loadDocumentFromSource: (workspaceStore: WorkspaceStore, source: string | null, name: string, watchMode: boolean) => Promise<boolean>;
|
|
16
|
+
//# sourceMappingURL=load-document-from-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-document-from-source.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/load-document-from-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAMpE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,GACjC,gBAAgB,cAAc,EAC9B,QAAQ,MAAM,GAAG,IAAI,EACrB,MAAM,MAAM,EACZ,WAAW,OAAO,KACjB,OAAO,CAAC,OAAO,CAiDjB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { normalize as i } from "@scalar/openapi-parser";
|
|
2
|
+
import { getOpenApiFromPostman as l } from "./get-openapi-from-postman.js";
|
|
3
|
+
import { isPostmanCollection as u } from "./is-postman-collection.js";
|
|
4
|
+
import { isUrl as d } from "../../../helpers/is-url.js";
|
|
5
|
+
const C = async (r, t, o, m) => {
|
|
6
|
+
if (!t)
|
|
7
|
+
return !1;
|
|
8
|
+
if (d(t))
|
|
9
|
+
return await r.addDocument({
|
|
10
|
+
name: o,
|
|
11
|
+
url: t,
|
|
12
|
+
meta: {
|
|
13
|
+
"x-scalar-watch-mode": m
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
if (u(t)) {
|
|
17
|
+
const n = l(t);
|
|
18
|
+
return n === null ? !1 : await r.addDocument({ name: o, document: n });
|
|
19
|
+
}
|
|
20
|
+
const e = ((n) => {
|
|
21
|
+
try {
|
|
22
|
+
return i(n);
|
|
23
|
+
} catch (a) {
|
|
24
|
+
return console.error(a), null;
|
|
25
|
+
}
|
|
26
|
+
})(t);
|
|
27
|
+
return e === null ? !1 : await r.addDocument({
|
|
28
|
+
name: o,
|
|
29
|
+
document: e
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
C as loadDocumentFromSource
|
|
34
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { importDocumentToWorkspace } from './helpers/import-document-to-workspace.js';
|
|
2
|
+
export { loadDocumentFromSource } from './helpers/load-document-from-source.js';
|
|
3
|
+
export { default as TheCommandPalette } from './TheCommandPalette.vue.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/command-palette/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { importDocumentToWorkspace as r } from "./helpers/import-document-to-workspace.js";
|
|
2
|
+
import { loadDocumentFromSource as t } from "./helpers/load-document-from-source.js";
|
|
3
|
+
import { default as p } from "./TheCommandPalette.vue.js";
|
|
4
|
+
export {
|
|
5
|
+
p as TheCommandPalette,
|
|
6
|
+
r as importDocumentToWorkspace,
|
|
7
|
+
t as loadDocumentFromSource
|
|
8
|
+
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { CollectionType, WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
2
2
|
import type { XScalarEnvironments } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
|
|
3
3
|
type __VLS_Props = {
|
|
4
|
+
/** List of environments, ensured to be non-nullable for safety */
|
|
4
5
|
environments: NonNullable<XScalarEnvironments['x-scalar-environments']>;
|
|
6
|
+
/** Event bus to handle workspace-related events */
|
|
5
7
|
eventBus: WorkspaceEventBus;
|
|
8
|
+
/** The currently active environment name */
|
|
9
|
+
activeEnvironment?: string;
|
|
6
10
|
} & CollectionType;
|
|
7
11
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
12
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentsList.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/environments/EnvironmentsList.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EnvironmentsList.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/environments/EnvironmentsList.vue"],"names":[],"mappings":"AAoGA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2EAA2E,CAAA;AAQpH,KAAK,WAAW,GAAG;IACb,kEAAkE;IAClE,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC,CAAA;IACvE,mDAAmD;IACnD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,4CAA4C;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,GAAG,cAAc,CAAC;;AAuLvB,wBAMG"}
|