@scalar/api-client 2.6.0 → 2.7.0
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 +55 -0
- package/dist/analytics.d.ts +2 -18
- package/dist/analytics.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +66 -42
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
- package/dist/hooks/useAnalytics.d.ts +2 -18
- package/dist/hooks/useAnalytics.d.ts.map +1 -1
- package/dist/hooks/useClientConfig.d.ts +115 -112
- package/dist/hooks/useClientConfig.d.ts.map +1 -1
- package/dist/layouts/App/create-api-client-app.d.ts +1378 -1306
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/Modal/create-api-client-modal.d.ts +2752 -2608
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Web/create-api-client-web.d.ts +1378 -1306
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/libs/create-client.d.ts +1378 -1306
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/find-request.d.ts +17 -17
- package/dist/libs/find-request.d.ts.map +1 -1
- package/dist/libs/hot-keys.d.ts +1 -1
- package/dist/libs/local-storage.d.ts.map +1 -1
- package/dist/libs/send-request/build-request-security.d.ts +1 -1
- package/dist/libs/send-request/create-fetch-body.d.ts +1 -1
- package/dist/libs/send-request/create-request-operation.test.d.ts +82 -82
- package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +1 -1
- package/dist/store/active-entities.d.ts +118 -118
- package/dist/store/active-entities.d.ts.map +1 -1
- package/dist/store/collections.d.ts +127 -127
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/cookies.d.ts +14 -14
- package/dist/store/environment.d.ts +23 -23
- package/dist/store/request-example.d.ts +546 -546
- package/dist/store/request-example.d.ts.map +1 -1
- package/dist/store/requests.d.ts +194 -194
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/security-schemes.d.ts +281 -281
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/servers.d.ts +45 -45
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/store.d.ts +1378 -1306
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +18 -18
- package/dist/store/tags.d.ts +35 -35
- package/dist/store/tags.d.ts.map +1 -1
- package/dist/store/workspace.d.ts +47 -47
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.d.ts +25 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.js +30 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue2.js +4 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +3 -3
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +102 -95
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.js +16 -14
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +31 -2
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +6 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +198 -131
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.bench.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.bench.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/index.d.ts +4 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/index.js +10 -4
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -6
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +54 -54
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +54 -54
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/RequestHeaders.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +1 -1
- package/dist/views/Request/libs/auth.d.ts +2 -2
- package/dist/views/Request/libs/watch-mode.d.ts +4 -4
- package/dist/views/Request/libs/watch-mode.d.ts.map +1 -1
- package/dist/views/Request/libs/watch-mode.js +241 -186
- package/package.json +25 -20
|
@@ -1,282 +1,337 @@
|
|
|
1
|
-
import { collectionSchema as
|
|
2
|
-
import { schemaModel as v, isHttpMethod as
|
|
3
|
-
import { getNestedValue as
|
|
4
|
-
import
|
|
5
|
-
import { z as
|
|
6
|
-
const
|
|
1
|
+
import { collectionSchema as A, requestSchema as O, serverSchema as R, tagSchema as b, securitySchemeSchema as S, createExampleFromRequest as D } from "@scalar/oas-utils/entities/spec";
|
|
2
|
+
import { schemaModel as v, isHttpMethod as N } from "@scalar/oas-utils/helpers";
|
|
3
|
+
import { getNestedValue as M } from "@scalar/object-utils/nested";
|
|
4
|
+
import k from "microdiff";
|
|
5
|
+
import { z as p } from "zod";
|
|
6
|
+
const x = (e, n = []) => {
|
|
7
7
|
const t = [];
|
|
8
|
-
let
|
|
9
|
-
for (let
|
|
10
|
-
if (
|
|
11
|
-
|
|
8
|
+
let s = !1;
|
|
9
|
+
for (let u = 0; u < e.length; u++) {
|
|
10
|
+
if (s) {
|
|
11
|
+
s = !1;
|
|
12
12
|
continue;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
else if (
|
|
19
|
-
t.push(
|
|
14
|
+
const a = e[u], r = e[u + 1];
|
|
15
|
+
if (a) {
|
|
16
|
+
if (n.length)
|
|
17
|
+
a.path = [...n, ...a.path], r && (r.path = [...n, ...r.path]);
|
|
18
|
+
else if (a.path[0] !== "paths") {
|
|
19
|
+
t.push(a);
|
|
20
20
|
continue;
|
|
21
21
|
}
|
|
22
|
-
if (
|
|
23
|
-
const [,
|
|
24
|
-
if (
|
|
22
|
+
if (a.type === "REMOVE" && r?.type === "CREATE") {
|
|
23
|
+
const [, i, o] = a.path, [, l, f] = r.path, c = ["paths", l].filter((d) => typeof d == "string");
|
|
24
|
+
if (i !== l && t.push({
|
|
25
25
|
type: "CHANGE",
|
|
26
26
|
path: ["paths", "path"],
|
|
27
|
-
oldValue:
|
|
28
|
-
value:
|
|
29
|
-
}),
|
|
27
|
+
oldValue: i,
|
|
28
|
+
value: l
|
|
29
|
+
}), o && typeof f == "string" && o !== f && l && (t.push({
|
|
30
30
|
type: "CHANGE",
|
|
31
|
-
path: ["paths",
|
|
32
|
-
oldValue:
|
|
33
|
-
value:
|
|
34
|
-
}), c.push(
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
t.push(...
|
|
31
|
+
path: ["paths", l, "method"],
|
|
32
|
+
oldValue: o,
|
|
33
|
+
value: f
|
|
34
|
+
}), c.push(f)), n.length === 0) {
|
|
35
|
+
const d = k(a.oldValue, r.value);
|
|
36
|
+
if (d.length) {
|
|
37
|
+
const T = x(d, c);
|
|
38
|
+
t.push(...T);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
} else
|
|
41
|
+
s = !0;
|
|
42
|
+
} else a.type === "CREATE" && a.path.length > 3 && typeof a.path.at(-1) != "number" ? t.push({ ...a, type: "CHANGE", oldValue: void 0 }) : a.type === "REMOVE" && a.path.length > 3 && typeof a.path.at(-1) != "number" ? t.push({ ...a, type: "CHANGE", value: void 0 }) : t.push(a);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return t;
|
|
46
|
-
}, E = (e,
|
|
47
|
-
for (const
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
46
|
+
}, E = (e, n, t) => {
|
|
47
|
+
for (const s of e) {
|
|
48
|
+
const u = n[s];
|
|
49
|
+
if (u && t(u))
|
|
50
|
+
return u;
|
|
51
51
|
}
|
|
52
52
|
return null;
|
|
53
|
-
},
|
|
53
|
+
}, h = (e) => {
|
|
54
|
+
if (e instanceof p.ZodOptional) {
|
|
55
|
+
const n = e.unwrap();
|
|
56
|
+
if (n instanceof p.ZodType)
|
|
57
|
+
return h(n);
|
|
58
|
+
}
|
|
59
|
+
if (e instanceof p.ZodDefault) {
|
|
60
|
+
const n = e._zod.def.innerType;
|
|
61
|
+
if (n instanceof p.ZodType)
|
|
62
|
+
return h(n);
|
|
63
|
+
}
|
|
64
|
+
if (e instanceof p.ZodCatch) {
|
|
65
|
+
const n = e._zod.def.innerType;
|
|
66
|
+
if (n instanceof p.ZodType)
|
|
67
|
+
return h(n);
|
|
68
|
+
}
|
|
69
|
+
if (e instanceof p.ZodPipe) {
|
|
70
|
+
const n = e._zod.def.in;
|
|
71
|
+
if (n instanceof p.ZodType)
|
|
72
|
+
return h(n);
|
|
73
|
+
}
|
|
74
|
+
return e;
|
|
75
|
+
}, H = (e, n) => {
|
|
54
76
|
let t = e;
|
|
55
|
-
for (const
|
|
56
|
-
if (t =
|
|
77
|
+
for (const s of n) {
|
|
78
|
+
if (t = h(t), t instanceof p.ZodAny)
|
|
57
79
|
return t;
|
|
58
|
-
if (t instanceof
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
80
|
+
if (t instanceof p.ZodObject && typeof s == "string" && s in t.shape) {
|
|
81
|
+
const u = t.shape[s];
|
|
82
|
+
if (u instanceof p.ZodType)
|
|
83
|
+
t = u;
|
|
84
|
+
else
|
|
85
|
+
return null;
|
|
86
|
+
} else if (t instanceof p.ZodArray)
|
|
87
|
+
if (typeof s == "number")
|
|
88
|
+
if (t.element instanceof p.ZodType)
|
|
89
|
+
t = t.element;
|
|
66
90
|
else
|
|
67
91
|
return null;
|
|
68
|
-
else
|
|
92
|
+
else if (typeof s == "string") {
|
|
93
|
+
if (t.element instanceof p.ZodType)
|
|
94
|
+
t = t.element;
|
|
95
|
+
else
|
|
96
|
+
return null;
|
|
97
|
+
if (t instanceof p.ZodObject && s in t.shape) {
|
|
98
|
+
const u = t.shape[s];
|
|
99
|
+
if (u instanceof p.ZodType)
|
|
100
|
+
t = u;
|
|
101
|
+
else
|
|
102
|
+
return null;
|
|
103
|
+
} else
|
|
104
|
+
return null;
|
|
105
|
+
} else
|
|
106
|
+
return null;
|
|
107
|
+
else if (t instanceof p.ZodRecord) {
|
|
108
|
+
const u = t._zod.def.valueType;
|
|
109
|
+
if (!u || !(u instanceof p.ZodType))
|
|
69
110
|
return null;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
111
|
+
if (typeof s == "string")
|
|
112
|
+
t = u, t = h(t);
|
|
113
|
+
else if (typeof s == "number") {
|
|
114
|
+
if (t = u, t = h(t), t instanceof p.ZodArray)
|
|
115
|
+
if (t.element instanceof p.ZodType)
|
|
116
|
+
t = t.element;
|
|
117
|
+
else
|
|
118
|
+
return null;
|
|
119
|
+
} else
|
|
120
|
+
t = u;
|
|
121
|
+
} else
|
|
73
122
|
return null;
|
|
74
|
-
t =
|
|
123
|
+
t = h(t);
|
|
75
124
|
}
|
|
76
125
|
return t;
|
|
77
|
-
},
|
|
78
|
-
const t =
|
|
126
|
+
}, m = (e, n) => {
|
|
127
|
+
const t = H(e, n.path);
|
|
79
128
|
if (!t)
|
|
80
129
|
return null;
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
130
|
+
const s = n.path.join("."), u = n.path.slice(0, -1).join(".");
|
|
131
|
+
if (n.type === "REMOVE")
|
|
83
132
|
return {
|
|
84
|
-
path:
|
|
85
|
-
pathMinusOne:
|
|
133
|
+
path: s,
|
|
134
|
+
pathMinusOne: u,
|
|
86
135
|
value: void 0
|
|
87
136
|
};
|
|
88
|
-
const
|
|
89
|
-
return typeof
|
|
90
|
-
path:
|
|
91
|
-
pathMinusOne:
|
|
92
|
-
value:
|
|
137
|
+
const a = v(n.value, t, !1);
|
|
138
|
+
return typeof a > "u" || a === null ? null : {
|
|
139
|
+
path: s,
|
|
140
|
+
pathMinusOne: u,
|
|
141
|
+
value: a
|
|
93
142
|
};
|
|
94
|
-
},
|
|
95
|
-
if (!
|
|
143
|
+
}, F = (e, { activeCollection: n }, { collectionMutators: t }) => {
|
|
144
|
+
if (!n.value)
|
|
96
145
|
return !1;
|
|
97
146
|
if (typeof e.path[e.path.length - 1] == "number" && (e.type === "CREATE" || e.type === "REMOVE")) {
|
|
98
|
-
const
|
|
147
|
+
const s = m(A, {
|
|
99
148
|
...e,
|
|
100
149
|
path: e.path
|
|
101
150
|
});
|
|
102
|
-
if (!
|
|
151
|
+
if (!s)
|
|
103
152
|
return !1;
|
|
104
|
-
const
|
|
105
|
-
e.type === "CREATE" ?
|
|
153
|
+
const u = [...M(n.value, s.pathMinusOne)];
|
|
154
|
+
e.type === "CREATE" ? u.push(s.value) : e.type === "REMOVE" && u.pop(), t.edit(n.value.uid, s.pathMinusOne, u);
|
|
106
155
|
} else {
|
|
107
|
-
const
|
|
108
|
-
if (!
|
|
156
|
+
const s = m(A, e);
|
|
157
|
+
if (!s)
|
|
109
158
|
return !1;
|
|
110
|
-
t.edit(
|
|
159
|
+
t.edit(n.value.uid, s.path, s.value);
|
|
111
160
|
}
|
|
112
161
|
return !0;
|
|
113
|
-
},
|
|
114
|
-
const { requests: t, requestExamples:
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
...
|
|
119
|
-
uid:
|
|
162
|
+
}, _ = (e, n) => {
|
|
163
|
+
const { requests: t, requestExamples: s, requestExampleMutators: u } = n, a = t[e];
|
|
164
|
+
a?.examples.forEach((r) => {
|
|
165
|
+
const i = D(a, s[r]?.name ?? "Default");
|
|
166
|
+
i && u.set({
|
|
167
|
+
...i,
|
|
168
|
+
uid: r
|
|
120
169
|
});
|
|
121
170
|
});
|
|
122
|
-
},
|
|
123
|
-
if (!
|
|
171
|
+
}, K = (e, { activeCollection: n }, t) => {
|
|
172
|
+
if (!n.value)
|
|
124
173
|
return !1;
|
|
125
|
-
const { requests:
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
174
|
+
const { requests: s, requestMutators: u } = t, [, a, r, ...i] = e.path;
|
|
175
|
+
if (a === "path" && e.type === "CHANGE")
|
|
176
|
+
n.value.requests.forEach((o) => {
|
|
177
|
+
s[o]?.path === e.oldValue && u.edit(o, "path", e.value);
|
|
129
178
|
});
|
|
130
|
-
else if (
|
|
131
|
-
|
|
132
|
-
|
|
179
|
+
else if (r === "method" && e.type === "CHANGE")
|
|
180
|
+
n.value.requests.forEach((o) => {
|
|
181
|
+
s[o]?.method === e.oldValue && s[o]?.path === a && u.edit(o, "method", e.value);
|
|
133
182
|
});
|
|
134
|
-
else if (e.type !== "CHANGE" && typeof
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
(c) => c.path ===
|
|
139
|
-
),
|
|
183
|
+
else if (e.type !== "CHANGE" && typeof i.at(-1) == "number") {
|
|
184
|
+
const o = E(
|
|
185
|
+
n.value.requests,
|
|
186
|
+
s,
|
|
187
|
+
(c) => c.path === a && c.method === r
|
|
188
|
+
), l = m(O, {
|
|
140
189
|
...e,
|
|
141
190
|
path: e.path.slice(3)
|
|
142
191
|
});
|
|
143
|
-
if (!
|
|
192
|
+
if (!o || !l)
|
|
144
193
|
return !1;
|
|
145
|
-
const
|
|
146
|
-
e.type === "CREATE" ?
|
|
194
|
+
const f = [...M(o, l.pathMinusOne)];
|
|
195
|
+
e.type === "CREATE" ? f.push(l.value) : e.type === "REMOVE" && f.pop(), u.edit(o.uid, l.pathMinusOne, f), (e.path[3] === "parameters" || e.path[3] === "requestBody") && _(o.uid, t);
|
|
147
196
|
} else if (e.type === "CREATE") {
|
|
148
|
-
const [
|
|
149
|
-
...
|
|
150
|
-
method:
|
|
151
|
-
path:
|
|
197
|
+
const [o] = Object.entries(e.value ?? {}), [l, f] = o ?? [], c = r ? e.value : f, d = r || l, T = R.array().parse(c.servers ?? []), { security: g, ...z } = c, V = {
|
|
198
|
+
...z,
|
|
199
|
+
method: N(d) ? d : "get",
|
|
200
|
+
path: a,
|
|
152
201
|
parameters: c.parameters ?? [],
|
|
153
|
-
servers:
|
|
202
|
+
servers: T.map((y) => y.uid)
|
|
154
203
|
};
|
|
155
|
-
|
|
156
|
-
if (Object.keys(
|
|
157
|
-
const [
|
|
158
|
-
return
|
|
159
|
-
[
|
|
160
|
-
} :
|
|
204
|
+
g?.length && (V.security = g.map((y) => {
|
|
205
|
+
if (Object.keys(y).length) {
|
|
206
|
+
const [Z] = Object.keys(y);
|
|
207
|
+
return Z ? {
|
|
208
|
+
[Z]: y[Z]
|
|
209
|
+
} : y;
|
|
161
210
|
}
|
|
162
|
-
return
|
|
211
|
+
return y;
|
|
163
212
|
}));
|
|
164
|
-
const
|
|
165
|
-
if (!
|
|
213
|
+
const q = v(V, O, !1);
|
|
214
|
+
if (!q)
|
|
166
215
|
return !1;
|
|
167
|
-
|
|
216
|
+
u.add(q, n.value.uid);
|
|
168
217
|
} else if (e.type === "REMOVE") {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
(
|
|
218
|
+
const o = E(
|
|
219
|
+
n.value.requests,
|
|
220
|
+
s,
|
|
221
|
+
(l) => l.path === a && l.method === r
|
|
173
222
|
);
|
|
174
|
-
if (!
|
|
223
|
+
if (!o)
|
|
175
224
|
return !1;
|
|
176
|
-
|
|
225
|
+
u.delete(o, n.value.uid);
|
|
177
226
|
} else if (e.type === "CHANGE") {
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
(
|
|
182
|
-
),
|
|
183
|
-
if (!
|
|
227
|
+
const o = E(
|
|
228
|
+
n.value.requests,
|
|
229
|
+
s,
|
|
230
|
+
(f) => f.path === a && f.method === r
|
|
231
|
+
), l = m(O, { ...e, path: i });
|
|
232
|
+
if (!o || !l)
|
|
184
233
|
return !1;
|
|
185
|
-
|
|
234
|
+
u.edit(o.uid, l.path, l.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && _(o.uid, t);
|
|
186
235
|
}
|
|
187
236
|
return !0;
|
|
188
|
-
}, W = (e, { activeCollection:
|
|
189
|
-
if (!
|
|
237
|
+
}, W = (e, { activeCollection: n }, { servers: t, serverMutators: s }) => {
|
|
238
|
+
if (!n.value)
|
|
190
239
|
return !1;
|
|
191
|
-
const [,
|
|
192
|
-
if (
|
|
193
|
-
const
|
|
194
|
-
if (!
|
|
240
|
+
const [, u, ...a] = e.path;
|
|
241
|
+
if (a?.length) {
|
|
242
|
+
const r = n.value.servers[u];
|
|
243
|
+
if (!r)
|
|
195
244
|
return !1;
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
245
|
+
const i = t[r], o = m(R, { ...e, path: a });
|
|
246
|
+
if (!i || !o)
|
|
198
247
|
return !1;
|
|
199
|
-
const
|
|
200
|
-
|
|
248
|
+
const f = e.type === "REMOVE" && a[a.length - 1] === "variables" ? {} : o.value;
|
|
249
|
+
s.edit(r, o.path, f);
|
|
201
250
|
} else if (e.type === "REMOVE") {
|
|
202
|
-
if (!
|
|
251
|
+
if (!n.value.servers[u])
|
|
203
252
|
return !1;
|
|
204
|
-
|
|
253
|
+
s.delete(n.value.servers[u], n.value.uid);
|
|
205
254
|
} else if (e.type === "CREATE") {
|
|
206
|
-
const
|
|
207
|
-
if (!
|
|
255
|
+
const r = v(e.value, R, !1);
|
|
256
|
+
if (!r)
|
|
208
257
|
return !1;
|
|
209
|
-
|
|
258
|
+
s.add(r, n.value.uid);
|
|
210
259
|
}
|
|
211
260
|
return !0;
|
|
212
|
-
}, I = (e, { activeCollection:
|
|
213
|
-
if (!
|
|
261
|
+
}, I = (e, { activeCollection: n }, { tags: t, tagMutators: s }) => {
|
|
262
|
+
if (!n.value)
|
|
214
263
|
return !1;
|
|
215
|
-
const [,
|
|
216
|
-
if (
|
|
217
|
-
const
|
|
218
|
-
if (!
|
|
264
|
+
const [, u, ...a] = e.path;
|
|
265
|
+
if (a?.length) {
|
|
266
|
+
const r = n.value.tags[u];
|
|
267
|
+
if (!r)
|
|
219
268
|
return !1;
|
|
220
|
-
const
|
|
221
|
-
if (!
|
|
269
|
+
const i = t[r], o = m(b, { ...e, path: a });
|
|
270
|
+
if (!i || !o)
|
|
222
271
|
return !1;
|
|
223
|
-
|
|
272
|
+
s.edit(r, o.path, o.value);
|
|
224
273
|
} else if (e.type === "REMOVE") {
|
|
225
|
-
const
|
|
226
|
-
if (!
|
|
274
|
+
const r = n.value.tags[u];
|
|
275
|
+
if (!r)
|
|
227
276
|
return !1;
|
|
228
|
-
const
|
|
229
|
-
if (!
|
|
277
|
+
const i = t[r];
|
|
278
|
+
if (!i)
|
|
230
279
|
return !1;
|
|
231
|
-
|
|
280
|
+
s.delete(i, n.value.uid);
|
|
232
281
|
} else if (e.type === "CREATE") {
|
|
233
|
-
const
|
|
234
|
-
if (!
|
|
282
|
+
const r = v(e.value, b, !1);
|
|
283
|
+
if (!r)
|
|
235
284
|
return !1;
|
|
236
|
-
|
|
285
|
+
s.add(r, n.value.uid);
|
|
237
286
|
}
|
|
238
287
|
return !0;
|
|
239
|
-
},
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
for (const
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
|
|
288
|
+
}, j = (e, n, t) => {
|
|
289
|
+
const s = h(e);
|
|
290
|
+
if (s instanceof p.ZodUnion || s instanceof p.ZodDiscriminatedUnion)
|
|
291
|
+
for (const u of s.options) {
|
|
292
|
+
if (!(u instanceof p.ZodType))
|
|
293
|
+
continue;
|
|
294
|
+
const a = h(u);
|
|
295
|
+
if (a instanceof p.ZodObject && n in a.shape) {
|
|
296
|
+
const r = h(a.shape[n]);
|
|
297
|
+
if (r instanceof p.ZodLiteral && r.value === t || r instanceof p.ZodDefault && r._zod.def.innerType instanceof p.ZodLiteral && r._zod.def.innerType.value === t || r instanceof p.ZodOptional && r._zod.def.innerType instanceof p.ZodLiteral && r._zod.def.innerType.value === t || r instanceof p.ZodDefault && r._zod.def.innerType instanceof p.ZodOptional && r._zod.def.innerType._zod.def.innerType instanceof p.ZodLiteral && r._zod.def.innerType._zod.def.innerType.value === t)
|
|
298
|
+
return a;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
246
301
|
return null;
|
|
247
|
-
}, J = (e, { activeCollection:
|
|
248
|
-
if (!
|
|
302
|
+
}, J = (e, { activeCollection: n }, { securitySchemes: t, securitySchemeMutators: s }) => {
|
|
303
|
+
if (!n.value)
|
|
249
304
|
return !1;
|
|
250
|
-
const [, ,
|
|
251
|
-
|
|
305
|
+
const [, , u, ...a] = e.path, r = t[u] ?? E(
|
|
306
|
+
n.value.securitySchemes,
|
|
252
307
|
t,
|
|
253
|
-
(
|
|
308
|
+
(i) => i.nameKey === u
|
|
254
309
|
);
|
|
255
|
-
if (
|
|
256
|
-
const
|
|
257
|
-
if (!
|
|
310
|
+
if (a?.length) {
|
|
311
|
+
const i = j(S, "type", r?.type ?? "");
|
|
312
|
+
if (!i || !r)
|
|
258
313
|
return !1;
|
|
259
|
-
const
|
|
260
|
-
if (!
|
|
314
|
+
const o = m(i, { ...e, path: a });
|
|
315
|
+
if (!o)
|
|
261
316
|
return !1;
|
|
262
|
-
const
|
|
263
|
-
|
|
317
|
+
const l = o.path;
|
|
318
|
+
s.edit(r.uid, l, o.value);
|
|
264
319
|
} else if (e.type === "REMOVE") {
|
|
265
|
-
if (!
|
|
320
|
+
if (!r)
|
|
266
321
|
return !1;
|
|
267
|
-
|
|
268
|
-
} else e.type === "CREATE" &&
|
|
322
|
+
s.delete(r.uid);
|
|
323
|
+
} else e.type === "CREATE" && s.add(S.parse(e.value), n.value.uid);
|
|
269
324
|
return !0;
|
|
270
325
|
};
|
|
271
326
|
export {
|
|
272
|
-
|
|
327
|
+
x as combineRenameDiffs,
|
|
273
328
|
E as findResource,
|
|
274
|
-
|
|
275
|
-
|
|
329
|
+
F as mutateCollectionDiff,
|
|
330
|
+
K as mutateRequestDiff,
|
|
276
331
|
J as mutateSecuritySchemeDiff,
|
|
277
332
|
W as mutateServerDiff,
|
|
278
333
|
I as mutateTagDiff,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
334
|
+
j as narrowUnionSchema,
|
|
335
|
+
m as parseDiff,
|
|
336
|
+
H as traverseZodSchema
|
|
282
337
|
};
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"rest",
|
|
19
19
|
"testing"
|
|
20
20
|
],
|
|
21
|
-
"version": "2.
|
|
21
|
+
"version": "2.7.0",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=20"
|
|
24
24
|
},
|
|
@@ -179,6 +179,11 @@
|
|
|
179
179
|
"import": "./dist/views/Request/types/index.js",
|
|
180
180
|
"types": "./dist/views/Request/types/index.d.ts",
|
|
181
181
|
"default": "./dist/views/Request/types/index.js"
|
|
182
|
+
},
|
|
183
|
+
"./v2/blocks/operation-code-sample": {
|
|
184
|
+
"import": "./dist/v2/blocks/operation-code-sample/index.js",
|
|
185
|
+
"types": "./dist/v2/blocks/operation-code-sample/index.d.ts",
|
|
186
|
+
"default": "./dist/v2/blocks/operation-code-sample/index.js"
|
|
182
187
|
}
|
|
183
188
|
},
|
|
184
189
|
"files": [
|
|
@@ -205,26 +210,26 @@
|
|
|
205
210
|
"vue-router": "^4.3.0",
|
|
206
211
|
"whatwg-mimetype": "^4.0.0",
|
|
207
212
|
"yaml": "2.8.0",
|
|
208
|
-
"zod": "
|
|
213
|
+
"zod": "4.1.11",
|
|
209
214
|
"@scalar/analytics-client": "1.0.0",
|
|
210
|
-
"@scalar/components": "0.14.
|
|
211
|
-
"@scalar/draggable": "0.2.0",
|
|
212
|
-
"@scalar/helpers": "0.0.11",
|
|
215
|
+
"@scalar/components": "0.14.40",
|
|
213
216
|
"@scalar/icons": "0.4.7",
|
|
214
|
-
"@scalar/
|
|
215
|
-
"@scalar/
|
|
216
|
-
"@scalar/
|
|
217
|
-
"@scalar/
|
|
217
|
+
"@scalar/helpers": "0.0.11",
|
|
218
|
+
"@scalar/draggable": "0.2.0",
|
|
219
|
+
"@scalar/import": "0.4.29",
|
|
220
|
+
"@scalar/oas-utils": "0.5.0",
|
|
218
221
|
"@scalar/object-utils": "1.2.7",
|
|
219
|
-
"@scalar/
|
|
220
|
-
"@scalar/
|
|
221
|
-
"@scalar/
|
|
222
|
-
"@scalar/themes": "0.13.
|
|
223
|
-
"@scalar/
|
|
224
|
-
"@scalar/use-codemirror": "0.12.
|
|
222
|
+
"@scalar/json-magic": "0.6.0",
|
|
223
|
+
"@scalar/openapi-parser": "0.22.1",
|
|
224
|
+
"@scalar/postman-to-openapi": "0.3.38",
|
|
225
|
+
"@scalar/themes": "0.13.20",
|
|
226
|
+
"@scalar/snippetz": "0.4.11",
|
|
227
|
+
"@scalar/use-codemirror": "0.12.41",
|
|
228
|
+
"@scalar/openapi-types": "0.4.0",
|
|
225
229
|
"@scalar/use-hooks": "0.2.5",
|
|
230
|
+
"@scalar/types": "0.3.0",
|
|
226
231
|
"@scalar/use-toasts": "0.8.0",
|
|
227
|
-
"@scalar/workspace-store": "0.16.
|
|
232
|
+
"@scalar/workspace-store": "0.16.2"
|
|
228
233
|
},
|
|
229
234
|
"devDependencies": {
|
|
230
235
|
"@tailwindcss/vite": "^4.1.7",
|
|
@@ -237,8 +242,8 @@
|
|
|
237
242
|
"vite": "7.1.5",
|
|
238
243
|
"vite-svg-loader": "^5.1.0",
|
|
239
244
|
"vitest": "3.2.4",
|
|
240
|
-
"@scalar/
|
|
241
|
-
"@scalar/
|
|
245
|
+
"@scalar/galaxy": "0.5.8",
|
|
246
|
+
"@scalar/build-tooling": "0.2.7"
|
|
242
247
|
},
|
|
243
248
|
"scripts": {
|
|
244
249
|
"build": "scalar-build-vite",
|
|
@@ -251,8 +256,8 @@
|
|
|
251
256
|
"preview": "vite preview",
|
|
252
257
|
"test": "vitest",
|
|
253
258
|
"test:benchmark": "vitest bench",
|
|
254
|
-
"test:benchmark:compare": "vitest bench --compare test
|
|
255
|
-
"test:benchmark:save": "vitest bench --outputJson test
|
|
259
|
+
"test:benchmark:compare": "vitest bench --compare test-results/test-benchmark.json",
|
|
260
|
+
"test:benchmark:save": "vitest bench --outputJson test-results/test-benchmark.json",
|
|
256
261
|
"types:build": "scalar-types-build-vue",
|
|
257
262
|
"types:check": "scalar-types-check-vue"
|
|
258
263
|
}
|