@omniviewdev/runtime 0.4.1 → 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.
Files changed (37) hide show
  1. package/dist/api.cjs +1 -1
  2. package/dist/api.js +246 -113
  3. package/dist/bindings/events/index.d.ts +140 -0
  4. package/dist/bindings/github.com/omniviewdev/omniview/appservice.d.ts +5 -0
  5. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/devserver/index.d.ts +1 -1
  6. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/devserver/models.d.ts +24 -26
  7. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/devserver/servicewrapper.d.ts +0 -1
  8. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/index.d.ts +1 -1
  9. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/models.d.ts +36 -0
  10. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graphservice.d.ts +6 -0
  11. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/servicewrapper.d.ts +2 -0
  12. package/dist/bindings/github.com/omniviewdev/omniview/internal/devcontract/index.d.ts +1 -0
  13. package/dist/bindings/github.com/omniviewdev/omniview/internal/devcontract/models.d.ts +101 -0
  14. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/config/index.d.ts +1 -1
  15. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/config/models.d.ts +31 -0
  16. package/dist/errors/types.d.ts +2 -0
  17. package/dist/graphservice-Cb7rr7SB.cjs +1 -0
  18. package/dist/graphservice-DloOtC_7.js +739 -0
  19. package/dist/hooks/resource/index.d.ts +2 -0
  20. package/dist/hooks/resource/useDependencyTree.d.ts +2 -2
  21. package/dist/hooks/resource/useRefetchOnGraphChange.d.ts +11 -0
  22. package/dist/hooks/resource/useRelatedResources.d.ts +2 -3
  23. package/dist/hooks/resource/useResourceGraph.d.ts +46 -0
  24. package/dist/index.cjs +2 -2
  25. package/dist/index.js +874 -797
  26. package/dist/models-8-4Ny_ft.cjs +1 -0
  27. package/dist/{models-BoBl5Kgj.js → models-BlTzZkmp.js} +46 -60
  28. package/dist/models-CGYstu7u.cjs +1 -0
  29. package/dist/{models-BvR5jdms.js → models-D-vu7j83.js} +520 -449
  30. package/dist/models.cjs +1 -1
  31. package/dist/models.d.ts +2 -2
  32. package/dist/models.js +67 -64
  33. package/package.json +5 -5
  34. package/dist/graphservice-CRRwkBcy.cjs +0 -1
  35. package/dist/graphservice-CXr8ZCEY.js +0 -726
  36. package/dist/models-CHycLCM0.cjs +0 -1
  37. package/dist/models-DOdc96z9.cjs +0 -1
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- var it = Object.defineProperty;
2
- var at = (t, e, n) => e in t ? it(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var T = (t, e, n) => at(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { jsx as A, jsxs as X } from "react/jsx-runtime";
5
- import b, { useContext as Y, createContext as re, useState as q, useCallback as k, useSyncExternalStore as ct, useRef as W, useEffect as G, useMemo as ut } from "react";
6
- import { Link as lt, useNavigate as dt, useLocation as ft, createMemoryRouter as pt, RouterProvider as yt } from "react-router-dom";
7
- import { P as gt, G as ht, V as mt, S as St, a as Ie, U as _t, R as wt, b as Et, c as De, d as Ct, L as bt, e as vt, f as Rt, g as Ft, h as It, i as Dt, j as Pt, C as Ot, k as Tt, l as At, m as xt, n as Nt, Q as Lt, o as kt, p as Ee, q as Mt, r as Pe, F as $t, s as Ut, t as Oe, D as Te, u as qt, v as Wt, w as Gt, x as Ae, y as jt, z as Qt, A as xe, B as Kt, E as Bt, H as Ht, I as zt, J as Yt, K as Jt, M as Zt, N as Xt, O as Vt } from "./graphservice-CXr8ZCEY.js";
8
- import { P as en, W as tn, S as nn, C as rn, L as sn, F as on, a as an, U as Ne, D as Le, G as cn, b as ke, c as Me, A as $e } from "./models-BvR5jdms.js";
9
- import { useQueryClient as j, useMutation as P, useQuery as O, keepPreviousData as Ue, useQueries as un } from "@tanstack/react-query";
10
- import { useToast as ln } from "@omniviewdev/base-ui";
1
+ var at = Object.defineProperty;
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 D = (t, e, n) => ct(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { jsx as x, jsxs as X } from "react/jsx-runtime";
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 { O as x, a as qe, b as ae } from "./events-DDTGFACO.js";
13
- import { w as dn } from "./legacyEnum-DORXlU_y.js";
14
- const ye = b.createContext(void 0), $ = {
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
+ import { w as pn } from "./legacyEnum-DORXlU_y.js";
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 fn(t) {
47
+ function gn(t) {
46
48
  switch (t) {
47
49
  case "NOT_FOUND":
48
- return { typeUri: $.RESOURCE_NOT_FOUND, status: 404 };
50
+ return { typeUri: U.RESOURCE_NOT_FOUND, status: 404 };
49
51
  case "FORBIDDEN":
50
- return { typeUri: $.RESOURCE_FORBIDDEN, status: 403 };
52
+ return { typeUri: U.RESOURCE_FORBIDDEN, status: 403 };
51
53
  case "UNAUTHORIZED":
52
- return { typeUri: $.RESOURCE_UNAUTHORIZED, status: 401 };
54
+ return { typeUri: U.RESOURCE_UNAUTHORIZED, status: 401 };
53
55
  case "CONFLICT":
54
56
  case "ALREADY_EXISTS":
55
- return { typeUri: $.RESOURCE_CONFLICT, status: 409 };
57
+ return { typeUri: U.RESOURCE_CONFLICT, status: 409 };
56
58
  case "TIMEOUT":
57
- return { typeUri: $.RESOURCE_TIMEOUT, status: 408 };
59
+ return { typeUri: U.RESOURCE_TIMEOUT, status: 408 };
58
60
  case "CONNECTION_ERROR":
59
- return { typeUri: $.RESOURCE_CONNECTION_ERROR, status: 503 };
61
+ return { typeUri: U.RESOURCE_CONNECTION_ERROR, status: 503 };
60
62
  case "CERTIFICATE_ERROR":
61
- return { typeUri: $.RESOURCE_CERTIFICATE_ERROR, status: 502 };
63
+ return { typeUri: U.RESOURCE_CERTIFICATE_ERROR, status: 502 };
62
64
  default:
63
- return { typeUri: $.INTERNAL, status: 500 };
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: $.INTERNAL,
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 } = fn(n.code);
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: $.INTERNAL,
95
+ type: U.INTERNAL,
94
96
  title: "Error",
95
97
  status: 500,
96
98
  detail: e
97
99
  };
98
100
  }
99
- function We(t) {
100
- return t == null ? !1 : (typeof t == "string" ? t : t instanceof Error ? t.message : String(t)) === "cancelled" ? !0 : Q(t).type === $.CANCELLED;
101
+ function Ge(t) {
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 pn(t) {
104
+ function yn(t) {
103
105
  switch (t.type) {
104
106
  case "navigate":
105
107
  return {
@@ -136,7 +138,7 @@ function pn(t) {
136
138
  };
137
139
  }
138
140
  }
139
- function Ge(t, e) {
141
+ function je(t, e) {
140
142
  var s, i;
141
143
  const n = [
142
144
  t.detail,
@@ -147,46 +149,67 @@ function Ge(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(pn)
152
+ actions: (i = t.actions) == null ? void 0 : i.map(yn)
151
153
  };
152
154
  }
153
155
  function z(t, e, n) {
154
- if (We(e)) return;
156
+ if (Ge(e)) return;
155
157
  const r = Q(e);
156
- t(Ge(r, n));
158
+ t(je(r, n));
157
159
  }
158
160
  function L(t, e) {
159
161
  return (n) => {
160
- if (We(n)) return;
162
+ if (Ge(n)) return;
161
163
  const r = Q(n);
162
- t(Ge(r, r.title !== "Error" ? r.title : e));
164
+ t(je(r, r.title !== "Error" ? r.title : e));
163
165
  };
164
166
  }
165
- function Br(t) {
166
- const { children: e, pluginId: n } = t, [r, s] = b.useState({}), [i, o] = b.useState(new en()), [a, c] = b.useState(!1), [l, u] = b.useState(null);
167
+ function zr(t) {
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 y = () => {
169
- n === void 0 || n === "" || (console.debug(`[PluginContextProvider] fetching settings for "${n}"`), gt(n).then((d) => {
170
- console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(d)), s(d);
171
- }).catch((d) => {
172
- const p = Q(d);
173
- console.error(`[PluginContextProvider] error fetching settings for "${n}":`, p.detail);
174
- }));
175
- }, f = () => {
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);
179
+ console.error(`[PluginContextProvider] error fetching settings for "${n}":`, y.detail);
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
- console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), ht(n).then((d) => {
181
- console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: d == null ? void 0 : d.name, version: d == null ? void 0 : d.version }), o(d), c(!0);
182
- }).catch((d) => {
183
- const p = Q(d);
184
- console.error(`[PluginContextProvider] error fetching meta for "${n}":`, p.detail), u(p.detail), c(!1);
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);
192
+ console.error(`[PluginContextProvider] error fetching meta for "${n}":`, y.detail), u(y.detail), c(!1);
185
193
  });
186
- };
187
- return b.useEffect(() => {
188
- console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), y(), f();
189
- }, [n]), l ? /* @__PURE__ */ A("div", { style: {
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",
@@ -203,17 +226,17 @@ function Br(t) {
203
226
  }, children: [
204
227
  /* @__PURE__ */ X("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
205
228
  /* @__PURE__ */ X("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
206
- /* @__PURE__ */ A("circle", { cx: "12", cy: "12", r: "10" }),
207
- /* @__PURE__ */ A("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
208
- /* @__PURE__ */ A("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
229
+ /* @__PURE__ */ x("circle", { cx: "12", cy: "12", r: "10" }),
230
+ /* @__PURE__ */ x("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
231
+ /* @__PURE__ */ x("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
209
232
  ] }),
210
- /* @__PURE__ */ A("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
233
+ /* @__PURE__ */ x("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
211
234
  ] }),
212
- /* @__PURE__ */ A("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
213
- /* @__PURE__ */ A(
235
+ /* @__PURE__ */ x("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
236
+ /* @__PURE__ */ x(
214
237
  "button",
215
238
  {
216
- onClick: () => f(),
239
+ onClick: () => g(),
217
240
  style: {
218
241
  background: "transparent",
219
242
  color: "#F87171",
@@ -227,13 +250,13 @@ function Br(t) {
227
250
  children: "Retry"
228
251
  }
229
252
  )
230
- ] }) }) : a ? /* @__PURE__ */ A(ye.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ X("div", { style: {
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",
234
257
  justifyContent: "center"
235
258
  }, children: [
236
- /* @__PURE__ */ A("div", { style: {
259
+ /* @__PURE__ */ x("div", { style: {
237
260
  width: 24,
238
261
  height: 24,
239
262
  border: "2px solid #3F3F46",
@@ -241,34 +264,38 @@ function Br(t) {
241
264
  borderRadius: "50%",
242
265
  animation: "plugin-spin 0.8s linear infinite"
243
266
  } }),
244
- /* @__PURE__ */ A("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
267
+ /* @__PURE__ */ x("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
245
268
  ] });
246
269
  }
247
- function ge() {
248
- const t = Y(ye);
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
- function Hr() {
254
- return ge().settings;
276
+ function Yr() {
277
+ return ye().settings;
255
278
  }
256
- const je = re(void 0), zr = ({ children: t }) => {
257
- const [e, n] = q({}), r = () => {
258
- mt().then((i) => {
259
- console.log("Fetched settings:", i), n(i);
260
- }).catch((i) => {
261
- console.error("Error fetching settings:", i);
279
+ const Qe = re(void 0), Jr = ({ children: t }) => {
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
- const s = () => {
268
- r();
269
- };
270
- return /* @__PURE__ */ A(je.Provider, { value: { settings: e, reload: s }, children: t });
271
- }, yn = {
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 });
298
+ }, hn = {
272
299
  height: 32,
273
300
  focused: 0,
274
301
  tabs: [],
@@ -292,30 +319,30 @@ const je = re(void 0), zr = ({ children: t }) => {
292
319
  },
293
320
  fullscreenDrawer: () => {
294
321
  }
295
- }, gn = b.createContext(yn), hn = re(void 0), mn = b.createContext(void 0), Qe = b.createContext(void 0), Sn = 3e4, Yr = ({ children: t }) => {
296
- const [e, n] = b.useState([]), r = b.useCallback((a) => {
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 = b.useCallback((a, c) => {
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 = b.useCallback((a) => {
329
+ }, []), i = w.useCallback((a) => {
303
330
  n((c) => c.filter((l) => l.id !== a));
304
331
  }, []);
305
- b.useEffect(() => {
332
+ w.useEffect(() => {
306
333
  const a = [];
307
334
  for (const c of e)
308
335
  if (c.status === "completed" || c.status === "error") {
309
- const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, Sn - l);
336
+ const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, En - l);
310
337
  a.push(setTimeout(() => i(c.id), u));
311
338
  }
312
339
  return () => a.forEach(clearTimeout);
313
340
  }, [e, i]);
314
- const o = b.useMemo(
341
+ const o = w.useMemo(
315
342
  () => ({ operations: e, addOperation: r, updateOperation: s, removeOperation: i }),
316
343
  [e, r, s, i]
317
344
  );
318
- return /* @__PURE__ */ A(Qe.Provider, { value: o, children: t });
345
+ return /* @__PURE__ */ x(Ke.Provider, { value: o, children: t });
319
346
  };
320
347
  var de = function(t, e) {
321
348
  return de = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
@@ -324,7 +351,7 @@ var de = function(t, e) {
324
351
  for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
325
352
  }, de(t, e);
326
353
  };
327
- function _n(t, e) {
354
+ function wn(t, e) {
328
355
  if (typeof e != "function" && e !== null)
329
356
  throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
330
357
  de(t, e);
@@ -333,28 +360,28 @@ function _n(t, e) {
333
360
  }
334
361
  t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
335
362
  }
336
- var ce = "Invariant Violation", Ce = Object.setPrototypeOf, wn = Ce === void 0 ? function(t, e) {
363
+ var ce = "Invariant Violation", be = Object.setPrototypeOf, Cn = be === void 0 ? function(t, e) {
337
364
  return t.__proto__ = e, t;
338
- } : Ce, En = (
365
+ } : be, bn = (
339
366
  /** @class */
340
367
  function(t) {
341
- _n(e, t);
368
+ wn(e, t);
342
369
  function e(n) {
343
370
  n === void 0 && (n = ce);
344
371
  var r = t.call(this, typeof n == "number" ? ce + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
345
- return r.framesToPop = 1, r.name = ce, wn(r, e.prototype), r;
372
+ return r.framesToPop = 1, r.name = ce, Cn(r, e.prototype), r;
346
373
  }
347
374
  return e;
348
375
  }(Error)
349
376
  );
350
377
  function fe(t, e) {
351
378
  if (!t)
352
- throw new En(e);
379
+ throw new bn(e);
353
380
  }
354
- var Ke = ["debug", "log", "warn", "error", "silent"], Cn = Ke.indexOf("log");
381
+ var He = ["debug", "log", "warn", "error", "silent"], vn = He.indexOf("log");
355
382
  function V(t) {
356
383
  return function() {
357
- if (Ke.indexOf(t) >= Cn) {
384
+ if (He.indexOf(t) >= vn) {
358
385
  var e = console[t] || console.log;
359
386
  return e.apply(console, arguments);
360
387
  }
@@ -363,9 +390,9 @@ function V(t) {
363
390
  (function(t) {
364
391
  t.debug = V("debug"), t.log = V("log"), t.warn = V("warn"), t.error = V("error");
365
392
  })(fe || (fe = {}));
366
- const Be = re(void 0), bn = () => Y(Be);
367
- function Jr(t) {
368
- const e = bn(), n = b.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = k(
393
+ const Be = re(void 0), Rn = () => Y(Be);
394
+ function Xr(t) {
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)), () => {
@@ -388,30 +415,30 @@ function Jr(t) {
388
415
  const c = {};
389
416
  return n.current = { store: o, version: o.version, sentinel: c }, c;
390
417
  }, [e, t]);
391
- return ct(s, i), e == null ? void 0 : e.getExtensionPoint(t);
418
+ return ut(s, i), e == null ? void 0 : e.getExtensionPoint(t);
392
419
  }
393
- const Zr = ({ registry: t, children: e }) => {
394
- const n = b.useRef(t);
420
+ const Vr = ({ registry: t, children: e }) => {
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"
398
- ), /* @__PURE__ */ A(Be.Provider, { value: n.current, children: e });
425
+ ), /* @__PURE__ */ x(Be.Provider, { value: n.current, children: e });
399
426
  }, ue = (t) => {
400
427
  if (!t || typeof t != "string")
401
428
  throw new TypeError(`extensionName is required to be a string and can't be: "${t}" (${typeof t})`);
402
429
  return t.trim();
403
430
  };
404
- class vn {
431
+ class Fn {
405
432
  constructor(e) {
406
- T(this, "id");
407
- T(this, "mode");
408
- T(this, "_pluginId");
409
- T(this, "_version", 0);
410
- T(this, "_contributions", /* @__PURE__ */ new Map());
411
- T(this, "_lookupCache", /* @__PURE__ */ new Map());
412
- T(this, "_matcher");
413
- T(this, "_select");
414
- T(this, "_listeners", /* @__PURE__ */ new Set());
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() {
@@ -521,11 +548,11 @@ class vn {
521
548
  e();
522
549
  }
523
550
  }
524
- class Xr {
551
+ class es {
525
552
  constructor(e) {
526
- T(this, "_stores", /* @__PURE__ */ new Map());
527
- T(this, "_storeUnsubs", /* @__PURE__ */ new Map());
528
- T(this, "_listeners", /* @__PURE__ */ new Set());
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);
@@ -542,7 +569,7 @@ class Xr {
542
569
  `Extension point "${n}" already exists (owned by "${s.pluginId ?? "unknown"}")`
543
570
  );
544
571
  }
545
- const r = new vn({ ...e, id: n });
572
+ const r = new Fn({ ...e, id: n });
546
573
  this._stores.set(n, r), this._storeUnsubs.set(n, r.subscribe(() => this._notify())), this._notify();
547
574
  }
548
575
  /**
@@ -597,79 +624,79 @@ class Xr {
597
624
  e();
598
625
  }
599
626
  }
600
- const He = re(void 0), Rn = {
627
+ const ze = re(void 0), In = {
601
628
  default: "info",
602
629
  info: "info",
603
630
  success: "success",
604
631
  warning: "warning",
605
632
  error: "danger"
606
- }, Vr = ({ children: t }) => {
607
- const { toast: e } = ln(), [n, r] = b.useState([]), s = (o) => {
633
+ }, ts = ({ children: t }) => {
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 = "", y = "info", f, d = 5e3, p;
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
- y = o.status, f = o.details, d = o.autoHideDuration ?? 5e3, p = o.actions;
645
+ f = o.status, d = o.details, p = o.autoHideDuration ?? 5e3, g = o.actions;
619
646
  } else
620
- u = o, y = a, f = c;
621
- e(f ?? u, {
622
- severity: Rn[y] ?? "info",
623
- title: f ? u : void 0,
624
- duration: d,
625
- action: p == null ? void 0 : p[0]
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
- return /* @__PURE__ */ A(He.Provider, { value: { showSnackbar: i }, children: t });
629
- }, U = () => {
630
- const t = Y(He);
655
+ return /* @__PURE__ */ x(ze.Provider, { value: { showSnackbar: i }, children: t });
656
+ }, W = () => {
657
+ const t = Y(ze);
631
658
  if (t === void 0)
632
659
  throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
633
660
  return t;
634
661
  };
635
- function D(t) {
636
- const e = Y(ye), n = (e == null ? void 0 : e.pluginId) ?? t;
662
+ function P(t) {
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"
640
667
  );
641
668
  return n;
642
669
  }
643
- const es = ({ pluginID: t, connectionID: e }) => {
644
- const n = D(t), r = j(), { showSnackbar: s } = U(), i = [n, "connection", "detail", e], { mutateAsync: o } = P({
645
- mutationFn: async () => St(n, e),
646
- onSuccess(y) {
647
- r.setQueryData(i, y), r.invalidateQueries({
670
+ const ns = ({ pluginID: t, connectionID: e }) => {
671
+ const n = P(t), r = j(), { showSnackbar: s } = W(), i = [n, "connection", "detail", e], { mutateAsync: o } = A({
672
+ mutationFn: async () => _t(n, e),
673
+ onSuccess(f) {
674
+ r.setQueryData(i, f), r.invalidateQueries({
648
675
  queryKey: ["EDITOR_SCHEMAS", n, e]
649
676
  });
650
677
  },
651
678
  onError: L(s, "Failed to start connection")
652
- }), { mutateAsync: a } = P({
653
- mutationFn: async () => Ie(n, e),
654
- onSuccess(y) {
655
- r.setQueryData(i, y);
679
+ }), { mutateAsync: a } = A({
680
+ mutationFn: async () => Pe(n, e),
681
+ onSuccess(f) {
682
+ r.setQueryData(i, f);
656
683
  },
657
684
  onError: L(s, "Failed to stop connection")
658
- }), { mutateAsync: c } = P({
659
- mutationFn: async (y) => _t(n, y),
660
- onSuccess(y, { name: f }) {
661
- s({ message: `Connection ${f} successfully updated`, status: "success" }), r.setQueryData(i, y), r.setQueriesData(
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
- (d) => d == null ? void 0 : d.map((p) => p.id === e ? y : p)
690
+ (p) => p == null ? void 0 : p.map((g) => g.id === e ? f : g)
664
691
  );
665
692
  },
666
693
  onError: L(s, "Failed to update connection")
667
- }), { mutateAsync: l } = P({
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
- (y) => y == null ? void 0 : y.filter((f) => f.id !== e)
699
+ (f) => f == null ? void 0 : f.filter((d) => d.id !== e)
673
700
  );
674
701
  },
675
702
  onError: L(s, "Failed to remove connection")
@@ -678,9 +705,9 @@ const es = ({ pluginID: t, connectionID: e }) => {
678
705
  /**
679
706
  * Get the connection
680
707
  */
681
- connection: O({
708
+ connection: T({
682
709
  queryKey: i,
683
- queryFn: async () => Et(n, e)
710
+ queryFn: async () => Ct(n, e)
684
711
  }),
685
712
  /**
686
713
  * Start the connection
@@ -699,51 +726,51 @@ const es = ({ pluginID: t, connectionID: e }) => {
699
726
  */
700
727
  deleteConnection: l
701
728
  };
702
- }, Fn = (t) => [t, "connection", "list"], ts = ({ plugin: t }) => {
703
- const e = D(t), n = j(), { showSnackbar: r } = U(), s = Fn(e), { mutateAsync: i } = P({
704
- mutationFn: async (l) => De(e, l.id),
729
+ }, Pn = (t) => [t, "connection", "list"], rs = ({ plugin: t }) => {
730
+ const e = P(t), n = j(), { showSnackbar: r } = W(), s = Pn(e), { mutateAsync: i } = A({
731
+ mutationFn: async (l) => Oe(e, l.id),
705
732
  onError: L(r, "Failed to start connection watch")
706
- }), { mutateAsync: o } = P({
707
- mutationFn: async (l) => Ct(e, l.id),
733
+ }), { mutateAsync: o } = A({
734
+ mutationFn: async (l) => bt(e, l.id),
708
735
  onError: L(r, "Failed to stop connection watch")
709
- }), a = b.useCallback((l) => {
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 b.useEffect(() => {
714
- const l = x(`${e}/connection/sync`, a);
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: O({
746
+ connections: T({
720
747
  queryKey: s,
721
748
  queryFn: async () => {
722
749
  try {
723
- return await bt(e);
750
+ return await vt(e);
724
751
  } catch (l) {
725
752
  console.log(l), L(r, "Failed to load connections")(l);
726
753
  }
727
754
  return [];
728
755
  },
729
756
  staleTime: 3e4,
730
- placeholderData: Ue
757
+ placeholderData: We
731
758
  }),
732
759
  startWatch: i,
733
760
  stopWatch: o
734
761
  };
735
- }, ns = ({ pluginID: t, connectionID: e }) => {
736
- const n = D(t);
762
+ }, ss = ({ pluginID: t, connectionID: e }) => {
763
+ const n = P(t);
737
764
  return {
738
765
  /**
739
766
  * Get the connection
740
767
  */
741
- namespaces: O({
768
+ namespaces: T({
742
769
  queryKey: [n, "connection", "namespaces", e],
743
- queryFn: async () => vt(n, e)
770
+ queryFn: async () => Rt(n, e)
744
771
  })
745
772
  };
746
- }, F = dn(tn, "WatchState");
773
+ }, F = pn(rn, "WatchState");
747
774
  function pe(t) {
748
775
  const e = Object.values(t.states), n = e.length;
749
776
  let r = 0, s = 0, i = 0, o = 0;
@@ -768,17 +795,17 @@ function pe(t) {
768
795
  function ne(t) {
769
796
  return t.watchedTotal > 0 && t.doneCount >= t.watchedTotal;
770
797
  }
771
- function ze(t) {
798
+ function Ye(t) {
772
799
  return t.some((e) => !ne(e));
773
800
  }
774
- function Ye(t) {
801
+ function Je(t) {
775
802
  const e = t.reduce((r, s) => r + s.watchedTotal, 0);
776
803
  return e === 0 ? 0 : t.reduce((r, s) => r + s.doneCount, 0) / e;
777
804
  }
778
805
  function he(t) {
779
806
  return `${t.pluginId}/${t.connection}`;
780
807
  }
781
- function Je(t, e) {
808
+ function Ze(t, e) {
782
809
  const n = he(e);
783
810
  t.has(n) || t.set(n, {
784
811
  states: {},
@@ -788,155 +815,155 @@ function Je(t, e) {
788
815
  const r = t.get(n);
789
816
  return r.states[e.resourceKey] = e.state, r;
790
817
  }
791
- function rs() {
792
- const [t, e] = q(/* @__PURE__ */ new Set()), [n, r] = q({}), [s, i] = q(/* @__PURE__ */ new Map()), o = W(/* @__PURE__ */ new Map()), [a, c] = q(/* @__PURE__ */ new Map());
793
- G(() => {
794
- const g = x("plugin/crash_recovery_failed", (R) => {
795
- const w = R.data, S = w == null ? void 0 : w.pluginID;
796
- S && c((E) => {
797
- const I = new Map(E);
798
- return I.set(S, w.error ?? "Crash recovery failed"), I;
818
+ function os() {
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());
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 = x("plugin/recovered", (R) => {
801
- const w = R.data, S = w == null ? void 0 : w.pluginID;
802
- S && c((E) => {
803
- if (!E.has(S)) return E;
804
- const I = new Map(E);
805
- return I.delete(S), I;
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
- g(), v();
836
+ h(), v();
810
837
  };
811
- }, []), G(() => {
812
- Rt().then((g) => {
813
- if (!g) return;
814
- const v = {}, R = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map();
815
- for (const [S, E] of Object.entries(g))
816
- if (E) {
817
- v[S] = E.map((I) => I.connection);
818
- for (const I of E) {
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 = `${S}/${I.connection.id}`;
847
+ const M = `${E}/${I.connection.id}`;
821
848
  R.add(M);
822
849
  const N = {
823
- pluginID: S,
850
+ pluginID: E,
824
851
  connectionID: I.connection.id,
825
852
  states: {}
826
853
  };
827
854
  if (I.resources)
828
- for (const [ie, ot] of Object.entries(I.resources))
829
- N.states[ie] = ot;
830
- o.current.set(M, N), w.set(M, pe(N));
855
+ for (const [ie, it] of Object.entries(I.resources))
856
+ N.states[ie] = it;
857
+ o.current.set(M, N), C.set(M, pe(N));
831
858
  }
832
859
  }
833
- r(v), e(R), i(w);
860
+ r(v), e(R), i(C);
834
861
  }).catch(() => {
835
862
  });
836
- }, []), G(() => x("connection/status", (v) => {
837
- const R = v.data, w = `${R.pluginID}/${R.connectionID}`;
838
- R.status === "DISCONNECTED" ? (e((S) => {
839
- const E = new Set(S);
840
- return E.delete(w), E;
841
- }), i((S) => {
842
- const E = new Map(S);
843
- return E.delete(w), E;
844
- }), o.current.delete(w)) : e((S) => {
845
- const E = new Set(S);
846
- return E.add(w), E;
847
- }), It().then((S) => {
848
- if (!S) return;
849
- const E = {};
850
- for (const [I, M] of Object.entries(S))
851
- M != null && (E[I] = M);
852
- r(E);
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 = k((g) => {
857
- const v = g.data, R = he(v);
858
- e((E) => {
859
- if (E.has(R)) return E;
860
- const I = new Set(E);
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 w = Je(o.current, v), S = pe(w);
864
- i((E) => {
865
- const I = new Map(E);
866
- return I.set(R, S), I;
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
- G(() => x("watch/STATE", l), [l]);
870
- const u = k(async (g, v) => {
871
- await Ie(g, v);
872
- }, []), y = k(async (g, v) => {
873
- await De(g, v);
874
- }, []), f = k(async (g) => {
875
- const v = a.get(g);
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(g)) return R;
878
- const w = new Map(R);
879
- return w.delete(g), w;
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 Ft(g);
909
+ await It(h);
883
910
  } catch (R) {
884
- throw c((w) => {
885
- const S = new Map(w);
886
- return S.set(g, v ?? "Reload failed"), S;
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]), d = [];
890
- for (const g of t) {
891
- const [v, R] = g.split("/", 2), S = (n[v] ?? []).find((ie) => ie.id === R), E = s.get(g), I = E != null && !ne(E), M = E != null && E.errorCount > 0, N = a.get(v);
892
- d.push({
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: (S == null ? void 0 : S.name) ?? R,
896
- avatar: (S == null ? void 0 : S.avatar) ?? "",
922
+ name: (E == null ? void 0 : E.name) ?? R,
923
+ avatar: (E == null ? void 0 : E.avatar) ?? "",
897
924
  isStarted: !0,
898
- sync: E,
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 p = /* @__PURE__ */ new Map();
906
- for (const g of d) {
907
- const v = p.get(g.pluginID) ?? [];
908
- v.push(g), p.set(g.pluginID, v);
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 _ = Array.from(s.values()), C = d.filter((g) => g.isSyncing), h = d.filter((g) => g.hasErrors), m = d.filter((g) => g.pluginFailed);
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: d,
913
- grouped: p,
914
- connectedCount: d.length,
915
- syncingCount: C.length,
916
- errorCount: h.length,
917
- failedCount: m.length,
918
- hasSyncing: ze(_),
919
- aggregateProgress: Ye(_),
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: y,
922
- retryPlugin: f
948
+ retryWatch: f,
949
+ retryPlugin: d
923
950
  };
924
951
  }
925
- function In(t, e) {
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
- function ss(t, e, n) {
929
- const r = D(t), s = j(), i = [r, "data", e], o = O({
955
+ function is(t, e, n) {
956
+ const r = P(t), s = j(), i = [r, "data", e], o = T({
930
957
  queryKey: i,
931
958
  queryFn: async () => {
932
- const c = await Dt(r, e);
933
- return c == null ? n : In(c, n) ? c : (console.warn(
959
+ const c = await Ot(r, e);
960
+ return c == null ? n : On(c, n) ? c : (console.warn(
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 = P({
964
+ }), a = A({
938
965
  mutationFn: async (c) => {
939
- await Pt(r, e, c);
966
+ await Tt(r, e, c);
940
967
  },
941
968
  onMutate: async (c) => {
942
969
  await s.cancelQueries({ queryKey: i });
@@ -958,19 +985,19 @@ function ss(t, e, n) {
958
985
  isLoading: o.isLoading
959
986
  };
960
987
  }
961
- const os = () => {
962
- const t = Y(hn);
988
+ const as = () => {
989
+ const t = Y(Sn);
963
990
  if (!t) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
964
991
  return t;
965
- }, Ze = () => {
966
- const t = Y(gn);
992
+ }, Xe = () => {
993
+ const t = Y(mn);
967
994
  if (t === void 0)
968
995
  throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
969
996
  return t;
970
- }, is = ({ pluginID: t }) => {
971
- const e = D(t), { showSnackbar: n } = U(), { createTab: r, updateTab: s } = Ze();
997
+ }, cs = ({ pluginID: t }) => {
998
+ const e = P(t), { showSnackbar: n } = W(), { createTab: r, updateTab: s } = Xe();
972
999
  return {
973
- createSession: P({
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,76 +1012,76 @@ const os = () => {
985
1012
  opts: { ...l }
986
1013
  }
987
1014
  });
988
- const y = nn.createFrom({
1015
+ const f = sn.createFrom({
989
1016
  command: ["/bin/bash"],
990
1017
  tty: !0,
991
1018
  ...l
992
1019
  });
993
1020
  try {
994
- const f = await Ot(e, o, y);
995
- if (!f) throw new Error("Failed to create session: null response");
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: f.id,
1000
- title: c ?? `Session ${f.id.substring(0, 8)}`,
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 (f) {
1005
- const d = Q(f);
1031
+ } catch (d) {
1032
+ const p = Q(d);
1006
1033
  s(
1007
1034
  { id: u },
1008
1035
  {
1009
- properties: { status: "error", error: d.detail, pluginID: e, connectionID: o, opts: { ...l } }
1036
+ properties: { status: "error", error: p.detail, pluginID: e, connectionID: o, opts: { ...l } }
1010
1037
  }
1011
- ), z(n, f, "Failed to start session");
1038
+ ), z(n, d, "Failed to start session");
1012
1039
  }
1013
1040
  }
1014
1041
  }).mutateAsync
1015
1042
  };
1016
- }, as = ({ pluginID: t }) => {
1017
- const e = D(t), { showSnackbar: n } = U(), { createTab: r } = Ze(), s = P({
1043
+ }, us = ({ pluginID: t }) => {
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: y,
1025
- target: f,
1026
- follow: d = !0,
1027
- tailLines: p = 1e3,
1028
- params: _
1051
+ label: f,
1052
+ target: d,
1053
+ follow: p = !0,
1054
+ tailLines: g = 1e3,
1055
+ params: S
1029
1056
  }) => {
1030
- const C = rn.createFrom({
1057
+ const m = on.createFrom({
1031
1058
  resource_key: a,
1032
1059
  resource_id: c,
1033
1060
  resource_data: l,
1034
- options: sn.createFrom({
1035
- target: f ?? "",
1036
- follow: d,
1061
+ options: an.createFrom({
1062
+ target: d ?? "",
1063
+ follow: p,
1037
1064
  include_previous: !1,
1038
1065
  include_timestamps: !0,
1039
- tail_lines: p,
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
- }), h = await Tt(e, o, C);
1046
- if (!h) throw new Error("Failed to create log session: null response");
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: h.id,
1049
- title: y ?? `Logs ${h.id.substring(0, 8)}`,
1075
+ id: y.id,
1076
+ title: f ?? `Logs ${y.id.substring(0, 8)}`,
1050
1077
  variant: "logs",
1051
1078
  icon: u ?? "LuLogs"
1052
- }), h;
1079
+ }), y;
1053
1080
  },
1054
1081
  onError: L(n, "Failed to start log session")
1055
- }), i = P({
1082
+ }), i = A({
1056
1083
  mutationFn: async (o) => {
1057
- await At(o);
1084
+ await xt(o);
1058
1085
  },
1059
1086
  onError: L(n, "Failed to close log session")
1060
1087
  });
@@ -1062,17 +1089,17 @@ const os = () => {
1062
1089
  createLogSession: s.mutateAsync,
1063
1090
  closeLogSession: i.mutateAsync
1064
1091
  };
1065
- }, cs = () => O({
1092
+ }, ls = () => T({
1066
1093
  queryKey: ["metric", "providers"],
1067
- queryFn: xt,
1094
+ queryFn: Nt,
1068
1095
  staleTime: 3e4
1069
- }), Dn = (t) => O({
1096
+ }), Tn = (t) => T({
1070
1097
  queryKey: ["metric", "providers", t],
1071
- queryFn: () => Nt(t),
1098
+ queryFn: () => kt(t),
1072
1099
  enabled: !!t,
1073
1100
  staleTime: 3e4
1074
- }), us = (t) => {
1075
- var C, h;
1101
+ }), ds = (t) => {
1102
+ var m, y;
1076
1103
  const {
1077
1104
  connectionID: e,
1078
1105
  resourceKey: n,
@@ -1086,12 +1113,12 @@ const os = () => {
1086
1113
  refreshInterval: l = 0,
1087
1114
  enabled: u = !0
1088
1115
  } = t, {
1089
- data: y,
1090
- isLoading: f
1091
- } = Dn(n), d = y ?? [], p = c ? Math.max(
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, _ = O({
1121
+ ) * 1e6 : 0, S = T({
1095
1122
  queryKey: [
1096
1123
  "metric",
1097
1124
  "query",
@@ -1101,11 +1128,11 @@ const os = () => {
1101
1128
  s,
1102
1129
  o,
1103
1130
  a,
1104
- (C = c == null ? void 0 : c.start) == null ? void 0 : C.getTime(),
1105
- (h = c == null ? void 0 : c.end) == null ? void 0 : h.getTime()
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 m = await Lt(
1135
+ const _ = await Lt(
1109
1136
  e,
1110
1137
  n,
1111
1138
  r,
@@ -1115,27 +1142,27 @@ const os = () => {
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
- p
1119
- ), g = {};
1120
- for (const [v, R] of Object.entries(m))
1121
- R != null && (g[v] = R);
1122
- return g;
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) && d.length > 0,
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: Ue
1156
+ placeholderData: We
1130
1157
  });
1131
1158
  return {
1132
- data: _.data ?? void 0,
1133
- providers: d,
1134
- isLoading: f || _.isLoading,
1135
- error: _.error,
1136
- refetch: _.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
- }, ls = (t) => {
1165
+ }, fs = (t) => {
1139
1166
  const {
1140
1167
  pluginID: e,
1141
1168
  connectionID: n,
@@ -1146,10 +1173,10 @@ const os = () => {
1146
1173
  metricIDs: a = [],
1147
1174
  interval: c = 1e4,
1148
1175
  enabled: l = !0
1149
- } = t, u = D(e), [y, f] = q(null), [d, p] = q(null), [_, C] = q(!1), [h, m] = q(null), g = W(null), v = k(async () => {
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 w = await kt(u, n, {
1179
+ const C = await Mt(u, n, {
1153
1180
  resource_key: r,
1154
1181
  resource_id: s,
1155
1182
  resource_namespace: i,
@@ -1158,97 +1185,97 @@ const os = () => {
1158
1185
  interval: c * 1e6
1159
1186
  // ms to nanoseconds for Go time.Duration
1160
1187
  });
1161
- p(w), C(!0), m(null);
1162
- const S = x(`core/metrics/data/${w}`, (I) => {
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 && f(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
- }), E = x(`core/metrics/error/${w}`, (I) => {
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
- m(N.error || "Unknown error");
1201
+ _(N.error || "Unknown error");
1175
1202
  } catch {
1176
- m("Failed to parse metric stream error");
1203
+ _("Failed to parse metric stream error");
1177
1204
  }
1178
1205
  });
1179
- g.current = () => {
1180
- S(), E();
1206
+ h.current = () => {
1207
+ E(), b();
1181
1208
  };
1182
- } catch (w) {
1183
- m(w instanceof Error ? w.message : String(w));
1209
+ } catch (C) {
1210
+ _(C instanceof Error ? C.message : String(C));
1184
1211
  }
1185
1212
  }, [u, n, r, s, i, a, c, l]), R = k(async () => {
1186
- if (d)
1213
+ if (p)
1187
1214
  try {
1188
- await Ee(d);
1189
- } catch (w) {
1190
- console.error("Failed to unsubscribe:", w);
1215
+ await Ce(p);
1216
+ } catch (C) {
1217
+ console.error("Failed to unsubscribe:", C);
1191
1218
  }
1192
- g.current && (g.current(), g.current = null), p(null), C(!1);
1193
- }, [d]);
1194
- return G(() => () => {
1195
- d && Ee(d).catch(console.error), g.current && g.current();
1196
- }, [d]), {
1197
- data: y,
1198
- subscriptionID: d,
1199
- isStreaming: _,
1200
- error: h,
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
- }, H = ["networker", "portforward", "all-sessions"];
1205
- function ds() {
1206
- const { showSnackbar: t } = U(), e = j(), n = O({
1207
- queryKey: [...H],
1208
- queryFn: async () => Mt().catch((i) => {
1231
+ }, B = ["networker", "portforward", "all-sessions"];
1232
+ function ps() {
1233
+ const { showSnackbar: t } = W(), e = j(), n = T({
1234
+ queryKey: [...B],
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
- G(() => {
1215
- const i = x("core/networker/portforward/created", () => {
1216
- e.invalidateQueries({ queryKey: [...H] });
1217
- }), o = x("core/networker/portforward/closed", () => {
1218
- e.invalidateQueries({ queryKey: [...H] });
1241
+ $(() => {
1242
+ const i = O("core/networker/portforward/created", () => {
1243
+ e.invalidateQueries({ queryKey: [...B] });
1244
+ }), o = O("core/networker/portforward/closed", () => {
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 = P({
1225
- mutationFn: async (i) => Pe(i),
1251
+ const r = n.data ?? [], s = A({
1252
+ mutationFn: async (i) => Te(i),
1226
1253
  onError: L(t, "Failed to close port forwarding session"),
1227
1254
  onSuccess: async () => {
1228
- await e.invalidateQueries({ queryKey: [...H] });
1255
+ await e.invalidateQueries({ queryKey: [...B] });
1229
1256
  }
1230
1257
  });
1231
1258
  return {
1232
1259
  sessions: n,
1233
1260
  activeSessions: r,
1234
1261
  closeSession: s.mutateAsync,
1235
- openInBrowser: (i) => qe(`http://localhost:${i}`)
1262
+ openInBrowser: (i) => $e(`http://localhost:${i}`)
1236
1263
  };
1237
1264
  }
1238
- function fs({ pluginID: t, connectionID: e, resourceID: n }) {
1239
- const r = D(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = U(), o = j(), a = O({
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 () => $t(r, e, on.createFrom({
1268
+ queryFn: async () => Ut(r, e, cn.createFrom({
1242
1269
  resource_id: n,
1243
1270
  connection_id: e
1244
1271
  })).catch((u) => {
1245
- const y = Q(u);
1246
- return y.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: y.detail }), []);
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 = P({
1276
+ }), c = A({
1250
1277
  mutationFn: async ({ opts: u }) => {
1251
- const y = an.createFrom({
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,24 +1289,24 @@ function fs({ pluginID: t, connectionID: e, resourceID: n }) {
1262
1289
  },
1263
1290
  labels: u.labels ?? {},
1264
1291
  params: u.parameters ?? {}
1265
- }), f = await Ut(r, e, y);
1266
- if (!f) throw new Error("Failed to start port forwarding: null response");
1267
- return u.openInBrowser && qe(`http://localhost:${f.local_port}`), f;
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
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
- o.invalidateQueries({ queryKey: [...H] })
1300
+ o.invalidateQueries({ queryKey: [...B] })
1274
1301
  ]);
1275
1302
  }
1276
- }), l = P({
1277
- mutationFn: async ({ opts: u }) => Pe(u.sessionID),
1303
+ }), l = A({
1304
+ mutationFn: async ({ opts: u }) => Te(u.sessionID),
1278
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 }),
1282
- o.invalidateQueries({ queryKey: [...H] })
1309
+ o.invalidateQueries({ queryKey: [...B] })
1283
1310
  ]);
1284
1311
  }
1285
1312
  });
@@ -1289,20 +1316,20 @@ function fs({ pluginID: t, connectionID: e, resourceID: n }) {
1289
1316
  close: l.mutateAsync
1290
1317
  };
1291
1318
  }
1292
- const ps = () => {
1293
- const t = b.useContext(mn);
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
- }, ys = ({
1323
+ }, hs = ({
1297
1324
  pluginID: t,
1298
1325
  connectionID: e,
1299
1326
  resourceKey: n,
1300
1327
  resourceID: r,
1301
1328
  namespace: s = ""
1302
1329
  }) => {
1303
- const i = D(t), o = j(), { showSnackbar: a } = U(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } = P({
1304
- mutationFn: async (f) => Oe(i, e, n, Ne.createFrom({
1305
- input: f.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
  })),
@@ -1310,11 +1337,11 @@ const ps = () => {
1310
1337
  a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey: c });
1311
1338
  },
1312
1339
  onError: L(a, `Failed to update resource ${r}`)
1313
- }), { mutateAsync: u } = P({
1314
- mutationFn: async (f = {}) => Te(i, e, n, Le.createFrom({
1340
+ }), { mutateAsync: u } = A({
1341
+ mutationFn: async (d = {}) => De(i, e, n, Le.createFrom({
1315
1342
  id: r,
1316
1343
  namespace: s,
1317
- gracePeriodSeconds: f.gracePeriodSeconds
1344
+ gracePeriodSeconds: d.gracePeriodSeconds
1318
1345
  })),
1319
1346
  onSuccess: async () => {
1320
1347
  a(`Resource ${r} deleted`, "success"), await o.invalidateQueries({ queryKey: c });
@@ -1326,9 +1353,9 @@ const ps = () => {
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: O({
1356
+ resource: T({
1330
1357
  queryKey: c,
1331
- queryFn: async () => qt(i, e, n, cn.createFrom({
1358
+ queryFn: async () => Wt(i, e, n, ln.createFrom({
1332
1359
  id: r,
1333
1360
  namespace: s
1334
1361
  })),
@@ -1349,40 +1376,40 @@ const ps = () => {
1349
1376
  */
1350
1377
  remove: u
1351
1378
  };
1352
- }, gs = (t) => {
1379
+ }, ms = (t) => {
1353
1380
  const e = ["component", t.plugin, t.resource, t.area];
1354
1381
  return {
1355
1382
  /**
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: O({
1386
+ component: T({
1360
1387
  queryKey: e,
1361
- queryFn: async () => Wt(t)
1388
+ queryFn: async () => Gt(t)
1362
1389
  })
1363
1390
  };
1364
- }, hs = ({ pluginID: t, connectionID: e }) => {
1365
- const n = D(t);
1391
+ }, Ss = ({ pluginID: t, connectionID: e }) => {
1392
+ const n = P(t);
1366
1393
  return {
1367
1394
  /**
1368
1395
  * The resource groups for the given plugin and connection.
1369
1396
  */
1370
- groups: O({
1397
+ groups: T({
1371
1398
  queryKey: [n, "resource_groups", "list"],
1372
- queryFn: async () => Gt(n, e),
1399
+ queryFn: async () => jt(n, e),
1373
1400
  retry: !1
1374
1401
  })
1375
1402
  };
1376
- }, ms = ({
1403
+ }, _s = ({
1377
1404
  pluginID: t,
1378
1405
  connectionID: e,
1379
1406
  searches: n
1380
1407
  }) => {
1381
- const r = D(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
1382
- return un({
1408
+ const r = P(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
1409
+ return dn({
1383
1410
  queries: n.map((o) => ({
1384
1411
  queryKey: s(o),
1385
- queryFn: async () => Ae(r, e, o.key, ke.createFrom({
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
@@ -1390,40 +1417,40 @@ const ps = () => {
1390
1417
  retry: !1
1391
1418
  }))
1392
1419
  });
1393
- }, Ss = ({ pluginID: t, resourceKey: e }) => {
1394
- const n = D(t);
1420
+ }, Es = ({ pluginID: t, resourceKey: e }) => {
1421
+ const n = P(t);
1395
1422
  return {
1396
1423
  /**
1397
1424
  * The current settings from the provider.
1398
1425
  */
1399
- resourceType: O({
1426
+ resourceType: T({
1400
1427
  queryKey: [n, "resources", e],
1401
- queryFn: async () => jt(n, e),
1428
+ queryFn: async () => Qt(n, e),
1402
1429
  retry: !1
1403
1430
  })
1404
1431
  };
1405
- }, _s = ({ pluginID: t, connectionID: e }) => {
1406
- const n = D(t);
1432
+ }, ws = ({ pluginID: t, connectionID: e }) => {
1433
+ const n = P(t);
1407
1434
  return {
1408
1435
  /**
1409
1436
  * The resource types for the given plugin and connection.
1410
1437
  */
1411
- types: O({
1438
+ types: T({
1412
1439
  queryKey: [n, "resources", "list", e],
1413
- queryFn: async () => Qt(n, e),
1440
+ queryFn: async () => Kt(n, e),
1414
1441
  retry: !1
1415
1442
  })
1416
1443
  };
1417
1444
  };
1418
1445
  var ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1419
- function Pn(t) {
1446
+ function An(t) {
1420
1447
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1421
1448
  }
1422
- var On = "Expected a function", Xe = "__lodash_hash_undefined__", Tn = "[object Function]", An = "[object GeneratorFunction]", xn = "[object Symbol]", Nn = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Ln = /^\w*$/, kn = /^\./, Mn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, $n = /[\\^$.*+?()[\]{}|]/g, Un = /\\(\\)?/g, qn = /^\[object .+?Constructor\]$/, Wn = typeof ee == "object" && ee && ee.Object === Object && ee, Gn = typeof self == "object" && self && self.Object === Object && self, me = Wn || Gn || Function("return this")();
1423
- function jn(t, e) {
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")();
1450
+ function Kn(t, e) {
1424
1451
  return t == null ? void 0 : t[e];
1425
1452
  }
1426
- function Qn(t) {
1453
+ function Hn(t) {
1427
1454
  var e = !1;
1428
1455
  if (t != null && typeof t.toString != "function")
1429
1456
  try {
@@ -1432,12 +1459,12 @@ function Qn(t) {
1432
1459
  }
1433
1460
  return e;
1434
1461
  }
1435
- var Kn = Array.prototype, Bn = Function.prototype, Ve = Object.prototype, le = me["__core-js_shared__"], be = function() {
1462
+ var Bn = Array.prototype, zn = Function.prototype, et = Object.prototype, le = me["__core-js_shared__"], ve = function() {
1436
1463
  var t = /[^.]+$/.exec(le && le.keys && le.keys.IE_PROTO || "");
1437
1464
  return t ? "Symbol(src)_1." + t : "";
1438
- }(), et = Bn.toString, Se = Ve.hasOwnProperty, tt = Ve.toString, Hn = RegExp(
1439
- "^" + et.call(Se).replace($n, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1440
- ), ve = me.Symbol, zn = Kn.splice, Yn = nt(me, "Map"), Z = nt(Object, "create"), Re = ve ? ve.prototype : void 0, Fe = Re ? Re.toString : void 0;
1465
+ }(), tt = zn.toString, Se = et.hasOwnProperty, nt = et.toString, Yn = RegExp(
1466
+ "^" + tt.call(Se).replace($n, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
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;
1443
1470
  for (this.clear(); ++e < n; ) {
@@ -1445,33 +1472,33 @@ function K(t) {
1445
1472
  this.set(r[0], r[1]);
1446
1473
  }
1447
1474
  }
1448
- function Jn() {
1475
+ function Xn() {
1449
1476
  this.__data__ = Z ? Z(null) : {};
1450
1477
  }
1451
- function Zn(t) {
1478
+ function Vn(t) {
1452
1479
  return this.has(t) && delete this.__data__[t];
1453
1480
  }
1454
- function Xn(t) {
1481
+ function er(t) {
1455
1482
  var e = this.__data__;
1456
1483
  if (Z) {
1457
1484
  var n = e[t];
1458
- return n === Xe ? void 0 : n;
1485
+ return n === Ve ? void 0 : n;
1459
1486
  }
1460
1487
  return Se.call(e, t) ? e[t] : void 0;
1461
1488
  }
1462
- function Vn(t) {
1489
+ function tr(t) {
1463
1490
  var e = this.__data__;
1464
1491
  return Z ? e[t] !== void 0 : Se.call(e, t);
1465
1492
  }
1466
- function er(t, e) {
1493
+ function nr(t, e) {
1467
1494
  var n = this.__data__;
1468
- return n[t] = Z && e === void 0 ? Xe : e, this;
1495
+ return n[t] = Z && e === void 0 ? Ve : e, this;
1469
1496
  }
1470
- K.prototype.clear = Jn;
1471
- K.prototype.delete = Zn;
1472
- K.prototype.get = Xn;
1473
- K.prototype.has = Vn;
1474
- K.prototype.set = er;
1497
+ K.prototype.clear = Xn;
1498
+ K.prototype.delete = Vn;
1499
+ K.prototype.get = er;
1500
+ K.prototype.has = tr;
1501
+ K.prototype.set = nr;
1475
1502
  function J(t) {
1476
1503
  var e = -1, n = t ? t.length : 0;
1477
1504
  for (this.clear(); ++e < n; ) {
@@ -1479,130 +1506,130 @@ function J(t) {
1479
1506
  this.set(r[0], r[1]);
1480
1507
  }
1481
1508
  }
1482
- function tr() {
1509
+ function rr() {
1483
1510
  this.__data__ = [];
1484
1511
  }
1485
- function nr(t) {
1512
+ function sr(t) {
1486
1513
  var e = this.__data__, n = se(e, t);
1487
1514
  if (n < 0)
1488
1515
  return !1;
1489
1516
  var r = e.length - 1;
1490
- return n == r ? e.pop() : zn.call(e, n, 1), !0;
1517
+ return n == r ? e.pop() : Jn.call(e, n, 1), !0;
1491
1518
  }
1492
- function rr(t) {
1519
+ function or(t) {
1493
1520
  var e = this.__data__, n = se(e, t);
1494
1521
  return n < 0 ? void 0 : e[n][1];
1495
1522
  }
1496
- function sr(t) {
1523
+ function ir(t) {
1497
1524
  return se(this.__data__, t) > -1;
1498
1525
  }
1499
- function or(t, e) {
1526
+ function ar(t, e) {
1500
1527
  var n = this.__data__, r = se(n, t);
1501
1528
  return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
1502
1529
  }
1503
- J.prototype.clear = tr;
1504
- J.prototype.delete = nr;
1505
- J.prototype.get = rr;
1506
- J.prototype.has = sr;
1507
- J.prototype.set = or;
1508
- function B(t) {
1530
+ J.prototype.clear = rr;
1531
+ J.prototype.delete = sr;
1532
+ J.prototype.get = or;
1533
+ J.prototype.has = ir;
1534
+ J.prototype.set = ar;
1535
+ function H(t) {
1509
1536
  var e = -1, n = t ? t.length : 0;
1510
1537
  for (this.clear(); ++e < n; ) {
1511
1538
  var r = t[e];
1512
1539
  this.set(r[0], r[1]);
1513
1540
  }
1514
1541
  }
1515
- function ir() {
1542
+ function cr() {
1516
1543
  this.__data__ = {
1517
1544
  hash: new K(),
1518
- map: new (Yn || J)(),
1545
+ map: new (Zn || J)(),
1519
1546
  string: new K()
1520
1547
  };
1521
1548
  }
1522
- function ar(t) {
1549
+ function ur(t) {
1523
1550
  return oe(this, t).delete(t);
1524
1551
  }
1525
- function cr(t) {
1552
+ function lr(t) {
1526
1553
  return oe(this, t).get(t);
1527
1554
  }
1528
- function ur(t) {
1555
+ function dr(t) {
1529
1556
  return oe(this, t).has(t);
1530
1557
  }
1531
- function lr(t, e) {
1558
+ function fr(t, e) {
1532
1559
  return oe(this, t).set(t, e), this;
1533
1560
  }
1534
- B.prototype.clear = ir;
1535
- B.prototype.delete = ar;
1536
- B.prototype.get = cr;
1537
- B.prototype.has = ur;
1538
- B.prototype.set = lr;
1561
+ H.prototype.clear = cr;
1562
+ H.prototype.delete = ur;
1563
+ H.prototype.get = lr;
1564
+ H.prototype.has = dr;
1565
+ H.prototype.set = fr;
1539
1566
  function se(t, e) {
1540
1567
  for (var n = t.length; n--; )
1541
- if (Er(t[n][0], e))
1568
+ if (br(t[n][0], e))
1542
1569
  return n;
1543
1570
  return -1;
1544
1571
  }
1545
- function dr(t, e) {
1546
- e = gr(e, t) ? [e] : yr(e);
1572
+ function pr(t, e) {
1573
+ e = mr(e, t) ? [e] : hr(e);
1547
1574
  for (var n = 0, r = e.length; t != null && n < r; )
1548
- t = t[_r(e[n++])];
1575
+ t = t[wr(e[n++])];
1549
1576
  return n && n == r ? t : void 0;
1550
1577
  }
1551
- function fr(t) {
1552
- if (!st(t) || mr(t))
1578
+ function gr(t) {
1579
+ if (!ot(t) || _r(t))
1553
1580
  return !1;
1554
- var e = Cr(t) || Qn(t) ? Hn : qn;
1555
- return e.test(wr(t));
1581
+ var e = vr(t) || Hn(t) ? Yn : Gn;
1582
+ return e.test(Cr(t));
1556
1583
  }
1557
- function pr(t) {
1584
+ function yr(t) {
1558
1585
  if (typeof t == "string")
1559
1586
  return t;
1560
- if (we(t))
1561
- return Fe ? Fe.call(t) : "";
1587
+ if (Ee(t))
1588
+ return Ie ? Ie.call(t) : "";
1562
1589
  var e = t + "";
1563
1590
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
1564
1591
  }
1565
- function yr(t) {
1566
- return rt(t) ? t : Sr(t);
1592
+ function hr(t) {
1593
+ return st(t) ? t : Er(t);
1567
1594
  }
1568
1595
  function oe(t, e) {
1569
1596
  var n = t.__data__;
1570
- return hr(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
1597
+ return Sr(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
1571
1598
  }
1572
- function nt(t, e) {
1573
- var n = jn(t, e);
1574
- return fr(n) ? n : void 0;
1599
+ function rt(t, e) {
1600
+ var n = Kn(t, e);
1601
+ return gr(n) ? n : void 0;
1575
1602
  }
1576
- function gr(t, e) {
1577
- if (rt(t))
1603
+ function mr(t, e) {
1604
+ if (st(t))
1578
1605
  return !1;
1579
1606
  var n = typeof t;
1580
- return n == "number" || n == "symbol" || n == "boolean" || t == null || we(t) ? !0 : Ln.test(t) || !Nn.test(t) || e != null && t in Object(e);
1607
+ return n == "number" || n == "symbol" || n == "boolean" || t == null || Ee(t) ? !0 : Mn.test(t) || !Ln.test(t) || e != null && t in Object(e);
1581
1608
  }
1582
- function hr(t) {
1609
+ function Sr(t) {
1583
1610
  var e = typeof t;
1584
1611
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
1585
1612
  }
1586
- function mr(t) {
1587
- return !!be && be in t;
1613
+ function _r(t) {
1614
+ return !!ve && ve in t;
1588
1615
  }
1589
- var Sr = _e(function(t) {
1590
- t = vr(t);
1616
+ var Er = _e(function(t) {
1617
+ t = Fr(t);
1591
1618
  var e = [];
1592
- return kn.test(t) && e.push(""), t.replace(Mn, function(n, r, s, i) {
1593
- e.push(s ? i.replace(Un, "$1") : r || n);
1619
+ return qn.test(t) && e.push(""), t.replace(Un, function(n, r, s, i) {
1620
+ e.push(s ? i.replace(Wn, "$1") : r || n);
1594
1621
  }), e;
1595
1622
  });
1596
- function _r(t) {
1597
- if (typeof t == "string" || we(t))
1623
+ function wr(t) {
1624
+ if (typeof t == "string" || Ee(t))
1598
1625
  return t;
1599
1626
  var e = t + "";
1600
1627
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
1601
1628
  }
1602
- function wr(t) {
1629
+ function Cr(t) {
1603
1630
  if (t != null) {
1604
1631
  try {
1605
- return et.call(t);
1632
+ return tt.call(t);
1606
1633
  } catch {
1607
1634
  }
1608
1635
  try {
@@ -1614,7 +1641,7 @@ function wr(t) {
1614
1641
  }
1615
1642
  function _e(t, e) {
1616
1643
  if (typeof t != "function" || e && typeof e != "function")
1617
- throw new TypeError(On);
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))
@@ -1622,37 +1649,37 @@ function _e(t, e) {
1622
1649
  var o = t.apply(this, r);
1623
1650
  return n.cache = i.set(s, o), o;
1624
1651
  };
1625
- return n.cache = new (_e.Cache || B)(), n;
1652
+ return n.cache = new (_e.Cache || H)(), n;
1626
1653
  }
1627
- _e.Cache = B;
1628
- function Er(t, e) {
1654
+ _e.Cache = H;
1655
+ function br(t, e) {
1629
1656
  return t === e || t !== t && e !== e;
1630
1657
  }
1631
- var rt = Array.isArray;
1632
- function Cr(t) {
1633
- var e = st(t) ? tt.call(t) : "";
1634
- return e == Tn || e == An;
1658
+ var st = Array.isArray;
1659
+ function vr(t) {
1660
+ var e = ot(t) ? nt.call(t) : "";
1661
+ return e == xn || e == Nn;
1635
1662
  }
1636
- function st(t) {
1663
+ function ot(t) {
1637
1664
  var e = typeof t;
1638
1665
  return !!t && (e == "object" || e == "function");
1639
1666
  }
1640
- function br(t) {
1667
+ function Rr(t) {
1641
1668
  return !!t && typeof t == "object";
1642
1669
  }
1643
- function we(t) {
1644
- return typeof t == "symbol" || br(t) && tt.call(t) == xn;
1670
+ function Ee(t) {
1671
+ return typeof t == "symbol" || Rr(t) && nt.call(t) == kn;
1645
1672
  }
1646
- function vr(t) {
1647
- return t == null ? "" : pr(t);
1673
+ function Fr(t) {
1674
+ return t == null ? "" : yr(t);
1648
1675
  }
1649
- function Rr(t, e, n) {
1650
- var r = t == null ? void 0 : dr(t, e);
1676
+ function Ir(t, e, n) {
1677
+ var r = t == null ? void 0 : pr(t, e);
1651
1678
  return r === void 0 ? n : r;
1652
1679
  }
1653
- var Fr = Rr;
1654
- const te = /* @__PURE__ */ Pn(Fr);
1655
- function Ir(t, e, n) {
1680
+ var Pr = Ir;
1681
+ const te = /* @__PURE__ */ An(Pr);
1682
+ function Or(t, e, n) {
1656
1683
  const r = t ?? { result: [], success: !0, totalCount: 0 }, s = [...r.result ?? []];
1657
1684
  for (const i of e) {
1658
1685
  const o = te(i.payload.data, n);
@@ -1675,126 +1702,126 @@ function Ir(t, e, n) {
1675
1702
  }
1676
1703
  return { ...r, result: s };
1677
1704
  }
1678
- function Dr(t, e, n, r, s, i) {
1679
- const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = W([]), c = W(null), l = W(null), u = W(s);
1705
+ function Tr(t, e, n, r, s, i) {
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 y = k(() => {
1682
- const d = a.current;
1683
- if (a.current = [], c.current = null, l.current = null, !(d.length === 0 || !r)) {
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
- (p) => Ir(p, d, r)
1713
+ (g) => Or(g, p, r)
1687
1714
  );
1688
- for (const p of d)
1689
- (p.type === "ADD" || p.type === "UPDATE") && t.setQueryData(
1690
- n(p.payload.id, p.payload.namespace),
1691
- { result: p.payload.data }
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]), f = k(
1695
- (d) => {
1696
- a.current.push(d), !(c.current !== null || l.current !== null) && (u.current === 1 ? c.current = setTimeout(y, o) : l.current = requestAnimationFrame(y));
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
- [y, o]
1725
+ [f, o]
1699
1726
  );
1700
- return G(() => () => {
1727
+ return $(() => () => {
1701
1728
  c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
1702
- }, []), f;
1729
+ }, []), d;
1703
1730
  }
1704
- const ws = ({
1731
+ const Cs = ({
1705
1732
  pluginID: t,
1706
1733
  connectionID: e,
1707
1734
  resourceKey: n,
1708
1735
  idAccessor: r,
1709
1736
  namespaces: s
1710
1737
  }) => {
1711
- const i = D(t), o = j(), { showSnackbar: a } = U(), c = b.useMemo(() => s ?? [], [s]), l = b.useMemo(
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 = b.useCallback(
1715
- (C, h) => [i, e, n, h, C],
1741
+ ), u = w.useCallback(
1742
+ (m, y) => [i, e, n, y, m],
1716
1743
  [i, e, n]
1717
- ), { mutateAsync: y } = P({
1718
- mutationFn: async (C) => xe(i, e, n, Me.createFrom({
1719
- input: C.input,
1720
- namespace: C.namespace ?? (c.length === 1 ? c[0] : "")
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 (C) => {
1749
+ onSuccess: async (m) => {
1723
1750
  var v;
1724
- const h = C == null ? void 0 : C.result;
1725
- let m = "";
1726
- (v = h == null ? void 0 : h.metadata) != null && v.name ? m = h.metadata.name : h != null && h.id ? m = h.id : h != null && h.name ? m = h.name : h != null && h.ID ? m = h.ID : h != null && h.Name && (m = h.Name);
1727
- const g = m ? `Resource ${m} created` : "Resource created";
1728
- a(g, "success"), await o.invalidateQueries({ queryKey: l });
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
1757
  onError: L(a, "Failed to create resource")
1731
- }), f = O({
1758
+ }), d = T({
1732
1759
  queryKey: l,
1733
- queryFn: async () => Ae(i, e, n, ke.createFrom({
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: (C, h) => C,
1765
+ placeholderData: (m, y) => m,
1739
1766
  retry: !1
1740
- }), [d, p] = b.useState(
1767
+ }), [p, g] = w.useState(
1741
1768
  F.WatchStateIdle
1742
1769
  );
1743
- b.useEffect(() => x(
1770
+ w.useEffect(() => O(
1744
1771
  `${i}/${e}/watch/STATE`,
1745
- (h) => {
1746
- const m = h.data;
1747
- m.resourceKey === n && p(m.state);
1772
+ (y) => {
1773
+ const _ = y.data;
1774
+ _.resourceKey === n && g(_.state);
1748
1775
  }
1749
1776
  ), [i, e, n]);
1750
- const _ = Dr(o, l, u, r, d);
1751
- return b.useEffect(() => {
1777
+ const S = Tr(o, l, u, r, p);
1778
+ return w.useEffect(() => {
1752
1779
  if (!r)
1753
1780
  return;
1754
- Kt(i, e, n);
1755
- const C = x(
1781
+ Ht(i, e, n);
1782
+ const m = O(
1756
1783
  `${i}/${e}/${n}/ADD`,
1757
- (g) => _({ type: "ADD", payload: g.data })
1758
- ), h = x(
1784
+ (h) => S({ type: "ADD", payload: h.data })
1785
+ ), y = O(
1759
1786
  `${i}/${e}/${n}/UPDATE`,
1760
- (g) => _({ type: "UPDATE", payload: g.data })
1761
- ), m = x(
1787
+ (h) => S({ type: "UPDATE", payload: h.data })
1788
+ ), _ = O(
1762
1789
  `${i}/${e}/${n}/DELETE`,
1763
- (g) => _({ type: "DELETE", payload: g.data })
1790
+ (h) => S({ type: "DELETE", payload: h.data })
1764
1791
  );
1765
1792
  return () => {
1766
- C(), h(), m(), Bt(i, e, n);
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: f,
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: y,
1808
+ create: f,
1782
1809
  /** Current watch state for this resource type */
1783
- watchState: d,
1810
+ watchState: p,
1784
1811
  /** Whether the watch is currently syncing */
1785
- isSyncing: d === F.WatchStateSyncing,
1812
+ isSyncing: p === F.WatchStateSyncing,
1786
1813
  /** Whether the watch has fully synced */
1787
- isSynced: d === F.WatchStateSynced,
1814
+ isSynced: p === F.WatchStateSynced,
1788
1815
  /** Whether the watch encountered an error */
1789
- watchError: d === F.WatchStateError
1816
+ watchError: p === F.WatchStateError
1790
1817
  };
1791
- }, Es = ({ pluginID: t }) => {
1792
- const e = D(t), { showSnackbar: n } = U(), r = P({
1793
- mutationFn: async ({ opts: o, input: a }) => xe(
1818
+ }, bs = ({ pluginID: t }) => {
1819
+ const e = P(t), { showSnackbar: n } = W(), r = A({
1820
+ mutationFn: async ({ opts: o, input: a }) => Ne(
1794
1821
  e,
1795
1822
  o.connectionID,
1796
1823
  o.resourceKey,
1797
- Me.createFrom({
1824
+ qe.createFrom({
1798
1825
  input: a.input,
1799
1826
  namespace: a.namespace ?? o.namespace ?? ""
1800
1827
  })
@@ -1805,12 +1832,12 @@ const ws = ({
1805
1832
  onError(o, { opts: a }) {
1806
1833
  z(n, o, `Failed to create resource ${a.resourceID}`);
1807
1834
  }
1808
- }), s = P({
1809
- mutationFn: async ({ opts: o, input: a }) => Oe(
1835
+ }), s = A({
1836
+ mutationFn: async ({ opts: o, input: a }) => Ae(
1810
1837
  e,
1811
1838
  o.connectionID,
1812
1839
  o.resourceKey,
1813
- Ne.createFrom({
1840
+ ke.createFrom({
1814
1841
  input: a.input,
1815
1842
  id: o.resourceID,
1816
1843
  namespace: o.namespace ?? ""
@@ -1822,8 +1849,8 @@ const ws = ({
1822
1849
  onError(o, { opts: a }) {
1823
1850
  z(n, o, `Failed to update resource ${a.resourceID}`);
1824
1851
  }
1825
- }), i = P({
1826
- mutationFn: async ({ opts: o, input: a }) => Te(
1852
+ }), i = A({
1853
+ mutationFn: async ({ opts: o, input: a }) => De(
1827
1854
  e,
1828
1855
  o.connectionID,
1829
1856
  o.resourceKey,
@@ -1845,15 +1872,15 @@ const ws = ({
1845
1872
  update: s.mutateAsync,
1846
1873
  remove: i.mutateAsync
1847
1874
  };
1848
- }, Cs = ({
1875
+ }, vs = ({
1849
1876
  pluginID: t,
1850
1877
  connectionID: e,
1851
1878
  resourceKey: n,
1852
1879
  enabled: r = !0
1853
1880
  }) => {
1854
- const s = D(t), i = O({
1881
+ const s = P(t), i = T({
1855
1882
  queryKey: ["RESOURCE_ACTIONS", s, e, n],
1856
- queryFn: () => Ht(s, e, n),
1883
+ queryFn: () => zt(s, e, n),
1857
1884
  enabled: r && !!s && !!e && !!n,
1858
1885
  staleTime: 5 * 60 * 1e3
1859
1886
  // actions don't change often
@@ -1863,18 +1890,18 @@ const ws = ({
1863
1890
  isLoading: i.isLoading,
1864
1891
  error: i.error
1865
1892
  };
1866
- }, bs = ({
1893
+ }, Rs = ({
1867
1894
  pluginID: t,
1868
1895
  connectionID: e,
1869
1896
  resourceKey: n
1870
1897
  }) => {
1871
- const r = D(t), s = j(), { showSnackbar: i } = U(), o = P({
1872
- mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => zt(
1898
+ const r = P(t), s = j(), { showSnackbar: i } = W(), o = A({
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
- $e.createFrom({ id: c, namespace: l, params: u })
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({
@@ -1890,14 +1917,14 @@ const ws = ({
1890
1917
  isExecuting: o.isPending,
1891
1918
  error: o.error
1892
1919
  };
1893
- }, vs = ({
1920
+ }, Fs = ({
1894
1921
  pluginID: t,
1895
1922
  connectionID: e,
1896
1923
  enabled: n = !0
1897
1924
  }) => {
1898
- const r = D(t), s = O({
1925
+ const r = P(t), s = T({
1899
1926
  queryKey: ["EDITOR_SCHEMAS", r, e],
1900
- queryFn: () => Yt(r, e),
1927
+ queryFn: () => Jt(r, e),
1901
1928
  enabled: n && !!r && !!e,
1902
1929
  staleTime: 10 * 60 * 1e3,
1903
1930
  // schemas are fairly stable per connection
@@ -1909,115 +1936,115 @@ const ws = ({
1909
1936
  error: s.error,
1910
1937
  refetch: s.refetch
1911
1938
  };
1912
- }, Rs = ({
1939
+ }, Is = ({
1913
1940
  pluginID: t,
1914
1941
  connectionID: e,
1915
1942
  enabled: n = !0
1916
1943
  }) => {
1917
- const r = D(t), s = j(), i = [r, e, "watch-state"], o = W([]), a = W(!1), c = k((f) => {
1918
- s.setQueryData(i, (d) => {
1919
- if (!d) return d;
1920
- const p = { ...d.resources, [f.resourceKey]: f.state }, _ = { ...d.resourceCounts, [f.resourceKey]: f.resourceCount };
1921
- let C = 0, h = 0;
1922
- for (const m of Object.values(p))
1923
- m === F.WatchStateSynced && C++, (m === F.WatchStateError || m === F.WatchStateFailed) && h++;
1924
- return { ...d, resources: p, resourceCounts: _, totalResources: Object.keys(p).length, syncedCount: C, errorCount: h };
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 = O({
1953
+ }, [s, r, e]), l = T({
1927
1954
  queryKey: i,
1928
1955
  queryFn: async () => {
1929
- const f = await Jt(r, e);
1930
- if (!f) throw new Error("Failed to get watch state: null response");
1931
- const d = {};
1932
- let p = 0, _ = 0;
1933
- for (const [h, m] of Object.entries(f.resources ?? {}))
1934
- m != null && (d[h] = m, m === F.WatchStateSynced && p++, m === F.WatchStateError && _++);
1935
- const C = {};
1936
- for (const [h, m] of Object.entries(f.resourceCounts ?? {}))
1937
- m != null && (C[h] = m);
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: f.connectionId,
1940
- resources: d,
1941
- resourceCounts: C,
1942
- totalResources: Object.keys(d).length,
1943
- syncedCount: p,
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: (f) => {
1949
- const d = f.state.data;
1950
- if (!d || d.totalResources === 0) return 3e3;
1951
- let p = 0;
1952
- for (const _ of Object.values(d.resources))
1953
- (_ === F.WatchStateSynced || _ === F.WatchStateError || _ === F.WatchStateStopped || _ === F.WatchStateFailed || _ === F.WatchStateForbidden || _ === F.WatchStateSkipped) && p++;
1954
- return p >= d.totalResources ? !1 : 3e3;
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
- G(() => {
1984
+ $(() => {
1958
1985
  if (!l.data || a.current) return;
1959
1986
  a.current = !0;
1960
- const f = o.current;
1987
+ const d = o.current;
1961
1988
  o.current = [];
1962
- for (const d of f)
1963
- c(d);
1964
- }, [l.data, c]), G(() => {
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 f = x(
1995
+ const d = O(
1969
1996
  `${r}/${e}/watch/STATE`,
1970
- (d) => {
1971
- const p = d.data;
1972
- a.current ? c(p) : o.current.push(p);
1997
+ (p) => {
1998
+ const g = p.data;
1999
+ a.current ? c(g) : o.current.push(g);
1973
2000
  }
1974
2001
  );
1975
2002
  return () => {
1976
- f(), a.current = !1, o.current = [];
2003
+ d(), a.current = !1, o.current = [];
1977
2004
  };
1978
2005
  }, [r, e, n, c]);
1979
2006
  const u = l.data;
1980
- let y = 0;
2007
+ let f = 0;
1981
2008
  if (u != null && u.resources)
1982
- for (const f of Object.values(u.resources))
1983
- (f === F.WatchStateSynced || f === F.WatchStateError || f === F.WatchStateStopped || f === F.WatchStateFailed || f === F.WatchStateForbidden || f === F.WatchStateSkipped) && y++;
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: (f) => u == null ? void 0 : u.resources[f],
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 && y === u.totalResources : !1,
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 ? y / 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
- }, Fs = () => {
1997
- const [t, e] = q(/* @__PURE__ */ new Map()), n = W(/* @__PURE__ */ new Map()), r = W(/* @__PURE__ */ new Map()), s = k((l) => {
1998
- const u = l.data, y = he(u), f = Je(n.current, u), d = pe(f);
1999
- if (e((p) => {
2000
- const _ = new Map(p);
2001
- return _.set(y, d), _;
2002
- }), r.current.has(y) && (clearTimeout(r.current.get(y)), r.current.delete(y)), ne(d)) {
2003
- const p = setTimeout(() => {
2004
- e((_) => {
2005
- const C = new Map(_);
2006
- return C.delete(y), C;
2007
- }), n.current.delete(y), r.current.delete(y);
2023
+ }, Ps = () => {
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(y, p);
2036
+ r.current.set(f, g);
2010
2037
  }
2011
2038
  }, []);
2012
- G(() => {
2013
- const l = x("watch/STATE", s);
2039
+ $(() => {
2040
+ const l = O("watch/STATE", s);
2014
2041
  return () => {
2015
2042
  l();
2016
2043
  for (const u of r.current.values())
2017
2044
  clearTimeout(u);
2018
2045
  };
2019
2046
  }, [s]);
2020
- const i = Array.from(t.values()), o = ze(i), a = i.find((l) => !ne(l)) ?? i[0] ?? null, c = Ye(i);
2047
+ const i = Array.from(t.values()), o = Ye(i), a = i.find((l) => !ne(l)) ?? i[0] ?? null, c = Je(i);
2021
2048
  return {
2022
2049
  /** All tracked syncs */
2023
2050
  syncs: i,
@@ -2028,76 +2055,95 @@ const ws = ({
2028
2055
  /** Aggregate progress across all connections (0-1) */
2029
2056
  aggregateProgress: c
2030
2057
  };
2031
- }, Pr = () => {
2032
- const t = b.useContext(Qe);
2058
+ }, Ar = () => {
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
- }, Is = ({
2062
+ }, Os = ({
2036
2063
  pluginID: t,
2037
2064
  connectionID: e,
2038
2065
  resourceKey: n
2039
2066
  }) => {
2040
- const r = D(t), { showSnackbar: s } = U(), { addOperation: i, updateOperation: o } = Pr(), a = b.useRef([]);
2041
- return b.useEffect(() => () => {
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: b.useCallback(
2044
- async ({ actionID: l, id: u, namespace: y, label: f, params: d = {} }) => {
2070
+ }, []), { startStreamAction: w.useCallback(
2071
+ async ({ actionID: l, id: u, namespace: f, label: d, params: p = {} }) => {
2045
2072
  try {
2046
- const p = await Zt(
2073
+ const g = await Xt(
2047
2074
  r,
2048
2075
  e,
2049
2076
  n,
2050
2077
  l,
2051
- $e.createFrom({ id: u, namespace: y, params: d })
2078
+ Ue.createFrom({ id: u, namespace: f, params: p })
2052
2079
  );
2053
2080
  i({
2054
- id: p,
2055
- label: f,
2081
+ id: g,
2082
+ label: d,
2056
2083
  resourceKey: n,
2057
2084
  resourceName: u,
2058
- namespace: y,
2085
+ namespace: f,
2059
2086
  connectionID: e,
2060
2087
  status: "running",
2061
2088
  startedAt: Date.now()
2062
2089
  });
2063
- const _ = `action/stream/${p}`, C = x(_, (h) => {
2064
- var g, v, R, w;
2065
- const m = h.data;
2066
- switch (m.type) {
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 S = m.data ?? {};
2069
- o(p, {
2070
- message: S.message,
2071
- progress: S.ready !== void 0 && S.desired !== void 0 ? { ready: S.ready, desired: S.desired } : void 0
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(p, {
2103
+ o(g, {
2077
2104
  status: "completed",
2078
- message: ((g = m.data) == null ? void 0 : g.message) ?? "Completed",
2105
+ message: ((h = _.data) == null ? void 0 : h.message) ?? "Completed",
2079
2106
  completedAt: Date.now()
2080
- }), s(((v = m.data) == null ? void 0 : v.message) ?? f + " completed", "success"), ae(_);
2107
+ }), s(((v = _.data) == null ? void 0 : v.message) ?? d + " completed", "success"), ae(S);
2081
2108
  break;
2082
2109
  case "error":
2083
- o(p, {
2110
+ o(g, {
2084
2111
  status: "error",
2085
- message: ((R = m.data) == null ? void 0 : R.message) ?? "Failed",
2112
+ message: ((R = _.data) == null ? void 0 : R.message) ?? "Failed",
2086
2113
  completedAt: Date.now()
2087
- }), s(((w = m.data) == null ? void 0 : w.message) ?? f + " failed", "error"), ae(_);
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
- C(), ae(_);
2093
- }), p;
2094
- } catch (p) {
2095
- throw z(s, p, `Failed to start "${l}"`), p;
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
- }, Or = 1e4, Tr = {
2127
+ };
2128
+ function Dr(t, e) {
2129
+ return `${t}/${e}/graph/CHANGED`;
2130
+ }
2131
+ function we(t, e, n, r) {
2132
+ const s = j(), i = q(n);
2133
+ i.current = n;
2134
+ const o = JSON.stringify(n);
2135
+ $(() => {
2136
+ if (!r || !t || !e)
2137
+ return;
2138
+ const a = O(Dr(t, e), () => {
2139
+ s.invalidateQueries({ queryKey: i.current, exact: !0 });
2140
+ });
2141
+ return () => {
2142
+ a();
2143
+ };
2144
+ }, [s, t, e, o, r]);
2145
+ }
2146
+ const xr = {
2101
2147
  owns: { outgoing: "Owns", incoming: "Owned by" },
2102
2148
  runs_on: { outgoing: "Runs on", incoming: "Running here" },
2103
2149
  uses: { outgoing: "Uses", incoming: "Used by" },
@@ -2106,19 +2152,19 @@ const ws = ({
2106
2152
  member_of: { outgoing: "Member of", incoming: "Members" },
2107
2153
  selects: { outgoing: "Selects", incoming: "Selected by" }
2108
2154
  };
2109
- function Ds(t, e) {
2110
- const n = Tr[t];
2155
+ function Ts(t, e) {
2156
+ const n = xr[t];
2111
2157
  if (n)
2112
2158
  return n[e];
2113
2159
  const r = t.replace(/_/g, " ");
2114
2160
  return e === "outgoing" ? r : `${r} (incoming)`;
2115
2161
  }
2116
- function Ar(t, e) {
2162
+ function Nr(t, e) {
2117
2163
  return t.pluginId === e.pluginId && t.connectionId === e.connectionId && t.resourceKey === e.resourceKey && t.id === e.id && (t.namespace ?? "") === (e.namespace ?? "");
2118
2164
  }
2119
- function xr(t, e) {
2165
+ function kr(t, e) {
2120
2166
  return e.map((n) => {
2121
- const r = Ar(n.source, t);
2167
+ const r = Nr(n.source, t);
2122
2168
  return {
2123
2169
  resource: r ? n.target : n.source,
2124
2170
  type: n.type,
@@ -2127,7 +2173,7 @@ function xr(t, e) {
2127
2173
  };
2128
2174
  });
2129
2175
  }
2130
- const Ps = ({
2176
+ const As = ({
2131
2177
  pluginID: t,
2132
2178
  connectionID: e,
2133
2179
  resourceKey: n,
@@ -2136,31 +2182,33 @@ const Ps = ({
2136
2182
  direction: i = "both",
2137
2183
  relationshipType: o,
2138
2184
  enabled: a = !0,
2139
- refetchInterval: c = Or
2185
+ refetchInterval: c = !1
2140
2186
  }) => {
2141
- const l = D(t), u = O({
2142
- queryKey: ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null],
2143
- queryFn: async () => Xt(l, e, n, s, r, i, o ?? null),
2144
- enabled: a && !!l && !!e && !!n && !!r,
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({
2190
+ queryKey: u,
2191
+ queryFn: async () => Vt(l, e, n, s, r, i, o ?? null),
2192
+ enabled: f,
2145
2193
  refetchInterval: c
2146
- }), y = {
2194
+ }), p = {
2147
2195
  pluginId: l,
2148
2196
  connectionId: e,
2149
2197
  resourceKey: n,
2150
2198
  id: r,
2151
2199
  namespace: s
2152
- }, f = u.data ?? [];
2200
+ }, g = d.data ?? [];
2153
2201
  return {
2154
2202
  /** One entry per edge, from the viewed resource's side. */
2155
- related: xr(y, f),
2203
+ related: kr(p, g),
2156
2204
  /** The raw graph edges. */
2157
- edges: f,
2158
- isLoading: u.isLoading,
2159
- isFetching: u.isFetching,
2160
- error: u.error,
2161
- refetch: u.refetch
2205
+ edges: g,
2206
+ isLoading: d.isLoading,
2207
+ isFetching: d.isFetching,
2208
+ error: d.error,
2209
+ refetch: d.refetch
2162
2210
  };
2163
- }, Os = ({
2211
+ }, Ds = ({
2164
2212
  pluginID: t,
2165
2213
  connectionID: e,
2166
2214
  resourceKey: n,
@@ -2168,54 +2216,80 @@ const Ps = ({
2168
2216
  namespace: s = "",
2169
2217
  maxDepth: i = 3,
2170
2218
  enabled: o = !0,
2171
- refetchInterval: a = 1e4
2219
+ refetchInterval: a = !1
2172
2220
  }) => {
2173
- const c = D(t), l = O({
2174
- queryKey: ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i],
2175
- queryFn: async () => Vt(c, e, n, s, r, i),
2176
- enabled: o && !!c && !!e && !!n && !!r,
2221
+ const c = P(t), l = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], u = o && !!c && !!e && !!n && !!r;
2222
+ we(c, e, l, u);
2223
+ const f = T({
2224
+ queryKey: l,
2225
+ queryFn: async () => en(c, e, n, s, r, i),
2226
+ enabled: u,
2177
2227
  refetchInterval: a
2178
2228
  });
2179
2229
  return {
2180
- tree: l.data ?? null,
2181
- isLoading: l.isLoading,
2182
- isFetching: l.isFetching,
2183
- error: l.error,
2184
- refetch: l.refetch
2230
+ tree: f.data ?? null,
2231
+ isLoading: f.isLoading,
2232
+ isFetching: f.isFetching,
2233
+ error: f.error,
2234
+ refetch: f.refetch
2235
+ };
2236
+ }, xs = ({
2237
+ pluginID: t,
2238
+ connectionID: e,
2239
+ resourceKey: n,
2240
+ resourceID: r,
2241
+ namespace: s = "",
2242
+ upDepth: i = 2,
2243
+ downDepth: o = 3,
2244
+ enabled: a = !0
2245
+ }) => {
2246
+ const c = P(t), l = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], u = a && !!c && !!e && !!n && !!r;
2247
+ we(c, e, l, u);
2248
+ const f = T({
2249
+ queryKey: l,
2250
+ queryFn: async () => tn(c, e, n, s, r, i, o),
2251
+ enabled: u
2252
+ });
2253
+ return {
2254
+ graph: f.data ?? null,
2255
+ isLoading: f.isLoading,
2256
+ isFetching: f.isFetching,
2257
+ error: f.error,
2258
+ refetch: f.refetch
2185
2259
  };
2186
- }, Ts = () => {
2187
- const t = b.useContext(je);
2260
+ }, Ns = () => {
2261
+ const t = w.useContext(Qe);
2188
2262
  if (!t)
2189
2263
  throw new Error("useSettings must be used within a SettingsProvider");
2190
2264
  return t;
2191
- }, As = ({ to: t, withinContext: e, ...n }) => {
2192
- const { pluginId: r } = ge();
2265
+ }, ks = ({ to: t, withinContext: e, ...n }) => {
2266
+ const { pluginId: r } = ye();
2193
2267
  r || console.error("Link used outside of a plugin context");
2194
2268
  const s = `/_plugin/${r}${t.startsWith("/") ? "" : "/"}${t}`;
2195
- return b.useMemo(() => /* @__PURE__ */ A(lt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
2269
+ return w.useMemo(() => /* @__PURE__ */ x(dt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
2196
2270
  };
2197
- function xs() {
2198
- const t = dt(), e = ft(), { pluginId: n } = ge();
2271
+ function Ls() {
2272
+ const t = ft(), e = pt(), { pluginId: n } = ye();
2199
2273
  n || console.error("usePluginRouter used outside of a plugin context");
2200
2274
  const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = k((o, a) => {
2201
2275
  const { ...c } = a ?? {};
2202
2276
  o.startsWith("/") ? t(`${r}${o}`, c) : t(o, c);
2203
2277
  }, [t, r]);
2204
- return ut(() => ({
2278
+ return lt(() => ({
2205
2279
  location: e,
2206
2280
  navigate: i,
2207
2281
  pluginPath: s
2208
2282
  }), [e, i, s]);
2209
2283
  }
2210
- class Ns {
2284
+ class Ms {
2211
2285
  }
2212
- class Ls {
2286
+ class qs {
2213
2287
  constructor() {
2214
- T(this, "_extensions");
2288
+ D(this, "_extensions");
2215
2289
  /**
2216
2290
  * The root component to render for the application window.
2217
2291
  */
2218
- T(this, "root");
2292
+ D(this, "root");
2219
2293
  /**
2220
2294
  * Various pages to render under the root component. These can be navigated to using
2221
2295
  * the built-in navigation system both programatically and through Links.
@@ -2245,8 +2319,8 @@ class Ls {
2245
2319
  * ```
2246
2320
  *
2247
2321
  */
2248
- T(this, "pages");
2249
- T(this, "_routes");
2322
+ D(this, "pages");
2323
+ D(this, "_routes");
2250
2324
  }
2251
2325
  get extensions() {
2252
2326
  return this._extensions || [];
@@ -2268,9 +2342,9 @@ class Ls {
2268
2342
  */
2269
2343
  get Window() {
2270
2344
  if (!this._routes && this.root)
2271
- return /* @__PURE__ */ A(this.root, {});
2272
- const e = pt(this._routes || []);
2273
- return /* @__PURE__ */ A(yt, { router: e });
2345
+ return /* @__PURE__ */ x(this.root, {});
2346
+ const e = gt(this._routes || []);
2347
+ return /* @__PURE__ */ x(yt, { router: e });
2274
2348
  }
2275
2349
  /**
2276
2350
  * Register extension points for other plugins to extend the functionality
@@ -2302,88 +2376,91 @@ class Ls {
2302
2376
  return this._routes = e, this;
2303
2377
  }
2304
2378
  }
2305
- var Nr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Nr || {});
2306
- const ks = (t) => {
2379
+ var Lr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Lr || {});
2380
+ const Us = (t) => {
2307
2381
  const e = t.split("::");
2308
2382
  return e.length === 1 ? { group: "core", version: "", kind: e[0] } : {
2309
2383
  group: e[0] || "core",
2310
2384
  version: e[1] || "",
2311
2385
  kind: e[2] || e[0]
2312
2386
  };
2313
- }, Ms = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
2387
+ }, $s = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
2314
2388
  export {
2315
- H as ALL_SESSIONS_KEY,
2316
- gn as BottomDrawerContext,
2317
- mn as ConfirmationModalContext,
2318
- $ as ErrorTypes,
2319
- Xr as ExtensionPointRegistry,
2320
- vn as ExtensionPointStore,
2321
- Zr as ExtensionProvider,
2322
- As as Link,
2323
- Qe as OperationsContext,
2324
- Yr as OperationsProvider,
2325
- ye as PluginContext,
2326
- Br as PluginContextProvider,
2327
- Nr as PluginErrorCode,
2328
- Ls as PluginWindow,
2329
- Ns as PluginWindowRootProps,
2330
- hn as RightDrawerContext,
2331
- je as SettingsContext,
2332
- zr as SettingsProvider,
2333
- Vr as SnackbarProvider,
2389
+ B as ALL_SESSIONS_KEY,
2390
+ mn as BottomDrawerContext,
2391
+ _n as ConfirmationModalContext,
2392
+ U as ErrorTypes,
2393
+ es as ExtensionPointRegistry,
2394
+ Fn as ExtensionPointStore,
2395
+ Vr as ExtensionProvider,
2396
+ ks as Link,
2397
+ Ke as OperationsContext,
2398
+ Zr as OperationsProvider,
2399
+ ge as PluginContext,
2400
+ zr as PluginContextProvider,
2401
+ Lr as PluginErrorCode,
2402
+ qs as PluginWindow,
2403
+ Ms as PluginWindowRootProps,
2404
+ Sn as RightDrawerContext,
2405
+ Qe as SettingsContext,
2406
+ Jr as SettingsProvider,
2407
+ ts as SnackbarProvider,
2334
2408
  F as WatchState,
2335
- pn as actionToSnackbar,
2336
- Ir as applyBatch,
2337
- Fn as connectionListQueryKey,
2409
+ yn as actionToSnackbar,
2410
+ Or as applyBatch,
2411
+ Pn as connectionListQueryKey,
2338
2412
  L as createErrorHandler,
2339
- yn as defaultState,
2340
- Ms as formatGroup,
2341
- We as isCancelledError,
2413
+ hn as defaultState,
2414
+ $s as formatGroup,
2415
+ Dr as graphChangedEvent,
2416
+ Ge as isCancelledError,
2342
2417
  Q as parseAppError,
2343
- ks as parseResourceKey,
2344
- Ds as relationshipLabel,
2418
+ Us as parseResourceKey,
2419
+ Ts as relationshipLabel,
2345
2420
  z as showAppError,
2346
- xr as toRelatedResources,
2347
- Fs as useActiveSyncs,
2348
- Ze as useBottomDrawer,
2349
- ps as useConfirmationModal,
2350
- es as useConnection,
2351
- ns as useConnectionNamespaces,
2352
- rs as useConnectionStatus,
2353
- ts as useConnections,
2354
- Os as useDependencyTree,
2355
- vs as useEditorSchemas,
2356
- Dr as useEventBatcher,
2357
- is as useExec,
2358
- bs as useExecuteAction,
2359
- Jr as useExtensionPoint,
2360
- bn as useExtensionRegistry,
2361
- as as useLogs,
2362
- cs as useMetricProviders,
2363
- Dn as useMetricProvidersForResource,
2364
- ls as useMetricStream,
2365
- Pr as useOperations,
2366
- ge as usePluginContext,
2367
- ss as usePluginData,
2368
- xs as usePluginRouter,
2369
- Hr as usePluginSettings,
2370
- ds as usePortForwardSessions,
2371
- Ps as useRelatedResources,
2372
- D as useResolvedPluginId,
2373
- ys as useResource,
2374
- Cs as useResourceActions,
2375
- gs as useResourceAreaComponent,
2376
- hs as useResourceGroups,
2377
- us as useResourceMetrics,
2378
- Es as useResourceMutations,
2379
- fs as useResourcePortForwarder,
2380
- ms as useResourceSearch,
2381
- Ss as useResourceType,
2382
- _s as useResourceTypes,
2383
- ws as useResources,
2384
- os as useRightDrawer,
2385
- Ts as useSettings,
2386
- U as useSnackbar,
2387
- Is as useStreamAction,
2388
- Rs as useWatchState
2421
+ kr as toRelatedResources,
2422
+ Ps as useActiveSyncs,
2423
+ Xe as useBottomDrawer,
2424
+ ys as useConfirmationModal,
2425
+ ns as useConnection,
2426
+ ss as useConnectionNamespaces,
2427
+ os as useConnectionStatus,
2428
+ rs as useConnections,
2429
+ Ds as useDependencyTree,
2430
+ Fs as useEditorSchemas,
2431
+ Tr as useEventBatcher,
2432
+ cs as useExec,
2433
+ Rs as useExecuteAction,
2434
+ Xr as useExtensionPoint,
2435
+ Rn as useExtensionRegistry,
2436
+ us as useLogs,
2437
+ ls as useMetricProviders,
2438
+ Tn as useMetricProvidersForResource,
2439
+ fs as useMetricStream,
2440
+ Ar as useOperations,
2441
+ ye as usePluginContext,
2442
+ is as usePluginData,
2443
+ Ls as usePluginRouter,
2444
+ Yr as usePluginSettings,
2445
+ ps as usePortForwardSessions,
2446
+ we as useRefetchOnGraphChange,
2447
+ As as useRelatedResources,
2448
+ P as useResolvedPluginId,
2449
+ hs as useResource,
2450
+ vs as useResourceActions,
2451
+ ms as useResourceAreaComponent,
2452
+ xs as useResourceGraph,
2453
+ Ss as useResourceGroups,
2454
+ ds as useResourceMetrics,
2455
+ bs as useResourceMutations,
2456
+ gs as useResourcePortForwarder,
2457
+ _s as useResourceSearch,
2458
+ Es as useResourceType,
2459
+ ws as useResourceTypes,
2460
+ Cs as useResources,
2461
+ as as useRightDrawer,
2462
+ Ns as useSettings,
2463
+ W as useSnackbar,
2464
+ Os as useStreamAction,
2465
+ Is as useWatchState
2389
2466
  };