@scalar/api-client 2.1.26 → 2.1.27
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 +17 -0
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +149 -89
- package/dist/components/ImportCollection/ImportNowButton.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +7 -9
- package/dist/layouts/App/create-api-client-app.d.ts +77 -20
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/App/create-api-client-app.js +14 -12
- package/dist/layouts/Modal/create-api-client-modal.d.ts +154 -40
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Modal/create-api-client-modal.js +23 -26
- package/dist/layouts/Web/create-api-client-web.d.ts +77 -20
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/layouts/Web/create-api-client-web.js +12 -10
- package/dist/libs/create-client.d.ts +77 -20
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +60 -58
- package/dist/store/collections.d.ts +34 -4
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/import-spec.d.ts +43 -4
- package/dist/store/import-spec.d.ts.map +1 -1
- package/dist/store/import-spec.js +60 -36
- package/dist/store/requests.d.ts +4 -1
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/requests.js +76 -76
- package/dist/store/security-schemes.d.ts +2 -2
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/security-schemes.js +35 -37
- package/dist/store/servers.d.ts +10 -10
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/store.d.ts +154 -40
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +27 -27
- package/dist/style.css +1 -1
- 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 +39 -38
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +12 -12
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.js +4 -4
- package/dist/views/Request/RequestSidebar.vue2.js +107 -102
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +165 -135
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +3 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +96 -71
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts +9 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.js +86 -0
- package/dist/views/Request/libs/live-sync.d.ts +59 -0
- package/dist/views/Request/libs/live-sync.d.ts.map +1 -0
- package/dist/views/Request/libs/live-sync.js +289 -0
- package/dist/views/Request/types/sidebar-item.d.ts +2 -0
- package/dist/views/Request/types/sidebar-item.d.ts.map +1 -1
- package/package.json +10 -8
|
@@ -1,149 +1,174 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { PathId as
|
|
6
|
-
import { useModal as z, ScalarDropdown as
|
|
7
|
-
import { useRouter as
|
|
8
|
-
import { useWorkspace as
|
|
9
|
-
const
|
|
1
|
+
import { defineComponent as A, ref as L, watch as P, onMounted as K, onBeforeUnmount as j, openBlock as r, createElementBlock as w, Fragment as y, createBlock as p, unref as n, withKeys as G, withCtx as u, createVNode as o, createElementVNode as g, createCommentVNode as $, createTextVNode as N, toDisplayString as H } from "vue";
|
|
2
|
+
import J from "../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
|
|
3
|
+
import O from "../../components/Sidebar/Actions/EditSidebarListCollection.vue.js";
|
|
4
|
+
import Q from "../../components/Sidebar/Actions/EditSidebarListElement.vue.js";
|
|
5
|
+
import { PathId as b } from "../../router.js";
|
|
6
|
+
import { useModal as z, ScalarDropdown as X, ScalarDropdownItem as k, ScalarIcon as v, ScalarModal as F } from "@scalar/components";
|
|
7
|
+
import { useRouter as Y } from "vue-router";
|
|
8
|
+
import { useWorkspace as Z } from "../../store/store.js";
|
|
9
|
+
const ae = /* @__PURE__ */ A({
|
|
10
10
|
__name: "RequestSidebarItemMenu",
|
|
11
11
|
props: {
|
|
12
12
|
menuItem: {}
|
|
13
13
|
},
|
|
14
|
-
emits: ["closeMenu"],
|
|
15
|
-
setup(
|
|
16
|
-
const a =
|
|
14
|
+
emits: ["closeMenu", "toggleWatchForChanges"],
|
|
15
|
+
setup(S, { emit: q }) {
|
|
16
|
+
const a = S, h = q, { replace: C } = Y(), { activeWorkspace: E, activeRouterParams: M, events: x } = Z(), d = z(), I = z(), B = () => {
|
|
17
17
|
var e;
|
|
18
|
-
return
|
|
18
|
+
return x.commandPalette.emit({
|
|
19
19
|
commandName: "Add Example",
|
|
20
20
|
metaData: {
|
|
21
21
|
itemUid: (e = a.menuItem.item) == null ? void 0 : e.entity.uid
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
},
|
|
24
|
+
}, R = (e, t) => {
|
|
25
25
|
var m;
|
|
26
|
-
(m = a.menuItem.item) == null || m.edit(e, t),
|
|
27
|
-
},
|
|
26
|
+
(m = a.menuItem.item) == null || m.edit(e, t), d.hide();
|
|
27
|
+
}, T = () => {
|
|
28
28
|
var e, t, m;
|
|
29
|
-
(e = a.menuItem.item) == null || e.delete(),
|
|
30
|
-
}, f =
|
|
31
|
-
|
|
29
|
+
(e = a.menuItem.item) == null || e.delete(), M.value[b.Request] === ((t = a.menuItem.item) == null ? void 0 : t.entity.uid) && C(`/workspace/${E.value.uid}/request/default`), M.value[b.Examples] === ((m = a.menuItem.item) == null ? void 0 : m.entity.uid) && C(`/workspace/${E.value}/request/default`), I.hide();
|
|
30
|
+
}, f = L(null);
|
|
31
|
+
P([() => a.menuItem.open, f], async ([e]) => {
|
|
32
32
|
var t, m;
|
|
33
33
|
e && ((m = (t = f.value) == null ? void 0 : t.$parent) != null && m.$el) && f.value.$parent.$el.focus();
|
|
34
34
|
});
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const D = () => a.menuItem.open && h("closeMenu");
|
|
36
|
+
K(() => window.addEventListener("click", D)), j(() => window.removeEventListener("click", D));
|
|
37
|
+
const U = () => {
|
|
38
|
+
h("toggleWatchForChanges", a.menuItem.item);
|
|
39
|
+
};
|
|
40
|
+
return (e, t) => {
|
|
41
|
+
var m, W;
|
|
42
|
+
return r(), w(y, null, [
|
|
43
|
+
e.menuItem.targetRef && e.menuItem.open ? (r(), p(n(X), {
|
|
40
44
|
key: 0,
|
|
41
45
|
static: "",
|
|
42
46
|
targetRef: e.menuItem.targetRef,
|
|
43
47
|
teleport: "",
|
|
44
|
-
onKeydown: t[2] || (t[2] =
|
|
48
|
+
onKeydown: t[2] || (t[2] = G((l) => e.$emit("closeMenu"), ["escape"]))
|
|
45
49
|
}, {
|
|
46
|
-
items:
|
|
47
|
-
var l;
|
|
50
|
+
items: u(() => {
|
|
51
|
+
var l, s;
|
|
48
52
|
return [
|
|
49
|
-
((l = e.menuItem.item) == null ? void 0 : l.entity.type) === "request" ? (
|
|
53
|
+
((l = e.menuItem.item) == null ? void 0 : l.entity.type) === "request" ? (r(), p(n(k), {
|
|
50
54
|
key: 0,
|
|
51
55
|
class: "flex gap-2",
|
|
52
|
-
onClick:
|
|
56
|
+
onClick: B
|
|
53
57
|
}, {
|
|
54
|
-
default:
|
|
55
|
-
o(n(
|
|
58
|
+
default: u(() => [
|
|
59
|
+
o(n(v), {
|
|
56
60
|
class: "inline-flex",
|
|
57
61
|
icon: "Example",
|
|
58
62
|
size: "md",
|
|
59
63
|
thickness: "1.5"
|
|
60
64
|
}),
|
|
61
|
-
t[6] || (t[6] =
|
|
65
|
+
t[6] || (t[6] = g("span", null, "Add Example", -1))
|
|
62
66
|
]),
|
|
63
67
|
_: 1
|
|
64
|
-
})) :
|
|
65
|
-
o(n(
|
|
68
|
+
})) : $("", !0),
|
|
69
|
+
o(n(k), {
|
|
66
70
|
ref_key: "menuRef",
|
|
67
71
|
ref: f,
|
|
68
72
|
class: "flex gap-2",
|
|
69
|
-
onClick: t[0] || (t[0] = (i) => n(
|
|
73
|
+
onClick: t[0] || (t[0] = (i) => n(d).show())
|
|
70
74
|
}, {
|
|
71
|
-
default:
|
|
75
|
+
default: u(() => {
|
|
72
76
|
var i;
|
|
73
77
|
return [
|
|
74
|
-
o(n(
|
|
78
|
+
o(n(v), {
|
|
75
79
|
class: "inline-flex",
|
|
76
80
|
icon: "Edit",
|
|
77
81
|
size: "md",
|
|
78
82
|
thickness: "1.5"
|
|
79
83
|
}),
|
|
80
|
-
|
|
81
|
-
((i = e.menuItem.item) == null ? void 0 : i.entity.type) === "collection" ? (
|
|
82
|
-
|
|
83
|
-
], 64)) : (
|
|
84
|
-
|
|
84
|
+
g("span", null, [
|
|
85
|
+
((i = e.menuItem.item) == null ? void 0 : i.entity.type) === "collection" ? (r(), w(y, { key: 0 }, [
|
|
86
|
+
N(" Edit ")
|
|
87
|
+
], 64)) : (r(), w(y, { key: 1 }, [
|
|
88
|
+
N(" Rename ")
|
|
85
89
|
], 64))
|
|
86
90
|
])
|
|
87
91
|
];
|
|
88
92
|
}),
|
|
89
93
|
_: 1
|
|
90
94
|
}, 512),
|
|
91
|
-
|
|
95
|
+
(s = e.menuItem.item) != null && s.documentUrl ? (r(), p(n(k), {
|
|
96
|
+
key: 1,
|
|
97
|
+
ref_key: "menuRef",
|
|
98
|
+
ref: f,
|
|
92
99
|
class: "flex gap-2",
|
|
93
|
-
onClick:
|
|
100
|
+
onClick: U
|
|
94
101
|
}, {
|
|
95
|
-
default:
|
|
96
|
-
|
|
102
|
+
default: u(() => {
|
|
103
|
+
var i, c;
|
|
104
|
+
return [
|
|
105
|
+
o(n(v), {
|
|
106
|
+
class: "inline-flex",
|
|
107
|
+
icon: (i = e.menuItem.item) != null && i.watchForChanges ? "Unwatch" : "Watch",
|
|
108
|
+
size: "md",
|
|
109
|
+
thickness: "1.5"
|
|
110
|
+
}, null, 8, ["icon"]),
|
|
111
|
+
g("span", null, H((c = e.menuItem.item) != null && c.watchForChanges ? "Disable Watch Mode" : "Enable Watch Mode"), 1)
|
|
112
|
+
];
|
|
113
|
+
}),
|
|
114
|
+
_: 1
|
|
115
|
+
}, 512)) : $("", !0),
|
|
116
|
+
o(n(k), {
|
|
117
|
+
class: "flex gap-2",
|
|
118
|
+
onClick: t[1] || (t[1] = (i) => n(I).show())
|
|
119
|
+
}, {
|
|
120
|
+
default: u(() => [
|
|
121
|
+
o(n(v), {
|
|
97
122
|
class: "inline-flex",
|
|
98
123
|
icon: "Delete",
|
|
99
124
|
size: "md",
|
|
100
125
|
thickness: "1.5"
|
|
101
126
|
}),
|
|
102
|
-
t[7] || (t[7] =
|
|
127
|
+
t[7] || (t[7] = g("span", null, "Delete", -1))
|
|
103
128
|
]),
|
|
104
129
|
_: 1
|
|
105
130
|
})
|
|
106
131
|
];
|
|
107
132
|
}),
|
|
108
133
|
_: 1
|
|
109
|
-
}, 8, ["targetRef"])) :
|
|
110
|
-
o(n(
|
|
134
|
+
}, 8, ["targetRef"])) : $("", !0),
|
|
135
|
+
o(n(F), {
|
|
111
136
|
size: "xxs",
|
|
112
|
-
state: n(
|
|
137
|
+
state: n(I),
|
|
113
138
|
title: `Delete ${(m = e.menuItem.item) == null ? void 0 : m.resourceTitle}`
|
|
114
139
|
}, {
|
|
115
|
-
default:
|
|
116
|
-
var l,
|
|
140
|
+
default: u(() => {
|
|
141
|
+
var l, s;
|
|
117
142
|
return [
|
|
118
|
-
o(
|
|
143
|
+
o(J, {
|
|
119
144
|
variableName: ((l = e.menuItem.item) == null ? void 0 : l.title) ?? "",
|
|
120
|
-
warningMessage: (
|
|
121
|
-
onClose: t[3] || (t[3] = (
|
|
122
|
-
onDelete:
|
|
145
|
+
warningMessage: (s = e.menuItem.item) == null ? void 0 : s.warning,
|
|
146
|
+
onClose: t[3] || (t[3] = (i) => n(I).hide()),
|
|
147
|
+
onDelete: T
|
|
123
148
|
}, null, 8, ["variableName", "warningMessage"])
|
|
124
149
|
];
|
|
125
150
|
}),
|
|
126
151
|
_: 1
|
|
127
152
|
}, 8, ["state", "title"]),
|
|
128
|
-
o(n(
|
|
153
|
+
o(n(F), {
|
|
129
154
|
size: "xxs",
|
|
130
|
-
state: n(
|
|
131
|
-
title: `Edit ${(
|
|
155
|
+
state: n(d),
|
|
156
|
+
title: `Edit ${(W = e.menuItem.item) == null ? void 0 : W.resourceTitle}`
|
|
132
157
|
}, {
|
|
133
|
-
default:
|
|
134
|
-
var l, i, c
|
|
158
|
+
default: u(() => {
|
|
159
|
+
var l, s, i, c;
|
|
135
160
|
return [
|
|
136
|
-
((l = e.menuItem.item) == null ? void 0 : l.resourceTitle) === "Collection" ? (
|
|
161
|
+
((l = e.menuItem.item) == null ? void 0 : l.resourceTitle) === "Collection" ? (r(), p(O, {
|
|
137
162
|
key: 0,
|
|
138
|
-
icon: ((
|
|
139
|
-
name: (
|
|
140
|
-
onClose: t[4] || (t[4] = (
|
|
141
|
-
onEdit:
|
|
142
|
-
}, null, 8, ["icon", "name"])) : (
|
|
163
|
+
icon: ((s = e.menuItem.item) == null ? void 0 : s.icon) || "interface-content-folder",
|
|
164
|
+
name: (i = e.menuItem.item) == null ? void 0 : i.title,
|
|
165
|
+
onClose: t[4] || (t[4] = (V) => n(d).hide()),
|
|
166
|
+
onEdit: R
|
|
167
|
+
}, null, 8, ["icon", "name"])) : (r(), p(Q, {
|
|
143
168
|
key: 1,
|
|
144
|
-
name: ((
|
|
145
|
-
onClose: t[5] || (t[5] = (
|
|
146
|
-
onEdit:
|
|
169
|
+
name: ((c = e.menuItem.item) == null ? void 0 : c.title) ?? "",
|
|
170
|
+
onClose: t[5] || (t[5] = (V) => n(d).hide()),
|
|
171
|
+
onEdit: R
|
|
147
172
|
}, null, 8, ["name"]))
|
|
148
173
|
];
|
|
149
174
|
}),
|
|
@@ -154,5 +179,5 @@ const le = /* @__PURE__ */ h({
|
|
|
154
179
|
}
|
|
155
180
|
});
|
|
156
181
|
export {
|
|
157
|
-
|
|
182
|
+
ae as default
|
|
158
183
|
};
|
|
@@ -13,7 +13,7 @@ const N = { class: "relative col-1 flex-center gap-6 p-2 capitalize" }, q = { cl
|
|
|
13
13
|
s.commandPalette.emit({ commandName: "Create Request" });
|
|
14
14
|
}, c = (n) => {
|
|
15
15
|
n != null && n.openCommandPaletteRequest && m();
|
|
16
|
-
}, x = "2.1.
|
|
16
|
+
}, x = "2.1.27";
|
|
17
17
|
return k(() => s.hotKeys.on(c)), R(() => s.hotKeys.off(c)), (n, e) => (r(), l("div", N, [
|
|
18
18
|
t("div", q, [
|
|
19
19
|
o(f).isReadOnly ? p("", !0) : (r(), l("div", v, [
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook which handles polling the documentUrl for changes then attempts to merge what is new
|
|
3
|
+
*
|
|
4
|
+
* TODO:
|
|
5
|
+
* - check lastModified or similar headers
|
|
6
|
+
* - speed up the polling when there's a change then slowly slow it down
|
|
7
|
+
*/
|
|
8
|
+
export declare const useOpenApiWatcher: () => void;
|
|
9
|
+
//# sourceMappingURL=useOpenApiWatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOpenApiWatcher.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/hooks/useOpenApiWatcher.ts"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,YAyI7B,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { specDictionary as u } from "../../../store/import-spec.js";
|
|
2
|
+
import { combineRenameDiffs as y, mutateCollectionDiff as A, mutateSecuritySchemeDiff as R, mutateServerDiff as S, mutateTagDiff as D, mutateRequestDiff as E } from "../libs/live-sync.js";
|
|
3
|
+
import { fetchSpecFromUrl as C, createHash as T } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { parseSchema as l } from "@scalar/oas-utils/transforms";
|
|
5
|
+
import { useToasts as d } from "@scalar/use-toasts";
|
|
6
|
+
import { useTimeoutPoll as F } from "@vueuse/core";
|
|
7
|
+
import I from "microdiff";
|
|
8
|
+
import { watch as U } from "vue";
|
|
9
|
+
import { useWorkspace as L } from "../../../store/store.js";
|
|
10
|
+
const N = 5 * 1e3, b = 60 * 1e3, V = () => {
|
|
11
|
+
const { toast: h } = d(), c = L(), { activeCollection: t, activeWorkspace: g, collectionMutators: i } = c, o = (e) => h(
|
|
12
|
+
`[useOpenApiWatcher] Changes to the ${e} were not applied`,
|
|
13
|
+
"error"
|
|
14
|
+
), v = (e) => {
|
|
15
|
+
e.path[0] === "info" || e.path[0] === "security" ? A(e, c) || o("collection") : e.path[0] === "components" && e.path[1] === "securitySchemes" ? R(e, c) || o("securitySchemes") : e.path[0] === "servers" ? S(e, c) || o("servers") : e.path[0] === "tags" ? D(e, c) || o("tags") : e.path[0] === "paths" && (E(e, c) || o("requests"));
|
|
16
|
+
}, { pause: f, resume: p } = F(async () => {
|
|
17
|
+
var m;
|
|
18
|
+
const e = (m = t.value) == null ? void 0 : m.documentUrl;
|
|
19
|
+
if (!e) return;
|
|
20
|
+
const s = u[e];
|
|
21
|
+
try {
|
|
22
|
+
const r = await C(
|
|
23
|
+
e,
|
|
24
|
+
g.value.proxyUrl,
|
|
25
|
+
!1
|
|
26
|
+
), n = T(r);
|
|
27
|
+
if (i.edit(
|
|
28
|
+
t.value.uid,
|
|
29
|
+
"watchForChangesStatus",
|
|
30
|
+
"WATCHING"
|
|
31
|
+
), s != null && s.hash)
|
|
32
|
+
if (s.hash && s.hash !== n) {
|
|
33
|
+
const { schema: a } = await l(r), O = I(s.schema, a), W = y(O);
|
|
34
|
+
try {
|
|
35
|
+
W.forEach(v), u[e] = {
|
|
36
|
+
hash: n,
|
|
37
|
+
schema: a
|
|
38
|
+
};
|
|
39
|
+
} catch (w) {
|
|
40
|
+
console.error("[useOpenApiWatcher] Error:", w);
|
|
41
|
+
}
|
|
42
|
+
} else console.log("[useOpenApiWatcher] No changes detected yet…");
|
|
43
|
+
else {
|
|
44
|
+
const { schema: a } = await l(r);
|
|
45
|
+
a && (u[e] = {
|
|
46
|
+
hash: n,
|
|
47
|
+
schema: a
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
} catch (r) {
|
|
51
|
+
console.error("[useOpenApiWatcher] Error:", r), console.info("[useOpenApiWatcher] Pausing watcher for 60 seconds"), f(), i.edit(
|
|
52
|
+
t.value.uid,
|
|
53
|
+
"watchForChangesStatus",
|
|
54
|
+
"ERROR"
|
|
55
|
+
), h(
|
|
56
|
+
"[useOpenApiWatcher] Unable to fetch the spec file, paused the watcher for 60 seconds",
|
|
57
|
+
"error"
|
|
58
|
+
), setTimeout(() => {
|
|
59
|
+
console.info("[useOpenApiWatcher] Resuming watcher"), p();
|
|
60
|
+
}, b);
|
|
61
|
+
}
|
|
62
|
+
}, N);
|
|
63
|
+
U(
|
|
64
|
+
[
|
|
65
|
+
() => {
|
|
66
|
+
var e;
|
|
67
|
+
return (e = t.value) == null ? void 0 : e.documentUrl;
|
|
68
|
+
},
|
|
69
|
+
() => {
|
|
70
|
+
var e;
|
|
71
|
+
return (e = t.value) == null ? void 0 : e.watchForChanges;
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
([e, s]) => {
|
|
75
|
+
e && s ? (console.info(`[useOpenApiWatcher] Watching ${e} …`), p()) : t.value && (f(), i.edit(
|
|
76
|
+
t.value.uid,
|
|
77
|
+
"watchForChangesStatus",
|
|
78
|
+
"IDLE"
|
|
79
|
+
));
|
|
80
|
+
},
|
|
81
|
+
{ immediate: !0 }
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
V as useOpenApiWatcher
|
|
86
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '../../../store/index.js';
|
|
2
|
+
import { type Path, type PathValue } from '@scalar/object-utils/nested';
|
|
3
|
+
import { type Difference } from 'microdiff';
|
|
4
|
+
import { type ZodSchema, type ZodTypeDef } from 'zod';
|
|
5
|
+
/**
|
|
6
|
+
* Combine Rename Diffs
|
|
7
|
+
* Rename diffs show up as a delete and an add.
|
|
8
|
+
* This will go through the diff and combine any diff items which are next to each other which go from remove to add.
|
|
9
|
+
*
|
|
10
|
+
* - first we check if the payloads are the same then it was just a simple rename
|
|
11
|
+
* - next we will add the rename and also handle any changes in the diff
|
|
12
|
+
*/
|
|
13
|
+
export declare const combineRenameDiffs: (diff: Difference[], pathPrefix?: string[]) => Difference[];
|
|
14
|
+
/** Like array.find but returns the resource instead of the uid */
|
|
15
|
+
export declare const findResource: <T>(arr: string[], resources: Record<string, T>, condition: (resource: T) => boolean) => T | null;
|
|
16
|
+
/**
|
|
17
|
+
* Traverses a zod schema based on the path and returns the schema at the end of the path
|
|
18
|
+
* or null if the path doesn't exist. Handles optional unwrapping, records, and arrays
|
|
19
|
+
*/
|
|
20
|
+
export declare const traverseZodSchema: (schema: ZodSchema, path: (string | number)[]) => ZodSchema | null;
|
|
21
|
+
/**
|
|
22
|
+
* Takes in diff, uses the path to get to the nested schema then parse the value
|
|
23
|
+
* If there is a sub schema and it successfully parses, both the path and new value are valid and returned as such
|
|
24
|
+
*
|
|
25
|
+
* We return a tuple to make it easier to pass into the mutators
|
|
26
|
+
*/
|
|
27
|
+
export declare const parseDiff: <T>(schema: ZodSchema<T, ZodTypeDef, any>, diff: Difference) => {
|
|
28
|
+
/** Typed path as it has been checked agains the schema */
|
|
29
|
+
path: Path<T>;
|
|
30
|
+
/** Path without the last item, used for getting the whole array instead of an item of the array */
|
|
31
|
+
pathMinusOne: Path<T>;
|
|
32
|
+
/** Typed value which has been parsed against the schema */
|
|
33
|
+
value: PathValue<T, Path<T>> | undefined;
|
|
34
|
+
} | null;
|
|
35
|
+
/**
|
|
36
|
+
* Transforms the diff into a payload for the collection mutator then executes that mutation
|
|
37
|
+
*
|
|
38
|
+
* @returns true if it succeeds, and false for a failure
|
|
39
|
+
*/
|
|
40
|
+
export declare const mutateCollectionDiff: (diff: Difference, { activeCollection, collectionMutators }: WorkspaceStore) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Generates an array of payloads for the request mutator from the request diff, also executes the mutation
|
|
43
|
+
*/
|
|
44
|
+
export declare const mutateRequestDiff: (diff: Difference, store: WorkspaceStore) => boolean;
|
|
45
|
+
/** Generates a payload for the server mutator from the server diff including the mutator method */
|
|
46
|
+
export declare const mutateServerDiff: (diff: Difference, { activeCollection, servers, serverMutators }: WorkspaceStore) => boolean;
|
|
47
|
+
/** Generates a payload for the tag mutator from the tag diff */
|
|
48
|
+
export declare const mutateTagDiff: (diff: Difference, { activeCollection, tags, tagMutators }: WorkspaceStore) => boolean;
|
|
49
|
+
/** Narrows down a zod union schema */
|
|
50
|
+
export declare const narrowUnionSchema: (schema: ZodSchema, key: string, value: string) => ZodSchema | null;
|
|
51
|
+
/**
|
|
52
|
+
* Generates a payload for the security scheme mutator from the security scheme diff, then executes that mutation
|
|
53
|
+
*
|
|
54
|
+
* Note: for edit we cannot use parseDiff here as it can't do unions, so we handle the unions first
|
|
55
|
+
*
|
|
56
|
+
* @returns true if it succeeds, and false for a failure
|
|
57
|
+
*/
|
|
58
|
+
export declare const mutateSecuritySchemeDiff: (diff: Difference, { activeCollection, securitySchemes, securitySchemeMutators }: WorkspaceStore) => boolean;
|
|
59
|
+
//# sourceMappingURL=live-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-sync.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/live-sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAgB7C,OAAO,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EAEf,MAAM,6BAA6B,CAAA;AAEpC,OAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAK,MAAM,KAAK,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,SACvB,UAAU,EAAE,eACN,MAAM,EAAE,KACnB,UAAU,EAqFZ,CAAA;AAED,kEAAkE;AAClE,eAAO,MAAM,YAAY,GAAI,CAAC,OACvB,MAAM,EAAE,aACF,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,aACjB,CAAC,QAAQ,EAAE,CAAC,KAAK,OAAO,KAClC,CAAC,GAAG,IAMN,CAAA;AASD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,WACpB,SAAS,QACX,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KACxB,SAAS,GAAG,IAqDd,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,UACjB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,QAC/B,UAAU,KACf;IACD,0DAA0D;IAC1D,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACb,mGAAmG;IACnG,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACrB,2DAA2D;IAC3D,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CACzC,GAAG,IAwBH,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,SACzB,UAAU,4CAC0B,cAAc,KACvD,OA0CF,CAAA;AAwBD;;GAEG;AACH,eAAO,MAAM,iBAAiB,SACtB,UAAU,SACT,cAAc,KACpB,OAwIF,CAAA;AAED,mGAAmG;AACnG,eAAO,MAAM,gBAAgB,SACrB,UAAU,iDAC+B,cAAc,KAC5D,OAoCF,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,aAAa,SAClB,UAAU,2CACyB,cAAc,KACtD,OA+BF,CAAA;AAED,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,WACpB,SAAS,OACZ,MAAM,SACJ,MAAM,KACZ,SAAS,GAAG,IAmBd,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,SAC7B,UAAU,iEAC+C,cAAc,KAC5E,OA+EF,CAAA"}
|