@scalar/api-client 2.1.52 → 2.2.1

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 (205) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
  3. package/dist/components/AddressBar/AddressBar.vue.js +1 -1
  4. package/dist/components/AddressBar/AddressBar.vue2.js +36 -43
  5. package/dist/components/AddressBar/AddressBarHistory.vue.d.ts.map +1 -1
  6. package/dist/components/AddressBar/AddressBarHistory.vue.js +2 -2
  7. package/dist/components/AddressBar/AddressBarHistory.vue2.js +25 -24
  8. package/dist/components/AddressBar/AddressBarServer.vue.d.ts.map +1 -1
  9. package/dist/components/AddressBar/AddressBarServer.vue.js +32 -39
  10. package/dist/components/AddressBar/AddressBarServerItem.vue.d.ts.map +1 -1
  11. package/dist/components/AddressBar/AddressBarServerItem.vue.js +10 -15
  12. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  13. package/dist/components/CodeInput/CodeInput.vue.js +1 -1
  14. package/dist/components/CodeInput/CodeInput.vue2.js +48 -47
  15. package/dist/components/CodeInput/codeVariableWidget.d.ts +3 -2
  16. package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
  17. package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
  18. package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +15 -14
  19. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
  20. package/dist/components/CommandPalette/CommandPaletteExample.vue.js +18 -23
  21. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  22. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +27 -26
  23. package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
  24. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +19 -20
  25. package/dist/components/CommandPalette/CommandPaletteServer.vue.d.ts.map +1 -1
  26. package/dist/components/CommandPalette/CommandPaletteServer.vue.js +19 -24
  27. package/dist/components/CommandPalette/CommandPaletteTag.vue.d.ts.map +1 -1
  28. package/dist/components/CommandPalette/CommandPaletteTag.vue.js +23 -22
  29. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
  30. package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
  31. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +47 -46
  32. package/dist/components/DataTable/DataTableInput.vue.d.ts +1 -1
  33. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  34. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.d.ts.map +1 -1
  35. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +23 -28
  36. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
  37. package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
  38. package/dist/components/ImportCollection/ImportCollectionModal.vue.js +127 -96
  39. package/dist/components/ImportCollection/ImportNowButton.vue.d.ts.map +1 -1
  40. package/dist/components/ImportCollection/ImportNowButton.vue.js +28 -27
  41. package/dist/components/ImportCollection/IntegrationLogo.vue.d.ts +1 -1
  42. package/dist/components/ImportCollection/IntegrationLogo.vue.d.ts.map +1 -1
  43. package/dist/components/ImportCollection/IntegrationLogo.vue.js +14 -18
  44. package/dist/components/ImportCollection/WorkspaceSelector.vue.d.ts.map +1 -1
  45. package/dist/components/ImportCollection/WorkspaceSelector.vue.js +15 -14
  46. package/dist/components/Search/useSearch.d.ts.map +1 -1
  47. package/dist/components/Search/useSearch.js +20 -19
  48. package/dist/components/SideNav/SideNav.vue.js +4 -4
  49. package/dist/components/SideNav/SideNavRouterLink.vue.js +9 -9
  50. package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
  51. package/dist/components/TopNav/TopNav.vue.js +165 -5
  52. package/dist/components/TopNav/TopNav.vue2.js +2 -164
  53. package/dist/components/TopNav/TopNavItem.vue.d.ts +2 -2
  54. package/dist/components/TopNav/TopNavItem.vue.d.ts.map +1 -1
  55. package/dist/components/TopNav/TopNavItem.vue.js +2 -2
  56. package/dist/components/TopNav/TopNavItem.vue2.js +5 -5
  57. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.d.ts.map +1 -1
  58. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +1 -1
  59. package/dist/components/ViewLayout/ViewLayoutSection.vue.js +2 -2
  60. package/dist/hooks/index.js +3 -2
  61. package/dist/hooks/useLayout.d.ts +2 -0
  62. package/dist/hooks/useLayout.d.ts.map +1 -1
  63. package/dist/hooks/useLayout.js +4 -3
  64. package/dist/layouts/App/ApiClientApp.vue.d.ts +1 -1
  65. package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -1
  66. package/dist/layouts/App/ApiClientApp.vue.js +35 -31
  67. package/dist/layouts/App/MainLayout.vue.d.ts.map +1 -1
  68. package/dist/layouts/App/MainLayout.vue.js +3 -3
  69. package/dist/layouts/App/create-api-client-app.d.ts +669 -1232
  70. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  71. package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
  72. package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
  73. package/dist/layouts/Modal/ApiClientModal.vue2.js +24 -23
  74. package/dist/layouts/Modal/create-api-client-modal.d.ts +1382 -2508
  75. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  76. package/dist/layouts/Web/ApiClientWeb.vue.d.ts.map +1 -1
  77. package/dist/layouts/Web/ApiClientWeb.vue.js +34 -33
  78. package/dist/layouts/Web/create-api-client-web.d.ts +669 -1232
  79. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  80. package/dist/libs/create-client.d.ts +673 -1236
  81. package/dist/libs/create-client.d.ts.map +1 -1
  82. package/dist/libs/create-client.js +91 -102
  83. package/dist/libs/hot-keys.d.ts +1 -1
  84. package/dist/libs/send-request.d.ts +2 -3
  85. package/dist/libs/send-request.d.ts.map +1 -1
  86. package/dist/libs/send-request.js +127 -123
  87. package/dist/store/active-entities.d.ts +333 -0
  88. package/dist/store/active-entities.d.ts.map +1 -0
  89. package/dist/store/active-entities.js +97 -0
  90. package/dist/store/collections.d.ts +4 -274
  91. package/dist/store/collections.d.ts.map +1 -1
  92. package/dist/store/cookies.d.ts +4 -4
  93. package/dist/store/environment.d.ts +4 -4
  94. package/dist/store/import-spec.d.ts +0 -54
  95. package/dist/store/import-spec.d.ts.map +1 -1
  96. package/dist/store/index.js +4 -3
  97. package/dist/store/request-example.d.ts +4 -4
  98. package/dist/store/requests.d.ts +15 -15
  99. package/dist/store/security-schemes.d.ts +527 -317
  100. package/dist/store/security-schemes.d.ts.map +1 -1
  101. package/dist/store/security-schemes.js +33 -41
  102. package/dist/store/servers.d.ts +4 -4
  103. package/dist/store/store-context.d.ts +0 -3
  104. package/dist/store/store-context.d.ts.map +1 -1
  105. package/dist/store/store.d.ts +640 -5297
  106. package/dist/store/store.d.ts.map +1 -1
  107. package/dist/store/store.js +111 -189
  108. package/dist/store/tags.d.ts +4 -4
  109. package/dist/store/workspace.d.ts +14 -24
  110. package/dist/store/workspace.d.ts.map +1 -1
  111. package/dist/style.css +1 -1
  112. package/dist/tailwind/desktop-variants.d.ts +18 -0
  113. package/dist/tailwind/desktop-variants.d.ts.map +1 -0
  114. package/dist/views/Cookies/CookieForm.vue.d.ts.map +1 -1
  115. package/dist/views/Cookies/CookieForm.vue.js +14 -13
  116. package/dist/views/Cookies/CookieRaw.vue.d.ts.map +1 -1
  117. package/dist/views/Cookies/CookieRaw.vue.js +14 -13
  118. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts +3 -3
  119. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
  120. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  121. package/dist/views/Request/Request.vue.js +1 -1
  122. package/dist/views/Request/Request.vue2.js +92 -92
  123. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +2 -2
  124. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  125. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +96 -99
  126. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts +2 -2
  127. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts.map +1 -1
  128. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +49 -46
  129. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  130. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +2 -2
  131. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +94 -100
  132. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.d.ts.map +1 -1
  133. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.js +60 -67
  134. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts +1 -1
  135. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts.map +1 -1
  136. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
  137. package/dist/views/Request/RequestSection/RequestBody.vue.js +2 -2
  138. package/dist/views/Request/RequestSection/RequestBody.vue2.js +29 -28
  139. package/dist/views/Request/RequestSection/RequestParams.vue.d.ts.map +1 -1
  140. package/dist/views/Request/RequestSection/RequestParams.vue.js +11 -10
  141. package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts.map +1 -1
  142. package/dist/views/Request/RequestSection/RequestPathParams.vue.js +24 -28
  143. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
  144. package/dist/views/Request/RequestSection/RequestSection.vue.js +2 -2
  145. package/dist/views/Request/RequestSection/RequestSection.vue2.js +17 -16
  146. package/dist/views/Request/RequestSection/RequestTable.vue.d.ts +2 -2
  147. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  148. package/dist/views/Request/RequestSidebar.vue.js +1 -1
  149. package/dist/views/Request/RequestSidebar.vue2.js +72 -73
  150. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  151. package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
  152. package/dist/views/Request/RequestSidebarItem.vue2.js +111 -109
  153. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
  154. package/dist/views/Request/RequestSidebarItemMenu.vue.js +2 -2
  155. package/dist/views/Request/RequestSidebarItemMenu.vue2.js +15 -16
  156. package/dist/views/Request/RequestSubpageHeader.vue.js +1 -1
  157. package/dist/views/Request/RequestSubpageHeader.vue2.js +14 -14
  158. package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.d.ts.map +1 -1
  159. package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +1 -1
  160. package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +25 -21
  161. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.d.ts.map +1 -1
  162. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +2 -2
  163. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +26 -25
  164. package/dist/views/Request/ResponseSection/ResponseHeaders.vue.d.ts.map +1 -1
  165. package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +7 -7
  166. package/dist/views/Request/components/WorkspaceDropdown.vue.d.ts.map +1 -1
  167. package/dist/views/Request/components/WorkspaceDropdown.vue.js +32 -31
  168. package/dist/views/Request/consts/new-auth-options.d.ts +16 -8
  169. package/dist/views/Request/consts/new-auth-options.d.ts.map +1 -1
  170. package/dist/views/Request/consts/new-auth-options.js +16 -8
  171. package/dist/views/Request/handle-drag.d.ts +2 -1
  172. package/dist/views/Request/handle-drag.d.ts.map +1 -1
  173. package/dist/views/Request/handle-drag.js +23 -25
  174. package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -1
  175. package/dist/views/Request/hooks/useOpenApiWatcher.js +40 -39
  176. package/dist/views/Request/libs/auth.d.ts +1 -29
  177. package/dist/views/Request/libs/auth.d.ts.map +1 -1
  178. package/dist/views/Request/libs/auth.js +2 -9
  179. package/dist/views/Request/libs/index.js +6 -8
  180. package/dist/views/Request/libs/live-sync.d.ts +6 -5
  181. package/dist/views/Request/libs/live-sync.d.ts.map +1 -1
  182. package/dist/views/Request/libs/live-sync.js +164 -185
  183. package/dist/views/Request/libs/oauth2.d.ts +6 -10
  184. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  185. package/dist/views/Request/libs/oauth2.js +54 -69
  186. package/dist/views/Servers/ServerForm.vue.d.ts.map +1 -1
  187. package/dist/views/Servers/ServerForm.vue.js +14 -13
  188. package/dist/views/Servers/Servers.vue.d.ts.map +1 -1
  189. package/dist/views/Servers/Servers.vue2.js +18 -17
  190. package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
  191. package/dist/views/Settings/SettingsGeneral.vue.js +218 -126
  192. package/dist/views/Settings/{SettingsGeneralMode.vue.d.ts → components/SettingsAppearance.vue.d.ts} +2 -2
  193. package/dist/views/Settings/components/SettingsAppearance.vue.d.ts.map +1 -0
  194. package/dist/views/Settings/components/SettingsAppearance.vue.js +74 -0
  195. package/dist/views/Settings/components/SettingsAppearance.vue2.js +4 -0
  196. package/dist/views/Settings/components/SettingsSection.vue.d.ts +24 -0
  197. package/dist/views/Settings/components/SettingsSection.vue.d.ts.map +1 -0
  198. package/dist/views/Settings/components/SettingsSection.vue.js +24 -0
  199. package/dist/views/Settings/components/SettingsSection.vue2.js +4 -0
  200. package/package.json +9 -9
  201. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthModal.vue.d.ts +0 -16
  202. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthModal.vue.d.ts.map +0 -1
  203. package/dist/views/Settings/SettingsGeneralMode.vue.d.ts.map +0 -1
  204. package/dist/views/Settings/SettingsGeneralMode.vue.js +0 -78
  205. package/dist/views/Settings/SettingsGeneralMode.vue2.js +0 -4
@@ -1,56 +1,56 @@
1
- import { ERRORS as B, normalizeError as C } from "./errors.js";
2
- import { normalizeHeaders as H } from "./normalize-headers.js";
3
- import { replaceTemplateVariables as h } from "./string-template.js";
4
- import { canMethodHaveBody as q, isRelativePath as A, concatenateUrlAndPath as K, shouldUseProxy as S } from "@scalar/oas-utils/helpers";
5
- import g from "js-cookie";
1
+ import { ERRORS as U, normalizeError as B } from "./errors.js";
2
+ import { normalizeHeaders as M } from "./normalize-headers.js";
3
+ import { replaceTemplateVariables as f } from "./string-template.js";
4
+ import { canMethodHaveBody as H, isRelativePath as C, concatenateUrlAndPath as q, shouldUseProxy as S } from "@scalar/oas-utils/helpers";
5
+ import R from "js-cookie";
6
6
  import W from "whatwg-mimetype";
7
7
  import { textMediaTypes as _ } from "../views/Request/consts/mediaTypes.js";
8
- function j(a, o) {
9
- const n = new W(o);
10
- return _.includes(n.essence) ? new TextDecoder(n.parameters.get("charset")).decode(a) : new Blob([a], { type: n.essence });
8
+ function j(n, e) {
9
+ const t = new W(e);
10
+ return _.includes(t.essence) ? new TextDecoder(t.parameters.get("charset")).decode(n) : new Blob([n], { type: t.essence });
11
11
  }
12
- function Q(a, o) {
13
- const n = {};
14
- return a.parameters.headers.forEach((e) => {
15
- const m = e.key.trim().toLowerCase();
16
- e.enabled && (m !== "content-type" || e.value !== "multipart/form-data") && (n[m] = h(e.value, o));
17
- }), n;
12
+ function K(n, e) {
13
+ const t = {};
14
+ return n.parameters.headers.forEach((r) => {
15
+ const h = r.key.trim().toLowerCase();
16
+ r.enabled && (h !== "content-type" || r.value !== "multipart/form-data") && (t[h] = f(r.value, e));
17
+ }), t;
18
18
  }
19
- function V(a, o) {
20
- const n = new URLSearchParams();
21
- return a.parameters.query.forEach((e) => {
22
- e.enabled && e.value && n.append(e.key, h(e.value, o));
23
- }), n;
19
+ function Q(n, e) {
20
+ const t = new URLSearchParams();
21
+ return n.parameters.query.forEach((r) => {
22
+ r.enabled && r.value && t.append(r.key, f(r.value, e));
23
+ }), t;
24
24
  }
25
- function I({
26
- example: a,
27
- env: o,
28
- globalCookies: n,
29
- domain: e,
30
- proxy: m
25
+ function V({
26
+ example: n,
27
+ env: e,
28
+ globalCookies: t,
29
+ domain: r,
30
+ proxy: h
31
31
  }) {
32
- let f;
32
+ let m;
33
33
  try {
34
- f = new URL(m || e).host;
34
+ m = new URL(h || r).host;
35
35
  } catch {
36
- typeof window < "u" && (f = window.location.host);
36
+ typeof window < "u" && (m = window.location.host);
37
37
  }
38
- const l = {
38
+ const c = {
39
39
  // Must point all cookies to the proxy and let it sort them out
40
- domain: f,
40
+ domain: m,
41
41
  // Means that the browser sends the cookie with both cross-site and same-site requests.
42
42
  sameSite: "None",
43
43
  // The Secure attribute must also be set when setting SameSite=None.
44
44
  secure: !0
45
- }, i = g.get();
46
- return Object.keys(i).forEach((r) => g.remove(r)), a.parameters.cookies.forEach((r) => {
47
- r.enabled && g.set(r.key, h(r.value, o));
48
- }), n.forEach((r) => {
49
- var R;
50
- const { name: P, value: s, ...p } = r;
51
- (p.domain === e || ((R = p.domain) == null ? void 0 : R.startsWith(".")) && e.endsWith(p.domain ?? "")) && g.set(P, s, {
45
+ }, l = R.get();
46
+ return Object.keys(l).forEach((a) => R.remove(a)), n.parameters.cookies.forEach((a) => {
47
+ a.enabled && R.set(a.key, f(a.value, e));
48
+ }), t.forEach((a) => {
49
+ var u;
50
+ const { name: s, value: v, ...p } = a;
51
+ (p.domain === r || ((u = p.domain) == null ? void 0 : u.startsWith(".")) && r.endsWith(p.domain ?? "")) && R.set(s, v, {
52
52
  /** Override the domain with the proxy value */
53
- domain: f,
53
+ domain: m,
54
54
  // TODO: path cookies probably don't worth with the proxy
55
55
  path: p.path,
56
56
  expires: p.expires ? new Date(p.expires) : void 0,
@@ -58,136 +58,140 @@ function I({
58
58
  secure: p.secure
59
59
  });
60
60
  }), {
61
- cookieParams: l
61
+ cookieParams: c
62
62
  };
63
63
  }
64
- function N(a, o, n) {
65
- var e, m, f;
66
- if (!q(a))
64
+ function I(n, e, t) {
65
+ var r, h, m;
66
+ if (!H(n))
67
67
  return { body: void 0, contentType: void 0 };
68
- if (o.body.activeBody === "formData" && o.body.formData) {
69
- const l = o.body.formData.encoding === "form-data" ? "multipart/form-data" : "application/x-www-form-urlencoded", i = o.body.formData.encoding === "form-data" ? new FormData() : new URLSearchParams();
70
- return o.body.formData.value.forEach((r) => {
71
- !r.enabled || !r.key || (r.file && i instanceof FormData ? i.append(r.key, r.file, r.file.name) : r.value !== void 0 && i.append(r.key, h(r.value, n)));
72
- }), { body: i, contentType: l };
68
+ if (e.body.activeBody === "formData" && e.body.formData) {
69
+ const c = e.body.formData.encoding === "form-data" ? "multipart/form-data" : "application/x-www-form-urlencoded", l = e.body.formData.encoding === "form-data" ? new FormData() : new URLSearchParams();
70
+ return e.body.formData.value.forEach((a) => {
71
+ !a.enabled || !a.key || (a.file && l instanceof FormData ? l.append(a.key, a.file, a.file.name) : a.value !== void 0 && l.append(a.key, f(a.value, t)));
72
+ }), { body: l, contentType: c };
73
73
  }
74
- return o.body.activeBody === "raw" ? {
75
- body: h(((e = o.body.raw) == null ? void 0 : e.value) ?? "", n),
76
- contentType: (m = o.body.raw) == null ? void 0 : m.encoding
77
- } : o.body.activeBody === "binary" ? {
78
- body: o.body.binary,
79
- contentType: (f = o.body.binary) == null ? void 0 : f.type
74
+ return e.body.activeBody === "raw" ? {
75
+ body: f(((r = e.body.raw) == null ? void 0 : r.value) ?? "", t),
76
+ contentType: (h = e.body.raw) == null ? void 0 : h.encoding
77
+ } : e.body.activeBody === "binary" ? {
78
+ body: e.body.binary,
79
+ contentType: (m = e.body.binary) == null ? void 0 : m.type
80
80
  } : {
81
81
  body: void 0,
82
82
  contentType: void 0
83
83
  };
84
84
  }
85
- function Y(a) {
86
- return a.startsWith("http://") || a.startsWith("https://") ? a : `http://${a}`;
85
+ function N(n) {
86
+ return n.startsWith("http://") || n.startsWith("https://") ? n : `http://${n}`;
87
87
  }
88
- const ne = ({
89
- request: a,
90
- auth: o,
91
- example: n,
92
- server: e,
93
- securitySchemes: m,
94
- selectedSecuritySchemeUids: f = [],
95
- proxy: l,
96
- status: i,
97
- environment: r,
98
- globalCookies: P
88
+ const te = ({
89
+ request: n,
90
+ example: e,
91
+ server: t,
92
+ securitySchemes: r,
93
+ selectedSecuritySchemeUids: h = [],
94
+ proxy: m,
95
+ status: c,
96
+ environment: l,
97
+ globalCookies: a
99
98
  }) => {
100
99
  try {
101
- const s = r ?? {}, p = new AbortController(), T = n.parameters.path.reduce((u, t) => (t.enabled && (u[t.key] = h(t.value, s)), u), {}), R = h((e == null ? void 0 : e.url) ?? "", s), w = h(a.path, T);
102
- let d = R || w;
103
- if (!d) throw B.URL_EMPTY;
104
- Object.entries((e == null ? void 0 : e.variables) ?? {}).forEach(([u, t]) => {
105
- d = h(d, { [u]: t.default });
100
+ const s = l ?? {}, v = new AbortController(), p = e.parameters.path.reduce((y, o) => (o.enabled && (y[o.key] = f(o.value, s)), y), {}), L = f((t == null ? void 0 : t.url) ?? "", s), u = f(n.path, p);
101
+ let d = L || u;
102
+ if (!d) throw U.URL_EMPTY;
103
+ Object.entries((t == null ? void 0 : t.variables) ?? {}).forEach(([y, o]) => {
104
+ d = f(d, { [y]: o.default });
106
105
  });
107
- const E = V(n, s), b = Q(n, s), { body: $ } = N(a.method, n, s);
108
- return I({
109
- example: n,
106
+ const T = Q(e, s), b = K(e, s), { body: $ } = I(n.method, e, s);
107
+ return V({
108
+ example: e,
110
109
  env: s,
111
- globalCookies: P,
110
+ globalCookies: a,
112
111
  domain: d,
113
- proxy: l
114
- }), f == null || f.forEach((u) => {
115
- const t = o[u], y = m[u];
116
- if (!(!t || !y)) {
117
- if (y.type === "apiKey" && t.type === "apiKey") {
118
- const c = h(t.value, s);
119
- y.in === "header" && (b[t.name] = c), y.in === "query" && E.append(t.name, c), y.in === "cookie" && g.set(t.name, c);
112
+ proxy: m
113
+ }), h == null || h.forEach((y) => {
114
+ var D;
115
+ const o = r[y];
116
+ if (o) {
117
+ if (o.type === "apiKey") {
118
+ const i = f(o.value, s);
119
+ o.in === "header" && (b[o.name] = i), o.in === "query" && T.append(o.name, i), o.in === "cookie" && R.set(o.name, i);
120
120
  }
121
- if (y.type === "http" && t.type === "http")
122
- if (y.scheme === "basic") {
123
- const c = h(t.username, s), v = h(t.password, s), L = `${c}:${v}`;
124
- b.Authorization = `Basic ${btoa(L)}`;
121
+ if (o.type === "http")
122
+ if (o.scheme === "basic") {
123
+ const i = f(o.username, s), w = f(o.password, s), k = `${i}:${w}`;
124
+ b.Authorization = `Basic ${btoa(k)}`;
125
125
  } else {
126
- const c = h(t.token, s);
127
- b.Authorization = `Bearer ${c}`;
126
+ const i = f(o.token, s);
127
+ b.Authorization = `Bearer ${i}`;
128
128
  }
129
- y.type === "oauth2" && t.type.includes("oauth") && "token" in t && (t.token || console.error("OAuth token was not created"), b.Authorization = `Bearer ${t.token}`);
129
+ if (o.type === "oauth2") {
130
+ const w = (D = Object.values(o.flows).find((k) => k.token)) == null ? void 0 : D.token;
131
+ if (!w) return;
132
+ b.Authorization = `Bearer ${w}`;
133
+ }
130
134
  }
131
135
  }), [
132
136
  null,
133
137
  {
134
138
  sendRequest: async () => {
135
- i == null || i.emit("start");
136
- const u = Date.now();
139
+ c == null || c.emit("start");
140
+ const y = Date.now();
137
141
  try {
138
- if (d && (!A(d) || typeof window < "u")) {
139
- const z = A(d) ? K(window.location.origin, d) : Y(d), k = new URL(z), M = new URL(w, k.origin), D = new URL(k);
140
- e != null && e.url && (k.pathname === "/" ? D.pathname = w : D.pathname = k.pathname + w), D.search = new URLSearchParams([
141
- ...k.searchParams,
142
- ...M.searchParams,
143
- ...E
144
- ]).toString(), d = D.toString();
142
+ if (d && (!C(d) || typeof window < "u")) {
143
+ const z = C(d) ? q(window.location.origin, d) : N(d), g = new URL(z), A = new URL(u, g.origin), P = new URL(g);
144
+ t != null && t.url && (g.pathname === "/" ? P.pathname = u : P.pathname = g.pathname + u), P.search = new URLSearchParams([
145
+ ...g.searchParams,
146
+ ...A.searchParams,
147
+ ...T
148
+ ]).toString(), d = P.toString();
145
149
  }
146
- const t = new URLSearchParams([["scalar_url", d.toString()]]), y = S(l, d) ? `${l}?${t.toString()}` : d, c = await fetch(y, {
147
- signal: p.signal,
148
- method: a.method.toUpperCase(),
150
+ const o = new URLSearchParams([["scalar_url", d.toString()]]), D = S(m, d) ? `${m}?${o.toString()}` : d, i = await fetch(D, {
151
+ signal: v.signal,
152
+ method: n.method.toUpperCase(),
149
153
  body: $,
150
154
  headers: b
151
155
  });
152
- i == null || i.emit("stop");
153
- const v = H(
154
- c.headers,
155
- S(l, d)
156
- ), L = c.headers.get("content-type") ?? "text/plain;charset=UTF-8", U = await c.arrayBuffer(), F = j(U, L), O = "getSetCookie" in c.headers && typeof c.headers.getSetCookie == "function" ? c.headers.getSetCookie() : [];
156
+ c == null || c.emit("stop");
157
+ const w = M(
158
+ i.headers,
159
+ S(m, d)
160
+ ), k = i.headers.get("content-type") ?? "text/plain;charset=UTF-8", E = await i.arrayBuffer(), F = j(E, k), O = "getSetCookie" in i.headers && typeof i.headers.getSetCookie == "function" ? i.headers.getSetCookie() : [];
157
161
  return [
158
162
  null,
159
163
  {
160
164
  timestamp: Date.now(),
161
- request: n,
165
+ request: e,
162
166
  response: {
163
- ...c,
164
- headers: v,
167
+ ...i,
168
+ headers: w,
165
169
  cookieHeaderKeys: O,
166
170
  data: F,
167
- size: U.byteLength,
168
- duration: Date.now() - u,
169
- method: a.method,
170
- status: c.status,
171
- path: w
171
+ size: E.byteLength,
172
+ duration: Date.now() - y,
173
+ method: n.method,
174
+ status: i.status,
175
+ path: u
172
176
  }
173
177
  }
174
178
  ];
175
- } catch (t) {
176
- return i == null || i.emit("abort"), [C(t, B.REQUEST_FAILED), null];
179
+ } catch (o) {
180
+ return c == null || c.emit("abort"), [B(o, U.REQUEST_FAILED), null];
177
181
  }
178
182
  },
179
- controller: p
183
+ controller: v
180
184
  }
181
185
  ];
182
186
  } catch (s) {
183
- return i == null || i.emit("abort"), [C(s), null];
187
+ return c == null || c.emit("abort"), [B(s), null];
184
188
  }
185
189
  };
186
190
  export {
187
- N as createFetchBody,
188
- Q as createFetchHeaders,
189
- V as createFetchQueryParams,
190
- ne as createRequestOperation,
191
+ I as createFetchBody,
192
+ K as createFetchHeaders,
193
+ Q as createFetchQueryParams,
194
+ te as createRequestOperation,
191
195
  j as decodeBuffer,
192
- I as setRequestCookies
196
+ V as setRequestCookies
193
197
  };
@@ -0,0 +1,333 @@
1
+ import type { Environment } from '@scalar/oas-utils/entities/environment';
2
+ import type { Collection, Request, RequestExample, Server } from '@scalar/oas-utils/entities/spec';
3
+ import type { Workspace } from '@scalar/oas-utils/entities/workspace';
4
+ import { type InjectionKey } from 'vue';
5
+ import type { Router } from 'vue-router';
6
+ type CreateActiveEntitiesStoreParams = {
7
+ router: Router;
8
+ collections: Record<string, Collection>;
9
+ environments: Record<string, Environment>;
10
+ requestExamples: Record<string, RequestExample>;
11
+ requests: Record<string, Request>;
12
+ servers: Record<string, Server>;
13
+ workspaces: Record<string, Workspace>;
14
+ };
15
+ /**
16
+ * Create the active entities store
17
+ *
18
+ * We need the factory function to pass the router instance
19
+ */
20
+ export declare const createActiveEntitiesStore: ({ collections, environments, requestExamples, requests, router, servers, workspaces, }: CreateActiveEntitiesStoreParams) => {
21
+ activeCollection: import("vue").ComputedRef<{
22
+ type: "collection";
23
+ uid: string;
24
+ children: string[];
25
+ openapi: string;
26
+ security: Record<string, string[]>[];
27
+ 'x-scalar-icon': string;
28
+ securitySchemes: string[];
29
+ selectedSecuritySchemeUids: string[];
30
+ selectedServerUid: string;
31
+ servers: string[];
32
+ requests: string[];
33
+ tags: string[];
34
+ watchMode: boolean;
35
+ watchModeStatus: "IDLE" | "WATCHING" | "ERROR";
36
+ externalDocs?: {
37
+ url: string;
38
+ description?: string | undefined;
39
+ } | undefined;
40
+ jsonSchemaDialect?: string | undefined;
41
+ info?: {
42
+ title: string;
43
+ version: string;
44
+ description?: string | undefined;
45
+ summary?: string | undefined;
46
+ termsOfService?: string | undefined;
47
+ contact?: {
48
+ name?: string | undefined;
49
+ url?: string | undefined;
50
+ email?: string | undefined;
51
+ } | undefined;
52
+ license?: {
53
+ name: string;
54
+ identifier?: string | undefined;
55
+ url?: string | undefined;
56
+ } | undefined;
57
+ } | undefined;
58
+ components?: Record<string, unknown> | undefined;
59
+ webhooks?: Record<string, unknown> | undefined;
60
+ 'x-scalar-environment'?: string | undefined;
61
+ 'x-scalar-environments'?: Record<string, {
62
+ variables: Record<string, string | {
63
+ default: string;
64
+ description?: string | undefined;
65
+ }>;
66
+ description?: string | undefined;
67
+ color?: string | undefined;
68
+ }> | undefined;
69
+ 'x-scalar-secrets'?: Record<string, {
70
+ description?: string | undefined;
71
+ example?: string | undefined;
72
+ }> | undefined;
73
+ documentUrl?: string | undefined;
74
+ integration?: string | null | undefined;
75
+ } | undefined>;
76
+ activeCookieId: import("vue").ComputedRef<string | undefined>;
77
+ activeExample: import("vue").ComputedRef<{
78
+ type: "requestExample";
79
+ uid: string;
80
+ name: string;
81
+ body: {
82
+ activeBody: "formData" | "binary" | "raw";
83
+ formData?: {
84
+ value: {
85
+ value: string;
86
+ key: string;
87
+ enabled: boolean;
88
+ minimum?: number | undefined;
89
+ type?: string | undefined;
90
+ maximum?: number | undefined;
91
+ default?: any;
92
+ required?: boolean | undefined;
93
+ description?: string | undefined;
94
+ enum?: string[] | undefined;
95
+ format?: string | undefined;
96
+ file?: any;
97
+ nullable?: boolean | undefined;
98
+ }[];
99
+ encoding: "form-data" | "urlencoded";
100
+ } | undefined;
101
+ binary?: Blob | undefined;
102
+ raw?: {
103
+ value: string;
104
+ encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
105
+ } | undefined;
106
+ };
107
+ requestUid: string;
108
+ parameters: {
109
+ path: {
110
+ value: string;
111
+ key: string;
112
+ enabled: boolean;
113
+ minimum?: number | undefined;
114
+ type?: string | undefined;
115
+ maximum?: number | undefined;
116
+ default?: any;
117
+ required?: boolean | undefined;
118
+ description?: string | undefined;
119
+ enum?: string[] | undefined;
120
+ format?: string | undefined;
121
+ file?: any;
122
+ nullable?: boolean | undefined;
123
+ }[];
124
+ cookies: {
125
+ value: string;
126
+ key: string;
127
+ enabled: boolean;
128
+ minimum?: number | undefined;
129
+ type?: string | undefined;
130
+ maximum?: number | undefined;
131
+ default?: any;
132
+ required?: boolean | undefined;
133
+ description?: string | undefined;
134
+ enum?: string[] | undefined;
135
+ format?: string | undefined;
136
+ file?: any;
137
+ nullable?: boolean | undefined;
138
+ }[];
139
+ query: {
140
+ value: string;
141
+ key: string;
142
+ enabled: boolean;
143
+ minimum?: number | undefined;
144
+ type?: string | undefined;
145
+ maximum?: number | undefined;
146
+ default?: any;
147
+ required?: boolean | undefined;
148
+ description?: string | undefined;
149
+ enum?: string[] | undefined;
150
+ format?: string | undefined;
151
+ file?: any;
152
+ nullable?: boolean | undefined;
153
+ }[];
154
+ headers: {
155
+ value: string;
156
+ key: string;
157
+ enabled: boolean;
158
+ minimum?: number | undefined;
159
+ type?: string | undefined;
160
+ maximum?: number | undefined;
161
+ default?: any;
162
+ required?: boolean | undefined;
163
+ description?: string | undefined;
164
+ enum?: string[] | undefined;
165
+ format?: string | undefined;
166
+ file?: any;
167
+ nullable?: boolean | undefined;
168
+ }[];
169
+ };
170
+ serverVariables?: Record<string, string[]> | undefined;
171
+ } | undefined>;
172
+ activeRequest: import("vue").ComputedRef<{
173
+ path: string;
174
+ type: "request";
175
+ uid: string;
176
+ selectedSecuritySchemeUids: string[];
177
+ selectedServerUid: string;
178
+ servers: string[];
179
+ examples: string[];
180
+ method: "options" | "connect" | "delete" | "get" | "head" | "patch" | "post" | "put" | "trace";
181
+ description?: string | undefined;
182
+ summary?: string | undefined;
183
+ externalDocs?: {
184
+ url: string;
185
+ description?: string | undefined;
186
+ } | undefined;
187
+ security?: Record<string, string[]>[] | undefined;
188
+ tags?: string[] | undefined;
189
+ deprecated?: boolean | undefined;
190
+ operationId?: string | undefined;
191
+ parameters?: {
192
+ required: boolean;
193
+ name: string;
194
+ in: "path" | "query" | "header" | "cookie";
195
+ deprecated: boolean;
196
+ description?: string | undefined;
197
+ example?: unknown;
198
+ schema?: unknown;
199
+ content?: unknown;
200
+ style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
201
+ examples?: Record<string, {
202
+ value?: unknown;
203
+ summary?: string | undefined;
204
+ }> | undefined;
205
+ }[] | undefined;
206
+ requestBody?: any;
207
+ responses?: Record<string, any> | undefined;
208
+ } | undefined>;
209
+ activeRouterParams: import("vue").ComputedRef<{
210
+ collection: string;
211
+ environment: string;
212
+ request: string;
213
+ examples: string;
214
+ schema: string;
215
+ cookies: string;
216
+ servers: string;
217
+ workspace: string;
218
+ settings: string;
219
+ }>;
220
+ activeEnvironment: import("vue").ComputedRef<{
221
+ value: string;
222
+ uid: string;
223
+ name: string;
224
+ color: string;
225
+ isDefault?: boolean | undefined;
226
+ }>;
227
+ activeServer: import("vue").ComputedRef<{
228
+ uid: string;
229
+ url: string;
230
+ description?: string | undefined;
231
+ variables?: Record<string, Omit<import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject, "enum"> & {
232
+ enum?: [string, ...string[]];
233
+ }> | undefined;
234
+ }>;
235
+ activeWorkspace: import("vue").ComputedRef<{
236
+ uid: string;
237
+ name: string;
238
+ description: string;
239
+ collections: string[];
240
+ environments: string[];
241
+ activeEnvironmentId: string;
242
+ cookies: string[];
243
+ themeId: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "none";
244
+ hotKeyConfig?: {
245
+ modifiers: ("Meta" | "Control" | "Shift" | "Alt" | "default")[];
246
+ hotKeys?: Partial<Record<"" | "/" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
247
+ event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "createNew" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
248
+ modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default")[] | undefined;
249
+ }>> | undefined;
250
+ } | undefined;
251
+ proxyUrl?: string | undefined;
252
+ }>;
253
+ activeWorkspaceCollections: import("vue").ComputedRef<{
254
+ type: "collection";
255
+ uid: string;
256
+ children: string[];
257
+ openapi: string;
258
+ security: Record<string, string[]>[];
259
+ 'x-scalar-icon': string;
260
+ securitySchemes: string[];
261
+ selectedSecuritySchemeUids: string[];
262
+ selectedServerUid: string;
263
+ servers: string[];
264
+ requests: string[];
265
+ tags: string[];
266
+ watchMode: boolean;
267
+ watchModeStatus: "IDLE" | "WATCHING" | "ERROR";
268
+ externalDocs?: {
269
+ url: string;
270
+ description?: string | undefined;
271
+ } | undefined;
272
+ jsonSchemaDialect?: string | undefined;
273
+ info?: {
274
+ title: string;
275
+ version: string;
276
+ description?: string | undefined;
277
+ summary?: string | undefined;
278
+ termsOfService?: string | undefined;
279
+ contact?: {
280
+ name?: string | undefined;
281
+ url?: string | undefined;
282
+ email?: string | undefined;
283
+ } | undefined;
284
+ license?: {
285
+ name: string;
286
+ identifier?: string | undefined;
287
+ url?: string | undefined;
288
+ } | undefined;
289
+ } | undefined;
290
+ components?: Record<string, unknown> | undefined;
291
+ webhooks?: Record<string, unknown> | undefined;
292
+ 'x-scalar-environment'?: string | undefined;
293
+ 'x-scalar-environments'?: Record<string, {
294
+ variables: Record<string, string | {
295
+ default: string;
296
+ description?: string | undefined;
297
+ }>;
298
+ description?: string | undefined;
299
+ color?: string | undefined;
300
+ }> | undefined;
301
+ 'x-scalar-secrets'?: Record<string, {
302
+ description?: string | undefined;
303
+ example?: string | undefined;
304
+ }> | undefined;
305
+ documentUrl?: string | undefined;
306
+ integration?: string | null | undefined;
307
+ }[]>;
308
+ activeWorkspaceServers: import("vue").ComputedRef<{
309
+ uid: string;
310
+ url: string;
311
+ description?: string | undefined;
312
+ variables?: Record<string, Omit<import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject, "enum"> & {
313
+ enum?: [string, ...string[]];
314
+ }> | undefined;
315
+ }[]>;
316
+ activeEnvVariables: import("vue").ComputedRef<{
317
+ key: string;
318
+ value: string;
319
+ }[]>;
320
+ activeWorkspaceRequests: import("vue").ComputedRef<string[]>;
321
+ router: Router;
322
+ };
323
+ export type ActiveEntitiesStore = ReturnType<typeof createActiveEntitiesStore>;
324
+ export declare const ACTIVE_ENTITIES_SYMBOL: InjectionKey<ActiveEntitiesStore>;
325
+ /**
326
+ * The active entities store
327
+ *
328
+ * This store returns anything related to the currently active entities
329
+ * The only reason this is a store and not a simple hook is due to storing the current router here
330
+ */
331
+ export declare const useActiveEntities: () => ActiveEntitiesStore;
332
+ export {};
333
+ //# sourceMappingURL=active-entities.d.ts.map