@scalar/api-client 2.2.6 → 2.2.7

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 (44) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/components/AddressBar/AddressBar.vue.js +2 -2
  3. package/dist/components/AddressBar/AddressBar.vue2.js +1 -1
  4. package/dist/components/AddressBar/AddressBarServer.vue.js +18 -18
  5. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +20 -20
  6. package/dist/components/HttpMethod/HttpMethod.vue.js +2 -2
  7. package/dist/components/HttpMethod/HttpMethod.vue2.js +12 -12
  8. package/dist/components/HttpMethod/index.d.ts +0 -1
  9. package/dist/components/HttpMethod/index.d.ts.map +1 -1
  10. package/dist/components/HttpMethod/index.js +2 -4
  11. package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
  12. package/dist/components/ImportCollection/ImportCollectionModal.vue.js +119 -102
  13. package/dist/components/OpenApiClientButton.vue.d.ts +1 -0
  14. package/dist/components/OpenApiClientButton.vue.d.ts.map +1 -1
  15. package/dist/components/OpenApiClientButton.vue.js +2 -2
  16. package/dist/components/OpenApiClientButton.vue2.js +23 -17
  17. package/dist/components/Search/useSearch.d.ts.map +1 -1
  18. package/dist/components/Search/useSearch.js +45 -41
  19. package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
  20. package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
  21. package/dist/layouts/Modal/ApiClientModal.vue2.js +28 -23
  22. package/dist/libs/create-client.d.ts +1 -0
  23. package/dist/libs/create-client.d.ts.map +1 -1
  24. package/dist/libs/create-client.js +31 -30
  25. package/dist/style.css +1 -1
  26. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
  27. package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +65 -62
  28. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  29. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
  30. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +82 -84
  31. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
  32. package/dist/views/Request/RequestSection/RequestBody.vue.js +2 -2
  33. package/dist/views/Request/RequestSection/RequestBody.vue2.js +27 -24
  34. package/dist/views/Request/RequestSubpageHeader.vue.d.ts.map +1 -1
  35. package/dist/views/Request/RequestSubpageHeader.vue.js +3 -3
  36. package/dist/views/Request/RequestSubpageHeader.vue2.js +34 -32
  37. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  38. package/dist/views/Request/components/WorkspaceDropdown.vue.js +1 -1
  39. package/dist/views/Request/libs/live-sync.d.ts.map +1 -1
  40. package/dist/views/Request/libs/live-sync.js +77 -78
  41. package/package.json +10 -10
  42. package/dist/components/HttpMethod/helpers.d.ts +0 -4
  43. package/dist/components/HttpMethod/helpers.d.ts.map +0 -1
  44. package/dist/components/HttpMethod/helpers.js +0 -5
@@ -1,4 +1,4 @@
1
- import { defineComponent as Z, computed as b, ref as I, watch as W, openBlock as f, createBlock as h, withCtx as d, createTextVNode as z, toDisplayString as F, createVNode as s, unref as u, createElementVNode as w, createCommentVNode as ee, createElementBlock as U, Fragment as ae, nextTick as te } from "vue";
1
+ import { defineComponent as Z, computed as b, ref as I, watch as W, openBlock as p, createBlock as h, withCtx as d, createTextVNode as z, toDisplayString as F, createVNode as s, unref as u, createElementVNode as w, createCommentVNode as ee, createElementBlock as U, Fragment as ae, nextTick as te } from "vue";
2
2
  import oe from "../../../components/CodeInput/CodeInput.vue.js";
3
3
  import ne from "../../../components/DataTable/DataTable.vue.js";
4
4
  import le from "../../../components/DataTable/DataTableHeader.vue.js";
@@ -59,9 +59,9 @@ const se = {
59
59
  function V() {
60
60
  console.log("deleteRow");
61
61
  }
62
- const C = (e, a, t) => {
62
+ const P = (e, a, t) => {
63
63
  if (!c.value || !o.value) return;
64
- const l = p.value;
64
+ const l = f.value;
65
65
  if (l.length > e) {
66
66
  const n = [...l];
67
67
  n[e] = { ...n[e], [a]: t }, (n[e].key !== "" || n[e].value !== "") && (n[e].enabled = !0), n[e].key === "" && n[e].value === "" && n.splice(e, 1), i.edit(
@@ -82,16 +82,19 @@ const se = {
82
82
  });
83
83
  }
84
84
  e === l.length - 1 && j();
85
- }, p = b(
85
+ }, f = b(
86
86
  () => {
87
87
  var e, a, t;
88
88
  return ((t = (a = (e = o.value) == null ? void 0 : e.body) == null ? void 0 : a.formData) == null ? void 0 : t.value) ?? [];
89
89
  }
90
- ), P = () => p.value.length === 0 && j(), j = () => {
90
+ ), C = () => {
91
+ const e = f.value[f.value.length - 1];
92
+ (!e || e.key !== "" || e.value !== "") && j();
93
+ }, j = () => {
91
94
  if (!c.value || !o.value) return;
92
95
  const e = J.parse({
93
96
  enabled: !1
94
- }), a = [...p.value, e];
97
+ }), a = [...f.value, e];
95
98
  o.value.body.formData ? i.edit(
96
99
  o.value.uid,
97
100
  "body.formData.value",
@@ -102,7 +105,7 @@ const se = {
102
105
  });
103
106
  }, N = (e, a) => {
104
107
  if (!c.value || !o.value) return;
105
- const t = p.value;
108
+ const t = f.value;
106
109
  if (t.length > e) {
107
110
  const l = [...t];
108
111
  l[e].enabled = a, i.edit(
@@ -184,7 +187,7 @@ const se = {
184
187
  onChange: async (t) => {
185
188
  const l = t == null ? void 0 : t[0];
186
189
  if (l && c.value && o.value) {
187
- const r = [...p.value];
190
+ const r = [...f.value];
188
191
  r[e] = {
189
192
  ...r[e],
190
193
  file: l
@@ -205,7 +208,7 @@ const se = {
205
208
  }
206
209
  function M(e) {
207
210
  if (!c.value || !o.value) return;
208
- const t = [...p.value];
211
+ const t = [...f.value];
209
212
  t[e] = {
210
213
  ...t[e],
211
214
  file: void 0
@@ -233,7 +236,7 @@ const se = {
233
236
  W(
234
237
  v,
235
238
  (e) => {
236
- ["multipartForm", "formUrlEncoded"].includes(e == null ? void 0 : e.id) && P();
239
+ ["multipartForm", "formUrlEncoded"].includes(e == null ? void 0 : e.id) && C();
237
240
  },
238
241
  { immediate: !0 }
239
242
  ), W(
@@ -245,7 +248,7 @@ const se = {
245
248
  var e;
246
249
  (e = c.value) != null && e.method && ue(c.value.method) && q(R.value), ["multipartForm", "formUrlEncoded"].includes(
247
250
  R.value
248
- ) && P();
251
+ ) && C();
249
252
  },
250
253
  { immediate: !0 }
251
254
  );
@@ -275,7 +278,7 @@ const se = {
275
278
  }
276
279
  }
277
280
  });
278
- return (e, a) => (f(), h(re, null, {
281
+ return (e, a) => (p(), h(re, null, {
279
282
  title: d(() => [
280
283
  z(F(e.title), 1)
281
284
  ]),
@@ -313,7 +316,7 @@ const se = {
313
316
  ]),
314
317
  _: 1
315
318
  }, 8, ["modelValue", "options"]),
316
- g.value.length > 0 ? (f(), h(u(A), {
319
+ g.value.length > 0 ? (p(), h(u(A), {
317
320
  key: 0,
318
321
  modelValue: _.value,
319
322
  "onUpdate:modelValue": a[1] || (a[1] = (t) => _.value = t),
@@ -352,10 +355,10 @@ const se = {
352
355
  default: d(() => {
353
356
  var t, l, n, r, m;
354
357
  return [
355
- v.value.id === "none" ? (f(), U("div", se, a[2] || (a[2] = [
358
+ v.value.id === "none" ? (p(), U("div", se, a[2] || (a[2] = [
356
359
  w("span", null, "No Body", -1)
357
- ]))) : v.value.id === "binaryFile" ? (f(), U("div", ce, [
358
- (t = u(o)) != null && t.body.binary ? (f(), U(ae, { key: 0 }, [
360
+ ]))) : v.value.id === "binaryFile" ? (p(), U("div", ce, [
361
+ (t = u(o)) != null && t.body.binary ? (p(), U(ae, { key: 0 }, [
359
362
  w("span", me, F(((l = u(o)) == null ? void 0 : l.body.binary).name), 1),
360
363
  s(u(k), {
361
364
  class: "bg-b-2 hover:bg-b-3 border-0 text-c-2 ml-1 shadow-none",
@@ -368,7 +371,7 @@ const se = {
368
371
  ])),
369
372
  _: 1
370
373
  })
371
- ], 64)) : (f(), h(u(k), {
374
+ ], 64)) : (p(), h(u(k), {
372
375
  key: 1,
373
376
  class: "bg-b-2 hover:bg-b-3 border-0 text-c-2 shadow-none",
374
377
  size: "sm",
@@ -386,33 +389,33 @@ const se = {
386
389
  ]),
387
390
  _: 1
388
391
  }))
389
- ])) : v.value.id == "multipartForm" ? (f(), h($, {
392
+ ])) : v.value.id == "multipartForm" ? (p(), h($, {
390
393
  key: 2,
391
394
  ref_key: "tableWrapperRef",
392
395
  ref: B,
393
396
  class: "!m-0 rounded-t-none shadow-none border-l-0 border-r-0 border-t-0 border-b-0",
394
397
  columns: ["32px", "", "", "61px"],
395
- items: p.value,
398
+ items: f.value,
396
399
  showUploadButton: "",
397
400
  onDeleteRow: V,
398
401
  onRemoveFile: M,
399
402
  onToggleRow: N,
400
- onUpdateRow: C,
403
+ onUpdateRow: P,
401
404
  onUploadFile: L
402
- }, null, 8, ["items"])) : v.value.id == "formUrlEncoded" ? (f(), h($, {
405
+ }, null, 8, ["items"])) : v.value.id == "formUrlEncoded" ? (p(), h($, {
403
406
  key: 3,
404
407
  ref_key: "tableWrapperRef",
405
408
  ref: B,
406
409
  class: "!m-0 rounded-t-none border-t-0 shadow-none border-l-0 border-r-0 border-t-0 border-b-0",
407
410
  columns: ["32px", "", "", "61px"],
408
- items: p.value,
411
+ items: f.value,
409
412
  showUploadButton: "",
410
413
  onDeleteRow: V,
411
414
  onRemoveFile: M,
412
415
  onToggleRow: N,
413
- onUpdateRow: C,
416
+ onUpdateRow: P,
414
417
  onUploadFile: L
415
- }, null, 8, ["items"])) : (f(), h(oe, {
418
+ }, null, 8, ["items"])) : (p(), h(oe, {
416
419
  key: 4,
417
420
  content: "",
418
421
  language: Y.value,
@@ -1 +1 @@
1
- {"version":3,"file":"RequestSubpageHeader.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSubpageHeader.vue"],"names":[],"mappings":"AA8GA,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAC;;;;;;;;;;AAkPF,wBAQG"}
1
+ {"version":3,"file":"RequestSubpageHeader.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSubpageHeader.vue"],"names":[],"mappings":"AAoHA,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAC;;;;;;;;;;AAwPF,wBAQG"}
@@ -1,7 +1,7 @@
1
- import e from "./RequestSubpageHeader.vue2.js";
1
+ import a from "./RequestSubpageHeader.vue2.js";
2
2
  /* empty css */
3
- import o from "../../_virtual/_plugin-vue_export-helper.js";
4
- const p = /* @__PURE__ */ o(e, [["__scopeId", "data-v-df327023"]]);
3
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const p = /* @__PURE__ */ e(a, [["__scopeId", "data-v-cad1af01"]]);
5
5
  export {
6
6
  p as default
7
7
  };
@@ -1,28 +1,29 @@
1
- import { defineComponent as C, openBlock as l, createElementBlock as a, createElementVNode as r, createVNode as s, normalizeClass as k, unref as t, createBlock as d, createCommentVNode as i } from "vue";
2
- import V from "../../components/AddressBar/AddressBar.vue.js";
3
- import x from "../../components/EnvironmentSelector/EnvironmentSelector.vue.js";
4
- import v from "../../components/Sidebar/SidebarToggle.vue.js";
5
- import { useActiveEntities as w } from "../../store/active-entities.js";
6
- import { ScalarIcon as g } from "@scalar/components";
7
- import $ from "./components/WorkspaceDropdown.vue.js";
8
- import B from "../../components/OpenApiClientButton.vue.js";
9
- import { useWorkspace as R } from "../../store/store.js";
10
- import { useLayout as h } from "../../hooks/useLayout.js";
11
- const z = { class: "lg:min-h-header flex items-center w-full justify-center p-2 pt-2 lg:pt-1 lg:p-1 flex-wrap t-app__top-container border-b-1/2" }, A = { class: "flex flex-row items-center gap-1 lg:px-1 lg:mb-0 lg:mb-0 mb-2 lg:flex-1 w-6/12" }, E = { class: "flex flex-row items-center gap-1 lg:px-2.5 lg:mb-0 mb-2 lg:flex-1 justify-end w-6/12" }, D = /* @__PURE__ */ C({
1
+ import { defineComponent as C, openBlock as l, createElementBlock as a, createElementVNode as i, createVNode as s, normalizeClass as V, unref as t, createBlock as u, createCommentVNode as r } from "vue";
2
+ import x from "../../components/AddressBar/AddressBar.vue.js";
3
+ import v from "../../components/EnvironmentSelector/EnvironmentSelector.vue.js";
4
+ import w from "../../components/Sidebar/SidebarToggle.vue.js";
5
+ import { useActiveEntities as R } from "../../store/active-entities.js";
6
+ import { ScalarIcon as c } from "@scalar/components";
7
+ import { useRouter as $ } from "vue-router";
8
+ import B from "./components/WorkspaceDropdown.vue.js";
9
+ import h from "../../components/OpenApiClientButton.vue.js";
10
+ import { useWorkspace as z } from "../../store/store.js";
11
+ import { useLayout as A } from "../../hooks/useLayout.js";
12
+ const E = { class: "lg:min-h-header flex items-center w-full justify-center p-2 pt-2 lg:pt-1 lg:p-1 flex-wrap t-app__top-container border-b-1/2" }, M = { class: "flex flex-row items-center gap-1 lg:px-1 lg:mb-0 lg:mb-0 mb-2 lg:flex-1 w-6/12" }, N = { class: "flex flex-row items-center gap-1 lg:px-2.5 lg:mb-0 mb-2 lg:flex-1 justify-end w-6/12" }, J = /* @__PURE__ */ C({
12
13
  __name: "RequestSubpageHeader",
13
14
  props: {
14
15
  modelValue: { type: Boolean },
15
16
  isReadonly: { type: Boolean }
16
17
  },
17
18
  emits: ["update:modelValue", "hideModal", "importCurl"],
18
- setup(M) {
19
- const { activeCollection: m } = w(), c = R(), { hideClientButton: y } = c, { layout: b } = h();
19
+ setup(S) {
20
+ const { activeCollection: m } = R(), g = z(), { hideClientButton: y } = g, { layout: b } = A(), { currentRoute: k } = $();
20
21
  return (o, e) => {
21
- var p, u, f;
22
- return l(), a("div", z, [
23
- r("div", A, [
24
- s(v, {
25
- class: k(["gitbook-hidden", [
22
+ var d, p, f;
23
+ return l(), a("div", E, [
24
+ i("div", M, [
25
+ s(w, {
26
+ class: V(["gitbook-hidden", [
26
27
  "xl:hidden",
27
28
  { "xl:!flex": !o.modelValue },
28
29
  { "!flex": t(b) === "modal" }
@@ -30,51 +31,52 @@ const z = { class: "lg:min-h-header flex items-center w-full justify-center p-2
30
31
  modelValue: o.modelValue,
31
32
  "onUpdate:modelValue": e[0] || (e[0] = (n) => o.$emit("update:modelValue", n))
32
33
  }, null, 8, ["class", "modelValue"]),
33
- o.isReadonly ? i("", !0) : (l(), d(t($), { key: 0 }))
34
+ o.isReadonly ? r("", !0) : (l(), u(t(B), { key: 0 }))
34
35
  ]),
35
- s(V, {
36
+ s(x, {
36
37
  onImportCurl: e[1] || (e[1] = (n) => o.$emit("importCurl", n))
37
38
  }),
38
- r("div", E, [
39
- o.isReadonly ? i("", !0) : (l(), d(x, { key: 0 })),
40
- o.isReadonly && ((p = t(m)) != null && p.documentUrl) && !t(y) ? (l(), d(t(B), {
39
+ i("div", N, [
40
+ o.isReadonly ? r("", !0) : (l(), u(v, { key: 0 })),
41
+ o.isReadonly && ((d = t(m)) != null && d.documentUrl) && !t(y) ? (l(), u(t(h), {
41
42
  key: 1,
42
43
  buttonSource: "modal",
43
44
  class: "!w-fit lg:-mr-1",
44
- integration: (u = t(m)) == null ? void 0 : u.integration,
45
+ integration: (p = t(m)) == null ? void 0 : p.integration,
46
+ source: t(k).query.source === "gitbook" ? "gitbook" : "api-reference",
45
47
  url: (f = t(m)) == null ? void 0 : f.documentUrl
46
- }, null, 8, ["integration", "url"])) : i("", !0),
48
+ }, null, 8, ["integration", "source", "url"])) : r("", !0),
47
49
  o.isReadonly ? (l(), a("button", {
48
50
  key: 2,
49
51
  class: "app-exit-button p-2 rounded-full fixed right-2 top-2 gitbook-hidden",
50
52
  type: "button",
51
53
  onClick: e[2] || (e[2] = (n) => o.$emit("hideModal"))
52
54
  }, [
53
- s(t(g), {
55
+ s(t(c), {
54
56
  icon: "Close",
55
57
  size: "lg",
56
58
  thickness: "2"
57
59
  }),
58
- e[4] || (e[4] = r("span", { class: "sr-only" }, "Close Client", -1))
59
- ])) : i("", !0),
60
+ e[4] || (e[4] = i("span", { class: "sr-only" }, "Close Client", -1))
61
+ ])) : r("", !0),
60
62
  o.isReadonly ? (l(), a("button", {
61
63
  key: 3,
62
64
  class: "text-c-1 hover:bg-b-2 active:text-c-1 p-2 rounded -mr-1.5 gitbook-show",
63
65
  type: "button",
64
66
  onClick: e[3] || (e[3] = (n) => o.$emit("hideModal"))
65
67
  }, [
66
- s(t(g), {
68
+ s(t(c), {
67
69
  icon: "Close",
68
70
  size: "md",
69
71
  thickness: "1.75"
70
72
  }),
71
- e[5] || (e[5] = r("span", { class: "sr-only" }, "Close Client", -1))
72
- ])) : i("", !0)
73
+ e[5] || (e[5] = i("span", { class: "sr-only" }, "Close Client", -1))
74
+ ])) : r("", !0)
73
75
  ])
74
76
  ]);
75
77
  };
76
78
  }
77
79
  });
78
80
  export {
79
- D as default
81
+ J as default
80
82
  };
@@ -17,7 +17,7 @@ const K = { class: "relative col-1 flex-center gap-6 p-2 capitalize" }, A = {
17
17
  a.commandPalette.emit({ commandName: "Create Request" });
18
18
  }, y = (i) => {
19
19
  i != null && i.createNew && v.name === "request" && f();
20
- }, h = "2.2.6";
20
+ }, h = "2.2.7";
21
21
  return R(() => a.hotKeys.on(y)), C(() => a.hotKeys.off(y)), (i, e) => (r(), l("div", K, [
22
22
  o("div", {
23
23
  class: k(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
@@ -52,7 +52,7 @@ const J = { class: "flex items-center text-sm w-[inherit]" }, K = { class: "font
52
52
  l("span", X, z(p.name), 1),
53
53
  s(e(S), {
54
54
  placement: "right-start",
55
- teleport: ".scalar-client"
55
+ teleport: ""
56
56
  }, {
57
57
  items: n(() => [
58
58
  s(e(u), {
@@ -1 +1 @@
1
- {"version":3,"file":"live-sync.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/live-sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAelE,OAAO,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EAEf,MAAM,6BAA6B,CAAA;AAEpC,OAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAK,MAAM,KAAK,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,SACvB,UAAU,EAAE,eACN,MAAM,EAAE,KACnB,UAAU,EAqFZ,CAAA;AAED,kEAAkE;AAClE,eAAO,MAAM,YAAY,GAAI,CAAC,OACvB,MAAM,EAAE,aACF,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,aACjB,CAAC,QAAQ,EAAE,CAAC,KAAK,OAAO,KAClC,CAAC,GAAG,IAMN,CAAA;AASD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,WACpB,SAAS,QACX,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KACxB,SAAS,GAAG,IAqDd,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,UACjB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,QAC/B,UAAU,KACf;IACD,0DAA0D;IAC1D,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACb,mGAAmG;IACnG,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACrB,2DAA2D;IAC3D,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CACzC,GAAG,IAwBH,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,SACzB,UAAU,wBACM,mBAAmB,0BACjB,cAAc,KACrC,OA0CF,CAAA;AAwBD;;GAEG;AACH,eAAO,MAAM,iBAAiB,SACtB,UAAU,wBACM,mBAAmB,SAClC,cAAc,KACpB,OAwIF,CAAA;AAED,mGAAmG;AACnG,eAAO,MAAM,gBAAgB,SACrB,UAAU,wBACM,mBAAmB,+BACZ,cAAc,KAC1C,OAoCF,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,aAAa,SAClB,UAAU,wBACM,mBAAmB,yBAClB,cAAc,KACpC,OA+BF,CAAA;AAED,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,WACpB,SAAS,OACZ,MAAM,SACJ,MAAM,KACZ,SAAS,GAAG,IAmBd,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,SAC7B,UAAU,wBACM,mBAAmB,+CACI,cAAc,KAC1D,OA0CF,CAAA"}
1
+ {"version":3,"file":"live-sync.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/live-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAelE,OAAO,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EAEf,MAAM,6BAA6B,CAAA;AAEpC,OAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAK,MAAM,KAAK,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,SACvB,UAAU,EAAE,eACN,MAAM,EAAE,KACnB,UAAU,EAqFZ,CAAA;AAED,kEAAkE;AAClE,eAAO,MAAM,YAAY,GAAI,CAAC,OACvB,MAAM,EAAE,aACF,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,aACjB,CAAC,QAAQ,EAAE,CAAC,KAAK,OAAO,KAClC,CAAC,GAAG,IAMN,CAAA;AASD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,WACpB,SAAS,QACX,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KACxB,SAAS,GAAG,IAqDd,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,UACjB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,QAC/B,UAAU,KACf;IACD,0DAA0D;IAC1D,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACb,mGAAmG;IACnG,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACrB,2DAA2D;IAC3D,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CACzC,GAAG,IAwBH,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,SACzB,UAAU,wBACM,mBAAmB,0BACjB,cAAc,KACrC,OA0CF,CAAA;AAwBD;;GAEG;AACH,eAAO,MAAM,iBAAiB,SACtB,UAAU,wBACM,mBAAmB,SAClC,cAAc,KACpB,OAwIF,CAAA;AAED,mGAAmG;AACnG,eAAO,MAAM,gBAAgB,SACrB,UAAU,wBACM,mBAAmB,+BACZ,cAAc,KAC1C,OAoCF,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,aAAa,SAClB,UAAU,wBACM,mBAAmB,yBAClB,cAAc,KACpC,OA+BF,CAAA;AAED,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,WACpB,SAAS,OACZ,MAAM,SACJ,MAAM,KACZ,SAAS,GAAG,IAmBd,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,SAC7B,UAAU,wBACM,mBAAmB,+CACI,cAAc,KAC1D,OA0CF,CAAA"}
@@ -1,26 +1,25 @@
1
- import { isHTTPMethod as D } from "../../../components/HttpMethod/helpers.js";
2
- import { collectionSchema as b, requestSchema as O, serverSchema as V, tagSchema as M, securitySchemeSchema as S, createExampleFromRequest as H } from "@scalar/oas-utils/entities/spec";
3
- import { schemaModel as R } from "@scalar/oas-utils/helpers";
4
- import { getNestedValue as Z } from "@scalar/object-utils/nested";
1
+ import { collectionSchema as b, requestSchema as O, serverSchema as V, tagSchema as M, securitySchemeSchema as S, createExampleFromRequest as D } from "@scalar/oas-utils/entities/spec";
2
+ import { isHttpMethod as H, schemaModel as R } from "@scalar/oas-utils/helpers";
3
+ import { getNestedValue as N } from "@scalar/object-utils/nested";
5
4
  import j from "microdiff";
6
5
  import { z as i } from "zod";
7
6
  const x = (e, s = []) => {
8
7
  const t = [];
9
8
  let a = !1;
10
- for (let n = 0; n < e.length; n++) {
9
+ for (let r = 0; r < e.length; r++) {
11
10
  if (a) {
12
11
  a = !1;
13
12
  continue;
14
13
  }
15
- const r = e[n], u = e[n + 1];
14
+ const n = e[r], u = e[r + 1];
16
15
  if (s.length)
17
- r.path = [...s, ...r.path], u && (u.path = [...s, ...u.path]);
18
- else if (r.path[0] !== "paths") {
19
- t.push(r);
16
+ n.path = [...s, ...n.path], u && (u.path = [...s, ...u.path]);
17
+ else if (n.path[0] !== "paths") {
18
+ t.push(n);
20
19
  continue;
21
20
  }
22
- if (r.type === "REMOVE" && (u == null ? void 0 : u.type) === "CREATE") {
23
- const [, l, p] = r.path, [, o, h] = u.path, c = ["paths", o];
21
+ if (n.type === "REMOVE" && (u == null ? void 0 : u.type) === "CREATE") {
22
+ const [, l, p] = n.path, [, o, h] = u.path, c = ["paths", o];
24
23
  if (l !== o && t.push({
25
24
  type: "CHANGE",
26
25
  path: ["paths", "path"],
@@ -32,20 +31,20 @@ const x = (e, s = []) => {
32
31
  oldValue: p,
33
32
  value: h
34
33
  }), c.push(h)), s.length === 0) {
35
- const y = j(r.oldValue, u.value);
34
+ const y = j(n.oldValue, u.value);
36
35
  if (y.length) {
37
- const f = x(y, c);
38
- t.push(...f);
36
+ const E = x(y, c);
37
+ t.push(...E);
39
38
  }
40
39
  }
41
40
  a = !0;
42
- } else r.type === "CREATE" && r.path.length > 3 && typeof r.path.at(-1) != "number" ? t.push({ ...r, type: "CHANGE", oldValue: void 0 }) : r.type === "REMOVE" && r.path.length > 3 && typeof r.path.at(-1) != "number" ? t.push({ ...r, type: "CHANGE", value: void 0 }) : t.push(r);
41
+ } else n.type === "CREATE" && n.path.length > 3 && typeof n.path.at(-1) != "number" ? t.push({ ...n, type: "CHANGE", oldValue: void 0 }) : n.type === "REMOVE" && n.path.length > 3 && typeof n.path.at(-1) != "number" ? t.push({ ...n, type: "CHANGE", value: void 0 }) : t.push(n);
43
42
  }
44
43
  return t;
45
44
  }, v = (e, s, t) => {
46
45
  for (const a of e) {
47
- const n = s[a];
48
- if (t(n)) return n;
46
+ const r = s[a];
47
+ if (t(r)) return r;
49
48
  }
50
49
  return null;
51
50
  }, d = (e) => e instanceof i.ZodOptional ? d(e.unwrap()) : e instanceof i.ZodDefault ? d(e._def.innerType) : e, G = (e, s) => {
@@ -75,18 +74,18 @@ const x = (e, s = []) => {
75
74
  }, m = (e, s) => {
76
75
  const t = G(e, s.path);
77
76
  if (!t) return null;
78
- const a = s.path.join("."), n = s.path.slice(0, -1).join(".");
77
+ const a = s.path.join("."), r = s.path.slice(0, -1).join(".");
79
78
  if (s.type === "REMOVE")
80
79
  return {
81
80
  path: a,
82
- pathMinusOne: n,
81
+ pathMinusOne: r,
83
82
  value: void 0
84
83
  };
85
- const r = R(s.value, t, !1);
86
- return r ? {
84
+ const n = R(s.value, t, !1);
85
+ return n ? {
87
86
  path: a,
88
- pathMinusOne: n,
89
- value: r
87
+ pathMinusOne: r,
88
+ value: n
90
89
  } : null;
91
90
  }, K = (e, { activeCollection: s }, { collectionMutators: t }) => {
92
91
  if (!s.value) return !1;
@@ -96,13 +95,13 @@ const x = (e, s = []) => {
96
95
  path: e.path
97
96
  });
98
97
  if (!a) return !1;
99
- const n = [
100
- ...Z(s.value, a.pathMinusOne)
98
+ const r = [
99
+ ...N(s.value, a.pathMinusOne)
101
100
  ];
102
- e.type === "CREATE" ? n.push(a.value) : e.type === "REMOVE" && n.pop(), t.edit(
101
+ e.type === "CREATE" ? r.push(a.value) : e.type === "REMOVE" && r.pop(), t.edit(
103
102
  s.value.uid,
104
103
  a.pathMinusOne,
105
- n
104
+ r
106
105
  );
107
106
  } else {
108
107
  const a = m(b, e);
@@ -114,90 +113,90 @@ const x = (e, s = []) => {
114
113
  );
115
114
  }
116
115
  return !0;
117
- }, T = (e, s) => {
118
- const { requests: t, requestExamples: a, requestExampleMutators: n } = s, r = t[e];
119
- r == null || r.examples.forEach((u) => {
120
- const l = H(
121
- r,
116
+ }, Z = (e, s) => {
117
+ const { requests: t, requestExamples: a, requestExampleMutators: r } = s, n = t[e];
118
+ n == null || n.examples.forEach((u) => {
119
+ const l = D(
120
+ n,
122
121
  a[u].name
123
122
  );
124
- l && n.set({
123
+ l && r.set({
125
124
  ...l,
126
125
  uid: u
127
126
  });
128
127
  });
129
128
  }, L = (e, { activeCollection: s }, t) => {
130
129
  if (!s.value) return !1;
131
- const { requests: a, requestMutators: n } = t, [, r, u, ...l] = e.path;
132
- if (r === "path" && e.type === "CHANGE")
130
+ const { requests: a, requestMutators: r } = t, [, n, u, ...l] = e.path;
131
+ if (n === "path" && e.type === "CHANGE")
133
132
  s.value.requests.forEach((p) => {
134
- a[p].path === e.oldValue && n.edit(p, "path", e.value);
133
+ a[p].path === e.oldValue && r.edit(p, "path", e.value);
135
134
  });
136
135
  else if (u === "method" && e.type === "CHANGE")
137
136
  s.value.requests.forEach((p) => {
138
- a[p].method === e.oldValue && a[p].path === r && n.edit(p, "method", e.value);
137
+ a[p].method === e.oldValue && a[p].path === n && r.edit(p, "method", e.value);
139
138
  });
140
139
  else if (e.type !== "CHANGE" && typeof l.at(-1) == "number") {
141
140
  const p = v(
142
141
  s.value.requests,
143
142
  a,
144
- (c) => c.path === r && c.method === u
143
+ (c) => c.path === n && c.method === u
145
144
  ), o = m(O, {
146
145
  ...e,
147
146
  path: e.path.slice(3)
148
147
  });
149
148
  if (!p || !o) return !1;
150
- const h = [...Z(p, o.pathMinusOne)];
151
- e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(), n.edit(p.uid, o.pathMinusOne, h), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, t);
149
+ const h = [...N(p, o.pathMinusOne)];
150
+ e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(), r.edit(p.uid, o.pathMinusOne, h), (e.path[3] === "parameters" || e.path[3] === "requestBody") && Z(p.uid, t);
152
151
  } else if (e.type === "CREATE") {
153
- const [[p, o]] = Object.entries(e.value), h = u ? e.value : o, c = u || p, y = V.array().parse(h.servers ?? []), { security: f, ...N } = h, g = {
154
- ...N,
155
- method: D(c) ? c : "get",
156
- path: r,
152
+ const [[p, o]] = Object.entries(e.value), h = u ? e.value : o, c = u || p, y = V.array().parse(h.servers ?? []), { security: E, ...T } = h, g = {
153
+ ...T,
154
+ method: H(c) ? c : "get",
155
+ path: n,
157
156
  parameters: h.parameters ?? [],
158
- servers: y.map((E) => E.uid)
157
+ servers: y.map((f) => f.uid)
159
158
  };
160
- f != null && f.length && (g.security = f.map((E) => {
161
- if (Object.keys(E).length) {
162
- const [A] = Object.keys(E);
159
+ E != null && E.length && (g.security = E.map((f) => {
160
+ if (Object.keys(f).length) {
161
+ const [A] = Object.keys(f);
163
162
  return {
164
- [A]: E[A]
163
+ [A]: f[A]
165
164
  };
166
- } else return E;
165
+ } else return f;
167
166
  }));
168
167
  const q = R(g, O, !1);
169
168
  if (!q) return !1;
170
- n.add(q, s.value.uid);
169
+ r.add(q, s.value.uid);
171
170
  } else if (e.type === "REMOVE") {
172
171
  const p = v(
173
172
  s.value.requests,
174
173
  a,
175
- (o) => o.path === r && o.method === u
174
+ (o) => o.path === n && o.method === u
176
175
  );
177
176
  if (!p) return !1;
178
- n.delete(p, s.value.uid);
177
+ r.delete(p, s.value.uid);
179
178
  } else if (e.type === "CHANGE") {
180
179
  const p = v(
181
180
  s.value.requests,
182
181
  a,
183
- (h) => h.path === r && h.method === u
182
+ (h) => h.path === n && h.method === u
184
183
  ), o = m(O, { ...e, path: l });
185
184
  if (!p || !o) return !1;
186
- n.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, t);
185
+ r.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && Z(p.uid, t);
187
186
  }
188
187
  return !0;
189
- }, W = (e, { activeCollection: s }, { servers: t, serverMutators: a }) => {
188
+ }, P = (e, { activeCollection: s }, { servers: t, serverMutators: a }) => {
190
189
  if (!s.value) return !1;
191
- const [, n, ...r] = e.path;
192
- if (r != null && r.length) {
193
- const u = s.value.servers[n], l = t[u], p = m(V, { ...e, path: r });
190
+ const [, r, ...n] = e.path;
191
+ if (n != null && n.length) {
192
+ const u = s.value.servers[r], l = t[u], p = m(V, { ...e, path: n });
194
193
  if (!l || !p) return !1;
195
- const h = e.type === "REMOVE" && r[r.length - 1] === "variables" ? {} : p.value;
194
+ const h = e.type === "REMOVE" && n[n.length - 1] === "variables" ? {} : p.value;
196
195
  a.edit(u, p.path, h);
197
196
  } else if (e.type === "REMOVE") {
198
- if (!s.value.servers[n]) return !1;
197
+ if (!s.value.servers[r]) return !1;
199
198
  a.delete(
200
- s.value.servers[n],
199
+ s.value.servers[r],
201
200
  s.value.uid
202
201
  );
203
202
  } else if (e.type === "CREATE") {
@@ -206,15 +205,15 @@ const x = (e, s = []) => {
206
205
  a.add(u, s.value.uid);
207
206
  }
208
207
  return !0;
209
- }, I = (e, { activeCollection: s }, { tags: t, tagMutators: a }) => {
208
+ }, W = (e, { activeCollection: s }, { tags: t, tagMutators: a }) => {
210
209
  if (!s.value) return !1;
211
- const [, n, ...r] = e.path;
212
- if (r != null && r.length) {
213
- const u = s.value.tags[n], l = t[u], p = m(M, { ...e, path: r });
210
+ const [, r, ...n] = e.path;
211
+ if (n != null && n.length) {
212
+ const u = s.value.tags[r], l = t[u], p = m(M, { ...e, path: n });
214
213
  if (!l || !p) return !1;
215
214
  a.edit(u, p.path, p.value);
216
215
  } else if (e.type === "REMOVE") {
217
- const u = s.value.tags[n], l = t[u];
216
+ const u = s.value.tags[r], l = t[u];
218
217
  if (!l) return !1;
219
218
  a.delete(l, s.value.uid);
220
219
  } else if (e.type === "CREATE") {
@@ -226,22 +225,22 @@ const x = (e, s = []) => {
226
225
  }, w = (e, s, t) => {
227
226
  const a = d(e);
228
227
  if (a instanceof i.ZodUnion || a instanceof i.ZodDiscriminatedUnion) {
229
- for (const n of a.options)
230
- if (n instanceof i.ZodObject && s in n.shape && n.shape[s] instanceof i.ZodLiteral && n.shape[s].value === t)
231
- return n;
228
+ for (const r of a.options)
229
+ if (r instanceof i.ZodObject && s in r.shape && r.shape[s] instanceof i.ZodLiteral && r.shape[s].value === t)
230
+ return r;
232
231
  }
233
232
  return null;
234
- }, J = (e, { activeCollection: s }, { securitySchemes: t, securitySchemeMutators: a }) => {
233
+ }, I = (e, { activeCollection: s }, { securitySchemes: t, securitySchemeMutators: a }) => {
235
234
  if (!s.value) return !1;
236
- const [, , n, ...r] = e.path, u = t[n] ?? v(
235
+ const [, , r, ...n] = e.path, u = t[r] ?? v(
237
236
  s.value.securitySchemes,
238
237
  t,
239
- (l) => l.nameKey === n
238
+ (l) => l.nameKey === r
240
239
  );
241
- if (r != null && r.length) {
240
+ if (n != null && n.length) {
242
241
  const l = w(S, "type", u == null ? void 0 : u.type);
243
242
  if (!l) return !1;
244
- const p = m(l, { ...e, path: r });
243
+ const p = m(l, { ...e, path: n });
245
244
  if (!p) return !1;
246
245
  const o = p.path;
247
246
  a.edit(u.uid, o, p.value);
@@ -259,9 +258,9 @@ export {
259
258
  v as findResource,
260
259
  K as mutateCollectionDiff,
261
260
  L as mutateRequestDiff,
262
- J as mutateSecuritySchemeDiff,
263
- W as mutateServerDiff,
264
- I as mutateTagDiff,
261
+ I as mutateSecuritySchemeDiff,
262
+ P as mutateServerDiff,
263
+ W as mutateTagDiff,
265
264
  w as narrowUnionSchema,
266
265
  m as parseDiff,
267
266
  G as traverseZodSchema