@scalar/api-client 2.0.40 → 2.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,72 +1,73 @@
1
- import { defineComponent as te, ref as oe, watch as re, onMounted as se, onBeforeUnmount as ie, openBlock as x, createElementBlock as S, Fragment as V, createElementVNode as h, normalizeClass as y, createVNode as n, unref as l, createCommentVNode as U, withCtx as v, withDirectives as le, createSlots as ae, withModifiers as $, renderList as ne, createBlock as C, createTextVNode as de, vShow as ce, pushScopeId as ue, popScopeId as me } from "vue";
2
- import fe from "../../components/AddressBar/AddressBar.vue.js";
3
- import pe from "../../components/Search/SearchButton.vue.js";
4
- import ve from "../../components/Search/SearchModal.vue.js";
5
- import he from "../../components/Sidebar/SidebarButton.vue.js";
1
+ import { defineComponent as oe, ref as re, watch as se, onMounted as ie, onBeforeUnmount as le, openBlock as b, createElementBlock as S, Fragment as V, createElementVNode as h, normalizeClass as x, createVNode as n, unref as i, createCommentVNode as U, withCtx as v, withDirectives as ae, createSlots as ne, withModifiers as $, renderList as de, createBlock as R, createTextVNode as ce, vShow as ue, pushScopeId as me, popScopeId as fe } from "vue";
2
+ import pe from "../../components/AddressBar/AddressBar.vue.js";
3
+ import ve from "../../components/Search/SearchButton.vue.js";
4
+ import he from "../../components/Search/SearchModal.vue.js";
5
+ import be from "../../components/Sidebar/SidebarButton.vue.js";
6
6
  import xe from "../../components/Sidebar/SidebarToggle.vue.js";
7
- import be from "../../components/ViewLayout/ViewLayout.vue.js";
8
- import ge from "../../components/ViewLayout/ViewLayoutContent.vue.js";
7
+ import ge from "../../components/ViewLayout/ViewLayout.vue.js";
8
+ import ye from "../../components/ViewLayout/ViewLayoutContent.vue.js";
9
9
  import { commandPaletteBus as N } from "../../libs/eventBusses/command-palette.js";
10
- import { useWorkspace as _e } from "../../store/workspace.js";
11
- import we from "./RequestSection/RequestSection.vue.js";
10
+ import { useWorkspace as we } from "../../store/workspace.js";
11
+ import _e from "./RequestSection/RequestSection.vue.js";
12
12
  /* empty css */
13
- import ye from "./ResponseSection/ResponseSection.vue.js";
14
- import { useModal as ke, ScalarIcon as R } from "@scalar/components";
15
- import { REQUEST_METHODS as Se } from "@scalar/oas-utils/helpers";
13
+ import ke from "./ResponseSection/ResponseSection.vue.js";
14
+ import { useModal as Se, ScalarIcon as C } from "@scalar/components";
15
+ import { REQUEST_METHODS as Ue } from "@scalar/oas-utils/helpers";
16
16
  import { isMacOS as F } from "@scalar/use-tooltip";
17
- import { useMagicKeys as Ue, useEventListener as Ce } from "@vueuse/core";
18
- import Re from "./RequestSidebarItem.vue.js";
17
+ import { useMagicKeys as Re, useEventListener as Ce } from "@vueuse/core";
18
+ import Oe from "./RequestSidebarItem.vue.js";
19
19
  import De from "../../components/Sidebar/Sidebar.vue.js";
20
20
  /* empty css */
21
21
  import Me from "./components/WorkspaceDropdown.vue.js";
22
- import { useSidebar as Oe } from "../../hooks/useSidebar.js";
23
- import { sendRequest as Ee } from "../../libs/sendRequest.js";
22
+ import { useSidebar as qe } from "../../hooks/useSidebar.js";
23
+ import { sendRequest as Be } from "../../libs/sendRequest.js";
24
24
  import { executeRequestBus as P } from "../../libs/eventBusses/executeRequestBus.js";
25
- const qe = (g) => (ue("data-v-a88db4d1"), g = g(), me(), g), Be = { class: "lg:min-h-header flex items-center w-full justify-center p-1 flex-wrap t-app__top-container" }, Ie = { class: "flex flex-row items-center gap-1 lg:px-1 lg:mb-0 mb-0.5 lg:flex-1 w-6/12" }, Ve = /* @__PURE__ */ qe(() => /* @__PURE__ */ h("a", {
25
+ const Ee = (y) => (me("data-v-b7d1e57f"), y = y(), fe(), y), Ie = { class: "lg:min-h-header flex items-center w-full justify-center p-1 flex-wrap t-app__top-container" }, Ve = { class: "flex flex-row items-center gap-1 lg:px-1 lg:mb-0 mb-0.5 lg:flex-1 w-6/12" }, $e = /* @__PURE__ */ Ee(() => /* @__PURE__ */ h("a", {
26
26
  class: "text-c-2 text-sm font-medium gitbook-show ml-.5 hover:text-c-1 border p-1 rounded hover:bg-b-3",
27
27
  href: "https://scalar.com/",
28
28
  target: "_blank"
29
- }, " Powered by Scalar.com ", -1)), $e = { class: "flex flex-row items-center gap-1 lg:px-1 lg:mb-0 mb-0.5 lg:flex-1 justify-end w-6/12" }, at = /* @__PURE__ */ te({
29
+ }, " Powered by Scalar.com ", -1)), Ne = { class: "flex flex-row items-center gap-1 lg:px-1 lg:mb-0 mb-0.5 lg:flex-1 justify-end w-6/12" }, nt = /* @__PURE__ */ oe({
30
30
  __name: "Request",
31
- setup(g) {
31
+ setup(y) {
32
32
  var I;
33
33
  const {
34
- activeExample: _,
34
+ activeExample: w,
35
35
  activeRequest: u,
36
- activeSecuritySchemes: z,
36
+ activeSecuritySchemes: W,
37
37
  activeWorkspace: a,
38
- activeWorkspaceCollections: L,
39
- activeWorkspaceServers: T,
40
- collectionMutators: D,
38
+ activeWorkspaceCollections: z,
39
+ activeWorkspaceServers: L,
40
+ activeWorkspaceRequests: T,
41
+ collectionMutators: O,
41
42
  collections: m,
42
- cookies: W,
43
- environments: j,
44
- findRequestFolders: A,
45
- folders: b,
46
- folderMutators: M,
47
- modalState: H,
48
- requestMutators: J,
49
- workspaceMutators: O
50
- } = _e(), { collapsedSidebarFolders: K, setCollapsedSidebarFolder: Q } = Oe(), E = ke(), f = oe(!((I = a.value) != null && I.isReadOnly));
51
- re(
43
+ cookies: j,
44
+ environments: A,
45
+ findRequestFolders: H,
46
+ folders: g,
47
+ folderMutators: D,
48
+ modalState: J,
49
+ requestMutators: K,
50
+ workspaceMutators: M
51
+ } = we(), { collapsedSidebarFolders: Q, setCollapsedSidebarFolder: G } = qe(), q = Se(), f = re(!((I = a.value) != null && I.isReadOnly));
52
+ se(
52
53
  u,
53
54
  (e) => {
54
- e && A(e.uid).forEach(
55
- (t) => Q(t, !0)
55
+ e && H(e.uid).forEach(
56
+ (t) => G(t, !0)
56
57
  );
57
58
  },
58
59
  { immediate: !0 }
59
60
  );
60
- const q = async () => {
61
+ const B = async () => {
61
62
  var d;
62
- if (!u.value || !_.value) {
63
+ if (!u.value || !w.value) {
63
64
  console.warn(
64
65
  "There is no request active at the moment. Please select one then try again."
65
66
  );
66
67
  return;
67
68
  }
68
- let e = _.value.url;
69
- const t = Object.values(j).reduce(
69
+ let e = w.value.url;
70
+ const t = Object.values(A).reduce(
70
71
  (c, s) => {
71
72
  try {
72
73
  return { ...c, ...JSON.parse(s.raw) };
@@ -76,95 +77,95 @@ const qe = (g) => (ue("data-v-a88db4d1"), g = g(), me(), g), Be = { class: "lg:m
76
77
  },
77
78
  {}
78
79
  ), o = /\{\{(.*?)\}\}/g;
79
- e = e.replace(o, (c, s) => (T.value.forEach((p) => {
80
+ e = e.replace(o, (c, s) => (L.value.forEach((p) => {
80
81
  if (p.url === s)
81
82
  return s;
82
83
  }), t[s] || s));
83
- const { request: r, response: i } = await Ee(
84
+ const { request: r, response: l } = await Be(
84
85
  u.value,
85
- _.value,
86
+ w.value,
86
87
  e,
87
- z.value,
88
+ W.value,
88
89
  (d = a.value) == null ? void 0 : d.proxyUrl,
89
- W
90
+ j
90
91
  );
91
- r && i ? J.edit(u.value.uid, "history", [
92
+ r && l ? K.edit(u.value.uid, "history", [
92
93
  ...u.value.history,
93
94
  {
94
95
  request: r,
95
- response: i,
96
+ response: l,
96
97
  timestamp: Date.now()
97
98
  }
98
99
  ]) : console.warn("No response or request was returned");
99
100
  };
100
- se(() => P.on(q)), ie(() => P.off(q));
101
- const B = (e, t) => {
102
- m[e] ? D.edit(e, "childUids", t) : b[e] && M.edit(e, "childUids", t);
103
- }, G = (e, t) => {
101
+ ie(() => P.on(B)), le(() => P.off(B));
102
+ const E = (e, t) => {
103
+ m[e] ? O.edit(e, "childUids", t) : g[e] && D.edit(e, "childUids", t);
104
+ }, X = (e, t) => {
104
105
  if (!e || !t) return;
105
- const { id: o, parentId: r } = e, { id: i, parentId: d, offset: c } = t;
106
- if (r ? m[r] ? D.edit(
106
+ const { id: o, parentId: r } = e, { id: l, parentId: d, offset: c } = t;
107
+ if (r ? m[r] ? O.edit(
107
108
  r,
108
109
  "childUids",
109
110
  m[r].childUids.filter(
110
111
  (s) => s !== o
111
112
  )
112
- ) : b[r] && M.edit(
113
+ ) : g[r] && D.edit(
113
114
  r,
114
115
  "childUids",
115
- b[r].childUids.filter((s) => s !== o)
116
- ) : O.edit(
116
+ g[r].childUids.filter((s) => s !== o)
117
+ ) : M.edit(
117
118
  a.value.uid,
118
119
  "collectionUids",
119
120
  a.value.collectionUids.filter((s) => s !== o)
120
121
  ), c === 2) {
121
- const s = m[i] || b[i];
122
- B(i, [...s.childUids, o]);
122
+ const s = m[l] || g[l];
123
+ E(l, [...s.childUids, o]);
123
124
  } else if (d) {
124
- const p = [...(m[d] || b[d]).childUids], k = p.findIndex((ee) => i === ee) ?? 0;
125
- p.splice(k + c, 0, o), B(d, p);
125
+ const p = [...(m[d] || g[d]).childUids], k = p.findIndex((te) => l === te) ?? 0;
126
+ p.splice(k + c, 0, o), E(d, p);
126
127
  } else {
127
- const s = [...a.value.collectionUids], p = s.findIndex((k) => i === k) ?? 0;
128
- s.splice(p + c, 0, o), O.edit(
128
+ const s = [...a.value.collectionUids], p = s.findIndex((k) => l === k) ?? 0;
129
+ s.splice(p + c, 0, o), M.edit(
129
130
  a.value.uid,
130
131
  "collectionUids",
131
132
  s
132
133
  );
133
134
  }
134
- }, X = () => N.emit(), w = Ue();
135
+ }, Y = () => N.emit(), _ = Re();
135
136
  Ce(document, "keydown", (e) => {
136
- (F() ? w.meta.value : w.ctrl.value) && e.key === "b" && (f.value = !f.value), !a.value.isReadOnly && (F() ? w.meta.value : w.ctrl.value) && e.key === "k" && N.emit();
137
+ (F() ? _.meta.value : _.ctrl.value) && e.key === "b" && (f.value = !f.value), !a.value.isReadOnly && (F() ? _.meta.value : _.ctrl.value) && e.key === "k" && N.emit();
137
138
  });
138
- const Y = () => {
139
+ const Z = () => {
139
140
  if (!u.value) return "";
140
141
  const { method: e } = u.value;
141
- return Se[e].backgroundColor;
142
- }, Z = (e, t) => {
143
- var o, r, i;
144
- return !(a.value.isReadOnly || !m[e.id] && t.offset !== 2 || m[e.id] && ((i = (r = (o = m[t.id]) == null ? void 0 : o.spec) == null ? void 0 : r.info) == null ? void 0 : i.title) === "Drafts");
142
+ return Ue[e].backgroundColor;
143
+ }, ee = (e, t) => {
144
+ var o, r, l;
145
+ return !(a.value.isReadOnly || !m[e.id] && t.offset !== 2 || m[e.id] && ((l = (r = (o = m[t.id]) == null ? void 0 : o.spec) == null ? void 0 : r.info) == null ? void 0 : l.title) === "Drafts");
145
146
  };
146
- return (e, t) => (x(), S(V, null, [
147
+ return (e, t) => (b(), S(V, null, [
147
148
  h("div", {
148
- class: y(["flex flex-1 flex-col rounded rounded-b-none rounded-r-none pt-0 h-full client-wrapper-bg-color relative", Y()])
149
+ class: x(["flex flex-1 flex-col rounded rounded-b-none rounded-r-none pt-0 h-full client-wrapper-bg-color relative", Z()])
149
150
  }, [
150
- h("div", Be, [
151
- h("div", Ie, [
151
+ h("div", Ie, [
152
+ h("div", Ve, [
152
153
  n(xe, {
153
154
  modelValue: f.value,
154
155
  "onUpdate:modelValue": t[0] || (t[0] = (o) => f.value = o),
155
156
  class: "gitbook-hidden"
156
157
  }, null, 8, ["modelValue"]),
157
- Ve
158
+ $e
158
159
  ]),
159
- n(fe),
160
- h("div", $e, [
161
- l(a).isReadOnly ? (x(), S("button", {
160
+ n(pe),
161
+ h("div", Ne, [
162
+ i(a).isReadOnly ? (b(), S("button", {
162
163
  key: 0,
163
164
  class: "text-c-3 hover:bg-b-3 active:text-c-1 p-2 rounded",
164
165
  type: "button",
165
- onClick: t[1] || (t[1] = (o) => l(H).hide())
166
+ onClick: t[1] || (t[1] = (o) => i(J).hide())
166
167
  }, [
167
- n(l(R), {
168
+ n(i(C), {
168
169
  icon: "Close",
169
170
  size: "lg",
170
171
  thickness: "1.75"
@@ -172,45 +173,47 @@ const qe = (g) => (ue("data-v-a88db4d1"), g = g(), me(), g), Be = { class: "lg:m
172
173
  ])) : U("", !0)
173
174
  ])
174
175
  ]),
175
- n(be, null, {
176
+ n(ge, null, {
176
177
  default: v(() => [
177
- le(n(l(De), {
178
- class: y([f.value ? "sidebar-active-width" : ""])
179
- }, ae({
178
+ ae(n(i(De), {
179
+ class: x([f.value ? "sidebar-active-width" : ""])
180
+ }, ne({
180
181
  content: v(() => [
181
- n(pe, {
182
- onOpenSearchModal: t[2] || (t[2] = (o) => l(E).show())
182
+ n(ve, {
183
+ onOpenSearchModal: t[2] || (t[2] = (o) => i(q).show())
183
184
  }),
184
185
  h("div", {
185
- class: "custom-scroll flex flex-1 flex-col overflow-visible px-3 pb-12 pt-2.5",
186
+ class: x(["custom-scroll flex flex-1 flex-col overflow-visible px-3 pb-3 pt-0", {
187
+ "pb-14": !i(a).isReadOnly
188
+ }]),
186
189
  onDragenter: t[3] || (t[3] = $(() => {
187
190
  }, ["prevent"])),
188
191
  onDragover: t[4] || (t[4] = $(() => {
189
192
  }, ["prevent"]))
190
193
  }, [
191
- (x(!0), S(V, null, ne(l(L), (o) => {
192
- var r, i;
193
- return x(), C(Re, {
194
+ (b(!0), S(V, null, de(i(z), (o) => {
195
+ var r, l;
196
+ return b(), R(Oe, {
194
197
  key: o.uid,
195
- isDraggable: !l(a).isReadOnly && ((i = (r = o.spec) == null ? void 0 : r.info) == null ? void 0 : i.title) !== "Drafts",
196
- isDroppable: Z,
198
+ isDraggable: !i(a).isReadOnly && ((l = (r = o.spec) == null ? void 0 : r.info) == null ? void 0 : l.title) !== "Drafts",
199
+ isDroppable: ee,
197
200
  item: o,
198
201
  parentUids: [],
199
- onOnDragEnd: G
202
+ onOnDragEnd: X
200
203
  }, {
201
204
  leftIcon: v(() => [
202
- n(l(R), {
205
+ n(i(C), {
203
206
  class: "text-sidebar-c-2 text-sm group-hover:hidden",
204
207
  icon: "CodeFolder",
205
208
  size: "sm",
206
209
  thickness: "2"
207
210
  }),
208
211
  h("div", {
209
- class: y({
210
- "rotate-90": l(K)[o.uid]
212
+ class: x({
213
+ "rotate-90": i(Q)[o.uid]
211
214
  })
212
215
  }, [
213
- n(l(R), {
216
+ n(i(C), {
214
217
  class: "text-c-3 hidden text-sm group-hover:block",
215
218
  icon: "ChevronRight",
216
219
  size: "sm"
@@ -220,41 +223,44 @@ const qe = (g) => (ue("data-v-a88db4d1"), g = g(), me(), g), Be = { class: "lg:m
220
223
  _: 2
221
224
  }, 1032, ["isDraggable", "item"]);
222
225
  }), 128))
223
- ], 32)
226
+ ], 34)
224
227
  ]),
225
228
  button: v(() => [
226
- l(a).isReadOnly ? U("", !0) : (x(), C(he, {
229
+ i(a).isReadOnly ? U("", !0) : (b(), R(be, {
227
230
  key: 0,
228
- click: X
231
+ class: x({
232
+ "empty-sidebar-item": i(T).length === 1
233
+ }),
234
+ click: Y
229
235
  }, {
230
236
  title: v(() => [
231
- de("Add Item")
237
+ ce("Add Item")
232
238
  ]),
233
239
  _: 1
234
- }))
240
+ }, 8, ["class"]))
235
241
  ]),
236
242
  _: 2
237
243
  }, [
238
- l(a).isReadOnly ? void 0 : {
244
+ i(a).isReadOnly ? void 0 : {
239
245
  name: "header",
240
246
  fn: v(() => [
241
- n(l(Me))
247
+ n(i(Me))
242
248
  ]),
243
249
  key: "0"
244
250
  }
245
251
  ]), 1032, ["class"]), [
246
- [ce, f.value]
252
+ [ue, f.value]
247
253
  ]),
248
- l(_) ? (x(), C(ge, {
254
+ i(w) ? (b(), R(ye, {
249
255
  key: 0,
250
- class: y(["flex-1", [f.value ? "sidebar-active-hide-layout" : ""]])
256
+ class: x(["flex-1", [f.value ? "sidebar-active-hide-layout" : ""]])
251
257
  }, {
252
258
  default: v(() => {
253
- var o, r, i, d, c;
259
+ var o, r, l, d, c;
254
260
  return [
255
- n(we),
256
- n(ye, {
257
- response: (c = (d = (o = l(u)) == null ? void 0 : o.history) == null ? void 0 : d[((i = (r = l(u)) == null ? void 0 : r.history) == null ? void 0 : i.length) - 1]) == null ? void 0 : c.response
261
+ n(_e),
262
+ n(ke, {
263
+ response: (c = (d = (o = i(u)) == null ? void 0 : o.history) == null ? void 0 : d[((l = (r = i(u)) == null ? void 0 : r.history) == null ? void 0 : l.length) - 1]) == null ? void 0 : c.response
258
264
  }, null, 8, ["response"])
259
265
  ];
260
266
  }),
@@ -264,10 +270,10 @@ const qe = (g) => (ue("data-v-a88db4d1"), g = g(), me(), g), Be = { class: "lg:m
264
270
  _: 1
265
271
  })
266
272
  ], 2),
267
- n(ve, { modalState: l(E) }, null, 8, ["modalState"])
273
+ n(he, { modalState: i(q) }, null, 8, ["modalState"])
268
274
  ], 64));
269
275
  }
270
276
  });
271
277
  export {
272
- at as default
278
+ nt as default
273
279
  };
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.0.40",
21
+ "version": "2.0.41",
22
22
  "engines": {
23
23
  "node": ">=18"
24
24
  },
@@ -127,14 +127,14 @@
127
127
  "vue-router": "^4.3.0",
128
128
  "whatwg-mimetype": "^4.0.0",
129
129
  "zod": "^3.22.4",
130
- "@scalar/components": "0.12.26",
131
- "@scalar/oas-utils": "0.2.22",
130
+ "@scalar/components": "0.12.27",
131
+ "@scalar/draggable": "0.1.4",
132
132
  "@scalar/object-utils": "1.1.5",
133
133
  "@scalar/themes": "0.9.19",
134
- "@scalar/use-codemirror": "0.11.9",
135
- "@scalar/draggable": "0.1.4",
134
+ "@scalar/use-codemirror": "0.11.10",
136
135
  "@scalar/use-toasts": "0.7.4",
137
- "@scalar/use-tooltip": "1.0.2"
136
+ "@scalar/use-tooltip": "1.0.2",
137
+ "@scalar/oas-utils": "0.2.22"
138
138
  },
139
139
  "devDependencies": {
140
140
  "@types/content-type": "^1.1.8",