@scalar/api-reference 1.24.48 → 1.24.49

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,17 +1,28 @@
1
1
  import { type TargetId } from 'httpsnippet-lite';
2
2
  import { type Ref } from 'vue';
3
3
  import type { AvailableTarget, HiddenClients } from '../types';
4
+ /**
5
+ * Gets the client title from the availableTargets
6
+ * { targetKey: 'shell', clientKey: 'curl' } -> 'Shell'
7
+ */
4
8
  declare function getTargetTitle(client: HttpClientState): string;
9
+ /**
10
+ * Gets the client title from the availableTargets
11
+ * { targetKey: 'shell', clientKey: 'curl' } -> 'cURL'
12
+ */
5
13
  declare function getClientTitle(client: HttpClientState): string;
6
14
  /**
7
15
  * Filters out hidden clients from the available targets (based on the given configuration).
8
16
  */
9
17
  export declare function filterHiddenClients(targets: AvailableTarget[], exclude: Ref<HiddenClients>): AvailableTarget[];
18
+ /** The selected HTTP client */
10
19
  export type HttpClientState = {
11
20
  targetKey: TargetId;
12
21
  clientKey: string;
13
22
  };
23
+ declare function setDefaultHttpClient(httpClient?: HttpClientState): void;
14
24
  declare function resetState(): void;
25
+ /** Keep track of the available and the selected HTTP client(s) */
15
26
  export declare const useHttpClientStore: () => {
16
27
  httpClient: {
17
28
  readonly targetKey: TargetId;
@@ -19,6 +30,7 @@ export declare const useHttpClientStore: () => {
19
30
  };
20
31
  resetState: typeof resetState;
21
32
  setHttpClient: (newState: Partial<HttpClientState>) => void;
33
+ setDefaultHttpClient: typeof setDefaultHttpClient;
22
34
  excludedClients: Ref<HiddenClients>;
23
35
  setExcludedClients: (v: HiddenClients) => void;
24
36
  availableTargets: import("vue").ComputedRef<AvailableTarget[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"useHttpClientStore.d.ts","sourceRoot":"","sources":["../../src/stores/useHttpClientStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAkC,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE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Q,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAYxE,iBAAS,oBAAoB,CAAC,UAAU,CAAC,EAAE,eAAe,QAQzD;AAmCD,iBAAS,UAAU,SAElB;AAYD,kEAAkE;AAClE,eAAO,MAAM,kBAAkB;;4BAtEY,QAAQ;4BAAa,MAAM;;;8BA8DrC,OAAO,CAAC,eAAe,CAAC;;qBAcP,GAAG,CAAC,aAAa,CAAC;4BACxC,aAAa;;;;;;CAaxC,CAAA"}
@@ -1,73 +1,82 @@
1
- import { objectMerge as d } from "@scalar/oas-utils/helpers";
2
- import { availableTargets as C } from "httpsnippet-lite";
3
- import { computed as c, ref as T, reactive as h, readonly as f } from "vue";
4
- function v(n) {
5
- var t;
6
- return ((t = s.value.find((e) => e.key === n.targetKey)) == null ? void 0 : t.title) ?? n.targetKey;
1
+ import { objectMerge as T } from "@scalar/oas-utils/helpers";
2
+ import { availableTargets as m } from "httpsnippet-lite";
3
+ import { computed as o, ref as k, reactive as A, readonly as f } from "vue";
4
+ const y = {
5
+ targetKey: "shell",
6
+ clientKey: "curl"
7
+ };
8
+ function p(e) {
9
+ var n;
10
+ return ((n = l.value.find((t) => t.key === e.targetKey)) == null ? void 0 : n.title) ?? e.targetKey;
7
11
  }
8
- function p(n) {
9
- var t, e;
10
- return ((e = (t = s.value.find((i) => i.key === n.targetKey)) == null ? void 0 : t.clients.find((i) => i.key === n.clientKey)) == null ? void 0 : e.title) ?? n.clientKey;
12
+ function C(e) {
13
+ var n, t;
14
+ return ((t = (n = l.value.find((i) => i.key === e.targetKey)) == null ? void 0 : n.clients.find((i) => i.key === e.clientKey)) == null ? void 0 : t.title) ?? e.clientKey;
11
15
  }
12
- const b = c(() => v(l)), m = c(() => p(l));
13
- function K(n, t) {
14
- return t.value === !0 ? [] : n.flatMap((e) => {
16
+ const b = o(() => p(r)), H = o(() => C(r));
17
+ function h(e, n) {
18
+ return n.value === !0 ? [] : e.flatMap((t) => {
15
19
  var i;
16
- return typeof t.value != "object" ? [] : Array.isArray(t.value) ? (e.clients = e.clients.filter(
20
+ return typeof n.value != "object" ? [] : Array.isArray(n.value) ? (t.clients = t.clients.filter(
17
21
  // @ts-expect-error Typescript, chill. It’s all good. It has to be an array.
18
- (r) => !t.value.includes(r.key)
19
- ), [e]) : t.value[e.key] === !0 ? [] : (Array.isArray(t.value[e.key]) && (e.clients = e.clients.filter((r) => !// @ts-expect-error We checked whether it’s an Array already.
20
- t.value[e.key].includes(r.key))), (i = e == null ? void 0 : e.clients) != null && i.length ? [e] : []);
22
+ (s) => !n.value.includes(s.key)
23
+ ), [t]) : n.value[t.key] === !0 ? [] : (Array.isArray(n.value[t.key]) && (t.clients = t.clients.filter((s) => !// @ts-expect-error We checked whether it’s an Array already.
24
+ n.value[t.key].includes(s.key))), (i = t == null ? void 0 : t.clients) != null && i.length ? [t] : []);
21
25
  });
22
26
  }
23
- const s = c(() => {
24
- var t;
25
- const n = C();
26
- return (t = n.find((e) => e.key === "node")) == null || t.clients.unshift({
27
+ const l = o(() => {
28
+ var n;
29
+ const e = m();
30
+ return (n = e.find((t) => t.key === "node")) == null || n.clients.unshift({
27
31
  description: "An HTTP/1.1 client, written from scratch for Node.js.",
28
32
  key: "undici",
29
33
  link: "https://github.com/nodejs/undici",
30
34
  title: "undici"
31
- }), K(n, u);
32
- }), y = {
35
+ }), h(e, c);
36
+ }), d = {
33
37
  node: ["unirest"]
34
- }, u = T({
35
- ...y === !0 ? {} : y
36
- }), a = () => {
37
- var t, e, i, r;
38
- return s.value.find(
39
- (o) => o.key === "shell" && o.clients.find((k) => k.key === "curl")
40
- ) ? {
41
- targetKey: "shell",
42
- clientKey: "curl"
43
- } : {
44
- targetKey: (t = s.value[0]) == null ? void 0 : t.key,
45
- clientKey: (r = (i = (e = s.value[0]) == null ? void 0 : e.clients) == null ? void 0 : i[0]) == null ? void 0 : r.key
38
+ }, c = k({
39
+ ...d === !0 ? {} : d
40
+ }), a = k();
41
+ function E(e) {
42
+ e !== void 0 && (a.value = e, K(u()));
43
+ }
44
+ const u = () => {
45
+ var e, n, t, i;
46
+ return v(a.value) ? a.value : v(y) ? y : {
47
+ targetKey: (e = l.value[0]) == null ? void 0 : e.key,
48
+ clientKey: (i = (t = (n = l.value[0]) == null ? void 0 : n.clients) == null ? void 0 : t[0]) == null ? void 0 : i.key
46
49
  };
47
- }, l = h(a());
48
- function A() {
49
- d(l, a());
50
+ };
51
+ function v(e) {
52
+ return e === void 0 ? !1 : !!l.value.find(
53
+ (n) => n.key === e.targetKey && n.clients.find((t) => t.key === e.clientKey)
54
+ );
55
+ }
56
+ function L() {
57
+ T(r, u());
50
58
  }
51
- const j = (n) => {
52
- Object.assign(l, {
53
- ...l,
54
- ...n
59
+ const r = A(u()), K = (e) => {
60
+ Object.assign(r, {
61
+ ...r,
62
+ ...e
55
63
  });
56
- }, g = () => ({
57
- httpClient: f(l),
58
- resetState: A,
59
- setHttpClient: j,
60
- excludedClients: f(u),
61
- setExcludedClients: (n) => {
62
- u.value = n, d(l, a());
64
+ }, _ = () => ({
65
+ httpClient: f(r),
66
+ resetState: L,
67
+ setHttpClient: K,
68
+ setDefaultHttpClient: E,
69
+ excludedClients: f(c),
70
+ setExcludedClients: (e) => {
71
+ c.value = e, T(r, u());
63
72
  },
64
- availableTargets: s,
65
- getClientTitle: p,
66
- getTargetTitle: v,
73
+ availableTargets: l,
74
+ getClientTitle: C,
75
+ getTargetTitle: p,
67
76
  httpTargetTitle: b,
68
- httpClientTitle: m
77
+ httpClientTitle: H
69
78
  });
70
79
  export {
71
- K as filterHiddenClients,
72
- g as useHttpClientStore
80
+ h as filterHiddenClients,
81
+ _ as useHttpClientStore
73
82
  };