@scalar/api-client 2.0.20 → 2.0.22

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.0.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 45b956f: fix: only add body data if body data is not null
8
+
9
+ ## 2.0.21
10
+
11
+ ### Patch Changes
12
+
13
+ - d48e4ac: fix: update active body when content type changes
14
+
3
15
  ## 2.0.20
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -57,31 +57,28 @@ await createApiClientApp(document.getElementById('scalar-client'), {
57
57
  Or you can mount a more compact version, which is living in a modal:
58
58
 
59
59
  ```ts
60
- import { createApiClientModal } from '@scalar/api-client'
61
-
62
- const targetElement = document.getElementById('root')
60
+ // main.js
61
+ import { createApiClientApp } from '@/App'
63
62
 
64
63
  // Initialize
65
- const { open } = await createApiClientModal(targetElement, {
66
- spec: {
67
- // Load a spec from URL
68
- url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.json',
69
- // OR the spec directly
70
- content: {
71
- ...
72
- }
64
+ const { open } = await createApiClientApp(
65
+ document.getElementById('scalar-client'),
66
+ {
67
+ spec: {
68
+ url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.json',
69
+ },
70
+ proxyUrl: 'https://proxy.scalar.com',
73
71
  },
74
- proxyUrl: 'https://proxy.scalar.com',
75
- })
72
+ )
76
73
 
77
74
  // Open the API client right-away
78
75
  open()
79
76
 
80
77
  // Or: Open a specific operation
81
- open({
82
- method: 'GET',
83
- path: '/me',
84
- })
78
+ // open({
79
+ // method: 'GET',
80
+ // path: '/me',
81
+ // })
85
82
  ```
86
83
 
87
84
  ## Configuration
@@ -1 +1 @@
1
- {"version":3,"file":"SearchModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Search/SearchModal.vue"],"names":[],"mappings":"AAgPA,OAAO,EACL,KAAK,UAAU,EAKhB,MAAM,oBAAoB,CAAA;;gBASb,UAAU;;gBAAV,UAAU;;AAsVxB,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"SearchModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Search/SearchModal.vue"],"names":[],"mappings":"AAgPA,OAAO,EACL,KAAK,UAAU,EAKhB,MAAM,oBAAoB,CAAA;;gBASb,UAAU;;gBAAV,UAAU;;AA8VxB,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sendRequest.d.ts","sourceRoot":"","sources":["../../src/libs/sendRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACrB,MAAM,+CAA+C,CAAA;AACtD,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EAEd,gBAAgB,EACjB,MAAM,2CAA2C,CAAA;AAkBlD;;;GAGG;AACH,eAAO,MAAM,WAAW,YACb,OAAO,WACP,cAAc,UACf,MAAM,mBACG;IACf,MAAM,EAAE,cAAc,CAAA;IACtB,IAAI,CAAC,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAA;CACpC,aACU,MAAM,KAChB,OAAO,CAAC;IACT,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAC5B,CA0LA,CAAA"}
1
+ {"version":3,"file":"sendRequest.d.ts","sourceRoot":"","sources":["../../src/libs/sendRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACrB,MAAM,+CAA+C,CAAA;AACtD,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EAEd,gBAAgB,EACjB,MAAM,2CAA2C,CAAA;AAkBlD;;;GAGG;AACH,eAAO,MAAM,WAAW,YACb,OAAO,WACP,cAAc,UACf,MAAM,mBACG;IACf,MAAM,EAAE,cAAc,CAAA;IACtB,IAAI,CAAC,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAA;CACpC,aACU,MAAM,KAChB,OAAO,CAAC;IACT,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAC5B,CA2LA,CAAA"}
@@ -1,23 +1,23 @@
1
1
  import { redirectToProxy as A, shouldUseProxy as C } from "@scalar/oas-utils/helpers";
2
2
  import E from "axios";
3
3
  import R from "js-cookie";
4
- const c = (d = []) => d.reduce(
4
+ const u = (c = []) => c.reduce(
5
5
  (o, i) => (i.key && (o[i.key] = i.value), o),
6
6
  {}
7
- ), g = async (d, o, i, s, y) => {
8
- var w;
9
- let n = i;
7
+ ), g = async (c, o, i, s, y) => {
8
+ var k;
9
+ let a = i;
10
10
  o.parameters.path.forEach((e) => {
11
- !e.key || !e.value || (n = n.replace(`{${e.key}}`, e.value));
11
+ !e.key || !e.value || (a = a.replace(`{${e.key}}`, e.value));
12
12
  });
13
- const r = c(
13
+ const r = u(
14
14
  o.parameters.headers.filter(({ enabled: e }) => e)
15
15
  );
16
- let u = null;
16
+ let d = null;
17
17
  if (o.body.activeBody === "binary" && o.body.binary)
18
- r["Content-Type"] = o.body.binary.type, r["Content-Disposition"] = `attachment; filename="${o.body.binary.name}"`, u = o.body.binary;
19
- else if (o.body.activeBody === "raw")
20
- u = o.body.raw.value;
18
+ r["Content-Type"] = o.body.binary.type, r["Content-Disposition"] = `attachment; filename="${o.body.binary.name}"`, d = o.body.binary;
19
+ else if (o.body.activeBody === "raw" && o.body.raw.value)
20
+ d = o.body.raw.value;
21
21
  else if (o.body.activeBody === "formData") {
22
22
  r["Content-Type"] = "multipart/form-data";
23
23
  const e = new FormData();
@@ -25,23 +25,23 @@ const c = (d = []) => d.reduce(
25
25
  (t) => {
26
26
  t.key && t.value ? e.append(t.key, t.value) : t.file && e.append(t.file.name, t.file);
27
27
  }
28
- ), u = e);
28
+ ), d = e);
29
29
  }
30
- const f = [], [k, p] = n.split("?");
31
- new URLSearchParams(p ?? "").forEach((e, t) => {
30
+ const f = [], [p, D] = a.split("?");
31
+ new URLSearchParams(D ?? "").forEach((e, t) => {
32
32
  f.push({
33
33
  key: t,
34
34
  value: e,
35
35
  enabled: !0
36
36
  });
37
37
  });
38
- const h = {
39
- ...c(
38
+ const b = {
39
+ ...u(
40
40
  o.parameters.query.filter(({ enabled: e }) => e).filter(({ value: e }) => e !== "")
41
41
  ),
42
- ...c(f)
42
+ ...u(f)
43
43
  }, l = {
44
- ...c(
44
+ ...u(
45
45
  (o.parameters.cookies ?? []).filter(({ enabled: e }) => e)
46
46
  )
47
47
  };
@@ -53,13 +53,13 @@ const c = (d = []) => d.reduce(
53
53
  l[e.name] = e.value;
54
54
  break;
55
55
  case "query":
56
- h[e.name] = e.value;
56
+ b[e.name] = e.value;
57
57
  break;
58
58
  case "header":
59
59
  r[e.name] = e.value;
60
60
  break;
61
61
  }
62
- else e.type === "http" && e.value ? e.scheme === "basic" && e.secondValue ? r.Authorization = `Basic ${btoa(`${e.value}:${e.secondValue}`)}` : r.Authorization = `Bearer ${e.value}` : e.type === "oauth2" && ((w = s.flow) != null && w.token) && (r.Authorization = `Bearer ${s.flow.token}`);
62
+ else e.type === "http" && e.value ? e.scheme === "basic" && e.secondValue ? r.Authorization = `Basic ${btoa(`${e.value}:${e.secondValue}`)}` : r.Authorization = `Bearer ${e.value}` : e.type === "oauth2" && ((k = s.flow) != null && k.token) && (r.Authorization = `Bearer ${s.flow.token}`);
63
63
  }
64
64
  Object.keys(l).forEach((e) => {
65
65
  R.set(e, l[e], {
@@ -69,37 +69,38 @@ const c = (d = []) => d.reduce(
69
69
  secure: !0
70
70
  });
71
71
  });
72
- const b = new URLSearchParams(h).toString();
73
- n = `${k}${b ? "?" + b : ""}`;
74
- const D = {
75
- url: A(y, n),
76
- method: d.method,
77
- headers: r,
78
- data: u
79
- }, v = Date.now();
72
+ const h = new URLSearchParams(b).toString();
73
+ a = `${p}${h ? "?" + h : ""}`;
74
+ const v = {
75
+ url: A(y, a),
76
+ method: c.method,
77
+ headers: r
78
+ };
79
+ d && (v.data = d);
80
+ const w = Date.now();
80
81
  try {
81
- const e = await E(D);
82
- return C(y, n) && [
82
+ const e = await E(v);
83
+ return C(y, a) && [
83
84
  "Access-Control-Allow-Headers",
84
85
  "Access-Control-Allow-Origin",
85
86
  "Access-Control-Allow-Methods",
86
87
  "Access-Control-Expose-Headers"
87
- ].map((a) => a.toLowerCase()).forEach((a) => delete e.headers[a]), {
88
+ ].map((n) => n.toLowerCase()).forEach((n) => delete e.headers[n]), {
88
89
  sentTime: Date.now(),
89
90
  request: o,
90
91
  response: {
91
92
  ...e,
92
- duration: Date.now() - v
93
+ duration: Date.now() - w
93
94
  }
94
95
  };
95
96
  } catch (e) {
96
- const a = e.response;
97
+ const n = e.response;
97
98
  return console.error("ERROR", e), {
98
99
  sentTime: Date.now(),
99
100
  request: o,
100
- response: a ? {
101
- ...a,
102
- duration: Date.now() - v
101
+ response: n ? {
102
+ ...n,
103
+ duration: Date.now() - w
103
104
  } : void 0
104
105
  };
105
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RequestBody.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestBody.vue"],"names":[],"mappings":";WAobS,MAAM;WACN,MAAM;eACF,GAAG,EAAE;;WAFT,MAAM;WACN,MAAM;eACF,GAAG,EAAE;;AAkwBlB,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"RequestBody.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestBody.vue"],"names":[],"mappings":";WAucS,MAAM;WACN,MAAM;eACF,GAAG,EAAE;;WAFT,MAAM;WACN,MAAM;eACF,GAAG,EAAE;;AAqxBlB,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,36 +1,36 @@
1
- import { defineComponent as Y, ref as T, computed as _, watch as N, openBlock as r, createBlock as f, withCtx as u, createTextVNode as V, toDisplayString as w, createElementBlock as v, Fragment as j, createVNode as i, unref as s, createElementVNode as y, nextTick as G } from "vue";
2
- import H from "../../../components/CodeInput/CodeInput.vue.js";
3
- import K from "../../../components/DataTable/DataTable.vue.js";
4
- import Q from "../../../components/DataTable/DataTableHeader.vue.js";
5
- import R from "../../../components/DataTable/DataTableRow.vue.js";
6
- import Z from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
7
- import { useWorkspace as I } from "../../../store/workspace.js";
8
- import { ScalarListbox as ee, ScalarButton as D, ScalarIcon as q } from "@scalar/components";
1
+ import { defineComponent as G, ref as T, computed as _, watch as N, openBlock as r, createBlock as f, withCtx as u, createTextVNode as V, toDisplayString as k, createElementBlock as v, Fragment as j, createVNode as d, unref as i, createElementVNode as y, nextTick as H } from "vue";
2
+ import K from "../../../components/CodeInput/CodeInput.vue.js";
3
+ import Q from "../../../components/DataTable/DataTable.vue.js";
4
+ import Z from "../../../components/DataTable/DataTableHeader.vue.js";
5
+ import D from "../../../components/DataTable/DataTableRow.vue.js";
6
+ import I from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
7
+ import { useWorkspace as ee } from "../../../store/workspace.js";
8
+ import { ScalarListbox as te, ScalarButton as F, ScalarIcon as q } from "@scalar/components";
9
9
  import { createRequestExampleParameter as S } from "@scalar/oas-utils/entities/workspace/spec";
10
10
  import L from "./RequestTable.vue.js";
11
11
  import { useFileDialog as W } from "../../../hooks/useFileDialog.js";
12
- const te = {
12
+ const ae = {
13
13
  key: 0,
14
14
  class: "text-c-3 flex min-h-14 w-full items-center justify-center rounded border border-dashed text-center text-base"
15
- }, ae = /* @__PURE__ */ y("span", null, "No Body", -1), oe = [
16
- ae
17
- ], le = {
15
+ }, oe = /* @__PURE__ */ y("span", null, "No Body", -1), le = [
16
+ oe
17
+ ], ne = {
18
18
  key: 0,
19
19
  class: "text-c-3 flex min-h-10 w-full items-center justify-center p-2 text-sm"
20
- }, ne = /* @__PURE__ */ y("span", null, "No Body", -1), re = [
21
- ne
22
- ], ue = {
20
+ }, re = /* @__PURE__ */ y("span", null, "No Body", -1), ue = [
21
+ re
22
+ ], ie = {
23
23
  key: 1,
24
24
  class: "flex items-center justify-center p-1.5 overflow-hidden"
25
- }, se = { class: "text-c-2 text-xs w-full border rounded p-1 max-w-full overflow-hidden whitespace-nowrap" }, ie = /* @__PURE__ */ y("span", null, "Upload File", -1), we = /* @__PURE__ */ Y({
25
+ }, se = { class: "text-c-2 text-xs w-full border rounded p-1 max-w-full overflow-hidden whitespace-nowrap" }, de = /* @__PURE__ */ y("span", null, "Upload File", -1), De = /* @__PURE__ */ G({
26
26
  __name: "RequestBody",
27
27
  props: {
28
28
  title: {},
29
29
  body: {},
30
30
  formData: {}
31
31
  },
32
- setup(de) {
33
- const M = {
32
+ setup(ce) {
33
+ const A = {
34
34
  multipartForm: "Multipart Form",
35
35
  formUrlEncoded: "Form URL Encoded",
36
36
  binaryFile: "Binary File",
@@ -40,39 +40,39 @@ const te = {
40
40
  edn: "EDN",
41
41
  other: "Other",
42
42
  none: "None"
43
- }, { activeRequest: m, activeExample: t, requestExampleMutators: d } = I(), n = T("none"), b = T(null), O = {
43
+ }, { activeRequest: m, activeExample: t, requestExampleMutators: s } = ee(), n = T("none"), b = T(null), M = {
44
44
  json: "json",
45
45
  xml: "xml",
46
46
  yaml: "yaml",
47
47
  edn: "edn",
48
48
  other: "html"
49
- }, z = _(() => {
49
+ }, O = _(() => {
50
50
  const e = n.value;
51
- return O[e] ?? "plaintext";
51
+ return M[e] ?? "plaintext";
52
52
  });
53
- function F() {
53
+ function R() {
54
54
  console.log("deleteRow");
55
55
  }
56
- const U = (e, o, a) => {
56
+ const U = (e, a, o) => {
57
57
  if (!m.value || !t.value) return;
58
58
  const c = p.value;
59
59
  if (c.length > e) {
60
60
  const l = [...c];
61
- l[e] = { ...l[e], [o]: a }, (l[e].key !== "" || l[e].value !== "") && (l[e].enabled = !0), l[e].key === "" && l[e].value === "" && l.splice(e, 1), d.edit(
61
+ l[e] = { ...l[e], [a]: o }, (l[e].key !== "" || l[e].value !== "") && (l[e].enabled = !0), l[e].key === "" && l[e].value === "" && l.splice(e, 1), s.edit(
62
62
  t.value.uid,
63
63
  "body.formData.value",
64
64
  l
65
65
  );
66
66
  } else {
67
- const l = [S({ [o]: a })];
68
- d.edit(
67
+ const l = [S({ [a]: o })];
68
+ s.edit(
69
69
  t.value.uid,
70
70
  "body.formData.value",
71
71
  l
72
- ), G(() => {
73
- var E;
72
+ ), H(() => {
73
+ var C;
74
74
  if (!b.value) return;
75
- (E = b.value.querySelectorAll("input")[o === "key" ? 0 : 1]) == null || E.focus();
75
+ (C = b.value.querySelectorAll("input")[a === "key" ? 0 : 1]) == null || C.focus();
76
76
  });
77
77
  }
78
78
  }, p = _(
@@ -81,35 +81,42 @@ const te = {
81
81
  return ((e = t.value) == null ? void 0 : e.body.formData.value) ?? [];
82
82
  }
83
83
  );
84
- function A() {
84
+ function z() {
85
85
  p.value.length === 0 && x();
86
86
  }
87
87
  const x = () => {
88
88
  if (!m.value || !t.value) return;
89
89
  const e = S({
90
90
  enabled: !1
91
- }), o = [...p.value, e];
92
- d.edit(
91
+ }), a = [...p.value, e];
92
+ s.edit(
93
93
  t.value.uid,
94
94
  "body.formData.value",
95
- o
95
+ a
96
96
  );
97
97
  }, $ = (e) => {
98
- !m.value || !t.value || d.edit(
98
+ !m.value || !t.value || s.edit(
99
99
  t.value.uid,
100
100
  "body.raw.value",
101
101
  e
102
102
  );
103
+ }, J = (e) => {
104
+ let a = "raw";
105
+ e === "multipartForm" || e === "formUrlEncoded" ? a = "formData" : e === "binaryFile" ? a = "binary" : a = "raw", s.edit(
106
+ t.value.uid,
107
+ "body.activeBody",
108
+ a
109
+ );
103
110
  }, B = async (e) => {
104
- const { open: o } = W({
105
- onChange: async (a) => {
106
- const c = a == null ? void 0 : a[0];
111
+ const { open: a } = W({
112
+ onChange: async (o) => {
113
+ const c = o == null ? void 0 : o[0];
107
114
  if (c && m.value && t.value) {
108
115
  const h = [...p.value];
109
116
  h[e] = {
110
117
  ...h[e],
111
118
  file: c
112
- }, d.edit(
119
+ }, s.edit(
113
120
  t.value.uid,
114
121
  "body.formData.value",
115
122
  h
@@ -119,31 +126,31 @@ const te = {
119
126
  multiple: !1,
120
127
  accept: "*/*"
121
128
  });
122
- o();
129
+ a();
123
130
  };
124
- function J() {
125
- !m.value || !t.value || d.edit(t.value.uid, "body.binary", void 0);
131
+ function X() {
132
+ !m.value || !t.value || s.edit(t.value.uid, "body.binary", void 0);
126
133
  }
127
- function P(e) {
134
+ function E(e) {
128
135
  if (!m.value || !t.value) return;
129
- const a = [...p.value];
130
- a[e] = {
131
- ...a[e],
136
+ const o = [...p.value];
137
+ o[e] = {
138
+ ...o[e],
132
139
  file: void 0
133
- }, d.edit(
140
+ }, s.edit(
134
141
  t.value.uid,
135
142
  "body.formData.value",
136
- a
143
+ o
137
144
  );
138
145
  }
139
- function X() {
146
+ function Y() {
140
147
  const { open: e } = W({
141
- onChange: async (o) => {
142
- const a = o == null ? void 0 : o[0];
143
- a && m.value && t.value && d.edit(
148
+ onChange: async (a) => {
149
+ const o = a == null ? void 0 : a[0];
150
+ o && m.value && t.value && s.edit(
144
151
  t.value.uid,
145
152
  "body.binary",
146
- a
153
+ o
147
154
  );
148
155
  },
149
156
  multiple: !1,
@@ -151,20 +158,20 @@ const te = {
151
158
  });
152
159
  e();
153
160
  }
154
- const C = Object.entries(M).map(
155
- ([e, o]) => ({
161
+ const P = Object.entries(A).map(
162
+ ([e, a]) => ({
156
163
  id: e,
157
- label: o,
164
+ label: a,
158
165
  value: e
159
166
  })
160
167
  ), g = _({
161
- get: () => C.find((e) => e.id === n.value),
168
+ get: () => P.find((e) => e.id === n.value),
162
169
  set: (e) => {
163
170
  e != null && e.id && (n.value = e.id);
164
171
  }
165
- }), k = _(() => t.value ? t.value.body.formData && t.value.body.formData.value.length > 0 ? "multipartForm" : t.value.body.raw && t.value.body.raw.value.trim() !== "" ? t.value.body.raw.encoding : n.value : "none");
166
- return k.value !== "none" && (n.value = k.value), N(
167
- k,
172
+ }), w = _(() => t.value ? t.value.body.formData && t.value.body.formData.value.length > 0 ? "multipartForm" : t.value.body.raw && t.value.body.raw.value.trim() !== "" ? t.value.body.raw.encoding : n.value : "none");
173
+ return w.value !== "none" && (n.value = w.value), N(
174
+ w,
168
175
  (e) => {
169
176
  e && (n.value = e);
170
177
  },
@@ -172,42 +179,42 @@ const te = {
172
179
  ), N(
173
180
  n,
174
181
  (e) => {
175
- (e === "multipartForm" || e === "formUrlEncoded") && A();
182
+ (e === "multipartForm" || e === "formUrlEncoded") && z(), J(e);
176
183
  },
177
184
  { immediate: !0 }
178
- ), (e, o) => (r(), f(Z, null, {
185
+ ), (e, a) => (r(), f(I, null, {
179
186
  title: u(() => [
180
- V(w(e.title), 1)
187
+ V(k(e.title), 1)
181
188
  ]),
182
189
  default: u(() => [
183
- e.body && e.body.length === 0 && e.formData && e.formData.length === 0 ? (r(), v("div", te, oe)) : e.formData && e.formData.length > 0 ? (r(), v(j, { key: 1 }, [], 64)) : (r(), f(K, {
190
+ e.body && e.body.length === 0 && e.formData && e.formData.length === 0 ? (r(), v("div", ae, le)) : e.formData && e.formData.length > 0 ? (r(), v(j, { key: 1 }, [], 64)) : (r(), f(Q, {
184
191
  key: 2,
185
192
  columns: [""]
186
193
  }, {
187
194
  default: u(() => [
188
- i(R, null, {
195
+ d(D, null, {
189
196
  default: u(() => [
190
- i(Q, { class: "relative col-span-full flex h-8 cursor-pointer items-center px-[2.25px] py-[2.25px]" }, {
197
+ d(Z, { class: "relative col-span-full flex h-8 cursor-pointer items-center px-[2.25px] py-[2.25px]" }, {
191
198
  default: u(() => [
192
- i(s(ee), {
199
+ d(i(te), {
193
200
  modelValue: g.value,
194
- "onUpdate:modelValue": o[0] || (o[0] = (a) => g.value = a),
201
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => g.value = o),
195
202
  class: "text-xxs w-full",
196
203
  fullWidth: "",
197
- options: s(C),
204
+ options: i(P),
198
205
  teleport: ""
199
206
  }, {
200
207
  default: u(() => [
201
- i(s(D), {
208
+ d(i(F), {
202
209
  class: "flex gap-1.5 h-auto px-1.5 text-c-2 font-normal hover:text-c-1",
203
210
  fullWidth: "",
204
211
  variant: "ghost"
205
212
  }, {
206
213
  default: u(() => {
207
- var a;
214
+ var o;
208
215
  return [
209
- y("span", null, w((a = g.value) == null ? void 0 : a.label), 1),
210
- i(s(q), {
216
+ y("span", null, k((o = g.value) == null ? void 0 : o.label), 1),
217
+ d(i(q), {
211
218
  class: "stroke-[1]",
212
219
  icon: "ChevronDown",
213
220
  size: "xs"
@@ -225,34 +232,34 @@ const te = {
225
232
  ]),
226
233
  _: 1
227
234
  }),
228
- i(R, null, {
235
+ d(D, null, {
229
236
  default: u(() => {
230
- var a, c, l;
237
+ var o, c, l;
231
238
  return [
232
- n.value === "none" ? (r(), v("div", le, re)) : n.value === "binaryFile" ? (r(), v("div", ue, [
233
- (a = s(t)) != null && a.body.binary ? (r(), v(j, { key: 0 }, [
234
- y("span", se, w((c = s(t)) == null ? void 0 : c.body.binary.name), 1),
235
- i(s(D), {
239
+ n.value === "none" ? (r(), v("div", ne, ue)) : n.value === "binaryFile" ? (r(), v("div", ie, [
240
+ (o = i(t)) != null && o.body.binary ? (r(), v(j, { key: 0 }, [
241
+ y("span", se, k((c = i(t)) == null ? void 0 : c.body.binary.name), 1),
242
+ d(i(F), {
236
243
  class: "bg-b-2 hover:bg-b-3 border-0 text-c-2 ml-1",
237
244
  size: "sm",
238
245
  variant: "outlined",
239
- onClick: J
246
+ onClick: X
240
247
  }, {
241
248
  default: u(() => [
242
249
  V(" Delete ")
243
250
  ]),
244
251
  _: 1
245
252
  })
246
- ], 64)) : (r(), f(s(D), {
253
+ ], 64)) : (r(), f(i(F), {
247
254
  key: 1,
248
255
  class: "bg-b-2 hover:bg-b-3 border-0 text-c-2",
249
256
  size: "sm",
250
257
  variant: "outlined",
251
- onClick: X
258
+ onClick: Y
252
259
  }, {
253
260
  default: u(() => [
254
- ie,
255
- i(s(q), {
261
+ de,
262
+ d(i(q), {
256
263
  class: "ml-1 stroke-[2.5]",
257
264
  icon: "UploadSimple",
258
265
  size: "xs"
@@ -269,8 +276,8 @@ const te = {
269
276
  items: p.value,
270
277
  showUploadButton: "",
271
278
  onAddRow: x,
272
- onDeleteRow: F,
273
- onRemoveFile: P,
279
+ onDeleteRow: R,
280
+ onRemoveFile: E,
274
281
  onUpdateRow: U,
275
282
  onUploadFile: B
276
283
  }, null, 8, ["items"])) : n.value == "formUrlEncoded" ? (r(), f(L, {
@@ -282,24 +289,24 @@ const te = {
282
289
  items: p.value,
283
290
  showUploadButton: "",
284
291
  onAddRow: x,
285
- onDeleteRow: F,
286
- onRemoveFile: P,
292
+ onDeleteRow: R,
293
+ onRemoveFile: E,
287
294
  onUpdateRow: U,
288
295
  onUploadFile: B
289
- }, null, 8, ["items"])) : (r(), f(H, {
296
+ }, null, 8, ["items"])) : (r(), f(K, {
290
297
  key: 4,
291
298
  content: "",
292
- language: z.value,
299
+ language: O.value,
293
300
  lineNumbers: "",
294
301
  lint: "",
295
- modelValue: ((l = s(t)) == null ? void 0 : l.body.raw.value) ?? "",
302
+ modelValue: ((l = i(t)) == null ? void 0 : l.body.raw.value) ?? "",
296
303
  "onUpdate:modelValue": $
297
304
  }, null, 8, ["language", "modelValue"]))
298
305
  ];
299
306
  }),
300
307
  _: 1
301
308
  }),
302
- i(R)
309
+ d(D)
303
310
  ]),
304
311
  _: 1
305
312
  }))
@@ -309,5 +316,5 @@ const te = {
309
316
  }
310
317
  });
311
318
  export {
312
- we as default
319
+ De as default
313
320
  };
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.0.20",
21
+ "version": "2.0.22",
22
22
  "engines": {
23
23
  "node": ">=18"
24
24
  },
@@ -111,13 +111,13 @@
111
111
  "nanoid": "^5.0.7",
112
112
  "pretty-bytes": "^6.1.1",
113
113
  "pretty-ms": "^8.0.0",
114
- "vue": "^3.4.22",
114
+ "vue": "^3.4.29",
115
115
  "vue-router": "^4.3.0",
116
116
  "zod": "^3.22.4",
117
117
  "@scalar/components": "0.12.14",
118
118
  "@scalar/draggable": "0.1.3",
119
- "@scalar/oas-utils": "0.2.13",
120
119
  "@scalar/themes": "0.9.13",
120
+ "@scalar/oas-utils": "0.2.13",
121
121
  "@scalar/object-utils": "1.1.4",
122
122
  "@scalar/use-codemirror": "0.11.6",
123
123
  "@scalar/use-toasts": "0.7.4",