@scalar/api-client 2.0.43 → 2.0.44

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.
@@ -1,61 +1,61 @@
1
- import { PathId as u, fallbackMissingParams as we } from "../router.js";
2
- import { useModal as Oe } from "@scalar/components";
3
- import { createWorkspace as Ue } from "@scalar/oas-utils/entities/workspace";
4
- import { createCollection as ke } from "@scalar/oas-utils/entities/workspace/collection";
5
- import { createCookie as xe } from "@scalar/oas-utils/entities/workspace/cookie";
6
- import { createEnvironment as je } from "@scalar/oas-utils/entities/workspace/environment";
7
- import { createFolder as Ce } from "@scalar/oas-utils/entities/workspace/folder";
8
- import { createSecurityScheme as Fe, securitySchemeApiKeyIn as Ke } from "@scalar/oas-utils/entities/workspace/security";
9
- import { createServer as Ie } from "@scalar/oas-utils/entities/workspace/server";
10
- import { createRequest as We, createRequestExample as ge, createRequestExampleParameter as Ae } from "@scalar/oas-utils/entities/workspace/spec";
11
- import { iterateTitle as Pe, fetchSpecFromUrl as Ne } from "@scalar/oas-utils/helpers";
12
- import { getRequestBodyFromOperation as Te } from "@scalar/oas-utils/spec-getters";
13
- import { importSpecToWorkspace as qe } from "@scalar/oas-utils/transforms";
14
- import { mutationFactory as S, LS_KEYS as E } from "@scalar/object-utils/mutator-record";
15
- import { computed as n, reactive as l, inject as _e, toRaw as De } from "vue";
16
- const ct = ($, y = !0) => {
17
- const C = n(() => {
1
+ import { PathId as f, fallbackMissingParams as Oe } from "../router.js";
2
+ import { useModal as Ue } from "@scalar/components";
3
+ import { createWorkspace as ke } from "@scalar/oas-utils/entities/workspace";
4
+ import { createCollection as xe } from "@scalar/oas-utils/entities/workspace/collection";
5
+ import { createCookie as je } from "@scalar/oas-utils/entities/workspace/cookie";
6
+ import { createEnvironment as Ce } from "@scalar/oas-utils/entities/workspace/environment";
7
+ import { createFolder as Fe } from "@scalar/oas-utils/entities/workspace/folder";
8
+ import { createSecurityScheme as Ke, securitySchemeApiKeyIn as Ie } from "@scalar/oas-utils/entities/workspace/security";
9
+ import { createServer as We } from "@scalar/oas-utils/entities/workspace/server";
10
+ import { createRequest as ge, createRequestExample as Ae, createRequestExampleParameter as Pe } from "@scalar/oas-utils/entities/workspace/spec";
11
+ import { iterateTitle as Ne, fetchSpecFromUrl as Te } from "@scalar/oas-utils/helpers";
12
+ import { getRequestBodyFromOperation as qe } from "@scalar/oas-utils/spec-getters";
13
+ import { importSpecToWorkspace as _e } from "@scalar/oas-utils/transforms";
14
+ import { mutationFactory as E, LS_KEYS as b } from "@scalar/object-utils/mutator-record";
15
+ import { computed as u, reactive as l, inject as De, toRaw as Le } from "vue";
16
+ const it = (H, y = !0) => {
17
+ const F = u(() => {
18
18
  const e = {
19
- [u.Collection]: "default",
20
- [u.Environment]: "default",
21
- [u.Request]: "default",
22
- [u.Examples]: "default",
23
- [u.Schema]: "default",
24
- [u.Cookies]: "default",
25
- [u.Servers]: "default",
26
- [u.Workspace]: "default"
27
- }, t = $.currentRoute.value;
28
- return t && Object.values(u).forEach((s) => {
19
+ [f.Collection]: "default",
20
+ [f.Environment]: "default",
21
+ [f.Request]: "default",
22
+ [f.Examples]: "default",
23
+ [f.Schema]: "default",
24
+ [f.Cookies]: "default",
25
+ [f.Servers]: "default",
26
+ [f.Workspace]: "default"
27
+ }, t = H.currentRoute.value;
28
+ return t && Object.values(f).forEach((s) => {
29
29
  t.params[s] && (e[s] = t.params[s]);
30
30
  }), e;
31
- }), f = l({}), m = S(
32
- f,
31
+ }), m = l({}), h = E(
32
+ m,
33
33
  l({}),
34
- y && E.REQUEST
35
- ), T = (e, t, s) => {
36
- const i = We(e), c = H(i, s);
37
- return i.childUids.push(c.uid), m.add(i), t && (d[t] ? h.edit(t, "childUids", [
34
+ y && b.REQUEST
35
+ ), q = (e, t, s) => {
36
+ const i = ge(e), c = Q(i, s);
37
+ return i.childUids.push(c.uid), h.add(i), t && (d[t] ? p.edit(t, "childUids", [
38
38
  ...d[t].childUids,
39
39
  i.uid
40
- ]) : r[t] && b.edit(t, "childUids", [
40
+ ]) : r[t] && R.edit(t, "childUids", [
41
41
  ...r[t].childUids,
42
42
  i.uid
43
43
  ])), i;
44
- }, q = (e, t) => {
45
- e.childUids.forEach((s) => K.delete(s)), t && d[t] ? h.edit(
44
+ }, _ = (e, t) => {
45
+ e.childUids.forEach((s) => I.delete(s)), t && d[t] ? p.edit(
46
46
  t,
47
47
  "childUids",
48
48
  d[t].childUids.filter((s) => s !== e.uid)
49
- ) : t && r[t] && b.edit(
49
+ ) : t && r[t] && R.edit(
50
50
  t,
51
51
  "childUids",
52
52
  r[t].childUids.filter((s) => s !== e.uid)
53
- ), m.delete(e.uid);
54
- }, w = n(() => {
53
+ ), h.delete(e.uid);
54
+ }, O = u(() => {
55
55
  var i, c;
56
- const e = C.value[u.Request], t = (c = (i = z.value) == null ? void 0 : i[0]) == null ? void 0 : c.uid, s = f[e] ?? f[t];
57
- return we(u.Request, s), s;
58
- }), _ = (e, t = []) => {
56
+ const e = F.value[f.Request], t = (c = (i = Z.value) == null ? void 0 : i[0]) == null ? void 0 : c.uid, s = m[e] ?? m[t];
57
+ return Oe(f.Request, s), s;
58
+ }), D = (e, t = []) => {
59
59
  const s = Object.values(d).find(
60
60
  (c) => c.childUids.includes(e)
61
61
  );
@@ -63,14 +63,14 @@ const ct = ($, y = !0) => {
63
63
  const i = Object.values(r).find(
64
64
  ({ childUids: c }) => c.includes(e)
65
65
  );
66
- return i ? _(i.uid, [...t, i.uid]) : t;
67
- }, F = l({}), K = S(
68
- F,
66
+ return i ? D(i.uid, [...t, i.uid]) : t;
67
+ }, K = l({}), I = E(
68
+ K,
69
69
  l({}),
70
- y && E.REQUEST_EXAMPLE
71
- ), W = (e) => {
72
- var t, s, i, c, v, p, R;
73
- return Ae({
70
+ y && b.REQUEST_EXAMPLE
71
+ ), g = (e) => {
72
+ var t, s, i, c, n, v, M;
73
+ return Pe({
74
74
  key: e.name,
75
75
  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] : "",
76
76
  description: e.description,
@@ -80,20 +80,20 @@ const ct = ($, y = !0) => {
80
80
  type: (s = e.schema) == null ? void 0 : s.type,
81
81
  format: (i = e.schema) == null ? void 0 : i.format,
82
82
  minimum: (c = e.schema) == null ? void 0 : c.minimum,
83
- maximum: (v = e.schema) == null ? void 0 : v.maximum,
84
- default: (p = e.schema) == null ? void 0 : p.default,
85
- nullable: (R = e.schema) == null ? void 0 : R.nullable
83
+ maximum: (n = e.schema) == null ? void 0 : n.maximum,
84
+ default: (v = e.schema) == null ? void 0 : v.default,
85
+ nullable: (M = e.schema) == null ? void 0 : M.nullable
86
86
  });
87
- }, H = (e, t, s) => {
88
- var R;
87
+ }, Q = (e, t, s) => {
88
+ var M;
89
89
  const i = {
90
- path: Object.values(e.parameters.path).map(W),
91
- query: Object.values(e.parameters.query).map(W),
90
+ path: Object.values(e.parameters.path).map(g),
91
+ query: Object.values(e.parameters.query).map(g),
92
92
  headers: Object.values(e.parameters.headers).map(
93
- W
93
+ g
94
94
  ),
95
95
  cookies: Object.values(e.parameters.cookies).map(
96
- W
96
+ g
97
97
  )
98
98
  }, c = {
99
99
  activeBody: "raw",
@@ -103,55 +103,55 @@ const ct = ($, y = !0) => {
103
103
  }
104
104
  };
105
105
  if (e.requestBody) {
106
- const o = Te({
106
+ const S = qe({
107
107
  httpVerb: e.method,
108
108
  path: e.path,
109
109
  information: {
110
110
  requestBody: e.requestBody
111
111
  }
112
112
  });
113
- ((R = o == null ? void 0 : o.postData) == null ? void 0 : R.mimeType) === "application/json" && (i.headers.push({
113
+ ((M = S == null ? void 0 : S.postData) == null ? void 0 : M.mimeType) === "application/json" && (i.headers.push({
114
114
  key: "Content-Type",
115
115
  value: "application/json",
116
116
  enabled: !0
117
- }), c.activeBody = "raw", c.raw.value = o.postData.text);
117
+ }), c.activeBody = "raw", c.raw.value = S.postData.text);
118
118
  }
119
- const v = s ?? Pe(
119
+ const n = s ?? Ne(
120
120
  (e.summary ?? "Example") + " #1",
121
- (o) => e.childUids.some((a) => o === F[a].name)
122
- ), p = ge({
121
+ (S) => e.childUids.some((o) => S === K[o].name)
122
+ ), v = Ae({
123
123
  url: t != null && t.url ? `{{${t == null ? void 0 : t.url}}}${e.path}` : e.path,
124
124
  requestUid: e.uid,
125
125
  parameters: i,
126
- name: v,
126
+ name: n,
127
127
  body: c
128
128
  });
129
- return K.add(p), p;
130
- }, ie = (e, t) => {
131
- const s = H(
129
+ return I.add(v), v;
130
+ }, oe = (e, t) => {
131
+ const s = Q(
132
132
  e,
133
- B.value[0],
133
+ V.value[0],
134
134
  t
135
135
  );
136
- return m.edit(e.uid, "childUids", [
136
+ return h.edit(e.uid, "childUids", [
137
137
  ...e.childUids,
138
138
  s.uid
139
139
  ]), s;
140
- }, oe = (e) => {
141
- m.edit(
140
+ }, ae = (e) => {
141
+ h.edit(
142
142
  e.requestUid,
143
143
  "childUids",
144
- f[e.requestUid].childUids.filter(
144
+ m[e.requestUid].childUids.filter(
145
145
  (t) => t !== e.uid
146
146
  )
147
- ), K.delete(e.uid);
148
- }, ae = n(
147
+ ), I.delete(e.uid);
148
+ }, de = u(
149
149
  () => {
150
150
  var e;
151
- return F[C.value[u.Examples]] ?? F[((e = w.value) == null ? void 0 : e.childUids[0]) ?? ""];
151
+ return K[F.value[f.Examples]] ?? K[((e = O.value) == null ? void 0 : e.childUids[0]) ?? ""];
152
152
  }
153
- ), de = n(() => Object.values(f).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)), D = l({
154
- default: je({
153
+ ), le = u(() => Object.values(m).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)), L = l({
154
+ default: Ce({
155
155
  uid: "default",
156
156
  name: "Global Environment",
157
157
  color: "blue",
@@ -159,21 +159,21 @@ const ct = ($, y = !0) => {
159
159
  parsed: [],
160
160
  isDefault: !0
161
161
  })
162
- }), Q = S(
163
- D,
162
+ }), G = E(
163
+ L,
164
164
  l({}),
165
- y && E.ENVIRONMENT
166
- ), le = (e) => {
165
+ y && b.ENVIRONMENT
166
+ ), re = (e) => {
167
167
  if (e === "default") {
168
168
  console.warn("Default environment cannot be deleted.");
169
169
  return;
170
170
  }
171
- Q.delete(e);
172
- }, re = n(() => {
173
- const e = B.value.map((s) => ({
171
+ G.delete(e);
172
+ }, ne = u(() => {
173
+ const e = V.value.map((s) => ({
174
174
  key: s.url,
175
175
  value: s.url
176
- })), t = Object.values(D).map((s) => {
176
+ })), t = Object.values(L).map((s) => {
177
177
  try {
178
178
  return {
179
179
  _scalarEnvId: s.uid,
@@ -186,8 +186,8 @@ const ct = ($, y = !0) => {
186
186
  (s) => Object.entries(s).flatMap(([i, c]) => i !== "_scalarEnvId" ? [{ _scalarEnvId: s._scalarEnvId, key: i, value: c }] : [])
187
187
  );
188
188
  return [...e, ...t];
189
- }), G = l({
190
- default: xe({
189
+ }), X = l({
190
+ default: je({
191
191
  uid: "default",
192
192
  name: "Cookie",
193
193
  value: "",
@@ -197,20 +197,20 @@ const ct = ($, y = !0) => {
197
197
  httpOnly: !1,
198
198
  sameSite: "None"
199
199
  })
200
- }), ne = S(
201
- G,
200
+ }), ue = E(
201
+ X,
202
202
  l({}),
203
- y && E.COOKIE
204
- ), ue = n(
205
- () => C.value[u.Cookies]
206
- ), O = l({}), U = S(
207
- O,
203
+ y && b.COOKIE
204
+ ), fe = u(
205
+ () => F.value[f.Cookies]
206
+ ), U = l({}), k = E(
207
+ U,
208
208
  l({}),
209
- y && E.WORKSPACE
210
- ), fe = (e = {}) => {
211
- const t = Ue(e);
212
- U.add(t);
213
- const s = V(
209
+ y && b.WORKSPACE
210
+ ), me = (e = {}) => {
211
+ const t = ke(e);
212
+ k.add(t);
213
+ const s = J(
214
214
  {
215
215
  spec: {
216
216
  info: {
@@ -220,53 +220,53 @@ const ct = ($, y = !0) => {
220
220
  },
221
221
  t.uid
222
222
  );
223
- return T({ summary: "My First Request" }, s.uid), t;
224
- }, me = (e) => {
223
+ return q({ summary: "My First Request" }, s.uid), t;
224
+ }, he = (e) => {
225
225
  if (e === "default") {
226
226
  console.warn("Default environment cannot be deleted.");
227
227
  return;
228
228
  }
229
- U.delete(e);
230
- }, k = n(
231
- () => O[C.value[u.Workspace]] ?? O[Object.keys(O)[0]]
232
- ), L = n(
229
+ k.delete(e);
230
+ }, x = u(
231
+ () => U[F.value[f.Workspace]] ?? U[Object.keys(U)[0]]
232
+ ), B = u(
233
233
  () => {
234
234
  var e;
235
- return (e = k.value) == null ? void 0 : e.collectionUids.map((t) => d[t]).sort((t, s) => {
236
- var i, c, v, p;
237
- return ((c = (i = t.spec) == null ? void 0 : i.info) == null ? void 0 : c.title) === "Drafts" ? 1 : ((p = (v = s.spec) == null ? void 0 : v.info) == null ? void 0 : p.title) === "Drafts" ? -1 : 0;
235
+ return (e = x.value) == null ? void 0 : e.collectionUids.map((t) => d[t]).sort((t, s) => {
236
+ var i, c, n, v;
237
+ return ((c = (i = t.spec) == null ? void 0 : i.info) == null ? void 0 : c.title) === "Drafts" ? 1 : ((v = (n = s.spec) == null ? void 0 : n.info) == null ? void 0 : v.title) === "Drafts" ? -1 : 0;
238
238
  });
239
239
  }
240
- ), B = n(
240
+ ), V = u(
241
241
  () => {
242
242
  var e;
243
- return (e = L.value) == null ? void 0 : e.flatMap(
244
- (t) => t.spec.serverUids.map((s) => P[s])
243
+ return (e = B.value) == null ? void 0 : e.flatMap(
244
+ (t) => t.spec.serverUids.map((s) => N[s])
245
245
  );
246
246
  }
247
- ), X = (e) => f[e] ?? r[e].childUids.flatMap((t) => X(t)), z = n(
247
+ ), z = (e) => m[e] ?? r[e].childUids.flatMap((t) => z(t)), Z = u(
248
248
  () => {
249
249
  var e;
250
- return (e = L.value) == null ? void 0 : e.flatMap(
251
- (t) => t.childUids.flatMap((s) => X(s))
250
+ return (e = B.value) == null ? void 0 : e.flatMap(
251
+ (t) => t.childUids.flatMap((s) => z(s))
252
252
  );
253
253
  }
254
- ), he = n(() => {
254
+ ), pe = u(() => {
255
255
  var e;
256
- return ((e = k.value) == null ? void 0 : e.isReadOnly) ?? !1;
257
- }), d = l({}), h = S(
256
+ return ((e = x.value) == null ? void 0 : e.isReadOnly) ?? !1;
257
+ }), d = l({}), p = E(
258
258
  d,
259
259
  l({}),
260
- y && E.COLLECTION
261
- ), V = (e, t) => {
262
- const s = ke(e);
263
- return U.edit(t, "collectionUids", [
264
- ...O[t].collectionUids,
260
+ y && b.COLLECTION
261
+ ), J = (e, t) => {
262
+ const s = xe(e);
263
+ return k.edit(t, "collectionUids", [
264
+ ...U[t].collectionUids,
265
265
  s.uid
266
- ]), h.add(s), s;
267
- }, pe = (e) => {
266
+ ]), p.add(s), s;
267
+ }, ve = (e) => {
268
268
  var t, s, i;
269
- if (k.value) {
269
+ if (x.value) {
270
270
  if (((i = (s = (t = d[e.uid]) == null ? void 0 : t.spec) == null ? void 0 : s.info) == null ? void 0 : i.title) === "Drafts") {
271
271
  console.warn("The drafts collection cannot be deleted");
272
272
  return;
@@ -276,38 +276,38 @@ const ct = ($, y = !0) => {
276
276
  return;
277
277
  }
278
278
  e.childUids.forEach((c) => {
279
- f[c] ? q(f[c]) : r[c] && J(r[c]);
280
- }), U.edit(
281
- k.value.uid,
279
+ m[c] ? _(m[c]) : r[c] && Y(r[c]);
280
+ }), k.edit(
281
+ x.value.uid,
282
282
  "collectionUids",
283
- k.value.collectionUids.filter(
283
+ x.value.collectionUids.filter(
284
284
  (c) => c !== e.uid
285
285
  )
286
- ), h.delete(e.uid);
286
+ ), p.delete(e.uid);
287
287
  }
288
- }, g = n(() => {
288
+ }, A = u(() => {
289
289
  const e = Object.values(d)[0];
290
- if (!w.value) return e;
291
- const t = _(w.value.uid);
290
+ if (!O.value) return e;
291
+ const t = D(O.value.uid);
292
292
  if (!t.length) return null;
293
293
  const s = t[t.length - 1];
294
294
  return d[s] ?? e;
295
- }), ve = n(
296
- () => g.value && P[g.value.selectedServerUid]
297
- ), r = l({}), b = S(
295
+ }), ye = u(
296
+ () => A.value && N[A.value.selectedServerUid]
297
+ ), r = l({}), R = E(
298
298
  r,
299
299
  l({}),
300
- y && E.FOLDER
301
- ), Z = (e, t) => {
302
- const s = Ce(e);
300
+ y && b.FOLDER
301
+ ), ee = (e, t) => {
302
+ const s = Fe(e);
303
303
  if (t)
304
304
  if (d[t])
305
- h.edit(t, "childUids", [
305
+ p.edit(t, "childUids", [
306
306
  ...d[t].childUids,
307
307
  s.uid
308
308
  ]);
309
309
  else if (r[t])
310
- b.edit(t, "childUids", [
310
+ R.edit(t, "childUids", [
311
311
  ...r[t].childUids,
312
312
  s.uid
313
313
  ]);
@@ -315,229 +315,229 @@ const ct = ($, y = !0) => {
315
315
  console.error("Could not find folder's parent ID");
316
316
  return;
317
317
  }
318
- b.add(s);
319
- }, J = (e, t) => {
318
+ R.add(s);
319
+ }, Y = (e, t) => {
320
320
  e.childUids.forEach((s) => {
321
- f[s] ? q(f[s]) : r[s] && J(r[s]);
322
- }), t && d[t] ? h.edit(
321
+ m[s] ? _(m[s]) : r[s] && Y(r[s]);
322
+ }), t && d[t] ? p.edit(
323
323
  t,
324
324
  "childUids",
325
325
  d[t].childUids.filter((s) => s !== e.uid)
326
- ) : t && r[t] && b.edit(
326
+ ) : t && r[t] && R.edit(
327
327
  t,
328
328
  "childUids",
329
329
  r[t].childUids.filter((s) => s !== e.uid)
330
- ), b.delete(e.uid);
331
- }, Y = l({}), A = S(
332
- Y,
330
+ ), R.delete(e.uid);
331
+ }, $ = l({}), P = E(
332
+ $,
333
333
  l({}),
334
- y && E.SECURITY_SCHEME
335
- ), ye = n(
334
+ y && b.SECURITY_SCHEME
335
+ ), Se = u(
336
336
  () => {
337
337
  var e;
338
- return ((e = w.value) == null ? void 0 : e.selectedSecuritySchemeUids.map(
339
- (t) => Y[t]
338
+ return ((e = O.value) == null ? void 0 : e.selectedSecuritySchemeUids.map(
339
+ (t) => $[t]
340
340
  )) ?? [];
341
341
  }
342
- ), Se = n(
342
+ ), Ee = u(
343
343
  () => {
344
344
  var e, t;
345
- return ((e = w.value) == null ? void 0 : e.security) ?? ((t = g.value) == null ? void 0 : t.spec.security) ?? [];
345
+ return ((e = O.value) == null ? void 0 : e.security) ?? ((t = A.value) == null ? void 0 : t.spec.security) ?? [];
346
346
  }
347
- ), I = (e, t, s, i = !1) => {
348
- const c = Fe(e);
349
- A.add(c), t && e.nameKey && h.edit(
347
+ ), W = (e, t, s, i = !1) => {
348
+ const c = Ke(e);
349
+ P.add(c), t && e.nameKey && p.edit(
350
350
  t,
351
351
  `securitySchemeDict.${e.nameKey}`,
352
352
  c.uid
353
- ), s && (m.edit(s.uid, "securitySchemeUids", [
353
+ ), s && (h.edit(s.uid, "securitySchemeUids", [
354
354
  ...s.securitySchemeUids,
355
355
  c.uid
356
- ]), i && m.edit(s.uid, "selectedSecuritySchemeUids", [
356
+ ]), i && h.edit(s.uid, "selectedSecuritySchemeUids", [
357
357
  ...s.selectedSecuritySchemeUids,
358
358
  c.uid
359
359
  ]));
360
- }, Ee = (e, t) => {
361
- t && (m.edit(
360
+ }, be = (e, t) => {
361
+ t && (h.edit(
362
362
  t.uid,
363
363
  "securitySchemeUids",
364
364
  t.securitySchemeUids.filter((s) => s !== e.uid)
365
- ), m.edit(
365
+ ), h.edit(
366
366
  t.uid,
367
367
  "selectedSecuritySchemeUids",
368
368
  t.selectedSecuritySchemeUids.filter((s) => s !== e.uid)
369
- )), A.delete(e.uid);
370
- }, P = l({}), N = S(
371
- P,
369
+ )), P.delete(e.uid);
370
+ }, N = l({}), T = E(
371
+ N,
372
372
  l({}),
373
- y && E.SERVER
374
- ), ee = (e, t) => {
375
- const s = Ie(e);
376
- t && h.edit(t, "spec.serverUids", [
373
+ y && b.SERVER
374
+ ), te = (e, t) => {
375
+ const s = We(e);
376
+ t && p.edit(t, "spec.serverUids", [
377
377
  ...d[t].spec.serverUids,
378
378
  s.uid
379
- ]), N.add(s);
380
- }, be = (e, t) => {
381
- h.edit(
379
+ ]), T.add(s);
380
+ }, Re = (e, t) => {
381
+ p.edit(
382
382
  t,
383
383
  "spec.serverUids",
384
384
  d[t].spec.serverUids.filter(
385
385
  (s) => s !== e
386
386
  )
387
- ), N.delete(e);
388
- }, te = async (e, t = "default") => {
389
- var R;
390
- const s = De(e), i = await qe(s);
391
- i.requests.forEach(
392
- (o) => T(o, void 0, i.servers[0])
387
+ ), T.delete(e);
388
+ }, se = async (e, t = "default", s) => {
389
+ var S;
390
+ const i = Le(e), c = await _e(i, s);
391
+ c.requests.forEach(
392
+ (o) => q(o, void 0, c.servers[0])
393
393
  );
394
- const c = V(i.collection, t);
395
- i.folders.forEach((o) => Z(o)), i.servers.forEach((o) => ee(o));
394
+ const n = J(c.collection, t);
395
+ c.folders.forEach((o) => ee(o)), c.servers.forEach((o) => te(o));
396
396
  const v = Object.entries(
397
- (((R = i.components) == null ? void 0 : R.securitySchemes) || i.securityDefinitions) ?? {}
398
- ), p = (o, a) => {
399
- var j;
400
- const M = (j = Object.keys(o[0])) == null ? void 0 : j[0];
401
- if (!M) return;
402
- const x = c.securitySchemeDict[M];
403
- m.edit(a.uid, "selectedSecuritySchemeUids", [x]);
397
+ (((S = c.components) == null ? void 0 : S.securitySchemes) || c.securityDefinitions) ?? {}
398
+ ), M = (o, a) => {
399
+ var C;
400
+ const w = (C = Object.keys(o[0])) == null ? void 0 : C[0];
401
+ if (!w) return;
402
+ const j = n.securitySchemeDict[w];
403
+ h.edit(a.uid, "selectedSecuritySchemeUids", [j]);
404
404
  };
405
405
  v.forEach(([o, a]) => {
406
406
  if (a && "flows" in a) {
407
- const { flows: M, ...x } = a;
408
- if (M) {
409
- const j = Object.entries(M), [se, ce] = j[0];
410
- se && ce && I(
407
+ const { flows: w, ...j } = a;
408
+ if (w) {
409
+ const C = Object.entries(w), [ce, ie] = C[0];
410
+ ce && ie && W(
411
411
  {
412
- ...x,
412
+ ...j,
413
413
  type: "oauth2",
414
- flow: { ...ce, type: se },
414
+ flow: { ...ie, type: ce },
415
415
  nameKey: o
416
416
  },
417
- c.uid
417
+ n.uid
418
418
  );
419
419
  }
420
- } else a.type === "basic" ? I(
420
+ } else a.type === "basic" ? W(
421
421
  { ...a, type: "http", scheme: "basic", nameKey: o },
422
- c.uid
423
- ) : a.type === "http" ? I(
422
+ n.uid
423
+ ) : a.type === "http" ? W(
424
424
  {
425
425
  ...a,
426
426
  type: "http",
427
427
  scheme: a.scheme === "bearer" ? "bearer" : "basic",
428
428
  nameKey: o
429
429
  },
430
- c.uid
431
- ) : a.type === "apiKey" && I(
430
+ n.uid
431
+ ) : a.type === "apiKey" && W(
432
432
  {
433
433
  ...a,
434
434
  type: "apiKey",
435
- in: Ke.includes(
435
+ in: Ie.includes(
436
436
  a.in
437
437
  ) ? a.in : "header",
438
438
  nameKey: o
439
439
  },
440
- c.uid
440
+ n.uid
441
441
  );
442
- }), v.length && Object.values(f).forEach((o) => {
443
- var M, x;
444
- const a = ((M = o.security) == null ? void 0 : M.filter((j) => JSON.stringify(j) !== "{}")) ?? [];
445
- a != null && a.length ? p(a, o) : typeof o.security > "u" && ((x = c.spec.security) != null && x.length) && p(c.spec.security, o);
442
+ }), v.length && Object.values(m).forEach((o) => {
443
+ var w, j;
444
+ const a = ((w = o.security) == null ? void 0 : w.filter((C) => JSON.stringify(C) !== "{}")) ?? [];
445
+ a != null && a.length ? M(a, o) : typeof o.security > "u" && ((j = n.spec.security) != null && j.length) && M(n.spec.security, o);
446
446
  });
447
447
  };
448
- async function Re(e, t) {
448
+ async function Me(e, t, s) {
449
449
  try {
450
- const s = await Ne(e, t);
451
- await te(s, void 0);
452
- } catch (s) {
453
- console.error("Failed to fetch spec from URL:", s);
450
+ const i = await Te(e, t);
451
+ await se(i, void 0, s);
452
+ } catch (i) {
453
+ console.error("Failed to fetch spec from URL:", i);
454
454
  }
455
455
  }
456
- const Me = Oe();
456
+ const we = Ue();
457
457
  return {
458
458
  // ---------------------------------------------------------------------------
459
459
  // STATE
460
- workspaces: O,
460
+ workspaces: U,
461
461
  collections: d,
462
- cookies: G,
463
- environments: D,
462
+ cookies: X,
463
+ environments: L,
464
464
  folders: r,
465
- requestExamples: F,
466
- requests: f,
467
- servers: P,
468
- securitySchemes: Y,
469
- activeCollection: g,
470
- activeCookieId: ue,
471
- activeExample: ae,
472
- activeRequest: w,
473
- activeRouterParams: C,
474
- activeSecurityRequirements: Se,
475
- activeSecuritySchemes: ye,
476
- activeServer: ve,
477
- activeWorkspace: k,
478
- activeWorkspaceCollections: L,
479
- activeWorkspaceServers: B,
480
- activeParsedEnvironments: re,
481
- activeWorkspaceRequests: z,
482
- modalState: Me,
483
- isReadOnly: he,
484
- router: $,
465
+ requestExamples: K,
466
+ requests: m,
467
+ servers: N,
468
+ securitySchemes: $,
469
+ activeCollection: A,
470
+ activeCookieId: fe,
471
+ activeExample: de,
472
+ activeRequest: O,
473
+ activeRouterParams: F,
474
+ activeSecurityRequirements: Ee,
475
+ activeSecuritySchemes: Se,
476
+ activeServer: ye,
477
+ activeWorkspace: x,
478
+ activeWorkspaceCollections: B,
479
+ activeWorkspaceServers: V,
480
+ activeParsedEnvironments: ne,
481
+ activeWorkspaceRequests: Z,
482
+ modalState: we,
483
+ isReadOnly: pe,
484
+ router: H,
485
485
  // ---------------------------------------------------------------------------
486
486
  // METHODS
487
- findRequestFolders: _,
488
- importSpecFile: te,
489
- importSpecFromUrl: Re,
490
- cookieMutators: ne,
487
+ findRequestFolders: D,
488
+ importSpecFile: se,
489
+ importSpecFromUrl: Me,
490
+ cookieMutators: ue,
491
491
  collectionMutators: {
492
- ...h,
493
- rawAdd: h.add,
494
- add: V,
495
- delete: pe
492
+ ...p,
493
+ rawAdd: p.add,
494
+ add: J,
495
+ delete: ve
496
496
  },
497
497
  environmentMutators: {
498
- ...Q,
499
- delete: le
498
+ ...G,
499
+ delete: re
500
500
  },
501
501
  folderMutators: {
502
- ...b,
503
- rawAdd: b.add,
504
- add: Z,
505
- delete: J
502
+ ...R,
503
+ rawAdd: R.add,
504
+ add: ee,
505
+ delete: Y
506
506
  },
507
507
  requestMutators: {
508
- ...m,
509
- rawAdd: m.add,
510
- add: T,
511
- delete: q
508
+ ...h,
509
+ rawAdd: h.add,
510
+ add: q,
511
+ delete: _
512
512
  },
513
513
  requestExampleMutators: {
514
- ...K,
515
- rawAdd: K.add,
516
- add: ie,
517
- delete: oe
514
+ ...I,
515
+ rawAdd: I.add,
516
+ add: oe,
517
+ delete: ae
518
518
  },
519
- requestsHistory: de,
519
+ requestsHistory: le,
520
520
  securitySchemeMutators: {
521
- ...A,
522
- rawAdd: A.add,
523
- add: I,
524
- delete: Ee
521
+ ...P,
522
+ rawAdd: P.add,
523
+ add: W,
524
+ delete: be
525
525
  },
526
526
  serverMutators: {
527
- ...N,
528
- rawAdd: N.add,
529
- add: ee,
530
- delete: be
527
+ ...T,
528
+ rawAdd: T.add,
529
+ add: te,
530
+ delete: Re
531
531
  },
532
532
  workspaceMutators: {
533
- ...U,
534
- rawAdd: U.add,
535
- add: fe,
536
- delete: me
533
+ ...k,
534
+ rawAdd: k.add,
535
+ add: me,
536
+ delete: he
537
537
  }
538
538
  };
539
- }, it = () => _e("workspace");
539
+ }, ot = () => De("workspace");
540
540
  export {
541
- ct as createWorkspaceStore,
542
- it as useWorkspace
541
+ it as createWorkspaceStore,
542
+ ot as useWorkspace
543
543
  };