@scalar/api-client 2.5.0 → 2.5.2

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,36 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - c06aa6a: fix(api-client): move global styles out of client layout
8
+ - 3ad9393: fix: updates string template for empety values susbtitution
9
+ - b461b62: fix: updates request section auth hidden logic"
10
+ - a47fa60: fix: override Electron default User-Agent header
11
+ - Updated dependencies [f1c0c01]
12
+ - Updated dependencies [ee3eb77]
13
+ - Updated dependencies [df7efac]
14
+ - Updated dependencies [7ca47ab]
15
+ - @scalar/components@0.14.5
16
+ - @scalar/openapi-parser@0.14.0
17
+ - @scalar/oas-utils@0.4.2
18
+ - @scalar/use-codemirror@0.12.6
19
+ - @scalar/import@0.4.6
20
+ - @scalar/postman-to-openapi@0.3.5
21
+
22
+ ## 2.5.1
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [85877aa]
27
+ - @scalar/themes@0.13.1
28
+ - @scalar/components@0.14.4
29
+ - @scalar/oas-utils@0.4.1
30
+ - @scalar/use-codemirror@0.12.5
31
+ - @scalar/import@0.4.5
32
+ - @scalar/postman-to-openapi@0.3.4
33
+
3
34
  ## 2.5.0
4
35
 
5
36
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"ApiClientWeb.vue.d.ts","sourceRoot":"","sources":["../../../src/layouts/Web/ApiClientWeb.vue"],"names":[],"mappings":";AA2SA,wBAMG"}
1
+ {"version":3,"file":"ApiClientWeb.vue.d.ts","sourceRoot":"","sources":["../../../src/layouts/Web/ApiClientWeb.vue"],"names":[],"mappings":";AAiSA,wBAMG"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-request-operation.d.ts","sourceRoot":"","sources":["../../../src/libs/send-request/create-request-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,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tC,OAAO,EAAE,OAAO,CAAA;CACjB,CA0OA,CAAA"}
1
+ {"version":3,"file":"create-request-operation.d.ts","sourceRoot":"","sources":["../../../src/libs/send-request/create-request-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAQhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/D,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,MAAM,EACP,MAAM,iCAAiC,CAAA;AAMxC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;AAEtD,uGAAuG;AACvG,KAAK,mBAAmB,GAAG,OAAO,CAChC,aAAa,CAAC;IACZ,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,OAAO,EAAE,cAAc,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAC,CACH,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAA;AAE/D,0BAA0B;AAC1B,eAAO,MAAM,sBAAsB,4IAWhC;IACD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,OAAO,EAAE,cAAc,CAAA;IACvB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,OAAO,EAAE,SAAS,CAAA;IAClB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IAC/C,0BAA0B,CAAC,EAAE,SAAS,CAAC,4BAA4B,CAAC,CAAA;IACpE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,MAAM,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAA;IAChC,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,WAAW,EAAE,MAAM,mBAAmB,CAAA;IACtC,OAAO,EAAE,OAAO,CAAA;CACjB,CAgPA,CAAA"}
@@ -1,61 +1,61 @@
1
1
  import { ERRORS as P, normalizeError as U } from "../errors.js";
2
- import { normalizeHeaders as G } from "../normalize-headers.js";
3
- import { createFetchBody as J } from "./create-fetch-body.js";
4
- import { createFetchHeaders as N } from "./create-fetch-headers.js";
5
- import { createFetchQueryParams as Z } from "./create-fetch-query-params.js";
6
- import { decodeBuffer as $ } from "./decode-buffer.js";
7
- import { setRequestCookies as M, getCookieHeader as ee } from "./set-request-cookies.js";
8
- import { replaceTemplateVariables as d } from "../string-template.js";
9
- import { isElectron as oe } from "../electron.js";
10
- import { isDefined as te, mergeUrls as re, shouldUseProxy as q, redirectToProxy as se, httpStatusCodes as ne } from "@scalar/oas-utils/helpers";
2
+ import { normalizeHeaders as J } from "../normalize-headers.js";
3
+ import { createFetchBody as N } from "./create-fetch-body.js";
4
+ import { createFetchHeaders as Z } from "./create-fetch-headers.js";
5
+ import { createFetchQueryParams as $ } from "./create-fetch-query-params.js";
6
+ import { decodeBuffer as M } from "./decode-buffer.js";
7
+ import { setRequestCookies as ee, getCookieHeader as oe } from "./set-request-cookies.js";
8
+ import { replaceTemplateVariables as m } from "../string-template.js";
9
+ import { isElectron as q } from "../electron.js";
10
+ import { isDefined as te, mergeUrls as re, shouldUseProxy as D, redirectToProxy as se, httpStatusCodes as ne } from "@scalar/oas-utils/helpers";
11
11
  import { buildRequestSecurity as ae } from "./build-request-security.js";
12
12
  const Re = ({
13
- environment: D,
13
+ environment: E,
14
14
  example: a,
15
- globalCookies: E,
16
- proxyUrl: l,
15
+ globalCookies: L,
16
+ proxyUrl: u,
17
17
  request: i,
18
- securitySchemes: L,
19
- selectedSecuritySchemeUids: z = [],
20
- server: c,
18
+ securitySchemes: z,
19
+ selectedSecuritySchemeUids: B = [],
20
+ server: d,
21
21
  status: o,
22
- pluginManager: u
22
+ pluginManager: f
23
23
  }) => {
24
24
  try {
25
- const t = D ?? {}, S = new AbortController(), w = a.parameters.path.reduce((e, s) => (s.enabled && (e[s.key] = d(s.value, t)), e), {}), B = d((c == null ? void 0 : c.url) ?? "", t), f = d(d(i.path, t), w);
26
- let n = B || f;
25
+ const t = E ?? {}, k = new AbortController(), w = a.parameters.path.reduce((e, s) => (s.enabled && (e[s.key] = m(s.value, t)), e), {}), F = m((d == null ? void 0 : d.url) ?? "", t), p = m(m(i.path, t), w);
26
+ let n = F || p;
27
27
  if (!n)
28
28
  throw P.URL_EMPTY;
29
- Object.entries((c == null ? void 0 : c.variables) ?? {}).forEach(([e, s]) => {
30
- n = d(n, {
29
+ Object.entries((d == null ? void 0 : d.variables) ?? {}).forEach(([e, s]) => {
30
+ n = m(n, {
31
31
  [e]: w[e] || s.default
32
32
  });
33
33
  });
34
- const F = Z(a, t, i), _ = N(a, t), { body: O } = J(i.method, a, t), { cookieParams: W } = M({
34
+ const _ = $(a, t, i), O = Z(a, t), { body: W } = N(i.method, a, t), { cookieParams: x } = ee({
35
35
  example: a,
36
36
  env: t,
37
- globalCookies: E,
37
+ globalCookies: L,
38
38
  serverUrl: n,
39
- proxyUrl: l
40
- }), x = z.flat().map((e) => L[e]).filter(te), b = ae(x, t), p = { ...Object.entries(b.headers).reduce(
39
+ proxyUrl: u
40
+ }), A = B.flat().map((e) => z[e]).filter(te), S = ae(A, t), c = { ...Object.entries(S.headers).reduce(
41
41
  (e, [s, y]) => (e[s.toLowerCase()] = y, e),
42
42
  {}
43
- ), ..._ }, j = [...W, ...b.cookies], A = new URLSearchParams([...F, ...b.urlParams]);
44
- n = re(n, f, A);
45
- const k = d(ee(j, p.Cookie), t);
46
- k && (oe() || q(l, n) ? (console.warn(
43
+ ), ...O }, X = [...x, ...S.cookies], j = new URLSearchParams([..._, ...S.urlParams]);
44
+ q() && c["user-agent"] && (c["X-Scalar-User-Agent"] = c["user-agent"]), n = re(n, p, j);
45
+ const b = m(oe(X, c.Cookie), t);
46
+ b && (q() || D(u, n) ? (console.warn(
47
47
  "We’re using a `X-Scalar-Cookie` custom header to the request. The proxy will forward this as a `Cookie` header. We do this to avoid the browser omitting the `Cookie` header for cross-origin requests for security reasons."
48
- ), p["X-Scalar-Cookie"] = k) : (console.warn(
48
+ ), c["X-Scalar-Cookie"] = b) : (console.warn(
49
49
  `We’re trying to add a Cookie header, but browsers often omit them for cross-origin requests for various security reasons. If it’s not working, that’s probably why. Here are the requirements for it to work:
50
50
 
51
51
  - The browser URL must be on the same domain as the server URL.
52
52
  - The connection must be made over HTTPS.
53
53
  `
54
- ), p.Cookie = k));
55
- const I = se(l, n), R = new Request(I, {
54
+ ), c.Cookie = b));
55
+ const I = se(u, n), R = new Request(I, {
56
56
  method: i.method.toUpperCase(),
57
- body: O ?? null,
58
- headers: p
57
+ body: W ?? null,
58
+ headers: c
59
59
  });
60
60
  return [
61
61
  null,
@@ -63,33 +63,33 @@ const Re = ({
63
63
  request: R,
64
64
  sendRequest: async () => {
65
65
  var s, y, C;
66
- o == null || o.emit("start"), u && u.executeHook("onBeforeRequest");
66
+ o == null || o.emit("start"), f && f.executeHook("onBeforeRequest");
67
67
  const e = Date.now();
68
68
  try {
69
69
  const r = await fetch(R, {
70
- signal: S.signal
70
+ signal: k.signal
71
71
  }), Q = (s = r.headers.get("content-type")) == null ? void 0 : s.startsWith("text/event-stream");
72
72
  o == null || o.emit("stop");
73
- const V = Date.now() - e, X = r.clone(), T = G(r.headers, q(l, n)), v = r.headers.get("content-type") ?? "text/plain;charset=UTF-8", g = await X.arrayBuffer(), K = $(g, v), m = r.clone(), Y = m.statusText || ((y = ne[m.status]) == null ? void 0 : y.name) || "", h = new Response(m.body, {
74
- status: m.status,
75
- statusText: Y,
76
- headers: m.headers
73
+ const V = Date.now() - e, v = r.clone(), g = J(r.headers, D(u, n)), K = r.headers.get("content-type") ?? "text/plain;charset=UTF-8", T = await v.arrayBuffer(), Y = M(T, K), h = r.clone(), G = h.statusText || ((y = ne[h.status]) == null ? void 0 : y.name) || "", l = new Response(h.body, {
74
+ status: h.status,
75
+ statusText: G,
76
+ headers: h.headers
77
77
  });
78
- u && u.executeHook("onResponseReceived", { response: h, operation: i });
79
- const H = "getSetCookie" in h.headers && typeof h.headers.getSetCookie == "function" ? h.headers.getSetCookie() : [];
78
+ f && f.executeHook("onResponseReceived", { response: l, operation: i });
79
+ const H = "getSetCookie" in l.headers && typeof l.headers.getSetCookie == "function" ? l.headers.getSetCookie() : [];
80
80
  return Q && r.body ? [
81
81
  null,
82
82
  {
83
83
  timestamp: Date.now(),
84
84
  request: a,
85
85
  response: {
86
- ...h,
87
- headers: T,
86
+ ...l,
87
+ headers: g,
88
88
  cookieHeaderKeys: H,
89
89
  reader: (C = r.body) == null ? void 0 : C.getReader(),
90
90
  duration: V,
91
91
  method: i.method,
92
- path: f
92
+ path: p
93
93
  }
94
94
  }
95
95
  ] : [
@@ -99,14 +99,14 @@ const Re = ({
99
99
  request: a,
100
100
  response: {
101
101
  ...r,
102
- headers: T,
102
+ headers: g,
103
103
  cookieHeaderKeys: H,
104
- data: K,
105
- size: g.byteLength,
104
+ data: Y,
105
+ size: T.byteLength,
106
106
  duration: Date.now() - e,
107
107
  method: i.method,
108
108
  status: r.status,
109
- path: f
109
+ path: p
110
110
  }
111
111
  }
112
112
  ];
@@ -114,7 +114,7 @@ const Re = ({
114
114
  return o == null || o.emit("abort"), [U(r, P.REQUEST_FAILED), null];
115
115
  }
116
116
  },
117
- controller: S
117
+ controller: k
118
118
  }
119
119
  ];
120
120
  } catch (t) {
@@ -1 +1 @@
1
- {"version":3,"file":"create-request-operation.test.d.ts","sourceRoot":"","sources":["../../../src/libs/send-request/create-request-operation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,oBAAoB,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;wBAA0C,CAAC;oBAAqC,CAAC;wBAA2B,CAAC;;;;;;uBAA0J,CAAC;oBAAsC,CAAC;uBAAoD,CAAC;2BAA6C,CAAC;uBAAyC,CAAC;wBAA2B,CAAC;oBAAuC,CAAC;sBAA0C,CAAC;wBAA0C,CAAC;oBAAqC,CAAC;wBAA2B,CAAC;;;;;;uBAA4J,CAAC;oBAAsC,CAAC;uBAAoD,CAAC;2BAA6C,CAAC;uBAAyC,CAAC;wBAA2B,CAAC;oBAAuC,CAAC;sBAA0C,CAAC;wBAA0C,CAAC;oBAAqC,CAAC;wBAA2B,CAAC;;;;;;uBAA4J,CAAC;oBAAsC,CAAC;uBAAoD,CAAC;2BAA6C,CAAC;uBAAyC,CAAC;wBAA2B,CAAC;oBAAuC,CAAC;sBAA0C,CAAC;wBAA0C,CAAC;oBAAqC,CAAC;wBAA2B,CAAC;;;+BAAqE,EAAG,KAAK;;;;sBAj1Bx0Z,EAAG,KAAK;;;;iBAI/C,CAAC;uBAEE,CAAC;mBAAqC,CAAC;gBAExD,CAAF;;;;;CA/NH,CAAA"}
1
+ {"version":3,"file":"create-request-operation.test.d.ts","sourceRoot":"","sources":["../../../src/libs/send-request/create-request-operation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,oBAAoB,EAIrB,MAAM,iCAAiC,CAAA;AAExC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAU5B,eAAO,MAAM,QAAQ,0BAAkC,CAAA;AAEvD,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,KAAK,kBAAkB,GAAG;IACxB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,qDAAqD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D,CAAC;2BAA6C,CAAC;uBAAyC,CAAC;wBAA2B,CAAC;oBAAuC,CAAC;sBAA0C,CAAC;wBAA0C,CAAC;oBAAqC,CAAC;wBAA2B,CAAC;;;+BAAqE,EAAG,KAAK;;;;sBA91B1gZ,EACf,KAAR;;;;iBAUD,CAAC;uBAAyC,CAAC;mBAEpC,CAAC;gBACF,CAAC;;;;;CAnOX,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"string-template.d.ts","sourceRoot":"","sources":["../../src/libs/string-template.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAK5D;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAkC/E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,sBAoBjD"}
1
+ {"version":3,"file":"string-template.d.ts","sourceRoot":"","sources":["../../src/libs/string-template.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAK5D;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAkC/E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,sBAoBjD"}
@@ -1,42 +1,42 @@
1
- import { REGEX as a } from "@scalar/oas-utils/helpers";
2
- function c(l, o) {
3
- const s = l.split(".").reduce((n, r) => n == null ? void 0 : n[r], o);
4
- return typeof s == "string" ? s : JSON.stringify(s);
1
+ import { REGEX as l, isDefined as a } from "@scalar/oas-utils/helpers";
2
+ function i(c, o) {
3
+ const n = c.split(".").reduce((s, r) => s == null ? void 0 : s[r], o);
4
+ return typeof n == "string" ? n : JSON.stringify(n);
5
5
  }
6
- function p(l, o) {
7
- let t = l;
8
- const s = /* @__PURE__ */ new Set();
9
- return t = t.replace(a.VARIABLES, (n, r) => {
6
+ function p(c, o) {
7
+ let t = c;
8
+ const n = /* @__PURE__ */ new Set();
9
+ return t = t.replace(l.VARIABLES, (s, r) => {
10
10
  const e = r.trim();
11
- s.add(e);
12
- const u = c(e, o);
13
- return u ?? `{{${e}}}`;
14
- }), t = t.replace(a.PATH, (n, r) => {
11
+ n.add(e);
12
+ const u = i(e, o);
13
+ return a(u) && u !== "" ? u : `{{${e}}}`;
14
+ }), t = t.replace(l.PATH, (s, r) => {
15
15
  const e = r.trim();
16
- if (s.has(e))
16
+ if (n.has(e))
17
17
  return `{${e}}`;
18
- const u = c(e, o);
19
- return u ?? `{${e}}`;
20
- }), t = t.replace(/:\b[\w.]+\b/g, (n) => {
21
- const r = n.slice(1);
22
- if (s.has(r))
23
- return n;
24
- const e = c(r, o);
25
- return e ?? n;
18
+ const u = i(e, o);
19
+ return a(u) && u !== "" ? u : `{${e}}`;
20
+ }), t = t.replace(/:\b[\w.]+\b/g, (s) => {
21
+ const r = s.slice(1);
22
+ if (n.has(r))
23
+ return s;
24
+ const e = i(r, o);
25
+ return a(e) && e !== "" ? e : s;
26
26
  }), t;
27
27
  }
28
- function f(l) {
29
- function o(t, s) {
30
- const n = Object.keys(t), r = [];
31
- return n.forEach((e) => {
32
- const u = s ? `${s}.${e}` : e;
28
+ function y(c) {
29
+ function o(t, n) {
30
+ const s = Object.keys(t), r = [];
31
+ return s.forEach((e) => {
32
+ const u = n ? `${n}.${e}` : e;
33
33
  typeof t[e] == "object" ? r.push(...o(t[e], u)) : r.push([u, String(t[e])]);
34
34
  }), r;
35
35
  }
36
- return o(l);
36
+ return o(c);
37
37
  }
38
38
  export {
39
- f as flattenEnvVars,
40
- c as getDotPathValue,
39
+ y as flattenEnvVars,
40
+ i as getDotPathValue,
41
41
  p as replaceTemplateVariables
42
42
  };