@scalar/api-client 2.2.11 → 2.2.12
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 +19 -0
- package/dist/components/AddressBar/AddressBarServerItem.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBarServerItem.vue.js +19 -18
- package/dist/layouts/App/create-api-client-app.d.ts +1 -1
- package/dist/layouts/Modal/create-api-client-modal.d.ts +2 -2
- package/dist/layouts/Web/create-api-client-web.d.ts +1 -1
- package/dist/libs/create-client.d.ts +1 -1
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +64 -51
- package/dist/libs/send-request/send-request.d.ts.map +1 -1
- package/dist/libs/send-request/send-request.js +47 -45
- package/dist/style.css +1 -1
- package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +53 -51
- package/dist/views/Request/RequestSection/RequestSection.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +15 -15
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestPathParams.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestPathParams.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestPathParams.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestPathParams.vue"],"names":[],"mappings":"AA8IA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAMrE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,cAAc,CAAC,YAAY,CAAC,CAAA;CAC7C,CAAC;;AAyMF,wBAOG"}
|
|
@@ -1,96 +1,98 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useActiveEntities as
|
|
4
|
-
import
|
|
5
|
-
import { REGEX as
|
|
6
|
-
import { useWorkspace as
|
|
7
|
-
const
|
|
8
|
-
key: 1,
|
|
9
|
-
class: "text-c-3 px-4 text-sm border rounded min-h-12 justify-center flex items-center bg-b-1 mx-1"
|
|
10
|
-
}, O = /* @__PURE__ */ _({
|
|
1
|
+
import { defineComponent as P, computed as _, watch as y, openBlock as g, createBlock as R, withCtx as $, createTextVNode as b, toDisplayString as q, createCommentVNode as w } from "vue";
|
|
2
|
+
import V from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
|
|
3
|
+
import { useActiveEntities as M } from "../../../store/active-entities.js";
|
|
4
|
+
import U from "./RequestTable.vue.js";
|
|
5
|
+
import { REGEX as N } from "@scalar/oas-utils/helpers";
|
|
6
|
+
import { useWorkspace as T } from "../../../store/store.js";
|
|
7
|
+
const S = /* @__PURE__ */ P({
|
|
11
8
|
__name: "RequestPathParams",
|
|
12
9
|
props: {
|
|
13
10
|
title: {},
|
|
14
11
|
paramKey: {}
|
|
15
12
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const o =
|
|
13
|
+
setup(E) {
|
|
14
|
+
const o = E, { activeRequest: s, activeExample: n, activeServer: d } = M(), { requestMutators: f, requestExampleMutators: v } = T(), p = _(() => {
|
|
18
15
|
const e = n.value;
|
|
19
|
-
return e ? e.parameters[o.paramKey].map((
|
|
16
|
+
return e ? e.parameters[o.paramKey].map((t) => {
|
|
20
17
|
var r;
|
|
21
18
|
return {
|
|
22
|
-
...
|
|
23
|
-
enum:
|
|
19
|
+
...t,
|
|
20
|
+
enum: t.enum || ((r = e.serverVariables) == null ? void 0 : r[t.key])
|
|
24
21
|
};
|
|
25
22
|
}) : [];
|
|
26
|
-
}),
|
|
27
|
-
var
|
|
23
|
+
}), K = (e, t, r) => {
|
|
24
|
+
var l, a;
|
|
28
25
|
if (!s.value || !n.value) return;
|
|
29
|
-
const i = n.value.parameters[o.paramKey],
|
|
30
|
-
if (
|
|
31
|
-
if ((
|
|
26
|
+
const i = n.value.parameters[o.paramKey], u = (l = i[e]) == null ? void 0 : l.key;
|
|
27
|
+
if (t === "key") {
|
|
28
|
+
if ((a = i[e]) != null && a.required)
|
|
32
29
|
return;
|
|
33
30
|
if (r) {
|
|
34
|
-
const c = encodeURIComponent(
|
|
35
|
-
|
|
31
|
+
const c = encodeURIComponent(u), m = encodeURIComponent(r), x = new RegExp(`(?<=/):${c}(?=[/?#]|$)`, "g"), C = s.value.path.replace(
|
|
32
|
+
x,
|
|
36
33
|
`:${m}`
|
|
37
34
|
);
|
|
38
|
-
|
|
35
|
+
f.edit(s.value.uid, "path", C);
|
|
39
36
|
} else {
|
|
40
37
|
i.splice(e, 1);
|
|
41
|
-
const c = new RegExp(`/:${encodeURIComponent(
|
|
42
|
-
|
|
38
|
+
const c = new RegExp(`/:${encodeURIComponent(u)}(?=[/?#]|$)`, "g"), m = s.value.path.replace(c, "");
|
|
39
|
+
f.edit(s.value.uid, "path", m);
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
|
|
42
|
+
v.edit(
|
|
46
43
|
n.value.uid,
|
|
47
|
-
`parameters.${o.paramKey}.${e}.${
|
|
44
|
+
`parameters.${o.paramKey}.${e}.${t}`,
|
|
48
45
|
r
|
|
49
46
|
);
|
|
50
|
-
},
|
|
51
|
-
var
|
|
47
|
+
}, k = (e) => {
|
|
48
|
+
var l;
|
|
52
49
|
if (!n.value) return;
|
|
53
|
-
const
|
|
54
|
-
(
|
|
50
|
+
const t = ((l = e.match(N.PATH)) == null ? void 0 : l.map((a) => a.slice(1, -1))) || [], r = n.value.parameters[o.paramKey], i = new Map(r.map((a) => [a.key, a])), u = t.map(
|
|
51
|
+
(a) => i.get(a) || { key: a, value: "", enabled: !0 }
|
|
55
52
|
);
|
|
56
|
-
r.forEach((
|
|
57
|
-
!
|
|
58
|
-
}), r.splice(0, r.length, ...
|
|
53
|
+
r.forEach((a) => {
|
|
54
|
+
!t.includes(a.key) && (a.value || a.required) && u.push(a);
|
|
55
|
+
}), r.splice(0, r.length, ...u), t.length === 0 && r.splice(0, r.length), v.edit(
|
|
59
56
|
n.value.uid,
|
|
60
57
|
`parameters.${o.paramKey}`,
|
|
61
58
|
r
|
|
62
59
|
);
|
|
60
|
+
}, h = (e) => {
|
|
61
|
+
e && k(e);
|
|
63
62
|
};
|
|
64
|
-
return
|
|
63
|
+
return y(
|
|
64
|
+
() => s.value,
|
|
65
|
+
(e) => {
|
|
66
|
+
var t;
|
|
67
|
+
e && h((t = d.value) == null ? void 0 : t.url);
|
|
68
|
+
}
|
|
69
|
+
), y(
|
|
65
70
|
() => {
|
|
66
71
|
var e;
|
|
67
|
-
return (e =
|
|
72
|
+
return (e = d.value) == null ? void 0 : e.url;
|
|
68
73
|
},
|
|
69
|
-
(e) => {
|
|
70
|
-
e &&
|
|
74
|
+
(e, t) => {
|
|
75
|
+
e !== t && h(e);
|
|
71
76
|
}
|
|
72
|
-
), (e,
|
|
73
|
-
itemCount:
|
|
77
|
+
), (e, t) => (g(), R(V, {
|
|
78
|
+
itemCount: p.value.length
|
|
74
79
|
}, {
|
|
75
|
-
title:
|
|
76
|
-
|
|
80
|
+
title: $(() => [
|
|
81
|
+
b(q(e.title), 1)
|
|
77
82
|
]),
|
|
78
|
-
default:
|
|
79
|
-
|
|
83
|
+
default: $(() => [
|
|
84
|
+
p.value.length ? (g(), R(U, {
|
|
80
85
|
key: 0,
|
|
81
86
|
class: "flex-1",
|
|
82
87
|
isEnabledHidden: "",
|
|
83
|
-
items:
|
|
84
|
-
onUpdateRow:
|
|
85
|
-
}, null, 8, ["items"])) : (
|
|
86
|
-
x(" You can use variables in your path: "),
|
|
87
|
-
P("code", { class: "bg-b-2 ml-1 px-1 rounded" }, "/endpoint/{my_path_variable}", -1)
|
|
88
|
-
])))
|
|
88
|
+
items: p.value,
|
|
89
|
+
onUpdateRow: K
|
|
90
|
+
}, null, 8, ["items"])) : w("", !0)
|
|
89
91
|
]),
|
|
90
92
|
_: 1
|
|
91
93
|
}, 8, ["itemCount"]));
|
|
92
94
|
}
|
|
93
95
|
});
|
|
94
96
|
export {
|
|
95
|
-
|
|
97
|
+
S as default
|
|
96
98
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./RequestSection.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-317bb675"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -3,24 +3,24 @@ import H from "../../../components/ContextBar.vue.js";
|
|
|
3
3
|
import N from "../../../components/ViewLayout/ViewLayoutSection.vue.js";
|
|
4
4
|
import { useActiveEntities as E } from "../../../store/active-entities.js";
|
|
5
5
|
import K from "./RequestBody.vue.js";
|
|
6
|
-
import
|
|
6
|
+
import f from "./RequestParams.vue.js";
|
|
7
7
|
import U from "./RequestPathParams.vue.js";
|
|
8
|
-
import { canMethodHaveBody as
|
|
8
|
+
import { canMethodHaveBody as h } from "@scalar/oas-utils/helpers";
|
|
9
9
|
import Q from "./RequestAuth/RequestAuth.vue.js";
|
|
10
10
|
import { useWorkspace as $ } from "../../../store/store.js";
|
|
11
11
|
const D = { class: "flex-1 flex gap-1 items-center lg:pr-24 pointer-events-none group" }, M = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "absolute w-full h-full top-0 left-0 pointer-events-auto opacity-0 cursor-text",
|
|
14
14
|
for: "requestname"
|
|
15
|
-
},
|
|
15
|
+
}, z = ["value"], I = {
|
|
16
16
|
key: 2,
|
|
17
17
|
class: "flex items-center text-c-1 h-8"
|
|
18
|
-
},
|
|
18
|
+
}, L = { class: "request-section-content custom-scroll flex flex-1 flex-col px-3 xl:px-4 py-2.5" }, ee = /* @__PURE__ */ B({
|
|
19
19
|
__name: "RequestSection",
|
|
20
20
|
props: {
|
|
21
21
|
selectedSecuritySchemeUids: {}
|
|
22
22
|
},
|
|
23
|
-
setup(
|
|
23
|
+
setup(O) {
|
|
24
24
|
const { activeRequest: l, activeExample: y } = E(), { isReadOnly: p, requestMutators: g } = $(), k = S(() => {
|
|
25
25
|
var a, u;
|
|
26
26
|
const t = /* @__PURE__ */ new Set([
|
|
@@ -32,7 +32,7 @@ const D = { class: "flex-1 flex gap-1 items-center lg:pr-24 pointer-events-none
|
|
|
32
32
|
"Headers",
|
|
33
33
|
"Body"
|
|
34
34
|
]);
|
|
35
|
-
return (a = y.value) != null && a.parameters.path.length || t.delete("Variables"),
|
|
35
|
+
return (a = y.value) != null && a.parameters.path.length || t.delete("Variables"), h(((u = l.value) == null ? void 0 : u.method) ?? "get") || t.delete("Body"), _.value && t.delete("Auth"), [...t];
|
|
36
36
|
}), _ = S(
|
|
37
37
|
() => {
|
|
38
38
|
var t, a;
|
|
@@ -40,7 +40,7 @@ const D = { class: "flex-1 flex gap-1 items-center lg:pr-24 pointer-events-none
|
|
|
40
40
|
}
|
|
41
41
|
), e = b("All");
|
|
42
42
|
V(l, (t) => {
|
|
43
|
-
e.value === "Body" && t && !
|
|
43
|
+
e.value === "Body" && t && !h(t.method) && (e.value = "All");
|
|
44
44
|
});
|
|
45
45
|
const q = (t) => {
|
|
46
46
|
if (!l.value) return;
|
|
@@ -57,14 +57,14 @@ const D = { class: "flex-1 flex gap-1 items-center lg:pr-24 pointer-events-none
|
|
|
57
57
|
return [
|
|
58
58
|
A("div", D, [
|
|
59
59
|
o(p) ? C("", !0) : (d(), v("label", M)),
|
|
60
|
-
o(p) ? (d(), v("span",
|
|
60
|
+
o(p) ? (d(), v("span", I, R((c = o(l)) == null ? void 0 : c.summary), 1)) : (d(), v("input", {
|
|
61
61
|
key: 1,
|
|
62
62
|
id: "requestname",
|
|
63
63
|
class: "text-c-1 rounded pointer-events-auto relative w-full pl-2 -ml-0.5 md:-ml-1 xl:-ml-2 has-[:focus-visible]:outline h-8 group-hover-input has-[:focus-visible]:outline z-10",
|
|
64
64
|
placeholder: "Request Name",
|
|
65
65
|
value: (n = o(l)) == null ? void 0 : n.summary,
|
|
66
66
|
onInput: q
|
|
67
|
-
}, null, 40,
|
|
67
|
+
}, null, 40, z))
|
|
68
68
|
]),
|
|
69
69
|
s(H, {
|
|
70
70
|
activeSection: e.value,
|
|
@@ -76,7 +76,7 @@ const D = { class: "flex-1 flex gap-1 items-center lg:pr-24 pointer-events-none
|
|
|
76
76
|
default: x(() => {
|
|
77
77
|
var n, c, m;
|
|
78
78
|
return [
|
|
79
|
-
A("div",
|
|
79
|
+
A("div", L, [
|
|
80
80
|
i(s(Q, {
|
|
81
81
|
selectedSecuritySchemeUids: t.selectedSecuritySchemeUids,
|
|
82
82
|
title: "Authentication"
|
|
@@ -88,26 +88,26 @@ const D = { class: "flex-1 flex gap-1 items-center lg:pr-24 pointer-events-none
|
|
|
88
88
|
]),
|
|
89
89
|
i(s(U, {
|
|
90
90
|
paramKey: "path",
|
|
91
|
-
title: "
|
|
91
|
+
title: "Variables"
|
|
92
92
|
}, null, 512), [
|
|
93
93
|
[
|
|
94
94
|
r,
|
|
95
95
|
(e.value === "All" || e.value === "Variables") && ((m = (c = (n = o(y)) == null ? void 0 : n.parameters) == null ? void 0 : c.path) == null ? void 0 : m.length)
|
|
96
96
|
]
|
|
97
97
|
]),
|
|
98
|
-
i(s(
|
|
98
|
+
i(s(f, {
|
|
99
99
|
paramKey: "cookies",
|
|
100
100
|
title: "Cookies"
|
|
101
101
|
}, null, 512), [
|
|
102
102
|
[r, e.value === "All" || e.value === "Cookies"]
|
|
103
103
|
]),
|
|
104
|
-
i(s(
|
|
104
|
+
i(s(f, {
|
|
105
105
|
paramKey: "headers",
|
|
106
106
|
title: "Headers"
|
|
107
107
|
}, null, 512), [
|
|
108
108
|
[r, e.value === "All" || e.value === "Headers"]
|
|
109
109
|
]),
|
|
110
|
-
i(s(
|
|
110
|
+
i(s(f, {
|
|
111
111
|
paramKey: "query",
|
|
112
112
|
title: "Query Parameters"
|
|
113
113
|
}, null, 512), [
|
|
@@ -116,7 +116,7 @@ const D = { class: "flex-1 flex gap-1 items-center lg:pr-24 pointer-events-none
|
|
|
116
116
|
i(s(K, { title: "Body" }, null, 512), [
|
|
117
117
|
[
|
|
118
118
|
r,
|
|
119
|
-
o(l) && (e.value === "All" || e.value === "Body") && o(
|
|
119
|
+
o(l) && (e.value === "All" || e.value === "Body") && o(h)(o(l).method)
|
|
120
120
|
]
|
|
121
121
|
])
|
|
122
122
|
])
|
|
@@ -17,7 +17,7 @@ const K = { class: "relative col-1 flex-center gap-6 p-2 capitalize" }, A = {
|
|
|
17
17
|
a.commandPalette.emit({ commandName: "Create Request" });
|
|
18
18
|
}, y = (i) => {
|
|
19
19
|
i != null && i.createNew && v.name === "request" && f();
|
|
20
|
-
}, h = "2.2.
|
|
20
|
+
}, h = "2.2.12";
|
|
21
21
|
return R(() => a.hotKeys.on(y)), C(() => a.hotKeys.off(y)), (i, e) => (r(), l("div", K, [
|
|
22
22
|
o("div", {
|
|
23
23
|
class: k(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"rest",
|
|
19
19
|
"testing"
|
|
20
20
|
],
|
|
21
|
-
"version": "2.2.
|
|
21
|
+
"version": "2.2.12",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=18"
|
|
24
24
|
},
|
|
@@ -169,19 +169,19 @@
|
|
|
169
169
|
"whatwg-mimetype": "^4.0.0",
|
|
170
170
|
"yaml": "^2.4.5",
|
|
171
171
|
"zod": "^3.23.8",
|
|
172
|
-
"@scalar/components": "0.13.4",
|
|
173
172
|
"@scalar/draggable": "0.1.7",
|
|
174
173
|
"@scalar/icons": "0.1.2",
|
|
175
|
-
"@scalar/
|
|
174
|
+
"@scalar/components": "0.13.5",
|
|
175
|
+
"@scalar/import": "0.2.7",
|
|
176
176
|
"@scalar/object-utils": "1.1.12",
|
|
177
|
-
"@scalar/
|
|
177
|
+
"@scalar/oas-utils": "0.2.88",
|
|
178
|
+
"@scalar/openapi-parser": "0.10.0",
|
|
178
179
|
"@scalar/openapi-types": "0.1.5",
|
|
179
|
-
"@scalar/
|
|
180
|
-
"@scalar/
|
|
181
|
-
"@scalar/
|
|
182
|
-
"@scalar/
|
|
183
|
-
"@scalar/
|
|
184
|
-
"@scalar/use-codemirror": "0.11.48",
|
|
180
|
+
"@scalar/postman-to-openapi": "0.1.11",
|
|
181
|
+
"@scalar/types": "0.0.24",
|
|
182
|
+
"@scalar/use-codemirror": "0.11.49",
|
|
183
|
+
"@scalar/use-hooks": "0.1.8",
|
|
184
|
+
"@scalar/themes": "0.9.55",
|
|
185
185
|
"@scalar/use-toasts": "0.7.7",
|
|
186
186
|
"@scalar/use-tooltip": "1.0.4"
|
|
187
187
|
},
|