@scalar/api-reference 1.24.35 → 1.24.37
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 +24 -0
- package/dist/browser/standalone.js +7192 -6870
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReferenceLayout.vue.d.ts +2 -3
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/Card/CardHeader.vue.js +2 -2
- package/dist/components/Content/Introduction/Description.vue.d.ts.map +1 -1
- package/dist/components/Content/Introduction/Description.vue.js +2 -2
- package/dist/components/Content/Operation/PathResponses/PathResponses.vue.js +2 -2
- package/dist/components/Content/Operation/PathResponses/PathResponses.vue2.js +2 -2
- package/dist/components/Content/Operation/TestRequestButton.vue.js +1 -1
- package/dist/components/Content/Operation/TestRequestButton.vue2.js +8 -5
- package/dist/components/Content/Schema/Schema.vue2.js +4 -4
- package/dist/components/Content/Schema/SchemaHeading.vue2.js +14 -14
- package/dist/components/GettingStarted.vue.d.ts +4 -5
- package/dist/components/GettingStarted.vue.d.ts.map +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.js +4 -4
- package/dist/features/ExampleRequest/ExampleRequest.vue2.js +127 -138
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -6
|
@@ -1,237 +1,226 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import { createHash as
|
|
4
|
-
import { getRequestFromOperation as
|
|
1
|
+
import { defineComponent as U, ref as _, watch as L, computed as y, inject as I, onServerPrefetch as M, useSSRContext as Y, openBlock as d, createBlock as b, unref as s, withCtx as c, createVNode as p, createElementBlock as g, Fragment as V, createTextVNode as H, toDisplayString as v, createElementVNode as O, renderSlot as j, createCommentVNode as N } from "vue";
|
|
2
|
+
import { ScalarCodeBlock as z } from "@scalar/components";
|
|
3
|
+
import { createHash as D, ssrState as Q } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { getRequestFromOperation as W } from "@scalar/oas-utils/spec-getters";
|
|
5
5
|
import { snippetz as R } from "@scalar/snippetz";
|
|
6
|
-
import { asyncComputed as
|
|
7
|
-
import { HTTPSnippet as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import { asyncComputed as X } from "@vueuse/core";
|
|
7
|
+
import { HTTPSnippet as Z } from "httpsnippet-lite";
|
|
8
|
+
import G from "./ExamplePicker.vue.js";
|
|
9
|
+
import ee from "./TextSelect.vue.js";
|
|
10
10
|
/* empty css */
|
|
11
|
-
import { GLOBAL_SECURITY_SYMBOL as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { getSecretCredentialsFromAuthentication as
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
const ve = { class: "request-header" }, Ke = { class: "code-snippet" }, xe = {
|
|
11
|
+
import { GLOBAL_SECURITY_SYMBOL as te } from "../../helpers/provideSymbols.js";
|
|
12
|
+
import oe from "../../components/Card/Card.vue.js";
|
|
13
|
+
import re from "../../components/Card/CardHeader.vue.js";
|
|
14
|
+
import ae from "../../components/HttpMethod/HttpMethod.vue.js";
|
|
15
|
+
import ne from "../../components/Card/CardContent.vue.js";
|
|
16
|
+
import { getSecretCredentialsFromAuthentication as se, getRequestFromAuthentication as le } from "../../legacy/helpers/getRequestFromAuthentication.js";
|
|
17
|
+
import ie from "../../components/Card/CardFooter.vue.js";
|
|
18
|
+
import { useHttpClientStore as ce } from "../../stores/useHttpClientStore.js";
|
|
19
|
+
import { getApiClientRequest as pe } from "../../helpers/getApiClientRequest.js";
|
|
20
|
+
import { useServerStore as me } from "../../legacy/stores/useServerStore.js";
|
|
21
|
+
import { useAuthenticationStore as ue } from "../../legacy/stores/useAuthenticationStore.js";
|
|
22
|
+
import { getHarRequest as de } from "../../helpers/getHarRequest.js";
|
|
23
|
+
import { getUrlFromServerState as fe } from "../../legacy/helpers/getUrlFromServerState.js";
|
|
24
|
+
const ye = { class: "request-header" }, he = { class: "code-snippet" }, ge = {
|
|
26
25
|
key: 0,
|
|
27
26
|
class: "request-card-footer-addon"
|
|
28
|
-
},
|
|
27
|
+
}, Ue = /* @__PURE__ */ U({
|
|
29
28
|
__name: "ExampleRequest",
|
|
30
29
|
props: {
|
|
31
30
|
customExamples: {},
|
|
32
31
|
operation: {}
|
|
33
32
|
},
|
|
34
|
-
setup(
|
|
35
|
-
var
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
)}`,
|
|
39
|
-
httpClient:
|
|
40
|
-
setHttpClient:
|
|
41
|
-
availableTargets:
|
|
42
|
-
httpTargetTitle:
|
|
43
|
-
httpClientTitle:
|
|
44
|
-
} =
|
|
33
|
+
setup(B) {
|
|
34
|
+
var k;
|
|
35
|
+
const a = B, K = `components-Content-Operation-Example-Request${D(
|
|
36
|
+
a.operation.path + a.operation.httpVerb + a.operation.operationId
|
|
37
|
+
)}`, x = _(), {
|
|
38
|
+
httpClient: n,
|
|
39
|
+
setHttpClient: T,
|
|
40
|
+
availableTargets: $,
|
|
41
|
+
httpTargetTitle: w,
|
|
42
|
+
httpClientTitle: F
|
|
43
|
+
} = ce(), { server: E } = me(), { authentication: h } = ue(), l = _(
|
|
45
44
|
// Default to first custom example
|
|
46
|
-
(
|
|
45
|
+
(k = a.customExamples) != null && k.length ? {
|
|
47
46
|
targetKey: "customExamples",
|
|
48
47
|
clientKey: 0
|
|
49
48
|
} : (
|
|
50
49
|
// Otherwise use the globally selected HTTP client
|
|
51
50
|
{
|
|
52
|
-
targetKey:
|
|
53
|
-
clientKey:
|
|
51
|
+
targetKey: n.targetKey,
|
|
52
|
+
clientKey: n.clientKey
|
|
54
53
|
}
|
|
55
54
|
)
|
|
56
55
|
);
|
|
57
|
-
L(
|
|
56
|
+
L(n, () => {
|
|
58
57
|
l.value = {
|
|
59
|
-
targetKey:
|
|
60
|
-
clientKey:
|
|
58
|
+
targetKey: n.targetKey,
|
|
59
|
+
clientKey: n.clientKey
|
|
61
60
|
};
|
|
62
61
|
});
|
|
63
|
-
const
|
|
62
|
+
const C = y(
|
|
64
63
|
() => {
|
|
65
|
-
var
|
|
64
|
+
var e, o, t, r;
|
|
66
65
|
return Object.keys(
|
|
67
|
-
((r = (
|
|
66
|
+
((r = (t = (o = (e = a.operation.information) == null ? void 0 : e.requestBody) == null ? void 0 : o.content) == null ? void 0 : t["application/json"]) == null ? void 0 : r.examples) ?? {}
|
|
68
67
|
).length > 1;
|
|
69
68
|
}
|
|
70
|
-
),
|
|
71
|
-
async function
|
|
69
|
+
), i = I(te);
|
|
70
|
+
async function S() {
|
|
72
71
|
var r, m, u;
|
|
73
72
|
if (l.value.targetKey === "customExamples")
|
|
74
|
-
return ((m = (r =
|
|
75
|
-
const
|
|
73
|
+
return ((m = (r = a.customExamples) == null ? void 0 : r[l.value.clientKey]) == null ? void 0 : m.source) ?? "";
|
|
74
|
+
const e = de(
|
|
76
75
|
{
|
|
77
|
-
url:
|
|
76
|
+
url: fe(E)
|
|
78
77
|
},
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
W(
|
|
79
|
+
a.operation,
|
|
81
80
|
{
|
|
82
81
|
replaceVariables: !0
|
|
83
82
|
},
|
|
84
|
-
|
|
83
|
+
x.value
|
|
85
84
|
),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
((u =
|
|
85
|
+
le(
|
|
86
|
+
h,
|
|
87
|
+
((u = a.operation.information) == null ? void 0 : u.security) ?? (i == null ? void 0 : i())
|
|
89
88
|
)
|
|
90
|
-
), o =
|
|
91
|
-
if (o && R().hasPlugin(
|
|
92
|
-
return R().print(
|
|
89
|
+
), o = n.clientKey === "undici" || n.clientKey === "fetch" || n.clientKey === "ofetch" ? n.clientKey : null, t = n.targetKey.replace("javascript", "js");
|
|
90
|
+
if (o && R().hasPlugin(t, o) && (t === "node" || t === "js"))
|
|
91
|
+
return R().print(t, o, e) ?? "";
|
|
93
92
|
try {
|
|
94
|
-
return await new
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
return await new Z(e).convert(
|
|
94
|
+
n.targetKey,
|
|
95
|
+
n.clientKey
|
|
97
96
|
);
|
|
98
97
|
} catch (f) {
|
|
99
98
|
return console.error("[ExampleRequest]", f), "";
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
|
-
const
|
|
101
|
+
const q = X(async () => {
|
|
103
102
|
try {
|
|
104
|
-
return await
|
|
105
|
-
} catch (
|
|
106
|
-
return console.error("[generateSnippet]",
|
|
103
|
+
return await S();
|
|
104
|
+
} catch (e) {
|
|
105
|
+
return console.error("[generateSnippet]", e), "";
|
|
107
106
|
}
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
}), y(() =>
|
|
113
|
-
serverState:
|
|
114
|
-
authenticationState:
|
|
115
|
-
operation:
|
|
116
|
-
globalSecurity:
|
|
107
|
+
}, Q[K] ?? "");
|
|
108
|
+
M(async () => {
|
|
109
|
+
const e = Y();
|
|
110
|
+
e.payload.data[K] = await S();
|
|
111
|
+
}), y(() => pe({
|
|
112
|
+
serverState: E,
|
|
113
|
+
authenticationState: h,
|
|
114
|
+
operation: a.operation,
|
|
115
|
+
globalSecurity: i == null ? void 0 : i()
|
|
117
116
|
}));
|
|
118
|
-
const
|
|
119
|
-
var o,
|
|
120
|
-
const
|
|
117
|
+
const A = y(() => {
|
|
118
|
+
var o, t, r;
|
|
119
|
+
const e = (
|
|
121
120
|
// Specified language
|
|
122
|
-
((o = l.value) == null ? void 0 : o.targetKey) === "customExamples" ? ((r = (
|
|
121
|
+
((o = l.value) == null ? void 0 : o.targetKey) === "customExamples" ? ((r = (t = a.customExamples) == null ? void 0 : t[l.value.clientKey]) == null ? void 0 : r.lang) ?? "plaintext" : (
|
|
123
122
|
// Or language for the globally selected HTTP client
|
|
124
|
-
|
|
123
|
+
n.targetKey
|
|
125
124
|
)
|
|
126
125
|
);
|
|
127
|
-
return
|
|
128
|
-
}),
|
|
126
|
+
return e === "shell" && q.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
|
|
127
|
+
}), J = y(() => {
|
|
129
128
|
var o;
|
|
130
|
-
const
|
|
131
|
-
value:
|
|
132
|
-
label:
|
|
133
|
-
options:
|
|
129
|
+
const e = $.value.map((t) => ({
|
|
130
|
+
value: t.key,
|
|
131
|
+
label: t.title,
|
|
132
|
+
options: t.clients.map((r) => ({
|
|
134
133
|
value: JSON.stringify({
|
|
135
|
-
targetKey:
|
|
134
|
+
targetKey: t.key,
|
|
136
135
|
clientKey: r.key
|
|
137
136
|
}),
|
|
138
137
|
label: r.title
|
|
139
138
|
}))
|
|
140
139
|
}));
|
|
141
|
-
return (o =
|
|
140
|
+
return (o = a.customExamples) != null && o.length && e.unshift({
|
|
142
141
|
value: "customExamples",
|
|
143
142
|
label: "Examples",
|
|
144
|
-
options:
|
|
143
|
+
options: a.customExamples.map((t, r) => ({
|
|
145
144
|
value: JSON.stringify({
|
|
146
145
|
targetKey: "customExamples",
|
|
147
146
|
clientKey: r
|
|
148
147
|
}),
|
|
149
|
-
label:
|
|
148
|
+
label: t.label ?? t.lang ?? `Example #${r + 1}`
|
|
150
149
|
}))
|
|
151
|
-
}),
|
|
150
|
+
}), e;
|
|
152
151
|
});
|
|
153
|
-
function
|
|
154
|
-
const o = JSON.parse(
|
|
155
|
-
o.targetKey === "customExamples" ? l.value = o :
|
|
152
|
+
function P(e) {
|
|
153
|
+
const o = JSON.parse(e);
|
|
154
|
+
o.targetKey === "customExamples" ? l.value = o : T(o);
|
|
156
155
|
}
|
|
157
|
-
return (
|
|
158
|
-
default:
|
|
159
|
-
|
|
160
|
-
actions:
|
|
161
|
-
|
|
156
|
+
return (e, o) => (d(), b(s(oe), { class: "dark-mode" }, {
|
|
157
|
+
default: c(() => [
|
|
158
|
+
p(s(re), { muted: "" }, {
|
|
159
|
+
actions: c(() => [
|
|
160
|
+
p(ee, {
|
|
162
161
|
class: "request-client-picker",
|
|
163
162
|
modelValue: JSON.stringify(l.value),
|
|
164
|
-
options:
|
|
165
|
-
"onUpdate:modelValue":
|
|
163
|
+
options: J.value,
|
|
164
|
+
"onUpdate:modelValue": P
|
|
166
165
|
}, {
|
|
167
|
-
default:
|
|
168
|
-
var
|
|
166
|
+
default: c(() => {
|
|
167
|
+
var t;
|
|
169
168
|
return [
|
|
170
|
-
l.value.targetKey === "customExamples" ? (d(),
|
|
171
|
-
|
|
172
|
-
], 64)) : (d(),
|
|
173
|
-
|
|
169
|
+
l.value.targetKey === "customExamples" ? (d(), g(V, { key: 0 }, [
|
|
170
|
+
H(v(((t = a.customExamples) == null ? void 0 : t[l.value.clientKey].label) ?? "Example"), 1)
|
|
171
|
+
], 64)) : (d(), g(V, { key: 1 }, [
|
|
172
|
+
H(v(s(w)) + " " + v(s(F)), 1)
|
|
174
173
|
], 64))
|
|
175
174
|
];
|
|
176
175
|
}),
|
|
177
176
|
_: 1
|
|
178
|
-
}, 8, ["modelValue", "options"])
|
|
179
|
-
x("button", {
|
|
180
|
-
class: "copy-button",
|
|
181
|
-
type: "button",
|
|
182
|
-
onClick: o[0] || (o[0] = (e) => a(B)(a(h)))
|
|
183
|
-
}, [
|
|
184
|
-
i(a(D), {
|
|
185
|
-
icon: "Clipboard",
|
|
186
|
-
width: "10px"
|
|
187
|
-
})
|
|
188
|
-
])
|
|
177
|
+
}, 8, ["modelValue", "options"])
|
|
189
178
|
]),
|
|
190
|
-
default:
|
|
191
|
-
|
|
192
|
-
|
|
179
|
+
default: c(() => [
|
|
180
|
+
O("div", ye, [
|
|
181
|
+
p(s(ae), {
|
|
193
182
|
as: "span",
|
|
194
183
|
class: "request-method",
|
|
195
|
-
method:
|
|
184
|
+
method: e.operation.httpVerb
|
|
196
185
|
}, null, 8, ["method"]),
|
|
197
|
-
j(
|
|
186
|
+
j(e.$slots, "header", {}, void 0, !0)
|
|
198
187
|
])
|
|
199
188
|
]),
|
|
200
189
|
_: 3
|
|
201
190
|
}),
|
|
202
|
-
|
|
191
|
+
p(s(ne), {
|
|
203
192
|
borderless: "",
|
|
204
193
|
class: "request-editor-section custom-scroll",
|
|
205
194
|
frameless: ""
|
|
206
195
|
}, {
|
|
207
|
-
default:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
content:
|
|
211
|
-
hideCredentials:
|
|
212
|
-
lang:
|
|
196
|
+
default: c(() => [
|
|
197
|
+
O("div", he, [
|
|
198
|
+
p(s(z), {
|
|
199
|
+
content: s(q),
|
|
200
|
+
hideCredentials: s(se)(s(h)),
|
|
201
|
+
lang: A.value,
|
|
213
202
|
lineNumbers: ""
|
|
214
203
|
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
215
204
|
])
|
|
216
205
|
]),
|
|
217
206
|
_: 1
|
|
218
207
|
}),
|
|
219
|
-
|
|
208
|
+
C.value || e.$slots.footer ? (d(), b(s(ie), {
|
|
220
209
|
key: 0,
|
|
221
210
|
class: "request-card-footer",
|
|
222
211
|
contrast: ""
|
|
223
212
|
}, {
|
|
224
|
-
default:
|
|
225
|
-
var
|
|
213
|
+
default: c(() => {
|
|
214
|
+
var t, r, m, u;
|
|
226
215
|
return [
|
|
227
|
-
|
|
228
|
-
|
|
216
|
+
C.value ? (d(), g("div", ge, [
|
|
217
|
+
p(G, {
|
|
229
218
|
class: "request-example-selector",
|
|
230
|
-
examples: ((u = (m = (r = (
|
|
231
|
-
"onUpdate:modelValue": o[
|
|
219
|
+
examples: ((u = (m = (r = (t = e.operation.information) == null ? void 0 : t.requestBody) == null ? void 0 : r.content) == null ? void 0 : m["application/json"]) == null ? void 0 : u.examples) ?? [],
|
|
220
|
+
"onUpdate:modelValue": o[0] || (o[0] = (f) => x.value = f)
|
|
232
221
|
}, null, 8, ["examples"])
|
|
233
222
|
])) : N("", !0),
|
|
234
|
-
j(
|
|
223
|
+
j(e.$slots, "footer", {}, void 0, !0)
|
|
235
224
|
];
|
|
236
225
|
}),
|
|
237
226
|
_: 3
|
|
@@ -242,5 +231,5 @@ const ve = { class: "request-header" }, Ke = { class: "code-snippet" }, xe = {
|
|
|
242
231
|
}
|
|
243
232
|
});
|
|
244
233
|
export {
|
|
245
|
-
|
|
234
|
+
Ue as default
|
|
246
235
|
};
|