@scalar/api-reference 1.31.0 → 1.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/browser/standalone.js +2030 -1927
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/Models.vue.js +1 -1
- package/dist/components/Content/Models/Models.vue2.js +2 -1
- package/dist/components/Content/Schema/Schema.preview.d.ts +252 -84
- package/dist/components/Content/Schema/Schema.preview.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.d.ts +17 -3
- package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.js +2 -2
- package/dist/components/Content/Schema/Schema.vue2.js +146 -128
- package/dist/components/Content/Schema/SchemaComposition.vue.d.ts +2 -2
- package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts +2 -3
- package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaDiscriminator.vue.js +29 -29
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +10 -3
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
- package/dist/components/Content/Schema/SchemaProperty.vue2.js +129 -101
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts +2 -2
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +122 -115
- package/dist/components/Layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/components/Layouts/ClassicLayout.vue.js +11 -11
- package/dist/components/Section/SectionAccordion.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionAccordion.vue.js +2 -2
- package/dist/components/Section/SectionAccordion.vue2.js +1 -1
- package/dist/components/Section/SectionContainerAccordion.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionContainerAccordion.vue.js +2 -2
- package/dist/components/Section/SectionContainerAccordion.vue2.js +4 -4
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts +2 -0
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.js +2 -2
- package/dist/features/ExampleRequest/ExampleRequest.vue2.js +178 -127
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js +29 -23
- package/dist/features/Operation/components/OperationParameters.vue.d.ts +7 -3
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js +28 -24
- package/dist/features/Operation/components/RequestBody.vue.d.ts +5 -1
- package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js +2 -2
- package/dist/features/Operation/components/RequestBody.vue2.js +41 -36
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +5 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
- package/dist/features/Operation/layouts/ClassicLayout.vue2.js +79 -74
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +5 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +63 -57
- package/dist/hooks/useDiscriminator.d.ts +53 -0
- package/dist/hooks/useDiscriminator.d.ts.map +1 -0
- package/dist/hooks/useDiscriminator.js +149 -0
- package/dist/hooks/useOperationDiscriminator.d.ts +8 -0
- package/dist/hooks/useOperationDiscriminator.d.ts.map +1 -0
- package/dist/hooks/useOperationDiscriminator.js +57 -0
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -6
- package/dist/components/Content/Schema/helpers/schema-discriminator.d.ts +0 -12
- package/dist/components/Content/Schema/helpers/schema-discriminator.d.ts.map +0 -1
- package/dist/components/Content/Schema/helpers/schema-discriminator.js +0 -45
|
@@ -1,50 +1,60 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useWorkspace as
|
|
3
|
-
import { getSnippet as
|
|
4
|
-
import { filterSecurityRequirements as
|
|
5
|
-
import { ScalarCodeBlock as
|
|
6
|
-
import
|
|
7
|
-
import { freezeElement as
|
|
8
|
-
import { useConfig as
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
1
|
+
import { defineComponent as ce, useId as me, ref as T, inject as z, computed as c, watch as L, onMounted as de, createBlock as V, createCommentVNode as j, unref as l, openBlock as y, withCtx as n, createVNode as s, createElementVNode as w, renderSlot as S, createTextVNode as h, createElementBlock as B, Fragment as W, toDisplayString as R } from "vue";
|
|
2
|
+
import { useWorkspace as pe } from "@scalar/api-client/store";
|
|
3
|
+
import { getSnippet as fe } from "@scalar/api-client/views/Components/CodeSnippet";
|
|
4
|
+
import { filterSecurityRequirements as ye } from "@scalar/api-client/views/Request/RequestSection";
|
|
5
|
+
import { ScalarCodeBlock as ve } from "@scalar/components";
|
|
6
|
+
import J from "../../components/ScreenReader.vue.js";
|
|
7
|
+
import { freezeElement as ge } from "../../helpers/freeze-element.js";
|
|
8
|
+
import { useConfig as xe } from "../../hooks/useConfig.js";
|
|
9
|
+
import { EXAMPLE_CONTEXT as he, DISCRIMINATOR_CONTEXT as Ee } from "../../hooks/useDiscriminator.js";
|
|
10
|
+
import { useHttpClientStore as Ke } from "../../stores/useHttpClientStore.js";
|
|
11
|
+
import be from "./ExamplePicker.vue.js";
|
|
12
|
+
import ke from "./TextSelect.vue.js";
|
|
12
13
|
/* empty css */
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { useExampleStore as
|
|
19
|
-
const
|
|
14
|
+
import G from "../../components/Card/Card.vue.js";
|
|
15
|
+
import Se from "../../components/Card/CardHeader.vue.js";
|
|
16
|
+
import Q from "../../components/HttpMethod/HttpMethod.vue.js";
|
|
17
|
+
import Y from "../../components/Card/CardContent.vue.js";
|
|
18
|
+
import Oe from "../../components/Card/CardFooter.vue.js";
|
|
19
|
+
import { useExampleStore as Ce } from "../../legacy/stores/useExampleStore.js";
|
|
20
|
+
const qe = ["id"], Ne = ["id"], $e = {
|
|
20
21
|
key: 0,
|
|
21
22
|
class: "request-card-footer-addon"
|
|
22
|
-
},
|
|
23
|
+
}, Te = { class: "request-header" }, Qe = /* @__PURE__ */ ce({
|
|
23
24
|
__name: "ExampleRequest",
|
|
24
25
|
props: {
|
|
25
26
|
operation: {},
|
|
26
27
|
server: {},
|
|
27
28
|
collection: {},
|
|
28
29
|
fallback: { type: Boolean },
|
|
29
|
-
transformedOperation: {}
|
|
30
|
+
transformedOperation: {},
|
|
31
|
+
schemas: {}
|
|
30
32
|
},
|
|
31
33
|
setup(o) {
|
|
32
|
-
const { selectedExampleKey:
|
|
34
|
+
const { selectedExampleKey: D, operationId: Z } = Ce(), { requestExamples: E, securitySchemes: H, requestExampleMutators: O } = pe(), _ = xe(), {
|
|
33
35
|
httpClient: i,
|
|
34
|
-
setHttpClient:
|
|
35
|
-
availableTargets:
|
|
36
|
-
httpTargetTitle:
|
|
37
|
-
httpClientTitle:
|
|
38
|
-
} =
|
|
36
|
+
setHttpClient: ee,
|
|
37
|
+
availableTargets: I,
|
|
38
|
+
httpTargetTitle: te,
|
|
39
|
+
httpClientTitle: ae
|
|
40
|
+
} = Ke(), K = me(), v = T(!1), b = z(he), d = z(Ee), C = c(() => {
|
|
41
|
+
var e;
|
|
42
|
+
return (e = d == null ? void 0 : d.value) == null ? void 0 : e.selectedType;
|
|
43
|
+
}), M = c(
|
|
44
|
+
() => {
|
|
45
|
+
var e;
|
|
46
|
+
return ((e = d == null ? void 0 : d.value) == null ? void 0 : e.hasDiscriminator) || !1;
|
|
47
|
+
}
|
|
48
|
+
), m = c(() => {
|
|
39
49
|
var t;
|
|
40
50
|
const e = ["x-custom-examples", "x-codeSamples", "x-code-samples"];
|
|
41
|
-
for (const
|
|
42
|
-
if ((t = o.transformedOperation.information) != null && t[
|
|
43
|
-
return [...o.transformedOperation.information[
|
|
51
|
+
for (const a of e)
|
|
52
|
+
if ((t = o.transformedOperation.information) != null && t[a])
|
|
53
|
+
return [...o.transformedOperation.information[a]];
|
|
44
54
|
return [];
|
|
45
|
-
}), r =
|
|
55
|
+
}), r = T(
|
|
46
56
|
// Default to first custom example
|
|
47
|
-
|
|
57
|
+
m.value.length ? {
|
|
48
58
|
targetKey: "customExamples",
|
|
49
59
|
clientKey: 0
|
|
50
60
|
} : (
|
|
@@ -55,233 +65,274 @@ const me = ["id"], de = ["id"], pe = {
|
|
|
55
65
|
}
|
|
56
66
|
)
|
|
57
67
|
);
|
|
58
|
-
|
|
68
|
+
L(i, () => {
|
|
59
69
|
r.value = {
|
|
60
70
|
targetKey: i.targetKey,
|
|
61
71
|
clientKey: i.clientKey
|
|
62
72
|
};
|
|
63
73
|
});
|
|
64
|
-
const
|
|
65
|
-
const e =
|
|
74
|
+
const U = c(() => {
|
|
75
|
+
const e = q.value;
|
|
66
76
|
return Object.keys(e).length > 1;
|
|
67
|
-
}),
|
|
68
|
-
var
|
|
77
|
+
}), le = () => {
|
|
78
|
+
var x;
|
|
69
79
|
if (r.value.targetKey === "customExamples")
|
|
70
|
-
return ((
|
|
71
|
-
const e = i.clientKey, t = i.targetKey,
|
|
72
|
-
if (!
|
|
80
|
+
return ((x = m.value[r.value.clientKey]) == null ? void 0 : x.source) ?? "";
|
|
81
|
+
const e = i.clientKey, t = i.targetKey, a = E[o.operation.examples[0]];
|
|
82
|
+
if (!a)
|
|
73
83
|
return "";
|
|
74
|
-
const
|
|
84
|
+
const u = ye(
|
|
75
85
|
o.operation.security || o.collection.security,
|
|
76
86
|
o.collection.selectedSecuritySchemeUids,
|
|
77
|
-
|
|
78
|
-
), [
|
|
87
|
+
H
|
|
88
|
+
), [g, k] = fe(t, e, {
|
|
79
89
|
operation: o.operation,
|
|
80
|
-
example:
|
|
90
|
+
example: a,
|
|
81
91
|
server: o.server,
|
|
82
|
-
securitySchemes:
|
|
92
|
+
securitySchemes: u
|
|
83
93
|
});
|
|
84
|
-
return
|
|
85
|
-
},
|
|
94
|
+
return g ? g.message ?? "" : k;
|
|
95
|
+
}, A = c(() => {
|
|
86
96
|
try {
|
|
87
|
-
return
|
|
97
|
+
return le();
|
|
88
98
|
} catch (e) {
|
|
89
99
|
return console.error("[generateSnippet]", e), "";
|
|
90
100
|
}
|
|
91
|
-
}),
|
|
92
|
-
var
|
|
93
|
-
const e = ((
|
|
101
|
+
}), q = c(() => {
|
|
102
|
+
var a, u;
|
|
103
|
+
const e = ((u = (a = o.transformedOperation.information) == null ? void 0 : a.requestBody) == null ? void 0 : u.content) ?? {}, t = Object.values(e)[0];
|
|
94
104
|
return (t == null ? void 0 : t.examples) ?? {};
|
|
95
|
-
}),
|
|
96
|
-
var t,
|
|
105
|
+
}), oe = c(() => {
|
|
106
|
+
var t, a;
|
|
97
107
|
const e = (
|
|
98
108
|
// Specified language
|
|
99
|
-
((t = r.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((
|
|
109
|
+
((t = r.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((a = m.value[r.value.clientKey]) == null ? void 0 : a.lang) ?? "plaintext" : (
|
|
100
110
|
// Or language for the globally selected HTTP client
|
|
101
111
|
i.targetKey
|
|
102
112
|
)
|
|
103
113
|
);
|
|
104
|
-
return e === "shell" &&
|
|
105
|
-
}),
|
|
106
|
-
() => Object.values(
|
|
114
|
+
return e === "shell" && A.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
|
|
115
|
+
}), re = c(
|
|
116
|
+
() => Object.values(H).flatMap((e) => e.type === "apiKey" ? e.value : (e == null ? void 0 : e.type) === "http" ? [
|
|
107
117
|
e.token,
|
|
108
118
|
e.password,
|
|
109
119
|
btoa(`${e.username}:${e.password}`)
|
|
110
120
|
] : e.type === "oauth2" ? Object.values(e.flows).map((t) => t.token) : [])
|
|
111
|
-
),
|
|
112
|
-
const e =
|
|
121
|
+
), ne = c(() => {
|
|
122
|
+
const e = I.value.map((t) => ({
|
|
113
123
|
value: t.key,
|
|
114
124
|
label: t.title,
|
|
115
|
-
options: t.clients.map((
|
|
125
|
+
options: t.clients.map((a) => ({
|
|
116
126
|
value: JSON.stringify({
|
|
117
127
|
targetKey: t.key,
|
|
118
|
-
clientKey:
|
|
128
|
+
clientKey: a.client
|
|
119
129
|
}),
|
|
120
|
-
label:
|
|
130
|
+
label: a.title
|
|
121
131
|
}))
|
|
122
132
|
}));
|
|
123
|
-
return
|
|
133
|
+
return m.value.length && e.unshift({
|
|
124
134
|
value: "customExamples",
|
|
125
135
|
label: "Examples",
|
|
126
|
-
options:
|
|
136
|
+
options: m.value.map((t, a) => ({
|
|
127
137
|
value: JSON.stringify({
|
|
128
138
|
targetKey: "customExamples",
|
|
129
|
-
clientKey:
|
|
139
|
+
clientKey: a
|
|
130
140
|
}),
|
|
131
|
-
label: t.label ?? t.lang ?? `Example #${
|
|
141
|
+
label: t.label ?? t.lang ?? `Example #${a + 1}`
|
|
132
142
|
}))
|
|
133
143
|
}), e;
|
|
134
|
-
}),
|
|
135
|
-
function
|
|
144
|
+
}), N = T(null);
|
|
145
|
+
function se(e) {
|
|
136
146
|
const t = JSON.parse(e);
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
147
|
+
if (N.value) {
|
|
148
|
+
const a = ge(N.value.$el);
|
|
139
149
|
setTimeout(() => {
|
|
140
|
-
|
|
150
|
+
a();
|
|
141
151
|
}, 300);
|
|
142
152
|
}
|
|
143
|
-
t.targetKey === "customExamples" || r.value.targetKey === "customExamples" && t.targetKey === i.targetKey && t.clientKey === i.clientKey ? r.value = t :
|
|
153
|
+
t.targetKey === "customExamples" || r.value.targetKey === "customExamples" && t.targetKey === i.targetKey && t.clientKey === i.clientKey ? r.value = t : ee(t);
|
|
144
154
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
147
|
-
const t =
|
|
148
|
-
if (t && (
|
|
155
|
+
function ie(e) {
|
|
156
|
+
D.value = e, Z.value = o.operation.operationId;
|
|
157
|
+
const t = E[o.operation.examples[0]], a = q.value[e];
|
|
158
|
+
if (t && (a != null && a.value))
|
|
149
159
|
try {
|
|
150
|
-
|
|
160
|
+
O.edit(
|
|
151
161
|
t.uid,
|
|
152
162
|
"body.raw.value",
|
|
153
|
-
JSON.stringify(
|
|
163
|
+
JSON.stringify(a.value, null, 2)
|
|
154
164
|
);
|
|
155
|
-
} catch (
|
|
156
|
-
console.error("[handleExampleUpdate]",
|
|
165
|
+
} catch (u) {
|
|
166
|
+
console.error("[handleExampleUpdate]", u);
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
|
-
|
|
169
|
+
de(() => {
|
|
170
|
+
M.value && C.value && !v.value && F(C.value);
|
|
171
|
+
});
|
|
172
|
+
const F = (e) => {
|
|
173
|
+
var t, a, u, g, k, x;
|
|
174
|
+
if (!v.value)
|
|
175
|
+
try {
|
|
176
|
+
v.value = !0;
|
|
177
|
+
const p = E[o.operation.examples[0]];
|
|
178
|
+
if (p && (b != null && b.generateExampleValue)) {
|
|
179
|
+
const ue = (a = (t = p.body) == null ? void 0 : t.raw) != null && a.value ? JSON.parse(p.body.raw.value) : void 0, $ = b.generateExampleValue(
|
|
180
|
+
Array.isArray(ue)
|
|
181
|
+
);
|
|
182
|
+
if (O.edit(
|
|
183
|
+
p.uid,
|
|
184
|
+
"body.raw.value",
|
|
185
|
+
JSON.stringify($, null, 2)
|
|
186
|
+
), o.operation.examples[0]) {
|
|
187
|
+
const f = E[o.operation.examples[0]];
|
|
188
|
+
f && O.edit(
|
|
189
|
+
f.uid,
|
|
190
|
+
"body.raw.value",
|
|
191
|
+
JSON.stringify($, null, 2)
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
if ((x = (k = (g = (u = o.transformedOperation.information) == null ? void 0 : u.requestBody) == null ? void 0 : g.content) == null ? void 0 : k["application/json"]) != null && x.examples) {
|
|
195
|
+
const f = o.transformedOperation.information.requestBody.content["application/json"].examples;
|
|
196
|
+
Object.keys(f).forEach((P) => {
|
|
197
|
+
var X;
|
|
198
|
+
(X = f[P]) != null && X.value && (f[P].value = $);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
} catch (p) {
|
|
203
|
+
console.error("[handleDiscriminatorChange]", p);
|
|
204
|
+
} finally {
|
|
205
|
+
v.value = !1;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
return L(C, (e) => {
|
|
209
|
+
e && M.value && !v.value && F();
|
|
210
|
+
}), (e, t) => l(I).length || m.value.length ? (y(), V(l(G), {
|
|
160
211
|
key: 0,
|
|
161
|
-
"aria-labelledby": `${
|
|
212
|
+
"aria-labelledby": `${l(K)}-header`,
|
|
162
213
|
class: "dark-mode",
|
|
163
214
|
ref_key: "elem",
|
|
164
|
-
ref:
|
|
215
|
+
ref: N,
|
|
165
216
|
role: "region"
|
|
166
217
|
}, {
|
|
167
218
|
default: n(() => [
|
|
168
|
-
s(
|
|
219
|
+
s(l(Se), { muted: "" }, {
|
|
169
220
|
actions: n(() => [
|
|
170
|
-
s(
|
|
221
|
+
s(ke, {
|
|
171
222
|
class: "request-client-picker",
|
|
172
|
-
controls: `${
|
|
223
|
+
controls: `${l(K)}-example`,
|
|
173
224
|
modelValue: JSON.stringify(r.value),
|
|
174
|
-
options:
|
|
175
|
-
"onUpdate:modelValue":
|
|
225
|
+
options: ne.value,
|
|
226
|
+
"onUpdate:modelValue": se
|
|
176
227
|
}, {
|
|
177
228
|
default: n(() => [
|
|
178
|
-
r.value.targetKey === "customExamples" ? (
|
|
179
|
-
s(
|
|
229
|
+
r.value.targetKey === "customExamples" ? (y(), B(W, { key: 0 }, [
|
|
230
|
+
s(J, null, {
|
|
180
231
|
default: n(() => t[1] || (t[1] = [
|
|
181
|
-
|
|
232
|
+
h("Selected Example:")
|
|
182
233
|
])),
|
|
183
234
|
_: 1
|
|
184
235
|
}),
|
|
185
|
-
|
|
186
|
-
], 64)) : (
|
|
187
|
-
s(
|
|
236
|
+
h(" " + R(m.value[r.value.clientKey].label ?? "Example"), 1)
|
|
237
|
+
], 64)) : (y(), B(W, { key: 1 }, [
|
|
238
|
+
s(J, null, {
|
|
188
239
|
default: n(() => t[2] || (t[2] = [
|
|
189
|
-
|
|
240
|
+
h("Selected HTTP client:")
|
|
190
241
|
])),
|
|
191
242
|
_: 1
|
|
192
243
|
}),
|
|
193
|
-
|
|
244
|
+
h(" " + R(l(te)) + " " + R(l(ae)), 1)
|
|
194
245
|
], 64))
|
|
195
246
|
]),
|
|
196
247
|
_: 1
|
|
197
248
|
}, 8, ["controls", "modelValue", "options"])
|
|
198
249
|
]),
|
|
199
250
|
default: n(() => [
|
|
200
|
-
|
|
201
|
-
id: `${
|
|
251
|
+
w("div", {
|
|
252
|
+
id: `${l(K)}-header`,
|
|
202
253
|
class: "request-header"
|
|
203
254
|
}, [
|
|
204
|
-
s(
|
|
255
|
+
s(J, null, {
|
|
205
256
|
default: n(() => t[0] || (t[0] = [
|
|
206
|
-
|
|
257
|
+
h("Request Example for")
|
|
207
258
|
])),
|
|
208
259
|
_: 1
|
|
209
260
|
}),
|
|
210
|
-
s(
|
|
261
|
+
s(l(Q), {
|
|
211
262
|
as: "span",
|
|
212
263
|
class: "request-method",
|
|
213
264
|
method: e.operation.method
|
|
214
265
|
}, null, 8, ["method"]),
|
|
215
|
-
|
|
216
|
-
], 8,
|
|
266
|
+
S(e.$slots, "header", {}, void 0, !0)
|
|
267
|
+
], 8, qe)
|
|
217
268
|
]),
|
|
218
269
|
_: 3
|
|
219
270
|
}),
|
|
220
|
-
s(
|
|
271
|
+
s(l(Y), {
|
|
221
272
|
borderless: "",
|
|
222
273
|
class: "request-editor-section custom-scroll",
|
|
223
274
|
frameless: ""
|
|
224
275
|
}, {
|
|
225
276
|
default: n(() => [
|
|
226
|
-
|
|
227
|
-
id: `${
|
|
277
|
+
w("div", {
|
|
278
|
+
id: `${l(K)}-example`,
|
|
228
279
|
class: "code-snippet"
|
|
229
280
|
}, [
|
|
230
|
-
s(
|
|
281
|
+
s(l(ve), {
|
|
231
282
|
class: "bg-b-2 -outline-offset-2",
|
|
232
|
-
content:
|
|
233
|
-
hideCredentials:
|
|
234
|
-
lang:
|
|
283
|
+
content: A.value,
|
|
284
|
+
hideCredentials: re.value,
|
|
285
|
+
lang: oe.value,
|
|
235
286
|
lineNumbers: ""
|
|
236
287
|
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
237
|
-
], 8,
|
|
288
|
+
], 8, Ne)
|
|
238
289
|
]),
|
|
239
290
|
_: 1
|
|
240
291
|
}),
|
|
241
|
-
(
|
|
292
|
+
(U.value || !l(_).hideTestRequestButton) && e.$slots.footer ? (y(), V(l(Oe), {
|
|
242
293
|
key: 0,
|
|
243
294
|
class: "request-card-footer",
|
|
244
295
|
contrast: ""
|
|
245
296
|
}, {
|
|
246
297
|
default: n(() => [
|
|
247
|
-
|
|
248
|
-
s(
|
|
298
|
+
U.value ? (y(), B("div", $e, [
|
|
299
|
+
s(be, {
|
|
249
300
|
class: "request-example-selector",
|
|
250
|
-
examples:
|
|
251
|
-
modelValue:
|
|
252
|
-
"onUpdate:modelValue":
|
|
301
|
+
examples: q.value,
|
|
302
|
+
modelValue: l(D),
|
|
303
|
+
"onUpdate:modelValue": ie
|
|
253
304
|
}, null, 8, ["examples", "modelValue"])
|
|
254
|
-
])) :
|
|
255
|
-
|
|
305
|
+
])) : j("", !0),
|
|
306
|
+
S(e.$slots, "footer", {}, void 0, !0)
|
|
256
307
|
]),
|
|
257
308
|
_: 3
|
|
258
|
-
})) :
|
|
309
|
+
})) : j("", !0)
|
|
259
310
|
]),
|
|
260
311
|
_: 3
|
|
261
|
-
}, 8, ["aria-labelledby"])) : e.fallback ? (
|
|
312
|
+
}, 8, ["aria-labelledby"])) : e.fallback ? (y(), V(l(G), {
|
|
262
313
|
key: 1,
|
|
263
314
|
class: "dark-mode"
|
|
264
315
|
}, {
|
|
265
316
|
default: n(() => [
|
|
266
|
-
s(
|
|
317
|
+
s(l(Y), { class: "request-card-simple" }, {
|
|
267
318
|
default: n(() => [
|
|
268
|
-
|
|
269
|
-
s(
|
|
319
|
+
w("div", Te, [
|
|
320
|
+
s(l(Q), {
|
|
270
321
|
as: "span",
|
|
271
322
|
class: "request-method",
|
|
272
323
|
method: e.operation.method
|
|
273
324
|
}, null, 8, ["method"]),
|
|
274
|
-
|
|
325
|
+
S(e.$slots, "header", {}, void 0, !0)
|
|
275
326
|
]),
|
|
276
|
-
|
|
327
|
+
S(e.$slots, "footer", {}, void 0, !0)
|
|
277
328
|
]),
|
|
278
329
|
_: 3
|
|
279
330
|
})
|
|
280
331
|
]),
|
|
281
332
|
_: 3
|
|
282
|
-
})) :
|
|
333
|
+
})) : j("", !0);
|
|
283
334
|
}
|
|
284
335
|
});
|
|
285
336
|
export {
|
|
286
|
-
|
|
337
|
+
Qe as default
|
|
287
338
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"AAsGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAahE,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC7B,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAA;CAC7D,CAAC;;AA4JF,wBAMG"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineComponent as c, computed as
|
|
2
|
-
import { useWorkspace as
|
|
3
|
-
import { getPointer as
|
|
4
|
-
import { useBlockProps as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { defineComponent as c, computed as d, createElementBlock as p, createCommentVNode as u, unref as t, openBlock as n, Fragment as f, createBlock as m } from "vue";
|
|
2
|
+
import { useWorkspace as v } from "@scalar/api-client/store";
|
|
3
|
+
import { getPointer as h } from "../../blocks/helpers/getPointer.js";
|
|
4
|
+
import { useBlockProps as O } from "../../blocks/hooks/useBlockProps.js";
|
|
5
|
+
import { useOperationDiscriminator as k } from "../../hooks/useOperationDiscriminator.js";
|
|
6
|
+
import y from "./layouts/ClassicLayout.vue.js";
|
|
7
|
+
import U from "./layouts/ModernLayout.vue.js";
|
|
7
8
|
const P = /* @__PURE__ */ c({
|
|
8
9
|
__name: "Operation",
|
|
9
10
|
props: {
|
|
@@ -15,44 +16,49 @@ const P = /* @__PURE__ */ c({
|
|
|
15
16
|
schemas: {}
|
|
16
17
|
},
|
|
17
18
|
setup(o) {
|
|
18
|
-
const i =
|
|
19
|
+
const i = v(), { handleDiscriminatorChange: s } = k(
|
|
20
|
+
o.transformedOperation,
|
|
21
|
+
o.schemas
|
|
22
|
+
), { operation: r } = O({
|
|
19
23
|
store: i,
|
|
20
24
|
collection: o.collection,
|
|
21
|
-
location:
|
|
25
|
+
location: h([
|
|
22
26
|
"paths",
|
|
23
27
|
o.transformedOperation.path,
|
|
24
28
|
o.transformedOperation.httpVerb.toLowerCase()
|
|
25
29
|
])
|
|
26
|
-
}),
|
|
30
|
+
}), l = d(() => {
|
|
27
31
|
var e;
|
|
28
32
|
if (!r.value)
|
|
29
33
|
return o.server;
|
|
30
34
|
if ((e = r.value) != null && e.selectedServerUid) {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
35
|
+
const a = i.servers[r.value.selectedServerUid];
|
|
36
|
+
if (a)
|
|
37
|
+
return a;
|
|
34
38
|
}
|
|
35
39
|
return o.server;
|
|
36
40
|
});
|
|
37
|
-
return (e,
|
|
38
|
-
e.layout === "classic" ? (
|
|
41
|
+
return (e, a) => e.collection && t(r) ? (n(), p(f, { key: 0 }, [
|
|
42
|
+
e.layout === "classic" ? (n(), m(y, {
|
|
39
43
|
key: 0,
|
|
40
44
|
id: e.id,
|
|
41
45
|
collection: e.collection,
|
|
42
|
-
operation:
|
|
46
|
+
operation: t(r),
|
|
43
47
|
schemas: e.schemas,
|
|
44
|
-
server:
|
|
45
|
-
transformedOperation: e.transformedOperation
|
|
46
|
-
|
|
48
|
+
server: l.value,
|
|
49
|
+
transformedOperation: e.transformedOperation,
|
|
50
|
+
"onUpdate:modelValue": t(s)
|
|
51
|
+
}, null, 8, ["id", "collection", "operation", "schemas", "server", "transformedOperation", "onUpdate:modelValue"])) : (n(), m(U, {
|
|
47
52
|
key: 1,
|
|
48
53
|
id: e.id,
|
|
49
54
|
collection: e.collection,
|
|
50
|
-
operation:
|
|
55
|
+
operation: t(r),
|
|
51
56
|
schemas: e.schemas,
|
|
52
|
-
server:
|
|
53
|
-
transformedOperation: e.transformedOperation
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
server: l.value,
|
|
58
|
+
transformedOperation: e.transformedOperation,
|
|
59
|
+
"onUpdate:modelValue": t(s)
|
|
60
|
+
}, null, 8, ["id", "collection", "operation", "schemas", "server", "transformedOperation", "onUpdate:modelValue"]))
|
|
61
|
+
], 64)) : u("", !0);
|
|
56
62
|
}
|
|
57
63
|
});
|
|
58
64
|
export {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { Request as RequestEntity } from '@scalar/oas-utils/entities/spec';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Schemas } from '../../../features/Operation/types/schemas';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
operation?: Pick<RequestEntity, 'parameters' | 'requestBody'>;
|
|
5
|
-
schemas?:
|
|
5
|
+
schemas?: Schemas;
|
|
6
6
|
};
|
|
7
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
"update:modelValue": (value: string) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
12
|
export default _default;
|
|
9
13
|
//# sourceMappingURL=OperationParameters.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationParameters.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/OperationParameters.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OperationParameters.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/OperationParameters.vue"],"names":[],"mappings":"AAiEA,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAE/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAOjE,KAAK,WAAW,GAAG;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,YAAY,GAAG,aAAa,CAAC,CAAA;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC;;;;;;AA2IF,wBAOG"}
|