@scalar/api-reference 1.25.6 → 1.25.9

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 (122) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/browser/standalone.js +10872 -11312
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiClientModal.vue.js +5 -5
  5. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  6. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  7. package/dist/components/ApiReferenceLayout.vue2.js +56 -53
  8. package/dist/components/Content/Authentication/Authentication.vue.js +1 -1
  9. package/dist/components/Content/Introduction/Introduction.vue.d.ts +1 -1
  10. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  11. package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
  12. package/dist/components/Content/Introduction/Introduction.vue2.js +9 -9
  13. package/dist/components/Content/Models/Models.vue.d.ts +1 -1
  14. package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
  15. package/dist/components/Content/Models/Models.vue.js +1 -1
  16. package/dist/components/Content/Models/Models.vue2.js +65 -42
  17. package/dist/components/Content/Models/ModelsAccordion.vue.d.ts +1 -1
  18. package/dist/components/Content/Models/ModelsAccordion.vue.d.ts.map +1 -1
  19. package/dist/components/Content/Models/ModelsAccordion.vue.js +1 -1
  20. package/dist/components/Content/Operation/Operation.vue.d.ts.map +1 -1
  21. package/dist/components/Content/Operation/Operation.vue.js +2 -2
  22. package/dist/components/Content/Operation/Operation.vue2.js +46 -59
  23. package/dist/components/Content/Schema/Schema.vue.d.ts +1 -1
  24. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  25. package/dist/components/Content/Schema/Schema.vue.js +2 -2
  26. package/dist/components/Content/Schema/Schema.vue2.js +18 -18
  27. package/dist/components/Content/Schema/SchemaHeading.vue.d.ts +1 -1
  28. package/dist/components/Content/Schema/SchemaHeading.vue.d.ts.map +1 -1
  29. package/dist/components/Content/Schema/SchemaHeading.vue.js +2 -2
  30. package/dist/components/Content/Schema/SchemaHeading.vue2.js +14 -14
  31. package/dist/components/Content/Webhooks/Webhook.vue.d.ts.map +1 -1
  32. package/dist/components/Content/Webhooks/Webhook.vue.js +5 -33
  33. package/dist/components/Content/Webhooks/Webhook.vue2.js +37 -2
  34. package/dist/components/Content/Webhooks/Webhooks.vue.d.ts.map +1 -1
  35. package/dist/components/Content/Webhooks/Webhooks.vue.js +2 -2
  36. package/dist/components/Content/Webhooks/Webhooks.vue2.js +93 -62
  37. package/dist/components/Section/CompactSection.vue.d.ts +28 -0
  38. package/dist/components/Section/CompactSection.vue.d.ts.map +1 -0
  39. package/dist/components/Section/CompactSection.vue.js +7 -0
  40. package/dist/components/Section/CompactSection.vue2.js +59 -0
  41. package/dist/components/Section/index.d.ts +1 -0
  42. package/dist/components/Section/index.d.ts.map +1 -1
  43. package/dist/{components/Content/Models/CollapsedModel.vue.d.ts → embeds/ExampleRequest/ExampleRequest.vue.d.ts} +9 -5
  44. package/dist/embeds/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -0
  45. package/dist/embeds/ExampleRequest/index.d.ts +2 -0
  46. package/dist/embeds/ExampleRequest/index.d.ts.map +1 -0
  47. package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts +508 -0
  48. package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts.map +1 -0
  49. package/dist/embeds/OpenApiDocument/index.d.ts +3 -0
  50. package/dist/embeds/OpenApiDocument/index.d.ts.map +1 -0
  51. package/dist/embeds/OpenApiDocument/types.d.ts +3 -0
  52. package/dist/embeds/OpenApiDocument/types.d.ts.map +1 -0
  53. package/dist/embeds/index.d.ts +3 -0
  54. package/dist/embeds/index.d.ts.map +1 -0
  55. package/dist/features/BaseUrl/BaseUrl.vue.d.ts.map +1 -1
  56. package/dist/features/BaseUrl/BaseUrl.vue.js +24 -74
  57. package/dist/features/BaseUrl/types.d.ts +1 -1
  58. package/dist/features/BaseUrl/types.d.ts.map +1 -1
  59. package/dist/features/BaseUrl/utils/getServers.d.ts +3 -2
  60. package/dist/features/BaseUrl/utils/getServers.d.ts.map +1 -1
  61. package/dist/{components/Content/Introduction/DownloadSpec.vue.d.ts → features/DownloadLink/DownloadLink.vue.d.ts} +1 -1
  62. package/dist/features/DownloadLink/DownloadLink.vue.d.ts.map +1 -0
  63. package/dist/features/DownloadLink/DownloadLink.vue.js +7 -0
  64. package/dist/features/DownloadLink/DownloadLink.vue2.js +36 -0
  65. package/dist/features/DownloadLink/index.d.ts +2 -0
  66. package/dist/features/DownloadLink/index.d.ts.map +1 -0
  67. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts +1 -3
  68. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  69. package/dist/features/ExampleRequest/ExampleRequest.vue.js +2 -2
  70. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +127 -122
  71. package/dist/features/Search/SearchModal.vue.d.ts.map +1 -1
  72. package/dist/features/Search/SearchModal.vue.js +3 -3
  73. package/dist/features/Search/SearchModal.vue2.js +63 -58
  74. package/dist/helpers/createEmptySpecification.d.ts +1 -1
  75. package/dist/helpers/createEmptySpecification.d.ts.map +1 -1
  76. package/dist/helpers/getApiClientRequest.d.ts +1 -1
  77. package/dist/helpers/getApiClientRequest.d.ts.map +1 -1
  78. package/dist/helpers/getHarRequest.d.ts.map +1 -1
  79. package/dist/helpers/getHarRequest.js +8 -15
  80. package/dist/helpers/getModels.d.ts +1 -1
  81. package/dist/helpers/getModels.d.ts.map +1 -1
  82. package/dist/helpers/openClientFor.d.ts +1 -1
  83. package/dist/helpers/openClientFor.d.ts.map +1 -1
  84. package/dist/helpers/openClientFor.js +5 -5
  85. package/dist/helpers/parse.d.ts.map +1 -1
  86. package/dist/helpers/provideSymbols.d.ts +3 -2
  87. package/dist/helpers/provideSymbols.d.ts.map +1 -1
  88. package/dist/helpers/provideSymbols.js +3 -2
  89. package/dist/index.js +65 -64
  90. package/dist/legacy/components/SecurityScheme.vue.d.ts +1 -1
  91. package/dist/legacy/components/SecurityScheme.vue.d.ts.map +1 -1
  92. package/dist/legacy/components/SecurityScheme.vue.js +2 -2
  93. package/dist/legacy/components/SecurityScheme.vue2.js +57 -53
  94. package/dist/legacy/components/SecuritySchemeSelector.vue.d.ts +1 -1
  95. package/dist/legacy/components/SecuritySchemeSelector.vue.d.ts.map +1 -1
  96. package/dist/legacy/components/SecuritySchemeSelector.vue.js +4 -4
  97. package/dist/legacy/components/SecuritySchemeSelector.vue2.js +5 -5
  98. package/dist/legacy/helpers/getRequestFromAuthentication.d.ts +1 -1
  99. package/dist/legacy/helpers/getRequestFromAuthentication.d.ts.map +1 -1
  100. package/dist/legacy/helpers/getUrlFromServerState.d.ts +1 -1
  101. package/dist/legacy/helpers/getUrlFromServerState.d.ts.map +1 -1
  102. package/dist/legacy/helpers/index.d.ts +1 -1
  103. package/dist/legacy/helpers/normalizeHeaders.d.ts +2 -3
  104. package/dist/legacy/helpers/normalizeHeaders.d.ts.map +1 -1
  105. package/dist/legacy/helpers/normalizeHeaders.js +24 -0
  106. package/dist/legacy/stores/useOpenApiStore.d.ts +2 -2
  107. package/dist/legacy/stores/useOpenApiStore.d.ts.map +1 -1
  108. package/dist/legacy/stores/useServerStore.d.ts +32 -6
  109. package/dist/legacy/stores/useServerStore.d.ts.map +1 -1
  110. package/dist/legacy/stores/useServerStore.js +70 -11
  111. package/dist/legacy/types.d.ts +0 -23
  112. package/dist/legacy/types.d.ts.map +1 -1
  113. package/dist/style.css +1 -1
  114. package/package.json +13 -12
  115. package/dist/components/Content/Introduction/DownloadSpec.vue.d.ts.map +0 -1
  116. package/dist/components/Content/Introduction/DownloadSpec.vue.js +0 -7
  117. package/dist/components/Content/Introduction/DownloadSpec.vue2.js +0 -30
  118. package/dist/components/Content/Models/CollapsedModel.vue.d.ts.map +0 -1
  119. package/dist/components/Content/Models/CollapsedModel.vue.js +0 -7
  120. package/dist/components/Content/Models/CollapsedModel.vue2.js +0 -70
  121. package/dist/features/BaseUrl/utils/index.d.ts +0 -2
  122. package/dist/features/BaseUrl/utils/index.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-parser';
1
+ import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
3
3
  value?: OpenAPIV2.SecuritySchemeObject | OpenAPIV3.SecuritySchemeObject | OpenAPIV3_1.SecuritySchemeObject;
4
4
  proxy?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"SecurityScheme.vue.d.ts","sourceRoot":"","sources":["../../../src/legacy/components/SecurityScheme.vue"],"names":[],"mappings":"AAqeA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;;YAiBzE,SAAS,CAAC,oBAAoB,GAC9B,SAAS,CAAC,oBAAoB,GAC9B,WAAW,CAAC,oBAAoB;YAC5B,MAAM;;YAHV,SAAS,CAAC,oBAAoB,GAC9B,SAAS,CAAC,oBAAoB,GAC9B,WAAW,CAAC,oBAAoB;YAC5B,MAAM;;AAstBhB,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"SecurityScheme.vue.d.ts","sourceRoot":"","sources":["../../../src/legacy/components/SecurityScheme.vue"],"names":[],"mappings":"AAueA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;;YAiBxE,SAAS,CAAC,oBAAoB,GAC9B,SAAS,CAAC,oBAAoB,GAC9B,WAAW,CAAC,oBAAoB;YAC5B,MAAM;;YAHV,SAAS,CAAC,oBAAoB,GAC9B,SAAS,CAAC,oBAAoB,GAC9B,WAAW,CAAC,oBAAoB;YAC5B,MAAM;;AAouBhB,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./SecurityScheme.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-3bdd11a8"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9d9c4ab4"]]);
5
5
  export {
6
- a as default
6
+ m as default
7
7
  };
@@ -1,23 +1,23 @@
1
- import { defineComponent as J, computed as Q, openBlock as n, createBlock as w, withCtx as s, unref as u, createElementBlock as P, Fragment as C, createTextVNode as c, toDisplayString as X, createCommentVNode as f, createVNode as i, createElementVNode as W } from "vue";
2
- import { concatenateUrlAndPath as Y, redirectToProxy as Z } from "@scalar/oas-utils/helpers";
3
- import { useToasts as _ } from "@scalar/use-toasts";
4
- import x from "./CardForm.vue.js";
5
- import ee from "./CardFormButton.vue.js";
1
+ import { defineComponent as J, computed as Q, openBlock as n, createBlock as w, withModifiers as X, withCtx as s, unref as u, createElementBlock as P, Fragment as S, createTextVNode as i, toDisplayString as Y, createCommentVNode as f, createVNode as d, createElementVNode as W } from "vue";
2
+ import { concatenateUrlAndPath as Z, redirectToProxy as _ } from "@scalar/oas-utils/helpers";
3
+ import { useToasts as x } from "@scalar/use-toasts";
4
+ import ee from "./CardForm.vue.js";
5
+ import te from "./CardFormButton.vue.js";
6
6
  import b from "./CardFormGroup.vue.js";
7
7
  import j from "./CardFormRows.vue.js";
8
8
  import v from "./CardFormTextInput.vue.js";
9
9
  import K from "./SecuritySchemeScopes.vue.js";
10
- import { getUrlFromServerState as te } from "../helpers/getUrlFromServerState.js";
11
10
  import { useServerStore as ae } from "../stores/useServerStore.js";
12
- import { useAuthenticationStore as oe } from "../stores/useAuthenticationStore.js";
13
- const fe = /* @__PURE__ */ J({
11
+ import { getUrlFromServerState as oe } from "../helpers/getUrlFromServerState.js";
12
+ import { useAuthenticationStore as se } from "../stores/useAuthenticationStore.js";
13
+ const Ae = /* @__PURE__ */ J({
14
14
  __name: "SecurityScheme",
15
15
  props: {
16
16
  value: {},
17
17
  proxy: {}
18
18
  },
19
- setup(se) {
20
- const { toast: R } = _(), { server: L } = ae(), { authentication: t, setAuthentication: p } = oe(), N = (e) => {
19
+ setup(re) {
20
+ const { toast: R } = x(), { server: L } = ae(), { authentication: t, setAuthentication: p } = se(), N = (e) => {
21
21
  p({
22
22
  apiKey: {
23
23
  ...t.apiKey,
@@ -54,7 +54,7 @@ const fe = /* @__PURE__ */ J({
54
54
  }
55
55
  }
56
56
  });
57
- }, S = (e) => {
57
+ }, C = (e) => {
58
58
  p({
59
59
  oAuth2: {
60
60
  ...t.oAuth2,
@@ -68,7 +68,7 @@ const fe = /* @__PURE__ */ J({
68
68
  username: e.target.value
69
69
  }
70
70
  });
71
- }, G = (e) => {
71
+ }, M = (e) => {
72
72
  p({
73
73
  oAuth2: {
74
74
  ...t.oAuth2,
@@ -76,7 +76,7 @@ const fe = /* @__PURE__ */ J({
76
76
  }
77
77
  });
78
78
  };
79
- function M(e) {
79
+ function G(e) {
80
80
  const a = t.oAuth2.scopes.join(" "), l = (Math.random() + 1).toString(36).substring(7), o = new URL(e.authorizationUrl);
81
81
  return p({
82
82
  oAuth2: { ...t.oAuth2, state: l }
@@ -87,9 +87,9 @@ const fe = /* @__PURE__ */ J({
87
87
  console.log("tokenUrl is not a string");
88
88
  return;
89
89
  }
90
- const l = a != null && a.baseUrl && !e.startsWith("http") ? Y(a == null ? void 0 : a.baseUrl, e) : e, o = new URL(l);
90
+ const l = a != null && a.baseUrl && !e.startsWith("http") ? Z(a == null ? void 0 : a.baseUrl, e) : e, o = new URL(l);
91
91
  o.searchParams.set("grant_type", "password"), o.searchParams.set("username", t.oAuth2.username), o.searchParams.set("password", t.oAuth2.password), o.searchParams.set("client_id", t.oAuth2.clientId), o.searchParams.set("scope", t.oAuth2.scopes.join(" ")), fetch(
92
- a != null && a.proxy ? Z(a == null ? void 0 : a.proxy, o.toString()) : o.toString(),
92
+ a != null && a.proxy ? _(a == null ? void 0 : a.proxy, o.toString()) : o.toString(),
93
93
  {
94
94
  method: "POST",
95
95
  headers: {
@@ -136,7 +136,11 @@ const fe = /* @__PURE__ */ J({
136
136
  };
137
137
  return (e, a) => {
138
138
  var l;
139
- return e.value && ((l = e.value) != null && l.type) ? (n(), w(x, { key: 0 }, {
139
+ return e.value && ((l = e.value) != null && l.type) ? (n(), w(ee, {
140
+ key: 0,
141
+ onSubmit: a[5] || (a[5] = X(() => {
142
+ }, ["prevent"]))
143
+ }, {
140
144
  default: s(() => [
141
145
  e.value.type === "apiKey" ? (n(), w(v, {
142
146
  key: 0,
@@ -147,30 +151,30 @@ const fe = /* @__PURE__ */ J({
147
151
  onInput: N
148
152
  }, {
149
153
  default: s(() => {
150
- var o, r, d;
154
+ var o, r, c;
151
155
  return [
152
- e.value.in ? (n(), P(C, { key: 0 }, [
153
- c(X(((r = (o = e.value.in) == null ? void 0 : o.charAt(0)) == null ? void 0 : r.toUpperCase()) + ((d = e.value.in) == null ? void 0 : d.slice(1))), 1)
156
+ e.value.in ? (n(), P(S, { key: 0 }, [
157
+ i(Y(((r = (o = e.value.in) == null ? void 0 : o.charAt(0)) == null ? void 0 : r.toUpperCase()) + ((c = e.value.in) == null ? void 0 : c.slice(1))), 1)
154
158
  ], 64)) : f("", !0),
155
- c(" API ")
159
+ i(" API ")
156
160
  ];
157
161
  }),
158
162
  _: 1
159
- }, 8, ["id", "value"])) : e.value.type === "http" || e.value.type === "basic" ? (n(), P(C, { key: 1 }, [
163
+ }, 8, ["id", "value"])) : e.value.type === "http" || e.value.type === "basic" ? (n(), P(S, { key: 1 }, [
160
164
  e.value.type === "basic" || e.value.scheme === "basic" ? (n(), w(b, { key: 0 }, {
161
165
  default: s(() => [
162
- i(v, {
166
+ d(v, {
163
167
  id: "http.basic.username",
164
168
  placeholder: "Username",
165
169
  value: u(t).http.basic.username,
166
170
  onInput: V
167
171
  }, {
168
172
  default: s(() => [
169
- c(" Username ")
173
+ i(" Username ")
170
174
  ]),
171
175
  _: 1
172
176
  }, 8, ["value"]),
173
- i(v, {
177
+ d(v, {
174
178
  id: "http.basic.password",
175
179
  placeholder: "Password",
176
180
  type: "password",
@@ -178,7 +182,7 @@ const fe = /* @__PURE__ */ J({
178
182
  onInput: D
179
183
  }, {
180
184
  default: s(() => [
181
- c(" Password ")
185
+ i(" Password ")
182
186
  ]),
183
187
  _: 1
184
188
  }, 8, ["value"])
@@ -193,7 +197,7 @@ const fe = /* @__PURE__ */ J({
193
197
  onInput: E
194
198
  }, {
195
199
  default: s(() => [
196
- c(" Bearer Token ")
200
+ i(" Bearer Token ")
197
201
  ]),
198
202
  _: 1
199
203
  }, 8, ["value"])) : f("", !0)
@@ -201,20 +205,20 @@ const fe = /* @__PURE__ */ J({
201
205
  default: s(() => {
202
206
  var o, r;
203
207
  return [
204
- e.value.flows.implicit ? (n(), P(C, { key: 0 }, [
205
- u(t).oAuth2.accessToken ? (n(), P(C, { key: 0 }, [
206
- i(v, {
208
+ e.value.flows.implicit ? (n(), P(S, { key: 0 }, [
209
+ u(t).oAuth2.accessToken ? (n(), P(S, { key: 0 }, [
210
+ d(v, {
207
211
  id: "oAuth2.accessToken",
208
212
  placeholder: "xxxxx",
209
213
  type: "password",
210
214
  value: u(t).oAuth2.accessToken
211
215
  }, {
212
216
  default: s(() => [
213
- c(" Access Token ")
217
+ i(" Access Token ")
214
218
  ]),
215
219
  _: 1
216
220
  }, 8, ["value"]),
217
- i(ee, {
221
+ d(te, {
218
222
  onClick: a[0] || (a[0] = () => u(p)({
219
223
  oAuth2: {
220
224
  ...u(t).oAuth2,
@@ -224,7 +228,7 @@ const fe = /* @__PURE__ */ J({
224
228
  }))
225
229
  }, {
226
230
  default: s(() => [
227
- c(" Reset ")
231
+ i(" Reset ")
228
232
  ]),
229
233
  _: 1
230
234
  })
@@ -232,52 +236,52 @@ const fe = /* @__PURE__ */ J({
232
236
  ], 64)) : f("", !0),
233
237
  (r = (o = e.value) == null ? void 0 : o.flows) != null && r.password ? (n(), w(j, { key: 1 }, {
234
238
  default: s(() => [
235
- i(b, null, {
239
+ d(b, null, {
236
240
  default: s(() => [
237
- i(v, {
241
+ d(v, {
238
242
  id: "oAuth2.username",
239
243
  placeholder: "Username",
240
244
  value: u(t).oAuth2.username,
241
245
  onInput: H
242
246
  }, {
243
247
  default: s(() => [
244
- c(" Username ")
248
+ i(" Username ")
245
249
  ]),
246
250
  _: 1
247
251
  }, 8, ["value"]),
248
- i(v, {
252
+ d(v, {
249
253
  id: "oAuth2.password",
250
254
  placeholder: "Password",
251
255
  type: "password",
252
256
  value: u(t).oAuth2.password,
253
- onInput: G
257
+ onInput: M
254
258
  }, {
255
259
  default: s(() => [
256
- c(" Password ")
260
+ i(" Password ")
257
261
  ]),
258
262
  _: 1
259
263
  }, 8, ["value"])
260
264
  ]),
261
265
  _: 1
262
266
  }),
263
- i(b, null, {
267
+ d(b, null, {
264
268
  default: s(() => {
265
- var d, h, m, A, y, k, T, U, F, B, O;
269
+ var c, h, m, A, y, k, T, U, F, B, O;
266
270
  return [
267
- i(v, {
271
+ d(v, {
268
272
  id: "oAuth2.clientId",
269
273
  placeholder: "12345",
270
274
  type: "text",
271
275
  value: u(t).oAuth2.clientId,
272
- onInput: S
276
+ onInput: C
273
277
  }, {
274
278
  default: s(() => [
275
- c(" Client ID ")
279
+ i(" Client ID ")
276
280
  ]),
277
281
  _: 1
278
282
  }, 8, ["value"]),
279
283
  e.value !== void 0 && Object.entries(
280
- ((m = (h = (d = e.value) == null ? void 0 : d.flows) == null ? void 0 : h.implicit) == null ? void 0 : m.scopes) ?? ((k = (y = (A = e.value) == null ? void 0 : A.flows) == null ? void 0 : y.password) == null ? void 0 : k.scopes) ?? {}
284
+ ((m = (h = (c = e.value) == null ? void 0 : c.flows) == null ? void 0 : h.implicit) == null ? void 0 : m.scopes) ?? ((k = (y = (A = e.value) == null ? void 0 : A.flows) == null ? void 0 : y.password) == null ? void 0 : k.scopes) ?? {}
281
285
  ).length > 0 ? (n(), w(K, {
282
286
  key: 0,
283
287
  selected: I.value,
@@ -292,7 +296,7 @@ const fe = /* @__PURE__ */ J({
292
296
  return $(
293
297
  (z = (g = e.value.flows) == null ? void 0 : g.password) == null ? void 0 : z.tokenUrl,
294
298
  {
295
- baseUrl: u(te)(u(L)),
299
+ baseUrl: u(oe)(u(L)),
296
300
  proxy: e.proxy
297
301
  }
298
302
  );
@@ -306,24 +310,24 @@ const fe = /* @__PURE__ */ J({
306
310
  _: 1
307
311
  })) : (n(), w(j, { key: 2 }, {
308
312
  default: s(() => [
309
- i(b, null, {
313
+ d(b, null, {
310
314
  default: s(() => {
311
- var d, h;
315
+ var c, h;
312
316
  return [
313
- i(v, {
317
+ d(v, {
314
318
  id: "oAuth2.clientId",
315
319
  placeholder: "12345",
316
320
  type: "text",
317
321
  value: u(t).oAuth2.clientId,
318
- onInput: S
322
+ onInput: C
319
323
  }, {
320
324
  default: s(() => [
321
- c(" Client ID ")
325
+ i(" Client ID ")
322
326
  ]),
323
327
  _: 1
324
328
  }, 8, ["value"]),
325
329
  e.value !== void 0 && Object.entries(
326
- ((d = e.value.flows.implicit) == null ? void 0 : d.scopes) ?? e.value.flows.password.scopes
330
+ ((c = e.value.flows.implicit) == null ? void 0 : c.scopes) ?? e.value.flows.password.scopes
327
331
  ).length > 0 ? (n(), w(K, {
328
332
  key: 0,
329
333
  selected: I.value,
@@ -336,7 +340,7 @@ const fe = /* @__PURE__ */ J({
336
340
  onClick: a[4] || (a[4] = () => {
337
341
  var m, A, y, k;
338
342
  return q(
339
- M(
343
+ G(
340
344
  ((A = (m = e.value) == null ? void 0 : m.flows) == null ? void 0 : A.implicit) ?? ((k = (y = e.value) == null ? void 0 : y.flows) == null ? void 0 : k.password)
341
345
  )
342
346
  );
@@ -360,5 +364,5 @@ const fe = /* @__PURE__ */ J({
360
364
  }
361
365
  });
362
366
  export {
363
- fe as default
367
+ Ae as default
364
368
  };
@@ -1,4 +1,4 @@
1
- import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-parser';
1
+ import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
3
3
  value?: OpenAPIV2.SecurityDefinitionsObject | OpenAPIV3.ComponentsObject["securitySchemes"] | OpenAPIV3_1.ComponentsObject["securitySchemes"];
4
4
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -1 +1 @@
1
- {"version":3,"file":"SecuritySchemeSelector.vue.d.ts","sourceRoot":"","sources":["../../../src/legacy/components/SecuritySchemeSelector.vue"],"names":[],"mappings":"AAmLA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;;YASzE,SAAS,CAAC,yBAAyB,GACnC,SAAS,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAC7C,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;;;;YAF/C,SAAS,CAAC,yBAAyB,GACnC,SAAS,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAC7C,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;;;;AAoLrD,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"SecuritySchemeSelector.vue.d.ts","sourceRoot":"","sources":["../../../src/legacy/components/SecuritySchemeSelector.vue"],"names":[],"mappings":"AAmLA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;;YASxE,SAAS,CAAC,yBAAyB,GACnC,SAAS,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAC7C,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;;;;YAF/C,SAAS,CAAC,yBAAyB,GACnC,SAAS,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAC7C,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;;;;AAoLrD,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,7 +1,7 @@
1
- import o from "./SecuritySchemeSelector.vue2.js";
1
+ import e from "./SecuritySchemeSelector.vue2.js";
2
2
  /* empty css */
3
- import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-630d0ab4"]]);
3
+ import o from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const c = /* @__PURE__ */ o(e, [["__scopeId", "data-v-e77a5dfa"]]);
5
5
  export {
6
- m as default
6
+ c as default
7
7
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as N, onMounted as O, onServerPrefetch as k, computed as B, openBlock as i, createElementBlock as a, toDisplayString as d, createElementVNode as y, unref as c, createVNode as j, withModifiers as K, Fragment as P, renderList as V, createCommentVNode as $, pushScopeId as D, popScopeId as E } from "vue";
1
+ import { defineComponent as N, onMounted as O, onServerPrefetch as k, computed as B, openBlock as a, createElementBlock as i, toDisplayString as d, createElementVNode as y, unref as c, createVNode as j, withModifiers as K, Fragment as P, renderList as V, createCommentVNode as $, pushScopeId as D, popScopeId as E } from "vue";
2
2
  import { ScalarIcon as F } from "@scalar/components";
3
3
  import { useAuthenticationStore as H } from "../stores/useAuthenticationStore.js";
4
- const M = (r) => (D("data-v-630d0ab4"), r = r(), E(), r), T = {
4
+ const M = (r) => (D("data-v-e77a5dfa"), r = r(), E(), r), T = {
5
5
  key: 0,
6
6
  class: "security-scheme-label"
7
7
  }, z = {
@@ -34,7 +34,7 @@ const M = (r) => (D("data-v-630d0ab4"), r = r(), E(), r), T = {
34
34
  }, n = B(() => Object.keys(l.value ?? {}));
35
35
  return (e, t) => {
36
36
  var s, f;
37
- return n.value.length === 1 ? (i(), a("div", T, d(h((s = e.value) == null ? void 0 : s[n.value[0]], n.value[0])), 1)) : n.value.length > 1 ? (i(), a("div", z, [
37
+ return n.value.length === 1 ? (a(), i("div", T, d(h((s = e.value) == null ? void 0 : s[n.value[0]], n.value[0])), 1)) : n.value.length > 1 ? (a(), i("div", z, [
38
38
  y("span", q, d(c(o).preferredSecurityScheme ? h(
39
39
  (f = e.value) == null ? void 0 : f[c(o).preferredSecurityScheme],
40
40
  c(o).preferredSecurityScheme
@@ -47,9 +47,9 @@ const M = (r) => (D("data-v-630d0ab4"), r = r(), E(), r), T = {
47
47
  onInput: _
48
48
  }, [
49
49
  J,
50
- (i(!0), a(P, null, V(n.value, (u) => {
50
+ (a(!0), i(P, null, V(n.value, (u) => {
51
51
  var S;
52
- return i(), a("option", {
52
+ return a(), i("option", {
53
53
  key: u,
54
54
  value: u ?? null
55
55
  }, d(h((S = e.value) == null ? void 0 : S[u], u)), 9, Q);
@@ -1,4 +1,4 @@
1
- import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-parser';
1
+ import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  import type { AuthenticationState } from '@scalar/types/legacy';
3
3
  import type { HarRequest } from 'httpsnippet-lite';
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"getRequestFromAuthentication.d.ts","sourceRoot":"","sources":["../../../src/legacy/helpers/getRequestFromAuthentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAoClD;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,mBAAmB,EACnC,iBAAiB,CAAC,EAAE,CAChB,SAAS,CAAC,yBAAyB,GACnC,SAAS,CAAC,yBAAyB,GACnC,WAAW,CAAC,yBAAyB,CACxC,EAAE,GACF,OAAO,CAAC,UAAU,CAAC,CAuIrB;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAIhE;AAED,wBAAgB,sCAAsC,CACpD,cAAc,EAAE,mBAAmB,YAcpC"}
1
+ {"version":3,"file":"getRequestFromAuthentication.d.ts","sourceRoot":"","sources":["../../../src/legacy/helpers/getRequestFromAuthentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAoClD;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,mBAAmB,EACnC,iBAAiB,CAAC,EAAE,CAChB,SAAS,CAAC,yBAAyB,GACnC,SAAS,CAAC,yBAAyB,GACnC,WAAW,CAAC,yBAAyB,CACxC,EAAE,GACF,OAAO,CAAC,UAAU,CAAC,CAuIrB;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAIhE;AAED,wBAAgB,sCAAsC,CACpD,cAAc,EAAE,mBAAmB,YAcpC"}
@@ -1,4 +1,4 @@
1
- import type { ServerState } from '../types';
1
+ import type { ServerState } from '#legacy';
2
2
  /**
3
3
  * Get the URL from the server state.
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getUrlFromServerState.d.ts","sourceRoot":"","sources":["../../../src/legacy/helpers/getUrlFromServerState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,sBAWvD"}
1
+ {"version":3,"file":"getUrlFromServerState.d.ts","sourceRoot":"","sources":["../../../src/legacy/helpers/getUrlFromServerState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,sBAWvD"}
@@ -4,7 +4,7 @@ export * from './getRequestFromAuthentication.js';
4
4
  export * from './getUrlFromServerState.js';
5
5
  export * from './humanDiff';
6
6
  export * from './mapFromArray';
7
- export * from './normalizeHeaders';
7
+ export * from './normalizeHeaders.js';
8
8
  export * from './normalizePath';
9
9
  export * from './normalizeRequestMethod.js';
10
10
  export * from './normalizeUrl';
@@ -1,9 +1,8 @@
1
+ import type { Header } from '@scalar/types/legacy';
1
2
  /**
2
3
  * Transforms all header keys to lowercase
3
4
  *
4
5
  * { 'Content-Type': 'application/json' } -> { 'content-type': 'application/json' }
5
6
  */
6
- export declare const normalizeHeaders: (headers?: Record<string, any>) => {
7
- [k: string]: any;
8
- };
7
+ export declare const normalizeHeaders: (headers?: Record<string, any> | Header[]) => Record<string, any> | Header[];
9
8
  //# sourceMappingURL=normalizeHeaders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeHeaders.d.ts","sourceRoot":"","sources":["../../../src/legacy/helpers/normalizeHeaders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,aAAc,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;CAK3D,CAAA"}
1
+ {"version":3,"file":"normalizeHeaders.d.ts","sourceRoot":"","sources":["../../../src/legacy/helpers/normalizeHeaders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,aACjB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EAAE,KACvC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EA2B9B,CAAA"}
@@ -0,0 +1,24 @@
1
+ const m = (n) => {
2
+ if (Array.isArray(n)) {
3
+ const e = /* @__PURE__ */ new Map();
4
+ return n.forEach((r) => {
5
+ e.set(t(r.name), r);
6
+ }), Array.from(e.values()).map((r) => ({
7
+ ...r,
8
+ name: t(r.name)
9
+ }));
10
+ }
11
+ return Object.fromEntries(
12
+ Object.entries(n ?? {}).reverse().filter(
13
+ ([e, r], a, s) => s.findIndex(
14
+ ([o, i]) => t(o) === t(e)
15
+ ) === a
16
+ ).reverse().map(([e, r]) => [t(e), r])
17
+ );
18
+ };
19
+ function t(n) {
20
+ return n.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join("-");
21
+ }
22
+ export {
23
+ m as normalizeHeaders
24
+ };
@@ -1,4 +1,4 @@
1
- import type { OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-parser';
1
+ import type { OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  import type { TransformedOperation } from '@scalar/types/legacy';
3
3
  export type OpenApiState = {
4
4
  operation: Partial<TransformedOperation>;
@@ -40,7 +40,7 @@ export declare const useOpenApiStore: () => {
40
40
  content?: import("@scalar/types/legacy").RequestBodyMimeTypes;
41
41
  }[] | undefined;
42
42
  responses?: Record<string, import("@scalar/types/legacy").ScalarResponse>;
43
- security?: import("@scalar/types/legacy").OpenAPIV3.SecurityRequirementObject[];
43
+ security?: OpenAPIV3.SecurityRequirementObject[];
44
44
  requestBody?: {
45
45
  description?: string;
46
46
  required?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"useOpenApiStore.d.ts","sourceRoot":"","sources":["../../../src/legacy/stores/useOpenApiStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAA;IACxC,cAAc,EACV,SAAS,CAAC,yBAAyB,EAAE,GACrC,WAAW,CAAC,yBAAyB,EAAE,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,uBAAuB,QAAO,YAGzC,CAAA;AAoBF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA3BtB,SAAS,CAAC,yBAAyB,EAAE,GACrC,WAAW,CAAC,yBAAyB,EAAE;;iCAUT,oBAAoB,GAAG,SAAS;2CAQ/C,WAAW,CAAC,yBAAyB,EAAE,GAAG,SAAS;CAYtE,CAAA"}
1
+ {"version":3,"file":"useOpenApiStore.d.ts","sourceRoot":"","sources":["../../../src/legacy/stores/useOpenApiStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAA;IACxC,cAAc,EACV,SAAS,CAAC,yBAAyB,EAAE,GACrC,WAAW,CAAC,yBAAyB,EAAE,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,uBAAuB,QAAO,YAGzC,CAAA;AAoBF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA3BtB,SAAS,CAAC,yBAAyB,EAAE,GACrC,WAAW,CAAC,yBAAyB,EAAE;;iCAUT,oBAAoB,GAAG,SAAS;2CAQ/C,WAAW,CAAC,yBAAyB,EAAE,GAAG,SAAS;CAYtE,CAAA"}
@@ -1,14 +1,40 @@
1
- import type { ServerState } from '../types';
1
+ import type { OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types';
2
+ import type { Spec } from '@scalar/types/legacy';
3
+ import { type Ref } from 'vue';
4
+ export type ServerState = {
5
+ selectedServer: null | number;
6
+ description?: string;
7
+ servers?: (OpenAPIV3.ServerObject | OpenAPIV3_1.ServerObject)[];
8
+ variables: {
9
+ [key: string]: string;
10
+ };
11
+ };
2
12
  export declare const createEmptyServerState: () => ServerState;
3
- export declare const useServerStore: () => {
13
+ export declare const useServerStore: ({ specification, defaultServerUrl, servers, }?: {
14
+ specification?: Ref<Spec | undefined>;
15
+ /**
16
+ * The fallback server URL to use if no servers are found in the specification
17
+ */
18
+ defaultServerUrl?: Ref<string | undefined>;
19
+ /**
20
+ * Overwrite the list of servers
21
+ */
22
+ servers?: Ref<(OpenAPIV3.ServerObject | OpenAPIV3_1.ServerObject)[] | undefined>;
23
+ }) => {
4
24
  server: {
5
25
  selectedServer: null | number;
6
26
  description?: string;
7
- servers?: {
8
- url: string;
27
+ servers?: ({
28
+ url?: string;
29
+ description?: string;
30
+ variables?: {
31
+ [variable: string]: OpenAPIV3.ServerVariableObject;
32
+ };
33
+ } | {
34
+ url?: string;
9
35
  description?: string;
10
- variables?: import("../types").ServerVariables;
11
- }[] | undefined;
36
+ variables?: Record<string, OpenAPIV3_1.ServerVariableObject>;
37
+ })[] | undefined;
12
38
  variables: {
13
39
  [key: string]: string;
14
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useServerStore.d.ts","sourceRoot":"","sources":["../../../src/legacy/stores/useServerStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,eAAO,MAAM,sBAAsB,QAAO,WAIxC,CAAA;AAWF,eAAO,MAAM,cAAc;;;;;;;;;;;;;0BAPE,OAAO,CAAC,WAAW,CAAC;CAU/C,CAAA"}
1
+ {"version":3,"file":"useServerStore.d.ts","sourceRoot":"","sources":["../../../src/legacy/stores/useServerStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,KAAK,GAAG,EAAmB,MAAM,KAAK,CAAA;AAK/C,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,EAAE,IAAI,GAAG,MAAM,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,EAAE,CAAA;IAC/D,SAAS,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,sBAAsB,QAAO,WAIxC,CAAA;AA8CF,eAAO,MAAM,cAAc,mDAIxB;IACD,aAAa,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,CAAA;IACrC;;OAEG;IACH,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC1C;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,CACX,CAAC,SAAS,CAAC,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,EAAE,GAAG,SAAS,CAClE,CAAA;CACF;;wBAxEiB,IAAI,GAAG,MAAM;sBACf,MAAM;;;;;;;;;;;;mBAET;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE;;0BAWT,OAAO,CAAC,WAAW,CAAC;CA2GhD,CAAA"}
@@ -1,18 +1,77 @@
1
- import { reactive as t } from "vue";
2
- const s = () => ({
1
+ import { reactive as u, watch as g } from "vue";
2
+ import { getServers as S } from "../../features/BaseUrl/utils/getServers.js";
3
+ import { createEmptySpecification as b } from "../../helpers/createEmptySpecification.js";
4
+ const j = () => ({
3
5
  selectedServer: null,
4
6
  servers: [],
5
7
  variables: {}
6
- }), e = t(s()), c = (r) => {
7
- Object.assign(e, {
8
- ...e,
9
- ...r
8
+ }), r = u(j()), v = (t) => {
9
+ Object.assign(r, {
10
+ ...r,
11
+ ...t
10
12
  });
11
- }, v = () => ({
12
- server: e,
13
- setServer: c
13
+ };
14
+ function E(t) {
15
+ return Object.fromEntries(
16
+ Object.entries(t ?? {}).map(([m, e]) => {
17
+ var a, o, n;
18
+ return [
19
+ m,
20
+ // 1) Default
21
+ ((a = e.default) == null ? void 0 : a.toString()) ?? // 2) First enum value
22
+ ((n = (o = e.enum) == null ? void 0 : o[0]) == null ? void 0 : n.toString()) ?? // 3) Empty string
23
+ ""
24
+ ];
25
+ })
26
+ );
27
+ }
28
+ function O(t, m) {
29
+ return Object.fromEntries(
30
+ Object.entries(t).filter(
31
+ ([e]) => e in (m.variables ?? {})
32
+ )
33
+ );
34
+ }
35
+ const V = ({
36
+ specification: t,
37
+ defaultServerUrl: m,
38
+ servers: e
39
+ } = {}) => ((t == null ? void 0 : t.value) !== void 0 && g(
40
+ () => [t == null ? void 0 : t.value, e == null ? void 0 : e.value, m == null ? void 0 : m.value],
41
+ () => {
42
+ const a = (
43
+ // Use the specification
44
+ (e == null ? void 0 : e.value) === void 0 ? (t == null ? void 0 : t.value) ?? b() : (
45
+ // Or create an empty one with the specified servers list
46
+ b({
47
+ servers: e.value
48
+ })
49
+ )
50
+ ), o = S(a, {
51
+ defaultServerUrl: m == null ? void 0 : m.value
52
+ }), n = o == null ? void 0 : o[r.selectedServer ?? 0];
53
+ v({
54
+ servers: o,
55
+ variables: {
56
+ // Set the initial values for the variables
57
+ ...E((n == null ? void 0 : n.variables) ?? {}),
58
+ // Don’t overwrite existing values, but filter out non-existing variables
59
+ ...O(
60
+ r.variables,
61
+ (o == null ? void 0 : o[r.selectedServer ?? 0]) ?? {}
62
+ )
63
+ }
64
+ });
65
+ },
66
+ {
67
+ deep: !0,
68
+ immediate: !0
69
+ }
70
+ ), {
71
+ server: r,
72
+ setServer: v
14
73
  });
15
74
  export {
16
- s as createEmptyServerState,
17
- v as useServerStore
75
+ j as createEmptyServerState,
76
+ V as useServerStore
18
77
  };