@scalar/api-client 2.2.22 → 2.2.23
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 +10 -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 +69 -70
- package/dist/components/AddressBar/AddressBarServer.vue.js +26 -26
- 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 +46 -46
- package/dist/components/CodeInput/codeVariableWidget.d.ts +4 -4
- package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
- package/dist/components/CodeInput/codeVariableWidget.js +42 -38
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +25 -24
- package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts +1 -1
- package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteExample.vue.js +64 -55
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +110 -106
- package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +2 -2
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +38 -37
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.d.ts.map +1 -1
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +52 -49
- package/dist/components/ImportCollection/DropEventListener.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/DropEventListener.vue.js +46 -43
- package/dist/components/ImportCollection/ImportCollectionModal.vue.js +40 -39
- package/dist/components/ImportCollection/ImportNowButton.vue.js +44 -42
- package/dist/components/ImportCollection/WorkspaceSelector.vue.js +76 -69
- package/dist/components/ScalarAsciiArt.vue.js +1 -1
- package/dist/components/ScalarAsciiArt.vue2.js +22 -19
- package/dist/components/Search/useSearch.d.ts.map +1 -1
- package/dist/components/Search/useSearch.js +57 -49
- package/dist/components/SideNav/SideNavRouterLink.vue.d.ts.map +1 -1
- package/dist/components/SideNav/SideNavRouterLink.vue.js +22 -19
- package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarListElement.vue.js +2 -2
- package/dist/components/Sidebar/SidebarListElement.vue2.js +38 -36
- package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
- package/dist/components/TopNav/TopNav.vue.js +71 -64
- package/dist/layouts/App/ApiClientApp.vue.js +4 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
- package/dist/layouts/Modal/ApiClientModal.vue2.js +22 -19
- package/dist/layouts/Web/ApiClientWeb.vue.js +4 -1
- package/dist/libs/create-client.d.ts +10 -10
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +42 -36
- package/dist/libs/extractAttachmentFilename.d.ts +3 -0
- package/dist/libs/extractAttachmentFilename.d.ts.map +1 -1
- package/dist/libs/extractAttachmentFilename.js +7 -7
- package/dist/libs/importers/curl.d.ts.map +1 -1
- package/dist/libs/importers/curl.js +18 -18
- package/dist/libs/normalize-headers.d.ts.map +1 -1
- package/dist/libs/normalize-headers.js +2 -2
- package/dist/libs/parse-curl.js +39 -36
- package/dist/store/active-entities.d.ts +4 -4
- package/dist/store/active-entities.d.ts.map +1 -1
- package/dist/store/active-entities.js +88 -86
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/collections.js +29 -29
- package/dist/store/request-example.d.ts.map +1 -1
- package/dist/store/request-example.js +27 -23
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/requests.js +94 -77
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/security-schemes.js +27 -27
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/servers.js +18 -18
- package/dist/store/tags.d.ts.map +1 -1
- package/dist/store/tags.js +35 -33
- package/dist/style.css +1 -1
- package/dist/views/Cookies/CookieForm.vue.d.ts.map +1 -1
- package/dist/views/Cookies/CookieForm.vue.js +14 -9
- package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +39 -37
- package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
- package/dist/views/Environment/Environment.vue2.js +94 -89
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +121 -119
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +28 -25
- 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 +38 -37
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue2.js +76 -73
- package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue2.js +80 -80
- package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue2.js +192 -178
- package/dist/views/Request/RequestSection/RequestParams.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestParams.vue.js +80 -73
- package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +50 -48
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.js +1 -1
- package/dist/views/Request/RequestSidebar.vue2.js +149 -144
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
- package/dist/views/Request/RequestSidebarItem.vue2.js +168 -150
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +80 -80
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +1 -1
- package/dist/views/Request/components/WorkspaceDropdown.vue.d.ts.map +1 -1
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +166 -156
- package/dist/views/Request/handle-drag.d.ts.map +1 -1
- package/dist/views/Request/handle-drag.js +37 -31
- package/dist/views/Request/hooks/useOpenApiWatcher.js +27 -27
- package/dist/views/Request/libs/live-sync.d.ts.map +1 -1
- package/dist/views/Request/libs/live-sync.js +147 -130
- package/dist/views/Request/types/sidebar-item.d.ts +4 -1
- package/dist/views/Request/types/sidebar-item.d.ts.map +1 -1
- package/dist/views/Servers/ServerForm.vue.js +38 -35
- package/dist/views/Servers/Servers.vue2.js +38 -35
- package/dist/views/Settings/Settings.vue.d.ts.map +1 -1
- package/dist/views/Settings/Settings.vue2.js +15 -15
- package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneral.vue.js +206 -174
- package/package.json +8 -8
|
@@ -1,53 +1,57 @@
|
|
|
1
|
-
import { collectionSchema as
|
|
2
|
-
import { isHttpMethod as
|
|
1
|
+
import { collectionSchema as M, requestSchema as V, serverSchema as q, tagSchema as S, securitySchemeSchema as Z, createExampleFromRequest as H } from "@scalar/oas-utils/entities/spec";
|
|
2
|
+
import { isHttpMethod as j, schemaModel as R } from "@scalar/oas-utils/helpers";
|
|
3
3
|
import { getNestedValue as N } from "@scalar/object-utils/nested";
|
|
4
|
-
import
|
|
4
|
+
import x from "microdiff";
|
|
5
5
|
import { z as i } from "zod";
|
|
6
|
-
const
|
|
6
|
+
const G = (e, s = []) => {
|
|
7
7
|
const t = [];
|
|
8
8
|
let a = !1;
|
|
9
|
-
for (let
|
|
9
|
+
for (let u = 0; u < e.length; u++) {
|
|
10
10
|
if (a) {
|
|
11
11
|
a = !1;
|
|
12
12
|
continue;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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];
|
|
23
|
-
if (l !== o && t.push({
|
|
24
|
-
type: "CHANGE",
|
|
25
|
-
path: ["paths", "path"],
|
|
26
|
-
oldValue: l,
|
|
27
|
-
value: o
|
|
28
|
-
}), p && h && p !== h && (t.push({
|
|
29
|
-
type: "CHANGE",
|
|
30
|
-
path: ["paths", o, "method"],
|
|
31
|
-
oldValue: p,
|
|
32
|
-
value: h
|
|
33
|
-
}), c.push(h)), s.length === 0) {
|
|
34
|
-
const y = j(n.oldValue, u.value);
|
|
35
|
-
if (y.length) {
|
|
36
|
-
const E = x(y, c);
|
|
37
|
-
t.push(...E);
|
|
38
|
-
}
|
|
14
|
+
const r = e[u], n = e[u + 1];
|
|
15
|
+
if (r) {
|
|
16
|
+
if (s.length)
|
|
17
|
+
r.path = [...s, ...r.path], n && (n.path = [...s, ...n.path]);
|
|
18
|
+
else if (r.path[0] !== "paths") {
|
|
19
|
+
t.push(r);
|
|
20
|
+
continue;
|
|
39
21
|
}
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
if (r.type === "REMOVE" && (n == null ? void 0 : n.type) === "CREATE") {
|
|
23
|
+
const [, l, p] = r.path, [, o, h] = n.path, c = ["paths", o].filter(
|
|
24
|
+
(f) => typeof f == "string"
|
|
25
|
+
);
|
|
26
|
+
if (l !== o && t.push({
|
|
27
|
+
type: "CHANGE",
|
|
28
|
+
path: ["paths", "path"],
|
|
29
|
+
oldValue: l,
|
|
30
|
+
value: o
|
|
31
|
+
}), p && typeof h == "string" && p !== h && o && (t.push({
|
|
32
|
+
type: "CHANGE",
|
|
33
|
+
path: ["paths", o, "method"],
|
|
34
|
+
oldValue: p,
|
|
35
|
+
value: h
|
|
36
|
+
}), c.push(h)), s.length === 0) {
|
|
37
|
+
const f = x(r.oldValue, n.value);
|
|
38
|
+
if (f.length) {
|
|
39
|
+
const g = G(f, c);
|
|
40
|
+
t.push(...g);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
a = !0;
|
|
44
|
+
} else r.type === "CREATE" && r.path.length > 3 && typeof r.path.at(-1) != "number" ? t.push({ ...r, type: "CHANGE", oldValue: void 0 }) : r.type === "REMOVE" && r.path.length > 3 && typeof r.path.at(-1) != "number" ? t.push({ ...r, type: "CHANGE", value: void 0 }) : t.push(r);
|
|
45
|
+
}
|
|
42
46
|
}
|
|
43
47
|
return t;
|
|
44
48
|
}, v = (e, s, t) => {
|
|
45
49
|
for (const a of e) {
|
|
46
|
-
const
|
|
47
|
-
if (t(
|
|
50
|
+
const u = s[a];
|
|
51
|
+
if (u && t(u)) return u;
|
|
48
52
|
}
|
|
49
53
|
return null;
|
|
50
|
-
}, d = (e) => e instanceof i.ZodOptional ? d(e.unwrap()) : e instanceof i.ZodDefault ? d(e._def.innerType) : e,
|
|
54
|
+
}, d = (e) => e instanceof i.ZodOptional ? d(e.unwrap()) : e instanceof i.ZodDefault ? d(e._def.innerType) : e, w = (e, s) => {
|
|
51
55
|
let t = e;
|
|
52
56
|
for (const a of s) {
|
|
53
57
|
if (t = d(t), t instanceof i.ZodAny)
|
|
@@ -71,40 +75,40 @@ const x = (e, s = []) => {
|
|
|
71
75
|
t = d(t);
|
|
72
76
|
}
|
|
73
77
|
return t;
|
|
74
|
-
},
|
|
75
|
-
const t =
|
|
78
|
+
}, E = (e, s) => {
|
|
79
|
+
const t = w(e, s.path);
|
|
76
80
|
if (!t) return null;
|
|
77
|
-
const a = s.path.join("."),
|
|
81
|
+
const a = s.path.join("."), u = s.path.slice(0, -1).join(".");
|
|
78
82
|
if (s.type === "REMOVE")
|
|
79
83
|
return {
|
|
80
84
|
path: a,
|
|
81
|
-
pathMinusOne:
|
|
85
|
+
pathMinusOne: u,
|
|
82
86
|
value: void 0
|
|
83
87
|
};
|
|
84
|
-
const
|
|
85
|
-
return
|
|
88
|
+
const r = R(s.value, t, !1);
|
|
89
|
+
return r ? {
|
|
86
90
|
path: a,
|
|
87
|
-
pathMinusOne:
|
|
88
|
-
value:
|
|
91
|
+
pathMinusOne: u,
|
|
92
|
+
value: r
|
|
89
93
|
} : null;
|
|
90
|
-
},
|
|
94
|
+
}, L = (e, { activeCollection: s }, { collectionMutators: t }) => {
|
|
91
95
|
if (!s.value) return !1;
|
|
92
96
|
if (typeof e.path[e.path.length - 1] == "number" && (e.type === "CREATE" || e.type === "REMOVE")) {
|
|
93
|
-
const a =
|
|
97
|
+
const a = E(M, {
|
|
94
98
|
...e,
|
|
95
99
|
path: e.path
|
|
96
100
|
});
|
|
97
101
|
if (!a) return !1;
|
|
98
|
-
const
|
|
102
|
+
const u = [
|
|
99
103
|
...N(s.value, a.pathMinusOne)
|
|
100
104
|
];
|
|
101
|
-
e.type === "CREATE" ?
|
|
105
|
+
e.type === "CREATE" ? u.push(a.value) : e.type === "REMOVE" && u.pop(), t.edit(
|
|
102
106
|
s.value.uid,
|
|
103
107
|
a.pathMinusOne,
|
|
104
|
-
|
|
108
|
+
u
|
|
105
109
|
);
|
|
106
110
|
} else {
|
|
107
|
-
const a =
|
|
111
|
+
const a = E(M, e);
|
|
108
112
|
if (!a) return !1;
|
|
109
113
|
t.edit(
|
|
110
114
|
s.value.uid,
|
|
@@ -113,155 +117,168 @@ const x = (e, s = []) => {
|
|
|
113
117
|
);
|
|
114
118
|
}
|
|
115
119
|
return !0;
|
|
116
|
-
},
|
|
117
|
-
const { requests: t, requestExamples: a, requestExampleMutators:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
}, D = (e, s) => {
|
|
121
|
+
const { requests: t, requestExamples: a, requestExampleMutators: u } = s, r = t[e];
|
|
122
|
+
r == null || r.examples.forEach((n) => {
|
|
123
|
+
var p;
|
|
124
|
+
const l = H(
|
|
125
|
+
r,
|
|
126
|
+
((p = a[n]) == null ? void 0 : p.name) ?? "Default"
|
|
122
127
|
);
|
|
123
|
-
l &&
|
|
128
|
+
l && u.set({
|
|
124
129
|
...l,
|
|
125
|
-
uid:
|
|
130
|
+
uid: n
|
|
126
131
|
});
|
|
127
132
|
});
|
|
128
|
-
},
|
|
133
|
+
}, P = (e, { activeCollection: s }, t) => {
|
|
129
134
|
if (!s.value) return !1;
|
|
130
|
-
const { requests: a, requestMutators:
|
|
131
|
-
if (
|
|
135
|
+
const { requests: a, requestMutators: u } = t, [, r, n, ...l] = e.path;
|
|
136
|
+
if (r === "path" && e.type === "CHANGE")
|
|
132
137
|
s.value.requests.forEach((p) => {
|
|
133
|
-
|
|
138
|
+
var o;
|
|
139
|
+
((o = a[p]) == null ? void 0 : o.path) === e.oldValue && u.edit(p, "path", e.value);
|
|
134
140
|
});
|
|
135
|
-
else if (
|
|
141
|
+
else if (n === "method" && e.type === "CHANGE")
|
|
136
142
|
s.value.requests.forEach((p) => {
|
|
137
|
-
|
|
143
|
+
var o, h;
|
|
144
|
+
((o = a[p]) == null ? void 0 : o.method) === e.oldValue && ((h = a[p]) == null ? void 0 : h.path) === r && u.edit(p, "method", e.value);
|
|
138
145
|
});
|
|
139
146
|
else if (e.type !== "CHANGE" && typeof l.at(-1) == "number") {
|
|
140
147
|
const p = v(
|
|
141
148
|
s.value.requests,
|
|
142
149
|
a,
|
|
143
|
-
(c) => c.path ===
|
|
144
|
-
), o =
|
|
150
|
+
(c) => c.path === r && c.method === n
|
|
151
|
+
), o = E(V, {
|
|
145
152
|
...e,
|
|
146
153
|
path: e.path.slice(3)
|
|
147
154
|
});
|
|
148
155
|
if (!p || !o) return !1;
|
|
149
156
|
const h = [...N(p, o.pathMinusOne)];
|
|
150
|
-
e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(),
|
|
157
|
+
e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(), u.edit(p.uid, o.pathMinusOne, h), (e.path[3] === "parameters" || e.path[3] === "requestBody") && D(p.uid, t);
|
|
151
158
|
} else if (e.type === "CREATE") {
|
|
152
|
-
const [
|
|
159
|
+
const [p] = Object.entries(e.value ?? {}), [o, h] = p ?? [], c = n ? e.value : h, f = n || o, g = q.array().parse(c.servers ?? []), { security: y, ...T } = c, A = {
|
|
153
160
|
...T,
|
|
154
|
-
method:
|
|
155
|
-
path:
|
|
156
|
-
parameters:
|
|
157
|
-
servers:
|
|
161
|
+
method: j(f) ? f : "get",
|
|
162
|
+
path: r,
|
|
163
|
+
parameters: c.parameters ?? [],
|
|
164
|
+
servers: g.map((m) => m.uid)
|
|
158
165
|
};
|
|
159
|
-
|
|
160
|
-
if (Object.keys(
|
|
161
|
-
const [
|
|
162
|
-
return {
|
|
163
|
-
[
|
|
164
|
-
};
|
|
165
|
-
} else return
|
|
166
|
+
y != null && y.length && (A.security = y.map((m) => {
|
|
167
|
+
if (Object.keys(m).length) {
|
|
168
|
+
const [O] = Object.keys(m);
|
|
169
|
+
return O ? {
|
|
170
|
+
[O]: m[O]
|
|
171
|
+
} : m;
|
|
172
|
+
} else return m;
|
|
166
173
|
}));
|
|
167
|
-
const
|
|
168
|
-
if (!
|
|
169
|
-
|
|
174
|
+
const b = R(A, V, !1);
|
|
175
|
+
if (!b) return !1;
|
|
176
|
+
u.add(b, s.value.uid);
|
|
170
177
|
} else if (e.type === "REMOVE") {
|
|
171
178
|
const p = v(
|
|
172
179
|
s.value.requests,
|
|
173
180
|
a,
|
|
174
|
-
(o) => o.path ===
|
|
181
|
+
(o) => o.path === r && o.method === n
|
|
175
182
|
);
|
|
176
183
|
if (!p) return !1;
|
|
177
|
-
|
|
184
|
+
u.delete(p, s.value.uid);
|
|
178
185
|
} else if (e.type === "CHANGE") {
|
|
179
186
|
const p = v(
|
|
180
187
|
s.value.requests,
|
|
181
188
|
a,
|
|
182
|
-
(h) => h.path ===
|
|
183
|
-
), o =
|
|
189
|
+
(h) => h.path === r && h.method === n
|
|
190
|
+
), o = E(V, { ...e, path: l });
|
|
184
191
|
if (!p || !o) return !1;
|
|
185
|
-
|
|
192
|
+
u.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && D(p.uid, t);
|
|
186
193
|
}
|
|
187
194
|
return !0;
|
|
188
|
-
},
|
|
195
|
+
}, W = (e, { activeCollection: s }, { servers: t, serverMutators: a }) => {
|
|
189
196
|
if (!s.value) return !1;
|
|
190
|
-
const [,
|
|
191
|
-
if (
|
|
192
|
-
const
|
|
197
|
+
const [, u, ...r] = e.path;
|
|
198
|
+
if (r != null && r.length) {
|
|
199
|
+
const n = s.value.servers[u];
|
|
200
|
+
if (!n) return !1;
|
|
201
|
+
const l = t[n], p = E(q, { ...e, path: r });
|
|
193
202
|
if (!l || !p) return !1;
|
|
194
|
-
const h = e.type === "REMOVE" &&
|
|
195
|
-
a.edit(
|
|
203
|
+
const h = e.type === "REMOVE" && r[r.length - 1] === "variables" ? {} : p.value;
|
|
204
|
+
a.edit(n, p.path, h);
|
|
196
205
|
} else if (e.type === "REMOVE") {
|
|
197
|
-
if (!s.value.servers[
|
|
206
|
+
if (!s.value.servers[u]) return !1;
|
|
198
207
|
a.delete(
|
|
199
|
-
s.value.servers[
|
|
208
|
+
s.value.servers[u],
|
|
200
209
|
s.value.uid
|
|
201
210
|
);
|
|
202
211
|
} else if (e.type === "CREATE") {
|
|
203
|
-
const
|
|
204
|
-
if (!
|
|
205
|
-
a.add(
|
|
212
|
+
const n = R(e.value, q, !1);
|
|
213
|
+
if (!n) return !1;
|
|
214
|
+
a.add(n, s.value.uid);
|
|
206
215
|
}
|
|
207
216
|
return !0;
|
|
208
|
-
},
|
|
217
|
+
}, I = (e, { activeCollection: s }, { tags: t, tagMutators: a }) => {
|
|
209
218
|
if (!s.value) return !1;
|
|
210
|
-
const [,
|
|
211
|
-
if (
|
|
212
|
-
const
|
|
219
|
+
const [, u, ...r] = e.path;
|
|
220
|
+
if (r != null && r.length) {
|
|
221
|
+
const n = s.value.tags[u];
|
|
222
|
+
if (!n) return !1;
|
|
223
|
+
const l = t[n], p = E(S, { ...e, path: r });
|
|
213
224
|
if (!l || !p) return !1;
|
|
214
|
-
a.edit(
|
|
225
|
+
a.edit(n, p.path, p.value);
|
|
215
226
|
} else if (e.type === "REMOVE") {
|
|
216
|
-
const
|
|
227
|
+
const n = s.value.tags[u];
|
|
228
|
+
if (!n) return !1;
|
|
229
|
+
const l = t[n];
|
|
217
230
|
if (!l) return !1;
|
|
218
231
|
a.delete(l, s.value.uid);
|
|
219
232
|
} else if (e.type === "CREATE") {
|
|
220
|
-
const
|
|
221
|
-
if (!
|
|
222
|
-
a.add(
|
|
233
|
+
const n = R(e.value, S, !1);
|
|
234
|
+
if (!n) return !1;
|
|
235
|
+
a.add(n, s.value.uid);
|
|
223
236
|
}
|
|
224
237
|
return !0;
|
|
225
|
-
},
|
|
238
|
+
}, U = (e, s, t) => {
|
|
226
239
|
const a = d(e);
|
|
227
240
|
if (a instanceof i.ZodUnion || a instanceof i.ZodDiscriminatedUnion) {
|
|
228
|
-
for (const
|
|
229
|
-
if (
|
|
230
|
-
return
|
|
241
|
+
for (const u of a.options)
|
|
242
|
+
if (u instanceof i.ZodObject && s in u.shape && u.shape[s] instanceof i.ZodLiteral && u.shape[s].value === t)
|
|
243
|
+
return u;
|
|
231
244
|
}
|
|
232
245
|
return null;
|
|
233
|
-
},
|
|
246
|
+
}, J = (e, { activeCollection: s }, { securitySchemes: t, securitySchemeMutators: a }) => {
|
|
234
247
|
if (!s.value) return !1;
|
|
235
|
-
const [, ,
|
|
248
|
+
const [, , u, ...r] = e.path, n = t[u] ?? v(
|
|
236
249
|
s.value.securitySchemes,
|
|
237
250
|
t,
|
|
238
|
-
(l) => l.nameKey ===
|
|
251
|
+
(l) => l.nameKey === u
|
|
239
252
|
);
|
|
240
|
-
if (
|
|
241
|
-
const l =
|
|
242
|
-
|
|
243
|
-
|
|
253
|
+
if (r != null && r.length) {
|
|
254
|
+
const l = U(
|
|
255
|
+
Z,
|
|
256
|
+
"type",
|
|
257
|
+
(n == null ? void 0 : n.type) ?? ""
|
|
258
|
+
);
|
|
259
|
+
if (!l || !n) return !1;
|
|
260
|
+
const p = E(l, { ...e, path: r });
|
|
244
261
|
if (!p) return !1;
|
|
245
262
|
const o = p.path;
|
|
246
|
-
a.edit(
|
|
263
|
+
a.edit(n.uid, o, p.value);
|
|
247
264
|
} else if (e.type === "REMOVE") {
|
|
248
|
-
if (!
|
|
249
|
-
a.delete(
|
|
265
|
+
if (!n) return !1;
|
|
266
|
+
a.delete(n.uid);
|
|
250
267
|
} else e.type === "CREATE" && a.add(
|
|
251
|
-
|
|
268
|
+
Z.parse(e.value),
|
|
252
269
|
s.value.uid
|
|
253
270
|
);
|
|
254
271
|
return !0;
|
|
255
272
|
};
|
|
256
273
|
export {
|
|
257
|
-
|
|
274
|
+
G as combineRenameDiffs,
|
|
258
275
|
v as findResource,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
276
|
+
L as mutateCollectionDiff,
|
|
277
|
+
P as mutateRequestDiff,
|
|
278
|
+
J as mutateSecuritySchemeDiff,
|
|
279
|
+
W as mutateServerDiff,
|
|
280
|
+
I as mutateTagDiff,
|
|
281
|
+
U as narrowUnionSchema,
|
|
282
|
+
E as parseDiff,
|
|
283
|
+
w as traverseZodSchema
|
|
267
284
|
};
|
|
@@ -2,7 +2,10 @@ import type { Collection, Request, RequestExample, RequestMethod, Tag } from '@s
|
|
|
2
2
|
import type { RouteLocationRaw } from 'vue-router';
|
|
3
3
|
export type SidebarItem = {
|
|
4
4
|
title: string;
|
|
5
|
-
entity: Collection | Tag | Request | RequestExample
|
|
5
|
+
entity: Collection | Tag | Request | RequestExample | {
|
|
6
|
+
type: 'unknown';
|
|
7
|
+
uid: string;
|
|
8
|
+
};
|
|
6
9
|
resourceTitle: string;
|
|
7
10
|
children: string[];
|
|
8
11
|
method?: RequestMethod;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/types/sidebar-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,GAAG,EACJ,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,
|
|
1
|
+
{"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/types/sidebar-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,GAAG,EACJ,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EACF,UAAU,GACV,GAAG,GACH,OAAO,GACP,cAAc,GACd;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACpC,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,8CAA8C;IAC9C,IAAI,EAAE,OAAO,CAAA;CACd,CAAA"}
|
|
@@ -1,68 +1,71 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, computed as l, openBlock as u, createElementBlock as p, Fragment as g, createVNode as y, createBlock as O, createCommentVNode as v } from "vue";
|
|
2
2
|
import m from "../../components/Form/Form.vue.js";
|
|
3
|
-
import { useActiveEntities as
|
|
4
|
-
import { useRoute as
|
|
5
|
-
import { useWorkspace as
|
|
6
|
-
const
|
|
3
|
+
import { useActiveEntities as V } from "../../store/active-entities.js";
|
|
4
|
+
import { useRoute as j } from "vue-router";
|
|
5
|
+
import { useWorkspace as B } from "../../store/store.js";
|
|
6
|
+
const C = { class: "w-full" }, R = /* @__PURE__ */ b({
|
|
7
7
|
__name: "ServerForm",
|
|
8
|
-
setup(
|
|
9
|
-
const { activeCollection:
|
|
8
|
+
setup(U) {
|
|
9
|
+
const { activeCollection: s } = V(), { servers: f, serverMutators: n } = B(), _ = [
|
|
10
10
|
{ label: "URL", key: "url", placeholder: "https://void.scalar.com/api" },
|
|
11
11
|
{
|
|
12
12
|
label: "Label",
|
|
13
13
|
key: "description",
|
|
14
14
|
placeholder: "Production"
|
|
15
15
|
}
|
|
16
|
-
], c =
|
|
16
|
+
], c = j(), r = l(
|
|
17
17
|
() => {
|
|
18
18
|
var e, t;
|
|
19
|
-
return
|
|
20
|
-
(
|
|
19
|
+
return f[(s.value && c.params.server === "default" ? (e = s.value) == null ? void 0 : e.servers[0] : (t = s.value) == null ? void 0 : t.servers.find(
|
|
20
|
+
(o) => o === c.params.server
|
|
21
21
|
)) ?? ""];
|
|
22
22
|
}
|
|
23
|
-
),
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
},
|
|
23
|
+
), k = (e, t) => {
|
|
24
|
+
!s.value || !r.value || n.edit(r.value.uid, e, t);
|
|
25
|
+
}, h = (e, t) => {
|
|
26
|
+
!s.value || !r.value || n.edit(r.value.uid, `variables.${e}.value`, t);
|
|
27
|
+
}, S = l(
|
|
28
28
|
() => {
|
|
29
29
|
var e;
|
|
30
|
-
return Object.entries(((e =
|
|
31
|
-
([t,
|
|
32
|
-
var
|
|
30
|
+
return Object.entries(((e = r.value) == null ? void 0 : e.variables) ?? {}).map(
|
|
31
|
+
([t, o]) => {
|
|
32
|
+
var a;
|
|
33
33
|
return {
|
|
34
34
|
key: t,
|
|
35
35
|
label: t,
|
|
36
|
-
placeholder: (
|
|
36
|
+
placeholder: (o.default ?? ((a = o == null ? void 0 : o.enum) == null ? void 0 : a[0]) ?? "").toString()
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
), i = l(
|
|
42
|
-
() =>
|
|
43
|
-
var
|
|
44
|
-
return
|
|
45
|
-
|
|
42
|
+
() => {
|
|
43
|
+
var e;
|
|
44
|
+
return Object.entries(((e = r.value) == null ? void 0 : e.variables) ?? {}).reduce((t, [o, a]) => {
|
|
45
|
+
var d;
|
|
46
|
+
return t[o] = (a.default ?? ((d = a == null ? void 0 : a.enum) == null ? void 0 : d[0]) ?? "").toString(), t;
|
|
47
|
+
}, {});
|
|
48
|
+
}
|
|
46
49
|
);
|
|
47
|
-
return (e, t) => (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
data:
|
|
51
|
-
onUpdate:
|
|
52
|
-
options:
|
|
50
|
+
return (e, t) => (u(), p("div", C, [
|
|
51
|
+
r.value ? (u(), p(g, { key: 0 }, [
|
|
52
|
+
y(m, {
|
|
53
|
+
data: r.value,
|
|
54
|
+
onUpdate: k,
|
|
55
|
+
options: _,
|
|
53
56
|
title: "Server"
|
|
54
57
|
}, null, 8, ["data"]),
|
|
55
|
-
Object.keys(i.value).length ? (
|
|
58
|
+
Object.keys(i.value).length ? (u(), O(m, {
|
|
56
59
|
key: 0,
|
|
57
60
|
data: i.value,
|
|
58
|
-
onUpdate:
|
|
59
|
-
options:
|
|
61
|
+
onUpdate: h,
|
|
62
|
+
options: S.value,
|
|
60
63
|
title: "Variables"
|
|
61
|
-
}, null, 8, ["data", "options"])) :
|
|
62
|
-
], 64)) :
|
|
64
|
+
}, null, 8, ["data", "options"])) : v("", !0)
|
|
65
|
+
], 64)) : v("", !0)
|
|
63
66
|
]));
|
|
64
67
|
}
|
|
65
68
|
});
|
|
66
69
|
export {
|
|
67
|
-
|
|
70
|
+
R as default
|
|
68
71
|
};
|
|
@@ -1,46 +1,49 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { useActiveEntities as
|
|
8
|
-
import { serverSchema as
|
|
9
|
-
import { useRouter as
|
|
10
|
-
import
|
|
11
|
-
import { useWorkspace as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
1
|
+
import { defineComponent as v, openBlock as a, createBlock as u, withCtx as e, createVNode as r, unref as n, createElementVNode as _, createElementBlock as S, Fragment as x, renderList as b, createTextVNode as k } from "vue";
|
|
2
|
+
import h from "../../components/Sidebar/SidebarButton.vue.js";
|
|
3
|
+
import L from "../../components/Sidebar/SidebarList.vue.js";
|
|
4
|
+
import V from "../../components/Sidebar/SidebarListElement.vue.js";
|
|
5
|
+
import w from "../../components/ViewLayout/ViewLayout.vue.js";
|
|
6
|
+
import y from "../../components/ViewLayout/ViewLayoutContent.vue.js";
|
|
7
|
+
import { useActiveEntities as C } from "../../store/active-entities.js";
|
|
8
|
+
import { serverSchema as E } from "@scalar/oas-utils/entities/spec";
|
|
9
|
+
import { useRouter as B } from "vue-router";
|
|
10
|
+
import N from "./ServerForm.vue.js";
|
|
11
|
+
import { useWorkspace as A } from "../../store/store.js";
|
|
12
|
+
import $ from "../../components/Sidebar/Sidebar.vue.js";
|
|
13
|
+
const g = { class: "flex-1" }, K = /* @__PURE__ */ v({
|
|
14
14
|
__name: "Servers",
|
|
15
|
-
setup(
|
|
16
|
-
const { activeCollection: t } =
|
|
15
|
+
setup(F) {
|
|
16
|
+
const { activeCollection: t } = C(), { servers: c, serverMutators: f } = A(), { push: p } = B(), d = () => {
|
|
17
17
|
if (!t.value) return;
|
|
18
|
-
const o =
|
|
19
|
-
|
|
18
|
+
const o = E.parse({ url: "http://localhost" });
|
|
19
|
+
f.add(o, t.value.uid), p({
|
|
20
20
|
name: "servers",
|
|
21
21
|
params: {
|
|
22
22
|
server: o.uid
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
return (o, i) => (a(),
|
|
26
|
+
return (o, i) => (a(), u(w, null, {
|
|
27
27
|
default: e(() => [
|
|
28
|
-
r(n(
|
|
28
|
+
r(n($), { title: "Servers" }, {
|
|
29
29
|
content: e(() => [
|
|
30
|
-
|
|
31
|
-
r(
|
|
30
|
+
_("div", g, [
|
|
31
|
+
r(L, null, {
|
|
32
32
|
default: e(() => {
|
|
33
33
|
var l;
|
|
34
34
|
return [
|
|
35
|
-
(a(!0),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
(a(!0), S(x, null, b((l = n(t)) == null ? void 0 : l.servers, (s) => {
|
|
36
|
+
var m;
|
|
37
|
+
return a(), u(V, {
|
|
38
|
+
key: s,
|
|
39
|
+
class: "text-xs",
|
|
40
|
+
type: "server",
|
|
41
|
+
variable: {
|
|
42
|
+
name: ((m = n(c)[s]) == null ? void 0 : m.url) ?? "",
|
|
43
|
+
uid: s
|
|
44
|
+
}
|
|
45
|
+
}, null, 8, ["variable"]);
|
|
46
|
+
}), 128))
|
|
44
47
|
];
|
|
45
48
|
}),
|
|
46
49
|
_: 1
|
|
@@ -48,18 +51,18 @@ const $ = { class: "flex-1" }, J = /* @__PURE__ */ d({
|
|
|
48
51
|
])
|
|
49
52
|
]),
|
|
50
53
|
button: e(() => [
|
|
51
|
-
r(
|
|
54
|
+
r(h, { click: d }, {
|
|
52
55
|
title: e(() => i[0] || (i[0] = [
|
|
53
|
-
|
|
56
|
+
k("Add Server")
|
|
54
57
|
])),
|
|
55
58
|
_: 1
|
|
56
59
|
})
|
|
57
60
|
]),
|
|
58
61
|
_: 1
|
|
59
62
|
}),
|
|
60
|
-
r(
|
|
63
|
+
r(y, { class: "flex-1" }, {
|
|
61
64
|
default: e(() => [
|
|
62
|
-
r(
|
|
65
|
+
r(N)
|
|
63
66
|
]),
|
|
64
67
|
_: 1
|
|
65
68
|
})
|
|
@@ -69,5 +72,5 @@ const $ = { class: "flex-1" }, J = /* @__PURE__ */ d({
|
|
|
69
72
|
}
|
|
70
73
|
});
|
|
71
74
|
export {
|
|
72
|
-
|
|
75
|
+
K as default
|
|
73
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/Settings.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Settings.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/Settings.vue"],"names":[],"mappings":"AAkCA,OAAO,EAAE,KAAK,eAAe,EAAO,MAAM,KAAK,CAAA;;AAgG/C,wBAMG"}
|