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