@scalar/api-reference 1.25.76 → 1.25.78
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 +33 -0
- package/dist/browser/standalone.js +24389 -23740
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +41 -56
- package/dist/components/ApiReferenceLayout.vue.d.ts +2 -2
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +3 -3
- package/dist/components/ApiReferenceLayout.vue2.js +140 -123
- package/dist/components/Content/Content.vue.d.ts +0 -1
- package/dist/components/Content/Content.vue.d.ts.map +1 -1
- package/dist/components/Content/Content.vue.js +1 -1
- package/dist/components/Content/Content.vue2.js +67 -62
- package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
- package/dist/components/Content/Lazy/Loading.vue.js +74 -69
- package/dist/components/Content/Tag/TagList.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/TagList.vue.js +37 -33
- package/dist/embeds/ExampleRequest/ExampleRequest.vue.d.ts +1 -1
- package/dist/embeds/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
- package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts +60 -60
- package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts.map +1 -1
- package/dist/embeds/OpenApiDocument/types.d.ts +1 -1
- package/dist/embeds/OpenApiDocument/types.d.ts.map +1 -1
- package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/features/ApiClientModal/ApiClientModal.vue.js +20 -18
- package/dist/features/ApiClientModal/useApiClient.d.ts +149 -138
- package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
- package/dist/features/ApiClientModal/useApiClient.js +6 -6
- package/dist/features/BaseUrl/ServerUrlSelect.vue.d.ts.map +1 -1
- package/dist/features/BaseUrl/ServerUrlSelect.vue.js +2 -2
- package/dist/features/BaseUrl/ServerVariablesSelect.vue.d.ts.map +1 -1
- package/dist/features/BaseUrl/ServerVariablesSelect.vue.js +3 -3
- package/dist/features/BaseUrl/ServerVariablesSelect.vue2.js +3 -3
- package/dist/features/BaseUrl/ServerVariablesTextbox.vue.d.ts.map +1 -1
- package/dist/features/BaseUrl/ServerVariablesTextbox.vue.js +2 -2
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts +3 -0
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.js +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue2.js +121 -147
- package/dist/features/Operation/Operation.vue.d.ts +6 -4
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js +30 -13
- package/dist/features/Operation/hooks/useRequestExample.d.ts +17 -0
- package/dist/features/Operation/hooks/useRequestExample.d.ts.map +1 -0
- package/dist/features/Operation/hooks/useRequestExample.js +68 -0
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +2 -0
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue2.js +47 -41
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +2 -0
- 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 +52 -48
- package/dist/helpers/convertRequestToHarRequest.d.ts +7 -0
- package/dist/helpers/convertRequestToHarRequest.d.ts.map +1 -0
- package/dist/helpers/convertRequestToHarRequest.js +64 -0
- package/dist/helpers/get-request.d.ts +40 -0
- package/dist/helpers/get-request.d.ts.map +1 -0
- package/dist/helpers/get-request.js +6 -0
- package/dist/helpers/getExampleCode.d.ts +2 -2
- package/dist/helpers/getExampleCode.d.ts.map +1 -1
- package/dist/helpers/getExampleCode.js +19 -16
- package/dist/helpers/index.d.ts +1 -3
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/provideSymbols.d.ts +0 -5
- package/dist/helpers/provideSymbols.d.ts.map +1 -1
- package/dist/helpers/provideSymbols.js +3 -4
- package/dist/hooks/useReactiveSpec.d.ts +1 -1
- package/dist/hooks/useSidebar.d.ts.map +1 -1
- package/dist/index.js +77 -85
- package/dist/legacy/helpers/getUrlFromServerState.js +8 -8
- package/dist/legacy/helpers/index.d.ts +0 -10
- package/dist/legacy/helpers/index.d.ts.map +1 -1
- package/dist/legacy/stores/index.d.ts +0 -3
- package/dist/legacy/stores/index.d.ts.map +1 -1
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +8 -8
- package/dist/components/Content/Authentication/Authentication.vue.d.ts +0 -8
- package/dist/components/Content/Authentication/Authentication.vue.d.ts.map +0 -1
- package/dist/components/Content/Authentication/Authentication.vue.js +0 -7
- package/dist/components/Content/Authentication/Authentication.vue2.js +0 -62
- package/dist/components/Content/Authentication/index.d.ts +0 -2
- package/dist/components/Content/Authentication/index.d.ts.map +0 -1
- package/dist/helpers/createRequest.d.ts +0 -6
- package/dist/helpers/createRequest.d.ts.map +0 -1
- package/dist/helpers/createRequest.js +0 -16
- package/dist/helpers/getApiClientRequest.d.ts +0 -13
- package/dist/helpers/getApiClientRequest.d.ts.map +0 -1
- package/dist/helpers/getApiClientRequest.js +0 -43
- package/dist/helpers/getHarRequest.d.ts +0 -4
- package/dist/helpers/getHarRequest.d.ts.map +0 -1
- package/dist/helpers/getHarRequest.js +0 -34
- package/dist/legacy/components/CardForm.vue.d.ts +0 -18
- package/dist/legacy/components/CardForm.vue.d.ts.map +0 -1
- package/dist/legacy/components/CardForm.vue.js +0 -13
- package/dist/legacy/components/CardFormButton.vue.d.ts +0 -22
- package/dist/legacy/components/CardFormButton.vue.d.ts.map +0 -1
- package/dist/legacy/components/CardFormButton.vue.js +0 -7
- package/dist/legacy/components/CardFormButton.vue2.js +0 -18
- package/dist/legacy/components/CardFormGroup.vue.d.ts +0 -18
- package/dist/legacy/components/CardFormGroup.vue.d.ts.map +0 -1
- package/dist/legacy/components/CardFormGroup.vue.js +0 -13
- package/dist/legacy/components/CardFormRows.vue.d.ts +0 -18
- package/dist/legacy/components/CardFormRows.vue.d.ts.map +0 -1
- package/dist/legacy/components/CardFormRows.vue.js +0 -13
- package/dist/legacy/components/CardFormTextInput.vue.d.ts +0 -23
- package/dist/legacy/components/CardFormTextInput.vue.d.ts.map +0 -1
- package/dist/legacy/components/CardFormTextInput.vue.js +0 -7
- package/dist/legacy/components/CardFormTextInput.vue2.js +0 -53
- package/dist/legacy/components/SecurityScheme.vue.d.ts +0 -8
- package/dist/legacy/components/SecurityScheme.vue.d.ts.map +0 -1
- package/dist/legacy/components/SecurityScheme.vue.js +0 -7
- package/dist/legacy/components/SecurityScheme.vue2.js +0 -393
- package/dist/legacy/components/SecuritySchemeScopes.vue.d.ts +0 -13
- package/dist/legacy/components/SecuritySchemeScopes.vue.d.ts.map +0 -1
- package/dist/legacy/components/SecuritySchemeScopes.vue.js +0 -7
- package/dist/legacy/components/SecuritySchemeScopes.vue2.js +0 -91
- package/dist/legacy/components/SecuritySchemeSelector.vue.d.ts +0 -11
- package/dist/legacy/components/SecuritySchemeSelector.vue.d.ts.map +0 -1
- package/dist/legacy/components/SecuritySchemeSelector.vue.js +0 -7
- package/dist/legacy/components/SecuritySchemeSelector.vue2.js +0 -96
- package/dist/legacy/helpers/createPlaceholderRequest.d.ts +0 -6
- package/dist/legacy/helpers/createPlaceholderRequest.d.ts.map +0 -1
- package/dist/legacy/helpers/encodeStringAsBase64.js +0 -6
- package/dist/legacy/helpers/getRequestFromAuthentication.d.ts +0 -10
- package/dist/legacy/helpers/getRequestFromAuthentication.d.ts.map +0 -1
- package/dist/legacy/helpers/getRequestFromAuthentication.js +0 -83
- package/dist/legacy/helpers/humanDiff.d.ts +0 -5
- package/dist/legacy/helpers/humanDiff.d.ts.map +0 -1
- package/dist/legacy/helpers/mapFromArray.d.ts +0 -5
- package/dist/legacy/helpers/mapFromArray.d.ts.map +0 -1
- package/dist/legacy/helpers/normalizeHeaderName.d.ts +0 -5
- package/dist/legacy/helpers/normalizeHeaderName.d.ts.map +0 -1
- package/dist/legacy/helpers/normalizeHeaderName.js +0 -6
- package/dist/legacy/helpers/normalizeHeaders.d.ts +0 -8
- package/dist/legacy/helpers/normalizeHeaders.d.ts.map +0 -1
- package/dist/legacy/helpers/normalizeHeaders.js +0 -22
- package/dist/legacy/helpers/normalizePath.d.ts +0 -5
- package/dist/legacy/helpers/normalizePath.d.ts.map +0 -1
- package/dist/legacy/helpers/normalizeUrl.d.ts +0 -5
- package/dist/legacy/helpers/normalizeUrl.d.ts.map +0 -1
- package/dist/legacy/helpers/prepareClientRequestConfig.d.ts +0 -24
- package/dist/legacy/helpers/prepareClientRequestConfig.d.ts.map +0 -1
- package/dist/legacy/stores/useAuthenticationStore.d.ts +0 -55
- package/dist/legacy/stores/useAuthenticationStore.d.ts.map +0 -1
- package/dist/legacy/stores/useAuthenticationStore.js +0 -36
- package/dist/legacy/stores/useOpenApiStore.d.ts +0 -125
- package/dist/legacy/stores/useOpenApiStore.d.ts.map +0 -1
- package/dist/legacy/stores/useOpenApiStore.js +0 -9
- package/dist/legacy/stores/useRequestStore.d.ts +0 -62
- package/dist/legacy/stores/useRequestStore.d.ts.map +0 -1
|
@@ -1,54 +1,49 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarCodeBlock as
|
|
3
|
-
import { createHash as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import ie from "./TextSelect.vue.js";
|
|
1
|
+
import { defineComponent as D, useId as M, computed as p, ref as z, watch as A, onServerPrefetch as G, useSSRContext as L, unref as o, openBlock as m, createBlock as v, withCtx as l, createVNode as r, createElementBlock as g, Fragment as V, createTextVNode as d, toDisplayString as h, createElementVNode as K, renderSlot as f, createCommentVNode as x } from "vue";
|
|
2
|
+
import { ScalarCodeBlock as Q } from "@scalar/components";
|
|
3
|
+
import { createHash as W, ssrState as X } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { asyncComputed as Y } from "@vueuse/core";
|
|
5
|
+
import H from "../../components/ScreenReader.vue.js";
|
|
6
|
+
import Z from "./ExamplePicker.vue.js";
|
|
7
|
+
import _ from "./TextSelect.vue.js";
|
|
9
8
|
/* empty css */
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
import { useServerStore as ve } from "../../legacy/stores/useServerStore.js";
|
|
20
|
-
import { useExampleStore as he } from "../../legacy/stores/useExampleStore.js";
|
|
21
|
-
import { useAuthenticationStore as ge } from "../../legacy/stores/useAuthenticationStore.js";
|
|
22
|
-
import { getUrlFromServerState as Se } from "../../legacy/helpers/getUrlFromServerState.js";
|
|
23
|
-
import { getHarRequest as Ke } from "../../helpers/getHarRequest.js";
|
|
24
|
-
const xe = ["id"], Ce = ["id"], ke = {
|
|
9
|
+
import N from "../../components/Card/Card.vue.js";
|
|
10
|
+
import ee from "../../components/Card/CardHeader.vue.js";
|
|
11
|
+
import B from "../../components/HttpMethod/HttpMethod.vue.js";
|
|
12
|
+
import O from "../../components/Card/CardContent.vue.js";
|
|
13
|
+
import te from "../../components/Card/CardFooter.vue.js";
|
|
14
|
+
import { getExampleCode as ae } from "../../helpers/getExampleCode.js";
|
|
15
|
+
import { useHttpClientStore as oe } from "../../stores/useHttpClientStore.js";
|
|
16
|
+
import { useExampleStore as le } from "../../legacy/stores/useExampleStore.js";
|
|
17
|
+
const re = ["id"], se = ["id"], ne = {
|
|
25
18
|
key: 0,
|
|
26
19
|
class: "request-card-footer-addon"
|
|
27
|
-
},
|
|
20
|
+
}, ie = { class: "request-header" }, qe = /* @__PURE__ */ D({
|
|
28
21
|
__name: "ExampleRequest",
|
|
29
22
|
props: {
|
|
30
23
|
operation: {},
|
|
24
|
+
request: {},
|
|
25
|
+
secretCredentials: {},
|
|
31
26
|
fallback: { type: Boolean }
|
|
32
27
|
},
|
|
33
|
-
setup(
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
)}`, { selectedExampleKey:
|
|
28
|
+
setup(n) {
|
|
29
|
+
const C = `components-Content-Operation-Example-Request${W(
|
|
30
|
+
n.operation.path + n.operation.httpVerb + n.operation.operationId
|
|
31
|
+
)}`, { selectedExampleKey: T, operationId: j } = le(), {
|
|
37
32
|
httpClient: i,
|
|
38
|
-
setHttpClient:
|
|
39
|
-
availableTargets:
|
|
40
|
-
httpTargetTitle:
|
|
41
|
-
httpClientTitle:
|
|
42
|
-
} =
|
|
33
|
+
setHttpClient: w,
|
|
34
|
+
availableTargets: k,
|
|
35
|
+
httpTargetTitle: R,
|
|
36
|
+
httpClientTitle: I
|
|
37
|
+
} = oe(), y = M(), u = p(() => {
|
|
43
38
|
var t;
|
|
44
39
|
const e = ["x-custom-examples", "x-codeSamples", "x-code-samples"];
|
|
45
|
-
for (const
|
|
46
|
-
if ((t =
|
|
47
|
-
return [...
|
|
40
|
+
for (const a of e)
|
|
41
|
+
if ((t = n.operation.information) != null && t[a])
|
|
42
|
+
return [...n.operation.information[a]];
|
|
48
43
|
return [];
|
|
49
|
-
}),
|
|
44
|
+
}), s = z(
|
|
50
45
|
// Default to first custom example
|
|
51
|
-
|
|
46
|
+
u.value.length ? {
|
|
52
47
|
targetKey: "customExamples",
|
|
53
48
|
clientKey: 0
|
|
54
49
|
} : (
|
|
@@ -59,214 +54,193 @@ const xe = ["id"], Ce = ["id"], ke = {
|
|
|
59
54
|
}
|
|
60
55
|
)
|
|
61
56
|
);
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
A(i, () => {
|
|
58
|
+
s.value = {
|
|
64
59
|
targetKey: i.targetKey,
|
|
65
60
|
clientKey: i.clientKey
|
|
66
61
|
};
|
|
67
62
|
});
|
|
68
|
-
const
|
|
63
|
+
const E = p(
|
|
69
64
|
() => {
|
|
70
|
-
var e, t,
|
|
65
|
+
var e, t, a, c;
|
|
71
66
|
return Object.keys(
|
|
72
|
-
((
|
|
67
|
+
((c = (a = (t = (e = n.operation.information) == null ? void 0 : e.requestBody) == null ? void 0 : t.content) == null ? void 0 : a["application/json"]) == null ? void 0 : c.examples) ?? {}
|
|
73
68
|
).length > 1;
|
|
74
69
|
}
|
|
75
|
-
),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const e =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return z;
|
|
84
|
-
}), t = Ke(
|
|
85
|
-
{
|
|
86
|
-
url: e.value
|
|
87
|
-
},
|
|
88
|
-
se(
|
|
89
|
-
l.operation,
|
|
90
|
-
{
|
|
91
|
-
replaceVariables: !0
|
|
92
|
-
},
|
|
93
|
-
q.value,
|
|
94
|
-
!0
|
|
95
|
-
),
|
|
96
|
-
ce(
|
|
97
|
-
V,
|
|
98
|
-
((d = l.operation.information) == null ? void 0 : d.security) ?? (g == null ? void 0 : g())
|
|
99
|
-
)
|
|
100
|
-
), o = i.clientKey, u = i.targetKey;
|
|
101
|
-
return await fe(t, u, o) ?? "";
|
|
102
|
-
}
|
|
103
|
-
const O = le(async () => {
|
|
70
|
+
), S = async () => {
|
|
71
|
+
var a;
|
|
72
|
+
if (s.value.targetKey === "customExamples")
|
|
73
|
+
return ((a = u.value[s.value.clientKey]) == null ? void 0 : a.source) ?? "";
|
|
74
|
+
if (!n.request) return "";
|
|
75
|
+
const e = i.clientKey, t = i.targetKey;
|
|
76
|
+
return await ae(n.request, t, e) ?? "";
|
|
77
|
+
}, b = Y(async () => {
|
|
104
78
|
try {
|
|
105
|
-
return await
|
|
79
|
+
return await S();
|
|
106
80
|
} catch (e) {
|
|
107
81
|
return console.error("[generateSnippet]", e), "";
|
|
108
82
|
}
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
const e =
|
|
112
|
-
e.payload.data[
|
|
83
|
+
}, X[C] ?? "");
|
|
84
|
+
G(async () => {
|
|
85
|
+
const e = L();
|
|
86
|
+
e.payload.data[C] = await S();
|
|
113
87
|
});
|
|
114
|
-
const
|
|
115
|
-
var t,
|
|
88
|
+
const J = p(() => {
|
|
89
|
+
var t, a;
|
|
116
90
|
const e = (
|
|
117
91
|
// Specified language
|
|
118
|
-
((t =
|
|
92
|
+
((t = s.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((a = u.value[s.value.clientKey]) == null ? void 0 : a.lang) ?? "plaintext" : (
|
|
119
93
|
// Or language for the globally selected HTTP client
|
|
120
94
|
i.targetKey
|
|
121
95
|
)
|
|
122
96
|
);
|
|
123
|
-
return e === "shell" &&
|
|
124
|
-
}),
|
|
125
|
-
const e =
|
|
97
|
+
return e === "shell" && b.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
|
|
98
|
+
}), P = p(() => {
|
|
99
|
+
const e = k.value.map((t) => ({
|
|
126
100
|
value: t.key,
|
|
127
101
|
label: t.title,
|
|
128
|
-
options: t.clients.map((
|
|
102
|
+
options: t.clients.map((a) => ({
|
|
129
103
|
value: JSON.stringify({
|
|
130
104
|
targetKey: t.key,
|
|
131
|
-
clientKey:
|
|
105
|
+
clientKey: a.key
|
|
132
106
|
}),
|
|
133
|
-
label:
|
|
107
|
+
label: a.title
|
|
134
108
|
}))
|
|
135
109
|
}));
|
|
136
|
-
return
|
|
110
|
+
return u.value.length && e.unshift({
|
|
137
111
|
value: "customExamples",
|
|
138
112
|
label: "Examples",
|
|
139
|
-
options:
|
|
113
|
+
options: u.value.map((t, a) => ({
|
|
140
114
|
value: JSON.stringify({
|
|
141
115
|
targetKey: "customExamples",
|
|
142
|
-
clientKey:
|
|
116
|
+
clientKey: a
|
|
143
117
|
}),
|
|
144
|
-
label: t.label ?? t.lang ?? `Example #${
|
|
118
|
+
label: t.label ?? t.lang ?? `Example #${a + 1}`
|
|
145
119
|
}))
|
|
146
120
|
}), e;
|
|
147
121
|
});
|
|
148
|
-
function
|
|
122
|
+
function F(e) {
|
|
149
123
|
const t = JSON.parse(e);
|
|
150
|
-
t.targetKey === "customExamples" ?
|
|
124
|
+
t.targetKey === "customExamples" ? s.value = t : w(t);
|
|
151
125
|
}
|
|
152
|
-
return (e, t) =>
|
|
126
|
+
return (e, t) => o(k).length || u.value.length ? (m(), v(o(N), {
|
|
153
127
|
key: 0,
|
|
154
128
|
class: "dark-mode"
|
|
155
129
|
}, {
|
|
156
|
-
default:
|
|
157
|
-
|
|
158
|
-
actions:
|
|
159
|
-
|
|
130
|
+
default: l(() => [
|
|
131
|
+
r(o(ee), { muted: "" }, {
|
|
132
|
+
actions: l(() => [
|
|
133
|
+
r(_, {
|
|
160
134
|
class: "request-client-picker",
|
|
161
|
-
controls: `${
|
|
162
|
-
modelValue: JSON.stringify(
|
|
163
|
-
options:
|
|
164
|
-
"onUpdate:modelValue":
|
|
135
|
+
controls: `${o(y)}-example`,
|
|
136
|
+
modelValue: JSON.stringify(s.value),
|
|
137
|
+
options: P.value,
|
|
138
|
+
"onUpdate:modelValue": F
|
|
165
139
|
}, {
|
|
166
|
-
default:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
default:
|
|
170
|
-
|
|
140
|
+
default: l(() => [
|
|
141
|
+
s.value.targetKey === "customExamples" ? (m(), g(V, { key: 0 }, [
|
|
142
|
+
r(H, null, {
|
|
143
|
+
default: l(() => t[1] || (t[1] = [
|
|
144
|
+
d("Selected Example:")
|
|
171
145
|
])),
|
|
172
146
|
_: 1
|
|
173
147
|
}),
|
|
174
|
-
|
|
175
|
-
], 64)) : (
|
|
176
|
-
|
|
177
|
-
default:
|
|
178
|
-
|
|
148
|
+
d(" " + h(u.value[s.value.clientKey].label ?? "Example"), 1)
|
|
149
|
+
], 64)) : (m(), g(V, { key: 1 }, [
|
|
150
|
+
r(H, null, {
|
|
151
|
+
default: l(() => t[2] || (t[2] = [
|
|
152
|
+
d("Selected HTTP client:")
|
|
179
153
|
])),
|
|
180
154
|
_: 1
|
|
181
155
|
}),
|
|
182
|
-
|
|
156
|
+
d(" " + h(o(R)) + " " + h(o(I)), 1)
|
|
183
157
|
], 64))
|
|
184
158
|
]),
|
|
185
159
|
_: 1
|
|
186
160
|
}, 8, ["controls", "modelValue", "options"])
|
|
187
161
|
]),
|
|
188
|
-
default:
|
|
189
|
-
|
|
190
|
-
id: `${
|
|
162
|
+
default: l(() => [
|
|
163
|
+
K("div", {
|
|
164
|
+
id: `${o(y)}-header`,
|
|
191
165
|
class: "request-header"
|
|
192
166
|
}, [
|
|
193
|
-
|
|
167
|
+
r(o(B), {
|
|
194
168
|
as: "span",
|
|
195
169
|
class: "request-method",
|
|
196
170
|
method: e.operation.httpVerb
|
|
197
171
|
}, null, 8, ["method"]),
|
|
198
|
-
|
|
199
|
-
], 8,
|
|
172
|
+
f(e.$slots, "header", {}, void 0, !0)
|
|
173
|
+
], 8, re)
|
|
200
174
|
]),
|
|
201
175
|
_: 3
|
|
202
176
|
}),
|
|
203
|
-
|
|
177
|
+
r(o(O), {
|
|
204
178
|
borderless: "",
|
|
205
179
|
class: "request-editor-section custom-scroll",
|
|
206
180
|
frameless: ""
|
|
207
181
|
}, {
|
|
208
|
-
default:
|
|
209
|
-
|
|
210
|
-
id: `${
|
|
182
|
+
default: l(() => [
|
|
183
|
+
K("div", {
|
|
184
|
+
id: `${o(y)}-example`,
|
|
211
185
|
class: "code-snippet"
|
|
212
186
|
}, [
|
|
213
|
-
|
|
187
|
+
r(o(Q), {
|
|
214
188
|
class: "bg-b-2",
|
|
215
|
-
content:
|
|
216
|
-
hideCredentials:
|
|
217
|
-
lang:
|
|
189
|
+
content: o(b),
|
|
190
|
+
hideCredentials: e.secretCredentials,
|
|
191
|
+
lang: J.value,
|
|
218
192
|
lineNumbers: ""
|
|
219
193
|
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
220
|
-
], 8,
|
|
194
|
+
], 8, se)
|
|
221
195
|
]),
|
|
222
196
|
_: 1
|
|
223
197
|
}),
|
|
224
|
-
|
|
198
|
+
E.value || e.$slots.footer ? (m(), v(o(te), {
|
|
225
199
|
key: 0,
|
|
226
200
|
class: "request-card-footer",
|
|
227
201
|
contrast: ""
|
|
228
202
|
}, {
|
|
229
|
-
default:
|
|
230
|
-
var
|
|
203
|
+
default: l(() => {
|
|
204
|
+
var a, c, q, $;
|
|
231
205
|
return [
|
|
232
|
-
|
|
233
|
-
|
|
206
|
+
E.value ? (m(), g("div", ne, [
|
|
207
|
+
r(Z, {
|
|
234
208
|
class: "request-example-selector",
|
|
235
|
-
examples: ((
|
|
236
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
209
|
+
examples: (($ = (q = (c = (a = e.operation.information) == null ? void 0 : a.requestBody) == null ? void 0 : c.content) == null ? void 0 : q["application/json"]) == null ? void 0 : $.examples) ?? [],
|
|
210
|
+
"onUpdate:modelValue": t[0] || (t[0] = (U) => (T.value = U, j.value = e.operation.operationId))
|
|
237
211
|
}, null, 8, ["examples"])
|
|
238
|
-
])) :
|
|
239
|
-
|
|
212
|
+
])) : x("", !0),
|
|
213
|
+
f(e.$slots, "footer", {}, void 0, !0)
|
|
240
214
|
];
|
|
241
215
|
}),
|
|
242
216
|
_: 3
|
|
243
|
-
})) :
|
|
217
|
+
})) : x("", !0)
|
|
244
218
|
]),
|
|
245
219
|
_: 3
|
|
246
|
-
})) : e.fallback ? (
|
|
220
|
+
})) : e.fallback ? (m(), v(o(N), {
|
|
247
221
|
key: 1,
|
|
248
222
|
class: "dark-mode"
|
|
249
223
|
}, {
|
|
250
|
-
default:
|
|
251
|
-
|
|
252
|
-
default:
|
|
253
|
-
|
|
254
|
-
|
|
224
|
+
default: l(() => [
|
|
225
|
+
r(o(O), { class: "request-card-simple" }, {
|
|
226
|
+
default: l(() => [
|
|
227
|
+
K("div", ie, [
|
|
228
|
+
r(o(B), {
|
|
255
229
|
as: "span",
|
|
256
230
|
class: "request-method",
|
|
257
231
|
method: e.operation.httpVerb
|
|
258
232
|
}, null, 8, ["method"]),
|
|
259
|
-
|
|
233
|
+
f(e.$slots, "header", {}, void 0, !0)
|
|
260
234
|
]),
|
|
261
|
-
|
|
235
|
+
f(e.$slots, "footer", {}, void 0, !0)
|
|
262
236
|
]),
|
|
263
237
|
_: 3
|
|
264
238
|
})
|
|
265
239
|
]),
|
|
266
240
|
_: 3
|
|
267
|
-
})) :
|
|
241
|
+
})) : x("", !0);
|
|
268
242
|
}
|
|
269
243
|
});
|
|
270
244
|
export {
|
|
271
|
-
|
|
245
|
+
qe as default
|
|
272
246
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { type WorkspaceStore } from '@scalar/api-client/store';
|
|
1
2
|
import type { TransformedOperation } from '@scalar/types/legacy';
|
|
2
3
|
type __VLS_Props = {
|
|
3
4
|
id?: string;
|
|
4
|
-
operation: TransformedOperation;
|
|
5
5
|
layout?: 'modern' | 'classic';
|
|
6
|
+
operation: TransformedOperation;
|
|
7
|
+
requests: WorkspaceStore['requests'];
|
|
8
|
+
requestExamples: WorkspaceStore['requestExamples'];
|
|
9
|
+
securitySchemes: WorkspaceStore['securitySchemes'];
|
|
6
10
|
};
|
|
7
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
8
|
-
layout: "modern" | "classic";
|
|
9
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
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>;
|
|
10
12
|
export default _default;
|
|
11
13
|
//# sourceMappingURL=Operation.vue.d.ts.map
|
|
@@ -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":"AAwDA,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAQhE,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC7B,SAAS,EAAE,oBAAoB,CAAA;IAC/B,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;IACpC,eAAe,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAClD,eAAe,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;CACnD,CAAC;;AA0FF,wBAMG"}
|
|
@@ -1,25 +1,42 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { defineComponent as c, openBlock as i, createBlock as a, unref as r } from "vue";
|
|
2
|
+
import { useActiveEntities as l } from "@scalar/api-client/store";
|
|
3
|
+
import { useRequestExample as m } from "./hooks/useRequestExample.js";
|
|
4
|
+
import p from "./layouts/ClassicLayout.vue.js";
|
|
5
|
+
import d from "./layouts/ModernLayout.vue.js";
|
|
6
|
+
const h = /* @__PURE__ */ c({
|
|
5
7
|
__name: "Operation",
|
|
6
8
|
props: {
|
|
7
9
|
id: {},
|
|
10
|
+
layout: { default: "modern" },
|
|
8
11
|
operation: {},
|
|
9
|
-
|
|
12
|
+
requests: {},
|
|
13
|
+
requestExamples: {},
|
|
14
|
+
securitySchemes: {}
|
|
10
15
|
},
|
|
11
16
|
setup(t) {
|
|
12
|
-
|
|
17
|
+
const { activeCollection: n, activeServer: u } = l(), { request: o, secretCredentials: s } = m({
|
|
18
|
+
operation: t.operation,
|
|
19
|
+
collection: n,
|
|
20
|
+
requests: t.requests,
|
|
21
|
+
requestExamples: t.requestExamples,
|
|
22
|
+
securitySchemes: t.securitySchemes,
|
|
23
|
+
server: u
|
|
24
|
+
});
|
|
25
|
+
return (e, q) => e.layout === "classic" ? (i(), a(p, {
|
|
13
26
|
key: 0,
|
|
14
|
-
id:
|
|
15
|
-
operation:
|
|
16
|
-
|
|
27
|
+
id: e.id,
|
|
28
|
+
operation: e.operation,
|
|
29
|
+
request: r(o),
|
|
30
|
+
secretCredentials: r(s)
|
|
31
|
+
}, null, 8, ["id", "operation", "request", "secretCredentials"])) : (i(), a(d, {
|
|
17
32
|
key: 1,
|
|
18
|
-
id:
|
|
19
|
-
operation:
|
|
20
|
-
|
|
33
|
+
id: e.id,
|
|
34
|
+
operation: e.operation,
|
|
35
|
+
request: r(o),
|
|
36
|
+
secretCredentials: r(s)
|
|
37
|
+
}, null, 8, ["id", "operation", "request", "secretCredentials"]));
|
|
21
38
|
}
|
|
22
39
|
});
|
|
23
40
|
export {
|
|
24
|
-
|
|
41
|
+
h as default
|
|
25
42
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/api-client/store';
|
|
2
|
+
import type { Collection, Server } from '@scalar/oas-utils/entities/spec';
|
|
3
|
+
import type { TransformedOperation } from '@scalar/types/legacy';
|
|
4
|
+
import { type ComputedRef } from 'vue';
|
|
5
|
+
/** Builds a request object for the code sniipet, as well as the security credentials to obfuscate */
|
|
6
|
+
export declare const useRequestExample: ({ operation, collection, requests, requestExamples, securitySchemes, server, }: {
|
|
7
|
+
operation: TransformedOperation;
|
|
8
|
+
collection: ComputedRef<Collection | undefined>;
|
|
9
|
+
requests: WorkspaceStore["requests"];
|
|
10
|
+
requestExamples: WorkspaceStore["requestExamples"];
|
|
11
|
+
securitySchemes: WorkspaceStore["securitySchemes"];
|
|
12
|
+
server: ComputedRef<Server>;
|
|
13
|
+
}) => {
|
|
14
|
+
request: ComputedRef<Request | null>;
|
|
15
|
+
secretCredentials: ComputedRef<string[]>;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useRequestExample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRequestExample.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/hooks/useRequestExample.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,KAAK,CAAA;AAEhD,qGAAqG;AACrG,eAAO,MAAM,iBAAiB,mFAO3B;IACD,SAAS,EAAE,oBAAoB,CAAA;IAC/B,UAAU,EAAE,WAAW,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAC/C,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;IACpC,eAAe,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAClD,eAAe,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAClD,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAC5B;;;CA6FA,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { getRequest as S } from "../../../helpers/get-request.js";
|
|
2
|
+
import { createRequestOperation as k } from "@scalar/api-client/libs";
|
|
3
|
+
import { computed as c } from "vue";
|
|
4
|
+
const w = ({
|
|
5
|
+
operation: p,
|
|
6
|
+
collection: d,
|
|
7
|
+
requests: v,
|
|
8
|
+
requestExamples: q,
|
|
9
|
+
securitySchemes: f,
|
|
10
|
+
server: b
|
|
11
|
+
}) => {
|
|
12
|
+
const o = c(
|
|
13
|
+
() => S(v, p.path, p.httpVerb)
|
|
14
|
+
), y = c(() => {
|
|
15
|
+
var n, u, a, l;
|
|
16
|
+
const t = ((n = o.value) == null ? void 0 : n.security) ?? ((u = d.value) == null ? void 0 : u.security) ?? [], s = t.filter(
|
|
17
|
+
(r) => Object.keys(r).length
|
|
18
|
+
), e = s.map((r) => Object.keys(r)[0]);
|
|
19
|
+
if (s.length < t.length)
|
|
20
|
+
return ((a = d.value) == null ? void 0 : a.selectedSecuritySchemeUids) ?? [];
|
|
21
|
+
{
|
|
22
|
+
const r = Object.values(f), g = e.map((m) => {
|
|
23
|
+
var i;
|
|
24
|
+
return (i = r.find((j) => j.nameKey === m)) == null ? void 0 : i.uid;
|
|
25
|
+
}).filter(Boolean);
|
|
26
|
+
return (l = d.value) == null ? void 0 : l.selectedSecuritySchemeUids.filter(
|
|
27
|
+
(m) => g.find((i) => i === m)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}), h = c(() => {
|
|
31
|
+
var u, a, l, r;
|
|
32
|
+
const t = q[((a = (u = o.value) == null ? void 0 : u.examples) == null ? void 0 : a[0]) ?? ""];
|
|
33
|
+
if (!o.value || !t) return null;
|
|
34
|
+
const [s, e] = k({
|
|
35
|
+
request: o.value,
|
|
36
|
+
example: t,
|
|
37
|
+
server: b.value,
|
|
38
|
+
securitySchemes: f,
|
|
39
|
+
selectedSecuritySchemeUids: y.value,
|
|
40
|
+
// TODO: env vars if we want em
|
|
41
|
+
environment: {},
|
|
42
|
+
// TODO: cookies if we want em
|
|
43
|
+
globalCookies: []
|
|
44
|
+
});
|
|
45
|
+
if (s)
|
|
46
|
+
return console.error("[useRequestExample]", s), null;
|
|
47
|
+
const n = Object.keys(
|
|
48
|
+
((r = (l = p.information) == null ? void 0 : l.requestBody) == null ? void 0 : r.content) ?? {}
|
|
49
|
+
);
|
|
50
|
+
return e.request.headers.get("content-type") === "text/plain;charset=UTF-8" && n.length && e.request.headers.set("content-type", n[0]), e.request;
|
|
51
|
+
}), O = c(
|
|
52
|
+
() => {
|
|
53
|
+
var t;
|
|
54
|
+
return ((t = y.value) == null ? void 0 : t.flatMap((s) => {
|
|
55
|
+
const e = f[s];
|
|
56
|
+
return (e == null ? void 0 : e.type) === "apiKey" ? e.value : (e == null ? void 0 : e.type) === "http" ? [
|
|
57
|
+
e.token,
|
|
58
|
+
e.password,
|
|
59
|
+
btoa(`${e.username}:${e.password}`)
|
|
60
|
+
] : (e == null ? void 0 : e.type) === "oauth2" ? Object.values(e.flows).map((n) => n.token) : [];
|
|
61
|
+
})) ?? [];
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
return { request: h, secretCredentials: O };
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
w as useRequestExample
|
|
68
|
+
};
|
|
@@ -2,6 +2,8 @@ import type { TransformedOperation } from '@scalar/types/legacy';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
id?: string;
|
|
4
4
|
operation: TransformedOperation;
|
|
5
|
+
request: Request | null;
|
|
6
|
+
secretCredentials: string[];
|
|
5
7
|
};
|
|
6
8
|
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>;
|
|
7
9
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassicLayout.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/layouts/ClassicLayout.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClassicLayout.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/layouts/ClassicLayout.vue"],"names":[],"mappings":"AAuSA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAShE,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,oBAAoB,CAAA;IAC/B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACvB,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAC5B,CAAC;;AAwPF,wBAOG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./ClassicLayout.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-040b254b"]]);
|
|
5
5
|
export {
|
|
6
6
|
m as default
|
|
7
7
|
};
|