@scalar/api-reference 1.31.8 → 1.31.9
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 +45 -0
- package/dist/browser/standalone.js +18613 -18470
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +10 -30
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +2 -2
- package/dist/components/ApiReferenceLayout.vue2.js +240 -222
- package/dist/components/Content/Content.vue.d.ts +2 -0
- package/dist/components/Content/Content.vue.d.ts.map +1 -1
- package/dist/components/Content/Content.vue.js +2 -2
- package/dist/components/Content/Content.vue2.js +84 -74
- package/dist/components/Content/Introduction/Introduction.vue.d.ts +1 -3
- package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
- package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
- package/dist/components/Content/Introduction/Introduction.vue2.js +93 -83
- package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
- package/dist/components/Content/Lazy/Loading.vue.js +84 -86
- package/dist/components/Content/Models/Models.vue.js +1 -1
- package/dist/components/Content/Models/Models.vue2.js +4 -4
- 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 +53 -53
- package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaDiscriminator.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue2.js +117 -112
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +2 -2
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +161 -191
- package/dist/components/Content/Schema/helpers/schema-name.d.ts +13 -0
- package/dist/components/Content/Schema/helpers/schema-name.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/schema-name.js +59 -13
- package/dist/components/Content/Tag/OperationsList.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/OperationsList.vue.js +1 -1
- package/dist/components/Content/Tag/OperationsList.vue2.js +22 -25
- package/dist/components/Content/Tag/OperationsListItem.vue.d.ts +2 -3
- package/dist/components/Content/Tag/OperationsListItem.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/OperationsListItem.vue.js +2 -2
- package/dist/components/Content/Tag/OperationsListItem.vue2.js +46 -47
- package/dist/components/Content/Tag/Tag.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/Tag.vue.js +45 -47
- package/dist/components/Content/Tag/TagList.vue.d.ts +2 -0
- package/dist/components/Content/Tag/TagList.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/TagList.vue.js +40 -41
- package/dist/components/Content/Tag/TagSection.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/TagSection.vue.js +2 -2
- package/dist/components/Content/Tag/TagSection.vue2.js +21 -21
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +16 -1
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.js +12 -11
- package/dist/components/MobileHeader.vue.d.ts +1 -8
- package/dist/components/MobileHeader.vue.d.ts.map +1 -1
- package/dist/components/MobileHeader.vue.js +1 -1
- package/dist/components/MobileHeader.vue2.js +19 -19
- package/dist/components/Section/Section.vue.js +2 -2
- package/dist/components/Section/Section.vue2.js +1 -1
- package/dist/components/ShowMoreButton.vue.js +2 -2
- package/dist/components/ShowMoreButton.vue2.js +1 -1
- package/dist/components/Sidebar/Sidebar.vue.d.ts +2 -4
- package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.vue.js +1 -1
- package/dist/components/Sidebar/Sidebar.vue2.js +113 -159
- package/dist/components/Sidebar/SidebarElement.vue.d.ts +2 -11
- package/dist/components/Sidebar/SidebarElement.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarElement.vue.js +2 -2
- package/dist/components/Sidebar/SidebarElement.vue2.js +85 -81
- package/dist/components/Sidebar/SidebarHttpBadge.vue.d.ts +16 -1
- package/dist/components/Sidebar/SidebarHttpBadge.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarHttpBadge.vue.js +2 -2
- package/dist/components/Sidebar/SidebarHttpBadge.vue2.js +11 -5
- package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/features/ApiClientModal/ApiClientModal.vue.js +54 -42
- package/dist/features/ApiClientModal/useApiClient.d.ts +74 -72
- package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
- package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts +0 -2
- package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts.map +1 -1
- package/dist/features/DocumentSource/hooks/useDocumentSource.js +40 -67
- package/dist/features/DownloadLink/DownloadLink.vue.js +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts +5 -5
- 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 +200 -179
- package/dist/features/Operation/Operation.vue.d.ts +0 -1
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js +31 -34
- package/dist/features/Operation/components/OperationParameters.vue.d.ts +3 -2
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js +62 -64
- package/dist/features/Operation/components/OperationResponses.vue.d.ts +1 -2
- package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationResponses.vue.js +2 -2
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
- package/dist/features/Operation/components/callbacks/Callback.vue2.js +31 -38
- package/dist/features/Operation/hooks/useResponses.d.ts +3 -3
- package/dist/features/Operation/hooks/useResponses.d.ts.map +1 -1
- package/dist/features/Operation/hooks/useResponses.js +12 -13
- package/dist/features/Operation/index.d.ts +0 -1
- package/dist/features/Operation/index.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +4 -6
- 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 +85 -72
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +2 -4
- 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 +114 -98
- package/dist/features/Search/SearchModal.vue.js +2 -2
- package/dist/features/Search/SearchModal.vue2.js +1 -1
- package/dist/features/Search/useSearchIndex.d.ts.map +1 -1
- package/dist/features/Search/useSearchIndex.js +61 -64
- package/dist/features/sidebar/helpers/create-sidebar.d.ts +4 -2
- package/dist/features/sidebar/helpers/create-sidebar.d.ts.map +1 -1
- package/dist/features/sidebar/helpers/create-sidebar.js +33 -0
- package/dist/features/sidebar/hooks/useSidebar.d.ts +2 -3
- package/dist/features/sidebar/hooks/useSidebar.d.ts.map +1 -1
- package/dist/features/sidebar/hooks/useSidebar.js +18 -0
- package/dist/features/sidebar/index.d.ts +2 -1
- package/dist/features/sidebar/index.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/get-tag.d.ts +4 -2
- package/dist/features/traverse-schema/helpers/get-tag.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/get-tag.js +7 -0
- package/dist/features/traverse-schema/helpers/traverse-description.js +33 -0
- package/dist/features/traverse-schema/helpers/traverse-document.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/traverse-document.js +34 -0
- package/dist/features/traverse-schema/helpers/traverse-paths.d.ts +5 -3
- package/dist/features/traverse-schema/helpers/traverse-paths.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/traverse-paths.js +32 -0
- package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts +2 -2
- package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/traverse-schemas.js +23 -0
- package/dist/features/traverse-schema/helpers/traverse-tags.d.ts +2 -2
- package/dist/features/traverse-schema/helpers/traverse-tags.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/traverse-tags.js +43 -0
- package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts +2 -2
- package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/traverse-webhooks.js +26 -0
- package/dist/features/traverse-schema/index.d.ts +3 -3
- package/dist/features/traverse-schema/index.d.ts.map +1 -1
- package/dist/features/traverse-schema/types.d.ts +8 -5
- package/dist/features/traverse-schema/types.d.ts.map +1 -1
- package/dist/helpers/parse.d.ts +2 -1
- package/dist/helpers/parse.d.ts.map +1 -1
- package/dist/helpers/parse.js +72 -88
- package/dist/hooks/useMultipleDocuments.d.ts +6 -6
- package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
- package/dist/hooks/useNavState.d.ts +1 -1
- package/dist/hooks/useNavState.d.ts.map +1 -1
- package/dist/hooks/useNavState.js +14 -9
- package/dist/hooks/useOperation.d.ts +7 -7
- package/dist/hooks/useOperation.d.ts.map +1 -1
- package/dist/hooks/useOperation.js +13 -12
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -25
- package/dist/legacy/fixtures/index.d.ts +1 -1
- package/dist/libs/openapi.d.ts +3 -4
- package/dist/libs/openapi.d.ts.map +1 -1
- package/dist/libs/openapi.js +8 -9
- package/dist/style.css +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.d.ts +4 -18
- package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.js +68 -45
- package/package.json +16 -16
- package/dist/components/Content/Webhooks/index.d.ts +0 -2
- package/dist/components/Content/Webhooks/index.d.ts.map +0 -1
- package/dist/features/Operation/Webhooks.vue.d.ts +0 -7
- package/dist/features/Operation/Webhooks.vue.d.ts.map +0 -1
- package/dist/features/Operation/Webhooks.vue.js +0 -7
- package/dist/features/Operation/Webhooks.vue2.js +0 -121
- package/dist/features/Operation/components/Webhook.vue.d.ts +0 -7
- package/dist/features/Operation/components/Webhook.vue.d.ts.map +0 -1
- package/dist/features/Operation/components/Webhook.vue.js +0 -7
- package/dist/features/Operation/components/Webhook.vue2.js +0 -29
- package/dist/features/traverse-schema/helpers/operation-id-params.d.ts +0 -8
- package/dist/features/traverse-schema/helpers/operation-id-params.d.ts.map +0 -1
- package/dist/features/traverse-schema/helpers/operation-id-params.js +0 -8
- package/dist/hooks/useSidebar.d.ts +0 -53
- package/dist/hooks/useSidebar.d.ts.map +0 -1
- package/dist/hooks/useSidebar.js +0 -248
- package/dist/legacy/fixtures/httpRequestMethods.js +0 -14
|
@@ -1,125 +1,145 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useWorkspace as
|
|
3
|
-
import { getSnippet as
|
|
4
|
-
import { filterSecurityRequirements as
|
|
5
|
-
import { ScalarCodeBlock as
|
|
6
|
-
import { freezeElement as
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
1
|
+
import { defineComponent as pe, useId as fe, ref as R, inject as Q, computed as c, watch as Y, onMounted as ye, createBlock as w, createCommentVNode as J, unref as r, openBlock as g, withCtx as s, createVNode as n, createElementVNode as U, renderSlot as N, createTextVNode as K, createElementBlock as D, Fragment as Z, toDisplayString as I } from "vue";
|
|
2
|
+
import { useWorkspace as ve } from "@scalar/api-client/store";
|
|
3
|
+
import { getSnippet as ge } from "@scalar/api-client/views/Components/CodeSnippet";
|
|
4
|
+
import { filterSecurityRequirements as xe } from "@scalar/api-client/views/Request/RequestSection";
|
|
5
|
+
import { ScalarCodeBlock as he } from "@scalar/components";
|
|
6
|
+
import { freezeElement as qe } from "@scalar/helpers/dom/freeze-element";
|
|
7
|
+
import { requestSchema as Ee, createExampleFromRequest as Ke } from "@scalar/oas-utils/entities/spec";
|
|
8
|
+
import { isDereferenced as be } from "@scalar/openapi-types/helpers";
|
|
9
|
+
import H from "../../components/ScreenReader.vue.js";
|
|
10
|
+
import { useConfig as Se } from "../../hooks/useConfig.js";
|
|
11
|
+
import { EXAMPLE_CONTEXT as ke, DISCRIMINATOR_CONTEXT as Ce } from "../../hooks/useDiscriminator.js";
|
|
12
|
+
import { useHttpClientStore as Oe } from "../../stores/useHttpClientStore.js";
|
|
13
|
+
import Ne from "./ExamplePicker.vue.js";
|
|
14
|
+
import $e from "./TextSelect.vue.js";
|
|
13
15
|
/* empty css */
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { useExampleStore as
|
|
20
|
-
const
|
|
16
|
+
import _ from "../../components/Card/Card.vue.js";
|
|
17
|
+
import Te from "../../components/Card/CardHeader.vue.js";
|
|
18
|
+
import ee from "../../components/HttpMethod/HttpMethod.vue.js";
|
|
19
|
+
import te from "../../components/Card/CardContent.vue.js";
|
|
20
|
+
import Ve from "../../components/Card/CardFooter.vue.js";
|
|
21
|
+
import { useExampleStore as Be } from "../../legacy/stores/useExampleStore.js";
|
|
22
|
+
const je = ["id"], Re = ["id"], we = {
|
|
21
23
|
key: 0,
|
|
22
24
|
class: "request-card-footer-addon"
|
|
23
|
-
},
|
|
25
|
+
}, Je = { class: "request-header" }, rt = /* @__PURE__ */ pe({
|
|
24
26
|
__name: "ExampleRequest",
|
|
25
27
|
props: {
|
|
26
|
-
operation: {},
|
|
27
28
|
server: {},
|
|
28
29
|
collection: {},
|
|
30
|
+
operation: {},
|
|
31
|
+
request: {},
|
|
32
|
+
method: {},
|
|
29
33
|
fallback: { type: Boolean },
|
|
30
|
-
transformedOperation: {},
|
|
31
34
|
schemas: {}
|
|
32
35
|
},
|
|
33
|
-
setup(
|
|
34
|
-
const { selectedExampleKey:
|
|
35
|
-
httpClient:
|
|
36
|
-
setHttpClient:
|
|
37
|
-
availableTargets:
|
|
38
|
-
httpTargetTitle:
|
|
39
|
-
httpClientTitle:
|
|
40
|
-
} =
|
|
36
|
+
setup(l) {
|
|
37
|
+
const { selectedExampleKey: M, operationId: ae } = Be(), { requestExamples: b, securitySchemes: A, requestExampleMutators: $ } = ve(), le = Se(), {
|
|
38
|
+
httpClient: u,
|
|
39
|
+
setHttpClient: re,
|
|
40
|
+
availableTargets: F,
|
|
41
|
+
httpTargetTitle: oe,
|
|
42
|
+
httpClientTitle: se
|
|
43
|
+
} = Oe(), S = fe(), x = R(!1), k = Q(ke), y = Q(Ce), T = c(() => {
|
|
41
44
|
var e;
|
|
42
|
-
return (e =
|
|
43
|
-
}),
|
|
45
|
+
return (e = y == null ? void 0 : y.value) == null ? void 0 : e.selectedType;
|
|
46
|
+
}), P = c(
|
|
44
47
|
() => {
|
|
45
48
|
var e;
|
|
46
|
-
return ((e =
|
|
49
|
+
return ((e = y == null ? void 0 : y.value) == null ? void 0 : e.hasDiscriminator) || !1;
|
|
47
50
|
}
|
|
48
|
-
),
|
|
51
|
+
), d = c(() => {
|
|
49
52
|
var t;
|
|
50
53
|
const e = ["x-custom-examples", "x-codeSamples", "x-code-samples"];
|
|
51
54
|
for (const a of e)
|
|
52
|
-
if ((t =
|
|
53
|
-
return [...
|
|
55
|
+
if ((t = l.operation) != null && t[a])
|
|
56
|
+
return [...l.operation[a]];
|
|
54
57
|
return [];
|
|
55
|
-
}),
|
|
58
|
+
}), o = R(
|
|
56
59
|
// Default to first custom example
|
|
57
|
-
|
|
60
|
+
d.value.length ? {
|
|
58
61
|
targetKey: "customExamples",
|
|
59
62
|
clientKey: 0
|
|
60
63
|
} : (
|
|
61
64
|
// Otherwise use the globally selected HTTP client
|
|
62
65
|
{
|
|
63
|
-
targetKey:
|
|
64
|
-
clientKey:
|
|
66
|
+
targetKey: u.targetKey,
|
|
67
|
+
clientKey: u.clientKey
|
|
65
68
|
}
|
|
66
69
|
)
|
|
67
70
|
);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
targetKey:
|
|
71
|
-
clientKey:
|
|
71
|
+
Y(u, () => {
|
|
72
|
+
o.value = {
|
|
73
|
+
targetKey: u.targetKey,
|
|
74
|
+
clientKey: u.clientKey
|
|
72
75
|
};
|
|
73
76
|
});
|
|
74
|
-
const
|
|
75
|
-
const e =
|
|
77
|
+
const X = c(() => {
|
|
78
|
+
const e = C.value;
|
|
76
79
|
return Object.keys(e).length > 1;
|
|
77
|
-
}),
|
|
78
|
-
var
|
|
79
|
-
if (
|
|
80
|
-
return ((
|
|
81
|
-
const e =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
}), ne = () => {
|
|
81
|
+
var h, q, E;
|
|
82
|
+
if (o.value.targetKey === "customExamples")
|
|
83
|
+
return ((h = d.value[o.value.clientKey]) == null ? void 0 : h.source) ?? "";
|
|
84
|
+
const e = u.clientKey, t = u.targetKey, a = l.request || Ee.parse({
|
|
85
|
+
uid: l.operation.operationId || "temp-request",
|
|
86
|
+
method: l.method,
|
|
87
|
+
path: l.operation.path,
|
|
88
|
+
parameters: l.operation.parameters || [],
|
|
89
|
+
requestBody: l.operation.requestBody,
|
|
90
|
+
examples: [],
|
|
91
|
+
type: "request",
|
|
92
|
+
selectedSecuritySchemeUids: [],
|
|
93
|
+
selectedServerUid: "",
|
|
94
|
+
servers: [],
|
|
95
|
+
summary: l.operation.summary || "Example Request"
|
|
96
|
+
});
|
|
97
|
+
let i = b[((E = (q = l.request) == null ? void 0 : q.examples) == null ? void 0 : E[0]) ?? ""];
|
|
98
|
+
if (!i) {
|
|
99
|
+
const m = C.value, B = Object.keys(m)[0];
|
|
100
|
+
i = Ke(a, B);
|
|
101
|
+
}
|
|
102
|
+
const p = xe(
|
|
103
|
+
l.operation.security || l.collection.security,
|
|
104
|
+
l.collection.selectedSecuritySchemeUids,
|
|
105
|
+
A
|
|
106
|
+
), [f, O] = ge(t, e, {
|
|
107
|
+
operation: l.request,
|
|
108
|
+
example: i,
|
|
109
|
+
server: l.server,
|
|
110
|
+
securitySchemes: p
|
|
93
111
|
});
|
|
94
|
-
return
|
|
95
|
-
},
|
|
112
|
+
return f ? f.message ?? "" : O;
|
|
113
|
+
}, z = c(() => {
|
|
96
114
|
try {
|
|
97
|
-
return
|
|
115
|
+
return ne();
|
|
98
116
|
} catch (e) {
|
|
99
117
|
return console.error("[generateSnippet]", e), "";
|
|
100
118
|
}
|
|
101
|
-
}),
|
|
102
|
-
var a
|
|
103
|
-
|
|
119
|
+
}), C = c(() => {
|
|
120
|
+
var a;
|
|
121
|
+
if (!be(l.operation.requestBody))
|
|
122
|
+
return {};
|
|
123
|
+
const e = ((a = l.operation.requestBody) == null ? void 0 : a.content) ?? {}, t = Object.values(e)[0];
|
|
104
124
|
return (t == null ? void 0 : t.examples) ?? {};
|
|
105
|
-
}),
|
|
125
|
+
}), ue = c(() => {
|
|
106
126
|
var t, a;
|
|
107
127
|
const e = (
|
|
108
128
|
// Specified language
|
|
109
|
-
((t =
|
|
129
|
+
((t = o.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((a = d.value[o.value.clientKey]) == null ? void 0 : a.lang) ?? "plaintext" : (
|
|
110
130
|
// Or language for the globally selected HTTP client
|
|
111
|
-
|
|
131
|
+
u.targetKey
|
|
112
132
|
)
|
|
113
133
|
);
|
|
114
|
-
return e === "shell" &&
|
|
115
|
-
}),
|
|
116
|
-
() => Object.values(
|
|
134
|
+
return e === "shell" && z.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
|
|
135
|
+
}), ie = c(
|
|
136
|
+
() => Object.values(A).flatMap((e) => e.type === "apiKey" ? e.value : (e == null ? void 0 : e.type) === "http" ? [
|
|
117
137
|
e.token,
|
|
118
138
|
e.password,
|
|
119
139
|
btoa(`${e.username}:${e.password}`)
|
|
120
140
|
] : e.type === "oauth2" ? Object.values(e.flows).map((t) => t.token) : [])
|
|
121
|
-
),
|
|
122
|
-
const e =
|
|
141
|
+
), ce = c(() => {
|
|
142
|
+
const e = F.value.map((t) => ({
|
|
123
143
|
value: t.key,
|
|
124
144
|
label: t.title,
|
|
125
145
|
options: t.clients.map((a) => ({
|
|
@@ -130,10 +150,10 @@ const qe = ["id"], Ne = ["id"], $e = {
|
|
|
130
150
|
label: a.title
|
|
131
151
|
}))
|
|
132
152
|
}));
|
|
133
|
-
return
|
|
153
|
+
return d.value.length && e.unshift({
|
|
134
154
|
value: "customExamples",
|
|
135
155
|
label: "Examples",
|
|
136
|
-
options:
|
|
156
|
+
options: d.value.map((t, a) => ({
|
|
137
157
|
value: JSON.stringify({
|
|
138
158
|
targetKey: "customExamples",
|
|
139
159
|
clientKey: a
|
|
@@ -141,198 +161,199 @@ const qe = ["id"], Ne = ["id"], $e = {
|
|
|
141
161
|
label: t.label ?? t.lang ?? `Example #${a + 1}`
|
|
142
162
|
}))
|
|
143
163
|
}), e;
|
|
144
|
-
}),
|
|
145
|
-
function
|
|
164
|
+
}), V = R(null);
|
|
165
|
+
function me(e) {
|
|
146
166
|
const t = JSON.parse(e);
|
|
147
|
-
if (
|
|
148
|
-
const a =
|
|
167
|
+
if (V.value) {
|
|
168
|
+
const a = qe(V.value.$el);
|
|
149
169
|
setTimeout(() => {
|
|
150
170
|
a();
|
|
151
171
|
}, 300);
|
|
152
172
|
}
|
|
153
|
-
t.targetKey === "customExamples" ||
|
|
173
|
+
t.targetKey === "customExamples" || o.value.targetKey === "customExamples" && t.targetKey === u.targetKey && t.clientKey === u.clientKey ? o.value = t : re(t);
|
|
154
174
|
}
|
|
155
|
-
function
|
|
156
|
-
|
|
157
|
-
|
|
175
|
+
function de(e) {
|
|
176
|
+
var i, p;
|
|
177
|
+
M.value = e, ae.value = l.operation.operationId;
|
|
178
|
+
const t = b[((p = (i = l.request) == null ? void 0 : i.examples) == null ? void 0 : p[0]) ?? ""], a = C.value[e];
|
|
158
179
|
if (t && (a != null && a.value))
|
|
159
180
|
try {
|
|
160
|
-
|
|
181
|
+
$.edit(
|
|
161
182
|
t.uid,
|
|
162
183
|
"body.raw.value",
|
|
163
184
|
JSON.stringify(a.value, null, 2)
|
|
164
185
|
);
|
|
165
|
-
} catch (
|
|
166
|
-
console.error("[handleExampleUpdate]",
|
|
186
|
+
} catch (f) {
|
|
187
|
+
console.error("[handleExampleUpdate]", f);
|
|
167
188
|
}
|
|
168
189
|
}
|
|
169
|
-
|
|
170
|
-
|
|
190
|
+
ye(() => {
|
|
191
|
+
P.value && T.value && !x.value && L(T.value);
|
|
171
192
|
});
|
|
172
|
-
const
|
|
173
|
-
var t, a,
|
|
174
|
-
if (!
|
|
193
|
+
const L = (e) => {
|
|
194
|
+
var t, a, i, p, f, O, h, q, E;
|
|
195
|
+
if (!x.value)
|
|
175
196
|
try {
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
179
|
-
const
|
|
180
|
-
Array.isArray(
|
|
197
|
+
x.value = !0;
|
|
198
|
+
const m = b[l.operation.examples[0]];
|
|
199
|
+
if (m && (k != null && k.generateExampleValue)) {
|
|
200
|
+
const B = (a = (t = m.body) == null ? void 0 : t.raw) != null && a.value ? JSON.parse(m.body.raw.value) : void 0, j = k.generateExampleValue(
|
|
201
|
+
Array.isArray(B)
|
|
181
202
|
);
|
|
182
|
-
if (
|
|
183
|
-
|
|
203
|
+
if ($.edit(
|
|
204
|
+
m.uid,
|
|
184
205
|
"body.raw.value",
|
|
185
|
-
JSON.stringify(
|
|
186
|
-
),
|
|
187
|
-
const f =
|
|
188
|
-
|
|
189
|
-
|
|
206
|
+
JSON.stringify(j, null, 2)
|
|
207
|
+
), (p = (i = l.request) == null ? void 0 : i.examples) != null && p[0]) {
|
|
208
|
+
const v = b[(O = (f = l.request) == null ? void 0 : f.examples) == null ? void 0 : O[0]];
|
|
209
|
+
v && $.edit(
|
|
210
|
+
v.uid,
|
|
190
211
|
"body.raw.value",
|
|
191
|
-
JSON.stringify(
|
|
212
|
+
JSON.stringify(j, null, 2)
|
|
192
213
|
);
|
|
193
214
|
}
|
|
194
|
-
if ((
|
|
195
|
-
const
|
|
196
|
-
Object.keys(
|
|
197
|
-
var
|
|
198
|
-
(
|
|
215
|
+
if ((E = (q = (h = l.operation.requestBody) == null ? void 0 : h.content) == null ? void 0 : q["application/json"]) != null && E.examples) {
|
|
216
|
+
const v = l.operation.requestBody.content["application/json"].examples;
|
|
217
|
+
Object.keys(v).forEach((W) => {
|
|
218
|
+
var G;
|
|
219
|
+
(G = v[W]) != null && G.value && (v[W].value = j);
|
|
199
220
|
});
|
|
200
221
|
}
|
|
201
222
|
}
|
|
202
|
-
} catch (
|
|
203
|
-
console.error("[handleDiscriminatorChange]",
|
|
223
|
+
} catch (m) {
|
|
224
|
+
console.error("[handleDiscriminatorChange]", m);
|
|
204
225
|
} finally {
|
|
205
|
-
|
|
226
|
+
x.value = !1;
|
|
206
227
|
}
|
|
207
228
|
};
|
|
208
|
-
return
|
|
209
|
-
e &&
|
|
210
|
-
}), (e, t) =>
|
|
229
|
+
return Y(T, (e) => {
|
|
230
|
+
e && P.value && !x.value && L();
|
|
231
|
+
}), (e, t) => r(F).length || d.value.length ? (g(), w(r(_), {
|
|
211
232
|
key: 0,
|
|
212
|
-
"aria-labelledby": `${
|
|
233
|
+
"aria-labelledby": `${r(S)}-header`,
|
|
213
234
|
class: "dark-mode",
|
|
214
235
|
ref_key: "elem",
|
|
215
|
-
ref:
|
|
236
|
+
ref: V,
|
|
216
237
|
role: "region"
|
|
217
238
|
}, {
|
|
218
|
-
default:
|
|
219
|
-
|
|
220
|
-
actions:
|
|
221
|
-
|
|
239
|
+
default: s(() => [
|
|
240
|
+
n(r(Te), { muted: "" }, {
|
|
241
|
+
actions: s(() => [
|
|
242
|
+
n($e, {
|
|
222
243
|
class: "request-client-picker",
|
|
223
|
-
controls: `${
|
|
224
|
-
modelValue: JSON.stringify(
|
|
225
|
-
options:
|
|
226
|
-
"onUpdate:modelValue":
|
|
244
|
+
controls: `${r(S)}-example`,
|
|
245
|
+
modelValue: JSON.stringify(o.value),
|
|
246
|
+
options: ce.value,
|
|
247
|
+
"onUpdate:modelValue": me
|
|
227
248
|
}, {
|
|
228
|
-
default:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
default:
|
|
232
|
-
|
|
249
|
+
default: s(() => [
|
|
250
|
+
o.value.targetKey === "customExamples" ? (g(), D(Z, { key: 0 }, [
|
|
251
|
+
n(H, null, {
|
|
252
|
+
default: s(() => t[1] || (t[1] = [
|
|
253
|
+
K("Selected Example:")
|
|
233
254
|
])),
|
|
234
255
|
_: 1
|
|
235
256
|
}),
|
|
236
|
-
|
|
237
|
-
], 64)) : (
|
|
238
|
-
|
|
239
|
-
default:
|
|
240
|
-
|
|
257
|
+
K(" " + I(d.value[o.value.clientKey].label ?? "Example"), 1)
|
|
258
|
+
], 64)) : (g(), D(Z, { key: 1 }, [
|
|
259
|
+
n(H, null, {
|
|
260
|
+
default: s(() => t[2] || (t[2] = [
|
|
261
|
+
K("Selected HTTP client:")
|
|
241
262
|
])),
|
|
242
263
|
_: 1
|
|
243
264
|
}),
|
|
244
|
-
|
|
265
|
+
K(" " + I(r(oe)) + " " + I(r(se)), 1)
|
|
245
266
|
], 64))
|
|
246
267
|
]),
|
|
247
268
|
_: 1
|
|
248
269
|
}, 8, ["controls", "modelValue", "options"])
|
|
249
270
|
]),
|
|
250
|
-
default:
|
|
251
|
-
|
|
252
|
-
id: `${
|
|
271
|
+
default: s(() => [
|
|
272
|
+
U("div", {
|
|
273
|
+
id: `${r(S)}-header`,
|
|
253
274
|
class: "request-header"
|
|
254
275
|
}, [
|
|
255
|
-
|
|
256
|
-
default:
|
|
257
|
-
|
|
276
|
+
n(H, null, {
|
|
277
|
+
default: s(() => t[0] || (t[0] = [
|
|
278
|
+
K("Request Example for")
|
|
258
279
|
])),
|
|
259
280
|
_: 1
|
|
260
281
|
}),
|
|
261
|
-
|
|
282
|
+
n(r(ee), {
|
|
262
283
|
as: "span",
|
|
263
284
|
class: "request-method",
|
|
264
|
-
method: e.
|
|
285
|
+
method: e.method
|
|
265
286
|
}, null, 8, ["method"]),
|
|
266
|
-
|
|
267
|
-
], 8,
|
|
287
|
+
N(e.$slots, "header", {}, void 0, !0)
|
|
288
|
+
], 8, je)
|
|
268
289
|
]),
|
|
269
290
|
_: 3
|
|
270
291
|
}),
|
|
271
|
-
|
|
292
|
+
n(r(te), {
|
|
272
293
|
borderless: "",
|
|
273
294
|
class: "request-editor-section custom-scroll",
|
|
274
295
|
frameless: ""
|
|
275
296
|
}, {
|
|
276
|
-
default:
|
|
277
|
-
|
|
278
|
-
id: `${
|
|
297
|
+
default: s(() => [
|
|
298
|
+
U("div", {
|
|
299
|
+
id: `${r(S)}-example`,
|
|
279
300
|
class: "code-snippet"
|
|
280
301
|
}, [
|
|
281
|
-
|
|
302
|
+
n(r(he), {
|
|
282
303
|
class: "bg-b-2 -outline-offset-2",
|
|
283
|
-
content:
|
|
284
|
-
hideCredentials:
|
|
285
|
-
lang:
|
|
304
|
+
content: z.value,
|
|
305
|
+
hideCredentials: ie.value,
|
|
306
|
+
lang: ue.value,
|
|
286
307
|
lineNumbers: ""
|
|
287
308
|
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
288
|
-
], 8,
|
|
309
|
+
], 8, Re)
|
|
289
310
|
]),
|
|
290
311
|
_: 1
|
|
291
312
|
}),
|
|
292
|
-
(
|
|
313
|
+
(X.value || !r(le).hideTestRequestButton) && e.$slots.footer ? (g(), w(r(Ve), {
|
|
293
314
|
key: 0,
|
|
294
315
|
class: "request-card-footer",
|
|
295
316
|
contrast: ""
|
|
296
317
|
}, {
|
|
297
|
-
default:
|
|
298
|
-
|
|
299
|
-
|
|
318
|
+
default: s(() => [
|
|
319
|
+
X.value ? (g(), D("div", we, [
|
|
320
|
+
n(Ne, {
|
|
300
321
|
class: "request-example-selector",
|
|
301
|
-
examples:
|
|
302
|
-
modelValue:
|
|
303
|
-
"onUpdate:modelValue":
|
|
322
|
+
examples: C.value,
|
|
323
|
+
modelValue: r(M),
|
|
324
|
+
"onUpdate:modelValue": de
|
|
304
325
|
}, null, 8, ["examples", "modelValue"])
|
|
305
|
-
])) :
|
|
306
|
-
|
|
326
|
+
])) : J("", !0),
|
|
327
|
+
N(e.$slots, "footer", {}, void 0, !0)
|
|
307
328
|
]),
|
|
308
329
|
_: 3
|
|
309
|
-
})) :
|
|
330
|
+
})) : J("", !0)
|
|
310
331
|
]),
|
|
311
332
|
_: 3
|
|
312
|
-
}, 8, ["aria-labelledby"])) : e.fallback ? (
|
|
333
|
+
}, 8, ["aria-labelledby"])) : e.fallback ? (g(), w(r(_), {
|
|
313
334
|
key: 1,
|
|
314
335
|
class: "dark-mode"
|
|
315
336
|
}, {
|
|
316
|
-
default:
|
|
317
|
-
|
|
318
|
-
default:
|
|
319
|
-
|
|
320
|
-
|
|
337
|
+
default: s(() => [
|
|
338
|
+
n(r(te), { class: "request-card-simple" }, {
|
|
339
|
+
default: s(() => [
|
|
340
|
+
U("div", Je, [
|
|
341
|
+
n(r(ee), {
|
|
321
342
|
as: "span",
|
|
322
343
|
class: "request-method",
|
|
323
|
-
method: e.
|
|
344
|
+
method: e.method
|
|
324
345
|
}, null, 8, ["method"]),
|
|
325
|
-
|
|
346
|
+
N(e.$slots, "header", {}, void 0, !0)
|
|
326
347
|
]),
|
|
327
|
-
|
|
348
|
+
N(e.$slots, "footer", {}, void 0, !0)
|
|
328
349
|
]),
|
|
329
350
|
_: 3
|
|
330
351
|
})
|
|
331
352
|
]),
|
|
332
353
|
_: 3
|
|
333
|
-
})) :
|
|
354
|
+
})) : J("", !0);
|
|
334
355
|
}
|
|
335
356
|
});
|
|
336
357
|
export {
|
|
337
|
-
|
|
358
|
+
rt as default
|
|
338
359
|
};
|
|
@@ -2,7 +2,6 @@ import type { Collection, Server } from '@scalar/oas-utils/entities/spec';
|
|
|
2
2
|
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
3
3
|
import type { TransformedOperation } from '@scalar/types/legacy';
|
|
4
4
|
type __VLS_Props = {
|
|
5
|
-
id?: string;
|
|
6
5
|
layout?: 'modern' | 'classic';
|
|
7
6
|
transformedOperation: TransformedOperation;
|
|
8
7
|
collection: Collection;
|
|
@@ -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":"AAiGA,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;AAYhE,KAAK,WAAW,GAAG;IACjB,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;;AA2JF,wBAMG"}
|