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