@scalar/api-client 2.5.1 → 2.5.3
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 +53 -0
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.js +2 -2
- package/dist/components/HttpMethod/HttpMethod.vue2.js +18 -18
- package/dist/components/ImportCollection/OperationBadge.vue.d.ts +1 -1
- package/dist/components/ImportCollection/OperationBadge.vue.d.ts.map +1 -1
- package/dist/components/ScalarHotkey.vue.d.ts.map +1 -1
- package/dist/components/ScalarHotkey.vue.js +1 -1
- package/dist/components/TopNav/TopNavItem.vue.js +2 -2
- package/dist/components/TopNav/TopNavItem.vue2.js +4 -4
- package/dist/layouts/Web/ApiClientWeb.vue.d.ts.map +1 -1
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +6 -5
- package/dist/libs/hot-keys.js +1 -1
- package/dist/libs/index.js +23 -24
- package/dist/libs/local-storage.d.ts +0 -8
- package/dist/libs/local-storage.d.ts.map +1 -1
- package/dist/libs/local-storage.js +24 -28
- package/dist/libs/send-request/create-request-operation.d.ts.map +1 -1
- package/dist/libs/send-request/create-request-operation.js +49 -49
- package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
- package/dist/libs/string-template.d.ts.map +1 -1
- package/dist/libs/string-template.js +29 -29
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/collections.js +1 -1
- package/dist/store/cookies.js +1 -1
- package/dist/store/environment.js +1 -1
- package/dist/store/request-example.d.ts.map +1 -1
- package/dist/store/request-example.js +13 -12
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/requests.js +42 -40
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/security-schemes.js +1 -1
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/servers.js +1 -1
- package/dist/store/tags.d.ts.map +1 -1
- package/dist/store/tags.js +14 -13
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +1 -1
- package/dist/style.css +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +28 -28
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue2.js +38 -38
- 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 +70 -68
- package/dist/views/Request/RequestSection/helpers/update-scheme.js +8 -8
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +13 -12
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarErrorBoundary as
|
|
3
|
-
import { canMethodHaveBody as
|
|
4
|
-
import
|
|
1
|
+
import { defineComponent as D, computed as v, useId as P, ref as M, watch as S, createBlock as p, openBlock as r, withCtx as c, createElementVNode as h, withDirectives as s, createCommentVNode as k, createElementBlock as f, createVNode as i, unref as n, vShow as u, Fragment as K, renderList as L, resolveDynamicComponent as Q, toDisplayString as $ } from "vue";
|
|
2
|
+
import { ScalarErrorBoundary as C } from "@scalar/components";
|
|
3
|
+
import { canMethodHaveBody as b, isDefined as j, REGEX as B } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import F from "../../../components/SectionFilter.vue.js";
|
|
5
5
|
import T from "../../../components/ViewLayout/ViewLayoutSection.vue.js";
|
|
6
6
|
import { matchesDomain as W } from "../../../libs/send-request/set-request-cookies.js";
|
|
7
7
|
import z from "./RequestBody.vue.js";
|
|
8
|
-
import
|
|
8
|
+
import V from "./RequestParams.vue.js";
|
|
9
9
|
import G from "./RequestPathParams.vue.js";
|
|
10
10
|
import X from "./RequestAuth/RequestAuth.vue.js";
|
|
11
11
|
import J from "./RequestCodeExample.vue.js";
|
|
12
12
|
import { usePluginManager as Y } from "../../../plugins/hooks/usePluginManager.js";
|
|
13
13
|
import { useWorkspace as Z } from "../../../store/store.js";
|
|
14
14
|
import { useLayout as x } from "../../../hooks/useLayout.js";
|
|
15
|
-
const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24" }, ee = ["for"], ae = ["id", "placeholder", "value"],
|
|
15
|
+
const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24" }, ee = ["for"], ae = ["id", "placeholder", "value"], le = {
|
|
16
16
|
key: 2,
|
|
17
17
|
class: "text-c-1 flex h-8 items-center"
|
|
18
|
-
},
|
|
18
|
+
}, oe = ["id", "role"], be = /* @__PURE__ */ D({
|
|
19
19
|
__name: "RequestSection",
|
|
20
20
|
props: {
|
|
21
21
|
collection: {},
|
|
@@ -28,42 +28,39 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
|
28
28
|
server: {},
|
|
29
29
|
workspace: {}
|
|
30
30
|
},
|
|
31
|
-
setup(
|
|
32
|
-
const
|
|
31
|
+
setup(l) {
|
|
32
|
+
const R = [
|
|
33
33
|
"Auth",
|
|
34
34
|
"Variables",
|
|
35
35
|
"Cookies",
|
|
36
36
|
"Headers",
|
|
37
37
|
"Query",
|
|
38
|
-
"Body"
|
|
39
|
-
|
|
40
|
-
], { requestMutators:
|
|
41
|
-
const e = /* @__PURE__ */ new Set(["All", ...
|
|
42
|
-
return
|
|
38
|
+
"Body"
|
|
39
|
+
// 'Scripts',
|
|
40
|
+
], { requestMutators: w, cookies: O, securitySchemes: A } = Z(), { layout: d } = x(), q = v(() => {
|
|
41
|
+
const e = /* @__PURE__ */ new Set(["All", ...R]);
|
|
42
|
+
return l.example.parameters.path.length || e.delete("Variables"), b(l.operation.method ?? "get") || e.delete("Body"), y.value && e.delete("Auth"), [...e];
|
|
43
43
|
}), t = v(
|
|
44
44
|
() => Object.fromEntries(
|
|
45
|
-
|
|
45
|
+
q.value.map((e) => [e, P()])
|
|
46
46
|
)
|
|
47
|
-
),
|
|
48
|
-
() => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
), a = D("All");
|
|
53
|
-
M(
|
|
54
|
-
() => o.operation,
|
|
47
|
+
), y = v(
|
|
48
|
+
() => d === "modal" && !l.operation.security && !Object.keys(A ?? {}).length
|
|
49
|
+
), a = M("All");
|
|
50
|
+
S(
|
|
51
|
+
() => l.operation,
|
|
55
52
|
(e) => {
|
|
56
|
-
a.value === "Body" && e && !
|
|
53
|
+
a.value === "Body" && e && !b(e.method) && (a.value = "All");
|
|
57
54
|
}
|
|
58
55
|
);
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
() => (
|
|
56
|
+
const E = (e) => {
|
|
57
|
+
const o = e.target;
|
|
58
|
+
w.edit(l.operation.uid, "summary", o.value);
|
|
59
|
+
}, H = v(
|
|
60
|
+
() => (l.workspace.cookies ?? []).map((e) => O[e]).filter(j).filter((e) => e.name).filter(
|
|
64
61
|
(e) => {
|
|
65
|
-
var
|
|
66
|
-
return W(((
|
|
62
|
+
var o;
|
|
63
|
+
return W(((o = l.server) == null ? void 0 : o.url) || l.operation.path, e.domain);
|
|
67
64
|
}
|
|
68
65
|
).map((e) => ({
|
|
69
66
|
key: e.name,
|
|
@@ -76,40 +73,45 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
|
76
73
|
},
|
|
77
74
|
enabled: !0
|
|
78
75
|
}))
|
|
79
|
-
),
|
|
80
|
-
return (
|
|
76
|
+
), N = () => l.operation.summary ? l.operation.summary : l.operation.path.replace(B.PROTOCOL, "") ? l.operation.path.replace(B.PROTOCOL, "") : "Request Name", g = P(), I = Y().getViewComponents("request.section"), U = (e, o) => w.edit(l.operation.uid, e, o);
|
|
77
|
+
return S(
|
|
78
|
+
() => y.value,
|
|
79
|
+
(e) => {
|
|
80
|
+
e && a.value === "Auth" && (a.value = "All");
|
|
81
|
+
}
|
|
82
|
+
), (e, o) => (r(), p(T, {
|
|
81
83
|
"aria-label": `Request: ${e.operation.summary}`
|
|
82
84
|
}, {
|
|
83
85
|
title: c(() => [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
h("div", _, [
|
|
87
|
+
n(d) !== "modal" ? (r(), f("label", {
|
|
86
88
|
key: 0,
|
|
87
89
|
class: "pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0",
|
|
88
|
-
for:
|
|
89
|
-
}, null, 8, ee)) :
|
|
90
|
-
|
|
90
|
+
for: n(g)
|
|
91
|
+
}, null, 8, ee)) : k("", !0),
|
|
92
|
+
n(d) !== "modal" ? (r(), f("input", {
|
|
91
93
|
key: 1,
|
|
92
|
-
id:
|
|
94
|
+
id: n(g),
|
|
93
95
|
class: "text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25",
|
|
94
|
-
placeholder:
|
|
96
|
+
placeholder: N(),
|
|
95
97
|
value: e.operation.summary,
|
|
96
|
-
onInput:
|
|
97
|
-
}, null, 40, ae)) : (
|
|
98
|
+
onInput: E
|
|
99
|
+
}, null, 40, ae)) : (r(), f("span", le, $(e.operation.summary), 1))
|
|
98
100
|
]),
|
|
99
|
-
i(
|
|
101
|
+
i(F, {
|
|
100
102
|
modelValue: a.value,
|
|
101
|
-
"onUpdate:modelValue":
|
|
103
|
+
"onUpdate:modelValue": o[0] || (o[0] = (m) => a.value = m),
|
|
102
104
|
filterIds: t.value,
|
|
103
|
-
filters:
|
|
105
|
+
filters: q.value
|
|
104
106
|
}, null, 8, ["modelValue", "filterIds", "filters"])
|
|
105
107
|
]),
|
|
106
108
|
default: c(() => [
|
|
107
|
-
|
|
109
|
+
h("div", {
|
|
108
110
|
id: t.value.All,
|
|
109
111
|
class: "request-section-content custom-scroll relative flex flex-1 flex-col",
|
|
110
112
|
role: a.value === "All" ? "tabpanel" : "none"
|
|
111
113
|
}, [
|
|
112
|
-
e.collection && e.workspace && (
|
|
114
|
+
e.collection && e.workspace && (n(d) !== "modal" || Object.keys(n(A) ?? {}).length) ? s((r(), p(X, {
|
|
113
115
|
key: 0,
|
|
114
116
|
id: t.value.Auth,
|
|
115
117
|
class: "request-section-content-auth",
|
|
@@ -125,10 +127,10 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
|
125
127
|
workspace: e.workspace
|
|
126
128
|
}, null, 8, ["id", "collection", "envVariables", "environment", "operation", "role", "selectedSecuritySchemeUids", "server", "workspace"])), [
|
|
127
129
|
[
|
|
128
|
-
|
|
129
|
-
!
|
|
130
|
+
u,
|
|
131
|
+
!y.value && (a.value === "All" || a.value === "Auth")
|
|
130
132
|
]
|
|
131
|
-
]) :
|
|
133
|
+
]) : k("", !0),
|
|
132
134
|
s(i(G, {
|
|
133
135
|
id: t.value.Variables,
|
|
134
136
|
class: "request-section-content-path-params",
|
|
@@ -143,11 +145,11 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
|
143
145
|
workspace: e.workspace
|
|
144
146
|
}, null, 8, ["id", "envVariables", "environment", "example", "invalidParams", "operation", "role", "workspace"]), [
|
|
145
147
|
[
|
|
146
|
-
|
|
148
|
+
u,
|
|
147
149
|
(a.value === "All" || a.value === "Variables") && e.example.parameters.path.length
|
|
148
150
|
]
|
|
149
151
|
]),
|
|
150
|
-
s(i(
|
|
152
|
+
s(i(V, {
|
|
151
153
|
id: t.value.Cookies,
|
|
152
154
|
class: "request-section-content-cookies",
|
|
153
155
|
envVariables: e.envVariables,
|
|
@@ -157,14 +159,14 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
|
157
159
|
label: "Cookie",
|
|
158
160
|
operation: e.operation,
|
|
159
161
|
paramKey: "cookies",
|
|
160
|
-
readOnlyEntries:
|
|
162
|
+
readOnlyEntries: H.value,
|
|
161
163
|
role: a.value === "All" ? "none" : "tabpanel",
|
|
162
164
|
title: "Cookies",
|
|
163
165
|
workspace: e.workspace
|
|
164
166
|
}, null, 8, ["id", "envVariables", "environment", "example", "invalidParams", "operation", "readOnlyEntries", "role", "workspace"]), [
|
|
165
|
-
[
|
|
167
|
+
[u, a.value === "All" || a.value === "Cookies"]
|
|
166
168
|
]),
|
|
167
|
-
s(i(
|
|
169
|
+
s(i(V, {
|
|
168
170
|
id: t.value.Headers,
|
|
169
171
|
class: "request-section-content-headers",
|
|
170
172
|
envVariables: e.envVariables,
|
|
@@ -178,9 +180,9 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
|
178
180
|
title: "Headers",
|
|
179
181
|
workspace: e.workspace
|
|
180
182
|
}, null, 8, ["id", "envVariables", "environment", "example", "invalidParams", "operation", "role", "workspace"]), [
|
|
181
|
-
[
|
|
183
|
+
[u, a.value === "All" || a.value === "Headers"]
|
|
182
184
|
]),
|
|
183
|
-
s(i(
|
|
185
|
+
s(i(V, {
|
|
184
186
|
id: t.value.Query,
|
|
185
187
|
class: "request-section-content-query",
|
|
186
188
|
envVariables: e.envVariables,
|
|
@@ -194,9 +196,9 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
|
194
196
|
title: "Query Parameters",
|
|
195
197
|
workspace: e.workspace
|
|
196
198
|
}, null, 8, ["id", "envVariables", "environment", "example", "invalidParams", "operation", "role", "workspace"]), [
|
|
197
|
-
[
|
|
199
|
+
[u, a.value === "All" || a.value === "Query"]
|
|
198
200
|
]),
|
|
199
|
-
e.operation.method && (a.value === "All" || a.value === "Body") &&
|
|
201
|
+
e.operation.method && (a.value === "All" || a.value === "Body") && n(b)(e.operation.method) ? (r(), p(z, {
|
|
200
202
|
key: 1,
|
|
201
203
|
id: t.value.Body,
|
|
202
204
|
class: "request-section-content-body",
|
|
@@ -207,22 +209,22 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
|
207
209
|
role: a.value === "All" ? "none" : "tabpanel",
|
|
208
210
|
title: "Body",
|
|
209
211
|
workspace: e.workspace
|
|
210
|
-
}, null, 8, ["id", "envVariables", "environment", "example", "operation", "role", "workspace"])) :
|
|
211
|
-
(
|
|
212
|
-
key:
|
|
212
|
+
}, null, 8, ["id", "envVariables", "environment", "example", "operation", "role", "workspace"])) : k("", !0),
|
|
213
|
+
(r(!0), f(K, null, L(n(I), (m) => (r(), p(n(C), {
|
|
214
|
+
key: m.component
|
|
213
215
|
}, {
|
|
214
216
|
default: c(() => [
|
|
215
|
-
s((
|
|
216
|
-
"onUpdate:operation":
|
|
217
|
+
s((r(), p(Q(m.component), {
|
|
218
|
+
"onUpdate:operation": U,
|
|
217
219
|
operation: e.operation
|
|
218
220
|
}, null, 40, ["operation"])), [
|
|
219
|
-
[
|
|
221
|
+
[u, a.value === "All" || a.value === m.title]
|
|
220
222
|
])
|
|
221
223
|
]),
|
|
222
224
|
_: 2
|
|
223
225
|
}, 1024))), 128)),
|
|
224
|
-
|
|
225
|
-
i(
|
|
226
|
+
o[1] || (o[1] = h("div", { class: "flex flex-grow" }, null, -1)),
|
|
227
|
+
i(n(C), null, {
|
|
226
228
|
default: c(() => [
|
|
227
229
|
i(J, {
|
|
228
230
|
class: "request-section-content-code-example -mt-1/2 border-t",
|
|
@@ -236,7 +238,7 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
|
|
|
236
238
|
]),
|
|
237
239
|
_: 1
|
|
238
240
|
})
|
|
239
|
-
], 8,
|
|
241
|
+
], 8, oe)
|
|
240
242
|
]),
|
|
241
243
|
_: 1
|
|
242
244
|
}, 8, ["aria-label"]));
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { CLIENT_LS_KEYS as
|
|
2
|
-
const
|
|
3
|
-
var
|
|
4
|
-
if (
|
|
1
|
+
import { safeLocalStorage as s, CLIENT_LS_KEYS as m } from "@scalar/helpers/object/local-storage";
|
|
2
|
+
const g = (o, r, n, { securitySchemeMutators: a, securitySchemes: S }, f = !1) => {
|
|
3
|
+
var c;
|
|
4
|
+
if (a.edit(o, r, n), !!f)
|
|
5
5
|
try {
|
|
6
|
-
const e = JSON.parse(
|
|
6
|
+
const e = JSON.parse(s().getItem(m.AUTH) ?? "{}"), t = S[o];
|
|
7
7
|
if (e && (t != null && t.nameKey)) {
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const i = e[c = t.nameKey] || (e[c] = {});
|
|
9
|
+
i[r] = n, s().setItem(m.AUTH, JSON.stringify(e));
|
|
10
10
|
}
|
|
11
11
|
} catch (e) {
|
|
12
12
|
console.error(e);
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
g as updateScheme
|
|
17
17
|
};
|
|
@@ -34,7 +34,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
|
|
|
34
34
|
}));
|
|
35
35
|
}, k = (o) => {
|
|
36
36
|
o != null && o.createNew && g.name === "request" && f();
|
|
37
|
-
}, w = "2.5.
|
|
37
|
+
}, w = "2.5.3";
|
|
38
38
|
return R(() => a.hotKeys.on(k)), v(() => a.hotKeys.off(k)), (o, e) => (u(), i("div", W, [
|
|
39
39
|
s("div", {
|
|
40
40
|
class: y(["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.5.
|
|
21
|
+
"version": "2.5.3",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=20"
|
|
24
24
|
},
|
|
@@ -204,19 +204,20 @@
|
|
|
204
204
|
"whatwg-mimetype": "^4.0.0",
|
|
205
205
|
"yaml": "^2.4.5",
|
|
206
206
|
"zod": "3.24.1",
|
|
207
|
-
"@scalar/components": "0.14.
|
|
208
|
-
"@scalar/draggable": "0.2.0",
|
|
207
|
+
"@scalar/components": "0.14.6",
|
|
209
208
|
"@scalar/icons": "0.4.2",
|
|
210
|
-
"@scalar/
|
|
209
|
+
"@scalar/draggable": "0.2.0",
|
|
210
|
+
"@scalar/import": "0.4.7",
|
|
211
|
+
"@scalar/helpers": "0.0.2",
|
|
212
|
+
"@scalar/oas-utils": "0.4.3",
|
|
211
213
|
"@scalar/object-utils": "1.2.1",
|
|
212
|
-
"@scalar/openapi-parser": "0.
|
|
213
|
-
"@scalar/openapi-types": "0.3.
|
|
214
|
-
"@scalar/postman-to-openapi": "0.3.
|
|
215
|
-
"@scalar/import": "0.4.5",
|
|
214
|
+
"@scalar/openapi-parser": "0.15.0",
|
|
215
|
+
"@scalar/openapi-types": "0.3.2",
|
|
216
|
+
"@scalar/postman-to-openapi": "0.3.6",
|
|
216
217
|
"@scalar/snippetz": "0.3.0",
|
|
217
|
-
"@scalar/types": "0.2.
|
|
218
|
-
"@scalar/
|
|
219
|
-
"@scalar/
|
|
218
|
+
"@scalar/types": "0.2.2",
|
|
219
|
+
"@scalar/use-codemirror": "0.12.7",
|
|
220
|
+
"@scalar/themes": "0.13.2",
|
|
220
221
|
"@scalar/use-hooks": "0.2.2",
|
|
221
222
|
"@scalar/use-toasts": "0.8.0",
|
|
222
223
|
"@scalar/use-tooltip": "1.1.0"
|
|
@@ -232,7 +233,7 @@
|
|
|
232
233
|
"vite": "5.4.19",
|
|
233
234
|
"vite-svg-loader": "^5.1.0",
|
|
234
235
|
"vitest": "^1.6.0",
|
|
235
|
-
"@scalar/build-tooling": "0.2.
|
|
236
|
+
"@scalar/build-tooling": "0.2.2",
|
|
236
237
|
"@scalar/galaxy": "0.5.0"
|
|
237
238
|
},
|
|
238
239
|
"scripts": {
|