@omniviewdev/runtime 0.4.2 → 0.5.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/api.cjs +1 -1
- package/dist/api.js +246 -113
- package/dist/bindings/events/index.d.ts +140 -0
- package/dist/bindings/github.com/omniviewdev/omniview/appservice.d.ts +5 -0
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/devserver/index.d.ts +1 -1
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/devserver/models.d.ts +24 -26
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/devserver/servicewrapper.d.ts +0 -1
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/servicewrapper.d.ts +2 -0
- package/dist/bindings/github.com/omniviewdev/omniview/internal/devcontract/index.d.ts +1 -0
- package/dist/bindings/github.com/omniviewdev/omniview/internal/devcontract/models.d.ts +101 -0
- package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/config/index.d.ts +1 -1
- package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/config/models.d.ts +31 -0
- package/dist/errors/types.d.ts +2 -0
- package/dist/graphservice-Cb7rr7SB.cjs +1 -0
- package/dist/graphservice-DloOtC_7.js +739 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +566 -539
- package/dist/models-8-4Ny_ft.cjs +1 -0
- package/dist/{models-3V1aa9YT.js → models-BlTzZkmp.js} +46 -60
- package/dist/models-CGYstu7u.cjs +1 -0
- package/dist/{models-B97zjrHu.js → models-D-vu7j83.js} +442 -411
- package/dist/models.cjs +1 -1
- package/dist/models.d.ts +1 -1
- package/dist/models.js +39 -38
- package/package.json +5 -5
- package/dist/graphservice-2kgAuCnt.cjs +0 -1
- package/dist/graphservice-5kuEPkCT.js +0 -731
- package/dist/models-BPmIMpct.cjs +0 -1
- package/dist/models-sJV1iQbd.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var at = Object.defineProperty;
|
|
2
2
|
var ct = (t, e, n) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var
|
|
3
|
+
var D = (t, e, n) => ct(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
import { jsx as x, jsxs as X } from "react/jsx-runtime";
|
|
5
|
-
import
|
|
6
|
-
import { Link as dt, useNavigate as ft, useLocation as pt, createMemoryRouter as
|
|
7
|
-
import { P as ht, G as mt, V as St, S as _t, a as Pe, U as Et, R as wt, b as Ct, c as Oe, d as bt, L as vt, e as Rt, f as Ft, g as It, h as Pt, i as Ot, j as Tt, C as At, k as xt, l as Dt, m as Nt, n as kt, Q as Lt, o as Mt, p as Ce, q as $t, r as Te, F as qt, s as Ut, t as Ae, D as xe, u as Wt, v as Gt, w as jt, x as De, y as Qt, z as Kt, A as Ne, B as Ht, E as Bt, H as zt, I as Yt, J as Jt, K as Zt, M as Xt, N as Vt, O as en, T as tn } from "./graphservice-5kuEPkCT.js";
|
|
8
|
-
import { P as nn, W as rn, S as sn, C as on, L as an, F as cn, a as un, U as ke, D as Le, G as ln, b as Me, c as $e, A as qe } from "./models-B97zjrHu.js";
|
|
9
|
-
import { useQueryClient as j, useMutation as T, useQuery as O, keepPreviousData as Ue, useQueries as dn } from "@tanstack/react-query";
|
|
10
|
-
import { useToast as fn } from "@omniviewdev/base-ui";
|
|
5
|
+
import w, { useContext as Y, createContext as re, useState as G, useRef as q, useCallback as k, useSyncExternalStore as ut, useEffect as $, useMemo as lt } from "react";
|
|
6
|
+
import { Link as dt, useNavigate as ft, useLocation as pt, createMemoryRouter as gt, RouterProvider as yt } from "react-router-dom";
|
|
11
7
|
import "./index-D2mKAO8s.js";
|
|
12
|
-
import {
|
|
8
|
+
import { P as ht, G as mt, V as St, S as _t, a as Pe, U as Et, R as wt, b as Ct, c as Oe, d as bt, L as vt, e as Rt, f as Ft, g as It, h as Pt, i as Ot, j as Tt, C as At, k as Dt, l as xt, m as Nt, n as kt, Q as Lt, o as Mt, p as Ce, q as qt, r as Te, F as Ut, s as $t, t as Ae, D as De, u as Wt, v as Gt, w as jt, x as xe, y as Qt, z as Kt, A as Ne, B as Ht, E as Bt, H as zt, I as Yt, J as Jt, K as Zt, M as Xt, N as Vt, O as en, T as tn } from "./graphservice-DloOtC_7.js";
|
|
9
|
+
import { P as nn, W as rn, S as sn, C as on, L as an, F as cn, a as un, U as ke, D as Le, G as ln, b as Me, c as qe, A as Ue } from "./models-D-vu7j83.js";
|
|
10
|
+
import { O, a as $e, b as ae } from "./events-DDTGFACO.js";
|
|
11
|
+
import { useQueryClient as j, useMutation as A, useQuery as T, keepPreviousData as We, useQueries as dn } from "@tanstack/react-query";
|
|
12
|
+
import { useToast as fn } from "@omniviewdev/base-ui";
|
|
13
13
|
import { w as pn } from "./legacyEnum-DORXlU_y.js";
|
|
14
|
-
const
|
|
14
|
+
const ge = w.createContext(void 0), U = {
|
|
15
15
|
// Plugin
|
|
16
16
|
PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
|
|
17
17
|
PLUGIN_NOT_LOADED: "omniview:plugin/not-loaded",
|
|
@@ -19,6 +19,8 @@ const ye = b.createContext(void 0), $ = {
|
|
|
19
19
|
PLUGIN_INSTALL_FAILED: "omniview:plugin/install-failed",
|
|
20
20
|
PLUGIN_LOAD_FAILED: "omniview:plugin/load-failed",
|
|
21
21
|
PLUGIN_BUILD_FAILED: "omniview:plugin/build-failed",
|
|
22
|
+
PLUGIN_COMMITTED_CLEANUP_PENDING: "omniview:plugin/committed-cleanup-pending",
|
|
23
|
+
PLUGIN_COMMIT_UNCERTAIN: "omniview:plugin/commit-uncertain",
|
|
22
24
|
// Settings
|
|
23
25
|
SETTINGS_MISSING_CONFIG: "omniview:settings/missing-config",
|
|
24
26
|
SETTINGS_INVALID_CONFIG: "omniview:settings/invalid-config",
|
|
@@ -42,31 +44,31 @@ const ye = b.createContext(void 0), $ = {
|
|
|
42
44
|
VALIDATION: "omniview:validation",
|
|
43
45
|
NOT_IMPLEMENTED: "omniview:not-implemented"
|
|
44
46
|
};
|
|
45
|
-
function
|
|
47
|
+
function gn(t) {
|
|
46
48
|
switch (t) {
|
|
47
49
|
case "NOT_FOUND":
|
|
48
|
-
return { typeUri:
|
|
50
|
+
return { typeUri: U.RESOURCE_NOT_FOUND, status: 404 };
|
|
49
51
|
case "FORBIDDEN":
|
|
50
|
-
return { typeUri:
|
|
52
|
+
return { typeUri: U.RESOURCE_FORBIDDEN, status: 403 };
|
|
51
53
|
case "UNAUTHORIZED":
|
|
52
|
-
return { typeUri:
|
|
54
|
+
return { typeUri: U.RESOURCE_UNAUTHORIZED, status: 401 };
|
|
53
55
|
case "CONFLICT":
|
|
54
56
|
case "ALREADY_EXISTS":
|
|
55
|
-
return { typeUri:
|
|
57
|
+
return { typeUri: U.RESOURCE_CONFLICT, status: 409 };
|
|
56
58
|
case "TIMEOUT":
|
|
57
|
-
return { typeUri:
|
|
59
|
+
return { typeUri: U.RESOURCE_TIMEOUT, status: 408 };
|
|
58
60
|
case "CONNECTION_ERROR":
|
|
59
|
-
return { typeUri:
|
|
61
|
+
return { typeUri: U.RESOURCE_CONNECTION_ERROR, status: 503 };
|
|
60
62
|
case "CERTIFICATE_ERROR":
|
|
61
|
-
return { typeUri:
|
|
63
|
+
return { typeUri: U.RESOURCE_CERTIFICATE_ERROR, status: 502 };
|
|
62
64
|
default:
|
|
63
|
-
return { typeUri:
|
|
65
|
+
return { typeUri: U.INTERNAL, status: 500 };
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
function Q(t) {
|
|
67
69
|
if (t == null)
|
|
68
70
|
return {
|
|
69
|
-
type:
|
|
71
|
+
type: U.INTERNAL,
|
|
70
72
|
title: "Unknown error",
|
|
71
73
|
status: 500,
|
|
72
74
|
detail: "An unknown error occurred."
|
|
@@ -78,7 +80,7 @@ function Q(t) {
|
|
|
78
80
|
if (typeof n.type == "string" && typeof n.title == "string" && typeof n.status == "number" && typeof n.detail == "string")
|
|
79
81
|
return n;
|
|
80
82
|
if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
|
|
81
|
-
const { typeUri: r, status: s } =
|
|
83
|
+
const { typeUri: r, status: s } = gn(n.code);
|
|
82
84
|
return {
|
|
83
85
|
type: r,
|
|
84
86
|
title: n.title,
|
|
@@ -90,16 +92,16 @@ function Q(t) {
|
|
|
90
92
|
} catch {
|
|
91
93
|
}
|
|
92
94
|
return {
|
|
93
|
-
type:
|
|
95
|
+
type: U.INTERNAL,
|
|
94
96
|
title: "Error",
|
|
95
97
|
status: 500,
|
|
96
98
|
detail: e
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
101
|
function Ge(t) {
|
|
100
|
-
return t == null ? !1 : (typeof t == "string" ? t : t instanceof Error ? t.message : String(t)) === "cancelled" ? !0 : Q(t).type ===
|
|
102
|
+
return t == null ? !1 : (typeof t == "string" ? t : t instanceof Error ? t.message : String(t)) === "cancelled" ? !0 : Q(t).type === U.CANCELLED;
|
|
101
103
|
}
|
|
102
|
-
function
|
|
104
|
+
function yn(t) {
|
|
103
105
|
switch (t.type) {
|
|
104
106
|
case "navigate":
|
|
105
107
|
return {
|
|
@@ -147,7 +149,7 @@ function je(t, e) {
|
|
|
147
149
|
message: e || (t.title !== "Error" ? t.title : "Operation failed"),
|
|
148
150
|
status: "error",
|
|
149
151
|
details: n,
|
|
150
|
-
actions: (i = t.actions) == null ? void 0 : i.map(
|
|
152
|
+
actions: (i = t.actions) == null ? void 0 : i.map(yn)
|
|
151
153
|
};
|
|
152
154
|
}
|
|
153
155
|
function z(t, e, n) {
|
|
@@ -155,7 +157,7 @@ function z(t, e, n) {
|
|
|
155
157
|
const r = Q(e);
|
|
156
158
|
t(je(r, n));
|
|
157
159
|
}
|
|
158
|
-
function
|
|
160
|
+
function L(t, e) {
|
|
159
161
|
return (n) => {
|
|
160
162
|
if (Ge(n)) return;
|
|
161
163
|
const r = Q(n);
|
|
@@ -163,30 +165,51 @@ function k(t, e) {
|
|
|
163
165
|
};
|
|
164
166
|
}
|
|
165
167
|
function zr(t) {
|
|
166
|
-
const { children: e, pluginId: n } = t, [r, s] =
|
|
168
|
+
const { children: e, pluginId: n } = t, [r, s] = w.useState({}), [i, o] = w.useState(new nn()), [a, c] = w.useState(!1), [l, u] = w.useState(null), f = w.useRef(0), d = w.useRef(0);
|
|
167
169
|
console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!l });
|
|
168
|
-
const p = () => {
|
|
169
|
-
n === void 0 || n === ""
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
const p = w.useCallback(() => {
|
|
171
|
+
if (n === void 0 || n === "")
|
|
172
|
+
return;
|
|
173
|
+
const S = ++f.current;
|
|
174
|
+
console.debug(`[PluginContextProvider] fetching settings for "${n}"`), ht(n).then((m) => {
|
|
175
|
+
S === f.current && (console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(m)), s(m));
|
|
176
|
+
}).catch((m) => {
|
|
177
|
+
if (S !== f.current) return;
|
|
178
|
+
const y = Q(m);
|
|
173
179
|
console.error(`[PluginContextProvider] error fetching settings for "${n}":`, y.detail);
|
|
174
|
-
})
|
|
175
|
-
},
|
|
180
|
+
});
|
|
181
|
+
}, [n]), g = w.useCallback(() => {
|
|
176
182
|
if (n === void 0 || n === "") {
|
|
177
183
|
console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
|
|
178
184
|
return;
|
|
179
185
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
const S = ++d.current;
|
|
187
|
+
console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), mt(n).then((m) => {
|
|
188
|
+
S === d.current && (console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: m == null ? void 0 : m.name, version: m == null ? void 0 : m.version }), o(m), c(!0));
|
|
189
|
+
}).catch((m) => {
|
|
190
|
+
if (S !== d.current) return;
|
|
191
|
+
const y = Q(m);
|
|
184
192
|
console.error(`[PluginContextProvider] error fetching meta for "${n}":`, y.detail), u(y.detail), c(!1);
|
|
185
193
|
});
|
|
186
|
-
};
|
|
187
|
-
return
|
|
188
|
-
|
|
189
|
-
|
|
194
|
+
}, [n]);
|
|
195
|
+
return w.useEffect(() => {
|
|
196
|
+
if (a) return;
|
|
197
|
+
const S = () => {
|
|
198
|
+
p(), g();
|
|
199
|
+
}, m = [
|
|
200
|
+
O("plugin/init_complete", S),
|
|
201
|
+
O("plugin/dev_install_complete", (y) => {
|
|
202
|
+
var _;
|
|
203
|
+
((_ = y.data) == null ? void 0 : _.id) === n && S();
|
|
204
|
+
}),
|
|
205
|
+
O("plugin/inventory_changed", S)
|
|
206
|
+
];
|
|
207
|
+
return () => {
|
|
208
|
+
for (const y of m) y();
|
|
209
|
+
};
|
|
210
|
+
}, [n, a, p, g]), w.useEffect(() => (console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), c(!1), u(null), s({}), p(), g(), () => {
|
|
211
|
+
++f.current, ++d.current;
|
|
212
|
+
}), [n, p, g]), l ? /* @__PURE__ */ x("div", { style: {
|
|
190
213
|
display: "flex",
|
|
191
214
|
flex: 1,
|
|
192
215
|
alignItems: "center",
|
|
@@ -213,7 +236,7 @@ function zr(t) {
|
|
|
213
236
|
/* @__PURE__ */ x(
|
|
214
237
|
"button",
|
|
215
238
|
{
|
|
216
|
-
onClick: () =>
|
|
239
|
+
onClick: () => g(),
|
|
217
240
|
style: {
|
|
218
241
|
background: "transparent",
|
|
219
242
|
color: "#F87171",
|
|
@@ -227,7 +250,7 @@ function zr(t) {
|
|
|
227
250
|
children: "Retry"
|
|
228
251
|
}
|
|
229
252
|
)
|
|
230
|
-
] }) }) : a ? /* @__PURE__ */ x(
|
|
253
|
+
] }) }) : a ? /* @__PURE__ */ x(ge.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ X("div", { style: {
|
|
231
254
|
display: "flex",
|
|
232
255
|
flex: 1,
|
|
233
256
|
alignItems: "center",
|
|
@@ -244,30 +267,34 @@ function zr(t) {
|
|
|
244
267
|
/* @__PURE__ */ x("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
|
|
245
268
|
] });
|
|
246
269
|
}
|
|
247
|
-
function
|
|
248
|
-
const t = Y(
|
|
270
|
+
function ye() {
|
|
271
|
+
const t = Y(ge);
|
|
249
272
|
if (!t)
|
|
250
273
|
throw new Error("usePluginContext must be used within a PluginContextProvider");
|
|
251
274
|
return t;
|
|
252
275
|
}
|
|
253
276
|
function Yr() {
|
|
254
|
-
return
|
|
277
|
+
return ye().settings;
|
|
255
278
|
}
|
|
256
279
|
const Qe = re(void 0), Jr = ({ children: t }) => {
|
|
257
|
-
const [e, n] = G({}), r = () => {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
280
|
+
const [e, n] = G({}), r = q(0), s = k(() => {
|
|
281
|
+
const o = r.current + 1;
|
|
282
|
+
r.current = o, St().then((a) => {
|
|
283
|
+
o === r.current && n(a);
|
|
284
|
+
}).catch((a) => {
|
|
285
|
+
o === r.current && console.error("Error fetching settings:", a);
|
|
262
286
|
});
|
|
263
|
-
};
|
|
264
|
-
b.useEffect(() => {
|
|
265
|
-
r();
|
|
266
287
|
}, []);
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
288
|
+
w.useEffect(() => {
|
|
289
|
+
const o = O("settings/changed", () => s());
|
|
290
|
+
return s(), () => {
|
|
291
|
+
r.current += 1, o();
|
|
292
|
+
};
|
|
293
|
+
}, [s]);
|
|
294
|
+
const i = k(() => {
|
|
295
|
+
s();
|
|
296
|
+
}, [s]);
|
|
297
|
+
return /* @__PURE__ */ x(Qe.Provider, { value: { settings: e, reload: i }, children: t });
|
|
271
298
|
}, hn = {
|
|
272
299
|
height: 32,
|
|
273
300
|
focused: 0,
|
|
@@ -292,17 +319,17 @@ const Qe = re(void 0), Jr = ({ children: t }) => {
|
|
|
292
319
|
},
|
|
293
320
|
fullscreenDrawer: () => {
|
|
294
321
|
}
|
|
295
|
-
}, mn =
|
|
296
|
-
const [e, n] =
|
|
322
|
+
}, mn = w.createContext(hn), Sn = re(void 0), _n = w.createContext(void 0), Ke = w.createContext(void 0), En = 3e4, Zr = ({ children: t }) => {
|
|
323
|
+
const [e, n] = w.useState([]), r = w.useCallback((a) => {
|
|
297
324
|
n((c) => [a, ...c]);
|
|
298
|
-
}, []), s =
|
|
325
|
+
}, []), s = w.useCallback((a, c) => {
|
|
299
326
|
n(
|
|
300
327
|
(l) => l.map((u) => u.id === a ? { ...u, ...c } : u)
|
|
301
328
|
);
|
|
302
|
-
}, []), i =
|
|
329
|
+
}, []), i = w.useCallback((a) => {
|
|
303
330
|
n((c) => c.filter((l) => l.id !== a));
|
|
304
331
|
}, []);
|
|
305
|
-
|
|
332
|
+
w.useEffect(() => {
|
|
306
333
|
const a = [];
|
|
307
334
|
for (const c of e)
|
|
308
335
|
if (c.status === "completed" || c.status === "error") {
|
|
@@ -311,7 +338,7 @@ const Qe = re(void 0), Jr = ({ children: t }) => {
|
|
|
311
338
|
}
|
|
312
339
|
return () => a.forEach(clearTimeout);
|
|
313
340
|
}, [e, i]);
|
|
314
|
-
const o =
|
|
341
|
+
const o = w.useMemo(
|
|
315
342
|
() => ({ operations: e, addOperation: r, updateOperation: s, removeOperation: i }),
|
|
316
343
|
[e, r, s, i]
|
|
317
344
|
);
|
|
@@ -365,7 +392,7 @@ function V(t) {
|
|
|
365
392
|
})(fe || (fe = {}));
|
|
366
393
|
const Be = re(void 0), Rn = () => Y(Be);
|
|
367
394
|
function Xr(t) {
|
|
368
|
-
const e = Rn(), n =
|
|
395
|
+
const e = Rn(), n = w.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = k(
|
|
369
396
|
(o) => {
|
|
370
397
|
const a = [];
|
|
371
398
|
return e && a.push(e.subscribe(o)), r && a.push(r.subscribe(o)), () => {
|
|
@@ -374,7 +401,7 @@ function Xr(t) {
|
|
|
374
401
|
};
|
|
375
402
|
},
|
|
376
403
|
[e, t, r]
|
|
377
|
-
), i =
|
|
404
|
+
), i = k(() => {
|
|
378
405
|
const o = e == null ? void 0 : e.getExtensionPoint(t);
|
|
379
406
|
if (!o) {
|
|
380
407
|
if (n.current && n.current.store === void 0)
|
|
@@ -391,7 +418,7 @@ function Xr(t) {
|
|
|
391
418
|
return ut(s, i), e == null ? void 0 : e.getExtensionPoint(t);
|
|
392
419
|
}
|
|
393
420
|
const Vr = ({ registry: t, children: e }) => {
|
|
394
|
-
const n =
|
|
421
|
+
const n = w.useRef(t);
|
|
395
422
|
return fe(
|
|
396
423
|
n.current === t,
|
|
397
424
|
"You can't change the extension registry after it has been rendered"
|
|
@@ -403,15 +430,15 @@ const Vr = ({ registry: t, children: e }) => {
|
|
|
403
430
|
};
|
|
404
431
|
class Fn {
|
|
405
432
|
constructor(e) {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
433
|
+
D(this, "id");
|
|
434
|
+
D(this, "mode");
|
|
435
|
+
D(this, "_pluginId");
|
|
436
|
+
D(this, "_version", 0);
|
|
437
|
+
D(this, "_contributions", /* @__PURE__ */ new Map());
|
|
438
|
+
D(this, "_lookupCache", /* @__PURE__ */ new Map());
|
|
439
|
+
D(this, "_matcher");
|
|
440
|
+
D(this, "_select");
|
|
441
|
+
D(this, "_listeners", /* @__PURE__ */ new Set());
|
|
415
442
|
this.id = e.id, this.mode = e.mode ?? "multiple", this._pluginId = e.pluginId, this._matcher = e.matcher, this._select = e.select;
|
|
416
443
|
}
|
|
417
444
|
get pluginId() {
|
|
@@ -523,9 +550,9 @@ class Fn {
|
|
|
523
550
|
}
|
|
524
551
|
class es {
|
|
525
552
|
constructor(e) {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
553
|
+
D(this, "_stores", /* @__PURE__ */ new Map());
|
|
554
|
+
D(this, "_storeUnsubs", /* @__PURE__ */ new Map());
|
|
555
|
+
D(this, "_listeners", /* @__PURE__ */ new Set());
|
|
529
556
|
if (e != null && e.initialStores)
|
|
530
557
|
for (const n of e.initialStores)
|
|
531
558
|
this.addExtensionPoint(n);
|
|
@@ -604,25 +631,25 @@ const ze = re(void 0), In = {
|
|
|
604
631
|
warning: "warning",
|
|
605
632
|
error: "danger"
|
|
606
633
|
}, ts = ({ children: t }) => {
|
|
607
|
-
const { toast: e } = fn(), [n, r] =
|
|
634
|
+
const { toast: e } = fn(), [n, r] = w.useState([]), s = (o) => {
|
|
608
635
|
r((a) => [...a, o]);
|
|
609
636
|
}, i = (o, a, c) => {
|
|
610
637
|
const l = typeof o == "object";
|
|
611
|
-
let u = "",
|
|
638
|
+
let u = "", f = "info", d, p = 5e3, g;
|
|
612
639
|
if (l) {
|
|
613
640
|
if (u = o.message, o.showOnce) {
|
|
614
641
|
if (n.includes(u))
|
|
615
642
|
return;
|
|
616
643
|
s(u);
|
|
617
644
|
}
|
|
618
|
-
|
|
645
|
+
f = o.status, d = o.details, p = o.autoHideDuration ?? 5e3, g = o.actions;
|
|
619
646
|
} else
|
|
620
|
-
u = o,
|
|
621
|
-
e(
|
|
622
|
-
severity: In[
|
|
623
|
-
title:
|
|
624
|
-
duration:
|
|
625
|
-
action:
|
|
647
|
+
u = o, f = a, d = c;
|
|
648
|
+
e(d ?? u, {
|
|
649
|
+
severity: In[f] ?? "info",
|
|
650
|
+
title: d ? u : void 0,
|
|
651
|
+
duration: p,
|
|
652
|
+
action: g == null ? void 0 : g[0]
|
|
626
653
|
});
|
|
627
654
|
};
|
|
628
655
|
return /* @__PURE__ */ x(ze.Provider, { value: { showSnackbar: i }, children: t });
|
|
@@ -633,7 +660,7 @@ const ze = re(void 0), In = {
|
|
|
633
660
|
return t;
|
|
634
661
|
};
|
|
635
662
|
function P(t) {
|
|
636
|
-
const e = Y(
|
|
663
|
+
const e = Y(ge), n = (e == null ? void 0 : e.pluginId) ?? t;
|
|
637
664
|
if (!n)
|
|
638
665
|
throw new Error(
|
|
639
666
|
"pluginID must be provided either via PluginContext or as an explicit parameter"
|
|
@@ -641,44 +668,44 @@ function P(t) {
|
|
|
641
668
|
return n;
|
|
642
669
|
}
|
|
643
670
|
const ns = ({ pluginID: t, connectionID: e }) => {
|
|
644
|
-
const n = P(t), r = j(), { showSnackbar: s } = W(), i = [n, "connection", "detail", e], { mutateAsync: o } =
|
|
671
|
+
const n = P(t), r = j(), { showSnackbar: s } = W(), i = [n, "connection", "detail", e], { mutateAsync: o } = A({
|
|
645
672
|
mutationFn: async () => _t(n, e),
|
|
646
|
-
onSuccess(
|
|
647
|
-
r.setQueryData(i,
|
|
673
|
+
onSuccess(f) {
|
|
674
|
+
r.setQueryData(i, f), r.invalidateQueries({
|
|
648
675
|
queryKey: ["EDITOR_SCHEMAS", n, e]
|
|
649
676
|
});
|
|
650
677
|
},
|
|
651
|
-
onError:
|
|
652
|
-
}), { mutateAsync: a } =
|
|
678
|
+
onError: L(s, "Failed to start connection")
|
|
679
|
+
}), { mutateAsync: a } = A({
|
|
653
680
|
mutationFn: async () => Pe(n, e),
|
|
654
|
-
onSuccess(
|
|
655
|
-
r.setQueryData(i,
|
|
681
|
+
onSuccess(f) {
|
|
682
|
+
r.setQueryData(i, f);
|
|
656
683
|
},
|
|
657
|
-
onError:
|
|
658
|
-
}), { mutateAsync: c } =
|
|
659
|
-
mutationFn: async (
|
|
660
|
-
onSuccess(
|
|
661
|
-
s({ message: `Connection ${
|
|
684
|
+
onError: L(s, "Failed to stop connection")
|
|
685
|
+
}), { mutateAsync: c } = A({
|
|
686
|
+
mutationFn: async (f) => Et(n, f),
|
|
687
|
+
onSuccess(f, { name: d }) {
|
|
688
|
+
s({ message: `Connection ${d} successfully updated`, status: "success" }), r.setQueryData(i, f), r.setQueriesData(
|
|
662
689
|
{ queryKey: [n, "connection", "list"] },
|
|
663
|
-
(
|
|
690
|
+
(p) => p == null ? void 0 : p.map((g) => g.id === e ? f : g)
|
|
664
691
|
);
|
|
665
692
|
},
|
|
666
|
-
onError:
|
|
667
|
-
}), { mutateAsync: l } =
|
|
693
|
+
onError: L(s, "Failed to update connection")
|
|
694
|
+
}), { mutateAsync: l } = A({
|
|
668
695
|
mutationFn: async () => wt(n, e),
|
|
669
696
|
onSuccess() {
|
|
670
697
|
s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(i, void 0), r.setQueriesData(
|
|
671
698
|
{ queryKey: [n, "connection", "list"] },
|
|
672
|
-
(
|
|
699
|
+
(f) => f == null ? void 0 : f.filter((d) => d.id !== e)
|
|
673
700
|
);
|
|
674
701
|
},
|
|
675
|
-
onError:
|
|
702
|
+
onError: L(s, "Failed to remove connection")
|
|
676
703
|
});
|
|
677
704
|
return {
|
|
678
705
|
/**
|
|
679
706
|
* Get the connection
|
|
680
707
|
*/
|
|
681
|
-
connection:
|
|
708
|
+
connection: T({
|
|
682
709
|
queryKey: i,
|
|
683
710
|
queryFn: async () => Ct(n, e)
|
|
684
711
|
}),
|
|
@@ -700,34 +727,34 @@ const ns = ({ pluginID: t, connectionID: e }) => {
|
|
|
700
727
|
deleteConnection: l
|
|
701
728
|
};
|
|
702
729
|
}, Pn = (t) => [t, "connection", "list"], rs = ({ plugin: t }) => {
|
|
703
|
-
const e = P(t), n = j(), { showSnackbar: r } = W(), s = Pn(e), { mutateAsync: i } =
|
|
730
|
+
const e = P(t), n = j(), { showSnackbar: r } = W(), s = Pn(e), { mutateAsync: i } = A({
|
|
704
731
|
mutationFn: async (l) => Oe(e, l.id),
|
|
705
|
-
onError:
|
|
706
|
-
}), { mutateAsync: o } =
|
|
732
|
+
onError: L(r, "Failed to start connection watch")
|
|
733
|
+
}), { mutateAsync: o } = A({
|
|
707
734
|
mutationFn: async (l) => bt(e, l.id),
|
|
708
|
-
onError:
|
|
709
|
-
}), a =
|
|
735
|
+
onError: L(r, "Failed to stop connection watch")
|
|
736
|
+
}), a = w.useCallback((l) => {
|
|
710
737
|
const u = l.data;
|
|
711
738
|
console.log("got update to connections", u), n.setQueryData(s, u);
|
|
712
739
|
}, [n, s]);
|
|
713
|
-
return
|
|
714
|
-
const l =
|
|
740
|
+
return w.useEffect(() => {
|
|
741
|
+
const l = O(`${e}/connection/sync`, a);
|
|
715
742
|
return () => {
|
|
716
743
|
l();
|
|
717
744
|
};
|
|
718
745
|
}, [e, a]), {
|
|
719
|
-
connections:
|
|
746
|
+
connections: T({
|
|
720
747
|
queryKey: s,
|
|
721
748
|
queryFn: async () => {
|
|
722
749
|
try {
|
|
723
750
|
return await vt(e);
|
|
724
751
|
} catch (l) {
|
|
725
|
-
console.log(l),
|
|
752
|
+
console.log(l), L(r, "Failed to load connections")(l);
|
|
726
753
|
}
|
|
727
754
|
return [];
|
|
728
755
|
},
|
|
729
756
|
staleTime: 3e4,
|
|
730
|
-
placeholderData:
|
|
757
|
+
placeholderData: We
|
|
731
758
|
}),
|
|
732
759
|
startWatch: i,
|
|
733
760
|
stopWatch: o
|
|
@@ -738,7 +765,7 @@ const ns = ({ pluginID: t, connectionID: e }) => {
|
|
|
738
765
|
/**
|
|
739
766
|
* Get the connection
|
|
740
767
|
*/
|
|
741
|
-
namespaces:
|
|
768
|
+
namespaces: T({
|
|
742
769
|
queryKey: [n, "connection", "namespaces", e],
|
|
743
770
|
queryFn: async () => Rt(n, e)
|
|
744
771
|
})
|
|
@@ -790,143 +817,143 @@ function Ze(t, e) {
|
|
|
790
817
|
}
|
|
791
818
|
function os() {
|
|
792
819
|
const [t, e] = G(/* @__PURE__ */ new Set()), [n, r] = G({}), [s, i] = G(/* @__PURE__ */ new Map()), o = q(/* @__PURE__ */ new Map()), [a, c] = G(/* @__PURE__ */ new Map());
|
|
793
|
-
|
|
794
|
-
const
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
const I = new Map(
|
|
798
|
-
return I.set(
|
|
820
|
+
$(() => {
|
|
821
|
+
const h = O("plugin/crash_recovery_failed", (R) => {
|
|
822
|
+
const C = R.data, E = C == null ? void 0 : C.pluginID;
|
|
823
|
+
E && c((b) => {
|
|
824
|
+
const I = new Map(b);
|
|
825
|
+
return I.set(E, C.error ?? "Crash recovery failed"), I;
|
|
799
826
|
});
|
|
800
|
-
}), v =
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
if (!
|
|
804
|
-
const I = new Map(
|
|
805
|
-
return I.delete(
|
|
827
|
+
}), v = O("plugin/recovered", (R) => {
|
|
828
|
+
const C = R.data, E = C == null ? void 0 : C.pluginID;
|
|
829
|
+
E && c((b) => {
|
|
830
|
+
if (!b.has(E)) return b;
|
|
831
|
+
const I = new Map(b);
|
|
832
|
+
return I.delete(E), I;
|
|
806
833
|
});
|
|
807
834
|
});
|
|
808
835
|
return () => {
|
|
809
|
-
|
|
836
|
+
h(), v();
|
|
810
837
|
};
|
|
811
|
-
}, []),
|
|
812
|
-
Ft().then((
|
|
813
|
-
if (!
|
|
814
|
-
const v = {}, R = /* @__PURE__ */ new Set(),
|
|
815
|
-
for (const [
|
|
816
|
-
if (
|
|
817
|
-
v[
|
|
818
|
-
for (const I of
|
|
838
|
+
}, []), $(() => {
|
|
839
|
+
Ft().then((h) => {
|
|
840
|
+
if (!h) return;
|
|
841
|
+
const v = {}, R = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Map();
|
|
842
|
+
for (const [E, b] of Object.entries(h))
|
|
843
|
+
if (b) {
|
|
844
|
+
v[E] = b.map((I) => I.connection);
|
|
845
|
+
for (const I of b) {
|
|
819
846
|
if (!I.started) continue;
|
|
820
|
-
const M = `${
|
|
847
|
+
const M = `${E}/${I.connection.id}`;
|
|
821
848
|
R.add(M);
|
|
822
849
|
const N = {
|
|
823
|
-
pluginID:
|
|
850
|
+
pluginID: E,
|
|
824
851
|
connectionID: I.connection.id,
|
|
825
852
|
states: {}
|
|
826
853
|
};
|
|
827
854
|
if (I.resources)
|
|
828
855
|
for (const [ie, it] of Object.entries(I.resources))
|
|
829
856
|
N.states[ie] = it;
|
|
830
|
-
o.current.set(M, N),
|
|
857
|
+
o.current.set(M, N), C.set(M, pe(N));
|
|
831
858
|
}
|
|
832
859
|
}
|
|
833
|
-
r(v), e(R), i(
|
|
860
|
+
r(v), e(R), i(C);
|
|
834
861
|
}).catch(() => {
|
|
835
862
|
});
|
|
836
|
-
}, []),
|
|
837
|
-
const R = v.data,
|
|
838
|
-
R.status === "DISCONNECTED" ? (e((
|
|
839
|
-
const
|
|
840
|
-
return
|
|
841
|
-
}), i((
|
|
842
|
-
const
|
|
843
|
-
return
|
|
844
|
-
}), o.current.delete(
|
|
845
|
-
const
|
|
846
|
-
return
|
|
847
|
-
}), Pt().then((
|
|
848
|
-
if (!
|
|
849
|
-
const
|
|
850
|
-
for (const [I, M] of Object.entries(
|
|
851
|
-
M != null && (
|
|
852
|
-
r(
|
|
863
|
+
}, []), $(() => O("connection/status", (v) => {
|
|
864
|
+
const R = v.data, C = `${R.pluginID}/${R.connectionID}`;
|
|
865
|
+
R.status === "DISCONNECTED" ? (e((E) => {
|
|
866
|
+
const b = new Set(E);
|
|
867
|
+
return b.delete(C), b;
|
|
868
|
+
}), i((E) => {
|
|
869
|
+
const b = new Map(E);
|
|
870
|
+
return b.delete(C), b;
|
|
871
|
+
}), o.current.delete(C)) : e((E) => {
|
|
872
|
+
const b = new Set(E);
|
|
873
|
+
return b.add(C), b;
|
|
874
|
+
}), Pt().then((E) => {
|
|
875
|
+
if (!E) return;
|
|
876
|
+
const b = {};
|
|
877
|
+
for (const [I, M] of Object.entries(E))
|
|
878
|
+
M != null && (b[I] = M);
|
|
879
|
+
r(b);
|
|
853
880
|
}).catch(() => {
|
|
854
881
|
});
|
|
855
882
|
}), []);
|
|
856
|
-
const l =
|
|
857
|
-
const v =
|
|
858
|
-
e((
|
|
859
|
-
if (
|
|
860
|
-
const I = new Set(
|
|
883
|
+
const l = k((h) => {
|
|
884
|
+
const v = h.data, R = he(v);
|
|
885
|
+
e((b) => {
|
|
886
|
+
if (b.has(R)) return b;
|
|
887
|
+
const I = new Set(b);
|
|
861
888
|
return I.add(R), I;
|
|
862
889
|
});
|
|
863
|
-
const
|
|
864
|
-
i((
|
|
865
|
-
const I = new Map(
|
|
866
|
-
return I.set(R,
|
|
890
|
+
const C = Ze(o.current, v), E = pe(C);
|
|
891
|
+
i((b) => {
|
|
892
|
+
const I = new Map(b);
|
|
893
|
+
return I.set(R, E), I;
|
|
867
894
|
});
|
|
868
895
|
}, []);
|
|
869
|
-
|
|
870
|
-
const u =
|
|
871
|
-
await Pe(
|
|
872
|
-
}, []),
|
|
873
|
-
await Oe(
|
|
874
|
-
}, []),
|
|
875
|
-
const v = a.get(
|
|
896
|
+
$(() => O("watch/STATE", l), [l]);
|
|
897
|
+
const u = k(async (h, v) => {
|
|
898
|
+
await Pe(h, v);
|
|
899
|
+
}, []), f = k(async (h, v) => {
|
|
900
|
+
await Oe(h, v);
|
|
901
|
+
}, []), d = k(async (h) => {
|
|
902
|
+
const v = a.get(h);
|
|
876
903
|
c((R) => {
|
|
877
|
-
if (!R.has(
|
|
878
|
-
const
|
|
879
|
-
return
|
|
904
|
+
if (!R.has(h)) return R;
|
|
905
|
+
const C = new Map(R);
|
|
906
|
+
return C.delete(h), C;
|
|
880
907
|
});
|
|
881
908
|
try {
|
|
882
|
-
await It(
|
|
909
|
+
await It(h);
|
|
883
910
|
} catch (R) {
|
|
884
|
-
throw c((
|
|
885
|
-
const
|
|
886
|
-
return
|
|
911
|
+
throw c((C) => {
|
|
912
|
+
const E = new Map(C);
|
|
913
|
+
return E.set(h, v ?? "Reload failed"), E;
|
|
887
914
|
}), R;
|
|
888
915
|
}
|
|
889
|
-
}, [a]),
|
|
890
|
-
for (const
|
|
891
|
-
const [v, R] =
|
|
892
|
-
|
|
916
|
+
}, [a]), p = [];
|
|
917
|
+
for (const h of t) {
|
|
918
|
+
const [v, R] = h.split("/", 2), E = (n[v] ?? []).find((ie) => ie.id === R), b = s.get(h), I = b != null && !ne(b), M = b != null && b.errorCount > 0, N = a.get(v);
|
|
919
|
+
p.push({
|
|
893
920
|
pluginID: v,
|
|
894
921
|
connectionID: R,
|
|
895
|
-
name: (
|
|
896
|
-
avatar: (
|
|
922
|
+
name: (E == null ? void 0 : E.name) ?? R,
|
|
923
|
+
avatar: (E == null ? void 0 : E.avatar) ?? "",
|
|
897
924
|
isStarted: !0,
|
|
898
|
-
sync:
|
|
925
|
+
sync: b,
|
|
899
926
|
isSyncing: I,
|
|
900
927
|
hasErrors: M || N != null,
|
|
901
928
|
pluginFailed: N != null,
|
|
902
929
|
pluginError: N
|
|
903
930
|
});
|
|
904
931
|
}
|
|
905
|
-
const
|
|
906
|
-
for (const
|
|
907
|
-
const v =
|
|
908
|
-
v.push(
|
|
932
|
+
const g = /* @__PURE__ */ new Map();
|
|
933
|
+
for (const h of p) {
|
|
934
|
+
const v = g.get(h.pluginID) ?? [];
|
|
935
|
+
v.push(h), g.set(h.pluginID, v);
|
|
909
936
|
}
|
|
910
|
-
const
|
|
937
|
+
const S = Array.from(s.values()), m = p.filter((h) => h.isSyncing), y = p.filter((h) => h.hasErrors), _ = p.filter((h) => h.pluginFailed);
|
|
911
938
|
return {
|
|
912
|
-
entries:
|
|
913
|
-
grouped:
|
|
914
|
-
connectedCount:
|
|
915
|
-
syncingCount:
|
|
916
|
-
errorCount:
|
|
917
|
-
failedCount:
|
|
918
|
-
hasSyncing: Ye(
|
|
919
|
-
aggregateProgress: Je(
|
|
939
|
+
entries: p,
|
|
940
|
+
grouped: g,
|
|
941
|
+
connectedCount: p.length,
|
|
942
|
+
syncingCount: m.length,
|
|
943
|
+
errorCount: y.length,
|
|
944
|
+
failedCount: _.length,
|
|
945
|
+
hasSyncing: Ye(S),
|
|
946
|
+
aggregateProgress: Je(S),
|
|
920
947
|
disconnect: u,
|
|
921
|
-
retryWatch:
|
|
922
|
-
retryPlugin:
|
|
948
|
+
retryWatch: f,
|
|
949
|
+
retryPlugin: d
|
|
923
950
|
};
|
|
924
951
|
}
|
|
925
952
|
function On(t, e) {
|
|
926
953
|
return e === null ? t === null : Array.isArray(e) ? Array.isArray(t) : typeof e == "object" ? typeof t == "object" && t !== null && !Array.isArray(t) : typeof t == typeof e;
|
|
927
954
|
}
|
|
928
955
|
function is(t, e, n) {
|
|
929
|
-
const r = P(t), s = j(), i = [r, "data", e], o =
|
|
956
|
+
const r = P(t), s = j(), i = [r, "data", e], o = T({
|
|
930
957
|
queryKey: i,
|
|
931
958
|
queryFn: async () => {
|
|
932
959
|
const c = await Ot(r, e);
|
|
@@ -934,7 +961,7 @@ function is(t, e, n) {
|
|
|
934
961
|
`[usePluginData] stored value for "${e}" has unexpected type (expected ${Array.isArray(n) ? "array" : typeof n}, got ${Array.isArray(c) ? "array" : typeof c}). Using default.`
|
|
935
962
|
), n);
|
|
936
963
|
}
|
|
937
|
-
}), a =
|
|
964
|
+
}), a = A({
|
|
938
965
|
mutationFn: async (c) => {
|
|
939
966
|
await Tt(r, e, c);
|
|
940
967
|
},
|
|
@@ -970,7 +997,7 @@ const as = () => {
|
|
|
970
997
|
}, cs = ({ pluginID: t }) => {
|
|
971
998
|
const e = P(t), { showSnackbar: n } = W(), { createTab: r, updateTab: s } = Xe();
|
|
972
999
|
return {
|
|
973
|
-
createSession:
|
|
1000
|
+
createSession: A({
|
|
974
1001
|
mutationFn: async ({ connectionID: o, icon: a, label: c, opts: l }) => {
|
|
975
1002
|
const u = `pending-${crypto.randomUUID()}`;
|
|
976
1003
|
r({
|
|
@@ -985,94 +1012,94 @@ const as = () => {
|
|
|
985
1012
|
opts: { ...l }
|
|
986
1013
|
}
|
|
987
1014
|
});
|
|
988
|
-
const
|
|
1015
|
+
const f = sn.createFrom({
|
|
989
1016
|
command: ["/bin/bash"],
|
|
990
1017
|
tty: !0,
|
|
991
1018
|
...l
|
|
992
1019
|
});
|
|
993
1020
|
try {
|
|
994
|
-
const
|
|
995
|
-
if (!
|
|
1021
|
+
const d = await At(e, o, f);
|
|
1022
|
+
if (!d) throw new Error("Failed to create session: null response");
|
|
996
1023
|
s(
|
|
997
1024
|
{ id: u },
|
|
998
1025
|
{
|
|
999
|
-
id:
|
|
1000
|
-
title: c ?? `Session ${
|
|
1026
|
+
id: d.id,
|
|
1027
|
+
title: c ?? `Session ${d.id.substring(0, 8)}`,
|
|
1001
1028
|
properties: { status: "connected", pluginID: e, connectionID: o, opts: { ...l } }
|
|
1002
1029
|
}
|
|
1003
1030
|
);
|
|
1004
|
-
} catch (
|
|
1005
|
-
const
|
|
1031
|
+
} catch (d) {
|
|
1032
|
+
const p = Q(d);
|
|
1006
1033
|
s(
|
|
1007
1034
|
{ id: u },
|
|
1008
1035
|
{
|
|
1009
|
-
properties: { status: "error", error:
|
|
1036
|
+
properties: { status: "error", error: p.detail, pluginID: e, connectionID: o, opts: { ...l } }
|
|
1010
1037
|
}
|
|
1011
|
-
), z(n,
|
|
1038
|
+
), z(n, d, "Failed to start session");
|
|
1012
1039
|
}
|
|
1013
1040
|
}
|
|
1014
1041
|
}).mutateAsync
|
|
1015
1042
|
};
|
|
1016
1043
|
}, us = ({ pluginID: t }) => {
|
|
1017
|
-
const e = P(t), { showSnackbar: n } = W(), { createTab: r } = Xe(), s =
|
|
1044
|
+
const e = P(t), { showSnackbar: n } = W(), { createTab: r } = Xe(), s = A({
|
|
1018
1045
|
mutationFn: async ({
|
|
1019
1046
|
connectionID: o,
|
|
1020
1047
|
resourceKey: a,
|
|
1021
1048
|
resourceID: c,
|
|
1022
1049
|
resourceData: l,
|
|
1023
1050
|
icon: u,
|
|
1024
|
-
label:
|
|
1025
|
-
target:
|
|
1026
|
-
follow:
|
|
1027
|
-
tailLines:
|
|
1028
|
-
params:
|
|
1051
|
+
label: f,
|
|
1052
|
+
target: d,
|
|
1053
|
+
follow: p = !0,
|
|
1054
|
+
tailLines: g = 1e3,
|
|
1055
|
+
params: S
|
|
1029
1056
|
}) => {
|
|
1030
|
-
const
|
|
1057
|
+
const m = on.createFrom({
|
|
1031
1058
|
resource_key: a,
|
|
1032
1059
|
resource_id: c,
|
|
1033
1060
|
resource_data: l,
|
|
1034
1061
|
options: an.createFrom({
|
|
1035
|
-
target:
|
|
1036
|
-
follow:
|
|
1062
|
+
target: d ?? "",
|
|
1063
|
+
follow: p,
|
|
1037
1064
|
include_previous: !1,
|
|
1038
1065
|
include_timestamps: !0,
|
|
1039
|
-
tail_lines:
|
|
1066
|
+
tail_lines: g,
|
|
1040
1067
|
since_seconds: 0,
|
|
1041
1068
|
limit_bytes: 0,
|
|
1042
1069
|
include_source_events: !0,
|
|
1043
|
-
params:
|
|
1070
|
+
params: S ?? {}
|
|
1044
1071
|
})
|
|
1045
|
-
}),
|
|
1046
|
-
if (!
|
|
1072
|
+
}), y = await Dt(e, o, m);
|
|
1073
|
+
if (!y) throw new Error("Failed to create log session: null response");
|
|
1047
1074
|
return r({
|
|
1048
|
-
id:
|
|
1049
|
-
title:
|
|
1075
|
+
id: y.id,
|
|
1076
|
+
title: f ?? `Logs ${y.id.substring(0, 8)}`,
|
|
1050
1077
|
variant: "logs",
|
|
1051
1078
|
icon: u ?? "LuLogs"
|
|
1052
|
-
}),
|
|
1079
|
+
}), y;
|
|
1053
1080
|
},
|
|
1054
|
-
onError:
|
|
1055
|
-
}), i =
|
|
1081
|
+
onError: L(n, "Failed to start log session")
|
|
1082
|
+
}), i = A({
|
|
1056
1083
|
mutationFn: async (o) => {
|
|
1057
|
-
await
|
|
1084
|
+
await xt(o);
|
|
1058
1085
|
},
|
|
1059
|
-
onError:
|
|
1086
|
+
onError: L(n, "Failed to close log session")
|
|
1060
1087
|
});
|
|
1061
1088
|
return {
|
|
1062
1089
|
createLogSession: s.mutateAsync,
|
|
1063
1090
|
closeLogSession: i.mutateAsync
|
|
1064
1091
|
};
|
|
1065
|
-
}, ls = () =>
|
|
1092
|
+
}, ls = () => T({
|
|
1066
1093
|
queryKey: ["metric", "providers"],
|
|
1067
1094
|
queryFn: Nt,
|
|
1068
1095
|
staleTime: 3e4
|
|
1069
|
-
}), Tn = (t) =>
|
|
1096
|
+
}), Tn = (t) => T({
|
|
1070
1097
|
queryKey: ["metric", "providers", t],
|
|
1071
1098
|
queryFn: () => kt(t),
|
|
1072
1099
|
enabled: !!t,
|
|
1073
1100
|
staleTime: 3e4
|
|
1074
1101
|
}), ds = (t) => {
|
|
1075
|
-
var
|
|
1102
|
+
var m, y;
|
|
1076
1103
|
const {
|
|
1077
1104
|
connectionID: e,
|
|
1078
1105
|
resourceKey: n,
|
|
@@ -1086,12 +1113,12 @@ const as = () => {
|
|
|
1086
1113
|
refreshInterval: l = 0,
|
|
1087
1114
|
enabled: u = !0
|
|
1088
1115
|
} = t, {
|
|
1089
|
-
data:
|
|
1090
|
-
isLoading:
|
|
1091
|
-
} = Tn(n),
|
|
1116
|
+
data: f,
|
|
1117
|
+
isLoading: d
|
|
1118
|
+
} = Tn(n), p = f ?? [], g = c ? Math.max(
|
|
1092
1119
|
Math.floor((c.end.getTime() - c.start.getTime()) / 250),
|
|
1093
1120
|
15e3
|
|
1094
|
-
) * 1e6 : 0,
|
|
1121
|
+
) * 1e6 : 0, S = T({
|
|
1095
1122
|
queryKey: [
|
|
1096
1123
|
"metric",
|
|
1097
1124
|
"query",
|
|
@@ -1101,11 +1128,11 @@ const as = () => {
|
|
|
1101
1128
|
s,
|
|
1102
1129
|
o,
|
|
1103
1130
|
a,
|
|
1104
|
-
(
|
|
1105
|
-
(
|
|
1131
|
+
(m = c == null ? void 0 : c.start) == null ? void 0 : m.getTime(),
|
|
1132
|
+
(y = c == null ? void 0 : c.end) == null ? void 0 : y.getTime()
|
|
1106
1133
|
],
|
|
1107
1134
|
queryFn: async () => {
|
|
1108
|
-
const
|
|
1135
|
+
const _ = await Lt(
|
|
1109
1136
|
e,
|
|
1110
1137
|
n,
|
|
1111
1138
|
r,
|
|
@@ -1115,25 +1142,25 @@ const as = () => {
|
|
|
1115
1142
|
a,
|
|
1116
1143
|
((c == null ? void 0 : c.start) ?? /* @__PURE__ */ new Date(0)).toISOString(),
|
|
1117
1144
|
((c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0)).toISOString(),
|
|
1118
|
-
|
|
1119
|
-
),
|
|
1120
|
-
for (const [v, R] of Object.entries(
|
|
1121
|
-
R != null && (
|
|
1122
|
-
return
|
|
1145
|
+
g
|
|
1146
|
+
), h = {};
|
|
1147
|
+
for (const [v, R] of Object.entries(_))
|
|
1148
|
+
R != null && (h[v] = R);
|
|
1149
|
+
return h;
|
|
1123
1150
|
},
|
|
1124
|
-
enabled: u && !!e && !!n && (n.startsWith("cluster::") || !!r) &&
|
|
1151
|
+
enabled: u && !!e && !!n && (n.startsWith("cluster::") || !!r) && p.length > 0,
|
|
1125
1152
|
refetchInterval: l > 0 ? l : void 0,
|
|
1126
1153
|
staleTime: 5e3,
|
|
1127
1154
|
// Keep previous data visible while fetching new data (e.g. on time range change)
|
|
1128
1155
|
// to prevent the chart from blinking empty.
|
|
1129
|
-
placeholderData:
|
|
1156
|
+
placeholderData: We
|
|
1130
1157
|
});
|
|
1131
1158
|
return {
|
|
1132
|
-
data:
|
|
1133
|
-
providers:
|
|
1134
|
-
isLoading:
|
|
1135
|
-
error:
|
|
1136
|
-
refetch:
|
|
1159
|
+
data: S.data ?? void 0,
|
|
1160
|
+
providers: p,
|
|
1161
|
+
isLoading: d || S.isLoading,
|
|
1162
|
+
error: S.error,
|
|
1163
|
+
refetch: S.refetch
|
|
1137
1164
|
};
|
|
1138
1165
|
}, fs = (t) => {
|
|
1139
1166
|
const {
|
|
@@ -1146,10 +1173,10 @@ const as = () => {
|
|
|
1146
1173
|
metricIDs: a = [],
|
|
1147
1174
|
interval: c = 1e4,
|
|
1148
1175
|
enabled: l = !0
|
|
1149
|
-
} = t, u = P(e), [
|
|
1176
|
+
} = t, u = P(e), [f, d] = G(null), [p, g] = G(null), [S, m] = G(!1), [y, _] = G(null), h = q(null), v = k(async () => {
|
|
1150
1177
|
if (!(!l || !u || !n || !r || !s))
|
|
1151
1178
|
try {
|
|
1152
|
-
const
|
|
1179
|
+
const C = await Mt(u, n, {
|
|
1153
1180
|
resource_key: r,
|
|
1154
1181
|
resource_id: s,
|
|
1155
1182
|
resource_namespace: i,
|
|
@@ -1158,72 +1185,72 @@ const as = () => {
|
|
|
1158
1185
|
interval: c * 1e6
|
|
1159
1186
|
// ms to nanoseconds for Go time.Duration
|
|
1160
1187
|
});
|
|
1161
|
-
|
|
1162
|
-
const
|
|
1188
|
+
g(C), m(!0), _(null);
|
|
1189
|
+
const E = O(`core/metrics/data/${C}`, (I) => {
|
|
1163
1190
|
const M = I.data;
|
|
1164
1191
|
try {
|
|
1165
1192
|
const N = JSON.parse(M);
|
|
1166
|
-
N.results &&
|
|
1193
|
+
N.results && d(N.results);
|
|
1167
1194
|
} catch (N) {
|
|
1168
1195
|
console.error("Failed to parse metric stream data:", N);
|
|
1169
1196
|
}
|
|
1170
|
-
}),
|
|
1197
|
+
}), b = O(`core/metrics/error/${C}`, (I) => {
|
|
1171
1198
|
const M = I.data;
|
|
1172
1199
|
try {
|
|
1173
1200
|
const N = JSON.parse(M);
|
|
1174
|
-
|
|
1201
|
+
_(N.error || "Unknown error");
|
|
1175
1202
|
} catch {
|
|
1176
|
-
|
|
1203
|
+
_("Failed to parse metric stream error");
|
|
1177
1204
|
}
|
|
1178
1205
|
});
|
|
1179
|
-
|
|
1180
|
-
|
|
1206
|
+
h.current = () => {
|
|
1207
|
+
E(), b();
|
|
1181
1208
|
};
|
|
1182
|
-
} catch (
|
|
1183
|
-
|
|
1209
|
+
} catch (C) {
|
|
1210
|
+
_(C instanceof Error ? C.message : String(C));
|
|
1184
1211
|
}
|
|
1185
|
-
}, [u, n, r, s, i, a, c, l]), R =
|
|
1186
|
-
if (
|
|
1212
|
+
}, [u, n, r, s, i, a, c, l]), R = k(async () => {
|
|
1213
|
+
if (p)
|
|
1187
1214
|
try {
|
|
1188
|
-
await Ce(
|
|
1189
|
-
} catch (
|
|
1190
|
-
console.error("Failed to unsubscribe:",
|
|
1215
|
+
await Ce(p);
|
|
1216
|
+
} catch (C) {
|
|
1217
|
+
console.error("Failed to unsubscribe:", C);
|
|
1191
1218
|
}
|
|
1192
|
-
|
|
1193
|
-
}, [
|
|
1194
|
-
return
|
|
1195
|
-
|
|
1196
|
-
}, [
|
|
1197
|
-
data:
|
|
1198
|
-
subscriptionID:
|
|
1199
|
-
isStreaming:
|
|
1200
|
-
error:
|
|
1219
|
+
h.current && (h.current(), h.current = null), g(null), m(!1);
|
|
1220
|
+
}, [p]);
|
|
1221
|
+
return $(() => () => {
|
|
1222
|
+
p && Ce(p).catch(console.error), h.current && h.current();
|
|
1223
|
+
}, [p]), {
|
|
1224
|
+
data: f,
|
|
1225
|
+
subscriptionID: p,
|
|
1226
|
+
isStreaming: S,
|
|
1227
|
+
error: y,
|
|
1201
1228
|
start: v,
|
|
1202
1229
|
stop: R
|
|
1203
1230
|
};
|
|
1204
1231
|
}, B = ["networker", "portforward", "all-sessions"];
|
|
1205
1232
|
function ps() {
|
|
1206
|
-
const { showSnackbar: t } = W(), e = j(), n =
|
|
1233
|
+
const { showSnackbar: t } = W(), e = j(), n = T({
|
|
1207
1234
|
queryKey: [...B],
|
|
1208
|
-
queryFn: async () =>
|
|
1235
|
+
queryFn: async () => qt().catch((i) => {
|
|
1209
1236
|
if (Q(i).detail.includes("not found")) return [];
|
|
1210
1237
|
throw i;
|
|
1211
1238
|
}),
|
|
1212
1239
|
retry: !1
|
|
1213
1240
|
});
|
|
1214
|
-
|
|
1215
|
-
const i =
|
|
1241
|
+
$(() => {
|
|
1242
|
+
const i = O("core/networker/portforward/created", () => {
|
|
1216
1243
|
e.invalidateQueries({ queryKey: [...B] });
|
|
1217
|
-
}), o =
|
|
1244
|
+
}), o = O("core/networker/portforward/closed", () => {
|
|
1218
1245
|
e.invalidateQueries({ queryKey: [...B] });
|
|
1219
1246
|
});
|
|
1220
1247
|
return () => {
|
|
1221
1248
|
i(), o();
|
|
1222
1249
|
};
|
|
1223
1250
|
}, [e]);
|
|
1224
|
-
const r = n.data ?? [], s =
|
|
1251
|
+
const r = n.data ?? [], s = A({
|
|
1225
1252
|
mutationFn: async (i) => Te(i),
|
|
1226
|
-
onError:
|
|
1253
|
+
onError: L(t, "Failed to close port forwarding session"),
|
|
1227
1254
|
onSuccess: async () => {
|
|
1228
1255
|
await e.invalidateQueries({ queryKey: [...B] });
|
|
1229
1256
|
}
|
|
@@ -1232,23 +1259,23 @@ function ps() {
|
|
|
1232
1259
|
sessions: n,
|
|
1233
1260
|
activeSessions: r,
|
|
1234
1261
|
closeSession: s.mutateAsync,
|
|
1235
|
-
openInBrowser: (i) =>
|
|
1262
|
+
openInBrowser: (i) => $e(`http://localhost:${i}`)
|
|
1236
1263
|
};
|
|
1237
1264
|
}
|
|
1238
|
-
function
|
|
1239
|
-
const r = P(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = W(), o = j(), a =
|
|
1265
|
+
function gs({ pluginID: t, connectionID: e, resourceID: n }) {
|
|
1266
|
+
const r = P(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = W(), o = j(), a = T({
|
|
1240
1267
|
queryKey: s,
|
|
1241
|
-
queryFn: async () =>
|
|
1268
|
+
queryFn: async () => Ut(r, e, cn.createFrom({
|
|
1242
1269
|
resource_id: n,
|
|
1243
1270
|
connection_id: e
|
|
1244
1271
|
})).catch((u) => {
|
|
1245
|
-
const
|
|
1246
|
-
return
|
|
1272
|
+
const f = Q(u);
|
|
1273
|
+
return f.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: f.detail }), []);
|
|
1247
1274
|
}),
|
|
1248
1275
|
retry: !1
|
|
1249
|
-
}), c =
|
|
1276
|
+
}), c = A({
|
|
1250
1277
|
mutationFn: async ({ opts: u }) => {
|
|
1251
|
-
const
|
|
1278
|
+
const f = un.createFrom({
|
|
1252
1279
|
local_port: u.localPort || 0,
|
|
1253
1280
|
remote_port: u.remotePort,
|
|
1254
1281
|
protocol: u.protocol || "TCP",
|
|
@@ -1262,20 +1289,20 @@ function ys({ pluginID: t, connectionID: e, resourceID: n }) {
|
|
|
1262
1289
|
},
|
|
1263
1290
|
labels: u.labels ?? {},
|
|
1264
1291
|
params: u.parameters ?? {}
|
|
1265
|
-
}),
|
|
1266
|
-
if (!
|
|
1267
|
-
return u.openInBrowser &&
|
|
1292
|
+
}), d = await $t(r, e, f);
|
|
1293
|
+
if (!d) throw new Error("Failed to start port forwarding: null response");
|
|
1294
|
+
return u.openInBrowser && $e(`http://localhost:${d.local_port}`), d;
|
|
1268
1295
|
},
|
|
1269
|
-
onError:
|
|
1296
|
+
onError: L(i, "Failed to start port forwarding session"),
|
|
1270
1297
|
onSuccess: async () => {
|
|
1271
1298
|
await Promise.all([
|
|
1272
1299
|
o.invalidateQueries({ queryKey: s }),
|
|
1273
1300
|
o.invalidateQueries({ queryKey: [...B] })
|
|
1274
1301
|
]);
|
|
1275
1302
|
}
|
|
1276
|
-
}), l =
|
|
1303
|
+
}), l = A({
|
|
1277
1304
|
mutationFn: async ({ opts: u }) => Te(u.sessionID),
|
|
1278
|
-
onError:
|
|
1305
|
+
onError: L(i, "Failed to close port forwarding session"),
|
|
1279
1306
|
onSuccess: async () => {
|
|
1280
1307
|
await Promise.all([
|
|
1281
1308
|
o.invalidateQueries({ queryKey: s }),
|
|
@@ -1289,8 +1316,8 @@ function ys({ pluginID: t, connectionID: e, resourceID: n }) {
|
|
|
1289
1316
|
close: l.mutateAsync
|
|
1290
1317
|
};
|
|
1291
1318
|
}
|
|
1292
|
-
const
|
|
1293
|
-
const t =
|
|
1319
|
+
const ys = () => {
|
|
1320
|
+
const t = w.useContext(_n);
|
|
1294
1321
|
if (!t) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
|
|
1295
1322
|
return t;
|
|
1296
1323
|
}, hs = ({
|
|
@@ -1300,33 +1327,33 @@ const gs = () => {
|
|
|
1300
1327
|
resourceID: r,
|
|
1301
1328
|
namespace: s = ""
|
|
1302
1329
|
}) => {
|
|
1303
|
-
const i = P(t), o = j(), { showSnackbar: a } = W(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } =
|
|
1304
|
-
mutationFn: async (
|
|
1305
|
-
input:
|
|
1330
|
+
const i = P(t), o = j(), { showSnackbar: a } = W(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } = A({
|
|
1331
|
+
mutationFn: async (d) => Ae(i, e, n, ke.createFrom({
|
|
1332
|
+
input: d.input,
|
|
1306
1333
|
id: r,
|
|
1307
1334
|
namespace: s
|
|
1308
1335
|
})),
|
|
1309
1336
|
onSuccess: async () => {
|
|
1310
1337
|
a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey: c });
|
|
1311
1338
|
},
|
|
1312
|
-
onError:
|
|
1313
|
-
}), { mutateAsync: u } =
|
|
1314
|
-
mutationFn: async (
|
|
1339
|
+
onError: L(a, `Failed to update resource ${r}`)
|
|
1340
|
+
}), { mutateAsync: u } = A({
|
|
1341
|
+
mutationFn: async (d = {}) => De(i, e, n, Le.createFrom({
|
|
1315
1342
|
id: r,
|
|
1316
1343
|
namespace: s,
|
|
1317
|
-
gracePeriodSeconds:
|
|
1344
|
+
gracePeriodSeconds: d.gracePeriodSeconds
|
|
1318
1345
|
})),
|
|
1319
1346
|
onSuccess: async () => {
|
|
1320
1347
|
a(`Resource ${r} deleted`, "success"), await o.invalidateQueries({ queryKey: c });
|
|
1321
1348
|
},
|
|
1322
|
-
onError:
|
|
1349
|
+
onError: L(a, `Failed to delete resource ${r}`)
|
|
1323
1350
|
});
|
|
1324
1351
|
return {
|
|
1325
1352
|
/**
|
|
1326
1353
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1327
1354
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1328
1355
|
*/
|
|
1329
|
-
resource:
|
|
1356
|
+
resource: T({
|
|
1330
1357
|
queryKey: c,
|
|
1331
1358
|
queryFn: async () => Wt(i, e, n, ln.createFrom({
|
|
1332
1359
|
id: r,
|
|
@@ -1356,7 +1383,7 @@ const gs = () => {
|
|
|
1356
1383
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1357
1384
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1358
1385
|
*/
|
|
1359
|
-
component:
|
|
1386
|
+
component: T({
|
|
1360
1387
|
queryKey: e,
|
|
1361
1388
|
queryFn: async () => Gt(t)
|
|
1362
1389
|
})
|
|
@@ -1367,7 +1394,7 @@ const gs = () => {
|
|
|
1367
1394
|
/**
|
|
1368
1395
|
* The resource groups for the given plugin and connection.
|
|
1369
1396
|
*/
|
|
1370
|
-
groups:
|
|
1397
|
+
groups: T({
|
|
1371
1398
|
queryKey: [n, "resource_groups", "list"],
|
|
1372
1399
|
queryFn: async () => jt(n, e),
|
|
1373
1400
|
retry: !1
|
|
@@ -1382,7 +1409,7 @@ const gs = () => {
|
|
|
1382
1409
|
return dn({
|
|
1383
1410
|
queries: n.map((o) => ({
|
|
1384
1411
|
queryKey: s(o),
|
|
1385
|
-
queryFn: async () =>
|
|
1412
|
+
queryFn: async () => xe(r, e, o.key, Me.createFrom({
|
|
1386
1413
|
order: [{ field: "name", descending: !1 }],
|
|
1387
1414
|
pagination: { page: 1, pageSize: 200 },
|
|
1388
1415
|
namespaces: o.namespaces
|
|
@@ -1396,7 +1423,7 @@ const gs = () => {
|
|
|
1396
1423
|
/**
|
|
1397
1424
|
* The current settings from the provider.
|
|
1398
1425
|
*/
|
|
1399
|
-
resourceType:
|
|
1426
|
+
resourceType: T({
|
|
1400
1427
|
queryKey: [n, "resources", e],
|
|
1401
1428
|
queryFn: async () => Qt(n, e),
|
|
1402
1429
|
retry: !1
|
|
@@ -1408,7 +1435,7 @@ const gs = () => {
|
|
|
1408
1435
|
/**
|
|
1409
1436
|
* The resource types for the given plugin and connection.
|
|
1410
1437
|
*/
|
|
1411
|
-
types:
|
|
1438
|
+
types: T({
|
|
1412
1439
|
queryKey: [n, "resources", "list", e],
|
|
1413
1440
|
queryFn: async () => Kt(n, e),
|
|
1414
1441
|
retry: !1
|
|
@@ -1419,7 +1446,7 @@ var ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1419
1446
|
function An(t) {
|
|
1420
1447
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
1421
1448
|
}
|
|
1422
|
-
var
|
|
1449
|
+
var Dn = "Expected a function", Ve = "__lodash_hash_undefined__", xn = "[object Function]", Nn = "[object GeneratorFunction]", kn = "[object Symbol]", Ln = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Mn = /^\w*$/, qn = /^\./, Un = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, $n = /[\\^$.*+?()[\]{}|]/g, Wn = /\\(\\)?/g, Gn = /^\[object .+?Constructor\]$/, jn = typeof ee == "object" && ee && ee.Object === Object && ee, Qn = typeof self == "object" && self && self.Object === Object && self, me = jn || Qn || Function("return this")();
|
|
1423
1450
|
function Kn(t, e) {
|
|
1424
1451
|
return t == null ? void 0 : t[e];
|
|
1425
1452
|
}
|
|
@@ -1436,7 +1463,7 @@ var Bn = Array.prototype, zn = Function.prototype, et = Object.prototype, le = m
|
|
|
1436
1463
|
var t = /[^.]+$/.exec(le && le.keys && le.keys.IE_PROTO || "");
|
|
1437
1464
|
return t ? "Symbol(src)_1." + t : "";
|
|
1438
1465
|
}(), tt = zn.toString, Se = et.hasOwnProperty, nt = et.toString, Yn = RegExp(
|
|
1439
|
-
"^" + tt.call(Se).replace(
|
|
1466
|
+
"^" + tt.call(Se).replace($n, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1440
1467
|
), Re = me.Symbol, Jn = Bn.splice, Zn = rt(me, "Map"), Z = rt(Object, "create"), Fe = Re ? Re.prototype : void 0, Ie = Fe ? Fe.toString : void 0;
|
|
1441
1468
|
function K(t) {
|
|
1442
1469
|
var e = -1, n = t ? t.length : 0;
|
|
@@ -1548,13 +1575,13 @@ function pr(t, e) {
|
|
|
1548
1575
|
t = t[wr(e[n++])];
|
|
1549
1576
|
return n && n == r ? t : void 0;
|
|
1550
1577
|
}
|
|
1551
|
-
function
|
|
1578
|
+
function gr(t) {
|
|
1552
1579
|
if (!ot(t) || _r(t))
|
|
1553
1580
|
return !1;
|
|
1554
1581
|
var e = vr(t) || Hn(t) ? Yn : Gn;
|
|
1555
1582
|
return e.test(Cr(t));
|
|
1556
1583
|
}
|
|
1557
|
-
function
|
|
1584
|
+
function yr(t) {
|
|
1558
1585
|
if (typeof t == "string")
|
|
1559
1586
|
return t;
|
|
1560
1587
|
if (Ee(t))
|
|
@@ -1571,7 +1598,7 @@ function oe(t, e) {
|
|
|
1571
1598
|
}
|
|
1572
1599
|
function rt(t, e) {
|
|
1573
1600
|
var n = Kn(t, e);
|
|
1574
|
-
return
|
|
1601
|
+
return gr(n) ? n : void 0;
|
|
1575
1602
|
}
|
|
1576
1603
|
function mr(t, e) {
|
|
1577
1604
|
if (st(t))
|
|
@@ -1589,7 +1616,7 @@ function _r(t) {
|
|
|
1589
1616
|
var Er = _e(function(t) {
|
|
1590
1617
|
t = Fr(t);
|
|
1591
1618
|
var e = [];
|
|
1592
|
-
return
|
|
1619
|
+
return qn.test(t) && e.push(""), t.replace(Un, function(n, r, s, i) {
|
|
1593
1620
|
e.push(s ? i.replace(Wn, "$1") : r || n);
|
|
1594
1621
|
}), e;
|
|
1595
1622
|
});
|
|
@@ -1614,7 +1641,7 @@ function Cr(t) {
|
|
|
1614
1641
|
}
|
|
1615
1642
|
function _e(t, e) {
|
|
1616
1643
|
if (typeof t != "function" || e && typeof e != "function")
|
|
1617
|
-
throw new TypeError(
|
|
1644
|
+
throw new TypeError(Dn);
|
|
1618
1645
|
var n = function() {
|
|
1619
1646
|
var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
|
|
1620
1647
|
if (i.has(s))
|
|
@@ -1631,7 +1658,7 @@ function br(t, e) {
|
|
|
1631
1658
|
var st = Array.isArray;
|
|
1632
1659
|
function vr(t) {
|
|
1633
1660
|
var e = ot(t) ? nt.call(t) : "";
|
|
1634
|
-
return e ==
|
|
1661
|
+
return e == xn || e == Nn;
|
|
1635
1662
|
}
|
|
1636
1663
|
function ot(t) {
|
|
1637
1664
|
var e = typeof t;
|
|
@@ -1644,7 +1671,7 @@ function Ee(t) {
|
|
|
1644
1671
|
return typeof t == "symbol" || Rr(t) && nt.call(t) == kn;
|
|
1645
1672
|
}
|
|
1646
1673
|
function Fr(t) {
|
|
1647
|
-
return t == null ? "" :
|
|
1674
|
+
return t == null ? "" : yr(t);
|
|
1648
1675
|
}
|
|
1649
1676
|
function Ir(t, e, n) {
|
|
1650
1677
|
var r = t == null ? void 0 : pr(t, e);
|
|
@@ -1678,28 +1705,28 @@ function Or(t, e, n) {
|
|
|
1678
1705
|
function Tr(t, e, n, r, s, i) {
|
|
1679
1706
|
const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = q([]), c = q(null), l = q(null), u = q(s);
|
|
1680
1707
|
u.current = s;
|
|
1681
|
-
const
|
|
1682
|
-
const
|
|
1683
|
-
if (a.current = [], c.current = null, l.current = null, !(
|
|
1708
|
+
const f = k(() => {
|
|
1709
|
+
const p = a.current;
|
|
1710
|
+
if (a.current = [], c.current = null, l.current = null, !(p.length === 0 || !r)) {
|
|
1684
1711
|
t.setQueryData(
|
|
1685
1712
|
e,
|
|
1686
|
-
(
|
|
1713
|
+
(g) => Or(g, p, r)
|
|
1687
1714
|
);
|
|
1688
|
-
for (const
|
|
1689
|
-
(
|
|
1690
|
-
n(
|
|
1691
|
-
{ result:
|
|
1715
|
+
for (const g of p)
|
|
1716
|
+
(g.type === "ADD" || g.type === "UPDATE") && t.setQueryData(
|
|
1717
|
+
n(g.payload.id, g.payload.namespace),
|
|
1718
|
+
{ result: g.payload.data }
|
|
1692
1719
|
);
|
|
1693
1720
|
}
|
|
1694
|
-
}, [t, e, n, r]),
|
|
1695
|
-
(
|
|
1696
|
-
a.current.push(
|
|
1721
|
+
}, [t, e, n, r]), d = k(
|
|
1722
|
+
(p) => {
|
|
1723
|
+
a.current.push(p), !(c.current !== null || l.current !== null) && (u.current === 1 ? c.current = setTimeout(f, o) : l.current = requestAnimationFrame(f));
|
|
1697
1724
|
},
|
|
1698
|
-
[
|
|
1725
|
+
[f, o]
|
|
1699
1726
|
);
|
|
1700
|
-
return
|
|
1727
|
+
return $(() => () => {
|
|
1701
1728
|
c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
1702
|
-
}, []),
|
|
1729
|
+
}, []), d;
|
|
1703
1730
|
}
|
|
1704
1731
|
const Cs = ({
|
|
1705
1732
|
pluginID: t,
|
|
@@ -1708,93 +1735,93 @@ const Cs = ({
|
|
|
1708
1735
|
idAccessor: r,
|
|
1709
1736
|
namespaces: s
|
|
1710
1737
|
}) => {
|
|
1711
|
-
const i = P(t), o = j(), { showSnackbar: a } = W(), c =
|
|
1738
|
+
const i = P(t), o = j(), { showSnackbar: a } = W(), c = w.useMemo(() => s ?? [], [s]), l = w.useMemo(
|
|
1712
1739
|
() => [i, e, n, c, "list"],
|
|
1713
1740
|
[i, e, n, c]
|
|
1714
|
-
), u =
|
|
1715
|
-
(
|
|
1741
|
+
), u = w.useCallback(
|
|
1742
|
+
(m, y) => [i, e, n, y, m],
|
|
1716
1743
|
[i, e, n]
|
|
1717
|
-
), { mutateAsync:
|
|
1718
|
-
mutationFn: async (
|
|
1719
|
-
input:
|
|
1720
|
-
namespace:
|
|
1744
|
+
), { mutateAsync: f } = A({
|
|
1745
|
+
mutationFn: async (m) => Ne(i, e, n, qe.createFrom({
|
|
1746
|
+
input: m.input,
|
|
1747
|
+
namespace: m.namespace ?? (c.length === 1 ? c[0] : "")
|
|
1721
1748
|
})),
|
|
1722
|
-
onSuccess: async (
|
|
1749
|
+
onSuccess: async (m) => {
|
|
1723
1750
|
var v;
|
|
1724
|
-
const
|
|
1725
|
-
let
|
|
1726
|
-
(v =
|
|
1727
|
-
const
|
|
1728
|
-
a(
|
|
1751
|
+
const y = m == null ? void 0 : m.result;
|
|
1752
|
+
let _ = "";
|
|
1753
|
+
(v = y == null ? void 0 : y.metadata) != null && v.name ? _ = y.metadata.name : y != null && y.id ? _ = y.id : y != null && y.name ? _ = y.name : y != null && y.ID ? _ = y.ID : y != null && y.Name && (_ = y.Name);
|
|
1754
|
+
const h = _ ? `Resource ${_} created` : "Resource created";
|
|
1755
|
+
a(h, "success"), await o.invalidateQueries({ queryKey: l });
|
|
1729
1756
|
},
|
|
1730
|
-
onError:
|
|
1731
|
-
}),
|
|
1757
|
+
onError: L(a, "Failed to create resource")
|
|
1758
|
+
}), d = T({
|
|
1732
1759
|
queryKey: l,
|
|
1733
|
-
queryFn: async () =>
|
|
1760
|
+
queryFn: async () => xe(i, e, n, Me.createFrom({
|
|
1734
1761
|
order: [{ field: "name", descending: !1 }],
|
|
1735
1762
|
pagination: { page: 1, pageSize: 200 },
|
|
1736
1763
|
namespaces: c
|
|
1737
1764
|
})),
|
|
1738
|
-
placeholderData: (
|
|
1765
|
+
placeholderData: (m, y) => m,
|
|
1739
1766
|
retry: !1
|
|
1740
|
-
}), [
|
|
1767
|
+
}), [p, g] = w.useState(
|
|
1741
1768
|
F.WatchStateIdle
|
|
1742
1769
|
);
|
|
1743
|
-
|
|
1770
|
+
w.useEffect(() => O(
|
|
1744
1771
|
`${i}/${e}/watch/STATE`,
|
|
1745
|
-
(
|
|
1746
|
-
const
|
|
1747
|
-
|
|
1772
|
+
(y) => {
|
|
1773
|
+
const _ = y.data;
|
|
1774
|
+
_.resourceKey === n && g(_.state);
|
|
1748
1775
|
}
|
|
1749
1776
|
), [i, e, n]);
|
|
1750
|
-
const
|
|
1751
|
-
return
|
|
1777
|
+
const S = Tr(o, l, u, r, p);
|
|
1778
|
+
return w.useEffect(() => {
|
|
1752
1779
|
if (!r)
|
|
1753
1780
|
return;
|
|
1754
1781
|
Ht(i, e, n);
|
|
1755
|
-
const
|
|
1782
|
+
const m = O(
|
|
1756
1783
|
`${i}/${e}/${n}/ADD`,
|
|
1757
|
-
(
|
|
1758
|
-
),
|
|
1784
|
+
(h) => S({ type: "ADD", payload: h.data })
|
|
1785
|
+
), y = O(
|
|
1759
1786
|
`${i}/${e}/${n}/UPDATE`,
|
|
1760
|
-
(
|
|
1761
|
-
),
|
|
1787
|
+
(h) => S({ type: "UPDATE", payload: h.data })
|
|
1788
|
+
), _ = O(
|
|
1762
1789
|
`${i}/${e}/${n}/DELETE`,
|
|
1763
|
-
(
|
|
1790
|
+
(h) => S({ type: "DELETE", payload: h.data })
|
|
1764
1791
|
);
|
|
1765
1792
|
return () => {
|
|
1766
|
-
|
|
1793
|
+
m(), y(), _(), Bt(i, e, n);
|
|
1767
1794
|
};
|
|
1768
|
-
}, [i, e, n,
|
|
1795
|
+
}, [i, e, n, S]), {
|
|
1769
1796
|
/**
|
|
1770
1797
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1771
1798
|
* when the resources are updated or deleted via the returned create and remove mutation functions, or
|
|
1772
1799
|
* the per-resource hook mutation functions.
|
|
1773
1800
|
*/
|
|
1774
|
-
resources:
|
|
1801
|
+
resources: d,
|
|
1775
1802
|
/**
|
|
1776
1803
|
* Create a new resource. A set of optional parameters can be passed to customize the create behavior,
|
|
1777
1804
|
* which if specified, will add additional default behavior set via the hook options.
|
|
1778
1805
|
*
|
|
1779
1806
|
* @params opts Optional parameters to pass to the resource create operation
|
|
1780
1807
|
*/
|
|
1781
|
-
create:
|
|
1808
|
+
create: f,
|
|
1782
1809
|
/** Current watch state for this resource type */
|
|
1783
|
-
watchState:
|
|
1810
|
+
watchState: p,
|
|
1784
1811
|
/** Whether the watch is currently syncing */
|
|
1785
|
-
isSyncing:
|
|
1812
|
+
isSyncing: p === F.WatchStateSyncing,
|
|
1786
1813
|
/** Whether the watch has fully synced */
|
|
1787
|
-
isSynced:
|
|
1814
|
+
isSynced: p === F.WatchStateSynced,
|
|
1788
1815
|
/** Whether the watch encountered an error */
|
|
1789
|
-
watchError:
|
|
1816
|
+
watchError: p === F.WatchStateError
|
|
1790
1817
|
};
|
|
1791
1818
|
}, bs = ({ pluginID: t }) => {
|
|
1792
|
-
const e = P(t), { showSnackbar: n } = W(), r =
|
|
1819
|
+
const e = P(t), { showSnackbar: n } = W(), r = A({
|
|
1793
1820
|
mutationFn: async ({ opts: o, input: a }) => Ne(
|
|
1794
1821
|
e,
|
|
1795
1822
|
o.connectionID,
|
|
1796
1823
|
o.resourceKey,
|
|
1797
|
-
|
|
1824
|
+
qe.createFrom({
|
|
1798
1825
|
input: a.input,
|
|
1799
1826
|
namespace: a.namespace ?? o.namespace ?? ""
|
|
1800
1827
|
})
|
|
@@ -1805,7 +1832,7 @@ const Cs = ({
|
|
|
1805
1832
|
onError(o, { opts: a }) {
|
|
1806
1833
|
z(n, o, `Failed to create resource ${a.resourceID}`);
|
|
1807
1834
|
}
|
|
1808
|
-
}), s =
|
|
1835
|
+
}), s = A({
|
|
1809
1836
|
mutationFn: async ({ opts: o, input: a }) => Ae(
|
|
1810
1837
|
e,
|
|
1811
1838
|
o.connectionID,
|
|
@@ -1822,8 +1849,8 @@ const Cs = ({
|
|
|
1822
1849
|
onError(o, { opts: a }) {
|
|
1823
1850
|
z(n, o, `Failed to update resource ${a.resourceID}`);
|
|
1824
1851
|
}
|
|
1825
|
-
}), i =
|
|
1826
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
1852
|
+
}), i = A({
|
|
1853
|
+
mutationFn: async ({ opts: o, input: a }) => De(
|
|
1827
1854
|
e,
|
|
1828
1855
|
o.connectionID,
|
|
1829
1856
|
o.resourceKey,
|
|
@@ -1851,7 +1878,7 @@ const Cs = ({
|
|
|
1851
1878
|
resourceKey: n,
|
|
1852
1879
|
enabled: r = !0
|
|
1853
1880
|
}) => {
|
|
1854
|
-
const s = P(t), i =
|
|
1881
|
+
const s = P(t), i = T({
|
|
1855
1882
|
queryKey: ["RESOURCE_ACTIONS", s, e, n],
|
|
1856
1883
|
queryFn: () => zt(s, e, n),
|
|
1857
1884
|
enabled: r && !!s && !!e && !!n,
|
|
@@ -1868,13 +1895,13 @@ const Cs = ({
|
|
|
1868
1895
|
connectionID: e,
|
|
1869
1896
|
resourceKey: n
|
|
1870
1897
|
}) => {
|
|
1871
|
-
const r = P(t), s = j(), { showSnackbar: i } = W(), o =
|
|
1898
|
+
const r = P(t), s = j(), { showSnackbar: i } = W(), o = A({
|
|
1872
1899
|
mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => Yt(
|
|
1873
1900
|
r,
|
|
1874
1901
|
e,
|
|
1875
1902
|
n,
|
|
1876
1903
|
a,
|
|
1877
|
-
|
|
1904
|
+
Ue.createFrom({ id: c, namespace: l, params: u })
|
|
1878
1905
|
),
|
|
1879
1906
|
onSuccess: (a) => {
|
|
1880
1907
|
a != null && a.message && i(a.message, "success"), s.invalidateQueries({
|
|
@@ -1895,7 +1922,7 @@ const Cs = ({
|
|
|
1895
1922
|
connectionID: e,
|
|
1896
1923
|
enabled: n = !0
|
|
1897
1924
|
}) => {
|
|
1898
|
-
const r = P(t), s =
|
|
1925
|
+
const r = P(t), s = T({
|
|
1899
1926
|
queryKey: ["EDITOR_SCHEMAS", r, e],
|
|
1900
1927
|
queryFn: () => Jt(r, e),
|
|
1901
1928
|
enabled: n && !!r && !!e,
|
|
@@ -1914,103 +1941,103 @@ const Cs = ({
|
|
|
1914
1941
|
connectionID: e,
|
|
1915
1942
|
enabled: n = !0
|
|
1916
1943
|
}) => {
|
|
1917
|
-
const r = P(t), s = j(), i = [r, e, "watch-state"], o = q([]), a = q(!1), c =
|
|
1918
|
-
s.setQueryData(i, (
|
|
1919
|
-
if (!
|
|
1920
|
-
const
|
|
1921
|
-
let
|
|
1922
|
-
for (const
|
|
1923
|
-
|
|
1924
|
-
return { ...
|
|
1944
|
+
const r = P(t), s = j(), i = [r, e, "watch-state"], o = q([]), a = q(!1), c = k((d) => {
|
|
1945
|
+
s.setQueryData(i, (p) => {
|
|
1946
|
+
if (!p) return p;
|
|
1947
|
+
const g = { ...p.resources, [d.resourceKey]: d.state }, S = { ...p.resourceCounts, [d.resourceKey]: d.resourceCount };
|
|
1948
|
+
let m = 0, y = 0;
|
|
1949
|
+
for (const _ of Object.values(g))
|
|
1950
|
+
_ === F.WatchStateSynced && m++, (_ === F.WatchStateError || _ === F.WatchStateFailed) && y++;
|
|
1951
|
+
return { ...p, resources: g, resourceCounts: S, totalResources: Object.keys(g).length, syncedCount: m, errorCount: y };
|
|
1925
1952
|
});
|
|
1926
|
-
}, [s, r, e]), l =
|
|
1953
|
+
}, [s, r, e]), l = T({
|
|
1927
1954
|
queryKey: i,
|
|
1928
1955
|
queryFn: async () => {
|
|
1929
|
-
const
|
|
1930
|
-
if (!
|
|
1931
|
-
const
|
|
1932
|
-
let
|
|
1933
|
-
for (const [
|
|
1934
|
-
|
|
1935
|
-
const
|
|
1936
|
-
for (const [
|
|
1937
|
-
|
|
1956
|
+
const d = await Zt(r, e);
|
|
1957
|
+
if (!d) throw new Error("Failed to get watch state: null response");
|
|
1958
|
+
const p = {};
|
|
1959
|
+
let g = 0, S = 0;
|
|
1960
|
+
for (const [y, _] of Object.entries(d.resources ?? {}))
|
|
1961
|
+
_ != null && (p[y] = _, _ === F.WatchStateSynced && g++, _ === F.WatchStateError && S++);
|
|
1962
|
+
const m = {};
|
|
1963
|
+
for (const [y, _] of Object.entries(d.resourceCounts ?? {}))
|
|
1964
|
+
_ != null && (m[y] = _);
|
|
1938
1965
|
return {
|
|
1939
|
-
connection:
|
|
1940
|
-
resources:
|
|
1941
|
-
resourceCounts:
|
|
1942
|
-
totalResources: Object.keys(
|
|
1943
|
-
syncedCount:
|
|
1944
|
-
errorCount:
|
|
1966
|
+
connection: d.connectionId,
|
|
1967
|
+
resources: p,
|
|
1968
|
+
resourceCounts: m,
|
|
1969
|
+
totalResources: Object.keys(p).length,
|
|
1970
|
+
syncedCount: g,
|
|
1971
|
+
errorCount: S
|
|
1945
1972
|
};
|
|
1946
1973
|
},
|
|
1947
1974
|
enabled: n && !!r && !!e,
|
|
1948
|
-
refetchInterval: (
|
|
1949
|
-
const
|
|
1950
|
-
if (!
|
|
1951
|
-
let
|
|
1952
|
-
for (const
|
|
1953
|
-
(
|
|
1954
|
-
return
|
|
1975
|
+
refetchInterval: (d) => {
|
|
1976
|
+
const p = d.state.data;
|
|
1977
|
+
if (!p || p.totalResources === 0) return 3e3;
|
|
1978
|
+
let g = 0;
|
|
1979
|
+
for (const S of Object.values(p.resources))
|
|
1980
|
+
(S === F.WatchStateSynced || S === F.WatchStateError || S === F.WatchStateStopped || S === F.WatchStateFailed || S === F.WatchStateForbidden || S === F.WatchStateSkipped) && g++;
|
|
1981
|
+
return g >= p.totalResources ? !1 : 3e3;
|
|
1955
1982
|
}
|
|
1956
1983
|
});
|
|
1957
|
-
|
|
1984
|
+
$(() => {
|
|
1958
1985
|
if (!l.data || a.current) return;
|
|
1959
1986
|
a.current = !0;
|
|
1960
|
-
const
|
|
1987
|
+
const d = o.current;
|
|
1961
1988
|
o.current = [];
|
|
1962
|
-
for (const
|
|
1963
|
-
c(
|
|
1964
|
-
}, [l.data, c]),
|
|
1989
|
+
for (const p of d)
|
|
1990
|
+
c(p);
|
|
1991
|
+
}, [l.data, c]), $(() => {
|
|
1965
1992
|
if (!n || !r || !e)
|
|
1966
1993
|
return;
|
|
1967
1994
|
a.current = !1, o.current = [];
|
|
1968
|
-
const
|
|
1995
|
+
const d = O(
|
|
1969
1996
|
`${r}/${e}/watch/STATE`,
|
|
1970
|
-
(
|
|
1971
|
-
const
|
|
1972
|
-
a.current ? c(
|
|
1997
|
+
(p) => {
|
|
1998
|
+
const g = p.data;
|
|
1999
|
+
a.current ? c(g) : o.current.push(g);
|
|
1973
2000
|
}
|
|
1974
2001
|
);
|
|
1975
2002
|
return () => {
|
|
1976
|
-
|
|
2003
|
+
d(), a.current = !1, o.current = [];
|
|
1977
2004
|
};
|
|
1978
2005
|
}, [r, e, n, c]);
|
|
1979
2006
|
const u = l.data;
|
|
1980
|
-
let
|
|
2007
|
+
let f = 0;
|
|
1981
2008
|
if (u != null && u.resources)
|
|
1982
|
-
for (const
|
|
1983
|
-
(
|
|
2009
|
+
for (const d of Object.values(u.resources))
|
|
2010
|
+
(d === F.WatchStateSynced || d === F.WatchStateError || d === F.WatchStateStopped || d === F.WatchStateFailed || d === F.WatchStateForbidden || d === F.WatchStateSkipped) && f++;
|
|
1984
2011
|
return {
|
|
1985
2012
|
/** Full summary query result */
|
|
1986
2013
|
summary: l,
|
|
1987
2014
|
/** Get the state of a specific resource type's watch */
|
|
1988
|
-
getResourceState: (
|
|
2015
|
+
getResourceState: (d) => u == null ? void 0 : u.resources[d],
|
|
1989
2016
|
/** Whether all registered watches have reached a terminal state */
|
|
1990
|
-
isFullySynced: u ? u.totalResources > 0 &&
|
|
2017
|
+
isFullySynced: u ? u.totalResources > 0 && f === u.totalResources : !1,
|
|
1991
2018
|
/** Sync progress as a 0-1 fraction (terminal states / total) */
|
|
1992
|
-
syncProgress: u && u.totalResources > 0 ?
|
|
2019
|
+
syncProgress: u && u.totalResources > 0 ? f / u.totalResources : 0,
|
|
1993
2020
|
/** Number of watches that encountered errors */
|
|
1994
2021
|
errorCount: (u == null ? void 0 : u.errorCount) ?? 0
|
|
1995
2022
|
};
|
|
1996
2023
|
}, Ps = () => {
|
|
1997
|
-
const [t, e] = G(/* @__PURE__ */ new Map()), n = q(/* @__PURE__ */ new Map()), r = q(/* @__PURE__ */ new Map()), s =
|
|
1998
|
-
const u = l.data,
|
|
1999
|
-
if (e((
|
|
2000
|
-
const
|
|
2001
|
-
return
|
|
2002
|
-
}), r.current.has(
|
|
2003
|
-
const
|
|
2004
|
-
e((
|
|
2005
|
-
const
|
|
2006
|
-
return
|
|
2007
|
-
}), n.current.delete(
|
|
2024
|
+
const [t, e] = G(/* @__PURE__ */ new Map()), n = q(/* @__PURE__ */ new Map()), r = q(/* @__PURE__ */ new Map()), s = k((l) => {
|
|
2025
|
+
const u = l.data, f = he(u), d = Ze(n.current, u), p = pe(d);
|
|
2026
|
+
if (e((g) => {
|
|
2027
|
+
const S = new Map(g);
|
|
2028
|
+
return S.set(f, p), S;
|
|
2029
|
+
}), r.current.has(f) && (clearTimeout(r.current.get(f)), r.current.delete(f)), ne(p)) {
|
|
2030
|
+
const g = setTimeout(() => {
|
|
2031
|
+
e((S) => {
|
|
2032
|
+
const m = new Map(S);
|
|
2033
|
+
return m.delete(f), m;
|
|
2034
|
+
}), n.current.delete(f), r.current.delete(f);
|
|
2008
2035
|
}, 5e3);
|
|
2009
|
-
r.current.set(
|
|
2036
|
+
r.current.set(f, g);
|
|
2010
2037
|
}
|
|
2011
2038
|
}, []);
|
|
2012
|
-
|
|
2013
|
-
const l =
|
|
2039
|
+
$(() => {
|
|
2040
|
+
const l = O("watch/STATE", s);
|
|
2014
2041
|
return () => {
|
|
2015
2042
|
l();
|
|
2016
2043
|
for (const u of r.current.values())
|
|
@@ -2029,7 +2056,7 @@ const Cs = ({
|
|
|
2029
2056
|
aggregateProgress: c
|
|
2030
2057
|
};
|
|
2031
2058
|
}, Ar = () => {
|
|
2032
|
-
const t =
|
|
2059
|
+
const t = w.useContext(Ke);
|
|
2033
2060
|
if (!t) throw new Error("useOperations must be used within an OperationsProvider");
|
|
2034
2061
|
return t;
|
|
2035
2062
|
}, Os = ({
|
|
@@ -2037,78 +2064,78 @@ const Cs = ({
|
|
|
2037
2064
|
connectionID: e,
|
|
2038
2065
|
resourceKey: n
|
|
2039
2066
|
}) => {
|
|
2040
|
-
const r = P(t), { showSnackbar: s } = W(), { addOperation: i, updateOperation: o } = Ar(), a =
|
|
2041
|
-
return
|
|
2067
|
+
const r = P(t), { showSnackbar: s } = W(), { addOperation: i, updateOperation: o } = Ar(), a = w.useRef([]);
|
|
2068
|
+
return w.useEffect(() => () => {
|
|
2042
2069
|
a.current.forEach((l) => l());
|
|
2043
|
-
}, []), { startStreamAction:
|
|
2044
|
-
async ({ actionID: l, id: u, namespace:
|
|
2070
|
+
}, []), { startStreamAction: w.useCallback(
|
|
2071
|
+
async ({ actionID: l, id: u, namespace: f, label: d, params: p = {} }) => {
|
|
2045
2072
|
try {
|
|
2046
|
-
const
|
|
2073
|
+
const g = await Xt(
|
|
2047
2074
|
r,
|
|
2048
2075
|
e,
|
|
2049
2076
|
n,
|
|
2050
2077
|
l,
|
|
2051
|
-
|
|
2078
|
+
Ue.createFrom({ id: u, namespace: f, params: p })
|
|
2052
2079
|
);
|
|
2053
2080
|
i({
|
|
2054
|
-
id:
|
|
2055
|
-
label:
|
|
2081
|
+
id: g,
|
|
2082
|
+
label: d,
|
|
2056
2083
|
resourceKey: n,
|
|
2057
2084
|
resourceName: u,
|
|
2058
|
-
namespace:
|
|
2085
|
+
namespace: f,
|
|
2059
2086
|
connectionID: e,
|
|
2060
2087
|
status: "running",
|
|
2061
2088
|
startedAt: Date.now()
|
|
2062
2089
|
});
|
|
2063
|
-
const
|
|
2064
|
-
var
|
|
2065
|
-
const
|
|
2066
|
-
switch (
|
|
2090
|
+
const S = `action/stream/${g}`, m = O(S, (y) => {
|
|
2091
|
+
var h, v, R, C;
|
|
2092
|
+
const _ = y.data;
|
|
2093
|
+
switch (_.type) {
|
|
2067
2094
|
case "progress": {
|
|
2068
|
-
const
|
|
2069
|
-
o(
|
|
2070
|
-
message:
|
|
2071
|
-
progress:
|
|
2095
|
+
const E = _.data ?? {};
|
|
2096
|
+
o(g, {
|
|
2097
|
+
message: E.message,
|
|
2098
|
+
progress: E.ready !== void 0 && E.desired !== void 0 ? { ready: E.ready, desired: E.desired } : void 0
|
|
2072
2099
|
});
|
|
2073
2100
|
break;
|
|
2074
2101
|
}
|
|
2075
2102
|
case "complete":
|
|
2076
|
-
o(
|
|
2103
|
+
o(g, {
|
|
2077
2104
|
status: "completed",
|
|
2078
|
-
message: ((
|
|
2105
|
+
message: ((h = _.data) == null ? void 0 : h.message) ?? "Completed",
|
|
2079
2106
|
completedAt: Date.now()
|
|
2080
|
-
}), s(((v =
|
|
2107
|
+
}), s(((v = _.data) == null ? void 0 : v.message) ?? d + " completed", "success"), ae(S);
|
|
2081
2108
|
break;
|
|
2082
2109
|
case "error":
|
|
2083
|
-
o(
|
|
2110
|
+
o(g, {
|
|
2084
2111
|
status: "error",
|
|
2085
|
-
message: ((R =
|
|
2112
|
+
message: ((R = _.data) == null ? void 0 : R.message) ?? "Failed",
|
|
2086
2113
|
completedAt: Date.now()
|
|
2087
|
-
}), s(((
|
|
2114
|
+
}), s(((C = _.data) == null ? void 0 : C.message) ?? d + " failed", "error"), ae(S);
|
|
2088
2115
|
break;
|
|
2089
2116
|
}
|
|
2090
2117
|
});
|
|
2091
2118
|
return a.current.push(() => {
|
|
2092
|
-
|
|
2093
|
-
}),
|
|
2094
|
-
} catch (
|
|
2095
|
-
throw z(s,
|
|
2119
|
+
m(), ae(S);
|
|
2120
|
+
}), g;
|
|
2121
|
+
} catch (g) {
|
|
2122
|
+
throw z(s, g, `Failed to start "${l}"`), g;
|
|
2096
2123
|
}
|
|
2097
2124
|
},
|
|
2098
2125
|
[r, e, n, i, o, s]
|
|
2099
2126
|
) };
|
|
2100
2127
|
};
|
|
2101
|
-
function
|
|
2128
|
+
function Dr(t, e) {
|
|
2102
2129
|
return `${t}/${e}/graph/CHANGED`;
|
|
2103
2130
|
}
|
|
2104
2131
|
function we(t, e, n, r) {
|
|
2105
2132
|
const s = j(), i = q(n);
|
|
2106
2133
|
i.current = n;
|
|
2107
2134
|
const o = JSON.stringify(n);
|
|
2108
|
-
|
|
2135
|
+
$(() => {
|
|
2109
2136
|
if (!r || !t || !e)
|
|
2110
2137
|
return;
|
|
2111
|
-
const a =
|
|
2138
|
+
const a = O(Dr(t, e), () => {
|
|
2112
2139
|
s.invalidateQueries({ queryKey: i.current, exact: !0 });
|
|
2113
2140
|
});
|
|
2114
2141
|
return () => {
|
|
@@ -2116,7 +2143,7 @@ function we(t, e, n, r) {
|
|
|
2116
2143
|
};
|
|
2117
2144
|
}, [s, t, e, o, r]);
|
|
2118
2145
|
}
|
|
2119
|
-
const
|
|
2146
|
+
const xr = {
|
|
2120
2147
|
owns: { outgoing: "Owns", incoming: "Owned by" },
|
|
2121
2148
|
runs_on: { outgoing: "Runs on", incoming: "Running here" },
|
|
2122
2149
|
uses: { outgoing: "Uses", incoming: "Used by" },
|
|
@@ -2126,7 +2153,7 @@ const Dr = {
|
|
|
2126
2153
|
selects: { outgoing: "Selects", incoming: "Selected by" }
|
|
2127
2154
|
};
|
|
2128
2155
|
function Ts(t, e) {
|
|
2129
|
-
const n =
|
|
2156
|
+
const n = xr[t];
|
|
2130
2157
|
if (n)
|
|
2131
2158
|
return n[e];
|
|
2132
2159
|
const r = t.replace(/_/g, " ");
|
|
@@ -2157,31 +2184,31 @@ const As = ({
|
|
|
2157
2184
|
enabled: a = !0,
|
|
2158
2185
|
refetchInterval: c = !1
|
|
2159
2186
|
}) => {
|
|
2160
|
-
const l = P(t), u = ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null],
|
|
2161
|
-
we(l, e, u,
|
|
2162
|
-
const
|
|
2187
|
+
const l = P(t), u = ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null], f = a && !!l && !!e && !!n && !!r;
|
|
2188
|
+
we(l, e, u, f);
|
|
2189
|
+
const d = T({
|
|
2163
2190
|
queryKey: u,
|
|
2164
2191
|
queryFn: async () => Vt(l, e, n, s, r, i, o ?? null),
|
|
2165
|
-
enabled:
|
|
2192
|
+
enabled: f,
|
|
2166
2193
|
refetchInterval: c
|
|
2167
|
-
}),
|
|
2194
|
+
}), p = {
|
|
2168
2195
|
pluginId: l,
|
|
2169
2196
|
connectionId: e,
|
|
2170
2197
|
resourceKey: n,
|
|
2171
2198
|
id: r,
|
|
2172
2199
|
namespace: s
|
|
2173
|
-
},
|
|
2200
|
+
}, g = d.data ?? [];
|
|
2174
2201
|
return {
|
|
2175
2202
|
/** One entry per edge, from the viewed resource's side. */
|
|
2176
|
-
related: kr(
|
|
2203
|
+
related: kr(p, g),
|
|
2177
2204
|
/** The raw graph edges. */
|
|
2178
|
-
edges:
|
|
2179
|
-
isLoading:
|
|
2180
|
-
isFetching:
|
|
2181
|
-
error:
|
|
2182
|
-
refetch:
|
|
2205
|
+
edges: g,
|
|
2206
|
+
isLoading: d.isLoading,
|
|
2207
|
+
isFetching: d.isFetching,
|
|
2208
|
+
error: d.error,
|
|
2209
|
+
refetch: d.refetch
|
|
2183
2210
|
};
|
|
2184
|
-
},
|
|
2211
|
+
}, Ds = ({
|
|
2185
2212
|
pluginID: t,
|
|
2186
2213
|
connectionID: e,
|
|
2187
2214
|
resourceKey: n,
|
|
@@ -2193,20 +2220,20 @@ const As = ({
|
|
|
2193
2220
|
}) => {
|
|
2194
2221
|
const c = P(t), l = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], u = o && !!c && !!e && !!n && !!r;
|
|
2195
2222
|
we(c, e, l, u);
|
|
2196
|
-
const
|
|
2223
|
+
const f = T({
|
|
2197
2224
|
queryKey: l,
|
|
2198
2225
|
queryFn: async () => en(c, e, n, s, r, i),
|
|
2199
2226
|
enabled: u,
|
|
2200
2227
|
refetchInterval: a
|
|
2201
2228
|
});
|
|
2202
2229
|
return {
|
|
2203
|
-
tree:
|
|
2204
|
-
isLoading:
|
|
2205
|
-
isFetching:
|
|
2206
|
-
error:
|
|
2207
|
-
refetch:
|
|
2230
|
+
tree: f.data ?? null,
|
|
2231
|
+
isLoading: f.isLoading,
|
|
2232
|
+
isFetching: f.isFetching,
|
|
2233
|
+
error: f.error,
|
|
2234
|
+
refetch: f.refetch
|
|
2208
2235
|
};
|
|
2209
|
-
},
|
|
2236
|
+
}, xs = ({
|
|
2210
2237
|
pluginID: t,
|
|
2211
2238
|
connectionID: e,
|
|
2212
2239
|
resourceKey: n,
|
|
@@ -2218,33 +2245,33 @@ const As = ({
|
|
|
2218
2245
|
}) => {
|
|
2219
2246
|
const c = P(t), l = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], u = a && !!c && !!e && !!n && !!r;
|
|
2220
2247
|
we(c, e, l, u);
|
|
2221
|
-
const
|
|
2248
|
+
const f = T({
|
|
2222
2249
|
queryKey: l,
|
|
2223
2250
|
queryFn: async () => tn(c, e, n, s, r, i, o),
|
|
2224
2251
|
enabled: u
|
|
2225
2252
|
});
|
|
2226
2253
|
return {
|
|
2227
|
-
graph:
|
|
2228
|
-
isLoading:
|
|
2229
|
-
isFetching:
|
|
2230
|
-
error:
|
|
2231
|
-
refetch:
|
|
2254
|
+
graph: f.data ?? null,
|
|
2255
|
+
isLoading: f.isLoading,
|
|
2256
|
+
isFetching: f.isFetching,
|
|
2257
|
+
error: f.error,
|
|
2258
|
+
refetch: f.refetch
|
|
2232
2259
|
};
|
|
2233
2260
|
}, Ns = () => {
|
|
2234
|
-
const t =
|
|
2261
|
+
const t = w.useContext(Qe);
|
|
2235
2262
|
if (!t)
|
|
2236
2263
|
throw new Error("useSettings must be used within a SettingsProvider");
|
|
2237
2264
|
return t;
|
|
2238
2265
|
}, ks = ({ to: t, withinContext: e, ...n }) => {
|
|
2239
|
-
const { pluginId: r } =
|
|
2266
|
+
const { pluginId: r } = ye();
|
|
2240
2267
|
r || console.error("Link used outside of a plugin context");
|
|
2241
2268
|
const s = `/_plugin/${r}${t.startsWith("/") ? "" : "/"}${t}`;
|
|
2242
|
-
return
|
|
2269
|
+
return w.useMemo(() => /* @__PURE__ */ x(dt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
|
|
2243
2270
|
};
|
|
2244
2271
|
function Ls() {
|
|
2245
|
-
const t = ft(), e = pt(), { pluginId: n } =
|
|
2272
|
+
const t = ft(), e = pt(), { pluginId: n } = ye();
|
|
2246
2273
|
n || console.error("usePluginRouter used outside of a plugin context");
|
|
2247
|
-
const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i =
|
|
2274
|
+
const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = k((o, a) => {
|
|
2248
2275
|
const { ...c } = a ?? {};
|
|
2249
2276
|
o.startsWith("/") ? t(`${r}${o}`, c) : t(o, c);
|
|
2250
2277
|
}, [t, r]);
|
|
@@ -2256,13 +2283,13 @@ function Ls() {
|
|
|
2256
2283
|
}
|
|
2257
2284
|
class Ms {
|
|
2258
2285
|
}
|
|
2259
|
-
class
|
|
2286
|
+
class qs {
|
|
2260
2287
|
constructor() {
|
|
2261
|
-
|
|
2288
|
+
D(this, "_extensions");
|
|
2262
2289
|
/**
|
|
2263
2290
|
* The root component to render for the application window.
|
|
2264
2291
|
*/
|
|
2265
|
-
|
|
2292
|
+
D(this, "root");
|
|
2266
2293
|
/**
|
|
2267
2294
|
* Various pages to render under the root component. These can be navigated to using
|
|
2268
2295
|
* the built-in navigation system both programatically and through Links.
|
|
@@ -2292,8 +2319,8 @@ class $s {
|
|
|
2292
2319
|
* ```
|
|
2293
2320
|
*
|
|
2294
2321
|
*/
|
|
2295
|
-
|
|
2296
|
-
|
|
2322
|
+
D(this, "pages");
|
|
2323
|
+
D(this, "_routes");
|
|
2297
2324
|
}
|
|
2298
2325
|
get extensions() {
|
|
2299
2326
|
return this._extensions || [];
|
|
@@ -2316,8 +2343,8 @@ class $s {
|
|
|
2316
2343
|
get Window() {
|
|
2317
2344
|
if (!this._routes && this.root)
|
|
2318
2345
|
return /* @__PURE__ */ x(this.root, {});
|
|
2319
|
-
const e =
|
|
2320
|
-
return /* @__PURE__ */ x(
|
|
2346
|
+
const e = gt(this._routes || []);
|
|
2347
|
+
return /* @__PURE__ */ x(yt, { router: e });
|
|
2321
2348
|
}
|
|
2322
2349
|
/**
|
|
2323
2350
|
* Register extension points for other plugins to extend the functionality
|
|
@@ -2350,56 +2377,56 @@ class $s {
|
|
|
2350
2377
|
}
|
|
2351
2378
|
}
|
|
2352
2379
|
var Lr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Lr || {});
|
|
2353
|
-
const
|
|
2380
|
+
const Us = (t) => {
|
|
2354
2381
|
const e = t.split("::");
|
|
2355
2382
|
return e.length === 1 ? { group: "core", version: "", kind: e[0] } : {
|
|
2356
2383
|
group: e[0] || "core",
|
|
2357
2384
|
version: e[1] || "",
|
|
2358
2385
|
kind: e[2] || e[0]
|
|
2359
2386
|
};
|
|
2360
|
-
},
|
|
2387
|
+
}, $s = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
2361
2388
|
export {
|
|
2362
2389
|
B as ALL_SESSIONS_KEY,
|
|
2363
2390
|
mn as BottomDrawerContext,
|
|
2364
2391
|
_n as ConfirmationModalContext,
|
|
2365
|
-
|
|
2392
|
+
U as ErrorTypes,
|
|
2366
2393
|
es as ExtensionPointRegistry,
|
|
2367
2394
|
Fn as ExtensionPointStore,
|
|
2368
2395
|
Vr as ExtensionProvider,
|
|
2369
2396
|
ks as Link,
|
|
2370
2397
|
Ke as OperationsContext,
|
|
2371
2398
|
Zr as OperationsProvider,
|
|
2372
|
-
|
|
2399
|
+
ge as PluginContext,
|
|
2373
2400
|
zr as PluginContextProvider,
|
|
2374
2401
|
Lr as PluginErrorCode,
|
|
2375
|
-
|
|
2402
|
+
qs as PluginWindow,
|
|
2376
2403
|
Ms as PluginWindowRootProps,
|
|
2377
2404
|
Sn as RightDrawerContext,
|
|
2378
2405
|
Qe as SettingsContext,
|
|
2379
2406
|
Jr as SettingsProvider,
|
|
2380
2407
|
ts as SnackbarProvider,
|
|
2381
2408
|
F as WatchState,
|
|
2382
|
-
|
|
2409
|
+
yn as actionToSnackbar,
|
|
2383
2410
|
Or as applyBatch,
|
|
2384
2411
|
Pn as connectionListQueryKey,
|
|
2385
|
-
|
|
2412
|
+
L as createErrorHandler,
|
|
2386
2413
|
hn as defaultState,
|
|
2387
|
-
|
|
2388
|
-
|
|
2414
|
+
$s as formatGroup,
|
|
2415
|
+
Dr as graphChangedEvent,
|
|
2389
2416
|
Ge as isCancelledError,
|
|
2390
2417
|
Q as parseAppError,
|
|
2391
|
-
|
|
2418
|
+
Us as parseResourceKey,
|
|
2392
2419
|
Ts as relationshipLabel,
|
|
2393
2420
|
z as showAppError,
|
|
2394
2421
|
kr as toRelatedResources,
|
|
2395
2422
|
Ps as useActiveSyncs,
|
|
2396
2423
|
Xe as useBottomDrawer,
|
|
2397
|
-
|
|
2424
|
+
ys as useConfirmationModal,
|
|
2398
2425
|
ns as useConnection,
|
|
2399
2426
|
ss as useConnectionNamespaces,
|
|
2400
2427
|
os as useConnectionStatus,
|
|
2401
2428
|
rs as useConnections,
|
|
2402
|
-
|
|
2429
|
+
Ds as useDependencyTree,
|
|
2403
2430
|
Fs as useEditorSchemas,
|
|
2404
2431
|
Tr as useEventBatcher,
|
|
2405
2432
|
cs as useExec,
|
|
@@ -2411,7 +2438,7 @@ export {
|
|
|
2411
2438
|
Tn as useMetricProvidersForResource,
|
|
2412
2439
|
fs as useMetricStream,
|
|
2413
2440
|
Ar as useOperations,
|
|
2414
|
-
|
|
2441
|
+
ye as usePluginContext,
|
|
2415
2442
|
is as usePluginData,
|
|
2416
2443
|
Ls as usePluginRouter,
|
|
2417
2444
|
Yr as usePluginSettings,
|
|
@@ -2422,11 +2449,11 @@ export {
|
|
|
2422
2449
|
hs as useResource,
|
|
2423
2450
|
vs as useResourceActions,
|
|
2424
2451
|
ms as useResourceAreaComponent,
|
|
2425
|
-
|
|
2452
|
+
xs as useResourceGraph,
|
|
2426
2453
|
Ss as useResourceGroups,
|
|
2427
2454
|
ds as useResourceMetrics,
|
|
2428
2455
|
bs as useResourceMutations,
|
|
2429
|
-
|
|
2456
|
+
gs as useResourcePortForwarder,
|
|
2430
2457
|
_s as useResourceSearch,
|
|
2431
2458
|
Es as useResourceType,
|
|
2432
2459
|
ws as useResourceTypes,
|