@scalar/api-client 2.5.32 → 2.5.33
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 +20 -0
- package/dist/components/AddressBar/AddressBar.vue.js +1 -1
- package/dist/components/AddressBar/AddressBar.vue2.js +120 -128
- package/dist/components/AddressBar/AddressBarHistory.vue.js +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue2.js +57 -63
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +143 -150
- package/dist/components/CodeInput/codeVariableWidget.js +70 -75
- package/dist/components/CommandPalette/CommandActionInput.vue.js +17 -19
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +26 -27
- package/dist/components/CommandPalette/CommandPaletteExample.vue.js +53 -55
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +129 -133
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue.js +1 -1
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue2.js +84 -98
- package/dist/components/CommandPalette/CommandPaletteServer.vue.js +64 -74
- package/dist/components/CommandPalette/CommandPaletteTag.vue.js +5 -11
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +164 -183
- package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInput.vue.js +4 -4
- package/dist/components/DataTable/DataTableInput.vue2.js +31 -31
- package/dist/components/DataTable/DataTableInputSelect.vue.js +1 -2
- package/dist/components/EmptyState.vue.js +1 -1
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +75 -84
- package/dist/components/Form/LabelInput.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue2.js +11 -11
- package/dist/components/ImportCollection/DropEventListener.vue.js +42 -44
- package/dist/components/ImportCollection/ImportCollectionListener.vue.js +22 -23
- package/dist/components/ImportCollection/ImportCollectionModal.vue.js +141 -149
- package/dist/components/ImportCollection/ImportCollectionModal.vue3.js +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +22 -23
- package/dist/components/ImportCollection/IntegrationLogo.vue.js +12 -13
- package/dist/components/ImportCollection/PasteEventListener.vue.js +11 -12
- package/dist/components/ImportCollection/WorkspaceSelector.vue.js +69 -76
- package/dist/components/ImportCollection/utils/get-openapi-version.js +8 -8
- package/dist/components/ImportCollection/utils/import-collection.js +14 -14
- package/dist/components/OpenApiClientButton.vue.js +1 -1
- package/dist/components/OpenApiClientButton.vue2.js +10 -10
- package/dist/components/ScalarAsciiArt.vue.js +1 -1
- package/dist/components/ScalarAsciiArt.vue2.js +19 -22
- package/dist/components/Search/useSearch.js +51 -61
- package/dist/components/SectionFilter.vue.js +1 -1
- package/dist/components/SectionFilter.vue2.js +26 -29
- package/dist/components/Server/ServerDropdown.vue.js +70 -96
- package/dist/components/Server/ServerDropdownItem.vue.js +1 -1
- package/dist/components/Server/ServerDropdownItem.vue2.js +57 -67
- package/dist/components/Server/ServerSelector.vue.js +44 -55
- package/dist/components/Server/ServerVariablesForm.vue.js +36 -42
- package/dist/components/Server/ServerVariablesSelect.vue.js +6 -6
- package/dist/components/SideNav/DownloadAppButton.vue.js +1 -1
- package/dist/components/SideNav/SideNav.vue.js +68 -74
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +1 -1
- package/dist/components/Sidebar/Sidebar.vue.js +1 -1
- package/dist/components/Sidebar/SidebarListElement.vue.js +2 -2
- package/dist/components/TopNav/TopNav.vue.js +107 -122
- package/dist/components/TopNav/TopNavItem.vue.js +1 -1
- package/dist/hooks/useFileDialog.js +12 -12
- package/dist/hooks/useResponseBody.js +14 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/layouts/App/ApiClientApp.vue.js +50 -56
- package/dist/layouts/App/ApiClientApp.vue3.js +1 -1
- package/dist/layouts/App/create-api-client-app.js +19 -20
- package/dist/layouts/App/index.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue2.js +18 -21
- package/dist/layouts/Web/ApiClientWeb.vue.js +45 -51
- package/dist/layouts/Web/ApiClientWeb.vue3.js +1 -1
- package/dist/layouts/Web/create-api-client-web.js +19 -20
- package/dist/layouts/Web/index.js +1 -1
- package/dist/libs/create-client.js +102 -109
- package/dist/libs/env-helpers.js +3 -3
- package/dist/libs/event-bus.js +15 -15
- package/dist/libs/extractAttachmentFilename.js +5 -6
- package/dist/libs/find-request.js +9 -10
- package/dist/libs/get-request-uid-by-path-method.js +12 -12
- package/dist/libs/getOpenApiDocumentDetails.js +7 -7
- package/dist/libs/importers/curl.js +3 -3
- package/dist/libs/normalize-headers.js +9 -10
- package/dist/libs/postman.js +15 -17
- package/dist/libs/send-request/build-request-security.js +9 -10
- package/dist/libs/send-request/create-fetch-body.js +11 -12
- package/dist/libs/send-request/create-fetch-query-params.js +13 -13
- package/dist/libs/send-request/create-request-operation.js +83 -84
- package/dist/libs/send-request/decode-buffer.d.ts.map +1 -1
- package/dist/libs/send-request/set-request-cookies.js +12 -12
- package/dist/libs/string-template.js +21 -21
- package/dist/libs/validate-parameters.js +5 -8
- package/dist/plugins/plugin-manager.js +11 -17
- package/dist/store/active-entities.js +90 -117
- package/dist/store/collections.js +41 -42
- package/dist/store/import-spec.js +25 -26
- package/dist/store/request-example.js +20 -24
- package/dist/store/requests.js +63 -81
- package/dist/store/router-params.js +7 -7
- package/dist/store/security-schemes.js +35 -36
- package/dist/store/store.js +2 -2
- package/dist/store/tags.js +20 -21
- package/dist/style.css +1 -1
- package/dist/views/Collection/Collection.vue2.js +21 -22
- package/dist/views/Collection/CollectionAuthentication.vue.js +1 -1
- package/dist/views/Collection/CollectionAuthentication.vue2.js +43 -47
- package/dist/views/Collection/CollectionEnvironment.vue.js +1 -1
- package/dist/views/Collection/CollectionEnvironment.vue2.js +196 -207
- package/dist/views/Collection/CollectionInfoForm.vue.js +1 -1
- package/dist/views/Collection/CollectionInfoForm.vue2.js +34 -41
- package/dist/views/Collection/CollectionNavigation.vue.js +116 -125
- package/dist/views/Collection/CollectionOverview.vue2.js +22 -25
- package/dist/views/Collection/CollectionServerForm.vue.js +39 -45
- package/dist/views/Collection/CollectionServers.vue2.js +88 -98
- package/dist/views/Collection/CollectionSettings.vue.js +1 -1
- package/dist/views/Collection/CollectionSettings.vue2.js +101 -108
- package/dist/views/Collection/components/EnvironmentForm.vue.js +1 -1
- package/dist/views/Collection/components/EnvironmentForm.vue2.js +141 -145
- package/dist/views/Collection/components/MarkdownInput.vue.js +1 -1
- package/dist/views/Collection/components/MarkdownInput.vue2.js +1 -2
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue.js +15 -15
- package/dist/views/Components/CodeSnippet/helpers/convert-to-har-request.js +15 -16
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +61 -64
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.js +9 -10
- package/dist/views/Cookies/CookieModal.vue.js +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +90 -93
- package/dist/views/Environment/Environment.vue2.js +267 -295
- package/dist/views/Environment/EnvironmentModal.vue.js +63 -70
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +38 -42
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +60 -67
- package/dist/views/Request/RequestRoot.vue.js +1 -1
- package/dist/views/Request/RequestRoot.vue2.js +78 -89
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +37 -44
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +44 -45
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +111 -127
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +120 -139
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +97 -97
- package/dist/views/Request/RequestSection/RequestBody.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue2.js +287 -310
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +86 -94
- package/dist/views/Request/RequestSection/RequestParams.vue.js +37 -38
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +36 -38
- package/dist/views/Request/RequestSection/RequestSection.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +28 -31
- package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue2.js +49 -52
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +1 -1
- package/dist/views/Request/RequestSection/helpers/filter-security-requirements.js +16 -16
- package/dist/views/Request/RequestSection/helpers/getting-started.js +7 -11
- package/dist/views/Request/RequestSection/helpers/update-scheme.js +7 -8
- package/dist/views/Request/RequestSidebar.vue.js +1 -1
- package/dist/views/Request/RequestSidebar.vue2.js +199 -211
- package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
- package/dist/views/Request/RequestSidebarItem.vue2.js +332 -349
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +210 -240
- package/dist/views/Request/RequestSubpageHeader.vue.js +1 -1
- package/dist/views/Request/ResponseSection/RequestHeaders.vue.js +38 -41
- package/dist/views/Request/ResponseSection/ResponseBody.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +58 -64
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.js +1 -2
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +20 -23
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue3.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +29 -30
- package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +38 -41
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js +28 -29
- package/dist/views/Request/ResponseSection/ResponseSection.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +128 -140
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +116 -124
- package/dist/views/Request/consts/mediaTypes.js +2 -3
- package/dist/views/Request/handle-drag.js +24 -28
- package/dist/views/Request/hooks/useOpenApiWatcher.js +26 -33
- package/dist/views/Request/libs/auth.js +37 -43
- package/dist/views/Request/libs/oauth2.js +30 -32
- package/dist/views/Request/libs/watch-mode.js +100 -103
- package/dist/views/Settings/SettingsGeneral.vue.js +206 -236
- package/package.json +22 -22
- package/dist/components/AddressBar/AddressBar.vue3.js +0 -4
- package/dist/components/AddressBar/AddressBarHistory.vue3.js +0 -4
- package/dist/components/CodeInput/CodeInput.vue3.js +0 -4
- package/dist/components/CodeInput/CodeInput.vue4.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue3.js +0 -4
- package/dist/components/CommandPalette/TheCommandPalette.vue3.js +0 -4
- package/dist/components/DataTable/DataTableInput.vue3.js +0 -4
- package/dist/components/EmptyState.vue3.js +0 -4
- package/dist/components/Form/LabelInput.vue3.js +0 -4
- package/dist/components/HttpMethod/HttpMethod.vue3.js +0 -4
- package/dist/components/ImportCollection/ImportCollectionModal.vue2.js +0 -4
- package/dist/components/OpenApiClientButton.vue3.js +0 -4
- package/dist/components/ScalarAsciiArt.vue3.js +0 -4
- package/dist/components/SectionFilter.vue3.js +0 -4
- package/dist/components/Server/ServerDropdownItem.vue3.js +0 -4
- package/dist/components/SideNav/DownloadAppButton.vue3.js +0 -4
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue3.js +0 -4
- package/dist/components/Sidebar/Sidebar.vue3.js +0 -4
- package/dist/components/Sidebar/SidebarListElement.vue3.js +0 -4
- package/dist/components/Sidebar/SidebarListElement.vue4.js +0 -4
- package/dist/components/TopNav/TopNavItem.vue3.js +0 -4
- package/dist/layouts/App/ApiClientApp.vue2.js +0 -4
- package/dist/layouts/Modal/ApiClientModal.vue3.js +0 -4
- package/dist/layouts/Web/ApiClientWeb.vue2.js +0 -4
- package/dist/style.css.js +0 -4
- package/dist/views/Collection/CollectionAuthentication.vue3.js +0 -4
- package/dist/views/Collection/CollectionEnvironment.vue3.js +0 -4
- package/dist/views/Collection/CollectionInfoForm.vue3.js +0 -4
- package/dist/views/Collection/CollectionSettings.vue3.js +0 -4
- package/dist/views/Collection/components/EnvironmentForm.vue3.js +0 -4
- package/dist/views/Collection/components/MarkdownInput.vue3.js +0 -4
- package/dist/views/Cookies/CookieModal.vue3.js +0 -4
- package/dist/views/Request/Request.vue3.js +0 -4
- package/dist/views/Request/RequestRoot.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestBody.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestCodeExample.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestSection.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestTable.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue3.js +0 -4
- package/dist/views/Request/RequestSidebar.vue3.js +0 -4
- package/dist/views/Request/RequestSidebarItem.vue3.js +0 -4
- package/dist/views/Request/RequestSidebarItem.vue4.js +0 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue3.js +0 -4
- package/dist/views/Request/RequestSubpageHeader.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBody.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseSection.vue3.js +0 -4
|
@@ -1,145 +1,118 @@
|
|
|
1
|
-
import { flattenEnvVars as
|
|
2
|
-
import { environmentSchema as
|
|
3
|
-
import { isDefined as
|
|
4
|
-
import { inject as
|
|
5
|
-
import { getRouterParams as
|
|
6
|
-
import { PathId as
|
|
7
|
-
const
|
|
8
|
-
collections:
|
|
9
|
-
requestExamples:
|
|
10
|
-
requests:
|
|
11
|
-
router:
|
|
12
|
-
servers:
|
|
13
|
-
workspaces:
|
|
1
|
+
import { flattenEnvVars as I } from "../libs/string-template.js";
|
|
2
|
+
import { environmentSchema as S } from "@scalar/oas-utils/entities/environment";
|
|
3
|
+
import { isDefined as U } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { inject as q, computed as r } from "vue";
|
|
5
|
+
import { getRouterParams as A } from "./router-params.js";
|
|
6
|
+
import { PathId as l } from "../routes.js";
|
|
7
|
+
const T = ({
|
|
8
|
+
collections: a,
|
|
9
|
+
requestExamples: b,
|
|
10
|
+
requests: u,
|
|
11
|
+
router: y,
|
|
12
|
+
servers: m,
|
|
13
|
+
workspaces: k
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
() =>
|
|
17
|
-
),
|
|
18
|
-
() =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
() => {
|
|
27
|
-
var e;
|
|
28
|
-
return (e = d.value) == null ? void 0 : e.flatMap((t) => t.servers.map((n) => p[n]));
|
|
29
|
-
}
|
|
30
|
-
), U = i(
|
|
31
|
-
() => {
|
|
32
|
-
var e;
|
|
33
|
-
return ((e = d.value) == null ? void 0 : e.flatMap((t) => t.requests)) ?? [];
|
|
34
|
-
}
|
|
35
|
-
), F = i(() => {
|
|
36
|
-
var t, n, v, o, u, a, c, b, y;
|
|
37
|
-
if (!((t = r.value) != null && t.activeEnvironmentId))
|
|
38
|
-
return k.parse({
|
|
15
|
+
const i = r(A(y)), t = r(
|
|
16
|
+
() => k[i.value[l.Workspace]] ?? Object.values(k)[0]
|
|
17
|
+
), s = r(
|
|
18
|
+
() => t.value?.collections.map((e) => a[e]).filter(U).sort((e, n) => e.info?.title === "Drafts" ? 1 : n.info?.title === "Drafts" ? -1 : 0) ?? []
|
|
19
|
+
), g = r(
|
|
20
|
+
() => s.value?.flatMap((e) => e.servers.map((n) => m[n]))
|
|
21
|
+
), x = r(
|
|
22
|
+
() => s.value?.flatMap((e) => e.requests) ?? []
|
|
23
|
+
), f = r(() => {
|
|
24
|
+
if (!t.value?.activeEnvironmentId)
|
|
25
|
+
return S.parse({
|
|
39
26
|
uid: "default",
|
|
40
27
|
color: "#FFFFFF",
|
|
41
28
|
name: "No Environment",
|
|
42
|
-
value: JSON.stringify(
|
|
29
|
+
value: JSON.stringify(t.value?.environments, null, 2)
|
|
43
30
|
});
|
|
44
|
-
const e =
|
|
45
|
-
(
|
|
46
|
-
var g, x;
|
|
47
|
-
return (x = j["x-scalar-environments"]) == null ? void 0 : x[((g = r.value) == null ? void 0 : g.activeEnvironmentId) ?? ""];
|
|
48
|
-
}
|
|
31
|
+
const e = s.value.find(
|
|
32
|
+
(n) => n["x-scalar-environments"]?.[t.value?.activeEnvironmentId ?? ""]
|
|
49
33
|
);
|
|
50
|
-
return e &&
|
|
51
|
-
uid:
|
|
52
|
-
name:
|
|
34
|
+
return e && t.value?.activeEnvironmentId ? S.parse({
|
|
35
|
+
uid: t.value.activeEnvironmentId,
|
|
36
|
+
name: t.value.activeEnvironmentId,
|
|
53
37
|
value: JSON.stringify(
|
|
54
|
-
|
|
38
|
+
e["x-scalar-environments"]?.[t.value?.activeEnvironmentId]?.variables,
|
|
55
39
|
null,
|
|
56
40
|
2
|
|
57
41
|
),
|
|
58
|
-
color:
|
|
42
|
+
color: e["x-scalar-environments"]?.[t.value?.activeEnvironmentId]?.color || "#FFFFFF",
|
|
59
43
|
isDefault: !1
|
|
60
|
-
}) :
|
|
44
|
+
}) : S.parse({
|
|
61
45
|
uid: "default",
|
|
62
46
|
color: "#FFFFFF",
|
|
63
47
|
name: "No Environment",
|
|
64
|
-
value: JSON.stringify(
|
|
48
|
+
value: JSON.stringify(t.value.environments, null, 2)
|
|
65
49
|
});
|
|
66
|
-
}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}), S = i(() => {
|
|
75
|
-
var v, o, u;
|
|
76
|
-
const e = l[s.value[m.Collection]];
|
|
50
|
+
}), v = r(() => {
|
|
51
|
+
const e = i.value[l.Request], n = a[i.value.collection] || a[t.value?.collections[0] ?? ""];
|
|
52
|
+
return u[e] || u[n?.requests[0] ?? ""] || Object.values(u)[0];
|
|
53
|
+
}), C = r(() => {
|
|
54
|
+
const e = i.value[l.Examples] === "default" ? v.value?.examples[0] || "" : i.value[l.Examples];
|
|
55
|
+
return b[e];
|
|
56
|
+
}), d = r(() => {
|
|
57
|
+
const e = a[i.value[l.Collection]];
|
|
77
58
|
if (e)
|
|
78
59
|
return e;
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
return Object.values(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if ((e = f.value) != null && e.selectedServerUid) {
|
|
90
|
-
const n = p[f.value.selectedServerUid];
|
|
91
|
-
if (n)
|
|
92
|
-
return n;
|
|
93
|
-
}
|
|
94
|
-
if ((t = S.value) != null && t.selectedServerUid) {
|
|
95
|
-
const n = p[S.value.selectedServerUid];
|
|
96
|
-
if (n)
|
|
97
|
-
return n;
|
|
60
|
+
const n = v.value?.uid;
|
|
61
|
+
if (n)
|
|
62
|
+
return Object.values(a).find((p) => p.requests?.includes(n));
|
|
63
|
+
const E = t.value?.collections[0] ?? a[0]?.uid ?? "";
|
|
64
|
+
return a[E];
|
|
65
|
+
}), O = r(() => {
|
|
66
|
+
if (v.value?.selectedServerUid) {
|
|
67
|
+
const e = m[v.value.selectedServerUid];
|
|
68
|
+
if (e)
|
|
69
|
+
return e;
|
|
98
70
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
71
|
+
if (d.value?.selectedServerUid) {
|
|
72
|
+
const e = m[d.value.selectedServerUid];
|
|
73
|
+
if (e)
|
|
74
|
+
return e;
|
|
103
75
|
}
|
|
104
|
-
),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
76
|
+
}), N = r(
|
|
77
|
+
() => i.value[l.Cookies] === "default" ? t.value?.cookies[0] ?? "default" : i.value[l.Cookies]
|
|
78
|
+
), h = r(() => {
|
|
79
|
+
const e = t.value?.environments ?? {}, n = f.value.uid ? JSON.parse(f.value.value) : {}, E = I(e).map(([o, F]) => ({
|
|
80
|
+
key: o,
|
|
81
|
+
value: F,
|
|
109
82
|
source: "global"
|
|
110
|
-
})),
|
|
111
|
-
key:
|
|
112
|
-
value:
|
|
83
|
+
})), p = I(n).map(([o, F]) => ({
|
|
84
|
+
key: o,
|
|
85
|
+
value: F,
|
|
113
86
|
source: "collection"
|
|
114
|
-
})),
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
}),
|
|
118
|
-
|
|
119
|
-
}), Array.from(
|
|
87
|
+
})), c = /* @__PURE__ */ new Map();
|
|
88
|
+
return p.forEach((o) => {
|
|
89
|
+
c.set(o.key, o);
|
|
90
|
+
}), E.forEach((o) => {
|
|
91
|
+
c.has(o.key) || c.set(o.key, o);
|
|
92
|
+
}), Array.from(c.values());
|
|
120
93
|
});
|
|
121
94
|
return {
|
|
122
|
-
activeCollection:
|
|
123
|
-
activeCookieId:
|
|
124
|
-
activeExample:
|
|
125
|
-
activeRequest:
|
|
126
|
-
activeRouterParams:
|
|
127
|
-
activeEnvironment:
|
|
128
|
-
activeServer:
|
|
129
|
-
activeWorkspace:
|
|
130
|
-
activeWorkspaceCollections:
|
|
131
|
-
activeWorkspaceServers:
|
|
132
|
-
activeEnvVariables:
|
|
133
|
-
activeWorkspaceRequests:
|
|
95
|
+
activeCollection: d,
|
|
96
|
+
activeCookieId: N,
|
|
97
|
+
activeExample: C,
|
|
98
|
+
activeRequest: v,
|
|
99
|
+
activeRouterParams: i,
|
|
100
|
+
activeEnvironment: f,
|
|
101
|
+
activeServer: O,
|
|
102
|
+
activeWorkspace: t,
|
|
103
|
+
activeWorkspaceCollections: s,
|
|
104
|
+
activeWorkspaceServers: g,
|
|
105
|
+
activeEnvVariables: h,
|
|
106
|
+
activeWorkspaceRequests: x
|
|
134
107
|
};
|
|
135
|
-
},
|
|
136
|
-
const
|
|
137
|
-
if (!
|
|
108
|
+
}, R = Symbol(), V = () => {
|
|
109
|
+
const a = q(R);
|
|
110
|
+
if (!a)
|
|
138
111
|
throw new Error("Active entities store not provided");
|
|
139
|
-
return
|
|
112
|
+
return a;
|
|
140
113
|
};
|
|
141
114
|
export {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
115
|
+
R as ACTIVE_ENTITIES_SYMBOL,
|
|
116
|
+
T as createActiveEntitiesStore,
|
|
117
|
+
V as useActiveEntities
|
|
145
118
|
};
|
|
@@ -1,74 +1,73 @@
|
|
|
1
|
-
import { collectionSchema as
|
|
2
|
-
import { LS_KEYS as
|
|
3
|
-
import { mutationFactory as
|
|
4
|
-
import { reactive as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
1
|
+
import { collectionSchema as E } from "@scalar/oas-utils/entities/spec";
|
|
2
|
+
import { LS_KEYS as h } from "@scalar/helpers/object/local-storage";
|
|
3
|
+
import { mutationFactory as x } from "@scalar/object-utils/mutator-record";
|
|
4
|
+
import { reactive as f } from "vue";
|
|
5
|
+
function D(s) {
|
|
6
|
+
const r = f({}), a = x(r, f({}), s && h.COLLECTION);
|
|
7
7
|
return {
|
|
8
|
-
collections:
|
|
8
|
+
collections: r,
|
|
9
9
|
collectionMutators: a
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function F({
|
|
13
13
|
requests: s,
|
|
14
|
-
requestMutators:
|
|
14
|
+
requestMutators: r,
|
|
15
15
|
requestExamples: a,
|
|
16
|
-
requestExampleMutators:
|
|
17
|
-
workspaces:
|
|
16
|
+
requestExampleMutators: m,
|
|
17
|
+
workspaces: u,
|
|
18
18
|
workspaceMutators: d,
|
|
19
|
-
collections:
|
|
20
|
-
collectionMutators:
|
|
21
|
-
tagMutators:
|
|
22
|
-
serverMutators:
|
|
19
|
+
collections: i,
|
|
20
|
+
collectionMutators: c,
|
|
21
|
+
tagMutators: v,
|
|
22
|
+
serverMutators: C
|
|
23
23
|
}) {
|
|
24
24
|
return {
|
|
25
|
-
addCollection: (
|
|
26
|
-
const
|
|
27
|
-
return n && d.edit(o, "collections", [...n.collections,
|
|
25
|
+
addCollection: (t, o) => {
|
|
26
|
+
const e = E.parse(t), n = u[o];
|
|
27
|
+
return n && d.edit(o, "collections", [...n.collections, e.uid]), c.add(e), e;
|
|
28
28
|
},
|
|
29
|
-
deleteCollection: (
|
|
30
|
-
var t, n;
|
|
29
|
+
deleteCollection: (t, o) => {
|
|
31
30
|
if (o.uid) {
|
|
32
|
-
if (
|
|
31
|
+
if (i[t.uid]?.info?.title === "Drafts") {
|
|
33
32
|
console.warn("The drafts collection cannot be deleted");
|
|
34
33
|
return;
|
|
35
34
|
}
|
|
36
|
-
if (Object.values(
|
|
35
|
+
if (Object.values(i).length === 1) {
|
|
37
36
|
console.warn("You must have at least one collection");
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
}),
|
|
44
|
-
|
|
39
|
+
t.tags.forEach((e) => v.delete(e)), t.requests.forEach((e) => {
|
|
40
|
+
const n = s[e];
|
|
41
|
+
n && (r.delete(e), n.examples.forEach((l) => a[l] && m.delete(l)));
|
|
42
|
+
}), t.servers.forEach((e) => {
|
|
43
|
+
e && C.delete(e);
|
|
45
44
|
}), d.edit(
|
|
46
45
|
o.uid,
|
|
47
46
|
"collections",
|
|
48
|
-
o.collections.filter((
|
|
49
|
-
),
|
|
47
|
+
o.collections.filter((e) => e !== t.uid)
|
|
48
|
+
), c.delete(t.uid);
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
|
-
addCollectionEnvironment: (
|
|
53
|
-
const n =
|
|
51
|
+
addCollectionEnvironment: (t, o, e) => {
|
|
52
|
+
const n = i[e];
|
|
54
53
|
if (n) {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
...
|
|
58
|
-
[
|
|
54
|
+
const l = n["x-scalar-environments"] || {};
|
|
55
|
+
c.edit(e, "x-scalar-environments", {
|
|
56
|
+
...l,
|
|
57
|
+
[t]: o
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
},
|
|
62
|
-
removeCollectionEnvironment: (
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
const n =
|
|
66
|
-
|
|
61
|
+
removeCollectionEnvironment: (t, o) => {
|
|
62
|
+
const e = i[o];
|
|
63
|
+
if (e) {
|
|
64
|
+
const n = e["x-scalar-environments"] || {};
|
|
65
|
+
t in n && (delete n[t], c.edit(o, "x-scalar-environments", n));
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
};
|
|
70
69
|
}
|
|
71
70
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
D as createStoreCollections,
|
|
72
|
+
F as extendedCollectionDataFactory
|
|
74
73
|
};
|
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
import { fetchDocument as
|
|
2
|
-
import { importSpecToWorkspace as
|
|
3
|
-
import { toRaw as
|
|
4
|
-
import { normalizeError as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
requestMutators:
|
|
8
|
-
collectionMutators:
|
|
9
|
-
serverMutators:
|
|
10
|
-
tagMutators:
|
|
11
|
-
securitySchemeMutators:
|
|
12
|
-
requestExampleMutators:
|
|
13
|
-
workspaceMutators:
|
|
14
|
-
workspaces:
|
|
1
|
+
import { fetchDocument as E, createHash as y } from "@scalar/oas-utils/helpers";
|
|
2
|
+
import { importSpecToWorkspace as R } from "@scalar/oas-utils/transforms";
|
|
3
|
+
import { toRaw as S } from "vue";
|
|
4
|
+
import { normalizeError as g } from "../libs/errors.js";
|
|
5
|
+
const w = {};
|
|
6
|
+
function D({
|
|
7
|
+
requestMutators: i,
|
|
8
|
+
collectionMutators: s,
|
|
9
|
+
serverMutators: l,
|
|
10
|
+
tagMutators: m,
|
|
11
|
+
securitySchemeMutators: p,
|
|
12
|
+
requestExampleMutators: d,
|
|
13
|
+
workspaceMutators: f,
|
|
14
|
+
workspaces: u
|
|
15
15
|
}) {
|
|
16
16
|
const n = async (t, a, e = {}) => {
|
|
17
|
-
|
|
18
|
-
const c = g(t), r = await S(c, e);
|
|
17
|
+
const c = S(t), r = await R(c, e);
|
|
19
18
|
if (r.error) {
|
|
20
19
|
console.group("IMPORT ERRORS"), r.importWarnings.forEach((o) => console.warn(o)), console.groupEnd();
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
|
-
return e.documentUrl && typeof c == "string" && (
|
|
24
|
-
hash:
|
|
22
|
+
return e.documentUrl && typeof c == "string" && (w[e.documentUrl] = {
|
|
23
|
+
hash: y(c),
|
|
25
24
|
schema: r.schema
|
|
26
|
-
}), r.examples.forEach((o) =>
|
|
27
|
-
...
|
|
25
|
+
}), r.examples.forEach((o) => d.add(o)), r.requests.forEach((o) => i.add(o)), r.tags.forEach((o) => m.add(o)), r.servers.forEach((o) => l.add(o)), r.securitySchemes.forEach((o) => p.add(o)), s.add(r.collection), f.edit(a, "collections", [
|
|
26
|
+
...u[a]?.collections ?? [],
|
|
28
27
|
r.collection.uid
|
|
29
28
|
]), r;
|
|
30
29
|
};
|
|
31
|
-
async function
|
|
30
|
+
async function h(t, a, {
|
|
32
31
|
proxyUrl: e,
|
|
33
32
|
...c
|
|
34
33
|
} = {}) {
|
|
35
34
|
try {
|
|
36
|
-
const r = await
|
|
35
|
+
const r = await E(t, e);
|
|
37
36
|
return [
|
|
38
37
|
null,
|
|
39
38
|
await n(r, a, {
|
|
@@ -42,15 +41,15 @@ function O({
|
|
|
42
41
|
})
|
|
43
42
|
];
|
|
44
43
|
} catch (r) {
|
|
45
|
-
return console.error("Failed to fetch spec from URL:", r), [
|
|
44
|
+
return console.error("Failed to fetch spec from URL:", r), [g(r), null];
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
return {
|
|
49
48
|
importSpecFile: n,
|
|
50
|
-
importSpecFromUrl:
|
|
49
|
+
importSpecFromUrl: h
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
52
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
D as importSpecFileFactory,
|
|
54
|
+
w as specDictionary
|
|
56
55
|
};
|
|
@@ -1,47 +1,43 @@
|
|
|
1
|
-
import { createExampleFromRequest as
|
|
2
|
-
import { LS_KEYS as
|
|
3
|
-
import { iterateTitle as
|
|
4
|
-
import { mutationFactory as
|
|
5
|
-
import { reactive as
|
|
6
|
-
function
|
|
7
|
-
const t =
|
|
1
|
+
import { createExampleFromRequest as s } from "@scalar/oas-utils/entities/spec";
|
|
2
|
+
import { LS_KEYS as c } from "@scalar/helpers/object/local-storage";
|
|
3
|
+
import { iterateTitle as x } from "@scalar/helpers/string/iterate-title";
|
|
4
|
+
import { mutationFactory as u } from "@scalar/object-utils/mutator-record";
|
|
5
|
+
import { reactive as i } from "vue";
|
|
6
|
+
function L(a) {
|
|
7
|
+
const t = i({}), m = u(
|
|
8
8
|
t,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
i({}),
|
|
10
|
+
a && c.REQUEST_EXAMPLE
|
|
11
11
|
);
|
|
12
12
|
return {
|
|
13
13
|
requestExamples: t,
|
|
14
14
|
requestExampleMutators: m
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
requestExamples:
|
|
17
|
+
function T({
|
|
18
|
+
requestExamples: a,
|
|
19
19
|
requestExampleMutators: t,
|
|
20
20
|
requestMutators: m,
|
|
21
|
-
requests:
|
|
21
|
+
requests: d
|
|
22
22
|
}) {
|
|
23
23
|
return {
|
|
24
|
-
addRequestExample: (e,
|
|
25
|
-
const
|
|
24
|
+
addRequestExample: (e, o) => {
|
|
25
|
+
const n = o ?? x(
|
|
26
26
|
(e.summary ?? "Example") + " #1",
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
), i = c(e, r);
|
|
32
|
-
return t.add(i), m.edit(e.uid, "examples", [...e.examples, i.uid]), i;
|
|
27
|
+
(p) => e.examples.some((l) => a[l]?.name === p)
|
|
28
|
+
), r = s(e, n);
|
|
29
|
+
return t.add(r), m.edit(e.uid, "examples", [...e.examples, r.uid]), r;
|
|
33
30
|
},
|
|
34
31
|
deleteRequestExample: (e) => {
|
|
35
|
-
var a;
|
|
36
32
|
e.requestUid && (m.edit(
|
|
37
33
|
e.requestUid,
|
|
38
34
|
"examples",
|
|
39
|
-
|
|
35
|
+
d[e.requestUid]?.examples.filter((o) => o !== e.uid) || []
|
|
40
36
|
), t.delete(e.uid));
|
|
41
37
|
}
|
|
42
38
|
};
|
|
43
39
|
}
|
|
44
40
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
L as createStoreRequestExamples,
|
|
42
|
+
T as extendedExampleDataFactory
|
|
47
43
|
};
|