@scalar/api-client 2.5.35 → 2.6.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/CodeInput/CodeInput.vue.d.ts +0 -3
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +60 -62
- package/dist/components/CodeInput/codeVariableWidget.d.ts +1 -3
- package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
- package/dist/components/CodeInput/codeVariableWidget.js +25 -32
- package/dist/components/DataTable/DataTableInput.vue.d.ts +0 -2
- package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInput.vue.js +2 -2
- package/dist/components/DataTable/DataTableInput.vue2.js +17 -19
- package/dist/layouts/App/create-api-client-app.d.ts +10 -10
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/Modal/create-api-client-modal.d.ts +20 -20
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Web/create-api-client-web.d.ts +10 -10
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/libs/create-client.d.ts +10 -10
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
- package/dist/store/security-schemes.d.ts +10 -10
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/store.d.ts +10 -10
- package/dist/store/store.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts +14 -0
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +55 -0
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue2.js +4 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +104 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +7 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +237 -0
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +41 -0
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.js +20 -0
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +20 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +4 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +17 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +30 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +29 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +209 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts +26 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +29 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +4 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.js +10 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts +7 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.js +28 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +52 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +59 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +12 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +57 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts +25 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +212 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +15 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js +55 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts +6 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.js +18 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/index.d.ts +3 -0
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/index.js +6 -0
- package/dist/v2/blocks/operation-code-sample/types.d.ts +29 -0
- package/dist/v2/blocks/operation-code-sample/types.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +65 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +7 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +122 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +25 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +7 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +90 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.d.ts +55 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.js +39 -0
- package/dist/v2/blocks/scalar-address-bar-block/index.d.ts +2 -0
- package/dist/v2/blocks/scalar-address-bar-block/index.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/index.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +49 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +7 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue2.js +172 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts +17 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js +52 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue2.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +45 -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 +254 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue2.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +16 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +134 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue2.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +33 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +7 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue2.js +82 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +48 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.js +48 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue2.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +29 -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/components/RequestAuthTab.vue.js +232 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue2.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/event-types.d.ts +29 -0
- package/dist/v2/blocks/scalar-auth-selector-block/event-types.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts +9 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +121 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +34 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +111 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +39 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +52 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.test.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.test.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/index.js +4 -0
- package/dist/v2/components/server/ServerDropdown.test.d.ts +2 -0
- package/dist/v2/components/server/ServerDropdown.test.d.ts.map +1 -0
- package/dist/v2/components/server/ServerDropdown.vue.d.ts +33 -0
- package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -0
- package/dist/v2/components/server/ServerDropdown.vue.js +87 -0
- package/dist/v2/components/server/ServerDropdown.vue2.js +4 -0
- package/dist/v2/components/server/ServerDropdownItem.test.d.ts +2 -0
- package/dist/v2/components/server/ServerDropdownItem.test.d.ts.map +1 -0
- package/dist/v2/components/server/ServerDropdownItem.vue.d.ts +21 -0
- package/dist/v2/components/server/ServerDropdownItem.vue.d.ts.map +1 -0
- package/dist/v2/components/server/ServerDropdownItem.vue.js +7 -0
- package/dist/v2/components/server/ServerDropdownItem.vue2.js +51 -0
- package/dist/v2/components/server/index.d.ts +2 -0
- package/dist/v2/components/server/index.d.ts.map +1 -0
- package/dist/v2/components/server/index.js +4 -0
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +4 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +2 -2
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +2 -2
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/vitest.setup.d.ts.map +1 -1
- package/package.json +14 -10
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { getResolvedRef as d } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
+
import { getExampleFromSchema as p } from "../get-example-from-schema.js";
|
|
3
|
+
import { getExampleValue as h } from "./get-example-value.js";
|
|
4
|
+
const A = (e) => (e ?? []).map((o) => d(o)), g = (e) => {
|
|
5
|
+
if (e.in === "header")
|
|
6
|
+
return { style: "simple", explode: "explode" in e && e.explode !== void 0 ? e.explode : !1 };
|
|
7
|
+
if (e.in === "cookie")
|
|
8
|
+
return { style: "form", explode: "explode" in e && e.explode !== void 0 ? e.explode : !0 };
|
|
9
|
+
const o = {
|
|
10
|
+
path: "simple",
|
|
11
|
+
query: "form",
|
|
12
|
+
header: "simple",
|
|
13
|
+
cookie: "form"
|
|
14
|
+
}[e.in], t = "style" in e && e.style ? e.style : o, $ = "explode" in e && e.explode !== void 0 ? e.explode : t === "form";
|
|
15
|
+
return { style: t, explode: $ };
|
|
16
|
+
}, S = (e, o, t) => {
|
|
17
|
+
const $ = h(e, o, t);
|
|
18
|
+
if ($ !== void 0)
|
|
19
|
+
return $;
|
|
20
|
+
if ("schema" in e && e.schema) {
|
|
21
|
+
const f = e.in === "path" ? { emptyString: `{${e.name}}` } : {};
|
|
22
|
+
return p(d(e.schema), f);
|
|
23
|
+
}
|
|
24
|
+
}, w = ({
|
|
25
|
+
harRequest: e,
|
|
26
|
+
parameters: o,
|
|
27
|
+
example: t,
|
|
28
|
+
contentType: $
|
|
29
|
+
}) => {
|
|
30
|
+
const f = [...e.headers], i = [...e.queryString];
|
|
31
|
+
let r = e.url;
|
|
32
|
+
const u = A(o);
|
|
33
|
+
for (const s of u) {
|
|
34
|
+
if (!s.in || !s.name)
|
|
35
|
+
continue;
|
|
36
|
+
const n = S(s, t, $);
|
|
37
|
+
if (n === void 0)
|
|
38
|
+
continue;
|
|
39
|
+
const { style: b, explode: v } = g(s);
|
|
40
|
+
switch (s.in) {
|
|
41
|
+
case "path": {
|
|
42
|
+
r = k(r, s, n, b, v);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case "query": {
|
|
46
|
+
switch (b) {
|
|
47
|
+
case "form": {
|
|
48
|
+
if (v)
|
|
49
|
+
if (Array.isArray(n))
|
|
50
|
+
for (const l of n)
|
|
51
|
+
i.push({ name: s.name, value: String(l) });
|
|
52
|
+
else if (typeof n == "object" && n !== null)
|
|
53
|
+
for (const [l, c] of Object.entries(n))
|
|
54
|
+
i.push({ name: l, value: String(c) });
|
|
55
|
+
else
|
|
56
|
+
i.push({ name: s.name, value: String(n) });
|
|
57
|
+
else if (Array.isArray(n))
|
|
58
|
+
i.push({ name: s.name, value: n.join(",") });
|
|
59
|
+
else if (typeof n == "object" && n !== null) {
|
|
60
|
+
const l = Object.entries(n).map(([c, y]) => `${c},${y}`).join(",");
|
|
61
|
+
i.push({ name: s.name, value: l });
|
|
62
|
+
} else
|
|
63
|
+
i.push({ name: s.name, value: String(n) });
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case "spaceDelimited": {
|
|
67
|
+
if (Array.isArray(n))
|
|
68
|
+
i.push({ name: s.name, value: n.join(" ") });
|
|
69
|
+
else if (typeof n == "object" && n !== null) {
|
|
70
|
+
const l = Object.entries(n).map(([c, y]) => `${c} ${y}`).join(" ");
|
|
71
|
+
i.push({ name: s.name, value: l });
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case "pipeDelimited": {
|
|
76
|
+
if (Array.isArray(n))
|
|
77
|
+
i.push({ name: s.name, value: n.join("|") });
|
|
78
|
+
else if (typeof n == "object" && n !== null) {
|
|
79
|
+
const l = Object.entries(n).flat().join("|");
|
|
80
|
+
i.push({ name: s.name, value: l });
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case "deepObject": {
|
|
85
|
+
if (v && typeof n == "object" && n !== null)
|
|
86
|
+
for (const [l, c] of Object.entries(n))
|
|
87
|
+
i.push({ name: `${s.name}[${l}]`, value: String(c) });
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
// Default to form style
|
|
91
|
+
default:
|
|
92
|
+
i.push({ name: s.name, value: String(n) });
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case "header":
|
|
97
|
+
if (v)
|
|
98
|
+
if (Array.isArray(n))
|
|
99
|
+
for (const l of n)
|
|
100
|
+
f.push({ name: s.name, value: String(l) });
|
|
101
|
+
else if (typeof n == "object" && n !== null) {
|
|
102
|
+
const l = Object.entries(n).map(([c, y]) => `${c}=${y}`).join(",");
|
|
103
|
+
f.push({ name: s.name, value: l });
|
|
104
|
+
} else
|
|
105
|
+
f.push({ name: s.name, value: String(n) });
|
|
106
|
+
else if (Array.isArray(n))
|
|
107
|
+
f.push({ name: s.name, value: n.join(",") });
|
|
108
|
+
else if (typeof n == "object" && n !== null) {
|
|
109
|
+
const l = Object.entries(n).map(([c, y]) => `${c},${y}`).join(",");
|
|
110
|
+
f.push({ name: s.name, value: l });
|
|
111
|
+
} else
|
|
112
|
+
f.push({ name: s.name, value: String(n) });
|
|
113
|
+
break;
|
|
114
|
+
case "cookie":
|
|
115
|
+
if (v)
|
|
116
|
+
if (Array.isArray(n))
|
|
117
|
+
for (const l of n)
|
|
118
|
+
e.cookies.push({ name: s.name, value: l === null ? "null" : String(l) });
|
|
119
|
+
else if (typeof n == "object" && n !== null)
|
|
120
|
+
for (const [l, c] of Object.entries(n))
|
|
121
|
+
e.cookies.push({ name: l, value: c === null ? "null" : String(c) });
|
|
122
|
+
else
|
|
123
|
+
e.cookies.push({ name: s.name, value: n === null ? "null" : String(n) });
|
|
124
|
+
else if (Array.isArray(n)) {
|
|
125
|
+
const l = n.map((c) => c === null ? "null" : String(c)).join(",");
|
|
126
|
+
e.cookies.push({ name: s.name, value: l });
|
|
127
|
+
} else if (typeof n == "object" && n !== null) {
|
|
128
|
+
const l = (y) => {
|
|
129
|
+
const a = [];
|
|
130
|
+
for (const [m, j] of Object.entries(y))
|
|
131
|
+
typeof j == "object" && j !== null && !Array.isArray(j) ? a.push(m, ...l(j)) : a.push(m, j === null ? "null" : String(j));
|
|
132
|
+
return a;
|
|
133
|
+
}, c = l(n).join(",");
|
|
134
|
+
e.cookies.push({ name: s.name, value: c });
|
|
135
|
+
} else
|
|
136
|
+
e.cookies.push({ name: s.name, value: n === null ? "null" : String(n) });
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
url: r,
|
|
142
|
+
headers: f,
|
|
143
|
+
queryString: i,
|
|
144
|
+
cookies: e.cookies
|
|
145
|
+
};
|
|
146
|
+
}, k = (e, o, t, $, f) => {
|
|
147
|
+
switch ($) {
|
|
148
|
+
case "matrix": {
|
|
149
|
+
if (f) {
|
|
150
|
+
if (Array.isArray(t)) {
|
|
151
|
+
const i = t.map((r) => `${o.name}=${r}`).join(";");
|
|
152
|
+
return e.replace(`{;${o.name}}`, `;${i}`);
|
|
153
|
+
}
|
|
154
|
+
if (typeof t == "object" && t !== null) {
|
|
155
|
+
const i = Object.entries(t).map(([r, u]) => `${r}=${u}`).join(";");
|
|
156
|
+
return e.replace(`{;${o.name}}`, `;${i}`);
|
|
157
|
+
}
|
|
158
|
+
return e.replace(`{;${o.name}}`, `;${o.name}=${t}`);
|
|
159
|
+
}
|
|
160
|
+
if (Array.isArray(t))
|
|
161
|
+
return e.replace(`{;${o.name}}`, `;${o.name}=${t.join(",")}`);
|
|
162
|
+
if (typeof t == "object" && t !== null) {
|
|
163
|
+
const i = Object.entries(t).map(([r, u]) => `${r},${u}`).join(",");
|
|
164
|
+
return e.replace(`{;${o.name}}`, `;${o.name}=${i}`);
|
|
165
|
+
}
|
|
166
|
+
return e.replace(`{;${o.name}}`, `;${o.name}=${t}`);
|
|
167
|
+
}
|
|
168
|
+
case "label": {
|
|
169
|
+
if (f) {
|
|
170
|
+
if (Array.isArray(t))
|
|
171
|
+
return e.replace(`{.${o.name}}`, `.${t.join(".")}`);
|
|
172
|
+
if (typeof t == "object" && t !== null) {
|
|
173
|
+
const i = Object.entries(t).map(([r, u]) => `${r}=${u}`).join(".");
|
|
174
|
+
return e.replace(`{.${o.name}}`, `.${i}`);
|
|
175
|
+
}
|
|
176
|
+
return e.replace(`{.${o.name}}`, `.${t}`);
|
|
177
|
+
}
|
|
178
|
+
if (Array.isArray(t))
|
|
179
|
+
return e.replace(`{.${o.name}}`, `.${t.join(",")}`);
|
|
180
|
+
if (typeof t == "object" && t !== null) {
|
|
181
|
+
const i = Object.entries(t).map(([r, u]) => `${r},${u}`).join(",");
|
|
182
|
+
return e.replace(`{.${o.name}}`, `.${i}`);
|
|
183
|
+
}
|
|
184
|
+
return e.replace(`{.${o.name}}`, `.${t}`);
|
|
185
|
+
}
|
|
186
|
+
case "simple": {
|
|
187
|
+
if (f) {
|
|
188
|
+
if (Array.isArray(t))
|
|
189
|
+
return e.replace(`{${o.name}}`, t.join(","));
|
|
190
|
+
if (typeof t == "object" && t !== null) {
|
|
191
|
+
const i = Object.entries(t).map(([r, u]) => `${r}=${u}`).join(",");
|
|
192
|
+
return e.replace(`{${o.name}}`, i);
|
|
193
|
+
}
|
|
194
|
+
return e.replace(`{${o.name}}`, String(t));
|
|
195
|
+
}
|
|
196
|
+
if (Array.isArray(t))
|
|
197
|
+
return e.replace(`{${o.name}}`, t.join(","));
|
|
198
|
+
if (typeof t == "object" && t !== null) {
|
|
199
|
+
const i = Object.entries(t).map(([r, u]) => `${r},${u}`).join(",");
|
|
200
|
+
return e.replace(`{${o.name}}`, i);
|
|
201
|
+
}
|
|
202
|
+
return e.replace(`{${o.name}}`, String(t));
|
|
203
|
+
}
|
|
204
|
+
// Default to simple style
|
|
205
|
+
default:
|
|
206
|
+
return e.replace(`{${o.name}}`, String(t));
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
export {
|
|
210
|
+
A as deReferenceParams,
|
|
211
|
+
w as processParameters
|
|
212
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-parameters.test.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.test.ts"],"names":[],"mappings":""}
|
package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
+
import type { Request as HarRequest } from 'har-format';
|
|
3
|
+
type ProcessedSecuritySchemesReturn = {
|
|
4
|
+
headers: HarRequest['headers'];
|
|
5
|
+
queryString: HarRequest['queryString'];
|
|
6
|
+
cookies: HarRequest['cookies'];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Process security schemes into whichever parameters they are applicable to
|
|
10
|
+
*
|
|
11
|
+
* TODO: we probably want to be able to disable YOUR_SECRET_TOKEN placeholder text + or allow it to be customzied
|
|
12
|
+
*/
|
|
13
|
+
export declare const processSecuritySchemes: (securitySchemes: SecuritySchemeObject[]) => ProcessedSecuritySchemesReturn;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=process-security-schemes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-security-schemes.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AACxG,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAGvD,KAAK,8BAA8B,GAAG;IACpC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACtC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAC/B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,iBAAiB,oBAAoB,EAAE,KAAG,8BAuEhF,CAAA"}
|
package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { encode as n } from "js-base64";
|
|
2
|
+
const i = (c) => {
|
|
3
|
+
const s = {
|
|
4
|
+
headers: [],
|
|
5
|
+
queryString: [],
|
|
6
|
+
cookies: []
|
|
7
|
+
};
|
|
8
|
+
for (const e of c) {
|
|
9
|
+
if (e.type === "apiKey") {
|
|
10
|
+
const a = e["x-scalar-secret-token"] || "YOUR_SECRET_TOKEN";
|
|
11
|
+
if (!e.name)
|
|
12
|
+
continue;
|
|
13
|
+
const o = { name: e.name, value: a };
|
|
14
|
+
switch (e.in) {
|
|
15
|
+
case "header":
|
|
16
|
+
s.headers.push(o);
|
|
17
|
+
break;
|
|
18
|
+
case "query":
|
|
19
|
+
s.queryString.push(o);
|
|
20
|
+
break;
|
|
21
|
+
case "cookie":
|
|
22
|
+
s.cookies.push(o);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (e.type === "http") {
|
|
28
|
+
if (e.scheme === "basic") {
|
|
29
|
+
const a = e["x-scalar-secret-username"] || "", o = e["x-scalar-secret-password"] || "", r = `${a}:${o}`, t = r === ":" ? "username:password" : n(r);
|
|
30
|
+
s.headers.push({
|
|
31
|
+
name: "Authorization",
|
|
32
|
+
value: `Basic ${t}`
|
|
33
|
+
});
|
|
34
|
+
} else if (e.scheme === "bearer") {
|
|
35
|
+
const a = e["x-scalar-secret-token"] || "YOUR_SECRET_TOKEN";
|
|
36
|
+
s.headers.push({
|
|
37
|
+
name: "Authorization",
|
|
38
|
+
value: `Bearer ${a}`
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (e.type === "oauth2" && e.flows) {
|
|
44
|
+
const r = Object.values(e.flows).find((t) => t["x-scalar-secret-token"])?.["x-scalar-secret-token"] || "YOUR_SECRET_TOKEN";
|
|
45
|
+
s.headers.push({
|
|
46
|
+
name: "Authorization",
|
|
47
|
+
value: `Bearer ${r}`
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return s;
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
i as processSecuritySchemes
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-security-schemes.test.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
+
/**
|
|
3
|
+
* Processes a server URL by replacing variables with their default values and merging with the path
|
|
4
|
+
*/
|
|
5
|
+
export declare const processServerUrl: (server: ServerObject, path: string) => string;
|
|
6
|
+
//# sourceMappingURL=process-server-url.d.ts.map
|
package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-server-url.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,YAAY,EAAE,MAAM,MAAM,KAAG,MA4BrE,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { replaceVariables as c } from "@scalar/helpers/regex/replace-variables";
|
|
2
|
+
import { mergeUrls as a } from "@scalar/helpers/url/merge-urls";
|
|
3
|
+
const m = (r, e) => {
|
|
4
|
+
if (!r.url)
|
|
5
|
+
return e;
|
|
6
|
+
const t = r.url;
|
|
7
|
+
if (r.variables) {
|
|
8
|
+
const i = Object.entries(r.variables).reduce(
|
|
9
|
+
(l, [u, s]) => (s.default !== void 0 && (l[u] = s.default), l),
|
|
10
|
+
{}
|
|
11
|
+
), o = c(t, i);
|
|
12
|
+
return a(o, e);
|
|
13
|
+
}
|
|
14
|
+
return a(t, e);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
m as processServerUrl
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-server-url.test.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-code-sample/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ScalarComboboxOption, ScalarComboboxOptionGroup } from '@scalar/components';
|
|
2
|
+
import type { AvailableClients, ClientId, TargetId } from '@scalar/snippetz';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a client option in the request example block.
|
|
5
|
+
* Extends the base combobox option with language-specific information
|
|
6
|
+
* for generating code examples in different programming languages.
|
|
7
|
+
*/
|
|
8
|
+
export type ClientOption = ScalarComboboxOption & {
|
|
9
|
+
/** A more specific ID */
|
|
10
|
+
id: AvailableClients[number];
|
|
11
|
+
/** Programming language or tool for code generation (e.g., 'javascript', 'python', 'curl') */
|
|
12
|
+
lang: TargetId | 'curl' | 'plaintext';
|
|
13
|
+
/** Title shows when the client is selected in the dropdown */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Target key for the client, differs from the lang due to the curl thing */
|
|
16
|
+
targetKey: TargetId;
|
|
17
|
+
/** Title of the target */
|
|
18
|
+
targetTitle: string;
|
|
19
|
+
/** Client key for the client */
|
|
20
|
+
clientKey: ClientId<TargetId>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Augments the base combobox option group with ClientOptions
|
|
24
|
+
*/
|
|
25
|
+
export type ClientOptionGroup = Omit<ScalarComboboxOptionGroup, 'options'> & {
|
|
26
|
+
/** Array of client options that belong to this group */
|
|
27
|
+
options: ClientOption[];
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-code-sample/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AACzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE5E;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,oBAAoB,GAAG;IAChD,yBAAyB;IACzB,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC5B,8FAA8F;IAC9F,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;IACrC,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAA;IACb,6EAA6E;IAC7E,SAAS,EAAE,QAAQ,CAAA;IACnB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,gCAAgC;IAChC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;CAC9B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,yBAAyB,EAAE,SAAS,CAAC,GAAG;IAC3E,wDAAwD;IACxD,OAAO,EAAE,YAAY,EAAE,CAAA;CACxB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddressBar.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods';
|
|
2
|
+
import type { Environment } from '@scalar/oas-utils/entities/environment';
|
|
3
|
+
import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
4
|
+
import { type ClientLayout } from '../../../../hooks/index.js';
|
|
5
|
+
import type { EnvVariable } from '../../../../store/active-entities.js';
|
|
6
|
+
import type { createStoreEvents } from '../../../../store/events.js';
|
|
7
|
+
import { type History } from './AddressBarHistory.vue.js';
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
/** Current request path */
|
|
10
|
+
path: string;
|
|
11
|
+
/** Current request method */
|
|
12
|
+
method: HttpMethodType;
|
|
13
|
+
/** Currently selected server */
|
|
14
|
+
server: ServerObject | undefined;
|
|
15
|
+
/** Server list available for operation/document */
|
|
16
|
+
servers: ServerObject[];
|
|
17
|
+
/** Environment variables used for codemirror variables pill on input */
|
|
18
|
+
environment: Environment;
|
|
19
|
+
envVariables: EnvVariable[];
|
|
20
|
+
/** List of request history */
|
|
21
|
+
history: History[];
|
|
22
|
+
/** Client layout */
|
|
23
|
+
layout: ClientLayout;
|
|
24
|
+
/** The amount remaining to load from 100 -> 0 */
|
|
25
|
+
percentage?: number;
|
|
26
|
+
/** Event bus */
|
|
27
|
+
events: ReturnType<typeof createStoreEvents>;
|
|
28
|
+
};
|
|
29
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
30
|
+
addServer: () => any;
|
|
31
|
+
importCurl: (value: string) => any;
|
|
32
|
+
"update:variable": (payload: {
|
|
33
|
+
key: string;
|
|
34
|
+
value: string;
|
|
35
|
+
}) => any;
|
|
36
|
+
"update:selectedServer": (payload: {
|
|
37
|
+
id: string;
|
|
38
|
+
}) => any;
|
|
39
|
+
"update:method": (payload: {
|
|
40
|
+
method: HttpMethodType;
|
|
41
|
+
}) => any;
|
|
42
|
+
"update:path": (payload: {
|
|
43
|
+
path: string;
|
|
44
|
+
}) => any;
|
|
45
|
+
execute: () => any;
|
|
46
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
47
|
+
onAddServer?: (() => any) | undefined;
|
|
48
|
+
onImportCurl?: ((value: string) => any) | undefined;
|
|
49
|
+
"onUpdate:variable"?: ((payload: {
|
|
50
|
+
key: string;
|
|
51
|
+
value: string;
|
|
52
|
+
}) => any) | undefined;
|
|
53
|
+
"onUpdate:selectedServer"?: ((payload: {
|
|
54
|
+
id: string;
|
|
55
|
+
}) => any) | undefined;
|
|
56
|
+
"onUpdate:method"?: ((payload: {
|
|
57
|
+
method: HttpMethodType;
|
|
58
|
+
}) => any) | undefined;
|
|
59
|
+
"onUpdate:path"?: ((payload: {
|
|
60
|
+
path: string;
|
|
61
|
+
}) => any) | undefined;
|
|
62
|
+
onExecute?: (() => any) | undefined;
|
|
63
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
64
|
+
export default _default;
|
|
65
|
+
//# sourceMappingURL=AddressBar.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue"],"names":[],"mappings":"AAsSA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAKhG,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGvD,OAA0B,EAAE,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEzE,KAAK,WAAW,GAAG;IACjB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,cAAc,CAAA;IACtB,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IAChC,mDAAmD;IACnD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,wEAAwE;IACxE,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,8BAA8B;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB;IAChB,MAAM,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA;CAC7C,CAAC;;;;;aAwBuC,MAAM;eAAS,MAAM;;;YADhB,MAAM;;;gBANV,cAAc;;;cAElB,MAAM;;;;;;;aAKH,MAAM;eAAS,MAAM;;;YADhB,MAAM;;;gBANV,cAAc;;;cAElB,MAAM;;;;AA8Y5C,wBAOG"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { defineComponent as g, useId as h, ref as p, createElementBlock as y, openBlock as f, unref as o, createElementVNode as l, createVNode as a, normalizeStyle as c, createBlock as x, createCommentVNode as w, withCtx as S, toDisplayString as u } from "vue";
|
|
2
|
+
import { ScalarButton as B, ScalarIcon as k } from "@scalar/components";
|
|
3
|
+
import { REQUEST_METHODS as C } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import V from "../../../../components/CodeInput/CodeInput.vue.js";
|
|
5
|
+
import E from "./AddressBarHistory.vue.js";
|
|
6
|
+
import $ from "../../../../components/HttpMethod/HttpMethod.vue.js";
|
|
7
|
+
import R from "../../../components/server/ServerDropdown.vue.js";
|
|
8
|
+
const z = ["id"], U = { class: "address-bar-bg-states text-xxs group relative order-last flex w-full max-w-[calc(100dvw-24px)] flex-1 flex-row items-stretch rounded-lg p-0.75 lg:order-none lg:max-w-[580px] lg:min-w-[580px] xl:max-w-[720px] xl:min-w-[720px]" }, A = { class: "pointer-events-none absolute top-0 left-0 block h-full w-full overflow-hidden rounded-lg border" }, I = { class: "z-context-plus flex gap-1" }, H = { class: "scroll-timeline-x scroll-timeline-x-hidden z-context-plus relative flex w-full bg-blend-normal" }, N = {
|
|
9
|
+
"aria-hidden": "true",
|
|
10
|
+
class: "inline-flex items-center gap-1"
|
|
11
|
+
}, T = { class: "sr-only" }, Q = /* @__PURE__ */ g({
|
|
12
|
+
__name: "AddressBar",
|
|
13
|
+
props: {
|
|
14
|
+
path: {},
|
|
15
|
+
method: {},
|
|
16
|
+
server: {},
|
|
17
|
+
servers: {},
|
|
18
|
+
environment: {},
|
|
19
|
+
envVariables: {},
|
|
20
|
+
history: {},
|
|
21
|
+
layout: {},
|
|
22
|
+
percentage: { default: 100 },
|
|
23
|
+
events: {}
|
|
24
|
+
},
|
|
25
|
+
emits: ["importCurl", "update:method", "update:path", "execute", "update:selectedServer", "update:variable", "addServer"],
|
|
26
|
+
setup(n, { emit: v }) {
|
|
27
|
+
const s = v, d = h(), i = p(null), m = p(null);
|
|
28
|
+
function b() {
|
|
29
|
+
return C[n.method].colorVar;
|
|
30
|
+
}
|
|
31
|
+
return n.events.hotKeys.on((r) => {
|
|
32
|
+
r?.focusAddressBar && i.value?.focus();
|
|
33
|
+
}), n.events.focusAddressBar.on(() => {
|
|
34
|
+
n.layout === "modal" ? m.value?.$el?.focus() : i.value?.focus();
|
|
35
|
+
}), (r, e) => (f(), y("div", {
|
|
36
|
+
id: o(d),
|
|
37
|
+
class: "scalar-address-bar order-last flex h-(--scalar-address-bar-height) w-full [--scalar-address-bar-height:32px] lg:order-none lg:w-auto"
|
|
38
|
+
}, [
|
|
39
|
+
l("div", U, [
|
|
40
|
+
l("div", A, [
|
|
41
|
+
l("div", {
|
|
42
|
+
class: "absolute top-0 left-0 z-[1002] h-full w-full",
|
|
43
|
+
style: c({
|
|
44
|
+
backgroundColor: `color-mix(in srgb, transparent 90%, ${b()})`,
|
|
45
|
+
transform: `translate3d(-${r.percentage}%,0,0)`
|
|
46
|
+
})
|
|
47
|
+
}, null, 4)
|
|
48
|
+
]),
|
|
49
|
+
l("div", I, [
|
|
50
|
+
a(o($), {
|
|
51
|
+
isEditable: r.layout !== "modal",
|
|
52
|
+
isSquare: "",
|
|
53
|
+
method: r.method,
|
|
54
|
+
teleport: "",
|
|
55
|
+
onChange: e[0] || (e[0] = (t) => s("update:method", { method: t }))
|
|
56
|
+
}, null, 8, ["isEditable", "method"])
|
|
57
|
+
]),
|
|
58
|
+
l("div", H, [
|
|
59
|
+
r.servers.length ? (f(), x(o(R), {
|
|
60
|
+
key: 0,
|
|
61
|
+
layout: r.layout,
|
|
62
|
+
server: r.server,
|
|
63
|
+
servers: r.servers,
|
|
64
|
+
target: o(d),
|
|
65
|
+
onAddServer: e[1] || (e[1] = (t) => s("addServer")),
|
|
66
|
+
"onUpdate:selectedServer": e[2] || (e[2] = (t) => s("update:selectedServer", t)),
|
|
67
|
+
"onUpdate:variable": e[3] || (e[3] = (t) => s("update:variable", t))
|
|
68
|
+
}, null, 8, ["layout", "server", "servers", "target"])) : w("", !0),
|
|
69
|
+
e[8] || (e[8] = l("div", { class: "fade-left" }, null, -1)),
|
|
70
|
+
a(V, {
|
|
71
|
+
ref_key: "addressBarRef",
|
|
72
|
+
ref: i,
|
|
73
|
+
"aria-label": "Path",
|
|
74
|
+
class: "min-w-fit outline-none",
|
|
75
|
+
disableCloseBrackets: "",
|
|
76
|
+
disabled: r.layout === "modal",
|
|
77
|
+
disableEnter: "",
|
|
78
|
+
disableTabIndent: "",
|
|
79
|
+
emitOnBlur: !1,
|
|
80
|
+
envVariables: r.envVariables,
|
|
81
|
+
environment: r.environment,
|
|
82
|
+
importCurl: "",
|
|
83
|
+
modelValue: r.path,
|
|
84
|
+
placeholder: r.server ? "" : "Enter a URL or cURL command",
|
|
85
|
+
server: "",
|
|
86
|
+
onCurl: e[4] || (e[4] = (t) => r.$emit("importCurl", t)),
|
|
87
|
+
onSubmit: e[5] || (e[5] = (t) => s("execute")),
|
|
88
|
+
"onUpdate:modelValue": e[6] || (e[6] = (t) => s("update:path", { path: t }))
|
|
89
|
+
}, null, 8, ["disabled", "envVariables", "environment", "modelValue", "placeholder"]),
|
|
90
|
+
e[9] || (e[9] = l("div", { class: "fade-right" }, null, -1))
|
|
91
|
+
]),
|
|
92
|
+
a(E, {
|
|
93
|
+
history: r.history,
|
|
94
|
+
target: o(d)
|
|
95
|
+
}, null, 8, ["history", "target"]),
|
|
96
|
+
a(o(B), {
|
|
97
|
+
ref_key: "sendButtonRef",
|
|
98
|
+
ref: m,
|
|
99
|
+
class: "z-context-plus relative h-auto shrink-0 overflow-hidden py-1 pr-2.5 pl-2 font-bold",
|
|
100
|
+
disabled: r.percentage < 100,
|
|
101
|
+
onClick: e[7] || (e[7] = (t) => s("execute"))
|
|
102
|
+
}, {
|
|
103
|
+
default: S(() => [
|
|
104
|
+
l("span", N, [
|
|
105
|
+
a(o(k), {
|
|
106
|
+
class: "relative shrink-0 fill-current",
|
|
107
|
+
icon: "Play",
|
|
108
|
+
size: "xs"
|
|
109
|
+
}),
|
|
110
|
+
e[10] || (e[10] = l("span", { class: "text-xxs hidden lg:flex" }, "Send", -1))
|
|
111
|
+
]),
|
|
112
|
+
l("span", T, " Send " + u(r.method) + " request to " + u(r.server?.url ?? "") + u(r.path), 1)
|
|
113
|
+
]),
|
|
114
|
+
_: 1
|
|
115
|
+
}, 8, ["disabled"])
|
|
116
|
+
])
|
|
117
|
+
], 8, z));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
export {
|
|
121
|
+
Q as default
|
|
122
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddressBarHistory.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods';
|
|
2
|
+
export type History = {
|
|
3
|
+
id: string;
|
|
4
|
+
method: HttpMethodType;
|
|
5
|
+
path: string;
|
|
6
|
+
duration: number;
|
|
7
|
+
status: number;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
/** The id of the target to use for the popover (e.g. address bar) */
|
|
11
|
+
target: string;
|
|
12
|
+
/** List of all request history items */
|
|
13
|
+
history: History[];
|
|
14
|
+
};
|
|
15
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
16
|
+
selectHistoryItem: (payload: {
|
|
17
|
+
index: number;
|
|
18
|
+
}) => any;
|
|
19
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
+
onSelectHistoryItem?: ((payload: {
|
|
21
|
+
index: number;
|
|
22
|
+
}) => any) | undefined;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=AddressBarHistory.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddressBarHistory.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue"],"names":[],"mappings":"AA4GA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAQrF,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,cAAc,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,OAAO,EAAE,OAAO,EAAE,CAAA;CACnB,CAAC;;;eAK2C,MAAM;;;;eAAN,MAAM;;;AAyOnD,wBAOG"}
|