@scalar/api-client 2.0.25 → 2.0.27
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 +26 -0
- package/dist/components/AddressBar/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue.js +38 -38
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +11 -11
- package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
- package/dist/components/CodeInput/codeVariableWidget.js +48 -46
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.js +23 -30
- package/dist/components/Sidebar/SidebarToggle.vue.d.ts +20 -0
- package/dist/components/Sidebar/SidebarToggle.vue.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarToggle.vue.js +48 -0
- package/dist/components/Sidebar/SidebarToggle.vue2.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -10
- package/dist/layouts/Modal/api-client-modal.d.ts +1 -1
- package/dist/layouts/Modal/api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Modal/api-client-modal.js +41 -41
- package/dist/store/workspace.d.ts +36 -12
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +163 -149
- package/dist/style.css +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +22 -22
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +32 -30
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +97 -98
- package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue.js +155 -125
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +44 -46
- package/dist/views/Request/ResponseSection/ResponseBody.vue.d.ts +0 -5
- package/dist/views/Request/ResponseSection/ResponseBody.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseBody.vue.js +2 -2
- package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +24 -113
- package/package.json +4 -4
package/dist/store/workspace.js
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
import { activeRouterParams as U, PathId as
|
|
2
|
-
import { useModal as
|
|
3
|
-
import { createWorkspace as
|
|
4
|
-
import { createCollection as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
import { activeRouterParams as U, PathId as R, fallbackMissingParams as X } from "../router.js";
|
|
2
|
+
import { useModal as z } from "@scalar/components";
|
|
3
|
+
import { createWorkspace as K } from "@scalar/oas-utils/entities/workspace";
|
|
4
|
+
import { createCollection as Z } from "@scalar/oas-utils/entities/workspace/collection";
|
|
5
|
+
import { createCookie as ee } from "@scalar/oas-utils/entities/workspace/cookie";
|
|
6
|
+
import { createEnvironment as te } from "@scalar/oas-utils/entities/workspace/environment";
|
|
7
|
+
import { createFolder as se } from "@scalar/oas-utils/entities/workspace/folder";
|
|
8
|
+
import { createSecurityScheme as oe } from "@scalar/oas-utils/entities/workspace/security";
|
|
9
|
+
import { createServer as ce } from "@scalar/oas-utils/entities/workspace/server";
|
|
10
|
+
import { createRequest as ae, createRequestExample as ie, createRequestExampleParameter as le } from "@scalar/oas-utils/entities/workspace/spec";
|
|
11
|
+
import { iterateTitle as re, fetchSpecFromUrl as de } from "@scalar/oas-utils/helpers";
|
|
12
|
+
import { getRequestBodyFromOperation as ne } from "@scalar/oas-utils/spec-getters";
|
|
13
|
+
import { importSpecToWorkspace as ue } from "@scalar/oas-utils/transforms";
|
|
13
14
|
import { mutationFactory as m, LS_KEYS as f } from "@scalar/object-utils/mutator-record";
|
|
14
|
-
import { reactive as i, computed as r, toRaw as
|
|
15
|
-
import { useSidebar as
|
|
16
|
-
const { setCollapsedSidebarFolder:
|
|
17
|
-
|
|
15
|
+
import { reactive as i, computed as r, toRaw as me } from "vue";
|
|
16
|
+
import { useSidebar as fe } from "../hooks/useSidebar.js";
|
|
17
|
+
const { setCollapsedSidebarFolder: he } = fe();
|
|
18
|
+
var B;
|
|
19
|
+
const h = !!(typeof window < "u" && ((B = document == null ? void 0 : document.getElementById("scalar-client")) != null && B.getAttribute("data-persist"))), y = i({}), b = m(
|
|
20
|
+
y,
|
|
18
21
|
i({}),
|
|
19
22
|
h && f.REQUEST
|
|
20
|
-
),
|
|
21
|
-
const o =
|
|
22
|
-
return o.childUids.push(c.uid),
|
|
23
|
+
), I = (e, t, s) => {
|
|
24
|
+
const o = ae(e), c = L(o, s);
|
|
25
|
+
return o.childUids.push(c.uid), b.add(o), t && (a[t] ? u.edit(t, "childUids", [
|
|
23
26
|
...a[t].childUids,
|
|
24
27
|
o.uid
|
|
25
28
|
]) : n[t] && p.edit(t, "childUids", [
|
|
26
29
|
...n[t].childUids,
|
|
27
30
|
o.uid
|
|
28
31
|
])), o;
|
|
29
|
-
},
|
|
32
|
+
}, pe = (e, t) => {
|
|
30
33
|
e.childUids.forEach((s) => x.delete(s)), a[t] ? u.edit(
|
|
31
34
|
t,
|
|
32
35
|
"childUids",
|
|
@@ -35,14 +38,14 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
35
38
|
t,
|
|
36
39
|
"childUids",
|
|
37
40
|
n[t].childUids.filter((s) => s !== e.uid)
|
|
38
|
-
),
|
|
39
|
-
},
|
|
41
|
+
), b.delete(e.uid);
|
|
42
|
+
}, k = r(() => {
|
|
40
43
|
var o, c;
|
|
41
|
-
const e = U.value[
|
|
42
|
-
return
|
|
43
|
-
(d) =>
|
|
44
|
+
const e = U.value[R.Request], t = (c = (o = Y.value) == null ? void 0 : o[0]) == null ? void 0 : c.uid, s = y[e] ?? y[t];
|
|
45
|
+
return X(R.Request, s), s && D(s.uid).forEach(
|
|
46
|
+
(d) => he(d, !0)
|
|
44
47
|
), s;
|
|
45
|
-
}),
|
|
48
|
+
}), D = (e, t = []) => {
|
|
46
49
|
const s = Object.values(a).find(
|
|
47
50
|
(c) => c.childUids.includes(e)
|
|
48
51
|
);
|
|
@@ -50,14 +53,14 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
50
53
|
const o = Object.values(n).find(
|
|
51
54
|
({ childUids: c }) => c.includes(e)
|
|
52
55
|
);
|
|
53
|
-
return o ?
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
+
return o ? D(o.uid, [...t, o.uid]) : t;
|
|
57
|
+
}, O = i({}), x = m(
|
|
58
|
+
O,
|
|
56
59
|
i({}),
|
|
57
60
|
h && f.REQUEST_EXAMPLE
|
|
58
|
-
),
|
|
61
|
+
), q = (e) => {
|
|
59
62
|
var t, s, o, c, d, l, v;
|
|
60
|
-
return
|
|
63
|
+
return le({
|
|
61
64
|
key: e.name,
|
|
62
65
|
value: e.schema && "default" in e.schema ? e.schema.default : e.schema && "examples" in e.schema && e.schema.examples.length > 0 ? e.schema.examples[0] : "",
|
|
63
66
|
description: e.description,
|
|
@@ -71,13 +74,13 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
71
74
|
default: (l = e.schema) == null ? void 0 : l.default,
|
|
72
75
|
nullable: (v = e.schema) == null ? void 0 : v.nullable
|
|
73
76
|
});
|
|
74
|
-
},
|
|
77
|
+
}, L = (e, t, s) => {
|
|
75
78
|
var v;
|
|
76
79
|
const o = {
|
|
77
|
-
path: Object.values(e.parameters.path).map(
|
|
78
|
-
query: Object.values(e.parameters.query).map(
|
|
79
|
-
headers: Object.values(e.parameters.headers).map(
|
|
80
|
-
cookies: Object.values(e.parameters.cookies).map(
|
|
80
|
+
path: Object.values(e.parameters.path).map(q),
|
|
81
|
+
query: Object.values(e.parameters.query).map(q),
|
|
82
|
+
headers: Object.values(e.parameters.headers).map(q),
|
|
83
|
+
cookies: Object.values(e.parameters.cookies).map(q)
|
|
81
84
|
}, c = {
|
|
82
85
|
activeBody: "raw",
|
|
83
86
|
raw: {
|
|
@@ -86,7 +89,7 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
86
89
|
}
|
|
87
90
|
};
|
|
88
91
|
if (e.requestBody) {
|
|
89
|
-
const S =
|
|
92
|
+
const S = ne({
|
|
90
93
|
httpVerb: e.method,
|
|
91
94
|
path: e.path,
|
|
92
95
|
information: {
|
|
@@ -99,10 +102,10 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
99
102
|
enabled: !0
|
|
100
103
|
}), c.activeBody = "raw", c.raw.value = S.postData.text);
|
|
101
104
|
}
|
|
102
|
-
const d = s ??
|
|
105
|
+
const d = s ?? re(
|
|
103
106
|
(e.summary ?? "Example") + " #1",
|
|
104
|
-
(S) => e.childUids.some((
|
|
105
|
-
), l =
|
|
107
|
+
(S) => e.childUids.some((G) => S === O[G].name)
|
|
108
|
+
), l = ie({
|
|
106
109
|
url: t != null && t.url ? `{{${t == null ? void 0 : t.url}}}${e.path}` : e.path,
|
|
107
110
|
requestUid: e.uid,
|
|
108
111
|
parameters: o,
|
|
@@ -110,31 +113,31 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
110
113
|
body: c
|
|
111
114
|
});
|
|
112
115
|
return x.add(l), l;
|
|
113
|
-
},
|
|
114
|
-
const s =
|
|
116
|
+
}, ve = (e, t) => {
|
|
117
|
+
const s = L(
|
|
115
118
|
e,
|
|
116
|
-
|
|
119
|
+
A.value[0],
|
|
117
120
|
t
|
|
118
121
|
);
|
|
119
|
-
return
|
|
122
|
+
return b.edit(e.uid, "childUids", [
|
|
120
123
|
...e.childUids,
|
|
121
124
|
s.uid
|
|
122
125
|
]), s;
|
|
123
|
-
},
|
|
124
|
-
|
|
126
|
+
}, ye = (e) => {
|
|
127
|
+
b.edit(
|
|
125
128
|
e.requestUid,
|
|
126
129
|
"childUids",
|
|
127
|
-
|
|
130
|
+
y[e.requestUid].childUids.filter(
|
|
128
131
|
(t) => t !== e.uid
|
|
129
132
|
)
|
|
130
133
|
), x.delete(e.uid);
|
|
131
|
-
},
|
|
134
|
+
}, Ee = r(
|
|
132
135
|
() => {
|
|
133
136
|
var e;
|
|
134
|
-
return
|
|
137
|
+
return O[U.value[R.Examples]] ?? O[((e = k.value) == null ? void 0 : e.childUids[0]) ?? ""];
|
|
135
138
|
}
|
|
136
|
-
),
|
|
137
|
-
default:
|
|
139
|
+
), Se = r(() => Object.values(y).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)), g = i({
|
|
140
|
+
default: te({
|
|
138
141
|
uid: "default",
|
|
139
142
|
name: "Global Environment",
|
|
140
143
|
color: "blue",
|
|
@@ -142,21 +145,21 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
142
145
|
parsed: [],
|
|
143
146
|
isDefault: !0
|
|
144
147
|
})
|
|
145
|
-
}),
|
|
146
|
-
|
|
148
|
+
}), N = m(
|
|
149
|
+
g,
|
|
147
150
|
i({}),
|
|
148
151
|
h && f.ENVIRONMENT
|
|
149
|
-
),
|
|
152
|
+
), we = (e) => {
|
|
150
153
|
if (e === "default") {
|
|
151
154
|
console.warn("Default environment cannot be deleted.");
|
|
152
155
|
return;
|
|
153
156
|
}
|
|
154
|
-
|
|
155
|
-
},
|
|
156
|
-
const e =
|
|
157
|
+
N.delete(e);
|
|
158
|
+
}, Me = r(() => {
|
|
159
|
+
const e = A.value.map((s) => ({
|
|
157
160
|
key: s.url,
|
|
158
161
|
value: s.url
|
|
159
|
-
})), t = Object.values(
|
|
162
|
+
})), t = Object.values(g).map((s) => {
|
|
160
163
|
try {
|
|
161
164
|
return {
|
|
162
165
|
_scalarEnvId: s.uid,
|
|
@@ -169,20 +172,31 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
169
172
|
(s) => Object.entries(s).flatMap(([o, c]) => o !== "_scalarEnvId" ? [{ _scalarEnvId: s._scalarEnvId, key: o, value: c }] : [])
|
|
170
173
|
);
|
|
171
174
|
return [...e, ...t];
|
|
172
|
-
}),
|
|
173
|
-
|
|
175
|
+
}), _ = i({
|
|
176
|
+
default: ee({
|
|
177
|
+
uid: "default",
|
|
178
|
+
name: "Cookie",
|
|
179
|
+
value: "",
|
|
180
|
+
domain: "",
|
|
181
|
+
path: "/",
|
|
182
|
+
secure: !1,
|
|
183
|
+
httpOnly: !1,
|
|
184
|
+
sameSite: "None"
|
|
185
|
+
})
|
|
186
|
+
}), be = m(
|
|
187
|
+
_,
|
|
174
188
|
i({}),
|
|
175
189
|
h && f.COOKIE
|
|
176
|
-
),
|
|
177
|
-
() => U.value[
|
|
178
|
-
), w = i({}),
|
|
190
|
+
), Re = r(
|
|
191
|
+
() => U.value[R.Cookies]
|
|
192
|
+
), w = i({}), E = m(
|
|
179
193
|
w,
|
|
180
194
|
i({}),
|
|
181
195
|
h && f.WORKSPACE
|
|
182
|
-
),
|
|
183
|
-
const t =
|
|
184
|
-
|
|
185
|
-
const s =
|
|
196
|
+
), ke = (e = {}) => {
|
|
197
|
+
const t = K(e);
|
|
198
|
+
E.add(t);
|
|
199
|
+
const s = P(
|
|
186
200
|
{
|
|
187
201
|
spec: {
|
|
188
202
|
info: {
|
|
@@ -192,15 +206,15 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
192
206
|
},
|
|
193
207
|
t.uid
|
|
194
208
|
);
|
|
195
|
-
return
|
|
196
|
-
},
|
|
209
|
+
return I({ summary: "My First Request" }, s.uid), t;
|
|
210
|
+
}, Oe = (e) => {
|
|
197
211
|
if (e === "default") {
|
|
198
212
|
console.warn("Default environment cannot be deleted.");
|
|
199
213
|
return;
|
|
200
214
|
}
|
|
201
|
-
|
|
215
|
+
E.delete(e);
|
|
202
216
|
}, M = r(
|
|
203
|
-
() => w[U.value[
|
|
217
|
+
() => w[U.value[R.Workspace]] ?? w[Object.keys(w)[0]]
|
|
204
218
|
), W = r(
|
|
205
219
|
() => {
|
|
206
220
|
var e;
|
|
@@ -209,34 +223,34 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
209
223
|
return ((c = (o = t.spec) == null ? void 0 : o.info) == null ? void 0 : c.title) === "Drafts" ? 1 : ((l = (d = s.spec) == null ? void 0 : d.info) == null ? void 0 : l.title) === "Drafts" ? -1 : 0;
|
|
210
224
|
});
|
|
211
225
|
}
|
|
212
|
-
),
|
|
226
|
+
), A = r(
|
|
213
227
|
() => {
|
|
214
228
|
var e;
|
|
215
229
|
return (e = W.value) == null ? void 0 : e.flatMap(
|
|
216
230
|
(t) => t.spec.serverUids.map((s) => F[s])
|
|
217
231
|
);
|
|
218
232
|
}
|
|
219
|
-
),
|
|
233
|
+
), V = (e) => y[e] ?? n[e].childUids.flatMap((t) => V(t)), Y = r(
|
|
220
234
|
() => {
|
|
221
235
|
var e;
|
|
222
236
|
return (e = W.value) == null ? void 0 : e.flatMap(
|
|
223
|
-
(t) => t.childUids.flatMap((s) =>
|
|
237
|
+
(t) => t.childUids.flatMap((s) => V(s))
|
|
224
238
|
);
|
|
225
239
|
}
|
|
226
|
-
),
|
|
240
|
+
), xe = r(() => {
|
|
227
241
|
var e;
|
|
228
242
|
return ((e = M.value) == null ? void 0 : e.isReadOnly) ?? !1;
|
|
229
243
|
}), a = i({}), u = m(
|
|
230
244
|
a,
|
|
231
245
|
i({}),
|
|
232
246
|
h && f.COLLECTION
|
|
233
|
-
),
|
|
234
|
-
const s =
|
|
235
|
-
return
|
|
247
|
+
), P = (e, t) => {
|
|
248
|
+
const s = Z(e);
|
|
249
|
+
return E.edit(t, "collectionUids", [
|
|
236
250
|
...w[t].collectionUids,
|
|
237
251
|
s.uid
|
|
238
252
|
]), u.add(s), s;
|
|
239
|
-
},
|
|
253
|
+
}, Ce = (e) => {
|
|
240
254
|
var t, s, o;
|
|
241
255
|
if (M.value) {
|
|
242
256
|
if (((o = (s = (t = a[e]) == null ? void 0 : t.spec) == null ? void 0 : s.info) == null ? void 0 : o.title) === "Drafts") {
|
|
@@ -247,7 +261,7 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
247
261
|
console.warn("You must have at least one collection");
|
|
248
262
|
return;
|
|
249
263
|
}
|
|
250
|
-
|
|
264
|
+
E.edit(
|
|
251
265
|
M.value.uid,
|
|
252
266
|
"collectionUids",
|
|
253
267
|
M.value.collectionUids.filter((c) => c !== e)
|
|
@@ -255,19 +269,19 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
255
269
|
}
|
|
256
270
|
}, C = r(() => {
|
|
257
271
|
const e = Object.values(a)[0];
|
|
258
|
-
if (!
|
|
259
|
-
const t =
|
|
272
|
+
if (!k.value) return e;
|
|
273
|
+
const t = D(k.value.uid);
|
|
260
274
|
if (!t.length) return null;
|
|
261
275
|
const s = t[t.length - 1];
|
|
262
276
|
return a[s] ?? e;
|
|
263
|
-
}),
|
|
277
|
+
}), qe = r(
|
|
264
278
|
() => C.value && F[C.value.selectedServerUid]
|
|
265
279
|
), n = i({}), p = m(
|
|
266
280
|
n,
|
|
267
281
|
i({}),
|
|
268
282
|
h && f.FOLDER
|
|
269
|
-
),
|
|
270
|
-
const s =
|
|
283
|
+
), H = (e, t) => {
|
|
284
|
+
const s = se(e);
|
|
271
285
|
if (t)
|
|
272
286
|
if (a[t])
|
|
273
287
|
u.edit(t, "childUids", [
|
|
@@ -284,7 +298,7 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
284
298
|
return;
|
|
285
299
|
}
|
|
286
300
|
p.add(s);
|
|
287
|
-
},
|
|
301
|
+
}, je = (e, t) => {
|
|
288
302
|
a[t] ? u.edit(
|
|
289
303
|
t,
|
|
290
304
|
"childUids",
|
|
@@ -294,11 +308,11 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
294
308
|
"childUids",
|
|
295
309
|
n[t].childUids.filter((s) => s !== e)
|
|
296
310
|
), p.delete(e);
|
|
297
|
-
}, T = i({}),
|
|
311
|
+
}, T = i({}), J = m(
|
|
298
312
|
T,
|
|
299
313
|
i({}),
|
|
300
314
|
h && f.SECURITY_SCHEME
|
|
301
|
-
),
|
|
315
|
+
), Ue = r(
|
|
302
316
|
() => {
|
|
303
317
|
var e;
|
|
304
318
|
return (e = C.value) == null ? void 0 : e.selectedSecuritySchemes.map((t) => {
|
|
@@ -306,126 +320,126 @@ const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && O
|
|
|
306
320
|
return { scheme: s, ...o };
|
|
307
321
|
})[0];
|
|
308
322
|
}
|
|
309
|
-
),
|
|
323
|
+
), Fe = r(
|
|
310
324
|
() => {
|
|
311
325
|
var e, t;
|
|
312
|
-
return ((e =
|
|
326
|
+
return ((e = k.value) == null ? void 0 : e.security) ?? ((t = C.value) == null ? void 0 : t.spec.security) ?? [];
|
|
313
327
|
}
|
|
314
|
-
), F = i({}),
|
|
328
|
+
), F = i({}), j = m(
|
|
315
329
|
F,
|
|
316
330
|
i({}),
|
|
317
331
|
h && f.SERVER
|
|
318
|
-
),
|
|
319
|
-
const s =
|
|
332
|
+
), Q = (e, t) => {
|
|
333
|
+
const s = ce(e);
|
|
320
334
|
t && u.edit(t, "spec.serverUids", [
|
|
321
335
|
...a[t].spec.serverUids,
|
|
322
336
|
s.uid
|
|
323
|
-
]),
|
|
324
|
-
},
|
|
337
|
+
]), j.add(s);
|
|
338
|
+
}, Ie = (e, t) => {
|
|
325
339
|
u.edit(
|
|
326
340
|
t,
|
|
327
341
|
"spec.serverUids",
|
|
328
342
|
a[t].spec.serverUids.filter(
|
|
329
343
|
(s) => s !== e
|
|
330
344
|
)
|
|
331
|
-
),
|
|
345
|
+
), j.delete(e);
|
|
332
346
|
};
|
|
333
|
-
async function
|
|
347
|
+
async function $(e, t = "default", s = !0) {
|
|
334
348
|
var d;
|
|
335
|
-
const o =
|
|
336
|
-
s &&
|
|
337
|
-
(l) =>
|
|
338
|
-
),
|
|
349
|
+
const o = me(e), c = await ue(o);
|
|
350
|
+
s && E.add(K({ uid: t })), c.requests.forEach(
|
|
351
|
+
(l) => I(l, void 0, c.servers[0])
|
|
352
|
+
), P(c.collection, t), c.folders.forEach((l) => H(l)), c.servers.forEach((l) => Q(l)), Object.entries(
|
|
339
353
|
(((d = c.components) == null ? void 0 : d.securitySchemes) || c.securityDefinitions) ?? {}
|
|
340
354
|
).forEach(
|
|
341
|
-
([l, v]) =>
|
|
342
|
-
|
|
355
|
+
([l, v]) => J.add(
|
|
356
|
+
oe({ ...v, uid: l })
|
|
343
357
|
)
|
|
344
358
|
);
|
|
345
359
|
}
|
|
346
|
-
async function
|
|
360
|
+
async function De(e, t) {
|
|
347
361
|
try {
|
|
348
|
-
const s = await
|
|
349
|
-
await
|
|
362
|
+
const s = await de(e, t);
|
|
363
|
+
await $(s);
|
|
350
364
|
} catch (s) {
|
|
351
365
|
console.error("Failed to fetch spec from URL:", s);
|
|
352
366
|
}
|
|
353
367
|
}
|
|
354
|
-
const
|
|
368
|
+
const ge = z(), Xe = () => ({
|
|
355
369
|
// ---------------------------------------------------------------------------
|
|
356
370
|
// STATE
|
|
357
371
|
workspaces: w,
|
|
358
372
|
collections: a,
|
|
359
|
-
cookies:
|
|
360
|
-
environments:
|
|
373
|
+
cookies: _,
|
|
374
|
+
environments: g,
|
|
361
375
|
folders: n,
|
|
362
|
-
requestExamples:
|
|
363
|
-
requests:
|
|
376
|
+
requestExamples: O,
|
|
377
|
+
requests: y,
|
|
364
378
|
servers: F,
|
|
365
379
|
securitySchemes: T,
|
|
366
380
|
activeCollection: C,
|
|
367
|
-
activeCookieId:
|
|
368
|
-
activeExample:
|
|
369
|
-
activeRequest:
|
|
370
|
-
activeSecurityRequirements:
|
|
371
|
-
activeSecurityScheme:
|
|
372
|
-
activeServer:
|
|
381
|
+
activeCookieId: Re,
|
|
382
|
+
activeExample: Ee,
|
|
383
|
+
activeRequest: k,
|
|
384
|
+
activeSecurityRequirements: Fe,
|
|
385
|
+
activeSecurityScheme: Ue,
|
|
386
|
+
activeServer: qe,
|
|
373
387
|
activeWorkspace: M,
|
|
374
388
|
activeWorkspaceCollections: W,
|
|
375
|
-
activeWorkspaceServers:
|
|
376
|
-
activeParsedEnvironments:
|
|
377
|
-
activeWorkspaceRequests:
|
|
378
|
-
modalState:
|
|
379
|
-
isReadOnly:
|
|
389
|
+
activeWorkspaceServers: A,
|
|
390
|
+
activeParsedEnvironments: Me,
|
|
391
|
+
activeWorkspaceRequests: Y,
|
|
392
|
+
modalState: ge,
|
|
393
|
+
isReadOnly: xe,
|
|
380
394
|
// ---------------------------------------------------------------------------
|
|
381
395
|
// METHODS
|
|
382
|
-
importSpecFile:
|
|
383
|
-
importSpecFromUrl:
|
|
384
|
-
cookieMutators:
|
|
396
|
+
importSpecFile: $,
|
|
397
|
+
importSpecFromUrl: De,
|
|
398
|
+
cookieMutators: be,
|
|
385
399
|
collectionMutators: {
|
|
386
400
|
...u,
|
|
387
401
|
rawAdd: u.add,
|
|
388
|
-
add:
|
|
389
|
-
delete:
|
|
402
|
+
add: P,
|
|
403
|
+
delete: Ce
|
|
390
404
|
},
|
|
391
405
|
environmentMutators: {
|
|
392
|
-
...
|
|
393
|
-
delete:
|
|
406
|
+
...N,
|
|
407
|
+
delete: we
|
|
394
408
|
},
|
|
395
409
|
folderMutators: {
|
|
396
410
|
...p,
|
|
397
411
|
rawAdd: p.add,
|
|
398
|
-
add:
|
|
399
|
-
delete:
|
|
412
|
+
add: H,
|
|
413
|
+
delete: je
|
|
400
414
|
},
|
|
401
415
|
requestMutators: {
|
|
402
|
-
...
|
|
403
|
-
rawAdd:
|
|
404
|
-
add:
|
|
405
|
-
delete:
|
|
416
|
+
...b,
|
|
417
|
+
rawAdd: b.add,
|
|
418
|
+
add: I,
|
|
419
|
+
delete: pe
|
|
406
420
|
},
|
|
407
421
|
requestExampleMutators: {
|
|
408
422
|
...x,
|
|
409
423
|
rawAdd: x.add,
|
|
410
|
-
add:
|
|
411
|
-
delete:
|
|
424
|
+
add: ve,
|
|
425
|
+
delete: ye
|
|
412
426
|
},
|
|
413
|
-
requestsHistory:
|
|
414
|
-
securitySchemeMutators:
|
|
427
|
+
requestsHistory: Se,
|
|
428
|
+
securitySchemeMutators: J,
|
|
415
429
|
serverMutators: {
|
|
416
|
-
...
|
|
417
|
-
rawAdd:
|
|
418
|
-
add:
|
|
419
|
-
delete:
|
|
430
|
+
...j,
|
|
431
|
+
rawAdd: j.add,
|
|
432
|
+
add: Q,
|
|
433
|
+
delete: Ie
|
|
420
434
|
},
|
|
421
435
|
workspaceMutators: {
|
|
422
|
-
...
|
|
423
|
-
rawAdd:
|
|
424
|
-
add:
|
|
425
|
-
delete:
|
|
436
|
+
...E,
|
|
437
|
+
rawAdd: E.add,
|
|
438
|
+
add: ke,
|
|
439
|
+
delete: Oe
|
|
426
440
|
}
|
|
427
441
|
});
|
|
428
442
|
export {
|
|
429
|
-
|
|
430
|
-
|
|
443
|
+
D as findRequestFolders,
|
|
444
|
+
Xe as useWorkspace
|
|
431
445
|
};
|