@scalar/api-reference 1.41.1 → 1.42.0
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 +41 -0
- package/dist/blocks/index.d.ts +0 -1
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/blocks/index.js +4 -6
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts +4 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.js +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue2.js +9 -13
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts +4 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.js +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue2.js +10 -9
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.d.ts +4 -0
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue2.js +4 -7
- package/dist/blocks/scalar-info-block/components/InfoBlock.vue.d.ts +7 -9
- package/dist/blocks/scalar-info-block/components/InfoBlock.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoBlock.vue.js +9 -6
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.d.ts +2 -9
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.js +13 -25
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.d.ts +8 -4
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.js +18 -41
- package/dist/browser/standalone.js +20335 -23246
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.d.ts +2 -254
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue2.js +71 -83
- package/dist/components/Content/Auth/Auth.vue.d.ts +17 -0
- package/dist/components/Content/Auth/Auth.vue.d.ts.map +1 -0
- package/dist/components/Content/Auth/Auth.vue.js +70 -0
- package/dist/components/Content/Auth/Auth.vue2.js +4 -0
- package/dist/components/Content/Auth/helpers/get-default-security.d.ts +18 -0
- package/dist/components/Content/Auth/helpers/get-default-security.d.ts.map +1 -0
- package/dist/components/Content/Auth/helpers/get-default-security.js +43 -0
- package/dist/components/Content/Auth/index.d.ts +2 -0
- package/dist/components/Content/Auth/index.d.ts.map +1 -0
- package/dist/components/Content/Content.vue.d.ts +9 -19
- package/dist/components/Content/Content.vue.d.ts.map +1 -1
- package/dist/components/Content/Content.vue.js +46 -47
- package/dist/components/Content/Models/Model.vue.d.ts +3 -6
- package/dist/components/Content/Models/Model.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/Model.vue.js +2 -2
- package/dist/components/Content/Models/ModelTag.vue.d.ts +2 -7
- package/dist/components/Content/Models/ModelTag.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/ModelTag.vue.js +3 -3
- package/dist/components/Content/Models/components/ClassicLayout.vue.d.ts +3 -5
- package/dist/components/Content/Models/components/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/components/ClassicLayout.vue.js +1 -1
- package/dist/components/Content/Models/components/ClassicLayout.vue2.js +2 -8
- package/dist/components/Content/Models/components/ModernLayout.vue.d.ts +1 -1
- package/dist/components/Content/Models/components/ModernLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +20 -25
- package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.js +38 -56
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/index.d.ts +0 -1
- package/dist/components/Content/index.d.ts.map +1 -1
- package/dist/components/ShowMoreButton.vue.d.ts +1 -4
- package/dist/components/ShowMoreButton.vue.d.ts.map +1 -1
- package/dist/components/ShowMoreButton.vue.js +1 -1
- package/dist/components/ShowMoreButton.vue2.js +7 -17
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +12 -14
- package/dist/features/Operation/Operation.vue.d.ts +23 -25
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js +28 -19
- package/dist/features/Operation/components/OperationParameters.vue.d.ts +2 -4
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js +17 -6
- package/dist/features/Operation/components/OperationResponses.vue.d.ts +3 -5
- package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationResponses.vue.js +3 -1
- package/dist/features/Operation/components/ParameterList.vue.d.ts +3 -6
- package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterList.vue.js +6 -8
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts +3 -6
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue2.js +6 -8
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +2 -4
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.js +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue2.js +1 -5
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +2 -8
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callbacks.vue.js +35 -24
- package/dist/features/Operation/helpers/filter-selected-security.d.ts +9 -0
- package/dist/features/Operation/helpers/filter-selected-security.d.ts.map +1 -0
- package/dist/features/Operation/helpers/filter-selected-security.js +27 -0
- package/dist/features/Operation/helpers/get-first-server.d.ts +1 -1
- package/dist/features/Operation/helpers/get-first-server.d.ts.map +1 -1
- package/dist/features/Operation/helpers/get-first-server.js +3 -3
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +7 -23
- 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 +24 -23
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +7 -23
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +25 -27
- package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponse.vue2.js +1 -2
- package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponses.vue2.js +1 -2
- package/dist/features/test-request-button/TestRequestButton.vue.d.ts +3 -0
- package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.js +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue2.js +5 -9
- package/dist/helpers/index.d.ts +0 -4
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +1 -9
- package/dist/helpers/map-config-plugins.d.ts +5 -0
- package/dist/helpers/map-config-plugins.d.ts.map +1 -0
- package/dist/helpers/map-config-plugins.js +29 -0
- package/dist/helpers/map-config-to-workspace-store.d.ts.map +1 -1
- package/dist/helpers/map-config-to-workspace-store.js +5 -0
- package/dist/helpers/map-configuration.d.ts +2 -2
- package/dist/helpers/storage.d.ts +347 -0
- package/dist/helpers/storage.d.ts.map +1 -0
- package/dist/helpers/storage.js +61 -0
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/plugins/persistance-plugin.d.ts +16 -0
- package/dist/plugins/persistance-plugin.d.ts.map +1 -0
- package/dist/plugins/persistance-plugin.js +54 -0
- package/dist/style.css +220 -542
- package/package.json +15 -15
- package/dist/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +0 -11
- package/dist/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +0 -1
- package/dist/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +0 -7
- package/dist/blocks/scalar-auth-selector-block/components/AuthSelector.vue2.js +0 -259
- package/dist/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts +0 -21
- package/dist/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +0 -1
- package/dist/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js +0 -66
- package/dist/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue2.js +0 -4
- package/dist/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +0 -17
- package/dist/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +0 -1
- package/dist/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +0 -273
- package/dist/blocks/scalar-auth-selector-block/components/OAuth2.vue2.js +0 -4
- package/dist/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +0 -9
- package/dist/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +0 -1
- package/dist/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +0 -150
- package/dist/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue2.js +0 -4
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +0 -20
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +0 -1
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +0 -7
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue2.js +0 -116
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +0 -50
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +0 -1
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.js +0 -55
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue2.js +0 -4
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +0 -17
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +0 -1
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +0 -288
- package/dist/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue2.js +0 -4
- package/dist/blocks/scalar-auth-selector-block/helpers/filter-security-requirements.d.ts +0 -6
- package/dist/blocks/scalar-auth-selector-block/helpers/filter-security-requirements.d.ts.map +0 -1
- package/dist/blocks/scalar-auth-selector-block/helpers/update-scheme.d.ts +0 -8
- package/dist/blocks/scalar-auth-selector-block/helpers/update-scheme.d.ts.map +0 -1
- package/dist/blocks/scalar-auth-selector-block/helpers/update-scheme.js +0 -26
- package/dist/blocks/scalar-auth-selector-block/index.d.ts +0 -2
- package/dist/blocks/scalar-auth-selector-block/index.d.ts.map +0 -1
- package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts +0 -16
- package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts.map +0 -1
- package/dist/components/Content/ClientLibraries/ClientLibraries.vue.js +0 -7
- package/dist/components/Content/ClientLibraries/ClientLibraries.vue2.js +0 -142
- package/dist/components/Content/ClientLibraries/ClientSelector.vue.d.ts +0 -13
- package/dist/components/Content/ClientLibraries/ClientSelector.vue.d.ts.map +0 -1
- package/dist/components/Content/ClientLibraries/ClientSelector.vue.js +0 -7
- package/dist/components/Content/ClientLibraries/ClientSelector.vue2.js +0 -125
- package/dist/components/Content/ClientLibraries/featured-clients.d.ts +0 -11
- package/dist/components/Content/ClientLibraries/featured-clients.d.ts.map +0 -1
- package/dist/components/Content/ClientLibraries/featured-clients.js +0 -24
- package/dist/components/Content/ClientLibraries/index.d.ts +0 -2
- package/dist/components/Content/ClientLibraries/index.d.ts.map +0 -1
- package/dist/features/example-responses/helpers/get-resolved-ref-deep.d.ts +0 -26
- package/dist/features/example-responses/helpers/get-resolved-ref-deep.d.ts.map +0 -1
- package/dist/features/example-responses/helpers/get-resolved-ref-deep.js +0 -39
- package/dist/helpers/convert-security-scheme.d.ts +0 -9
- package/dist/helpers/convert-security-scheme.d.ts.map +0 -1
- package/dist/helpers/convert-security-scheme.js +0 -34
- package/dist/helpers/map-config-to-client-store.d.ts +0 -72
- package/dist/helpers/map-config-to-client-store.d.ts.map +0 -1
- package/dist/helpers/map-config-to-client-store.js +0 -146
- package/dist/hooks/use-legacy-store-events.d.ts +0 -14
- package/dist/hooks/use-legacy-store-events.d.ts.map +0 -1
- package/dist/hooks/use-legacy-store-events.js +0 -91
- package/dist/hooks/use-workspace-store-events.d.ts +0 -4
- package/dist/hooks/use-workspace-store-events.d.ts.map +0 -1
- package/dist/hooks/use-workspace-store-events.js +0 -68
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, createElementBlock, openBlock, createVNode, Fragment, renderList, createBlock, unref, normalizeClass, withCtx, createElementVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
-
import { Tab } from "@headlessui/vue";
|
|
3
|
-
import { findClient } from "@scalar/api-client/v2/blocks/operation-code-sample";
|
|
4
|
-
import { ScalarIcon, ScalarCombobox } from "@scalar/components";
|
|
5
|
-
import { freezeElement } from "@scalar/helpers/dom/freeze-element";
|
|
6
|
-
import { emitCustomEvent } from "@scalar/workspace-store/events";
|
|
7
|
-
import { isFeaturedClient } from "./featured-clients.js";
|
|
8
|
-
const _hoisted_1 = { class: "client-libraries-text" };
|
|
9
|
-
const _hoisted_2 = {
|
|
10
|
-
"aria-hidden": "true",
|
|
11
|
-
class: "client-libraries-icon__more"
|
|
12
|
-
};
|
|
13
|
-
const _hoisted_3 = {
|
|
14
|
-
key: 1,
|
|
15
|
-
class: "client-libraries-icon",
|
|
16
|
-
height: "50",
|
|
17
|
-
role: "presentation",
|
|
18
|
-
viewBox: "0 0 50 50",
|
|
19
|
-
width: "50",
|
|
20
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
21
|
-
};
|
|
22
|
-
const _hoisted_4 = {
|
|
23
|
-
key: 0,
|
|
24
|
-
class: "client-libraries-text client-libraries-text-more"
|
|
25
|
-
};
|
|
26
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
27
|
-
__name: "ClientSelector",
|
|
28
|
-
props: {
|
|
29
|
-
clientOptions: {},
|
|
30
|
-
selectedClient: {},
|
|
31
|
-
featuredClients: {}
|
|
32
|
-
},
|
|
33
|
-
setup(__props) {
|
|
34
|
-
const containerRef = ref();
|
|
35
|
-
const getIconByLanguageKey = (targetKey) => `programming-language-${targetKey === "js" ? "javascript" : targetKey}`;
|
|
36
|
-
const selectClient = (option) => {
|
|
37
|
-
if (!containerRef.value) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const unfreeze = freezeElement(containerRef.value);
|
|
41
|
-
setTimeout(() => {
|
|
42
|
-
unfreeze();
|
|
43
|
-
}, 300);
|
|
44
|
-
emitCustomEvent(
|
|
45
|
-
containerRef.value,
|
|
46
|
-
"scalar-update-selected-client",
|
|
47
|
-
option.id
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
const selectedTargetKey = computed(
|
|
51
|
-
() => __props.selectedClient?.split("/")[0]
|
|
52
|
-
);
|
|
53
|
-
return (_ctx, _cache) => {
|
|
54
|
-
return openBlock(), createElementBlock("div", {
|
|
55
|
-
ref_key: "containerRef",
|
|
56
|
-
ref: containerRef,
|
|
57
|
-
class: "client-libraries-content"
|
|
58
|
-
}, [
|
|
59
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.featuredClients, (featuredClient) => {
|
|
60
|
-
return openBlock(), createBlock(unref(Tab), {
|
|
61
|
-
key: featuredClient.clientKey,
|
|
62
|
-
class: normalizeClass(["client-libraries rendered-code-sdks", {
|
|
63
|
-
"client-libraries__active": featuredClient.id === _ctx.selectedClient
|
|
64
|
-
}])
|
|
65
|
-
}, {
|
|
66
|
-
default: withCtx(() => [
|
|
67
|
-
createElementVNode("div", {
|
|
68
|
-
class: normalizeClass(`client-libraries-icon__${featuredClient.targetKey}`)
|
|
69
|
-
}, [
|
|
70
|
-
createVNode(unref(ScalarIcon), {
|
|
71
|
-
class: "client-libraries-icon",
|
|
72
|
-
icon: getIconByLanguageKey(featuredClient.targetKey)
|
|
73
|
-
}, null, 8, ["icon"])
|
|
74
|
-
], 2),
|
|
75
|
-
createElementVNode("span", _hoisted_1, toDisplayString(featuredClient.targetTitle), 1)
|
|
76
|
-
]),
|
|
77
|
-
_: 2
|
|
78
|
-
}, 1032, ["class"]);
|
|
79
|
-
}), 128)),
|
|
80
|
-
createVNode(unref(ScalarCombobox), {
|
|
81
|
-
modelValue: unref(findClient)(_ctx.clientOptions, _ctx.selectedClient),
|
|
82
|
-
options: _ctx.clientOptions,
|
|
83
|
-
placement: "bottom-end",
|
|
84
|
-
teleport: "",
|
|
85
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectClient($event))
|
|
86
|
-
}, {
|
|
87
|
-
default: withCtx(() => [
|
|
88
|
-
createElementVNode("button", {
|
|
89
|
-
class: normalizeClass(["client-libraries client-libraries__select", {
|
|
90
|
-
"client-libraries__active": _ctx.selectedClient && !unref(isFeaturedClient)(_ctx.selectedClient)
|
|
91
|
-
}]),
|
|
92
|
-
type: "button"
|
|
93
|
-
}, [
|
|
94
|
-
createElementVNode("div", _hoisted_2, [
|
|
95
|
-
_ctx.selectedClient && !unref(isFeaturedClient)(_ctx.selectedClient) ? (openBlock(), createElementBlock("div", {
|
|
96
|
-
key: 0,
|
|
97
|
-
class: normalizeClass(`client-libraries-icon__${selectedTargetKey.value}`)
|
|
98
|
-
}, [
|
|
99
|
-
selectedTargetKey.value ? (openBlock(), createBlock(unref(ScalarIcon), {
|
|
100
|
-
key: 0,
|
|
101
|
-
class: "client-libraries-icon",
|
|
102
|
-
icon: getIconByLanguageKey(selectedTargetKey.value)
|
|
103
|
-
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
104
|
-
], 2)) : (openBlock(), createElementBlock("svg", _hoisted_3, [..._cache[1] || (_cache[1] = [
|
|
105
|
-
createElementVNode("g", {
|
|
106
|
-
fill: "currentColor",
|
|
107
|
-
"fill-rule": "nonzero"
|
|
108
|
-
}, [
|
|
109
|
-
createElementVNode("path", { d: "M10.71 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M21.13 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M31.55 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0" })
|
|
110
|
-
], -1)
|
|
111
|
-
])]))
|
|
112
|
-
]),
|
|
113
|
-
_ctx.clientOptions.length ? (openBlock(), createElementBlock("span", _hoisted_4, " More ")) : createCommentVNode("", true),
|
|
114
|
-
_cache[2] || (_cache[2] = createElementVNode("span", { class: "sr-only" }, "Select from all clients", -1))
|
|
115
|
-
], 2)
|
|
116
|
-
]),
|
|
117
|
-
_: 1
|
|
118
|
-
}, 8, ["modelValue", "options"])
|
|
119
|
-
], 512);
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
export {
|
|
124
|
-
_sfc_main as default
|
|
125
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ClientOption, ClientOptionGroup } from '@scalar/api-client/v2/blocks/operation-code-sample';
|
|
2
|
-
import type { AvailableClients } from '@scalar/snippetz';
|
|
3
|
-
/** Whether or not a client is in the featured list */
|
|
4
|
-
export declare const isFeaturedClient: (clientId: AvailableClients[number] | undefined, featuredClients?: AvailableClients[number][]) => boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Maps featured client IDs to their corresponding ClientOption objects.
|
|
7
|
-
* Returns an array of ClientOption objects that match the featured clients list,
|
|
8
|
-
* maintaining the order of the featured clients.
|
|
9
|
-
*/
|
|
10
|
-
export declare const getFeaturedClients: (clientOptions: ClientOptionGroup[], featuredClients?: AvailableClients[number][]) => ClientOption[];
|
|
11
|
-
//# sourceMappingURL=featured-clients.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"featured-clients.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/ClientLibraries/featured-clients.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AACzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAWxD,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,GAC3B,UAAU,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,EAC9C,kBAAiB,gBAAgB,CAAC,MAAM,CAAC,EAAqB,YACgC,CAAA;AAEhG;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,eAAe,iBAAiB,EAAE,EAClC,kBAAiB,gBAAgB,CAAC,MAAM,CAAC,EAAqB,KAC7D,YAAY,EAgBd,CAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const FEATURED_CLIENTS = [
|
|
2
|
-
"shell/curl",
|
|
3
|
-
"ruby/native",
|
|
4
|
-
"node/undici",
|
|
5
|
-
"php/guzzle",
|
|
6
|
-
"python/python3"
|
|
7
|
-
];
|
|
8
|
-
const isFeaturedClient = (clientId, featuredClients = FEATURED_CLIENTS) => Boolean(clientId && featuredClients.includes(clientId));
|
|
9
|
-
const getFeaturedClients = (clientOptions, featuredClients = FEATURED_CLIENTS) => {
|
|
10
|
-
const clientMap = /* @__PURE__ */ new Map();
|
|
11
|
-
for (const group of clientOptions) {
|
|
12
|
-
for (const option of group.options) {
|
|
13
|
-
clientMap.set(option.id, option);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return featuredClients.flatMap((clientId) => {
|
|
17
|
-
const client = clientMap.get(clientId);
|
|
18
|
-
return client ?? [];
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
getFeaturedClients,
|
|
23
|
-
isFeaturedClient
|
|
24
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/ClientLibraries/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Dereference } from '@scalar/workspace-store/helpers/get-resolved-ref';
|
|
2
|
-
export type RefNode<Node> = Partial<Node> & {
|
|
3
|
-
$ref: string;
|
|
4
|
-
'$ref-value': Node | RefNode<Node>;
|
|
5
|
-
};
|
|
6
|
-
export type NodeInput<Node> = Node | RefNode<Node>;
|
|
7
|
-
/**
|
|
8
|
-
* Recursively resolves $ref objects
|
|
9
|
-
* This type helper ensures proper typing for deeply nested ref resolution.
|
|
10
|
-
* Properties that could contain $ref objects may resolve to '[circular]' if we have a circular reference.
|
|
11
|
-
*/
|
|
12
|
-
export type DeepDereference<T> = Dereference<T> extends T ? T extends readonly (infer U)[] ? DeepDereference<U>[] : T extends object ? {
|
|
13
|
-
[K in keyof T]: T[K] extends RefNode<any> ? DeepDereference<T[K]> | '[circular]' : DeepDereference<T[K]>;
|
|
14
|
-
} : T : Dereference<T> extends object ? {
|
|
15
|
-
[K in keyof Dereference<T>]: Dereference<T>[K] extends RefNode<any> ? DeepDereference<Dereference<T>[K]> | '[circular]' : DeepDereference<Dereference<T>[K]>;
|
|
16
|
-
} : Dereference<T>;
|
|
17
|
-
/**
|
|
18
|
-
* Recursively resolves all $ref objects in a data structure to their actual values.
|
|
19
|
-
* Traverses through objects, arrays, and nested structures to find and resolve
|
|
20
|
-
* any $ref references at any depth level.
|
|
21
|
-
*
|
|
22
|
-
* Handles circular references gracefully by detecting them and returning '[circular]'
|
|
23
|
-
* to prevent infinite loops.
|
|
24
|
-
*/
|
|
25
|
-
export declare const getResolvedRefDeep: <Node>(node: NodeInput<Node>) => DeepDereference<NodeInput<Node>>;
|
|
26
|
-
//# sourceMappingURL=get-resolved-ref-deep.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-resolved-ref-deep.d.ts","sourceRoot":"","sources":["../../../../src/features/example-responses/helpers/get-resolved-ref-deep.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AAEnF,MAAM,MAAM,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAA;AAChG,MAAM,MAAM,SAAS,CAAC,IAAI,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAElD;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,GACrD,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAC5B,eAAe,CAAC,CAAC,CAAC,EAAE,GACpB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC5G,CAAC,GACL,WAAW,CAAC,CAAC,CAAC,SAAS,MAAM,GAC3B;KACG,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAC/D,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,GACjD,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACvC,GACD,WAAW,CAAC,CAAC,CAAC,CAAA;AAEpB;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,KAAG,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAoD/F,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { getRaw } from "@scalar/json-magic/magic-proxy";
|
|
2
|
-
const getResolvedRefDeep = (node) => {
|
|
3
|
-
const visited = /* @__PURE__ */ new WeakSet();
|
|
4
|
-
const resolveNode = (current) => {
|
|
5
|
-
if (current === null || current === void 0 || typeof current !== "object") {
|
|
6
|
-
return current;
|
|
7
|
-
}
|
|
8
|
-
const raw = getRaw(current);
|
|
9
|
-
if (visited.has(raw)) {
|
|
10
|
-
return "[circular]";
|
|
11
|
-
}
|
|
12
|
-
visited.add(raw);
|
|
13
|
-
if (typeof current === "object" && current !== null && "$ref" in current) {
|
|
14
|
-
const refValue = current["$ref-value"];
|
|
15
|
-
const resolved = resolveNode(refValue);
|
|
16
|
-
visited.delete(raw);
|
|
17
|
-
return resolved;
|
|
18
|
-
}
|
|
19
|
-
if (Array.isArray(current)) {
|
|
20
|
-
const resolvedArray = current.map((item) => resolveNode(item));
|
|
21
|
-
visited.delete(raw);
|
|
22
|
-
return resolvedArray;
|
|
23
|
-
}
|
|
24
|
-
if (typeof current === "object" && current !== null) {
|
|
25
|
-
const resolvedObject = {};
|
|
26
|
-
for (const [key, value] of Object.entries(current)) {
|
|
27
|
-
resolvedObject[key] = resolveNode(value);
|
|
28
|
-
}
|
|
29
|
-
visited.delete(raw);
|
|
30
|
-
return resolvedObject;
|
|
31
|
-
}
|
|
32
|
-
visited.delete(raw);
|
|
33
|
-
return current;
|
|
34
|
-
};
|
|
35
|
-
return resolveNode(node);
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
getResolvedRefDeep
|
|
39
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SecurityScheme } from '@scalar/oas-utils/entities/spec';
|
|
2
|
-
import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
3
|
-
/**
|
|
4
|
-
* Convert the old security scheme to the new one with secret extensions
|
|
5
|
-
*
|
|
6
|
-
* Remove this once we are migrated to the workspace store. We are going to double up on secrets temporarily.
|
|
7
|
-
*/
|
|
8
|
-
export declare const convertSecurityScheme: (scheme: SecurityScheme) => SecuritySchemeObject;
|
|
9
|
-
//# sourceMappingURL=convert-security-scheme.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert-security-scheme.d.ts","sourceRoot":"","sources":["../../src/helpers/convert-security-scheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,cAAc,KAAG,oBAsC9D,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const convertSecurityScheme = (scheme) => {
|
|
2
|
-
if (scheme.type === "apiKey") {
|
|
3
|
-
return {
|
|
4
|
-
...scheme,
|
|
5
|
-
"x-scalar-secret-token": scheme.value
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
if (scheme.type === "http") {
|
|
9
|
-
return {
|
|
10
|
-
...scheme,
|
|
11
|
-
"x-scalar-secret-token": scheme.token,
|
|
12
|
-
"x-scalar-secret-username": scheme.username,
|
|
13
|
-
"x-scalar-secret-password": scheme.password
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
if (scheme.type === "oauth2") {
|
|
17
|
-
return {
|
|
18
|
-
...scheme,
|
|
19
|
-
flows: Object.fromEntries(
|
|
20
|
-
Object.entries(scheme.flows).map(([flowKey, flow]) => [
|
|
21
|
-
flowKey,
|
|
22
|
-
flow ? {
|
|
23
|
-
...flow,
|
|
24
|
-
"x-scalar-secret-token": flow.token
|
|
25
|
-
} : flow
|
|
26
|
-
])
|
|
27
|
-
)
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return scheme;
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
convertSecurityScheme
|
|
34
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
-
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
3
|
-
import type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference';
|
|
4
|
-
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
5
|
-
import type { SecurityRequirementObject, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
6
|
-
import { type MaybeRefOrGetter } from '@vueuse/core';
|
|
7
|
-
import { type Ref } from 'vue';
|
|
8
|
-
/**
|
|
9
|
-
* Temporary state mapping factory to handle syncing the client store with the workspace store.
|
|
10
|
-
*/
|
|
11
|
-
export declare function mapConfigToClientStore({ config, workspaceStore, el, root, dereferencedDocument, documentUrl, }: {
|
|
12
|
-
/** Element the client will be mounted to */
|
|
13
|
-
el: Ref<HTMLElement | null>;
|
|
14
|
-
/** Root element used to capture custom events on */
|
|
15
|
-
root: Ref<HTMLElement | null>;
|
|
16
|
-
/** Configuration object for API client */
|
|
17
|
-
config: MaybeRefOrGetter<ApiReferenceConfigurationRaw>;
|
|
18
|
-
/** Instantiated client store */
|
|
19
|
-
workspaceStore: WorkspaceStore;
|
|
20
|
-
dereferencedDocument: MaybeRefOrGetter<OpenAPIV3_1.Document | null>;
|
|
21
|
-
/** Document URL */
|
|
22
|
-
documentUrl: MaybeRefOrGetter<string | undefined>;
|
|
23
|
-
}): {
|
|
24
|
-
activeServer: import("vue").ComputedRef<{
|
|
25
|
-
url: string;
|
|
26
|
-
uid: string & import("zod").$brand<"server">;
|
|
27
|
-
description?: string | undefined;
|
|
28
|
-
variables?: Record<string, {
|
|
29
|
-
enum?: string[] | undefined;
|
|
30
|
-
default?: string | undefined;
|
|
31
|
-
description?: string | undefined;
|
|
32
|
-
value?: string | undefined;
|
|
33
|
-
}> | undefined;
|
|
34
|
-
} | undefined>;
|
|
35
|
-
activeEnvVariables: import("vue").ComputedRef<import("@scalar/api-client/store").EnvVariable[]>;
|
|
36
|
-
activeEnvironment: import("vue").ComputedRef<{
|
|
37
|
-
uid: string & import("zod").$brand<"environment">;
|
|
38
|
-
name: string;
|
|
39
|
-
color: string;
|
|
40
|
-
value: string;
|
|
41
|
-
isDefault?: boolean | undefined;
|
|
42
|
-
}>;
|
|
43
|
-
activeWorkspace: import("vue").ComputedRef<{
|
|
44
|
-
uid: string & import("zod").$brand<"workspace">;
|
|
45
|
-
name: string;
|
|
46
|
-
description: string;
|
|
47
|
-
collections: (string & import("zod").$brand<"collection">)[];
|
|
48
|
-
environments: Record<string, string>;
|
|
49
|
-
activeEnvironmentId: string;
|
|
50
|
-
cookies: (string & import("zod").$brand<"cookie">)[];
|
|
51
|
-
themeId: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "laserwave" | "none";
|
|
52
|
-
selectedHttpClient: {
|
|
53
|
-
targetKey: string;
|
|
54
|
-
clientKey: string;
|
|
55
|
-
};
|
|
56
|
-
hotKeyConfig?: {
|
|
57
|
-
modifiers: ("default" | "Meta" | "Control" | "Shift" | "Alt")[];
|
|
58
|
-
hotKeys?: Partial<Record<"" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "0" | "." | "2" | "-" | "," | "/" | "1" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "*" | "+" | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "`" | "[" | "\\" | "]" | "4" | "3" | "5" | "6" | "7" | "8" | "9", {
|
|
59
|
-
event: "addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar";
|
|
60
|
-
modifiers?: ("default" | "Meta" | "Control" | "Shift" | "Alt")[] | undefined;
|
|
61
|
-
}>> | undefined;
|
|
62
|
-
} | undefined;
|
|
63
|
-
proxyUrl?: string | undefined;
|
|
64
|
-
} | undefined>;
|
|
65
|
-
getSecuritySchemes: SecuritySchemeGetter;
|
|
66
|
-
openClient: (payload: {
|
|
67
|
-
method: HttpMethod;
|
|
68
|
-
path: string;
|
|
69
|
-
}) => void | undefined;
|
|
70
|
-
};
|
|
71
|
-
export type SecuritySchemeGetter = (operationSecurity: SecurityRequirementObject[] | undefined, documentSecurity: SecurityRequirementObject[] | undefined) => SecuritySchemeObject[];
|
|
72
|
-
//# sourceMappingURL=map-config-to-client-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map-config-to-client-store.d.ts","sourceRoot":"","sources":["../../src/helpers/map-config-to-client-store.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,KAAK,EACV,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AACrE,OAAO,EAAE,KAAK,gBAAgB,EAAkB,MAAM,cAAc,CAAA;AAEpE,OAAO,EAAE,KAAK,GAAG,EAA4C,MAAM,KAAK,CAAA;AAKxE;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,cAAc,EACd,EAAE,EACF,IAAI,EACJ,oBAAoB,EACpB,WAAW,GACZ,EAAE;IACD,4CAA4C;IAC5C,EAAE,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC3B,oDAAoD;IACpD,IAAI,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC7B,0CAA0C;IAC1C,MAAM,EAAE,gBAAgB,CAAC,4BAA4B,CAAC,CAAA;IACtD,gCAAgC;IAChC,cAAc,EAAE,cAAc,CAAA;IAC9B,oBAAoB,EAAE,gBAAgB,CAAC,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IACnE,mBAAmB;IACnB,WAAW,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAClD;;;;;;gBAuMg7K,CAAC;mBAA2C,CAAC;uBAA6C,CAAC;iBAAuC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;mBAA5rC,CAAC;;yBAAg6B,CAAC;;;;;;0BARhwK;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;EAE7D;AAED,MAAM,MAAM,oBAAoB,GAAG,CACjC,iBAAiB,EAAE,yBAAyB,EAAE,GAAG,SAAS,EAC1D,gBAAgB,EAAE,yBAAyB,EAAE,GAAG,SAAS,KACtD,oBAAoB,EAAE,CAAA"}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { createApiClientModal } from "@scalar/api-client/layouts/Modal";
|
|
2
|
-
import { createWorkspaceStore, createActiveEntitiesStore, WORKSPACE_SYMBOL, ACTIVE_ENTITIES_SYMBOL } from "@scalar/api-client/store";
|
|
3
|
-
import { mutateSecuritySchemeDiff } from "@scalar/api-client/views/Request/libs";
|
|
4
|
-
import { filterSecurityRequirements } from "@scalar/api-client/views/Request/RequestSection";
|
|
5
|
-
import { getServersFromDocument } from "@scalar/oas-utils/helpers";
|
|
6
|
-
import { emitCustomEvent } from "@scalar/workspace-store/events";
|
|
7
|
-
import { watchDebounced } from "@vueuse/core";
|
|
8
|
-
import microdiff from "microdiff";
|
|
9
|
-
import { toValue, provide, watch, toRaw, computed } from "vue";
|
|
10
|
-
import { convertSecurityScheme } from "./convert-security-scheme.js";
|
|
11
|
-
import { useLegacyStoreEvents } from "../hooks/use-legacy-store-events.js";
|
|
12
|
-
function mapConfigToClientStore({
|
|
13
|
-
config,
|
|
14
|
-
workspaceStore,
|
|
15
|
-
el,
|
|
16
|
-
root,
|
|
17
|
-
dereferencedDocument,
|
|
18
|
-
documentUrl
|
|
19
|
-
}) {
|
|
20
|
-
const store = createWorkspaceStore({
|
|
21
|
-
useLocalStorage: false,
|
|
22
|
-
proxyUrl: toValue(config).proxyUrl,
|
|
23
|
-
theme: toValue(config).theme,
|
|
24
|
-
showSidebar: toValue(config).showSidebar,
|
|
25
|
-
hideClientButton: toValue(config).hideClientButton,
|
|
26
|
-
_integration: toValue(config)._integration
|
|
27
|
-
});
|
|
28
|
-
let client = null;
|
|
29
|
-
const activeEntities = createActiveEntitiesStore(store);
|
|
30
|
-
provide(WORKSPACE_SYMBOL, store);
|
|
31
|
-
provide(ACTIVE_ENTITIES_SYMBOL, activeEntities);
|
|
32
|
-
useLegacyStoreEvents(workspaceStore, store, activeEntities, root);
|
|
33
|
-
watch(
|
|
34
|
-
el,
|
|
35
|
-
() => {
|
|
36
|
-
console.info(`[CLIENT]: Client element changed. ${el.value ? "Mounting client..." : "Unmounting client..."}`);
|
|
37
|
-
if (!el.value) {
|
|
38
|
-
client?.app?.unmount();
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const clientConfig = toValue(config);
|
|
42
|
-
const mount = createApiClientModal({
|
|
43
|
-
el: el.value,
|
|
44
|
-
configuration: {
|
|
45
|
-
...clientConfig,
|
|
46
|
-
plugins: typeof clientConfig.onBeforeRequest === "function" ? [
|
|
47
|
-
() => ({
|
|
48
|
-
name: "on-before-request",
|
|
49
|
-
hooks: {
|
|
50
|
-
onBeforeRequest: clientConfig.onBeforeRequest
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
] : []
|
|
54
|
-
},
|
|
55
|
-
store
|
|
56
|
-
});
|
|
57
|
-
client = mount.client;
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
immediate: true
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
watchDebounced(
|
|
64
|
-
() => toValue(config),
|
|
65
|
-
(newConfig, oldConfig) => {
|
|
66
|
-
if (!oldConfig || !activeEntities.activeCollection.value) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
microdiff(oldConfig, newConfig).forEach((d) => {
|
|
70
|
-
if (d.path[0] === "authentication") {
|
|
71
|
-
mutateSecuritySchemeDiff(d, activeEntities, store);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
{ deep: true, debounce: 300 }
|
|
76
|
-
);
|
|
77
|
-
watch(
|
|
78
|
-
[() => toValue(config).servers, () => toValue(dereferencedDocument)?.servers, () => toValue(config).baseServerURL],
|
|
79
|
-
([newServers], [oldServers]) => {
|
|
80
|
-
if (newServers || oldServers) {
|
|
81
|
-
const servers = getServersFromDocument(newServers ?? toValue(dereferencedDocument)?.servers, {
|
|
82
|
-
baseServerURL: toValue(config).baseServerURL
|
|
83
|
-
});
|
|
84
|
-
emitCustomEvent(el.value, "scalar-replace-servers", {
|
|
85
|
-
servers,
|
|
86
|
-
options: {
|
|
87
|
-
disableOldStoreUpdate: true
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
watchDebounced(
|
|
94
|
-
() => toValue(dereferencedDocument),
|
|
95
|
-
(newDocument, oldDocument) => {
|
|
96
|
-
if (!newDocument) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const diff = microdiff(newDocument, oldDocument || {});
|
|
100
|
-
if (!diff?.length) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (activeEntities.activeCollection.value) {
|
|
104
|
-
client?.resetStore();
|
|
105
|
-
}
|
|
106
|
-
return store.importSpecFile(void 0, "default", {
|
|
107
|
-
dereferencedDocument: toRaw(newDocument),
|
|
108
|
-
shouldLoad: true,
|
|
109
|
-
documentUrl: toValue(documentUrl),
|
|
110
|
-
useCollectionSecurity: true,
|
|
111
|
-
...toValue(config)
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
const { activeCollection, activeEnvVariables, activeEnvironment, activeWorkspace } = activeEntities;
|
|
116
|
-
const activeServer = computed(() => {
|
|
117
|
-
if (!activeCollection.value) {
|
|
118
|
-
return void 0;
|
|
119
|
-
}
|
|
120
|
-
if (activeCollection.value.selectedServerUid) {
|
|
121
|
-
const server = store.servers[activeCollection.value.selectedServerUid];
|
|
122
|
-
if (server) {
|
|
123
|
-
return server;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return store.servers[activeCollection.value.servers[0] ?? ""];
|
|
127
|
-
});
|
|
128
|
-
const getSecuritySchemes = (operationSecurity, documentSecurity) => {
|
|
129
|
-
return filterSecurityRequirements(
|
|
130
|
-
operationSecurity || documentSecurity || [],
|
|
131
|
-
activeCollection.value?.selectedSecuritySchemeUids || [],
|
|
132
|
-
store.securitySchemes
|
|
133
|
-
).map(convertSecurityScheme);
|
|
134
|
-
};
|
|
135
|
-
return {
|
|
136
|
-
activeServer,
|
|
137
|
-
activeEnvVariables,
|
|
138
|
-
activeEnvironment,
|
|
139
|
-
activeWorkspace,
|
|
140
|
-
getSecuritySchemes,
|
|
141
|
-
openClient: (payload) => client?.open(payload)
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
export {
|
|
145
|
-
mapConfigToClientStore
|
|
146
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceStore as Legacy } from '@scalar/api-client/store';
|
|
2
|
-
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
3
|
-
import type { Ref } from 'vue';
|
|
4
|
-
import type { createActiveEntitiesStore } from '@scalar/api-client/store';
|
|
5
|
-
/**
|
|
6
|
-
* Keep the old store in sync with the new server selector block.
|
|
7
|
-
*
|
|
8
|
-
* This is a temporary solution to maintain consistency between the legacy
|
|
9
|
-
* api-client store and the new workspace store during the migration period.
|
|
10
|
-
*
|
|
11
|
-
* @todo Remove this hook when api-client is fully migrated to the new store
|
|
12
|
-
*/
|
|
13
|
-
export declare const useLegacyStoreEvents: (store: WorkspaceStore, legacyStore: Legacy, activeEntities: ReturnType<typeof createActiveEntitiesStore>, root: Ref<HTMLElement | null>) => void;
|
|
14
|
-
//# sourceMappingURL=use-legacy-store-events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-legacy-store-events.d.ts","sourceRoot":"","sources":["../../src/hooks/use-legacy-store-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,cAAc,EACrB,aAAa,MAAM,EACnB,gBAAgB,UAAU,CAAC,OAAO,yBAAyB,CAAC,EAC5D,MAAM,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,SA6H9B,CAAA"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { onCustomEvent } from "@scalar/workspace-store/events";
|
|
2
|
-
const useLegacyStoreEvents = (store, legacyStore, activeEntities, root) => {
|
|
3
|
-
const { servers, serverMutators, requestMutators, collectionMutators, securitySchemeMutators } = legacyStore;
|
|
4
|
-
const { activeCollection, activeServer } = activeEntities;
|
|
5
|
-
onCustomEvent(root, "scalar-replace-servers", ({ detail: { servers: inputServers, options } }) => {
|
|
6
|
-
if (options?.disableOldStoreUpdate === true) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const collection = activeCollection.value;
|
|
10
|
-
if (!collection) {
|
|
11
|
-
return console.warn("No active collection found");
|
|
12
|
-
}
|
|
13
|
-
collection.servers.forEach((serverUid) => {
|
|
14
|
-
serverMutators.delete(serverUid, collection.uid);
|
|
15
|
-
});
|
|
16
|
-
inputServers.forEach((server) => {
|
|
17
|
-
const result = Object.values(servers).find((s) => s.url === server.url);
|
|
18
|
-
if (result) {
|
|
19
|
-
serverMutators.add(result, collection.uid);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const lastServer = Object.values(servers).find((s) => s.url === inputServers.at(-1)?.url);
|
|
23
|
-
collectionMutators.edit(collection.uid, "selectedServerUid", lastServer?.uid);
|
|
24
|
-
});
|
|
25
|
-
onCustomEvent(root, "scalar-update-selected-server", ({ detail: { value, options } }) => {
|
|
26
|
-
if (options?.disableOldStoreUpdate === true) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const collection = activeCollection.value;
|
|
30
|
-
if (!collection) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const server = Object.values(servers).find((s) => s.url === value);
|
|
34
|
-
if (!server) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
collectionMutators.edit(collection.uid, "selectedServerUid", server.uid);
|
|
38
|
-
});
|
|
39
|
-
onCustomEvent(root, "store-update-selected-server-properties", ({ detail: { key, value, options } }) => {
|
|
40
|
-
if (options?.disableOldStoreUpdate) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const server = activeServer.value;
|
|
44
|
-
if (!server) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
serverMutators.edit(server.uid, key, value);
|
|
48
|
-
});
|
|
49
|
-
onCustomEvent(root, "scalar-update-selected-server-variables", ({ detail: { key, value, options } }) => {
|
|
50
|
-
if (options?.disableOldStoreUpdate === true) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const server = activeServer.value;
|
|
54
|
-
if (!server || server.url !== store.workspace.activeDocument?.["x-scalar-active-server"]) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const variables = server.variables || {};
|
|
58
|
-
variables[key] = { ...variables[key], default: value };
|
|
59
|
-
serverMutators.edit(server.uid, "variables", variables);
|
|
60
|
-
});
|
|
61
|
-
onCustomEvent(root, "scalar-select-security-schemes", ({ detail: { uids } }) => {
|
|
62
|
-
const collection = activeCollection.value;
|
|
63
|
-
if (!collection) {
|
|
64
|
-
return console.warn("No active collection found");
|
|
65
|
-
}
|
|
66
|
-
collectionMutators.edit(collection.uid, "selectedSecuritySchemeUids", uids);
|
|
67
|
-
});
|
|
68
|
-
onCustomEvent(root, "scalar-select-operation-security-schemes", ({ detail: { operationUid, uids } }) => {
|
|
69
|
-
requestMutators.edit(operationUid, "selectedSecuritySchemeUids", uids);
|
|
70
|
-
});
|
|
71
|
-
onCustomEvent(root, "scalar-edit-security-scheme", ({ detail: { uid, path, value } }) => {
|
|
72
|
-
securitySchemeMutators.edit(uid, path, value);
|
|
73
|
-
});
|
|
74
|
-
onCustomEvent(root, "scalar-add-auth-option", ({ detail: { payload } }) => {
|
|
75
|
-
const collection = activeCollection.value;
|
|
76
|
-
if (!collection) {
|
|
77
|
-
return console.warn("No active collection found");
|
|
78
|
-
}
|
|
79
|
-
securitySchemeMutators.add(payload, collection.uid);
|
|
80
|
-
});
|
|
81
|
-
onCustomEvent(root, "scalar-delete-security-scheme", ({ detail: { uid } }) => {
|
|
82
|
-
const collection = activeCollection.value;
|
|
83
|
-
if (!collection) {
|
|
84
|
-
return console.warn("No active collection found");
|
|
85
|
-
}
|
|
86
|
-
securitySchemeMutators.delete(uid);
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
export {
|
|
90
|
-
useLegacyStoreEvents
|
|
91
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
-
import type { Ref } from 'vue';
|
|
3
|
-
export declare const useWorkspaceStoreEvents: (store: WorkspaceStore, root: Ref<HTMLElement | null>) => void;
|
|
4
|
-
//# sourceMappingURL=use-workspace-store-events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-workspace-store-events.d.ts","sourceRoot":"","sources":["../../src/hooks/use-workspace-store-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,gCAAgC,CAAA;AAE5F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,eAAO,MAAM,uBAAuB,GAAI,OAAO,cAAc,EAAE,MAAM,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,SAgG3F,CAAA"}
|