@scalar/api-reference 1.25.28 → 1.25.29

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,159 +1,168 @@
1
- import { ssrState as $ } from "@scalar/oas-utils/helpers";
2
- import { ref as m, reactive as J, computed as K, watch as B } from "vue";
3
- import { lazyBus as ee } from "../components/Content/Lazy/lazyBus.js";
4
- import { useNavState as te } from "./useNavState.js";
5
- import { getLowestHeadingLevel as N } from "../helpers/getLowestHeadingLevel.js";
1
+ import { ssrState as ee } from "@scalar/oas-utils/helpers";
2
+ import { ref as w, reactive as N, computed as Q, watch as W } from "vue";
3
+ import { lazyBus as te } from "../components/Content/Lazy/lazyBus.js";
4
+ import { useNavState as oe } from "./useNavState.js";
5
+ import { getLowestHeadingLevel as U } from "../helpers/getLowestHeadingLevel.js";
6
6
  import { openClientFor as D } from "../helpers/openClientFor.js";
7
7
  import { hasModels as se } from "../helpers/hasModels.js";
8
- import { getModels as F } from "../helpers/getModels.js";
9
- import { hasWebhooks as oe } from "../helpers/hasWebhooks.js";
10
- import { scrollToId as V } from "../helpers/scrollToId.js";
8
+ import { getModels as z } from "../helpers/getModels.js";
9
+ import { hasWebhooks as re } from "../helpers/hasWebhooks.js";
10
+ import { scrollToId as P } from "../helpers/scrollToId.js";
11
11
  import { getHeadingsFromMarkdown as ie } from "../helpers/getHeadingsFromMarkdown.js";
12
- import { useApiClientStore as re } from "../legacy/stores/useApiClientStore.js";
13
- import { useOpenApiStore as le } from "../legacy/stores/useOpenApiStore.js";
12
+ import { useApiClientStore as le } from "../legacy/stores/useApiClientStore.js";
13
+ import { useOpenApiStore as ne } from "../legacy/stores/useOpenApiStore.js";
14
14
  const {
15
- getHeadingId: z,
16
- getModelId: P,
17
- getOperationId: R,
18
- getSectionId: Q,
19
- getTagId: U,
20
- getWebhookId: A,
21
- hash: O
22
- } = te(), l = m(void 0), S = J({});
23
- function q(t) {
24
- var s, o;
25
- return S.tagsSorter === "alpha" ? t.tags = (s = t.tags) == null ? void 0 : s.sort((r, c) => r.name.localeCompare(c.name)) : typeof S.tagsSorter == "function" && (t.tags = (o = t.tags) == null ? void 0 : o.sort(S.tagsSorter)), l.value = t;
15
+ getHeadingId: R,
16
+ getModelId: q,
17
+ getOperationId: J,
18
+ getSectionId: X,
19
+ getTagId: Y,
20
+ getWebhookId: T,
21
+ hash: k
22
+ } = oe(), l = w(void 0), f = N({});
23
+ function K(t) {
24
+ var m, p, A;
25
+ f.tagsSorter === "alpha" ? t.tags = (m = t.tags) == null ? void 0 : m.sort((a, u) => a.name.localeCompare(u.name)) : typeof f.tagsSorter == "function" && (t.tags = (p = t.tags) == null ? void 0 : p.sort(f.tagsSorter));
26
+ const o = (a, u) => {
27
+ const v = a.name ?? a.path, O = u.name ?? u.path;
28
+ return v.localeCompare(O);
29
+ }, r = (a, u) => a.httpVerb.localeCompare(u.httpVerb);
30
+ let s;
31
+ return f.operationsSorter === "alpha" ? s = o : f.operationsSorter === "method" ? s = r : typeof f.operationsSorter == "function" && (s = f.operationsSorter), s && ((A = t.tags) == null || A.forEach((a) => {
32
+ var u;
33
+ a.operations = (u = a.operations) == null ? void 0 : u.sort(s);
34
+ })), l.value = t;
26
35
  }
27
- const X = m(!1), Y = m(!1), f = J(
28
- $["useSidebarContent-collapsedSidebarItems"] ?? {}
36
+ const Z = w(!1), _ = w(!1), g = N(
37
+ ee["useSidebarContent-collapsedSidebarItems"] ?? {}
29
38
  );
30
- function ne(t) {
31
- f[t] = !f[t];
39
+ function ae(t) {
40
+ g[t] = !g[t];
32
41
  }
33
- function h(t, s) {
34
- f[t] = s;
42
+ function b(t, o) {
43
+ g[t] = o;
35
44
  }
36
- const C = m([]);
37
- function ae(t) {
38
- const s = ie(t), o = N(s);
39
- return s.filter((r) => (
45
+ const C = w([]);
46
+ function ue(t) {
47
+ const o = ie(t), r = U(o);
48
+ return o.filter((s) => (
40
49
  // highest level, eg. # Introduction
41
- r.depth === o || // second highest level, eg. ## Authentication
42
- r.depth === o + 1
50
+ s.depth === r || // second highest level, eg. ## Authentication
51
+ s.depth === r + 1
43
52
  ));
44
53
  }
45
- const Z = K(() => {
46
- var T, I, y, H, M, j, x, E, G, L;
47
- const { state: t } = re(), s = {}, {
48
- openApi: { globalSecurity: o }
49
- } = le(), r = [];
50
- let c = null;
54
+ const $ = Q(() => {
55
+ var I, M, H, B, E, j, x, V, F, G;
56
+ const { state: t } = le(), o = {}, {
57
+ openApi: { globalSecurity: r }
58
+ } = ne(), s = [];
59
+ let m = null;
51
60
  C.value.forEach((e) => {
52
61
  var i;
53
- e.depth === N(C.value) ? (c = {
54
- id: z(e),
62
+ e.depth === U(C.value) ? (m = {
63
+ id: R(e),
55
64
  title: e.value,
56
65
  show: !t.showApiClient,
57
66
  children: []
58
- }, r.push(c)) : c && ((i = c.children) == null || i.push({
59
- id: z(e),
67
+ }, s.push(m)) : m && ((i = m.children) == null || i.push({
68
+ id: R(e),
60
69
  title: e.value,
61
70
  show: !t.showApiClient
62
71
  }));
63
72
  });
64
- const p = (I = (T = l.value) == null ? void 0 : T.tags) == null ? void 0 : I[0], v = p && ((e) => (e == null ? void 0 : e.length) !== 1 || e[0].name !== "default" || e[0].description !== "")((y = l.value) == null ? void 0 : y.tags) ? (M = (H = l.value) == null ? void 0 : H.tags) == null ? void 0 : M.filter((e) => {
73
+ const p = (M = (I = l.value) == null ? void 0 : I.tags) == null ? void 0 : M[0], a = p && ((e) => (e == null ? void 0 : e.length) !== 1 || e[0].name !== "default" || e[0].description !== "")((H = l.value) == null ? void 0 : H.tags) ? (E = (B = l.value) == null ? void 0 : B.tags) == null ? void 0 : E.filter((e) => {
65
74
  var i;
66
75
  return ((i = e.operations) == null ? void 0 : i.length) > 0;
67
76
  }).map((e) => {
68
77
  var i;
69
78
  return {
70
- id: U(e),
79
+ id: Y(e),
71
80
  title: e.name,
72
81
  displayTitle: e["x-displayName"] ?? e.name,
73
82
  show: !0,
74
83
  children: (i = e.operations) == null ? void 0 : i.map(
75
84
  (n) => {
76
- var d;
77
- const a = R(n, e), u = n.name ?? n.path;
78
- return s[a] = u, {
79
- id: a,
80
- title: u,
85
+ var h;
86
+ const c = J(n, e), d = n.name ?? n.path;
87
+ return o[c] = d, {
88
+ id: c,
89
+ title: d,
81
90
  httpVerb: n.httpVerb,
82
- deprecated: ((d = n.information) == null ? void 0 : d.deprecated) ?? !1,
91
+ deprecated: ((h = n.information) == null ? void 0 : h.deprecated) ?? !1,
83
92
  show: !0,
84
93
  select: () => {
85
- t.showApiClient && D(n, o);
94
+ t.showApiClient && D(n, r);
86
95
  }
87
96
  };
88
97
  }
89
98
  )
90
99
  };
91
100
  }) : (j = p == null ? void 0 : p.operations) == null ? void 0 : j.map((e) => {
92
- var a;
93
- const i = R(e, p), n = e.name ?? e.path;
94
- return s[i] = n, {
101
+ var c;
102
+ const i = J(e, p), n = e.name ?? e.path;
103
+ return o[i] = n, {
95
104
  id: i,
96
105
  title: n,
97
106
  httpVerb: e.httpVerb,
98
- deprecated: ((a = e.information) == null ? void 0 : a.deprecated) ?? !1,
107
+ deprecated: ((c = e.information) == null ? void 0 : c.deprecated) ?? !1,
99
108
  show: !0,
100
109
  select: () => {
101
- t.showApiClient && D(e, o);
110
+ t.showApiClient && D(e, r);
102
111
  }
103
112
  };
104
113
  });
105
- let g = se(l.value) && !X.value ? [
114
+ let u = se(l.value) && !Z.value ? [
106
115
  {
107
- id: P(),
116
+ id: q(),
108
117
  title: "Models",
109
118
  show: !t.showApiClient,
110
- children: Object.keys(F(l.value) ?? {}).map(
119
+ children: Object.keys(z(l.value) ?? {}).map(
111
120
  (e) => {
112
121
  var n;
113
- const i = P(e);
114
- return s[i] = e, {
122
+ const i = q(e);
123
+ return o[i] = e, {
115
124
  id: i,
116
- title: ((n = F(l.value)) == null ? void 0 : n[e]).title ?? e,
125
+ title: ((n = z(l.value)) == null ? void 0 : n[e]).title ?? e,
117
126
  show: !t.showApiClient
118
127
  };
119
128
  }
120
129
  )
121
130
  }
122
- ] : [], w = oe(l.value) ? [
131
+ ] : [], v = re(l.value) ? [
123
132
  {
124
- id: A(),
133
+ id: T(),
125
134
  title: "Webhooks",
126
135
  show: !t.showApiClient,
127
136
  children: Object.keys(((x = l.value) == null ? void 0 : x.webhooks) ?? {}).map((e) => {
128
- var n, a;
129
- const i = A(e);
130
- return s[i] = e, Object.keys(
131
- ((a = (n = l.value) == null ? void 0 : n.webhooks) == null ? void 0 : a[e]) ?? {}
132
- ).map((u) => {
133
- var d, b, W;
137
+ var n, c;
138
+ const i = T(e);
139
+ return o[i] = e, Object.keys(
140
+ ((c = (n = l.value) == null ? void 0 : n.webhooks) == null ? void 0 : c[e]) ?? {}
141
+ ).map((d) => {
142
+ var h, S, L;
134
143
  return {
135
- id: A(e, u),
136
- title: (W = (b = (d = l.value) == null ? void 0 : d.webhooks) == null ? void 0 : b[e][u]) == null ? void 0 : W.name,
137
- httpVerb: u,
144
+ id: T(e, d),
145
+ title: (L = (S = (h = l.value) == null ? void 0 : h.webhooks) == null ? void 0 : S[e][d]) == null ? void 0 : L.name,
146
+ httpVerb: d,
138
147
  show: !t.showApiClient
139
148
  };
140
149
  });
141
150
  }).flat()
142
151
  }
143
152
  ] : [];
144
- const _ = (E = l.value) != null && E["x-tagGroups"] ? (L = (G = l.value) == null ? void 0 : G["x-tagGroups"]) == null ? void 0 : L.map((e) => {
145
- var a;
153
+ const O = (V = l.value) != null && V["x-tagGroups"] ? (G = (F = l.value) == null ? void 0 : F["x-tagGroups"]) == null ? void 0 : G.map((e) => {
154
+ var c;
146
155
  const i = [];
147
- return (a = e.tags) == null || a.map((u) => {
148
- if (u === "models" && g.length > 0)
149
- i.push(g[0]), g = [];
150
- else if (u === "webhooks" && w.length > 0)
151
- i.push(w[0]), w = [];
156
+ return (c = e.tags) == null || c.map((d) => {
157
+ if (d === "models" && u.length > 0)
158
+ i.push(u[0]), u = [];
159
+ else if (d === "webhooks" && v.length > 0)
160
+ i.push(v[0]), v = [];
152
161
  else {
153
- const d = v == null ? void 0 : v.find(
154
- (b) => b.title === u
162
+ const h = a == null ? void 0 : a.find(
163
+ (S) => S.title === d
155
164
  );
156
- d && i.push(d);
165
+ h && i.push(h);
157
166
  }
158
167
  }), {
159
168
  id: e.name,
@@ -162,76 +171,76 @@ const Z = K(() => {
162
171
  show: !0,
163
172
  isGroup: !0
164
173
  };
165
- }) : void 0, k = [
166
- ...r,
167
- ..._ ?? v ?? [],
168
- ...w,
169
- ...g
174
+ }) : void 0, y = [
175
+ ...s,
176
+ ...O ?? a ?? [],
177
+ ...v,
178
+ ...u
170
179
  ];
171
- return Y.value && k.forEach((e) => {
172
- h(e.id, !0), e.show = !0;
180
+ return _.value && y.forEach((e) => {
181
+ b(e.id, !0), e.show = !0;
173
182
  }), {
174
- entries: k,
175
- titles: s
183
+ entries: y,
184
+ titles: o
176
185
  };
177
- }), ue = m(!1), de = K(() => {
178
- var t, s;
179
- return ((s = (t = Z.value) == null ? void 0 : t.titles) == null ? void 0 : s[O.value]) ?? "";
180
- }), ce = (t) => {
181
- const s = Q(t);
182
- if (s !== t)
183
- if (f[s])
184
- V(t);
186
+ }), ce = w(!1), de = Q(() => {
187
+ var t, o;
188
+ return ((o = (t = $.value) == null ? void 0 : t.titles) == null ? void 0 : o[k.value]) ?? "";
189
+ }), pe = (t) => {
190
+ const o = X(t);
191
+ if (o !== t)
192
+ if (g[o])
193
+ P(t);
185
194
  else {
186
- const o = ee.on((r) => {
187
- r.id === t && (V(t), o());
195
+ const r = te.on((s) => {
196
+ s.id === t && (P(t), r());
188
197
  });
189
- h(s, !0);
198
+ b(o, !0);
190
199
  }
191
200
  };
192
- function Ie(t) {
193
- return Object.assign(S, t), t != null && t.parsedSpec && (q(t.parsedSpec), B(
201
+ function ye(t) {
202
+ return Object.assign(f, t), t != null && t.parsedSpec && (K(t.parsedSpec), W(
194
203
  () => {
195
- var s, o;
196
- return (o = (s = l.value) == null ? void 0 : s.tags) == null ? void 0 : o.length;
204
+ var o, r;
205
+ return (r = (o = l.value) == null ? void 0 : o.tags) == null ? void 0 : r.length;
197
206
  },
198
207
  () => {
199
- var s, o;
200
- if (O.value) {
201
- const r = Q(O.value);
202
- r && h(r, !0);
208
+ var o, r;
209
+ if (k.value) {
210
+ const s = X(k.value);
211
+ s && b(s, !0);
203
212
  } else {
204
- const r = (o = (s = l.value) == null ? void 0 : s.tags) == null ? void 0 : o[0];
205
- r && h(U(r), !0);
213
+ const s = (r = (o = l.value) == null ? void 0 : o.tags) == null ? void 0 : r[0];
214
+ s && b(Y(s), !0);
206
215
  }
207
216
  }
208
- ), B(
217
+ ), W(
209
218
  () => {
210
- var s, o;
211
- return (o = (s = l.value) == null ? void 0 : s.info) == null ? void 0 : o.description;
219
+ var o, r;
220
+ return (r = (o = l.value) == null ? void 0 : o.info) == null ? void 0 : r.description;
212
221
  },
213
222
  () => {
214
- var o, r;
215
- const s = (r = (o = l.value) == null ? void 0 : o.info) == null ? void 0 : r.description;
216
- return s ? C.value = ae(s) : C.value = [];
223
+ var r, s;
224
+ const o = (s = (r = l.value) == null ? void 0 : r.info) == null ? void 0 : s.description;
225
+ return o ? C.value = ue(o) : C.value = [];
217
226
  },
218
227
  {
219
228
  immediate: !0
220
229
  }
221
230
  )), {
222
231
  breadcrumb: de,
223
- items: Z,
224
- isSidebarOpen: ue,
225
- collapsedSidebarItems: f,
226
- toggleCollapsedSidebarItem: ne,
227
- setCollapsedSidebarItem: h,
228
- hideModels: X,
229
- setParsedSpec: q,
230
- defaultOpenAllTags: Y,
231
- scrollToOperation: ce
232
+ items: $,
233
+ isSidebarOpen: ce,
234
+ collapsedSidebarItems: g,
235
+ toggleCollapsedSidebarItem: ae,
236
+ setCollapsedSidebarItem: b,
237
+ hideModels: Z,
238
+ setParsedSpec: K,
239
+ defaultOpenAllTags: _,
240
+ scrollToOperation: pe
232
241
  };
233
242
  }
234
243
  export {
235
- ce as scrollToOperation,
236
- Ie as useSidebar
244
+ pe as scrollToOperation,
245
+ ye as useSidebar
237
246
  };