@scalar/api-client 2.0.8 → 2.0.11

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 (30) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/App.vue.d.ts.map +1 -1
  3. package/dist/Modal/ApiClientModal.vue.d.ts.map +1 -1
  4. package/dist/Modal/ApiClientModal.vue.js +2 -2
  5. package/dist/Modal/ApiClientModal.vue2.js +19 -16
  6. package/dist/components/DataTable/DataTableInput.vue.d.ts +5 -0
  7. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  8. package/dist/components/DataTable/DataTableInput.vue.js +3 -3
  9. package/dist/components/DataTable/DataTableInput.vue2.js +46 -36
  10. package/dist/components/Search/SearchModal.vue.d.ts.map +1 -1
  11. package/dist/components/Search/SearchModal.vue.js +3 -3
  12. package/dist/components/Search/SearchModal.vue2.js +65 -54
  13. package/dist/store/workspace.d.ts +92 -2
  14. package/dist/store/workspace.d.ts.map +1 -1
  15. package/dist/store/workspace.js +67 -65
  16. package/dist/style.css +1 -1
  17. package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
  18. package/dist/views/Cookies/Cookies.vue2.js +31 -30
  19. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  20. package/dist/views/Request/Request.vue.js +2 -2
  21. package/dist/views/Request/Request.vue2.js +89 -88
  22. package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
  23. package/dist/views/Request/RequestSection/RequestTable.vue.js +3 -2
  24. package/dist/views/Request/RequestSection/RequestTable.vue2.js +79 -59
  25. package/dist/views/Request/RequestSection/RequestTableTooltip.vue.d.ts.map +1 -1
  26. package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +31 -19
  27. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  28. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  29. package/dist/views/Request/RequestSidebarItem.vue2.js +23 -23
  30. package/package.json +7 -7
@@ -10,32 +10,32 @@ import { createRequest as Q, createRequestExample as X, createRequestExamplePara
10
10
  import { iterateTitle as Z, fetchSpecFromUrl as _ } from "@scalar/oas-utils/helpers";
11
11
  import { getRequestBodyFromOperation as $ } from "@scalar/oas-utils/spec-getters";
12
12
  import { importSpecToWorkspace as ee } from "@scalar/oas-utils/transforms";
13
- import { mutationFactory as n } from "@scalar/object-utils/mutator-record";
13
+ import { mutationFactory as u } from "@scalar/object-utils/mutator-record";
14
14
  import { setNestedValue as te } from "@scalar/object-utils/nested";
15
- import { reactive as i, computed as d, readonly as se, toRaw as oe } from "vue";
15
+ import { reactive as i, computed as a, readonly as se, toRaw as oe } from "vue";
16
16
  import { useSidebar as ce } from "../hooks/useSidebar.js";
17
- const { setCollapsedSidebarFolder: ie } = ce(), u = i({}), S = n(u, i({})), U = (e, t) => {
17
+ const { setCollapsedSidebarFolder: ie } = ce(), f = i({}), S = u(f, i({})), U = (e, t) => {
18
18
  const s = Q(e), c = R(s);
19
- return s.childUids.push(c.uid), S.add(s), t && (r[t] ? a.edit(t, "childUids", [
19
+ return s.childUids.push(c.uid), S.add(s), t && (r[t] ? n.edit(t, "childUids", [
20
20
  ...r[t].childUids,
21
21
  s.uid
22
- ]) : l[t] && m.edit(t, "childUids", [
22
+ ]) : l[t] && h.edit(t, "childUids", [
23
23
  ...l[t].childUids,
24
24
  s.uid
25
25
  ])), s;
26
26
  }, re = (e, t) => {
27
- e.childUids.forEach((s) => k.delete(s)), r[t] ? a.edit(
27
+ e.childUids.forEach((s) => k.delete(s)), r[t] ? n.edit(
28
28
  t,
29
29
  "childUids",
30
30
  r[t].childUids.filter((s) => s !== e.uid)
31
- ) : l[t] && m.edit(
31
+ ) : l[t] && h.edit(
32
32
  t,
33
33
  "childUids",
34
34
  l[t].childUids.filter((s) => s !== e.uid)
35
35
  ), S.delete(e.uid);
36
- }, h = d(() => {
36
+ }, p = a(() => {
37
37
  var c;
38
- const e = E.value[b.Request], t = (c = D.value[0]) == null ? void 0 : c.uid, s = u[e] ?? u[t];
38
+ const e = E.value[b.Request], t = (c = D.value[0]) == null ? void 0 : c.uid, s = f[e] ?? f[t];
39
39
  return V(b.Request, s), s && M(s.uid).forEach(
40
40
  (o) => ie(o, !0)
41
41
  ), s;
@@ -48,8 +48,8 @@ const { setCollapsedSidebarFolder: ie } = ce(), u = i({}), S = n(u, i({})), U =
48
48
  ({ childUids: o }) => o.includes(e)
49
49
  );
50
50
  return c ? M(c.uid, [...t, c.uid]) : t;
51
- }, p = i({}), k = n(p, i({})), x = (e) => {
52
- var t, s, c, o;
51
+ }, v = i({}), k = u(v, i({})), w = (e) => {
52
+ var t, s, c, o, m, d;
53
53
  return Y({
54
54
  key: e.name,
55
55
  value: e.schema && "default" in e.schema ? e.schema.default : e.schema && "examples" in e.schema && e.schema.examples.length > 0 ? e.schema.examples[0] : "",
@@ -58,15 +58,17 @@ const { setCollapsedSidebarFolder: ie } = ce(), u = i({}), S = n(u, i({})), U =
58
58
  enum: (t = e.schema) == null ? void 0 : t.enum,
59
59
  type: (s = e.schema) == null ? void 0 : s.type,
60
60
  format: (c = e.schema) == null ? void 0 : c.format,
61
- default: (o = e.schema) == null ? void 0 : o.default
61
+ minimum: (o = e.schema) == null ? void 0 : o.minimum,
62
+ maximum: (m = e.schema) == null ? void 0 : m.maximum,
63
+ default: (d = e.schema) == null ? void 0 : d.default
62
64
  });
63
65
  }, R = (e) => {
64
- var w;
66
+ var m;
65
67
  const t = {
66
- path: Object.values(e.parameters.path).map(x),
67
- query: Object.values(e.parameters.query).map(x),
68
- headers: Object.values(e.parameters.headers).map(x),
69
- cookies: Object.values(e.parameters.cookies).map(x)
68
+ path: Object.values(e.parameters.path).map(w),
69
+ query: Object.values(e.parameters.query).map(w),
70
+ headers: Object.values(e.parameters.headers).map(w),
71
+ cookies: Object.values(e.parameters.cookies).map(w)
70
72
  }, s = {
71
73
  activeBody: "raw",
72
74
  raw: {
@@ -75,22 +77,22 @@ const { setCollapsedSidebarFolder: ie } = ce(), u = i({}), S = n(u, i({})), U =
75
77
  }
76
78
  };
77
79
  if (e.requestBody) {
78
- const f = $({
80
+ const d = $({
79
81
  httpVerb: e.method,
80
82
  path: e.path,
81
83
  information: {
82
84
  requestBody: e.requestBody
83
85
  }
84
86
  });
85
- ((w = f == null ? void 0 : f.postData) == null ? void 0 : w.mimeType) === "application/json" && (t.headers.push({
87
+ ((m = d == null ? void 0 : d.postData) == null ? void 0 : m.mimeType) === "application/json" && (t.headers.push({
86
88
  key: "Content-Type",
87
89
  value: "application/json",
88
90
  enabled: !0
89
- }), s.activeBody = "raw", s.raw.value = f.postData.text);
91
+ }), s.activeBody = "raw", s.raw.value = d.postData.text);
90
92
  }
91
93
  const c = Z(
92
94
  (e.summary ?? "Example") + " #1",
93
- (f) => e.childUids.some((T) => f === p[T].name)
95
+ (d) => e.childUids.some((T) => d === v[T].name)
94
96
  ), o = X({
95
97
  requestUid: e.uid,
96
98
  parameters: t,
@@ -108,16 +110,16 @@ const { setCollapsedSidebarFolder: ie } = ce(), u = i({}), S = n(u, i({})), U =
108
110
  S.edit(
109
111
  e.requestUid,
110
112
  "childUids",
111
- u[e.requestUid].childUids.filter(
113
+ f[e.requestUid].childUids.filter(
112
114
  (t) => t !== e.uid
113
115
  )
114
116
  ), k.delete(e.uid);
115
- }, ae = d(
117
+ }, ae = a(
116
118
  () => {
117
119
  var e;
118
- return p[E.value[b.Example]] ?? p[((e = h.value) == null ? void 0 : e.childUids[0]) ?? ""];
120
+ return v[E.value[b.Example]] ?? v[((e = p.value) == null ? void 0 : e.childUids[0]) ?? ""];
119
121
  }
120
- ), ne = d(() => Object.values(u).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)), O = i({
122
+ ), ne = a(() => Object.values(f).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)), O = i({
121
123
  default: J({
122
124
  uid: "default",
123
125
  name: "Global Environment",
@@ -126,45 +128,45 @@ const { setCollapsedSidebarFolder: ie } = ce(), u = i({}), S = n(u, i({})), U =
126
128
  parsed: [],
127
129
  isDefault: !0
128
130
  })
129
- }), C = n(O, i({})), ue = (e) => {
131
+ }), C = u(O, i({})), ue = (e) => {
130
132
  if (e === "default") {
131
133
  console.warn("Default environment cannot be deleted.");
132
134
  return;
133
135
  }
134
136
  C.delete(e);
135
- }, g = i({}), me = n(g, i({})), fe = d(
137
+ }, g = i({}), me = u(g, i({})), fe = a(
136
138
  () => E.value[b.Cookies]
137
- ), v = i(G({})), D = d(
138
- () => Object.values(u).map((e) => ({
139
+ ), y = i(G({})), D = a(
140
+ () => Object.values(f).map((e) => ({
139
141
  uid: e.uid,
140
142
  path: e.path,
141
143
  method: e.method,
142
144
  summary: e.summary
143
145
  }))
144
- ), he = (e, t) => te(v, e, t), r = i({}), a = n(r, i({})), B = (e) => {
146
+ ), he = (e, t) => te(y, e, t), r = i({}), n = u(r, i({})), B = (e) => {
145
147
  const t = H(e);
146
- v.collectionUids.push(t.uid), a.add(t);
148
+ y.collectionUids.push(t.uid), n.add(t);
147
149
  }, pe = (e) => {
148
- const t = v.collectionUids.findIndex((s) => s === e);
149
- t >= 0 ? (v.collectionUids.splice(t, 1), a.delete(e)) : console.error("Tried to remove a collection that does not exist");
150
- }, y = d(() => {
151
- if (!h.value) return null;
152
- const e = M(h.value.uid);
150
+ const t = y.collectionUids.findIndex((s) => s === e);
151
+ t >= 0 ? (y.collectionUids.splice(t, 1), n.delete(e)) : console.error("Tried to remove a collection that does not exist");
152
+ }, x = a(() => {
153
+ if (!p.value) return null;
154
+ const e = M(p.value.uid);
153
155
  if (!e.length) return null;
154
156
  const t = e[e.length - 1];
155
157
  return r[t];
156
- }), ve = d(
157
- () => y.value && j[y.value.selectedServerUid]
158
- ), l = i({}), m = n(l, i({})), I = (e, t) => {
158
+ }), ve = a(
159
+ () => x.value && j[x.value.selectedServerUid]
160
+ ), l = i({}), h = u(l, i({})), I = (e, t) => {
159
161
  const s = L(e);
160
162
  if (t)
161
163
  if (r[t])
162
- a.edit(t, "childUids", [
164
+ n.edit(t, "childUids", [
163
165
  ...r[t].childUids,
164
166
  s.uid
165
167
  ]);
166
168
  else if (l[t])
167
- m.edit(t, "childUids", [
169
+ h.edit(t, "childUids", [
168
170
  ...l[t].childUids,
169
171
  s.uid
170
172
  ]);
@@ -172,38 +174,38 @@ const { setCollapsedSidebarFolder: ie } = ce(), u = i({}), S = n(u, i({})), U =
172
174
  console.error("Could not find folder's parent ID");
173
175
  return;
174
176
  }
175
- m.add(s);
177
+ h.add(s);
176
178
  }, ye = (e, t) => {
177
- r[t] ? a.edit(
179
+ r[t] ? n.edit(
178
180
  t,
179
181
  "childUids",
180
182
  r[t].childUids.filter((s) => s !== e)
181
- ) : l[t] && m.edit(
183
+ ) : l[t] && h.edit(
182
184
  t,
183
185
  "childUids",
184
186
  l[t].childUids.filter((s) => s !== e)
185
- ), m.delete(e);
186
- }, q = i({}), P = n(q, i({})), Se = d(
187
+ ), h.delete(e);
188
+ }, q = i({}), P = u(q, i({})), xe = a(
187
189
  () => {
188
190
  var e;
189
- return (e = y.value) == null ? void 0 : e.selectedSecuritySchemes.map((t) => {
191
+ return (e = x.value) == null ? void 0 : e.selectedSecuritySchemes.map((t) => {
190
192
  const s = q[t.uid], c = t.flowKey && "flows" in s && s.flows ? { flow: s.flows[t.flowKey] } : {};
191
193
  return { scheme: s, ...c };
192
194
  })[0];
193
195
  }
194
- ), we = d(
196
+ ), Se = a(
195
197
  () => {
196
198
  var e, t;
197
- return ((e = h.value) == null ? void 0 : e.security) ?? ((t = y.value) == null ? void 0 : t.spec.security) ?? [];
199
+ return ((e = p.value) == null ? void 0 : e.security) ?? ((t = x.value) == null ? void 0 : t.spec.security) ?? [];
198
200
  }
199
- ), j = i({}), F = n(j, i({})), K = (e, t) => {
201
+ ), j = i({}), F = u(j, i({})), K = (e, t) => {
200
202
  const s = A(e);
201
- t && a.edit(t, "spec.serverUids", [
203
+ t && n.edit(t, "spec.serverUids", [
202
204
  ...r[t].spec.serverUids,
203
205
  s.uid
204
206
  ]), F.add(s);
205
- }, xe = (e, t) => {
206
- a.edit(
207
+ }, we = (e, t) => {
208
+ n.edit(
207
209
  t,
208
210
  "spec.serverUids",
209
211
  r[t].spec.serverUids.filter(
@@ -217,8 +219,8 @@ async function W(e) {
217
219
  s.requests.forEach((o) => U(o)), B(s.collection), s.folders.forEach((o) => I(o)), s.servers.forEach((o) => K(o)), Object.entries(
218
220
  (((c = s.components) == null ? void 0 : c.securitySchemes) || s.securityDefinitions) ?? {}
219
221
  ).forEach(
220
- ([o, w]) => P.add(
221
- z({ ...w, uid: o })
222
+ ([o, m]) => P.add(
223
+ z({ ...m, uid: o })
222
224
  )
223
225
  );
224
226
  }
@@ -233,22 +235,22 @@ async function be(e, t) {
233
235
  const ke = N(), Te = () => ({
234
236
  // ---------------------------------------------------------------------------
235
237
  // STATE
236
- workspace: se(v),
238
+ workspace: se(y),
237
239
  workspaceRequests: D,
238
240
  collections: r,
239
- requests: u,
241
+ requests: f,
240
242
  environments: O,
241
- requestExamples: p,
243
+ requestExamples: v,
242
244
  folders: l,
243
245
  cookies: g,
244
246
  servers: j,
245
247
  securitySchemes: q,
246
248
  activeCookieId: fe,
247
- activeCollection: y,
249
+ activeCollection: x,
248
250
  activeServer: ve,
249
- activeSecurityRequirements: we,
250
- activeSecurityScheme: Se,
251
- activeRequest: h,
251
+ activeSecurityRequirements: Se,
252
+ activeSecurityScheme: xe,
253
+ activeRequest: p,
252
254
  activeExample: ae,
253
255
  modalState: ke,
254
256
  // ---------------------------------------------------------------------------
@@ -258,7 +260,7 @@ const ke = N(), Te = () => ({
258
260
  cookieMutators: me,
259
261
  createExampleFromRequest: R,
260
262
  collectionMutators: {
261
- ...a,
263
+ ...n,
262
264
  add: B,
263
265
  delete: pe
264
266
  },
@@ -267,7 +269,7 @@ const ke = N(), Te = () => ({
267
269
  delete: ue
268
270
  },
269
271
  folderMutators: {
270
- ...m,
272
+ ...h,
271
273
  add: I,
272
274
  delete: ye
273
275
  },
@@ -286,7 +288,7 @@ const ke = N(), Te = () => ({
286
288
  serverMutators: {
287
289
  ...F,
288
290
  add: K,
289
- delete: xe
291
+ delete: we
290
292
  },
291
293
  workspaceMutators: {
292
294
  edit: he