@scalar/api-client 2.0.38 → 2.0.40
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 +32 -0
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +84 -80
- package/dist/components/DataTable/DataTableInput.vue.d.ts +1 -1
- package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInput.vue.js +2 -2
- package/dist/components/DataTable/DataTableInput.vue2.js +1 -1
- package/dist/components/DataTable/DataTableInputSelect.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInputSelect.vue.js +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts +2 -0
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js +18 -14
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +5 -40
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue2.js +48 -2
- package/dist/components/Sidebar/SidebarListElement.vue.d.ts +2 -0
- package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarListElement.vue.js +2 -2
- package/dist/components/Sidebar/SidebarListElement.vue2.js +24 -22
- package/dist/components/Sidebar/SidebarListElementActions.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarListElementActions.vue.js +26 -25
- package/dist/components/SubpageHeader.vue.d.ts.map +1 -1
- package/dist/components/SubpageHeader.vue.js +5 -29
- package/dist/components/SubpageHeader.vue2.js +31 -2
- package/dist/layouts/App/create-api-client-app.d.ts +20 -20
- package/dist/layouts/Modal/create-api-client-modal.d.ts +40 -40
- package/dist/libs/create-client.d.ts +20 -20
- package/dist/libs/sendRequest.d.ts.map +1 -1
- package/dist/libs/sendRequest.js +87 -70
- package/dist/store/workspace.d.ts +64 -64
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +129 -132
- package/dist/style.css +1 -1
- package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +46 -36
- package/dist/views/Environment/Environment.vue2.js +26 -26
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +37 -34
- 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 +196 -142
- package/dist/views/Request/RequestSection/RequestAuth.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth.vue.js +5 -311
- package/dist/views/Request/RequestSection/RequestAuth.vue2.js +312 -2
- package/dist/views/Request/RequestSection/RequestSection.vue.js +19 -19
- package/dist/views/Request/RequestSidebarItem.vue.d.ts +4 -4
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +108 -87
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +5 -162
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +166 -2
- package/dist/views/Request/ResponseSection/ResponseBody.vue.d.ts +3 -17
- package/dist/views/Request/ResponseSection/ResponseBody.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseBody.vue.js +89 -5
- package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +2 -37
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.d.ts +18 -0
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.d.ts.map +1 -0
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.js +34 -0
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue2.js +4 -0
- package/dist/views/Request/ResponseSection/ResponseBodyInfo.vue.d.ts +12 -0
- package/dist/views/Request/ResponseSection/ResponseBodyInfo.vue.d.ts.map +1 -0
- package/dist/views/Request/ResponseSection/ResponseBodyInfo.vue.js +14 -0
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.d.ts +23 -0
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.d.ts.map +1 -0
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.js +7 -0
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue2.js +65 -0
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.d.ts +19 -0
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.d.ts.map +1 -0
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +7 -0
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +29 -0
- package/dist/views/Request/ResponseSection/ResponseBodyToggle.vue.d.ts +20 -0
- package/dist/views/Request/ResponseSection/ResponseBodyToggle.vue.d.ts.map +1 -0
- package/dist/views/Request/ResponseSection/ResponseBodyToggle.vue.js +25 -0
- package/dist/views/Request/ResponseSection/ResponseBodyToggle.vue2.js +4 -0
- package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue.js +61 -63
- package/dist/views/Request/consts/index.d.ts +2 -0
- package/dist/views/Request/consts/index.d.ts.map +1 -1
- package/dist/views/Request/consts/index.js +6 -3
- package/dist/views/Request/consts/mediaTypes.d.ts +16 -0
- package/dist/views/Request/consts/mediaTypes.d.ts.map +1 -0
- package/dist/views/Request/consts/mediaTypes.js +108 -0
- package/dist/views/Servers/Servers.vue2.js +17 -17
- package/package.json +8 -6
|
@@ -1,313 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import y from "./RequestAuthDataTableInput.vue.js";
|
|
6
|
-
import { ScalarComboboxMultiselect as L, ScalarButton as B, ScalarIcon as K } from "@scalar/components";
|
|
7
|
-
import { camelToTitleWords as G } from "@scalar/oas-utils/helpers";
|
|
8
|
-
import { ADD_AUTH_OPTIONS as J, ADD_AUTH_DICT as X } from "../consts/new-auth-options.js";
|
|
9
|
-
import Y from "../../../components/DataTable/DataTable.vue.js";
|
|
10
|
-
import c from "../../../components/DataTable/DataTableRow.vue.js";
|
|
11
|
-
import Z from "../../../components/DataTable/DataTableHeader.vue.js";
|
|
12
|
-
import ee from "../components/OAuth2.vue.js";
|
|
13
|
-
const te = { class: "flex gap-1" }, le = /* @__PURE__ */ b("div", { class: "text-c-2 h-8 flex min-w-[120px] items-center border-r-1/2 pr-0 pl-2" }, " Auth Type ", -1), ae = { class: "pl-2" }, oe = { class: "text-c-2 flex whitespace-nowrap opacity-0 group-hover/delete:opacity-100 request-meta-buttons" }, Ve = /* @__PURE__ */ q({
|
|
14
|
-
__name: "RequestAuth",
|
|
15
|
-
props: {
|
|
16
|
-
title: {}
|
|
17
|
-
},
|
|
18
|
-
setup(ue) {
|
|
19
|
-
const {
|
|
20
|
-
activeCollection: h,
|
|
21
|
-
activeRequest: V,
|
|
22
|
-
activeSecurityRequirements: N,
|
|
23
|
-
activeSecuritySchemes: T,
|
|
24
|
-
isReadOnly: U,
|
|
25
|
-
requestMutators: F,
|
|
26
|
-
securitySchemeMutators: S,
|
|
27
|
-
securitySchemes: w
|
|
28
|
-
} = E(), C = O(null), D = (a) => {
|
|
29
|
-
switch (a == null ? void 0 : a.type) {
|
|
30
|
-
case "apiKey":
|
|
31
|
-
return `${M(a.in)}`;
|
|
32
|
-
case "http":
|
|
33
|
-
return `${M(a.scheme)} Authentication`;
|
|
34
|
-
case "oauth2":
|
|
35
|
-
return G(a.flow.type);
|
|
36
|
-
case "openIdConnect":
|
|
37
|
-
return "Open ID Connect";
|
|
38
|
-
default:
|
|
39
|
-
return "None";
|
|
40
|
-
}
|
|
41
|
-
}, g = $(
|
|
42
|
-
() => {
|
|
43
|
-
var e;
|
|
44
|
-
const a = (e = h.value) == null ? void 0 : e.securitySchemeDict, o = N.value.flatMap((r) => {
|
|
45
|
-
const t = Object.keys(r);
|
|
46
|
-
return t.length === 0 && U.value ? { id: "none", label: "None", labelWithoutId: "None" } : t.flatMap((d) => {
|
|
47
|
-
if (!a) return [];
|
|
48
|
-
const s = a[d], W = w[s], R = D(W);
|
|
49
|
-
return {
|
|
50
|
-
id: s,
|
|
51
|
-
label: `${R} (${d})`,
|
|
52
|
-
labelWithoutId: R
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
if (U.value)
|
|
57
|
-
return o;
|
|
58
|
-
{
|
|
59
|
-
const r = V.value.securitySchemeUids.map((t) => {
|
|
60
|
-
const d = w[t], s = D(d);
|
|
61
|
-
return {
|
|
62
|
-
id: t,
|
|
63
|
-
label: "name" in d && d.name.length ? `${s} (${d.name})` : s,
|
|
64
|
-
labelWithoutId: s
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
return [
|
|
68
|
-
{ label: "Select auth", options: [...o, ...r] },
|
|
69
|
-
{
|
|
70
|
-
label: "Add new auth",
|
|
71
|
-
options: J
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
), f = $({
|
|
77
|
-
// Grab the selected OR first security scheme
|
|
78
|
-
get: () => g.value.flatMap(
|
|
79
|
-
(o) => "options" in o ? o.options : o
|
|
80
|
-
).filter(
|
|
81
|
-
({ id: o }) => {
|
|
82
|
-
var e, r;
|
|
83
|
-
return (r = (e = V.value) == null ? void 0 : e.selectedSecuritySchemeUids) == null ? void 0 : r.find(
|
|
84
|
-
(t) => t === o
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
// Update the selected auth per this request
|
|
89
|
-
set: (a) => {
|
|
90
|
-
var e, r, t, d;
|
|
91
|
-
const o = a.find(
|
|
92
|
-
(s) => X[s.id]
|
|
93
|
-
);
|
|
94
|
-
o != null && o.payload && h.value ? ((d = (t = (r = (e = C.value) == null ? void 0 : e.comboboxPopoverRef) == null ? void 0 : r.popoverButtonRef) == null ? void 0 : t.el) == null || d.click(), S.add(
|
|
95
|
-
o.payload,
|
|
96
|
-
h.value.uid,
|
|
97
|
-
V.value,
|
|
98
|
-
!0
|
|
99
|
-
)) : F.edit(
|
|
100
|
-
V.value.uid,
|
|
101
|
-
"selectedSecuritySchemeUids",
|
|
102
|
-
a.map((s) => s.id)
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
}), m = (a, o, e) => S.edit(a.uid ?? "", o, e), A = $(() => f.value.length > 1 ? f.value.map(({ labelWithoutId: a }) => a).join(", ") : f.value.length ? f.value[0].label : "None"), P = (a) => S.delete(a, V.value);
|
|
106
|
-
return (a, o) => (i(), x(z, {
|
|
107
|
-
class: "group/params",
|
|
108
|
-
itemCount: g.value.length
|
|
109
|
-
}, {
|
|
110
|
-
title: l(() => [
|
|
111
|
-
b("div", te, k(a.title), 1)
|
|
112
|
-
]),
|
|
113
|
-
default: l(() => [
|
|
114
|
-
b("form", null, [
|
|
115
|
-
u(n(Y), {
|
|
116
|
-
class: "flex-1",
|
|
117
|
-
columns: [""]
|
|
118
|
-
}, {
|
|
119
|
-
default: l(() => [
|
|
120
|
-
u(n(c), null, {
|
|
121
|
-
default: l(() => [
|
|
122
|
-
u(n(Z), { class: "relative col-span-full cursor-pointer py-[0px] px-[0px] flex items-center" }, {
|
|
123
|
-
default: l(() => [
|
|
124
|
-
u(n(L), {
|
|
125
|
-
ref_key: "comboboxRef",
|
|
126
|
-
ref: C,
|
|
127
|
-
modelValue: f.value,
|
|
128
|
-
"onUpdate:modelValue": o[0] || (o[0] = (e) => f.value = e),
|
|
129
|
-
class: "text-xs w-full left-2",
|
|
130
|
-
fullWidth: "",
|
|
131
|
-
multiple: "",
|
|
132
|
-
options: g.value,
|
|
133
|
-
teleport: ""
|
|
134
|
-
}, {
|
|
135
|
-
default: l(() => [
|
|
136
|
-
u(n(B), {
|
|
137
|
-
class: "h-auto py-0 px-0 text-c-2 hover:text-c-1 font-normal justify-start",
|
|
138
|
-
fullWidth: "",
|
|
139
|
-
variant: "ghost"
|
|
140
|
-
}, {
|
|
141
|
-
default: l(() => [
|
|
142
|
-
le,
|
|
143
|
-
b("span", ae, k(A.value), 1),
|
|
144
|
-
u(n(K), {
|
|
145
|
-
icon: "ChevronDown",
|
|
146
|
-
size: "xs"
|
|
147
|
-
})
|
|
148
|
-
]),
|
|
149
|
-
_: 1
|
|
150
|
-
})
|
|
151
|
-
]),
|
|
152
|
-
_: 1
|
|
153
|
-
}, 8, ["modelValue", "options"])
|
|
154
|
-
]),
|
|
155
|
-
_: 1
|
|
156
|
-
})
|
|
157
|
-
]),
|
|
158
|
-
_: 1
|
|
159
|
-
}),
|
|
160
|
-
(i(!0), _(v, null, Q(n(T), (e, r) => (i(), _(v, {
|
|
161
|
-
key: e.uid
|
|
162
|
-
}, [
|
|
163
|
-
n(T).length > 1 ? (i(), x(n(c), {
|
|
164
|
-
key: 0,
|
|
165
|
-
class: "group/delete"
|
|
166
|
-
}, {
|
|
167
|
-
default: l(() => [
|
|
168
|
-
u(H, { class: "text-c-1 pl-2 text-sm flex items-center justify-between" }, {
|
|
169
|
-
default: l(() => {
|
|
170
|
-
var t;
|
|
171
|
-
return [
|
|
172
|
-
p(k((t = f.value[r]) == null ? void 0 : t.label) + " ", 1),
|
|
173
|
-
b("div", oe, [
|
|
174
|
-
u(n(B), {
|
|
175
|
-
class: "px-1 transition-none",
|
|
176
|
-
size: "sm",
|
|
177
|
-
variant: "ghost",
|
|
178
|
-
onClick: j((d) => P(e), ["stop"])
|
|
179
|
-
}, {
|
|
180
|
-
default: l(() => [
|
|
181
|
-
p(" Delete ")
|
|
182
|
-
]),
|
|
183
|
-
_: 2
|
|
184
|
-
}, 1032, ["onClick"])
|
|
185
|
-
])
|
|
186
|
-
];
|
|
187
|
-
}),
|
|
188
|
-
_: 2
|
|
189
|
-
}, 1024)
|
|
190
|
-
]),
|
|
191
|
-
_: 2
|
|
192
|
-
}, 1024)) : I("", !0),
|
|
193
|
-
e.type === "http" ? (i(), _(v, { key: 1 }, [
|
|
194
|
-
e.scheme === "bearer" ? (i(), x(n(c), { key: 0 }, {
|
|
195
|
-
default: l(() => [
|
|
196
|
-
u(y, {
|
|
197
|
-
id: `http-bearer-token-${e.uid}`,
|
|
198
|
-
modelValue: e.value,
|
|
199
|
-
placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
|
|
200
|
-
type: "password",
|
|
201
|
-
"onUpdate:modelValue": (t) => m(e, "value", t)
|
|
202
|
-
}, {
|
|
203
|
-
default: l(() => [
|
|
204
|
-
p(" Bearer Token ")
|
|
205
|
-
]),
|
|
206
|
-
_: 2
|
|
207
|
-
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
208
|
-
]),
|
|
209
|
-
_: 2
|
|
210
|
-
}, 1024)) : e.scheme === "basic" ? (i(), _(v, { key: 1 }, [
|
|
211
|
-
u(n(c), null, {
|
|
212
|
-
default: l(() => [
|
|
213
|
-
u(y, {
|
|
214
|
-
id: `http-basic-username-${e.uid}`,
|
|
215
|
-
class: "text-c-2",
|
|
216
|
-
modelValue: e.value,
|
|
217
|
-
placeholder: "ScalarEnjoyer01",
|
|
218
|
-
required: "",
|
|
219
|
-
"onUpdate:modelValue": (t) => m(e, "value", t)
|
|
220
|
-
}, {
|
|
221
|
-
default: l(() => [
|
|
222
|
-
p(" Username ")
|
|
223
|
-
]),
|
|
224
|
-
_: 2
|
|
225
|
-
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
226
|
-
]),
|
|
227
|
-
_: 2
|
|
228
|
-
}, 1024),
|
|
229
|
-
u(n(c), null, {
|
|
230
|
-
default: l(() => [
|
|
231
|
-
u(y, {
|
|
232
|
-
id: `http-basic-password-${e.uid}`,
|
|
233
|
-
modelValue: e.secondValue,
|
|
234
|
-
placeholder: "xxxxxx",
|
|
235
|
-
type: "password",
|
|
236
|
-
"onUpdate:modelValue": (t) => m(e, "secondValue", t)
|
|
237
|
-
}, {
|
|
238
|
-
default: l(() => [
|
|
239
|
-
p(" Password ")
|
|
240
|
-
]),
|
|
241
|
-
_: 2
|
|
242
|
-
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
243
|
-
]),
|
|
244
|
-
_: 2
|
|
245
|
-
}, 1024)
|
|
246
|
-
], 64)) : I("", !0)
|
|
247
|
-
], 64)) : e.type === "apiKey" ? (i(), _(v, { key: 2 }, [
|
|
248
|
-
n(U) ? (i(), x(n(c), { key: 1 }, {
|
|
249
|
-
default: l(() => [
|
|
250
|
-
u(y, {
|
|
251
|
-
id: `api-key-value-${e.uid}`,
|
|
252
|
-
modelValue: e.value,
|
|
253
|
-
placeholder: "Value",
|
|
254
|
-
"onUpdate:modelValue": (t) => m(e, "value", t)
|
|
255
|
-
}, {
|
|
256
|
-
default: l(() => [
|
|
257
|
-
p(k(e.name), 1)
|
|
258
|
-
]),
|
|
259
|
-
_: 2
|
|
260
|
-
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
261
|
-
]),
|
|
262
|
-
_: 2
|
|
263
|
-
}, 1024)) : (i(), _(v, { key: 0 }, [
|
|
264
|
-
u(n(c), null, {
|
|
265
|
-
default: l(() => [
|
|
266
|
-
u(y, {
|
|
267
|
-
id: `api-key-name-${e.uid}`,
|
|
268
|
-
modelValue: e.name,
|
|
269
|
-
placeholder: "api-key",
|
|
270
|
-
"onUpdate:modelValue": (t) => m(e, "name", t)
|
|
271
|
-
}, {
|
|
272
|
-
default: l(() => [
|
|
273
|
-
p(" Name ")
|
|
274
|
-
]),
|
|
275
|
-
_: 2
|
|
276
|
-
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
277
|
-
]),
|
|
278
|
-
_: 2
|
|
279
|
-
}, 1024),
|
|
280
|
-
u(n(c), null, {
|
|
281
|
-
default: l(() => [
|
|
282
|
-
u(y, {
|
|
283
|
-
id: `api-key-value-add-${e.uid}`,
|
|
284
|
-
modelValue: e.value,
|
|
285
|
-
placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
|
|
286
|
-
"onUpdate:modelValue": (t) => m(e, "value", t)
|
|
287
|
-
}, {
|
|
288
|
-
default: l(() => [
|
|
289
|
-
p(" Value ")
|
|
290
|
-
]),
|
|
291
|
-
_: 2
|
|
292
|
-
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
293
|
-
]),
|
|
294
|
-
_: 2
|
|
295
|
-
}, 1024)
|
|
296
|
-
], 64))
|
|
297
|
-
], 64)) : e.type === "oauth2" ? (i(), x(n(ee), {
|
|
298
|
-
key: 3,
|
|
299
|
-
scheme: e
|
|
300
|
-
}, null, 8, ["scheme"])) : I("", !0)
|
|
301
|
-
], 64))), 128))
|
|
302
|
-
]),
|
|
303
|
-
_: 1
|
|
304
|
-
})
|
|
305
|
-
])
|
|
306
|
-
]),
|
|
307
|
-
_: 1
|
|
308
|
-
}, 8, ["itemCount"]));
|
|
309
|
-
}
|
|
310
|
-
});
|
|
1
|
+
import t from "./RequestAuth.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import o from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ o(t, [["__scopeId", "data-v-a3784b0e"]]);
|
|
311
5
|
export {
|
|
312
|
-
|
|
6
|
+
m as default
|
|
313
7
|
};
|
|
@@ -1,4 +1,314 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent as O, ref as Q, computed as $, openBlock as i, createBlock as x, withCtx as l, createElementVNode as b, toDisplayString as h, createVNode as u, unref as n, createElementBlock as _, Fragment as v, renderList as j, createTextVNode as p, withModifiers as H, createCommentVNode as w, capitalize as B, pushScopeId as z, popScopeId as E } from "vue";
|
|
2
|
+
import L from "../../../components/DataTable/DataTableCell.vue.js";
|
|
3
|
+
import K from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
|
|
4
|
+
import { useWorkspace as G } from "../../../store/workspace.js";
|
|
5
|
+
import y from "./RequestAuthDataTableInput.vue.js";
|
|
6
|
+
import { ScalarComboboxMultiselect as J, ScalarButton as N, ScalarIcon as X } from "@scalar/components";
|
|
7
|
+
import { camelToTitleWords as Y } from "@scalar/oas-utils/helpers";
|
|
8
|
+
import { ADD_AUTH_OPTIONS as Z, ADD_AUTH_DICT as ee } from "../consts/new-auth-options.js";
|
|
9
|
+
import te from "../../../components/DataTable/DataTable.vue.js";
|
|
10
|
+
import c from "../../../components/DataTable/DataTableRow.vue.js";
|
|
11
|
+
import le from "../../../components/DataTable/DataTableHeader.vue.js";
|
|
12
|
+
import ae from "../components/OAuth2.vue.js";
|
|
13
|
+
const oe = (k) => (z("data-v-a3784b0e"), k = k(), E(), k), ue = { class: "flex gap-1" }, ne = /* @__PURE__ */ oe(() => /* @__PURE__ */ b("div", { class: "text-c-2 h-8 flex min-w-[120px] items-center border-r-1/2 pr-0 pl-2" }, " Auth Type ", -1)), de = { class: "pl-2" }, re = { class: "text-c-2 flex whitespace-nowrap opacity-0 group-hover/delete:opacity-100 request-meta-buttons pr-2" }, ke = /* @__PURE__ */ O({
|
|
14
|
+
__name: "RequestAuth",
|
|
15
|
+
props: {
|
|
16
|
+
title: {}
|
|
17
|
+
},
|
|
18
|
+
setup(k) {
|
|
19
|
+
const {
|
|
20
|
+
activeCollection: S,
|
|
21
|
+
activeRequest: V,
|
|
22
|
+
activeSecurityRequirements: F,
|
|
23
|
+
activeSecuritySchemes: T,
|
|
24
|
+
isReadOnly: U,
|
|
25
|
+
requestMutators: A,
|
|
26
|
+
securitySchemeMutators: g,
|
|
27
|
+
securitySchemes: C
|
|
28
|
+
} = G(), D = Q(null), R = (a) => {
|
|
29
|
+
switch (a == null ? void 0 : a.type) {
|
|
30
|
+
case "apiKey":
|
|
31
|
+
return `${B(a.in)}`;
|
|
32
|
+
case "http":
|
|
33
|
+
return `${B(a.scheme)} Authentication`;
|
|
34
|
+
case "oauth2":
|
|
35
|
+
return Y(a.flow.type);
|
|
36
|
+
case "openIdConnect":
|
|
37
|
+
return "Open ID Connect";
|
|
38
|
+
default:
|
|
39
|
+
return "None";
|
|
40
|
+
}
|
|
41
|
+
}, I = $(
|
|
42
|
+
() => {
|
|
43
|
+
var e;
|
|
44
|
+
const a = (e = S.value) == null ? void 0 : e.securitySchemeDict, o = F.value.flatMap((d) => {
|
|
45
|
+
const t = Object.keys(d);
|
|
46
|
+
return t.length === 0 && U.value ? { id: "none", label: "None", labelWithoutId: "None" } : t.flatMap((r) => {
|
|
47
|
+
if (!a) return [];
|
|
48
|
+
const s = a[r], q = C[s], M = R(q);
|
|
49
|
+
return {
|
|
50
|
+
id: s,
|
|
51
|
+
label: `${M} (${r})`,
|
|
52
|
+
labelWithoutId: M
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
if (U.value)
|
|
57
|
+
return o;
|
|
58
|
+
{
|
|
59
|
+
const d = V.value.securitySchemeUids.map((t) => {
|
|
60
|
+
const r = C[t], s = R(r);
|
|
61
|
+
return {
|
|
62
|
+
id: t,
|
|
63
|
+
label: "name" in r && r.name.length ? `${s} (${r.name})` : s,
|
|
64
|
+
labelWithoutId: s
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
return [
|
|
68
|
+
{ label: "Select auth", options: [...o, ...d] },
|
|
69
|
+
{
|
|
70
|
+
label: "Add new auth",
|
|
71
|
+
options: Z
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
), f = $({
|
|
77
|
+
// Grab the selected OR first security scheme
|
|
78
|
+
get: () => I.value.flatMap(
|
|
79
|
+
(o) => "options" in o ? o.options : o
|
|
80
|
+
).filter(
|
|
81
|
+
({ id: o }) => {
|
|
82
|
+
var e, d;
|
|
83
|
+
return (d = (e = V.value) == null ? void 0 : e.selectedSecuritySchemeUids) == null ? void 0 : d.find(
|
|
84
|
+
(t) => t === o
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
// Update the selected auth per this request
|
|
89
|
+
set: (a) => {
|
|
90
|
+
var e, d, t, r;
|
|
91
|
+
const o = a.find(
|
|
92
|
+
(s) => ee[s.id]
|
|
93
|
+
);
|
|
94
|
+
o != null && o.payload && S.value ? ((r = (t = (d = (e = D.value) == null ? void 0 : e.comboboxPopoverRef) == null ? void 0 : d.popoverButtonRef) == null ? void 0 : t.el) == null || r.click(), g.add(
|
|
95
|
+
o.payload,
|
|
96
|
+
S.value.uid,
|
|
97
|
+
V.value,
|
|
98
|
+
!0
|
|
99
|
+
)) : A.edit(
|
|
100
|
+
V.value.uid,
|
|
101
|
+
"selectedSecuritySchemeUids",
|
|
102
|
+
a.map((s) => s.id)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}), m = (a, o, e) => g.edit(a.uid ?? "", o, e), P = $(() => f.value.length > 1 ? f.value.map(({ labelWithoutId: a }) => a).join(", ") : f.value.length ? f.value[0].label : "None"), W = (a) => g.delete(a, V.value);
|
|
106
|
+
return (a, o) => (i(), x(K, {
|
|
107
|
+
class: "group/params",
|
|
108
|
+
itemCount: I.value.length
|
|
109
|
+
}, {
|
|
110
|
+
title: l(() => [
|
|
111
|
+
b("div", ue, h(a.title), 1)
|
|
112
|
+
]),
|
|
113
|
+
default: l(() => [
|
|
114
|
+
b("form", null, [
|
|
115
|
+
u(n(te), {
|
|
116
|
+
class: "flex-1",
|
|
117
|
+
columns: [""]
|
|
118
|
+
}, {
|
|
119
|
+
default: l(() => [
|
|
120
|
+
u(n(c), null, {
|
|
121
|
+
default: l(() => [
|
|
122
|
+
u(n(le), { class: "relative col-span-full cursor-pointer py-[0px] px-[0px] flex items-center" }, {
|
|
123
|
+
default: l(() => [
|
|
124
|
+
u(n(J), {
|
|
125
|
+
ref_key: "comboboxRef",
|
|
126
|
+
ref: D,
|
|
127
|
+
modelValue: f.value,
|
|
128
|
+
"onUpdate:modelValue": o[0] || (o[0] = (e) => f.value = e),
|
|
129
|
+
class: "text-xs w-full",
|
|
130
|
+
fullWidth: "",
|
|
131
|
+
multiple: "",
|
|
132
|
+
options: I.value,
|
|
133
|
+
style: { "margin-left": "120px" },
|
|
134
|
+
teleport: ""
|
|
135
|
+
}, {
|
|
136
|
+
default: l(() => [
|
|
137
|
+
u(n(N), {
|
|
138
|
+
class: "h-auto py-0 px-0 text-c-2 hover:text-c-1 font-normal justify-start",
|
|
139
|
+
fullWidth: "",
|
|
140
|
+
variant: "ghost"
|
|
141
|
+
}, {
|
|
142
|
+
default: l(() => [
|
|
143
|
+
ne,
|
|
144
|
+
b("span", de, h(P.value), 1),
|
|
145
|
+
u(n(X), {
|
|
146
|
+
icon: "ChevronDown",
|
|
147
|
+
size: "xs"
|
|
148
|
+
})
|
|
149
|
+
]),
|
|
150
|
+
_: 1
|
|
151
|
+
})
|
|
152
|
+
]),
|
|
153
|
+
_: 1
|
|
154
|
+
}, 8, ["modelValue", "options"])
|
|
155
|
+
]),
|
|
156
|
+
_: 1
|
|
157
|
+
})
|
|
158
|
+
]),
|
|
159
|
+
_: 1
|
|
160
|
+
}),
|
|
161
|
+
(i(!0), _(v, null, j(n(T), (e, d) => (i(), _(v, {
|
|
162
|
+
key: e.uid
|
|
163
|
+
}, [
|
|
164
|
+
n(T).length > 1 ? (i(), x(n(c), {
|
|
165
|
+
key: 0,
|
|
166
|
+
class: "group/delete"
|
|
167
|
+
}, {
|
|
168
|
+
default: l(() => [
|
|
169
|
+
u(L, { class: "text-c-2 pl-2 text-xs font-medium flex items-center justify-between bg-b-2" }, {
|
|
170
|
+
default: l(() => {
|
|
171
|
+
var t;
|
|
172
|
+
return [
|
|
173
|
+
p(h((t = f.value[d]) == null ? void 0 : t.label) + " ", 1),
|
|
174
|
+
b("div", re, [
|
|
175
|
+
u(n(N), {
|
|
176
|
+
class: "px-1 transition-none",
|
|
177
|
+
size: "sm",
|
|
178
|
+
variant: "ghost",
|
|
179
|
+
onClick: H((r) => W(e), ["stop"])
|
|
180
|
+
}, {
|
|
181
|
+
default: l(() => [
|
|
182
|
+
p(" Delete ")
|
|
183
|
+
]),
|
|
184
|
+
_: 2
|
|
185
|
+
}, 1032, ["onClick"])
|
|
186
|
+
])
|
|
187
|
+
];
|
|
188
|
+
}),
|
|
189
|
+
_: 2
|
|
190
|
+
}, 1024)
|
|
191
|
+
]),
|
|
192
|
+
_: 2
|
|
193
|
+
}, 1024)) : w("", !0),
|
|
194
|
+
e.type === "http" ? (i(), _(v, { key: 1 }, [
|
|
195
|
+
e.scheme === "bearer" ? (i(), x(n(c), { key: 0 }, {
|
|
196
|
+
default: l(() => [
|
|
197
|
+
u(y, {
|
|
198
|
+
id: `http-bearer-token-${e.uid}`,
|
|
199
|
+
modelValue: e.value,
|
|
200
|
+
placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
|
|
201
|
+
type: "password",
|
|
202
|
+
"onUpdate:modelValue": (t) => m(e, "value", t)
|
|
203
|
+
}, {
|
|
204
|
+
default: l(() => [
|
|
205
|
+
p(" Bearer Token ")
|
|
206
|
+
]),
|
|
207
|
+
_: 2
|
|
208
|
+
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
209
|
+
]),
|
|
210
|
+
_: 2
|
|
211
|
+
}, 1024)) : e.scheme === "basic" ? (i(), _(v, { key: 1 }, [
|
|
212
|
+
u(n(c), null, {
|
|
213
|
+
default: l(() => [
|
|
214
|
+
u(y, {
|
|
215
|
+
id: `http-basic-username-${e.uid}`,
|
|
216
|
+
class: "text-c-2",
|
|
217
|
+
modelValue: e.value,
|
|
218
|
+
placeholder: "ScalarEnjoyer01",
|
|
219
|
+
required: "",
|
|
220
|
+
"onUpdate:modelValue": (t) => m(e, "value", t)
|
|
221
|
+
}, {
|
|
222
|
+
default: l(() => [
|
|
223
|
+
p(" Username ")
|
|
224
|
+
]),
|
|
225
|
+
_: 2
|
|
226
|
+
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
227
|
+
]),
|
|
228
|
+
_: 2
|
|
229
|
+
}, 1024),
|
|
230
|
+
u(n(c), null, {
|
|
231
|
+
default: l(() => [
|
|
232
|
+
u(y, {
|
|
233
|
+
id: `http-basic-password-${e.uid}`,
|
|
234
|
+
modelValue: e.secondValue,
|
|
235
|
+
placeholder: "xxxxxx",
|
|
236
|
+
type: "password",
|
|
237
|
+
"onUpdate:modelValue": (t) => m(e, "secondValue", t)
|
|
238
|
+
}, {
|
|
239
|
+
default: l(() => [
|
|
240
|
+
p(" Password ")
|
|
241
|
+
]),
|
|
242
|
+
_: 2
|
|
243
|
+
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
244
|
+
]),
|
|
245
|
+
_: 2
|
|
246
|
+
}, 1024)
|
|
247
|
+
], 64)) : w("", !0)
|
|
248
|
+
], 64)) : e.type === "apiKey" ? (i(), _(v, { key: 2 }, [
|
|
249
|
+
n(U) ? (i(), x(n(c), { key: 1 }, {
|
|
250
|
+
default: l(() => [
|
|
251
|
+
u(y, {
|
|
252
|
+
id: `api-key-value-${e.uid}`,
|
|
253
|
+
modelValue: e.value,
|
|
254
|
+
placeholder: "Value",
|
|
255
|
+
"onUpdate:modelValue": (t) => m(e, "value", t)
|
|
256
|
+
}, {
|
|
257
|
+
default: l(() => [
|
|
258
|
+
p(h(e.name), 1)
|
|
259
|
+
]),
|
|
260
|
+
_: 2
|
|
261
|
+
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
262
|
+
]),
|
|
263
|
+
_: 2
|
|
264
|
+
}, 1024)) : (i(), _(v, { key: 0 }, [
|
|
265
|
+
u(n(c), null, {
|
|
266
|
+
default: l(() => [
|
|
267
|
+
u(y, {
|
|
268
|
+
id: `api-key-name-${e.uid}`,
|
|
269
|
+
modelValue: e.name,
|
|
270
|
+
placeholder: "api-key",
|
|
271
|
+
"onUpdate:modelValue": (t) => m(e, "name", t)
|
|
272
|
+
}, {
|
|
273
|
+
default: l(() => [
|
|
274
|
+
p(" Name ")
|
|
275
|
+
]),
|
|
276
|
+
_: 2
|
|
277
|
+
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
278
|
+
]),
|
|
279
|
+
_: 2
|
|
280
|
+
}, 1024),
|
|
281
|
+
u(n(c), null, {
|
|
282
|
+
default: l(() => [
|
|
283
|
+
u(y, {
|
|
284
|
+
id: `api-key-value-add-${e.uid}`,
|
|
285
|
+
modelValue: e.value,
|
|
286
|
+
placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
|
|
287
|
+
"onUpdate:modelValue": (t) => m(e, "value", t)
|
|
288
|
+
}, {
|
|
289
|
+
default: l(() => [
|
|
290
|
+
p(" Value ")
|
|
291
|
+
]),
|
|
292
|
+
_: 2
|
|
293
|
+
}, 1032, ["id", "modelValue", "onUpdate:modelValue"])
|
|
294
|
+
]),
|
|
295
|
+
_: 2
|
|
296
|
+
}, 1024)
|
|
297
|
+
], 64))
|
|
298
|
+
], 64)) : e.type === "oauth2" ? (i(), x(n(ae), {
|
|
299
|
+
key: 3,
|
|
300
|
+
scheme: e
|
|
301
|
+
}, null, 8, ["scheme"])) : w("", !0)
|
|
302
|
+
], 64))), 128))
|
|
303
|
+
]),
|
|
304
|
+
_: 1
|
|
305
|
+
})
|
|
306
|
+
])
|
|
307
|
+
]),
|
|
308
|
+
_: 1
|
|
309
|
+
}, 8, ["itemCount"]));
|
|
310
|
+
}
|
|
311
|
+
});
|
|
2
312
|
export {
|
|
3
|
-
|
|
313
|
+
ke as default
|
|
4
314
|
};
|