@scalar/api-client 2.0.16 → 2.0.17
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 +8 -0
- package/dist/components/CodeInput/CodeInput.vue.d.ts +9 -0
- 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 +69 -44
- package/dist/components/DataTable/DataTableInput.vue.js +2 -2
- package/dist/components/DataTable/DataTableInput.vue2.js +13 -13
- package/dist/components/DataTable/{DataTableInputEnumSelect.vue.d.ts → DataTableInputSelect.vue.d.ts} +3 -3
- package/dist/components/DataTable/DataTableInputSelect.vue.d.ts.map +1 -0
- package/dist/components/DataTable/DataTableInputSelect.vue.js +109 -0
- package/dist/components/DataTable/DataTableInputSelect.vue2.js +4 -0
- package/dist/store/workspace.d.ts +52 -2
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +74 -73
- package/dist/style.css +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue2.js +39 -38
- package/package.json +6 -6
- package/dist/components/DataTable/DataTableInputEnumSelect.vue.d.ts.map +0 -1
- package/dist/components/DataTable/DataTableInputEnumSelect.vue.js +0 -102
- package/dist/components/DataTable/DataTableInputEnumSelect.vue2.js +0 -4
package/dist/store/workspace.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { activeRouterParams as
|
|
1
|
+
import { activeRouterParams as j, PathId as k, fallbackMissingParams as V } from "../router.js";
|
|
2
2
|
import { useModal as G } from "@scalar/components";
|
|
3
3
|
import { createWorkspace as H } from "@scalar/oas-utils/entities/workspace";
|
|
4
4
|
import { createCollection as Q } from "@scalar/oas-utils/entities/workspace/collection";
|
|
@@ -17,8 +17,8 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
17
17
|
y,
|
|
18
18
|
o({}),
|
|
19
19
|
h && f.REQUEST
|
|
20
|
-
),
|
|
21
|
-
const s = z(e), c =
|
|
20
|
+
), g = (e, t) => {
|
|
21
|
+
const s = z(e), c = F(s);
|
|
22
22
|
return s.childUids.push(c.uid), E.add(s), t && (d[t] ? u.edit(t, "childUids", [
|
|
23
23
|
...d[t].childUids,
|
|
24
24
|
s.uid
|
|
@@ -38,11 +38,11 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
38
38
|
), E.delete(e.uid);
|
|
39
39
|
}, S = n(() => {
|
|
40
40
|
var c;
|
|
41
|
-
const e =
|
|
42
|
-
return V(
|
|
41
|
+
const e = j.value[k.Request], t = (c = D.value[0]) == null ? void 0 : c.uid, s = y[e] ?? y[t];
|
|
42
|
+
return V(k.Request, s), s && U(s.uid).forEach(
|
|
43
43
|
(i) => re(i, !0)
|
|
44
44
|
), s;
|
|
45
|
-
}),
|
|
45
|
+
}), U = (e, t = []) => {
|
|
46
46
|
const s = Object.values(d).find(
|
|
47
47
|
(i) => i.childUids.includes(e)
|
|
48
48
|
);
|
|
@@ -50,13 +50,13 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
50
50
|
const c = Object.values(l).find(
|
|
51
51
|
({ childUids: i }) => i.includes(e)
|
|
52
52
|
);
|
|
53
|
-
return c ?
|
|
53
|
+
return c ? U(c.uid, [...t, c.uid]) : t;
|
|
54
54
|
}, R = o({}), w = m(
|
|
55
55
|
R,
|
|
56
56
|
o({}),
|
|
57
57
|
h && f.REQUEST_EXAMPLE
|
|
58
|
-
),
|
|
59
|
-
var t, s, c, i, r, a;
|
|
58
|
+
), M = (e) => {
|
|
59
|
+
var t, s, c, i, r, a, O;
|
|
60
60
|
return ee({
|
|
61
61
|
key: e.name,
|
|
62
62
|
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] : "",
|
|
@@ -67,15 +67,16 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
67
67
|
format: (c = e.schema) == null ? void 0 : c.format,
|
|
68
68
|
minimum: (i = e.schema) == null ? void 0 : i.minimum,
|
|
69
69
|
maximum: (r = e.schema) == null ? void 0 : r.maximum,
|
|
70
|
-
default: (a = e.schema) == null ? void 0 : a.default
|
|
70
|
+
default: (a = e.schema) == null ? void 0 : a.default,
|
|
71
|
+
nullable: (O = e.schema) == null ? void 0 : O.nullable
|
|
71
72
|
});
|
|
72
|
-
},
|
|
73
|
+
}, F = (e) => {
|
|
73
74
|
var r;
|
|
74
75
|
const t = {
|
|
75
|
-
path: Object.values(e.parameters.path).map(
|
|
76
|
-
query: Object.values(e.parameters.query).map(
|
|
77
|
-
headers: Object.values(e.parameters.headers).map(
|
|
78
|
-
cookies: Object.values(e.parameters.cookies).map(
|
|
76
|
+
path: Object.values(e.parameters.path).map(M),
|
|
77
|
+
query: Object.values(e.parameters.query).map(M),
|
|
78
|
+
headers: Object.values(e.parameters.headers).map(M),
|
|
79
|
+
cookies: Object.values(e.parameters.cookies).map(M)
|
|
79
80
|
}, s = {
|
|
80
81
|
activeBody: "raw",
|
|
81
82
|
raw: {
|
|
@@ -99,7 +100,7 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
99
100
|
}
|
|
100
101
|
const c = te(
|
|
101
102
|
(e.summary ?? "Example") + " #1",
|
|
102
|
-
(a) => e.childUids.some((
|
|
103
|
+
(a) => e.childUids.some((O) => a === R[O].name)
|
|
103
104
|
), i = Z({
|
|
104
105
|
requestUid: e.uid,
|
|
105
106
|
parameters: t,
|
|
@@ -108,7 +109,7 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
108
109
|
});
|
|
109
110
|
return w.add(i), i;
|
|
110
111
|
}, le = (e) => {
|
|
111
|
-
const t =
|
|
112
|
+
const t = F(e);
|
|
112
113
|
E.edit(e.uid, "childUids", [
|
|
113
114
|
...e.childUids,
|
|
114
115
|
t.uid
|
|
@@ -124,9 +125,9 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
124
125
|
}, ue = n(
|
|
125
126
|
() => {
|
|
126
127
|
var e;
|
|
127
|
-
return R[
|
|
128
|
+
return R[j.value[k.Example]] ?? R[((e = S.value) == null ? void 0 : e.childUids[0]) ?? ""];
|
|
128
129
|
}
|
|
129
|
-
), me = n(() => Object.values(y).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)),
|
|
130
|
+
), me = n(() => Object.values(y).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)), I = o({
|
|
130
131
|
default: Y({
|
|
131
132
|
uid: "default",
|
|
132
133
|
name: "Global Environment",
|
|
@@ -135,8 +136,8 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
135
136
|
parsed: [],
|
|
136
137
|
isDefault: !0
|
|
137
138
|
})
|
|
138
|
-
}),
|
|
139
|
-
|
|
139
|
+
}), T = m(
|
|
140
|
+
I,
|
|
140
141
|
o({}),
|
|
141
142
|
h && f.ENVIRONMENT
|
|
142
143
|
), fe = (e) => {
|
|
@@ -144,24 +145,24 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
144
145
|
console.warn("Default environment cannot be deleted.");
|
|
145
146
|
return;
|
|
146
147
|
}
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
|
|
148
|
+
T.delete(e);
|
|
149
|
+
}, B = o({}), he = m(
|
|
150
|
+
B,
|
|
150
151
|
o({}),
|
|
151
152
|
h && f.COOKIE
|
|
152
153
|
), ve = n(
|
|
153
|
-
() =>
|
|
154
|
-
),
|
|
155
|
-
|
|
154
|
+
() => j.value[k.Cookies]
|
|
155
|
+
), x = o({}), pe = (e) => m(
|
|
156
|
+
x,
|
|
156
157
|
o({}),
|
|
157
158
|
h && `${f.WORKSPACE}${e}`
|
|
158
|
-
),
|
|
159
|
+
), C = pe("default"), v = n(
|
|
159
160
|
() => (
|
|
160
161
|
// TODO bring this back with the routing
|
|
161
162
|
// workspaces[activeRouterParams.value[PathId.Workspace]] ??
|
|
162
|
-
|
|
163
|
+
x[Object.keys(x)[0]]
|
|
163
164
|
)
|
|
164
|
-
),
|
|
165
|
+
), D = n(
|
|
165
166
|
() => Object.values(y).map((e) => ({
|
|
166
167
|
uid: e.uid,
|
|
167
168
|
path: e.path,
|
|
@@ -175,32 +176,32 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
175
176
|
d,
|
|
176
177
|
o({}),
|
|
177
178
|
h && f.COLLECTION
|
|
178
|
-
),
|
|
179
|
+
), K = (e) => {
|
|
179
180
|
if (!v.value) return;
|
|
180
181
|
const t = Q(e);
|
|
181
|
-
|
|
182
|
+
C.edit(v.value.uid, "collectionUids", [
|
|
182
183
|
...v.value.collectionUids,
|
|
183
184
|
t.uid
|
|
184
185
|
]), u.add(t);
|
|
185
186
|
}, Ee = (e) => {
|
|
186
|
-
v.value && (
|
|
187
|
+
v.value && (C.edit(
|
|
187
188
|
v.value.uid,
|
|
188
189
|
"collectionUids",
|
|
189
190
|
v.value.collectionUids.filter((t) => t !== e)
|
|
190
191
|
), u.delete(e));
|
|
191
|
-
},
|
|
192
|
+
}, b = n(() => {
|
|
192
193
|
if (!S.value) return null;
|
|
193
|
-
const e =
|
|
194
|
+
const e = U(S.value.uid);
|
|
194
195
|
if (!e.length) return null;
|
|
195
196
|
const t = e[e.length - 1];
|
|
196
197
|
return d[t];
|
|
197
198
|
}), Se = n(
|
|
198
|
-
() =>
|
|
199
|
+
() => b.value && L[b.value.selectedServerUid]
|
|
199
200
|
), l = o({}), p = m(
|
|
200
201
|
l,
|
|
201
202
|
o({}),
|
|
202
203
|
h && f.FOLDER
|
|
203
|
-
),
|
|
204
|
+
), P = (e, t) => {
|
|
204
205
|
const s = $(e);
|
|
205
206
|
if (t)
|
|
206
207
|
if (d[t])
|
|
@@ -228,49 +229,49 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
228
229
|
"childUids",
|
|
229
230
|
l[t].childUids.filter((s) => s !== e)
|
|
230
231
|
), p.delete(e);
|
|
231
|
-
},
|
|
232
|
-
|
|
232
|
+
}, A = o({}), N = m(
|
|
233
|
+
A,
|
|
233
234
|
o({}),
|
|
234
235
|
h && f.SECURITY_SCHEME
|
|
235
236
|
), we = n(
|
|
236
237
|
() => {
|
|
237
238
|
var e;
|
|
238
|
-
return (e =
|
|
239
|
-
const s =
|
|
239
|
+
return (e = b.value) == null ? void 0 : e.selectedSecuritySchemes.map((t) => {
|
|
240
|
+
const s = A[t.uid], c = t.flowKey && "flows" in s && s.flows ? { flow: s.flows[t.flowKey] } : {};
|
|
240
241
|
return { scheme: s, ...c };
|
|
241
242
|
})[0];
|
|
242
243
|
}
|
|
243
|
-
),
|
|
244
|
+
), be = n(
|
|
244
245
|
() => {
|
|
245
246
|
var e, t;
|
|
246
|
-
return ((e = S.value) == null ? void 0 : e.security) ?? ((t =
|
|
247
|
+
return ((e = S.value) == null ? void 0 : e.security) ?? ((t = b.value) == null ? void 0 : t.spec.security) ?? [];
|
|
247
248
|
}
|
|
248
|
-
),
|
|
249
|
-
|
|
249
|
+
), L = o({}), q = m(
|
|
250
|
+
L,
|
|
250
251
|
o({}),
|
|
251
252
|
h && f.SERVER
|
|
252
|
-
),
|
|
253
|
+
), W = (e, t) => {
|
|
253
254
|
const s = X(e);
|
|
254
255
|
t && u.edit(t, "spec.serverUids", [
|
|
255
256
|
...d[t].spec.serverUids,
|
|
256
257
|
s.uid
|
|
257
|
-
]),
|
|
258
|
-
},
|
|
258
|
+
]), q.add(s);
|
|
259
|
+
}, Oe = (e, t) => {
|
|
259
260
|
u.edit(
|
|
260
261
|
t,
|
|
261
262
|
"spec.serverUids",
|
|
262
263
|
d[t].spec.serverUids.filter(
|
|
263
264
|
(s) => s !== e
|
|
264
265
|
)
|
|
265
|
-
),
|
|
266
|
+
), q.delete(e);
|
|
266
267
|
};
|
|
267
|
-
async function
|
|
268
|
+
async function _(e) {
|
|
268
269
|
var i;
|
|
269
270
|
const t = ie(e), s = await ce(t), c = H({ uid: "default" });
|
|
270
|
-
|
|
271
|
+
C.add(c), s.requests.forEach((r) => g(r)), K(s.collection), s.folders.forEach((r) => P(r)), s.servers.forEach((r) => W(r)), Object.entries(
|
|
271
272
|
(((i = s.components) == null ? void 0 : i.securitySchemes) || s.securityDefinitions) ?? {}
|
|
272
273
|
).forEach(
|
|
273
|
-
([r, a]) =>
|
|
274
|
+
([r, a]) => N.add(
|
|
274
275
|
J({ ...a, uid: r })
|
|
275
276
|
)
|
|
276
277
|
);
|
|
@@ -278,7 +279,7 @@ async function W(e) {
|
|
|
278
279
|
async function Me(e, t) {
|
|
279
280
|
try {
|
|
280
281
|
const s = await se(e, t);
|
|
281
|
-
await
|
|
282
|
+
await _(s);
|
|
282
283
|
} catch (s) {
|
|
283
284
|
console.error("Failed to fetch spec from URL:", s);
|
|
284
285
|
}
|
|
@@ -286,21 +287,21 @@ async function Me(e, t) {
|
|
|
286
287
|
const ke = G(), Ne = () => ({
|
|
287
288
|
// ---------------------------------------------------------------------------
|
|
288
289
|
// STATE
|
|
289
|
-
workspaces:
|
|
290
|
-
workspaceRequests:
|
|
290
|
+
workspaces: x,
|
|
291
|
+
workspaceRequests: D,
|
|
291
292
|
collections: d,
|
|
292
|
-
cookies:
|
|
293
|
-
environments:
|
|
293
|
+
cookies: B,
|
|
294
|
+
environments: I,
|
|
294
295
|
folders: l,
|
|
295
296
|
requestExamples: R,
|
|
296
297
|
requests: y,
|
|
297
|
-
servers:
|
|
298
|
-
securitySchemes:
|
|
299
|
-
activeCollection:
|
|
298
|
+
servers: L,
|
|
299
|
+
securitySchemes: A,
|
|
300
|
+
activeCollection: b,
|
|
300
301
|
activeCookieId: ve,
|
|
301
302
|
activeExample: ue,
|
|
302
303
|
activeRequest: S,
|
|
303
|
-
activeSecurityRequirements:
|
|
304
|
+
activeSecurityRequirements: be,
|
|
304
305
|
activeSecurityScheme: we,
|
|
305
306
|
activeServer: Se,
|
|
306
307
|
activeWorkspace: v,
|
|
@@ -308,30 +309,30 @@ const ke = G(), Ne = () => ({
|
|
|
308
309
|
isReadOnly: ye,
|
|
309
310
|
// ---------------------------------------------------------------------------
|
|
310
311
|
// METHODS
|
|
311
|
-
importSpecFile:
|
|
312
|
+
importSpecFile: _,
|
|
312
313
|
importSpecFromUrl: Me,
|
|
313
314
|
cookieMutators: he,
|
|
314
|
-
createExampleFromRequest:
|
|
315
|
+
createExampleFromRequest: F,
|
|
315
316
|
collectionMutators: {
|
|
316
317
|
...u,
|
|
317
318
|
rawAdd: u.add,
|
|
318
|
-
add:
|
|
319
|
+
add: K,
|
|
319
320
|
delete: Ee
|
|
320
321
|
},
|
|
321
322
|
environmentMutators: {
|
|
322
|
-
...
|
|
323
|
+
...T,
|
|
323
324
|
delete: fe
|
|
324
325
|
},
|
|
325
326
|
folderMutators: {
|
|
326
327
|
...p,
|
|
327
328
|
rawAdd: p.add,
|
|
328
|
-
add:
|
|
329
|
+
add: P,
|
|
329
330
|
delete: Re
|
|
330
331
|
},
|
|
331
332
|
requestMutators: {
|
|
332
333
|
...E,
|
|
333
334
|
rawAdd: E.add,
|
|
334
|
-
add:
|
|
335
|
+
add: g,
|
|
335
336
|
delete: ae
|
|
336
337
|
},
|
|
337
338
|
requestExampleMutators: {
|
|
@@ -341,14 +342,14 @@ const ke = G(), Ne = () => ({
|
|
|
341
342
|
delete: ne
|
|
342
343
|
},
|
|
343
344
|
requestsHistory: me,
|
|
344
|
-
securitySchemeMutators:
|
|
345
|
+
securitySchemeMutators: N,
|
|
345
346
|
serverMutators: {
|
|
346
|
-
...
|
|
347
|
-
rawAdd:
|
|
348
|
-
add:
|
|
349
|
-
delete:
|
|
347
|
+
...q,
|
|
348
|
+
rawAdd: q.add,
|
|
349
|
+
add: W,
|
|
350
|
+
delete: Oe
|
|
350
351
|
},
|
|
351
|
-
workspaceMutators:
|
|
352
|
+
workspaceMutators: C
|
|
352
353
|
});
|
|
353
354
|
export {
|
|
354
355
|
Ne as useWorkspace
|