@scalar/api-client 2.2.6 → 2.2.7
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 +19 -0
- package/dist/components/AddressBar/AddressBar.vue.js +2 -2
- package/dist/components/AddressBar/AddressBar.vue2.js +1 -1
- package/dist/components/AddressBar/AddressBarServer.vue.js +18 -18
- package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +20 -20
- package/dist/components/HttpMethod/HttpMethod.vue.js +2 -2
- package/dist/components/HttpMethod/HttpMethod.vue2.js +12 -12
- package/dist/components/HttpMethod/index.d.ts +0 -1
- package/dist/components/HttpMethod/index.d.ts.map +1 -1
- package/dist/components/HttpMethod/index.js +2 -4
- package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/ImportCollectionModal.vue.js +119 -102
- package/dist/components/OpenApiClientButton.vue.d.ts +1 -0
- package/dist/components/OpenApiClientButton.vue.d.ts.map +1 -1
- package/dist/components/OpenApiClientButton.vue.js +2 -2
- package/dist/components/OpenApiClientButton.vue2.js +23 -17
- package/dist/components/Search/useSearch.d.ts.map +1 -1
- package/dist/components/Search/useSearch.js +45 -41
- 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 +28 -23
- package/dist/libs/create-client.d.ts +1 -0
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +31 -30
- package/dist/style.css +1 -1
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +65 -62
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +82 -84
- package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestBody.vue2.js +27 -24
- package/dist/views/Request/RequestSubpageHeader.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSubpageHeader.vue.js +3 -3
- package/dist/views/Request/RequestSubpageHeader.vue2.js +34 -32
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +1 -1
- package/dist/views/Request/libs/live-sync.d.ts.map +1 -1
- package/dist/views/Request/libs/live-sync.js +77 -78
- package/package.json +10 -10
- package/dist/components/HttpMethod/helpers.d.ts +0 -4
- package/dist/components/HttpMethod/helpers.d.ts.map +0 -1
- package/dist/components/HttpMethod/helpers.js +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Z, computed as b, ref as I, watch as W, openBlock as
|
|
1
|
+
import { defineComponent as Z, computed as b, ref as I, watch as W, openBlock as p, createBlock as h, withCtx as d, createTextVNode as z, toDisplayString as F, createVNode as s, unref as u, createElementVNode as w, createCommentVNode as ee, createElementBlock as U, Fragment as ae, nextTick as te } from "vue";
|
|
2
2
|
import oe from "../../../components/CodeInput/CodeInput.vue.js";
|
|
3
3
|
import ne from "../../../components/DataTable/DataTable.vue.js";
|
|
4
4
|
import le from "../../../components/DataTable/DataTableHeader.vue.js";
|
|
@@ -59,9 +59,9 @@ const se = {
|
|
|
59
59
|
function V() {
|
|
60
60
|
console.log("deleteRow");
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const P = (e, a, t) => {
|
|
63
63
|
if (!c.value || !o.value) return;
|
|
64
|
-
const l =
|
|
64
|
+
const l = f.value;
|
|
65
65
|
if (l.length > e) {
|
|
66
66
|
const n = [...l];
|
|
67
67
|
n[e] = { ...n[e], [a]: t }, (n[e].key !== "" || n[e].value !== "") && (n[e].enabled = !0), n[e].key === "" && n[e].value === "" && n.splice(e, 1), i.edit(
|
|
@@ -82,16 +82,19 @@ const se = {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
e === l.length - 1 && j();
|
|
85
|
-
},
|
|
85
|
+
}, f = b(
|
|
86
86
|
() => {
|
|
87
87
|
var e, a, t;
|
|
88
88
|
return ((t = (a = (e = o.value) == null ? void 0 : e.body) == null ? void 0 : a.formData) == null ? void 0 : t.value) ?? [];
|
|
89
89
|
}
|
|
90
|
-
),
|
|
90
|
+
), C = () => {
|
|
91
|
+
const e = f.value[f.value.length - 1];
|
|
92
|
+
(!e || e.key !== "" || e.value !== "") && j();
|
|
93
|
+
}, j = () => {
|
|
91
94
|
if (!c.value || !o.value) return;
|
|
92
95
|
const e = J.parse({
|
|
93
96
|
enabled: !1
|
|
94
|
-
}), a = [...
|
|
97
|
+
}), a = [...f.value, e];
|
|
95
98
|
o.value.body.formData ? i.edit(
|
|
96
99
|
o.value.uid,
|
|
97
100
|
"body.formData.value",
|
|
@@ -102,7 +105,7 @@ const se = {
|
|
|
102
105
|
});
|
|
103
106
|
}, N = (e, a) => {
|
|
104
107
|
if (!c.value || !o.value) return;
|
|
105
|
-
const t =
|
|
108
|
+
const t = f.value;
|
|
106
109
|
if (t.length > e) {
|
|
107
110
|
const l = [...t];
|
|
108
111
|
l[e].enabled = a, i.edit(
|
|
@@ -184,7 +187,7 @@ const se = {
|
|
|
184
187
|
onChange: async (t) => {
|
|
185
188
|
const l = t == null ? void 0 : t[0];
|
|
186
189
|
if (l && c.value && o.value) {
|
|
187
|
-
const r = [...
|
|
190
|
+
const r = [...f.value];
|
|
188
191
|
r[e] = {
|
|
189
192
|
...r[e],
|
|
190
193
|
file: l
|
|
@@ -205,7 +208,7 @@ const se = {
|
|
|
205
208
|
}
|
|
206
209
|
function M(e) {
|
|
207
210
|
if (!c.value || !o.value) return;
|
|
208
|
-
const t = [...
|
|
211
|
+
const t = [...f.value];
|
|
209
212
|
t[e] = {
|
|
210
213
|
...t[e],
|
|
211
214
|
file: void 0
|
|
@@ -233,7 +236,7 @@ const se = {
|
|
|
233
236
|
W(
|
|
234
237
|
v,
|
|
235
238
|
(e) => {
|
|
236
|
-
["multipartForm", "formUrlEncoded"].includes(e == null ? void 0 : e.id) &&
|
|
239
|
+
["multipartForm", "formUrlEncoded"].includes(e == null ? void 0 : e.id) && C();
|
|
237
240
|
},
|
|
238
241
|
{ immediate: !0 }
|
|
239
242
|
), W(
|
|
@@ -245,7 +248,7 @@ const se = {
|
|
|
245
248
|
var e;
|
|
246
249
|
(e = c.value) != null && e.method && ue(c.value.method) && q(R.value), ["multipartForm", "formUrlEncoded"].includes(
|
|
247
250
|
R.value
|
|
248
|
-
) &&
|
|
251
|
+
) && C();
|
|
249
252
|
},
|
|
250
253
|
{ immediate: !0 }
|
|
251
254
|
);
|
|
@@ -275,7 +278,7 @@ const se = {
|
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
280
|
});
|
|
278
|
-
return (e, a) => (
|
|
281
|
+
return (e, a) => (p(), h(re, null, {
|
|
279
282
|
title: d(() => [
|
|
280
283
|
z(F(e.title), 1)
|
|
281
284
|
]),
|
|
@@ -313,7 +316,7 @@ const se = {
|
|
|
313
316
|
]),
|
|
314
317
|
_: 1
|
|
315
318
|
}, 8, ["modelValue", "options"]),
|
|
316
|
-
g.value.length > 0 ? (
|
|
319
|
+
g.value.length > 0 ? (p(), h(u(A), {
|
|
317
320
|
key: 0,
|
|
318
321
|
modelValue: _.value,
|
|
319
322
|
"onUpdate:modelValue": a[1] || (a[1] = (t) => _.value = t),
|
|
@@ -352,10 +355,10 @@ const se = {
|
|
|
352
355
|
default: d(() => {
|
|
353
356
|
var t, l, n, r, m;
|
|
354
357
|
return [
|
|
355
|
-
v.value.id === "none" ? (
|
|
358
|
+
v.value.id === "none" ? (p(), U("div", se, a[2] || (a[2] = [
|
|
356
359
|
w("span", null, "No Body", -1)
|
|
357
|
-
]))) : v.value.id === "binaryFile" ? (
|
|
358
|
-
(t = u(o)) != null && t.body.binary ? (
|
|
360
|
+
]))) : v.value.id === "binaryFile" ? (p(), U("div", ce, [
|
|
361
|
+
(t = u(o)) != null && t.body.binary ? (p(), U(ae, { key: 0 }, [
|
|
359
362
|
w("span", me, F(((l = u(o)) == null ? void 0 : l.body.binary).name), 1),
|
|
360
363
|
s(u(k), {
|
|
361
364
|
class: "bg-b-2 hover:bg-b-3 border-0 text-c-2 ml-1 shadow-none",
|
|
@@ -368,7 +371,7 @@ const se = {
|
|
|
368
371
|
])),
|
|
369
372
|
_: 1
|
|
370
373
|
})
|
|
371
|
-
], 64)) : (
|
|
374
|
+
], 64)) : (p(), h(u(k), {
|
|
372
375
|
key: 1,
|
|
373
376
|
class: "bg-b-2 hover:bg-b-3 border-0 text-c-2 shadow-none",
|
|
374
377
|
size: "sm",
|
|
@@ -386,33 +389,33 @@ const se = {
|
|
|
386
389
|
]),
|
|
387
390
|
_: 1
|
|
388
391
|
}))
|
|
389
|
-
])) : v.value.id == "multipartForm" ? (
|
|
392
|
+
])) : v.value.id == "multipartForm" ? (p(), h($, {
|
|
390
393
|
key: 2,
|
|
391
394
|
ref_key: "tableWrapperRef",
|
|
392
395
|
ref: B,
|
|
393
396
|
class: "!m-0 rounded-t-none shadow-none border-l-0 border-r-0 border-t-0 border-b-0",
|
|
394
397
|
columns: ["32px", "", "", "61px"],
|
|
395
|
-
items:
|
|
398
|
+
items: f.value,
|
|
396
399
|
showUploadButton: "",
|
|
397
400
|
onDeleteRow: V,
|
|
398
401
|
onRemoveFile: M,
|
|
399
402
|
onToggleRow: N,
|
|
400
|
-
onUpdateRow:
|
|
403
|
+
onUpdateRow: P,
|
|
401
404
|
onUploadFile: L
|
|
402
|
-
}, null, 8, ["items"])) : v.value.id == "formUrlEncoded" ? (
|
|
405
|
+
}, null, 8, ["items"])) : v.value.id == "formUrlEncoded" ? (p(), h($, {
|
|
403
406
|
key: 3,
|
|
404
407
|
ref_key: "tableWrapperRef",
|
|
405
408
|
ref: B,
|
|
406
409
|
class: "!m-0 rounded-t-none border-t-0 shadow-none border-l-0 border-r-0 border-t-0 border-b-0",
|
|
407
410
|
columns: ["32px", "", "", "61px"],
|
|
408
|
-
items:
|
|
411
|
+
items: f.value,
|
|
409
412
|
showUploadButton: "",
|
|
410
413
|
onDeleteRow: V,
|
|
411
414
|
onRemoveFile: M,
|
|
412
415
|
onToggleRow: N,
|
|
413
|
-
onUpdateRow:
|
|
416
|
+
onUpdateRow: P,
|
|
414
417
|
onUploadFile: L
|
|
415
|
-
}, null, 8, ["items"])) : (
|
|
418
|
+
}, null, 8, ["items"])) : (p(), h(oe, {
|
|
416
419
|
key: 4,
|
|
417
420
|
content: "",
|
|
418
421
|
language: Y.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestSubpageHeader.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSubpageHeader.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestSubpageHeader.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSubpageHeader.vue"],"names":[],"mappings":"AAoHA,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAC;;;;;;;;;;AAwPF,wBAQG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from "./RequestSubpageHeader.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const p = /* @__PURE__ */
|
|
3
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const p = /* @__PURE__ */ e(a, [["__scopeId", "data-v-cad1af01"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { defineComponent as C, openBlock as l, createElementBlock as a, createElementVNode as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useActiveEntities as
|
|
6
|
-
import { ScalarIcon as
|
|
7
|
-
import $ from "
|
|
8
|
-
import B from "
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
1
|
+
import { defineComponent as C, openBlock as l, createElementBlock as a, createElementVNode as i, createVNode as s, normalizeClass as V, unref as t, createBlock as u, createCommentVNode as r } from "vue";
|
|
2
|
+
import x from "../../components/AddressBar/AddressBar.vue.js";
|
|
3
|
+
import v from "../../components/EnvironmentSelector/EnvironmentSelector.vue.js";
|
|
4
|
+
import w from "../../components/Sidebar/SidebarToggle.vue.js";
|
|
5
|
+
import { useActiveEntities as R } from "../../store/active-entities.js";
|
|
6
|
+
import { ScalarIcon as c } from "@scalar/components";
|
|
7
|
+
import { useRouter as $ } from "vue-router";
|
|
8
|
+
import B from "./components/WorkspaceDropdown.vue.js";
|
|
9
|
+
import h from "../../components/OpenApiClientButton.vue.js";
|
|
10
|
+
import { useWorkspace as z } from "../../store/store.js";
|
|
11
|
+
import { useLayout as A } from "../../hooks/useLayout.js";
|
|
12
|
+
const E = { class: "lg:min-h-header flex items-center w-full justify-center p-2 pt-2 lg:pt-1 lg:p-1 flex-wrap t-app__top-container border-b-1/2" }, M = { class: "flex flex-row items-center gap-1 lg:px-1 lg:mb-0 lg:mb-0 mb-2 lg:flex-1 w-6/12" }, N = { class: "flex flex-row items-center gap-1 lg:px-2.5 lg:mb-0 mb-2 lg:flex-1 justify-end w-6/12" }, J = /* @__PURE__ */ C({
|
|
12
13
|
__name: "RequestSubpageHeader",
|
|
13
14
|
props: {
|
|
14
15
|
modelValue: { type: Boolean },
|
|
15
16
|
isReadonly: { type: Boolean }
|
|
16
17
|
},
|
|
17
18
|
emits: ["update:modelValue", "hideModal", "importCurl"],
|
|
18
|
-
setup(
|
|
19
|
-
const { activeCollection: m } =
|
|
19
|
+
setup(S) {
|
|
20
|
+
const { activeCollection: m } = R(), g = z(), { hideClientButton: y } = g, { layout: b } = A(), { currentRoute: k } = $();
|
|
20
21
|
return (o, e) => {
|
|
21
|
-
var
|
|
22
|
-
return l(), a("div",
|
|
23
|
-
|
|
24
|
-
s(
|
|
25
|
-
class:
|
|
22
|
+
var d, p, f;
|
|
23
|
+
return l(), a("div", E, [
|
|
24
|
+
i("div", M, [
|
|
25
|
+
s(w, {
|
|
26
|
+
class: V(["gitbook-hidden", [
|
|
26
27
|
"xl:hidden",
|
|
27
28
|
{ "xl:!flex": !o.modelValue },
|
|
28
29
|
{ "!flex": t(b) === "modal" }
|
|
@@ -30,51 +31,52 @@ const z = { class: "lg:min-h-header flex items-center w-full justify-center p-2
|
|
|
30
31
|
modelValue: o.modelValue,
|
|
31
32
|
"onUpdate:modelValue": e[0] || (e[0] = (n) => o.$emit("update:modelValue", n))
|
|
32
33
|
}, null, 8, ["class", "modelValue"]),
|
|
33
|
-
o.isReadonly ?
|
|
34
|
+
o.isReadonly ? r("", !0) : (l(), u(t(B), { key: 0 }))
|
|
34
35
|
]),
|
|
35
|
-
s(
|
|
36
|
+
s(x, {
|
|
36
37
|
onImportCurl: e[1] || (e[1] = (n) => o.$emit("importCurl", n))
|
|
37
38
|
}),
|
|
38
|
-
|
|
39
|
-
o.isReadonly ?
|
|
40
|
-
o.isReadonly && ((
|
|
39
|
+
i("div", N, [
|
|
40
|
+
o.isReadonly ? r("", !0) : (l(), u(v, { key: 0 })),
|
|
41
|
+
o.isReadonly && ((d = t(m)) != null && d.documentUrl) && !t(y) ? (l(), u(t(h), {
|
|
41
42
|
key: 1,
|
|
42
43
|
buttonSource: "modal",
|
|
43
44
|
class: "!w-fit lg:-mr-1",
|
|
44
|
-
integration: (
|
|
45
|
+
integration: (p = t(m)) == null ? void 0 : p.integration,
|
|
46
|
+
source: t(k).query.source === "gitbook" ? "gitbook" : "api-reference",
|
|
45
47
|
url: (f = t(m)) == null ? void 0 : f.documentUrl
|
|
46
|
-
}, null, 8, ["integration", "url"])) :
|
|
48
|
+
}, null, 8, ["integration", "source", "url"])) : r("", !0),
|
|
47
49
|
o.isReadonly ? (l(), a("button", {
|
|
48
50
|
key: 2,
|
|
49
51
|
class: "app-exit-button p-2 rounded-full fixed right-2 top-2 gitbook-hidden",
|
|
50
52
|
type: "button",
|
|
51
53
|
onClick: e[2] || (e[2] = (n) => o.$emit("hideModal"))
|
|
52
54
|
}, [
|
|
53
|
-
s(t(
|
|
55
|
+
s(t(c), {
|
|
54
56
|
icon: "Close",
|
|
55
57
|
size: "lg",
|
|
56
58
|
thickness: "2"
|
|
57
59
|
}),
|
|
58
|
-
e[4] || (e[4] =
|
|
59
|
-
])) :
|
|
60
|
+
e[4] || (e[4] = i("span", { class: "sr-only" }, "Close Client", -1))
|
|
61
|
+
])) : r("", !0),
|
|
60
62
|
o.isReadonly ? (l(), a("button", {
|
|
61
63
|
key: 3,
|
|
62
64
|
class: "text-c-1 hover:bg-b-2 active:text-c-1 p-2 rounded -mr-1.5 gitbook-show",
|
|
63
65
|
type: "button",
|
|
64
66
|
onClick: e[3] || (e[3] = (n) => o.$emit("hideModal"))
|
|
65
67
|
}, [
|
|
66
|
-
s(t(
|
|
68
|
+
s(t(c), {
|
|
67
69
|
icon: "Close",
|
|
68
70
|
size: "md",
|
|
69
71
|
thickness: "1.75"
|
|
70
72
|
}),
|
|
71
|
-
e[5] || (e[5] =
|
|
72
|
-
])) :
|
|
73
|
+
e[5] || (e[5] = i("span", { class: "sr-only" }, "Close Client", -1))
|
|
74
|
+
])) : r("", !0)
|
|
73
75
|
])
|
|
74
76
|
]);
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
79
|
});
|
|
78
80
|
export {
|
|
79
|
-
|
|
81
|
+
J as default
|
|
80
82
|
};
|
|
@@ -17,7 +17,7 @@ const K = { class: "relative col-1 flex-center gap-6 p-2 capitalize" }, A = {
|
|
|
17
17
|
a.commandPalette.emit({ commandName: "Create Request" });
|
|
18
18
|
}, y = (i) => {
|
|
19
19
|
i != null && i.createNew && v.name === "request" && f();
|
|
20
|
-
}, h = "2.2.
|
|
20
|
+
}, h = "2.2.7";
|
|
21
21
|
return R(() => a.hotKeys.on(y)), C(() => a.hotKeys.off(y)), (i, e) => (r(), l("div", K, [
|
|
22
22
|
o("div", {
|
|
23
23
|
class: k(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-sync.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/live-sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"live-sync.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/live-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAelE,OAAO,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EAEf,MAAM,6BAA6B,CAAA;AAEpC,OAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAK,MAAM,KAAK,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,SACvB,UAAU,EAAE,eACN,MAAM,EAAE,KACnB,UAAU,EAqFZ,CAAA;AAED,kEAAkE;AAClE,eAAO,MAAM,YAAY,GAAI,CAAC,OACvB,MAAM,EAAE,aACF,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,aACjB,CAAC,QAAQ,EAAE,CAAC,KAAK,OAAO,KAClC,CAAC,GAAG,IAMN,CAAA;AASD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,WACpB,SAAS,QACX,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KACxB,SAAS,GAAG,IAqDd,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,UACjB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,QAC/B,UAAU,KACf;IACD,0DAA0D;IAC1D,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACb,mGAAmG;IACnG,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACrB,2DAA2D;IAC3D,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CACzC,GAAG,IAwBH,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,SACzB,UAAU,wBACM,mBAAmB,0BACjB,cAAc,KACrC,OA0CF,CAAA;AAwBD;;GAEG;AACH,eAAO,MAAM,iBAAiB,SACtB,UAAU,wBACM,mBAAmB,SAClC,cAAc,KACpB,OAwIF,CAAA;AAED,mGAAmG;AACnG,eAAO,MAAM,gBAAgB,SACrB,UAAU,wBACM,mBAAmB,+BACZ,cAAc,KAC1C,OAoCF,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,aAAa,SAClB,UAAU,wBACM,mBAAmB,yBAClB,cAAc,KACpC,OA+BF,CAAA;AAED,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,WACpB,SAAS,OACZ,MAAM,SACJ,MAAM,KACZ,SAAS,GAAG,IAmBd,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,SAC7B,UAAU,wBACM,mBAAmB,+CACI,cAAc,KAC1D,OA0CF,CAAA"}
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { getNestedValue as Z } from "@scalar/object-utils/nested";
|
|
1
|
+
import { collectionSchema as b, requestSchema as O, serverSchema as V, tagSchema as M, securitySchemeSchema as S, createExampleFromRequest as D } from "@scalar/oas-utils/entities/spec";
|
|
2
|
+
import { isHttpMethod as H, schemaModel as R } from "@scalar/oas-utils/helpers";
|
|
3
|
+
import { getNestedValue as N } from "@scalar/object-utils/nested";
|
|
5
4
|
import j from "microdiff";
|
|
6
5
|
import { z as i } from "zod";
|
|
7
6
|
const x = (e, s = []) => {
|
|
8
7
|
const t = [];
|
|
9
8
|
let a = !1;
|
|
10
|
-
for (let
|
|
9
|
+
for (let r = 0; r < e.length; r++) {
|
|
11
10
|
if (a) {
|
|
12
11
|
a = !1;
|
|
13
12
|
continue;
|
|
14
13
|
}
|
|
15
|
-
const
|
|
14
|
+
const n = e[r], u = e[r + 1];
|
|
16
15
|
if (s.length)
|
|
17
|
-
|
|
18
|
-
else if (
|
|
19
|
-
t.push(
|
|
16
|
+
n.path = [...s, ...n.path], u && (u.path = [...s, ...u.path]);
|
|
17
|
+
else if (n.path[0] !== "paths") {
|
|
18
|
+
t.push(n);
|
|
20
19
|
continue;
|
|
21
20
|
}
|
|
22
|
-
if (
|
|
23
|
-
const [, l, p] =
|
|
21
|
+
if (n.type === "REMOVE" && (u == null ? void 0 : u.type) === "CREATE") {
|
|
22
|
+
const [, l, p] = n.path, [, o, h] = u.path, c = ["paths", o];
|
|
24
23
|
if (l !== o && t.push({
|
|
25
24
|
type: "CHANGE",
|
|
26
25
|
path: ["paths", "path"],
|
|
@@ -32,20 +31,20 @@ const x = (e, s = []) => {
|
|
|
32
31
|
oldValue: p,
|
|
33
32
|
value: h
|
|
34
33
|
}), c.push(h)), s.length === 0) {
|
|
35
|
-
const y = j(
|
|
34
|
+
const y = j(n.oldValue, u.value);
|
|
36
35
|
if (y.length) {
|
|
37
|
-
const
|
|
38
|
-
t.push(...
|
|
36
|
+
const E = x(y, c);
|
|
37
|
+
t.push(...E);
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
a = !0;
|
|
42
|
-
} else
|
|
41
|
+
} else n.type === "CREATE" && n.path.length > 3 && typeof n.path.at(-1) != "number" ? t.push({ ...n, type: "CHANGE", oldValue: void 0 }) : n.type === "REMOVE" && n.path.length > 3 && typeof n.path.at(-1) != "number" ? t.push({ ...n, type: "CHANGE", value: void 0 }) : t.push(n);
|
|
43
42
|
}
|
|
44
43
|
return t;
|
|
45
44
|
}, v = (e, s, t) => {
|
|
46
45
|
for (const a of e) {
|
|
47
|
-
const
|
|
48
|
-
if (t(
|
|
46
|
+
const r = s[a];
|
|
47
|
+
if (t(r)) return r;
|
|
49
48
|
}
|
|
50
49
|
return null;
|
|
51
50
|
}, d = (e) => e instanceof i.ZodOptional ? d(e.unwrap()) : e instanceof i.ZodDefault ? d(e._def.innerType) : e, G = (e, s) => {
|
|
@@ -75,18 +74,18 @@ const x = (e, s = []) => {
|
|
|
75
74
|
}, m = (e, s) => {
|
|
76
75
|
const t = G(e, s.path);
|
|
77
76
|
if (!t) return null;
|
|
78
|
-
const a = s.path.join("."),
|
|
77
|
+
const a = s.path.join("."), r = s.path.slice(0, -1).join(".");
|
|
79
78
|
if (s.type === "REMOVE")
|
|
80
79
|
return {
|
|
81
80
|
path: a,
|
|
82
|
-
pathMinusOne:
|
|
81
|
+
pathMinusOne: r,
|
|
83
82
|
value: void 0
|
|
84
83
|
};
|
|
85
|
-
const
|
|
86
|
-
return
|
|
84
|
+
const n = R(s.value, t, !1);
|
|
85
|
+
return n ? {
|
|
87
86
|
path: a,
|
|
88
|
-
pathMinusOne:
|
|
89
|
-
value:
|
|
87
|
+
pathMinusOne: r,
|
|
88
|
+
value: n
|
|
90
89
|
} : null;
|
|
91
90
|
}, K = (e, { activeCollection: s }, { collectionMutators: t }) => {
|
|
92
91
|
if (!s.value) return !1;
|
|
@@ -96,13 +95,13 @@ const x = (e, s = []) => {
|
|
|
96
95
|
path: e.path
|
|
97
96
|
});
|
|
98
97
|
if (!a) return !1;
|
|
99
|
-
const
|
|
100
|
-
...
|
|
98
|
+
const r = [
|
|
99
|
+
...N(s.value, a.pathMinusOne)
|
|
101
100
|
];
|
|
102
|
-
e.type === "CREATE" ?
|
|
101
|
+
e.type === "CREATE" ? r.push(a.value) : e.type === "REMOVE" && r.pop(), t.edit(
|
|
103
102
|
s.value.uid,
|
|
104
103
|
a.pathMinusOne,
|
|
105
|
-
|
|
104
|
+
r
|
|
106
105
|
);
|
|
107
106
|
} else {
|
|
108
107
|
const a = m(b, e);
|
|
@@ -114,90 +113,90 @@ const x = (e, s = []) => {
|
|
|
114
113
|
);
|
|
115
114
|
}
|
|
116
115
|
return !0;
|
|
117
|
-
},
|
|
118
|
-
const { requests: t, requestExamples: a, requestExampleMutators:
|
|
119
|
-
|
|
120
|
-
const l =
|
|
121
|
-
|
|
116
|
+
}, Z = (e, s) => {
|
|
117
|
+
const { requests: t, requestExamples: a, requestExampleMutators: r } = s, n = t[e];
|
|
118
|
+
n == null || n.examples.forEach((u) => {
|
|
119
|
+
const l = D(
|
|
120
|
+
n,
|
|
122
121
|
a[u].name
|
|
123
122
|
);
|
|
124
|
-
l &&
|
|
123
|
+
l && r.set({
|
|
125
124
|
...l,
|
|
126
125
|
uid: u
|
|
127
126
|
});
|
|
128
127
|
});
|
|
129
128
|
}, L = (e, { activeCollection: s }, t) => {
|
|
130
129
|
if (!s.value) return !1;
|
|
131
|
-
const { requests: a, requestMutators:
|
|
132
|
-
if (
|
|
130
|
+
const { requests: a, requestMutators: r } = t, [, n, u, ...l] = e.path;
|
|
131
|
+
if (n === "path" && e.type === "CHANGE")
|
|
133
132
|
s.value.requests.forEach((p) => {
|
|
134
|
-
a[p].path === e.oldValue &&
|
|
133
|
+
a[p].path === e.oldValue && r.edit(p, "path", e.value);
|
|
135
134
|
});
|
|
136
135
|
else if (u === "method" && e.type === "CHANGE")
|
|
137
136
|
s.value.requests.forEach((p) => {
|
|
138
|
-
a[p].method === e.oldValue && a[p].path ===
|
|
137
|
+
a[p].method === e.oldValue && a[p].path === n && r.edit(p, "method", e.value);
|
|
139
138
|
});
|
|
140
139
|
else if (e.type !== "CHANGE" && typeof l.at(-1) == "number") {
|
|
141
140
|
const p = v(
|
|
142
141
|
s.value.requests,
|
|
143
142
|
a,
|
|
144
|
-
(c) => c.path ===
|
|
143
|
+
(c) => c.path === n && c.method === u
|
|
145
144
|
), o = m(O, {
|
|
146
145
|
...e,
|
|
147
146
|
path: e.path.slice(3)
|
|
148
147
|
});
|
|
149
148
|
if (!p || !o) return !1;
|
|
150
|
-
const h = [...
|
|
151
|
-
e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(),
|
|
149
|
+
const h = [...N(p, o.pathMinusOne)];
|
|
150
|
+
e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(), r.edit(p.uid, o.pathMinusOne, h), (e.path[3] === "parameters" || e.path[3] === "requestBody") && Z(p.uid, t);
|
|
152
151
|
} else if (e.type === "CREATE") {
|
|
153
|
-
const [[p, o]] = Object.entries(e.value), h = u ? e.value : o, c = u || p, y = V.array().parse(h.servers ?? []), { security:
|
|
154
|
-
...
|
|
155
|
-
method:
|
|
156
|
-
path:
|
|
152
|
+
const [[p, o]] = Object.entries(e.value), h = u ? e.value : o, c = u || p, y = V.array().parse(h.servers ?? []), { security: E, ...T } = h, g = {
|
|
153
|
+
...T,
|
|
154
|
+
method: H(c) ? c : "get",
|
|
155
|
+
path: n,
|
|
157
156
|
parameters: h.parameters ?? [],
|
|
158
|
-
servers: y.map((
|
|
157
|
+
servers: y.map((f) => f.uid)
|
|
159
158
|
};
|
|
160
|
-
|
|
161
|
-
if (Object.keys(
|
|
162
|
-
const [A] = Object.keys(
|
|
159
|
+
E != null && E.length && (g.security = E.map((f) => {
|
|
160
|
+
if (Object.keys(f).length) {
|
|
161
|
+
const [A] = Object.keys(f);
|
|
163
162
|
return {
|
|
164
|
-
[A]:
|
|
163
|
+
[A]: f[A]
|
|
165
164
|
};
|
|
166
|
-
} else return
|
|
165
|
+
} else return f;
|
|
167
166
|
}));
|
|
168
167
|
const q = R(g, O, !1);
|
|
169
168
|
if (!q) return !1;
|
|
170
|
-
|
|
169
|
+
r.add(q, s.value.uid);
|
|
171
170
|
} else if (e.type === "REMOVE") {
|
|
172
171
|
const p = v(
|
|
173
172
|
s.value.requests,
|
|
174
173
|
a,
|
|
175
|
-
(o) => o.path ===
|
|
174
|
+
(o) => o.path === n && o.method === u
|
|
176
175
|
);
|
|
177
176
|
if (!p) return !1;
|
|
178
|
-
|
|
177
|
+
r.delete(p, s.value.uid);
|
|
179
178
|
} else if (e.type === "CHANGE") {
|
|
180
179
|
const p = v(
|
|
181
180
|
s.value.requests,
|
|
182
181
|
a,
|
|
183
|
-
(h) => h.path ===
|
|
182
|
+
(h) => h.path === n && h.method === u
|
|
184
183
|
), o = m(O, { ...e, path: l });
|
|
185
184
|
if (!p || !o) return !1;
|
|
186
|
-
|
|
185
|
+
r.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && Z(p.uid, t);
|
|
187
186
|
}
|
|
188
187
|
return !0;
|
|
189
|
-
},
|
|
188
|
+
}, P = (e, { activeCollection: s }, { servers: t, serverMutators: a }) => {
|
|
190
189
|
if (!s.value) return !1;
|
|
191
|
-
const [,
|
|
192
|
-
if (
|
|
193
|
-
const u = s.value.servers[
|
|
190
|
+
const [, r, ...n] = e.path;
|
|
191
|
+
if (n != null && n.length) {
|
|
192
|
+
const u = s.value.servers[r], l = t[u], p = m(V, { ...e, path: n });
|
|
194
193
|
if (!l || !p) return !1;
|
|
195
|
-
const h = e.type === "REMOVE" &&
|
|
194
|
+
const h = e.type === "REMOVE" && n[n.length - 1] === "variables" ? {} : p.value;
|
|
196
195
|
a.edit(u, p.path, h);
|
|
197
196
|
} else if (e.type === "REMOVE") {
|
|
198
|
-
if (!s.value.servers[
|
|
197
|
+
if (!s.value.servers[r]) return !1;
|
|
199
198
|
a.delete(
|
|
200
|
-
s.value.servers[
|
|
199
|
+
s.value.servers[r],
|
|
201
200
|
s.value.uid
|
|
202
201
|
);
|
|
203
202
|
} else if (e.type === "CREATE") {
|
|
@@ -206,15 +205,15 @@ const x = (e, s = []) => {
|
|
|
206
205
|
a.add(u, s.value.uid);
|
|
207
206
|
}
|
|
208
207
|
return !0;
|
|
209
|
-
},
|
|
208
|
+
}, W = (e, { activeCollection: s }, { tags: t, tagMutators: a }) => {
|
|
210
209
|
if (!s.value) return !1;
|
|
211
|
-
const [,
|
|
212
|
-
if (
|
|
213
|
-
const u = s.value.tags[
|
|
210
|
+
const [, r, ...n] = e.path;
|
|
211
|
+
if (n != null && n.length) {
|
|
212
|
+
const u = s.value.tags[r], l = t[u], p = m(M, { ...e, path: n });
|
|
214
213
|
if (!l || !p) return !1;
|
|
215
214
|
a.edit(u, p.path, p.value);
|
|
216
215
|
} else if (e.type === "REMOVE") {
|
|
217
|
-
const u = s.value.tags[
|
|
216
|
+
const u = s.value.tags[r], l = t[u];
|
|
218
217
|
if (!l) return !1;
|
|
219
218
|
a.delete(l, s.value.uid);
|
|
220
219
|
} else if (e.type === "CREATE") {
|
|
@@ -226,22 +225,22 @@ const x = (e, s = []) => {
|
|
|
226
225
|
}, w = (e, s, t) => {
|
|
227
226
|
const a = d(e);
|
|
228
227
|
if (a instanceof i.ZodUnion || a instanceof i.ZodDiscriminatedUnion) {
|
|
229
|
-
for (const
|
|
230
|
-
if (
|
|
231
|
-
return
|
|
228
|
+
for (const r of a.options)
|
|
229
|
+
if (r instanceof i.ZodObject && s in r.shape && r.shape[s] instanceof i.ZodLiteral && r.shape[s].value === t)
|
|
230
|
+
return r;
|
|
232
231
|
}
|
|
233
232
|
return null;
|
|
234
|
-
},
|
|
233
|
+
}, I = (e, { activeCollection: s }, { securitySchemes: t, securitySchemeMutators: a }) => {
|
|
235
234
|
if (!s.value) return !1;
|
|
236
|
-
const [, ,
|
|
235
|
+
const [, , r, ...n] = e.path, u = t[r] ?? v(
|
|
237
236
|
s.value.securitySchemes,
|
|
238
237
|
t,
|
|
239
|
-
(l) => l.nameKey ===
|
|
238
|
+
(l) => l.nameKey === r
|
|
240
239
|
);
|
|
241
|
-
if (
|
|
240
|
+
if (n != null && n.length) {
|
|
242
241
|
const l = w(S, "type", u == null ? void 0 : u.type);
|
|
243
242
|
if (!l) return !1;
|
|
244
|
-
const p = m(l, { ...e, path:
|
|
243
|
+
const p = m(l, { ...e, path: n });
|
|
245
244
|
if (!p) return !1;
|
|
246
245
|
const o = p.path;
|
|
247
246
|
a.edit(u.uid, o, p.value);
|
|
@@ -259,9 +258,9 @@ export {
|
|
|
259
258
|
v as findResource,
|
|
260
259
|
K as mutateCollectionDiff,
|
|
261
260
|
L as mutateRequestDiff,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
261
|
+
I as mutateSecuritySchemeDiff,
|
|
262
|
+
P as mutateServerDiff,
|
|
263
|
+
W as mutateTagDiff,
|
|
265
264
|
w as narrowUnionSchema,
|
|
266
265
|
m as parseDiff,
|
|
267
266
|
G as traverseZodSchema
|