@scalar/api-client 2.2.54 → 2.2.55
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 +18 -0
- package/dist/components/CommandPalette/CommandActionForm.vue.d.ts +1 -1
- package/dist/components/CommandPalette/CommandActionForm.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandActionForm.vue.js +15 -14
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +121 -106
- package/dist/components/{ImportCurl/ImportCurlModal.vue.d.ts → CommandPalette/CommandPaletteImportCurl.vue.d.ts} +9 -17
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue.d.ts.map +1 -0
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue.js +7 -0
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue2.js +141 -0
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +98 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +2 -2
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +128 -113
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
- package/dist/components/OpenApiClientButton.vue.d.ts.map +1 -1
- package/dist/components/OpenApiClientButton.vue.js +2 -2
- package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
- package/dist/components/TopNav/TopNav.vue.js +122 -94
- package/dist/components/TopNav/TopNavItem.vue.d.ts +1 -0
- package/dist/components/TopNav/TopNavItem.vue.d.ts.map +1 -1
- package/dist/components/TopNav/TopNavItem.vue.js +1 -1
- package/dist/components/TopNav/TopNavItem.vue2.js +49 -42
- package/dist/layouts/App/create-api-client-app.d.ts +12 -12
- package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
- package/dist/layouts/Modal/create-api-client-modal.d.ts +24 -24
- package/dist/layouts/Web/create-api-client-web.d.ts +12 -12
- package/dist/libs/create-client.d.ts +12 -12
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +91 -115
- package/dist/libs/get-request-uid-by-path-method.d.ts +7 -0
- package/dist/libs/get-request-uid-by-path-method.d.ts.map +1 -0
- package/dist/libs/get-request-uid-by-path-method.js +10 -0
- package/dist/libs/get-request-uid-by-path-method.test.d.ts +2 -0
- package/dist/libs/get-request-uid-by-path-method.test.d.ts.map +1 -0
- package/dist/libs/send-request/create-fetch-body.d.ts +1 -1
- package/dist/libs/validate-parameters.d.ts +6 -0
- package/dist/libs/validate-parameters.d.ts.map +1 -0
- package/dist/libs/validate-parameters.js +12 -0
- package/dist/libs/validate-parameters.test.d.ts +2 -0
- package/dist/libs/validate-parameters.test.d.ts.map +1 -0
- package/dist/store/cookies.d.ts +4 -4
- package/dist/store/request-example.d.ts +4 -4
- package/dist/store/requests.d.ts +4 -4
- package/dist/store/store.d.ts +12 -12
- package/dist/style.css +1 -1
- package/dist/views/Request/Request.vue.d.ts +6 -3
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +2 -2
- package/dist/views/Request/Request.vue2.js +96 -145
- package/dist/views/Request/RequestRoot.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestRoot.vue.js +2 -2
- package/dist/views/Request/RequestRoot.vue2.js +68 -57
- package/dist/views/Request/RequestSection/RequestParams.vue.d.ts +1 -0
- package/dist/views/Request/RequestSection/RequestParams.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestParams.vue.js +34 -31
- package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts +1 -0
- package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +35 -33
- package/dist/views/Request/RequestSection/RequestSection.vue.d.ts +1 -0
- package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +59 -54
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts +1 -0
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestTable.vue2.js +29 -27
- package/dist/views/Request/RequestSidebar.vue.js +2 -2
- package/dist/views/Request/RequestSidebar.vue2.js +23 -23
- package/dist/views/Request/RequestSubpageHeader.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSubpageHeader.vue.js +2 -2
- package/dist/views/Request/RequestSubpageHeader.vue2.js +4 -4
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/libs/request.js +1 -2
- package/package.json +13 -13
- package/dist/components/ImportCurl/ImportCurlModal.vue.d.ts.map +0 -1
- package/dist/components/ImportCurl/ImportCurlModal.vue.js +0 -7
- package/dist/components/ImportCurl/ImportCurlModal.vue2.js +0 -125
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 2.2.55
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d078633: fix: updates top nav icon logic
|
|
8
|
+
- 0d4520f: fix(themes): improve how we handle zoomed in screens
|
|
9
|
+
- 98323b8: feat: adds command palette import curl
|
|
10
|
+
- eb3bb7f: fix: sets error cue on invalid param request
|
|
11
|
+
- ea19156: fix: routing to the api client modal
|
|
12
|
+
- Updated dependencies [0d4520f]
|
|
13
|
+
- @scalar/components@0.13.28
|
|
14
|
+
- @scalar/use-hooks@0.1.25
|
|
15
|
+
- @scalar/themes@0.9.71
|
|
16
|
+
- @scalar/use-codemirror@0.11.73
|
|
17
|
+
- @scalar/oas-utils@0.2.110
|
|
18
|
+
- @scalar/import@0.2.30
|
|
19
|
+
- @scalar/postman-to-openapi@0.1.33
|
|
20
|
+
|
|
3
21
|
## 2.2.54
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandActionForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandActionForm.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommandActionForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandActionForm.vue"],"names":[],"mappings":"AA4CA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAA;AAI3B,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAC;AAmBF,iBAAS,cAAc;WAmET,OAAO,IAA6B;;yBAVrB,GAAG;yBACH,GAAG;wBACJ,GAAG;;;;EAa9B;AAWD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;8FAQnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAUpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarButton as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as a, openBlock as d, createElementBlock as r, withKeys as m, withModifiers as l, createElementVNode as t, normalizeProps as p, guardReactiveProps as f, unref as n, renderSlot as s, createVNode as u, withCtx as x, createTextVNode as b } from "vue";
|
|
2
|
+
import { useBindCx as c, ScalarButton as g } from "@scalar/components";
|
|
3
|
+
const v = { class: "flex gap-2" }, w = { class: "flex max-h-8 flex-1" }, h = /* @__PURE__ */ a({
|
|
4
4
|
__name: "CommandActionForm",
|
|
5
5
|
props: {
|
|
6
6
|
loading: {},
|
|
7
7
|
disabled: { type: Boolean, default: !1 }
|
|
8
8
|
},
|
|
9
9
|
emits: ["submit", "cancel", "back"],
|
|
10
|
-
setup(
|
|
11
|
-
|
|
10
|
+
setup(B) {
|
|
11
|
+
const { cx: i } = c();
|
|
12
|
+
return (e, o) => (d(), r("form", {
|
|
12
13
|
class: "flex w-full flex-col gap-3",
|
|
13
|
-
onKeydown:
|
|
14
|
+
onKeydown: o[0] || (o[0] = m(l(() => {
|
|
14
15
|
}, ["stop"]), ["enter"])),
|
|
15
|
-
onSubmit:
|
|
16
|
+
onSubmit: o[1] || (o[1] = l((C) => e.$emit("submit"), ["prevent", "stop"]))
|
|
16
17
|
}, [
|
|
17
|
-
|
|
18
|
+
t("div", p(f(n(i)("relative flex min-h-20 flex-col rounded"))), [
|
|
18
19
|
s(e.$slots, "default")
|
|
19
|
-
]),
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
], 16),
|
|
21
|
+
t("div", v, [
|
|
22
|
+
t("div", w, [
|
|
22
23
|
s(e.$slots, "options")
|
|
23
24
|
]),
|
|
24
|
-
|
|
25
|
+
u(n(g), {
|
|
25
26
|
class: "max-h-8 p-0 px-3 text-xs",
|
|
26
27
|
disabled: e.disabled,
|
|
27
28
|
loading: e.loading,
|
|
28
29
|
type: "submit"
|
|
29
30
|
}, {
|
|
30
|
-
default:
|
|
31
|
+
default: x(() => [
|
|
31
32
|
s(e.$slots, "submit", {}, () => [
|
|
32
|
-
|
|
33
|
+
o[2] || (o[2] = b("Continue"))
|
|
33
34
|
])
|
|
34
35
|
]),
|
|
35
36
|
_: 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;AA+vBA,wBAOG"}
|
|
@@ -1,94 +1,95 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLoadingState as
|
|
3
|
-
import { useToasts as
|
|
4
|
-
import { useRouter as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
import { defineComponent as G, ref as R, computed as k, watch as D, openBlock as n, createBlock as S, unref as s, withCtx as v, createElementVNode as w, createVNode as C, createTextVNode as f, createElementBlock as u, Fragment as g, toDisplayString as V, createCommentVNode as H } from "vue";
|
|
2
|
+
import { useLoadingState as K, ScalarButton as T, ScalarIcon as Q, ScalarTooltip as X, ScalarCodeBlock as Z } from "@scalar/components";
|
|
3
|
+
import { useToasts as ee } from "@scalar/use-toasts";
|
|
4
|
+
import { useRouter as te } from "vue-router";
|
|
5
|
+
import { importCurlCommand as oe } from "../../libs/importers/curl.js";
|
|
6
|
+
import { useActiveEntities as ae } from "../../store/active-entities.js";
|
|
7
|
+
import le from "./CommandActionForm.vue.js";
|
|
8
|
+
import ne from "./CommandActionInput.vue.js";
|
|
9
|
+
import re from "./WatchModeToggle.vue.js";
|
|
10
|
+
import { isPostmanCollection as _, getPostmanDocumentDetails as ie, convertPostmanToOpenApi as F } from "../../libs/postman.js";
|
|
11
|
+
import { getOpenApiDocumentDetails as se } from "../../libs/getOpenApiDocumentDetails.js";
|
|
12
|
+
import { isUrl as U } from "../../libs/isUrl.js";
|
|
13
|
+
import { useFileDialog as ce } from "../../hooks/useFileDialog.js";
|
|
13
14
|
import { PathId as M } from "../../routes.js";
|
|
14
|
-
import { useWorkspace as
|
|
15
|
-
const
|
|
15
|
+
import { useWorkspace as ue } from "../../store/store.js";
|
|
16
|
+
const me = { class: "flex justify-between" }, de = { class: "flex w-full flex-row items-center justify-between gap-3" }, pe = { class: "w-content bg-b-1 text-xxs text-c-1 pointer-events-none z-10 grid max-w-[320px] gap-1.5 rounded p-2 leading-5 shadow-lg" }, ve = { class: "text-c-2 flex items-center" }, fe = {
|
|
16
17
|
key: 0,
|
|
17
18
|
class: "text-pretty"
|
|
18
|
-
},
|
|
19
|
+
}, ge = {
|
|
19
20
|
key: 1,
|
|
20
21
|
class: "text-pretty"
|
|
21
|
-
},
|
|
22
|
+
}, De = /* @__PURE__ */ G({
|
|
22
23
|
__name: "CommandPaletteImport",
|
|
23
24
|
emits: ["close", "back"],
|
|
24
|
-
setup(
|
|
25
|
-
const
|
|
26
|
-
() =>
|
|
25
|
+
setup(ye, { emit: N }) {
|
|
26
|
+
const P = N, $ = te(), { activeWorkspace: m, activeCollection: B } = ae(), { importSpecFile: b, importSpecFromUrl: W, events: j } = ue(), { toast: d } = ee(), p = K(), a = R(""), y = R(!0), i = k(() => _(a.value) ? ie(a.value) : se(a.value)), A = k(
|
|
27
|
+
() => i.value ? i.value.type : "json"
|
|
27
28
|
);
|
|
28
|
-
function x(
|
|
29
|
+
function x(t) {
|
|
29
30
|
var e;
|
|
30
|
-
|
|
31
|
+
t && $.push({
|
|
31
32
|
name: "collection",
|
|
32
33
|
params: {
|
|
33
34
|
[M.Workspace]: (e = m.value) == null ? void 0 : e.uid,
|
|
34
|
-
[M.Collection]:
|
|
35
|
+
[M.Collection]: t.uid
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
|
-
const h =
|
|
39
|
-
onChange: async (
|
|
40
|
-
const e =
|
|
39
|
+
const h = k(() => U(a.value)), z = k(() => !!i.value), { open: E } = ce({
|
|
40
|
+
onChange: async (t) => {
|
|
41
|
+
const e = t == null ? void 0 : t[0];
|
|
41
42
|
if (e) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
const
|
|
43
|
+
const r = new FileReader();
|
|
44
|
+
r.onload = async (I) => {
|
|
45
|
+
var c, L, O;
|
|
46
|
+
const o = (c = I.target) == null ? void 0 : c.result;
|
|
46
47
|
try {
|
|
47
|
-
if (_(
|
|
48
|
-
const
|
|
49
|
-
await F(
|
|
50
|
-
((
|
|
48
|
+
if (_(o)) {
|
|
49
|
+
const l = await b(
|
|
50
|
+
await F(o),
|
|
51
|
+
((L = m.value) == null ? void 0 : L.uid) ?? ""
|
|
51
52
|
);
|
|
52
|
-
x(
|
|
53
|
+
x(l == null ? void 0 : l.collection);
|
|
53
54
|
} else {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
((
|
|
55
|
+
const l = await b(
|
|
56
|
+
o,
|
|
57
|
+
((O = m.value) == null ? void 0 : O.uid) ?? ""
|
|
57
58
|
);
|
|
58
|
-
x(
|
|
59
|
+
x(l == null ? void 0 : l.collection);
|
|
59
60
|
}
|
|
60
|
-
d("Import successful", "info"),
|
|
61
|
-
} catch (
|
|
62
|
-
console.error(
|
|
63
|
-
const
|
|
64
|
-
d(`Import failed: ${
|
|
61
|
+
d("Import successful", "info"), P("close");
|
|
62
|
+
} catch (l) {
|
|
63
|
+
console.error(l);
|
|
64
|
+
const q = (l == null ? void 0 : l.message) || "Unknown error";
|
|
65
|
+
d(`Import failed: ${q}`, "error");
|
|
65
66
|
}
|
|
66
|
-
},
|
|
67
|
+
}, r.readAsText(e);
|
|
67
68
|
}
|
|
68
69
|
},
|
|
69
70
|
multiple: !1,
|
|
70
71
|
accept: ".json,.yaml,.yml"
|
|
71
72
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}),
|
|
75
|
-
|
|
73
|
+
D(h, (t) => {
|
|
74
|
+
t || (y.value = !1);
|
|
75
|
+
}), D(a, (t) => {
|
|
76
|
+
U(t) || (y.value = !1);
|
|
76
77
|
});
|
|
77
|
-
async function
|
|
78
|
-
var
|
|
79
|
-
if (!(!
|
|
78
|
+
async function J() {
|
|
79
|
+
var t, e, r, I;
|
|
80
|
+
if (!(!a.value || p.isLoading)) {
|
|
80
81
|
p.startLoading();
|
|
81
82
|
try {
|
|
82
83
|
if (h.value) {
|
|
83
|
-
const [
|
|
84
|
-
|
|
85
|
-
((
|
|
84
|
+
const [o, c] = await W(
|
|
85
|
+
a.value,
|
|
86
|
+
((t = m.value) == null ? void 0 : t.uid) ?? "",
|
|
86
87
|
{
|
|
87
88
|
proxyUrl: (e = m.value) == null ? void 0 : e.proxyUrl,
|
|
88
89
|
watchMode: y.value
|
|
89
90
|
}
|
|
90
91
|
);
|
|
91
|
-
if (x(
|
|
92
|
+
if (x(c == null ? void 0 : c.collection), o) {
|
|
92
93
|
d(
|
|
93
94
|
"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.",
|
|
94
95
|
"error",
|
|
@@ -96,47 +97,61 @@ const re = { class: "flex justify-between" }, se = { class: "flex w-full flex-ro
|
|
|
96
97
|
), p.invalidate(2e3, !0);
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
99
|
-
} else if (
|
|
100
|
-
if (_(
|
|
101
|
-
const
|
|
102
|
-
await F(
|
|
103
|
-
((
|
|
100
|
+
} else if (z.value)
|
|
101
|
+
if (_(a.value)) {
|
|
102
|
+
const o = await b(
|
|
103
|
+
await F(a.value),
|
|
104
|
+
((r = m.value) == null ? void 0 : r.uid) ?? ""
|
|
104
105
|
);
|
|
105
|
-
x(
|
|
106
|
+
x(o == null ? void 0 : o.collection), d("Successfully converted Postman collection", "info");
|
|
106
107
|
} else {
|
|
107
|
-
const
|
|
108
|
-
|
|
108
|
+
const o = await b(
|
|
109
|
+
a.value,
|
|
109
110
|
((I = m.value) == null ? void 0 : I.uid) ?? ""
|
|
110
111
|
);
|
|
111
|
-
x(
|
|
112
|
+
x(o == null ? void 0 : o.collection);
|
|
112
113
|
}
|
|
113
114
|
else {
|
|
114
115
|
d("Import failed: Invalid URL or OpenAPI document", "error"), p.invalidate(2e3, !0);
|
|
115
116
|
return;
|
|
116
117
|
}
|
|
117
|
-
p.clear(),
|
|
118
|
-
} catch (
|
|
119
|
-
console.error("[importCollection]",
|
|
120
|
-
const
|
|
121
|
-
p.invalidate(2e3, !0), d(`Import failed: ${
|
|
118
|
+
p.clear(), P("close"), d("Import successful", "info");
|
|
119
|
+
} catch (o) {
|
|
120
|
+
console.error("[importCollection]", o);
|
|
121
|
+
const c = (o == null ? void 0 : o.message) || "Unknown error";
|
|
122
|
+
p.invalidate(2e3, !0), d(`Import failed: ${c}`, "error");
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
const Y = (t) => {
|
|
127
|
+
var e;
|
|
128
|
+
if (t.trim().toLowerCase().startsWith("curl")) {
|
|
129
|
+
j.commandPalette.emit({
|
|
130
|
+
commandName: "Import from cURL",
|
|
131
|
+
metaData: {
|
|
132
|
+
parsedCurl: oe(t),
|
|
133
|
+
collectionUid: (e = B.value) == null ? void 0 : e.uid
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
a.value = t;
|
|
139
|
+
};
|
|
140
|
+
return (t, e) => (n(), S(le, {
|
|
141
|
+
disabled: !a.value.trim(),
|
|
127
142
|
loading: s(p),
|
|
128
|
-
onSubmit:
|
|
143
|
+
onSubmit: J
|
|
129
144
|
}, {
|
|
130
145
|
options: v(() => [
|
|
131
|
-
w("div",
|
|
132
|
-
|
|
146
|
+
w("div", de, [
|
|
147
|
+
C(s(T), {
|
|
133
148
|
class: "hover:bg-b-2 relative max-h-8 gap-1.5 p-2 text-xs",
|
|
134
149
|
variant: "outlined",
|
|
135
|
-
onClick: s(
|
|
150
|
+
onClick: s(E)
|
|
136
151
|
}, {
|
|
137
152
|
default: v(() => [
|
|
138
|
-
e[
|
|
139
|
-
|
|
153
|
+
e[5] || (e[5] = f(" JSON, or YAML File ")),
|
|
154
|
+
C(s(Q), {
|
|
140
155
|
class: "text-c-3",
|
|
141
156
|
icon: "UploadSimple",
|
|
142
157
|
size: "md"
|
|
@@ -144,23 +159,23 @@ const re = { class: "flex justify-between" }, se = { class: "flex w-full flex-ro
|
|
|
144
159
|
]),
|
|
145
160
|
_: 1
|
|
146
161
|
}, 8, ["onClick"]),
|
|
147
|
-
|
|
162
|
+
C(s(X), {
|
|
148
163
|
as: "div",
|
|
149
164
|
class: "z-[10001]",
|
|
150
165
|
side: "bottom",
|
|
151
166
|
sideOffset: 5
|
|
152
167
|
}, {
|
|
153
168
|
trigger: v(() => [
|
|
154
|
-
|
|
169
|
+
C(re, {
|
|
155
170
|
modelValue: y.value,
|
|
156
|
-
"onUpdate:modelValue": e[
|
|
171
|
+
"onUpdate:modelValue": e[2] || (e[2] = (r) => y.value = r),
|
|
157
172
|
disabled: !h.value
|
|
158
173
|
}, null, 8, ["modelValue", "disabled"])
|
|
159
174
|
]),
|
|
160
175
|
content: v(() => [
|
|
161
|
-
w("div",
|
|
162
|
-
w("div",
|
|
163
|
-
h.value ? (
|
|
176
|
+
w("div", pe, [
|
|
177
|
+
w("div", ve, [
|
|
178
|
+
h.value ? (n(), u("span", fe, " Automatically updates the API client when the OpenAPI URL content changes, ensuring your client remains up-to-date. ")) : (n(), u("span", ge, " Watch Mode is only available for URL imports. It automatically updates the API client when the OpenAPI URL content changes. "))
|
|
164
179
|
])
|
|
165
180
|
])
|
|
166
181
|
]),
|
|
@@ -169,47 +184,47 @@ const re = { class: "flex justify-between" }, se = { class: "flex w-full flex-ro
|
|
|
169
184
|
])
|
|
170
185
|
]),
|
|
171
186
|
submit: v(() => [
|
|
172
|
-
e[
|
|
173
|
-
h.value ? (
|
|
187
|
+
e[6] || (e[6] = f(" Import ")),
|
|
188
|
+
h.value ? (n(), u(g, { key: 0 }, [
|
|
174
189
|
f(" from URL ")
|
|
175
|
-
], 64)) :
|
|
176
|
-
|
|
177
|
-
f(' "' + V(
|
|
178
|
-
], 64)) : (
|
|
179
|
-
f(V(
|
|
190
|
+
], 64)) : i.value && A.value ? (n(), u(g, { key: 1 }, [
|
|
191
|
+
i.value.title ? (n(), u(g, { key: 0 }, [
|
|
192
|
+
f(' "' + V(i.value.title) + '" ', 1)
|
|
193
|
+
], 64)) : (n(), u(g, { key: 1 }, [
|
|
194
|
+
f(V(i.value.version), 1)
|
|
180
195
|
], 64))
|
|
181
|
-
], 64)) : (
|
|
196
|
+
], 64)) : (n(), u(g, { key: 2 }, [
|
|
182
197
|
f(" Collection ")
|
|
183
198
|
], 64))
|
|
184
199
|
]),
|
|
185
200
|
default: v(() => [
|
|
186
|
-
!
|
|
201
|
+
!i.value || s(U)(a.value) ? (n(), S(ne, {
|
|
187
202
|
key: 0,
|
|
188
|
-
modelValue:
|
|
189
|
-
"onUpdate:modelValue":
|
|
190
|
-
placeholder: "OpenAPI/Swagger/Postman URL or
|
|
191
|
-
onOnDelete: e[
|
|
192
|
-
}, null, 8, ["modelValue"])) : (
|
|
193
|
-
w("div",
|
|
194
|
-
e[
|
|
195
|
-
|
|
203
|
+
modelValue: a.value,
|
|
204
|
+
"onUpdate:modelValue": Y,
|
|
205
|
+
placeholder: "OpenAPI/Swagger/Postman URL or cURL",
|
|
206
|
+
onOnDelete: e[0] || (e[0] = (r) => P("back", r))
|
|
207
|
+
}, null, 8, ["modelValue"])) : (n(), u(g, { key: 1 }, [
|
|
208
|
+
w("div", me, [
|
|
209
|
+
e[4] || (e[4] = w("div", { class: "text-c-2 min-h-8 py-2 pl-8 text-xs" }, "Preview", -1)),
|
|
210
|
+
C(s(T), {
|
|
196
211
|
class: "hover:bg-b-2 relative ml-auto max-h-8 gap-1.5 p-2 text-xs",
|
|
197
212
|
variant: "ghost",
|
|
198
|
-
onClick: e[
|
|
213
|
+
onClick: e[1] || (e[1] = (r) => a.value = "")
|
|
199
214
|
}, {
|
|
200
|
-
default: v(() => e[
|
|
215
|
+
default: v(() => e[3] || (e[3] = [
|
|
201
216
|
f(" Clear ")
|
|
202
217
|
])),
|
|
203
218
|
_: 1
|
|
204
219
|
})
|
|
205
220
|
]),
|
|
206
|
-
|
|
221
|
+
i.value && !s(U)(a.value) ? (n(), S(s(Z), {
|
|
207
222
|
key: 0,
|
|
208
223
|
class: "bg-b-2 mt-1 max-h-[40dvh] rounded border [--scalar-small:--scalar-font-size-4]",
|
|
209
|
-
content:
|
|
224
|
+
content: a.value,
|
|
210
225
|
copy: !1,
|
|
211
226
|
lang: A.value
|
|
212
|
-
}, null, 8, ["content", "lang"])) :
|
|
227
|
+
}, null, 8, ["content", "lang"])) : H("", !0)
|
|
213
228
|
], 64))
|
|
214
229
|
]),
|
|
215
230
|
_: 1
|
|
@@ -217,5 +232,5 @@ const re = { class: "flex justify-between" }, se = { class: "flex w-full flex-ro
|
|
|
217
232
|
}
|
|
218
233
|
});
|
|
219
234
|
export {
|
|
220
|
-
|
|
235
|
+
De as default
|
|
221
236
|
};
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import type { RequestPayload } from '@scalar/oas-utils/entities/spec';
|
|
2
|
+
type ExtendedRequestPayload = RequestPayload & {
|
|
3
|
+
url?: string;
|
|
4
|
+
};
|
|
2
5
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
show: () => void;
|
|
7
|
-
hide: () => void;
|
|
6
|
+
metaData: {
|
|
7
|
+
parsedCurl: ExtendedRequestPayload;
|
|
8
|
+
collectionUid: string;
|
|
8
9
|
};
|
|
9
|
-
collectionUid: string;
|
|
10
10
|
};
|
|
11
11
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
12
12
|
close: () => any;
|
|
13
|
-
|
|
14
|
-
parsedCurl: RequestPayload;
|
|
15
|
-
requestName: string;
|
|
16
|
-
collectionUid: string;
|
|
17
|
-
}) => any;
|
|
13
|
+
back: (e: KeyboardEvent) => any;
|
|
18
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
15
|
onClose?: () => any;
|
|
20
|
-
|
|
21
|
-
parsedCurl: RequestPayload;
|
|
22
|
-
requestName: string;
|
|
23
|
-
collectionUid: string;
|
|
24
|
-
}) => any;
|
|
16
|
+
onBack?: (e: KeyboardEvent) => any;
|
|
25
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
18
|
export default _default;
|
|
27
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=CommandPaletteImportCurl.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPaletteImportCurl.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImportCurl.vue"],"names":[],"mappings":"AAiMA,OAAO,KAAK,EAEV,cAAc,EACf,MAAM,iCAAiC,CAAA;AAaxC,KAAK,sBAAsB,GAAG,cAAc,GAAG;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE;QACR,UAAU,EAAE,sBAAsB,CAAA;QAClC,aAAa,EAAE,MAAM,CAAA;KACtB,CAAA;CACF,CAAC;;;;;;;;AAqQF,wBAOG"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { defineComponent as N, ref as I, computed as A, openBlock as G, createElementBlock as H, Fragment as T, createElementVNode as r, createVNode as n, withCtx as d, unref as f, normalizeClass as X, toDisplayString as v } from "vue";
|
|
2
|
+
import { ScalarListbox as $, ScalarButton as J, ScalarIcon as K } from "@scalar/components";
|
|
3
|
+
import { REGEX as Q } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { useRouter as Y } from "vue-router";
|
|
5
|
+
import Z from "./CommandActionForm.vue.js";
|
|
6
|
+
import _ from "../HttpMethod/HttpMethod.vue.js";
|
|
7
|
+
import { useActiveEntities as ee } from "../../store/active-entities.js";
|
|
8
|
+
import { PathId as C } from "../../routes.js";
|
|
9
|
+
import { useWorkspace as te } from "../../store/store.js";
|
|
10
|
+
const ae = { class: "flex h-9 flex-row items-center gap-2 rounded border p-[3px] text-sm" }, le = { class: "flex h-full" }, re = { class: "scroll-timeline-x whitespace-nowrap" }, se = { class: "flex" }, ve = /* @__PURE__ */ N({
|
|
11
|
+
__name: "CommandPaletteImportCurl",
|
|
12
|
+
props: {
|
|
13
|
+
metaData: {}
|
|
14
|
+
},
|
|
15
|
+
emits: ["close", "back"],
|
|
16
|
+
setup(a, { emit: B }) {
|
|
17
|
+
const V = B, O = te(), { activeWorkspaceCollections: h, activeCollection: W, activeWorkspace: D } = ee(), { requestMutators: L, serverMutators: M, servers: P } = O, c = I(""), j = Y(), p = A(
|
|
18
|
+
() => h.value.map((t) => {
|
|
19
|
+
var e;
|
|
20
|
+
return {
|
|
21
|
+
id: t.uid,
|
|
22
|
+
label: ((e = t.info) == null ? void 0 : e.title) ?? "Unititled Collection"
|
|
23
|
+
};
|
|
24
|
+
})
|
|
25
|
+
), s = I(
|
|
26
|
+
a.metaData.collectionUid ? p.value.find(
|
|
27
|
+
(t) => t.id === a.metaData.collectionUid
|
|
28
|
+
) : p.value.find(
|
|
29
|
+
(t) => {
|
|
30
|
+
var e;
|
|
31
|
+
return t.id === ((e = W.value) == null ? void 0 : e.uid);
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
function z({ collectionUid: t }) {
|
|
36
|
+
var i, u, b, w, k, S, q, R, U, g;
|
|
37
|
+
if (!a.metaData.parsedCurl) return;
|
|
38
|
+
const e = h.value.find(
|
|
39
|
+
(m) => m.uid === t
|
|
40
|
+
);
|
|
41
|
+
if (!e) return;
|
|
42
|
+
const l = ((i = e == null ? void 0 : e.info) == null ? void 0 : i.title) === "Drafts";
|
|
43
|
+
if (!l && a.metaData.parsedCurl.servers) {
|
|
44
|
+
const m = Object.values(P).find(
|
|
45
|
+
(F) => {
|
|
46
|
+
var y, E;
|
|
47
|
+
return F.url === ((E = (y = a.metaData.parsedCurl) == null ? void 0 : y.servers) == null ? void 0 : E[0]);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
m ? c.value = m.uid : c.value = M.add(
|
|
51
|
+
{ url: a.metaData.parsedCurl.servers[0] ?? "/" },
|
|
52
|
+
e.uid
|
|
53
|
+
).uid;
|
|
54
|
+
}
|
|
55
|
+
const o = L.add(
|
|
56
|
+
{
|
|
57
|
+
summary: l ? (b = (u = a.metaData.parsedCurl) == null ? void 0 : u.url) == null ? void 0 : b.replace(Q.PROTOCOL, "") : (w = a.metaData.parsedCurl) == null ? void 0 : w.path,
|
|
58
|
+
path: l ? (k = a.metaData.parsedCurl) == null ? void 0 : k.url : (S = a.metaData.parsedCurl) == null ? void 0 : S.path,
|
|
59
|
+
method: (q = a.metaData.parsedCurl) == null ? void 0 : q.method,
|
|
60
|
+
parameters: (R = a.metaData.parsedCurl) == null ? void 0 : R.parameters,
|
|
61
|
+
selectedServerUid: l ? void 0 : c.value,
|
|
62
|
+
requestBody: (U = a.metaData.parsedCurl) == null ? void 0 : U.requestBody
|
|
63
|
+
},
|
|
64
|
+
e.uid
|
|
65
|
+
);
|
|
66
|
+
o && ((g = D.value) != null && g.uid) && j.push({
|
|
67
|
+
name: "request",
|
|
68
|
+
params: {
|
|
69
|
+
[C.Workspace]: D.value.uid,
|
|
70
|
+
[C.Collection]: e.uid,
|
|
71
|
+
[C.Request]: o.uid
|
|
72
|
+
}
|
|
73
|
+
}), V("close");
|
|
74
|
+
}
|
|
75
|
+
const x = () => {
|
|
76
|
+
var t;
|
|
77
|
+
z({
|
|
78
|
+
collectionUid: ((t = s.value) == null ? void 0 : t.id) ?? ""
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
return (t, e) => (G(), H(T, null, [
|
|
82
|
+
e[1] || (e[1] = r("div", { class: "text-c-2 flex-center py-1.5 text-sm" }, "Import cURL", -1)),
|
|
83
|
+
n(Z, {
|
|
84
|
+
onSubmit: x,
|
|
85
|
+
class: "mt-1.5 min-h-fit"
|
|
86
|
+
}, {
|
|
87
|
+
options: d(() => [
|
|
88
|
+
r("div", se, [
|
|
89
|
+
n(f($), {
|
|
90
|
+
modelValue: s.value,
|
|
91
|
+
"onUpdate:modelValue": e[0] || (e[0] = (l) => s.value = l),
|
|
92
|
+
options: p.value
|
|
93
|
+
}, {
|
|
94
|
+
default: d(() => [
|
|
95
|
+
n(f(J), {
|
|
96
|
+
class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
|
|
97
|
+
variant: "outlined"
|
|
98
|
+
}, {
|
|
99
|
+
default: d(() => [
|
|
100
|
+
r("span", {
|
|
101
|
+
class: X(["whitespace-nowrap", s.value ? "text-c-1" : "text-c-3"])
|
|
102
|
+
}, v(s.value ? s.value.label : "Select Collection"), 3),
|
|
103
|
+
n(f(K), {
|
|
104
|
+
class: "text-c-3",
|
|
105
|
+
icon: "ChevronDown",
|
|
106
|
+
size: "md"
|
|
107
|
+
})
|
|
108
|
+
]),
|
|
109
|
+
_: 1
|
|
110
|
+
})
|
|
111
|
+
]),
|
|
112
|
+
_: 1
|
|
113
|
+
}, 8, ["modelValue", "options"])
|
|
114
|
+
])
|
|
115
|
+
]),
|
|
116
|
+
submit: d(() => [
|
|
117
|
+
r("span", { onClick: x }, "Import Request")
|
|
118
|
+
]),
|
|
119
|
+
default: d(() => {
|
|
120
|
+
var l, o, i, u;
|
|
121
|
+
return [
|
|
122
|
+
r("div", ae, [
|
|
123
|
+
r("div", le, [
|
|
124
|
+
n(_, {
|
|
125
|
+
isEditable: !1,
|
|
126
|
+
isSquare: "",
|
|
127
|
+
method: ((l = t.metaData.parsedCurl) == null ? void 0 : l.method) || "get"
|
|
128
|
+
}, null, 8, ["method"])
|
|
129
|
+
]),
|
|
130
|
+
r("span", re, v(((i = (o = t.metaData.parsedCurl) == null ? void 0 : o.servers) == null ? void 0 : i[0]) || "") + v(((u = t.metaData.parsedCurl) == null ? void 0 : u.path) || ""), 1)
|
|
131
|
+
])
|
|
132
|
+
];
|
|
133
|
+
}),
|
|
134
|
+
_: 1
|
|
135
|
+
})
|
|
136
|
+
], 64));
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
export {
|
|
140
|
+
ve as default
|
|
141
|
+
};
|