@omniviewdev/runtime 0.1.8 → 0.1.9
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-BtQwAB3N.cjs +1 -0
- package/dist/{Client-9Aa3u0B7.js → Client-DRRyPmcf.js} +151 -141
- package/dist/api.cjs +1 -1
- package/dist/api.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +710 -708
- package/dist/models.cjs +1 -1
- package/dist/models.js +3 -3
- package/dist/wailsjs/go/models.d.ts +6 -6
- package/dist/wailsjs/go/resource/Client.d.ts +4 -0
- package/package.json +1 -1
- package/dist/Client-B7h6-bCB.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var zt = Object.defineProperty;
|
|
2
|
-
var Wt = (e, t,
|
|
3
|
-
var M = (e, t,
|
|
2
|
+
var Wt = (e, t, r) => t in e ? zt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var M = (e, t, r) => Wt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { jsx as F, jsxs as ae } from "react/jsx-runtime";
|
|
5
|
-
import _, { useContext as te, createContext as me, useState as q, useRef as de, useEffect as
|
|
5
|
+
import _, { useContext as te, createContext as me, useState as q, useRef as de, useEffect as Q, useCallback as V, useMemo as Ht } from "react";
|
|
6
6
|
import { Link as Bt, useNavigate as Yt, useLocation as Jt, createMemoryRouter as Vt, RouterProvider as Xt } from "react-router-dom";
|
|
7
|
-
import { P as Zt, G as
|
|
8
|
-
import { config as
|
|
9
|
-
import { useQueryClient as G, useMutation as v, useQuery as D, keepPreviousData as gt, useQueries as
|
|
10
|
-
import { useNotificationStack as
|
|
7
|
+
import { P as Zt, G as er, V as tr, S as rr, h as lt, U as nr, R as sr, i as or, j as dt, k as ir, L as ar, l as cr, m as Ye, n as ur, o as lr, q as dr, r as fr, s as pr, Q as yr, t as hr, u as Je, v as mr, w as ft, F as gr, x as _r, y as pt, D as yt, z as wr, A as Sr, B as Cr, E as ht, H as Er, I as br, J as mt, K as vr, M as Pr, N as Dr, O as Fr, T as xr, W as Ir, X as Or } from "./Client-DRRyPmcf.js";
|
|
8
|
+
import { config as Ar, exec as Tr, logs as Ve, networker as Xe, types as T } from "./models.js";
|
|
9
|
+
import { useQueryClient as G, useMutation as v, useQuery as D, keepPreviousData as gt, useQueries as Nr } from "@tanstack/react-query";
|
|
10
|
+
import { useNotificationStack as Rr } from "@omniviewdev/ui/feedback";
|
|
11
11
|
import { EventsOn as A, BrowserOpenURL as _t, EventsOff as be } from "./runtime.js";
|
|
12
12
|
const $e = _.createContext(void 0), xe = {
|
|
13
13
|
// Plugin
|
|
@@ -38,7 +38,7 @@ const $e = _.createContext(void 0), xe = {
|
|
|
38
38
|
VALIDATION: "omniview:validation",
|
|
39
39
|
NOT_IMPLEMENTED: "omniview:not-implemented"
|
|
40
40
|
};
|
|
41
|
-
function
|
|
41
|
+
function U(e) {
|
|
42
42
|
if (e == null)
|
|
43
43
|
return {
|
|
44
44
|
type: xe.INTERNAL,
|
|
@@ -49,9 +49,9 @@ function K(e) {
|
|
|
49
49
|
let t;
|
|
50
50
|
if (typeof e == "string" ? t = e : e instanceof Error ? t = e.message : t = String(e), t.startsWith("{"))
|
|
51
51
|
try {
|
|
52
|
-
const
|
|
53
|
-
if (typeof
|
|
54
|
-
return
|
|
52
|
+
const r = JSON.parse(t);
|
|
53
|
+
if (typeof r.type == "string" && typeof r.title == "string" && typeof r.status == "number" && typeof r.detail == "string")
|
|
54
|
+
return r;
|
|
55
55
|
} catch {
|
|
56
56
|
}
|
|
57
57
|
return {
|
|
@@ -62,9 +62,9 @@ function K(e) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
function wt(e) {
|
|
65
|
-
return e == null ? !1 : (typeof e == "string" ? e : e instanceof Error ? e.message : String(e)) === "cancelled" ? !0 :
|
|
65
|
+
return e == null ? !1 : (typeof e == "string" ? e : e instanceof Error ? e.message : String(e)) === "cancelled" ? !0 : U(e).type === xe.CANCELLED;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function kr(e) {
|
|
68
68
|
switch (e.type) {
|
|
69
69
|
case "navigate":
|
|
70
70
|
return {
|
|
@@ -103,7 +103,7 @@ function kn(e) {
|
|
|
103
103
|
}
|
|
104
104
|
function St(e, t) {
|
|
105
105
|
var s, i;
|
|
106
|
-
const
|
|
106
|
+
const r = [
|
|
107
107
|
e.detail,
|
|
108
108
|
...((s = e.suggestions) == null ? void 0 : s.map((o) => `• ${o}`)) ?? []
|
|
109
109
|
].join(`
|
|
@@ -111,47 +111,47 @@ function St(e, t) {
|
|
|
111
111
|
return {
|
|
112
112
|
message: t || (e.title !== "Error" ? e.title : "Operation failed"),
|
|
113
113
|
status: "error",
|
|
114
|
-
details:
|
|
115
|
-
actions: (i = e.actions) == null ? void 0 : i.map(
|
|
114
|
+
details: r,
|
|
115
|
+
actions: (i = e.actions) == null ? void 0 : i.map(kr)
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
function X(e, t,
|
|
118
|
+
function X(e, t, r) {
|
|
119
119
|
if (wt(t)) return;
|
|
120
|
-
const
|
|
121
|
-
e(St(
|
|
120
|
+
const n = U(t);
|
|
121
|
+
e(St(n, r));
|
|
122
122
|
}
|
|
123
123
|
function I(e, t) {
|
|
124
|
-
return (
|
|
125
|
-
if (wt(
|
|
126
|
-
const
|
|
127
|
-
e(St(
|
|
124
|
+
return (r) => {
|
|
125
|
+
if (wt(r)) return;
|
|
126
|
+
const n = U(r);
|
|
127
|
+
e(St(n, n.title !== "Error" ? n.title : t));
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
const { children: t, pluginId:
|
|
132
|
-
console.debug("[PluginContextProvider] render", { pluginId:
|
|
130
|
+
function ws(e) {
|
|
131
|
+
const { children: t, pluginId: r } = e, [n, s] = _.useState({}), [i, o] = _.useState(new Ar.PluginMeta()), [a, c] = _.useState(!1), [l, u] = _.useState(null);
|
|
132
|
+
console.debug("[PluginContextProvider] render", { pluginId: r, metaLoaded: a, metaError: !!l });
|
|
133
133
|
const y = () => {
|
|
134
|
-
|
|
135
|
-
console.debug(`[PluginContextProvider] settings loaded for "${
|
|
134
|
+
r === void 0 || r === "" || (console.debug(`[PluginContextProvider] fetching settings for "${r}"`), Zt(r).then((f) => {
|
|
135
|
+
console.debug(`[PluginContextProvider] settings loaded for "${r}"`, Object.keys(f)), s(f);
|
|
136
136
|
}).catch((f) => {
|
|
137
|
-
const m =
|
|
138
|
-
console.error(`[PluginContextProvider] error fetching settings for "${
|
|
137
|
+
const m = U(f);
|
|
138
|
+
console.error(`[PluginContextProvider] error fetching settings for "${r}":`, m.detail);
|
|
139
139
|
}));
|
|
140
140
|
}, h = () => {
|
|
141
|
-
if (
|
|
141
|
+
if (r === void 0 || r === "") {
|
|
142
142
|
console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
console.debug(`[PluginContextProvider] fetching meta for "${
|
|
146
|
-
console.debug(`[PluginContextProvider] meta loaded for "${
|
|
145
|
+
console.debug(`[PluginContextProvider] fetching meta for "${r}"`), u(null), er(r).then((f) => {
|
|
146
|
+
console.debug(`[PluginContextProvider] meta loaded for "${r}"`, { name: f == null ? void 0 : f.name, version: f == null ? void 0 : f.version }), o(f), c(!0);
|
|
147
147
|
}).catch((f) => {
|
|
148
|
-
const m =
|
|
149
|
-
console.error(`[PluginContextProvider] error fetching meta for "${
|
|
148
|
+
const m = U(f);
|
|
149
|
+
console.error(`[PluginContextProvider] error fetching meta for "${r}":`, m.detail), u(m.detail), c(!1);
|
|
150
150
|
});
|
|
151
151
|
};
|
|
152
152
|
return _.useEffect(() => {
|
|
153
|
-
console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${
|
|
154
|
-
}, [
|
|
153
|
+
console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${r}"`), y(), h();
|
|
154
|
+
}, [r]), l ? /* @__PURE__ */ F("div", { style: {
|
|
155
155
|
display: "flex",
|
|
156
156
|
flex: 1,
|
|
157
157
|
alignItems: "center",
|
|
@@ -192,7 +192,7 @@ function gs(e) {
|
|
|
192
192
|
children: "Retry"
|
|
193
193
|
}
|
|
194
194
|
)
|
|
195
|
-
] }) }) : a ? /* @__PURE__ */ F($e.Provider, { value: { pluginId:
|
|
195
|
+
] }) }) : a ? /* @__PURE__ */ F($e.Provider, { value: { pluginId: r, settings: n, meta: i }, children: t }) : /* @__PURE__ */ ae("div", { style: {
|
|
196
196
|
display: "flex",
|
|
197
197
|
flex: 1,
|
|
198
198
|
alignItems: "center",
|
|
@@ -215,25 +215,25 @@ function Le() {
|
|
|
215
215
|
throw new Error("usePluginContext must be used within a PluginContextProvider");
|
|
216
216
|
return e;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function Ss() {
|
|
219
219
|
return Le().settings;
|
|
220
220
|
}
|
|
221
|
-
const Ct = me(void 0),
|
|
222
|
-
const [t,
|
|
223
|
-
|
|
224
|
-
console.log("Fetched settings:", i),
|
|
221
|
+
const Ct = me(void 0), Cs = ({ children: e }) => {
|
|
222
|
+
const [t, r] = q({}), n = () => {
|
|
223
|
+
tr().then((i) => {
|
|
224
|
+
console.log("Fetched settings:", i), r(i);
|
|
225
225
|
}).catch((i) => {
|
|
226
226
|
console.error("Error fetching settings:", i);
|
|
227
227
|
});
|
|
228
228
|
};
|
|
229
229
|
_.useEffect(() => {
|
|
230
|
-
|
|
230
|
+
n();
|
|
231
231
|
}, []);
|
|
232
232
|
const s = () => {
|
|
233
|
-
|
|
233
|
+
n();
|
|
234
234
|
};
|
|
235
235
|
return /* @__PURE__ */ F(Ct.Provider, { value: { settings: t, reload: s }, children: e });
|
|
236
|
-
},
|
|
236
|
+
}, Mr = {
|
|
237
237
|
height: 32,
|
|
238
238
|
focused: 0,
|
|
239
239
|
tabs: [],
|
|
@@ -257,69 +257,69 @@ const Ct = me(void 0), ws = ({ children: e }) => {
|
|
|
257
257
|
},
|
|
258
258
|
fullscreenDrawer: () => {
|
|
259
259
|
}
|
|
260
|
-
},
|
|
261
|
-
const [t,
|
|
262
|
-
|
|
260
|
+
}, $r = _.createContext(Mr), Lr = me(void 0), qr = _.createContext(void 0), Et = _.createContext(void 0), Gr = 3e4, Es = ({ children: e }) => {
|
|
261
|
+
const [t, r] = _.useState([]), n = _.useCallback((a) => {
|
|
262
|
+
r((c) => [a, ...c]);
|
|
263
263
|
}, []), s = _.useCallback((a, c) => {
|
|
264
|
-
|
|
264
|
+
r(
|
|
265
265
|
(l) => l.map((u) => u.id === a ? { ...u, ...c } : u)
|
|
266
266
|
);
|
|
267
267
|
}, []), i = _.useCallback((a) => {
|
|
268
|
-
|
|
268
|
+
r((c) => c.filter((l) => l.id !== a));
|
|
269
269
|
}, []);
|
|
270
270
|
_.useEffect(() => {
|
|
271
271
|
const a = [];
|
|
272
272
|
for (const c of t)
|
|
273
273
|
if (c.status === "completed" || c.status === "error") {
|
|
274
|
-
const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0,
|
|
274
|
+
const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, Gr - l);
|
|
275
275
|
a.push(setTimeout(() => i(c.id), u));
|
|
276
276
|
}
|
|
277
277
|
return () => a.forEach(clearTimeout);
|
|
278
278
|
}, [t, i]);
|
|
279
279
|
const o = _.useMemo(
|
|
280
|
-
() => ({ operations: t, addOperation:
|
|
281
|
-
[t,
|
|
280
|
+
() => ({ operations: t, addOperation: n, updateOperation: s, removeOperation: i }),
|
|
281
|
+
[t, n, s, i]
|
|
282
282
|
);
|
|
283
283
|
return /* @__PURE__ */ F(Et.Provider, { value: o, children: e });
|
|
284
284
|
};
|
|
285
285
|
var Ie = function(e, t) {
|
|
286
|
-
return Ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
287
|
-
|
|
288
|
-
} || function(
|
|
289
|
-
for (var s in
|
|
286
|
+
return Ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
|
|
287
|
+
r.__proto__ = n;
|
|
288
|
+
} || function(r, n) {
|
|
289
|
+
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (r[s] = n[s]);
|
|
290
290
|
}, Ie(e, t);
|
|
291
291
|
};
|
|
292
|
-
function
|
|
292
|
+
function Ur(e, t) {
|
|
293
293
|
if (typeof t != "function" && t !== null)
|
|
294
294
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
295
295
|
Ie(e, t);
|
|
296
|
-
function
|
|
296
|
+
function r() {
|
|
297
297
|
this.constructor = e;
|
|
298
298
|
}
|
|
299
|
-
e.prototype = t === null ? Object.create(t) : (
|
|
299
|
+
e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
|
|
300
300
|
}
|
|
301
|
-
var ve = "Invariant Violation", Ze = Object.setPrototypeOf,
|
|
301
|
+
var ve = "Invariant Violation", Ze = Object.setPrototypeOf, Kr = Ze === void 0 ? function(e, t) {
|
|
302
302
|
return e.__proto__ = t, e;
|
|
303
|
-
} : Ze,
|
|
303
|
+
} : Ze, Qr = (
|
|
304
304
|
/** @class */
|
|
305
305
|
function(e) {
|
|
306
|
-
|
|
307
|
-
function t(
|
|
308
|
-
|
|
309
|
-
var
|
|
310
|
-
return
|
|
306
|
+
Ur(t, e);
|
|
307
|
+
function t(r) {
|
|
308
|
+
r === void 0 && (r = ve);
|
|
309
|
+
var n = e.call(this, typeof r == "number" ? ve + ": " + r + " (see https://github.com/apollographql/invariant-packages)" : r) || this;
|
|
310
|
+
return n.framesToPop = 1, n.name = ve, Kr(n, t.prototype), n;
|
|
311
311
|
}
|
|
312
312
|
return t;
|
|
313
313
|
}(Error)
|
|
314
314
|
);
|
|
315
315
|
function Oe(e, t) {
|
|
316
316
|
if (!e)
|
|
317
|
-
throw new
|
|
317
|
+
throw new Qr(t);
|
|
318
318
|
}
|
|
319
|
-
var bt = ["debug", "log", "warn", "error", "silent"],
|
|
319
|
+
var bt = ["debug", "log", "warn", "error", "silent"], jr = bt.indexOf("log");
|
|
320
320
|
function ce(e) {
|
|
321
321
|
return function() {
|
|
322
|
-
if (bt.indexOf(e) >=
|
|
322
|
+
if (bt.indexOf(e) >= jr) {
|
|
323
323
|
var t = console[e] || console.log;
|
|
324
324
|
return t.apply(console, arguments);
|
|
325
325
|
}
|
|
@@ -328,34 +328,34 @@ function ce(e) {
|
|
|
328
328
|
(function(e) {
|
|
329
329
|
e.debug = ce("debug"), e.log = ce("log"), e.warn = ce("warn"), e.error = ce("error");
|
|
330
330
|
})(Oe || (Oe = {}));
|
|
331
|
-
const vt = me(void 0), Pt = () => te(vt),
|
|
331
|
+
const vt = me(void 0), Pt = () => te(vt), bs = (e) => {
|
|
332
332
|
const t = Pt();
|
|
333
333
|
return t == null ? void 0 : t.getExtensionPoint(e);
|
|
334
|
-
},
|
|
335
|
-
const t = Pt(),
|
|
336
|
-
return
|
|
337
|
-
},
|
|
338
|
-
const
|
|
334
|
+
}, vs = (e) => {
|
|
335
|
+
const t = Pt(), r = t == null ? void 0 : t.getExtensionPoint(e);
|
|
336
|
+
return r ? r.provide({ getCacheKey: () => e }) : [];
|
|
337
|
+
}, Ps = ({ registry: e, children: t }) => {
|
|
338
|
+
const r = _.useRef(e);
|
|
339
339
|
return _.useEffect(() => {
|
|
340
340
|
Oe(
|
|
341
|
-
|
|
341
|
+
r.current === e,
|
|
342
342
|
"You can't change the extension registry after it has been rendered"
|
|
343
343
|
);
|
|
344
|
-
}, [e]), /* @__PURE__ */ F(vt.Provider, { value:
|
|
344
|
+
}, [e]), /* @__PURE__ */ F(vt.Provider, { value: r.current, children: _.Children.only(t) });
|
|
345
345
|
}, et = (e) => {
|
|
346
346
|
if (!e || typeof e != "string")
|
|
347
347
|
throw new TypeError(`extensionName is required to be a string and can't be: "${e}" (${typeof e})`);
|
|
348
348
|
return e.trim();
|
|
349
349
|
};
|
|
350
|
-
class
|
|
350
|
+
class zr {
|
|
351
351
|
constructor(t) {
|
|
352
352
|
M(this, "_settings");
|
|
353
353
|
M(this, "_extensions", /* @__PURE__ */ new Map());
|
|
354
354
|
M(this, "_lookupCache", /* @__PURE__ */ new Map());
|
|
355
355
|
M(this, "_matchCache", /* @__PURE__ */ new Map());
|
|
356
356
|
M(this, "_matcher");
|
|
357
|
-
const { matcher:
|
|
358
|
-
this._settings =
|
|
357
|
+
const { matcher: r, ...n } = t;
|
|
358
|
+
this._settings = n, this._matcher = t.matcher;
|
|
359
359
|
}
|
|
360
360
|
settings() {
|
|
361
361
|
return this._settings;
|
|
@@ -377,15 +377,15 @@ class Qn {
|
|
|
377
377
|
register(t) {
|
|
378
378
|
if (this._extensions.get(t.id))
|
|
379
379
|
throw new Error(`Resource sidebar view with id ${t.id} already exists`);
|
|
380
|
-
const
|
|
380
|
+
const r = {
|
|
381
381
|
...t,
|
|
382
382
|
registeredAt: /* @__PURE__ */ new Date(),
|
|
383
383
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
384
384
|
enabled: !0
|
|
385
385
|
};
|
|
386
|
-
this._extensions.set(t.id,
|
|
387
|
-
const
|
|
388
|
-
for (const s of
|
|
386
|
+
this._extensions.set(t.id, r);
|
|
387
|
+
const n = Array.from(this._matchCache.keys());
|
|
388
|
+
for (const s of n)
|
|
389
389
|
s.startsWith(t.plugin) && this._matchCache.delete(s);
|
|
390
390
|
}
|
|
391
391
|
/**
|
|
@@ -410,8 +410,8 @@ class Qn {
|
|
|
410
410
|
* }
|
|
411
411
|
*/
|
|
412
412
|
get(t) {
|
|
413
|
-
var
|
|
414
|
-
return (
|
|
413
|
+
var r;
|
|
414
|
+
return (r = this._extensions.get(t)) == null ? void 0 : r.component;
|
|
415
415
|
}
|
|
416
416
|
/**
|
|
417
417
|
* Lists all registered components in the registry. Useful for debugging or generating summaries of available components.
|
|
@@ -433,16 +433,16 @@ class Qn {
|
|
|
433
433
|
calculateMatches(t) {
|
|
434
434
|
if (!this._matcher)
|
|
435
435
|
return Array.from(this._extensions.values());
|
|
436
|
-
const
|
|
437
|
-
for (const
|
|
438
|
-
const s = this.generateMatchCacheKey(
|
|
436
|
+
const r = [];
|
|
437
|
+
for (const n of this._extensions.values()) {
|
|
438
|
+
const s = this.generateMatchCacheKey(n), i = this._matchCache.has(s);
|
|
439
439
|
if (i && this._matchCache.get(s)) {
|
|
440
|
-
|
|
440
|
+
r.push(n);
|
|
441
441
|
continue;
|
|
442
442
|
}
|
|
443
|
-
this._matcher(t,
|
|
443
|
+
this._matcher(t, n) ? (this._matchCache.set(s, !0), r.push(n)) : i || this._matchCache.set(s, !1);
|
|
444
444
|
}
|
|
445
|
-
return
|
|
445
|
+
return r;
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
448
|
* Preload the registry caches with the given expected context to avoid on-first-request calculation.
|
|
@@ -454,8 +454,8 @@ class Qn {
|
|
|
454
454
|
* @param context The context expected to be called preload the registry with on provide.
|
|
455
455
|
*/
|
|
456
456
|
preload(t) {
|
|
457
|
-
const
|
|
458
|
-
this._lookupCache.set(
|
|
457
|
+
const r = this.calculateMatches(t), n = t.getCacheKey();
|
|
458
|
+
this._lookupCache.set(n, r.map((s) => s.id));
|
|
459
459
|
}
|
|
460
460
|
/**
|
|
461
461
|
* Provide the components that match the given context.
|
|
@@ -467,25 +467,25 @@ class Qn {
|
|
|
467
467
|
const i = this._extensions.get(this._settings.selected);
|
|
468
468
|
return i ? [i.component] : [];
|
|
469
469
|
}
|
|
470
|
-
const
|
|
471
|
-
let
|
|
472
|
-
if (
|
|
473
|
-
let i =
|
|
474
|
-
return this._settings.order && (i = this.reorderComponents(i,
|
|
470
|
+
const r = t.getCacheKey();
|
|
471
|
+
let n = this._lookupCache.get(r);
|
|
472
|
+
if (n) {
|
|
473
|
+
let i = n.map((o) => this._extensions.get(o)).filter((o) => !!o).map((o) => o.component);
|
|
474
|
+
return this._settings.order && (i = this.reorderComponents(i, n, this._settings.order)), i;
|
|
475
475
|
}
|
|
476
|
-
|
|
477
|
-
let s =
|
|
478
|
-
return this._settings.order && (s = this.reorderComponents(s,
|
|
476
|
+
n = this.calculateMatches(t).map((i) => i.id), this._lookupCache.set(r, n);
|
|
477
|
+
let s = n.map((i) => this._extensions.get(i)).filter((i) => !!i).map((i) => i.component);
|
|
478
|
+
return this._settings.order && (s = this.reorderComponents(s, n, this._settings.order)), s;
|
|
479
479
|
}
|
|
480
|
-
reorderComponents(t,
|
|
481
|
-
const s = new Map(
|
|
482
|
-
return
|
|
480
|
+
reorderComponents(t, r, n) {
|
|
481
|
+
const s = new Map(r.map((i, o) => [i, t[o]]));
|
|
482
|
+
return n.map((i) => s.get(i)).filter((i) => !!i);
|
|
483
483
|
}
|
|
484
484
|
/**
|
|
485
485
|
* Reorder the components in the registry based on the given order.
|
|
486
486
|
*/
|
|
487
487
|
reorder(t) {
|
|
488
|
-
const
|
|
488
|
+
const r = t.map((o) => this._extensions.get(o)).filter((o) => !!o), n = Array.from(this._extensions.values()).filter((o) => !t.includes(o.id)), s = [...r, ...n];
|
|
489
489
|
this._extensions.clear(), s.forEach((o) => this._extensions.set(o.id, o));
|
|
490
490
|
const i = Array.from(this._lookupCache.keys());
|
|
491
491
|
for (const o of i) {
|
|
@@ -506,11 +506,11 @@ class Qn {
|
|
|
506
506
|
this.clearLookupCache(), this.clearMatchCache();
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
|
-
class
|
|
509
|
+
class Ds {
|
|
510
510
|
constructor({ initialStores: t }) {
|
|
511
511
|
M(this, "store", {});
|
|
512
|
-
t.forEach((
|
|
513
|
-
this.addExtensionPoint(
|
|
512
|
+
t.forEach((r) => {
|
|
513
|
+
this.addExtensionPoint(r);
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
516
|
/**
|
|
@@ -519,12 +519,12 @@ class vs {
|
|
|
519
519
|
* @param opts The settings for the extension point
|
|
520
520
|
*/
|
|
521
521
|
addExtensionPoint(t) {
|
|
522
|
-
let
|
|
523
|
-
if (console.log("validated",
|
|
524
|
-
console.warn(`Extension point ${
|
|
522
|
+
let r = et(t.id);
|
|
523
|
+
if (console.log("validated", r), console.log("store", this.store), this.store[r]) {
|
|
524
|
+
console.warn(`Extension point ${r} already exists. Not adding again.`);
|
|
525
525
|
return;
|
|
526
526
|
}
|
|
527
|
-
this.store[
|
|
527
|
+
this.store[r] = new zr(t);
|
|
528
528
|
}
|
|
529
529
|
/**
|
|
530
530
|
* Get an extension point from the registry.
|
|
@@ -560,21 +560,21 @@ class vs {
|
|
|
560
560
|
return Object.values(this.store).map((t) => t.settings());
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
const Dt = me(void 0),
|
|
563
|
+
const Dt = me(void 0), Wr = {
|
|
564
564
|
default: "info",
|
|
565
565
|
info: "info",
|
|
566
566
|
success: "success",
|
|
567
567
|
warning: "warning",
|
|
568
568
|
error: "error"
|
|
569
|
-
},
|
|
570
|
-
const { push: t } =
|
|
571
|
-
|
|
569
|
+
}, Fs = ({ children: e }) => {
|
|
570
|
+
const { push: t } = Rr(), [r, n] = _.useState([]), s = (o) => {
|
|
571
|
+
n((a) => [...a, o]);
|
|
572
572
|
}, i = (o, a, c) => {
|
|
573
573
|
const l = typeof o == "object";
|
|
574
574
|
let u = "", y = "info", h, f = 5e3, m;
|
|
575
575
|
if (l) {
|
|
576
576
|
if (u = o.message, o.showOnce) {
|
|
577
|
-
if (
|
|
577
|
+
if (r.includes(u))
|
|
578
578
|
return;
|
|
579
579
|
s(u);
|
|
580
580
|
}
|
|
@@ -582,7 +582,7 @@ const Dt = me(void 0), zn = {
|
|
|
582
582
|
} else
|
|
583
583
|
u = o, y = a, h = c;
|
|
584
584
|
t({
|
|
585
|
-
severity:
|
|
585
|
+
severity: Wr[y] ?? "info",
|
|
586
586
|
title: u,
|
|
587
587
|
message: h,
|
|
588
588
|
timeout: f,
|
|
@@ -597,49 +597,49 @@ const Dt = me(void 0), zn = {
|
|
|
597
597
|
return e;
|
|
598
598
|
};
|
|
599
599
|
function P(e) {
|
|
600
|
-
const t = te($e),
|
|
601
|
-
if (!
|
|
600
|
+
const t = te($e), r = (t == null ? void 0 : t.pluginId) ?? e;
|
|
601
|
+
if (!r)
|
|
602
602
|
throw new Error(
|
|
603
603
|
"pluginID must be provided either via PluginContext or as an explicit parameter"
|
|
604
604
|
);
|
|
605
|
-
return
|
|
605
|
+
return r;
|
|
606
606
|
}
|
|
607
|
-
const
|
|
608
|
-
const
|
|
609
|
-
mutationFn: async () =>
|
|
607
|
+
const xs = ({ pluginID: e, connectionID: t }) => {
|
|
608
|
+
const r = P(e), n = G(), { showSnackbar: s } = $(), i = [r, "connection", "detail", t], { mutateAsync: o } = v({
|
|
609
|
+
mutationFn: async () => rr(r, t),
|
|
610
610
|
onSuccess(y) {
|
|
611
|
-
|
|
612
|
-
queryKey: ["EDITOR_SCHEMAS",
|
|
611
|
+
n.setQueryData(i, y), n.invalidateQueries({
|
|
612
|
+
queryKey: ["EDITOR_SCHEMAS", r, t]
|
|
613
613
|
});
|
|
614
614
|
},
|
|
615
615
|
onError: I(s, "Failed to start connection")
|
|
616
616
|
}), { mutateAsync: a } = v({
|
|
617
|
-
mutationFn: async () => lt(
|
|
617
|
+
mutationFn: async () => lt(r, t),
|
|
618
618
|
onSuccess(y) {
|
|
619
|
-
|
|
619
|
+
n.setQueryData(i, y);
|
|
620
620
|
},
|
|
621
621
|
onError: I(s, "Failed to stop connection")
|
|
622
622
|
}), { mutateAsync: c } = v({
|
|
623
|
-
mutationFn: async (y) =>
|
|
623
|
+
mutationFn: async (y) => nr(r, y),
|
|
624
624
|
onSuccess(y, { name: h }) {
|
|
625
|
-
s({ message: `Connection ${h} successfully updated`, status: "success" }),
|
|
626
|
-
{ queryKey: [
|
|
625
|
+
s({ message: `Connection ${h} successfully updated`, status: "success" }), n.setQueryData(i, u), n.setQueriesData(
|
|
626
|
+
{ queryKey: [r, "connection", "list"] },
|
|
627
627
|
(f) => f == null ? void 0 : f.map((m) => m.id === t ? y : m)
|
|
628
628
|
);
|
|
629
629
|
},
|
|
630
630
|
onError: I(s, "Failed to update connection")
|
|
631
631
|
}), { mutateAsync: l } = v({
|
|
632
|
-
mutationFn: async () =>
|
|
632
|
+
mutationFn: async () => sr(r, t),
|
|
633
633
|
onSuccess() {
|
|
634
|
-
s({ message: "Connection successfully removed", status: "success" }),
|
|
635
|
-
{ queryKey: [
|
|
634
|
+
s({ message: "Connection successfully removed", status: "success" }), n.setQueryData(i, void 0), n.setQueriesData(
|
|
635
|
+
{ queryKey: [r, "connection", "list"] },
|
|
636
636
|
(y) => y == null ? void 0 : y.filter((h) => h.id !== t)
|
|
637
637
|
);
|
|
638
638
|
},
|
|
639
639
|
onError: I(s, "Failed to remove connection")
|
|
640
640
|
}), u = D({
|
|
641
641
|
queryKey: i,
|
|
642
|
-
queryFn: async () =>
|
|
642
|
+
queryFn: async () => or(r, t)
|
|
643
643
|
});
|
|
644
644
|
return {
|
|
645
645
|
/**
|
|
@@ -663,15 +663,15 @@ const Ds = ({ pluginID: e, connectionID: t }) => {
|
|
|
663
663
|
*/
|
|
664
664
|
deleteConnection: l
|
|
665
665
|
};
|
|
666
|
-
},
|
|
667
|
-
const t = P(e),
|
|
666
|
+
}, Hr = (e) => [e, "connection", "list"], Is = ({ plugin: e }) => {
|
|
667
|
+
const t = P(e), r = G(), { showSnackbar: n } = $(), s = Hr(t), { mutateAsync: i } = v({
|
|
668
668
|
mutationFn: async (l) => dt(t, l.id),
|
|
669
|
-
onError: I(
|
|
669
|
+
onError: I(n, "Failed to start connection informer")
|
|
670
670
|
}), { mutateAsync: o } = v({
|
|
671
|
-
mutationFn: async (l) =>
|
|
672
|
-
onError: I(
|
|
671
|
+
mutationFn: async (l) => ir(t, l.id),
|
|
672
|
+
onError: I(n, "Failed to stop connection informer")
|
|
673
673
|
}), a = _.useCallback((l) => {
|
|
674
|
-
console.log("got update to connections", l),
|
|
674
|
+
console.log("got update to connections", l), r.setQueryData(s, l);
|
|
675
675
|
}, []);
|
|
676
676
|
return _.useEffect(() => {
|
|
677
677
|
const l = A(`${t}/connection/sync`, a);
|
|
@@ -683,9 +683,9 @@ const Ds = ({ pluginID: e, connectionID: t }) => {
|
|
|
683
683
|
queryKey: s,
|
|
684
684
|
queryFn: async () => {
|
|
685
685
|
try {
|
|
686
|
-
return await
|
|
686
|
+
return await ar(t);
|
|
687
687
|
} catch (l) {
|
|
688
|
-
console.log(l), I(
|
|
688
|
+
console.log(l), I(n, "Failed to load connections")(l);
|
|
689
689
|
}
|
|
690
690
|
return [];
|
|
691
691
|
},
|
|
@@ -695,32 +695,32 @@ const Ds = ({ pluginID: e, connectionID: t }) => {
|
|
|
695
695
|
startInformer: i,
|
|
696
696
|
stopInformer: o
|
|
697
697
|
};
|
|
698
|
-
},
|
|
699
|
-
const
|
|
698
|
+
}, Os = ({ pluginID: e, connectionID: t }) => {
|
|
699
|
+
const r = P(e);
|
|
700
700
|
return {
|
|
701
701
|
/**
|
|
702
702
|
* Get the connection
|
|
703
703
|
*/
|
|
704
704
|
namespaces: D({
|
|
705
|
-
queryKey: [
|
|
706
|
-
queryFn: async () =>
|
|
705
|
+
queryKey: [r, "connection", "namespaces", t],
|
|
706
|
+
queryFn: async () => cr(r, t)
|
|
707
707
|
})
|
|
708
708
|
};
|
|
709
709
|
};
|
|
710
|
-
var
|
|
710
|
+
var Br = /* @__PURE__ */ ((e) => (e[e.OnConnect = 0] = "OnConnect", e[e.OnFirstQuery = 1] = "OnFirstQuery", e[e.Never = 2] = "Never", e))(Br || {}), x = /* @__PURE__ */ ((e) => (e[e.Pending = 0] = "Pending", e[e.Syncing = 1] = "Syncing", e[e.Synced = 2] = "Synced", e[e.Error = 3] = "Error", e[e.Cancelled = 4] = "Cancelled", e))(x || {});
|
|
711
711
|
function Ft(e) {
|
|
712
|
-
const t = Object.values(e.states),
|
|
713
|
-
let
|
|
712
|
+
const t = Object.values(e.states), r = t.length;
|
|
713
|
+
let n = 0, s = 0;
|
|
714
714
|
for (const a of t)
|
|
715
|
-
a === x.Synced &&
|
|
715
|
+
a === x.Synced && n++, a === x.Error && s++;
|
|
716
716
|
const i = t.filter(
|
|
717
717
|
(a) => a === x.Synced || a === x.Error || a === x.Cancelled
|
|
718
|
-
).length, o =
|
|
718
|
+
).length, o = r > 0 ? i / r : 0;
|
|
719
719
|
return {
|
|
720
720
|
pluginID: e.pluginID,
|
|
721
721
|
connectionID: e.connectionID,
|
|
722
|
-
totalResources:
|
|
723
|
-
syncedCount:
|
|
722
|
+
totalResources: r,
|
|
723
|
+
syncedCount: n,
|
|
724
724
|
errorCount: s,
|
|
725
725
|
doneCount: i,
|
|
726
726
|
progress: o
|
|
@@ -733,30 +733,30 @@ function xt(e) {
|
|
|
733
733
|
return e.some((t) => !fe(t));
|
|
734
734
|
}
|
|
735
735
|
function It(e) {
|
|
736
|
-
const t = e.reduce((
|
|
737
|
-
return t === 0 ? 0 : e.reduce((
|
|
736
|
+
const t = e.reduce((n, s) => n + s.totalResources, 0);
|
|
737
|
+
return t === 0 ? 0 : e.reduce((n, s) => n + s.doneCount, 0) / t;
|
|
738
738
|
}
|
|
739
739
|
function qe(e) {
|
|
740
740
|
return `${e.pluginId}/${e.connection}`;
|
|
741
741
|
}
|
|
742
742
|
function Ot(e, t) {
|
|
743
|
-
const
|
|
744
|
-
e.has(
|
|
743
|
+
const r = qe(t);
|
|
744
|
+
e.has(r) || e.set(r, {
|
|
745
745
|
states: {},
|
|
746
746
|
pluginID: t.pluginId,
|
|
747
747
|
connectionID: t.connection
|
|
748
748
|
});
|
|
749
|
-
const
|
|
750
|
-
return
|
|
749
|
+
const n = e.get(r);
|
|
750
|
+
return n.states[t.resourceKey] = t.state, n;
|
|
751
751
|
}
|
|
752
|
-
function
|
|
753
|
-
const [e, t] = q(/* @__PURE__ */ new Set()), [
|
|
754
|
-
|
|
752
|
+
function As() {
|
|
753
|
+
const [e, t] = q(/* @__PURE__ */ new Set()), [r, n] = q({}), [s, i] = q(/* @__PURE__ */ new Map()), o = de(/* @__PURE__ */ new Map());
|
|
754
|
+
Q(() => {
|
|
755
755
|
Ye().then((p) => {
|
|
756
|
-
p &&
|
|
756
|
+
p && n(p);
|
|
757
757
|
}).catch(() => {
|
|
758
758
|
});
|
|
759
|
-
}, []),
|
|
759
|
+
}, []), Q(() => A("connection/status", (S) => {
|
|
760
760
|
const w = `${S.pluginID}/${S.connectionID}`;
|
|
761
761
|
S.status === "DISCONNECTED" ? (t((b) => {
|
|
762
762
|
const d = new Set(b);
|
|
@@ -768,7 +768,7 @@ function Is() {
|
|
|
768
768
|
const d = new Set(b);
|
|
769
769
|
return d.add(w), d;
|
|
770
770
|
}), Ye().then((b) => {
|
|
771
|
-
b &&
|
|
771
|
+
b && n(b);
|
|
772
772
|
}).catch(() => {
|
|
773
773
|
});
|
|
774
774
|
}), []);
|
|
@@ -785,14 +785,14 @@ function Is() {
|
|
|
785
785
|
return g.set(S, b), g;
|
|
786
786
|
});
|
|
787
787
|
}, []);
|
|
788
|
-
|
|
788
|
+
Q(() => A("informer/STATE", a), [a]);
|
|
789
789
|
const c = V(async (p, S) => {
|
|
790
790
|
await lt(p, S);
|
|
791
791
|
}, []), l = V(async (p, S) => {
|
|
792
792
|
await dt(p, S);
|
|
793
793
|
}, []), u = [];
|
|
794
794
|
for (const p of e) {
|
|
795
|
-
const [S, w] = p.split("/", 2), d = (
|
|
795
|
+
const [S, w] = p.split("/", 2), d = (r[S] ?? []).find((k) => k.id === w), g = s.get(p), E = g != null && !fe(g), C = g != null && g.errorCount > 0;
|
|
796
796
|
u.push({
|
|
797
797
|
pluginID: S,
|
|
798
798
|
connectionID: w,
|
|
@@ -822,22 +822,22 @@ function Is() {
|
|
|
822
822
|
retryInformer: l
|
|
823
823
|
};
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function Yr(e, t) {
|
|
826
826
|
return window.go.data.Client.Get(e, t);
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
return window.go.data.Client.Set(e, t,
|
|
828
|
+
function Jr(e, t, r) {
|
|
829
|
+
return window.go.data.Client.Set(e, t, r);
|
|
830
830
|
}
|
|
831
|
-
function
|
|
832
|
-
const
|
|
831
|
+
function Ts(e, t, r) {
|
|
832
|
+
const n = P(e), s = G(), i = [n, "data", t], o = D({
|
|
833
833
|
queryKey: i,
|
|
834
834
|
queryFn: async () => {
|
|
835
|
-
const c = await
|
|
836
|
-
return c ??
|
|
835
|
+
const c = await Yr(n, t);
|
|
836
|
+
return c ?? r;
|
|
837
837
|
}
|
|
838
838
|
}), a = v({
|
|
839
839
|
mutationFn: async (c) => {
|
|
840
|
-
await
|
|
840
|
+
await Jr(n, t, c);
|
|
841
841
|
},
|
|
842
842
|
onMutate: async (c) => {
|
|
843
843
|
await s.cancelQueries({ queryKey: i });
|
|
@@ -852,29 +852,29 @@ function Os(e, t, n) {
|
|
|
852
852
|
}
|
|
853
853
|
});
|
|
854
854
|
return {
|
|
855
|
-
data: o.data ??
|
|
855
|
+
data: o.data ?? r,
|
|
856
856
|
update: async (c) => {
|
|
857
857
|
await a.mutateAsync(c);
|
|
858
858
|
},
|
|
859
859
|
isLoading: o.isLoading
|
|
860
860
|
};
|
|
861
861
|
}
|
|
862
|
-
const
|
|
863
|
-
const e = te(
|
|
862
|
+
const Ns = () => {
|
|
863
|
+
const e = te(Lr);
|
|
864
864
|
if (!e) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
|
|
865
865
|
return e;
|
|
866
866
|
}, At = () => {
|
|
867
|
-
const e = te(
|
|
867
|
+
const e = te($r);
|
|
868
868
|
if (e === void 0)
|
|
869
869
|
throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
|
|
870
870
|
return e;
|
|
871
|
-
},
|
|
872
|
-
const t = P(e), { showSnackbar:
|
|
871
|
+
}, Rs = ({ pluginID: e }) => {
|
|
872
|
+
const t = P(e), { showSnackbar: r } = $(), { createTab: n, updateTab: s } = At();
|
|
873
873
|
return {
|
|
874
874
|
createSession: v({
|
|
875
875
|
mutationFn: async ({ connectionID: o, icon: a, label: c, opts: l }) => {
|
|
876
876
|
const u = `pending-${crypto.randomUUID()}`;
|
|
877
|
-
|
|
877
|
+
n({
|
|
878
878
|
id: u,
|
|
879
879
|
title: c ?? "Connecting...",
|
|
880
880
|
variant: "terminal",
|
|
@@ -886,13 +886,13 @@ const As = () => {
|
|
|
886
886
|
opts: { ...l }
|
|
887
887
|
}
|
|
888
888
|
});
|
|
889
|
-
const y =
|
|
889
|
+
const y = Tr.SessionOptions.createFrom({
|
|
890
890
|
command: ["/bin/bash"],
|
|
891
891
|
tty: !0,
|
|
892
892
|
...l
|
|
893
893
|
});
|
|
894
894
|
try {
|
|
895
|
-
const h = await
|
|
895
|
+
const h = await ur(t, o, y);
|
|
896
896
|
s(
|
|
897
897
|
{ id: u },
|
|
898
898
|
{
|
|
@@ -902,19 +902,19 @@ const As = () => {
|
|
|
902
902
|
}
|
|
903
903
|
);
|
|
904
904
|
} catch (h) {
|
|
905
|
-
const f =
|
|
905
|
+
const f = U(h);
|
|
906
906
|
s(
|
|
907
907
|
{ id: u },
|
|
908
908
|
{
|
|
909
909
|
properties: { status: "error", error: f.detail, pluginID: t, connectionID: o, opts: { ...l } }
|
|
910
910
|
}
|
|
911
|
-
), X(
|
|
911
|
+
), X(r, h, "Failed to start session");
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
914
|
}).mutateAsync
|
|
915
915
|
};
|
|
916
|
-
},
|
|
917
|
-
const t = P(e), { showSnackbar:
|
|
916
|
+
}, ks = ({ pluginID: e }) => {
|
|
917
|
+
const t = P(e), { showSnackbar: r } = $(), { createTab: n } = At(), s = v({
|
|
918
918
|
mutationFn: async ({
|
|
919
919
|
connectionID: o,
|
|
920
920
|
resourceKey: a,
|
|
@@ -942,40 +942,40 @@ const As = () => {
|
|
|
942
942
|
include_source_events: !0,
|
|
943
943
|
params: p ?? {}
|
|
944
944
|
})
|
|
945
|
-
}), w = await
|
|
946
|
-
return
|
|
945
|
+
}), w = await lr(t, o, S);
|
|
946
|
+
return n({
|
|
947
947
|
id: w.id,
|
|
948
948
|
title: y ?? `Logs ${w.id.substring(0, 8)}`,
|
|
949
949
|
variant: "logs",
|
|
950
950
|
icon: u ?? "LuLogs"
|
|
951
951
|
}), w;
|
|
952
952
|
},
|
|
953
|
-
onError: I(
|
|
953
|
+
onError: I(r, "Failed to start log session")
|
|
954
954
|
}), i = v({
|
|
955
955
|
mutationFn: async (o) => {
|
|
956
|
-
await
|
|
956
|
+
await dr(o);
|
|
957
957
|
},
|
|
958
|
-
onError: I(
|
|
958
|
+
onError: I(r, "Failed to close log session")
|
|
959
959
|
});
|
|
960
960
|
return {
|
|
961
961
|
createLogSession: s.mutateAsync,
|
|
962
962
|
closeLogSession: i.mutateAsync
|
|
963
963
|
};
|
|
964
|
-
},
|
|
964
|
+
}, Ms = () => D({
|
|
965
965
|
queryKey: ["metric", "providers"],
|
|
966
|
-
queryFn:
|
|
966
|
+
queryFn: fr,
|
|
967
967
|
staleTime: 3e4
|
|
968
|
-
}),
|
|
968
|
+
}), Vr = (e) => D({
|
|
969
969
|
queryKey: ["metric", "providers", e],
|
|
970
|
-
queryFn: () =>
|
|
970
|
+
queryFn: () => pr(e),
|
|
971
971
|
enabled: !!e,
|
|
972
972
|
staleTime: 3e4
|
|
973
|
-
}),
|
|
973
|
+
}), $s = (e) => {
|
|
974
974
|
var S, w;
|
|
975
975
|
const {
|
|
976
976
|
connectionID: t,
|
|
977
|
-
resourceKey:
|
|
978
|
-
resourceID:
|
|
977
|
+
resourceKey: r,
|
|
978
|
+
resourceID: n,
|
|
979
979
|
resourceNamespace: s = "",
|
|
980
980
|
resourceData: i = {},
|
|
981
981
|
metricIDs: o = [],
|
|
@@ -987,7 +987,7 @@ const As = () => {
|
|
|
987
987
|
} = e, {
|
|
988
988
|
data: y,
|
|
989
989
|
isLoading: h
|
|
990
|
-
} =
|
|
990
|
+
} = Vr(r), f = y ?? [], m = c ? Math.max(
|
|
991
991
|
Math.floor((c.end.getTime() - c.start.getTime()) / 250),
|
|
992
992
|
15e3
|
|
993
993
|
) * 1e6 : 0, p = D({
|
|
@@ -995,18 +995,18 @@ const As = () => {
|
|
|
995
995
|
"metric",
|
|
996
996
|
"query",
|
|
997
997
|
t,
|
|
998
|
-
n,
|
|
999
998
|
r,
|
|
999
|
+
n,
|
|
1000
1000
|
s,
|
|
1001
1001
|
o,
|
|
1002
1002
|
a,
|
|
1003
1003
|
(S = c == null ? void 0 : c.start) == null ? void 0 : S.getTime(),
|
|
1004
1004
|
(w = c == null ? void 0 : c.end) == null ? void 0 : w.getTime()
|
|
1005
1005
|
],
|
|
1006
|
-
queryFn: () =>
|
|
1006
|
+
queryFn: () => yr(
|
|
1007
1007
|
t,
|
|
1008
|
-
n,
|
|
1009
1008
|
r,
|
|
1009
|
+
n,
|
|
1010
1010
|
s,
|
|
1011
1011
|
i,
|
|
1012
1012
|
o,
|
|
@@ -1015,7 +1015,7 @@ const As = () => {
|
|
|
1015
1015
|
(c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0),
|
|
1016
1016
|
m
|
|
1017
1017
|
),
|
|
1018
|
-
enabled: u && !!t && !!
|
|
1018
|
+
enabled: u && !!t && !!r && (r.startsWith("cluster::") || !!n) && f.length > 0,
|
|
1019
1019
|
refetchInterval: l > 0 ? l : void 0,
|
|
1020
1020
|
staleTime: 5e3,
|
|
1021
1021
|
// Keep previous data visible while fetching new data (e.g. on time range change)
|
|
@@ -1029,11 +1029,11 @@ const As = () => {
|
|
|
1029
1029
|
error: p.error,
|
|
1030
1030
|
refetch: p.refetch
|
|
1031
1031
|
};
|
|
1032
|
-
},
|
|
1032
|
+
}, Ls = (e) => {
|
|
1033
1033
|
const {
|
|
1034
1034
|
pluginID: t,
|
|
1035
|
-
connectionID:
|
|
1036
|
-
resourceKey:
|
|
1035
|
+
connectionID: r,
|
|
1036
|
+
resourceKey: n,
|
|
1037
1037
|
resourceID: s,
|
|
1038
1038
|
resourceNamespace: i = "",
|
|
1039
1039
|
resourceData: o = {},
|
|
@@ -1041,10 +1041,10 @@ const As = () => {
|
|
|
1041
1041
|
interval: c = 1e4,
|
|
1042
1042
|
enabled: l = !0
|
|
1043
1043
|
} = e, u = P(t), [y, h] = q(null), [f, m] = q(null), [p, S] = q(!1), [w, b] = q(null), d = de(null), g = V(async () => {
|
|
1044
|
-
if (!(!l || !u || !
|
|
1044
|
+
if (!(!l || !u || !r || !n || !s))
|
|
1045
1045
|
try {
|
|
1046
|
-
const C = await
|
|
1047
|
-
resource_key:
|
|
1046
|
+
const C = await hr(u, r, {
|
|
1047
|
+
resource_key: n,
|
|
1048
1048
|
resource_id: s,
|
|
1049
1049
|
resource_namespace: i,
|
|
1050
1050
|
resource_data: o,
|
|
@@ -1053,7 +1053,7 @@ const As = () => {
|
|
|
1053
1053
|
// ms to nanoseconds for Go time.Duration
|
|
1054
1054
|
});
|
|
1055
1055
|
m(C), S(!0), b(null);
|
|
1056
|
-
const
|
|
1056
|
+
const k = A(`core/metrics/data/${C}`, (B) => {
|
|
1057
1057
|
try {
|
|
1058
1058
|
const L = JSON.parse(B);
|
|
1059
1059
|
L.results && h(L.results);
|
|
@@ -1069,12 +1069,12 @@ const As = () => {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
});
|
|
1071
1071
|
d.current = () => {
|
|
1072
|
-
|
|
1072
|
+
k(), ie();
|
|
1073
1073
|
};
|
|
1074
1074
|
} catch (C) {
|
|
1075
1075
|
b(C instanceof Error ? C.message : String(C));
|
|
1076
1076
|
}
|
|
1077
|
-
}, [u,
|
|
1077
|
+
}, [u, r, n, s, i, a, c, l]), E = V(async () => {
|
|
1078
1078
|
if (f)
|
|
1079
1079
|
try {
|
|
1080
1080
|
await Je(f);
|
|
@@ -1083,7 +1083,7 @@ const As = () => {
|
|
|
1083
1083
|
}
|
|
1084
1084
|
d.current && (d.current(), d.current = null), m(null), S(!1);
|
|
1085
1085
|
}, [f]);
|
|
1086
|
-
return
|
|
1086
|
+
return Q(() => () => {
|
|
1087
1087
|
f && Je(f).catch(console.error), d.current && d.current();
|
|
1088
1088
|
}, [f]), {
|
|
1089
1089
|
data: y,
|
|
@@ -1094,16 +1094,16 @@ const As = () => {
|
|
|
1094
1094
|
stop: E
|
|
1095
1095
|
};
|
|
1096
1096
|
}, J = ["networker", "portforward", "all-sessions"];
|
|
1097
|
-
function
|
|
1098
|
-
const { showSnackbar: e } = $(), t = G(),
|
|
1097
|
+
function qs() {
|
|
1098
|
+
const { showSnackbar: e } = $(), t = G(), r = D({
|
|
1099
1099
|
queryKey: [...J],
|
|
1100
|
-
queryFn: async () =>
|
|
1101
|
-
if (
|
|
1100
|
+
queryFn: async () => mr().catch((i) => {
|
|
1101
|
+
if (U(i).detail.includes("not found")) return [];
|
|
1102
1102
|
throw i;
|
|
1103
1103
|
}),
|
|
1104
1104
|
retry: !1
|
|
1105
1105
|
});
|
|
1106
|
-
|
|
1106
|
+
Q(() => {
|
|
1107
1107
|
const i = A("core/networker/portforward/created", () => {
|
|
1108
1108
|
t.invalidateQueries({ queryKey: [...J] });
|
|
1109
1109
|
}), o = A("core/networker/portforward/closed", () => {
|
|
@@ -1113,7 +1113,7 @@ function $s() {
|
|
|
1113
1113
|
i(), o();
|
|
1114
1114
|
};
|
|
1115
1115
|
}, [t]);
|
|
1116
|
-
const
|
|
1116
|
+
const n = r.data ?? [], s = v({
|
|
1117
1117
|
mutationFn: async (i) => ft(i),
|
|
1118
1118
|
onError: I(e, "Failed to close port forwarding session"),
|
|
1119
1119
|
onSuccess: async () => {
|
|
@@ -1121,20 +1121,20 @@ function $s() {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
});
|
|
1123
1123
|
return {
|
|
1124
|
-
sessions:
|
|
1125
|
-
activeSessions:
|
|
1124
|
+
sessions: r,
|
|
1125
|
+
activeSessions: n,
|
|
1126
1126
|
closeSession: s.mutateAsync,
|
|
1127
1127
|
openInBrowser: (i) => _t(`http://localhost:${i}`)
|
|
1128
1128
|
};
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1131
|
-
const
|
|
1130
|
+
function Gs({ pluginID: e, connectionID: t, resourceID: r }) {
|
|
1131
|
+
const n = P(e), s = ["networker", "portforward", "sessions", n, t, r], { showSnackbar: i } = $(), o = G(), a = D({
|
|
1132
1132
|
queryKey: s,
|
|
1133
|
-
queryFn: async () =>
|
|
1134
|
-
resource_id:
|
|
1133
|
+
queryFn: async () => gr(n, t, Xe.FindPortForwardSessionRequest.createFrom({
|
|
1134
|
+
resource_id: r,
|
|
1135
1135
|
connection_id: t
|
|
1136
1136
|
})).catch((u) => {
|
|
1137
|
-
const y =
|
|
1137
|
+
const y = U(u);
|
|
1138
1138
|
return y.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: y.detail }), []);
|
|
1139
1139
|
}),
|
|
1140
1140
|
retry: !1
|
|
@@ -1148,13 +1148,13 @@ function Ls({ pluginID: e, connectionID: t, resourceID: n }) {
|
|
|
1148
1148
|
connection: {
|
|
1149
1149
|
resource_data: u.resource,
|
|
1150
1150
|
connection_id: t,
|
|
1151
|
-
plugin_id:
|
|
1151
|
+
plugin_id: n,
|
|
1152
1152
|
resource_id: u.resourceId,
|
|
1153
1153
|
resource_key: u.resourceKey
|
|
1154
1154
|
},
|
|
1155
1155
|
labels: u.labels ?? {},
|
|
1156
1156
|
params: u.parameters ?? {}
|
|
1157
|
-
}), h = await
|
|
1157
|
+
}), h = await _r(n, t, y);
|
|
1158
1158
|
return u.openInBrowser && _t(`http://localhost:${h.local_port}`), h;
|
|
1159
1159
|
},
|
|
1160
1160
|
onError: I(i, "Failed to start port forwarding session"),
|
|
@@ -1180,43 +1180,43 @@ function Ls({ pluginID: e, connectionID: t, resourceID: n }) {
|
|
|
1180
1180
|
close: l.mutateAsync
|
|
1181
1181
|
};
|
|
1182
1182
|
}
|
|
1183
|
-
const
|
|
1184
|
-
const e = _.useContext(
|
|
1183
|
+
const Us = () => {
|
|
1184
|
+
const e = _.useContext(qr);
|
|
1185
1185
|
if (!e) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
|
|
1186
1186
|
return e;
|
|
1187
|
-
},
|
|
1187
|
+
}, Ks = ({
|
|
1188
1188
|
pluginID: e,
|
|
1189
1189
|
connectionID: t,
|
|
1190
|
-
resourceKey:
|
|
1191
|
-
resourceID:
|
|
1190
|
+
resourceKey: r,
|
|
1191
|
+
resourceID: n,
|
|
1192
1192
|
namespace: s = "",
|
|
1193
1193
|
getParams: i = {},
|
|
1194
1194
|
updateParams: o = {},
|
|
1195
1195
|
deleteParams: a = {}
|
|
1196
1196
|
}) => {
|
|
1197
|
-
const c = P(e), l = G(), { showSnackbar: u } = $(), y = ["RESOURCE", c, t,
|
|
1198
|
-
mutationFn: async (p) => pt(c, t,
|
|
1197
|
+
const c = P(e), l = G(), { showSnackbar: u } = $(), y = ["RESOURCE", c, t, r, n, s], { mutateAsync: h } = v({
|
|
1198
|
+
mutationFn: async (p) => pt(c, t, r, T.UpdateInput.createFrom({
|
|
1199
1199
|
params: { ...o, ...p.params },
|
|
1200
1200
|
input: { ...o, ...p.input },
|
|
1201
|
-
id:
|
|
1201
|
+
id: n,
|
|
1202
1202
|
namespace: s
|
|
1203
1203
|
})),
|
|
1204
1204
|
onSuccess: async () => {
|
|
1205
|
-
u(`Resource ${
|
|
1205
|
+
u(`Resource ${n} updated`, "success"), await l.invalidateQueries({ queryKey: y });
|
|
1206
1206
|
},
|
|
1207
|
-
onError: I(u, `Failed to update resource ${
|
|
1207
|
+
onError: I(u, `Failed to update resource ${n}`)
|
|
1208
1208
|
}), { mutateAsync: f } = v({
|
|
1209
|
-
mutationFn: async (p) => yt(c, t,
|
|
1209
|
+
mutationFn: async (p) => yt(c, t, r, T.DeleteInput.createFrom({
|
|
1210
1210
|
params: { ...a, ...p.params },
|
|
1211
1211
|
input: { ...a, ...p.input },
|
|
1212
|
-
id:
|
|
1212
|
+
id: n,
|
|
1213
1213
|
...p,
|
|
1214
1214
|
namespace: s
|
|
1215
1215
|
})),
|
|
1216
1216
|
onSuccess: async () => {
|
|
1217
|
-
u(`Resource ${
|
|
1217
|
+
u(`Resource ${n} deleted`, "success"), await l.invalidateQueries({ queryKey: y });
|
|
1218
1218
|
},
|
|
1219
|
-
onError: I(u, `Failed to delete resource ${
|
|
1219
|
+
onError: I(u, `Failed to delete resource ${n}`)
|
|
1220
1220
|
});
|
|
1221
1221
|
return {
|
|
1222
1222
|
/**
|
|
@@ -1225,9 +1225,9 @@ const qs = () => {
|
|
|
1225
1225
|
*/
|
|
1226
1226
|
resource: D({
|
|
1227
1227
|
queryKey: y,
|
|
1228
|
-
queryFn: async () =>
|
|
1228
|
+
queryFn: async () => wr(c, t, r, T.GetInput.createFrom({
|
|
1229
1229
|
params: i,
|
|
1230
|
-
id:
|
|
1230
|
+
id: n,
|
|
1231
1231
|
namespace: s
|
|
1232
1232
|
})),
|
|
1233
1233
|
retry: !1
|
|
@@ -1247,7 +1247,7 @@ const qs = () => {
|
|
|
1247
1247
|
*/
|
|
1248
1248
|
remove: f
|
|
1249
1249
|
};
|
|
1250
|
-
},
|
|
1250
|
+
}, Qs = (e) => {
|
|
1251
1251
|
const t = ["component", e.plugin, e.resource, e.area];
|
|
1252
1252
|
return {
|
|
1253
1253
|
/**
|
|
@@ -1256,31 +1256,31 @@ const qs = () => {
|
|
|
1256
1256
|
*/
|
|
1257
1257
|
component: D({
|
|
1258
1258
|
queryKey: t,
|
|
1259
|
-
queryFn: async () =>
|
|
1259
|
+
queryFn: async () => Sr(e)
|
|
1260
1260
|
})
|
|
1261
1261
|
};
|
|
1262
|
-
},
|
|
1263
|
-
const
|
|
1262
|
+
}, js = ({ pluginID: e, connectionID: t }) => {
|
|
1263
|
+
const r = P(e);
|
|
1264
1264
|
return {
|
|
1265
1265
|
/**
|
|
1266
1266
|
* The current settings from the provider.
|
|
1267
1267
|
*/
|
|
1268
1268
|
groups: D({
|
|
1269
|
-
queryKey: [
|
|
1270
|
-
queryFn: async () =>
|
|
1269
|
+
queryKey: [r, "resource_groups", "list"],
|
|
1270
|
+
queryFn: async () => Cr(r, t),
|
|
1271
1271
|
retry: !1
|
|
1272
1272
|
})
|
|
1273
1273
|
};
|
|
1274
|
-
},
|
|
1274
|
+
}, zs = ({
|
|
1275
1275
|
pluginID: e,
|
|
1276
1276
|
connectionID: t,
|
|
1277
|
-
searches:
|
|
1277
|
+
searches: r
|
|
1278
1278
|
}) => {
|
|
1279
|
-
const
|
|
1280
|
-
return
|
|
1281
|
-
queries:
|
|
1279
|
+
const n = P(e), s = (o) => [n, t, o.key, o.namespaces, "list"];
|
|
1280
|
+
return Nr({
|
|
1281
|
+
queries: r.map((o) => ({
|
|
1282
1282
|
queryKey: s(o),
|
|
1283
|
-
queryFn: async () => ht(
|
|
1283
|
+
queryFn: async () => ht(n, t, o.key, T.ListInput.createFrom({
|
|
1284
1284
|
params: {},
|
|
1285
1285
|
order: {
|
|
1286
1286
|
by: "name",
|
|
@@ -1295,32 +1295,32 @@ const qs = () => {
|
|
|
1295
1295
|
retry: !1
|
|
1296
1296
|
}))
|
|
1297
1297
|
});
|
|
1298
|
-
},
|
|
1299
|
-
const
|
|
1298
|
+
}, Ws = ({ pluginID: e, resourceKey: t }) => {
|
|
1299
|
+
const r = P(e);
|
|
1300
1300
|
return {
|
|
1301
1301
|
/**
|
|
1302
1302
|
* The current settings from the provider.
|
|
1303
1303
|
*/
|
|
1304
1304
|
resourceType: D({
|
|
1305
|
-
queryKey: [
|
|
1306
|
-
queryFn: async () =>
|
|
1305
|
+
queryKey: [r, "resources", t],
|
|
1306
|
+
queryFn: async () => Er(r, t),
|
|
1307
1307
|
retry: !1
|
|
1308
1308
|
})
|
|
1309
1309
|
};
|
|
1310
|
-
},
|
|
1311
|
-
const
|
|
1310
|
+
}, Hs = ({ pluginID: e, connectionID: t }) => {
|
|
1311
|
+
const r = P(e);
|
|
1312
1312
|
return {
|
|
1313
1313
|
/**
|
|
1314
1314
|
* The current settings from the provider.
|
|
1315
1315
|
*/
|
|
1316
1316
|
types: D({
|
|
1317
|
-
queryKey: [
|
|
1318
|
-
queryFn: async () =>
|
|
1317
|
+
queryKey: [r, "resources", "list"],
|
|
1318
|
+
queryFn: async () => br(r, t),
|
|
1319
1319
|
retry: !1
|
|
1320
1320
|
})
|
|
1321
1321
|
};
|
|
1322
1322
|
};
|
|
1323
|
-
var Tt = Symbol.for("immer-nothing"), tt = Symbol.for("immer-draftable"), N = Symbol.for("immer-state"),
|
|
1323
|
+
var Tt = Symbol.for("immer-nothing"), tt = Symbol.for("immer-draftable"), N = Symbol.for("immer-state"), Xr = process.env.NODE_ENV !== "production" ? [
|
|
1324
1324
|
// All error codes, starting by 0:
|
|
1325
1325
|
function(e) {
|
|
1326
1326
|
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
@@ -1353,8 +1353,8 @@ var Tt = Symbol.for("immer-nothing"), tt = Symbol.for("immer-draftable"), N = Sy
|
|
|
1353
1353
|
] : [];
|
|
1354
1354
|
function O(e, ...t) {
|
|
1355
1355
|
if (process.env.NODE_ENV !== "production") {
|
|
1356
|
-
const
|
|
1357
|
-
throw new Error(`[Immer] ${
|
|
1356
|
+
const r = Xr[e], n = typeof r == "function" ? r.apply(null, t) : r;
|
|
1357
|
+
throw new Error(`[Immer] ${n}`);
|
|
1358
1358
|
}
|
|
1359
1359
|
throw new Error(
|
|
1360
1360
|
`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
|
|
@@ -1364,24 +1364,24 @@ var Z = Object.getPrototypeOf;
|
|
|
1364
1364
|
function ee(e) {
|
|
1365
1365
|
return !!e && !!e[N];
|
|
1366
1366
|
}
|
|
1367
|
-
function
|
|
1367
|
+
function j(e) {
|
|
1368
1368
|
var t;
|
|
1369
1369
|
return e ? Nt(e) || Array.isArray(e) || !!e[tt] || !!((t = e.constructor) != null && t[tt]) || _e(e) || we(e) : !1;
|
|
1370
1370
|
}
|
|
1371
|
-
var
|
|
1371
|
+
var Zr = Object.prototype.constructor.toString();
|
|
1372
1372
|
function Nt(e) {
|
|
1373
1373
|
if (!e || typeof e != "object")
|
|
1374
1374
|
return !1;
|
|
1375
1375
|
const t = Z(e);
|
|
1376
1376
|
if (t === null)
|
|
1377
1377
|
return !0;
|
|
1378
|
-
const
|
|
1379
|
-
return
|
|
1378
|
+
const r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
|
|
1379
|
+
return r === Object ? !0 : typeof r == "function" && Function.toString.call(r) === Zr;
|
|
1380
1380
|
}
|
|
1381
1381
|
function pe(e, t) {
|
|
1382
|
-
ge(e) === 0 ? Reflect.ownKeys(e).forEach((
|
|
1383
|
-
t(
|
|
1384
|
-
}) : e.forEach((
|
|
1382
|
+
ge(e) === 0 ? Reflect.ownKeys(e).forEach((r) => {
|
|
1383
|
+
t(r, e[r], e);
|
|
1384
|
+
}) : e.forEach((r, n) => t(n, r, e));
|
|
1385
1385
|
}
|
|
1386
1386
|
function ge(e) {
|
|
1387
1387
|
const t = e[N];
|
|
@@ -1390,11 +1390,11 @@ function ge(e) {
|
|
|
1390
1390
|
function Ae(e, t) {
|
|
1391
1391
|
return ge(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
1392
1392
|
}
|
|
1393
|
-
function
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1393
|
+
function Rt(e, t, r) {
|
|
1394
|
+
const n = ge(e);
|
|
1395
|
+
n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1397
|
+
function en(e, t) {
|
|
1398
1398
|
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
1399
1399
|
}
|
|
1400
1400
|
function _e(e) {
|
|
@@ -1403,7 +1403,7 @@ function _e(e) {
|
|
|
1403
1403
|
function we(e) {
|
|
1404
1404
|
return e instanceof Set;
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1406
|
+
function K(e) {
|
|
1407
1407
|
return e.copy_ || e.base_;
|
|
1408
1408
|
}
|
|
1409
1409
|
function Te(e, t) {
|
|
@@ -1413,14 +1413,14 @@ function Te(e, t) {
|
|
|
1413
1413
|
return new Set(e);
|
|
1414
1414
|
if (Array.isArray(e))
|
|
1415
1415
|
return Array.prototype.slice.call(e);
|
|
1416
|
-
const
|
|
1417
|
-
if (t === !0 || t === "class_only" && !
|
|
1418
|
-
const
|
|
1419
|
-
delete
|
|
1420
|
-
let s = Reflect.ownKeys(
|
|
1416
|
+
const r = Nt(e);
|
|
1417
|
+
if (t === !0 || t === "class_only" && !r) {
|
|
1418
|
+
const n = Object.getOwnPropertyDescriptors(e);
|
|
1419
|
+
delete n[N];
|
|
1420
|
+
let s = Reflect.ownKeys(n);
|
|
1421
1421
|
for (let i = 0; i < s.length; i++) {
|
|
1422
|
-
const o = s[i], a =
|
|
1423
|
-
a.writable === !1 && (a.writable = !0, a.configurable = !0), (a.get || a.set) && (
|
|
1422
|
+
const o = s[i], a = n[o];
|
|
1423
|
+
a.writable === !1 && (a.writable = !0, a.configurable = !0), (a.get || a.set) && (n[o] = {
|
|
1424
1424
|
configurable: !0,
|
|
1425
1425
|
writable: !0,
|
|
1426
1426
|
// could live with !!desc.set as well here...
|
|
@@ -1428,34 +1428,34 @@ function Te(e, t) {
|
|
|
1428
1428
|
value: e[o]
|
|
1429
1429
|
});
|
|
1430
1430
|
}
|
|
1431
|
-
return Object.create(Z(e),
|
|
1431
|
+
return Object.create(Z(e), n);
|
|
1432
1432
|
} else {
|
|
1433
|
-
const
|
|
1434
|
-
if (
|
|
1433
|
+
const n = Z(e);
|
|
1434
|
+
if (n !== null && r)
|
|
1435
1435
|
return { ...e };
|
|
1436
|
-
const s = Object.create(
|
|
1436
|
+
const s = Object.create(n);
|
|
1437
1437
|
return Object.assign(s, e);
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
function Ge(e, t = !1) {
|
|
1441
|
-
return Se(e) || ee(e) || !
|
|
1441
|
+
return Se(e) || ee(e) || !j(e) || (ge(e) > 1 && (e.set = e.add = e.clear = e.delete = tn), Object.freeze(e), t && Object.entries(e).forEach(([r, n]) => Ge(n, !0))), e;
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1443
|
+
function tn() {
|
|
1444
1444
|
O(2);
|
|
1445
1445
|
}
|
|
1446
1446
|
function Se(e) {
|
|
1447
1447
|
return Object.isFrozen(e);
|
|
1448
1448
|
}
|
|
1449
|
-
var
|
|
1449
|
+
var rn = {};
|
|
1450
1450
|
function z(e) {
|
|
1451
|
-
const t =
|
|
1451
|
+
const t = rn[e];
|
|
1452
1452
|
return t || O(0, e), t;
|
|
1453
1453
|
}
|
|
1454
|
-
var
|
|
1455
|
-
function
|
|
1456
|
-
return
|
|
1454
|
+
var ne;
|
|
1455
|
+
function kt() {
|
|
1456
|
+
return ne;
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function nn(e, t) {
|
|
1459
1459
|
return {
|
|
1460
1460
|
drafts_: [],
|
|
1461
1461
|
parent_: e,
|
|
@@ -1466,84 +1466,84 @@ function nr(e, t) {
|
|
|
1466
1466
|
unfinalizedDrafts_: 0
|
|
1467
1467
|
};
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1469
|
+
function rt(e, t) {
|
|
1470
1470
|
t && (z("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
1471
1471
|
}
|
|
1472
1472
|
function Ne(e) {
|
|
1473
|
-
|
|
1473
|
+
Re(e), e.drafts_.forEach(sn), e.drafts_ = null;
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1476
|
-
e ===
|
|
1475
|
+
function Re(e) {
|
|
1476
|
+
e === ne && (ne = e.parent_);
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1479
|
-
return
|
|
1478
|
+
function nt(e) {
|
|
1479
|
+
return ne = nn(ne, e);
|
|
1480
1480
|
}
|
|
1481
|
-
function
|
|
1481
|
+
function sn(e) {
|
|
1482
1482
|
const t = e[N];
|
|
1483
1483
|
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
|
|
1484
1484
|
}
|
|
1485
1485
|
function st(e, t) {
|
|
1486
1486
|
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
1487
|
-
const
|
|
1488
|
-
return e !== void 0 && e !==
|
|
1489
|
-
|
|
1487
|
+
const r = t.drafts_[0];
|
|
1488
|
+
return e !== void 0 && e !== r ? (r[N].modified_ && (Ne(t), O(4)), j(e) && (e = ye(t, e), t.parent_ || he(t, e)), t.patches_ && z("Patches").generateReplacementPatches_(
|
|
1489
|
+
r[N].base_,
|
|
1490
1490
|
e,
|
|
1491
1491
|
t.patches_,
|
|
1492
1492
|
t.inversePatches_
|
|
1493
|
-
)) : e = ye(t,
|
|
1493
|
+
)) : e = ye(t, r, []), Ne(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Tt ? e : void 0;
|
|
1494
1494
|
}
|
|
1495
|
-
function ye(e, t,
|
|
1495
|
+
function ye(e, t, r) {
|
|
1496
1496
|
if (Se(t))
|
|
1497
1497
|
return t;
|
|
1498
|
-
const
|
|
1499
|
-
if (!
|
|
1498
|
+
const n = t[N];
|
|
1499
|
+
if (!n)
|
|
1500
1500
|
return pe(
|
|
1501
1501
|
t,
|
|
1502
|
-
(s, i) => ot(e,
|
|
1502
|
+
(s, i) => ot(e, n, t, s, i, r)
|
|
1503
1503
|
), t;
|
|
1504
|
-
if (
|
|
1504
|
+
if (n.scope_ !== e)
|
|
1505
1505
|
return t;
|
|
1506
|
-
if (!
|
|
1507
|
-
return he(e,
|
|
1508
|
-
if (!
|
|
1509
|
-
|
|
1510
|
-
const s =
|
|
1506
|
+
if (!n.modified_)
|
|
1507
|
+
return he(e, n.base_, !0), n.base_;
|
|
1508
|
+
if (!n.finalized_) {
|
|
1509
|
+
n.finalized_ = !0, n.scope_.unfinalizedDrafts_--;
|
|
1510
|
+
const s = n.copy_;
|
|
1511
1511
|
let i = s, o = !1;
|
|
1512
|
-
|
|
1512
|
+
n.type_ === 3 && (i = new Set(s), s.clear(), o = !0), pe(
|
|
1513
1513
|
i,
|
|
1514
|
-
(a, c) => ot(e,
|
|
1515
|
-
), he(e, s, !1),
|
|
1516
|
-
r,
|
|
1514
|
+
(a, c) => ot(e, n, s, a, c, r, o)
|
|
1515
|
+
), he(e, s, !1), r && e.patches_ && z("Patches").generatePatches_(
|
|
1517
1516
|
n,
|
|
1517
|
+
r,
|
|
1518
1518
|
e.patches_,
|
|
1519
1519
|
e.inversePatches_
|
|
1520
1520
|
);
|
|
1521
1521
|
}
|
|
1522
|
-
return
|
|
1522
|
+
return n.copy_;
|
|
1523
1523
|
}
|
|
1524
|
-
function ot(e, t,
|
|
1525
|
-
if (process.env.NODE_ENV !== "production" && s ===
|
|
1524
|
+
function ot(e, t, r, n, s, i, o) {
|
|
1525
|
+
if (process.env.NODE_ENV !== "production" && s === r && O(5), ee(s)) {
|
|
1526
1526
|
const a = i && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
1527
|
-
!Ae(t.assigned_,
|
|
1528
|
-
if (
|
|
1527
|
+
!Ae(t.assigned_, n) ? i.concat(n) : void 0, c = ye(e, s, a);
|
|
1528
|
+
if (Rt(r, n, c), ee(c))
|
|
1529
1529
|
e.canAutoFreeze_ = !1;
|
|
1530
1530
|
else
|
|
1531
1531
|
return;
|
|
1532
|
-
} else o &&
|
|
1533
|
-
if (
|
|
1532
|
+
} else o && r.add(s);
|
|
1533
|
+
if (j(s) && !Se(s)) {
|
|
1534
1534
|
if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
|
|
1535
1535
|
return;
|
|
1536
|
-
ye(e, s), (!t || !t.scope_.parent_) && typeof
|
|
1536
|
+
ye(e, s), (!t || !t.scope_.parent_) && typeof n != "symbol" && Object.prototype.propertyIsEnumerable.call(r, n) && he(e, s);
|
|
1537
1537
|
}
|
|
1538
1538
|
}
|
|
1539
|
-
function he(e, t,
|
|
1540
|
-
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && Ge(t,
|
|
1539
|
+
function he(e, t, r = !1) {
|
|
1540
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && Ge(t, r);
|
|
1541
1541
|
}
|
|
1542
|
-
function
|
|
1543
|
-
const
|
|
1544
|
-
type_:
|
|
1542
|
+
function on(e, t) {
|
|
1543
|
+
const r = Array.isArray(e), n = {
|
|
1544
|
+
type_: r ? 1 : 0,
|
|
1545
1545
|
// Track which produce call this is associated with.
|
|
1546
|
-
scope_: t ? t.scope_ :
|
|
1546
|
+
scope_: t ? t.scope_ : kt(),
|
|
1547
1547
|
// True for both shallow and deep changes.
|
|
1548
1548
|
modified_: !1,
|
|
1549
1549
|
// Used during finalization.
|
|
@@ -1563,55 +1563,55 @@ function sr(e, t) {
|
|
|
1563
1563
|
revoke_: null,
|
|
1564
1564
|
isManual_: !1
|
|
1565
1565
|
};
|
|
1566
|
-
let s =
|
|
1567
|
-
|
|
1566
|
+
let s = n, i = Ue;
|
|
1567
|
+
r && (s = [n], i = se);
|
|
1568
1568
|
const { revoke: o, proxy: a } = Proxy.revocable(s, i);
|
|
1569
|
-
return
|
|
1569
|
+
return n.draft_ = a, n.revoke_ = o, a;
|
|
1570
1570
|
}
|
|
1571
|
-
var
|
|
1571
|
+
var Ue = {
|
|
1572
1572
|
get(e, t) {
|
|
1573
1573
|
if (t === N)
|
|
1574
1574
|
return e;
|
|
1575
|
-
const
|
|
1576
|
-
if (!Ae(
|
|
1577
|
-
return
|
|
1578
|
-
const
|
|
1579
|
-
return e.finalized_ || !
|
|
1575
|
+
const r = K(e);
|
|
1576
|
+
if (!Ae(r, t))
|
|
1577
|
+
return an(e, r, t);
|
|
1578
|
+
const n = r[t];
|
|
1579
|
+
return e.finalized_ || !j(n) ? n : n === Pe(e.base_, t) ? (De(e), e.copy_[t] = Me(n, e)) : n;
|
|
1580
1580
|
},
|
|
1581
1581
|
has(e, t) {
|
|
1582
|
-
return t in
|
|
1582
|
+
return t in K(e);
|
|
1583
1583
|
},
|
|
1584
1584
|
ownKeys(e) {
|
|
1585
|
-
return Reflect.ownKeys(
|
|
1585
|
+
return Reflect.ownKeys(K(e));
|
|
1586
1586
|
},
|
|
1587
|
-
set(e, t,
|
|
1588
|
-
const
|
|
1589
|
-
if (
|
|
1590
|
-
return
|
|
1587
|
+
set(e, t, r) {
|
|
1588
|
+
const n = Mt(K(e), t);
|
|
1589
|
+
if (n != null && n.set)
|
|
1590
|
+
return n.set.call(e.draft_, r), !0;
|
|
1591
1591
|
if (!e.modified_) {
|
|
1592
|
-
const s = Pe(
|
|
1593
|
-
if (i && i.base_ ===
|
|
1594
|
-
return e.copy_[t] =
|
|
1595
|
-
if (
|
|
1592
|
+
const s = Pe(K(e), t), i = s == null ? void 0 : s[N];
|
|
1593
|
+
if (i && i.base_ === r)
|
|
1594
|
+
return e.copy_[t] = r, e.assigned_[t] = !1, !0;
|
|
1595
|
+
if (en(r, s) && (r !== void 0 || Ae(e.base_, t)))
|
|
1596
1596
|
return !0;
|
|
1597
|
-
De(e),
|
|
1597
|
+
De(e), ke(e);
|
|
1598
1598
|
}
|
|
1599
|
-
return e.copy_[t] ===
|
|
1600
|
-
(
|
|
1601
|
-
Number.isNaN(
|
|
1599
|
+
return e.copy_[t] === r && // special case: handle new props with value 'undefined'
|
|
1600
|
+
(r !== void 0 || t in e.copy_) || // special case: NaN
|
|
1601
|
+
Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_[t] = !0), !0;
|
|
1602
1602
|
},
|
|
1603
1603
|
deleteProperty(e, t) {
|
|
1604
|
-
return Pe(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, De(e),
|
|
1604
|
+
return Pe(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, De(e), ke(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
|
|
1605
1605
|
},
|
|
1606
1606
|
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
1607
1607
|
// the same guarantee in ES5 mode.
|
|
1608
1608
|
getOwnPropertyDescriptor(e, t) {
|
|
1609
|
-
const
|
|
1610
|
-
return
|
|
1609
|
+
const r = K(e), n = Reflect.getOwnPropertyDescriptor(r, t);
|
|
1610
|
+
return n && {
|
|
1611
1611
|
writable: !0,
|
|
1612
1612
|
configurable: e.type_ !== 1 || t !== "length",
|
|
1613
|
-
enumerable:
|
|
1614
|
-
value:
|
|
1613
|
+
enumerable: n.enumerable,
|
|
1614
|
+
value: r[t]
|
|
1615
1615
|
};
|
|
1616
1616
|
},
|
|
1617
1617
|
defineProperty() {
|
|
@@ -1624,7 +1624,7 @@ var Ke = {
|
|
|
1624
1624
|
O(12);
|
|
1625
1625
|
}
|
|
1626
1626
|
}, se = {};
|
|
1627
|
-
pe(
|
|
1627
|
+
pe(Ue, (e, t) => {
|
|
1628
1628
|
se[e] = function() {
|
|
1629
1629
|
return arguments[0] = arguments[0][0], t.apply(this, arguments);
|
|
1630
1630
|
};
|
|
@@ -1632,35 +1632,35 @@ pe(Ke, (e, t) => {
|
|
|
1632
1632
|
se.deleteProperty = function(e, t) {
|
|
1633
1633
|
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && O(13), se.set.call(this, e, t, void 0);
|
|
1634
1634
|
};
|
|
1635
|
-
se.set = function(e, t,
|
|
1636
|
-
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && O(14),
|
|
1635
|
+
se.set = function(e, t, r) {
|
|
1636
|
+
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && O(14), Ue.set.call(this, e[0], t, r, e[0]);
|
|
1637
1637
|
};
|
|
1638
1638
|
function Pe(e, t) {
|
|
1639
|
-
const
|
|
1640
|
-
return (
|
|
1639
|
+
const r = e[N];
|
|
1640
|
+
return (r ? K(r) : e)[t];
|
|
1641
1641
|
}
|
|
1642
|
-
function
|
|
1642
|
+
function an(e, t, r) {
|
|
1643
1643
|
var s;
|
|
1644
|
-
const
|
|
1645
|
-
return
|
|
1644
|
+
const n = Mt(t, r);
|
|
1645
|
+
return n ? "value" in n ? n.value : (
|
|
1646
1646
|
// This is a very special case, if the prop is a getter defined by the
|
|
1647
1647
|
// prototype, we should invoke it with the draft as context!
|
|
1648
|
-
(s =
|
|
1648
|
+
(s = n.get) == null ? void 0 : s.call(e.draft_)
|
|
1649
1649
|
) : void 0;
|
|
1650
1650
|
}
|
|
1651
1651
|
function Mt(e, t) {
|
|
1652
1652
|
if (!(t in e))
|
|
1653
1653
|
return;
|
|
1654
|
-
let
|
|
1655
|
-
for (;
|
|
1656
|
-
const
|
|
1657
|
-
if (
|
|
1658
|
-
return
|
|
1659
|
-
|
|
1654
|
+
let r = Z(e);
|
|
1655
|
+
for (; r; ) {
|
|
1656
|
+
const n = Object.getOwnPropertyDescriptor(r, t);
|
|
1657
|
+
if (n)
|
|
1658
|
+
return n;
|
|
1659
|
+
r = Z(r);
|
|
1660
1660
|
}
|
|
1661
1661
|
}
|
|
1662
|
-
function
|
|
1663
|
-
e.modified_ || (e.modified_ = !0, e.parent_ &&
|
|
1662
|
+
function ke(e) {
|
|
1663
|
+
e.modified_ || (e.modified_ = !0, e.parent_ && ke(e.parent_));
|
|
1664
1664
|
}
|
|
1665
1665
|
function De(e) {
|
|
1666
1666
|
e.copy_ || (e.copy_ = Te(
|
|
@@ -1668,55 +1668,55 @@ function De(e) {
|
|
|
1668
1668
|
e.scope_.immer_.useStrictShallowCopy_
|
|
1669
1669
|
));
|
|
1670
1670
|
}
|
|
1671
|
-
var
|
|
1671
|
+
var cn = class {
|
|
1672
1672
|
constructor(e) {
|
|
1673
|
-
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t,
|
|
1674
|
-
if (typeof t == "function" && typeof
|
|
1675
|
-
const i =
|
|
1676
|
-
|
|
1673
|
+
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, r, n) => {
|
|
1674
|
+
if (typeof t == "function" && typeof r != "function") {
|
|
1675
|
+
const i = r;
|
|
1676
|
+
r = t;
|
|
1677
1677
|
const o = this;
|
|
1678
1678
|
return function(c = i, ...l) {
|
|
1679
|
-
return o.produce(c, (u) =>
|
|
1679
|
+
return o.produce(c, (u) => r.call(this, u, ...l));
|
|
1680
1680
|
};
|
|
1681
1681
|
}
|
|
1682
|
-
typeof
|
|
1682
|
+
typeof r != "function" && O(6), n !== void 0 && typeof n != "function" && O(7);
|
|
1683
1683
|
let s;
|
|
1684
|
-
if (
|
|
1685
|
-
const i =
|
|
1684
|
+
if (j(t)) {
|
|
1685
|
+
const i = nt(this), o = Me(t, void 0);
|
|
1686
1686
|
let a = !0;
|
|
1687
1687
|
try {
|
|
1688
|
-
s =
|
|
1688
|
+
s = r(o), a = !1;
|
|
1689
1689
|
} finally {
|
|
1690
|
-
a ? Ne(i) :
|
|
1690
|
+
a ? Ne(i) : Re(i);
|
|
1691
1691
|
}
|
|
1692
|
-
return
|
|
1692
|
+
return rt(i, n), st(s, i);
|
|
1693
1693
|
} else if (!t || typeof t != "object") {
|
|
1694
|
-
if (s =
|
|
1694
|
+
if (s = r(t), s === void 0 && (s = t), s === Tt && (s = void 0), this.autoFreeze_ && Ge(s, !0), n) {
|
|
1695
1695
|
const i = [], o = [];
|
|
1696
|
-
z("Patches").generateReplacementPatches_(t, s, i, o),
|
|
1696
|
+
z("Patches").generateReplacementPatches_(t, s, i, o), n(i, o);
|
|
1697
1697
|
}
|
|
1698
1698
|
return s;
|
|
1699
1699
|
} else
|
|
1700
1700
|
O(1, t);
|
|
1701
|
-
}, this.produceWithPatches = (t,
|
|
1701
|
+
}, this.produceWithPatches = (t, r) => {
|
|
1702
1702
|
if (typeof t == "function")
|
|
1703
1703
|
return (o, ...a) => this.produceWithPatches(o, (c) => t(c, ...a));
|
|
1704
|
-
let
|
|
1705
|
-
return [this.produce(t,
|
|
1706
|
-
|
|
1707
|
-
}),
|
|
1704
|
+
let n, s;
|
|
1705
|
+
return [this.produce(t, r, (o, a) => {
|
|
1706
|
+
n = o, s = a;
|
|
1707
|
+
}), n, s];
|
|
1708
1708
|
}, typeof (e == null ? void 0 : e.autoFreeze) == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof (e == null ? void 0 : e.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy);
|
|
1709
1709
|
}
|
|
1710
1710
|
createDraft(e) {
|
|
1711
|
-
|
|
1712
|
-
const t =
|
|
1713
|
-
return
|
|
1711
|
+
j(e) || O(8), ee(e) && (e = un(e));
|
|
1712
|
+
const t = nt(this), r = Me(e, void 0);
|
|
1713
|
+
return r[N].isManual_ = !0, Re(t), r;
|
|
1714
1714
|
}
|
|
1715
1715
|
finishDraft(e, t) {
|
|
1716
|
-
const
|
|
1717
|
-
(!
|
|
1718
|
-
const { scope_:
|
|
1719
|
-
return
|
|
1716
|
+
const r = e && e[N];
|
|
1717
|
+
(!r || !r.isManual_) && O(9);
|
|
1718
|
+
const { scope_: n } = r;
|
|
1719
|
+
return rt(n, t), st(void 0, n);
|
|
1720
1720
|
}
|
|
1721
1721
|
/**
|
|
1722
1722
|
* Pass true to automatically freeze all copies created by Immer.
|
|
@@ -1735,62 +1735,62 @@ var ir = class {
|
|
|
1735
1735
|
this.useStrictShallowCopy_ = e;
|
|
1736
1736
|
}
|
|
1737
1737
|
applyPatches(e, t) {
|
|
1738
|
-
let
|
|
1739
|
-
for (
|
|
1740
|
-
const s = t[
|
|
1738
|
+
let r;
|
|
1739
|
+
for (r = t.length - 1; r >= 0; r--) {
|
|
1740
|
+
const s = t[r];
|
|
1741
1741
|
if (s.path.length === 0 && s.op === "replace") {
|
|
1742
1742
|
e = s.value;
|
|
1743
1743
|
break;
|
|
1744
1744
|
}
|
|
1745
1745
|
}
|
|
1746
|
-
|
|
1747
|
-
const
|
|
1748
|
-
return ee(e) ?
|
|
1746
|
+
r > -1 && (t = t.slice(r + 1));
|
|
1747
|
+
const n = z("Patches").applyPatches_;
|
|
1748
|
+
return ee(e) ? n(e, t) : this.produce(
|
|
1749
1749
|
e,
|
|
1750
|
-
(s) =>
|
|
1750
|
+
(s) => n(s, t)
|
|
1751
1751
|
);
|
|
1752
1752
|
}
|
|
1753
1753
|
};
|
|
1754
1754
|
function Me(e, t) {
|
|
1755
|
-
const
|
|
1756
|
-
return (t ? t.scope_ :
|
|
1755
|
+
const r = _e(e) ? z("MapSet").proxyMap_(e, t) : we(e) ? z("MapSet").proxySet_(e, t) : on(e, t);
|
|
1756
|
+
return (t ? t.scope_ : kt()).drafts_.push(r), r;
|
|
1757
1757
|
}
|
|
1758
|
-
function
|
|
1758
|
+
function un(e) {
|
|
1759
1759
|
return ee(e) || O(10, e), $t(e);
|
|
1760
1760
|
}
|
|
1761
1761
|
function $t(e) {
|
|
1762
|
-
if (!
|
|
1762
|
+
if (!j(e) || Se(e))
|
|
1763
1763
|
return e;
|
|
1764
1764
|
const t = e[N];
|
|
1765
|
-
let
|
|
1765
|
+
let r;
|
|
1766
1766
|
if (t) {
|
|
1767
1767
|
if (!t.modified_)
|
|
1768
1768
|
return t.base_;
|
|
1769
|
-
t.finalized_ = !0,
|
|
1769
|
+
t.finalized_ = !0, r = Te(e, t.scope_.immer_.useStrictShallowCopy_);
|
|
1770
1770
|
} else
|
|
1771
|
-
|
|
1772
|
-
return pe(
|
|
1773
|
-
|
|
1774
|
-
}), t && (t.finalized_ = !1),
|
|
1775
|
-
}
|
|
1776
|
-
var
|
|
1777
|
-
|
|
1778
|
-
|
|
1771
|
+
r = Te(e, !0);
|
|
1772
|
+
return pe(r, (n, s) => {
|
|
1773
|
+
Rt(r, n, $t(s));
|
|
1774
|
+
}), t && (t.finalized_ = !1), r;
|
|
1775
|
+
}
|
|
1776
|
+
var R = new cn(), le = R.produce;
|
|
1777
|
+
R.produceWithPatches.bind(
|
|
1778
|
+
R
|
|
1779
1779
|
);
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1780
|
+
R.setAutoFreeze.bind(R);
|
|
1781
|
+
R.setUseStrictShallowCopy.bind(R);
|
|
1782
|
+
R.applyPatches.bind(R);
|
|
1783
|
+
R.createDraft.bind(R);
|
|
1784
|
+
R.finishDraft.bind(R);
|
|
1785
1785
|
var ue = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1786
|
-
function
|
|
1786
|
+
function ln(e) {
|
|
1787
1787
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1788
1788
|
}
|
|
1789
|
-
var
|
|
1790
|
-
function
|
|
1789
|
+
var dn = "Expected a function", Lt = "__lodash_hash_undefined__", fn = "[object Function]", pn = "[object GeneratorFunction]", yn = "[object Symbol]", hn = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, mn = /^\w*$/, gn = /^\./, _n = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, wn = /[\\^$.*+?()[\]{}|]/g, Sn = /\\(\\)?/g, Cn = /^\[object .+?Constructor\]$/, En = typeof ue == "object" && ue && ue.Object === Object && ue, bn = typeof self == "object" && self && self.Object === Object && self, Ke = En || bn || Function("return this")();
|
|
1790
|
+
function vn(e, t) {
|
|
1791
1791
|
return e == null ? void 0 : e[t];
|
|
1792
1792
|
}
|
|
1793
|
-
function
|
|
1793
|
+
function Pn(e) {
|
|
1794
1794
|
var t = !1;
|
|
1795
1795
|
if (e != null && typeof e.toString != "function")
|
|
1796
1796
|
try {
|
|
@@ -1799,129 +1799,129 @@ function br(e) {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
return t;
|
|
1801
1801
|
}
|
|
1802
|
-
var
|
|
1802
|
+
var Dn = Array.prototype, Fn = Function.prototype, qt = Object.prototype, Fe = Ke["__core-js_shared__"], it = function() {
|
|
1803
1803
|
var e = /[^.]+$/.exec(Fe && Fe.keys && Fe.keys.IE_PROTO || "");
|
|
1804
1804
|
return e ? "Symbol(src)_1." + e : "";
|
|
1805
|
-
}(), Gt =
|
|
1806
|
-
"^" + Gt.call(
|
|
1807
|
-
), at =
|
|
1805
|
+
}(), Gt = Fn.toString, Qe = qt.hasOwnProperty, Ut = qt.toString, xn = RegExp(
|
|
1806
|
+
"^" + Gt.call(Qe).replace(wn, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1807
|
+
), at = Ke.Symbol, In = Dn.splice, On = Kt(Ke, "Map"), oe = Kt(Object, "create"), ct = at ? at.prototype : void 0, ut = ct ? ct.toString : void 0;
|
|
1808
1808
|
function W(e) {
|
|
1809
|
-
var t = -1,
|
|
1810
|
-
for (this.clear(); ++t <
|
|
1811
|
-
var
|
|
1812
|
-
this.set(
|
|
1809
|
+
var t = -1, r = e ? e.length : 0;
|
|
1810
|
+
for (this.clear(); ++t < r; ) {
|
|
1811
|
+
var n = e[t];
|
|
1812
|
+
this.set(n[0], n[1]);
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
|
-
function
|
|
1815
|
+
function An() {
|
|
1816
1816
|
this.__data__ = oe ? oe(null) : {};
|
|
1817
1817
|
}
|
|
1818
|
-
function
|
|
1818
|
+
function Tn(e) {
|
|
1819
1819
|
return this.has(e) && delete this.__data__[e];
|
|
1820
1820
|
}
|
|
1821
|
-
function
|
|
1821
|
+
function Nn(e) {
|
|
1822
1822
|
var t = this.__data__;
|
|
1823
1823
|
if (oe) {
|
|
1824
|
-
var
|
|
1825
|
-
return
|
|
1824
|
+
var r = t[e];
|
|
1825
|
+
return r === Lt ? void 0 : r;
|
|
1826
1826
|
}
|
|
1827
|
-
return
|
|
1827
|
+
return Qe.call(t, e) ? t[e] : void 0;
|
|
1828
1828
|
}
|
|
1829
|
-
function
|
|
1829
|
+
function Rn(e) {
|
|
1830
1830
|
var t = this.__data__;
|
|
1831
|
-
return oe ? t[e] !== void 0 :
|
|
1832
|
-
}
|
|
1833
|
-
function
|
|
1834
|
-
var
|
|
1835
|
-
return
|
|
1836
|
-
}
|
|
1837
|
-
W.prototype.clear =
|
|
1838
|
-
W.prototype.delete =
|
|
1839
|
-
W.prototype.get =
|
|
1840
|
-
W.prototype.has =
|
|
1841
|
-
W.prototype.set =
|
|
1842
|
-
function
|
|
1843
|
-
var t = -1,
|
|
1844
|
-
for (this.clear(); ++t <
|
|
1845
|
-
var
|
|
1846
|
-
this.set(
|
|
1831
|
+
return oe ? t[e] !== void 0 : Qe.call(t, e);
|
|
1832
|
+
}
|
|
1833
|
+
function kn(e, t) {
|
|
1834
|
+
var r = this.__data__;
|
|
1835
|
+
return r[e] = oe && t === void 0 ? Lt : t, this;
|
|
1836
|
+
}
|
|
1837
|
+
W.prototype.clear = An;
|
|
1838
|
+
W.prototype.delete = Tn;
|
|
1839
|
+
W.prototype.get = Nn;
|
|
1840
|
+
W.prototype.has = Rn;
|
|
1841
|
+
W.prototype.set = kn;
|
|
1842
|
+
function re(e) {
|
|
1843
|
+
var t = -1, r = e ? e.length : 0;
|
|
1844
|
+
for (this.clear(); ++t < r; ) {
|
|
1845
|
+
var n = e[t];
|
|
1846
|
+
this.set(n[0], n[1]);
|
|
1847
1847
|
}
|
|
1848
1848
|
}
|
|
1849
|
-
function
|
|
1849
|
+
function Mn() {
|
|
1850
1850
|
this.__data__ = [];
|
|
1851
1851
|
}
|
|
1852
|
-
function
|
|
1853
|
-
var t = this.__data__,
|
|
1854
|
-
if (
|
|
1852
|
+
function $n(e) {
|
|
1853
|
+
var t = this.__data__, r = Ce(t, e);
|
|
1854
|
+
if (r < 0)
|
|
1855
1855
|
return !1;
|
|
1856
|
-
var
|
|
1857
|
-
return
|
|
1856
|
+
var n = t.length - 1;
|
|
1857
|
+
return r == n ? t.pop() : In.call(t, r, 1), !0;
|
|
1858
1858
|
}
|
|
1859
|
-
function
|
|
1860
|
-
var t = this.__data__,
|
|
1861
|
-
return
|
|
1859
|
+
function Ln(e) {
|
|
1860
|
+
var t = this.__data__, r = Ce(t, e);
|
|
1861
|
+
return r < 0 ? void 0 : t[r][1];
|
|
1862
1862
|
}
|
|
1863
|
-
function
|
|
1863
|
+
function qn(e) {
|
|
1864
1864
|
return Ce(this.__data__, e) > -1;
|
|
1865
1865
|
}
|
|
1866
|
-
function
|
|
1867
|
-
var
|
|
1868
|
-
return
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1866
|
+
function Gn(e, t) {
|
|
1867
|
+
var r = this.__data__, n = Ce(r, e);
|
|
1868
|
+
return n < 0 ? r.push([e, t]) : r[n][1] = t, this;
|
|
1869
|
+
}
|
|
1870
|
+
re.prototype.clear = Mn;
|
|
1871
|
+
re.prototype.delete = $n;
|
|
1872
|
+
re.prototype.get = Ln;
|
|
1873
|
+
re.prototype.has = qn;
|
|
1874
|
+
re.prototype.set = Gn;
|
|
1875
1875
|
function H(e) {
|
|
1876
|
-
var t = -1,
|
|
1877
|
-
for (this.clear(); ++t <
|
|
1878
|
-
var
|
|
1879
|
-
this.set(
|
|
1876
|
+
var t = -1, r = e ? e.length : 0;
|
|
1877
|
+
for (this.clear(); ++t < r; ) {
|
|
1878
|
+
var n = e[t];
|
|
1879
|
+
this.set(n[0], n[1]);
|
|
1880
1880
|
}
|
|
1881
1881
|
}
|
|
1882
|
-
function
|
|
1882
|
+
function Un() {
|
|
1883
1883
|
this.__data__ = {
|
|
1884
1884
|
hash: new W(),
|
|
1885
|
-
map: new (
|
|
1885
|
+
map: new (On || re)(),
|
|
1886
1886
|
string: new W()
|
|
1887
1887
|
};
|
|
1888
1888
|
}
|
|
1889
|
-
function
|
|
1889
|
+
function Kn(e) {
|
|
1890
1890
|
return Ee(this, e).delete(e);
|
|
1891
1891
|
}
|
|
1892
|
-
function
|
|
1892
|
+
function Qn(e) {
|
|
1893
1893
|
return Ee(this, e).get(e);
|
|
1894
1894
|
}
|
|
1895
|
-
function
|
|
1895
|
+
function jn(e) {
|
|
1896
1896
|
return Ee(this, e).has(e);
|
|
1897
1897
|
}
|
|
1898
|
-
function
|
|
1898
|
+
function zn(e, t) {
|
|
1899
1899
|
return Ee(this, e).set(e, t), this;
|
|
1900
1900
|
}
|
|
1901
|
-
H.prototype.clear =
|
|
1902
|
-
H.prototype.delete =
|
|
1903
|
-
H.prototype.get =
|
|
1904
|
-
H.prototype.has =
|
|
1905
|
-
H.prototype.set =
|
|
1901
|
+
H.prototype.clear = Un;
|
|
1902
|
+
H.prototype.delete = Kn;
|
|
1903
|
+
H.prototype.get = Qn;
|
|
1904
|
+
H.prototype.has = jn;
|
|
1905
|
+
H.prototype.set = zn;
|
|
1906
1906
|
function Ce(e, t) {
|
|
1907
|
-
for (var
|
|
1908
|
-
if (
|
|
1909
|
-
return
|
|
1907
|
+
for (var r = e.length; r--; )
|
|
1908
|
+
if (rs(e[r][0], t))
|
|
1909
|
+
return r;
|
|
1910
1910
|
return -1;
|
|
1911
1911
|
}
|
|
1912
|
-
function
|
|
1913
|
-
t =
|
|
1914
|
-
for (var
|
|
1915
|
-
e = e[
|
|
1916
|
-
return
|
|
1912
|
+
function Wn(e, t) {
|
|
1913
|
+
t = Jn(t, e) ? [t] : Yn(t);
|
|
1914
|
+
for (var r = 0, n = t.length; e != null && r < n; )
|
|
1915
|
+
e = e[es(t[r++])];
|
|
1916
|
+
return r && r == n ? e : void 0;
|
|
1917
1917
|
}
|
|
1918
|
-
function
|
|
1919
|
-
if (!
|
|
1918
|
+
function Hn(e) {
|
|
1919
|
+
if (!jt(e) || Xn(e))
|
|
1920
1920
|
return !1;
|
|
1921
|
-
var t =
|
|
1922
|
-
return t.test(
|
|
1921
|
+
var t = ns(e) || Pn(e) ? xn : Cn;
|
|
1922
|
+
return t.test(ts(e));
|
|
1923
1923
|
}
|
|
1924
|
-
function
|
|
1924
|
+
function Bn(e) {
|
|
1925
1925
|
if (typeof e == "string")
|
|
1926
1926
|
return e;
|
|
1927
1927
|
if (ze(e))
|
|
@@ -1929,44 +1929,44 @@ function Wr(e) {
|
|
|
1929
1929
|
var t = e + "";
|
|
1930
1930
|
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
1931
1931
|
}
|
|
1932
|
-
function
|
|
1933
|
-
return
|
|
1932
|
+
function Yn(e) {
|
|
1933
|
+
return Qt(e) ? e : Zn(e);
|
|
1934
1934
|
}
|
|
1935
1935
|
function Ee(e, t) {
|
|
1936
|
-
var
|
|
1937
|
-
return
|
|
1936
|
+
var r = e.__data__;
|
|
1937
|
+
return Vn(t) ? r[typeof t == "string" ? "string" : "hash"] : r.map;
|
|
1938
1938
|
}
|
|
1939
|
-
function
|
|
1940
|
-
var
|
|
1941
|
-
return
|
|
1939
|
+
function Kt(e, t) {
|
|
1940
|
+
var r = vn(e, t);
|
|
1941
|
+
return Hn(r) ? r : void 0;
|
|
1942
1942
|
}
|
|
1943
|
-
function
|
|
1944
|
-
if (
|
|
1943
|
+
function Jn(e, t) {
|
|
1944
|
+
if (Qt(e))
|
|
1945
1945
|
return !1;
|
|
1946
|
-
var
|
|
1947
|
-
return
|
|
1946
|
+
var r = typeof e;
|
|
1947
|
+
return r == "number" || r == "symbol" || r == "boolean" || e == null || ze(e) ? !0 : mn.test(e) || !hn.test(e) || t != null && e in Object(t);
|
|
1948
1948
|
}
|
|
1949
|
-
function
|
|
1949
|
+
function Vn(e) {
|
|
1950
1950
|
var t = typeof e;
|
|
1951
1951
|
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
|
|
1952
1952
|
}
|
|
1953
|
-
function
|
|
1953
|
+
function Xn(e) {
|
|
1954
1954
|
return !!it && it in e;
|
|
1955
1955
|
}
|
|
1956
|
-
var
|
|
1957
|
-
e =
|
|
1956
|
+
var Zn = je(function(e) {
|
|
1957
|
+
e = os(e);
|
|
1958
1958
|
var t = [];
|
|
1959
|
-
return
|
|
1960
|
-
t.push(s ? i.replace(
|
|
1959
|
+
return gn.test(e) && t.push(""), e.replace(_n, function(r, n, s, i) {
|
|
1960
|
+
t.push(s ? i.replace(Sn, "$1") : n || r);
|
|
1961
1961
|
}), t;
|
|
1962
1962
|
});
|
|
1963
|
-
function
|
|
1963
|
+
function es(e) {
|
|
1964
1964
|
if (typeof e == "string" || ze(e))
|
|
1965
1965
|
return e;
|
|
1966
1966
|
var t = e + "";
|
|
1967
1967
|
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
1968
1968
|
}
|
|
1969
|
-
function
|
|
1969
|
+
function ts(e) {
|
|
1970
1970
|
if (e != null) {
|
|
1971
1971
|
try {
|
|
1972
1972
|
return Gt.call(e);
|
|
@@ -1979,73 +1979,71 @@ function Zr(e) {
|
|
|
1979
1979
|
}
|
|
1980
1980
|
return "";
|
|
1981
1981
|
}
|
|
1982
|
-
function
|
|
1982
|
+
function je(e, t) {
|
|
1983
1983
|
if (typeof e != "function" || t && typeof t != "function")
|
|
1984
|
-
throw new TypeError(
|
|
1985
|
-
var
|
|
1986
|
-
var
|
|
1984
|
+
throw new TypeError(dn);
|
|
1985
|
+
var r = function() {
|
|
1986
|
+
var n = arguments, s = t ? t.apply(this, n) : n[0], i = r.cache;
|
|
1987
1987
|
if (i.has(s))
|
|
1988
1988
|
return i.get(s);
|
|
1989
|
-
var o = e.apply(this,
|
|
1990
|
-
return
|
|
1989
|
+
var o = e.apply(this, n);
|
|
1990
|
+
return r.cache = i.set(s, o), o;
|
|
1991
1991
|
};
|
|
1992
|
-
return
|
|
1992
|
+
return r.cache = new (je.Cache || H)(), r;
|
|
1993
1993
|
}
|
|
1994
|
-
|
|
1995
|
-
function
|
|
1994
|
+
je.Cache = H;
|
|
1995
|
+
function rs(e, t) {
|
|
1996
1996
|
return e === t || e !== e && t !== t;
|
|
1997
1997
|
}
|
|
1998
|
-
var
|
|
1999
|
-
function
|
|
2000
|
-
var t =
|
|
2001
|
-
return t ==
|
|
1998
|
+
var Qt = Array.isArray;
|
|
1999
|
+
function ns(e) {
|
|
2000
|
+
var t = jt(e) ? Ut.call(e) : "";
|
|
2001
|
+
return t == fn || t == pn;
|
|
2002
2002
|
}
|
|
2003
|
-
function
|
|
2003
|
+
function jt(e) {
|
|
2004
2004
|
var t = typeof e;
|
|
2005
2005
|
return !!e && (t == "object" || t == "function");
|
|
2006
2006
|
}
|
|
2007
|
-
function
|
|
2007
|
+
function ss(e) {
|
|
2008
2008
|
return !!e && typeof e == "object";
|
|
2009
2009
|
}
|
|
2010
2010
|
function ze(e) {
|
|
2011
|
-
return typeof e == "symbol" ||
|
|
2011
|
+
return typeof e == "symbol" || ss(e) && Ut.call(e) == yn;
|
|
2012
2012
|
}
|
|
2013
|
-
function
|
|
2014
|
-
return e == null ? "" :
|
|
2013
|
+
function os(e) {
|
|
2014
|
+
return e == null ? "" : Bn(e);
|
|
2015
2015
|
}
|
|
2016
|
-
function
|
|
2017
|
-
var
|
|
2018
|
-
return
|
|
2016
|
+
function is(e, t, r) {
|
|
2017
|
+
var n = e == null ? void 0 : Wn(e, t);
|
|
2018
|
+
return n === void 0 ? r : n;
|
|
2019
2019
|
}
|
|
2020
|
-
var
|
|
2021
|
-
const Y = /* @__PURE__ */
|
|
2020
|
+
var as = is;
|
|
2021
|
+
const Y = /* @__PURE__ */ ln(as), Bs = ({
|
|
2022
2022
|
pluginID: e,
|
|
2023
2023
|
connectionID: t,
|
|
2024
|
-
resourceKey:
|
|
2025
|
-
idAccessor:
|
|
2024
|
+
resourceKey: r,
|
|
2025
|
+
idAccessor: n,
|
|
2026
2026
|
namespaces: s = [],
|
|
2027
2027
|
listParams: i = {},
|
|
2028
2028
|
createParams: o = {}
|
|
2029
2029
|
}) => {
|
|
2030
|
-
const a = P(e), c = G(), { showSnackbar: l } = $(), u = [a, t,
|
|
2031
|
-
|
|
2032
|
-
const { mutateAsync: h } = v({
|
|
2033
|
-
mutationFn: async (d) => mt(a, t, n, T.CreateInput.createFrom({
|
|
2030
|
+
const a = P(e), c = G(), { showSnackbar: l } = $(), u = [a, t, r, s, "list"], y = (d, g) => [a, t, r, g, d], { mutateAsync: h } = v({
|
|
2031
|
+
mutationFn: async (d) => mt(a, t, r, T.CreateInput.createFrom({
|
|
2034
2032
|
params: d.params || o,
|
|
2035
2033
|
input: d.input,
|
|
2036
2034
|
namespaces: s
|
|
2037
2035
|
})),
|
|
2038
2036
|
onSuccess: async (d) => {
|
|
2039
|
-
var C,
|
|
2037
|
+
var C, k, ie, B, L, We, He, Be;
|
|
2040
2038
|
let g = "";
|
|
2041
|
-
(C = d.result.metadata) != null && C.name ? g = d.result.metadata.name : (
|
|
2039
|
+
(C = d.result.metadata) != null && C.name ? g = d.result.metadata.name : (k = d.result) != null && k.id ? g = (ie = d.result) == null ? void 0 : ie.id : (B = d.result) != null && B.name ? g = (L = d.result) == null ? void 0 : L.name : (We = d.result) != null && We.ID ? g = (He = d.result) == null ? void 0 : He.ID : (Be = d.result) != null && Be.Name && (g = d.result.Name);
|
|
2042
2040
|
const E = g ? `Resource ${g} created` : "Resource created";
|
|
2043
2041
|
l(E, "success"), await c.invalidateQueries({ queryKey: u });
|
|
2044
2042
|
},
|
|
2045
2043
|
onError: I(l, "Failed to create resource")
|
|
2046
2044
|
}), f = D({
|
|
2047
2045
|
queryKey: u,
|
|
2048
|
-
queryFn: async () => ht(a, t,
|
|
2046
|
+
queryFn: async () => ht(a, t, r, T.ListInput.createFrom({
|
|
2049
2047
|
params: i,
|
|
2050
2048
|
order: {
|
|
2051
2049
|
by: "name",
|
|
@@ -2060,34 +2058,34 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2060
2058
|
placeholderData: (d, g) => d,
|
|
2061
2059
|
retry: !1
|
|
2062
2060
|
}), m = _.useCallback((d) => {
|
|
2063
|
-
|
|
2061
|
+
n && (c.setQueryData(u, (g) => le(g, (E) => {
|
|
2064
2062
|
if (E || (E = T.ListResult.createFrom({
|
|
2065
2063
|
result: [],
|
|
2066
2064
|
success: !0,
|
|
2067
2065
|
pagination: {}
|
|
2068
|
-
})), E.result.findIndex((
|
|
2066
|
+
})), E.result.findIndex((k) => Y(d.data, n) === Y(k, n)) === -1) {
|
|
2069
2067
|
E.result.push(d.data);
|
|
2070
2068
|
return;
|
|
2071
2069
|
}
|
|
2072
2070
|
})), c.setQueryData(y(d.id, d.namespace), { result: d.data }));
|
|
2073
2071
|
}, []), p = _.useCallback((d) => {
|
|
2074
|
-
|
|
2072
|
+
n && (c.setQueryData(u, (g) => le(g, (E) => {
|
|
2075
2073
|
E || (E = T.ListResult.createFrom({
|
|
2076
2074
|
result: [],
|
|
2077
2075
|
success: !0,
|
|
2078
2076
|
pagination: {}
|
|
2079
2077
|
}));
|
|
2080
|
-
const C = E.result.findIndex((
|
|
2078
|
+
const C = E.result.findIndex((k) => Y(d.newData, n) === Y(k, n));
|
|
2081
2079
|
if (C !== -1) {
|
|
2082
2080
|
E.result[C] = d.newData;
|
|
2083
2081
|
return;
|
|
2084
2082
|
}
|
|
2085
2083
|
})), c.setQueryData(y(d.id, d.namespace), { result: d.newData }));
|
|
2086
2084
|
}, []), S = _.useCallback((d) => {
|
|
2087
|
-
|
|
2085
|
+
n && c.setQueryData(u, (g) => le(g, (E) => {
|
|
2088
2086
|
if (!E)
|
|
2089
2087
|
return;
|
|
2090
|
-
const C = E.result.findIndex((
|
|
2088
|
+
const C = E.result.findIndex((k) => Y(d.data, n) === Y(k, n));
|
|
2091
2089
|
if (C !== -1) {
|
|
2092
2090
|
E.result.splice(C, 1);
|
|
2093
2091
|
return;
|
|
@@ -2095,22 +2093,26 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2095
2093
|
}));
|
|
2096
2094
|
}, []);
|
|
2097
2095
|
_.useEffect(() => {
|
|
2098
|
-
if (!
|
|
2096
|
+
if (!n)
|
|
2099
2097
|
return;
|
|
2100
|
-
|
|
2098
|
+
let d = !1;
|
|
2099
|
+
vr(a, t, r).then(() => {
|
|
2100
|
+
d || c.invalidateQueries({ queryKey: u });
|
|
2101
|
+
});
|
|
2102
|
+
const g = A(`${a}/${t}/${r}/ADD`, m), E = A(`${a}/${t}/${r}/UPDATE`, p), C = A(`${a}/${t}/${r}/DELETE`, S);
|
|
2101
2103
|
return () => {
|
|
2102
|
-
d
|
|
2104
|
+
d = !0, g(), E(), C(), Pr(a, t, r);
|
|
2103
2105
|
};
|
|
2104
|
-
}, []);
|
|
2106
|
+
}, [a, t, r]);
|
|
2105
2107
|
const [w, b] = _.useState(
|
|
2106
2108
|
x.Pending
|
|
2107
2109
|
);
|
|
2108
2110
|
return _.useEffect(() => A(
|
|
2109
2111
|
`${a}/${t}/informer/STATE`,
|
|
2110
2112
|
(g) => {
|
|
2111
|
-
g.resourceKey ===
|
|
2113
|
+
g.resourceKey === r && b(g.state);
|
|
2112
2114
|
}
|
|
2113
|
-
), [a, t,
|
|
2115
|
+
), [a, t, r]), {
|
|
2114
2116
|
/**
|
|
2115
2117
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
2116
2118
|
* when the resources are updated or deleted via the returned create and remove mutation functions, or
|
|
@@ -2133,8 +2135,8 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2133
2135
|
/** Whether the informer encountered an error */
|
|
2134
2136
|
informerError: w === x.Error
|
|
2135
2137
|
};
|
|
2136
|
-
},
|
|
2137
|
-
const t = P(e), { showSnackbar:
|
|
2138
|
+
}, Ys = ({ pluginID: e }) => {
|
|
2139
|
+
const t = P(e), { showSnackbar: r } = $(), n = v({
|
|
2138
2140
|
mutationFn: async ({ opts: o, input: a }) => mt(
|
|
2139
2141
|
t,
|
|
2140
2142
|
o.connectionID,
|
|
@@ -2147,10 +2149,10 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2147
2149
|
})
|
|
2148
2150
|
),
|
|
2149
2151
|
onSuccess: (o, { opts: a }) => {
|
|
2150
|
-
|
|
2152
|
+
r(`Resource ${a.resourceID} created`, "success");
|
|
2151
2153
|
},
|
|
2152
2154
|
onError(o, { opts: a }) {
|
|
2153
|
-
X(
|
|
2155
|
+
X(r, o, `Failed to create resource ${a.resourceID}`);
|
|
2154
2156
|
}
|
|
2155
2157
|
}), s = v({
|
|
2156
2158
|
mutationFn: async ({ opts: o, input: a }) => pt(
|
|
@@ -2165,10 +2167,10 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2165
2167
|
})
|
|
2166
2168
|
),
|
|
2167
2169
|
onSuccess: (o, { opts: a }) => {
|
|
2168
|
-
|
|
2170
|
+
r(`Resource ${a.resourceID} updated`, "success");
|
|
2169
2171
|
},
|
|
2170
2172
|
onError(o, { opts: a }) {
|
|
2171
|
-
X(
|
|
2173
|
+
X(r, o, `Failed to update resource ${a.resourceID}`);
|
|
2172
2174
|
}
|
|
2173
2175
|
}), i = v({
|
|
2174
2176
|
mutationFn: async ({ opts: o, input: a }) => yt(
|
|
@@ -2184,27 +2186,27 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2184
2186
|
})
|
|
2185
2187
|
),
|
|
2186
2188
|
onSuccess: (o, { opts: a }) => {
|
|
2187
|
-
|
|
2189
|
+
r(`Resource ${a.resourceID} deleted`, "success");
|
|
2188
2190
|
},
|
|
2189
2191
|
onError(o, { opts: a }) {
|
|
2190
|
-
X(
|
|
2192
|
+
X(r, o, `Failed to delete resource ${a.resourceID}`);
|
|
2191
2193
|
}
|
|
2192
2194
|
});
|
|
2193
2195
|
return {
|
|
2194
|
-
create:
|
|
2196
|
+
create: n.mutateAsync,
|
|
2195
2197
|
update: s.mutateAsync,
|
|
2196
2198
|
remove: i.mutateAsync
|
|
2197
2199
|
};
|
|
2198
|
-
},
|
|
2200
|
+
}, Js = ({
|
|
2199
2201
|
pluginID: e,
|
|
2200
2202
|
connectionID: t,
|
|
2201
|
-
resourceKey:
|
|
2202
|
-
enabled:
|
|
2203
|
+
resourceKey: r,
|
|
2204
|
+
enabled: n = !0
|
|
2203
2205
|
}) => {
|
|
2204
2206
|
const s = P(e), i = D({
|
|
2205
|
-
queryKey: ["RESOURCE_ACTIONS", s, t,
|
|
2206
|
-
queryFn: () =>
|
|
2207
|
-
enabled:
|
|
2207
|
+
queryKey: ["RESOURCE_ACTIONS", s, t, r],
|
|
2208
|
+
queryFn: () => Dr(s, t, r),
|
|
2209
|
+
enabled: n && !!s && !!t && !!r,
|
|
2208
2210
|
staleTime: 5 * 60 * 1e3
|
|
2209
2211
|
// actions don't change often
|
|
2210
2212
|
});
|
|
@@ -2213,22 +2215,22 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2213
2215
|
isLoading: i.isLoading,
|
|
2214
2216
|
error: i.error
|
|
2215
2217
|
};
|
|
2216
|
-
},
|
|
2218
|
+
}, Vs = ({
|
|
2217
2219
|
pluginID: e,
|
|
2218
2220
|
connectionID: t,
|
|
2219
|
-
resourceKey:
|
|
2221
|
+
resourceKey: r
|
|
2220
2222
|
}) => {
|
|
2221
|
-
const
|
|
2222
|
-
mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) =>
|
|
2223
|
-
r,
|
|
2224
|
-
t,
|
|
2223
|
+
const n = P(e), s = G(), { showSnackbar: i } = $(), o = v({
|
|
2224
|
+
mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => Fr(
|
|
2225
2225
|
n,
|
|
2226
|
+
t,
|
|
2227
|
+
r,
|
|
2226
2228
|
a,
|
|
2227
2229
|
T.ActionInput.createFrom({ id: c, namespace: l, params: u })
|
|
2228
2230
|
),
|
|
2229
2231
|
onSuccess: (a) => {
|
|
2230
2232
|
a.message && i(a.message, "success"), s.invalidateQueries({
|
|
2231
|
-
queryKey: ["RESOURCES",
|
|
2233
|
+
queryKey: ["RESOURCES", n, t, r]
|
|
2232
2234
|
});
|
|
2233
2235
|
},
|
|
2234
2236
|
onError: (a, c) => {
|
|
@@ -2240,15 +2242,15 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2240
2242
|
isExecuting: o.isPending,
|
|
2241
2243
|
error: o.error
|
|
2242
2244
|
};
|
|
2243
|
-
},
|
|
2245
|
+
}, Xs = ({
|
|
2244
2246
|
pluginID: e,
|
|
2245
2247
|
connectionID: t,
|
|
2246
|
-
enabled:
|
|
2248
|
+
enabled: r = !0
|
|
2247
2249
|
}) => {
|
|
2248
|
-
const
|
|
2249
|
-
queryKey: ["EDITOR_SCHEMAS",
|
|
2250
|
-
queryFn: () =>
|
|
2251
|
-
enabled:
|
|
2250
|
+
const n = P(e), s = D({
|
|
2251
|
+
queryKey: ["EDITOR_SCHEMAS", n, t],
|
|
2252
|
+
queryFn: () => xr(n, t),
|
|
2253
|
+
enabled: r && !!n && !!t,
|
|
2252
2254
|
staleTime: 10 * 60 * 1e3,
|
|
2253
2255
|
// schemas are fairly stable per connection
|
|
2254
2256
|
retry: 1
|
|
@@ -2259,18 +2261,18 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2259
2261
|
error: s.error,
|
|
2260
2262
|
refetch: s.refetch
|
|
2261
2263
|
};
|
|
2262
|
-
},
|
|
2264
|
+
}, Zs = ({
|
|
2263
2265
|
pluginID: e,
|
|
2264
2266
|
connectionID: t,
|
|
2265
|
-
enabled:
|
|
2267
|
+
enabled: r = !0
|
|
2266
2268
|
}) => {
|
|
2267
|
-
const
|
|
2269
|
+
const n = P(e), s = G(), i = [n, t, "informer-state"], o = D({
|
|
2268
2270
|
queryKey: i,
|
|
2269
|
-
queryFn: () =>
|
|
2270
|
-
enabled:
|
|
2271
|
+
queryFn: () => Ir(n, t),
|
|
2272
|
+
enabled: r && !!n && !!t
|
|
2271
2273
|
});
|
|
2272
|
-
|
|
2273
|
-
`${
|
|
2274
|
+
Q(() => !r || !n || !t ? void 0 : A(
|
|
2275
|
+
`${n}/${t}/informer/STATE`,
|
|
2274
2276
|
(u) => {
|
|
2275
2277
|
s.setQueryData(i, (y) => y && le(y, (h) => {
|
|
2276
2278
|
h.resources[u.resourceKey] = u.state, h.resourceCounts[u.resourceKey] = u.resourceCount;
|
|
@@ -2280,7 +2282,7 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2280
2282
|
h.syncedCount = f, h.errorCount = m;
|
|
2281
2283
|
}));
|
|
2282
2284
|
}
|
|
2283
|
-
), [
|
|
2285
|
+
), [n, t, r]);
|
|
2284
2286
|
const a = o.data;
|
|
2285
2287
|
let c = 0;
|
|
2286
2288
|
if (a != null && a.resources)
|
|
@@ -2298,27 +2300,27 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2298
2300
|
/** Number of informers that encountered errors */
|
|
2299
2301
|
errorCount: (a == null ? void 0 : a.errorCount) ?? 0
|
|
2300
2302
|
};
|
|
2301
|
-
},
|
|
2302
|
-
const [e, t] = q(/* @__PURE__ */ new Map()),
|
|
2303
|
-
const u = qe(l), y = Ot(
|
|
2303
|
+
}, eo = () => {
|
|
2304
|
+
const [e, t] = q(/* @__PURE__ */ new Map()), r = de(/* @__PURE__ */ new Map()), n = de(/* @__PURE__ */ new Map()), s = V((l) => {
|
|
2305
|
+
const u = qe(l), y = Ot(r.current, l), h = Ft(y);
|
|
2304
2306
|
if (t((f) => {
|
|
2305
2307
|
const m = new Map(f);
|
|
2306
2308
|
return m.set(u, h), m;
|
|
2307
|
-
}),
|
|
2309
|
+
}), n.current.has(u) && (clearTimeout(n.current.get(u)), n.current.delete(u)), fe(h)) {
|
|
2308
2310
|
const f = setTimeout(() => {
|
|
2309
2311
|
t((m) => {
|
|
2310
2312
|
const p = new Map(m);
|
|
2311
2313
|
return p.delete(u), p;
|
|
2312
|
-
}),
|
|
2314
|
+
}), r.current.delete(u), n.current.delete(u);
|
|
2313
2315
|
}, 5e3);
|
|
2314
|
-
|
|
2316
|
+
n.current.set(u, f);
|
|
2315
2317
|
}
|
|
2316
2318
|
}, []);
|
|
2317
|
-
|
|
2319
|
+
Q(() => {
|
|
2318
2320
|
const l = A("informer/STATE", s);
|
|
2319
2321
|
return () => {
|
|
2320
2322
|
l();
|
|
2321
|
-
for (const u of
|
|
2323
|
+
for (const u of n.current.values())
|
|
2322
2324
|
clearTimeout(u);
|
|
2323
2325
|
};
|
|
2324
2326
|
}, [s]);
|
|
@@ -2333,32 +2335,32 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2333
2335
|
/** Aggregate progress across all connections (0-1) */
|
|
2334
2336
|
aggregateProgress: c
|
|
2335
2337
|
};
|
|
2336
|
-
},
|
|
2338
|
+
}, cs = () => {
|
|
2337
2339
|
const e = _.useContext(Et);
|
|
2338
2340
|
if (!e) throw new Error("useOperations must be used within an OperationsProvider");
|
|
2339
2341
|
return e;
|
|
2340
|
-
},
|
|
2342
|
+
}, to = ({
|
|
2341
2343
|
pluginID: e,
|
|
2342
2344
|
connectionID: t,
|
|
2343
|
-
resourceKey:
|
|
2345
|
+
resourceKey: r
|
|
2344
2346
|
}) => {
|
|
2345
|
-
const
|
|
2347
|
+
const n = P(e), { showSnackbar: s } = $(), { addOperation: i, updateOperation: o } = cs(), a = _.useRef([]);
|
|
2346
2348
|
return _.useEffect(() => () => {
|
|
2347
2349
|
a.current.forEach((l) => l());
|
|
2348
2350
|
}, []), { startStreamAction: _.useCallback(
|
|
2349
2351
|
async ({ actionID: l, id: u, namespace: y, label: h, params: f = {} }) => {
|
|
2350
2352
|
try {
|
|
2351
|
-
const m = await
|
|
2352
|
-
r,
|
|
2353
|
-
t,
|
|
2353
|
+
const m = await Or(
|
|
2354
2354
|
n,
|
|
2355
|
+
t,
|
|
2356
|
+
r,
|
|
2355
2357
|
l,
|
|
2356
2358
|
T.ActionInput.createFrom({ id: u, namespace: y, params: f })
|
|
2357
2359
|
);
|
|
2358
2360
|
i({
|
|
2359
2361
|
id: m,
|
|
2360
2362
|
label: h,
|
|
2361
|
-
resourceKey:
|
|
2363
|
+
resourceKey: r,
|
|
2362
2364
|
resourceName: u,
|
|
2363
2365
|
namespace: y,
|
|
2364
2366
|
connectionID: t,
|
|
@@ -2399,25 +2401,25 @@ const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
|
2399
2401
|
throw X(s, m, `Failed to start "${l}"`), m;
|
|
2400
2402
|
}
|
|
2401
2403
|
},
|
|
2402
|
-
[
|
|
2404
|
+
[n, t, r, i, o, s]
|
|
2403
2405
|
) };
|
|
2404
|
-
},
|
|
2406
|
+
}, ro = () => {
|
|
2405
2407
|
const e = _.useContext(Ct);
|
|
2406
2408
|
if (!e)
|
|
2407
2409
|
throw new Error("useSettings must be used within a SettingsProvider");
|
|
2408
2410
|
return e;
|
|
2409
|
-
},
|
|
2410
|
-
const { meta:
|
|
2411
|
-
|
|
2412
|
-
const s = `/_plugin/${
|
|
2413
|
-
return _.useMemo(() => /* @__PURE__ */ F(Bt, { style: { textDecoration: "none", color: "inherit" }, ...
|
|
2411
|
+
}, no = ({ to: e, withinContext: t, ...r }) => {
|
|
2412
|
+
const { meta: n } = Le();
|
|
2413
|
+
n.id || console.error("Link used outside of a plugin context");
|
|
2414
|
+
const s = `/_plugin/${n.id}${e.startsWith("/") ? "" : "/"}${e}`;
|
|
2415
|
+
return _.useMemo(() => /* @__PURE__ */ F(Bt, { style: { textDecoration: "none", color: "inherit" }, ...r, to: s }), [r, s]);
|
|
2414
2416
|
};
|
|
2415
|
-
function
|
|
2416
|
-
const e = Yt(), t = Jt(), { meta:
|
|
2417
|
-
|
|
2418
|
-
const
|
|
2417
|
+
function so() {
|
|
2418
|
+
const e = Yt(), t = Jt(), { meta: r } = Le();
|
|
2419
|
+
r.id || console.error("usePluginRouter used outside of a plugin context");
|
|
2420
|
+
const n = `/_plugin/${r.id}`, s = t.pathname.startsWith(n) ? t.pathname.slice(n.length) || "/" : t.pathname, i = (o, a) => {
|
|
2419
2421
|
const { ...c } = a ?? {};
|
|
2420
|
-
o.startsWith("/") ? e(`${
|
|
2422
|
+
o.startsWith("/") ? e(`${n}${o}`, c) : e(o, c);
|
|
2421
2423
|
};
|
|
2422
2424
|
return Ht(() => ({
|
|
2423
2425
|
location: t,
|
|
@@ -2425,9 +2427,9 @@ function no() {
|
|
|
2425
2427
|
pluginPath: s
|
|
2426
2428
|
}), [t.pathname]);
|
|
2427
2429
|
}
|
|
2428
|
-
class
|
|
2430
|
+
class oo {
|
|
2429
2431
|
}
|
|
2430
|
-
class
|
|
2432
|
+
class io {
|
|
2431
2433
|
constructor() {
|
|
2432
2434
|
M(this, "_extensions");
|
|
2433
2435
|
/**
|
|
@@ -2511,83 +2513,83 @@ class so {
|
|
|
2511
2513
|
/**
|
|
2512
2514
|
* Adds a page to the plugin window. This page will be displayed under:
|
|
2513
2515
|
*/
|
|
2514
|
-
withPage(t,
|
|
2516
|
+
withPage(t, r) {
|
|
2515
2517
|
return this.pages || (this.pages = {}), this.pages[t] ? (console.warn(
|
|
2516
2518
|
"Cannot register page with the same name. Please use a different name."
|
|
2517
|
-
), this) : (this.pages[t] =
|
|
2519
|
+
), this) : (this.pages[t] = r, this);
|
|
2518
2520
|
}
|
|
2519
2521
|
withRoutes(t) {
|
|
2520
2522
|
return this._routes = t, this;
|
|
2521
2523
|
}
|
|
2522
2524
|
}
|
|
2523
|
-
var
|
|
2525
|
+
var us = /* @__PURE__ */ ((e) => (e.MISSING_MANIFEST = "MISSING_MANIFEST", e.MISSING_PLUGIN = "MISSING_PLUGIN", e.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", e))(us || {});
|
|
2524
2526
|
export {
|
|
2525
2527
|
J as ALL_SESSIONS_KEY,
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
+
$r as BottomDrawerContext,
|
|
2529
|
+
qr as ConfirmationModalContext,
|
|
2528
2530
|
xe as ErrorTypes,
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2531
|
+
Ds as ExtensionPointRegistry,
|
|
2532
|
+
zr as ExtensionPointStore,
|
|
2533
|
+
Ps as ExtensionProvider,
|
|
2532
2534
|
x as InformerResourceState,
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
+
Br as InformerSyncPolicy,
|
|
2536
|
+
no as Link,
|
|
2535
2537
|
Et as OperationsContext,
|
|
2536
|
-
|
|
2538
|
+
Es as OperationsProvider,
|
|
2537
2539
|
$e as PluginContext,
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2540
|
+
ws as PluginContextProvider,
|
|
2541
|
+
us as PluginErrorCode,
|
|
2542
|
+
io as PluginWindow,
|
|
2543
|
+
oo as PluginWindowRootProps,
|
|
2544
|
+
Lr as RightDrawerContext,
|
|
2543
2545
|
Ct as SettingsContext,
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2546
|
+
Cs as SettingsProvider,
|
|
2547
|
+
Fs as SnackbarProvider,
|
|
2548
|
+
kr as actionToSnackbar,
|
|
2549
|
+
Hr as connectionListQueryKey,
|
|
2548
2550
|
I as createErrorHandler,
|
|
2549
|
-
|
|
2551
|
+
Mr as defaultState,
|
|
2550
2552
|
wt as isCancelledError,
|
|
2551
|
-
|
|
2553
|
+
U as parseAppError,
|
|
2552
2554
|
X as showAppError,
|
|
2553
|
-
|
|
2555
|
+
eo as useActiveSyncs,
|
|
2554
2556
|
At as useBottomDrawer,
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2557
|
+
Us as useConfirmationModal,
|
|
2558
|
+
xs as useConnection,
|
|
2559
|
+
Os as useConnectionNamespaces,
|
|
2560
|
+
As as useConnectionStatus,
|
|
2561
|
+
Is as useConnections,
|
|
2562
|
+
Xs as useEditorSchemas,
|
|
2563
|
+
Rs as useExec,
|
|
2564
|
+
Vs as useExecuteAction,
|
|
2565
|
+
bs as useExtensionPoint,
|
|
2566
|
+
vs as useExtensionPointComponents,
|
|
2565
2567
|
Pt as useExtensionRegistry,
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2568
|
+
Zs as useInformerState,
|
|
2569
|
+
ks as useLogs,
|
|
2570
|
+
Ms as useMetricProviders,
|
|
2571
|
+
Vr as useMetricProvidersForResource,
|
|
2572
|
+
Ls as useMetricStream,
|
|
2573
|
+
cs as useOperations,
|
|
2572
2574
|
Le as usePluginContext,
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2575
|
+
Ts as usePluginData,
|
|
2576
|
+
so as usePluginRouter,
|
|
2577
|
+
Ss as usePluginSettings,
|
|
2578
|
+
qs as usePortForwardSessions,
|
|
2577
2579
|
P as useResolvedPluginId,
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2580
|
+
Ks as useResource,
|
|
2581
|
+
Js as useResourceActions,
|
|
2582
|
+
Qs as useResourceAreaComponent,
|
|
2583
|
+
js as useResourceGroups,
|
|
2584
|
+
$s as useResourceMetrics,
|
|
2585
|
+
Ys as useResourceMutations,
|
|
2586
|
+
Gs as useResourcePortForwarder,
|
|
2587
|
+
zs as useResourceSearch,
|
|
2588
|
+
Ws as useResourceType,
|
|
2589
|
+
Hs as useResourceTypes,
|
|
2590
|
+
Bs as useResources,
|
|
2591
|
+
Ns as useRightDrawer,
|
|
2592
|
+
ro as useSettings,
|
|
2591
2593
|
$ as useSnackbar,
|
|
2592
|
-
|
|
2594
|
+
to as useStreamAction
|
|
2593
2595
|
};
|