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