@scalar/api-client 2.12.0 → 2.14.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 +66 -0
- package/dist/components/CodeInput/CodeInput.vue.d.ts +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandActionForm.vue.d.ts +2 -2
- package/dist/components/CommandPalette/CommandActionForm.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandActionForm.vue.js +14 -14
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +38 -38
- package/dist/components/EmptyState.vue.d.ts.map +1 -1
- package/dist/components/EmptyState.vue.js +2 -2
- package/dist/components/EmptyState.vue2.js +27 -16
- package/dist/components/TopNav/TopNav.vue.js +33 -33
- package/dist/layouts/App/create-api-client-app.d.ts +28 -28
- package/dist/layouts/Web/create-api-client-web.d.ts +28 -28
- package/dist/libs/create-client.d.ts +28 -28
- package/dist/libs/hot-keys.d.ts +2 -2
- package/dist/libs/send-request/create-fetch-body.d.ts +2 -2
- package/dist/store/active-entities.d.ts +2 -2
- package/dist/store/collections.d.ts +4 -4
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +8 -8
- package/dist/store/request-example.d.ts +12 -12
- package/dist/store/store.d.ts +28 -28
- package/dist/store/workspace.d.ts +12 -12
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +1 -2
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +9 -8
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +3 -3
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +14 -11
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js +22 -22
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +2 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +2 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +18 -15
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +2 -2
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue2.js +17 -17
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +17 -12
- package/dist/v2/blocks/scalar-address-bar-block/index.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +205 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +52 -52
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +205 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +90 -75
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +1 -2
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +126 -103
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts +0 -2
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue2.js +56 -53
- package/dist/v2/features/app/components/DesktopTab.vue.d.ts +26 -0
- package/dist/v2/features/app/components/DesktopTab.vue.d.ts.map +1 -0
- package/dist/v2/features/app/components/DesktopTab.vue.js +7 -0
- package/dist/v2/features/app/components/DesktopTab.vue2.js +134 -0
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +9 -4
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.js +47 -13
- package/dist/v2/features/app/components/DesktopTabs.vue2.js +2 -4
- package/dist/v2/features/app/components/SplashScreen.vue.js +2 -2
- package/dist/v2/features/app/components/SplashScreen.vue2.js +2 -2
- package/dist/v2/features/app/helpers/routes.js +1 -1
- package/dist/v2/features/collection/components/Settings.vue2.js +3 -3
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts +61 -0
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.js +48 -0
- package/dist/v2/features/command-palette/components/CommandActionForm.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +39 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.js +52 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts +36 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.js +78 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +30 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +169 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +34 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +175 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts +43 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.js +7 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue2.js +115 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +39 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +213 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +38 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +89 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts +41 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.js +7 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue2.js +172 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts +33 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.js +40 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/index.d.ts +2 -0
- package/dist/v2/features/command-palette/components/index.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/index.js +4 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts +23 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.js +31 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +13 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +12 -0
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts +26 -0
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.js +70 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts +23 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.js +18 -0
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts +11 -0
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/is-postman-collection.js +11 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +202 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +109 -0
- package/dist/v2/features/command-palette/types.d.ts +82 -0
- package/dist/v2/features/command-palette/types.d.ts.map +1 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +24 -20
- package/dist/v2/helpers/drag-handle-factory.d.ts +1 -2
- package/dist/v2/helpers/drag-handle-factory.d.ts.map +1 -1
- package/dist/v2/helpers/drag-handle-factory.js +84 -99
- package/dist/v2/helpers/get-tab-details.d.ts +43 -0
- package/dist/v2/helpers/get-tab-details.d.ts.map +1 -0
- package/dist/v2/helpers/get-tab-details.js +34 -0
- package/dist/v2/helpers/handle-hotkeys.js +1 -1
- package/dist/v2/helpers/is-url.d.ts +2 -0
- package/dist/v2/helpers/is-url.d.ts.map +1 -0
- package/dist/v2/helpers/is-url.js +5 -0
- package/dist/v2/helpers/remove-circular.d.ts +15 -0
- package/dist/v2/helpers/remove-circular.d.ts.map +1 -0
- package/dist/v2/helpers/remove-circular.js +18 -0
- package/dist/v2/helpers/storage.d.ts +4 -6
- package/dist/v2/helpers/storage.d.ts.map +1 -1
- package/dist/v2/helpers/storage.js +8 -12
- package/dist/v2/hooks/use-sidebar-state.d.ts +12 -19
- package/dist/v2/hooks/use-sidebar-state.d.ts.map +1 -1
- package/dist/v2/hooks/use-sidebar-state.js +36 -30
- package/dist/v2/hooks/use-sync-path.d.ts +11 -0
- package/dist/v2/hooks/use-sync-path.d.ts.map +1 -0
- package/dist/v2/hooks/use-sync-path.js +51 -0
- package/dist/v2/hooks/use-tabs.d.ts +31 -0
- package/dist/v2/hooks/use-tabs.d.ts.map +1 -0
- package/dist/v2/hooks/use-tabs.js +44 -0
- package/dist/v2/hooks/use-workspace-client-events.d.ts +5 -2
- package/dist/v2/hooks/use-workspace-client-events.d.ts.map +1 -1
- package/dist/v2/hooks/use-workspace-client-events.js +91 -36
- package/dist/v2/hooks/use-workspace-selector.d.ts +16 -6
- package/dist/v2/hooks/use-workspace-selector.d.ts.map +1 -1
- package/dist/v2/hooks/use-workspace-selector.js +58 -64
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +78 -78
- package/dist/views/Request/ResponseSection/ResponseBodyStreaming.vue.js +29 -29
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +2 -2
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue2.js +19 -19
- package/dist/views/Request/libs/oauth2.d.ts +2 -2
- package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
- package/dist/views/Request/libs/oauth2.js +66 -53
- package/package.json +134 -44
|
@@ -1,100 +1,113 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { makeUrlAbsolute as x } from "@scalar/helpers/url/make-url-absolute";
|
|
2
|
+
import { shouldUseProxy as U } from "@scalar/oas-utils/helpers";
|
|
3
|
+
import { fromUint8Array as S, encode as w } from "js-base64";
|
|
4
|
+
const A = () => {
|
|
4
5
|
const e = new Uint8Array(32);
|
|
5
|
-
return crypto.getRandomValues(e),
|
|
6
|
-
},
|
|
7
|
-
if (
|
|
6
|
+
return crypto.getRandomValues(e), S(e, !0);
|
|
7
|
+
}, b = async (e, c) => {
|
|
8
|
+
if (c === "plain")
|
|
8
9
|
return e;
|
|
9
10
|
if (typeof crypto?.subtle?.digest != "function")
|
|
10
11
|
return console.warn("SHA-256 is only supported when using https, using a plain text code challenge instead."), e;
|
|
11
|
-
const n = new TextEncoder().encode(e),
|
|
12
|
-
return
|
|
13
|
-
},
|
|
12
|
+
const n = new TextEncoder().encode(e), o = await crypto.subtle.digest("SHA-256", n);
|
|
13
|
+
return S(new Uint8Array(o), !0);
|
|
14
|
+
}, T = async (e, c, u) => {
|
|
14
15
|
try {
|
|
15
16
|
if (!e)
|
|
16
17
|
return [new Error("Flow not found"), null];
|
|
17
18
|
const n = e.selectedScopes.join(" ");
|
|
18
19
|
if (e.type === "clientCredentials" || e.type === "password")
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
return k(
|
|
21
|
+
e,
|
|
22
|
+
n,
|
|
23
|
+
{
|
|
24
|
+
proxyUrl: u
|
|
25
|
+
},
|
|
26
|
+
c
|
|
27
|
+
);
|
|
28
|
+
const o = (Math.random() + 1).toString(36).substring(2, 10), _ = x(e.authorizationUrl, {
|
|
29
|
+
baseUrl: c?.url
|
|
30
|
+
}), t = new URL(_);
|
|
31
|
+
let y = null;
|
|
24
32
|
if (e.type === "implicit")
|
|
25
33
|
t.searchParams.set("response_type", "token");
|
|
26
34
|
else if (e.type === "authorizationCode" && (t.searchParams.set("response_type", "code"), e["x-usePkce"] !== "no")) {
|
|
27
|
-
const r =
|
|
28
|
-
|
|
35
|
+
const r = A(), a = await b(r, e["x-usePkce"]);
|
|
36
|
+
y = {
|
|
29
37
|
codeVerifier: r,
|
|
30
|
-
codeChallenge:
|
|
38
|
+
codeChallenge: a,
|
|
31
39
|
codeChallengeMethod: e["x-usePkce"] === "SHA-256" ? "S256" : "plain"
|
|
32
|
-
}, t.searchParams.set("code_challenge",
|
|
40
|
+
}, t.searchParams.set("code_challenge", a), t.searchParams.set("code_challenge_method", y.codeChallengeMethod);
|
|
33
41
|
}
|
|
34
42
|
if (e["x-scalar-redirect-uri"].startsWith("/")) {
|
|
35
|
-
const r =
|
|
36
|
-
t.searchParams.set("redirect_uri",
|
|
43
|
+
const r = c?.url || window.location.origin + window.location.pathname, a = x(e["x-scalar-redirect-uri"], { baseUrl: r });
|
|
44
|
+
t.searchParams.set("redirect_uri", a);
|
|
37
45
|
} else
|
|
38
46
|
t.searchParams.set("redirect_uri", e["x-scalar-redirect-uri"]);
|
|
39
47
|
e["x-scalar-security-query"] && Object.keys(e["x-scalar-security-query"]).forEach((r) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
}), t.searchParams.set("client_id", e["x-scalar-client-id"]), t.searchParams.set("state",
|
|
43
|
-
const
|
|
44
|
-
return
|
|
45
|
-
const
|
|
46
|
-
let
|
|
48
|
+
const a = e["x-scalar-security-query"]?.[r];
|
|
49
|
+
a && t.searchParams.set(r, a);
|
|
50
|
+
}), t.searchParams.set("client_id", e["x-scalar-client-id"]), t.searchParams.set("state", o), n && t.searchParams.set("scope", n);
|
|
51
|
+
const s = window.open(t, "openAuth2Window", "left=100,top=100,width=800,height=600");
|
|
52
|
+
return s ? new Promise((r) => {
|
|
53
|
+
const a = setInterval(() => {
|
|
54
|
+
let h = null, l = null, d = null, m = null;
|
|
47
55
|
try {
|
|
48
|
-
const i = new URL(
|
|
49
|
-
|
|
50
|
-
const g = new URLSearchParams(
|
|
51
|
-
|
|
56
|
+
const i = new URL(s.location.href).searchParams, P = e["x-tokenName"] || "access_token";
|
|
57
|
+
h = i.get(P), l = i.get("code"), d = i.get("error"), m = i.get("error_description");
|
|
58
|
+
const g = new URLSearchParams(s.location.href.split("#")[1]);
|
|
59
|
+
h ||= g.get(P), l ||= g.get("code"), d ||= g.get("error"), m ||= g.get("error_description");
|
|
52
60
|
} catch {
|
|
53
61
|
}
|
|
54
|
-
if (
|
|
55
|
-
if (clearInterval(
|
|
56
|
-
r([new Error(`OAuth error: ${
|
|
57
|
-
else if (
|
|
58
|
-
const i =
|
|
59
|
-
r(i ===
|
|
60
|
-
} else
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
if (s.closed || h || l || d)
|
|
63
|
+
if (clearInterval(a), s.close(), d)
|
|
64
|
+
r([new Error(`OAuth error: ${d}${m ? ` (${m})` : ""}`), null]);
|
|
65
|
+
else if (h) {
|
|
66
|
+
const i = s.location.href.match(/state=([^&]*)/)?.[1];
|
|
67
|
+
r(i === o ? [null, h] : [new Error("State mismatch"), null]);
|
|
68
|
+
} else l ? new URL(s.location.href).searchParams.get("state") === o ? k(
|
|
69
|
+
e,
|
|
70
|
+
n,
|
|
71
|
+
{
|
|
72
|
+
code: l,
|
|
73
|
+
pkce: y,
|
|
74
|
+
proxyUrl: u
|
|
75
|
+
},
|
|
76
|
+
c
|
|
77
|
+
).then(r) : r([new Error("State mismatch"), null]) : (clearInterval(a), r([new Error("Window was closed without granting authorization"), null]));
|
|
65
78
|
}, 200);
|
|
66
79
|
}) : [new Error("Failed to open auth window"), null];
|
|
67
80
|
} catch {
|
|
68
81
|
return [new Error("Failed to authorize oauth2 flow"), null];
|
|
69
82
|
}
|
|
70
|
-
},
|
|
83
|
+
}, k = async (e, c, {
|
|
71
84
|
code: u,
|
|
72
85
|
pkce: n,
|
|
73
|
-
proxyUrl:
|
|
74
|
-
} = {}) => {
|
|
86
|
+
proxyUrl: o
|
|
87
|
+
} = {}, _) => {
|
|
75
88
|
if (!e)
|
|
76
89
|
return [new Error("OAuth2 flow was not defined"), null];
|
|
77
90
|
const t = new URLSearchParams();
|
|
78
|
-
t.set("client_id", e["x-scalar-client-id"]),
|
|
79
|
-
|
|
91
|
+
t.set("client_id", e["x-scalar-client-id"]), c && (e.type === "clientCredentials" || e.type === "password") && t.set("scope", c), e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "body") && t.set("client_secret", e.clientSecret), "x-scalar-redirect-uri" in e && e["x-scalar-redirect-uri"] && t.set("redirect_uri", e["x-scalar-redirect-uri"]), u ? (t.set("code", u), t.set("grant_type", "authorization_code"), n && t.set("code_verifier", n.codeVerifier)) : e.type === "password" ? (t.set("grant_type", "password"), t.set("username", e.username), t.set("password", e.password)) : t.set("grant_type", "client_credentials"), e["x-scalar-security-body"] && Object.entries(e["x-scalar-security-body"]).forEach(([p, s]) => {
|
|
92
|
+
s && t.set(p, s);
|
|
80
93
|
});
|
|
81
94
|
try {
|
|
82
95
|
const p = {
|
|
83
96
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
84
97
|
};
|
|
85
|
-
e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "header") && (p.Authorization = `Basic ${
|
|
86
|
-
const r =
|
|
98
|
+
e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "header") && (p.Authorization = `Basic ${w(`${e["x-scalar-client-id"]}:${e.clientSecret}`)}`);
|
|
99
|
+
const r = x(e.tokenUrl, { baseUrl: _?.url }), a = U(o, r) ? `${o}?${new URLSearchParams([["scalar_url", r]]).toString()}` : r, l = await (await fetch(a, {
|
|
87
100
|
method: "POST",
|
|
88
101
|
headers: p,
|
|
89
102
|
body: t
|
|
90
103
|
})).json(), d = e["x-tokenName"] || "access_token";
|
|
91
|
-
return [null,
|
|
104
|
+
return [null, l[d]];
|
|
92
105
|
} catch {
|
|
93
106
|
return [new Error("Failed to get an access token. Please check your credentials."), null];
|
|
94
107
|
}
|
|
95
108
|
};
|
|
96
109
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
T as authorizeOauth2,
|
|
111
|
+
k as authorizeServers,
|
|
112
|
+
b as generateCodeChallenge
|
|
100
113
|
};
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"rest",
|
|
19
19
|
"testing"
|
|
20
20
|
],
|
|
21
|
-
"version": "2.
|
|
21
|
+
"version": "2.14.0",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=20"
|
|
24
24
|
},
|
|
@@ -141,6 +141,121 @@
|
|
|
141
141
|
"types": "./dist/types/index.d.ts",
|
|
142
142
|
"default": "./dist/types/index.js"
|
|
143
143
|
},
|
|
144
|
+
"./v2/blocks/operation-block": {
|
|
145
|
+
"import": "./dist/v2/blocks/operation-block/index.js",
|
|
146
|
+
"types": "./dist/v2/blocks/operation-block/index.d.ts",
|
|
147
|
+
"default": "./dist/v2/blocks/operation-block/index.js"
|
|
148
|
+
},
|
|
149
|
+
"./v2/blocks/operation-code-sample": {
|
|
150
|
+
"import": "./dist/v2/blocks/operation-code-sample/index.js",
|
|
151
|
+
"types": "./dist/v2/blocks/operation-code-sample/index.d.ts",
|
|
152
|
+
"default": "./dist/v2/blocks/operation-code-sample/index.js"
|
|
153
|
+
},
|
|
154
|
+
"./v2/blocks/request-block": {
|
|
155
|
+
"import": "./dist/v2/blocks/request-block/index.js",
|
|
156
|
+
"types": "./dist/v2/blocks/request-block/index.d.ts",
|
|
157
|
+
"default": "./dist/v2/blocks/request-block/index.js"
|
|
158
|
+
},
|
|
159
|
+
"./v2/blocks/response-block": {
|
|
160
|
+
"import": "./dist/v2/blocks/response-block/index.js",
|
|
161
|
+
"types": "./dist/v2/blocks/response-block/index.d.ts",
|
|
162
|
+
"default": "./dist/v2/blocks/response-block/index.js"
|
|
163
|
+
},
|
|
164
|
+
"./v2/blocks/scalar-address-bar-block": {
|
|
165
|
+
"import": "./dist/v2/blocks/scalar-address-bar-block/index.js",
|
|
166
|
+
"types": "./dist/v2/blocks/scalar-address-bar-block/index.d.ts",
|
|
167
|
+
"default": "./dist/v2/blocks/scalar-address-bar-block/index.js"
|
|
168
|
+
},
|
|
169
|
+
"./v2/blocks/scalar-auth-selector-block": {
|
|
170
|
+
"import": "./dist/v2/blocks/scalar-auth-selector-block/index.js",
|
|
171
|
+
"types": "./dist/v2/blocks/scalar-auth-selector-block/index.d.ts",
|
|
172
|
+
"default": "./dist/v2/blocks/scalar-auth-selector-block/index.js"
|
|
173
|
+
},
|
|
174
|
+
"./v2/components/code-input": {
|
|
175
|
+
"import": "./dist/v2/components/code-input/index.js",
|
|
176
|
+
"types": "./dist/v2/components/code-input/index.d.ts",
|
|
177
|
+
"default": "./dist/v2/components/code-input/index.js"
|
|
178
|
+
},
|
|
179
|
+
"./v2/components/data-table": {
|
|
180
|
+
"import": "./dist/v2/components/data-table/index.js",
|
|
181
|
+
"types": "./dist/v2/components/data-table/index.d.ts",
|
|
182
|
+
"default": "./dist/v2/components/data-table/index.js"
|
|
183
|
+
},
|
|
184
|
+
"./v2/components/forms": {
|
|
185
|
+
"import": "./dist/v2/components/forms/index.js",
|
|
186
|
+
"types": "./dist/v2/components/forms/index.d.ts",
|
|
187
|
+
"default": "./dist/v2/components/forms/index.js"
|
|
188
|
+
},
|
|
189
|
+
"./v2/components/layout": {
|
|
190
|
+
"import": "./dist/v2/components/layout/index.js",
|
|
191
|
+
"types": "./dist/v2/components/layout/index.d.ts",
|
|
192
|
+
"default": "./dist/v2/components/layout/index.js"
|
|
193
|
+
},
|
|
194
|
+
"./v2/components/modals": {
|
|
195
|
+
"import": "./dist/v2/components/modals/index.js",
|
|
196
|
+
"types": "./dist/v2/components/modals/index.d.ts",
|
|
197
|
+
"default": "./dist/v2/components/modals/index.js"
|
|
198
|
+
},
|
|
199
|
+
"./v2/components/resize": {
|
|
200
|
+
"import": "./dist/v2/components/resize/index.js",
|
|
201
|
+
"types": "./dist/v2/components/resize/index.d.ts",
|
|
202
|
+
"default": "./dist/v2/components/resize/index.js"
|
|
203
|
+
},
|
|
204
|
+
"./v2/components/server": {
|
|
205
|
+
"import": "./dist/v2/components/server/index.js",
|
|
206
|
+
"types": "./dist/v2/components/server/index.d.ts",
|
|
207
|
+
"default": "./dist/v2/components/server/index.js"
|
|
208
|
+
},
|
|
209
|
+
"./v2/components/sidebar": {
|
|
210
|
+
"import": "./dist/v2/components/sidebar/index.js",
|
|
211
|
+
"types": "./dist/v2/components/sidebar/index.d.ts",
|
|
212
|
+
"default": "./dist/v2/components/sidebar/index.js"
|
|
213
|
+
},
|
|
214
|
+
"./v2/features/app": {
|
|
215
|
+
"import": "./dist/v2/features/app/index.js",
|
|
216
|
+
"types": "./dist/v2/features/app/index.d.ts",
|
|
217
|
+
"default": "./dist/v2/features/app/index.js"
|
|
218
|
+
},
|
|
219
|
+
"./v2/features/app/components": {
|
|
220
|
+
"import": "./dist/v2/features/app/components/index.js",
|
|
221
|
+
"types": "./dist/v2/features/app/components/index.d.ts",
|
|
222
|
+
"default": "./dist/v2/features/app/components/index.js"
|
|
223
|
+
},
|
|
224
|
+
"./v2/features/command-palette/components": {
|
|
225
|
+
"import": "./dist/v2/features/command-palette/components/index.js",
|
|
226
|
+
"types": "./dist/v2/features/command-palette/components/index.d.ts",
|
|
227
|
+
"default": "./dist/v2/features/command-palette/components/index.js"
|
|
228
|
+
},
|
|
229
|
+
"./v2/features/environments": {
|
|
230
|
+
"import": "./dist/v2/features/environments/index.js",
|
|
231
|
+
"types": "./dist/v2/features/environments/index.d.ts",
|
|
232
|
+
"default": "./dist/v2/features/environments/index.js"
|
|
233
|
+
},
|
|
234
|
+
"./v2/features/global-cookies": {
|
|
235
|
+
"import": "./dist/v2/features/global-cookies/index.js",
|
|
236
|
+
"types": "./dist/v2/features/global-cookies/index.d.ts",
|
|
237
|
+
"default": "./dist/v2/features/global-cookies/index.js"
|
|
238
|
+
},
|
|
239
|
+
"./v2/features/modal": {
|
|
240
|
+
"import": "./dist/v2/features/modal/index.js",
|
|
241
|
+
"types": "./dist/v2/features/modal/index.d.ts",
|
|
242
|
+
"default": "./dist/v2/features/modal/index.js"
|
|
243
|
+
},
|
|
244
|
+
"./v2/features/operation": {
|
|
245
|
+
"import": "./dist/v2/features/operation/index.js",
|
|
246
|
+
"types": "./dist/v2/features/operation/index.d.ts",
|
|
247
|
+
"default": "./dist/v2/features/operation/index.js"
|
|
248
|
+
},
|
|
249
|
+
"./v2/features/search": {
|
|
250
|
+
"import": "./dist/v2/features/search/index.js",
|
|
251
|
+
"types": "./dist/v2/features/search/index.d.ts",
|
|
252
|
+
"default": "./dist/v2/features/search/index.js"
|
|
253
|
+
},
|
|
254
|
+
"./v2/features/settings": {
|
|
255
|
+
"import": "./dist/v2/features/settings/index.js",
|
|
256
|
+
"types": "./dist/v2/features/settings/index.d.ts",
|
|
257
|
+
"default": "./dist/v2/features/settings/index.js"
|
|
258
|
+
},
|
|
144
259
|
"./views/Components/CodeSnippet": {
|
|
145
260
|
"import": "./dist/views/Components/CodeSnippet/index.js",
|
|
146
261
|
"types": "./dist/views/Components/CodeSnippet/index.d.ts",
|
|
@@ -180,31 +295,6 @@
|
|
|
180
295
|
"import": "./dist/views/Request/types/index.js",
|
|
181
296
|
"types": "./dist/views/Request/types/index.d.ts",
|
|
182
297
|
"default": "./dist/views/Request/types/index.js"
|
|
183
|
-
},
|
|
184
|
-
"./v2/blocks/operation-code-sample": {
|
|
185
|
-
"import": "./dist/v2/blocks/operation-code-sample/index.js",
|
|
186
|
-
"types": "./dist/v2/blocks/operation-code-sample/index.d.ts",
|
|
187
|
-
"default": "./dist/v2/blocks/operation-code-sample/index.js"
|
|
188
|
-
},
|
|
189
|
-
"./v2/blocks/scalar-address-bar-block": {
|
|
190
|
-
"import": "./dist/v2/blocks/scalar-address-bar-block/index.js",
|
|
191
|
-
"types": "./dist/v2/blocks/scalar-address-bar-block/index.d.ts",
|
|
192
|
-
"default": "./dist/v2/blocks/scalar-address-bar-block/index.js"
|
|
193
|
-
},
|
|
194
|
-
"./v2/blocks/scalar-auth-selector-block": {
|
|
195
|
-
"import": "./dist/v2/blocks/scalar-auth-selector-block/index.js",
|
|
196
|
-
"types": "./dist/v2/blocks/scalar-auth-selector-block/index.d.ts",
|
|
197
|
-
"default": "./dist/v2/blocks/scalar-auth-selector-block/index.js"
|
|
198
|
-
},
|
|
199
|
-
"./v2/blocks/operation-block": {
|
|
200
|
-
"import": "./dist/v2/blocks/operation-block/index.js",
|
|
201
|
-
"types": "./dist/v2/blocks/operation-block/index.d.ts",
|
|
202
|
-
"default": "./dist/v2/blocks/operation-block/index.js"
|
|
203
|
-
},
|
|
204
|
-
"./v2/blocks/response-block": {
|
|
205
|
-
"import": "./dist/v2/blocks/response-block/index.js",
|
|
206
|
-
"types": "./dist/v2/blocks/response-block/index.d.ts",
|
|
207
|
-
"default": "./dist/v2/blocks/response-block/index.js"
|
|
208
298
|
}
|
|
209
299
|
},
|
|
210
300
|
"files": [
|
|
@@ -233,24 +323,24 @@
|
|
|
233
323
|
"zod": "4.1.11",
|
|
234
324
|
"@scalar/analytics-client": "1.0.0",
|
|
235
325
|
"@scalar/draggable": "0.3.0",
|
|
236
|
-
"@scalar/
|
|
237
|
-
"@scalar/
|
|
326
|
+
"@scalar/helpers": "0.2.0",
|
|
327
|
+
"@scalar/components": "0.16.6",
|
|
238
328
|
"@scalar/icons": "0.5.0",
|
|
239
|
-
"@scalar/
|
|
240
|
-
"@scalar/
|
|
241
|
-
"@scalar/
|
|
242
|
-
"@scalar/
|
|
243
|
-
"@scalar/
|
|
244
|
-
"@scalar/openapi-
|
|
245
|
-
"@scalar/postman-to-openapi": "0.3.
|
|
246
|
-
"@scalar/sidebar": "0.
|
|
247
|
-
"@scalar/
|
|
248
|
-
"@scalar/
|
|
249
|
-
"@scalar/
|
|
250
|
-
"@scalar/use-
|
|
251
|
-
"@scalar/use-
|
|
252
|
-
"@scalar/
|
|
253
|
-
"@scalar/
|
|
329
|
+
"@scalar/import": "0.4.37",
|
|
330
|
+
"@scalar/json-magic": "0.8.4",
|
|
331
|
+
"@scalar/object-utils": "1.2.14",
|
|
332
|
+
"@scalar/openapi-types": "0.5.2",
|
|
333
|
+
"@scalar/oas-utils": "0.6.6",
|
|
334
|
+
"@scalar/openapi-parser": "0.23.5",
|
|
335
|
+
"@scalar/postman-to-openapi": "0.3.47",
|
|
336
|
+
"@scalar/sidebar": "0.5.1",
|
|
337
|
+
"@scalar/snippetz": "0.5.4",
|
|
338
|
+
"@scalar/types": "0.5.1",
|
|
339
|
+
"@scalar/themes": "0.13.25",
|
|
340
|
+
"@scalar/use-hooks": "0.3.2",
|
|
341
|
+
"@scalar/use-toasts": "0.9.1",
|
|
342
|
+
"@scalar/workspace-store": "0.22.1",
|
|
343
|
+
"@scalar/use-codemirror": "0.13.0"
|
|
254
344
|
},
|
|
255
345
|
"devDependencies": {
|
|
256
346
|
"@tailwindcss/vite": "^4.1.7",
|
|
@@ -266,7 +356,7 @@
|
|
|
266
356
|
"vite-svg-loader": "5.1.0",
|
|
267
357
|
"vitest": "3.2.4",
|
|
268
358
|
"@scalar/galaxy": "0.5.12",
|
|
269
|
-
"@scalar/build-tooling": "0.3.
|
|
359
|
+
"@scalar/build-tooling": "0.3.1"
|
|
270
360
|
},
|
|
271
361
|
"scripts": {
|
|
272
362
|
"build": "scalar-build-vite",
|