@omniviewdev/runtime 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var k = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as R, jsxs as ce } from "react/jsx-runtime";
5
5
  import S, { useContext as ne, createContext as he, useState as q, useRef as $, useEffect as j, useCallback as U, useMemo as Kt } from "react";
6
6
  import { Link as zt, useNavigate as Qt, useLocation as Wt, createMemoryRouter as Bt, RouterProvider as Ht } from "react-router-dom";
7
- import { P as Yt, G as Jt, V as Vt, S as Xt, h as it, U as Zt, R as en, i as tn, j as at, k as nn, L as rn, l as sn, m as on, n as an, o as cn, q as un, r as ln, s as dn, t as fn, Q as pn, u as yn, v as We, w as hn, x as ct, F as gn, y as mn, z as ut, D as lt, A as _n, B as En, E as Sn, H as dt, I as wn, J as Cn, K as ft, M as bn, N as vn, O as Dn, T as Pn, W as Rn, X as In, Y as Fn } from "./Client-RGYOEzh2.js";
7
+ import { P as Yt, G as Jt, V as Vt, S as Xt, h as it, U as Zt, R as en, i as tn, j as at, k as nn, L as rn, l as sn, m as on, n as an, o as cn, q as un, r as ln, s as dn, t as fn, Q as pn, u as yn, v as We, w as hn, x as ct, F as gn, y as mn, z as ut, D as lt, A as _n, B as En, E as Sn, H as dt, I as Cn, J as wn, K as ft, M as bn, N as vn, O as Dn, T as Pn, W as Rn, X as In, Y as Fn } from "./Client-RGYOEzh2.js";
8
8
  import { config as On, resource as A, exec as xn, logs as Be, networker as He } from "./models.js";
9
9
  import { useQueryClient as G, useMutation as v, useQuery as P, keepPreviousData as pt, useQueries as An } from "@tanstack/react-query";
10
10
  import { useNotificationStack as Tn } from "@omniviewdev/ui/feedback";
@@ -251,7 +251,7 @@ function $e() {
251
251
  function Ss() {
252
252
  return $e().settings;
253
253
  }
254
- const mt = he(void 0), ws = ({ children: e }) => {
254
+ const mt = he(void 0), Cs = ({ children: e }) => {
255
255
  const [t, n] = q({}), r = () => {
256
256
  Vt().then((o) => {
257
257
  console.log("Fetched settings:", o), n(o);
@@ -290,7 +290,7 @@ const mt = he(void 0), ws = ({ children: e }) => {
290
290
  },
291
291
  fullscreenDrawer: () => {
292
292
  }
293
- }, Ln = S.createContext(Mn), $n = he(void 0), Un = S.createContext(void 0), _t = S.createContext(void 0), qn = 3e4, Cs = ({ children: e }) => {
293
+ }, Ln = S.createContext(Mn), $n = he(void 0), Un = S.createContext(void 0), _t = S.createContext(void 0), qn = 3e4, ws = ({ children: e }) => {
294
294
  const [t, n] = S.useState([]), r = S.useCallback((a) => {
295
295
  n((u) => [a, ...u]);
296
296
  }, []), s = S.useCallback((a, u) => {
@@ -361,11 +361,11 @@ function ue(e) {
361
361
  (function(e) {
362
362
  e.debug = ue("debug"), e.log = ue("log"), e.warn = ue("warn"), e.error = ue("error");
363
363
  })(Fe || (Fe = {}));
364
- const St = he(void 0), wt = () => ne(St), bs = (e) => {
365
- const t = wt();
364
+ const St = he(void 0), Ct = () => ne(St), bs = (e) => {
365
+ const t = Ct();
366
366
  return t == null ? void 0 : t.getExtensionPoint(e);
367
367
  }, vs = (e) => {
368
- const t = wt(), n = t == null ? void 0 : t.getExtensionPoint(e);
368
+ const t = Ct(), n = t == null ? void 0 : t.getExtensionPoint(e);
369
369
  return n ? n.provide({ getCacheKey: () => e }) : [];
370
370
  }, Ds = ({ registry: e, children: t }) => {
371
371
  const n = S.useRef(e);
@@ -593,7 +593,7 @@ class Ps {
593
593
  return Object.values(this.store).map((t) => t.settings());
594
594
  }
595
595
  }
596
- const Ct = he(void 0), Wn = {
596
+ const wt = he(void 0), Wn = {
597
597
  default: "info",
598
598
  info: "info",
599
599
  success: "success",
@@ -622,9 +622,9 @@ const Ct = he(void 0), Wn = {
622
622
  actions: h
623
623
  });
624
624
  };
625
- return /* @__PURE__ */ R(Ct.Provider, { value: { showSnackbar: o }, children: e });
625
+ return /* @__PURE__ */ R(wt.Provider, { value: { showSnackbar: o }, children: e });
626
626
  }, L = () => {
627
- const e = ne(Ct);
627
+ const e = ne(wt);
628
628
  if (e === void 0)
629
629
  throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
630
630
  return e;
@@ -739,14 +739,14 @@ const Is = ({ pluginID: e, connectionID: t }) => {
739
739
  queryFn: async () => sn(n, t)
740
740
  })
741
741
  };
742
- }, w = A.WatchState, xs = A.SyncPolicy;
742
+ }, C = A.WatchState, xs = A.SyncPolicy;
743
743
  function Oe(e) {
744
744
  const t = Object.values(e.states), n = t.length;
745
745
  let r = 0, s = 0, o = 0, i = 0;
746
746
  for (const c of t)
747
- c === w.SYNCED && r++, (c === w.ERROR || c === w.FAILED) && s++, c === w.FORBIDDEN && o++, c === w.SKIPPED && i++;
747
+ c === C.SYNCED && r++, (c === C.ERROR || c === C.FAILED) && s++, c === C.FORBIDDEN && o++, c === C.SKIPPED && i++;
748
748
  const a = n - i, u = t.filter(
749
- (c) => c === w.SYNCED || c === w.ERROR || c === w.STOPPED || c === w.FAILED || c === w.FORBIDDEN
749
+ (c) => c === C.SYNCED || c === C.ERROR || c === C.STOPPED || c === C.FAILED || c === C.FORBIDDEN
750
750
  ).length, l = a > 0 ? u / a : 0;
751
751
  return {
752
752
  pluginID: e.pluginID,
@@ -790,9 +790,9 @@ function As() {
790
790
  on().then((y) => {
791
791
  if (!y) return;
792
792
  const m = {}, p = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map();
793
- for (const [_, C] of Object.entries(y)) {
794
- m[_] = C.map((F) => F.connection);
795
- for (const F of C) {
793
+ for (const [_, w] of Object.entries(y)) {
794
+ m[_] = w.map((F) => F.connection);
795
+ for (const F of w) {
796
796
  if (!F.started) continue;
797
797
  const b = `${_}/${F.connection.id}`;
798
798
  p.add(b);
@@ -802,8 +802,8 @@ function As() {
802
802
  states: {}
803
803
  };
804
804
  if (F.resources)
805
- for (const [Ce, se] of Object.entries(F.resources))
806
- z.states[Ce] = se;
805
+ for (const [we, se] of Object.entries(F.resources))
806
+ z.states[we] = se;
807
807
  i.current.set(b, z), E.set(b, Oe(z));
808
808
  }
809
809
  }
@@ -830,13 +830,13 @@ function As() {
830
830
  const m = Ue(y);
831
831
  t((_) => {
832
832
  if (_.has(m)) return _;
833
- const C = new Set(_);
834
- return C.add(m), C;
833
+ const w = new Set(_);
834
+ return w.add(m), w;
835
835
  });
836
836
  const p = Dt(i.current, y), E = Oe(p);
837
837
  o((_) => {
838
- const C = new Map(_);
839
- return C.set(m, E), C;
838
+ const w = new Map(_);
839
+ return w.set(m, E), w;
840
840
  });
841
841
  }, []);
842
842
  j(() => x("watch/STATE", a), [a]);
@@ -846,14 +846,14 @@ function As() {
846
846
  await at(y, m);
847
847
  }, []), c = [];
848
848
  for (const y of e) {
849
- const [m, p] = y.split("/", 2), _ = (n[m] ?? []).find((z) => z.id === p), C = s.get(y), F = C != null && !de(C), b = C != null && C.errorCount > 0;
849
+ const [m, p] = y.split("/", 2), _ = (n[m] ?? []).find((z) => z.id === p), w = s.get(y), F = w != null && !de(w), b = w != null && w.errorCount > 0;
850
850
  c.push({
851
851
  pluginID: m,
852
852
  connectionID: p,
853
853
  name: (_ == null ? void 0 : _.name) ?? p,
854
854
  avatar: (_ == null ? void 0 : _.avatar) ?? "",
855
855
  isStarted: !0,
856
- sync: C,
856
+ sync: w,
857
857
  isSyncing: F,
858
858
  hasErrors: b
859
859
  });
@@ -1094,7 +1094,7 @@ const Ns = () => {
1094
1094
  metricIDs: a = [],
1095
1095
  interval: u = 1e4,
1096
1096
  enabled: l = !0
1097
- } = e, c = D(t), [g, f] = q(null), [d, h] = q(null), [y, m] = q(!1), [p, E] = q(null), _ = $(null), C = U(async () => {
1097
+ } = e, c = D(t), [g, f] = q(null), [d, h] = q(null), [y, m] = q(!1), [p, E] = q(null), _ = $(null), w = U(async () => {
1098
1098
  if (!(!l || !c || !n || !r || !s))
1099
1099
  try {
1100
1100
  const b = await yn(c, n, {
@@ -1114,7 +1114,7 @@ const Ns = () => {
1114
1114
  } catch (Q) {
1115
1115
  console.error("Failed to parse metric stream data:", Q);
1116
1116
  }
1117
- }), Ce = x(`core/metrics/error/${b}`, (se) => {
1117
+ }), we = x(`core/metrics/error/${b}`, (se) => {
1118
1118
  try {
1119
1119
  const Q = JSON.parse(se);
1120
1120
  E(Q.error || "Unknown error");
@@ -1123,7 +1123,7 @@ const Ns = () => {
1123
1123
  }
1124
1124
  });
1125
1125
  _.current = () => {
1126
- z(), Ce();
1126
+ z(), we();
1127
1127
  };
1128
1128
  } catch (b) {
1129
1129
  E(b instanceof Error ? b.message : String(b));
@@ -1144,7 +1144,7 @@ const Ns = () => {
1144
1144
  subscriptionID: d,
1145
1145
  isStreaming: y,
1146
1146
  error: p,
1147
- start: C,
1147
+ start: w,
1148
1148
  stop: F
1149
1149
  };
1150
1150
  }, X = ["networker", "portforward", "all-sessions"];
@@ -1246,7 +1246,7 @@ const Gs = () => {
1246
1246
  namespace: s = ""
1247
1247
  }) => {
1248
1248
  const o = D(e), i = G(), { showSnackbar: a } = L(), u = ["RESOURCE", o, t, n, r, s], { mutateAsync: l } = v({
1249
- mutationFn: async (f) => ut(o, t, n, A.UpdateInput.createFrom({
1249
+ mutationFn: async (f) => ut(o, t, n, A.ClientUpdateInput.createFrom({
1250
1250
  input: f.input,
1251
1251
  id: r,
1252
1252
  namespace: s
@@ -1343,7 +1343,7 @@ const Gs = () => {
1343
1343
  */
1344
1344
  resourceType: P({
1345
1345
  queryKey: [n, "resources", t],
1346
- queryFn: async () => wn(n, t),
1346
+ queryFn: async () => Cn(n, t),
1347
1347
  retry: !1
1348
1348
  })
1349
1349
  };
@@ -1355,7 +1355,7 @@ const Gs = () => {
1355
1355
  */
1356
1356
  types: P({
1357
1357
  queryKey: [n, "resources", "list"],
1358
- queryFn: async () => Cn(n, t),
1358
+ queryFn: async () => wn(n, t),
1359
1359
  retry: !1
1360
1360
  })
1361
1361
  };
@@ -1826,8 +1826,8 @@ var le = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1826
1826
  function cr(e) {
1827
1827
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1828
1828
  }
1829
- var ur = "Expected a function", Nt = "__lodash_hash_undefined__", lr = "[object Function]", dr = "[object GeneratorFunction]", fr = "[object Symbol]", pr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, yr = /^\w*$/, hr = /^\./, gr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, mr = /[\\^$.*+?()[\]{}|]/g, _r = /\\(\\)?/g, Er = /^\[object .+?Constructor\]$/, Sr = typeof le == "object" && le && le.Object === Object && le, wr = typeof self == "object" && self && self.Object === Object && self, Ge = Sr || wr || Function("return this")();
1830
- function Cr(e, t) {
1829
+ var ur = "Expected a function", Nt = "__lodash_hash_undefined__", lr = "[object Function]", dr = "[object GeneratorFunction]", fr = "[object Symbol]", pr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, yr = /^\w*$/, hr = /^\./, gr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, mr = /[\\^$.*+?()[\]{}|]/g, _r = /\\(\\)?/g, Er = /^\[object .+?Constructor\]$/, Sr = typeof le == "object" && le && le.Object === Object && le, Cr = typeof self == "object" && self && self.Object === Object && self, Ge = Sr || Cr || Function("return this")();
1830
+ function wr(e, t) {
1831
1831
  return e == null ? void 0 : e[t];
1832
1832
  }
1833
1833
  function br(e) {
@@ -1927,16 +1927,16 @@ function Ur() {
1927
1927
  };
1928
1928
  }
1929
1929
  function qr(e) {
1930
- return we(this, e).delete(e);
1930
+ return Ce(this, e).delete(e);
1931
1931
  }
1932
1932
  function jr(e) {
1933
- return we(this, e).get(e);
1933
+ return Ce(this, e).get(e);
1934
1934
  }
1935
1935
  function Gr(e) {
1936
- return we(this, e).has(e);
1936
+ return Ce(this, e).has(e);
1937
1937
  }
1938
1938
  function Kr(e, t) {
1939
- return we(this, e).set(e, t), this;
1939
+ return Ce(this, e).set(e, t), this;
1940
1940
  }
1941
1941
  J.prototype.clear = Ur;
1942
1942
  J.prototype.delete = qr;
@@ -1972,12 +1972,12 @@ function Wr(e) {
1972
1972
  function Br(e) {
1973
1973
  return Ut(e) ? e : Vr(e);
1974
1974
  }
1975
- function we(e, t) {
1975
+ function Ce(e, t) {
1976
1976
  var n = e.__data__;
1977
1977
  return Yr(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
1978
1978
  }
1979
1979
  function $t(e, t) {
1980
- var n = Cr(e, t);
1980
+ var n = wr(e, t);
1981
1981
  return Qr(n) ? n : void 0;
1982
1982
  }
1983
1983
  function Hr(e, t) {
@@ -2126,15 +2126,15 @@ const Ys = ({
2126
2126
  (m, p) => [o, t, n, p, m],
2127
2127
  [o, t, n]
2128
2128
  ), { mutateAsync: g } = v({
2129
- mutationFn: async (m) => ft(o, t, n, A.CreateInput.createFrom({
2129
+ mutationFn: async (m) => ft(o, t, n, A.ClientCreateInput.createFrom({
2130
2130
  input: m.input,
2131
2131
  namespace: m.namespace ?? (u.length === 1 ? u[0] : "")
2132
2132
  })),
2133
2133
  onSuccess: async (m) => {
2134
- var C;
2134
+ var w;
2135
2135
  const p = m.result;
2136
2136
  let E = "";
2137
- (C = p == null ? void 0 : p.metadata) != null && C.name ? E = p.metadata.name : p != null && p.id ? E = p.id : p != null && p.name ? E = p.name : p != null && p.ID ? E = p.ID : p != null && p.Name && (E = p.Name);
2137
+ (w = p == null ? void 0 : p.metadata) != null && w.name ? E = p.metadata.name : p != null && p.id ? E = p.id : p != null && p.name ? E = p.name : p != null && p.ID ? E = p.ID : p != null && p.Name && (E = p.Name);
2138
2138
  const _ = E ? `Resource ${E} created` : "Resource created";
2139
2139
  a(_, "success"), await i.invalidateQueries({ queryKey: l });
2140
2140
  },
@@ -2149,7 +2149,7 @@ const Ys = ({
2149
2149
  placeholderData: (m, p) => m,
2150
2150
  retry: !1
2151
2151
  }), [d, h] = S.useState(
2152
- w.IDLE
2152
+ C.IDLE
2153
2153
  );
2154
2154
  S.useEffect(() => x(
2155
2155
  `${o}/${t}/watch/STATE`,
@@ -2192,11 +2192,11 @@ const Ys = ({
2192
2192
  /** Current watch state for this resource type */
2193
2193
  watchState: d,
2194
2194
  /** Whether the watch is currently syncing */
2195
- isSyncing: d === w.SYNCING,
2195
+ isSyncing: d === C.SYNCING,
2196
2196
  /** Whether the watch has fully synced */
2197
- isSynced: d === w.SYNCED,
2197
+ isSynced: d === C.SYNCED,
2198
2198
  /** Whether the watch encountered an error */
2199
- watchError: d === w.ERROR
2199
+ watchError: d === C.ERROR
2200
2200
  };
2201
2201
  }, Js = ({ pluginID: e }) => {
2202
2202
  const t = D(e), { showSnackbar: n } = L(), r = v({
@@ -2204,7 +2204,7 @@ const Ys = ({
2204
2204
  t,
2205
2205
  i.connectionID,
2206
2206
  i.resourceKey,
2207
- A.CreateInput.createFrom({
2207
+ A.ClientCreateInput.createFrom({
2208
2208
  input: a.input,
2209
2209
  namespace: a.namespace ?? i.namespace ?? ""
2210
2210
  })
@@ -2220,7 +2220,7 @@ const Ys = ({
2220
2220
  t,
2221
2221
  i.connectionID,
2222
2222
  i.resourceKey,
2223
- A.UpdateInput.createFrom({
2223
+ A.ClientUpdateInput.createFrom({
2224
2224
  input: a.input,
2225
2225
  id: i.resourceID,
2226
2226
  namespace: i.namespace ?? ""
@@ -2329,7 +2329,7 @@ const Ys = ({
2329
2329
  h.resources[f.resourceKey] = f.state, h.resourceCounts[f.resourceKey] = f.resourceCount;
2330
2330
  let y = 0, m = 0;
2331
2331
  for (const p of Object.values(h.resources))
2332
- p === w.SYNCED && y++, (p === w.ERROR || p === w.FAILED) && m++;
2332
+ p === C.SYNCED && y++, (p === C.ERROR || p === C.FAILED) && m++;
2333
2333
  h.syncedCount = y, h.errorCount = m;
2334
2334
  }));
2335
2335
  }, [s, r, t]), l = P({
@@ -2338,7 +2338,7 @@ const Ys = ({
2338
2338
  const f = await In(r, t), d = {};
2339
2339
  let h = 0, y = 0;
2340
2340
  for (const [p, E] of Object.entries(f.resources ?? {}))
2341
- d[p] = E, E === w.SYNCED && h++, E === w.ERROR && y++;
2341
+ d[p] = E, E === C.SYNCED && h++, E === C.ERROR && y++;
2342
2342
  const m = {};
2343
2343
  for (const [p, E] of Object.entries(f.resourceCounts ?? {}))
2344
2344
  m[p] = E;
@@ -2357,7 +2357,7 @@ const Ys = ({
2357
2357
  if (!d || d.totalResources === 0) return 3e3;
2358
2358
  let h = 0;
2359
2359
  for (const y of Object.values(d.resources))
2360
- (y === w.SYNCED || y === w.ERROR || y === w.STOPPED || y === w.FAILED || y === w.FORBIDDEN || y === w.SKIPPED) && h++;
2360
+ (y === C.SYNCED || y === C.ERROR || y === C.STOPPED || y === C.FAILED || y === C.FORBIDDEN || y === C.SKIPPED) && h++;
2361
2361
  return h >= d.totalResources ? !1 : 3e3;
2362
2362
  }
2363
2363
  });
@@ -2386,7 +2386,7 @@ const Ys = ({
2386
2386
  let g = 0;
2387
2387
  if (c != null && c.resources)
2388
2388
  for (const f of Object.values(c.resources))
2389
- (f === w.SYNCED || f === w.ERROR || f === w.STOPPED || f === w.FAILED || f === w.FORBIDDEN || f === w.SKIPPED) && g++;
2389
+ (f === C.SYNCED || f === C.ERROR || f === C.STOPPED || f === C.FAILED || f === C.FORBIDDEN || f === C.SKIPPED) && g++;
2390
2390
  return {
2391
2391
  /** Full summary query result */
2392
2392
  summary: l,
@@ -2467,7 +2467,7 @@ const Ys = ({
2467
2467
  startedAt: Date.now()
2468
2468
  });
2469
2469
  const y = `action/stream/${h}`, m = x(y, (p) => {
2470
- var E, _, C, F;
2470
+ var E, _, w, F;
2471
2471
  switch (p.type) {
2472
2472
  case "progress": {
2473
2473
  const b = p.data ?? {};
@@ -2487,7 +2487,7 @@ const Ys = ({
2487
2487
  case "error":
2488
2488
  i(h, {
2489
2489
  status: "error",
2490
- message: ((C = p.data) == null ? void 0 : C.message) ?? "Failed",
2490
+ message: ((w = p.data) == null ? void 0 : w.message) ?? "Failed",
2491
2491
  completedAt: Date.now()
2492
2492
  }), s(((F = p.data) == null ? void 0 : F.message) ?? f + " failed", "error"), be(y);
2493
2493
  break;
@@ -2640,7 +2640,7 @@ export {
2640
2640
  Ds as ExtensionProvider,
2641
2641
  so as Link,
2642
2642
  _t as OperationsContext,
2643
- Cs as OperationsProvider,
2643
+ ws as OperationsProvider,
2644
2644
  Le as PluginContext,
2645
2645
  Es as PluginContextProvider,
2646
2646
  us as PluginErrorCode,
@@ -2648,10 +2648,10 @@ export {
2648
2648
  io as PluginWindowRootProps,
2649
2649
  $n as RightDrawerContext,
2650
2650
  mt as SettingsContext,
2651
- ws as SettingsProvider,
2651
+ Cs as SettingsProvider,
2652
2652
  Rs as SnackbarProvider,
2653
2653
  xs as SyncPolicy,
2654
- w as WatchState,
2654
+ C as WatchState,
2655
2655
  kn as actionToSnackbar,
2656
2656
  is as applyBatch,
2657
2657
  Bn as connectionListQueryKey,
@@ -2675,7 +2675,7 @@ export {
2675
2675
  Xs as useExecuteAction,
2676
2676
  bs as useExtensionPoint,
2677
2677
  vs as useExtensionPointComponents,
2678
- wt as useExtensionRegistry,
2678
+ Ct as useExtensionRegistry,
2679
2679
  Ms as useLogs,
2680
2680
  Ls as useMetricProviders,
2681
2681
  Jn as useMetricProvidersForResource,