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