@scalar/api-client 2.0.46 → 2.0.48
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 +44 -0
- package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBar.vue.js +2 -2
- package/dist/components/AddressBar/AddressBar.vue2.js +77 -71
- package/dist/components/CodeInput/CodeInput.vue.d.ts +3 -1
- 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 +49 -44
- 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 +97 -106
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue2.js +10 -10
- package/dist/components/Search/SearchModal.vue.d.ts.map +1 -1
- package/dist/components/Search/SearchModal.vue.js +1 -1
- package/dist/components/Search/SearchModal.vue2.js +43 -41
- package/dist/components/SideNav/SideNav.vue.d.ts.map +1 -1
- package/dist/components/SideNav/SideNav.vue.js +1 -1
- package/dist/components/SideNav/SideNav.vue2.js +22 -19
- package/dist/components/Sidebar/Sidebar.vue.d.ts +24 -3
- package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.vue.js +57 -19
- 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 +1 -1
- package/dist/components/Sidebar/SidebarListElementActions.vue.d.ts +2 -0
- package/dist/components/Sidebar/SidebarListElementActions.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarListElementActions.vue.js +22 -21
- package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
- package/dist/components/TopNav/TopNav.vue.js +1 -1
- package/dist/components/TopNav/TopNav.vue2.js +46 -43
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/layouts/App/ApiClientApp.vue.js +1 -1
- package/dist/layouts/App/create-api-client-app.d.ts +56 -46
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
- package/dist/layouts/Modal/ApiClientModal.vue2.js +20 -20
- package/dist/layouts/Modal/create-api-client-modal.d.ts +112 -92
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/libs/create-client.d.ts +56 -46
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/event-busses/{command-palette.d.ts → command-palette-bus.d.ts} +1 -1
- package/dist/libs/event-busses/command-palette-bus.d.ts.map +1 -0
- package/dist/libs/event-busses/{execute-requestBus.d.ts → execute-request-bus.d.ts} +1 -1
- package/dist/libs/event-busses/execute-request-bus.d.ts.map +1 -0
- package/dist/libs/event-busses/hot-keys-bus.d.ts +33 -0
- package/dist/libs/event-busses/hot-keys-bus.d.ts.map +1 -0
- package/dist/libs/event-busses/hot-keys-bus.js +33 -0
- package/dist/libs/event-busses/index.d.ts +3 -3
- package/dist/libs/event-busses/index.d.ts.map +1 -1
- package/dist/libs/event-busses/index.js +3 -3
- package/dist/libs/index.js +3 -3
- package/dist/libs/local-storage.d.ts +1 -1
- package/dist/libs/local-storage.d.ts.map +1 -1
- package/dist/libs/local-storage.js +15 -30
- package/dist/router.d.ts +2 -2
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +3 -3
- package/dist/store/workspace.d.ts +112 -92
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +140 -137
- package/dist/style.css +1 -1
- package/dist/views/Cookies/CookieForm.vue.d.ts.map +1 -1
- package/dist/views/Cookies/CookieForm.vue.js +14 -15
- package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +114 -55
- package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
- package/dist/views/Environment/Environment.vue2.js +21 -20
- 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 +132 -128
- 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 +253 -139
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +27 -5
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +83 -158
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/components/WorkspaceDropdown.vue.d.ts.map +1 -1
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +214 -70
- package/package.json +6 -6
- package/dist/libs/event-busses/command-palette.d.ts.map +0 -1
- package/dist/libs/event-busses/execute-requestBus.d.ts.map +0 -1
- package/dist/libs/event-busses/hot-key.d.ts +0 -34
- package/dist/libs/event-busses/hot-key.d.ts.map +0 -1
- package/dist/libs/event-busses/hot-key.js +0 -25
- /package/dist/libs/event-busses/{command-palette.js → command-palette-bus.js} +0 -0
- /package/dist/libs/event-busses/{execute-requestBus.js → execute-request-bus.js} +0 -0
package/dist/store/workspace.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { PathId as f, fallbackMissingParams as Oe } from "../router.js";
|
|
2
2
|
import { useModal as Ue } from "@scalar/components";
|
|
3
|
-
import { createWorkspace as
|
|
3
|
+
import { createWorkspace as je } from "@scalar/oas-utils/entities/workspace";
|
|
4
4
|
import { createCollection as xe } from "@scalar/oas-utils/entities/workspace/collection";
|
|
5
|
-
import { createCookie as
|
|
6
|
-
import { createEnvironment as
|
|
7
|
-
import { createFolder as
|
|
8
|
-
import { createSecurityScheme as
|
|
9
|
-
import { createServer as
|
|
10
|
-
import { createRequest as
|
|
11
|
-
import { iterateTitle as Ne, fetchSpecFromUrl as
|
|
12
|
-
import { getRequestBodyFromOperation as
|
|
13
|
-
import { importSpecToWorkspace as
|
|
5
|
+
import { createCookie as Ce } from "@scalar/oas-utils/entities/workspace/cookie";
|
|
6
|
+
import { createEnvironment as Fe } from "@scalar/oas-utils/entities/workspace/environment";
|
|
7
|
+
import { createFolder as Ke } from "@scalar/oas-utils/entities/workspace/folder";
|
|
8
|
+
import { createSecurityScheme as We, securitySchemeApiKeyIn as ge } from "@scalar/oas-utils/entities/workspace/security";
|
|
9
|
+
import { createServer as Ie } from "@scalar/oas-utils/entities/workspace/server";
|
|
10
|
+
import { createRequest as Ae, createRequestExample as Pe, createRequestExampleParameter as Te } from "@scalar/oas-utils/entities/workspace/spec";
|
|
11
|
+
import { iterateTitle as Ne, fetchSpecFromUrl as qe } from "@scalar/oas-utils/helpers";
|
|
12
|
+
import { getRequestBodyFromOperation as _e } from "@scalar/oas-utils/spec-getters";
|
|
13
|
+
import { importSpecToWorkspace as Le } from "@scalar/oas-utils/transforms";
|
|
14
14
|
import { mutationFactory as E, LS_KEYS as b } from "@scalar/object-utils/mutator-record";
|
|
15
|
-
import { computed as u, reactive as l, inject as
|
|
16
|
-
const
|
|
15
|
+
import { computed as u, reactive as l, inject as Be, toRaw as De } from "vue";
|
|
16
|
+
const ot = (H, y = !0) => {
|
|
17
17
|
const F = u(() => {
|
|
18
18
|
const e = {
|
|
19
19
|
[f.Collection]: "default",
|
|
@@ -33,7 +33,7 @@ const it = (H, y = !0) => {
|
|
|
33
33
|
l({}),
|
|
34
34
|
y && b.REQUEST
|
|
35
35
|
), q = (e, t, s) => {
|
|
36
|
-
const i =
|
|
36
|
+
const i = Ae(e), c = Q(i, s);
|
|
37
37
|
return i.childUids.push(c.uid), h.add(i), t && (d[t] ? p.edit(t, "childUids", [
|
|
38
38
|
...d[t].childUids,
|
|
39
39
|
i.uid
|
|
@@ -42,7 +42,7 @@ const it = (H, y = !0) => {
|
|
|
42
42
|
i.uid
|
|
43
43
|
])), i;
|
|
44
44
|
}, _ = (e, t) => {
|
|
45
|
-
e.childUids.forEach((s) =>
|
|
45
|
+
e.childUids.forEach((s) => W.delete(s)), t && d[t] ? p.edit(
|
|
46
46
|
t,
|
|
47
47
|
"childUids",
|
|
48
48
|
d[t].childUids.filter((s) => s !== e.uid)
|
|
@@ -51,11 +51,11 @@ const it = (H, y = !0) => {
|
|
|
51
51
|
"childUids",
|
|
52
52
|
r[t].childUids.filter((s) => s !== e.uid)
|
|
53
53
|
), h.delete(e.uid);
|
|
54
|
-
},
|
|
54
|
+
}, U = u(() => {
|
|
55
55
|
var i, c;
|
|
56
56
|
const e = F.value[f.Request], t = (c = (i = Z.value) == null ? void 0 : i[0]) == null ? void 0 : c.uid, s = m[e] ?? m[t];
|
|
57
57
|
return Oe(f.Request, s), s;
|
|
58
|
-
}),
|
|
58
|
+
}), L = (e, t = []) => {
|
|
59
59
|
const s = Object.values(d).find(
|
|
60
60
|
(c) => c.childUids.includes(e)
|
|
61
61
|
);
|
|
@@ -63,14 +63,14 @@ const it = (H, y = !0) => {
|
|
|
63
63
|
const i = Object.values(r).find(
|
|
64
64
|
({ childUids: c }) => c.includes(e)
|
|
65
65
|
);
|
|
66
|
-
return i ?
|
|
67
|
-
}, K = l({}),
|
|
66
|
+
return i ? L(i.uid, [...t, i.uid]) : t;
|
|
67
|
+
}, K = l({}), W = E(
|
|
68
68
|
K,
|
|
69
69
|
l({}),
|
|
70
70
|
y && b.REQUEST_EXAMPLE
|
|
71
|
-
),
|
|
72
|
-
var t, s, i, c, n, v,
|
|
73
|
-
return
|
|
71
|
+
), I = (e) => {
|
|
72
|
+
var t, s, i, c, n, v, k;
|
|
73
|
+
return Te({
|
|
74
74
|
key: e.name,
|
|
75
75
|
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] : "",
|
|
76
76
|
description: e.description,
|
|
@@ -82,18 +82,18 @@ const it = (H, y = !0) => {
|
|
|
82
82
|
minimum: (c = e.schema) == null ? void 0 : c.minimum,
|
|
83
83
|
maximum: (n = e.schema) == null ? void 0 : n.maximum,
|
|
84
84
|
default: (v = e.schema) == null ? void 0 : v.default,
|
|
85
|
-
nullable: (
|
|
85
|
+
nullable: (k = e.schema) == null ? void 0 : k.nullable
|
|
86
86
|
});
|
|
87
87
|
}, Q = (e, t, s) => {
|
|
88
|
-
var
|
|
88
|
+
var k;
|
|
89
89
|
const i = {
|
|
90
|
-
path: Object.values(e.parameters.path).map(
|
|
91
|
-
query: Object.values(e.parameters.query).map(
|
|
90
|
+
path: Object.values(e.parameters.path).map(I),
|
|
91
|
+
query: Object.values(e.parameters.query).map(I),
|
|
92
92
|
headers: Object.values(e.parameters.headers).map(
|
|
93
|
-
|
|
93
|
+
I
|
|
94
94
|
),
|
|
95
95
|
cookies: Object.values(e.parameters.cookies).map(
|
|
96
|
-
|
|
96
|
+
I
|
|
97
97
|
)
|
|
98
98
|
}, c = {
|
|
99
99
|
activeBody: "raw",
|
|
@@ -103,14 +103,14 @@ const it = (H, y = !0) => {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
if (e.requestBody) {
|
|
106
|
-
const S =
|
|
106
|
+
const S = _e({
|
|
107
107
|
httpVerb: e.method,
|
|
108
108
|
path: e.path,
|
|
109
109
|
information: {
|
|
110
110
|
requestBody: e.requestBody
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
-
((
|
|
113
|
+
((k = S == null ? void 0 : S.postData) == null ? void 0 : k.mimeType) === "application/json" && (i.headers.push({
|
|
114
114
|
key: "Content-Type",
|
|
115
115
|
value: "application/json",
|
|
116
116
|
enabled: !0
|
|
@@ -119,14 +119,14 @@ const it = (H, y = !0) => {
|
|
|
119
119
|
const n = s ?? Ne(
|
|
120
120
|
(e.summary ?? "Example") + " #1",
|
|
121
121
|
(S) => e.childUids.some((o) => S === K[o].name)
|
|
122
|
-
), v =
|
|
122
|
+
), v = Pe({
|
|
123
123
|
url: t != null && t.url ? `{{${t == null ? void 0 : t.url}}}${e.path}` : e.path,
|
|
124
124
|
requestUid: e.uid,
|
|
125
125
|
parameters: i,
|
|
126
126
|
name: n,
|
|
127
127
|
body: c
|
|
128
128
|
});
|
|
129
|
-
return
|
|
129
|
+
return W.add(v), v;
|
|
130
130
|
}, oe = (e, t) => {
|
|
131
131
|
const s = Q(
|
|
132
132
|
e,
|
|
@@ -144,14 +144,14 @@ const it = (H, y = !0) => {
|
|
|
144
144
|
m[e.requestUid].childUids.filter(
|
|
145
145
|
(t) => t !== e.uid
|
|
146
146
|
)
|
|
147
|
-
),
|
|
147
|
+
), W.delete(e.uid);
|
|
148
148
|
}, de = u(
|
|
149
149
|
() => {
|
|
150
150
|
var e;
|
|
151
|
-
return K[F.value[f.Examples]] ?? K[((e =
|
|
151
|
+
return K[F.value[f.Examples]] ?? K[((e = U.value) == null ? void 0 : e.childUids[0]) ?? ""];
|
|
152
152
|
}
|
|
153
|
-
), le = u(() => Object.values(m).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)),
|
|
154
|
-
default:
|
|
153
|
+
), le = u(() => Object.values(m).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)), B = l({
|
|
154
|
+
default: Fe({
|
|
155
155
|
uid: "default",
|
|
156
156
|
name: "Global Environment",
|
|
157
157
|
color: "blue",
|
|
@@ -160,7 +160,7 @@ const it = (H, y = !0) => {
|
|
|
160
160
|
isDefault: !0
|
|
161
161
|
})
|
|
162
162
|
}), G = E(
|
|
163
|
-
|
|
163
|
+
B,
|
|
164
164
|
l({}),
|
|
165
165
|
y && b.ENVIRONMENT
|
|
166
166
|
), re = (e) => {
|
|
@@ -173,7 +173,7 @@ const it = (H, y = !0) => {
|
|
|
173
173
|
const e = V.value.map((s) => ({
|
|
174
174
|
key: s.url,
|
|
175
175
|
value: s.url
|
|
176
|
-
})), t = Object.values(
|
|
176
|
+
})), t = Object.values(B).map((s) => {
|
|
177
177
|
try {
|
|
178
178
|
return {
|
|
179
179
|
_scalarEnvId: s.uid,
|
|
@@ -187,7 +187,7 @@ const it = (H, y = !0) => {
|
|
|
187
187
|
);
|
|
188
188
|
return [...e, ...t];
|
|
189
189
|
}), X = l({
|
|
190
|
-
default:
|
|
190
|
+
default: Ce({
|
|
191
191
|
uid: "default",
|
|
192
192
|
name: "Cookie",
|
|
193
193
|
value: "",
|
|
@@ -203,14 +203,14 @@ const it = (H, y = !0) => {
|
|
|
203
203
|
y && b.COOKIE
|
|
204
204
|
), fe = u(
|
|
205
205
|
() => F.value[f.Cookies]
|
|
206
|
-
),
|
|
207
|
-
|
|
206
|
+
), w = l({}), O = E(
|
|
207
|
+
w,
|
|
208
208
|
l({}),
|
|
209
209
|
y && b.WORKSPACE
|
|
210
210
|
), me = (e = {}) => {
|
|
211
|
-
const t =
|
|
212
|
-
|
|
213
|
-
const s =
|
|
211
|
+
const t = je(e);
|
|
212
|
+
O.add(t);
|
|
213
|
+
const s = $(
|
|
214
214
|
{
|
|
215
215
|
spec: {
|
|
216
216
|
info: {
|
|
@@ -222,17 +222,19 @@ const it = (H, y = !0) => {
|
|
|
222
222
|
);
|
|
223
223
|
return q({ summary: "My First Request" }, s.uid), t;
|
|
224
224
|
}, he = (e) => {
|
|
225
|
-
if (
|
|
226
|
-
console.warn("
|
|
225
|
+
if (Object.keys(w).length <= 1) {
|
|
226
|
+
console.warn("The last workspace cannot be deleted.");
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
|
-
|
|
230
|
-
},
|
|
231
|
-
()
|
|
232
|
-
|
|
229
|
+
O.delete(e);
|
|
230
|
+
}, pe = (e, t) => {
|
|
231
|
+
w[e] ? O.edit(e, "name", t) : console.warn(`Workspace with uid ${e} not found.`);
|
|
232
|
+
}, j = u(
|
|
233
|
+
() => w[F.value[f.Workspace]] ?? w[Object.keys(w)[0]]
|
|
234
|
+
), D = u(
|
|
233
235
|
() => {
|
|
234
236
|
var e;
|
|
235
|
-
return (e =
|
|
237
|
+
return (e = j.value) == null ? void 0 : e.collectionUids.map((t) => d[t]).sort((t, s) => {
|
|
236
238
|
var i, c, n, v;
|
|
237
239
|
return ((c = (i = t.spec) == null ? void 0 : i.info) == null ? void 0 : c.title) === "Drafts" ? 1 : ((v = (n = s.spec) == null ? void 0 : n.info) == null ? void 0 : v.title) === "Drafts" ? -1 : 0;
|
|
238
240
|
});
|
|
@@ -240,33 +242,33 @@ const it = (H, y = !0) => {
|
|
|
240
242
|
), V = u(
|
|
241
243
|
() => {
|
|
242
244
|
var e;
|
|
243
|
-
return (e =
|
|
244
|
-
(t) => t.spec.serverUids.map((s) =>
|
|
245
|
+
return (e = D.value) == null ? void 0 : e.flatMap(
|
|
246
|
+
(t) => t.spec.serverUids.map((s) => T[s])
|
|
245
247
|
);
|
|
246
248
|
}
|
|
247
249
|
), z = (e) => m[e] ?? r[e].childUids.flatMap((t) => z(t)), Z = u(
|
|
248
250
|
() => {
|
|
249
251
|
var e;
|
|
250
|
-
return (e =
|
|
252
|
+
return (e = D.value) == null ? void 0 : e.flatMap(
|
|
251
253
|
(t) => t.childUids.flatMap((s) => z(s))
|
|
252
254
|
);
|
|
253
255
|
}
|
|
254
|
-
),
|
|
256
|
+
), ve = u(() => {
|
|
255
257
|
var e;
|
|
256
|
-
return ((e =
|
|
258
|
+
return ((e = j.value) == null ? void 0 : e.isReadOnly) ?? !1;
|
|
257
259
|
}), d = l({}), p = E(
|
|
258
260
|
d,
|
|
259
261
|
l({}),
|
|
260
262
|
y && b.COLLECTION
|
|
261
|
-
),
|
|
263
|
+
), $ = (e, t) => {
|
|
262
264
|
const s = xe(e);
|
|
263
|
-
return
|
|
264
|
-
...
|
|
265
|
+
return O.edit(t, "collectionUids", [
|
|
266
|
+
...w[t].collectionUids,
|
|
265
267
|
s.uid
|
|
266
268
|
]), p.add(s), s;
|
|
267
|
-
},
|
|
269
|
+
}, ye = (e) => {
|
|
268
270
|
var t, s, i;
|
|
269
|
-
if (
|
|
271
|
+
if (j.value) {
|
|
270
272
|
if (((i = (s = (t = d[e.uid]) == null ? void 0 : t.spec) == null ? void 0 : s.info) == null ? void 0 : i.title) === "Drafts") {
|
|
271
273
|
console.warn("The drafts collection cannot be deleted");
|
|
272
274
|
return;
|
|
@@ -276,30 +278,30 @@ const it = (H, y = !0) => {
|
|
|
276
278
|
return;
|
|
277
279
|
}
|
|
278
280
|
e.childUids.forEach((c) => {
|
|
279
|
-
m[c] ? _(m[c]) : r[c] &&
|
|
280
|
-
}),
|
|
281
|
-
|
|
281
|
+
m[c] ? _(m[c]) : r[c] && J(r[c]);
|
|
282
|
+
}), O.edit(
|
|
283
|
+
j.value.uid,
|
|
282
284
|
"collectionUids",
|
|
283
|
-
|
|
285
|
+
j.value.collectionUids.filter(
|
|
284
286
|
(c) => c !== e.uid
|
|
285
287
|
)
|
|
286
288
|
), p.delete(e.uid);
|
|
287
289
|
}
|
|
288
290
|
}, A = u(() => {
|
|
289
291
|
const e = Object.values(d)[0];
|
|
290
|
-
if (!
|
|
291
|
-
const t =
|
|
292
|
+
if (!U.value) return e;
|
|
293
|
+
const t = L(U.value.uid);
|
|
292
294
|
if (!t.length) return null;
|
|
293
295
|
const s = t[t.length - 1];
|
|
294
296
|
return d[s] ?? e;
|
|
295
|
-
}),
|
|
296
|
-
() => A.value &&
|
|
297
|
+
}), Se = u(
|
|
298
|
+
() => A.value && T[A.value.selectedServerUid]
|
|
297
299
|
), r = l({}), R = E(
|
|
298
300
|
r,
|
|
299
301
|
l({}),
|
|
300
302
|
y && b.FOLDER
|
|
301
303
|
), ee = (e, t) => {
|
|
302
|
-
const s =
|
|
304
|
+
const s = Ke(e);
|
|
303
305
|
if (t)
|
|
304
306
|
if (d[t])
|
|
305
307
|
p.edit(t, "childUids", [
|
|
@@ -316,9 +318,9 @@ const it = (H, y = !0) => {
|
|
|
316
318
|
return;
|
|
317
319
|
}
|
|
318
320
|
R.add(s);
|
|
319
|
-
},
|
|
321
|
+
}, J = (e, t) => {
|
|
320
322
|
e.childUids.forEach((s) => {
|
|
321
|
-
m[s] ? _(m[s]) : r[s] &&
|
|
323
|
+
m[s] ? _(m[s]) : r[s] && J(r[s]);
|
|
322
324
|
}), t && d[t] ? p.edit(
|
|
323
325
|
t,
|
|
324
326
|
"childUids",
|
|
@@ -328,24 +330,24 @@ const it = (H, y = !0) => {
|
|
|
328
330
|
"childUids",
|
|
329
331
|
r[t].childUids.filter((s) => s !== e.uid)
|
|
330
332
|
), R.delete(e.uid);
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
+
}, Y = l({}), P = E(
|
|
334
|
+
Y,
|
|
333
335
|
l({}),
|
|
334
336
|
y && b.SECURITY_SCHEME
|
|
335
|
-
),
|
|
337
|
+
), Ee = u(
|
|
336
338
|
() => {
|
|
337
339
|
var e;
|
|
338
|
-
return ((e =
|
|
339
|
-
(t) =>
|
|
340
|
+
return ((e = U.value) == null ? void 0 : e.selectedSecuritySchemeUids.map(
|
|
341
|
+
(t) => Y[t]
|
|
340
342
|
)) ?? [];
|
|
341
343
|
}
|
|
342
|
-
),
|
|
344
|
+
), be = u(
|
|
343
345
|
() => {
|
|
344
346
|
var e, t;
|
|
345
|
-
return ((e =
|
|
347
|
+
return ((e = U.value) == null ? void 0 : e.security) ?? ((t = A.value) == null ? void 0 : t.spec.security) ?? [];
|
|
346
348
|
}
|
|
347
|
-
),
|
|
348
|
-
const c =
|
|
349
|
+
), g = (e, t, s, i = !1) => {
|
|
350
|
+
const c = We(e);
|
|
349
351
|
P.add(c), t && e.nameKey && p.edit(
|
|
350
352
|
t,
|
|
351
353
|
`securitySchemeDict.${e.nameKey}`,
|
|
@@ -357,7 +359,7 @@ const it = (H, y = !0) => {
|
|
|
357
359
|
...s.selectedSecuritySchemeUids,
|
|
358
360
|
c.uid
|
|
359
361
|
]));
|
|
360
|
-
},
|
|
362
|
+
}, we = (e, t) => {
|
|
361
363
|
t && (h.edit(
|
|
362
364
|
t.uid,
|
|
363
365
|
"securitySchemeUids",
|
|
@@ -367,16 +369,16 @@ const it = (H, y = !0) => {
|
|
|
367
369
|
"selectedSecuritySchemeUids",
|
|
368
370
|
t.selectedSecuritySchemeUids.filter((s) => s !== e.uid)
|
|
369
371
|
)), P.delete(e.uid);
|
|
370
|
-
},
|
|
371
|
-
|
|
372
|
+
}, T = l({}), N = E(
|
|
373
|
+
T,
|
|
372
374
|
l({}),
|
|
373
375
|
y && b.SERVER
|
|
374
376
|
), te = (e, t) => {
|
|
375
|
-
const s =
|
|
377
|
+
const s = Ie(e);
|
|
376
378
|
t && p.edit(t, "spec.serverUids", [
|
|
377
379
|
...d[t].spec.serverUids,
|
|
378
380
|
s.uid
|
|
379
|
-
]),
|
|
381
|
+
]), N.add(s);
|
|
380
382
|
}, Re = (e, t) => {
|
|
381
383
|
p.edit(
|
|
382
384
|
t,
|
|
@@ -384,32 +386,32 @@ const it = (H, y = !0) => {
|
|
|
384
386
|
d[t].spec.serverUids.filter(
|
|
385
387
|
(s) => s !== e
|
|
386
388
|
)
|
|
387
|
-
),
|
|
389
|
+
), N.delete(e);
|
|
388
390
|
}, se = async (e, t = "default", s) => {
|
|
389
391
|
var S;
|
|
390
|
-
const i =
|
|
392
|
+
const i = De(e), c = await Le(i, s);
|
|
391
393
|
c.requests.forEach(
|
|
392
394
|
(o) => q(o, void 0, c.servers[0])
|
|
393
395
|
);
|
|
394
|
-
const n =
|
|
396
|
+
const n = $(c.collection, t);
|
|
395
397
|
c.folders.forEach((o) => ee(o)), c.servers.forEach((o) => te(o));
|
|
396
398
|
const v = Object.entries(
|
|
397
399
|
(((S = c.components) == null ? void 0 : S.securitySchemes) || c.securityDefinitions) ?? {}
|
|
398
|
-
),
|
|
400
|
+
), k = (o, a) => {
|
|
399
401
|
var C;
|
|
400
|
-
const
|
|
401
|
-
if (!
|
|
402
|
-
const
|
|
403
|
-
h.edit(a.uid, "selectedSecuritySchemeUids", [
|
|
402
|
+
const M = (C = Object.keys(o[0])) == null ? void 0 : C[0];
|
|
403
|
+
if (!M) return;
|
|
404
|
+
const x = n.securitySchemeDict[M];
|
|
405
|
+
h.edit(a.uid, "selectedSecuritySchemeUids", [x]);
|
|
404
406
|
};
|
|
405
407
|
v.forEach(([o, a]) => {
|
|
406
408
|
if (a && "flows" in a) {
|
|
407
|
-
const { flows:
|
|
408
|
-
if (
|
|
409
|
-
const C = Object.entries(
|
|
410
|
-
ce && ie &&
|
|
409
|
+
const { flows: M, ...x } = a;
|
|
410
|
+
if (M) {
|
|
411
|
+
const C = Object.entries(M), [ce, ie] = C[0];
|
|
412
|
+
ce && ie && g(
|
|
411
413
|
{
|
|
412
|
-
...
|
|
414
|
+
...x,
|
|
413
415
|
type: "oauth2",
|
|
414
416
|
flow: { ...ie, type: ce },
|
|
415
417
|
nameKey: o
|
|
@@ -417,10 +419,10 @@ const it = (H, y = !0) => {
|
|
|
417
419
|
n.uid
|
|
418
420
|
);
|
|
419
421
|
}
|
|
420
|
-
} else a.type === "basic" ?
|
|
422
|
+
} else a.type === "basic" ? g(
|
|
421
423
|
{ ...a, type: "http", scheme: "basic", nameKey: o },
|
|
422
424
|
n.uid
|
|
423
|
-
) : a.type === "http" ?
|
|
425
|
+
) : a.type === "http" ? g(
|
|
424
426
|
{
|
|
425
427
|
...a,
|
|
426
428
|
type: "http",
|
|
@@ -428,11 +430,11 @@ const it = (H, y = !0) => {
|
|
|
428
430
|
nameKey: o
|
|
429
431
|
},
|
|
430
432
|
n.uid
|
|
431
|
-
) : a.type === "apiKey" &&
|
|
433
|
+
) : a.type === "apiKey" && g(
|
|
432
434
|
{
|
|
433
435
|
...a,
|
|
434
436
|
type: "apiKey",
|
|
435
|
-
in:
|
|
437
|
+
in: ge.includes(
|
|
436
438
|
a.in
|
|
437
439
|
) ? a.in : "header",
|
|
438
440
|
nameKey: o
|
|
@@ -440,59 +442,59 @@ const it = (H, y = !0) => {
|
|
|
440
442
|
n.uid
|
|
441
443
|
);
|
|
442
444
|
}), v.length && Object.values(m).forEach((o) => {
|
|
443
|
-
var
|
|
444
|
-
const a = ((
|
|
445
|
-
a != null && a.length ?
|
|
445
|
+
var M, x;
|
|
446
|
+
const a = ((M = o.security) == null ? void 0 : M.filter((C) => JSON.stringify(C) !== "{}")) ?? [];
|
|
447
|
+
a != null && a.length ? k(a, o) : typeof o.security > "u" && ((x = n.spec.security) != null && x.length) && k(n.spec.security, o);
|
|
446
448
|
});
|
|
447
449
|
};
|
|
448
|
-
async function
|
|
450
|
+
async function ke(e, t, s) {
|
|
449
451
|
try {
|
|
450
|
-
const i = await
|
|
452
|
+
const i = await qe(e, t);
|
|
451
453
|
await se(i, void 0, s);
|
|
452
454
|
} catch (i) {
|
|
453
455
|
console.error("Failed to fetch spec from URL:", i);
|
|
454
456
|
}
|
|
455
457
|
}
|
|
456
|
-
const
|
|
458
|
+
const Me = Ue();
|
|
457
459
|
return {
|
|
458
460
|
// ---------------------------------------------------------------------------
|
|
459
461
|
// STATE
|
|
460
|
-
workspaces:
|
|
462
|
+
workspaces: w,
|
|
461
463
|
collections: d,
|
|
462
464
|
cookies: X,
|
|
463
|
-
environments:
|
|
465
|
+
environments: B,
|
|
464
466
|
folders: r,
|
|
465
467
|
requestExamples: K,
|
|
466
468
|
requests: m,
|
|
467
|
-
servers:
|
|
468
|
-
securitySchemes:
|
|
469
|
+
servers: T,
|
|
470
|
+
securitySchemes: Y,
|
|
469
471
|
activeCollection: A,
|
|
470
472
|
activeCookieId: fe,
|
|
471
473
|
activeExample: de,
|
|
472
|
-
activeRequest:
|
|
474
|
+
activeRequest: U,
|
|
473
475
|
activeRouterParams: F,
|
|
474
|
-
activeSecurityRequirements:
|
|
475
|
-
activeSecuritySchemes:
|
|
476
|
-
activeServer:
|
|
477
|
-
activeWorkspace:
|
|
478
|
-
activeWorkspaceCollections:
|
|
476
|
+
activeSecurityRequirements: be,
|
|
477
|
+
activeSecuritySchemes: Ee,
|
|
478
|
+
activeServer: Se,
|
|
479
|
+
activeWorkspace: j,
|
|
480
|
+
activeWorkspaceCollections: D,
|
|
479
481
|
activeWorkspaceServers: V,
|
|
480
482
|
activeParsedEnvironments: ne,
|
|
481
483
|
activeWorkspaceRequests: Z,
|
|
482
|
-
modalState:
|
|
483
|
-
isReadOnly:
|
|
484
|
+
modalState: Me,
|
|
485
|
+
isReadOnly: ve,
|
|
484
486
|
router: H,
|
|
485
487
|
// ---------------------------------------------------------------------------
|
|
486
488
|
// METHODS
|
|
487
|
-
findRequestFolders:
|
|
489
|
+
findRequestFolders: L,
|
|
488
490
|
importSpecFile: se,
|
|
489
|
-
importSpecFromUrl:
|
|
491
|
+
importSpecFromUrl: ke,
|
|
490
492
|
cookieMutators: ue,
|
|
491
493
|
collectionMutators: {
|
|
492
494
|
...p,
|
|
493
495
|
rawAdd: p.add,
|
|
494
|
-
add:
|
|
495
|
-
delete:
|
|
496
|
+
add: $,
|
|
497
|
+
delete: ye
|
|
496
498
|
},
|
|
497
499
|
environmentMutators: {
|
|
498
500
|
...G,
|
|
@@ -502,7 +504,7 @@ const it = (H, y = !0) => {
|
|
|
502
504
|
...R,
|
|
503
505
|
rawAdd: R.add,
|
|
504
506
|
add: ee,
|
|
505
|
-
delete:
|
|
507
|
+
delete: J
|
|
506
508
|
},
|
|
507
509
|
requestMutators: {
|
|
508
510
|
...h,
|
|
@@ -511,8 +513,8 @@ const it = (H, y = !0) => {
|
|
|
511
513
|
delete: _
|
|
512
514
|
},
|
|
513
515
|
requestExampleMutators: {
|
|
514
|
-
...
|
|
515
|
-
rawAdd:
|
|
516
|
+
...W,
|
|
517
|
+
rawAdd: W.add,
|
|
516
518
|
add: oe,
|
|
517
519
|
delete: ae
|
|
518
520
|
},
|
|
@@ -520,24 +522,25 @@ const it = (H, y = !0) => {
|
|
|
520
522
|
securitySchemeMutators: {
|
|
521
523
|
...P,
|
|
522
524
|
rawAdd: P.add,
|
|
523
|
-
add:
|
|
524
|
-
delete:
|
|
525
|
+
add: g,
|
|
526
|
+
delete: we
|
|
525
527
|
},
|
|
526
528
|
serverMutators: {
|
|
527
|
-
...
|
|
528
|
-
rawAdd:
|
|
529
|
+
...N,
|
|
530
|
+
rawAdd: N.add,
|
|
529
531
|
add: te,
|
|
530
532
|
delete: Re
|
|
531
533
|
},
|
|
532
534
|
workspaceMutators: {
|
|
533
|
-
...
|
|
534
|
-
rawAdd:
|
|
535
|
+
...O,
|
|
536
|
+
rawAdd: O.add,
|
|
535
537
|
add: me,
|
|
536
|
-
delete: he
|
|
538
|
+
delete: he,
|
|
539
|
+
rename: pe
|
|
537
540
|
}
|
|
538
541
|
};
|
|
539
|
-
},
|
|
542
|
+
}, at = () => Be("workspace");
|
|
540
543
|
export {
|
|
541
|
-
|
|
542
|
-
|
|
544
|
+
ot as createWorkspaceStore,
|
|
545
|
+
at as useWorkspace
|
|
543
546
|
};
|