@scalar/api-client 2.6.0 → 2.7.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 +55 -0
- package/dist/analytics.d.ts +2 -18
- package/dist/analytics.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +66 -42
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
- package/dist/hooks/useAnalytics.d.ts +2 -18
- package/dist/hooks/useAnalytics.d.ts.map +1 -1
- package/dist/hooks/useClientConfig.d.ts +115 -112
- package/dist/hooks/useClientConfig.d.ts.map +1 -1
- package/dist/layouts/App/create-api-client-app.d.ts +1378 -1306
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/Modal/create-api-client-modal.d.ts +2752 -2608
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Web/create-api-client-web.d.ts +1378 -1306
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/libs/create-client.d.ts +1378 -1306
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/find-request.d.ts +17 -17
- package/dist/libs/find-request.d.ts.map +1 -1
- package/dist/libs/hot-keys.d.ts +1 -1
- package/dist/libs/local-storage.d.ts.map +1 -1
- package/dist/libs/send-request/build-request-security.d.ts +1 -1
- package/dist/libs/send-request/create-fetch-body.d.ts +1 -1
- package/dist/libs/send-request/create-request-operation.test.d.ts +82 -82
- package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +1 -1
- package/dist/store/active-entities.d.ts +118 -118
- package/dist/store/active-entities.d.ts.map +1 -1
- package/dist/store/collections.d.ts +127 -127
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/cookies.d.ts +14 -14
- package/dist/store/environment.d.ts +23 -23
- package/dist/store/request-example.d.ts +546 -546
- package/dist/store/request-example.d.ts.map +1 -1
- package/dist/store/requests.d.ts +194 -194
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/security-schemes.d.ts +281 -281
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/servers.d.ts +45 -45
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/store.d.ts +1378 -1306
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +18 -18
- package/dist/store/tags.d.ts +35 -35
- package/dist/store/tags.d.ts.map +1 -1
- package/dist/store/workspace.d.ts +47 -47
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.test.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.test.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.d.ts +25 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.js +30 -0
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue2.js +4 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +3 -3
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +102 -95
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.js +16 -14
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +31 -2
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +6 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +198 -131
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.bench.d.ts +2 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.bench.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/index.d.ts +4 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/index.js +10 -4
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -6
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +54 -54
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +54 -54
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/RequestHeaders.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +1 -1
- package/dist/views/Request/libs/auth.d.ts +2 -2
- package/dist/views/Request/libs/watch-mode.d.ts +4 -4
- package/dist/views/Request/libs/watch-mode.d.ts.map +1 -1
- package/dist/views/Request/libs/watch-mode.js +241 -186
- package/package.json +25 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpMethod.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/HttpMethod.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
+
import { type Component } from 'vue';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** The type of element to render as, defaults to `span` */
|
|
5
|
+
as?: Component | string;
|
|
6
|
+
/** The css style property or variable that will be set to the request method color, defaults to `color` */
|
|
7
|
+
property?: string;
|
|
8
|
+
/** Whether or not to abbreviated the slot content */
|
|
9
|
+
short?: boolean;
|
|
10
|
+
/** The HTTP method to show */
|
|
11
|
+
method: HttpMethod | string;
|
|
12
|
+
};
|
|
13
|
+
declare var __VLS_6: {};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_6) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_component: 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>;
|
|
18
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=HttpMethod.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpMethod.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/HttpMethod.vue"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,KAAK,CAAA;AAE9C,KAAK,WAAW,GAAG;IACjB,2DAA2D;IAC3D,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IACvB,2GAA2G;IAC3G,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,8BAA8B;IAC9B,MAAM,EAAE,UAAU,GAAG,MAAM,CAAA;CAC5B,CAAC;AAqCF,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAqB/C,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineComponent as a, computed as r, createBlock as s, openBlock as l, resolveDynamicComponent as m, normalizeStyle as d, withCtx as c, renderSlot as h, createTextVNode as i, toDisplayString as u } from "vue";
|
|
2
|
+
import { getHttpMethodInfo as f } from "@scalar/helpers/http/http-info";
|
|
3
|
+
import { normalizeHttpMethod as y } from "@scalar/helpers/http/normalize-http-method";
|
|
4
|
+
const z = /* @__PURE__ */ a({
|
|
5
|
+
__name: "HttpMethod",
|
|
6
|
+
props: {
|
|
7
|
+
as: {},
|
|
8
|
+
property: {},
|
|
9
|
+
short: { type: Boolean },
|
|
10
|
+
method: {}
|
|
11
|
+
},
|
|
12
|
+
setup(p) {
|
|
13
|
+
const t = p, e = r(
|
|
14
|
+
() => f(String(t.method || ""))
|
|
15
|
+
), n = r(() => y(t.method));
|
|
16
|
+
return (o, v) => (l(), s(m(o.as ?? "span"), {
|
|
17
|
+
class: "uppercase",
|
|
18
|
+
style: d({ [o.property || "color"]: e.value.colorVar })
|
|
19
|
+
}, {
|
|
20
|
+
default: c(() => [
|
|
21
|
+
h(o.$slots, "default"),
|
|
22
|
+
i(" " + u(o.short ? e.value.short : n.value), 1)
|
|
23
|
+
]),
|
|
24
|
+
_: 3
|
|
25
|
+
}, 8, ["style"]));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
z as default
|
|
30
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"AA+eA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,kBAAkB,CAAA;AAGvE,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AASrE,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,yCAAyC,CAAA;AAKhD,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,eAAe,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;GAQG;;YAkBO,MAAM,OAAO;YACb,MAAM,OAAO;;AAlBvB,wBAmkBC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./OperationCodeSample.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import t from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-585ef96b"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarCard as
|
|
3
|
-
import { freezeElement as
|
|
4
|
-
import { ScalarIconCaretDown as
|
|
5
|
-
import { emitCustomEvent as
|
|
6
|
-
import { getResolvedRef as
|
|
7
|
-
import { operationToHar as
|
|
8
|
-
import
|
|
1
|
+
import { defineComponent as D, computed as n, ref as k, watch as R, useId as N, createBlock as i, createCommentVNode as f, openBlock as r, unref as o, withCtx as s, createVNode as u, createSlots as z, createElementVNode as y, createElementBlock as S, renderSlot as b, toDisplayString as K } from "vue";
|
|
2
|
+
import { ScalarCard as T, ScalarCardHeader as M, ScalarCombobox as U, ScalarButton as A, ScalarCardSection as q, ScalarCodeBlock as F, ScalarVirtualText as Z, ScalarCardFooter as G } from "@scalar/components";
|
|
3
|
+
import { freezeElement as J } from "@scalar/helpers/dom/freeze-element";
|
|
4
|
+
import { ScalarIconCaretDown as P } from "@scalar/icons";
|
|
5
|
+
import { emitCustomEvent as E } from "@scalar/workspace-store/events";
|
|
6
|
+
import { getResolvedRef as Q } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
7
|
+
import { operationToHar as X } from "../helpers/operation-to-har/operation-to-har.js";
|
|
8
|
+
import V from "./HttpMethod.vue.js";
|
|
9
|
+
import { findClient as O } from "../helpers/find-client.js";
|
|
9
10
|
import { generateCustomId as $ } from "../helpers/generate-client-options.js";
|
|
10
|
-
import { generateCodeSnippet as
|
|
11
|
-
import { getSecrets as
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
const Z = ["innerHTML"], _ = { class: "text-base font-normal" }, ee = ["id"], te = {
|
|
11
|
+
import { generateCodeSnippet as Y } from "../helpers/generate-code-snippet.js";
|
|
12
|
+
import { getSecrets as _ } from "../helpers/get-secrets.js";
|
|
13
|
+
import ee from "./ExamplePicker.vue.js";
|
|
14
|
+
const te = ["innerHTML"], le = { class: "text-base font-normal" }, oe = ["id"], ae = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "request-card-footer-addon"
|
|
17
|
-
},
|
|
18
|
-
...
|
|
17
|
+
}, ne = { class: "request-header" }, se = {}, ge = /* @__PURE__ */ D({
|
|
18
|
+
...se,
|
|
19
19
|
__name: "OperationCodeSample",
|
|
20
20
|
props: {
|
|
21
21
|
clientOptions: {},
|
|
@@ -32,16 +32,16 @@ const Z = ["innerHTML"], _ = { class: "text-base font-normal" }, ee = ["id"], te
|
|
|
32
32
|
isWebhook: { type: Boolean }
|
|
33
33
|
},
|
|
34
34
|
setup(l) {
|
|
35
|
-
const
|
|
36
|
-
const e =
|
|
35
|
+
const d = n(() => {
|
|
36
|
+
const e = Q(l.operation.requestBody)?.content ?? {}, t = l.selectedContentType || Object.keys(e)[0];
|
|
37
37
|
return t ? e[t]?.examples ?? {} : {};
|
|
38
|
-
}),
|
|
39
|
-
l.selectedExample ?? Object.keys(
|
|
40
|
-
), C =
|
|
38
|
+
}), p = k(
|
|
39
|
+
l.selectedExample ?? Object.keys(d.value)[0] ?? ""
|
|
40
|
+
), C = n(() => [
|
|
41
41
|
"x-custom-examples",
|
|
42
42
|
"x-codeSamples",
|
|
43
43
|
"x-code-samples"
|
|
44
|
-
].flatMap((t) => l.operation[t] ?? [])),
|
|
44
|
+
].flatMap((t) => l.operation[t] ?? [])), h = n(() => C.value.length ? [
|
|
45
45
|
{
|
|
46
46
|
label: "Code Examples",
|
|
47
47
|
options: C.value.map((t) => {
|
|
@@ -55,34 +55,34 @@ const Z = ["innerHTML"], _ = { class: "text-base font-normal" }, ee = ["id"], te
|
|
|
55
55
|
})
|
|
56
56
|
},
|
|
57
57
|
...l.clientOptions
|
|
58
|
-
] : l.clientOptions),
|
|
59
|
-
|
|
58
|
+
] : l.clientOptions), c = k(
|
|
59
|
+
O(h.value, l.selectedClient)
|
|
60
60
|
);
|
|
61
|
-
|
|
61
|
+
R(
|
|
62
62
|
() => l.selectedClient,
|
|
63
63
|
(e) => {
|
|
64
|
-
const t =
|
|
65
|
-
t && (
|
|
64
|
+
const t = O(h.value, e);
|
|
65
|
+
t && (c.value = t);
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
|
-
const
|
|
68
|
+
const g = n(() => {
|
|
69
69
|
if (!l.isWebhook) return null;
|
|
70
70
|
try {
|
|
71
|
-
return
|
|
71
|
+
return X({
|
|
72
72
|
operation: l.operation,
|
|
73
73
|
method: l.method,
|
|
74
74
|
path: l.path,
|
|
75
|
-
example:
|
|
75
|
+
example: p.value
|
|
76
76
|
});
|
|
77
77
|
} catch (e) {
|
|
78
78
|
return console.error("[webhookHar]", e), null;
|
|
79
79
|
}
|
|
80
|
-
}),
|
|
80
|
+
}), v = n(() => {
|
|
81
81
|
try {
|
|
82
|
-
const e =
|
|
82
|
+
const e = c.value?.id;
|
|
83
83
|
return e ? e.startsWith("custom") ? C.value.find(
|
|
84
|
-
(t) => $(t) ===
|
|
85
|
-
)?.source ?? "Custom example not found" : l.isWebhook ?
|
|
84
|
+
(t) => $(t) === c.value?.id
|
|
85
|
+
)?.source ?? "Custom example not found" : l.isWebhook ? g.value?.postData?.text ?? "" : Y({
|
|
86
86
|
clientId: e,
|
|
87
87
|
operation: l.operation,
|
|
88
88
|
method: l.method,
|
|
@@ -90,68 +90,68 @@ const Z = ["innerHTML"], _ = { class: "text-base font-normal" }, ee = ["id"], te
|
|
|
90
90
|
securitySchemes: l.securitySchemes,
|
|
91
91
|
contentType: l.selectedContentType,
|
|
92
92
|
path: l.path,
|
|
93
|
-
example:
|
|
93
|
+
example: p.value
|
|
94
94
|
}) : "";
|
|
95
95
|
} catch (e) {
|
|
96
96
|
return console.error("[generateSnippet]", e), "";
|
|
97
97
|
}
|
|
98
|
-
}),
|
|
99
|
-
if (!
|
|
100
|
-
const e =
|
|
98
|
+
}), B = n(() => l.isWebhook ? j.value : c.value?.lang), j = n(() => {
|
|
99
|
+
if (!g.value?.postData) return "json";
|
|
100
|
+
const e = g.value.postData.mimeType;
|
|
101
101
|
return e?.includes("json") ? "json" : e?.includes("xml") ? "xml" : e?.includes("yaml") || e?.includes("yml") ? "yaml" : e?.includes("text/plain") ? "text" : "json";
|
|
102
|
-
}), w =
|
|
103
|
-
if (
|
|
104
|
-
const t =
|
|
102
|
+
}), w = n(() => _(l.securitySchemes)), m = k(null), H = (e) => {
|
|
103
|
+
if (m.value) {
|
|
104
|
+
const t = J(m.value.$el);
|
|
105
105
|
setTimeout(() => {
|
|
106
106
|
t();
|
|
107
107
|
}, 300);
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
},
|
|
111
|
-
return (e, t) =>
|
|
109
|
+
c.value = e, e.id.startsWith("custom") || E(m.value?.$el, "scalar-update-selected-client", e.id);
|
|
110
|
+
}, L = 3e4, W = n(() => (v.value.length ?? 0) > L), I = N();
|
|
111
|
+
return (e, t) => v.value ? (r(), i(o(T), {
|
|
112
112
|
key: 0,
|
|
113
113
|
ref_key: "elem",
|
|
114
|
-
ref:
|
|
114
|
+
ref: m,
|
|
115
115
|
class: "request-card dark-mode"
|
|
116
116
|
}, {
|
|
117
|
-
default:
|
|
118
|
-
|
|
119
|
-
default:
|
|
120
|
-
t[3] || (t[3] =
|
|
121
|
-
|
|
117
|
+
default: s(() => [
|
|
118
|
+
u(o(M), { class: "pr-2.5" }, z({
|
|
119
|
+
default: s(() => [
|
|
120
|
+
t[3] || (t[3] = y("span", { class: "sr-only" }, "Request Example for", -1)),
|
|
121
|
+
u(V, {
|
|
122
122
|
as: "span",
|
|
123
123
|
class: "request-method",
|
|
124
124
|
method: e.method
|
|
125
125
|
}, null, 8, ["method"]),
|
|
126
|
-
e.generateLabel ? (
|
|
126
|
+
e.generateLabel ? (r(), S("span", {
|
|
127
127
|
key: 0,
|
|
128
128
|
innerHTML: e.generateLabel()
|
|
129
|
-
}, null, 8,
|
|
130
|
-
|
|
129
|
+
}, null, 8, te)) : f("", !0),
|
|
130
|
+
b(e.$slots, "header", {}, void 0, !0)
|
|
131
131
|
]),
|
|
132
132
|
_: 2
|
|
133
133
|
}, [
|
|
134
|
-
!e.isWebhook &&
|
|
134
|
+
!e.isWebhook && h.value.length ? {
|
|
135
135
|
name: "actions",
|
|
136
|
-
fn:
|
|
137
|
-
|
|
136
|
+
fn: s(() => [
|
|
137
|
+
u(o(U), {
|
|
138
138
|
class: "max-h-80",
|
|
139
|
-
modelValue:
|
|
140
|
-
options:
|
|
139
|
+
modelValue: c.value,
|
|
140
|
+
options: h.value,
|
|
141
141
|
placement: "bottom-end",
|
|
142
142
|
teleport: "",
|
|
143
|
-
"onUpdate:modelValue": t[0] || (t[0] = (a) =>
|
|
143
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => H(a))
|
|
144
144
|
}, {
|
|
145
|
-
default:
|
|
146
|
-
|
|
145
|
+
default: s(() => [
|
|
146
|
+
u(o(A), {
|
|
147
147
|
class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5",
|
|
148
148
|
"data-testid": "client-picker",
|
|
149
149
|
fullWidth: "",
|
|
150
150
|
variant: "ghost"
|
|
151
151
|
}, {
|
|
152
|
-
default:
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
default: s(() => [
|
|
153
|
+
y("span", le, K(c.value?.title), 1),
|
|
154
|
+
u(o(P), {
|
|
155
155
|
class: "ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
|
|
156
156
|
weight: "bold"
|
|
157
157
|
})
|
|
@@ -165,73 +165,80 @@ const Z = ["innerHTML"], _ = { class: "text-base font-normal" }, ee = ["id"], te
|
|
|
165
165
|
key: "0"
|
|
166
166
|
} : void 0
|
|
167
167
|
]), 1024),
|
|
168
|
-
|
|
169
|
-
default:
|
|
170
|
-
|
|
171
|
-
id: `${o(
|
|
168
|
+
u(o(q), { class: "request-editor-section custom-scroll p-0" }, {
|
|
169
|
+
default: s(() => [
|
|
170
|
+
y("div", {
|
|
171
|
+
id: `${o(I)}-example`,
|
|
172
172
|
class: "code-snippet"
|
|
173
173
|
}, [
|
|
174
|
-
|
|
174
|
+
W.value ? (r(), i(o(Z), {
|
|
175
|
+
key: 1,
|
|
176
|
+
containerClass: "custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen",
|
|
177
|
+
contentClass: "language-plaintext whitespace-pre font-code text-base",
|
|
178
|
+
lineHeight: 20,
|
|
179
|
+
text: v.value
|
|
180
|
+
}, null, 8, ["text"])) : (r(), i(o(F), {
|
|
181
|
+
key: 0,
|
|
175
182
|
class: "bg-b-2 !min-h-full -outline-offset-2",
|
|
176
|
-
content:
|
|
183
|
+
content: v.value,
|
|
177
184
|
hideCredentials: w.value,
|
|
178
|
-
lang:
|
|
185
|
+
lang: B.value,
|
|
179
186
|
lineNumbers: ""
|
|
180
|
-
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
181
|
-
], 8,
|
|
187
|
+
}, null, 8, ["content", "hideCredentials", "lang"]))
|
|
188
|
+
], 8, oe)
|
|
182
189
|
]),
|
|
183
190
|
_: 1
|
|
184
191
|
}),
|
|
185
|
-
Object.keys(
|
|
192
|
+
Object.keys(d.value).length > 1 || e.$slots.footer ? (r(), i(o(G), {
|
|
186
193
|
key: 0,
|
|
187
194
|
class: "request-card-footer bg-b-3"
|
|
188
195
|
}, {
|
|
189
|
-
default:
|
|
190
|
-
Object.keys(
|
|
191
|
-
Object.keys(
|
|
196
|
+
default: s(() => [
|
|
197
|
+
Object.keys(d.value).length > 1 ? (r(), S("div", ae, [
|
|
198
|
+
Object.keys(d.value).length ? (r(), i(ee, {
|
|
192
199
|
key: 0,
|
|
193
|
-
modelValue:
|
|
200
|
+
modelValue: p.value,
|
|
194
201
|
"onUpdate:modelValue": [
|
|
195
|
-
t[1] || (t[1] = (a) =>
|
|
196
|
-
t[2] || (t[2] = (a) => o(
|
|
197
|
-
|
|
202
|
+
t[1] || (t[1] = (a) => p.value = a),
|
|
203
|
+
t[2] || (t[2] = (a) => o(E)(
|
|
204
|
+
m.value?.$el,
|
|
198
205
|
"scalar-update-selected-example",
|
|
199
206
|
a
|
|
200
207
|
))
|
|
201
208
|
],
|
|
202
|
-
examples:
|
|
203
|
-
}, null, 8, ["modelValue", "examples"])) :
|
|
204
|
-
])) :
|
|
205
|
-
|
|
209
|
+
examples: d.value
|
|
210
|
+
}, null, 8, ["modelValue", "examples"])) : f("", !0)
|
|
211
|
+
])) : f("", !0),
|
|
212
|
+
b(e.$slots, "footer", {}, void 0, !0)
|
|
206
213
|
]),
|
|
207
214
|
_: 3
|
|
208
|
-
})) :
|
|
215
|
+
})) : f("", !0)
|
|
209
216
|
]),
|
|
210
217
|
_: 3
|
|
211
|
-
}, 512)) : e.fallback ? (
|
|
218
|
+
}, 512)) : e.fallback ? (r(), i(o(T), {
|
|
212
219
|
key: 1,
|
|
213
220
|
class: "request-card dark-mode"
|
|
214
221
|
}, {
|
|
215
|
-
default:
|
|
216
|
-
|
|
217
|
-
default:
|
|
218
|
-
|
|
219
|
-
|
|
222
|
+
default: s(() => [
|
|
223
|
+
u(o(q), { class: "request-card-simple" }, {
|
|
224
|
+
default: s(() => [
|
|
225
|
+
y("div", ne, [
|
|
226
|
+
u(V, {
|
|
220
227
|
as: "span",
|
|
221
228
|
class: "request-method",
|
|
222
229
|
method: e.method
|
|
223
230
|
}, null, 8, ["method"]),
|
|
224
|
-
|
|
231
|
+
b(e.$slots, "header", {}, void 0, !0)
|
|
225
232
|
]),
|
|
226
|
-
|
|
233
|
+
b(e.$slots, "footer", {}, void 0, !0)
|
|
227
234
|
]),
|
|
228
235
|
_: 3
|
|
229
236
|
})
|
|
230
237
|
]),
|
|
231
238
|
_: 3
|
|
232
|
-
})) :
|
|
239
|
+
})) : f("", !0);
|
|
233
240
|
}
|
|
234
241
|
});
|
|
235
242
|
export {
|
|
236
|
-
|
|
243
|
+
ge as default
|
|
237
244
|
};
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { AVAILABLE_CLIENTS as f } from "@scalar/snippetz";
|
|
2
|
+
const c = "shell/curl", d = (o) => f.includes(o), u = (o, s) => {
|
|
3
|
+
const r = o[0]?.options[0];
|
|
3
4
|
if (s)
|
|
4
|
-
for (const
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
return
|
|
5
|
+
for (const i of o) {
|
|
6
|
+
const t = i.options.find((n) => n.id === s);
|
|
7
|
+
if (t)
|
|
8
|
+
return t;
|
|
8
9
|
}
|
|
9
|
-
if (!
|
|
10
|
-
for (const
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
return
|
|
10
|
+
if (!r?.id.startsWith("custom"))
|
|
11
|
+
for (const i of o) {
|
|
12
|
+
const t = i.options.find((n) => n.id === c);
|
|
13
|
+
if (t)
|
|
14
|
+
return t;
|
|
14
15
|
}
|
|
15
|
-
return
|
|
16
|
+
return r;
|
|
16
17
|
};
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
c as DEFAULT_CLIENT,
|
|
20
|
+
u as findClient,
|
|
21
|
+
d as isClient
|
|
20
22
|
};
|
|
@@ -1,4 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
import { snippetz as l } from "@scalar/snippetz";
|
|
2
|
+
import { capitalize as o } from "vue";
|
|
3
|
+
const y = (t) => `custom/${t.lang}`, m = (t) => t === !0 ? [] : l().clients().flatMap((e) => {
|
|
4
|
+
const n = e.clients.flatMap((r) => {
|
|
5
|
+
const c = `${e.key}/${r.client}`;
|
|
6
|
+
if (Array.isArray(t) && t.includes(r.client))
|
|
7
|
+
return [];
|
|
8
|
+
if (typeof t == "object" && t !== null) {
|
|
9
|
+
const i = t[e.key];
|
|
10
|
+
if (i === !0)
|
|
11
|
+
return [];
|
|
12
|
+
if (Array.isArray(i) && i.includes(r.client))
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
id: c,
|
|
17
|
+
lang: r.client === "curl" ? "curl" : e.key,
|
|
18
|
+
title: `${o(e.title)} ${r.title}`,
|
|
19
|
+
label: r.title,
|
|
20
|
+
targetKey: e.key,
|
|
21
|
+
targetTitle: e.title,
|
|
22
|
+
clientKey: r.client
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
return n.length === 0 ? [] : {
|
|
26
|
+
label: e.title,
|
|
27
|
+
options: n
|
|
28
|
+
};
|
|
29
|
+
});
|
|
2
30
|
export {
|
|
3
|
-
|
|
31
|
+
m as generateClientOptions,
|
|
32
|
+
y as generateCustomId
|
|
4
33
|
};
|
|
@@ -25,5 +25,10 @@ export declare const getExampleFromSchema: (schema: SchemaObject, options?: {
|
|
|
25
25
|
variables?: Record<string, unknown>;
|
|
26
26
|
/** Whether to omit empty and optional properties. */
|
|
27
27
|
omitEmptyAndOptionalProperties?: boolean;
|
|
28
|
-
},
|
|
28
|
+
}, args?: Partial<{
|
|
29
|
+
level: number;
|
|
30
|
+
parentSchema: SchemaObject;
|
|
31
|
+
name: string;
|
|
32
|
+
seen: WeakSet<object>;
|
|
33
|
+
}>) => unknown;
|
|
29
34
|
//# sourceMappingURL=get-example-from-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/get-example-from-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/get-example-from-schema.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AA+ahG;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,YAAY,EACpB,UAAU;IACR,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,qDAAqD;IACrD,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,EACD,OAAO,OAAO,CAAC;IACb,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,YAAY,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CACtB,CAAC,KACD,OAyJF,CAAA"}
|