@scalar/api-client 2.0.59 → 2.0.62

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