@scalar/api-client 2.0.22 → 2.0.25
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 +48 -0
- package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBar.vue.js +2 -2
- package/dist/components/AddressBar/AddressBar.vue2.js +80 -84
- package/dist/components/AddressBar/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue.js +11 -10
- package/dist/components/AddressBar/AddressBarServer.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts +10 -0
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.js +3 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +42 -37
- package/dist/components/CodeInput/codeDropdownWidget.d.ts +24 -0
- package/dist/components/CodeInput/codeDropdownWidget.d.ts.map +1 -0
- package/dist/components/CodeInput/codeDropdownWidget.js +110 -0
- package/dist/components/CodeInput/codeVariableWidget.d.ts +8 -0
- package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -0
- package/dist/components/CodeInput/codeVariableWidget.js +124 -0
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts +2 -15
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +51 -54
- package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts +4 -2
- package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteExample.vue.js +106 -92
- package/dist/components/CommandPalette/CommandPaletteFolder.vue.d.ts +2 -15
- package/dist/components/CommandPalette/CommandPaletteFolder.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteFolder.vue.js +68 -74
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts +2 -15
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +56 -62
- package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts +2 -15
- package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +106 -99
- package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.d.ts +7 -0
- package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.d.ts.map +1 -0
- package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.js +57 -0
- package/dist/components/CommandPalette/CommandPaletteWorkspace.vue2.js +4 -0
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +50 -0
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -0
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +9 -0
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +198 -0
- package/dist/components/CommandPalette/index.d.ts +2 -0
- package/dist/components/CommandPalette/index.d.ts.map +1 -0
- package/dist/components/CommandPalette/index.js +4 -0
- package/dist/components/ContextBar.vue.js +4 -4
- package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.js +7 -6
- package/dist/components/DataTable/DataTableCheckbox.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableCheckbox.vue.js +3 -2
- package/dist/components/DataTable/DataTableInput.vue.d.ts +1 -1
- package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInput.vue.js +3 -3
- package/dist/components/DataTable/DataTableInput.vue2.js +36 -49
- package/dist/components/DataTable/DataTableInputSelect.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInputSelect.vue.js +15 -14
- package/dist/components/Search/SearchButton.vue.d.ts.map +1 -1
- package/dist/components/Search/SearchButton.vue.js +7 -6
- package/dist/components/SideNav/SideNav.vue.d.ts.map +1 -1
- package/dist/components/SideNav/SideNav.vue.js +26 -23
- package/dist/components/SideNav/SideNavLink.vue.d.ts +3 -2
- package/dist/components/SideNav/SideNavLink.vue.d.ts.map +1 -1
- package/dist/components/SideNav/SideNavLink.vue.js +18 -16
- package/dist/components/Sidebar/Sidebar.vue.d.ts +15 -2
- package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.vue.js +14 -12
- package/dist/components/Sidebar/SidebarButton.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarButton.vue.js +5 -5
- package/dist/components/Sidebar/SidebarListElementActions.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarListElementActions.vue.js +2 -2
- package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
- package/dist/components/TopNav/TopNav.vue.js +1 -1
- package/dist/components/TopNav/TopNav.vue2.js +31 -29
- package/dist/components/TopNav/TopNavItem.vue.d.ts +7 -3
- package/dist/components/TopNav/TopNavItem.vue.d.ts.map +1 -1
- package/dist/components/TopNav/TopNavItem.vue.js +2 -2
- package/dist/components/TopNav/TopNavItem.vue2.js +18 -18
- package/dist/components/ViewLayout/ViewLayout.vue.d.ts.map +1 -1
- package/dist/components/ViewLayout/ViewLayout.vue.js +1 -1
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.d.ts.map +1 -1
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +2 -1
- package/dist/constants.d.ts +13 -7
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -16
- package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -0
- package/dist/layouts/App/ApiClientApp.vue.js +72 -0
- package/dist/{App → layouts/App}/createApiClientApp.d.ts +1 -1
- package/dist/layouts/App/createApiClientApp.d.ts.map +1 -0
- package/dist/{App → layouts/App}/createApiClientApp.js +2 -2
- package/dist/layouts/App/index.d.ts.map +1 -0
- package/dist/{Modal → layouts/Modal}/ApiClientModal.vue.d.ts +1 -0
- package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -0
- package/dist/{Modal → layouts/Modal}/ApiClientModal.vue.js +2 -2
- package/dist/layouts/Modal/api-client-modal.d.ts.map +1 -0
- package/dist/{Modal → layouts/Modal}/api-client-modal.js +7 -7
- package/dist/layouts/Modal/index.d.ts.map +1 -0
- package/dist/libs/eventBusses/command-palette.d.ts +14 -0
- package/dist/libs/eventBusses/command-palette.d.ts.map +1 -0
- package/dist/libs/eventBusses/command-palette.js +5 -0
- package/dist/libs/local-storage.d.ts +1 -1
- package/dist/libs/local-storage.d.ts.map +1 -1
- package/dist/libs/local-storage.js +19 -19
- package/dist/router.d.ts +18 -6
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +107 -71
- package/dist/store/topNav.d.ts +94 -82
- package/dist/store/topNav.d.ts.map +1 -1
- package/dist/store/topNav.js +21 -20
- package/dist/store/workspace.d.ts +312 -82
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +299 -224
- package/dist/style.css +1 -1
- package/dist/views/Collection/Collection.vue.d.ts.map +1 -1
- package/dist/views/Components/Schemas/Schemas.vue.d.ts.map +1 -1
- package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +9 -12
- package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
- package/dist/views/Environment/Environment.vue2.js +22 -25
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +38 -47
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +125 -108
- package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue.js +5 -4
- package/dist/views/Request/RequestSection/RequestSection.vue.js +3 -2
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.js +4 -4
- package/dist/views/Request/RequestSection/RequestTable.vue2.js +22 -21
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +6 -5
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
- package/dist/views/Request/RequestSidebarItem.vue2.js +84 -79
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +58 -38
- package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue.js +3 -2
- package/dist/views/Request/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/views/Request/components/OAuth2.vue.js +2 -0
- package/dist/{App.vue.d.ts → views/Request/components/WorkspaceDropdown.vue.d.ts} +1 -2
- package/dist/views/Request/components/WorkspaceDropdown.vue.d.ts.map +1 -0
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +80 -0
- package/dist/views/Request/components/WorkspaceDropdown.vue2.js +4 -0
- package/dist/views/Request/components/index.d.ts +1 -0
- package/dist/views/Request/components/index.d.ts.map +1 -1
- package/dist/views/Request/components/index.js +4 -2
- package/dist/views/Servers/Servers.vue.d.ts.map +1 -1
- package/dist/views/Servers/Servers.vue2.js +12 -15
- package/package.json +19 -15
- package/dist/App/ApiClientApp.vue.d.ts.map +0 -1
- package/dist/App/ApiClientApp.vue.js +0 -56
- package/dist/App/createApiClientApp.d.ts.map +0 -1
- package/dist/App/index.d.ts.map +0 -1
- package/dist/App.vue.d.ts.map +0 -1
- package/dist/App.vue.js +0 -77
- package/dist/App.vue3.js +0 -5
- package/dist/Modal/ApiClientModal.vue.d.ts.map +0 -1
- package/dist/Modal/api-client-modal.d.ts.map +0 -1
- package/dist/Modal/index.d.ts.map +0 -1
- package/dist/components/AddressBar/AddressBarServer.vue.js +0 -106
- package/dist/components/AddressBar/AddressBarServer.vue2.js +0 -4
- package/dist/components/CommandPalette/CommandPalette.vue.d.ts +0 -17
- package/dist/components/CommandPalette/CommandPalette.vue.d.ts.map +0 -1
- package/dist/components/CommandPalette/CommandPalette.vue.js +0 -7
- package/dist/components/CommandPalette/CommandPalette.vue2.js +0 -184
- package/dist/main.d.ts +0 -2
- package/dist/main.d.ts.map +0 -1
- package/dist/views/Collection/Collection.vue.js +0 -4
- package/dist/views/Collection/Collection.vue2.js +0 -136
- package/dist/views/Components/Schemas/Schemas.vue.js +0 -4
- package/dist/views/Components/Schemas/Schemas.vue2.js +0 -20
- /package/dist/{App → layouts/App}/ApiClientApp.vue.d.ts +0 -0
- /package/dist/{App → layouts/App}/ApiClientApp.vue3.js +0 -0
- /package/dist/{App → layouts/App}/index.d.ts +0 -0
- /package/dist/{App → layouts/App}/index.js +0 -0
- /package/dist/{Modal → layouts/Modal}/ApiClientModal.vue2.js +0 -0
- /package/dist/{Modal → layouts/Modal}/api-client-modal.d.ts +0 -0
- /package/dist/{Modal → layouts/Modal}/index.d.ts +0 -0
- /package/dist/{Modal → layouts/Modal}/index.js +0 -0
package/dist/store/workspace.js
CHANGED
|
@@ -1,83 +1,84 @@
|
|
|
1
|
-
import { activeRouterParams as
|
|
2
|
-
import { useModal as
|
|
3
|
-
import { createWorkspace as
|
|
4
|
-
import { createCollection as
|
|
5
|
-
import { createEnvironment as
|
|
6
|
-
import { createFolder as
|
|
7
|
-
import { createSecurityScheme as
|
|
8
|
-
import { createServer as
|
|
9
|
-
import { createRequest as
|
|
10
|
-
import { iterateTitle as
|
|
11
|
-
import { getRequestBodyFromOperation as
|
|
12
|
-
import { importSpecToWorkspace as
|
|
1
|
+
import { activeRouterParams as U, PathId as b, fallbackMissingParams as $ } from "../router.js";
|
|
2
|
+
import { useModal as X } from "@scalar/components";
|
|
3
|
+
import { createWorkspace as _ } from "@scalar/oas-utils/entities/workspace";
|
|
4
|
+
import { createCollection as z } from "@scalar/oas-utils/entities/workspace/collection";
|
|
5
|
+
import { createEnvironment as Z } from "@scalar/oas-utils/entities/workspace/environment";
|
|
6
|
+
import { createFolder as ee } from "@scalar/oas-utils/entities/workspace/folder";
|
|
7
|
+
import { createSecurityScheme as te } from "@scalar/oas-utils/entities/workspace/security";
|
|
8
|
+
import { createServer as se } from "@scalar/oas-utils/entities/workspace/server";
|
|
9
|
+
import { createRequest as oe, createRequestExample as ce, createRequestExampleParameter as ae } from "@scalar/oas-utils/entities/workspace/spec";
|
|
10
|
+
import { iterateTitle as ie, fetchSpecFromUrl as le } from "@scalar/oas-utils/helpers";
|
|
11
|
+
import { getRequestBodyFromOperation as re } from "@scalar/oas-utils/spec-getters";
|
|
12
|
+
import { importSpecToWorkspace as de } from "@scalar/oas-utils/transforms";
|
|
13
13
|
import { mutationFactory as m, LS_KEYS as f } from "@scalar/object-utils/mutator-record";
|
|
14
|
-
import { reactive as
|
|
15
|
-
import { useSidebar as
|
|
16
|
-
const { setCollapsedSidebarFolder:
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
import { reactive as i, computed as r, toRaw as ne } from "vue";
|
|
15
|
+
import { useSidebar as ue } from "../hooks/useSidebar.js";
|
|
16
|
+
const { setCollapsedSidebarFolder: me } = ue(), h = !!(typeof process < "u" && Object.hasOwn(process.env, "ENABLE_LOCAL_STORAGE")), E = i({}), R = m(
|
|
17
|
+
E,
|
|
18
|
+
i({}),
|
|
19
19
|
h && f.REQUEST
|
|
20
|
-
),
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
...
|
|
24
|
-
|
|
25
|
-
]) :
|
|
26
|
-
...
|
|
27
|
-
|
|
28
|
-
])),
|
|
29
|
-
},
|
|
30
|
-
e.childUids.forEach((s) =>
|
|
20
|
+
), D = (e, t, s) => {
|
|
21
|
+
const o = oe(e), c = P(o, s);
|
|
22
|
+
return o.childUids.push(c.uid), R.add(o), t && (a[t] ? u.edit(t, "childUids", [
|
|
23
|
+
...a[t].childUids,
|
|
24
|
+
o.uid
|
|
25
|
+
]) : n[t] && p.edit(t, "childUids", [
|
|
26
|
+
...n[t].childUids,
|
|
27
|
+
o.uid
|
|
28
|
+
])), o;
|
|
29
|
+
}, fe = (e, t) => {
|
|
30
|
+
e.childUids.forEach((s) => x.delete(s)), a[t] ? u.edit(
|
|
31
31
|
t,
|
|
32
32
|
"childUids",
|
|
33
|
-
|
|
34
|
-
) :
|
|
33
|
+
a[t].childUids.filter((s) => s !== e.uid)
|
|
34
|
+
) : n[t] && p.edit(
|
|
35
35
|
t,
|
|
36
36
|
"childUids",
|
|
37
|
-
|
|
38
|
-
),
|
|
39
|
-
},
|
|
40
|
-
var c;
|
|
41
|
-
const e =
|
|
42
|
-
return
|
|
43
|
-
(
|
|
37
|
+
n[t].childUids.filter((s) => s !== e.uid)
|
|
38
|
+
), R.delete(e.uid);
|
|
39
|
+
}, O = r(() => {
|
|
40
|
+
var o, c;
|
|
41
|
+
const e = U.value[b.Request], t = (c = (o = V.value) == null ? void 0 : o[0]) == null ? void 0 : c.uid, s = E[e] ?? E[t];
|
|
42
|
+
return $(b.Request, s), s && I(s.uid).forEach(
|
|
43
|
+
(d) => me(d, !0)
|
|
44
44
|
), s;
|
|
45
|
-
}),
|
|
46
|
-
const s = Object.values(
|
|
47
|
-
(
|
|
45
|
+
}), I = (e, t = []) => {
|
|
46
|
+
const s = Object.values(a).find(
|
|
47
|
+
(c) => c.childUids.includes(e)
|
|
48
48
|
);
|
|
49
49
|
if (s) return [...t, s.uid];
|
|
50
|
-
const
|
|
51
|
-
({ childUids:
|
|
50
|
+
const o = Object.values(n).find(
|
|
51
|
+
({ childUids: c }) => c.includes(e)
|
|
52
52
|
);
|
|
53
|
-
return
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
return o ? I(o.uid, [...t, o.uid]) : t;
|
|
54
|
+
}, k = i({}), x = m(
|
|
55
|
+
k,
|
|
56
|
+
i({}),
|
|
57
57
|
h && f.REQUEST_EXAMPLE
|
|
58
|
-
),
|
|
59
|
-
var t, s,
|
|
60
|
-
return
|
|
58
|
+
), j = (e) => {
|
|
59
|
+
var t, s, o, c, d, l, v;
|
|
60
|
+
return ae({
|
|
61
61
|
key: e.name,
|
|
62
62
|
value: e.schema && "default" in e.schema ? e.schema.default : e.schema && "examples" in e.schema && e.schema.examples.length > 0 ? e.schema.examples[0] : "",
|
|
63
63
|
description: e.description,
|
|
64
64
|
required: e.required,
|
|
65
|
+
enabled: !!e.required,
|
|
65
66
|
enum: (t = e.schema) == null ? void 0 : t.enum,
|
|
66
67
|
type: (s = e.schema) == null ? void 0 : s.type,
|
|
67
|
-
format: (
|
|
68
|
-
minimum: (
|
|
69
|
-
maximum: (
|
|
70
|
-
default: (
|
|
71
|
-
nullable: (
|
|
68
|
+
format: (o = e.schema) == null ? void 0 : o.format,
|
|
69
|
+
minimum: (c = e.schema) == null ? void 0 : c.minimum,
|
|
70
|
+
maximum: (d = e.schema) == null ? void 0 : d.maximum,
|
|
71
|
+
default: (l = e.schema) == null ? void 0 : l.default,
|
|
72
|
+
nullable: (v = e.schema) == null ? void 0 : v.nullable
|
|
72
73
|
});
|
|
73
|
-
},
|
|
74
|
-
var
|
|
75
|
-
const
|
|
76
|
-
path: Object.values(e.parameters.path).map(
|
|
77
|
-
query: Object.values(e.parameters.query).map(
|
|
78
|
-
headers: Object.values(e.parameters.headers).map(
|
|
79
|
-
cookies: Object.values(e.parameters.cookies).map(
|
|
80
|
-
},
|
|
74
|
+
}, P = (e, t, s) => {
|
|
75
|
+
var v;
|
|
76
|
+
const o = {
|
|
77
|
+
path: Object.values(e.parameters.path).map(j),
|
|
78
|
+
query: Object.values(e.parameters.query).map(j),
|
|
79
|
+
headers: Object.values(e.parameters.headers).map(j),
|
|
80
|
+
cookies: Object.values(e.parameters.cookies).map(j)
|
|
81
|
+
}, c = {
|
|
81
82
|
activeBody: "raw",
|
|
82
83
|
raw: {
|
|
83
84
|
encoding: "json",
|
|
@@ -85,50 +86,55 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
85
86
|
}
|
|
86
87
|
};
|
|
87
88
|
if (e.requestBody) {
|
|
88
|
-
const
|
|
89
|
+
const S = re({
|
|
89
90
|
httpVerb: e.method,
|
|
90
91
|
path: e.path,
|
|
91
92
|
information: {
|
|
92
93
|
requestBody: e.requestBody
|
|
93
94
|
}
|
|
94
95
|
});
|
|
95
|
-
((
|
|
96
|
+
((v = S == null ? void 0 : S.postData) == null ? void 0 : v.mimeType) === "application/json" && (o.headers.push({
|
|
96
97
|
key: "Content-Type",
|
|
97
98
|
value: "application/json",
|
|
98
99
|
enabled: !0
|
|
99
|
-
}),
|
|
100
|
+
}), c.activeBody = "raw", c.raw.value = S.postData.text);
|
|
100
101
|
}
|
|
101
|
-
const
|
|
102
|
+
const d = s ?? ie(
|
|
102
103
|
(e.summary ?? "Example") + " #1",
|
|
103
|
-
(
|
|
104
|
-
),
|
|
104
|
+
(S) => e.childUids.some((Q) => S === k[Q].name)
|
|
105
|
+
), l = ce({
|
|
106
|
+
url: t != null && t.url ? `{{${t == null ? void 0 : t.url}}}${e.path}` : e.path,
|
|
105
107
|
requestUid: e.uid,
|
|
106
|
-
parameters:
|
|
107
|
-
name:
|
|
108
|
-
body:
|
|
108
|
+
parameters: o,
|
|
109
|
+
name: d,
|
|
110
|
+
body: c
|
|
109
111
|
});
|
|
110
|
-
return
|
|
111
|
-
},
|
|
112
|
-
const
|
|
113
|
-
|
|
112
|
+
return x.add(l), l;
|
|
113
|
+
}, he = (e, t) => {
|
|
114
|
+
const s = P(
|
|
115
|
+
e,
|
|
116
|
+
L.value[0],
|
|
117
|
+
t
|
|
118
|
+
);
|
|
119
|
+
return R.edit(e.uid, "childUids", [
|
|
114
120
|
...e.childUids,
|
|
115
|
-
|
|
116
|
-
]);
|
|
117
|
-
},
|
|
118
|
-
|
|
121
|
+
s.uid
|
|
122
|
+
]), s;
|
|
123
|
+
}, pe = (e) => {
|
|
124
|
+
R.edit(
|
|
119
125
|
e.requestUid,
|
|
120
126
|
"childUids",
|
|
121
|
-
|
|
127
|
+
E[e.requestUid].childUids.filter(
|
|
122
128
|
(t) => t !== e.uid
|
|
123
129
|
)
|
|
124
|
-
),
|
|
125
|
-
},
|
|
130
|
+
), x.delete(e.uid);
|
|
131
|
+
}, ve = r(
|
|
126
132
|
() => {
|
|
127
133
|
var e;
|
|
128
|
-
return
|
|
134
|
+
return k[U.value[b.Examples]] ?? k[((e = O.value) == null ? void 0 : e.childUids[0]) ?? ""];
|
|
129
135
|
}
|
|
130
|
-
),
|
|
131
|
-
default:
|
|
136
|
+
), Ee = r(() => Object.values(E).flatMap((e) => e.history).filter((e) => e.request && e.response).sort((e, t) => t.timestamp - e.timestamp)), A = i({
|
|
137
|
+
default: Z({
|
|
132
138
|
uid: "default",
|
|
133
139
|
name: "Global Environment",
|
|
134
140
|
color: "blue",
|
|
@@ -136,82 +142,141 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
136
142
|
parsed: [],
|
|
137
143
|
isDefault: !0
|
|
138
144
|
})
|
|
139
|
-
}),
|
|
140
|
-
|
|
141
|
-
|
|
145
|
+
}), B = m(
|
|
146
|
+
A,
|
|
147
|
+
i({}),
|
|
142
148
|
h && f.ENVIRONMENT
|
|
143
|
-
),
|
|
149
|
+
), ye = (e) => {
|
|
144
150
|
if (e === "default") {
|
|
145
151
|
console.warn("Default environment cannot be deleted.");
|
|
146
152
|
return;
|
|
147
153
|
}
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
|
|
154
|
+
B.delete(e);
|
|
155
|
+
}, Se = r(() => {
|
|
156
|
+
const e = L.value.map((s) => ({
|
|
157
|
+
key: s.url,
|
|
158
|
+
value: s.url
|
|
159
|
+
})), t = Object.values(A).map((s) => {
|
|
160
|
+
try {
|
|
161
|
+
return {
|
|
162
|
+
_scalarEnvId: s.uid,
|
|
163
|
+
...JSON.parse(s.raw)
|
|
164
|
+
};
|
|
165
|
+
} catch {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
}).filter((s) => s).flatMap(
|
|
169
|
+
(s) => Object.entries(s).flatMap(([o, c]) => o !== "_scalarEnvId" ? [{ _scalarEnvId: s._scalarEnvId, key: o, value: c }] : [])
|
|
170
|
+
);
|
|
171
|
+
return [...e, ...t];
|
|
172
|
+
}), K = i({}), we = m(
|
|
173
|
+
K,
|
|
174
|
+
i({}),
|
|
152
175
|
h && f.COOKIE
|
|
153
|
-
),
|
|
154
|
-
() =>
|
|
155
|
-
),
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
h &&
|
|
159
|
-
),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
176
|
+
), Me = r(
|
|
177
|
+
() => U.value[b.Cookies]
|
|
178
|
+
), w = i({}), y = m(
|
|
179
|
+
w,
|
|
180
|
+
i({}),
|
|
181
|
+
h && f.WORKSPACE
|
|
182
|
+
), Re = (e = {}) => {
|
|
183
|
+
const t = _(e);
|
|
184
|
+
y.add(t);
|
|
185
|
+
const s = g(
|
|
186
|
+
{
|
|
187
|
+
spec: {
|
|
188
|
+
info: {
|
|
189
|
+
title: "Drafts"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
t.uid
|
|
194
|
+
);
|
|
195
|
+
return D({ summary: "My First Request" }, s.uid), t;
|
|
196
|
+
}, be = (e) => {
|
|
197
|
+
if (e === "default") {
|
|
198
|
+
console.warn("Default environment cannot be deleted.");
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
y.delete(e);
|
|
202
|
+
}, M = r(
|
|
203
|
+
() => w[U.value[b.Workspace]] ?? w[Object.keys(w)[0]]
|
|
204
|
+
), W = r(
|
|
205
|
+
() => {
|
|
206
|
+
var e;
|
|
207
|
+
return (e = M.value) == null ? void 0 : e.collectionUids.map((t) => a[t]).sort((t, s) => {
|
|
208
|
+
var o, c, d, l;
|
|
209
|
+
return ((c = (o = t.spec) == null ? void 0 : o.info) == null ? void 0 : c.title) === "Drafts" ? 1 : ((l = (d = s.spec) == null ? void 0 : d.info) == null ? void 0 : l.title) === "Drafts" ? -1 : 0;
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
), L = r(
|
|
213
|
+
() => {
|
|
214
|
+
var e;
|
|
215
|
+
return (e = W.value) == null ? void 0 : e.flatMap(
|
|
216
|
+
(t) => t.spec.serverUids.map((s) => F[s])
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
), N = (e) => E[e] ?? n[e].childUids.flatMap((t) => N(t)), V = r(
|
|
220
|
+
() => {
|
|
221
|
+
var e;
|
|
222
|
+
return (e = W.value) == null ? void 0 : e.flatMap(
|
|
223
|
+
(t) => t.childUids.flatMap((s) => N(s))
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
), Oe = r(() => {
|
|
173
227
|
var e;
|
|
174
|
-
return ((e =
|
|
175
|
-
}),
|
|
176
|
-
|
|
177
|
-
|
|
228
|
+
return ((e = M.value) == null ? void 0 : e.isReadOnly) ?? !1;
|
|
229
|
+
}), a = i({}), u = m(
|
|
230
|
+
a,
|
|
231
|
+
i({}),
|
|
178
232
|
h && f.COLLECTION
|
|
179
|
-
),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
),
|
|
201
|
-
|
|
202
|
-
|
|
233
|
+
), g = (e, t) => {
|
|
234
|
+
const s = z(e);
|
|
235
|
+
return y.edit(t, "collectionUids", [
|
|
236
|
+
...w[t].collectionUids,
|
|
237
|
+
s.uid
|
|
238
|
+
]), u.add(s), s;
|
|
239
|
+
}, ke = (e) => {
|
|
240
|
+
var t, s, o;
|
|
241
|
+
if (M.value) {
|
|
242
|
+
if (((o = (s = (t = a[e]) == null ? void 0 : t.spec) == null ? void 0 : s.info) == null ? void 0 : o.title) === "Drafts") {
|
|
243
|
+
console.warn("The drafts collection cannot be deleted");
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (Object.values(a).length === 1) {
|
|
247
|
+
console.warn("You must have at least one collection");
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
y.edit(
|
|
251
|
+
M.value.uid,
|
|
252
|
+
"collectionUids",
|
|
253
|
+
M.value.collectionUids.filter((c) => c !== e)
|
|
254
|
+
), u.delete(e);
|
|
255
|
+
}
|
|
256
|
+
}, C = r(() => {
|
|
257
|
+
const e = Object.values(a)[0];
|
|
258
|
+
if (!O.value) return e;
|
|
259
|
+
const t = I(O.value.uid);
|
|
260
|
+
if (!t.length) return null;
|
|
261
|
+
const s = t[t.length - 1];
|
|
262
|
+
return a[s] ?? e;
|
|
263
|
+
}), xe = r(
|
|
264
|
+
() => C.value && F[C.value.selectedServerUid]
|
|
265
|
+
), n = i({}), p = m(
|
|
266
|
+
n,
|
|
267
|
+
i({}),
|
|
203
268
|
h && f.FOLDER
|
|
204
|
-
),
|
|
205
|
-
const s =
|
|
269
|
+
), Y = (e, t) => {
|
|
270
|
+
const s = ee(e);
|
|
206
271
|
if (t)
|
|
207
|
-
if (
|
|
272
|
+
if (a[t])
|
|
208
273
|
u.edit(t, "childUids", [
|
|
209
|
-
...
|
|
274
|
+
...a[t].childUids,
|
|
210
275
|
s.uid
|
|
211
276
|
]);
|
|
212
|
-
else if (
|
|
277
|
+
else if (n[t])
|
|
213
278
|
p.edit(t, "childUids", [
|
|
214
|
-
...
|
|
279
|
+
...n[t].childUids,
|
|
215
280
|
s.uid
|
|
216
281
|
]);
|
|
217
282
|
else {
|
|
@@ -219,138 +284,148 @@ const { setCollapsedSidebarFolder: re } = de(), h = !!(typeof process < "u" && O
|
|
|
219
284
|
return;
|
|
220
285
|
}
|
|
221
286
|
p.add(s);
|
|
222
|
-
},
|
|
223
|
-
|
|
287
|
+
}, Ce = (e, t) => {
|
|
288
|
+
a[t] ? u.edit(
|
|
224
289
|
t,
|
|
225
290
|
"childUids",
|
|
226
|
-
|
|
227
|
-
) :
|
|
291
|
+
a[t].childUids.filter((s) => s !== e)
|
|
292
|
+
) : n[t] && p.edit(
|
|
228
293
|
t,
|
|
229
294
|
"childUids",
|
|
230
|
-
|
|
295
|
+
n[t].childUids.filter((s) => s !== e)
|
|
231
296
|
), p.delete(e);
|
|
232
|
-
},
|
|
233
|
-
|
|
234
|
-
|
|
297
|
+
}, T = i({}), G = m(
|
|
298
|
+
T,
|
|
299
|
+
i({}),
|
|
235
300
|
h && f.SECURITY_SCHEME
|
|
236
|
-
),
|
|
301
|
+
), je = r(
|
|
237
302
|
() => {
|
|
238
303
|
var e;
|
|
239
|
-
return (e =
|
|
240
|
-
const s =
|
|
241
|
-
return { scheme: s, ...
|
|
304
|
+
return (e = C.value) == null ? void 0 : e.selectedSecuritySchemes.map((t) => {
|
|
305
|
+
const s = T[t.uid], o = t.flowKey && "flows" in s && s.flows ? { flow: s.flows[t.flowKey] } : {};
|
|
306
|
+
return { scheme: s, ...o };
|
|
242
307
|
})[0];
|
|
243
308
|
}
|
|
244
|
-
),
|
|
309
|
+
), qe = r(
|
|
245
310
|
() => {
|
|
246
311
|
var e, t;
|
|
247
|
-
return ((e =
|
|
312
|
+
return ((e = O.value) == null ? void 0 : e.security) ?? ((t = C.value) == null ? void 0 : t.spec.security) ?? [];
|
|
248
313
|
}
|
|
249
|
-
),
|
|
250
|
-
|
|
251
|
-
|
|
314
|
+
), F = i({}), q = m(
|
|
315
|
+
F,
|
|
316
|
+
i({}),
|
|
252
317
|
h && f.SERVER
|
|
253
|
-
),
|
|
254
|
-
const s =
|
|
318
|
+
), H = (e, t) => {
|
|
319
|
+
const s = se(e);
|
|
255
320
|
t && u.edit(t, "spec.serverUids", [
|
|
256
|
-
...
|
|
321
|
+
...a[t].spec.serverUids,
|
|
257
322
|
s.uid
|
|
258
323
|
]), q.add(s);
|
|
259
|
-
},
|
|
324
|
+
}, Ue = (e, t) => {
|
|
260
325
|
u.edit(
|
|
261
326
|
t,
|
|
262
327
|
"spec.serverUids",
|
|
263
|
-
|
|
328
|
+
a[t].spec.serverUids.filter(
|
|
264
329
|
(s) => s !== e
|
|
265
330
|
)
|
|
266
331
|
), q.delete(e);
|
|
267
332
|
};
|
|
268
|
-
async function
|
|
269
|
-
var
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
(
|
|
333
|
+
async function J(e, t = "default", s = !0) {
|
|
334
|
+
var d;
|
|
335
|
+
const o = ne(e), c = await de(o);
|
|
336
|
+
s && y.add(_({ uid: t })), c.requests.forEach(
|
|
337
|
+
(l) => D(l, void 0, c.servers[0])
|
|
338
|
+
), g(c.collection, t), c.folders.forEach((l) => Y(l)), c.servers.forEach((l) => H(l)), Object.entries(
|
|
339
|
+
(((d = c.components) == null ? void 0 : d.securitySchemes) || c.securityDefinitions) ?? {}
|
|
273
340
|
).forEach(
|
|
274
|
-
([
|
|
275
|
-
|
|
341
|
+
([l, v]) => G.add(
|
|
342
|
+
te({ ...v, uid: l })
|
|
276
343
|
)
|
|
277
344
|
);
|
|
278
345
|
}
|
|
279
|
-
async function
|
|
346
|
+
async function Fe(e, t) {
|
|
280
347
|
try {
|
|
281
|
-
const s = await
|
|
282
|
-
await
|
|
348
|
+
const s = await le(e, t);
|
|
349
|
+
await J(s);
|
|
283
350
|
} catch (s) {
|
|
284
351
|
console.error("Failed to fetch spec from URL:", s);
|
|
285
352
|
}
|
|
286
353
|
}
|
|
287
|
-
const
|
|
354
|
+
const De = X(), Je = () => ({
|
|
288
355
|
// ---------------------------------------------------------------------------
|
|
289
356
|
// STATE
|
|
290
|
-
workspaces:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
357
|
+
workspaces: w,
|
|
358
|
+
collections: a,
|
|
359
|
+
cookies: K,
|
|
360
|
+
environments: A,
|
|
361
|
+
folders: n,
|
|
362
|
+
requestExamples: k,
|
|
363
|
+
requests: E,
|
|
364
|
+
servers: F,
|
|
365
|
+
securitySchemes: T,
|
|
366
|
+
activeCollection: C,
|
|
367
|
+
activeCookieId: Me,
|
|
368
|
+
activeExample: ve,
|
|
369
|
+
activeRequest: O,
|
|
370
|
+
activeSecurityRequirements: qe,
|
|
371
|
+
activeSecurityScheme: je,
|
|
372
|
+
activeServer: xe,
|
|
373
|
+
activeWorkspace: M,
|
|
374
|
+
activeWorkspaceCollections: W,
|
|
375
|
+
activeWorkspaceServers: L,
|
|
376
|
+
activeParsedEnvironments: Se,
|
|
377
|
+
activeWorkspaceRequests: V,
|
|
378
|
+
modalState: De,
|
|
379
|
+
isReadOnly: Oe,
|
|
310
380
|
// ---------------------------------------------------------------------------
|
|
311
381
|
// METHODS
|
|
312
|
-
importSpecFile:
|
|
313
|
-
importSpecFromUrl:
|
|
314
|
-
cookieMutators:
|
|
315
|
-
createExampleFromRequest: F,
|
|
382
|
+
importSpecFile: J,
|
|
383
|
+
importSpecFromUrl: Fe,
|
|
384
|
+
cookieMutators: we,
|
|
316
385
|
collectionMutators: {
|
|
317
386
|
...u,
|
|
318
387
|
rawAdd: u.add,
|
|
319
|
-
add:
|
|
320
|
-
delete:
|
|
388
|
+
add: g,
|
|
389
|
+
delete: ke
|
|
321
390
|
},
|
|
322
391
|
environmentMutators: {
|
|
323
|
-
...
|
|
324
|
-
delete:
|
|
392
|
+
...B,
|
|
393
|
+
delete: ye
|
|
325
394
|
},
|
|
326
395
|
folderMutators: {
|
|
327
396
|
...p,
|
|
328
397
|
rawAdd: p.add,
|
|
329
|
-
add:
|
|
330
|
-
delete:
|
|
398
|
+
add: Y,
|
|
399
|
+
delete: Ce
|
|
331
400
|
},
|
|
332
401
|
requestMutators: {
|
|
333
|
-
...
|
|
334
|
-
rawAdd:
|
|
335
|
-
add:
|
|
336
|
-
delete:
|
|
402
|
+
...R,
|
|
403
|
+
rawAdd: R.add,
|
|
404
|
+
add: D,
|
|
405
|
+
delete: fe
|
|
337
406
|
},
|
|
338
407
|
requestExampleMutators: {
|
|
339
|
-
...
|
|
340
|
-
rawAdd:
|
|
341
|
-
add:
|
|
342
|
-
delete:
|
|
408
|
+
...x,
|
|
409
|
+
rawAdd: x.add,
|
|
410
|
+
add: he,
|
|
411
|
+
delete: pe
|
|
343
412
|
},
|
|
344
|
-
requestsHistory:
|
|
345
|
-
securitySchemeMutators:
|
|
413
|
+
requestsHistory: Ee,
|
|
414
|
+
securitySchemeMutators: G,
|
|
346
415
|
serverMutators: {
|
|
347
416
|
...q,
|
|
348
417
|
rawAdd: q.add,
|
|
349
|
-
add:
|
|
350
|
-
delete:
|
|
418
|
+
add: H,
|
|
419
|
+
delete: Ue
|
|
351
420
|
},
|
|
352
|
-
workspaceMutators:
|
|
421
|
+
workspaceMutators: {
|
|
422
|
+
...y,
|
|
423
|
+
rawAdd: y.add,
|
|
424
|
+
add: Re,
|
|
425
|
+
delete: be
|
|
426
|
+
}
|
|
353
427
|
});
|
|
354
428
|
export {
|
|
355
|
-
|
|
429
|
+
I as findRequestFolders,
|
|
430
|
+
Je as useWorkspace
|
|
356
431
|
};
|