@scalar/api-client 2.0.47 → 2.0.49

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