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