@omniviewdev/runtime 0.1.11 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Client-BRYjLBXY.cjs +1 -0
- package/dist/{Client-DRRyPmcf.js → Client-RGYOEzh2.js} +312 -275
- package/dist/api.cjs +1 -1
- package/dist/api.d.ts +1 -0
- package/dist/api.js +95 -51
- package/dist/context/drawer/types.d.ts +1 -1
- package/dist/errors/types.d.ts +2 -0
- package/dist/hooks/connection/useConnectionStatus.d.ts +3 -3
- package/dist/hooks/connection/useConnections.d.ts +2 -2
- package/dist/hooks/resource/index.d.ts +2 -1
- package/dist/hooks/resource/useActiveSyncs.d.ts +2 -2
- package/dist/hooks/resource/useEditorSchemas.d.ts +2 -2
- package/dist/hooks/resource/useEventBatcher.d.ts +55 -0
- package/dist/hooks/resource/useResource.d.ts +9 -21
- package/dist/hooks/resource/useResourceActions.d.ts +3 -3
- package/dist/hooks/resource/useResourceGroups.d.ts +1 -1
- package/dist/hooks/resource/useResourceMutations.d.ts +14 -7
- package/dist/hooks/resource/useResourceSearch.d.ts +1 -1
- package/dist/hooks/resource/useResourceType.d.ts +1 -1
- package/dist/hooks/resource/useResourceTypes.d.ts +1 -1
- package/dist/hooks/resource/useResources.d.ts +14 -22
- package/dist/hooks/resource/useWatchState.d.ts +28 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1406 -1295
- package/dist/models.cjs +1 -1
- package/dist/models.js +1343 -972
- package/dist/types/index.d.ts +1 -1
- package/dist/types/watch.d.ts +29 -0
- package/dist/utils/activeSyncAggregator.d.ts +13 -8
- package/dist/utils/resourceKey.d.ts +12 -0
- package/dist/wailsjs/go/devserver/DevServerManager.d.ts +2 -0
- package/dist/wailsjs/go/models.d.ts +400 -214
- package/dist/wailsjs/go/plugin/pluginManager.d.ts +3 -1
- package/dist/wailsjs/go/pluginlog/Manager.d.ts +18 -0
- package/dist/wailsjs/go/resource/Client.d.ts +39 -23
- package/package.json +1 -1
- package/dist/Client-BtQwAB3N.cjs +0 -1
- package/dist/errors/parseAppError.test.d.ts +0 -1
- package/dist/hooks/resource/useInformerState.d.ts +0 -24
- package/dist/types/informer.d.ts +0 -49
- package/dist/utils/activeSyncAggregator.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import
|
|
6
|
-
import { Link as
|
|
7
|
-
import { P as
|
|
8
|
-
import { config as
|
|
9
|
-
import { useQueryClient as G, useMutation as v, useQuery as
|
|
10
|
-
import { useNotificationStack as
|
|
11
|
-
import { EventsOn as
|
|
12
|
-
const
|
|
1
|
+
var jt = Object.defineProperty;
|
|
2
|
+
var Gt = (e, t, n) => t in e ? jt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var k = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsx as R, jsxs as ce } from "react/jsx-runtime";
|
|
5
|
+
import S, { useContext as ne, createContext as he, useState as q, useRef as $, useEffect as j, useCallback as U, useMemo as Kt } from "react";
|
|
6
|
+
import { Link as zt, useNavigate as Qt, useLocation as Wt, createMemoryRouter as Bt, RouterProvider as Ht } from "react-router-dom";
|
|
7
|
+
import { P as Yt, G as Jt, V as Vt, S as Xt, h as it, U as Zt, R as en, i as tn, j as at, k as nn, L as rn, l as sn, m as on, n as an, o as cn, q as un, r as ln, s as dn, t as fn, Q as pn, u as yn, v as We, w as hn, x as ct, F as gn, y as mn, z as ut, D as lt, A as _n, B as En, E as Sn, H as dt, I as wn, J as Cn, K as ft, M as bn, N as vn, O as Dn, T as Pn, W as Rn, X as In, Y as Fn } from "./Client-RGYOEzh2.js";
|
|
8
|
+
import { config as On, resource as A, exec as xn, logs as Be, networker as He } from "./models.js";
|
|
9
|
+
import { useQueryClient as G, useMutation as v, useQuery as P, keepPreviousData as pt, useQueries as An } from "@tanstack/react-query";
|
|
10
|
+
import { useNotificationStack as Tn } from "@omniviewdev/ui/feedback";
|
|
11
|
+
import { EventsOn as x, BrowserOpenURL as yt, EventsOff as be } from "./runtime.js";
|
|
12
|
+
const Le = S.createContext(void 0), M = {
|
|
13
13
|
// Plugin
|
|
14
14
|
PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
|
|
15
15
|
PLUGIN_NOT_LOADED: "omniview:plugin/not-loaded",
|
|
@@ -29,6 +29,8 @@ const $e = _.createContext(void 0), xe = {
|
|
|
29
29
|
// Connection
|
|
30
30
|
CONNECTION_NOT_FOUND: "omniview:connection/not-found",
|
|
31
31
|
CONNECTION_FAILED: "omniview:connection/failed",
|
|
32
|
+
RESOURCE_CONNECTION_ERROR: "omniview:resource/connection-error",
|
|
33
|
+
RESOURCE_CERTIFICATE_ERROR: "omniview:resource/certificate-error",
|
|
32
34
|
// Session
|
|
33
35
|
SESSION_NOT_FOUND: "omniview:session/not-found",
|
|
34
36
|
SESSION_FAILED: "omniview:session/failed",
|
|
@@ -38,10 +40,31 @@ const $e = _.createContext(void 0), xe = {
|
|
|
38
40
|
VALIDATION: "omniview:validation",
|
|
39
41
|
NOT_IMPLEMENTED: "omniview:not-implemented"
|
|
40
42
|
};
|
|
41
|
-
function
|
|
43
|
+
function Nn(e) {
|
|
44
|
+
switch (e) {
|
|
45
|
+
case "NOT_FOUND":
|
|
46
|
+
return { typeUri: M.RESOURCE_NOT_FOUND, status: 404 };
|
|
47
|
+
case "FORBIDDEN":
|
|
48
|
+
return { typeUri: M.RESOURCE_FORBIDDEN, status: 403 };
|
|
49
|
+
case "UNAUTHORIZED":
|
|
50
|
+
return { typeUri: M.RESOURCE_UNAUTHORIZED, status: 401 };
|
|
51
|
+
case "CONFLICT":
|
|
52
|
+
case "ALREADY_EXISTS":
|
|
53
|
+
return { typeUri: M.RESOURCE_CONFLICT, status: 409 };
|
|
54
|
+
case "TIMEOUT":
|
|
55
|
+
return { typeUri: M.RESOURCE_TIMEOUT, status: 408 };
|
|
56
|
+
case "CONNECTION_ERROR":
|
|
57
|
+
return { typeUri: M.RESOURCE_CONNECTION_ERROR, status: 503 };
|
|
58
|
+
case "CERTIFICATE_ERROR":
|
|
59
|
+
return { typeUri: M.RESOURCE_CERTIFICATE_ERROR, status: 502 };
|
|
60
|
+
default:
|
|
61
|
+
return { typeUri: M.INTERNAL, status: 500 };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function K(e) {
|
|
42
65
|
if (e == null)
|
|
43
66
|
return {
|
|
44
|
-
type:
|
|
67
|
+
type: M.INTERNAL,
|
|
45
68
|
title: "Unknown error",
|
|
46
69
|
status: 500,
|
|
47
70
|
detail: "An unknown error occurred."
|
|
@@ -49,22 +72,32 @@ function U(e) {
|
|
|
49
72
|
let t;
|
|
50
73
|
if (typeof e == "string" ? t = e : e instanceof Error ? t = e.message : t = String(e), t.startsWith("{"))
|
|
51
74
|
try {
|
|
52
|
-
const
|
|
53
|
-
if (typeof
|
|
54
|
-
return
|
|
75
|
+
const n = JSON.parse(t);
|
|
76
|
+
if (typeof n.type == "string" && typeof n.title == "string" && typeof n.status == "number" && typeof n.detail == "string")
|
|
77
|
+
return n;
|
|
78
|
+
if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
|
|
79
|
+
const { typeUri: r, status: s } = Nn(n.code);
|
|
80
|
+
return {
|
|
81
|
+
type: r,
|
|
82
|
+
title: n.title,
|
|
83
|
+
status: s,
|
|
84
|
+
detail: n.message,
|
|
85
|
+
suggestions: Array.isArray(n.suggestions) ? n.suggestions : void 0
|
|
86
|
+
};
|
|
87
|
+
}
|
|
55
88
|
} catch {
|
|
56
89
|
}
|
|
57
90
|
return {
|
|
58
|
-
type:
|
|
91
|
+
type: M.INTERNAL,
|
|
59
92
|
title: "Error",
|
|
60
93
|
status: 500,
|
|
61
94
|
detail: t
|
|
62
95
|
};
|
|
63
96
|
}
|
|
64
|
-
function
|
|
65
|
-
return e == null ? !1 : (typeof e == "string" ? e : e instanceof Error ? e.message : String(e)) === "cancelled" ? !0 :
|
|
97
|
+
function ht(e) {
|
|
98
|
+
return e == null ? !1 : (typeof e == "string" ? e : e instanceof Error ? e.message : String(e)) === "cancelled" ? !0 : K(e).type === M.CANCELLED;
|
|
66
99
|
}
|
|
67
|
-
function
|
|
100
|
+
function kn(e) {
|
|
68
101
|
switch (e.type) {
|
|
69
102
|
case "navigate":
|
|
70
103
|
return {
|
|
@@ -101,63 +134,63 @@ function kr(e) {
|
|
|
101
134
|
};
|
|
102
135
|
}
|
|
103
136
|
}
|
|
104
|
-
function
|
|
105
|
-
var s,
|
|
106
|
-
const
|
|
137
|
+
function gt(e, t) {
|
|
138
|
+
var s, o;
|
|
139
|
+
const n = [
|
|
107
140
|
e.detail,
|
|
108
|
-
...((s = e.suggestions) == null ? void 0 : s.map((
|
|
141
|
+
...((s = e.suggestions) == null ? void 0 : s.map((i) => `• ${i}`)) ?? []
|
|
109
142
|
].join(`
|
|
110
143
|
`);
|
|
111
144
|
return {
|
|
112
145
|
message: t || (e.title !== "Error" ? e.title : "Operation failed"),
|
|
113
146
|
status: "error",
|
|
114
|
-
details:
|
|
115
|
-
actions: (
|
|
147
|
+
details: n,
|
|
148
|
+
actions: (o = e.actions) == null ? void 0 : o.map(kn)
|
|
116
149
|
};
|
|
117
150
|
}
|
|
118
|
-
function
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
e(
|
|
151
|
+
function Z(e, t, n) {
|
|
152
|
+
if (ht(t)) return;
|
|
153
|
+
const r = K(t);
|
|
154
|
+
e(gt(r, n));
|
|
122
155
|
}
|
|
123
156
|
function I(e, t) {
|
|
124
|
-
return (
|
|
125
|
-
if (
|
|
126
|
-
const
|
|
127
|
-
e(
|
|
157
|
+
return (n) => {
|
|
158
|
+
if (ht(n)) return;
|
|
159
|
+
const r = K(n);
|
|
160
|
+
e(gt(r, r.title !== "Error" ? r.title : t));
|
|
128
161
|
};
|
|
129
162
|
}
|
|
130
|
-
function
|
|
131
|
-
const { children: t, pluginId:
|
|
132
|
-
console.debug("[PluginContextProvider] render", { pluginId:
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
console.debug(`[PluginContextProvider] settings loaded for "${
|
|
136
|
-
}).catch((
|
|
137
|
-
const
|
|
138
|
-
console.error(`[PluginContextProvider] error fetching settings for "${
|
|
163
|
+
function Es(e) {
|
|
164
|
+
const { children: t, pluginId: n } = e, [r, s] = S.useState({}), [o, i] = S.useState(new On.PluginMeta()), [a, u] = S.useState(!1), [l, c] = S.useState(null);
|
|
165
|
+
console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!l });
|
|
166
|
+
const g = () => {
|
|
167
|
+
n === void 0 || n === "" || (console.debug(`[PluginContextProvider] fetching settings for "${n}"`), Yt(n).then((d) => {
|
|
168
|
+
console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(d)), s(d);
|
|
169
|
+
}).catch((d) => {
|
|
170
|
+
const h = K(d);
|
|
171
|
+
console.error(`[PluginContextProvider] error fetching settings for "${n}":`, h.detail);
|
|
139
172
|
}));
|
|
140
|
-
},
|
|
141
|
-
if (
|
|
173
|
+
}, f = () => {
|
|
174
|
+
if (n === void 0 || n === "") {
|
|
142
175
|
console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
|
|
143
176
|
return;
|
|
144
177
|
}
|
|
145
|
-
console.debug(`[PluginContextProvider] fetching meta for "${
|
|
146
|
-
console.debug(`[PluginContextProvider] meta loaded for "${
|
|
147
|
-
}).catch((
|
|
148
|
-
const
|
|
149
|
-
console.error(`[PluginContextProvider] error fetching meta for "${
|
|
178
|
+
console.debug(`[PluginContextProvider] fetching meta for "${n}"`), c(null), Jt(n).then((d) => {
|
|
179
|
+
console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: d == null ? void 0 : d.name, version: d == null ? void 0 : d.version }), i(d), u(!0);
|
|
180
|
+
}).catch((d) => {
|
|
181
|
+
const h = K(d);
|
|
182
|
+
console.error(`[PluginContextProvider] error fetching meta for "${n}":`, h.detail), c(h.detail), u(!1);
|
|
150
183
|
});
|
|
151
184
|
};
|
|
152
|
-
return
|
|
153
|
-
console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${
|
|
154
|
-
}, [
|
|
185
|
+
return S.useEffect(() => {
|
|
186
|
+
console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), g(), f();
|
|
187
|
+
}, [n]), l ? /* @__PURE__ */ R("div", { style: {
|
|
155
188
|
display: "flex",
|
|
156
189
|
flex: 1,
|
|
157
190
|
alignItems: "center",
|
|
158
191
|
justifyContent: "center",
|
|
159
192
|
padding: 24
|
|
160
|
-
}, children: /* @__PURE__ */
|
|
193
|
+
}, children: /* @__PURE__ */ ce("div", { style: {
|
|
161
194
|
maxWidth: 480,
|
|
162
195
|
width: "100%",
|
|
163
196
|
border: "1px solid #7F1D1D",
|
|
@@ -166,19 +199,19 @@ function ws(e) {
|
|
|
166
199
|
padding: 20,
|
|
167
200
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
168
201
|
}, children: [
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ ce("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
|
|
203
|
+
/* @__PURE__ */ ce("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
204
|
+
/* @__PURE__ */ R("circle", { cx: "12", cy: "12", r: "10" }),
|
|
205
|
+
/* @__PURE__ */ R("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
206
|
+
/* @__PURE__ */ R("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
174
207
|
] }),
|
|
175
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ R("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
|
|
176
209
|
] }),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ R("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
|
|
211
|
+
/* @__PURE__ */ R(
|
|
179
212
|
"button",
|
|
180
213
|
{
|
|
181
|
-
onClick: () =>
|
|
214
|
+
onClick: () => f(),
|
|
182
215
|
style: {
|
|
183
216
|
background: "transparent",
|
|
184
217
|
color: "#F87171",
|
|
@@ -192,13 +225,13 @@ function ws(e) {
|
|
|
192
225
|
children: "Retry"
|
|
193
226
|
}
|
|
194
227
|
)
|
|
195
|
-
] }) }) : a ? /* @__PURE__ */
|
|
228
|
+
] }) }) : a ? /* @__PURE__ */ R(Le.Provider, { value: { pluginId: n, settings: r, meta: o }, children: t }) : /* @__PURE__ */ ce("div", { style: {
|
|
196
229
|
display: "flex",
|
|
197
230
|
flex: 1,
|
|
198
231
|
alignItems: "center",
|
|
199
232
|
justifyContent: "center"
|
|
200
233
|
}, children: [
|
|
201
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ R("div", { style: {
|
|
202
235
|
width: 24,
|
|
203
236
|
height: 24,
|
|
204
237
|
border: "2px solid #3F3F46",
|
|
@@ -206,34 +239,34 @@ function ws(e) {
|
|
|
206
239
|
borderRadius: "50%",
|
|
207
240
|
animation: "plugin-spin 0.8s linear infinite"
|
|
208
241
|
} }),
|
|
209
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ R("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
|
|
210
243
|
] });
|
|
211
244
|
}
|
|
212
|
-
function
|
|
213
|
-
const e =
|
|
245
|
+
function $e() {
|
|
246
|
+
const e = ne(Le);
|
|
214
247
|
if (!e)
|
|
215
248
|
throw new Error("usePluginContext must be used within a PluginContextProvider");
|
|
216
249
|
return e;
|
|
217
250
|
}
|
|
218
251
|
function Ss() {
|
|
219
|
-
return
|
|
220
|
-
}
|
|
221
|
-
const
|
|
222
|
-
const [t,
|
|
223
|
-
|
|
224
|
-
console.log("Fetched settings:",
|
|
225
|
-
}).catch((
|
|
226
|
-
console.error("Error fetching settings:",
|
|
252
|
+
return $e().settings;
|
|
253
|
+
}
|
|
254
|
+
const mt = he(void 0), ws = ({ children: e }) => {
|
|
255
|
+
const [t, n] = q({}), r = () => {
|
|
256
|
+
Vt().then((o) => {
|
|
257
|
+
console.log("Fetched settings:", o), n(o);
|
|
258
|
+
}).catch((o) => {
|
|
259
|
+
console.error("Error fetching settings:", o);
|
|
227
260
|
});
|
|
228
261
|
};
|
|
229
|
-
|
|
230
|
-
|
|
262
|
+
S.useEffect(() => {
|
|
263
|
+
r();
|
|
231
264
|
}, []);
|
|
232
265
|
const s = () => {
|
|
233
|
-
|
|
266
|
+
r();
|
|
234
267
|
};
|
|
235
|
-
return /* @__PURE__ */
|
|
236
|
-
},
|
|
268
|
+
return /* @__PURE__ */ R(mt.Provider, { value: { settings: t, reload: s }, children: e });
|
|
269
|
+
}, Mn = {
|
|
237
270
|
height: 32,
|
|
238
271
|
focused: 0,
|
|
239
272
|
tabs: [],
|
|
@@ -257,105 +290,105 @@ const Ct = me(void 0), Cs = ({ children: e }) => {
|
|
|
257
290
|
},
|
|
258
291
|
fullscreenDrawer: () => {
|
|
259
292
|
}
|
|
260
|
-
},
|
|
261
|
-
const [t,
|
|
262
|
-
|
|
263
|
-
}, []), s =
|
|
264
|
-
|
|
265
|
-
(l) => l.map((
|
|
293
|
+
}, Ln = S.createContext(Mn), $n = he(void 0), Un = S.createContext(void 0), _t = S.createContext(void 0), qn = 3e4, Cs = ({ children: e }) => {
|
|
294
|
+
const [t, n] = S.useState([]), r = S.useCallback((a) => {
|
|
295
|
+
n((u) => [a, ...u]);
|
|
296
|
+
}, []), s = S.useCallback((a, u) => {
|
|
297
|
+
n(
|
|
298
|
+
(l) => l.map((c) => c.id === a ? { ...c, ...u } : c)
|
|
266
299
|
);
|
|
267
|
-
}, []),
|
|
268
|
-
|
|
300
|
+
}, []), o = S.useCallback((a) => {
|
|
301
|
+
n((u) => u.filter((l) => l.id !== a));
|
|
269
302
|
}, []);
|
|
270
|
-
|
|
303
|
+
S.useEffect(() => {
|
|
271
304
|
const a = [];
|
|
272
|
-
for (const
|
|
273
|
-
if (
|
|
274
|
-
const l = Date.now() - (
|
|
275
|
-
a.push(setTimeout(() =>
|
|
305
|
+
for (const u of t)
|
|
306
|
+
if (u.status === "completed" || u.status === "error") {
|
|
307
|
+
const l = Date.now() - (u.completedAt ?? u.startedAt), c = Math.max(0, qn - l);
|
|
308
|
+
a.push(setTimeout(() => o(u.id), c));
|
|
276
309
|
}
|
|
277
310
|
return () => a.forEach(clearTimeout);
|
|
278
|
-
}, [t,
|
|
279
|
-
const
|
|
280
|
-
() => ({ operations: t, addOperation:
|
|
281
|
-
[t,
|
|
311
|
+
}, [t, o]);
|
|
312
|
+
const i = S.useMemo(
|
|
313
|
+
() => ({ operations: t, addOperation: r, updateOperation: s, removeOperation: o }),
|
|
314
|
+
[t, r, s, o]
|
|
282
315
|
);
|
|
283
|
-
return /* @__PURE__ */
|
|
316
|
+
return /* @__PURE__ */ R(_t.Provider, { value: i, children: e });
|
|
284
317
|
};
|
|
285
318
|
var Ie = function(e, t) {
|
|
286
|
-
return Ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
287
|
-
|
|
288
|
-
} || function(
|
|
289
|
-
for (var s in
|
|
319
|
+
return Ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
320
|
+
n.__proto__ = r;
|
|
321
|
+
} || function(n, r) {
|
|
322
|
+
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
290
323
|
}, Ie(e, t);
|
|
291
324
|
};
|
|
292
|
-
function
|
|
325
|
+
function jn(e, t) {
|
|
293
326
|
if (typeof t != "function" && t !== null)
|
|
294
327
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
295
328
|
Ie(e, t);
|
|
296
|
-
function
|
|
329
|
+
function n() {
|
|
297
330
|
this.constructor = e;
|
|
298
331
|
}
|
|
299
|
-
e.prototype = t === null ? Object.create(t) : (
|
|
332
|
+
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
|
|
300
333
|
}
|
|
301
|
-
var ve = "Invariant Violation",
|
|
334
|
+
var ve = "Invariant Violation", Ye = Object.setPrototypeOf, Gn = Ye === void 0 ? function(e, t) {
|
|
302
335
|
return e.__proto__ = t, e;
|
|
303
|
-
} :
|
|
336
|
+
} : Ye, Kn = (
|
|
304
337
|
/** @class */
|
|
305
338
|
function(e) {
|
|
306
|
-
|
|
307
|
-
function t(
|
|
308
|
-
|
|
309
|
-
var
|
|
310
|
-
return
|
|
339
|
+
jn(t, e);
|
|
340
|
+
function t(n) {
|
|
341
|
+
n === void 0 && (n = ve);
|
|
342
|
+
var r = e.call(this, typeof n == "number" ? ve + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
|
|
343
|
+
return r.framesToPop = 1, r.name = ve, Gn(r, t.prototype), r;
|
|
311
344
|
}
|
|
312
345
|
return t;
|
|
313
346
|
}(Error)
|
|
314
347
|
);
|
|
315
|
-
function
|
|
348
|
+
function Fe(e, t) {
|
|
316
349
|
if (!e)
|
|
317
|
-
throw new
|
|
350
|
+
throw new Kn(t);
|
|
318
351
|
}
|
|
319
|
-
var
|
|
320
|
-
function
|
|
352
|
+
var Et = ["debug", "log", "warn", "error", "silent"], zn = Et.indexOf("log");
|
|
353
|
+
function ue(e) {
|
|
321
354
|
return function() {
|
|
322
|
-
if (
|
|
355
|
+
if (Et.indexOf(e) >= zn) {
|
|
323
356
|
var t = console[e] || console.log;
|
|
324
357
|
return t.apply(console, arguments);
|
|
325
358
|
}
|
|
326
359
|
};
|
|
327
360
|
}
|
|
328
361
|
(function(e) {
|
|
329
|
-
e.debug =
|
|
330
|
-
})(
|
|
331
|
-
const
|
|
332
|
-
const t =
|
|
362
|
+
e.debug = ue("debug"), e.log = ue("log"), e.warn = ue("warn"), e.error = ue("error");
|
|
363
|
+
})(Fe || (Fe = {}));
|
|
364
|
+
const St = he(void 0), wt = () => ne(St), bs = (e) => {
|
|
365
|
+
const t = wt();
|
|
333
366
|
return t == null ? void 0 : t.getExtensionPoint(e);
|
|
334
367
|
}, vs = (e) => {
|
|
335
|
-
const t =
|
|
336
|
-
return
|
|
337
|
-
},
|
|
338
|
-
const
|
|
339
|
-
return
|
|
340
|
-
|
|
341
|
-
|
|
368
|
+
const t = wt(), n = t == null ? void 0 : t.getExtensionPoint(e);
|
|
369
|
+
return n ? n.provide({ getCacheKey: () => e }) : [];
|
|
370
|
+
}, Ds = ({ registry: e, children: t }) => {
|
|
371
|
+
const n = S.useRef(e);
|
|
372
|
+
return S.useEffect(() => {
|
|
373
|
+
Fe(
|
|
374
|
+
n.current === e,
|
|
342
375
|
"You can't change the extension registry after it has been rendered"
|
|
343
376
|
);
|
|
344
|
-
}, [e]), /* @__PURE__ */
|
|
345
|
-
},
|
|
377
|
+
}, [e]), /* @__PURE__ */ R(St.Provider, { value: n.current, children: S.Children.only(t) });
|
|
378
|
+
}, Je = (e) => {
|
|
346
379
|
if (!e || typeof e != "string")
|
|
347
380
|
throw new TypeError(`extensionName is required to be a string and can't be: "${e}" (${typeof e})`);
|
|
348
381
|
return e.trim();
|
|
349
382
|
};
|
|
350
|
-
class
|
|
383
|
+
class Qn {
|
|
351
384
|
constructor(t) {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const { matcher:
|
|
358
|
-
this._settings =
|
|
385
|
+
k(this, "_settings");
|
|
386
|
+
k(this, "_extensions", /* @__PURE__ */ new Map());
|
|
387
|
+
k(this, "_lookupCache", /* @__PURE__ */ new Map());
|
|
388
|
+
k(this, "_matchCache", /* @__PURE__ */ new Map());
|
|
389
|
+
k(this, "_matcher");
|
|
390
|
+
const { matcher: n, ...r } = t;
|
|
391
|
+
this._settings = r, this._matcher = t.matcher;
|
|
359
392
|
}
|
|
360
393
|
settings() {
|
|
361
394
|
return this._settings;
|
|
@@ -377,15 +410,15 @@ class zr {
|
|
|
377
410
|
register(t) {
|
|
378
411
|
if (this._extensions.get(t.id))
|
|
379
412
|
throw new Error(`Resource sidebar view with id ${t.id} already exists`);
|
|
380
|
-
const
|
|
413
|
+
const n = {
|
|
381
414
|
...t,
|
|
382
415
|
registeredAt: /* @__PURE__ */ new Date(),
|
|
383
416
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
384
417
|
enabled: !0
|
|
385
418
|
};
|
|
386
|
-
this._extensions.set(t.id,
|
|
387
|
-
const
|
|
388
|
-
for (const s of
|
|
419
|
+
this._extensions.set(t.id, n);
|
|
420
|
+
const r = Array.from(this._matchCache.keys());
|
|
421
|
+
for (const s of r)
|
|
389
422
|
s.startsWith(t.plugin) && this._matchCache.delete(s);
|
|
390
423
|
}
|
|
391
424
|
/**
|
|
@@ -410,8 +443,8 @@ class zr {
|
|
|
410
443
|
* }
|
|
411
444
|
*/
|
|
412
445
|
get(t) {
|
|
413
|
-
var
|
|
414
|
-
return (
|
|
446
|
+
var n;
|
|
447
|
+
return (n = this._extensions.get(t)) == null ? void 0 : n.component;
|
|
415
448
|
}
|
|
416
449
|
/**
|
|
417
450
|
* Lists all registered components in the registry. Useful for debugging or generating summaries of available components.
|
|
@@ -433,16 +466,16 @@ class zr {
|
|
|
433
466
|
calculateMatches(t) {
|
|
434
467
|
if (!this._matcher)
|
|
435
468
|
return Array.from(this._extensions.values());
|
|
436
|
-
const
|
|
437
|
-
for (const
|
|
438
|
-
const s = this.generateMatchCacheKey(
|
|
439
|
-
if (
|
|
440
|
-
|
|
469
|
+
const n = [];
|
|
470
|
+
for (const r of this._extensions.values()) {
|
|
471
|
+
const s = this.generateMatchCacheKey(r), o = this._matchCache.has(s);
|
|
472
|
+
if (o && this._matchCache.get(s)) {
|
|
473
|
+
n.push(r);
|
|
441
474
|
continue;
|
|
442
475
|
}
|
|
443
|
-
this._matcher(t,
|
|
476
|
+
this._matcher(t, r) ? (this._matchCache.set(s, !0), n.push(r)) : o || this._matchCache.set(s, !1);
|
|
444
477
|
}
|
|
445
|
-
return
|
|
478
|
+
return n;
|
|
446
479
|
}
|
|
447
480
|
/**
|
|
448
481
|
* Preload the registry caches with the given expected context to avoid on-first-request calculation.
|
|
@@ -454,8 +487,8 @@ class zr {
|
|
|
454
487
|
* @param context The context expected to be called preload the registry with on provide.
|
|
455
488
|
*/
|
|
456
489
|
preload(t) {
|
|
457
|
-
const
|
|
458
|
-
this._lookupCache.set(
|
|
490
|
+
const n = this.calculateMatches(t), r = t.getCacheKey();
|
|
491
|
+
this._lookupCache.set(r, n.map((s) => s.id));
|
|
459
492
|
}
|
|
460
493
|
/**
|
|
461
494
|
* Provide the components that match the given context.
|
|
@@ -464,36 +497,36 @@ class zr {
|
|
|
464
497
|
if (this._settings.disabled)
|
|
465
498
|
return [];
|
|
466
499
|
if (this._settings.mode === "single") {
|
|
467
|
-
const
|
|
468
|
-
return
|
|
500
|
+
const o = this._extensions.get(this._settings.selected);
|
|
501
|
+
return o ? [o.component] : [];
|
|
469
502
|
}
|
|
470
|
-
const
|
|
471
|
-
let
|
|
472
|
-
if (
|
|
473
|
-
let
|
|
474
|
-
return this._settings.order && (
|
|
503
|
+
const n = t.getCacheKey();
|
|
504
|
+
let r = this._lookupCache.get(n);
|
|
505
|
+
if (r) {
|
|
506
|
+
let o = r.map((i) => this._extensions.get(i)).filter((i) => !!i).map((i) => i.component);
|
|
507
|
+
return this._settings.order && (o = this.reorderComponents(o, r, this._settings.order)), o;
|
|
475
508
|
}
|
|
476
|
-
|
|
477
|
-
let s =
|
|
478
|
-
return this._settings.order && (s = this.reorderComponents(s,
|
|
509
|
+
r = this.calculateMatches(t).map((o) => o.id), this._lookupCache.set(n, r);
|
|
510
|
+
let s = r.map((o) => this._extensions.get(o)).filter((o) => !!o).map((o) => o.component);
|
|
511
|
+
return this._settings.order && (s = this.reorderComponents(s, r, this._settings.order)), s;
|
|
479
512
|
}
|
|
480
|
-
reorderComponents(t,
|
|
481
|
-
const s = new Map(
|
|
482
|
-
return
|
|
513
|
+
reorderComponents(t, n, r) {
|
|
514
|
+
const s = new Map(n.map((o, i) => [o, t[i]]));
|
|
515
|
+
return r.map((o) => s.get(o)).filter((o) => !!o);
|
|
483
516
|
}
|
|
484
517
|
/**
|
|
485
518
|
* Reorder the components in the registry based on the given order.
|
|
486
519
|
*/
|
|
487
520
|
reorder(t) {
|
|
488
|
-
const
|
|
489
|
-
this._extensions.clear(), s.forEach((
|
|
490
|
-
const
|
|
491
|
-
for (const
|
|
492
|
-
const a = this._lookupCache.get(
|
|
521
|
+
const n = t.map((i) => this._extensions.get(i)).filter((i) => !!i), r = Array.from(this._extensions.values()).filter((i) => !t.includes(i.id)), s = [...n, ...r];
|
|
522
|
+
this._extensions.clear(), s.forEach((i) => this._extensions.set(i.id, i));
|
|
523
|
+
const o = Array.from(this._lookupCache.keys());
|
|
524
|
+
for (const i of o) {
|
|
525
|
+
const a = this._lookupCache.get(i);
|
|
493
526
|
if (!a)
|
|
494
527
|
continue;
|
|
495
|
-
const
|
|
496
|
-
this._lookupCache.set(
|
|
528
|
+
const u = a.filter((l) => t.includes(l));
|
|
529
|
+
this._lookupCache.set(i, u);
|
|
497
530
|
}
|
|
498
531
|
}
|
|
499
532
|
clearLookupCache() {
|
|
@@ -506,11 +539,11 @@ class zr {
|
|
|
506
539
|
this.clearLookupCache(), this.clearMatchCache();
|
|
507
540
|
}
|
|
508
541
|
}
|
|
509
|
-
class
|
|
542
|
+
class Ps {
|
|
510
543
|
constructor({ initialStores: t }) {
|
|
511
|
-
|
|
512
|
-
t.forEach((
|
|
513
|
-
this.addExtensionPoint(
|
|
544
|
+
k(this, "store", {});
|
|
545
|
+
t.forEach((n) => {
|
|
546
|
+
this.addExtensionPoint(n);
|
|
514
547
|
});
|
|
515
548
|
}
|
|
516
549
|
/**
|
|
@@ -519,18 +552,18 @@ class Ds {
|
|
|
519
552
|
* @param opts The settings for the extension point
|
|
520
553
|
*/
|
|
521
554
|
addExtensionPoint(t) {
|
|
522
|
-
let
|
|
523
|
-
if (console.log("validated",
|
|
524
|
-
console.warn(`Extension point ${
|
|
555
|
+
let n = Je(t.id);
|
|
556
|
+
if (console.log("validated", n), console.log("store", this.store), this.store[n]) {
|
|
557
|
+
console.warn(`Extension point ${n} already exists. Not adding again.`);
|
|
525
558
|
return;
|
|
526
559
|
}
|
|
527
|
-
this.store[
|
|
560
|
+
this.store[n] = new Qn(t);
|
|
528
561
|
}
|
|
529
562
|
/**
|
|
530
563
|
* Get an extension point from the registry.
|
|
531
564
|
*/
|
|
532
565
|
getExtensionPoint(t) {
|
|
533
|
-
return t =
|
|
566
|
+
return t = Je(t), this.store[t];
|
|
534
567
|
}
|
|
535
568
|
/**
|
|
536
569
|
* List all extension points in the registry.
|
|
@@ -560,96 +593,96 @@ class Ds {
|
|
|
560
593
|
return Object.values(this.store).map((t) => t.settings());
|
|
561
594
|
}
|
|
562
595
|
}
|
|
563
|
-
const
|
|
596
|
+
const Ct = he(void 0), Wn = {
|
|
564
597
|
default: "info",
|
|
565
598
|
info: "info",
|
|
566
599
|
success: "success",
|
|
567
600
|
warning: "warning",
|
|
568
601
|
error: "error"
|
|
569
|
-
},
|
|
570
|
-
const { push: t } =
|
|
571
|
-
|
|
572
|
-
},
|
|
573
|
-
const l = typeof
|
|
574
|
-
let
|
|
602
|
+
}, Rs = ({ children: e }) => {
|
|
603
|
+
const { push: t } = Tn(), [n, r] = S.useState([]), s = (i) => {
|
|
604
|
+
r((a) => [...a, i]);
|
|
605
|
+
}, o = (i, a, u) => {
|
|
606
|
+
const l = typeof i == "object";
|
|
607
|
+
let c = "", g = "info", f, d = 5e3, h;
|
|
575
608
|
if (l) {
|
|
576
|
-
if (
|
|
577
|
-
if (
|
|
609
|
+
if (c = i.message, i.showOnce) {
|
|
610
|
+
if (n.includes(c))
|
|
578
611
|
return;
|
|
579
|
-
s(
|
|
612
|
+
s(c);
|
|
580
613
|
}
|
|
581
|
-
|
|
614
|
+
g = i.status, f = i.details, d = i.autoHideDuration ?? 5e3, h = i.actions;
|
|
582
615
|
} else
|
|
583
|
-
|
|
616
|
+
c = i, g = a, f = u;
|
|
584
617
|
t({
|
|
585
|
-
severity:
|
|
586
|
-
title:
|
|
587
|
-
message:
|
|
588
|
-
timeout:
|
|
589
|
-
actions:
|
|
618
|
+
severity: Wn[g] ?? "info",
|
|
619
|
+
title: c,
|
|
620
|
+
message: f,
|
|
621
|
+
timeout: d,
|
|
622
|
+
actions: h
|
|
590
623
|
});
|
|
591
624
|
};
|
|
592
|
-
return /* @__PURE__ */
|
|
593
|
-
},
|
|
594
|
-
const e =
|
|
625
|
+
return /* @__PURE__ */ R(Ct.Provider, { value: { showSnackbar: o }, children: e });
|
|
626
|
+
}, L = () => {
|
|
627
|
+
const e = ne(Ct);
|
|
595
628
|
if (e === void 0)
|
|
596
629
|
throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
|
|
597
630
|
return e;
|
|
598
631
|
};
|
|
599
|
-
function
|
|
600
|
-
const t =
|
|
601
|
-
if (!
|
|
632
|
+
function D(e) {
|
|
633
|
+
const t = ne(Le), n = (t == null ? void 0 : t.pluginId) ?? e;
|
|
634
|
+
if (!n)
|
|
602
635
|
throw new Error(
|
|
603
636
|
"pluginID must be provided either via PluginContext or as an explicit parameter"
|
|
604
637
|
);
|
|
605
|
-
return
|
|
606
|
-
}
|
|
607
|
-
const
|
|
608
|
-
const
|
|
609
|
-
mutationFn: async () =>
|
|
610
|
-
onSuccess(
|
|
611
|
-
|
|
612
|
-
queryKey: ["EDITOR_SCHEMAS",
|
|
638
|
+
return n;
|
|
639
|
+
}
|
|
640
|
+
const Is = ({ pluginID: e, connectionID: t }) => {
|
|
641
|
+
const n = D(e), r = G(), { showSnackbar: s } = L(), o = [n, "connection", "detail", t], { mutateAsync: i } = v({
|
|
642
|
+
mutationFn: async () => Xt(n, t),
|
|
643
|
+
onSuccess(g) {
|
|
644
|
+
r.setQueryData(o, g), r.invalidateQueries({
|
|
645
|
+
queryKey: ["EDITOR_SCHEMAS", n, t]
|
|
613
646
|
});
|
|
614
647
|
},
|
|
615
648
|
onError: I(s, "Failed to start connection")
|
|
616
649
|
}), { mutateAsync: a } = v({
|
|
617
|
-
mutationFn: async () =>
|
|
618
|
-
onSuccess(
|
|
619
|
-
|
|
650
|
+
mutationFn: async () => it(n, t),
|
|
651
|
+
onSuccess(g) {
|
|
652
|
+
r.setQueryData(o, g);
|
|
620
653
|
},
|
|
621
654
|
onError: I(s, "Failed to stop connection")
|
|
622
|
-
}), { mutateAsync:
|
|
623
|
-
mutationFn: async (
|
|
624
|
-
onSuccess(
|
|
625
|
-
s({ message: `Connection ${
|
|
626
|
-
{ queryKey: [
|
|
627
|
-
(
|
|
655
|
+
}), { mutateAsync: u } = v({
|
|
656
|
+
mutationFn: async (g) => Zt(n, g),
|
|
657
|
+
onSuccess(g, { name: f }) {
|
|
658
|
+
s({ message: `Connection ${f} successfully updated`, status: "success" }), r.setQueryData(o, c), r.setQueriesData(
|
|
659
|
+
{ queryKey: [n, "connection", "list"] },
|
|
660
|
+
(d) => d == null ? void 0 : d.map((h) => h.id === t ? g : h)
|
|
628
661
|
);
|
|
629
662
|
},
|
|
630
663
|
onError: I(s, "Failed to update connection")
|
|
631
664
|
}), { mutateAsync: l } = v({
|
|
632
|
-
mutationFn: async () =>
|
|
665
|
+
mutationFn: async () => en(n, t),
|
|
633
666
|
onSuccess() {
|
|
634
|
-
s({ message: "Connection successfully removed", status: "success" }),
|
|
635
|
-
{ queryKey: [
|
|
636
|
-
(
|
|
667
|
+
s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(o, void 0), r.setQueriesData(
|
|
668
|
+
{ queryKey: [n, "connection", "list"] },
|
|
669
|
+
(g) => g == null ? void 0 : g.filter((f) => f.id !== t)
|
|
637
670
|
);
|
|
638
671
|
},
|
|
639
672
|
onError: I(s, "Failed to remove connection")
|
|
640
|
-
}),
|
|
641
|
-
queryKey:
|
|
642
|
-
queryFn: async () =>
|
|
673
|
+
}), c = P({
|
|
674
|
+
queryKey: o,
|
|
675
|
+
queryFn: async () => tn(n, t)
|
|
643
676
|
});
|
|
644
677
|
return {
|
|
645
678
|
/**
|
|
646
679
|
* Get the connection
|
|
647
680
|
*/
|
|
648
|
-
connection:
|
|
681
|
+
connection: c,
|
|
649
682
|
/**
|
|
650
683
|
* Start the connection
|
|
651
684
|
*/
|
|
652
|
-
startConnection:
|
|
685
|
+
startConnection: i,
|
|
653
686
|
/**
|
|
654
687
|
* Stop the connection
|
|
655
688
|
*/
|
|
@@ -657,577 +690,591 @@ const xs = ({ pluginID: e, connectionID: t }) => {
|
|
|
657
690
|
/**
|
|
658
691
|
* Update the connection.
|
|
659
692
|
*/
|
|
660
|
-
updateConnection:
|
|
693
|
+
updateConnection: u,
|
|
661
694
|
/**
|
|
662
695
|
* Delete the connection
|
|
663
696
|
*/
|
|
664
697
|
deleteConnection: l
|
|
665
698
|
};
|
|
666
|
-
},
|
|
667
|
-
const t =
|
|
668
|
-
mutationFn: async (l) =>
|
|
669
|
-
onError: I(
|
|
670
|
-
}), { mutateAsync:
|
|
671
|
-
mutationFn: async (l) =>
|
|
672
|
-
onError: I(
|
|
673
|
-
}), a =
|
|
674
|
-
console.log("got update to connections", l),
|
|
699
|
+
}, Bn = (e) => [e, "connection", "list"], Fs = ({ plugin: e }) => {
|
|
700
|
+
const t = D(e), n = G(), { showSnackbar: r } = L(), s = Bn(t), { mutateAsync: o } = v({
|
|
701
|
+
mutationFn: async (l) => at(t, l.id),
|
|
702
|
+
onError: I(r, "Failed to start connection watch")
|
|
703
|
+
}), { mutateAsync: i } = v({
|
|
704
|
+
mutationFn: async (l) => nn(t, l.id),
|
|
705
|
+
onError: I(r, "Failed to stop connection watch")
|
|
706
|
+
}), a = S.useCallback((l) => {
|
|
707
|
+
console.log("got update to connections", l), n.setQueryData(s, l);
|
|
675
708
|
}, []);
|
|
676
|
-
return
|
|
677
|
-
const l =
|
|
709
|
+
return S.useEffect(() => {
|
|
710
|
+
const l = x(`${t}/connection/sync`, a);
|
|
678
711
|
return () => {
|
|
679
712
|
l();
|
|
680
713
|
};
|
|
681
714
|
}, []), {
|
|
682
|
-
connections:
|
|
715
|
+
connections: P({
|
|
683
716
|
queryKey: s,
|
|
684
717
|
queryFn: async () => {
|
|
685
718
|
try {
|
|
686
|
-
return await
|
|
719
|
+
return await rn(t);
|
|
687
720
|
} catch (l) {
|
|
688
|
-
console.log(l), I(
|
|
721
|
+
console.log(l), I(r, "Failed to load connections")(l);
|
|
689
722
|
}
|
|
690
723
|
return [];
|
|
691
724
|
},
|
|
692
725
|
staleTime: 3e4,
|
|
693
|
-
placeholderData:
|
|
726
|
+
placeholderData: pt
|
|
694
727
|
}),
|
|
695
|
-
|
|
696
|
-
|
|
728
|
+
startWatch: o,
|
|
729
|
+
stopWatch: i
|
|
697
730
|
};
|
|
698
731
|
}, Os = ({ pluginID: e, connectionID: t }) => {
|
|
699
|
-
const
|
|
732
|
+
const n = D(e);
|
|
700
733
|
return {
|
|
701
734
|
/**
|
|
702
735
|
* Get the connection
|
|
703
736
|
*/
|
|
704
|
-
namespaces:
|
|
705
|
-
queryKey: [
|
|
706
|
-
queryFn: async () =>
|
|
737
|
+
namespaces: P({
|
|
738
|
+
queryKey: [n, "connection", "namespaces", t],
|
|
739
|
+
queryFn: async () => sn(n, t)
|
|
707
740
|
})
|
|
708
741
|
};
|
|
709
|
-
};
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
).length, o = r > 0 ? i / r : 0;
|
|
742
|
+
}, w = A.WatchState, xs = A.SyncPolicy;
|
|
743
|
+
function Oe(e) {
|
|
744
|
+
const t = Object.values(e.states), n = t.length;
|
|
745
|
+
let r = 0, s = 0, o = 0, i = 0;
|
|
746
|
+
for (const c of t)
|
|
747
|
+
c === w.SYNCED && r++, (c === w.ERROR || c === w.FAILED) && s++, c === w.FORBIDDEN && o++, c === w.SKIPPED && i++;
|
|
748
|
+
const a = n - i, u = t.filter(
|
|
749
|
+
(c) => c === w.SYNCED || c === w.ERROR || c === w.STOPPED || c === w.FAILED || c === w.FORBIDDEN
|
|
750
|
+
).length, l = a > 0 ? u / a : 0;
|
|
719
751
|
return {
|
|
720
752
|
pluginID: e.pluginID,
|
|
721
753
|
connectionID: e.connectionID,
|
|
722
|
-
totalResources:
|
|
723
|
-
|
|
754
|
+
totalResources: n,
|
|
755
|
+
watchedTotal: a,
|
|
756
|
+
syncedCount: r,
|
|
724
757
|
errorCount: s,
|
|
725
|
-
|
|
726
|
-
|
|
758
|
+
forbiddenCount: o,
|
|
759
|
+
skippedCount: i,
|
|
760
|
+
doneCount: u,
|
|
761
|
+
progress: l
|
|
727
762
|
};
|
|
728
763
|
}
|
|
729
|
-
function
|
|
730
|
-
return e.
|
|
764
|
+
function de(e) {
|
|
765
|
+
return e.watchedTotal > 0 && e.doneCount >= e.watchedTotal;
|
|
731
766
|
}
|
|
732
|
-
function
|
|
733
|
-
return e.some((t) => !
|
|
767
|
+
function bt(e) {
|
|
768
|
+
return e.some((t) => !de(t));
|
|
734
769
|
}
|
|
735
|
-
function
|
|
736
|
-
const t = e.reduce((
|
|
737
|
-
return t === 0 ? 0 : e.reduce((
|
|
770
|
+
function vt(e) {
|
|
771
|
+
const t = e.reduce((r, s) => r + s.watchedTotal, 0);
|
|
772
|
+
return t === 0 ? 0 : e.reduce((r, s) => r + s.doneCount, 0) / t;
|
|
738
773
|
}
|
|
739
|
-
function
|
|
774
|
+
function Ue(e) {
|
|
740
775
|
return `${e.pluginId}/${e.connection}`;
|
|
741
776
|
}
|
|
742
|
-
function
|
|
743
|
-
const
|
|
744
|
-
e.has(
|
|
777
|
+
function Dt(e, t) {
|
|
778
|
+
const n = Ue(t);
|
|
779
|
+
e.has(n) || e.set(n, {
|
|
745
780
|
states: {},
|
|
746
781
|
pluginID: t.pluginId,
|
|
747
782
|
connectionID: t.connection
|
|
748
783
|
});
|
|
749
|
-
const
|
|
750
|
-
return
|
|
784
|
+
const r = e.get(n);
|
|
785
|
+
return r.states[t.resourceKey] = t.state, r;
|
|
751
786
|
}
|
|
752
787
|
function As() {
|
|
753
|
-
const [e, t] = q(/* @__PURE__ */ new Set()), [
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
788
|
+
const [e, t] = q(/* @__PURE__ */ new Set()), [n, r] = q({}), [s, o] = q(/* @__PURE__ */ new Map()), i = $(/* @__PURE__ */ new Map());
|
|
789
|
+
j(() => {
|
|
790
|
+
on().then((y) => {
|
|
791
|
+
if (!y) return;
|
|
792
|
+
const m = {}, p = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map();
|
|
793
|
+
for (const [_, C] of Object.entries(y)) {
|
|
794
|
+
m[_] = C.map((F) => F.connection);
|
|
795
|
+
for (const F of C) {
|
|
796
|
+
if (!F.started) continue;
|
|
797
|
+
const b = `${_}/${F.connection.id}`;
|
|
798
|
+
p.add(b);
|
|
799
|
+
const z = {
|
|
800
|
+
pluginID: _,
|
|
801
|
+
connectionID: F.connection.id,
|
|
802
|
+
states: {}
|
|
803
|
+
};
|
|
804
|
+
if (F.resources)
|
|
805
|
+
for (const [Ce, se] of Object.entries(F.resources))
|
|
806
|
+
z.states[Ce] = se;
|
|
807
|
+
i.current.set(b, z), E.set(b, Oe(z));
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
r(m), t(p), o(E);
|
|
757
811
|
}).catch(() => {
|
|
758
812
|
});
|
|
759
|
-
}, []),
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
const
|
|
763
|
-
return
|
|
764
|
-
}),
|
|
765
|
-
const
|
|
766
|
-
return
|
|
767
|
-
}),
|
|
768
|
-
const
|
|
769
|
-
return
|
|
770
|
-
}),
|
|
771
|
-
|
|
813
|
+
}, []), j(() => x("connection/status", (m) => {
|
|
814
|
+
const p = `${m.pluginID}/${m.connectionID}`;
|
|
815
|
+
m.status === "DISCONNECTED" ? (t((E) => {
|
|
816
|
+
const _ = new Set(E);
|
|
817
|
+
return _.delete(p), _;
|
|
818
|
+
}), o((E) => {
|
|
819
|
+
const _ = new Map(E);
|
|
820
|
+
return _.delete(p), _;
|
|
821
|
+
}), i.current.delete(p)) : t((E) => {
|
|
822
|
+
const _ = new Set(E);
|
|
823
|
+
return _.add(p), _;
|
|
824
|
+
}), an().then((E) => {
|
|
825
|
+
E && r(E);
|
|
772
826
|
}).catch(() => {
|
|
773
827
|
});
|
|
774
828
|
}), []);
|
|
775
|
-
const a =
|
|
776
|
-
const
|
|
777
|
-
t((
|
|
778
|
-
if (
|
|
779
|
-
const
|
|
780
|
-
return
|
|
829
|
+
const a = U((y) => {
|
|
830
|
+
const m = Ue(y);
|
|
831
|
+
t((_) => {
|
|
832
|
+
if (_.has(m)) return _;
|
|
833
|
+
const C = new Set(_);
|
|
834
|
+
return C.add(m), C;
|
|
781
835
|
});
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
const
|
|
785
|
-
return
|
|
836
|
+
const p = Dt(i.current, y), E = Oe(p);
|
|
837
|
+
o((_) => {
|
|
838
|
+
const C = new Map(_);
|
|
839
|
+
return C.set(m, E), C;
|
|
786
840
|
});
|
|
787
841
|
}, []);
|
|
788
|
-
|
|
789
|
-
const
|
|
790
|
-
await
|
|
791
|
-
}, []), l =
|
|
792
|
-
await
|
|
793
|
-
}, []),
|
|
794
|
-
for (const
|
|
795
|
-
const [
|
|
796
|
-
|
|
797
|
-
pluginID:
|
|
798
|
-
connectionID:
|
|
799
|
-
name: (
|
|
800
|
-
avatar: (
|
|
842
|
+
j(() => x("watch/STATE", a), [a]);
|
|
843
|
+
const u = U(async (y, m) => {
|
|
844
|
+
await it(y, m);
|
|
845
|
+
}, []), l = U(async (y, m) => {
|
|
846
|
+
await at(y, m);
|
|
847
|
+
}, []), c = [];
|
|
848
|
+
for (const y of e) {
|
|
849
|
+
const [m, p] = y.split("/", 2), _ = (n[m] ?? []).find((z) => z.id === p), C = s.get(y), F = C != null && !de(C), b = C != null && C.errorCount > 0;
|
|
850
|
+
c.push({
|
|
851
|
+
pluginID: m,
|
|
852
|
+
connectionID: p,
|
|
853
|
+
name: (_ == null ? void 0 : _.name) ?? p,
|
|
854
|
+
avatar: (_ == null ? void 0 : _.avatar) ?? "",
|
|
801
855
|
isStarted: !0,
|
|
802
|
-
sync:
|
|
803
|
-
isSyncing:
|
|
804
|
-
hasErrors:
|
|
856
|
+
sync: C,
|
|
857
|
+
isSyncing: F,
|
|
858
|
+
hasErrors: b
|
|
805
859
|
});
|
|
806
860
|
}
|
|
807
|
-
const
|
|
808
|
-
for (const
|
|
809
|
-
const
|
|
810
|
-
|
|
861
|
+
const g = /* @__PURE__ */ new Map();
|
|
862
|
+
for (const y of c) {
|
|
863
|
+
const m = g.get(y.pluginID) ?? [];
|
|
864
|
+
m.push(y), g.set(y.pluginID, m);
|
|
811
865
|
}
|
|
812
|
-
const
|
|
866
|
+
const f = Array.from(s.values()), d = c.filter((y) => y.isSyncing), h = c.filter((y) => y.hasErrors);
|
|
813
867
|
return {
|
|
814
|
-
entries:
|
|
815
|
-
grouped:
|
|
816
|
-
connectedCount:
|
|
817
|
-
syncingCount:
|
|
818
|
-
errorCount:
|
|
819
|
-
hasSyncing:
|
|
820
|
-
aggregateProgress:
|
|
821
|
-
disconnect:
|
|
822
|
-
|
|
868
|
+
entries: c,
|
|
869
|
+
grouped: g,
|
|
870
|
+
connectedCount: c.length,
|
|
871
|
+
syncingCount: d.length,
|
|
872
|
+
errorCount: h.length,
|
|
873
|
+
hasSyncing: bt(f),
|
|
874
|
+
aggregateProgress: vt(f),
|
|
875
|
+
disconnect: u,
|
|
876
|
+
retryWatch: l
|
|
823
877
|
};
|
|
824
878
|
}
|
|
825
|
-
function
|
|
879
|
+
function Hn(e, t) {
|
|
826
880
|
return window.go.data.Client.Get(e, t);
|
|
827
881
|
}
|
|
828
|
-
function
|
|
829
|
-
return window.go.data.Client.Set(e, t,
|
|
882
|
+
function Yn(e, t, n) {
|
|
883
|
+
return window.go.data.Client.Set(e, t, n);
|
|
830
884
|
}
|
|
831
|
-
function Ts(e, t,
|
|
832
|
-
const
|
|
833
|
-
queryKey:
|
|
885
|
+
function Ts(e, t, n) {
|
|
886
|
+
const r = D(e), s = G(), o = [r, "data", t], i = P({
|
|
887
|
+
queryKey: o,
|
|
834
888
|
queryFn: async () => {
|
|
835
|
-
const
|
|
836
|
-
return
|
|
889
|
+
const u = await Hn(r, t);
|
|
890
|
+
return u ?? n;
|
|
837
891
|
}
|
|
838
892
|
}), a = v({
|
|
839
|
-
mutationFn: async (
|
|
840
|
-
await
|
|
893
|
+
mutationFn: async (u) => {
|
|
894
|
+
await Yn(r, t, u);
|
|
841
895
|
},
|
|
842
|
-
onMutate: async (
|
|
843
|
-
await s.cancelQueries({ queryKey:
|
|
844
|
-
const l = s.getQueryData(
|
|
845
|
-
return s.setQueryData(
|
|
896
|
+
onMutate: async (u) => {
|
|
897
|
+
await s.cancelQueries({ queryKey: o });
|
|
898
|
+
const l = s.getQueryData(o);
|
|
899
|
+
return s.setQueryData(o, u), { previous: l };
|
|
846
900
|
},
|
|
847
|
-
onError: (
|
|
848
|
-
(
|
|
901
|
+
onError: (u, l, c) => {
|
|
902
|
+
(c == null ? void 0 : c.previous) !== void 0 && s.setQueryData(o, c.previous);
|
|
849
903
|
},
|
|
850
904
|
onSettled: () => {
|
|
851
|
-
s.invalidateQueries({ queryKey:
|
|
905
|
+
s.invalidateQueries({ queryKey: o });
|
|
852
906
|
}
|
|
853
907
|
});
|
|
854
908
|
return {
|
|
855
|
-
data:
|
|
856
|
-
update: async (
|
|
857
|
-
await a.mutateAsync(
|
|
909
|
+
data: i.data ?? n,
|
|
910
|
+
update: async (u) => {
|
|
911
|
+
await a.mutateAsync(u);
|
|
858
912
|
},
|
|
859
|
-
isLoading:
|
|
913
|
+
isLoading: i.isLoading
|
|
860
914
|
};
|
|
861
915
|
}
|
|
862
916
|
const Ns = () => {
|
|
863
|
-
const e =
|
|
917
|
+
const e = ne($n);
|
|
864
918
|
if (!e) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
|
|
865
919
|
return e;
|
|
866
|
-
},
|
|
867
|
-
const e =
|
|
920
|
+
}, Pt = () => {
|
|
921
|
+
const e = ne(Ln);
|
|
868
922
|
if (e === void 0)
|
|
869
923
|
throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
|
|
870
924
|
return e;
|
|
871
|
-
},
|
|
872
|
-
const t =
|
|
925
|
+
}, ks = ({ pluginID: e }) => {
|
|
926
|
+
const t = D(e), { showSnackbar: n } = L(), { createTab: r, updateTab: s } = Pt();
|
|
873
927
|
return {
|
|
874
928
|
createSession: v({
|
|
875
|
-
mutationFn: async ({ connectionID:
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
id:
|
|
879
|
-
title:
|
|
929
|
+
mutationFn: async ({ connectionID: i, icon: a, label: u, opts: l }) => {
|
|
930
|
+
const c = `pending-${crypto.randomUUID()}`;
|
|
931
|
+
r({
|
|
932
|
+
id: c,
|
|
933
|
+
title: u ?? "Connecting...",
|
|
880
934
|
variant: "terminal",
|
|
881
935
|
icon: a ?? "LuSquareTerminal",
|
|
882
936
|
properties: {
|
|
883
937
|
status: "connecting",
|
|
884
938
|
pluginID: t,
|
|
885
|
-
connectionID:
|
|
939
|
+
connectionID: i,
|
|
886
940
|
opts: { ...l }
|
|
887
941
|
}
|
|
888
942
|
});
|
|
889
|
-
const
|
|
943
|
+
const g = xn.SessionOptions.createFrom({
|
|
890
944
|
command: ["/bin/bash"],
|
|
891
945
|
tty: !0,
|
|
892
946
|
...l
|
|
893
947
|
});
|
|
894
948
|
try {
|
|
895
|
-
const
|
|
949
|
+
const f = await cn(t, i, g);
|
|
896
950
|
s(
|
|
897
|
-
{ id:
|
|
951
|
+
{ id: c },
|
|
898
952
|
{
|
|
899
|
-
id:
|
|
900
|
-
title:
|
|
901
|
-
properties: { status: "connected", pluginID: t, connectionID:
|
|
953
|
+
id: f.id,
|
|
954
|
+
title: u ?? `Session ${f.id.substring(0, 8)}`,
|
|
955
|
+
properties: { status: "connected", pluginID: t, connectionID: i, opts: { ...l } }
|
|
902
956
|
}
|
|
903
957
|
);
|
|
904
|
-
} catch (
|
|
905
|
-
const
|
|
958
|
+
} catch (f) {
|
|
959
|
+
const d = K(f);
|
|
906
960
|
s(
|
|
907
|
-
{ id:
|
|
961
|
+
{ id: c },
|
|
908
962
|
{
|
|
909
|
-
properties: { status: "error", error:
|
|
963
|
+
properties: { status: "error", error: d.detail, pluginID: t, connectionID: i, opts: { ...l } }
|
|
910
964
|
}
|
|
911
|
-
),
|
|
965
|
+
), Z(n, f, "Failed to start session");
|
|
912
966
|
}
|
|
913
967
|
}
|
|
914
968
|
}).mutateAsync
|
|
915
969
|
};
|
|
916
|
-
},
|
|
917
|
-
const t =
|
|
970
|
+
}, Ms = ({ pluginID: e }) => {
|
|
971
|
+
const t = D(e), { showSnackbar: n } = L(), { createTab: r } = Pt(), s = v({
|
|
918
972
|
mutationFn: async ({
|
|
919
|
-
connectionID:
|
|
973
|
+
connectionID: i,
|
|
920
974
|
resourceKey: a,
|
|
921
|
-
resourceID:
|
|
975
|
+
resourceID: u,
|
|
922
976
|
resourceData: l,
|
|
923
|
-
icon:
|
|
924
|
-
label:
|
|
925
|
-
target:
|
|
926
|
-
follow:
|
|
927
|
-
tailLines:
|
|
928
|
-
params:
|
|
977
|
+
icon: c,
|
|
978
|
+
label: g,
|
|
979
|
+
target: f,
|
|
980
|
+
follow: d = !0,
|
|
981
|
+
tailLines: h = 1e3,
|
|
982
|
+
params: y
|
|
929
983
|
}) => {
|
|
930
|
-
const
|
|
984
|
+
const m = Be.CreateSessionOptions.createFrom({
|
|
931
985
|
resource_key: a,
|
|
932
|
-
resource_id:
|
|
986
|
+
resource_id: u,
|
|
933
987
|
resource_data: l,
|
|
934
|
-
options:
|
|
935
|
-
target:
|
|
936
|
-
follow:
|
|
988
|
+
options: Be.LogSessionOptions.createFrom({
|
|
989
|
+
target: f ?? "",
|
|
990
|
+
follow: d,
|
|
937
991
|
include_previous: !1,
|
|
938
992
|
include_timestamps: !0,
|
|
939
|
-
tail_lines:
|
|
993
|
+
tail_lines: h,
|
|
940
994
|
since_seconds: 0,
|
|
941
995
|
limit_bytes: 0,
|
|
942
996
|
include_source_events: !0,
|
|
943
|
-
params:
|
|
997
|
+
params: y ?? {}
|
|
944
998
|
})
|
|
945
|
-
}),
|
|
946
|
-
return
|
|
947
|
-
id:
|
|
948
|
-
title:
|
|
999
|
+
}), p = await un(t, i, m);
|
|
1000
|
+
return r({
|
|
1001
|
+
id: p.id,
|
|
1002
|
+
title: g ?? `Logs ${p.id.substring(0, 8)}`,
|
|
949
1003
|
variant: "logs",
|
|
950
|
-
icon:
|
|
951
|
-
}),
|
|
1004
|
+
icon: c ?? "LuLogs"
|
|
1005
|
+
}), p;
|
|
952
1006
|
},
|
|
953
|
-
onError: I(
|
|
954
|
-
}),
|
|
955
|
-
mutationFn: async (
|
|
956
|
-
await
|
|
1007
|
+
onError: I(n, "Failed to start log session")
|
|
1008
|
+
}), o = v({
|
|
1009
|
+
mutationFn: async (i) => {
|
|
1010
|
+
await ln(i);
|
|
957
1011
|
},
|
|
958
|
-
onError: I(
|
|
1012
|
+
onError: I(n, "Failed to close log session")
|
|
959
1013
|
});
|
|
960
1014
|
return {
|
|
961
1015
|
createLogSession: s.mutateAsync,
|
|
962
|
-
closeLogSession:
|
|
1016
|
+
closeLogSession: o.mutateAsync
|
|
963
1017
|
};
|
|
964
|
-
},
|
|
1018
|
+
}, Ls = () => P({
|
|
965
1019
|
queryKey: ["metric", "providers"],
|
|
966
|
-
queryFn:
|
|
1020
|
+
queryFn: dn,
|
|
967
1021
|
staleTime: 3e4
|
|
968
|
-
}),
|
|
1022
|
+
}), Jn = (e) => P({
|
|
969
1023
|
queryKey: ["metric", "providers", e],
|
|
970
|
-
queryFn: () =>
|
|
1024
|
+
queryFn: () => fn(e),
|
|
971
1025
|
enabled: !!e,
|
|
972
1026
|
staleTime: 3e4
|
|
973
1027
|
}), $s = (e) => {
|
|
974
|
-
var
|
|
1028
|
+
var m, p;
|
|
975
1029
|
const {
|
|
976
1030
|
connectionID: t,
|
|
977
|
-
resourceKey:
|
|
978
|
-
resourceID:
|
|
1031
|
+
resourceKey: n,
|
|
1032
|
+
resourceID: r,
|
|
979
1033
|
resourceNamespace: s = "",
|
|
980
|
-
resourceData:
|
|
981
|
-
metricIDs:
|
|
1034
|
+
resourceData: o = {},
|
|
1035
|
+
metricIDs: i = [],
|
|
982
1036
|
shape: a = 0,
|
|
983
1037
|
// CURRENT
|
|
984
|
-
timeRange:
|
|
1038
|
+
timeRange: u,
|
|
985
1039
|
refreshInterval: l = 0,
|
|
986
|
-
enabled:
|
|
1040
|
+
enabled: c = !0
|
|
987
1041
|
} = e, {
|
|
988
|
-
data:
|
|
989
|
-
isLoading:
|
|
990
|
-
} =
|
|
991
|
-
Math.floor((
|
|
1042
|
+
data: g,
|
|
1043
|
+
isLoading: f
|
|
1044
|
+
} = Jn(n), d = g ?? [], h = u ? Math.max(
|
|
1045
|
+
Math.floor((u.end.getTime() - u.start.getTime()) / 250),
|
|
992
1046
|
15e3
|
|
993
|
-
) * 1e6 : 0,
|
|
1047
|
+
) * 1e6 : 0, y = P({
|
|
994
1048
|
queryKey: [
|
|
995
1049
|
"metric",
|
|
996
1050
|
"query",
|
|
997
1051
|
t,
|
|
998
|
-
r,
|
|
999
1052
|
n,
|
|
1053
|
+
r,
|
|
1000
1054
|
s,
|
|
1001
|
-
|
|
1055
|
+
i,
|
|
1002
1056
|
a,
|
|
1003
|
-
(
|
|
1004
|
-
(
|
|
1057
|
+
(m = u == null ? void 0 : u.start) == null ? void 0 : m.getTime(),
|
|
1058
|
+
(p = u == null ? void 0 : u.end) == null ? void 0 : p.getTime()
|
|
1005
1059
|
],
|
|
1006
|
-
queryFn: () =>
|
|
1060
|
+
queryFn: () => pn(
|
|
1007
1061
|
t,
|
|
1008
|
-
r,
|
|
1009
1062
|
n,
|
|
1063
|
+
r,
|
|
1010
1064
|
s,
|
|
1011
|
-
i,
|
|
1012
1065
|
o,
|
|
1066
|
+
i,
|
|
1013
1067
|
a,
|
|
1014
|
-
(
|
|
1015
|
-
(
|
|
1016
|
-
|
|
1068
|
+
(u == null ? void 0 : u.start) ?? /* @__PURE__ */ new Date(0),
|
|
1069
|
+
(u == null ? void 0 : u.end) ?? /* @__PURE__ */ new Date(0),
|
|
1070
|
+
h
|
|
1017
1071
|
),
|
|
1018
|
-
enabled:
|
|
1072
|
+
enabled: c && !!t && !!n && (n.startsWith("cluster::") || !!r) && d.length > 0,
|
|
1019
1073
|
refetchInterval: l > 0 ? l : void 0,
|
|
1020
1074
|
staleTime: 5e3,
|
|
1021
1075
|
// Keep previous data visible while fetching new data (e.g. on time range change)
|
|
1022
1076
|
// to prevent the chart from blinking empty.
|
|
1023
|
-
placeholderData:
|
|
1077
|
+
placeholderData: pt
|
|
1024
1078
|
});
|
|
1025
1079
|
return {
|
|
1026
|
-
data:
|
|
1027
|
-
providers:
|
|
1028
|
-
isLoading:
|
|
1029
|
-
error:
|
|
1030
|
-
refetch:
|
|
1080
|
+
data: y.data ?? void 0,
|
|
1081
|
+
providers: d,
|
|
1082
|
+
isLoading: f || y.isLoading,
|
|
1083
|
+
error: y.error,
|
|
1084
|
+
refetch: y.refetch
|
|
1031
1085
|
};
|
|
1032
|
-
},
|
|
1086
|
+
}, Us = (e) => {
|
|
1033
1087
|
const {
|
|
1034
1088
|
pluginID: t,
|
|
1035
|
-
connectionID:
|
|
1036
|
-
resourceKey:
|
|
1089
|
+
connectionID: n,
|
|
1090
|
+
resourceKey: r,
|
|
1037
1091
|
resourceID: s,
|
|
1038
|
-
resourceNamespace:
|
|
1039
|
-
resourceData:
|
|
1092
|
+
resourceNamespace: o = "",
|
|
1093
|
+
resourceData: i = {},
|
|
1040
1094
|
metricIDs: a = [],
|
|
1041
|
-
interval:
|
|
1095
|
+
interval: u = 1e4,
|
|
1042
1096
|
enabled: l = !0
|
|
1043
|
-
} = e,
|
|
1044
|
-
if (!(!l || !
|
|
1097
|
+
} = e, c = D(t), [g, f] = q(null), [d, h] = q(null), [y, m] = q(!1), [p, E] = q(null), _ = $(null), C = U(async () => {
|
|
1098
|
+
if (!(!l || !c || !n || !r || !s))
|
|
1045
1099
|
try {
|
|
1046
|
-
const
|
|
1047
|
-
resource_key:
|
|
1100
|
+
const b = await yn(c, n, {
|
|
1101
|
+
resource_key: r,
|
|
1048
1102
|
resource_id: s,
|
|
1049
|
-
resource_namespace:
|
|
1050
|
-
resource_data:
|
|
1103
|
+
resource_namespace: o,
|
|
1104
|
+
resource_data: i,
|
|
1051
1105
|
metric_ids: a,
|
|
1052
|
-
interval:
|
|
1106
|
+
interval: u * 1e6
|
|
1053
1107
|
// ms to nanoseconds for Go time.Duration
|
|
1054
1108
|
});
|
|
1055
|
-
|
|
1056
|
-
const
|
|
1109
|
+
h(b), m(!0), E(null);
|
|
1110
|
+
const z = x(`core/metrics/data/${b}`, (se) => {
|
|
1057
1111
|
try {
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1060
|
-
} catch (
|
|
1061
|
-
console.error("Failed to parse metric stream data:",
|
|
1112
|
+
const Q = JSON.parse(se);
|
|
1113
|
+
Q.results && f(Q.results);
|
|
1114
|
+
} catch (Q) {
|
|
1115
|
+
console.error("Failed to parse metric stream data:", Q);
|
|
1062
1116
|
}
|
|
1063
|
-
}),
|
|
1117
|
+
}), Ce = x(`core/metrics/error/${b}`, (se) => {
|
|
1064
1118
|
try {
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1119
|
+
const Q = JSON.parse(se);
|
|
1120
|
+
E(Q.error || "Unknown error");
|
|
1067
1121
|
} catch {
|
|
1068
|
-
|
|
1122
|
+
E("Failed to parse metric stream error");
|
|
1069
1123
|
}
|
|
1070
1124
|
});
|
|
1071
|
-
|
|
1072
|
-
|
|
1125
|
+
_.current = () => {
|
|
1126
|
+
z(), Ce();
|
|
1073
1127
|
};
|
|
1074
|
-
} catch (
|
|
1075
|
-
b
|
|
1128
|
+
} catch (b) {
|
|
1129
|
+
E(b instanceof Error ? b.message : String(b));
|
|
1076
1130
|
}
|
|
1077
|
-
}, [
|
|
1078
|
-
if (
|
|
1131
|
+
}, [c, n, r, s, o, a, u, l]), F = U(async () => {
|
|
1132
|
+
if (d)
|
|
1079
1133
|
try {
|
|
1080
|
-
await
|
|
1081
|
-
} catch (
|
|
1082
|
-
console.error("Failed to unsubscribe:",
|
|
1134
|
+
await We(d);
|
|
1135
|
+
} catch (b) {
|
|
1136
|
+
console.error("Failed to unsubscribe:", b);
|
|
1083
1137
|
}
|
|
1084
|
-
|
|
1085
|
-
}, [
|
|
1086
|
-
return
|
|
1087
|
-
|
|
1088
|
-
}, [
|
|
1089
|
-
data:
|
|
1090
|
-
subscriptionID:
|
|
1091
|
-
isStreaming:
|
|
1092
|
-
error:
|
|
1093
|
-
start:
|
|
1094
|
-
stop:
|
|
1138
|
+
_.current && (_.current(), _.current = null), h(null), m(!1);
|
|
1139
|
+
}, [d]);
|
|
1140
|
+
return j(() => () => {
|
|
1141
|
+
d && We(d).catch(console.error), _.current && _.current();
|
|
1142
|
+
}, [d]), {
|
|
1143
|
+
data: g,
|
|
1144
|
+
subscriptionID: d,
|
|
1145
|
+
isStreaming: y,
|
|
1146
|
+
error: p,
|
|
1147
|
+
start: C,
|
|
1148
|
+
stop: F
|
|
1095
1149
|
};
|
|
1096
|
-
},
|
|
1150
|
+
}, X = ["networker", "portforward", "all-sessions"];
|
|
1097
1151
|
function qs() {
|
|
1098
|
-
const { showSnackbar: e } =
|
|
1099
|
-
queryKey: [...
|
|
1100
|
-
queryFn: async () =>
|
|
1101
|
-
if (
|
|
1102
|
-
throw
|
|
1152
|
+
const { showSnackbar: e } = L(), t = G(), n = P({
|
|
1153
|
+
queryKey: [...X],
|
|
1154
|
+
queryFn: async () => hn().catch((o) => {
|
|
1155
|
+
if (K(o).detail.includes("not found")) return [];
|
|
1156
|
+
throw o;
|
|
1103
1157
|
}),
|
|
1104
1158
|
retry: !1
|
|
1105
1159
|
});
|
|
1106
|
-
|
|
1107
|
-
const
|
|
1108
|
-
t.invalidateQueries({ queryKey: [...
|
|
1109
|
-
}),
|
|
1110
|
-
t.invalidateQueries({ queryKey: [...
|
|
1160
|
+
j(() => {
|
|
1161
|
+
const o = x("core/networker/portforward/created", () => {
|
|
1162
|
+
t.invalidateQueries({ queryKey: [...X] });
|
|
1163
|
+
}), i = x("core/networker/portforward/closed", () => {
|
|
1164
|
+
t.invalidateQueries({ queryKey: [...X] });
|
|
1111
1165
|
});
|
|
1112
1166
|
return () => {
|
|
1113
|
-
|
|
1167
|
+
o(), i();
|
|
1114
1168
|
};
|
|
1115
1169
|
}, [t]);
|
|
1116
|
-
const
|
|
1117
|
-
mutationFn: async (
|
|
1170
|
+
const r = n.data ?? [], s = v({
|
|
1171
|
+
mutationFn: async (o) => ct(o),
|
|
1118
1172
|
onError: I(e, "Failed to close port forwarding session"),
|
|
1119
1173
|
onSuccess: async () => {
|
|
1120
|
-
await t.invalidateQueries({ queryKey: [...
|
|
1174
|
+
await t.invalidateQueries({ queryKey: [...X] });
|
|
1121
1175
|
}
|
|
1122
1176
|
});
|
|
1123
1177
|
return {
|
|
1124
|
-
sessions:
|
|
1125
|
-
activeSessions:
|
|
1178
|
+
sessions: n,
|
|
1179
|
+
activeSessions: r,
|
|
1126
1180
|
closeSession: s.mutateAsync,
|
|
1127
|
-
openInBrowser: (
|
|
1181
|
+
openInBrowser: (o) => yt(`http://localhost:${o}`)
|
|
1128
1182
|
};
|
|
1129
1183
|
}
|
|
1130
|
-
function
|
|
1131
|
-
const
|
|
1184
|
+
function js({ pluginID: e, connectionID: t, resourceID: n }) {
|
|
1185
|
+
const r = D(e), s = ["networker", "portforward", "sessions", r, t, n], { showSnackbar: o } = L(), i = G(), a = P({
|
|
1132
1186
|
queryKey: s,
|
|
1133
|
-
queryFn: async () =>
|
|
1134
|
-
resource_id:
|
|
1187
|
+
queryFn: async () => gn(r, t, He.FindPortForwardSessionRequest.createFrom({
|
|
1188
|
+
resource_id: n,
|
|
1135
1189
|
connection_id: t
|
|
1136
|
-
})).catch((
|
|
1137
|
-
const
|
|
1138
|
-
return
|
|
1190
|
+
})).catch((c) => {
|
|
1191
|
+
const g = K(c);
|
|
1192
|
+
return g.detail.includes("not found") ? [] : (o({ message: "Failed to fetch port forward sessions", status: "error", details: g.detail }), []);
|
|
1139
1193
|
}),
|
|
1140
1194
|
retry: !1
|
|
1141
|
-
}),
|
|
1142
|
-
mutationFn: async ({ opts:
|
|
1143
|
-
const
|
|
1144
|
-
local_port:
|
|
1145
|
-
remote_port:
|
|
1146
|
-
protocol:
|
|
1195
|
+
}), u = v({
|
|
1196
|
+
mutationFn: async ({ opts: c }) => {
|
|
1197
|
+
const g = He.PortForwardSessionOptions.createFrom({
|
|
1198
|
+
local_port: c.localPort || 0,
|
|
1199
|
+
remote_port: c.remotePort,
|
|
1200
|
+
protocol: c.protocol || "TCP",
|
|
1147
1201
|
connection_type: "RESOURCE",
|
|
1148
1202
|
connection: {
|
|
1149
|
-
resource_data:
|
|
1203
|
+
resource_data: c.resource,
|
|
1150
1204
|
connection_id: t,
|
|
1151
|
-
plugin_id:
|
|
1152
|
-
resource_id:
|
|
1153
|
-
resource_key:
|
|
1205
|
+
plugin_id: r,
|
|
1206
|
+
resource_id: c.resourceId,
|
|
1207
|
+
resource_key: c.resourceKey
|
|
1154
1208
|
},
|
|
1155
|
-
labels:
|
|
1156
|
-
params:
|
|
1157
|
-
}),
|
|
1158
|
-
return
|
|
1209
|
+
labels: c.labels ?? {},
|
|
1210
|
+
params: c.parameters ?? {}
|
|
1211
|
+
}), f = await mn(r, t, g);
|
|
1212
|
+
return c.openInBrowser && yt(`http://localhost:${f.local_port}`), f;
|
|
1159
1213
|
},
|
|
1160
|
-
onError: I(
|
|
1214
|
+
onError: I(o, "Failed to start port forwarding session"),
|
|
1161
1215
|
onSuccess: async () => {
|
|
1162
1216
|
await Promise.all([
|
|
1163
|
-
|
|
1164
|
-
|
|
1217
|
+
i.invalidateQueries({ queryKey: s }),
|
|
1218
|
+
i.invalidateQueries({ queryKey: [...X] })
|
|
1165
1219
|
]);
|
|
1166
1220
|
}
|
|
1167
1221
|
}), l = v({
|
|
1168
|
-
mutationFn: async ({ opts:
|
|
1169
|
-
onError: I(
|
|
1222
|
+
mutationFn: async ({ opts: c }) => ct(c.sessionID),
|
|
1223
|
+
onError: I(o, "Failed to close port forwarding session"),
|
|
1170
1224
|
onSuccess: async () => {
|
|
1171
1225
|
await Promise.all([
|
|
1172
|
-
|
|
1173
|
-
|
|
1226
|
+
i.invalidateQueries({ queryKey: s }),
|
|
1227
|
+
i.invalidateQueries({ queryKey: [...X] })
|
|
1174
1228
|
]);
|
|
1175
1229
|
}
|
|
1176
1230
|
});
|
|
1177
1231
|
return {
|
|
1178
1232
|
sessions: a,
|
|
1179
|
-
forward:
|
|
1233
|
+
forward: u.mutateAsync,
|
|
1180
1234
|
close: l.mutateAsync
|
|
1181
1235
|
};
|
|
1182
1236
|
}
|
|
1183
|
-
const
|
|
1184
|
-
const e =
|
|
1237
|
+
const Gs = () => {
|
|
1238
|
+
const e = S.useContext(Un);
|
|
1185
1239
|
if (!e) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
|
|
1186
1240
|
return e;
|
|
1187
1241
|
}, Ks = ({
|
|
1188
1242
|
pluginID: e,
|
|
1189
1243
|
connectionID: t,
|
|
1190
|
-
resourceKey:
|
|
1191
|
-
resourceID:
|
|
1192
|
-
namespace: s = ""
|
|
1193
|
-
getParams: i = {},
|
|
1194
|
-
updateParams: o = {},
|
|
1195
|
-
deleteParams: a = {}
|
|
1244
|
+
resourceKey: n,
|
|
1245
|
+
resourceID: r,
|
|
1246
|
+
namespace: s = ""
|
|
1196
1247
|
}) => {
|
|
1197
|
-
const
|
|
1198
|
-
mutationFn: async (
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
id: n,
|
|
1248
|
+
const o = D(e), i = G(), { showSnackbar: a } = L(), u = ["RESOURCE", o, t, n, r, s], { mutateAsync: l } = v({
|
|
1249
|
+
mutationFn: async (f) => ut(o, t, n, A.UpdateInput.createFrom({
|
|
1250
|
+
input: f.input,
|
|
1251
|
+
id: r,
|
|
1202
1252
|
namespace: s
|
|
1203
1253
|
})),
|
|
1204
1254
|
onSuccess: async () => {
|
|
1205
|
-
|
|
1255
|
+
a(`Resource ${r} updated`, "success"), await i.invalidateQueries({ queryKey: u });
|
|
1206
1256
|
},
|
|
1207
|
-
onError: I(
|
|
1208
|
-
}), { mutateAsync:
|
|
1209
|
-
mutationFn: async (
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
...p,
|
|
1214
|
-
namespace: s
|
|
1257
|
+
onError: I(a, `Failed to update resource ${r}`)
|
|
1258
|
+
}), { mutateAsync: c } = v({
|
|
1259
|
+
mutationFn: async (f = {}) => lt(o, t, n, A.DeleteInput.createFrom({
|
|
1260
|
+
id: r,
|
|
1261
|
+
namespace: s,
|
|
1262
|
+
gracePeriodSeconds: f.gracePeriodSeconds
|
|
1215
1263
|
})),
|
|
1216
1264
|
onSuccess: async () => {
|
|
1217
|
-
|
|
1265
|
+
a(`Resource ${r} deleted`, "success"), await i.invalidateQueries({ queryKey: u });
|
|
1218
1266
|
},
|
|
1219
|
-
onError: I(
|
|
1267
|
+
onError: I(a, `Failed to delete resource ${r}`)
|
|
1220
1268
|
});
|
|
1221
1269
|
return {
|
|
1222
1270
|
/**
|
|
1223
1271
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1224
1272
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1225
1273
|
*/
|
|
1226
|
-
resource:
|
|
1227
|
-
queryKey:
|
|
1228
|
-
queryFn: async () =>
|
|
1229
|
-
|
|
1230
|
-
id: n,
|
|
1274
|
+
resource: P({
|
|
1275
|
+
queryKey: u,
|
|
1276
|
+
queryFn: async () => _n(o, t, n, A.GetInput.createFrom({
|
|
1277
|
+
id: r,
|
|
1231
1278
|
namespace: s
|
|
1232
1279
|
})),
|
|
1233
1280
|
retry: !1
|
|
@@ -1238,89 +1285,82 @@ const Us = () => {
|
|
|
1238
1285
|
*
|
|
1239
1286
|
* @params opts Optional parameters to pass to the resource update
|
|
1240
1287
|
*/
|
|
1241
|
-
update:
|
|
1288
|
+
update: l,
|
|
1242
1289
|
/**
|
|
1243
1290
|
* Delete an existing resource. A set of optional parameters can be passed to customize the delete behavior,
|
|
1244
1291
|
* which if specified, will add additional default behavior set via the hook options.
|
|
1245
1292
|
*
|
|
1246
1293
|
* @params {object} opts Optional parameters to pass to the resource delete
|
|
1247
1294
|
*/
|
|
1248
|
-
remove:
|
|
1295
|
+
remove: c
|
|
1249
1296
|
};
|
|
1250
|
-
},
|
|
1297
|
+
}, zs = (e) => {
|
|
1251
1298
|
const t = ["component", e.plugin, e.resource, e.area];
|
|
1252
1299
|
return {
|
|
1253
1300
|
/**
|
|
1254
1301
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1255
1302
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1256
1303
|
*/
|
|
1257
|
-
component:
|
|
1304
|
+
component: P({
|
|
1258
1305
|
queryKey: t,
|
|
1259
|
-
queryFn: async () =>
|
|
1306
|
+
queryFn: async () => En(e)
|
|
1260
1307
|
})
|
|
1261
1308
|
};
|
|
1262
|
-
},
|
|
1263
|
-
const
|
|
1309
|
+
}, Qs = ({ pluginID: e, connectionID: t }) => {
|
|
1310
|
+
const n = D(e);
|
|
1264
1311
|
return {
|
|
1265
1312
|
/**
|
|
1266
1313
|
* The current settings from the provider.
|
|
1267
1314
|
*/
|
|
1268
|
-
groups:
|
|
1269
|
-
queryKey: [
|
|
1270
|
-
queryFn: async () =>
|
|
1315
|
+
groups: P({
|
|
1316
|
+
queryKey: [n, "resource_groups", "list"],
|
|
1317
|
+
queryFn: async () => Sn(n, t),
|
|
1271
1318
|
retry: !1
|
|
1272
1319
|
})
|
|
1273
1320
|
};
|
|
1274
|
-
},
|
|
1321
|
+
}, Ws = ({
|
|
1275
1322
|
pluginID: e,
|
|
1276
1323
|
connectionID: t,
|
|
1277
|
-
searches:
|
|
1324
|
+
searches: n
|
|
1278
1325
|
}) => {
|
|
1279
|
-
const
|
|
1280
|
-
return
|
|
1281
|
-
queries:
|
|
1282
|
-
queryKey: s(
|
|
1283
|
-
queryFn: async () =>
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
},
|
|
1289
|
-
pagination: {
|
|
1290
|
-
page: 1,
|
|
1291
|
-
pageSize: 200
|
|
1292
|
-
},
|
|
1293
|
-
namespaces: o.namespaces
|
|
1294
|
-
})).then((a) => (console.log(a.result), a.result && o.postFilter ? Object.values(a.result).filter(o.postFilter) : Object.values(a.result || {}))),
|
|
1326
|
+
const r = D(e), s = (i) => [r, t, i.key, i.namespaces, "list"];
|
|
1327
|
+
return An({
|
|
1328
|
+
queries: n.map((i) => ({
|
|
1329
|
+
queryKey: s(i),
|
|
1330
|
+
queryFn: async () => dt(r, t, i.key, A.ListInput.createFrom({
|
|
1331
|
+
order: [{ field: "name", descending: !1 }],
|
|
1332
|
+
pagination: { page: 1, pageSize: 200 },
|
|
1333
|
+
namespaces: i.namespaces
|
|
1334
|
+
})).then((a) => (console.log(a.result), a.result && i.postFilter ? Object.values(a.result).filter(i.postFilter) : Object.values(a.result || {}))),
|
|
1295
1335
|
retry: !1
|
|
1296
1336
|
}))
|
|
1297
1337
|
});
|
|
1298
|
-
},
|
|
1299
|
-
const
|
|
1338
|
+
}, Bs = ({ pluginID: e, resourceKey: t }) => {
|
|
1339
|
+
const n = D(e);
|
|
1300
1340
|
return {
|
|
1301
1341
|
/**
|
|
1302
1342
|
* The current settings from the provider.
|
|
1303
1343
|
*/
|
|
1304
|
-
resourceType:
|
|
1305
|
-
queryKey: [
|
|
1306
|
-
queryFn: async () =>
|
|
1344
|
+
resourceType: P({
|
|
1345
|
+
queryKey: [n, "resources", t],
|
|
1346
|
+
queryFn: async () => wn(n, t),
|
|
1307
1347
|
retry: !1
|
|
1308
1348
|
})
|
|
1309
1349
|
};
|
|
1310
1350
|
}, Hs = ({ pluginID: e, connectionID: t }) => {
|
|
1311
|
-
const
|
|
1351
|
+
const n = D(e);
|
|
1312
1352
|
return {
|
|
1313
1353
|
/**
|
|
1314
1354
|
* The current settings from the provider.
|
|
1315
1355
|
*/
|
|
1316
|
-
types:
|
|
1317
|
-
queryKey: [
|
|
1318
|
-
queryFn: async () =>
|
|
1356
|
+
types: P({
|
|
1357
|
+
queryKey: [n, "resources", "list"],
|
|
1358
|
+
queryFn: async () => Cn(n, t),
|
|
1319
1359
|
retry: !1
|
|
1320
1360
|
})
|
|
1321
1361
|
};
|
|
1322
1362
|
};
|
|
1323
|
-
var
|
|
1363
|
+
var Rt = Symbol.for("immer-nothing"), Ve = Symbol.for("immer-draftable"), T = Symbol.for("immer-state"), Vn = process.env.NODE_ENV !== "production" ? [
|
|
1324
1364
|
// All error codes, starting by 0:
|
|
1325
1365
|
function(e) {
|
|
1326
1366
|
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
@@ -1353,109 +1393,109 @@ var Tt = Symbol.for("immer-nothing"), tt = Symbol.for("immer-draftable"), N = Sy
|
|
|
1353
1393
|
] : [];
|
|
1354
1394
|
function O(e, ...t) {
|
|
1355
1395
|
if (process.env.NODE_ENV !== "production") {
|
|
1356
|
-
const
|
|
1357
|
-
throw new Error(`[Immer] ${
|
|
1396
|
+
const n = Vn[e], r = typeof n == "function" ? n.apply(null, t) : n;
|
|
1397
|
+
throw new Error(`[Immer] ${r}`);
|
|
1358
1398
|
}
|
|
1359
1399
|
throw new Error(
|
|
1360
1400
|
`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
|
|
1361
1401
|
);
|
|
1362
1402
|
}
|
|
1363
|
-
var
|
|
1364
|
-
function
|
|
1365
|
-
return !!e && !!e[
|
|
1403
|
+
var ee = Object.getPrototypeOf;
|
|
1404
|
+
function te(e) {
|
|
1405
|
+
return !!e && !!e[T];
|
|
1366
1406
|
}
|
|
1367
|
-
function
|
|
1407
|
+
function B(e) {
|
|
1368
1408
|
var t;
|
|
1369
|
-
return e ?
|
|
1409
|
+
return e ? It(e) || Array.isArray(e) || !!e[Ve] || !!((t = e.constructor) != null && t[Ve]) || me(e) || _e(e) : !1;
|
|
1370
1410
|
}
|
|
1371
|
-
var
|
|
1372
|
-
function
|
|
1411
|
+
var Xn = Object.prototype.constructor.toString();
|
|
1412
|
+
function It(e) {
|
|
1373
1413
|
if (!e || typeof e != "object")
|
|
1374
1414
|
return !1;
|
|
1375
|
-
const t =
|
|
1415
|
+
const t = ee(e);
|
|
1376
1416
|
if (t === null)
|
|
1377
1417
|
return !0;
|
|
1378
|
-
const
|
|
1379
|
-
return
|
|
1418
|
+
const n = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
|
|
1419
|
+
return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) === Xn;
|
|
1380
1420
|
}
|
|
1381
|
-
function
|
|
1382
|
-
ge(e) === 0 ? Reflect.ownKeys(e).forEach((
|
|
1383
|
-
t(
|
|
1384
|
-
}) : e.forEach((
|
|
1421
|
+
function fe(e, t) {
|
|
1422
|
+
ge(e) === 0 ? Reflect.ownKeys(e).forEach((n) => {
|
|
1423
|
+
t(n, e[n], e);
|
|
1424
|
+
}) : e.forEach((n, r) => t(r, n, e));
|
|
1385
1425
|
}
|
|
1386
1426
|
function ge(e) {
|
|
1387
|
-
const t = e[
|
|
1388
|
-
return t ? t.type_ : Array.isArray(e) ? 1 :
|
|
1427
|
+
const t = e[T];
|
|
1428
|
+
return t ? t.type_ : Array.isArray(e) ? 1 : me(e) ? 2 : _e(e) ? 3 : 0;
|
|
1389
1429
|
}
|
|
1390
|
-
function
|
|
1430
|
+
function xe(e, t) {
|
|
1391
1431
|
return ge(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
1392
1432
|
}
|
|
1393
|
-
function
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1433
|
+
function Ft(e, t, n) {
|
|
1434
|
+
const r = ge(e);
|
|
1435
|
+
r === 2 ? e.set(t, n) : r === 3 ? e.add(n) : e[t] = n;
|
|
1396
1436
|
}
|
|
1397
|
-
function
|
|
1437
|
+
function Zn(e, t) {
|
|
1398
1438
|
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
1399
1439
|
}
|
|
1400
|
-
function
|
|
1440
|
+
function me(e) {
|
|
1401
1441
|
return e instanceof Map;
|
|
1402
1442
|
}
|
|
1403
|
-
function
|
|
1443
|
+
function _e(e) {
|
|
1404
1444
|
return e instanceof Set;
|
|
1405
1445
|
}
|
|
1406
|
-
function
|
|
1446
|
+
function W(e) {
|
|
1407
1447
|
return e.copy_ || e.base_;
|
|
1408
1448
|
}
|
|
1409
|
-
function
|
|
1410
|
-
if (
|
|
1449
|
+
function Ae(e, t) {
|
|
1450
|
+
if (me(e))
|
|
1411
1451
|
return new Map(e);
|
|
1412
|
-
if (
|
|
1452
|
+
if (_e(e))
|
|
1413
1453
|
return new Set(e);
|
|
1414
1454
|
if (Array.isArray(e))
|
|
1415
1455
|
return Array.prototype.slice.call(e);
|
|
1416
|
-
const
|
|
1417
|
-
if (t === !0 || t === "class_only" && !
|
|
1418
|
-
const
|
|
1419
|
-
delete
|
|
1420
|
-
let s = Reflect.ownKeys(
|
|
1421
|
-
for (let
|
|
1422
|
-
const
|
|
1423
|
-
a.writable === !1 && (a.writable = !0, a.configurable = !0), (a.get || a.set) && (
|
|
1456
|
+
const n = It(e);
|
|
1457
|
+
if (t === !0 || t === "class_only" && !n) {
|
|
1458
|
+
const r = Object.getOwnPropertyDescriptors(e);
|
|
1459
|
+
delete r[T];
|
|
1460
|
+
let s = Reflect.ownKeys(r);
|
|
1461
|
+
for (let o = 0; o < s.length; o++) {
|
|
1462
|
+
const i = s[o], a = r[i];
|
|
1463
|
+
a.writable === !1 && (a.writable = !0, a.configurable = !0), (a.get || a.set) && (r[i] = {
|
|
1424
1464
|
configurable: !0,
|
|
1425
1465
|
writable: !0,
|
|
1426
1466
|
// could live with !!desc.set as well here...
|
|
1427
1467
|
enumerable: a.enumerable,
|
|
1428
|
-
value: e[
|
|
1468
|
+
value: e[i]
|
|
1429
1469
|
});
|
|
1430
1470
|
}
|
|
1431
|
-
return Object.create(
|
|
1471
|
+
return Object.create(ee(e), r);
|
|
1432
1472
|
} else {
|
|
1433
|
-
const
|
|
1434
|
-
if (
|
|
1473
|
+
const r = ee(e);
|
|
1474
|
+
if (r !== null && n)
|
|
1435
1475
|
return { ...e };
|
|
1436
|
-
const s = Object.create(
|
|
1476
|
+
const s = Object.create(r);
|
|
1437
1477
|
return Object.assign(s, e);
|
|
1438
1478
|
}
|
|
1439
1479
|
}
|
|
1440
|
-
function
|
|
1441
|
-
return
|
|
1480
|
+
function qe(e, t = !1) {
|
|
1481
|
+
return Ee(e) || te(e) || !B(e) || (ge(e) > 1 && (e.set = e.add = e.clear = e.delete = er), Object.freeze(e), t && Object.entries(e).forEach(([n, r]) => qe(r, !0))), e;
|
|
1442
1482
|
}
|
|
1443
|
-
function
|
|
1483
|
+
function er() {
|
|
1444
1484
|
O(2);
|
|
1445
1485
|
}
|
|
1446
|
-
function
|
|
1486
|
+
function Ee(e) {
|
|
1447
1487
|
return Object.isFrozen(e);
|
|
1448
1488
|
}
|
|
1449
|
-
var
|
|
1450
|
-
function
|
|
1451
|
-
const t =
|
|
1489
|
+
var tr = {};
|
|
1490
|
+
function H(e) {
|
|
1491
|
+
const t = tr[e];
|
|
1452
1492
|
return t || O(0, e), t;
|
|
1453
1493
|
}
|
|
1454
|
-
var
|
|
1455
|
-
function
|
|
1456
|
-
return
|
|
1494
|
+
var oe;
|
|
1495
|
+
function Ot() {
|
|
1496
|
+
return oe;
|
|
1457
1497
|
}
|
|
1458
|
-
function
|
|
1498
|
+
function nr(e, t) {
|
|
1459
1499
|
return {
|
|
1460
1500
|
drafts_: [],
|
|
1461
1501
|
parent_: e,
|
|
@@ -1466,84 +1506,84 @@ function nn(e, t) {
|
|
|
1466
1506
|
unfinalizedDrafts_: 0
|
|
1467
1507
|
};
|
|
1468
1508
|
}
|
|
1469
|
-
function
|
|
1470
|
-
t && (
|
|
1509
|
+
function Xe(e, t) {
|
|
1510
|
+
t && (H("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
1471
1511
|
}
|
|
1472
|
-
function
|
|
1473
|
-
|
|
1512
|
+
function Te(e) {
|
|
1513
|
+
Ne(e), e.drafts_.forEach(rr), e.drafts_ = null;
|
|
1474
1514
|
}
|
|
1475
|
-
function
|
|
1476
|
-
e ===
|
|
1515
|
+
function Ne(e) {
|
|
1516
|
+
e === oe && (oe = e.parent_);
|
|
1477
1517
|
}
|
|
1478
|
-
function
|
|
1479
|
-
return
|
|
1518
|
+
function Ze(e) {
|
|
1519
|
+
return oe = nr(oe, e);
|
|
1480
1520
|
}
|
|
1481
|
-
function
|
|
1482
|
-
const t = e[
|
|
1521
|
+
function rr(e) {
|
|
1522
|
+
const t = e[T];
|
|
1483
1523
|
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
|
|
1484
1524
|
}
|
|
1485
|
-
function
|
|
1525
|
+
function et(e, t) {
|
|
1486
1526
|
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
1487
|
-
const
|
|
1488
|
-
return e !== void 0 && e !==
|
|
1489
|
-
|
|
1527
|
+
const n = t.drafts_[0];
|
|
1528
|
+
return e !== void 0 && e !== n ? (n[T].modified_ && (Te(t), O(4)), B(e) && (e = pe(t, e), t.parent_ || ye(t, e)), t.patches_ && H("Patches").generateReplacementPatches_(
|
|
1529
|
+
n[T].base_,
|
|
1490
1530
|
e,
|
|
1491
1531
|
t.patches_,
|
|
1492
1532
|
t.inversePatches_
|
|
1493
|
-
)) : e =
|
|
1533
|
+
)) : e = pe(t, n, []), Te(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Rt ? e : void 0;
|
|
1494
1534
|
}
|
|
1495
|
-
function
|
|
1496
|
-
if (
|
|
1535
|
+
function pe(e, t, n) {
|
|
1536
|
+
if (Ee(t))
|
|
1497
1537
|
return t;
|
|
1498
|
-
const
|
|
1499
|
-
if (!
|
|
1500
|
-
return
|
|
1538
|
+
const r = t[T];
|
|
1539
|
+
if (!r)
|
|
1540
|
+
return fe(
|
|
1501
1541
|
t,
|
|
1502
|
-
(s,
|
|
1542
|
+
(s, o) => tt(e, r, t, s, o, n)
|
|
1503
1543
|
), t;
|
|
1504
|
-
if (
|
|
1544
|
+
if (r.scope_ !== e)
|
|
1505
1545
|
return t;
|
|
1506
|
-
if (!
|
|
1507
|
-
return
|
|
1508
|
-
if (!
|
|
1509
|
-
|
|
1510
|
-
const s =
|
|
1511
|
-
let
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
(a,
|
|
1515
|
-
),
|
|
1516
|
-
n,
|
|
1546
|
+
if (!r.modified_)
|
|
1547
|
+
return ye(e, r.base_, !0), r.base_;
|
|
1548
|
+
if (!r.finalized_) {
|
|
1549
|
+
r.finalized_ = !0, r.scope_.unfinalizedDrafts_--;
|
|
1550
|
+
const s = r.copy_;
|
|
1551
|
+
let o = s, i = !1;
|
|
1552
|
+
r.type_ === 3 && (o = new Set(s), s.clear(), i = !0), fe(
|
|
1553
|
+
o,
|
|
1554
|
+
(a, u) => tt(e, r, s, a, u, n, i)
|
|
1555
|
+
), ye(e, s, !1), n && e.patches_ && H("Patches").generatePatches_(
|
|
1517
1556
|
r,
|
|
1557
|
+
n,
|
|
1518
1558
|
e.patches_,
|
|
1519
1559
|
e.inversePatches_
|
|
1520
1560
|
);
|
|
1521
1561
|
}
|
|
1522
|
-
return
|
|
1562
|
+
return r.copy_;
|
|
1523
1563
|
}
|
|
1524
|
-
function
|
|
1525
|
-
if (process.env.NODE_ENV !== "production" && s ===
|
|
1526
|
-
const a =
|
|
1527
|
-
!
|
|
1528
|
-
if (
|
|
1564
|
+
function tt(e, t, n, r, s, o, i) {
|
|
1565
|
+
if (process.env.NODE_ENV !== "production" && s === n && O(5), te(s)) {
|
|
1566
|
+
const a = o && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
1567
|
+
!xe(t.assigned_, r) ? o.concat(r) : void 0, u = pe(e, s, a);
|
|
1568
|
+
if (Ft(n, r, u), te(u))
|
|
1529
1569
|
e.canAutoFreeze_ = !1;
|
|
1530
1570
|
else
|
|
1531
1571
|
return;
|
|
1532
|
-
} else
|
|
1533
|
-
if (
|
|
1572
|
+
} else i && n.add(s);
|
|
1573
|
+
if (B(s) && !Ee(s)) {
|
|
1534
1574
|
if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
|
|
1535
1575
|
return;
|
|
1536
|
-
|
|
1576
|
+
pe(e, s), (!t || !t.scope_.parent_) && typeof r != "symbol" && Object.prototype.propertyIsEnumerable.call(n, r) && ye(e, s);
|
|
1537
1577
|
}
|
|
1538
1578
|
}
|
|
1539
|
-
function
|
|
1540
|
-
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ &&
|
|
1579
|
+
function ye(e, t, n = !1) {
|
|
1580
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && qe(t, n);
|
|
1541
1581
|
}
|
|
1542
|
-
function
|
|
1543
|
-
const
|
|
1544
|
-
type_:
|
|
1582
|
+
function sr(e, t) {
|
|
1583
|
+
const n = Array.isArray(e), r = {
|
|
1584
|
+
type_: n ? 1 : 0,
|
|
1545
1585
|
// Track which produce call this is associated with.
|
|
1546
|
-
scope_: t ? t.scope_ :
|
|
1586
|
+
scope_: t ? t.scope_ : Ot(),
|
|
1547
1587
|
// True for both shallow and deep changes.
|
|
1548
1588
|
modified_: !1,
|
|
1549
1589
|
// Used during finalization.
|
|
@@ -1563,160 +1603,160 @@ function on(e, t) {
|
|
|
1563
1603
|
revoke_: null,
|
|
1564
1604
|
isManual_: !1
|
|
1565
1605
|
};
|
|
1566
|
-
let s =
|
|
1567
|
-
|
|
1568
|
-
const { revoke:
|
|
1569
|
-
return
|
|
1606
|
+
let s = r, o = je;
|
|
1607
|
+
n && (s = [r], o = ie);
|
|
1608
|
+
const { revoke: i, proxy: a } = Proxy.revocable(s, o);
|
|
1609
|
+
return r.draft_ = a, r.revoke_ = i, a;
|
|
1570
1610
|
}
|
|
1571
|
-
var
|
|
1611
|
+
var je = {
|
|
1572
1612
|
get(e, t) {
|
|
1573
|
-
if (t ===
|
|
1613
|
+
if (t === T)
|
|
1574
1614
|
return e;
|
|
1575
|
-
const
|
|
1576
|
-
if (!
|
|
1577
|
-
return
|
|
1578
|
-
const
|
|
1579
|
-
return e.finalized_ || !
|
|
1615
|
+
const n = W(e);
|
|
1616
|
+
if (!xe(n, t))
|
|
1617
|
+
return or(e, n, t);
|
|
1618
|
+
const r = n[t];
|
|
1619
|
+
return e.finalized_ || !B(r) ? r : r === De(e.base_, t) ? (Pe(e), e.copy_[t] = Me(r, e)) : r;
|
|
1580
1620
|
},
|
|
1581
1621
|
has(e, t) {
|
|
1582
|
-
return t in
|
|
1622
|
+
return t in W(e);
|
|
1583
1623
|
},
|
|
1584
1624
|
ownKeys(e) {
|
|
1585
|
-
return Reflect.ownKeys(
|
|
1625
|
+
return Reflect.ownKeys(W(e));
|
|
1586
1626
|
},
|
|
1587
|
-
set(e, t,
|
|
1588
|
-
const
|
|
1589
|
-
if (
|
|
1590
|
-
return
|
|
1627
|
+
set(e, t, n) {
|
|
1628
|
+
const r = xt(W(e), t);
|
|
1629
|
+
if (r != null && r.set)
|
|
1630
|
+
return r.set.call(e.draft_, n), !0;
|
|
1591
1631
|
if (!e.modified_) {
|
|
1592
|
-
const s =
|
|
1593
|
-
if (
|
|
1594
|
-
return e.copy_[t] =
|
|
1595
|
-
if (
|
|
1632
|
+
const s = De(W(e), t), o = s == null ? void 0 : s[T];
|
|
1633
|
+
if (o && o.base_ === n)
|
|
1634
|
+
return e.copy_[t] = n, e.assigned_[t] = !1, !0;
|
|
1635
|
+
if (Zn(n, s) && (n !== void 0 || xe(e.base_, t)))
|
|
1596
1636
|
return !0;
|
|
1597
|
-
|
|
1637
|
+
Pe(e), ke(e);
|
|
1598
1638
|
}
|
|
1599
|
-
return e.copy_[t] ===
|
|
1600
|
-
(
|
|
1601
|
-
Number.isNaN(
|
|
1639
|
+
return e.copy_[t] === n && // special case: handle new props with value 'undefined'
|
|
1640
|
+
(n !== void 0 || t in e.copy_) || // special case: NaN
|
|
1641
|
+
Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n, e.assigned_[t] = !0), !0;
|
|
1602
1642
|
},
|
|
1603
1643
|
deleteProperty(e, t) {
|
|
1604
|
-
return
|
|
1644
|
+
return De(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, Pe(e), ke(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
|
|
1605
1645
|
},
|
|
1606
1646
|
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
1607
1647
|
// the same guarantee in ES5 mode.
|
|
1608
1648
|
getOwnPropertyDescriptor(e, t) {
|
|
1609
|
-
const
|
|
1610
|
-
return
|
|
1649
|
+
const n = W(e), r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
1650
|
+
return r && {
|
|
1611
1651
|
writable: !0,
|
|
1612
1652
|
configurable: e.type_ !== 1 || t !== "length",
|
|
1613
|
-
enumerable:
|
|
1614
|
-
value:
|
|
1653
|
+
enumerable: r.enumerable,
|
|
1654
|
+
value: n[t]
|
|
1615
1655
|
};
|
|
1616
1656
|
},
|
|
1617
1657
|
defineProperty() {
|
|
1618
1658
|
O(11);
|
|
1619
1659
|
},
|
|
1620
1660
|
getPrototypeOf(e) {
|
|
1621
|
-
return
|
|
1661
|
+
return ee(e.base_);
|
|
1622
1662
|
},
|
|
1623
1663
|
setPrototypeOf() {
|
|
1624
1664
|
O(12);
|
|
1625
1665
|
}
|
|
1626
|
-
},
|
|
1627
|
-
|
|
1628
|
-
|
|
1666
|
+
}, ie = {};
|
|
1667
|
+
fe(je, (e, t) => {
|
|
1668
|
+
ie[e] = function() {
|
|
1629
1669
|
return arguments[0] = arguments[0][0], t.apply(this, arguments);
|
|
1630
1670
|
};
|
|
1631
1671
|
});
|
|
1632
|
-
|
|
1633
|
-
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && O(13),
|
|
1672
|
+
ie.deleteProperty = function(e, t) {
|
|
1673
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && O(13), ie.set.call(this, e, t, void 0);
|
|
1634
1674
|
};
|
|
1635
|
-
|
|
1636
|
-
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && O(14),
|
|
1675
|
+
ie.set = function(e, t, n) {
|
|
1676
|
+
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && O(14), je.set.call(this, e[0], t, n, e[0]);
|
|
1637
1677
|
};
|
|
1638
|
-
function
|
|
1639
|
-
const
|
|
1640
|
-
return (
|
|
1678
|
+
function De(e, t) {
|
|
1679
|
+
const n = e[T];
|
|
1680
|
+
return (n ? W(n) : e)[t];
|
|
1641
1681
|
}
|
|
1642
|
-
function
|
|
1682
|
+
function or(e, t, n) {
|
|
1643
1683
|
var s;
|
|
1644
|
-
const
|
|
1645
|
-
return
|
|
1684
|
+
const r = xt(t, n);
|
|
1685
|
+
return r ? "value" in r ? r.value : (
|
|
1646
1686
|
// This is a very special case, if the prop is a getter defined by the
|
|
1647
1687
|
// prototype, we should invoke it with the draft as context!
|
|
1648
|
-
(s =
|
|
1688
|
+
(s = r.get) == null ? void 0 : s.call(e.draft_)
|
|
1649
1689
|
) : void 0;
|
|
1650
1690
|
}
|
|
1651
|
-
function
|
|
1691
|
+
function xt(e, t) {
|
|
1652
1692
|
if (!(t in e))
|
|
1653
1693
|
return;
|
|
1654
|
-
let
|
|
1655
|
-
for (;
|
|
1656
|
-
const
|
|
1657
|
-
if (
|
|
1658
|
-
return
|
|
1659
|
-
|
|
1694
|
+
let n = ee(e);
|
|
1695
|
+
for (; n; ) {
|
|
1696
|
+
const r = Object.getOwnPropertyDescriptor(n, t);
|
|
1697
|
+
if (r)
|
|
1698
|
+
return r;
|
|
1699
|
+
n = ee(n);
|
|
1660
1700
|
}
|
|
1661
1701
|
}
|
|
1662
1702
|
function ke(e) {
|
|
1663
1703
|
e.modified_ || (e.modified_ = !0, e.parent_ && ke(e.parent_));
|
|
1664
1704
|
}
|
|
1665
|
-
function
|
|
1666
|
-
e.copy_ || (e.copy_ =
|
|
1705
|
+
function Pe(e) {
|
|
1706
|
+
e.copy_ || (e.copy_ = Ae(
|
|
1667
1707
|
e.base_,
|
|
1668
1708
|
e.scope_.immer_.useStrictShallowCopy_
|
|
1669
1709
|
));
|
|
1670
1710
|
}
|
|
1671
|
-
var
|
|
1711
|
+
var ir = class {
|
|
1672
1712
|
constructor(e) {
|
|
1673
|
-
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t,
|
|
1674
|
-
if (typeof t == "function" && typeof
|
|
1675
|
-
const
|
|
1676
|
-
|
|
1677
|
-
const
|
|
1678
|
-
return function(
|
|
1679
|
-
return
|
|
1713
|
+
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, n, r) => {
|
|
1714
|
+
if (typeof t == "function" && typeof n != "function") {
|
|
1715
|
+
const o = n;
|
|
1716
|
+
n = t;
|
|
1717
|
+
const i = this;
|
|
1718
|
+
return function(u = o, ...l) {
|
|
1719
|
+
return i.produce(u, (c) => n.call(this, c, ...l));
|
|
1680
1720
|
};
|
|
1681
1721
|
}
|
|
1682
|
-
typeof
|
|
1722
|
+
typeof n != "function" && O(6), r !== void 0 && typeof r != "function" && O(7);
|
|
1683
1723
|
let s;
|
|
1684
|
-
if (
|
|
1685
|
-
const
|
|
1724
|
+
if (B(t)) {
|
|
1725
|
+
const o = Ze(this), i = Me(t, void 0);
|
|
1686
1726
|
let a = !0;
|
|
1687
1727
|
try {
|
|
1688
|
-
s =
|
|
1728
|
+
s = n(i), a = !1;
|
|
1689
1729
|
} finally {
|
|
1690
|
-
a ?
|
|
1730
|
+
a ? Te(o) : Ne(o);
|
|
1691
1731
|
}
|
|
1692
|
-
return
|
|
1732
|
+
return Xe(o, r), et(s, o);
|
|
1693
1733
|
} else if (!t || typeof t != "object") {
|
|
1694
|
-
if (s =
|
|
1695
|
-
const
|
|
1696
|
-
|
|
1734
|
+
if (s = n(t), s === void 0 && (s = t), s === Rt && (s = void 0), this.autoFreeze_ && qe(s, !0), r) {
|
|
1735
|
+
const o = [], i = [];
|
|
1736
|
+
H("Patches").generateReplacementPatches_(t, s, o, i), r(o, i);
|
|
1697
1737
|
}
|
|
1698
1738
|
return s;
|
|
1699
1739
|
} else
|
|
1700
1740
|
O(1, t);
|
|
1701
|
-
}, this.produceWithPatches = (t,
|
|
1741
|
+
}, this.produceWithPatches = (t, n) => {
|
|
1702
1742
|
if (typeof t == "function")
|
|
1703
|
-
return (
|
|
1704
|
-
let
|
|
1705
|
-
return [this.produce(t,
|
|
1706
|
-
|
|
1707
|
-
}),
|
|
1743
|
+
return (i, ...a) => this.produceWithPatches(i, (u) => t(u, ...a));
|
|
1744
|
+
let r, s;
|
|
1745
|
+
return [this.produce(t, n, (i, a) => {
|
|
1746
|
+
r = i, s = a;
|
|
1747
|
+
}), r, s];
|
|
1708
1748
|
}, typeof (e == null ? void 0 : e.autoFreeze) == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof (e == null ? void 0 : e.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy);
|
|
1709
1749
|
}
|
|
1710
1750
|
createDraft(e) {
|
|
1711
|
-
|
|
1712
|
-
const t =
|
|
1713
|
-
return
|
|
1751
|
+
B(e) || O(8), te(e) && (e = ar(e));
|
|
1752
|
+
const t = Ze(this), n = Me(e, void 0);
|
|
1753
|
+
return n[T].isManual_ = !0, Ne(t), n;
|
|
1714
1754
|
}
|
|
1715
1755
|
finishDraft(e, t) {
|
|
1716
|
-
const
|
|
1717
|
-
(!
|
|
1718
|
-
const { scope_:
|
|
1719
|
-
return
|
|
1756
|
+
const n = e && e[T];
|
|
1757
|
+
(!n || !n.isManual_) && O(9);
|
|
1758
|
+
const { scope_: r } = n;
|
|
1759
|
+
return Xe(r, t), et(void 0, r);
|
|
1720
1760
|
}
|
|
1721
1761
|
/**
|
|
1722
1762
|
* Pass true to automatically freeze all copies created by Immer.
|
|
@@ -1735,62 +1775,62 @@ var cn = class {
|
|
|
1735
1775
|
this.useStrictShallowCopy_ = e;
|
|
1736
1776
|
}
|
|
1737
1777
|
applyPatches(e, t) {
|
|
1738
|
-
let
|
|
1739
|
-
for (
|
|
1740
|
-
const s = t[
|
|
1778
|
+
let n;
|
|
1779
|
+
for (n = t.length - 1; n >= 0; n--) {
|
|
1780
|
+
const s = t[n];
|
|
1741
1781
|
if (s.path.length === 0 && s.op === "replace") {
|
|
1742
1782
|
e = s.value;
|
|
1743
1783
|
break;
|
|
1744
1784
|
}
|
|
1745
1785
|
}
|
|
1746
|
-
|
|
1747
|
-
const
|
|
1748
|
-
return
|
|
1786
|
+
n > -1 && (t = t.slice(n + 1));
|
|
1787
|
+
const r = H("Patches").applyPatches_;
|
|
1788
|
+
return te(e) ? r(e, t) : this.produce(
|
|
1749
1789
|
e,
|
|
1750
|
-
(s) =>
|
|
1790
|
+
(s) => r(s, t)
|
|
1751
1791
|
);
|
|
1752
1792
|
}
|
|
1753
1793
|
};
|
|
1754
1794
|
function Me(e, t) {
|
|
1755
|
-
const
|
|
1756
|
-
return (t ? t.scope_ :
|
|
1795
|
+
const n = me(e) ? H("MapSet").proxyMap_(e, t) : _e(e) ? H("MapSet").proxySet_(e, t) : sr(e, t);
|
|
1796
|
+
return (t ? t.scope_ : Ot()).drafts_.push(n), n;
|
|
1757
1797
|
}
|
|
1758
|
-
function
|
|
1759
|
-
return
|
|
1798
|
+
function ar(e) {
|
|
1799
|
+
return te(e) || O(10, e), At(e);
|
|
1760
1800
|
}
|
|
1761
|
-
function
|
|
1762
|
-
if (!
|
|
1801
|
+
function At(e) {
|
|
1802
|
+
if (!B(e) || Ee(e))
|
|
1763
1803
|
return e;
|
|
1764
|
-
const t = e[
|
|
1765
|
-
let
|
|
1804
|
+
const t = e[T];
|
|
1805
|
+
let n;
|
|
1766
1806
|
if (t) {
|
|
1767
1807
|
if (!t.modified_)
|
|
1768
1808
|
return t.base_;
|
|
1769
|
-
t.finalized_ = !0,
|
|
1809
|
+
t.finalized_ = !0, n = Ae(e, t.scope_.immer_.useStrictShallowCopy_);
|
|
1770
1810
|
} else
|
|
1771
|
-
|
|
1772
|
-
return
|
|
1773
|
-
|
|
1774
|
-
}), t && (t.finalized_ = !1),
|
|
1775
|
-
}
|
|
1776
|
-
var
|
|
1777
|
-
|
|
1778
|
-
|
|
1811
|
+
n = Ae(e, !0);
|
|
1812
|
+
return fe(n, (r, s) => {
|
|
1813
|
+
Ft(n, r, At(s));
|
|
1814
|
+
}), t && (t.finalized_ = !1), n;
|
|
1815
|
+
}
|
|
1816
|
+
var N = new ir(), Tt = N.produce;
|
|
1817
|
+
N.produceWithPatches.bind(
|
|
1818
|
+
N
|
|
1779
1819
|
);
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
var
|
|
1786
|
-
function
|
|
1820
|
+
N.setAutoFreeze.bind(N);
|
|
1821
|
+
N.setUseStrictShallowCopy.bind(N);
|
|
1822
|
+
N.applyPatches.bind(N);
|
|
1823
|
+
N.createDraft.bind(N);
|
|
1824
|
+
N.finishDraft.bind(N);
|
|
1825
|
+
var le = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1826
|
+
function cr(e) {
|
|
1787
1827
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1788
1828
|
}
|
|
1789
|
-
var
|
|
1790
|
-
function
|
|
1829
|
+
var ur = "Expected a function", Nt = "__lodash_hash_undefined__", lr = "[object Function]", dr = "[object GeneratorFunction]", fr = "[object Symbol]", pr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, yr = /^\w*$/, hr = /^\./, gr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, mr = /[\\^$.*+?()[\]{}|]/g, _r = /\\(\\)?/g, Er = /^\[object .+?Constructor\]$/, Sr = typeof le == "object" && le && le.Object === Object && le, wr = typeof self == "object" && self && self.Object === Object && self, Ge = Sr || wr || Function("return this")();
|
|
1830
|
+
function Cr(e, t) {
|
|
1791
1831
|
return e == null ? void 0 : e[t];
|
|
1792
1832
|
}
|
|
1793
|
-
function
|
|
1833
|
+
function br(e) {
|
|
1794
1834
|
var t = !1;
|
|
1795
1835
|
if (e != null && typeof e.toString != "function")
|
|
1796
1836
|
try {
|
|
@@ -1799,177 +1839,177 @@ function Pn(e) {
|
|
|
1799
1839
|
}
|
|
1800
1840
|
return t;
|
|
1801
1841
|
}
|
|
1802
|
-
var
|
|
1803
|
-
var e = /[^.]+$/.exec(
|
|
1842
|
+
var vr = Array.prototype, Dr = Function.prototype, kt = Object.prototype, Re = Ge["__core-js_shared__"], nt = function() {
|
|
1843
|
+
var e = /[^.]+$/.exec(Re && Re.keys && Re.keys.IE_PROTO || "");
|
|
1804
1844
|
return e ? "Symbol(src)_1." + e : "";
|
|
1805
|
-
}(),
|
|
1806
|
-
"^" +
|
|
1807
|
-
),
|
|
1808
|
-
function
|
|
1809
|
-
var t = -1,
|
|
1810
|
-
for (this.clear(); ++t <
|
|
1811
|
-
var
|
|
1812
|
-
this.set(
|
|
1845
|
+
}(), Mt = Dr.toString, Ke = kt.hasOwnProperty, Lt = kt.toString, Pr = RegExp(
|
|
1846
|
+
"^" + Mt.call(Ke).replace(mr, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1847
|
+
), rt = Ge.Symbol, Rr = vr.splice, Ir = $t(Ge, "Map"), ae = $t(Object, "create"), st = rt ? rt.prototype : void 0, ot = st ? st.toString : void 0;
|
|
1848
|
+
function Y(e) {
|
|
1849
|
+
var t = -1, n = e ? e.length : 0;
|
|
1850
|
+
for (this.clear(); ++t < n; ) {
|
|
1851
|
+
var r = e[t];
|
|
1852
|
+
this.set(r[0], r[1]);
|
|
1813
1853
|
}
|
|
1814
1854
|
}
|
|
1815
|
-
function
|
|
1816
|
-
this.__data__ =
|
|
1855
|
+
function Fr() {
|
|
1856
|
+
this.__data__ = ae ? ae(null) : {};
|
|
1817
1857
|
}
|
|
1818
|
-
function
|
|
1858
|
+
function Or(e) {
|
|
1819
1859
|
return this.has(e) && delete this.__data__[e];
|
|
1820
1860
|
}
|
|
1821
|
-
function
|
|
1861
|
+
function xr(e) {
|
|
1822
1862
|
var t = this.__data__;
|
|
1823
|
-
if (
|
|
1824
|
-
var
|
|
1825
|
-
return
|
|
1863
|
+
if (ae) {
|
|
1864
|
+
var n = t[e];
|
|
1865
|
+
return n === Nt ? void 0 : n;
|
|
1826
1866
|
}
|
|
1827
|
-
return
|
|
1867
|
+
return Ke.call(t, e) ? t[e] : void 0;
|
|
1828
1868
|
}
|
|
1829
|
-
function
|
|
1869
|
+
function Ar(e) {
|
|
1830
1870
|
var t = this.__data__;
|
|
1831
|
-
return
|
|
1871
|
+
return ae ? t[e] !== void 0 : Ke.call(t, e);
|
|
1832
1872
|
}
|
|
1833
|
-
function
|
|
1834
|
-
var
|
|
1835
|
-
return
|
|
1873
|
+
function Tr(e, t) {
|
|
1874
|
+
var n = this.__data__;
|
|
1875
|
+
return n[e] = ae && t === void 0 ? Nt : t, this;
|
|
1836
1876
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1877
|
+
Y.prototype.clear = Fr;
|
|
1878
|
+
Y.prototype.delete = Or;
|
|
1879
|
+
Y.prototype.get = xr;
|
|
1880
|
+
Y.prototype.has = Ar;
|
|
1881
|
+
Y.prototype.set = Tr;
|
|
1842
1882
|
function re(e) {
|
|
1843
|
-
var t = -1,
|
|
1844
|
-
for (this.clear(); ++t <
|
|
1845
|
-
var
|
|
1846
|
-
this.set(
|
|
1883
|
+
var t = -1, n = e ? e.length : 0;
|
|
1884
|
+
for (this.clear(); ++t < n; ) {
|
|
1885
|
+
var r = e[t];
|
|
1886
|
+
this.set(r[0], r[1]);
|
|
1847
1887
|
}
|
|
1848
1888
|
}
|
|
1849
|
-
function
|
|
1889
|
+
function Nr() {
|
|
1850
1890
|
this.__data__ = [];
|
|
1851
1891
|
}
|
|
1852
|
-
function
|
|
1853
|
-
var t = this.__data__,
|
|
1854
|
-
if (
|
|
1892
|
+
function kr(e) {
|
|
1893
|
+
var t = this.__data__, n = Se(t, e);
|
|
1894
|
+
if (n < 0)
|
|
1855
1895
|
return !1;
|
|
1856
|
-
var
|
|
1857
|
-
return
|
|
1858
|
-
}
|
|
1859
|
-
function
|
|
1860
|
-
var t = this.__data__,
|
|
1861
|
-
return
|
|
1862
|
-
}
|
|
1863
|
-
function
|
|
1864
|
-
return
|
|
1865
|
-
}
|
|
1866
|
-
function
|
|
1867
|
-
var
|
|
1868
|
-
return
|
|
1869
|
-
}
|
|
1870
|
-
re.prototype.clear =
|
|
1871
|
-
re.prototype.delete =
|
|
1872
|
-
re.prototype.get =
|
|
1873
|
-
re.prototype.has =
|
|
1874
|
-
re.prototype.set =
|
|
1875
|
-
function
|
|
1876
|
-
var t = -1,
|
|
1877
|
-
for (this.clear(); ++t <
|
|
1878
|
-
var
|
|
1879
|
-
this.set(
|
|
1896
|
+
var r = t.length - 1;
|
|
1897
|
+
return n == r ? t.pop() : Rr.call(t, n, 1), !0;
|
|
1898
|
+
}
|
|
1899
|
+
function Mr(e) {
|
|
1900
|
+
var t = this.__data__, n = Se(t, e);
|
|
1901
|
+
return n < 0 ? void 0 : t[n][1];
|
|
1902
|
+
}
|
|
1903
|
+
function Lr(e) {
|
|
1904
|
+
return Se(this.__data__, e) > -1;
|
|
1905
|
+
}
|
|
1906
|
+
function $r(e, t) {
|
|
1907
|
+
var n = this.__data__, r = Se(n, e);
|
|
1908
|
+
return r < 0 ? n.push([e, t]) : n[r][1] = t, this;
|
|
1909
|
+
}
|
|
1910
|
+
re.prototype.clear = Nr;
|
|
1911
|
+
re.prototype.delete = kr;
|
|
1912
|
+
re.prototype.get = Mr;
|
|
1913
|
+
re.prototype.has = Lr;
|
|
1914
|
+
re.prototype.set = $r;
|
|
1915
|
+
function J(e) {
|
|
1916
|
+
var t = -1, n = e ? e.length : 0;
|
|
1917
|
+
for (this.clear(); ++t < n; ) {
|
|
1918
|
+
var r = e[t];
|
|
1919
|
+
this.set(r[0], r[1]);
|
|
1880
1920
|
}
|
|
1881
1921
|
}
|
|
1882
|
-
function
|
|
1922
|
+
function Ur() {
|
|
1883
1923
|
this.__data__ = {
|
|
1884
|
-
hash: new
|
|
1885
|
-
map: new (
|
|
1886
|
-
string: new
|
|
1924
|
+
hash: new Y(),
|
|
1925
|
+
map: new (Ir || re)(),
|
|
1926
|
+
string: new Y()
|
|
1887
1927
|
};
|
|
1888
1928
|
}
|
|
1889
|
-
function
|
|
1890
|
-
return
|
|
1929
|
+
function qr(e) {
|
|
1930
|
+
return we(this, e).delete(e);
|
|
1891
1931
|
}
|
|
1892
|
-
function
|
|
1893
|
-
return
|
|
1932
|
+
function jr(e) {
|
|
1933
|
+
return we(this, e).get(e);
|
|
1894
1934
|
}
|
|
1895
|
-
function
|
|
1896
|
-
return
|
|
1935
|
+
function Gr(e) {
|
|
1936
|
+
return we(this, e).has(e);
|
|
1897
1937
|
}
|
|
1898
|
-
function
|
|
1899
|
-
return
|
|
1938
|
+
function Kr(e, t) {
|
|
1939
|
+
return we(this, e).set(e, t), this;
|
|
1900
1940
|
}
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
function
|
|
1907
|
-
for (var
|
|
1908
|
-
if (
|
|
1909
|
-
return
|
|
1941
|
+
J.prototype.clear = Ur;
|
|
1942
|
+
J.prototype.delete = qr;
|
|
1943
|
+
J.prototype.get = jr;
|
|
1944
|
+
J.prototype.has = Gr;
|
|
1945
|
+
J.prototype.set = Kr;
|
|
1946
|
+
function Se(e, t) {
|
|
1947
|
+
for (var n = e.length; n--; )
|
|
1948
|
+
if (es(e[n][0], t))
|
|
1949
|
+
return n;
|
|
1910
1950
|
return -1;
|
|
1911
1951
|
}
|
|
1912
|
-
function
|
|
1913
|
-
t =
|
|
1914
|
-
for (var
|
|
1915
|
-
e = e[
|
|
1916
|
-
return
|
|
1952
|
+
function zr(e, t) {
|
|
1953
|
+
t = Hr(t, e) ? [t] : Br(t);
|
|
1954
|
+
for (var n = 0, r = t.length; e != null && n < r; )
|
|
1955
|
+
e = e[Xr(t[n++])];
|
|
1956
|
+
return n && n == r ? e : void 0;
|
|
1917
1957
|
}
|
|
1918
|
-
function
|
|
1919
|
-
if (!
|
|
1958
|
+
function Qr(e) {
|
|
1959
|
+
if (!qt(e) || Jr(e))
|
|
1920
1960
|
return !1;
|
|
1921
|
-
var t =
|
|
1922
|
-
return t.test(
|
|
1961
|
+
var t = ts(e) || br(e) ? Pr : Er;
|
|
1962
|
+
return t.test(Zr(e));
|
|
1923
1963
|
}
|
|
1924
|
-
function
|
|
1964
|
+
function Wr(e) {
|
|
1925
1965
|
if (typeof e == "string")
|
|
1926
1966
|
return e;
|
|
1927
|
-
if (
|
|
1928
|
-
return
|
|
1967
|
+
if (Qe(e))
|
|
1968
|
+
return ot ? ot.call(e) : "";
|
|
1929
1969
|
var t = e + "";
|
|
1930
1970
|
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
1931
1971
|
}
|
|
1932
|
-
function
|
|
1933
|
-
return
|
|
1972
|
+
function Br(e) {
|
|
1973
|
+
return Ut(e) ? e : Vr(e);
|
|
1934
1974
|
}
|
|
1935
|
-
function
|
|
1936
|
-
var
|
|
1937
|
-
return
|
|
1975
|
+
function we(e, t) {
|
|
1976
|
+
var n = e.__data__;
|
|
1977
|
+
return Yr(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
|
|
1938
1978
|
}
|
|
1939
|
-
function
|
|
1940
|
-
var
|
|
1941
|
-
return
|
|
1979
|
+
function $t(e, t) {
|
|
1980
|
+
var n = Cr(e, t);
|
|
1981
|
+
return Qr(n) ? n : void 0;
|
|
1942
1982
|
}
|
|
1943
|
-
function
|
|
1944
|
-
if (
|
|
1983
|
+
function Hr(e, t) {
|
|
1984
|
+
if (Ut(e))
|
|
1945
1985
|
return !1;
|
|
1946
|
-
var
|
|
1947
|
-
return
|
|
1986
|
+
var n = typeof e;
|
|
1987
|
+
return n == "number" || n == "symbol" || n == "boolean" || e == null || Qe(e) ? !0 : yr.test(e) || !pr.test(e) || t != null && e in Object(t);
|
|
1948
1988
|
}
|
|
1949
|
-
function
|
|
1989
|
+
function Yr(e) {
|
|
1950
1990
|
var t = typeof e;
|
|
1951
1991
|
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
|
|
1952
1992
|
}
|
|
1953
|
-
function
|
|
1954
|
-
return !!
|
|
1993
|
+
function Jr(e) {
|
|
1994
|
+
return !!nt && nt in e;
|
|
1955
1995
|
}
|
|
1956
|
-
var
|
|
1957
|
-
e =
|
|
1996
|
+
var Vr = ze(function(e) {
|
|
1997
|
+
e = rs(e);
|
|
1958
1998
|
var t = [];
|
|
1959
|
-
return
|
|
1960
|
-
t.push(s ?
|
|
1999
|
+
return hr.test(e) && t.push(""), e.replace(gr, function(n, r, s, o) {
|
|
2000
|
+
t.push(s ? o.replace(_r, "$1") : r || n);
|
|
1961
2001
|
}), t;
|
|
1962
2002
|
});
|
|
1963
|
-
function
|
|
1964
|
-
if (typeof e == "string" ||
|
|
2003
|
+
function Xr(e) {
|
|
2004
|
+
if (typeof e == "string" || Qe(e))
|
|
1965
2005
|
return e;
|
|
1966
2006
|
var t = e + "";
|
|
1967
2007
|
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
1968
2008
|
}
|
|
1969
|
-
function
|
|
2009
|
+
function Zr(e) {
|
|
1970
2010
|
if (e != null) {
|
|
1971
2011
|
try {
|
|
1972
|
-
return
|
|
2012
|
+
return Mt.call(e);
|
|
1973
2013
|
} catch {
|
|
1974
2014
|
}
|
|
1975
2015
|
try {
|
|
@@ -1979,140 +2019,163 @@ function ts(e) {
|
|
|
1979
2019
|
}
|
|
1980
2020
|
return "";
|
|
1981
2021
|
}
|
|
1982
|
-
function
|
|
2022
|
+
function ze(e, t) {
|
|
1983
2023
|
if (typeof e != "function" || t && typeof t != "function")
|
|
1984
|
-
throw new TypeError(
|
|
1985
|
-
var
|
|
1986
|
-
var
|
|
1987
|
-
if (
|
|
1988
|
-
return
|
|
1989
|
-
var
|
|
1990
|
-
return
|
|
2024
|
+
throw new TypeError(ur);
|
|
2025
|
+
var n = function() {
|
|
2026
|
+
var r = arguments, s = t ? t.apply(this, r) : r[0], o = n.cache;
|
|
2027
|
+
if (o.has(s))
|
|
2028
|
+
return o.get(s);
|
|
2029
|
+
var i = e.apply(this, r);
|
|
2030
|
+
return n.cache = o.set(s, i), i;
|
|
1991
2031
|
};
|
|
1992
|
-
return
|
|
2032
|
+
return n.cache = new (ze.Cache || J)(), n;
|
|
1993
2033
|
}
|
|
1994
|
-
|
|
1995
|
-
function
|
|
2034
|
+
ze.Cache = J;
|
|
2035
|
+
function es(e, t) {
|
|
1996
2036
|
return e === t || e !== e && t !== t;
|
|
1997
2037
|
}
|
|
1998
|
-
var
|
|
1999
|
-
function
|
|
2000
|
-
var t =
|
|
2001
|
-
return t ==
|
|
2038
|
+
var Ut = Array.isArray;
|
|
2039
|
+
function ts(e) {
|
|
2040
|
+
var t = qt(e) ? Lt.call(e) : "";
|
|
2041
|
+
return t == lr || t == dr;
|
|
2002
2042
|
}
|
|
2003
|
-
function
|
|
2043
|
+
function qt(e) {
|
|
2004
2044
|
var t = typeof e;
|
|
2005
2045
|
return !!e && (t == "object" || t == "function");
|
|
2006
2046
|
}
|
|
2007
|
-
function
|
|
2047
|
+
function ns(e) {
|
|
2008
2048
|
return !!e && typeof e == "object";
|
|
2009
2049
|
}
|
|
2010
|
-
function
|
|
2011
|
-
return typeof e == "symbol" ||
|
|
2012
|
-
}
|
|
2013
|
-
function
|
|
2014
|
-
return e == null ? "" :
|
|
2050
|
+
function Qe(e) {
|
|
2051
|
+
return typeof e == "symbol" || ns(e) && Lt.call(e) == fr;
|
|
2052
|
+
}
|
|
2053
|
+
function rs(e) {
|
|
2054
|
+
return e == null ? "" : Wr(e);
|
|
2055
|
+
}
|
|
2056
|
+
function ss(e, t, n) {
|
|
2057
|
+
var r = e == null ? void 0 : zr(e, t);
|
|
2058
|
+
return r === void 0 ? n : r;
|
|
2059
|
+
}
|
|
2060
|
+
var os = ss;
|
|
2061
|
+
const V = /* @__PURE__ */ cr(os);
|
|
2062
|
+
function is(e, t, n) {
|
|
2063
|
+
return Tt(e ?? { result: [], success: !0, totalCount: 0 }, (s) => {
|
|
2064
|
+
for (const o of t)
|
|
2065
|
+
switch (o.type) {
|
|
2066
|
+
case "ADD": {
|
|
2067
|
+
s.result.findIndex(
|
|
2068
|
+
(a) => V(o.payload.data, n) === V(a, n)
|
|
2069
|
+
) === -1 && s.result.push(o.payload.data);
|
|
2070
|
+
break;
|
|
2071
|
+
}
|
|
2072
|
+
case "UPDATE": {
|
|
2073
|
+
const i = s.result.findIndex(
|
|
2074
|
+
(a) => V(o.payload.data, n) === V(a, n)
|
|
2075
|
+
);
|
|
2076
|
+
i !== -1 && (s.result[i] = o.payload.data);
|
|
2077
|
+
break;
|
|
2078
|
+
}
|
|
2079
|
+
case "DELETE": {
|
|
2080
|
+
const i = s.result.findIndex(
|
|
2081
|
+
(a) => V(o.payload.data, n) === V(a, n)
|
|
2082
|
+
);
|
|
2083
|
+
i !== -1 && s.result.splice(i, 1);
|
|
2084
|
+
break;
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
});
|
|
2015
2088
|
}
|
|
2016
|
-
function
|
|
2017
|
-
|
|
2018
|
-
|
|
2089
|
+
function as(e, t, n, r, s, o) {
|
|
2090
|
+
const i = (o == null ? void 0 : o.syncWindowMs) ?? 500, a = $([]), u = $(null), l = $(null), c = $(s);
|
|
2091
|
+
c.current = s;
|
|
2092
|
+
const g = U(() => {
|
|
2093
|
+
const d = a.current;
|
|
2094
|
+
if (a.current = [], u.current = null, l.current = null, !(d.length === 0 || !r)) {
|
|
2095
|
+
e.setQueryData(
|
|
2096
|
+
t,
|
|
2097
|
+
(h) => is(h, d, r)
|
|
2098
|
+
);
|
|
2099
|
+
for (const h of d)
|
|
2100
|
+
(h.type === "ADD" || h.type === "UPDATE") && e.setQueryData(
|
|
2101
|
+
n(h.payload.id, h.payload.namespace),
|
|
2102
|
+
{ result: h.payload.data }
|
|
2103
|
+
);
|
|
2104
|
+
}
|
|
2105
|
+
}, [e, t, n, r]), f = U(
|
|
2106
|
+
(d) => {
|
|
2107
|
+
a.current.push(d), !(u.current !== null || l.current !== null) && (c.current === 1 ? u.current = setTimeout(g, i) : l.current = requestAnimationFrame(g));
|
|
2108
|
+
},
|
|
2109
|
+
[g, i]
|
|
2110
|
+
);
|
|
2111
|
+
return j(() => () => {
|
|
2112
|
+
u.current !== null && (clearTimeout(u.current), u.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
2113
|
+
}, []), f;
|
|
2019
2114
|
}
|
|
2020
|
-
|
|
2021
|
-
const Y = /* @__PURE__ */ ln(as), Bs = ({
|
|
2115
|
+
const Ys = ({
|
|
2022
2116
|
pluginID: e,
|
|
2023
2117
|
connectionID: t,
|
|
2024
|
-
resourceKey:
|
|
2025
|
-
idAccessor:
|
|
2026
|
-
namespaces: s
|
|
2027
|
-
listParams: i = {},
|
|
2028
|
-
createParams: o = {}
|
|
2118
|
+
resourceKey: n,
|
|
2119
|
+
idAccessor: r,
|
|
2120
|
+
namespaces: s
|
|
2029
2121
|
}) => {
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2122
|
+
const o = D(e), i = G(), { showSnackbar: a } = L(), u = S.useMemo(() => s ?? [], [s]), l = S.useMemo(
|
|
2123
|
+
() => [o, t, n, u, "list"],
|
|
2124
|
+
[o, t, n, u]
|
|
2125
|
+
), c = S.useCallback(
|
|
2126
|
+
(m, p) => [o, t, n, p, m],
|
|
2127
|
+
[o, t, n]
|
|
2128
|
+
), { mutateAsync: g } = v({
|
|
2129
|
+
mutationFn: async (m) => ft(o, t, n, A.CreateInput.createFrom({
|
|
2130
|
+
input: m.input,
|
|
2131
|
+
namespace: m.namespace ?? (u.length === 1 ? u[0] : "")
|
|
2035
2132
|
})),
|
|
2036
|
-
onSuccess: async (
|
|
2037
|
-
var C
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2133
|
+
onSuccess: async (m) => {
|
|
2134
|
+
var C;
|
|
2135
|
+
const p = m.result;
|
|
2136
|
+
let E = "";
|
|
2137
|
+
(C = p == null ? void 0 : p.metadata) != null && C.name ? E = p.metadata.name : p != null && p.id ? E = p.id : p != null && p.name ? E = p.name : p != null && p.ID ? E = p.ID : p != null && p.Name && (E = p.Name);
|
|
2138
|
+
const _ = E ? `Resource ${E} created` : "Resource created";
|
|
2139
|
+
a(_, "success"), await i.invalidateQueries({ queryKey: l });
|
|
2042
2140
|
},
|
|
2043
|
-
onError: I(
|
|
2044
|
-
}), f =
|
|
2045
|
-
queryKey:
|
|
2046
|
-
queryFn: async () =>
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
direction: !0
|
|
2051
|
-
},
|
|
2052
|
-
pagination: {
|
|
2053
|
-
page: 1,
|
|
2054
|
-
pageSize: 200
|
|
2055
|
-
},
|
|
2056
|
-
namespaces: s
|
|
2141
|
+
onError: I(a, "Failed to create resource")
|
|
2142
|
+
}), f = P({
|
|
2143
|
+
queryKey: l,
|
|
2144
|
+
queryFn: async () => dt(o, t, n, A.ListInput.createFrom({
|
|
2145
|
+
order: [{ field: "name", descending: !1 }],
|
|
2146
|
+
pagination: { page: 1, pageSize: 200 },
|
|
2147
|
+
namespaces: u
|
|
2057
2148
|
})),
|
|
2058
|
-
placeholderData: (
|
|
2149
|
+
placeholderData: (m, p) => m,
|
|
2059
2150
|
retry: !1
|
|
2060
|
-
}),
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
n && (c.setQueryData(u, (g) => le(g, (E) => {
|
|
2073
|
-
E || (E = T.ListResult.createFrom({
|
|
2074
|
-
result: [],
|
|
2075
|
-
success: !0,
|
|
2076
|
-
pagination: {}
|
|
2077
|
-
}));
|
|
2078
|
-
const C = E.result.findIndex((k) => Y(d.newData, n) === Y(k, n));
|
|
2079
|
-
if (C !== -1) {
|
|
2080
|
-
E.result[C] = d.newData;
|
|
2081
|
-
return;
|
|
2082
|
-
}
|
|
2083
|
-
})), c.setQueryData(y(d.id, d.namespace), { result: d.newData }));
|
|
2084
|
-
}, []), S = _.useCallback((d) => {
|
|
2085
|
-
n && c.setQueryData(u, (g) => le(g, (E) => {
|
|
2086
|
-
if (!E)
|
|
2087
|
-
return;
|
|
2088
|
-
const C = E.result.findIndex((k) => Y(d.data, n) === Y(k, n));
|
|
2089
|
-
if (C !== -1) {
|
|
2090
|
-
E.result.splice(C, 1);
|
|
2091
|
-
return;
|
|
2092
|
-
}
|
|
2093
|
-
}));
|
|
2094
|
-
}, []);
|
|
2095
|
-
_.useEffect(() => {
|
|
2096
|
-
if (!n)
|
|
2151
|
+
}), [d, h] = S.useState(
|
|
2152
|
+
w.IDLE
|
|
2153
|
+
);
|
|
2154
|
+
S.useEffect(() => x(
|
|
2155
|
+
`${o}/${t}/watch/STATE`,
|
|
2156
|
+
(p) => {
|
|
2157
|
+
p.resourceKey === n && h(p.state);
|
|
2158
|
+
}
|
|
2159
|
+
), [o, t, n]);
|
|
2160
|
+
const y = as(i, l, c, r, d);
|
|
2161
|
+
return S.useEffect(() => {
|
|
2162
|
+
if (!r)
|
|
2097
2163
|
return;
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2164
|
+
bn(o, t, n);
|
|
2165
|
+
const m = x(
|
|
2166
|
+
`${o}/${t}/${n}/ADD`,
|
|
2167
|
+
(_) => y({ type: "ADD", payload: _ })
|
|
2168
|
+
), p = x(
|
|
2169
|
+
`${o}/${t}/${n}/UPDATE`,
|
|
2170
|
+
(_) => y({ type: "UPDATE", payload: _ })
|
|
2171
|
+
), E = x(
|
|
2172
|
+
`${o}/${t}/${n}/DELETE`,
|
|
2173
|
+
(_) => y({ type: "DELETE", payload: _ })
|
|
2174
|
+
);
|
|
2103
2175
|
return () => {
|
|
2104
|
-
|
|
2176
|
+
m(), p(), E(), vn(o, t, n);
|
|
2105
2177
|
};
|
|
2106
|
-
}, [
|
|
2107
|
-
const [w, b] = _.useState(
|
|
2108
|
-
x.Pending
|
|
2109
|
-
);
|
|
2110
|
-
return _.useEffect(() => A(
|
|
2111
|
-
`${a}/${t}/informer/STATE`,
|
|
2112
|
-
(g) => {
|
|
2113
|
-
g.resourceKey === r && b(g.state);
|
|
2114
|
-
}
|
|
2115
|
-
), [a, t, r]), {
|
|
2178
|
+
}, [o, t, n, y]), {
|
|
2116
2179
|
/**
|
|
2117
2180
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
2118
2181
|
* when the resources are updated or deleted via the returned create and remove mutation functions, or
|
|
@@ -2125,132 +2188,127 @@ const Y = /* @__PURE__ */ ln(as), Bs = ({
|
|
|
2125
2188
|
*
|
|
2126
2189
|
* @params opts Optional parameters to pass to the resource create operation
|
|
2127
2190
|
*/
|
|
2128
|
-
create:
|
|
2129
|
-
/** Current
|
|
2130
|
-
|
|
2131
|
-
/** Whether the
|
|
2132
|
-
isSyncing:
|
|
2133
|
-
/** Whether the
|
|
2134
|
-
isSynced:
|
|
2135
|
-
/** Whether the
|
|
2136
|
-
|
|
2191
|
+
create: g,
|
|
2192
|
+
/** Current watch state for this resource type */
|
|
2193
|
+
watchState: d,
|
|
2194
|
+
/** Whether the watch is currently syncing */
|
|
2195
|
+
isSyncing: d === w.SYNCING,
|
|
2196
|
+
/** Whether the watch has fully synced */
|
|
2197
|
+
isSynced: d === w.SYNCED,
|
|
2198
|
+
/** Whether the watch encountered an error */
|
|
2199
|
+
watchError: d === w.ERROR
|
|
2137
2200
|
};
|
|
2138
|
-
},
|
|
2139
|
-
const t =
|
|
2140
|
-
mutationFn: async ({ opts:
|
|
2201
|
+
}, Js = ({ pluginID: e }) => {
|
|
2202
|
+
const t = D(e), { showSnackbar: n } = L(), r = v({
|
|
2203
|
+
mutationFn: async ({ opts: i, input: a }) => ft(
|
|
2141
2204
|
t,
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
id: o.resourceID,
|
|
2148
|
-
namespace: o.namespace
|
|
2205
|
+
i.connectionID,
|
|
2206
|
+
i.resourceKey,
|
|
2207
|
+
A.CreateInput.createFrom({
|
|
2208
|
+
input: a.input,
|
|
2209
|
+
namespace: a.namespace ?? i.namespace ?? ""
|
|
2149
2210
|
})
|
|
2150
2211
|
),
|
|
2151
|
-
onSuccess: (
|
|
2152
|
-
|
|
2212
|
+
onSuccess: (i, { opts: a }) => {
|
|
2213
|
+
n(`Resource ${a.resourceID} created`, "success");
|
|
2153
2214
|
},
|
|
2154
|
-
onError(
|
|
2155
|
-
|
|
2215
|
+
onError(i, { opts: a }) {
|
|
2216
|
+
Z(n, i, `Failed to create resource ${a.resourceID}`);
|
|
2156
2217
|
}
|
|
2157
2218
|
}), s = v({
|
|
2158
|
-
mutationFn: async ({ opts:
|
|
2219
|
+
mutationFn: async ({ opts: i, input: a }) => ut(
|
|
2159
2220
|
t,
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
namespace: o.namespace
|
|
2221
|
+
i.connectionID,
|
|
2222
|
+
i.resourceKey,
|
|
2223
|
+
A.UpdateInput.createFrom({
|
|
2224
|
+
input: a.input,
|
|
2225
|
+
id: i.resourceID,
|
|
2226
|
+
namespace: i.namespace ?? ""
|
|
2167
2227
|
})
|
|
2168
2228
|
),
|
|
2169
|
-
onSuccess: (
|
|
2170
|
-
|
|
2229
|
+
onSuccess: (i, { opts: a }) => {
|
|
2230
|
+
n(`Resource ${a.resourceID} updated`, "success");
|
|
2171
2231
|
},
|
|
2172
|
-
onError(
|
|
2173
|
-
|
|
2232
|
+
onError(i, { opts: a }) {
|
|
2233
|
+
Z(n, i, `Failed to update resource ${a.resourceID}`);
|
|
2174
2234
|
}
|
|
2175
|
-
}),
|
|
2176
|
-
mutationFn: async ({ opts:
|
|
2235
|
+
}), o = v({
|
|
2236
|
+
mutationFn: async ({ opts: i, input: a }) => lt(
|
|
2177
2237
|
t,
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
id: o.resourceID,
|
|
2185
|
-
namespace: o.namespace
|
|
2238
|
+
i.connectionID,
|
|
2239
|
+
i.resourceKey,
|
|
2240
|
+
A.DeleteInput.createFrom({
|
|
2241
|
+
id: i.resourceID,
|
|
2242
|
+
namespace: i.namespace ?? "",
|
|
2243
|
+
gracePeriodSeconds: a.gracePeriodSeconds
|
|
2186
2244
|
})
|
|
2187
2245
|
),
|
|
2188
|
-
onSuccess: (
|
|
2189
|
-
|
|
2246
|
+
onSuccess: (i, { opts: a }) => {
|
|
2247
|
+
n(`Resource ${a.resourceID} deleted`, "success");
|
|
2190
2248
|
},
|
|
2191
|
-
onError(
|
|
2192
|
-
|
|
2249
|
+
onError(i, { opts: a }) {
|
|
2250
|
+
Z(n, i, `Failed to delete resource ${a.resourceID}`);
|
|
2193
2251
|
}
|
|
2194
2252
|
});
|
|
2195
2253
|
return {
|
|
2196
|
-
create:
|
|
2254
|
+
create: r.mutateAsync,
|
|
2197
2255
|
update: s.mutateAsync,
|
|
2198
|
-
remove:
|
|
2256
|
+
remove: o.mutateAsync
|
|
2199
2257
|
};
|
|
2200
|
-
},
|
|
2258
|
+
}, Vs = ({
|
|
2201
2259
|
pluginID: e,
|
|
2202
2260
|
connectionID: t,
|
|
2203
|
-
resourceKey:
|
|
2204
|
-
enabled:
|
|
2261
|
+
resourceKey: n,
|
|
2262
|
+
enabled: r = !0
|
|
2205
2263
|
}) => {
|
|
2206
|
-
const s =
|
|
2207
|
-
queryKey: ["RESOURCE_ACTIONS", s, t,
|
|
2208
|
-
queryFn: () =>
|
|
2209
|
-
enabled:
|
|
2264
|
+
const s = D(e), o = P({
|
|
2265
|
+
queryKey: ["RESOURCE_ACTIONS", s, t, n],
|
|
2266
|
+
queryFn: () => Dn(s, t, n),
|
|
2267
|
+
enabled: r && !!s && !!t && !!n,
|
|
2210
2268
|
staleTime: 5 * 60 * 1e3
|
|
2211
2269
|
// actions don't change often
|
|
2212
2270
|
});
|
|
2213
2271
|
return {
|
|
2214
|
-
actions:
|
|
2215
|
-
isLoading:
|
|
2216
|
-
error:
|
|
2272
|
+
actions: o.data ?? [],
|
|
2273
|
+
isLoading: o.isLoading,
|
|
2274
|
+
error: o.error
|
|
2217
2275
|
};
|
|
2218
|
-
},
|
|
2276
|
+
}, Xs = ({
|
|
2219
2277
|
pluginID: e,
|
|
2220
2278
|
connectionID: t,
|
|
2221
|
-
resourceKey:
|
|
2279
|
+
resourceKey: n
|
|
2222
2280
|
}) => {
|
|
2223
|
-
const
|
|
2224
|
-
mutationFn: async ({ actionID: a, id:
|
|
2225
|
-
n,
|
|
2226
|
-
t,
|
|
2281
|
+
const r = D(e), s = G(), { showSnackbar: o } = L(), i = v({
|
|
2282
|
+
mutationFn: async ({ actionID: a, id: u = "", namespace: l = "", params: c = {} }) => Pn(
|
|
2227
2283
|
r,
|
|
2284
|
+
t,
|
|
2285
|
+
n,
|
|
2228
2286
|
a,
|
|
2229
|
-
|
|
2287
|
+
A.ActionInput.createFrom({ id: u, namespace: l, params: c })
|
|
2230
2288
|
),
|
|
2231
2289
|
onSuccess: (a) => {
|
|
2232
|
-
a.message &&
|
|
2233
|
-
queryKey: ["RESOURCES",
|
|
2290
|
+
a.message && o(a.message, "success"), s.invalidateQueries({
|
|
2291
|
+
queryKey: ["RESOURCES", r, t, n]
|
|
2234
2292
|
});
|
|
2235
2293
|
},
|
|
2236
|
-
onError: (a,
|
|
2237
|
-
|
|
2294
|
+
onError: (a, u) => {
|
|
2295
|
+
Z(o, a, `Failed to execute action "${u.actionID}"`);
|
|
2238
2296
|
}
|
|
2239
2297
|
});
|
|
2240
2298
|
return {
|
|
2241
|
-
executeAction:
|
|
2242
|
-
isExecuting:
|
|
2243
|
-
error:
|
|
2299
|
+
executeAction: i.mutateAsync,
|
|
2300
|
+
isExecuting: i.isPending,
|
|
2301
|
+
error: i.error
|
|
2244
2302
|
};
|
|
2245
|
-
},
|
|
2303
|
+
}, Zs = ({
|
|
2246
2304
|
pluginID: e,
|
|
2247
2305
|
connectionID: t,
|
|
2248
|
-
enabled:
|
|
2306
|
+
enabled: n = !0
|
|
2249
2307
|
}) => {
|
|
2250
|
-
const
|
|
2251
|
-
queryKey: ["EDITOR_SCHEMAS",
|
|
2252
|
-
queryFn: () =>
|
|
2253
|
-
enabled:
|
|
2308
|
+
const r = D(e), s = P({
|
|
2309
|
+
queryKey: ["EDITOR_SCHEMAS", r, t],
|
|
2310
|
+
queryFn: () => Rn(r, t),
|
|
2311
|
+
enabled: n && !!r && !!t,
|
|
2254
2312
|
staleTime: 10 * 60 * 1e3,
|
|
2255
2313
|
// schemas are fairly stable per connection
|
|
2256
2314
|
retry: 1
|
|
@@ -2261,181 +2319,222 @@ const Y = /* @__PURE__ */ ln(as), Bs = ({
|
|
|
2261
2319
|
error: s.error,
|
|
2262
2320
|
refetch: s.refetch
|
|
2263
2321
|
};
|
|
2264
|
-
},
|
|
2322
|
+
}, eo = ({
|
|
2265
2323
|
pluginID: e,
|
|
2266
2324
|
connectionID: t,
|
|
2267
|
-
enabled:
|
|
2325
|
+
enabled: n = !0
|
|
2268
2326
|
}) => {
|
|
2269
|
-
const
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2327
|
+
const r = D(e), s = G(), o = [r, t, "watch-state"], i = $([]), a = $(!1), u = U((f) => {
|
|
2328
|
+
s.setQueryData(o, (d) => d && Tt(d, (h) => {
|
|
2329
|
+
h.resources[f.resourceKey] = f.state, h.resourceCounts[f.resourceKey] = f.resourceCount;
|
|
2330
|
+
let y = 0, m = 0;
|
|
2331
|
+
for (const p of Object.values(h.resources))
|
|
2332
|
+
p === w.SYNCED && y++, (p === w.ERROR || p === w.FAILED) && m++;
|
|
2333
|
+
h.syncedCount = y, h.errorCount = m;
|
|
2334
|
+
}));
|
|
2335
|
+
}, [s, r, t]), l = P({
|
|
2336
|
+
queryKey: o,
|
|
2337
|
+
queryFn: async () => {
|
|
2338
|
+
const f = await In(r, t), d = {};
|
|
2339
|
+
let h = 0, y = 0;
|
|
2340
|
+
for (const [p, E] of Object.entries(f.resources ?? {}))
|
|
2341
|
+
d[p] = E, E === w.SYNCED && h++, E === w.ERROR && y++;
|
|
2342
|
+
const m = {};
|
|
2343
|
+
for (const [p, E] of Object.entries(f.resourceCounts ?? {}))
|
|
2344
|
+
m[p] = E;
|
|
2345
|
+
return {
|
|
2346
|
+
connection: f.connectionId,
|
|
2347
|
+
resources: d,
|
|
2348
|
+
resourceCounts: m,
|
|
2349
|
+
totalResources: Object.keys(d).length,
|
|
2350
|
+
syncedCount: h,
|
|
2351
|
+
errorCount: y
|
|
2352
|
+
};
|
|
2353
|
+
},
|
|
2354
|
+
enabled: n && !!r && !!t,
|
|
2355
|
+
refetchInterval: (f) => {
|
|
2356
|
+
const d = f.state.data;
|
|
2357
|
+
if (!d || d.totalResources === 0) return 3e3;
|
|
2358
|
+
let h = 0;
|
|
2359
|
+
for (const y of Object.values(d.resources))
|
|
2360
|
+
(y === w.SYNCED || y === w.ERROR || y === w.STOPPED || y === w.FAILED || y === w.FORBIDDEN || y === w.SKIPPED) && h++;
|
|
2361
|
+
return h >= d.totalResources ? !1 : 3e3;
|
|
2284
2362
|
}
|
|
2285
|
-
)
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2363
|
+
});
|
|
2364
|
+
j(() => {
|
|
2365
|
+
if (!l.data || a.current) return;
|
|
2366
|
+
a.current = !0;
|
|
2367
|
+
const f = i.current;
|
|
2368
|
+
i.current = [];
|
|
2369
|
+
for (const d of f)
|
|
2370
|
+
u(d);
|
|
2371
|
+
}, [l.data, u]), j(() => {
|
|
2372
|
+
if (!n || !r || !t)
|
|
2373
|
+
return;
|
|
2374
|
+
a.current = !1, i.current = [];
|
|
2375
|
+
const f = x(
|
|
2376
|
+
`${r}/${t}/watch/STATE`,
|
|
2377
|
+
(d) => {
|
|
2378
|
+
a.current ? u(d) : i.current.push(d);
|
|
2379
|
+
}
|
|
2380
|
+
);
|
|
2381
|
+
return () => {
|
|
2382
|
+
f(), a.current = !1, i.current = [];
|
|
2383
|
+
};
|
|
2384
|
+
}, [r, t, n, u]);
|
|
2385
|
+
const c = l.data;
|
|
2386
|
+
let g = 0;
|
|
2387
|
+
if (c != null && c.resources)
|
|
2388
|
+
for (const f of Object.values(c.resources))
|
|
2389
|
+
(f === w.SYNCED || f === w.ERROR || f === w.STOPPED || f === w.FAILED || f === w.FORBIDDEN || f === w.SKIPPED) && g++;
|
|
2291
2390
|
return {
|
|
2292
2391
|
/** Full summary query result */
|
|
2293
|
-
summary:
|
|
2294
|
-
/** Get the state of a specific resource type's
|
|
2295
|
-
getResourceState: (
|
|
2296
|
-
/** Whether all registered
|
|
2297
|
-
isFullySynced:
|
|
2392
|
+
summary: l,
|
|
2393
|
+
/** Get the state of a specific resource type's watch */
|
|
2394
|
+
getResourceState: (f) => c == null ? void 0 : c.resources[f],
|
|
2395
|
+
/** Whether all registered watches have reached a terminal state */
|
|
2396
|
+
isFullySynced: c ? c.totalResources > 0 && g === c.totalResources : !1,
|
|
2298
2397
|
/** Sync progress as a 0-1 fraction (terminal states / total) */
|
|
2299
|
-
syncProgress:
|
|
2300
|
-
/** Number of
|
|
2301
|
-
errorCount: (
|
|
2398
|
+
syncProgress: c && c.totalResources > 0 ? g / c.totalResources : 0,
|
|
2399
|
+
/** Number of watches that encountered errors */
|
|
2400
|
+
errorCount: (c == null ? void 0 : c.errorCount) ?? 0
|
|
2302
2401
|
};
|
|
2303
|
-
},
|
|
2304
|
-
const [e, t] = q(/* @__PURE__ */ new Map()),
|
|
2305
|
-
const
|
|
2306
|
-
if (t((
|
|
2307
|
-
const
|
|
2308
|
-
return
|
|
2309
|
-
}),
|
|
2310
|
-
const
|
|
2311
|
-
t((
|
|
2312
|
-
const
|
|
2313
|
-
return
|
|
2314
|
-
}),
|
|
2402
|
+
}, to = () => {
|
|
2403
|
+
const [e, t] = q(/* @__PURE__ */ new Map()), n = $(/* @__PURE__ */ new Map()), r = $(/* @__PURE__ */ new Map()), s = U((l) => {
|
|
2404
|
+
const c = Ue(l), g = Dt(n.current, l), f = Oe(g);
|
|
2405
|
+
if (t((d) => {
|
|
2406
|
+
const h = new Map(d);
|
|
2407
|
+
return h.set(c, f), h;
|
|
2408
|
+
}), r.current.has(c) && (clearTimeout(r.current.get(c)), r.current.delete(c)), de(f)) {
|
|
2409
|
+
const d = setTimeout(() => {
|
|
2410
|
+
t((h) => {
|
|
2411
|
+
const y = new Map(h);
|
|
2412
|
+
return y.delete(c), y;
|
|
2413
|
+
}), n.current.delete(c), r.current.delete(c);
|
|
2315
2414
|
}, 5e3);
|
|
2316
|
-
|
|
2415
|
+
r.current.set(c, d);
|
|
2317
2416
|
}
|
|
2318
2417
|
}, []);
|
|
2319
|
-
|
|
2320
|
-
const l =
|
|
2418
|
+
j(() => {
|
|
2419
|
+
const l = x("watch/STATE", s);
|
|
2321
2420
|
return () => {
|
|
2322
2421
|
l();
|
|
2323
|
-
for (const
|
|
2324
|
-
clearTimeout(
|
|
2422
|
+
for (const c of r.current.values())
|
|
2423
|
+
clearTimeout(c);
|
|
2325
2424
|
};
|
|
2326
2425
|
}, [s]);
|
|
2327
|
-
const
|
|
2426
|
+
const o = Array.from(e.values()), i = bt(o), a = o.find((l) => !de(l)) ?? o[0] ?? null, u = vt(o);
|
|
2328
2427
|
return {
|
|
2329
2428
|
/** All tracked syncs */
|
|
2330
|
-
syncs:
|
|
2429
|
+
syncs: o,
|
|
2331
2430
|
/** Whether any connection is actively syncing */
|
|
2332
|
-
hasSyncing:
|
|
2431
|
+
hasSyncing: i,
|
|
2333
2432
|
/** The primary (first incomplete) sync or most recent */
|
|
2334
2433
|
primarySync: a,
|
|
2335
2434
|
/** Aggregate progress across all connections (0-1) */
|
|
2336
|
-
aggregateProgress:
|
|
2435
|
+
aggregateProgress: u
|
|
2337
2436
|
};
|
|
2338
2437
|
}, cs = () => {
|
|
2339
|
-
const e =
|
|
2438
|
+
const e = S.useContext(_t);
|
|
2340
2439
|
if (!e) throw new Error("useOperations must be used within an OperationsProvider");
|
|
2341
2440
|
return e;
|
|
2342
|
-
},
|
|
2441
|
+
}, no = ({
|
|
2343
2442
|
pluginID: e,
|
|
2344
2443
|
connectionID: t,
|
|
2345
|
-
resourceKey:
|
|
2444
|
+
resourceKey: n
|
|
2346
2445
|
}) => {
|
|
2347
|
-
const
|
|
2348
|
-
return
|
|
2446
|
+
const r = D(e), { showSnackbar: s } = L(), { addOperation: o, updateOperation: i } = cs(), a = S.useRef([]);
|
|
2447
|
+
return S.useEffect(() => () => {
|
|
2349
2448
|
a.current.forEach((l) => l());
|
|
2350
|
-
}, []), { startStreamAction:
|
|
2351
|
-
async ({ actionID: l, id:
|
|
2449
|
+
}, []), { startStreamAction: S.useCallback(
|
|
2450
|
+
async ({ actionID: l, id: c, namespace: g, label: f, params: d = {} }) => {
|
|
2352
2451
|
try {
|
|
2353
|
-
const
|
|
2354
|
-
n,
|
|
2355
|
-
t,
|
|
2452
|
+
const h = await Fn(
|
|
2356
2453
|
r,
|
|
2454
|
+
t,
|
|
2455
|
+
n,
|
|
2357
2456
|
l,
|
|
2358
|
-
|
|
2457
|
+
A.ActionInput.createFrom({ id: c, namespace: g, params: d })
|
|
2359
2458
|
);
|
|
2360
|
-
|
|
2361
|
-
id:
|
|
2362
|
-
label:
|
|
2363
|
-
resourceKey:
|
|
2364
|
-
resourceName:
|
|
2365
|
-
namespace:
|
|
2459
|
+
o({
|
|
2460
|
+
id: h,
|
|
2461
|
+
label: f,
|
|
2462
|
+
resourceKey: n,
|
|
2463
|
+
resourceName: c,
|
|
2464
|
+
namespace: g,
|
|
2366
2465
|
connectionID: t,
|
|
2367
2466
|
status: "running",
|
|
2368
2467
|
startedAt: Date.now()
|
|
2369
2468
|
});
|
|
2370
|
-
const
|
|
2371
|
-
var
|
|
2372
|
-
switch (
|
|
2469
|
+
const y = `action/stream/${h}`, m = x(y, (p) => {
|
|
2470
|
+
var E, _, C, F;
|
|
2471
|
+
switch (p.type) {
|
|
2373
2472
|
case "progress": {
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2376
|
-
message:
|
|
2377
|
-
progress:
|
|
2473
|
+
const b = p.data ?? {};
|
|
2474
|
+
i(h, {
|
|
2475
|
+
message: b.message,
|
|
2476
|
+
progress: b.ready !== void 0 && b.desired !== void 0 ? { ready: b.ready, desired: b.desired } : void 0
|
|
2378
2477
|
});
|
|
2379
2478
|
break;
|
|
2380
2479
|
}
|
|
2381
2480
|
case "complete":
|
|
2382
|
-
|
|
2481
|
+
i(h, {
|
|
2383
2482
|
status: "completed",
|
|
2384
|
-
message: ((
|
|
2483
|
+
message: ((E = p.data) == null ? void 0 : E.message) ?? "Completed",
|
|
2385
2484
|
completedAt: Date.now()
|
|
2386
|
-
}), s(((
|
|
2485
|
+
}), s(((_ = p.data) == null ? void 0 : _.message) ?? f + " completed", "success"), be(y);
|
|
2387
2486
|
break;
|
|
2388
2487
|
case "error":
|
|
2389
|
-
|
|
2488
|
+
i(h, {
|
|
2390
2489
|
status: "error",
|
|
2391
|
-
message: ((
|
|
2490
|
+
message: ((C = p.data) == null ? void 0 : C.message) ?? "Failed",
|
|
2392
2491
|
completedAt: Date.now()
|
|
2393
|
-
}), s(((
|
|
2492
|
+
}), s(((F = p.data) == null ? void 0 : F.message) ?? f + " failed", "error"), be(y);
|
|
2394
2493
|
break;
|
|
2395
2494
|
}
|
|
2396
2495
|
});
|
|
2397
2496
|
return a.current.push(() => {
|
|
2398
|
-
|
|
2399
|
-
}),
|
|
2400
|
-
} catch (
|
|
2401
|
-
throw
|
|
2497
|
+
m(), be(y);
|
|
2498
|
+
}), h;
|
|
2499
|
+
} catch (h) {
|
|
2500
|
+
throw Z(s, h, `Failed to start "${l}"`), h;
|
|
2402
2501
|
}
|
|
2403
2502
|
},
|
|
2404
|
-
[
|
|
2503
|
+
[r, t, n, o, i, s]
|
|
2405
2504
|
) };
|
|
2406
2505
|
}, ro = () => {
|
|
2407
|
-
const e =
|
|
2506
|
+
const e = S.useContext(mt);
|
|
2408
2507
|
if (!e)
|
|
2409
2508
|
throw new Error("useSettings must be used within a SettingsProvider");
|
|
2410
2509
|
return e;
|
|
2411
|
-
},
|
|
2412
|
-
const {
|
|
2413
|
-
|
|
2414
|
-
const s = `/_plugin/${
|
|
2415
|
-
return
|
|
2510
|
+
}, so = ({ to: e, withinContext: t, ...n }) => {
|
|
2511
|
+
const { pluginId: r } = $e();
|
|
2512
|
+
r || console.error("Link used outside of a plugin context");
|
|
2513
|
+
const s = `/_plugin/${r}${e.startsWith("/") ? "" : "/"}${e}`;
|
|
2514
|
+
return S.useMemo(() => /* @__PURE__ */ R(zt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
|
|
2416
2515
|
};
|
|
2417
|
-
function
|
|
2418
|
-
const e =
|
|
2419
|
-
|
|
2420
|
-
const
|
|
2421
|
-
const { ...
|
|
2422
|
-
|
|
2423
|
-
};
|
|
2424
|
-
return
|
|
2516
|
+
function oo() {
|
|
2517
|
+
const e = Qt(), t = Wt(), { pluginId: n } = $e();
|
|
2518
|
+
n || console.error("usePluginRouter used outside of a plugin context");
|
|
2519
|
+
const r = `/_plugin/${n}`, s = t.pathname.startsWith(r) ? t.pathname.slice(r.length) || "/" : t.pathname, o = U((i, a) => {
|
|
2520
|
+
const { ...u } = a ?? {};
|
|
2521
|
+
i.startsWith("/") ? e(`${r}${i}`, u) : e(i, u);
|
|
2522
|
+
}, [e, r]);
|
|
2523
|
+
return Kt(() => ({
|
|
2425
2524
|
location: t,
|
|
2426
|
-
navigate:
|
|
2525
|
+
navigate: o,
|
|
2427
2526
|
pluginPath: s
|
|
2428
|
-
}), [t
|
|
2429
|
-
}
|
|
2430
|
-
class oo {
|
|
2527
|
+
}), [t, o, s]);
|
|
2431
2528
|
}
|
|
2432
2529
|
class io {
|
|
2530
|
+
}
|
|
2531
|
+
class ao {
|
|
2433
2532
|
constructor() {
|
|
2434
|
-
|
|
2533
|
+
k(this, "_extensions");
|
|
2435
2534
|
/**
|
|
2436
2535
|
* The root component to render for the application window.
|
|
2437
2536
|
*/
|
|
2438
|
-
|
|
2537
|
+
k(this, "root");
|
|
2439
2538
|
/**
|
|
2440
2539
|
* Various pages to render under the root component. These can be navigated to using
|
|
2441
2540
|
* the built-in navigation system both programatically and through Links.
|
|
@@ -2465,8 +2564,8 @@ class io {
|
|
|
2465
2564
|
* ```
|
|
2466
2565
|
*
|
|
2467
2566
|
*/
|
|
2468
|
-
|
|
2469
|
-
|
|
2567
|
+
k(this, "pages");
|
|
2568
|
+
k(this, "_routes");
|
|
2470
2569
|
}
|
|
2471
2570
|
get extensions() {
|
|
2472
2571
|
return this._extensions || [];
|
|
@@ -2488,9 +2587,9 @@ class io {
|
|
|
2488
2587
|
*/
|
|
2489
2588
|
get Window() {
|
|
2490
2589
|
if (!this._routes && this.root)
|
|
2491
|
-
return /* @__PURE__ */
|
|
2492
|
-
const t =
|
|
2493
|
-
return /* @__PURE__ */
|
|
2590
|
+
return /* @__PURE__ */ R(this.root, {});
|
|
2591
|
+
const t = Bt(this._routes || []);
|
|
2592
|
+
return /* @__PURE__ */ R(Ht, { router: t });
|
|
2494
2593
|
}
|
|
2495
2594
|
/**
|
|
2496
2595
|
* Register extension points for other plugins to extend the functionality
|
|
@@ -2513,83 +2612,95 @@ class io {
|
|
|
2513
2612
|
/**
|
|
2514
2613
|
* Adds a page to the plugin window. This page will be displayed under:
|
|
2515
2614
|
*/
|
|
2516
|
-
withPage(t,
|
|
2615
|
+
withPage(t, n) {
|
|
2517
2616
|
return this.pages || (this.pages = {}), this.pages[t] ? (console.warn(
|
|
2518
2617
|
"Cannot register page with the same name. Please use a different name."
|
|
2519
|
-
), this) : (this.pages[t] =
|
|
2618
|
+
), this) : (this.pages[t] = n, this);
|
|
2520
2619
|
}
|
|
2521
2620
|
withRoutes(t) {
|
|
2522
2621
|
return this._routes = t, this;
|
|
2523
2622
|
}
|
|
2524
2623
|
}
|
|
2525
2624
|
var us = /* @__PURE__ */ ((e) => (e.MISSING_MANIFEST = "MISSING_MANIFEST", e.MISSING_PLUGIN = "MISSING_PLUGIN", e.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", e))(us || {});
|
|
2625
|
+
const co = (e) => {
|
|
2626
|
+
const t = e.split("::");
|
|
2627
|
+
return t.length === 1 ? { group: "core", version: "", kind: t[0] } : {
|
|
2628
|
+
group: t[0] || "core",
|
|
2629
|
+
version: t[1] || "",
|
|
2630
|
+
kind: t[2] || t[0]
|
|
2631
|
+
};
|
|
2632
|
+
}, uo = (e) => !e || e === "core" ? "Core" : e.charAt(0).toUpperCase() + e.slice(1);
|
|
2526
2633
|
export {
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
Es as
|
|
2539
|
-
$e as PluginContext,
|
|
2540
|
-
ws as PluginContextProvider,
|
|
2634
|
+
X as ALL_SESSIONS_KEY,
|
|
2635
|
+
Ln as BottomDrawerContext,
|
|
2636
|
+
Un as ConfirmationModalContext,
|
|
2637
|
+
M as ErrorTypes,
|
|
2638
|
+
Ps as ExtensionPointRegistry,
|
|
2639
|
+
Qn as ExtensionPointStore,
|
|
2640
|
+
Ds as ExtensionProvider,
|
|
2641
|
+
so as Link,
|
|
2642
|
+
_t as OperationsContext,
|
|
2643
|
+
Cs as OperationsProvider,
|
|
2644
|
+
Le as PluginContext,
|
|
2645
|
+
Es as PluginContextProvider,
|
|
2541
2646
|
us as PluginErrorCode,
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2647
|
+
ao as PluginWindow,
|
|
2648
|
+
io as PluginWindowRootProps,
|
|
2649
|
+
$n as RightDrawerContext,
|
|
2650
|
+
mt as SettingsContext,
|
|
2651
|
+
ws as SettingsProvider,
|
|
2652
|
+
Rs as SnackbarProvider,
|
|
2653
|
+
xs as SyncPolicy,
|
|
2654
|
+
w as WatchState,
|
|
2655
|
+
kn as actionToSnackbar,
|
|
2656
|
+
is as applyBatch,
|
|
2657
|
+
Bn as connectionListQueryKey,
|
|
2550
2658
|
I as createErrorHandler,
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2659
|
+
Mn as defaultState,
|
|
2660
|
+
uo as formatGroup,
|
|
2661
|
+
ht as isCancelledError,
|
|
2662
|
+
K as parseAppError,
|
|
2663
|
+
co as parseResourceKey,
|
|
2664
|
+
Z as showAppError,
|
|
2665
|
+
to as useActiveSyncs,
|
|
2666
|
+
Pt as useBottomDrawer,
|
|
2667
|
+
Gs as useConfirmationModal,
|
|
2668
|
+
Is as useConnection,
|
|
2559
2669
|
Os as useConnectionNamespaces,
|
|
2560
2670
|
As as useConnectionStatus,
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2671
|
+
Fs as useConnections,
|
|
2672
|
+
Zs as useEditorSchemas,
|
|
2673
|
+
as as useEventBatcher,
|
|
2674
|
+
ks as useExec,
|
|
2675
|
+
Xs as useExecuteAction,
|
|
2565
2676
|
bs as useExtensionPoint,
|
|
2566
2677
|
vs as useExtensionPointComponents,
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
Ls as useMetricStream,
|
|
2678
|
+
wt as useExtensionRegistry,
|
|
2679
|
+
Ms as useLogs,
|
|
2680
|
+
Ls as useMetricProviders,
|
|
2681
|
+
Jn as useMetricProvidersForResource,
|
|
2682
|
+
Us as useMetricStream,
|
|
2573
2683
|
cs as useOperations,
|
|
2574
|
-
|
|
2684
|
+
$e as usePluginContext,
|
|
2575
2685
|
Ts as usePluginData,
|
|
2576
|
-
|
|
2686
|
+
oo as usePluginRouter,
|
|
2577
2687
|
Ss as usePluginSettings,
|
|
2578
2688
|
qs as usePortForwardSessions,
|
|
2579
|
-
|
|
2689
|
+
D as useResolvedPluginId,
|
|
2580
2690
|
Ks as useResource,
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2691
|
+
Vs as useResourceActions,
|
|
2692
|
+
zs as useResourceAreaComponent,
|
|
2693
|
+
Qs as useResourceGroups,
|
|
2584
2694
|
$s as useResourceMetrics,
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2695
|
+
Js as useResourceMutations,
|
|
2696
|
+
js as useResourcePortForwarder,
|
|
2697
|
+
Ws as useResourceSearch,
|
|
2698
|
+
Bs as useResourceType,
|
|
2589
2699
|
Hs as useResourceTypes,
|
|
2590
|
-
|
|
2700
|
+
Ys as useResources,
|
|
2591
2701
|
Ns as useRightDrawer,
|
|
2592
2702
|
ro as useSettings,
|
|
2593
|
-
|
|
2594
|
-
|
|
2703
|
+
L as useSnackbar,
|
|
2704
|
+
no as useStreamAction,
|
|
2705
|
+
eo as useWatchState
|
|
2595
2706
|
};
|