@scalar/api-client 2.5.1 → 2.5.3

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 (52) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
  3. package/dist/components/HttpMethod/HttpMethod.vue.js +2 -2
  4. package/dist/components/HttpMethod/HttpMethod.vue2.js +18 -18
  5. package/dist/components/ImportCollection/OperationBadge.vue.d.ts +1 -1
  6. package/dist/components/ImportCollection/OperationBadge.vue.d.ts.map +1 -1
  7. package/dist/components/ScalarHotkey.vue.d.ts.map +1 -1
  8. package/dist/components/ScalarHotkey.vue.js +1 -1
  9. package/dist/components/TopNav/TopNavItem.vue.js +2 -2
  10. package/dist/components/TopNav/TopNavItem.vue2.js +4 -4
  11. package/dist/layouts/Web/ApiClientWeb.vue.d.ts.map +1 -1
  12. package/dist/libs/create-client.d.ts.map +1 -1
  13. package/dist/libs/create-client.js +6 -5
  14. package/dist/libs/hot-keys.js +1 -1
  15. package/dist/libs/index.js +23 -24
  16. package/dist/libs/local-storage.d.ts +0 -8
  17. package/dist/libs/local-storage.d.ts.map +1 -1
  18. package/dist/libs/local-storage.js +24 -28
  19. package/dist/libs/send-request/create-request-operation.d.ts.map +1 -1
  20. package/dist/libs/send-request/create-request-operation.js +49 -49
  21. package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
  22. package/dist/libs/string-template.d.ts.map +1 -1
  23. package/dist/libs/string-template.js +29 -29
  24. package/dist/store/collections.d.ts.map +1 -1
  25. package/dist/store/collections.js +1 -1
  26. package/dist/store/cookies.js +1 -1
  27. package/dist/store/environment.js +1 -1
  28. package/dist/store/request-example.d.ts.map +1 -1
  29. package/dist/store/request-example.js +13 -12
  30. package/dist/store/requests.d.ts.map +1 -1
  31. package/dist/store/requests.js +42 -40
  32. package/dist/store/security-schemes.d.ts.map +1 -1
  33. package/dist/store/security-schemes.js +1 -1
  34. package/dist/store/servers.d.ts.map +1 -1
  35. package/dist/store/servers.js +1 -1
  36. package/dist/store/tags.d.ts.map +1 -1
  37. package/dist/store/tags.js +14 -13
  38. package/dist/store/workspace.d.ts.map +1 -1
  39. package/dist/store/workspace.js +1 -1
  40. package/dist/style.css +1 -1
  41. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  42. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
  43. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +28 -28
  44. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.d.ts.map +1 -1
  45. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +1 -1
  46. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue2.js +38 -38
  47. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
  48. package/dist/views/Request/RequestSection/RequestSection.vue.js +2 -2
  49. package/dist/views/Request/RequestSection/RequestSection.vue2.js +70 -68
  50. package/dist/views/Request/RequestSection/helpers/update-scheme.js +8 -8
  51. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  52. package/package.json +13 -12
@@ -1,21 +1,21 @@
1
- import { defineComponent as U, computed as v, useId as g, ref as D, watch as M, createBlock as p, openBlock as n, withCtx as c, createElementVNode as y, withDirectives as s, createCommentVNode as h, createElementBlock as f, createVNode as i, unref as r, vShow as m, Fragment as K, renderList as L, resolveDynamicComponent as Q, toDisplayString as $ } from "vue";
2
- import { ScalarErrorBoundary as P } from "@scalar/components";
3
- import { canMethodHaveBody as k, isDefined as F, REGEX as S } from "@scalar/oas-utils/helpers";
4
- import j from "../../../components/SectionFilter.vue.js";
1
+ import { defineComponent as D, computed as v, useId as P, ref as M, watch as S, createBlock as p, openBlock as r, withCtx as c, createElementVNode as h, withDirectives as s, createCommentVNode as k, createElementBlock as f, createVNode as i, unref as n, vShow as u, Fragment as K, renderList as L, resolveDynamicComponent as Q, toDisplayString as $ } from "vue";
2
+ import { ScalarErrorBoundary as C } from "@scalar/components";
3
+ import { canMethodHaveBody as b, isDefined as j, REGEX as B } from "@scalar/oas-utils/helpers";
4
+ import F from "../../../components/SectionFilter.vue.js";
5
5
  import T from "../../../components/ViewLayout/ViewLayoutSection.vue.js";
6
6
  import { matchesDomain as W } from "../../../libs/send-request/set-request-cookies.js";
7
7
  import z from "./RequestBody.vue.js";
8
- import b from "./RequestParams.vue.js";
8
+ import V from "./RequestParams.vue.js";
9
9
  import G from "./RequestPathParams.vue.js";
10
10
  import X from "./RequestAuth/RequestAuth.vue.js";
11
11
  import J from "./RequestCodeExample.vue.js";
12
12
  import { usePluginManager as Y } from "../../../plugins/hooks/usePluginManager.js";
13
13
  import { useWorkspace as Z } from "../../../store/store.js";
14
14
  import { useLayout as x } from "../../../hooks/useLayout.js";
15
- const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24" }, ee = ["for"], ae = ["id", "placeholder", "value"], oe = {
15
+ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24" }, ee = ["for"], ae = ["id", "placeholder", "value"], le = {
16
16
  key: 2,
17
17
  class: "text-c-1 flex h-8 items-center"
18
- }, le = ["id", "role"], be = /* @__PURE__ */ U({
18
+ }, oe = ["id", "role"], be = /* @__PURE__ */ D({
19
19
  __name: "RequestSection",
20
20
  props: {
21
21
  collection: {},
@@ -28,42 +28,39 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
28
28
  server: {},
29
29
  workspace: {}
30
30
  },
31
- setup(o) {
32
- const C = [
31
+ setup(l) {
32
+ const R = [
33
33
  "Auth",
34
34
  "Variables",
35
35
  "Cookies",
36
36
  "Headers",
37
37
  "Query",
38
- "Body",
39
- "Scripts"
40
- ], { requestMutators: V, cookies: B, securitySchemes: R } = Z(), { layout: d } = x(), w = v(() => {
41
- const e = /* @__PURE__ */ new Set(["All", ...C]);
42
- return o.example.parameters.path.length || e.delete("Variables"), k(o.operation.method ?? "get") || e.delete("Body"), A.value && e.delete("Auth"), [...e];
38
+ "Body"
39
+ // 'Scripts',
40
+ ], { requestMutators: w, cookies: O, securitySchemes: A } = Z(), { layout: d } = x(), q = v(() => {
41
+ const e = /* @__PURE__ */ new Set(["All", ...R]);
42
+ return l.example.parameters.path.length || e.delete("Variables"), b(l.operation.method ?? "get") || e.delete("Body"), y.value && e.delete("Auth"), [...e];
43
43
  }), t = v(
44
44
  () => Object.fromEntries(
45
- w.value.map((e) => [e, g()])
45
+ q.value.map((e) => [e, P()])
46
46
  )
47
- ), A = v(
48
- () => {
49
- var e;
50
- return d === "modal" && ((e = o.operation.security) == null ? void 0 : e.length) === 0;
51
- }
52
- ), a = D("All");
53
- M(
54
- () => o.operation,
47
+ ), y = v(
48
+ () => d === "modal" && !l.operation.security && !Object.keys(A ?? {}).length
49
+ ), a = M("All");
50
+ S(
51
+ () => l.operation,
55
52
  (e) => {
56
- a.value === "Body" && e && !k(e.method) && (a.value = "All");
53
+ a.value === "Body" && e && !b(e.method) && (a.value = "All");
57
54
  }
58
55
  );
59
- const O = (e) => {
60
- const l = e.target;
61
- V.edit(o.operation.uid, "summary", l.value);
62
- }, E = v(
63
- () => (o.workspace.cookies ?? []).map((e) => B[e]).filter(F).filter((e) => e.name).filter(
56
+ const E = (e) => {
57
+ const o = e.target;
58
+ w.edit(l.operation.uid, "summary", o.value);
59
+ }, H = v(
60
+ () => (l.workspace.cookies ?? []).map((e) => O[e]).filter(j).filter((e) => e.name).filter(
64
61
  (e) => {
65
- var l;
66
- return W(((l = o.server) == null ? void 0 : l.url) || o.operation.path, e.domain);
62
+ var o;
63
+ return W(((o = l.server) == null ? void 0 : o.url) || l.operation.path, e.domain);
67
64
  }
68
65
  ).map((e) => ({
69
66
  key: e.name,
@@ -76,40 +73,45 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
76
73
  },
77
74
  enabled: !0
78
75
  }))
79
- ), H = () => o.operation.summary ? o.operation.summary : o.operation.path.replace(S.PROTOCOL, "") ? o.operation.path.replace(S.PROTOCOL, "") : "Request Name", q = g(), N = Y().getViewComponents("request.section"), I = (e, l) => V.edit(o.operation.uid, e, l);
80
- return (e, l) => (n(), p(T, {
76
+ ), N = () => l.operation.summary ? l.operation.summary : l.operation.path.replace(B.PROTOCOL, "") ? l.operation.path.replace(B.PROTOCOL, "") : "Request Name", g = P(), I = Y().getViewComponents("request.section"), U = (e, o) => w.edit(l.operation.uid, e, o);
77
+ return S(
78
+ () => y.value,
79
+ (e) => {
80
+ e && a.value === "Auth" && (a.value = "All");
81
+ }
82
+ ), (e, o) => (r(), p(T, {
81
83
  "aria-label": `Request: ${e.operation.summary}`
82
84
  }, {
83
85
  title: c(() => [
84
- y("div", _, [
85
- r(d) !== "modal" ? (n(), f("label", {
86
+ h("div", _, [
87
+ n(d) !== "modal" ? (r(), f("label", {
86
88
  key: 0,
87
89
  class: "pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0",
88
- for: r(q)
89
- }, null, 8, ee)) : h("", !0),
90
- r(d) !== "modal" ? (n(), f("input", {
90
+ for: n(g)
91
+ }, null, 8, ee)) : k("", !0),
92
+ n(d) !== "modal" ? (r(), f("input", {
91
93
  key: 1,
92
- id: r(q),
94
+ id: n(g),
93
95
  class: "text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25",
94
- placeholder: H(),
96
+ placeholder: N(),
95
97
  value: e.operation.summary,
96
- onInput: O
97
- }, null, 40, ae)) : (n(), f("span", oe, $(e.operation.summary), 1))
98
+ onInput: E
99
+ }, null, 40, ae)) : (r(), f("span", le, $(e.operation.summary), 1))
98
100
  ]),
99
- i(j, {
101
+ i(F, {
100
102
  modelValue: a.value,
101
- "onUpdate:modelValue": l[0] || (l[0] = (u) => a.value = u),
103
+ "onUpdate:modelValue": o[0] || (o[0] = (m) => a.value = m),
102
104
  filterIds: t.value,
103
- filters: w.value
105
+ filters: q.value
104
106
  }, null, 8, ["modelValue", "filterIds", "filters"])
105
107
  ]),
106
108
  default: c(() => [
107
- y("div", {
109
+ h("div", {
108
110
  id: t.value.All,
109
111
  class: "request-section-content custom-scroll relative flex flex-1 flex-col",
110
112
  role: a.value === "All" ? "tabpanel" : "none"
111
113
  }, [
112
- e.collection && e.workspace && (r(d) !== "modal" || Object.keys(r(R) ?? {}).length) ? s((n(), p(X, {
114
+ e.collection && e.workspace && (n(d) !== "modal" || Object.keys(n(A) ?? {}).length) ? s((r(), p(X, {
113
115
  key: 0,
114
116
  id: t.value.Auth,
115
117
  class: "request-section-content-auth",
@@ -125,10 +127,10 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
125
127
  workspace: e.workspace
126
128
  }, null, 8, ["id", "collection", "envVariables", "environment", "operation", "role", "selectedSecuritySchemeUids", "server", "workspace"])), [
127
129
  [
128
- m,
129
- !A.value && (a.value === "All" || a.value === "Auth")
130
+ u,
131
+ !y.value && (a.value === "All" || a.value === "Auth")
130
132
  ]
131
- ]) : h("", !0),
133
+ ]) : k("", !0),
132
134
  s(i(G, {
133
135
  id: t.value.Variables,
134
136
  class: "request-section-content-path-params",
@@ -143,11 +145,11 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
143
145
  workspace: e.workspace
144
146
  }, null, 8, ["id", "envVariables", "environment", "example", "invalidParams", "operation", "role", "workspace"]), [
145
147
  [
146
- m,
148
+ u,
147
149
  (a.value === "All" || a.value === "Variables") && e.example.parameters.path.length
148
150
  ]
149
151
  ]),
150
- s(i(b, {
152
+ s(i(V, {
151
153
  id: t.value.Cookies,
152
154
  class: "request-section-content-cookies",
153
155
  envVariables: e.envVariables,
@@ -157,14 +159,14 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
157
159
  label: "Cookie",
158
160
  operation: e.operation,
159
161
  paramKey: "cookies",
160
- readOnlyEntries: E.value,
162
+ readOnlyEntries: H.value,
161
163
  role: a.value === "All" ? "none" : "tabpanel",
162
164
  title: "Cookies",
163
165
  workspace: e.workspace
164
166
  }, null, 8, ["id", "envVariables", "environment", "example", "invalidParams", "operation", "readOnlyEntries", "role", "workspace"]), [
165
- [m, a.value === "All" || a.value === "Cookies"]
167
+ [u, a.value === "All" || a.value === "Cookies"]
166
168
  ]),
167
- s(i(b, {
169
+ s(i(V, {
168
170
  id: t.value.Headers,
169
171
  class: "request-section-content-headers",
170
172
  envVariables: e.envVariables,
@@ -178,9 +180,9 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
178
180
  title: "Headers",
179
181
  workspace: e.workspace
180
182
  }, null, 8, ["id", "envVariables", "environment", "example", "invalidParams", "operation", "role", "workspace"]), [
181
- [m, a.value === "All" || a.value === "Headers"]
183
+ [u, a.value === "All" || a.value === "Headers"]
182
184
  ]),
183
- s(i(b, {
185
+ s(i(V, {
184
186
  id: t.value.Query,
185
187
  class: "request-section-content-query",
186
188
  envVariables: e.envVariables,
@@ -194,9 +196,9 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
194
196
  title: "Query Parameters",
195
197
  workspace: e.workspace
196
198
  }, null, 8, ["id", "envVariables", "environment", "example", "invalidParams", "operation", "role", "workspace"]), [
197
- [m, a.value === "All" || a.value === "Query"]
199
+ [u, a.value === "All" || a.value === "Query"]
198
200
  ]),
199
- e.operation.method && (a.value === "All" || a.value === "Body") && r(k)(e.operation.method) ? (n(), p(z, {
201
+ e.operation.method && (a.value === "All" || a.value === "Body") && n(b)(e.operation.method) ? (r(), p(z, {
200
202
  key: 1,
201
203
  id: t.value.Body,
202
204
  class: "request-section-content-body",
@@ -207,22 +209,22 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
207
209
  role: a.value === "All" ? "none" : "tabpanel",
208
210
  title: "Body",
209
211
  workspace: e.workspace
210
- }, null, 8, ["id", "envVariables", "environment", "example", "operation", "role", "workspace"])) : h("", !0),
211
- (n(!0), f(K, null, L(r(N), (u) => (n(), p(r(P), {
212
- key: u.component
212
+ }, null, 8, ["id", "envVariables", "environment", "example", "operation", "role", "workspace"])) : k("", !0),
213
+ (r(!0), f(K, null, L(n(I), (m) => (r(), p(n(C), {
214
+ key: m.component
213
215
  }, {
214
216
  default: c(() => [
215
- s((n(), p(Q(u.component), {
216
- "onUpdate:operation": I,
217
+ s((r(), p(Q(m.component), {
218
+ "onUpdate:operation": U,
217
219
  operation: e.operation
218
220
  }, null, 40, ["operation"])), [
219
- [m, a.value === "All" || a.value === u.title]
221
+ [u, a.value === "All" || a.value === m.title]
220
222
  ])
221
223
  ]),
222
224
  _: 2
223
225
  }, 1024))), 128)),
224
- l[1] || (l[1] = y("div", { class: "flex flex-grow" }, null, -1)),
225
- i(r(P), null, {
226
+ o[1] || (o[1] = h("div", { class: "flex flex-grow" }, null, -1)),
227
+ i(n(C), null, {
226
228
  default: c(() => [
227
229
  i(J, {
228
230
  class: "request-section-content-code-example -mt-1/2 border-t",
@@ -236,7 +238,7 @@ const _ = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:
236
238
  ]),
237
239
  _: 1
238
240
  })
239
- ], 8, le)
241
+ ], 8, oe)
240
242
  ]),
241
243
  _: 1
242
244
  }, 8, ["aria-label"]));
@@ -1,17 +1,17 @@
1
- import { CLIENT_LS_KEYS as a } from "../../../../libs/local-storage.js";
2
- const l = (o, r, c, { securitySchemeMutators: m, securitySchemes: s }, S = !1) => {
3
- var n;
4
- if (m.edit(o, r, c), !!S)
1
+ import { safeLocalStorage as s, CLIENT_LS_KEYS as m } from "@scalar/helpers/object/local-storage";
2
+ const g = (o, r, n, { securitySchemeMutators: a, securitySchemes: S }, f = !1) => {
3
+ var c;
4
+ if (a.edit(o, r, n), !!f)
5
5
  try {
6
- const e = JSON.parse(localStorage.getItem(a.AUTH) ?? "{}"), t = s[o];
6
+ const e = JSON.parse(s().getItem(m.AUTH) ?? "{}"), t = S[o];
7
7
  if (e && (t != null && t.nameKey)) {
8
- const f = e[n = t.nameKey] || (e[n] = {});
9
- f[r] = c, localStorage.setItem(a.AUTH, JSON.stringify(e));
8
+ const i = e[c = t.nameKey] || (e[c] = {});
9
+ i[r] = n, s().setItem(m.AUTH, JSON.stringify(e));
10
10
  }
11
11
  } catch (e) {
12
12
  console.error(e);
13
13
  }
14
14
  };
15
15
  export {
16
- l as updateScheme
16
+ g as updateScheme
17
17
  };
@@ -34,7 +34,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
34
34
  }));
35
35
  }, k = (o) => {
36
36
  o != null && o.createNew && g.name === "request" && f();
37
- }, w = "2.5.1";
37
+ }, w = "2.5.3";
38
38
  return R(() => a.hotKeys.on(k)), v(() => a.hotKeys.off(k)), (o, e) => (u(), i("div", W, [
39
39
  s("div", {
40
40
  class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.5.1",
21
+ "version": "2.5.3",
22
22
  "engines": {
23
23
  "node": ">=20"
24
24
  },
@@ -204,19 +204,20 @@
204
204
  "whatwg-mimetype": "^4.0.0",
205
205
  "yaml": "^2.4.5",
206
206
  "zod": "3.24.1",
207
- "@scalar/components": "0.14.4",
208
- "@scalar/draggable": "0.2.0",
207
+ "@scalar/components": "0.14.6",
209
208
  "@scalar/icons": "0.4.2",
210
- "@scalar/oas-utils": "0.4.1",
209
+ "@scalar/draggable": "0.2.0",
210
+ "@scalar/import": "0.4.7",
211
+ "@scalar/helpers": "0.0.2",
212
+ "@scalar/oas-utils": "0.4.3",
211
213
  "@scalar/object-utils": "1.2.1",
212
- "@scalar/openapi-parser": "0.13.0",
213
- "@scalar/openapi-types": "0.3.1",
214
- "@scalar/postman-to-openapi": "0.3.4",
215
- "@scalar/import": "0.4.5",
214
+ "@scalar/openapi-parser": "0.15.0",
215
+ "@scalar/openapi-types": "0.3.2",
216
+ "@scalar/postman-to-openapi": "0.3.6",
216
217
  "@scalar/snippetz": "0.3.0",
217
- "@scalar/types": "0.2.1",
218
- "@scalar/themes": "0.13.1",
219
- "@scalar/use-codemirror": "0.12.5",
218
+ "@scalar/types": "0.2.2",
219
+ "@scalar/use-codemirror": "0.12.7",
220
+ "@scalar/themes": "0.13.2",
220
221
  "@scalar/use-hooks": "0.2.2",
221
222
  "@scalar/use-toasts": "0.8.0",
222
223
  "@scalar/use-tooltip": "1.1.0"
@@ -232,7 +233,7 @@
232
233
  "vite": "5.4.19",
233
234
  "vite-svg-loader": "^5.1.0",
234
235
  "vitest": "^1.6.0",
235
- "@scalar/build-tooling": "0.2.1",
236
+ "@scalar/build-tooling": "0.2.2",
236
237
  "@scalar/galaxy": "0.5.0"
237
238
  },
238
239
  "scripts": {