@scalar/api-client 2.3.31 → 2.3.32
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 +12 -0
- package/dist/style.css +1 -1
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue.d.ts +2 -0
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue.d.ts.map +1 -1
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue.js +15 -13
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts +3 -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 +74 -31
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts +3 -1
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts.map +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.js +8 -6
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.d.ts +2 -0
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +54 -59
- package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue.js +3 -3
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +17 -16
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/consts/mediaTypes.d.ts.map +1 -1
- package/dist/views/Request/consts/mediaTypes.js +1 -0
- package/package.json +10 -10
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Operation, RequestExample, SecurityScheme, Server } from '@scalar/oas-utils/entities/spec';
|
|
2
2
|
import type { ClientId, TargetId } from '@scalar/snippetz';
|
|
3
|
+
import type { EnvVariables } from '../../../libs/env-helpers';
|
|
3
4
|
type __VLS_Props = {
|
|
4
5
|
target: TargetId;
|
|
5
6
|
client: ClientId<TargetId>;
|
|
@@ -7,6 +8,7 @@ type __VLS_Props = {
|
|
|
7
8
|
server?: Server | undefined;
|
|
8
9
|
example?: RequestExample | undefined;
|
|
9
10
|
securitySchemes?: SecurityScheme[];
|
|
11
|
+
environment?: EnvVariables | undefined;
|
|
10
12
|
};
|
|
11
13
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
14
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeSnippet.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Components/CodeSnippet/CodeSnippet.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CodeSnippet.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Components/CodeSnippet/CodeSnippet.vue"],"names":[],"mappings":"AAgGA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,cAAc,EACd,MAAM,EACP,MAAM,iCAAiC,CAAA;AAExC,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAG1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAKtD,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,QAAQ,CAAA;IAChB,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC1B,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IACjC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;IACpC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;IAClC,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACvC,CAAC;;AAmIF,wBAMG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as u, computed as
|
|
2
|
-
import { ScalarCodeBlock as
|
|
3
|
-
import { isDefined as
|
|
4
|
-
import { getSnippet as
|
|
1
|
+
import { defineComponent as u, computed as a, createElementBlock as c, createBlock as s, createCommentVNode as d, openBlock as l, toDisplayString as m, unref as f } from "vue";
|
|
2
|
+
import { ScalarCodeBlock as p } from "@scalar/components";
|
|
3
|
+
import { isDefined as v } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { getSnippet as y } from "./helpers/get-snippet.js";
|
|
5
5
|
const g = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "text-c-3 flex min-h-16 items-center justify-center px-4 text-sm"
|
|
@@ -13,28 +13,30 @@ const g = {
|
|
|
13
13
|
operation: {},
|
|
14
14
|
server: {},
|
|
15
15
|
example: {},
|
|
16
|
-
securitySchemes: { default: () => [] }
|
|
16
|
+
securitySchemes: { default: () => [] },
|
|
17
|
+
environment: {}
|
|
17
18
|
},
|
|
18
19
|
setup(t) {
|
|
19
|
-
const i =
|
|
20
|
+
const i = a(
|
|
20
21
|
() => t.securitySchemes.flatMap((e) => e.type === "apiKey" ? e.value : (e == null ? void 0 : e.type) === "http" ? [
|
|
21
22
|
e.token,
|
|
22
23
|
e.password,
|
|
23
24
|
btoa(`${e.username}:${e.password}`)
|
|
24
|
-
] : e.type === "oauth2" ? Object.values(e.flows).map((r) => r == null ? void 0 : r.token).filter(
|
|
25
|
-
),
|
|
26
|
-
const [e, r] =
|
|
25
|
+
] : e.type === "oauth2" ? Object.values(e.flows).map((r) => r == null ? void 0 : r.token).filter(v) : [])
|
|
26
|
+
), n = a(() => {
|
|
27
|
+
const [e, r] = y(t.target, t.client, {
|
|
27
28
|
operation: t.operation,
|
|
28
29
|
example: t.example,
|
|
29
30
|
server: t.server,
|
|
30
|
-
securitySchemes: t.securitySchemes
|
|
31
|
+
securitySchemes: t.securitySchemes,
|
|
32
|
+
environment: t.environment
|
|
31
33
|
});
|
|
32
34
|
return { error: e, payload: r };
|
|
33
|
-
}), o =
|
|
34
|
-
return (e, r) =>
|
|
35
|
+
}), o = a(() => t.target === "shell" && t.client === "curl" ? "curl" : t.target ?? "plaintext");
|
|
36
|
+
return (e, r) => n.value.error ? (l(), c("div", g, m(n.value.error.message), 1)) : n.value.payload ? (l(), s(f(p), {
|
|
35
37
|
key: 1,
|
|
36
38
|
class: "w-full",
|
|
37
|
-
content:
|
|
39
|
+
content: n.value.payload,
|
|
38
40
|
hideCredentials: i.value,
|
|
39
41
|
lang: o.value,
|
|
40
42
|
lineNumbers: ""
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Operation, RequestExample, SecurityScheme, Server } from '@scalar/oas-utils/entities/spec';
|
|
2
2
|
import type { HarRequest } from '@scalar/snippetz';
|
|
3
|
+
import type { EnvVariables } from '../../../../libs/env-helpers';
|
|
3
4
|
/**
|
|
4
5
|
* Creates a snippetz-compatible HarRequest from OpenAPI-like store entities
|
|
5
6
|
*/
|
|
6
|
-
export declare const getHarRequest: ({ operation, example, server, securitySchemes, }: {
|
|
7
|
+
export declare const getHarRequest: ({ operation, example, server, securitySchemes, environment, }: {
|
|
7
8
|
operation?: Operation | undefined;
|
|
8
9
|
example?: RequestExample | undefined;
|
|
9
10
|
server?: Server | undefined;
|
|
10
11
|
securitySchemes?: SecurityScheme[];
|
|
12
|
+
environment?: EnvVariables | undefined;
|
|
11
13
|
}) => HarRequest;
|
|
12
14
|
//# sourceMappingURL=get-har-request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-har-request.d.ts","sourceRoot":"","sources":["../../../../../src/views/Components/CodeSnippet/helpers/get-har-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"get-har-request.d.ts","sourceRoot":"","sources":["../../../../../src/views/Components/CodeSnippet/helpers/get-har-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAMtD;;GAEG;AACH,eAAO,MAAM,aAAa,kEAMvB;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,UA0GH,CAAA"}
|
|
@@ -1,43 +1,86 @@
|
|
|
1
|
-
import { buildRequestSecurity as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { buildRequestSecurity as V } from "../../../../libs/send-request/build-request-security.js";
|
|
2
|
+
import { replaceTemplateVariables as A } from "../../../../libs/string-template.js";
|
|
3
|
+
import { REGEX as s } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { convertToHarRequest as L } from "./convert-to-har-request.js";
|
|
5
|
+
const v = "YOUR_SECRET_TOKEN", g = ({
|
|
6
|
+
operation: e,
|
|
7
|
+
example: u,
|
|
8
|
+
server: r,
|
|
9
|
+
securitySchemes: i = [],
|
|
10
|
+
environment: E
|
|
8
11
|
}) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const n = E && Array.isArray(E) ? Object.fromEntries(E.map((t) => [t.key, t.value])) : E || {}, T = (() => {
|
|
13
|
+
if (r != null && r.url && (s.VARIABLES.test(r.url) || s.PATH.test(r.url))) {
|
|
14
|
+
const t = Object.entries((r == null ? void 0 : r.variables) || {}).reduce(
|
|
15
|
+
(a, [d, l]) => {
|
|
16
|
+
var o, R;
|
|
17
|
+
const c = (R = (o = u == null ? void 0 : u.parameters) == null ? void 0 : o.path.find((b) => b.enabled && b.key === d)) == null ? void 0 : R.value;
|
|
18
|
+
return c ? a[d] = A(c, n) : l.default && (a[d] = A(l.default, n)), a;
|
|
19
|
+
},
|
|
20
|
+
{}
|
|
21
|
+
);
|
|
22
|
+
return A(A(r.url, n), t);
|
|
23
|
+
}
|
|
24
|
+
return r == null ? void 0 : r.url;
|
|
25
|
+
})(), P = (() => {
|
|
26
|
+
var a;
|
|
27
|
+
const t = (e == null ? void 0 : e.path) ?? "/";
|
|
28
|
+
if (t && (s.VARIABLES.test(t) || s.PATH.test(t))) {
|
|
29
|
+
const d = (((a = u == null ? void 0 : u.parameters) == null ? void 0 : a.path) ?? []).reduce((l, c) => (c.enabled && (l[c.key] = A(c.value, n)), l), {});
|
|
30
|
+
return A(A(t, n), d);
|
|
31
|
+
}
|
|
32
|
+
return t;
|
|
33
|
+
})(), f = V(i, n, v), y = [
|
|
34
|
+
...((u == null ? void 0 : u.parameters.headers) ?? []).map((t) => ({
|
|
35
|
+
...t,
|
|
36
|
+
value: s.VARIABLES.test(t.value) || s.PATH.test(t.value) ? A(t.value, n) : t.value
|
|
37
|
+
})) ?? [],
|
|
38
|
+
...Object.entries(f.headers).map(([t, a]) => ({
|
|
39
|
+
key: t,
|
|
40
|
+
value: a,
|
|
14
41
|
enabled: !0
|
|
15
42
|
}))
|
|
16
|
-
],
|
|
17
|
-
...(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
43
|
+
], S = [
|
|
44
|
+
...((u == null ? void 0 : u.parameters.cookies) ?? []).map((t) => ({
|
|
45
|
+
...t,
|
|
46
|
+
value: s.VARIABLES.test(t.value) || s.PATH.test(t.value) ? A(t.value, n) : t.value
|
|
47
|
+
})) ?? [],
|
|
48
|
+
...f.cookies.map((t) => ({
|
|
49
|
+
key: t.name,
|
|
50
|
+
value: t.value,
|
|
21
51
|
enabled: !0
|
|
22
52
|
}))
|
|
23
|
-
],
|
|
24
|
-
...(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
53
|
+
], h = [
|
|
54
|
+
...((u == null ? void 0 : u.parameters.query) ?? []).map((t) => ({
|
|
55
|
+
...t,
|
|
56
|
+
value: s.VARIABLES.test(t.value) || s.PATH.test(t.value) ? A(t.value, n) : t.value
|
|
57
|
+
})) ?? [],
|
|
58
|
+
...Array.from(f.urlParams.entries()).map(([t, a]) => ({
|
|
59
|
+
key: t,
|
|
60
|
+
value: a,
|
|
28
61
|
enabled: !0
|
|
29
62
|
}))
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
63
|
+
], H = (() => {
|
|
64
|
+
var a;
|
|
65
|
+
const t = u == null ? void 0 : u.body;
|
|
66
|
+
return (a = t == null ? void 0 : t.raw) != null && a.value && (s.VARIABLES.test(t.raw.value) || s.PATH.test(t.raw.value)) ? {
|
|
67
|
+
...t,
|
|
68
|
+
raw: {
|
|
69
|
+
...t.raw,
|
|
70
|
+
value: A(t.raw.value, n)
|
|
71
|
+
}
|
|
72
|
+
} : t;
|
|
73
|
+
})();
|
|
74
|
+
return L({
|
|
75
|
+
baseUrl: T,
|
|
76
|
+
method: (e == null ? void 0 : e.method) ?? "get",
|
|
77
|
+
path: P,
|
|
78
|
+
body: H,
|
|
79
|
+
cookies: S,
|
|
37
80
|
headers: y,
|
|
38
|
-
query:
|
|
81
|
+
query: h
|
|
39
82
|
});
|
|
40
83
|
};
|
|
41
84
|
export {
|
|
42
|
-
|
|
85
|
+
g as getHarRequest
|
|
43
86
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { ErrorResponse } from '../../../../libs/errors';
|
|
2
2
|
import type { Operation, RequestExample, SecurityScheme, Server } from '@scalar/oas-utils/entities/spec';
|
|
3
3
|
import { type ClientId, type TargetId } from '@scalar/snippetz';
|
|
4
|
+
import type { EnvVariables } from '../../../../libs/env-helpers';
|
|
4
5
|
/**
|
|
5
6
|
* Returns a code example for given operation
|
|
6
7
|
*/
|
|
7
|
-
export declare const getSnippet: <T extends TargetId>(target: T | "javascript", client: ClientId<T>, { operation, example, server, securitySchemes, }: {
|
|
8
|
+
export declare const getSnippet: <T extends TargetId>(target: T | "javascript", client: ClientId<T>, { operation, example, server, securitySchemes, environment, }: {
|
|
8
9
|
operation?: Operation | undefined;
|
|
9
10
|
example?: RequestExample | undefined;
|
|
10
11
|
server?: Server | undefined;
|
|
11
12
|
securitySchemes?: SecurityScheme[];
|
|
13
|
+
environment?: EnvVariables | undefined;
|
|
12
14
|
}) => ErrorResponse<string>;
|
|
13
15
|
//# sourceMappingURL=get-snippet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/views/Components/CodeSnippet/helpers/get-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxG,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAY,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"get-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/views/Components/CodeSnippet/helpers/get-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxG,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAY,MAAM,kBAAkB,CAAA;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAOtD;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,QAAQ,UACnC,CAAC,GAAG,YAAY,UAChB,QAAQ,CAAC,CAAC,CAAC,iEAOhB;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,KACA,aAAa,CAAC,MAAM,CAkDtB,CAAA"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { snippetz as a } from "@scalar/snippetz";
|
|
2
|
-
import { getHarRequest as
|
|
3
|
-
const s = "ws://replace.me",
|
|
2
|
+
import { getHarRequest as d } from "./get-har-request.js";
|
|
3
|
+
const s = "ws://replace.me", f = (i, t, {
|
|
4
4
|
operation: l,
|
|
5
5
|
example: u,
|
|
6
6
|
server: c,
|
|
7
|
-
securitySchemes: g = []
|
|
7
|
+
securitySchemes: g = [],
|
|
8
|
+
environment: E
|
|
8
9
|
}) => {
|
|
9
10
|
var n;
|
|
10
11
|
try {
|
|
11
|
-
const r =
|
|
12
|
+
const r = d({
|
|
12
13
|
operation: l,
|
|
13
14
|
example: u,
|
|
14
15
|
server: c,
|
|
15
|
-
securitySchemes: g
|
|
16
|
+
securitySchemes: g,
|
|
17
|
+
environment: E
|
|
16
18
|
});
|
|
17
19
|
if (!r.url)
|
|
18
20
|
return [new Error("Please enter a URL to see a code snippet"), null];
|
|
@@ -39,5 +41,5 @@ const s = "ws://replace.me", S = (i, t, {
|
|
|
39
41
|
return [new Error("No snippet found"), null];
|
|
40
42
|
};
|
|
41
43
|
export {
|
|
42
|
-
|
|
44
|
+
f as getSnippet
|
|
43
45
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Collection, Operation, RequestExample, Server } from '@scalar/oas-utils/entities/spec';
|
|
2
2
|
import type { Workspace } from '@scalar/oas-utils/entities/workspace';
|
|
3
|
+
import type { EnvVariables } from '../../../libs/env-helpers';
|
|
3
4
|
type __VLS_Props = {
|
|
4
5
|
collection: Collection;
|
|
5
6
|
example: RequestExample;
|
|
6
7
|
operation: Operation;
|
|
7
8
|
server: Server | undefined;
|
|
8
9
|
workspace: Workspace;
|
|
10
|
+
environment: EnvVariables;
|
|
9
11
|
};
|
|
10
12
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
11
13
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestCodeExample.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestCodeExample.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestCodeExample.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestCodeExample.vue"],"names":[],"mappings":"AA8RA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,cAAc,EAEd,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAOrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAMtD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;IACpB,WAAW,EAAE,YAAY,CAAA;CAC1B,CAAC;;AA6WF,wBAOG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./RequestCodeExample.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const r = /* @__PURE__ */
|
|
3
|
+
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-01b51127"]]);
|
|
5
5
|
export {
|
|
6
6
|
r as default
|
|
7
7
|
};
|
|
@@ -1,70 +1,64 @@
|
|
|
1
|
-
import { defineComponent as H, computed as a, ref as U, createElementBlock as j, openBlock as
|
|
2
|
-
import { ScalarCodeBlock as
|
|
3
|
-
import { snippetz as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { defineComponent as H, computed as a, ref as U, createElementBlock as j, openBlock as y, createVNode as i, withCtx as c, createElementVNode as x, createBlock as C, unref as r, toDisplayString as D, createTextVNode as N } from "vue";
|
|
2
|
+
import { ScalarCodeBlock as T, ScalarCombobox as W, ScalarButton as z, ScalarIcon as I } from "@scalar/components";
|
|
3
|
+
import { snippetz as O } from "@scalar/snippetz";
|
|
4
|
+
import R from "../../../components/DataTable/DataTable.vue.js";
|
|
5
|
+
import q from "../../../components/DataTable/DataTableRow.vue.js";
|
|
6
6
|
import M from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
|
|
7
|
-
import
|
|
8
|
-
import A from "
|
|
9
|
-
|
|
10
|
-
const G = { class: "w-full" }, J = { class: "-mx-1 flex flex-1" }, L = { class: "bg-b-1 flex items-center justify-center overflow-hidden border-t" }, ne = /* @__PURE__ */ H({
|
|
7
|
+
import P from "../../Components/CodeSnippet/CodeSnippet.vue.js";
|
|
8
|
+
import { useWorkspace as A } from "../../../store/store.js";
|
|
9
|
+
const F = { class: "w-full" }, G = { class: "-mx-1 flex flex-1" }, J = { class: "bg-b-1 flex items-center justify-center overflow-hidden border-t" }, le = /* @__PURE__ */ H({
|
|
11
10
|
__name: "RequestCodeExample",
|
|
12
11
|
props: {
|
|
13
12
|
collection: {},
|
|
14
13
|
example: {},
|
|
15
14
|
operation: {},
|
|
16
15
|
server: {},
|
|
17
|
-
workspace: {}
|
|
16
|
+
workspace: {},
|
|
17
|
+
environment: {}
|
|
18
18
|
},
|
|
19
|
-
setup(
|
|
20
|
-
var b, K,
|
|
21
|
-
const { securitySchemes: k, workspaceMutators: w } =
|
|
19
|
+
setup(o) {
|
|
20
|
+
var b, K, h, S;
|
|
21
|
+
const { securitySchemes: k, workspaceMutators: w } = A(), f = a(() => {
|
|
22
22
|
var t, e, l;
|
|
23
23
|
return d.value.targetKey === "custom" && ((t = u.value) == null ? void 0 : t.some(
|
|
24
|
-
(
|
|
24
|
+
(n) => n.lang === d.value.clientKey
|
|
25
25
|
)) ? d.value : {
|
|
26
|
-
targetKey: ((e =
|
|
27
|
-
clientKey: ((l =
|
|
26
|
+
targetKey: ((e = o.workspace.selectedHttpClient) == null ? void 0 : e.targetKey) ?? "js",
|
|
27
|
+
clientKey: ((l = o.workspace.selectedHttpClient) == null ? void 0 : l.clientKey) ?? "fetch"
|
|
28
28
|
};
|
|
29
29
|
}), u = a(
|
|
30
|
-
() =>
|
|
30
|
+
() => o.operation["x-codeSamples"] || o.operation["x-code-samples"] || o.operation["x-custom-examples"]
|
|
31
31
|
), d = U(
|
|
32
32
|
(b = u.value) != null && b.length ? {
|
|
33
33
|
targetKey: "custom",
|
|
34
34
|
clientKey: (K = u.value[0]) == null ? void 0 : K.lang
|
|
35
35
|
} : {
|
|
36
|
-
targetKey: ((
|
|
37
|
-
clientKey: ((
|
|
36
|
+
targetKey: ((h = o.workspace.selectedHttpClient) == null ? void 0 : h.targetKey) ?? "js",
|
|
37
|
+
clientKey: ((S = o.workspace.selectedHttpClient) == null ? void 0 : S.clientKey) ?? "fetch"
|
|
38
38
|
}
|
|
39
|
-
), $ = a(
|
|
40
|
-
() =>
|
|
41
|
-
|
|
42
|
-
n.
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
), y = a(() => {
|
|
46
|
-
const t = {}, e = z().clients().map((o) => ({
|
|
47
|
-
label: o.title,
|
|
48
|
-
options: o.clients.map((p) => (t[`${o.key},${p.client}`] = p.title, {
|
|
49
|
-
id: `${o.key},${p.client}`,
|
|
39
|
+
), $ = a(() => (o.operation.selectedSecuritySchemeUids || o.collection.selectedSecuritySchemeUids || []).flat().map((e) => k[e]).filter((e) => !!e)), v = a(() => {
|
|
40
|
+
const t = {}, e = O().clients().map((n) => ({
|
|
41
|
+
label: n.title,
|
|
42
|
+
options: n.clients.map((p) => (t[`${n.key},${p.client}`] = p.title, {
|
|
43
|
+
id: `${n.key},${p.client}`,
|
|
50
44
|
label: p.title
|
|
51
45
|
}))
|
|
52
|
-
})), l = (
|
|
53
|
-
id: `custom,${
|
|
54
|
-
label:
|
|
46
|
+
})), l = (o.operation["x-codeSamples"] || o.operation["x-code-samples"] || o.operation["x-custom-examples"] || []).map((n) => ({
|
|
47
|
+
id: `custom,${n.lang}`,
|
|
48
|
+
label: n.label || n.lang
|
|
55
49
|
})), m = l.length > 0 ? [
|
|
56
50
|
{
|
|
57
51
|
id: "customExamples",
|
|
58
52
|
label: "Code Examples",
|
|
59
|
-
options: l.map((
|
|
60
|
-
id:
|
|
61
|
-
label:
|
|
53
|
+
options: l.map((n) => ({
|
|
54
|
+
id: n.id,
|
|
55
|
+
label: n.label ?? n.id
|
|
62
56
|
}))
|
|
63
57
|
},
|
|
64
58
|
...e
|
|
65
59
|
] : e;
|
|
66
|
-
return l.forEach((
|
|
67
|
-
t[
|
|
60
|
+
return l.forEach((n) => {
|
|
61
|
+
t[n.id] = n.label ?? n.id;
|
|
68
62
|
}), {
|
|
69
63
|
options: m,
|
|
70
64
|
dict: t
|
|
@@ -75,24 +69,24 @@ const G = { class: "w-full" }, J = { class: "-mx-1 flex flex-1" }, L = { class:
|
|
|
75
69
|
const l = `custom,${t.clientKey}`;
|
|
76
70
|
return {
|
|
77
71
|
id: l,
|
|
78
|
-
label:
|
|
72
|
+
label: v.value.dict[l] ?? "Unknown"
|
|
79
73
|
};
|
|
80
74
|
}
|
|
81
75
|
const e = `${t.targetKey},${t.clientKey}`;
|
|
82
76
|
return {
|
|
83
77
|
id: e,
|
|
84
|
-
label:
|
|
78
|
+
label: v.value.dict[e] ?? "Unknown"
|
|
85
79
|
};
|
|
86
80
|
}), E = a(
|
|
87
81
|
() => f.value.targetKey
|
|
88
|
-
),
|
|
82
|
+
), B = a(
|
|
89
83
|
() => f.value.clientKey
|
|
90
|
-
),
|
|
84
|
+
), V = ({ id: t }) => {
|
|
91
85
|
const [e, l] = t.split(",");
|
|
92
86
|
!e || !l || (d.value = {
|
|
93
87
|
targetKey: e,
|
|
94
88
|
clientKey: l
|
|
95
|
-
}, e !== "custom" && w.edit(
|
|
89
|
+
}, e !== "custom" && w.edit(o.workspace.uid, "selectedHttpClient", {
|
|
96
90
|
targetKey: e,
|
|
97
91
|
clientKey: l
|
|
98
92
|
}));
|
|
@@ -103,7 +97,7 @@ const G = { class: "w-full" }, J = { class: "-mx-1 flex flex-1" }, L = { class:
|
|
|
103
97
|
const t = s.value.id.split(",")[1], e = (l = u.value) == null ? void 0 : l.find((m) => m.lang === t);
|
|
104
98
|
return e == null ? void 0 : e.source;
|
|
105
99
|
});
|
|
106
|
-
return (t, e) => (
|
|
100
|
+
return (t, e) => (y(), j("div", F, [
|
|
107
101
|
i(M, {
|
|
108
102
|
class: "group/preview w-full border-b-0",
|
|
109
103
|
defaultOpen: !1
|
|
@@ -112,15 +106,15 @@ const G = { class: "w-full" }, J = { class: "-mx-1 flex flex-1" }, L = { class:
|
|
|
112
106
|
N("Code Snippet")
|
|
113
107
|
])),
|
|
114
108
|
actions: c(() => [
|
|
115
|
-
x("div",
|
|
116
|
-
i(r(
|
|
109
|
+
x("div", G, [
|
|
110
|
+
i(r(W), {
|
|
117
111
|
modelValue: s.value,
|
|
118
|
-
options:
|
|
112
|
+
options: v.value.options,
|
|
119
113
|
placement: "bottom-end",
|
|
120
|
-
"onUpdate:modelValue":
|
|
114
|
+
"onUpdate:modelValue": V
|
|
121
115
|
}, {
|
|
122
116
|
default: c(() => [
|
|
123
|
-
i(r(
|
|
117
|
+
i(r(z), {
|
|
124
118
|
class: "text-c-1 hover:bg-b-3 py-0.75 flex h-full w-fit gap-1.5 px-1.5 font-normal",
|
|
125
119
|
fullWidth: "",
|
|
126
120
|
variant: "ghost"
|
|
@@ -129,7 +123,7 @@ const G = { class: "w-full" }, J = { class: "-mx-1 flex flex-1" }, L = { class:
|
|
|
129
123
|
var l;
|
|
130
124
|
return [
|
|
131
125
|
x("span", null, D((l = s.value) == null ? void 0 : l.label), 1),
|
|
132
|
-
i(r(
|
|
126
|
+
i(r(I), {
|
|
133
127
|
icon: "ChevronDown",
|
|
134
128
|
size: "md"
|
|
135
129
|
})
|
|
@@ -143,29 +137,30 @@ const G = { class: "w-full" }, J = { class: "-mx-1 flex flex-1" }, L = { class:
|
|
|
143
137
|
])
|
|
144
138
|
]),
|
|
145
139
|
default: c(() => [
|
|
146
|
-
i(
|
|
140
|
+
i(R, {
|
|
147
141
|
columns: [""],
|
|
148
142
|
presentational: ""
|
|
149
143
|
}, {
|
|
150
144
|
default: c(() => [
|
|
151
|
-
i(
|
|
145
|
+
i(q, null, {
|
|
152
146
|
default: c(() => [
|
|
153
|
-
x("div",
|
|
154
|
-
g.value ? (
|
|
147
|
+
x("div", J, [
|
|
148
|
+
g.value ? (y(), C(r(T), {
|
|
155
149
|
key: 0,
|
|
156
150
|
class: "px-3 py-1.5",
|
|
157
151
|
content: g.value,
|
|
158
152
|
lang: s.value.id.split(",")[1] ?? "plaintext"
|
|
159
|
-
}, null, 8, ["content", "lang"])) : (
|
|
153
|
+
}, null, 8, ["content", "lang"])) : (y(), C(r(P), {
|
|
160
154
|
key: 1,
|
|
161
155
|
class: "px-3 py-1.5",
|
|
162
|
-
client:
|
|
156
|
+
client: B.value,
|
|
163
157
|
example: t.example,
|
|
164
158
|
operation: t.operation,
|
|
165
159
|
securitySchemes: $.value,
|
|
166
160
|
server: t.server,
|
|
167
|
-
target: E.value
|
|
168
|
-
|
|
161
|
+
target: E.value,
|
|
162
|
+
environment: t.environment
|
|
163
|
+
}, null, 8, ["client", "example", "operation", "securitySchemes", "server", "target", "environment"]))
|
|
169
164
|
])
|
|
170
165
|
]),
|
|
171
166
|
_: 1
|
|
@@ -180,5 +175,5 @@ const G = { class: "w-full" }, J = { class: "-mx-1 flex flex-1" }, L = { class:
|
|
|
180
175
|
}
|
|
181
176
|
});
|
|
182
177
|
export {
|
|
183
|
-
|
|
178
|
+
le as default
|
|
184
179
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestSection.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestSection.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestSection.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestSection.vue"],"names":[],"mappings":"AAiUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AASrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAU1D,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,OAAO,EAAE,cAAc,CAAA;IACvB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;IACpB,0BAA0B,EAAE,0BAA0B,CAAA;IACtD,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;;AAoVF,wBAOG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "./RequestSection.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const p = /* @__PURE__ */ o
|
|
3
|
+
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-83e16b0b"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|