@scalar/api-client 2.1.51 → 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 +47 -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 +16 -15
- 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/IconSelector.vue.js +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/Sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.vue.js +2 -2
- package/dist/components/Sidebar/Sidebar.vue2.js +37 -39
- 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 +670 -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 +1384 -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 +670 -1232
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/libs/create-client.d.ts +675 -1236
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +100 -95
- package/dist/libs/hot-keys.d.ts +1 -1
- package/dist/libs/send-request.d.ts +3 -7
- package/dist/libs/send-request.d.ts.map +1 -1
- package/dist/libs/send-request.js +126 -119
- package/dist/libs/string-template.d.ts.map +1 -1
- package/dist/libs/string-template.js +23 -22
- 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 +94 -94
- 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/RequestSection/RequestTableTooltip.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +27 -27
- 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 +74 -75
- 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/ResponseBodyRaw.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +2 -2
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +35 -15
- 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 +12 -12
- 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,190 +1,197 @@
|
|
|
1
|
-
import { ERRORS as
|
|
2
|
-
import { normalizeHeaders as
|
|
1
|
+
import { ERRORS as U, normalizeError as B } from "./errors.js";
|
|
2
|
+
import { normalizeHeaders as M } from "./normalize-headers.js";
|
|
3
3
|
import { replaceTemplateVariables as f } from "./string-template.js";
|
|
4
|
-
import { canMethodHaveBody as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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
|
+
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
|
-
a.enabled &&
|
|
48
|
-
}),
|
|
49
|
-
var
|
|
50
|
-
const { name:
|
|
51
|
-
(
|
|
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
|
-
path:
|
|
56
|
-
expires:
|
|
57
|
-
httpOnly:
|
|
58
|
-
secure:
|
|
55
|
+
path: p.path,
|
|
56
|
+
expires: p.expires ? new Date(p.expires) : void 0,
|
|
57
|
+
httpOnly: p.httpOnly,
|
|
58
|
+
secure: p.secure
|
|
59
59
|
});
|
|
60
60
|
}), {
|
|
61
|
-
cookieParams:
|
|
61
|
+
cookieParams: c
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
function I(
|
|
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
|
-
!a.enabled || !a.key || (a.file &&
|
|
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: f(((
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
function N(n) {
|
|
86
|
+
return n.startsWith("http://") || n.startsWith("https://") ? n : `http://${n}`;
|
|
87
|
+
}
|
|
88
|
+
const te = ({
|
|
89
|
+
request: n,
|
|
90
|
+
example: e,
|
|
91
|
+
server: t,
|
|
92
|
+
securitySchemes: r,
|
|
91
93
|
selectedSecuritySchemeUids: h = [],
|
|
92
|
-
proxy:
|
|
93
|
-
status:
|
|
94
|
-
environment:
|
|
95
|
-
globalCookies:
|
|
94
|
+
proxy: m,
|
|
95
|
+
status: c,
|
|
96
|
+
environment: l,
|
|
97
|
+
globalCookies: a
|
|
96
98
|
}) => {
|
|
97
99
|
try {
|
|
98
|
-
const s =
|
|
99
|
-
let d =
|
|
100
|
-
if (!d) throw
|
|
101
|
-
Object.entries((
|
|
102
|
-
d = f(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 });
|
|
103
105
|
});
|
|
104
|
-
const
|
|
105
|
-
return
|
|
106
|
-
example:
|
|
106
|
+
const T = Q(e, s), b = K(e, s), { body: $ } = I(n.method, e, s);
|
|
107
|
+
return V({
|
|
108
|
+
example: e,
|
|
107
109
|
env: s,
|
|
108
|
-
globalCookies:
|
|
110
|
+
globalCookies: a,
|
|
109
111
|
domain: d,
|
|
110
|
-
proxy:
|
|
111
|
-
}), h == null || h.forEach((
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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") {
|
|
115
118
|
const i = f(o.value, s);
|
|
116
|
-
|
|
119
|
+
o.in === "header" && (b[o.name] = i), o.in === "query" && T.append(o.name, i), o.in === "cookie" && R.set(o.name, i);
|
|
117
120
|
}
|
|
118
|
-
if (
|
|
119
|
-
if (
|
|
120
|
-
const i = f(o.username, s),
|
|
121
|
-
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)}`;
|
|
122
125
|
} else {
|
|
123
126
|
const i = f(o.token, s);
|
|
124
127
|
b.Authorization = `Bearer ${i}`;
|
|
125
128
|
}
|
|
126
|
-
|
|
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
|
+
}
|
|
127
134
|
}
|
|
128
135
|
}), [
|
|
129
136
|
null,
|
|
130
137
|
{
|
|
131
138
|
sendRequest: async () => {
|
|
132
|
-
|
|
133
|
-
const
|
|
139
|
+
c == null || c.emit("start");
|
|
140
|
+
const y = Date.now();
|
|
134
141
|
try {
|
|
135
|
-
if (d && (!
|
|
136
|
-
const z =
|
|
137
|
-
|
|
138
|
-
...
|
|
139
|
-
...
|
|
140
|
-
...
|
|
141
|
-
]).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();
|
|
142
149
|
}
|
|
143
|
-
const o = new URLSearchParams([["scalar_url", d.toString()]]),
|
|
144
|
-
signal:
|
|
145
|
-
method:
|
|
146
|
-
body:
|
|
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(),
|
|
153
|
+
body: $,
|
|
147
154
|
headers: b
|
|
148
155
|
});
|
|
149
|
-
|
|
150
|
-
const
|
|
156
|
+
c == null || c.emit("stop");
|
|
157
|
+
const w = M(
|
|
151
158
|
i.headers,
|
|
152
|
-
|
|
153
|
-
),
|
|
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() : [];
|
|
154
161
|
return [
|
|
155
162
|
null,
|
|
156
163
|
{
|
|
157
164
|
timestamp: Date.now(),
|
|
158
|
-
request:
|
|
165
|
+
request: e,
|
|
159
166
|
response: {
|
|
160
167
|
...i,
|
|
161
|
-
headers:
|
|
162
|
-
cookieHeaderKeys:
|
|
163
|
-
data:
|
|
164
|
-
size:
|
|
165
|
-
duration: Date.now() -
|
|
166
|
-
method:
|
|
168
|
+
headers: w,
|
|
169
|
+
cookieHeaderKeys: O,
|
|
170
|
+
data: F,
|
|
171
|
+
size: E.byteLength,
|
|
172
|
+
duration: Date.now() - y,
|
|
173
|
+
method: n.method,
|
|
167
174
|
status: i.status,
|
|
168
|
-
path:
|
|
175
|
+
path: u
|
|
169
176
|
}
|
|
170
177
|
}
|
|
171
178
|
];
|
|
172
179
|
} catch (o) {
|
|
173
|
-
return
|
|
180
|
+
return c == null || c.emit("abort"), [B(o, U.REQUEST_FAILED), null];
|
|
174
181
|
}
|
|
175
182
|
},
|
|
176
|
-
controller:
|
|
183
|
+
controller: v
|
|
177
184
|
}
|
|
178
185
|
];
|
|
179
186
|
} catch (s) {
|
|
180
|
-
return
|
|
187
|
+
return c == null || c.emit("abort"), [B(s), null];
|
|
181
188
|
}
|
|
182
189
|
};
|
|
183
190
|
export {
|
|
184
191
|
I as createFetchBody,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
192
|
+
K as createFetchHeaders,
|
|
193
|
+
Q as createFetchQueryParams,
|
|
194
|
+
te as createRequestOperation,
|
|
188
195
|
j as decodeBuffer,
|
|
189
|
-
|
|
196
|
+
V as setRequestCookies
|
|
190
197
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-template.d.ts","sourceRoot":"","sources":["../../src/libs/string-template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"string-template.d.ts","sourceRoot":"","sources":["../../src/libs/string-template.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAQ5D;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,UAehB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,sBAoBjD"}
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { REGEX as u } from "@scalar/oas-utils/helpers";
|
|
2
|
+
function l(n, o) {
|
|
3
|
+
const t = n.split(".").reduce(
|
|
4
|
+
(e, c) => e == null ? void 0 : e[c],
|
|
5
|
+
o
|
|
5
6
|
);
|
|
6
|
-
return typeof
|
|
7
|
+
return typeof t == "string" ? t : JSON.stringify(t);
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
let
|
|
11
|
-
return
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
}),
|
|
9
|
+
function f(n, o) {
|
|
10
|
+
const r = n.match(u.TEMPLATE_VARIABLE) ?? [];
|
|
11
|
+
let t = n;
|
|
12
|
+
return r.forEach((e) => {
|
|
13
|
+
const c = e.startsWith(":") ? e.slice(1) : e.replace(/[{}]/g, "").trim(), s = l(c, o);
|
|
14
|
+
s != null && (t = t.replaceAll(e, s));
|
|
15
|
+
}), t;
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
const e = Object.keys(
|
|
19
|
-
return e.forEach((
|
|
20
|
-
const
|
|
21
|
-
typeof
|
|
22
|
-
}),
|
|
17
|
+
function p(n) {
|
|
18
|
+
function o(r, t) {
|
|
19
|
+
const e = Object.keys(r), c = [];
|
|
20
|
+
return e.forEach((s) => {
|
|
21
|
+
const a = t ? `${t}.${s}` : s;
|
|
22
|
+
typeof r[s] == "object" ? c.push(...o(r[s], a)) : c.push([a, String(r[s])]);
|
|
23
|
+
}), c;
|
|
23
24
|
}
|
|
24
|
-
return
|
|
25
|
+
return o(n);
|
|
25
26
|
}
|
|
26
27
|
export {
|
|
27
|
-
|
|
28
|
+
p as flattenEnvVars,
|
|
28
29
|
l as getDotPathValue,
|
|
29
|
-
|
|
30
|
+
f as replaceTemplateVariables
|
|
30
31
|
};
|