@scalar/api-client
Version:
the open source API testing client
68 lines (67 loc) • 2.53 kB
JavaScript
import { defineComponent as v, computed as r, createBlock as h, createElementBlock as y, openBlock as s, unref as a, createElementVNode as p } from "vue";
import { getResolvedRef as f } from "@scalar/workspace-store/helpers/get-resolved-ref";
import { useRouter as S } from "vue-router";
import { getSecurityRequirements as k } from "./helpers/get-security-requirements.js";
import B from "../../blocks/operation-block/OperationBlock.vue.js";
const R = {
key: 1,
class: "flex h-full w-full items-center justify-center"
}, g = {}, P = /* @__PURE__ */ v({
...g,
__name: "Operation",
props: {
documentSlug: {},
document: {},
eventBus: {},
layout: {},
path: {},
method: {},
exampleName: {},
environment: {},
workspaceStore: {},
activeWorkspace: {}
},
setup(e) {
const o = r(
() => e.path && e.method ? f(e.document?.paths?.[e.path]?.[e.method]) : void 0
), u = r(
() => k(e.document, o.value)
), m = r(
() => e.document?.servers?.find(
({ url: t }) => t === e.document?.["x-scalar-selected-server"]
) ?? null
), c = r(() => e.document?.["x-scalar-set-operation-security"] ? o.value?.["x-scalar-selected-security"] : e.document?.["x-scalar-selected-security"]), l = r(() => e.document?.["x-scalar-set-operation-security"] ? {
type: "operation",
path: e.path ?? "",
method: e.method ?? "get"
} : {
type: "document"
}), i = "2.12.0", d = S();
return (t, n) => t.path && t.method && t.exampleName && o.value ? (s(), h(a(B), {
key: 0,
appVersion: a(i),
authMeta: l.value,
environment: t.environment,
eventBus: t.eventBus,
exampleKey: t.exampleName,
history: [],
layout: t.layout,
method: t.method,
operation: o.value,
path: t.path,
plugins: [],
security: u.value,
securitySchemes: t.document?.components?.securitySchemes ?? {},
selectedSecurity: c.value,
server: m.value,
servers: t.document?.servers ?? [],
totalPerformedRequests: 0,
"onUpdate:servers": n[0] || (n[0] = (N) => a(d).push({ name: "document.servers" }))
}, null, 8, ["appVersion", "authMeta", "environment", "eventBus", "exampleKey", "layout", "method", "operation", "path", "security", "securitySchemes", "selectedSecurity", "server", "servers"])) : (s(), y("div", R, [...n[1] || (n[1] = [
p("span", { class: "text-c-3" }, "Select an operation to view details", -1)
])]));
}
});
export {
P as default
};