@scalar/api-client 2.1.52 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBar.vue.js +1 -1
- package/dist/components/AddressBar/AddressBar.vue2.js +35 -42
- package/dist/components/AddressBar/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue.js +2 -2
- package/dist/components/AddressBar/AddressBarHistory.vue2.js +25 -24
- package/dist/components/AddressBar/AddressBarServer.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBarServer.vue.js +32 -39
- package/dist/components/AddressBar/AddressBarServerItem.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBarServerItem.vue.js +10 -15
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.js +1 -1
- package/dist/components/CodeInput/CodeInput.vue2.js +48 -47
- package/dist/components/CodeInput/codeVariableWidget.d.ts +3 -2
- package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +15 -14
- package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteExample.vue.js +18 -23
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +27 -26
- package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +19 -20
- package/dist/components/CommandPalette/CommandPaletteServer.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteServer.vue.js +19 -24
- package/dist/components/CommandPalette/CommandPaletteTag.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteTag.vue.js +23 -22
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +47 -46
- package/dist/components/DataTable/DataTableInput.vue.d.ts +1 -1
- package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.d.ts.map +1 -1
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +23 -28
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
- package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/ImportCollectionModal.vue.js +127 -96
- package/dist/components/ImportCollection/ImportNowButton.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +28 -27
- package/dist/components/ImportCollection/IntegrationLogo.vue.d.ts +1 -1
- package/dist/components/ImportCollection/IntegrationLogo.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/IntegrationLogo.vue.js +14 -18
- package/dist/components/ImportCollection/WorkspaceSelector.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/WorkspaceSelector.vue.js +15 -14
- package/dist/components/Search/useSearch.d.ts.map +1 -1
- package/dist/components/Search/useSearch.js +20 -19
- package/dist/components/SideNav/SideNavRouterLink.vue.js +9 -9
- package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
- package/dist/components/TopNav/TopNav.vue.js +1 -1
- package/dist/components/TopNav/TopNav.vue2.js +20 -19
- package/dist/components/TopNav/TopNavItem.vue.d.ts +2 -2
- package/dist/hooks/index.js +3 -2
- package/dist/hooks/useLayout.d.ts +2 -0
- package/dist/hooks/useLayout.d.ts.map +1 -1
- package/dist/hooks/useLayout.js +4 -3
- package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -1
- package/dist/layouts/App/ApiClientApp.vue.js +38 -37
- package/dist/layouts/App/MainLayout.vue.d.ts.map +1 -1
- package/dist/layouts/App/MainLayout.vue.js +3 -3
- package/dist/layouts/App/create-api-client-app.d.ts +669 -1232
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
- package/dist/layouts/Modal/ApiClientModal.vue2.js +24 -23
- package/dist/layouts/Modal/create-api-client-modal.d.ts +1382 -2508
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Web/ApiClientWeb.vue.d.ts.map +1 -1
- package/dist/layouts/Web/ApiClientWeb.vue.js +34 -33
- package/dist/layouts/Web/create-api-client-web.d.ts +669 -1232
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/libs/create-client.d.ts +673 -1236
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +91 -102
- package/dist/libs/hot-keys.d.ts +1 -1
- package/dist/libs/send-request.d.ts +2 -3
- package/dist/libs/send-request.d.ts.map +1 -1
- package/dist/libs/send-request.js +127 -123
- package/dist/store/active-entities.d.ts +333 -0
- package/dist/store/active-entities.d.ts.map +1 -0
- package/dist/store/active-entities.js +97 -0
- package/dist/store/collections.d.ts +4 -274
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/cookies.d.ts +4 -4
- package/dist/store/environment.d.ts +4 -4
- package/dist/store/import-spec.d.ts +0 -54
- package/dist/store/import-spec.d.ts.map +1 -1
- package/dist/store/index.js +4 -3
- package/dist/store/request-example.d.ts +4 -4
- package/dist/store/requests.d.ts +15 -15
- package/dist/store/security-schemes.d.ts +527 -317
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/security-schemes.js +33 -41
- package/dist/store/servers.d.ts +4 -4
- package/dist/store/store-context.d.ts +0 -3
- package/dist/store/store-context.d.ts.map +1 -1
- package/dist/store/store.d.ts +640 -5297
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +111 -189
- package/dist/store/tags.d.ts +4 -4
- package/dist/store/workspace.d.ts +14 -24
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/views/Cookies/CookieForm.vue.d.ts.map +1 -1
- package/dist/views/Cookies/CookieForm.vue.js +14 -13
- package/dist/views/Cookies/CookieRaw.vue.d.ts.map +1 -1
- package/dist/views/Cookies/CookieRaw.vue.js +14 -13
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts +3 -3
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +2 -2
- package/dist/views/Request/Request.vue2.js +92 -92
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +2 -2
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +96 -99
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts +2 -2
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +49 -46
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +94 -100
- package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.js +60 -67
- package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestBody.vue2.js +29 -28
- package/dist/views/Request/RequestSection/RequestParams.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestParams.vue.js +11 -10
- package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +24 -28
- package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +19 -18
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts +2 -2
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.js +1 -1
- package/dist/views/Request/RequestSidebar.vue2.js +72 -73
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +111 -109
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +2 -2
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +15 -16
- package/dist/views/Request/RequestSubpageHeader.vue.js +1 -1
- package/dist/views/Request/RequestSubpageHeader.vue2.js +14 -14
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +23 -22
- package/dist/views/Request/components/WorkspaceDropdown.vue.d.ts.map +1 -1
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +32 -31
- package/dist/views/Request/consts/new-auth-options.d.ts +16 -8
- package/dist/views/Request/consts/new-auth-options.d.ts.map +1 -1
- package/dist/views/Request/consts/new-auth-options.js +16 -8
- package/dist/views/Request/handle-drag.d.ts +2 -1
- package/dist/views/Request/handle-drag.d.ts.map +1 -1
- package/dist/views/Request/handle-drag.js +23 -25
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -1
- package/dist/views/Request/hooks/useOpenApiWatcher.js +40 -39
- package/dist/views/Request/libs/auth.d.ts +1 -29
- package/dist/views/Request/libs/auth.d.ts.map +1 -1
- package/dist/views/Request/libs/auth.js +2 -9
- package/dist/views/Request/libs/index.js +6 -8
- package/dist/views/Request/libs/live-sync.d.ts +6 -5
- package/dist/views/Request/libs/live-sync.d.ts.map +1 -1
- package/dist/views/Request/libs/live-sync.js +164 -185
- package/dist/views/Request/libs/oauth2.d.ts +6 -10
- package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
- package/dist/views/Request/libs/oauth2.js +54 -69
- package/dist/views/Servers/ServerForm.vue.d.ts.map +1 -1
- package/dist/views/Servers/ServerForm.vue.js +14 -13
- package/dist/views/Servers/Servers.vue.d.ts.map +1 -1
- package/dist/views/Servers/Servers.vue2.js +18 -17
- package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneral.vue.js +218 -126
- package/dist/views/Settings/{SettingsGeneralMode.vue.d.ts → components/SettingsAppearance.vue.d.ts} +2 -2
- package/dist/views/Settings/components/SettingsAppearance.vue.d.ts.map +1 -0
- package/dist/views/Settings/components/SettingsAppearance.vue.js +74 -0
- package/dist/views/Settings/components/SettingsAppearance.vue2.js +4 -0
- package/dist/views/Settings/components/SettingsSection.vue.d.ts +24 -0
- package/dist/views/Settings/components/SettingsSection.vue.d.ts.map +1 -0
- package/dist/views/Settings/components/SettingsSection.vue.js +24 -0
- package/dist/views/Settings/components/SettingsSection.vue2.js +4 -0
- package/package.json +8 -8
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthModal.vue.d.ts +0 -16
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthModal.vue.d.ts.map +0 -1
- package/dist/views/Settings/SettingsGeneralMode.vue.d.ts.map +0 -1
- package/dist/views/Settings/SettingsGeneralMode.vue.js +0 -78
- package/dist/views/Settings/SettingsGeneralMode.vue2.js +0 -4
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { ERRORS as
|
|
2
|
-
import { normalizeHeaders as
|
|
3
|
-
import { replaceTemplateVariables as
|
|
4
|
-
import { canMethodHaveBody as
|
|
5
|
-
import
|
|
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(
|
|
9
|
-
const
|
|
10
|
-
return _.includes(
|
|
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
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
}),
|
|
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
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
}),
|
|
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
|
|
26
|
-
example:
|
|
27
|
-
env:
|
|
28
|
-
globalCookies:
|
|
29
|
-
domain:
|
|
30
|
-
proxy:
|
|
25
|
+
function V({
|
|
26
|
+
example: n,
|
|
27
|
+
env: e,
|
|
28
|
+
globalCookies: t,
|
|
29
|
+
domain: r,
|
|
30
|
+
proxy: h
|
|
31
31
|
}) {
|
|
32
|
-
let
|
|
32
|
+
let m;
|
|
33
33
|
try {
|
|
34
|
-
|
|
34
|
+
m = new URL(h || r).host;
|
|
35
35
|
} catch {
|
|
36
|
-
typeof window < "u" && (
|
|
36
|
+
typeof window < "u" && (m = window.location.host);
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const c = {
|
|
39
39
|
// Must point all cookies to the proxy and let it sort them out
|
|
40
|
-
domain:
|
|
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
|
-
},
|
|
46
|
-
return Object.keys(
|
|
47
|
-
|
|
48
|
-
}),
|
|
49
|
-
var
|
|
50
|
-
const { name:
|
|
51
|
-
(p.domain ===
|
|
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:
|
|
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:
|
|
61
|
+
cookieParams: c
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
var
|
|
66
|
-
if (!
|
|
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 (
|
|
69
|
-
const
|
|
70
|
-
return
|
|
71
|
-
!
|
|
72
|
-
}), { body:
|
|
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
|
|
75
|
-
body:
|
|
76
|
-
contentType: (
|
|
77
|
-
} :
|
|
78
|
-
body:
|
|
79
|
-
contentType: (
|
|
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
|
|
86
|
-
return
|
|
85
|
+
function N(n) {
|
|
86
|
+
return n.startsWith("http://") || n.startsWith("https://") ? n : `http://${n}`;
|
|
87
87
|
}
|
|
88
|
-
const
|
|
89
|
-
request:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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 =
|
|
102
|
-
let d =
|
|
103
|
-
if (!d) throw
|
|
104
|
-
Object.entries((
|
|
105
|
-
d =
|
|
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
|
|
108
|
-
return
|
|
109
|
-
example:
|
|
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:
|
|
110
|
+
globalCookies: a,
|
|
112
111
|
domain: d,
|
|
113
|
-
proxy:
|
|
114
|
-
}),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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 (
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
124
|
-
b.Authorization = `Basic ${btoa(
|
|
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
|
|
127
|
-
b.Authorization = `Bearer ${
|
|
126
|
+
const i = f(o.token, s);
|
|
127
|
+
b.Authorization = `Bearer ${i}`;
|
|
128
128
|
}
|
|
129
|
-
|
|
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
|
-
|
|
136
|
-
const
|
|
139
|
+
c == null || c.emit("start");
|
|
140
|
+
const y = Date.now();
|
|
137
141
|
try {
|
|
138
|
-
if (d && (!
|
|
139
|
-
const z =
|
|
140
|
-
|
|
141
|
-
...
|
|
142
|
-
...
|
|
143
|
-
...
|
|
144
|
-
]).toString(), d =
|
|
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
|
|
147
|
-
signal:
|
|
148
|
-
method:
|
|
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
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
S(
|
|
156
|
-
),
|
|
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:
|
|
165
|
+
request: e,
|
|
162
166
|
response: {
|
|
163
|
-
...
|
|
164
|
-
headers:
|
|
167
|
+
...i,
|
|
168
|
+
headers: w,
|
|
165
169
|
cookieHeaderKeys: O,
|
|
166
170
|
data: F,
|
|
167
|
-
size:
|
|
168
|
-
duration: Date.now() -
|
|
169
|
-
method:
|
|
170
|
-
status:
|
|
171
|
-
path:
|
|
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 (
|
|
176
|
-
return
|
|
179
|
+
} catch (o) {
|
|
180
|
+
return c == null || c.emit("abort"), [B(o, U.REQUEST_FAILED), null];
|
|
177
181
|
}
|
|
178
182
|
},
|
|
179
|
-
controller:
|
|
183
|
+
controller: v
|
|
180
184
|
}
|
|
181
185
|
];
|
|
182
186
|
} catch (s) {
|
|
183
|
-
return
|
|
187
|
+
return c == null || c.emit("abort"), [B(s), null];
|
|
184
188
|
}
|
|
185
189
|
};
|
|
186
190
|
export {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
+
I as createFetchBody,
|
|
192
|
+
K as createFetchHeaders,
|
|
193
|
+
Q as createFetchQueryParams,
|
|
194
|
+
te as createRequestOperation,
|
|
191
195
|
j as decodeBuffer,
|
|
192
|
-
|
|
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
|