@scalar/api-client 2.36.0 → 2.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js +28 -27
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +47 -42
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +65 -59
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +57 -42
- 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 +44 -41
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +38 -34
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.js +34 -30
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts.map +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +44 -45
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +15 -15
package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js
CHANGED
|
@@ -1,73 +1,88 @@
|
|
|
1
|
-
import { isObject as
|
|
2
|
-
import { objectEntries as
|
|
1
|
+
import { isObject as p } from "@scalar/helpers/object/is-object";
|
|
2
|
+
import { objectEntries as u } from "@scalar/helpers/object/object-entries";
|
|
3
3
|
const f = {
|
|
4
4
|
"x-scalar-secret-client-id": "x-scalar-client-id",
|
|
5
5
|
"x-scalar-secret-client-secret": "clientSecret",
|
|
6
6
|
"x-scalar-secret-password": "password",
|
|
7
7
|
"x-scalar-secret-redirect-uri": "x-scalar-redirect-uri",
|
|
8
8
|
"x-scalar-secret-token": "token",
|
|
9
|
-
"x-scalar-secret-username": "username"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
"x-scalar-secret-username": "username",
|
|
10
|
+
"x-scalar-secret-auth-url": "authorizationUrl",
|
|
11
|
+
"x-scalar-secret-token-url": "tokenUrl"
|
|
12
|
+
}, i = (t, s, n = {}) => Object.fromEntries(
|
|
13
|
+
t.map((c) => {
|
|
14
|
+
const r = n[c] || s[c] || s[f[c]] || "";
|
|
15
|
+
return [c, r];
|
|
14
16
|
})
|
|
15
|
-
),
|
|
17
|
+
), l = (t = {}) => {
|
|
16
18
|
const s = t["x-scalar-secret-refresh-token"];
|
|
17
19
|
return typeof s == "string" ? { "x-scalar-secret-refresh-token": s } : {};
|
|
18
20
|
}, x = (t, s) => {
|
|
19
|
-
const
|
|
20
|
-
return { flows:
|
|
21
|
-
if (!
|
|
21
|
+
const n = /* @__PURE__ */ new Set();
|
|
22
|
+
return { flows: u(t ?? {}).reduce((r, [e, a]) => {
|
|
23
|
+
if (!p(a))
|
|
22
24
|
return r;
|
|
23
|
-
const
|
|
24
|
-
return Array.isArray(
|
|
25
|
-
...
|
|
26
|
-
...
|
|
27
|
-
[
|
|
28
|
-
|
|
25
|
+
const o = a.selectedScopes;
|
|
26
|
+
return Array.isArray(o) && o.forEach((d) => typeof d == "string" && n.add(d)), e === "implicit" && (r.implicit = {
|
|
27
|
+
...a,
|
|
28
|
+
...i(
|
|
29
|
+
[
|
|
30
|
+
"x-scalar-secret-client-id",
|
|
31
|
+
"x-scalar-secret-redirect-uri",
|
|
32
|
+
"x-scalar-secret-token",
|
|
33
|
+
"x-scalar-secret-auth-url"
|
|
34
|
+
],
|
|
35
|
+
a,
|
|
29
36
|
s?.implicit
|
|
30
37
|
),
|
|
31
|
-
...
|
|
38
|
+
...l(s?.implicit)
|
|
32
39
|
}), e === "password" && (r[e] = {
|
|
33
|
-
...
|
|
34
|
-
...
|
|
40
|
+
...a,
|
|
41
|
+
...i(
|
|
35
42
|
[
|
|
36
43
|
"x-scalar-secret-client-id",
|
|
37
44
|
"x-scalar-secret-client-secret",
|
|
38
45
|
"x-scalar-secret-username",
|
|
39
46
|
"x-scalar-secret-password",
|
|
40
|
-
"x-scalar-secret-token"
|
|
47
|
+
"x-scalar-secret-token",
|
|
48
|
+
"x-scalar-secret-token-url"
|
|
41
49
|
],
|
|
42
|
-
|
|
50
|
+
a,
|
|
43
51
|
s?.password
|
|
44
52
|
),
|
|
45
|
-
...
|
|
53
|
+
...l(s?.password)
|
|
46
54
|
}), e === "clientCredentials" && (r[e] = {
|
|
47
|
-
...
|
|
48
|
-
...
|
|
49
|
-
[
|
|
50
|
-
|
|
55
|
+
...a,
|
|
56
|
+
...i(
|
|
57
|
+
[
|
|
58
|
+
"x-scalar-secret-client-id",
|
|
59
|
+
"x-scalar-secret-client-secret",
|
|
60
|
+
"x-scalar-secret-token",
|
|
61
|
+
"x-scalar-secret-token-url"
|
|
62
|
+
],
|
|
63
|
+
a,
|
|
51
64
|
s?.clientCredentials
|
|
52
65
|
),
|
|
53
|
-
...
|
|
66
|
+
...l(s?.clientCredentials)
|
|
54
67
|
}), e === "authorizationCode" && (r[e] = {
|
|
55
|
-
...
|
|
56
|
-
...
|
|
68
|
+
...a,
|
|
69
|
+
...i(
|
|
57
70
|
[
|
|
58
71
|
"x-scalar-secret-client-id",
|
|
59
72
|
"x-scalar-secret-client-secret",
|
|
60
73
|
"x-scalar-secret-redirect-uri",
|
|
61
|
-
"x-scalar-secret-token"
|
|
74
|
+
"x-scalar-secret-token",
|
|
75
|
+
"x-scalar-secret-auth-url",
|
|
76
|
+
"x-scalar-secret-token-url"
|
|
62
77
|
],
|
|
63
|
-
|
|
78
|
+
a,
|
|
64
79
|
s?.authorizationCode
|
|
65
80
|
),
|
|
66
|
-
...
|
|
81
|
+
...l(s?.authorizationCode)
|
|
67
82
|
}), r;
|
|
68
|
-
}, {}), selectedScopes: Array.from(
|
|
69
|
-
},
|
|
70
|
-
const r = s.getAuthSecrets(
|
|
83
|
+
}, {}), selectedScopes: Array.from(n) };
|
|
84
|
+
}, C = (t, s, n, c) => {
|
|
85
|
+
const r = s.getAuthSecrets(c, n);
|
|
71
86
|
if (t.type === "apiKey") {
|
|
72
87
|
const e = r?.type === "apiKey" ? r : void 0;
|
|
73
88
|
return {
|
|
@@ -85,15 +100,15 @@ const f = {
|
|
|
85
100
|
};
|
|
86
101
|
}
|
|
87
102
|
if (t.type === "oauth2") {
|
|
88
|
-
const e = r?.type === "oauth2" ? r : void 0,
|
|
103
|
+
const e = r?.type === "oauth2" ? r : void 0, a = x(t.flows, e);
|
|
89
104
|
return {
|
|
90
105
|
...t,
|
|
91
|
-
flows:
|
|
92
|
-
"x-default-scopes":
|
|
106
|
+
flows: a.flows,
|
|
107
|
+
"x-default-scopes": a.selectedScopes
|
|
93
108
|
};
|
|
94
109
|
}
|
|
95
110
|
if (t.type === "openIdConnect") {
|
|
96
|
-
const e = r?.type === "openIdConnect" ? r : void 0,
|
|
111
|
+
const e = r?.type === "openIdConnect" ? r : void 0, a = x(
|
|
97
112
|
{
|
|
98
113
|
implicit: e?.implicit,
|
|
99
114
|
password: e?.password,
|
|
@@ -104,11 +119,11 @@ const f = {
|
|
|
104
119
|
);
|
|
105
120
|
return {
|
|
106
121
|
...t,
|
|
107
|
-
...
|
|
122
|
+
...u(a.flows).length ? { flows: a.flows } : {}
|
|
108
123
|
};
|
|
109
124
|
}
|
|
110
125
|
return t;
|
|
111
126
|
};
|
|
112
127
|
export {
|
|
113
|
-
|
|
128
|
+
C as extractSecuritySchemeSecrets
|
|
114
129
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6DAA6D,CAAA;AAWzG,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAqDD;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,sBAAsB,EAC7B,MAAM,MAAM,sBAAsB,EAClC,gBAAgB,MAAM,EAAE;AACxB,wEAAwE;AACxE,cAAc,YAAY,GAAG,IAAI;AACjC,kCAAkC;AAClC,UAAU,MAAM;AAChB,6FAA6F;AAC7F,uBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KAChD,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAwLrC,CAAA"}
|
|
@@ -33,52 +33,52 @@ const z = (t, e = {}) => {
|
|
|
33
33
|
u,
|
|
34
34
|
g
|
|
35
35
|
);
|
|
36
|
-
const
|
|
37
|
-
t[e].authorizationUrl,
|
|
36
|
+
const r = (Math.random() + 1).toString(36).substring(2, 10), a = A(
|
|
37
|
+
t[e]["x-scalar-secret-auth-url"] ?? t[e].authorizationUrl,
|
|
38
38
|
z(u, g)
|
|
39
|
-
),
|
|
39
|
+
), n = new URL(a);
|
|
40
40
|
let c = null;
|
|
41
41
|
if (e === "implicit")
|
|
42
|
-
|
|
42
|
+
n.searchParams.set("response_type", "token");
|
|
43
43
|
else if (e === "authorizationCode") {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const o = $(), d = await L(o,
|
|
44
|
+
const s = t[e];
|
|
45
|
+
if (n.searchParams.set("response_type", "code"), s["x-usePkce"] !== "no") {
|
|
46
|
+
const o = $(), d = await L(o, s["x-usePkce"]);
|
|
47
47
|
c = {
|
|
48
48
|
codeVerifier: o,
|
|
49
49
|
codeChallenge: d,
|
|
50
|
-
codeChallengeMethod:
|
|
51
|
-
},
|
|
50
|
+
codeChallengeMethod: s["x-usePkce"] === "SHA-256" ? "S256" : "plain"
|
|
51
|
+
}, n.searchParams.set("code_challenge", d), n.searchParams.set("code_challenge_method", c.codeChallengeMethod);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
const l = t[e];
|
|
55
55
|
if (l["x-scalar-secret-redirect-uri"].startsWith("/")) {
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const s = b(u, g) || window.location.origin + window.location.pathname, o = new URL(l["x-scalar-secret-redirect-uri"], s).toString();
|
|
57
|
+
n.searchParams.set("redirect_uri", o);
|
|
58
58
|
} else
|
|
59
|
-
|
|
60
|
-
f["x-scalar-security-query"] && Object.keys(f["x-scalar-security-query"]).forEach((
|
|
61
|
-
const o = f["x-scalar-security-query"]?.[
|
|
62
|
-
o &&
|
|
63
|
-
}),
|
|
64
|
-
const w = window.open(
|
|
65
|
-
return w ? new Promise((
|
|
59
|
+
n.searchParams.set("redirect_uri", l["x-scalar-secret-redirect-uri"]);
|
|
60
|
+
f["x-scalar-security-query"] && Object.keys(f["x-scalar-security-query"]).forEach((s) => {
|
|
61
|
+
const o = f["x-scalar-security-query"]?.[s];
|
|
62
|
+
o && n.searchParams.set(s, o);
|
|
63
|
+
}), n.searchParams.set("client_id", f["x-scalar-secret-client-id"]), n.searchParams.set("state", r), p && n.searchParams.set("scope", p);
|
|
64
|
+
const w = window.open(n, "openAuth2Window", "left=100,top=100,width=800,height=600");
|
|
65
|
+
return w ? new Promise((s) => {
|
|
66
66
|
const o = setInterval(() => {
|
|
67
|
-
let d = null, _ = null, x = null, P = null,
|
|
67
|
+
let d = null, _ = null, x = null, P = null, y = null;
|
|
68
68
|
try {
|
|
69
69
|
const h = new URL(w.location.href).searchParams, S = f["x-tokenName"] || "access_token";
|
|
70
|
-
d = h.get(S), _ = h.get("refresh_token"), x = h.get("code"), P = h.get("error"),
|
|
71
|
-
const
|
|
72
|
-
d ||=
|
|
70
|
+
d = h.get(S), _ = h.get("refresh_token"), x = h.get("code"), P = h.get("error"), y = h.get("error_description");
|
|
71
|
+
const k = new URLSearchParams(w.location.href.split("#")[1]);
|
|
72
|
+
d ||= k.get(S), _ ||= k.get("refresh_token"), x ||= k.get("code"), P ||= k.get("error"), y ||= k.get("error_description");
|
|
73
73
|
} catch {
|
|
74
74
|
}
|
|
75
75
|
if (w.closed || d || x || P)
|
|
76
76
|
if (clearInterval(o), w.close(), P)
|
|
77
|
-
|
|
77
|
+
s([new Error(`OAuth error: ${P}${y ? ` (${y})` : ""}`), null]);
|
|
78
78
|
else if (d) {
|
|
79
79
|
const h = w.location.href.match(/state=([^&]*)/)?.[1];
|
|
80
|
-
|
|
81
|
-
} else x && e === "authorizationCode" ? new URL(w.location.href).searchParams.get("state") ===
|
|
80
|
+
s(h === r ? [null, { accessToken: d, ..._ ? { refreshToken: _ } : {} }] : [new Error("State mismatch"), null]);
|
|
81
|
+
} else x && e === "authorizationCode" ? new URL(w.location.href).searchParams.get("state") === r ? C(
|
|
82
82
|
t,
|
|
83
83
|
e,
|
|
84
84
|
p,
|
|
@@ -89,7 +89,7 @@ const z = (t, e = {}) => {
|
|
|
89
89
|
},
|
|
90
90
|
u,
|
|
91
91
|
g
|
|
92
|
-
).then(
|
|
92
|
+
).then(s) : s([new Error("State mismatch"), null]) : (clearInterval(o), s([new Error("Window was closed without granting authorization"), null]));
|
|
93
93
|
}, 200);
|
|
94
94
|
}) : [new Error("Failed to open auth window"), null];
|
|
95
95
|
} catch {
|
|
@@ -100,32 +100,35 @@ const z = (t, e = {}) => {
|
|
|
100
100
|
pkce: m,
|
|
101
101
|
proxyUrl: g
|
|
102
102
|
} = {}, f, p = {}) => {
|
|
103
|
-
const
|
|
104
|
-
if (!
|
|
103
|
+
const r = t[e];
|
|
104
|
+
if (!r)
|
|
105
105
|
return [new Error("OAuth2 flow was not defined"), null];
|
|
106
|
-
const
|
|
107
|
-
i && (e === "clientCredentials" || e === "password") &&
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
|
|
106
|
+
const a = new URLSearchParams();
|
|
107
|
+
i && (e === "clientCredentials" || e === "password") && a.set("scope", i);
|
|
108
|
+
const n = r["x-scalar-credentials-location"] === "body";
|
|
109
|
+
if (n && (a.set("client_id", r["x-scalar-secret-client-id"]), a.set("client_secret", r["x-scalar-secret-client-secret"])), "x-scalar-secret-redirect-uri" in r && r["x-scalar-secret-redirect-uri"] && a.set("redirect_uri", r["x-scalar-secret-redirect-uri"]), u)
|
|
110
|
+
a.set("code", u), a.set("grant_type", "authorization_code"), m && a.set("code_verifier", m.codeVerifier);
|
|
111
111
|
else if (e === "password") {
|
|
112
112
|
const c = t[e];
|
|
113
|
-
|
|
113
|
+
a.set("grant_type", "password"), a.set("username", c["x-scalar-secret-username"]), a.set("password", c["x-scalar-secret-password"]);
|
|
114
114
|
} else
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
l &&
|
|
115
|
+
a.set("grant_type", "client_credentials");
|
|
116
|
+
r["x-scalar-security-body"] && Object.entries(r["x-scalar-security-body"]).forEach(([c, l]) => {
|
|
117
|
+
l && a.set(c, String(l));
|
|
118
118
|
});
|
|
119
119
|
try {
|
|
120
120
|
const c = {
|
|
121
121
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
122
122
|
};
|
|
123
|
-
|
|
124
|
-
const l = A(
|
|
123
|
+
n || (c.Authorization = `Basic ${T(`${r["x-scalar-secret-client-id"]}:${r["x-scalar-secret-client-secret"]}`)}`);
|
|
124
|
+
const l = A(
|
|
125
|
+
r["x-scalar-secret-token-url"] ?? r.tokenUrl,
|
|
126
|
+
z(f, p)
|
|
127
|
+
), U = R(g, l) ? `${g}?${new URLSearchParams([["scalar_url", l]]).toString()}` : l, s = await (await fetch(U, {
|
|
125
128
|
method: "POST",
|
|
126
129
|
headers: c,
|
|
127
|
-
body:
|
|
128
|
-
})).json(), o =
|
|
130
|
+
body: a
|
|
131
|
+
})).json(), o = r["x-tokenName"] || "access_token", d = s[o], _ = s.refresh_token;
|
|
129
132
|
return [null, { accessToken: d, ...typeof _ == "string" ? { refreshToken: _ } : {} }];
|
|
130
133
|
} catch {
|
|
131
134
|
return [new Error("Failed to get an access token. Please check your credentials."), null];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { XScalarSecretClientId, XScalarSecretClientSecret, XScalarSecretHTTP, XScalarSecretRedirectUri, XScalarSecretRefreshToken, XScalarSecretToken } from '@scalar/workspace-store/schemas/extensions/security';
|
|
1
|
+
import type { XScalarAuthUrl, XScalarSecretClientId, XScalarSecretClientSecret, XScalarSecretHTTP, XScalarSecretRedirectUri, XScalarSecretRefreshToken, XScalarSecretToken, XScalarTokenUrl } from '@scalar/workspace-store/schemas/extensions/security';
|
|
2
2
|
import type { OAuthFlowAuthorizationCode, OAuthFlowClientCredentials, OAuthFlowImplicit, OAuthFlowPassword } from '@scalar/workspace-store/schemas/v3.1/strict/oauth-flow';
|
|
3
3
|
import type { ApiKeyObject, HttpObject, OAuth2Object, OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
4
|
-
type OAuthFlowCommonSecret = XScalarSecretClientId & XScalarSecretToken & XScalarSecretRefreshToken;
|
|
4
|
+
type OAuthFlowCommonSecret = XScalarSecretClientId & XScalarSecretToken & XScalarSecretRefreshToken & XScalarAuthUrl & XScalarTokenUrl;
|
|
5
5
|
export type OAuthFlowImplicitSecret = OAuthFlowImplicit & OAuthFlowCommonSecret & XScalarSecretRedirectUri;
|
|
6
6
|
export type OAuthFlowPasswordSecret = OAuthFlowPassword & OAuthFlowCommonSecret & XScalarSecretHTTP & XScalarSecretClientSecret;
|
|
7
7
|
export type OAuthFlowClientCredentialsSecret = OAuthFlowClientCredentials & OAuthFlowCommonSecret & XScalarSecretClientSecret;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret-types.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/secret-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"secret-types.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/secret-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EAChB,MAAM,qDAAqD,CAAA;AAC5D,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,wDAAwD,CAAA;AAC/D,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,8DAA8D,CAAA;AAErE,KAAK,qBAAqB,GAAG,qBAAqB,GAChD,kBAAkB,GAClB,yBAAyB,GACzB,cAAc,GACd,eAAe,CAAA;AAEjB,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,wBAAwB,CAAA;AAE1G,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GACrD,qBAAqB,GACrB,iBAAiB,GACjB,yBAAyB,CAAA;AAE3B,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,GACvE,qBAAqB,GACrB,yBAAyB,CAAA;AAE3B,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,GACvE,qBAAqB,GACrB,yBAAyB,GACzB,wBAAwB,CAAA;AAE1B,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,uBAAuB,CAAA;IAClC,QAAQ,CAAC,EAAE,uBAAuB,CAAA;IAClC,iBAAiB,CAAC,EAAE,gCAAgC,CAAA;IACpD,iBAAiB,CAAC,EAAE,gCAAgC,CAAA;CACrD,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,kBAAkB,CAAA;AAClE,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,iBAAiB,GAAG,kBAAkB,CAAA;AAClF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAChG,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,GAAG;IAAE,KAAK,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAEhG,MAAM,MAAM,0BAA0B,GAClC,kBAAkB,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,yBAAyB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/sidebar/Sidebar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sidebar.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/sidebar/Sidebar.vue"],"names":[],"mappings":"AAqMA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAKhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIrD,KAAK,WAAW,GAAG;IACjB,iDAAiD;IACjD,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;IAC1C,4BAA4B;IAC5B,MAAM,EAAE,YAAY,CAAA;IACpB,qCAAqC;IACrC,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/B,2CAA2C;IAC3C,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,+CAA+C;IAC/C,SAAS,EAAE,iBAAiB,EAAE,CAAA;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EACR,OAAO,GACP,CAAC,CAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,CAAA;CACxE,CAAC;AAkBF,KAAK,WAAW,GAAG;IACjB,uCAAuC;IACvC,eAAe,CAAC,IAAI,OAAO,CAAA;IAC3B,sDAAsD;IACtD,SAAS,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,GAAG,OAAO,CAAA;IACpD,mDAAmD;IACnD,MAAM,CAAC,IAAI,OAAO,CAAA;IAClB,yDAAyD;IACzD,KAAK,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,GAAG,OAAO,CAAA;IAChD,oEAAoE;IACpE,kBAAkB,CAAC,IAAI,OAAO,CAAA;IAC9B,iDAAiD;IACjD,IAAI,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAA;CAC/D,CAAC;AAiCF,KAAK,gBAAgB,GAAG;IACxB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;CACtB,CAAC;AAKF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAkSxD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;kFAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as V, mergeModels as
|
|
1
|
+
import { defineComponent as V, mergeModels as g, useSlots as B, ref as C, useModel as M, computed as E, createBlock as u, openBlock as r, unref as l, withCtx as s, createVNode as y, createSlots as z, renderSlot as i, createElementBlock as w, createCommentVNode as c, Fragment as N, normalizeProps as f, guardReactiveProps as b, createElementVNode as p, normalizeClass as R, isRef as h } from "vue";
|
|
2
2
|
import { ScalarIconButton as F, ScalarSidebarSearchInput as q } from "@scalar/components";
|
|
3
3
|
import { ScalarIconFileDashed as A, ScalarIconMagnifyingGlass as U } from "@scalar/icons";
|
|
4
4
|
import { ScalarSidebar as j } from "@scalar/sidebar";
|
|
@@ -7,7 +7,7 @@ import { useSearchIndex as H } from "../../features/search/hooks/use-search-inde
|
|
|
7
7
|
import J from "../resize/Resize.vue.js";
|
|
8
8
|
const K = { class: "flex items-center justify-between" }, L = { key: 1 }, _ = /* @__PURE__ */ V({
|
|
9
9
|
__name: "Sidebar",
|
|
10
|
-
props: /* @__PURE__ */
|
|
10
|
+
props: /* @__PURE__ */ g({
|
|
11
11
|
sidebarState: {},
|
|
12
12
|
layout: {},
|
|
13
13
|
activeWorkspace: {},
|
|
@@ -21,19 +21,19 @@ const K = { class: "flex items-center justify-between" }, L = { key: 1 }, _ = /*
|
|
|
21
21
|
},
|
|
22
22
|
sidebarWidthModifiers: {}
|
|
23
23
|
}),
|
|
24
|
-
emits: /* @__PURE__ */
|
|
24
|
+
emits: /* @__PURE__ */ g(["selectItem", "select:workspace", "create:workspace", "reorder", "navigate:to:settings"], ["update:sidebarWidth"]),
|
|
25
25
|
setup(a, { emit: x }) {
|
|
26
|
-
const n = x,
|
|
27
|
-
n("selectItem", o),
|
|
26
|
+
const n = x, v = B(), d = C(!1), k = M(a, "sidebarWidth"), S = (o) => o.type === "example" && o.title === "draft", { query: m, results: $ } = H(() => a.documents), I = E(() => $.value ?? a.sidebarState.items.value), W = (o) => {
|
|
27
|
+
n("selectItem", o), m.value = "", d.value = !1;
|
|
28
28
|
};
|
|
29
|
-
return (o,
|
|
30
|
-
width:
|
|
31
|
-
"onUpdate:width":
|
|
29
|
+
return (o, e) => (r(), u(l(J), {
|
|
30
|
+
width: k.value,
|
|
31
|
+
"onUpdate:width": e[6] || (e[6] = (t) => k.value = t),
|
|
32
32
|
class: "flex flex-col"
|
|
33
33
|
}, {
|
|
34
34
|
default: s(() => [
|
|
35
35
|
y(l(j), {
|
|
36
|
-
class: "
|
|
36
|
+
class: "flex w-auto flex-1",
|
|
37
37
|
indent: 20,
|
|
38
38
|
isDraggable: a.layout !== "modal",
|
|
39
39
|
isDroppable: a.isDroppable,
|
|
@@ -41,49 +41,53 @@ const K = { class: "flex items-center justify-between" }, L = { key: 1 }, _ = /*
|
|
|
41
41
|
isSelected: a.sidebarState.isSelected,
|
|
42
42
|
items: I.value,
|
|
43
43
|
layout: "client",
|
|
44
|
-
onReorder:
|
|
44
|
+
onReorder: e[5] || (e[5] = (t, D) => n("reorder", t, D)),
|
|
45
45
|
onSelectItem: W
|
|
46
|
-
},
|
|
46
|
+
}, z({
|
|
47
47
|
header: s(() => [
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
e[7] || (e[7] = p("div", { class: "mac:h-12 mac:app-drag-region h-2" }, null, -1)),
|
|
49
|
+
p("div", {
|
|
50
|
+
class: R(["bg-sidebar-b-1 z-1 flex flex-col gap-1.5 px-3 pb-1.5", { "max-md:pt-12": a.layout !== "modal" }])
|
|
50
51
|
}, [
|
|
51
|
-
|
|
52
|
-
a.layout !== "modal" ? (r(),
|
|
52
|
+
p("div", K, [
|
|
53
|
+
a.layout !== "modal" ? (r(), u(G, {
|
|
53
54
|
key: 0,
|
|
54
55
|
activeWorkspace: a.activeWorkspace,
|
|
55
56
|
workspaces: a.workspaces,
|
|
56
|
-
"onCreate:workspace":
|
|
57
|
-
"onNavigate:to:settings":
|
|
58
|
-
"onSelect:workspace":
|
|
57
|
+
"onCreate:workspace": e[0] || (e[0] = (t) => n("create:workspace")),
|
|
58
|
+
"onNavigate:to:settings": e[1] || (e[1] = (t) => n("navigate:to:settings")),
|
|
59
|
+
"onSelect:workspace": e[2] || (e[2] = (t) => n("select:workspace", t))
|
|
59
60
|
}, {
|
|
60
61
|
sidebarMenuActions: s(() => [
|
|
61
62
|
i(o.$slots, "sidebarMenuActions")
|
|
62
63
|
]),
|
|
63
64
|
_: 3
|
|
64
|
-
}, 8, ["activeWorkspace", "workspaces"])) : a.layout === "modal" ? (r(),
|
|
65
|
+
}, 8, ["activeWorkspace", "workspaces"])) : a.layout === "modal" ? (r(), w("div", L)) : c("", !0),
|
|
65
66
|
y(l(F), {
|
|
66
67
|
icon: l(U),
|
|
67
68
|
label: "Search",
|
|
68
|
-
onClick:
|
|
69
|
+
onClick: e[3] || (e[3] = (t) => d.value = !d.value)
|
|
69
70
|
}, null, 8, ["icon"])
|
|
70
71
|
]),
|
|
71
|
-
d.value ? (r(),
|
|
72
|
+
d.value ? (r(), u(l(q), {
|
|
72
73
|
key: 0,
|
|
73
|
-
modelValue: l(
|
|
74
|
-
"onUpdate:modelValue":
|
|
74
|
+
modelValue: l(m),
|
|
75
|
+
"onUpdate:modelValue": e[4] || (e[4] = (t) => h(m) ? m.value = t : null),
|
|
75
76
|
autofocus: ""
|
|
76
|
-
}, null, 8, ["modelValue"])) :
|
|
77
|
+
}, null, 8, ["modelValue"])) : c("", !0)
|
|
77
78
|
], 2)
|
|
78
79
|
]),
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
spacer: s(() => [
|
|
81
|
+
e[8] || (e[8] = p("div", { class: "mac:app-drag-region flex-1" }, null, -1))
|
|
81
82
|
]),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
decorator: s((t) => [
|
|
84
|
+
i(o.$slots, "decorator", f(b(t)))
|
|
85
|
+
]),
|
|
86
|
+
icon: s((t) => [
|
|
87
|
+
v.icon || S(t.item) ? (r(), w(N, { key: 0 }, [
|
|
88
|
+
S(t.item) ? (r(), u(l(A), { key: 0 })) : c("", !0),
|
|
89
|
+
i(o.$slots, "icon", f(b(t)))
|
|
90
|
+
], 64)) : c("", !0)
|
|
87
91
|
]),
|
|
88
92
|
before: s(() => [
|
|
89
93
|
i(o.$slots, "workspaceButton")
|
|
@@ -93,10 +97,10 @@ const K = { class: "flex items-center justify-between" }, L = { key: 1 }, _ = /*
|
|
|
93
97
|
]),
|
|
94
98
|
_: 2
|
|
95
99
|
}, [
|
|
96
|
-
|
|
100
|
+
v.empty ? {
|
|
97
101
|
name: "empty",
|
|
98
|
-
fn: s((
|
|
99
|
-
i(o.$slots, "empty", f(
|
|
102
|
+
fn: s((t) => [
|
|
103
|
+
i(o.$slots, "empty", f(b(t)))
|
|
100
104
|
]),
|
|
101
105
|
key: "0"
|
|
102
106
|
} : void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesktopTabs.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/DesktopTabs.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DesktopTabs.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/DesktopTabs.vue"],"names":[],"mappings":"AAgFA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oEAAoE,CAAA;AAK7F,KAAK,WAAW,GAAG;IACjB,iBAAiB;IACjB,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,+BAA+B;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,0DAA0D;IAC1D,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AA+JF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as m, computed as h, createElementBlock as r, openBlock as o, createElementVNode as n, Fragment as T, renderList as p, createBlock as C, createVNode as g, unref as k } from "vue";
|
|
2
2
|
import { ScalarIcon as f } from "@scalar/components";
|
|
3
3
|
import B from "./DesktopTab.vue.js";
|
|
4
|
-
const y = { class: "t-app__top-nav z-1 flex h-10 items-center gap-2 px-2" },
|
|
4
|
+
const y = { class: "t-app__top-nav" }, S = { class: "mac:app-drag-region" }, I = { class: "z-1 flex h-10 items-center gap-2 px-2" }, w = /* @__PURE__ */ m({
|
|
5
5
|
__name: "DesktopTabs",
|
|
6
6
|
props: {
|
|
7
7
|
tabs: {},
|
|
@@ -9,44 +9,48 @@ const y = { class: "t-app__top-nav z-1 flex h-10 items-center gap-2 px-2" }, U =
|
|
|
9
9
|
eventBus: {}
|
|
10
10
|
},
|
|
11
11
|
setup(e) {
|
|
12
|
-
const
|
|
12
|
+
const s = h(() => e.tabs.length === 1), c = () => {
|
|
13
13
|
e.eventBus.emit("tabs:add:tab", void 0);
|
|
14
14
|
}, b = (t) => {
|
|
15
15
|
e.eventBus.emit("tabs:focus:tab", { index: t });
|
|
16
|
-
}, r = (t) => {
|
|
17
|
-
e.eventBus.emit("tabs:close:tab", { index: t });
|
|
18
16
|
}, i = (t) => {
|
|
19
|
-
e.eventBus.emit("tabs:close:
|
|
17
|
+
e.eventBus.emit("tabs:close:tab", { index: t });
|
|
20
18
|
}, u = (t) => {
|
|
19
|
+
e.eventBus.emit("tabs:close:other-tabs", { index: t });
|
|
20
|
+
}, d = (t) => {
|
|
21
21
|
e.eventBus.emit("tabs:copy:url", { index: t });
|
|
22
22
|
};
|
|
23
|
-
return (t,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
return (t, N) => (o(), r("nav", y, [
|
|
24
|
+
n("div", S, [
|
|
25
|
+
n("div", I, [
|
|
26
|
+
(o(!0), r(T, null, p(e.tabs, (v, a) => (o(), C(B, {
|
|
27
|
+
key: a,
|
|
28
|
+
active: a === e.activeTabIndex,
|
|
29
|
+
hotkey: !s.value && a < 9 ? String(a + 1) : void 0,
|
|
30
|
+
isSingleTab: s.value,
|
|
31
|
+
tab: v,
|
|
32
|
+
onClick: (l) => b(a),
|
|
33
|
+
onClose: (l) => i(a),
|
|
34
|
+
onCloseOtherTabs: (l) => u(a),
|
|
35
|
+
onCopyUrl: () => d(a),
|
|
36
|
+
onNewTab: c
|
|
37
|
+
}, null, 8, ["active", "hotkey", "isSingleTab", "tab", "onClick", "onClose", "onCloseOtherTabs", "onCopyUrl"]))), 128)),
|
|
38
|
+
n("button", {
|
|
39
|
+
class: "text-c-3 hover:bg-b-3 app-no-drag-region rounded p-1.5",
|
|
40
|
+
type: "button",
|
|
41
|
+
onClick: c
|
|
42
|
+
}, [
|
|
43
|
+
g(k(f), {
|
|
44
|
+
icon: "Add",
|
|
45
|
+
size: "sm",
|
|
46
|
+
thickness: "2.5"
|
|
47
|
+
})
|
|
48
|
+
])
|
|
49
|
+
])
|
|
46
50
|
])
|
|
47
51
|
]));
|
|
48
52
|
}
|
|
49
53
|
});
|
|
50
54
|
export {
|
|
51
|
-
|
|
55
|
+
w as default
|
|
52
56
|
};
|
|
@@ -83,7 +83,7 @@ const P = {
|
|
|
83
83
|
)
|
|
84
84
|
)), x = t(
|
|
85
85
|
() => b(a(e.options)?.hiddenClients)
|
|
86
|
-
), g = "2.36.
|
|
86
|
+
), g = "2.36.1";
|
|
87
87
|
return (n, o) => e.path && e.method && e.exampleName && r.value ? (m(), C(c(V), {
|
|
88
88
|
key: 0,
|
|
89
89
|
activeEnvironment: e.workspaceStore.workspace["x-scalar-active-environment"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-har-request.d.ts","sourceRoot":"","sources":["../../../../../src/views/Components/CodeSnippet/helpers/get-har-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAExG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAQtD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,+DAM3B;IACD,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IACjC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;IAClC,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACvC,KAAG,
|
|
1
|
+
{"version":3,"file":"get-har-request.d.ts","sourceRoot":"","sources":["../../../../../src/views/Components/CodeSnippet/helpers/get-har-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAExG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAQtD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,+DAM3B;IACD,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IACjC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;IAClC,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACvC,KAAG,UA2GH,CAAA"}
|