@omniviewdev/runtime 0.0.0-nightly.20260225
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/LICENSE +661 -0
- package/dist/Client-DGdSmmVk.js +585 -0
- package/dist/Client-ES-O5dCV.cjs +1 -0
- package/dist/api.cjs +1 -0
- package/dist/api.d.ts +13 -0
- package/dist/api.js +120 -0
- package/dist/context/drawer/BottomDrawerContext.d.ts +20 -0
- package/dist/context/drawer/RightDrawerContext.d.ts +15 -0
- package/dist/context/drawer/index.d.ts +3 -0
- package/dist/context/drawer/types.d.ts +222 -0
- package/dist/context/index.d.ts +5 -0
- package/dist/context/modal/ConfirmationModalContext.d.ts +12 -0
- package/dist/context/modal/index.d.ts +1 -0
- package/dist/context/operations/OperationsContext.d.ts +27 -0
- package/dist/context/plugins/PluginContext.d.ts +9 -0
- package/dist/context/plugins/PluginContextProvider.d.ts +5 -0
- package/dist/context/plugins/index.d.ts +3 -0
- package/dist/context/plugins/usePluginContext.d.ts +3 -0
- package/dist/context/settings/SettingsContext.d.ts +9 -0
- package/dist/context/settings/index.d.ts +1 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/parseAppError.d.ts +51 -0
- package/dist/errors/parseAppError.test.d.ts +1 -0
- package/dist/errors/types.d.ts +40 -0
- package/dist/extensions/index.d.ts +2 -0
- package/dist/extensions/points/resource/helpers.d.ts +19 -0
- package/dist/extensions/points/resource/types.d.ts +6 -0
- package/dist/extensions/provider.d.ts +18 -0
- package/dist/extensions/registry.d.ts +30 -0
- package/dist/extensions/utils.d.ts +4 -0
- package/dist/hooks/connection/index.d.ts +4 -0
- package/dist/hooks/connection/useConnection.d.ts +37 -0
- package/dist/hooks/connection/useConnectionNamespaces.d.ts +20 -0
- package/dist/hooks/connection/useConnectionStatus.d.ts +29 -0
- package/dist/hooks/connection/useConnections.d.ts +18 -0
- package/dist/hooks/data/index.d.ts +1 -0
- package/dist/hooks/data/usePluginData.d.ts +11 -0
- package/dist/hooks/drawer/index.d.ts +2 -0
- package/dist/hooks/drawer/useBottomDrawer.d.ts +1 -0
- package/dist/hooks/drawer/useRightDrawer.d.ts +5 -0
- package/dist/hooks/exec/index.d.ts +1 -0
- package/dist/hooks/exec/useExecSession.d.ts +21 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/logs/index.d.ts +1 -0
- package/dist/hooks/logs/useLogSession.d.ts +21 -0
- package/dist/hooks/metric/index.d.ts +3 -0
- package/dist/hooks/metric/useMetricProviders.d.ts +9 -0
- package/dist/hooks/metric/useMetricStream.d.ts +40 -0
- package/dist/hooks/metric/useResourceMetrics.d.ts +46 -0
- package/dist/hooks/modal/index.d.ts +1 -0
- package/dist/hooks/modal/useConfirmationModal.d.ts +5 -0
- package/dist/hooks/networker/index.d.ts +3 -0
- package/dist/hooks/networker/types.d.ts +50 -0
- package/dist/hooks/networker/usePortForwardSessions.d.ts +13 -0
- package/dist/hooks/networker/useResourcePortForwarder.d.ts +21 -0
- package/dist/hooks/operations/useOperations.d.ts +1 -0
- package/dist/hooks/resource/index.d.ts +13 -0
- package/dist/hooks/resource/useActiveSyncs.d.ts +16 -0
- package/dist/hooks/resource/useEditorSchemas.d.ts +22 -0
- package/dist/hooks/resource/useInformerState.d.ts +24 -0
- package/dist/hooks/resource/useResource.d.ts +74 -0
- package/dist/hooks/resource/useResourceActions.d.ts +69 -0
- package/dist/hooks/resource/useResourceAreaComponent.d.ts +9 -0
- package/dist/hooks/resource/useResourceGroups.d.ts +22 -0
- package/dist/hooks/resource/useResourceMutations.d.ts +58 -0
- package/dist/hooks/resource/useResourceSearch.d.ts +36 -0
- package/dist/hooks/resource/useResourceType.d.ts +22 -0
- package/dist/hooks/resource/useResourceTypes.d.ts +22 -0
- package/dist/hooks/resource/useResources.d.ts +73 -0
- package/dist/hooks/resource/useStreamAction.d.ts +21 -0
- package/dist/hooks/settings/index.d.ts +1 -0
- package/dist/hooks/settings/useSettings.d.ts +2 -0
- package/dist/hooks/snackbar/index.d.ts +1 -0
- package/dist/hooks/snackbar/useSnackbar.d.ts +24 -0
- package/dist/hooks/useResolvedPluginId.d.ts +8 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2593 -0
- package/dist/models.cjs +1 -0
- package/dist/models.d.ts +1 -0
- package/dist/models.js +1915 -0
- package/dist/router/Link.d.ts +24 -0
- package/dist/router/index.d.ts +11 -0
- package/dist/router/usePluginRouter.d.ts +40 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +215 -0
- package/dist/types/app.d.ts +73 -0
- package/dist/types/extensions.d.ts +186 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/informer.d.ts +49 -0
- package/dist/types/plugin.d.ts +5 -0
- package/dist/utils/activeSyncAggregator.d.ts +29 -0
- package/dist/utils/activeSyncAggregator.test.d.ts +1 -0
- package/dist/wailsjs/go/data/Client.d.ts +10 -0
- package/dist/wailsjs/go/devserver/DevServerManager.d.ts +22 -0
- package/dist/wailsjs/go/diagnostics/DiagnosticsClient.d.ts +18 -0
- package/dist/wailsjs/go/exec/Client.d.ts +26 -0
- package/dist/wailsjs/go/logs/Client.d.ts +16 -0
- package/dist/wailsjs/go/main/App.d.ts +8 -0
- package/dist/wailsjs/go/metric/Client.d.ts +12 -0
- package/dist/wailsjs/go/models.d.ts +894 -0
- package/dist/wailsjs/go/networker/Client.d.ts +14 -0
- package/dist/wailsjs/go/plugin/pluginManager.d.ts +52 -0
- package/dist/wailsjs/go/resource/Client.d.ts +68 -0
- package/dist/wailsjs/go/settings/Client.d.ts +14 -0
- package/dist/wailsjs/go/settings/provider.d.ts +46 -0
- package/dist/wailsjs/go/ui/Client.d.ts +6 -0
- package/dist/wailsjs/go/utils/Client.d.ts +2 -0
- package/dist/wailsjs/runtime/runtime.d.ts +249 -0
- package/package.json +68 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2593 @@
|
|
|
1
|
+
var zt = Object.defineProperty;
|
|
2
|
+
var Wt = (e, t, n) => t in e ? zt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var M = (e, t, n) => Wt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
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 j, useCallback as V, useMemo as Ht } from "react";
|
|
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 en, V as tn, S as nn, h as lt, U as rn, R as sn, i as on, j as dt, k as an, L as cn, l as un, m as Ye, n as ln, o as dn, q as fn, r as pn, s as yn, Q as hn, t as mn, u as Je, v as gn, w as ft, F as _n, x as wn, y as pt, D as yt, z as Sn, A as Cn, B as En, E as ht, H as bn, I as vn, J as mt, K as Pn, M as Dn, N as Fn, O as xn, T as In } from "./Client-DGdSmmVk.js";
|
|
8
|
+
import { config as On, exec as An, 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 Tn } from "@tanstack/react-query";
|
|
10
|
+
import { useNotificationStack as Nn } from "@omniviewdev/ui/feedback";
|
|
11
|
+
import { EventsOn as A, BrowserOpenURL as _t, EventsOff as be } from "./runtime.js";
|
|
12
|
+
const $e = _.createContext(void 0), xe = {
|
|
13
|
+
// Plugin
|
|
14
|
+
PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
|
|
15
|
+
PLUGIN_NOT_LOADED: "omniview:plugin/not-loaded",
|
|
16
|
+
PLUGIN_ALREADY_LOADED: "omniview:plugin/already-loaded",
|
|
17
|
+
PLUGIN_INSTALL_FAILED: "omniview:plugin/install-failed",
|
|
18
|
+
PLUGIN_LOAD_FAILED: "omniview:plugin/load-failed",
|
|
19
|
+
PLUGIN_BUILD_FAILED: "omniview:plugin/build-failed",
|
|
20
|
+
// Settings
|
|
21
|
+
SETTINGS_MISSING_CONFIG: "omniview:settings/missing-config",
|
|
22
|
+
SETTINGS_INVALID_CONFIG: "omniview:settings/invalid-config",
|
|
23
|
+
// Resource
|
|
24
|
+
RESOURCE_NOT_FOUND: "omniview:resource/not-found",
|
|
25
|
+
RESOURCE_FORBIDDEN: "omniview:resource/forbidden",
|
|
26
|
+
RESOURCE_UNAUTHORIZED: "omniview:resource/unauthorized",
|
|
27
|
+
RESOURCE_CONFLICT: "omniview:resource/conflict",
|
|
28
|
+
RESOURCE_TIMEOUT: "omniview:resource/timeout",
|
|
29
|
+
// Connection
|
|
30
|
+
CONNECTION_NOT_FOUND: "omniview:connection/not-found",
|
|
31
|
+
CONNECTION_FAILED: "omniview:connection/failed",
|
|
32
|
+
// Session
|
|
33
|
+
SESSION_NOT_FOUND: "omniview:session/not-found",
|
|
34
|
+
SESSION_FAILED: "omniview:session/failed",
|
|
35
|
+
// General
|
|
36
|
+
CANCELLED: "omniview:cancelled",
|
|
37
|
+
INTERNAL: "omniview:internal",
|
|
38
|
+
VALIDATION: "omniview:validation",
|
|
39
|
+
NOT_IMPLEMENTED: "omniview:not-implemented"
|
|
40
|
+
};
|
|
41
|
+
function K(e) {
|
|
42
|
+
if (e == null)
|
|
43
|
+
return {
|
|
44
|
+
type: xe.INTERNAL,
|
|
45
|
+
title: "Unknown error",
|
|
46
|
+
status: 500,
|
|
47
|
+
detail: "An unknown error occurred."
|
|
48
|
+
};
|
|
49
|
+
let t;
|
|
50
|
+
if (typeof e == "string" ? t = e : e instanceof Error ? t = e.message : t = String(e), t.startsWith("{"))
|
|
51
|
+
try {
|
|
52
|
+
const n = JSON.parse(t);
|
|
53
|
+
if (typeof n.type == "string" && typeof n.title == "string" && typeof n.status == "number" && typeof n.detail == "string")
|
|
54
|
+
return n;
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
type: xe.INTERNAL,
|
|
59
|
+
title: "Error",
|
|
60
|
+
status: 500,
|
|
61
|
+
detail: t
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function wt(e) {
|
|
65
|
+
return e == null ? !1 : (typeof e == "string" ? e : e instanceof Error ? e.message : String(e)) === "cancelled" ? !0 : K(e).type === xe.CANCELLED;
|
|
66
|
+
}
|
|
67
|
+
function kn(e) {
|
|
68
|
+
switch (e.type) {
|
|
69
|
+
case "navigate":
|
|
70
|
+
return {
|
|
71
|
+
label: e.label,
|
|
72
|
+
onClick: () => {
|
|
73
|
+
window.location.hash = e.target ?? "";
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
case "open-url":
|
|
77
|
+
return {
|
|
78
|
+
label: e.label,
|
|
79
|
+
onClick: () => {
|
|
80
|
+
window.open(e.target, "_blank");
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
case "copy":
|
|
84
|
+
return {
|
|
85
|
+
label: e.label,
|
|
86
|
+
onClick: () => {
|
|
87
|
+
navigator.clipboard.writeText(e.target ?? "");
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
case "retry":
|
|
91
|
+
return {
|
|
92
|
+
label: e.label,
|
|
93
|
+
onClick: () => {
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
default:
|
|
97
|
+
return {
|
|
98
|
+
label: e.label,
|
|
99
|
+
onClick: () => {
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function St(e, t) {
|
|
105
|
+
var s, i;
|
|
106
|
+
const n = [
|
|
107
|
+
e.detail,
|
|
108
|
+
...((s = e.suggestions) == null ? void 0 : s.map((o) => `• ${o}`)) ?? []
|
|
109
|
+
].join(`
|
|
110
|
+
`);
|
|
111
|
+
return {
|
|
112
|
+
message: t || (e.title !== "Error" ? e.title : "Operation failed"),
|
|
113
|
+
status: "error",
|
|
114
|
+
details: n,
|
|
115
|
+
actions: (i = e.actions) == null ? void 0 : i.map(kn)
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function X(e, t, n) {
|
|
119
|
+
if (wt(t)) return;
|
|
120
|
+
const r = K(t);
|
|
121
|
+
e(St(r, n));
|
|
122
|
+
}
|
|
123
|
+
function I(e, t) {
|
|
124
|
+
return (n) => {
|
|
125
|
+
if (wt(n)) return;
|
|
126
|
+
const r = K(n);
|
|
127
|
+
e(St(r, r.title !== "Error" ? r.title : t));
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function gs(e) {
|
|
131
|
+
const { children: t, pluginId: n } = e, [r, s] = _.useState({}), [i, o] = _.useState(new On.PluginMeta()), [a, c] = _.useState(!1), [l, u] = _.useState(null);
|
|
132
|
+
console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!l });
|
|
133
|
+
const y = () => {
|
|
134
|
+
n === void 0 || n === "" || (console.debug(`[PluginContextProvider] fetching settings for "${n}"`), Zt(n).then((f) => {
|
|
135
|
+
console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(f)), s(f);
|
|
136
|
+
}).catch((f) => {
|
|
137
|
+
const m = K(f);
|
|
138
|
+
console.error(`[PluginContextProvider] error fetching settings for "${n}":`, m.detail);
|
|
139
|
+
}));
|
|
140
|
+
}, h = () => {
|
|
141
|
+
if (n === void 0 || n === "") {
|
|
142
|
+
console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), en(n).then((f) => {
|
|
146
|
+
console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: f == null ? void 0 : f.name, version: f == null ? void 0 : f.version }), o(f), c(!0);
|
|
147
|
+
}).catch((f) => {
|
|
148
|
+
const m = K(f);
|
|
149
|
+
console.error(`[PluginContextProvider] error fetching meta for "${n}":`, m.detail), u(m.detail), c(!1);
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
return _.useEffect(() => {
|
|
153
|
+
console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), y(), h();
|
|
154
|
+
}, [n]), l ? /* @__PURE__ */ F("div", { style: {
|
|
155
|
+
display: "flex",
|
|
156
|
+
flex: 1,
|
|
157
|
+
alignItems: "center",
|
|
158
|
+
justifyContent: "center",
|
|
159
|
+
padding: 24
|
|
160
|
+
}, children: /* @__PURE__ */ ae("div", { style: {
|
|
161
|
+
maxWidth: 480,
|
|
162
|
+
width: "100%",
|
|
163
|
+
border: "1px solid #7F1D1D",
|
|
164
|
+
borderRadius: 8,
|
|
165
|
+
backgroundColor: "#1C1917",
|
|
166
|
+
padding: 20,
|
|
167
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
168
|
+
}, children: [
|
|
169
|
+
/* @__PURE__ */ ae("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
|
|
170
|
+
/* @__PURE__ */ ae("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
171
|
+
/* @__PURE__ */ F("circle", { cx: "12", cy: "12", r: "10" }),
|
|
172
|
+
/* @__PURE__ */ F("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
173
|
+
/* @__PURE__ */ F("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ F("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ F("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
|
|
178
|
+
/* @__PURE__ */ F(
|
|
179
|
+
"button",
|
|
180
|
+
{
|
|
181
|
+
onClick: () => h(),
|
|
182
|
+
style: {
|
|
183
|
+
background: "transparent",
|
|
184
|
+
color: "#F87171",
|
|
185
|
+
border: "1px solid #7F1D1D",
|
|
186
|
+
borderRadius: 6,
|
|
187
|
+
padding: "6px 14px",
|
|
188
|
+
fontSize: 13,
|
|
189
|
+
fontWeight: 500,
|
|
190
|
+
cursor: "pointer"
|
|
191
|
+
},
|
|
192
|
+
children: "Retry"
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
] }) }) : a ? /* @__PURE__ */ F($e.Provider, { value: { pluginId: n, settings: r, meta: i }, children: t }) : /* @__PURE__ */ ae("div", { style: {
|
|
196
|
+
display: "flex",
|
|
197
|
+
flex: 1,
|
|
198
|
+
alignItems: "center",
|
|
199
|
+
justifyContent: "center"
|
|
200
|
+
}, children: [
|
|
201
|
+
/* @__PURE__ */ F("div", { style: {
|
|
202
|
+
width: 24,
|
|
203
|
+
height: 24,
|
|
204
|
+
border: "2px solid #3F3F46",
|
|
205
|
+
borderTopColor: "#A1A1AA",
|
|
206
|
+
borderRadius: "50%",
|
|
207
|
+
animation: "plugin-spin 0.8s linear infinite"
|
|
208
|
+
} }),
|
|
209
|
+
/* @__PURE__ */ F("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
|
|
210
|
+
] });
|
|
211
|
+
}
|
|
212
|
+
function Le() {
|
|
213
|
+
const e = te($e);
|
|
214
|
+
if (!e)
|
|
215
|
+
throw new Error("usePluginContext must be used within a PluginContextProvider");
|
|
216
|
+
return e;
|
|
217
|
+
}
|
|
218
|
+
function _s() {
|
|
219
|
+
return Le().settings;
|
|
220
|
+
}
|
|
221
|
+
const Ct = me(void 0), ws = ({ children: e }) => {
|
|
222
|
+
const [t, n] = q({}), r = () => {
|
|
223
|
+
tn().then((i) => {
|
|
224
|
+
console.log("Fetched settings:", i), n(i);
|
|
225
|
+
}).catch((i) => {
|
|
226
|
+
console.error("Error fetching settings:", i);
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
_.useEffect(() => {
|
|
230
|
+
r();
|
|
231
|
+
}, []);
|
|
232
|
+
const s = () => {
|
|
233
|
+
r();
|
|
234
|
+
};
|
|
235
|
+
return /* @__PURE__ */ F(Ct.Provider, { value: { settings: t, reload: s }, children: e });
|
|
236
|
+
}, Rn = {
|
|
237
|
+
height: 32,
|
|
238
|
+
focused: 0,
|
|
239
|
+
tabs: [],
|
|
240
|
+
createTab: () => {
|
|
241
|
+
},
|
|
242
|
+
createTabs: () => {
|
|
243
|
+
},
|
|
244
|
+
updateTab: () => {
|
|
245
|
+
},
|
|
246
|
+
focusTab: () => {
|
|
247
|
+
},
|
|
248
|
+
reorderTab: () => {
|
|
249
|
+
},
|
|
250
|
+
closeTab: () => {
|
|
251
|
+
},
|
|
252
|
+
closeTabs: () => {
|
|
253
|
+
},
|
|
254
|
+
resizeDrawer: () => {
|
|
255
|
+
},
|
|
256
|
+
closeDrawer: () => {
|
|
257
|
+
},
|
|
258
|
+
fullscreenDrawer: () => {
|
|
259
|
+
}
|
|
260
|
+
}, Mn = _.createContext(Rn), $n = me(void 0), Ln = _.createContext(void 0), Et = _.createContext(void 0), qn = 3e4, Ss = ({ children: e }) => {
|
|
261
|
+
const [t, n] = _.useState([]), r = _.useCallback((a) => {
|
|
262
|
+
n((c) => [a, ...c]);
|
|
263
|
+
}, []), s = _.useCallback((a, c) => {
|
|
264
|
+
n(
|
|
265
|
+
(l) => l.map((u) => u.id === a ? { ...u, ...c } : u)
|
|
266
|
+
);
|
|
267
|
+
}, []), i = _.useCallback((a) => {
|
|
268
|
+
n((c) => c.filter((l) => l.id !== a));
|
|
269
|
+
}, []);
|
|
270
|
+
_.useEffect(() => {
|
|
271
|
+
const a = [];
|
|
272
|
+
for (const c of t)
|
|
273
|
+
if (c.status === "completed" || c.status === "error") {
|
|
274
|
+
const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, qn - l);
|
|
275
|
+
a.push(setTimeout(() => i(c.id), u));
|
|
276
|
+
}
|
|
277
|
+
return () => a.forEach(clearTimeout);
|
|
278
|
+
}, [t, i]);
|
|
279
|
+
const o = _.useMemo(
|
|
280
|
+
() => ({ operations: t, addOperation: r, updateOperation: s, removeOperation: i }),
|
|
281
|
+
[t, r, s, i]
|
|
282
|
+
);
|
|
283
|
+
return /* @__PURE__ */ F(Et.Provider, { value: o, children: e });
|
|
284
|
+
};
|
|
285
|
+
var Ie = function(e, t) {
|
|
286
|
+
return Ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
287
|
+
n.__proto__ = r;
|
|
288
|
+
} || function(n, r) {
|
|
289
|
+
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
290
|
+
}, Ie(e, t);
|
|
291
|
+
};
|
|
292
|
+
function Gn(e, t) {
|
|
293
|
+
if (typeof t != "function" && t !== null)
|
|
294
|
+
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
295
|
+
Ie(e, t);
|
|
296
|
+
function n() {
|
|
297
|
+
this.constructor = e;
|
|
298
|
+
}
|
|
299
|
+
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
|
|
300
|
+
}
|
|
301
|
+
var ve = "Invariant Violation", Ze = Object.setPrototypeOf, Kn = Ze === void 0 ? function(e, t) {
|
|
302
|
+
return e.__proto__ = t, e;
|
|
303
|
+
} : Ze, Un = (
|
|
304
|
+
/** @class */
|
|
305
|
+
function(e) {
|
|
306
|
+
Gn(t, e);
|
|
307
|
+
function t(n) {
|
|
308
|
+
n === void 0 && (n = ve);
|
|
309
|
+
var r = e.call(this, typeof n == "number" ? ve + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
|
|
310
|
+
return r.framesToPop = 1, r.name = ve, Kn(r, t.prototype), r;
|
|
311
|
+
}
|
|
312
|
+
return t;
|
|
313
|
+
}(Error)
|
|
314
|
+
);
|
|
315
|
+
function Oe(e, t) {
|
|
316
|
+
if (!e)
|
|
317
|
+
throw new Un(t);
|
|
318
|
+
}
|
|
319
|
+
var bt = ["debug", "log", "warn", "error", "silent"], jn = bt.indexOf("log");
|
|
320
|
+
function ce(e) {
|
|
321
|
+
return function() {
|
|
322
|
+
if (bt.indexOf(e) >= jn) {
|
|
323
|
+
var t = console[e] || console.log;
|
|
324
|
+
return t.apply(console, arguments);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
(function(e) {
|
|
329
|
+
e.debug = ce("debug"), e.log = ce("log"), e.warn = ce("warn"), e.error = ce("error");
|
|
330
|
+
})(Oe || (Oe = {}));
|
|
331
|
+
const vt = me(void 0), Pt = () => te(vt), Cs = (e) => {
|
|
332
|
+
const t = Pt();
|
|
333
|
+
return t == null ? void 0 : t.getExtensionPoint(e);
|
|
334
|
+
}, Es = (e) => {
|
|
335
|
+
const t = Pt(), n = t == null ? void 0 : t.getExtensionPoint(e);
|
|
336
|
+
return n ? n.provide({ getCacheKey: () => e }) : [];
|
|
337
|
+
}, bs = ({ registry: e, children: t }) => {
|
|
338
|
+
const n = _.useRef(e);
|
|
339
|
+
return _.useEffect(() => {
|
|
340
|
+
Oe(
|
|
341
|
+
n.current === e,
|
|
342
|
+
"You can't change the extension registry after it has been rendered"
|
|
343
|
+
);
|
|
344
|
+
}, [e]), /* @__PURE__ */ F(vt.Provider, { value: n.current, children: _.Children.only(t) });
|
|
345
|
+
}, et = (e) => {
|
|
346
|
+
if (!e || typeof e != "string")
|
|
347
|
+
throw new TypeError(`extensionName is required to be a string and can't be: "${e}" (${typeof e})`);
|
|
348
|
+
return e.trim();
|
|
349
|
+
};
|
|
350
|
+
class Qn {
|
|
351
|
+
constructor(t) {
|
|
352
|
+
M(this, "_settings");
|
|
353
|
+
M(this, "_extensions", /* @__PURE__ */ new Map());
|
|
354
|
+
M(this, "_lookupCache", /* @__PURE__ */ new Map());
|
|
355
|
+
M(this, "_matchCache", /* @__PURE__ */ new Map());
|
|
356
|
+
M(this, "_matcher");
|
|
357
|
+
const { matcher: n, ...r } = t;
|
|
358
|
+
this._settings = r, this._matcher = t.matcher;
|
|
359
|
+
}
|
|
360
|
+
settings() {
|
|
361
|
+
return this._settings;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Registers a new component within the registry. Throws an error if a component with the same ID already exists.
|
|
365
|
+
* This method should be used when initializing components or dynamically adding new components at runtime.
|
|
366
|
+
*
|
|
367
|
+
* @param opts The registration options for the component, containing its ID, plugin, and other metadata.
|
|
368
|
+
* @throws Error if a component with the same ID is already registered.
|
|
369
|
+
* @example
|
|
370
|
+
* registry.register({
|
|
371
|
+
* id: 'unique-sidebar-item',
|
|
372
|
+
* plugin: 'examplePlugin',
|
|
373
|
+
* label: 'My Sidebar Item',
|
|
374
|
+
* component: MyComponent,
|
|
375
|
+
* });
|
|
376
|
+
*/
|
|
377
|
+
register(t) {
|
|
378
|
+
if (this._extensions.get(t.id))
|
|
379
|
+
throw new Error(`Resource sidebar view with id ${t.id} already exists`);
|
|
380
|
+
const n = {
|
|
381
|
+
...t,
|
|
382
|
+
registeredAt: /* @__PURE__ */ new Date(),
|
|
383
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
384
|
+
enabled: !0
|
|
385
|
+
};
|
|
386
|
+
this._extensions.set(t.id, n);
|
|
387
|
+
const r = Array.from(this._matchCache.keys());
|
|
388
|
+
for (const s of r)
|
|
389
|
+
s.startsWith(t.plugin) && this._matchCache.delete(s);
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Unregisters a component from the registry by its ID. Useful for cleanup or when components are dynamically removed.
|
|
393
|
+
*
|
|
394
|
+
* @param id The ID of the component to unregister.
|
|
395
|
+
* @example
|
|
396
|
+
* registry.unregister('unique-sidebar-item');
|
|
397
|
+
*/
|
|
398
|
+
unregister(t) {
|
|
399
|
+
this._extensions.delete(t);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Retrieves a component by its ID from the registry. Returns undefined if no such component exists.
|
|
403
|
+
*
|
|
404
|
+
* @param id The ID of the component to retrieve.
|
|
405
|
+
* @returns The component associated with the given ID, or undefined if not found.
|
|
406
|
+
* @example
|
|
407
|
+
* const component = registry.get('unique-sidebar-item');
|
|
408
|
+
* if (component) {
|
|
409
|
+
* render(component);
|
|
410
|
+
* }
|
|
411
|
+
*/
|
|
412
|
+
get(t) {
|
|
413
|
+
var n;
|
|
414
|
+
return (n = this._extensions.get(t)) == null ? void 0 : n.component;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Lists all registered components in the registry. Useful for debugging or generating summaries of available components.
|
|
418
|
+
*
|
|
419
|
+
* @returns An array of all registered components.
|
|
420
|
+
* @example
|
|
421
|
+
* const allComponents = registry.list();
|
|
422
|
+
* console.log('Registered Components:', allComponents);
|
|
423
|
+
*/
|
|
424
|
+
list() {
|
|
425
|
+
return Array.from(this._extensions.values());
|
|
426
|
+
}
|
|
427
|
+
generateMatchCacheKey(t) {
|
|
428
|
+
return `${t.plugin}/${t.id}`;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Calculate the matches for the given context.
|
|
432
|
+
*/
|
|
433
|
+
calculateMatches(t) {
|
|
434
|
+
if (!this._matcher)
|
|
435
|
+
return Array.from(this._extensions.values());
|
|
436
|
+
const n = [];
|
|
437
|
+
for (const r of this._extensions.values()) {
|
|
438
|
+
const s = this.generateMatchCacheKey(r), i = this._matchCache.has(s);
|
|
439
|
+
if (i && this._matchCache.get(s)) {
|
|
440
|
+
n.push(r);
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
this._matcher(t, r) ? (this._matchCache.set(s, !0), n.push(r)) : i || this._matchCache.set(s, !1);
|
|
444
|
+
}
|
|
445
|
+
return n;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Preload the registry caches with the given expected context to avoid on-first-request calculation.
|
|
449
|
+
* This is useful when the registry is used to provide components for a specific context, like for
|
|
450
|
+
* specific resources types.
|
|
451
|
+
*
|
|
452
|
+
* If the cache is already populated for the expected context, the cache key will be recalculated.
|
|
453
|
+
*
|
|
454
|
+
* @param context The context expected to be called preload the registry with on provide.
|
|
455
|
+
*/
|
|
456
|
+
preload(t) {
|
|
457
|
+
const n = this.calculateMatches(t), r = t.getCacheKey();
|
|
458
|
+
this._lookupCache.set(r, n.map((s) => s.id));
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Provide the components that match the given context.
|
|
462
|
+
*/
|
|
463
|
+
provide(t) {
|
|
464
|
+
if (this._settings.disabled)
|
|
465
|
+
return [];
|
|
466
|
+
if (this._settings.mode === "single") {
|
|
467
|
+
const i = this._extensions.get(this._settings.selected);
|
|
468
|
+
return i ? [i.component] : [];
|
|
469
|
+
}
|
|
470
|
+
const n = t.getCacheKey();
|
|
471
|
+
let r = this._lookupCache.get(n);
|
|
472
|
+
if (r) {
|
|
473
|
+
let i = r.map((o) => this._extensions.get(o)).filter((o) => !!o).map((o) => o.component);
|
|
474
|
+
return this._settings.order && (i = this.reorderComponents(i, r, this._settings.order)), i;
|
|
475
|
+
}
|
|
476
|
+
r = this.calculateMatches(t).map((i) => i.id), this._lookupCache.set(n, r);
|
|
477
|
+
let s = r.map((i) => this._extensions.get(i)).filter((i) => !!i).map((i) => i.component);
|
|
478
|
+
return this._settings.order && (s = this.reorderComponents(s, r, this._settings.order)), s;
|
|
479
|
+
}
|
|
480
|
+
reorderComponents(t, n, r) {
|
|
481
|
+
const s = new Map(n.map((i, o) => [i, t[o]]));
|
|
482
|
+
return r.map((i) => s.get(i)).filter((i) => !!i);
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Reorder the components in the registry based on the given order.
|
|
486
|
+
*/
|
|
487
|
+
reorder(t) {
|
|
488
|
+
const n = t.map((o) => this._extensions.get(o)).filter((o) => !!o), r = Array.from(this._extensions.values()).filter((o) => !t.includes(o.id)), s = [...n, ...r];
|
|
489
|
+
this._extensions.clear(), s.forEach((o) => this._extensions.set(o.id, o));
|
|
490
|
+
const i = Array.from(this._lookupCache.keys());
|
|
491
|
+
for (const o of i) {
|
|
492
|
+
const a = this._lookupCache.get(o);
|
|
493
|
+
if (!a)
|
|
494
|
+
continue;
|
|
495
|
+
const c = a.filter((l) => t.includes(l));
|
|
496
|
+
this._lookupCache.set(o, c);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
clearLookupCache() {
|
|
500
|
+
this._lookupCache.clear();
|
|
501
|
+
}
|
|
502
|
+
clearMatchCache() {
|
|
503
|
+
this._matchCache.clear();
|
|
504
|
+
}
|
|
505
|
+
clearAllCaches() {
|
|
506
|
+
this.clearLookupCache(), this.clearMatchCache();
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
class vs {
|
|
510
|
+
constructor({ initialStores: t }) {
|
|
511
|
+
M(this, "store", {});
|
|
512
|
+
t.forEach((n) => {
|
|
513
|
+
this.addExtensionPoint(n);
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Add a new extension point to the registry. If the extension point already exists, it will not be
|
|
518
|
+
* added again.
|
|
519
|
+
* @param opts The settings for the extension point
|
|
520
|
+
*/
|
|
521
|
+
addExtensionPoint(t) {
|
|
522
|
+
let n = et(t.id);
|
|
523
|
+
if (console.log("validated", n), console.log("store", this.store), this.store[n]) {
|
|
524
|
+
console.warn(`Extension point ${n} already exists. Not adding again.`);
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
this.store[n] = new Qn(t);
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Get an extension point from the registry.
|
|
531
|
+
*/
|
|
532
|
+
getExtensionPoint(t) {
|
|
533
|
+
return t = et(t), this.store[t];
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* List all extension points in the registry.
|
|
537
|
+
*/
|
|
538
|
+
listExtensionPointIds() {
|
|
539
|
+
return Object.keys(this.store);
|
|
540
|
+
}
|
|
541
|
+
// /**
|
|
542
|
+
// * List extension points, grouped by owner
|
|
543
|
+
// */
|
|
544
|
+
// listExtensionPointsByOwner(): Record<string, ExtensionPointSettings[]> {
|
|
545
|
+
// const byOwner: Record<string, ExtensionPointSettings[]> = {};
|
|
546
|
+
// Object.values(this.store).forEach((store) => {
|
|
547
|
+
// const owner = store.settings().owner;
|
|
548
|
+
// if (!byOwner[owner]) {
|
|
549
|
+
// byOwner[owner] = [];
|
|
550
|
+
// }
|
|
551
|
+
//
|
|
552
|
+
// byOwner[owner].push(store.settings());
|
|
553
|
+
// });
|
|
554
|
+
// return byOwner;
|
|
555
|
+
// }
|
|
556
|
+
/**
|
|
557
|
+
* List all extensions in the registry.
|
|
558
|
+
*/
|
|
559
|
+
listExtensionPoints() {
|
|
560
|
+
return Object.values(this.store).map((t) => t.settings());
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
const Dt = me(void 0), zn = {
|
|
564
|
+
default: "info",
|
|
565
|
+
info: "info",
|
|
566
|
+
success: "success",
|
|
567
|
+
warning: "warning",
|
|
568
|
+
error: "error"
|
|
569
|
+
}, Ps = ({ children: e }) => {
|
|
570
|
+
const { push: t } = Nn(), [n, r] = _.useState([]), s = (o) => {
|
|
571
|
+
r((a) => [...a, o]);
|
|
572
|
+
}, i = (o, a, c) => {
|
|
573
|
+
const l = typeof o == "object";
|
|
574
|
+
let u = "", y = "info", h, f = 5e3, m;
|
|
575
|
+
if (l) {
|
|
576
|
+
if (u = o.message, o.showOnce) {
|
|
577
|
+
if (n.includes(u))
|
|
578
|
+
return;
|
|
579
|
+
s(u);
|
|
580
|
+
}
|
|
581
|
+
y = o.status, h = o.details, f = o.autoHideDuration ?? 5e3, m = o.actions;
|
|
582
|
+
} else
|
|
583
|
+
u = o, y = a, h = c;
|
|
584
|
+
t({
|
|
585
|
+
severity: zn[y] ?? "info",
|
|
586
|
+
title: u,
|
|
587
|
+
message: h,
|
|
588
|
+
timeout: f,
|
|
589
|
+
actions: m
|
|
590
|
+
});
|
|
591
|
+
};
|
|
592
|
+
return /* @__PURE__ */ F(Dt.Provider, { value: { showSnackbar: i }, children: e });
|
|
593
|
+
}, $ = () => {
|
|
594
|
+
const e = te(Dt);
|
|
595
|
+
if (e === void 0)
|
|
596
|
+
throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
|
|
597
|
+
return e;
|
|
598
|
+
};
|
|
599
|
+
function P(e) {
|
|
600
|
+
const t = te($e), n = (t == null ? void 0 : t.pluginId) ?? e;
|
|
601
|
+
if (!n)
|
|
602
|
+
throw new Error(
|
|
603
|
+
"pluginID must be provided either via PluginContext or as an explicit parameter"
|
|
604
|
+
);
|
|
605
|
+
return n;
|
|
606
|
+
}
|
|
607
|
+
const Ds = ({ pluginID: e, connectionID: t }) => {
|
|
608
|
+
const n = P(e), r = G(), { showSnackbar: s } = $(), i = [n, "connection", "detail", t], { mutateAsync: o } = v({
|
|
609
|
+
mutationFn: async () => nn(n, t),
|
|
610
|
+
onSuccess(y) {
|
|
611
|
+
r.setQueryData(i, y), r.invalidateQueries({
|
|
612
|
+
queryKey: ["EDITOR_SCHEMAS", n, t]
|
|
613
|
+
});
|
|
614
|
+
},
|
|
615
|
+
onError: I(s, "Failed to start connection")
|
|
616
|
+
}), { mutateAsync: a } = v({
|
|
617
|
+
mutationFn: async () => lt(n, t),
|
|
618
|
+
onSuccess(y) {
|
|
619
|
+
r.setQueryData(i, y);
|
|
620
|
+
},
|
|
621
|
+
onError: I(s, "Failed to stop connection")
|
|
622
|
+
}), { mutateAsync: c } = v({
|
|
623
|
+
mutationFn: async (y) => rn(n, y),
|
|
624
|
+
onSuccess(y, { name: h }) {
|
|
625
|
+
s({ message: `Connection ${h} successfully updated`, status: "success" }), r.setQueryData(i, u), r.setQueriesData(
|
|
626
|
+
{ queryKey: [n, "connection", "list"] },
|
|
627
|
+
(f) => f == null ? void 0 : f.map((m) => m.id === t ? y : m)
|
|
628
|
+
);
|
|
629
|
+
},
|
|
630
|
+
onError: I(s, "Failed to update connection")
|
|
631
|
+
}), { mutateAsync: l } = v({
|
|
632
|
+
mutationFn: async () => sn(n, t),
|
|
633
|
+
onSuccess() {
|
|
634
|
+
s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(i, void 0), r.setQueriesData(
|
|
635
|
+
{ queryKey: [n, "connection", "list"] },
|
|
636
|
+
(y) => y == null ? void 0 : y.filter((h) => h.id !== t)
|
|
637
|
+
);
|
|
638
|
+
},
|
|
639
|
+
onError: I(s, "Failed to remove connection")
|
|
640
|
+
}), u = D({
|
|
641
|
+
queryKey: i,
|
|
642
|
+
queryFn: async () => on(n, t)
|
|
643
|
+
});
|
|
644
|
+
return {
|
|
645
|
+
/**
|
|
646
|
+
* Get the connection
|
|
647
|
+
*/
|
|
648
|
+
connection: u,
|
|
649
|
+
/**
|
|
650
|
+
* Start the connection
|
|
651
|
+
*/
|
|
652
|
+
startConnection: o,
|
|
653
|
+
/**
|
|
654
|
+
* Stop the connection
|
|
655
|
+
*/
|
|
656
|
+
stopConnection: a,
|
|
657
|
+
/**
|
|
658
|
+
* Update the connection.
|
|
659
|
+
*/
|
|
660
|
+
updateConnection: c,
|
|
661
|
+
/**
|
|
662
|
+
* Delete the connection
|
|
663
|
+
*/
|
|
664
|
+
deleteConnection: l
|
|
665
|
+
};
|
|
666
|
+
}, Wn = (e) => [e, "connection", "list"], Fs = ({ plugin: e }) => {
|
|
667
|
+
const t = P(e), n = G(), { showSnackbar: r } = $(), s = Wn(t), { mutateAsync: i } = v({
|
|
668
|
+
mutationFn: async (l) => dt(t, l.id),
|
|
669
|
+
onError: I(r, "Failed to start connection informer")
|
|
670
|
+
}), { mutateAsync: o } = v({
|
|
671
|
+
mutationFn: async (l) => an(t, l.id),
|
|
672
|
+
onError: I(r, "Failed to stop connection informer")
|
|
673
|
+
}), a = _.useCallback((l) => {
|
|
674
|
+
console.log("got update to connections", l), n.setQueryData(s, l);
|
|
675
|
+
}, []);
|
|
676
|
+
return _.useEffect(() => {
|
|
677
|
+
const l = A(`${t}/connection/sync`, a);
|
|
678
|
+
return () => {
|
|
679
|
+
l();
|
|
680
|
+
};
|
|
681
|
+
}, []), {
|
|
682
|
+
connections: D({
|
|
683
|
+
queryKey: s,
|
|
684
|
+
queryFn: async () => {
|
|
685
|
+
try {
|
|
686
|
+
return await cn(t);
|
|
687
|
+
} catch (l) {
|
|
688
|
+
console.log(l), I(r, "Failed to load connections")(l);
|
|
689
|
+
}
|
|
690
|
+
return [];
|
|
691
|
+
},
|
|
692
|
+
staleTime: 3e4,
|
|
693
|
+
placeholderData: gt
|
|
694
|
+
}),
|
|
695
|
+
startInformer: i,
|
|
696
|
+
stopInformer: o
|
|
697
|
+
};
|
|
698
|
+
}, xs = ({ pluginID: e, connectionID: t }) => {
|
|
699
|
+
const n = P(e);
|
|
700
|
+
return {
|
|
701
|
+
/**
|
|
702
|
+
* Get the connection
|
|
703
|
+
*/
|
|
704
|
+
namespaces: D({
|
|
705
|
+
queryKey: [n, "connection", "namespaces", t],
|
|
706
|
+
queryFn: async () => un(n, t)
|
|
707
|
+
})
|
|
708
|
+
};
|
|
709
|
+
};
|
|
710
|
+
var Hn = /* @__PURE__ */ ((e) => (e[e.OnConnect = 0] = "OnConnect", e[e.OnFirstQuery = 1] = "OnFirstQuery", e[e.Never = 2] = "Never", e))(Hn || {}), 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
|
+
function Ft(e) {
|
|
712
|
+
const t = Object.values(e.states), n = t.length;
|
|
713
|
+
let r = 0, s = 0;
|
|
714
|
+
for (const a of t)
|
|
715
|
+
a === x.Synced && r++, a === x.Error && s++;
|
|
716
|
+
const i = t.filter(
|
|
717
|
+
(a) => a === x.Synced || a === x.Error || a === x.Cancelled
|
|
718
|
+
).length, o = n > 0 ? i / n : 0;
|
|
719
|
+
return {
|
|
720
|
+
pluginID: e.pluginID,
|
|
721
|
+
connectionID: e.connectionID,
|
|
722
|
+
totalResources: n,
|
|
723
|
+
syncedCount: r,
|
|
724
|
+
errorCount: s,
|
|
725
|
+
doneCount: i,
|
|
726
|
+
progress: o
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
function fe(e) {
|
|
730
|
+
return e.totalResources > 0 && e.doneCount >= e.totalResources;
|
|
731
|
+
}
|
|
732
|
+
function xt(e) {
|
|
733
|
+
return e.some((t) => !fe(t));
|
|
734
|
+
}
|
|
735
|
+
function It(e) {
|
|
736
|
+
const t = e.reduce((r, s) => r + s.totalResources, 0);
|
|
737
|
+
return t === 0 ? 0 : e.reduce((r, s) => r + s.doneCount, 0) / t;
|
|
738
|
+
}
|
|
739
|
+
function qe(e) {
|
|
740
|
+
return `${e.pluginId}/${e.connection}`;
|
|
741
|
+
}
|
|
742
|
+
function Ot(e, t) {
|
|
743
|
+
const n = qe(t);
|
|
744
|
+
e.has(n) || e.set(n, {
|
|
745
|
+
states: {},
|
|
746
|
+
pluginID: t.pluginId,
|
|
747
|
+
connectionID: t.connection
|
|
748
|
+
});
|
|
749
|
+
const r = e.get(n);
|
|
750
|
+
return r.states[t.resourceKey] = t.state, r;
|
|
751
|
+
}
|
|
752
|
+
function Is() {
|
|
753
|
+
const [e, t] = q(/* @__PURE__ */ new Set()), [n, r] = q({}), [s, i] = q(/* @__PURE__ */ new Map()), o = de(/* @__PURE__ */ new Map());
|
|
754
|
+
j(() => {
|
|
755
|
+
Ye().then((p) => {
|
|
756
|
+
p && r(p);
|
|
757
|
+
}).catch(() => {
|
|
758
|
+
});
|
|
759
|
+
}, []), j(() => A("connection/status", (S) => {
|
|
760
|
+
const w = `${S.pluginID}/${S.connectionID}`;
|
|
761
|
+
S.status === "DISCONNECTED" ? (t((b) => {
|
|
762
|
+
const d = new Set(b);
|
|
763
|
+
return d.delete(w), d;
|
|
764
|
+
}), i((b) => {
|
|
765
|
+
const d = new Map(b);
|
|
766
|
+
return d.delete(w), d;
|
|
767
|
+
}), o.current.delete(w)) : t((b) => {
|
|
768
|
+
const d = new Set(b);
|
|
769
|
+
return d.add(w), d;
|
|
770
|
+
}), Ye().then((b) => {
|
|
771
|
+
b && r(b);
|
|
772
|
+
}).catch(() => {
|
|
773
|
+
});
|
|
774
|
+
}), []);
|
|
775
|
+
const a = V((p) => {
|
|
776
|
+
const S = qe(p);
|
|
777
|
+
t((d) => {
|
|
778
|
+
if (d.has(S)) return d;
|
|
779
|
+
const g = new Set(d);
|
|
780
|
+
return g.add(S), g;
|
|
781
|
+
});
|
|
782
|
+
const w = Ot(o.current, p), b = Ft(w);
|
|
783
|
+
i((d) => {
|
|
784
|
+
const g = new Map(d);
|
|
785
|
+
return g.set(S, b), g;
|
|
786
|
+
});
|
|
787
|
+
}, []);
|
|
788
|
+
j(() => A("informer/STATE", a), [a]);
|
|
789
|
+
const c = V(async (p, S) => {
|
|
790
|
+
await lt(p, S);
|
|
791
|
+
}, []), l = V(async (p, S) => {
|
|
792
|
+
await dt(p, S);
|
|
793
|
+
}, []), u = [];
|
|
794
|
+
for (const p of e) {
|
|
795
|
+
const [S, w] = p.split("/", 2), d = (n[S] ?? []).find((R) => R.id === w), g = s.get(p), E = g != null && !fe(g), C = g != null && g.errorCount > 0;
|
|
796
|
+
u.push({
|
|
797
|
+
pluginID: S,
|
|
798
|
+
connectionID: w,
|
|
799
|
+
name: (d == null ? void 0 : d.name) ?? w,
|
|
800
|
+
avatar: (d == null ? void 0 : d.avatar) ?? "",
|
|
801
|
+
isStarted: !0,
|
|
802
|
+
sync: g,
|
|
803
|
+
isSyncing: E,
|
|
804
|
+
hasErrors: C
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
const y = /* @__PURE__ */ new Map();
|
|
808
|
+
for (const p of u) {
|
|
809
|
+
const S = y.get(p.pluginID) ?? [];
|
|
810
|
+
S.push(p), y.set(p.pluginID, S);
|
|
811
|
+
}
|
|
812
|
+
const h = Array.from(s.values()), f = u.filter((p) => p.isSyncing), m = u.filter((p) => p.hasErrors);
|
|
813
|
+
return {
|
|
814
|
+
entries: u,
|
|
815
|
+
grouped: y,
|
|
816
|
+
connectedCount: u.length,
|
|
817
|
+
syncingCount: f.length,
|
|
818
|
+
errorCount: m.length,
|
|
819
|
+
hasSyncing: xt(h),
|
|
820
|
+
aggregateProgress: It(h),
|
|
821
|
+
disconnect: c,
|
|
822
|
+
retryInformer: l
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
function Bn(e, t) {
|
|
826
|
+
return window.go.data.Client.Get(e, t);
|
|
827
|
+
}
|
|
828
|
+
function Yn(e, t, n) {
|
|
829
|
+
return window.go.data.Client.Set(e, t, n);
|
|
830
|
+
}
|
|
831
|
+
function Os(e, t, n) {
|
|
832
|
+
const r = P(e), s = G(), i = [r, "data", t], o = D({
|
|
833
|
+
queryKey: i,
|
|
834
|
+
queryFn: async () => {
|
|
835
|
+
const c = await Bn(r, t);
|
|
836
|
+
return c ?? n;
|
|
837
|
+
}
|
|
838
|
+
}), a = v({
|
|
839
|
+
mutationFn: async (c) => {
|
|
840
|
+
await Yn(r, t, c);
|
|
841
|
+
},
|
|
842
|
+
onMutate: async (c) => {
|
|
843
|
+
await s.cancelQueries({ queryKey: i });
|
|
844
|
+
const l = s.getQueryData(i);
|
|
845
|
+
return s.setQueryData(i, c), { previous: l };
|
|
846
|
+
},
|
|
847
|
+
onError: (c, l, u) => {
|
|
848
|
+
(u == null ? void 0 : u.previous) !== void 0 && s.setQueryData(i, u.previous);
|
|
849
|
+
},
|
|
850
|
+
onSettled: () => {
|
|
851
|
+
s.invalidateQueries({ queryKey: i });
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
return {
|
|
855
|
+
data: o.data ?? n,
|
|
856
|
+
update: async (c) => {
|
|
857
|
+
await a.mutateAsync(c);
|
|
858
|
+
},
|
|
859
|
+
isLoading: o.isLoading
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
const As = () => {
|
|
863
|
+
const e = te($n);
|
|
864
|
+
if (!e) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
|
|
865
|
+
return e;
|
|
866
|
+
}, At = () => {
|
|
867
|
+
const e = te(Mn);
|
|
868
|
+
if (e === void 0)
|
|
869
|
+
throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
|
|
870
|
+
return e;
|
|
871
|
+
}, Ts = ({ pluginID: e }) => {
|
|
872
|
+
const t = P(e), { showSnackbar: n } = $(), { createTab: r, updateTab: s } = At();
|
|
873
|
+
return {
|
|
874
|
+
createSession: v({
|
|
875
|
+
mutationFn: async ({ connectionID: o, icon: a, label: c, opts: l }) => {
|
|
876
|
+
const u = `pending-${crypto.randomUUID()}`;
|
|
877
|
+
r({
|
|
878
|
+
id: u,
|
|
879
|
+
title: c ?? "Connecting...",
|
|
880
|
+
variant: "terminal",
|
|
881
|
+
icon: a ?? "LuSquareTerminal",
|
|
882
|
+
properties: {
|
|
883
|
+
status: "connecting",
|
|
884
|
+
pluginID: t,
|
|
885
|
+
connectionID: o,
|
|
886
|
+
opts: { ...l }
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
const y = An.SessionOptions.createFrom({
|
|
890
|
+
command: ["/bin/bash"],
|
|
891
|
+
tty: !0,
|
|
892
|
+
...l
|
|
893
|
+
});
|
|
894
|
+
try {
|
|
895
|
+
const h = await ln(t, o, y);
|
|
896
|
+
s(
|
|
897
|
+
{ id: u },
|
|
898
|
+
{
|
|
899
|
+
id: h.id,
|
|
900
|
+
title: c ?? `Session ${h.id.substring(0, 8)}`,
|
|
901
|
+
properties: { status: "connected", pluginID: t, connectionID: o, opts: { ...l } }
|
|
902
|
+
}
|
|
903
|
+
);
|
|
904
|
+
} catch (h) {
|
|
905
|
+
const f = K(h);
|
|
906
|
+
s(
|
|
907
|
+
{ id: u },
|
|
908
|
+
{
|
|
909
|
+
properties: { status: "error", error: f.detail, pluginID: t, connectionID: o, opts: { ...l } }
|
|
910
|
+
}
|
|
911
|
+
), X(n, h, "Failed to start session");
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}).mutateAsync
|
|
915
|
+
};
|
|
916
|
+
}, Ns = ({ pluginID: e }) => {
|
|
917
|
+
const t = P(e), { showSnackbar: n } = $(), { createTab: r } = At(), s = v({
|
|
918
|
+
mutationFn: async ({
|
|
919
|
+
connectionID: o,
|
|
920
|
+
resourceKey: a,
|
|
921
|
+
resourceID: c,
|
|
922
|
+
resourceData: l,
|
|
923
|
+
icon: u,
|
|
924
|
+
label: y,
|
|
925
|
+
target: h,
|
|
926
|
+
follow: f = !0,
|
|
927
|
+
tailLines: m = 1e3,
|
|
928
|
+
params: p
|
|
929
|
+
}) => {
|
|
930
|
+
const S = Ve.CreateSessionOptions.createFrom({
|
|
931
|
+
resource_key: a,
|
|
932
|
+
resource_id: c,
|
|
933
|
+
resource_data: l,
|
|
934
|
+
options: Ve.LogSessionOptions.createFrom({
|
|
935
|
+
target: h ?? "",
|
|
936
|
+
follow: f,
|
|
937
|
+
include_previous: !1,
|
|
938
|
+
include_timestamps: !0,
|
|
939
|
+
tail_lines: m,
|
|
940
|
+
since_seconds: 0,
|
|
941
|
+
limit_bytes: 0,
|
|
942
|
+
include_source_events: !0,
|
|
943
|
+
params: p ?? {}
|
|
944
|
+
})
|
|
945
|
+
}), w = await dn(t, o, S);
|
|
946
|
+
return r({
|
|
947
|
+
id: w.id,
|
|
948
|
+
title: y ?? `Logs ${w.id.substring(0, 8)}`,
|
|
949
|
+
variant: "logs",
|
|
950
|
+
icon: u ?? "LuLogs"
|
|
951
|
+
}), w;
|
|
952
|
+
},
|
|
953
|
+
onError: I(n, "Failed to start log session")
|
|
954
|
+
}), i = v({
|
|
955
|
+
mutationFn: async (o) => {
|
|
956
|
+
await fn(o);
|
|
957
|
+
},
|
|
958
|
+
onError: I(n, "Failed to close log session")
|
|
959
|
+
});
|
|
960
|
+
return {
|
|
961
|
+
createLogSession: s.mutateAsync,
|
|
962
|
+
closeLogSession: i.mutateAsync
|
|
963
|
+
};
|
|
964
|
+
}, ks = () => D({
|
|
965
|
+
queryKey: ["metric", "providers"],
|
|
966
|
+
queryFn: pn,
|
|
967
|
+
staleTime: 3e4
|
|
968
|
+
}), Jn = (e) => D({
|
|
969
|
+
queryKey: ["metric", "providers", e],
|
|
970
|
+
queryFn: () => yn(e),
|
|
971
|
+
enabled: !!e,
|
|
972
|
+
staleTime: 3e4
|
|
973
|
+
}), Rs = (e) => {
|
|
974
|
+
var S, w;
|
|
975
|
+
const {
|
|
976
|
+
connectionID: t,
|
|
977
|
+
resourceKey: n,
|
|
978
|
+
resourceID: r,
|
|
979
|
+
resourceNamespace: s = "",
|
|
980
|
+
resourceData: i = {},
|
|
981
|
+
metricIDs: o = [],
|
|
982
|
+
shape: a = 0,
|
|
983
|
+
// CURRENT
|
|
984
|
+
timeRange: c,
|
|
985
|
+
refreshInterval: l = 0,
|
|
986
|
+
enabled: u = !0
|
|
987
|
+
} = e, {
|
|
988
|
+
data: y,
|
|
989
|
+
isLoading: h
|
|
990
|
+
} = Jn(n), f = y ?? [], m = c ? Math.max(
|
|
991
|
+
Math.floor((c.end.getTime() - c.start.getTime()) / 250),
|
|
992
|
+
15e3
|
|
993
|
+
) * 1e6 : 0, p = D({
|
|
994
|
+
queryKey: [
|
|
995
|
+
"metric",
|
|
996
|
+
"query",
|
|
997
|
+
t,
|
|
998
|
+
n,
|
|
999
|
+
r,
|
|
1000
|
+
s,
|
|
1001
|
+
o,
|
|
1002
|
+
a,
|
|
1003
|
+
(S = c == null ? void 0 : c.start) == null ? void 0 : S.getTime(),
|
|
1004
|
+
(w = c == null ? void 0 : c.end) == null ? void 0 : w.getTime()
|
|
1005
|
+
],
|
|
1006
|
+
queryFn: () => hn(
|
|
1007
|
+
t,
|
|
1008
|
+
n,
|
|
1009
|
+
r,
|
|
1010
|
+
s,
|
|
1011
|
+
i,
|
|
1012
|
+
o,
|
|
1013
|
+
a,
|
|
1014
|
+
(c == null ? void 0 : c.start) ?? /* @__PURE__ */ new Date(0),
|
|
1015
|
+
(c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0),
|
|
1016
|
+
m
|
|
1017
|
+
),
|
|
1018
|
+
enabled: u && !!t && !!n && (n.startsWith("cluster::") || !!r) && f.length > 0,
|
|
1019
|
+
refetchInterval: l > 0 ? l : void 0,
|
|
1020
|
+
staleTime: 5e3,
|
|
1021
|
+
// Keep previous data visible while fetching new data (e.g. on time range change)
|
|
1022
|
+
// to prevent the chart from blinking empty.
|
|
1023
|
+
placeholderData: gt
|
|
1024
|
+
});
|
|
1025
|
+
return {
|
|
1026
|
+
data: p.data ?? void 0,
|
|
1027
|
+
providers: f,
|
|
1028
|
+
isLoading: h || p.isLoading,
|
|
1029
|
+
error: p.error,
|
|
1030
|
+
refetch: p.refetch
|
|
1031
|
+
};
|
|
1032
|
+
}, Ms = (e) => {
|
|
1033
|
+
const {
|
|
1034
|
+
pluginID: t,
|
|
1035
|
+
connectionID: n,
|
|
1036
|
+
resourceKey: r,
|
|
1037
|
+
resourceID: s,
|
|
1038
|
+
resourceNamespace: i = "",
|
|
1039
|
+
resourceData: o = {},
|
|
1040
|
+
metricIDs: a = [],
|
|
1041
|
+
interval: c = 1e4,
|
|
1042
|
+
enabled: l = !0
|
|
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 || !n || !r || !s))
|
|
1045
|
+
try {
|
|
1046
|
+
const C = await mn(u, n, {
|
|
1047
|
+
resource_key: r,
|
|
1048
|
+
resource_id: s,
|
|
1049
|
+
resource_namespace: i,
|
|
1050
|
+
resource_data: o,
|
|
1051
|
+
metric_ids: a,
|
|
1052
|
+
interval: c * 1e6
|
|
1053
|
+
// ms to nanoseconds for Go time.Duration
|
|
1054
|
+
});
|
|
1055
|
+
m(C), S(!0), b(null);
|
|
1056
|
+
const R = A(`core/metrics/data/${C}`, (B) => {
|
|
1057
|
+
try {
|
|
1058
|
+
const L = JSON.parse(B);
|
|
1059
|
+
L.results && h(L.results);
|
|
1060
|
+
} catch (L) {
|
|
1061
|
+
console.error("Failed to parse metric stream data:", L);
|
|
1062
|
+
}
|
|
1063
|
+
}), ie = A(`core/metrics/error/${C}`, (B) => {
|
|
1064
|
+
try {
|
|
1065
|
+
const L = JSON.parse(B);
|
|
1066
|
+
b(L.error || "Unknown error");
|
|
1067
|
+
} catch {
|
|
1068
|
+
b("Failed to parse metric stream error");
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
d.current = () => {
|
|
1072
|
+
R(), ie();
|
|
1073
|
+
};
|
|
1074
|
+
} catch (C) {
|
|
1075
|
+
b(C instanceof Error ? C.message : String(C));
|
|
1076
|
+
}
|
|
1077
|
+
}, [u, n, r, s, i, a, c, l]), E = V(async () => {
|
|
1078
|
+
if (f)
|
|
1079
|
+
try {
|
|
1080
|
+
await Je(f);
|
|
1081
|
+
} catch (C) {
|
|
1082
|
+
console.error("Failed to unsubscribe:", C);
|
|
1083
|
+
}
|
|
1084
|
+
d.current && (d.current(), d.current = null), m(null), S(!1);
|
|
1085
|
+
}, [f]);
|
|
1086
|
+
return j(() => () => {
|
|
1087
|
+
f && Je(f).catch(console.error), d.current && d.current();
|
|
1088
|
+
}, [f]), {
|
|
1089
|
+
data: y,
|
|
1090
|
+
subscriptionID: f,
|
|
1091
|
+
isStreaming: p,
|
|
1092
|
+
error: w,
|
|
1093
|
+
start: g,
|
|
1094
|
+
stop: E
|
|
1095
|
+
};
|
|
1096
|
+
}, J = ["networker", "portforward", "all-sessions"];
|
|
1097
|
+
function $s() {
|
|
1098
|
+
const { showSnackbar: e } = $(), t = G(), n = D({
|
|
1099
|
+
queryKey: [...J],
|
|
1100
|
+
queryFn: async () => gn().catch((i) => {
|
|
1101
|
+
if (K(i).detail.includes("not found")) return [];
|
|
1102
|
+
throw i;
|
|
1103
|
+
}),
|
|
1104
|
+
retry: !1
|
|
1105
|
+
});
|
|
1106
|
+
j(() => {
|
|
1107
|
+
const i = A("core/networker/portforward/created", () => {
|
|
1108
|
+
t.invalidateQueries({ queryKey: [...J] });
|
|
1109
|
+
}), o = A("core/networker/portforward/closed", () => {
|
|
1110
|
+
t.invalidateQueries({ queryKey: [...J] });
|
|
1111
|
+
});
|
|
1112
|
+
return () => {
|
|
1113
|
+
i(), o();
|
|
1114
|
+
};
|
|
1115
|
+
}, [t]);
|
|
1116
|
+
const r = n.data ?? [], s = v({
|
|
1117
|
+
mutationFn: async (i) => ft(i),
|
|
1118
|
+
onError: I(e, "Failed to close port forwarding session"),
|
|
1119
|
+
onSuccess: async () => {
|
|
1120
|
+
await t.invalidateQueries({ queryKey: [...J] });
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
return {
|
|
1124
|
+
sessions: n,
|
|
1125
|
+
activeSessions: r,
|
|
1126
|
+
closeSession: s.mutateAsync,
|
|
1127
|
+
openInBrowser: (i) => _t(`http://localhost:${i}`)
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
function Ls({ pluginID: e, connectionID: t, resourceID: n }) {
|
|
1131
|
+
const r = P(e), s = ["networker", "portforward", "sessions", r, t, n], { showSnackbar: i } = $(), o = G(), a = D({
|
|
1132
|
+
queryKey: s,
|
|
1133
|
+
queryFn: async () => _n(r, t, Xe.FindPortForwardSessionRequest.createFrom({
|
|
1134
|
+
resource_id: n,
|
|
1135
|
+
connection_id: t
|
|
1136
|
+
})).catch((u) => {
|
|
1137
|
+
const y = K(u);
|
|
1138
|
+
return y.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: y.detail }), []);
|
|
1139
|
+
}),
|
|
1140
|
+
retry: !1
|
|
1141
|
+
}), c = v({
|
|
1142
|
+
mutationFn: async ({ opts: u }) => {
|
|
1143
|
+
const y = Xe.PortForwardSessionOptions.createFrom({
|
|
1144
|
+
local_port: u.localPort || 0,
|
|
1145
|
+
remote_port: u.remotePort,
|
|
1146
|
+
protocol: u.protocol || "TCP",
|
|
1147
|
+
connection_type: "RESOURCE",
|
|
1148
|
+
connection: {
|
|
1149
|
+
resource_data: u.resource,
|
|
1150
|
+
connection_id: t,
|
|
1151
|
+
plugin_id: r,
|
|
1152
|
+
resource_id: u.resourceId,
|
|
1153
|
+
resource_key: u.resourceKey
|
|
1154
|
+
},
|
|
1155
|
+
labels: u.labels ?? {},
|
|
1156
|
+
params: u.parameters ?? {}
|
|
1157
|
+
}), h = await wn(r, t, y);
|
|
1158
|
+
return u.openInBrowser && _t(`http://localhost:${h.local_port}`), h;
|
|
1159
|
+
},
|
|
1160
|
+
onError: I(i, "Failed to start port forwarding session"),
|
|
1161
|
+
onSuccess: async () => {
|
|
1162
|
+
await Promise.all([
|
|
1163
|
+
o.invalidateQueries({ queryKey: s }),
|
|
1164
|
+
o.invalidateQueries({ queryKey: [...J] })
|
|
1165
|
+
]);
|
|
1166
|
+
}
|
|
1167
|
+
}), l = v({
|
|
1168
|
+
mutationFn: async ({ opts: u }) => ft(u.sessionID),
|
|
1169
|
+
onError: I(i, "Failed to close port forwarding session"),
|
|
1170
|
+
onSuccess: async () => {
|
|
1171
|
+
await Promise.all([
|
|
1172
|
+
o.invalidateQueries({ queryKey: s }),
|
|
1173
|
+
o.invalidateQueries({ queryKey: [...J] })
|
|
1174
|
+
]);
|
|
1175
|
+
}
|
|
1176
|
+
});
|
|
1177
|
+
return {
|
|
1178
|
+
sessions: a,
|
|
1179
|
+
forward: c.mutateAsync,
|
|
1180
|
+
close: l.mutateAsync
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
const qs = () => {
|
|
1184
|
+
const e = _.useContext(Ln);
|
|
1185
|
+
if (!e) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
|
|
1186
|
+
return e;
|
|
1187
|
+
}, Gs = ({
|
|
1188
|
+
pluginID: e,
|
|
1189
|
+
connectionID: t,
|
|
1190
|
+
resourceKey: n,
|
|
1191
|
+
resourceID: r,
|
|
1192
|
+
namespace: s = "",
|
|
1193
|
+
getParams: i = {},
|
|
1194
|
+
updateParams: o = {},
|
|
1195
|
+
deleteParams: a = {}
|
|
1196
|
+
}) => {
|
|
1197
|
+
const c = P(e), l = G(), { showSnackbar: u } = $(), y = ["RESOURCE", c, t, n, r, s], { mutateAsync: h } = v({
|
|
1198
|
+
mutationFn: async (p) => pt(c, t, n, T.UpdateInput.createFrom({
|
|
1199
|
+
params: { ...o, ...p.params },
|
|
1200
|
+
input: { ...o, ...p.input },
|
|
1201
|
+
id: r,
|
|
1202
|
+
namespace: s
|
|
1203
|
+
})),
|
|
1204
|
+
onSuccess: async () => {
|
|
1205
|
+
u(`Resource ${r} updated`, "success"), await l.invalidateQueries({ queryKey: y });
|
|
1206
|
+
},
|
|
1207
|
+
onError: I(u, `Failed to update resource ${r}`)
|
|
1208
|
+
}), { mutateAsync: f } = v({
|
|
1209
|
+
mutationFn: async (p) => yt(c, t, n, T.DeleteInput.createFrom({
|
|
1210
|
+
params: { ...a, ...p.params },
|
|
1211
|
+
input: { ...a, ...p.input },
|
|
1212
|
+
id: r,
|
|
1213
|
+
...p,
|
|
1214
|
+
namespace: s
|
|
1215
|
+
})),
|
|
1216
|
+
onSuccess: async () => {
|
|
1217
|
+
u(`Resource ${r} deleted`, "success"), await l.invalidateQueries({ queryKey: y });
|
|
1218
|
+
},
|
|
1219
|
+
onError: I(u, `Failed to delete resource ${r}`)
|
|
1220
|
+
});
|
|
1221
|
+
return {
|
|
1222
|
+
/**
|
|
1223
|
+
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1224
|
+
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1225
|
+
*/
|
|
1226
|
+
resource: D({
|
|
1227
|
+
queryKey: y,
|
|
1228
|
+
queryFn: async () => Sn(c, t, n, T.GetInput.createFrom({
|
|
1229
|
+
params: i,
|
|
1230
|
+
id: r,
|
|
1231
|
+
namespace: s
|
|
1232
|
+
})),
|
|
1233
|
+
retry: !1
|
|
1234
|
+
}),
|
|
1235
|
+
/**
|
|
1236
|
+
* Update an existing resource. A set of optional parameters can be passed to customize the update behavior,
|
|
1237
|
+
* which if specified, will add additional default behavior set via the hook options.
|
|
1238
|
+
*
|
|
1239
|
+
* @params opts Optional parameters to pass to the resource update
|
|
1240
|
+
*/
|
|
1241
|
+
update: h,
|
|
1242
|
+
/**
|
|
1243
|
+
* Delete an existing resource. A set of optional parameters can be passed to customize the delete behavior,
|
|
1244
|
+
* which if specified, will add additional default behavior set via the hook options.
|
|
1245
|
+
*
|
|
1246
|
+
* @params {object} opts Optional parameters to pass to the resource delete
|
|
1247
|
+
*/
|
|
1248
|
+
remove: f
|
|
1249
|
+
};
|
|
1250
|
+
}, Ks = (e) => {
|
|
1251
|
+
const t = ["component", e.plugin, e.resource, e.area];
|
|
1252
|
+
return {
|
|
1253
|
+
/**
|
|
1254
|
+
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1255
|
+
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1256
|
+
*/
|
|
1257
|
+
component: D({
|
|
1258
|
+
queryKey: t,
|
|
1259
|
+
queryFn: async () => Cn(e)
|
|
1260
|
+
})
|
|
1261
|
+
};
|
|
1262
|
+
}, Us = ({ pluginID: e, connectionID: t }) => {
|
|
1263
|
+
const n = P(e);
|
|
1264
|
+
return {
|
|
1265
|
+
/**
|
|
1266
|
+
* The current settings from the provider.
|
|
1267
|
+
*/
|
|
1268
|
+
groups: D({
|
|
1269
|
+
queryKey: [n, "resource_groups", "list"],
|
|
1270
|
+
queryFn: async () => En(n, t),
|
|
1271
|
+
retry: !1
|
|
1272
|
+
})
|
|
1273
|
+
};
|
|
1274
|
+
}, js = ({
|
|
1275
|
+
pluginID: e,
|
|
1276
|
+
connectionID: t,
|
|
1277
|
+
searches: n
|
|
1278
|
+
}) => {
|
|
1279
|
+
const r = P(e), s = (o) => [r, t, o.key, o.namespaces, "list"];
|
|
1280
|
+
return Tn({
|
|
1281
|
+
queries: n.map((o) => ({
|
|
1282
|
+
queryKey: s(o),
|
|
1283
|
+
queryFn: async () => ht(r, t, o.key, T.ListInput.createFrom({
|
|
1284
|
+
params: {},
|
|
1285
|
+
order: {
|
|
1286
|
+
by: "name",
|
|
1287
|
+
direction: !0
|
|
1288
|
+
},
|
|
1289
|
+
pagination: {
|
|
1290
|
+
page: 1,
|
|
1291
|
+
pageSize: 200
|
|
1292
|
+
},
|
|
1293
|
+
namespaces: o.namespaces
|
|
1294
|
+
})).then((a) => (console.log(a.result), a.result && o.postFilter ? Object.values(a.result).filter(o.postFilter) : Object.values(a.result || {}))),
|
|
1295
|
+
retry: !1
|
|
1296
|
+
}))
|
|
1297
|
+
});
|
|
1298
|
+
}, Qs = ({ pluginID: e, resourceKey: t }) => {
|
|
1299
|
+
const n = P(e);
|
|
1300
|
+
return {
|
|
1301
|
+
/**
|
|
1302
|
+
* The current settings from the provider.
|
|
1303
|
+
*/
|
|
1304
|
+
resourceType: D({
|
|
1305
|
+
queryKey: [n, "resources", t],
|
|
1306
|
+
queryFn: async () => bn(n, t),
|
|
1307
|
+
retry: !1
|
|
1308
|
+
})
|
|
1309
|
+
};
|
|
1310
|
+
}, zs = ({ pluginID: e, connectionID: t }) => {
|
|
1311
|
+
const n = P(e);
|
|
1312
|
+
return {
|
|
1313
|
+
/**
|
|
1314
|
+
* The current settings from the provider.
|
|
1315
|
+
*/
|
|
1316
|
+
types: D({
|
|
1317
|
+
queryKey: [n, "resources", "list"],
|
|
1318
|
+
queryFn: async () => vn(n, t),
|
|
1319
|
+
retry: !1
|
|
1320
|
+
})
|
|
1321
|
+
};
|
|
1322
|
+
};
|
|
1323
|
+
var Tt = Symbol.for("immer-nothing"), tt = Symbol.for("immer-draftable"), N = Symbol.for("immer-state"), Vn = process.env.NODE_ENV !== "production" ? [
|
|
1324
|
+
// All error codes, starting by 0:
|
|
1325
|
+
function(e) {
|
|
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.`;
|
|
1327
|
+
},
|
|
1328
|
+
function(e) {
|
|
1329
|
+
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
|
|
1330
|
+
},
|
|
1331
|
+
"This object has been frozen and should not be mutated",
|
|
1332
|
+
function(e) {
|
|
1333
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
|
|
1334
|
+
},
|
|
1335
|
+
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
1336
|
+
"Immer forbids circular references",
|
|
1337
|
+
"The first or second argument to `produce` must be a function",
|
|
1338
|
+
"The third argument to `produce` must be a function or undefined",
|
|
1339
|
+
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
1340
|
+
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
1341
|
+
function(e) {
|
|
1342
|
+
return `'current' expects a draft, got: ${e}`;
|
|
1343
|
+
},
|
|
1344
|
+
"Object.defineProperty() cannot be used on an Immer draft",
|
|
1345
|
+
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
1346
|
+
"Immer only supports deleting array indices",
|
|
1347
|
+
"Immer only supports setting array indices and the 'length' property",
|
|
1348
|
+
function(e) {
|
|
1349
|
+
return `'original' expects a draft, got: ${e}`;
|
|
1350
|
+
}
|
|
1351
|
+
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
1352
|
+
// See Patches.ts for additional errors
|
|
1353
|
+
] : [];
|
|
1354
|
+
function O(e, ...t) {
|
|
1355
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1356
|
+
const n = Vn[e], r = typeof n == "function" ? n.apply(null, t) : n;
|
|
1357
|
+
throw new Error(`[Immer] ${r}`);
|
|
1358
|
+
}
|
|
1359
|
+
throw new Error(
|
|
1360
|
+
`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
|
|
1361
|
+
);
|
|
1362
|
+
}
|
|
1363
|
+
var Z = Object.getPrototypeOf;
|
|
1364
|
+
function ee(e) {
|
|
1365
|
+
return !!e && !!e[N];
|
|
1366
|
+
}
|
|
1367
|
+
function Q(e) {
|
|
1368
|
+
var t;
|
|
1369
|
+
return e ? Nt(e) || Array.isArray(e) || !!e[tt] || !!((t = e.constructor) != null && t[tt]) || _e(e) || we(e) : !1;
|
|
1370
|
+
}
|
|
1371
|
+
var Xn = Object.prototype.constructor.toString();
|
|
1372
|
+
function Nt(e) {
|
|
1373
|
+
if (!e || typeof e != "object")
|
|
1374
|
+
return !1;
|
|
1375
|
+
const t = Z(e);
|
|
1376
|
+
if (t === null)
|
|
1377
|
+
return !0;
|
|
1378
|
+
const n = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
|
|
1379
|
+
return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) === Xn;
|
|
1380
|
+
}
|
|
1381
|
+
function pe(e, t) {
|
|
1382
|
+
ge(e) === 0 ? Reflect.ownKeys(e).forEach((n) => {
|
|
1383
|
+
t(n, e[n], e);
|
|
1384
|
+
}) : e.forEach((n, r) => t(r, n, e));
|
|
1385
|
+
}
|
|
1386
|
+
function ge(e) {
|
|
1387
|
+
const t = e[N];
|
|
1388
|
+
return t ? t.type_ : Array.isArray(e) ? 1 : _e(e) ? 2 : we(e) ? 3 : 0;
|
|
1389
|
+
}
|
|
1390
|
+
function Ae(e, t) {
|
|
1391
|
+
return ge(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
1392
|
+
}
|
|
1393
|
+
function kt(e, t, n) {
|
|
1394
|
+
const r = ge(e);
|
|
1395
|
+
r === 2 ? e.set(t, n) : r === 3 ? e.add(n) : e[t] = n;
|
|
1396
|
+
}
|
|
1397
|
+
function Zn(e, t) {
|
|
1398
|
+
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
1399
|
+
}
|
|
1400
|
+
function _e(e) {
|
|
1401
|
+
return e instanceof Map;
|
|
1402
|
+
}
|
|
1403
|
+
function we(e) {
|
|
1404
|
+
return e instanceof Set;
|
|
1405
|
+
}
|
|
1406
|
+
function U(e) {
|
|
1407
|
+
return e.copy_ || e.base_;
|
|
1408
|
+
}
|
|
1409
|
+
function Te(e, t) {
|
|
1410
|
+
if (_e(e))
|
|
1411
|
+
return new Map(e);
|
|
1412
|
+
if (we(e))
|
|
1413
|
+
return new Set(e);
|
|
1414
|
+
if (Array.isArray(e))
|
|
1415
|
+
return Array.prototype.slice.call(e);
|
|
1416
|
+
const n = Nt(e);
|
|
1417
|
+
if (t === !0 || t === "class_only" && !n) {
|
|
1418
|
+
const r = Object.getOwnPropertyDescriptors(e);
|
|
1419
|
+
delete r[N];
|
|
1420
|
+
let s = Reflect.ownKeys(r);
|
|
1421
|
+
for (let i = 0; i < s.length; i++) {
|
|
1422
|
+
const o = s[i], a = r[o];
|
|
1423
|
+
a.writable === !1 && (a.writable = !0, a.configurable = !0), (a.get || a.set) && (r[o] = {
|
|
1424
|
+
configurable: !0,
|
|
1425
|
+
writable: !0,
|
|
1426
|
+
// could live with !!desc.set as well here...
|
|
1427
|
+
enumerable: a.enumerable,
|
|
1428
|
+
value: e[o]
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
return Object.create(Z(e), r);
|
|
1432
|
+
} else {
|
|
1433
|
+
const r = Z(e);
|
|
1434
|
+
if (r !== null && n)
|
|
1435
|
+
return { ...e };
|
|
1436
|
+
const s = Object.create(r);
|
|
1437
|
+
return Object.assign(s, e);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
function Ge(e, t = !1) {
|
|
1441
|
+
return Se(e) || ee(e) || !Q(e) || (ge(e) > 1 && (e.set = e.add = e.clear = e.delete = er), Object.freeze(e), t && Object.entries(e).forEach(([n, r]) => Ge(r, !0))), e;
|
|
1442
|
+
}
|
|
1443
|
+
function er() {
|
|
1444
|
+
O(2);
|
|
1445
|
+
}
|
|
1446
|
+
function Se(e) {
|
|
1447
|
+
return Object.isFrozen(e);
|
|
1448
|
+
}
|
|
1449
|
+
var tr = {};
|
|
1450
|
+
function z(e) {
|
|
1451
|
+
const t = tr[e];
|
|
1452
|
+
return t || O(0, e), t;
|
|
1453
|
+
}
|
|
1454
|
+
var re;
|
|
1455
|
+
function Rt() {
|
|
1456
|
+
return re;
|
|
1457
|
+
}
|
|
1458
|
+
function nr(e, t) {
|
|
1459
|
+
return {
|
|
1460
|
+
drafts_: [],
|
|
1461
|
+
parent_: e,
|
|
1462
|
+
immer_: t,
|
|
1463
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
1464
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
1465
|
+
canAutoFreeze_: !0,
|
|
1466
|
+
unfinalizedDrafts_: 0
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
function nt(e, t) {
|
|
1470
|
+
t && (z("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
1471
|
+
}
|
|
1472
|
+
function Ne(e) {
|
|
1473
|
+
ke(e), e.drafts_.forEach(rr), e.drafts_ = null;
|
|
1474
|
+
}
|
|
1475
|
+
function ke(e) {
|
|
1476
|
+
e === re && (re = e.parent_);
|
|
1477
|
+
}
|
|
1478
|
+
function rt(e) {
|
|
1479
|
+
return re = nr(re, e);
|
|
1480
|
+
}
|
|
1481
|
+
function rr(e) {
|
|
1482
|
+
const t = e[N];
|
|
1483
|
+
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
|
|
1484
|
+
}
|
|
1485
|
+
function st(e, t) {
|
|
1486
|
+
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
1487
|
+
const n = t.drafts_[0];
|
|
1488
|
+
return e !== void 0 && e !== n ? (n[N].modified_ && (Ne(t), O(4)), Q(e) && (e = ye(t, e), t.parent_ || he(t, e)), t.patches_ && z("Patches").generateReplacementPatches_(
|
|
1489
|
+
n[N].base_,
|
|
1490
|
+
e,
|
|
1491
|
+
t.patches_,
|
|
1492
|
+
t.inversePatches_
|
|
1493
|
+
)) : e = ye(t, n, []), Ne(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Tt ? e : void 0;
|
|
1494
|
+
}
|
|
1495
|
+
function ye(e, t, n) {
|
|
1496
|
+
if (Se(t))
|
|
1497
|
+
return t;
|
|
1498
|
+
const r = t[N];
|
|
1499
|
+
if (!r)
|
|
1500
|
+
return pe(
|
|
1501
|
+
t,
|
|
1502
|
+
(s, i) => ot(e, r, t, s, i, n)
|
|
1503
|
+
), t;
|
|
1504
|
+
if (r.scope_ !== e)
|
|
1505
|
+
return t;
|
|
1506
|
+
if (!r.modified_)
|
|
1507
|
+
return he(e, r.base_, !0), r.base_;
|
|
1508
|
+
if (!r.finalized_) {
|
|
1509
|
+
r.finalized_ = !0, r.scope_.unfinalizedDrafts_--;
|
|
1510
|
+
const s = r.copy_;
|
|
1511
|
+
let i = s, o = !1;
|
|
1512
|
+
r.type_ === 3 && (i = new Set(s), s.clear(), o = !0), pe(
|
|
1513
|
+
i,
|
|
1514
|
+
(a, c) => ot(e, r, s, a, c, n, o)
|
|
1515
|
+
), he(e, s, !1), n && e.patches_ && z("Patches").generatePatches_(
|
|
1516
|
+
r,
|
|
1517
|
+
n,
|
|
1518
|
+
e.patches_,
|
|
1519
|
+
e.inversePatches_
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1522
|
+
return r.copy_;
|
|
1523
|
+
}
|
|
1524
|
+
function ot(e, t, n, r, s, i, o) {
|
|
1525
|
+
if (process.env.NODE_ENV !== "production" && s === n && O(5), ee(s)) {
|
|
1526
|
+
const a = i && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
1527
|
+
!Ae(t.assigned_, r) ? i.concat(r) : void 0, c = ye(e, s, a);
|
|
1528
|
+
if (kt(n, r, c), ee(c))
|
|
1529
|
+
e.canAutoFreeze_ = !1;
|
|
1530
|
+
else
|
|
1531
|
+
return;
|
|
1532
|
+
} else o && n.add(s);
|
|
1533
|
+
if (Q(s) && !Se(s)) {
|
|
1534
|
+
if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
|
|
1535
|
+
return;
|
|
1536
|
+
ye(e, s), (!t || !t.scope_.parent_) && typeof r != "symbol" && Object.prototype.propertyIsEnumerable.call(n, r) && he(e, s);
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
function he(e, t, n = !1) {
|
|
1540
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && Ge(t, n);
|
|
1541
|
+
}
|
|
1542
|
+
function sr(e, t) {
|
|
1543
|
+
const n = Array.isArray(e), r = {
|
|
1544
|
+
type_: n ? 1 : 0,
|
|
1545
|
+
// Track which produce call this is associated with.
|
|
1546
|
+
scope_: t ? t.scope_ : Rt(),
|
|
1547
|
+
// True for both shallow and deep changes.
|
|
1548
|
+
modified_: !1,
|
|
1549
|
+
// Used during finalization.
|
|
1550
|
+
finalized_: !1,
|
|
1551
|
+
// Track which properties have been assigned (true) or deleted (false).
|
|
1552
|
+
assigned_: {},
|
|
1553
|
+
// The parent draft state.
|
|
1554
|
+
parent_: t,
|
|
1555
|
+
// The base state.
|
|
1556
|
+
base_: e,
|
|
1557
|
+
// The base proxy.
|
|
1558
|
+
draft_: null,
|
|
1559
|
+
// set below
|
|
1560
|
+
// The base copy with any updated values.
|
|
1561
|
+
copy_: null,
|
|
1562
|
+
// Called by the `produce` function.
|
|
1563
|
+
revoke_: null,
|
|
1564
|
+
isManual_: !1
|
|
1565
|
+
};
|
|
1566
|
+
let s = r, i = Ke;
|
|
1567
|
+
n && (s = [r], i = se);
|
|
1568
|
+
const { revoke: o, proxy: a } = Proxy.revocable(s, i);
|
|
1569
|
+
return r.draft_ = a, r.revoke_ = o, a;
|
|
1570
|
+
}
|
|
1571
|
+
var Ke = {
|
|
1572
|
+
get(e, t) {
|
|
1573
|
+
if (t === N)
|
|
1574
|
+
return e;
|
|
1575
|
+
const n = U(e);
|
|
1576
|
+
if (!Ae(n, t))
|
|
1577
|
+
return or(e, n, t);
|
|
1578
|
+
const r = n[t];
|
|
1579
|
+
return e.finalized_ || !Q(r) ? r : r === Pe(e.base_, t) ? (De(e), e.copy_[t] = Me(r, e)) : r;
|
|
1580
|
+
},
|
|
1581
|
+
has(e, t) {
|
|
1582
|
+
return t in U(e);
|
|
1583
|
+
},
|
|
1584
|
+
ownKeys(e) {
|
|
1585
|
+
return Reflect.ownKeys(U(e));
|
|
1586
|
+
},
|
|
1587
|
+
set(e, t, n) {
|
|
1588
|
+
const r = Mt(U(e), t);
|
|
1589
|
+
if (r != null && r.set)
|
|
1590
|
+
return r.set.call(e.draft_, n), !0;
|
|
1591
|
+
if (!e.modified_) {
|
|
1592
|
+
const s = Pe(U(e), t), i = s == null ? void 0 : s[N];
|
|
1593
|
+
if (i && i.base_ === n)
|
|
1594
|
+
return e.copy_[t] = n, e.assigned_[t] = !1, !0;
|
|
1595
|
+
if (Zn(n, s) && (n !== void 0 || Ae(e.base_, t)))
|
|
1596
|
+
return !0;
|
|
1597
|
+
De(e), Re(e);
|
|
1598
|
+
}
|
|
1599
|
+
return e.copy_[t] === n && // special case: handle new props with value 'undefined'
|
|
1600
|
+
(n !== void 0 || t in e.copy_) || // special case: NaN
|
|
1601
|
+
Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n, e.assigned_[t] = !0), !0;
|
|
1602
|
+
},
|
|
1603
|
+
deleteProperty(e, t) {
|
|
1604
|
+
return Pe(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, De(e), Re(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
|
|
1605
|
+
},
|
|
1606
|
+
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
1607
|
+
// the same guarantee in ES5 mode.
|
|
1608
|
+
getOwnPropertyDescriptor(e, t) {
|
|
1609
|
+
const n = U(e), r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
1610
|
+
return r && {
|
|
1611
|
+
writable: !0,
|
|
1612
|
+
configurable: e.type_ !== 1 || t !== "length",
|
|
1613
|
+
enumerable: r.enumerable,
|
|
1614
|
+
value: n[t]
|
|
1615
|
+
};
|
|
1616
|
+
},
|
|
1617
|
+
defineProperty() {
|
|
1618
|
+
O(11);
|
|
1619
|
+
},
|
|
1620
|
+
getPrototypeOf(e) {
|
|
1621
|
+
return Z(e.base_);
|
|
1622
|
+
},
|
|
1623
|
+
setPrototypeOf() {
|
|
1624
|
+
O(12);
|
|
1625
|
+
}
|
|
1626
|
+
}, se = {};
|
|
1627
|
+
pe(Ke, (e, t) => {
|
|
1628
|
+
se[e] = function() {
|
|
1629
|
+
return arguments[0] = arguments[0][0], t.apply(this, arguments);
|
|
1630
|
+
};
|
|
1631
|
+
});
|
|
1632
|
+
se.deleteProperty = function(e, t) {
|
|
1633
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && O(13), se.set.call(this, e, t, void 0);
|
|
1634
|
+
};
|
|
1635
|
+
se.set = function(e, t, n) {
|
|
1636
|
+
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && O(14), Ke.set.call(this, e[0], t, n, e[0]);
|
|
1637
|
+
};
|
|
1638
|
+
function Pe(e, t) {
|
|
1639
|
+
const n = e[N];
|
|
1640
|
+
return (n ? U(n) : e)[t];
|
|
1641
|
+
}
|
|
1642
|
+
function or(e, t, n) {
|
|
1643
|
+
var s;
|
|
1644
|
+
const r = Mt(t, n);
|
|
1645
|
+
return r ? "value" in r ? r.value : (
|
|
1646
|
+
// This is a very special case, if the prop is a getter defined by the
|
|
1647
|
+
// prototype, we should invoke it with the draft as context!
|
|
1648
|
+
(s = r.get) == null ? void 0 : s.call(e.draft_)
|
|
1649
|
+
) : void 0;
|
|
1650
|
+
}
|
|
1651
|
+
function Mt(e, t) {
|
|
1652
|
+
if (!(t in e))
|
|
1653
|
+
return;
|
|
1654
|
+
let n = Z(e);
|
|
1655
|
+
for (; n; ) {
|
|
1656
|
+
const r = Object.getOwnPropertyDescriptor(n, t);
|
|
1657
|
+
if (r)
|
|
1658
|
+
return r;
|
|
1659
|
+
n = Z(n);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
function Re(e) {
|
|
1663
|
+
e.modified_ || (e.modified_ = !0, e.parent_ && Re(e.parent_));
|
|
1664
|
+
}
|
|
1665
|
+
function De(e) {
|
|
1666
|
+
e.copy_ || (e.copy_ = Te(
|
|
1667
|
+
e.base_,
|
|
1668
|
+
e.scope_.immer_.useStrictShallowCopy_
|
|
1669
|
+
));
|
|
1670
|
+
}
|
|
1671
|
+
var ir = class {
|
|
1672
|
+
constructor(e) {
|
|
1673
|
+
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, n, r) => {
|
|
1674
|
+
if (typeof t == "function" && typeof n != "function") {
|
|
1675
|
+
const i = n;
|
|
1676
|
+
n = t;
|
|
1677
|
+
const o = this;
|
|
1678
|
+
return function(c = i, ...l) {
|
|
1679
|
+
return o.produce(c, (u) => n.call(this, u, ...l));
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1682
|
+
typeof n != "function" && O(6), r !== void 0 && typeof r != "function" && O(7);
|
|
1683
|
+
let s;
|
|
1684
|
+
if (Q(t)) {
|
|
1685
|
+
const i = rt(this), o = Me(t, void 0);
|
|
1686
|
+
let a = !0;
|
|
1687
|
+
try {
|
|
1688
|
+
s = n(o), a = !1;
|
|
1689
|
+
} finally {
|
|
1690
|
+
a ? Ne(i) : ke(i);
|
|
1691
|
+
}
|
|
1692
|
+
return nt(i, r), st(s, i);
|
|
1693
|
+
} else if (!t || typeof t != "object") {
|
|
1694
|
+
if (s = n(t), s === void 0 && (s = t), s === Tt && (s = void 0), this.autoFreeze_ && Ge(s, !0), r) {
|
|
1695
|
+
const i = [], o = [];
|
|
1696
|
+
z("Patches").generateReplacementPatches_(t, s, i, o), r(i, o);
|
|
1697
|
+
}
|
|
1698
|
+
return s;
|
|
1699
|
+
} else
|
|
1700
|
+
O(1, t);
|
|
1701
|
+
}, this.produceWithPatches = (t, n) => {
|
|
1702
|
+
if (typeof t == "function")
|
|
1703
|
+
return (o, ...a) => this.produceWithPatches(o, (c) => t(c, ...a));
|
|
1704
|
+
let r, s;
|
|
1705
|
+
return [this.produce(t, n, (o, a) => {
|
|
1706
|
+
r = o, s = a;
|
|
1707
|
+
}), r, s];
|
|
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
|
+
}
|
|
1710
|
+
createDraft(e) {
|
|
1711
|
+
Q(e) || O(8), ee(e) && (e = ar(e));
|
|
1712
|
+
const t = rt(this), n = Me(e, void 0);
|
|
1713
|
+
return n[N].isManual_ = !0, ke(t), n;
|
|
1714
|
+
}
|
|
1715
|
+
finishDraft(e, t) {
|
|
1716
|
+
const n = e && e[N];
|
|
1717
|
+
(!n || !n.isManual_) && O(9);
|
|
1718
|
+
const { scope_: r } = n;
|
|
1719
|
+
return nt(r, t), st(void 0, r);
|
|
1720
|
+
}
|
|
1721
|
+
/**
|
|
1722
|
+
* Pass true to automatically freeze all copies created by Immer.
|
|
1723
|
+
*
|
|
1724
|
+
* By default, auto-freezing is enabled.
|
|
1725
|
+
*/
|
|
1726
|
+
setAutoFreeze(e) {
|
|
1727
|
+
this.autoFreeze_ = e;
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Pass true to enable strict shallow copy.
|
|
1731
|
+
*
|
|
1732
|
+
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
1733
|
+
*/
|
|
1734
|
+
setUseStrictShallowCopy(e) {
|
|
1735
|
+
this.useStrictShallowCopy_ = e;
|
|
1736
|
+
}
|
|
1737
|
+
applyPatches(e, t) {
|
|
1738
|
+
let n;
|
|
1739
|
+
for (n = t.length - 1; n >= 0; n--) {
|
|
1740
|
+
const s = t[n];
|
|
1741
|
+
if (s.path.length === 0 && s.op === "replace") {
|
|
1742
|
+
e = s.value;
|
|
1743
|
+
break;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
n > -1 && (t = t.slice(n + 1));
|
|
1747
|
+
const r = z("Patches").applyPatches_;
|
|
1748
|
+
return ee(e) ? r(e, t) : this.produce(
|
|
1749
|
+
e,
|
|
1750
|
+
(s) => r(s, t)
|
|
1751
|
+
);
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
function Me(e, t) {
|
|
1755
|
+
const n = _e(e) ? z("MapSet").proxyMap_(e, t) : we(e) ? z("MapSet").proxySet_(e, t) : sr(e, t);
|
|
1756
|
+
return (t ? t.scope_ : Rt()).drafts_.push(n), n;
|
|
1757
|
+
}
|
|
1758
|
+
function ar(e) {
|
|
1759
|
+
return ee(e) || O(10, e), $t(e);
|
|
1760
|
+
}
|
|
1761
|
+
function $t(e) {
|
|
1762
|
+
if (!Q(e) || Se(e))
|
|
1763
|
+
return e;
|
|
1764
|
+
const t = e[N];
|
|
1765
|
+
let n;
|
|
1766
|
+
if (t) {
|
|
1767
|
+
if (!t.modified_)
|
|
1768
|
+
return t.base_;
|
|
1769
|
+
t.finalized_ = !0, n = Te(e, t.scope_.immer_.useStrictShallowCopy_);
|
|
1770
|
+
} else
|
|
1771
|
+
n = Te(e, !0);
|
|
1772
|
+
return pe(n, (r, s) => {
|
|
1773
|
+
kt(n, r, $t(s));
|
|
1774
|
+
}), t && (t.finalized_ = !1), n;
|
|
1775
|
+
}
|
|
1776
|
+
var k = new ir(), le = k.produce;
|
|
1777
|
+
k.produceWithPatches.bind(
|
|
1778
|
+
k
|
|
1779
|
+
);
|
|
1780
|
+
k.setAutoFreeze.bind(k);
|
|
1781
|
+
k.setUseStrictShallowCopy.bind(k);
|
|
1782
|
+
k.applyPatches.bind(k);
|
|
1783
|
+
k.createDraft.bind(k);
|
|
1784
|
+
k.finishDraft.bind(k);
|
|
1785
|
+
var ue = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1786
|
+
function cr(e) {
|
|
1787
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1788
|
+
}
|
|
1789
|
+
var ur = "Expected a function", Lt = "__lodash_hash_undefined__", lr = "[object Function]", dr = "[object GeneratorFunction]", fr = "[object Symbol]", pr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, yr = /^\w*$/, hr = /^\./, mr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, gr = /[\\^$.*+?()[\]{}|]/g, _r = /\\(\\)?/g, wr = /^\[object .+?Constructor\]$/, Sr = typeof ue == "object" && ue && ue.Object === Object && ue, Cr = typeof self == "object" && self && self.Object === Object && self, Ue = Sr || Cr || Function("return this")();
|
|
1790
|
+
function Er(e, t) {
|
|
1791
|
+
return e == null ? void 0 : e[t];
|
|
1792
|
+
}
|
|
1793
|
+
function br(e) {
|
|
1794
|
+
var t = !1;
|
|
1795
|
+
if (e != null && typeof e.toString != "function")
|
|
1796
|
+
try {
|
|
1797
|
+
t = !!(e + "");
|
|
1798
|
+
} catch {
|
|
1799
|
+
}
|
|
1800
|
+
return t;
|
|
1801
|
+
}
|
|
1802
|
+
var vr = Array.prototype, Pr = Function.prototype, qt = Object.prototype, Fe = Ue["__core-js_shared__"], it = function() {
|
|
1803
|
+
var e = /[^.]+$/.exec(Fe && Fe.keys && Fe.keys.IE_PROTO || "");
|
|
1804
|
+
return e ? "Symbol(src)_1." + e : "";
|
|
1805
|
+
}(), Gt = Pr.toString, je = qt.hasOwnProperty, Kt = qt.toString, Dr = RegExp(
|
|
1806
|
+
"^" + Gt.call(je).replace(gr, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1807
|
+
), at = Ue.Symbol, Fr = vr.splice, xr = Ut(Ue, "Map"), oe = Ut(Object, "create"), ct = at ? at.prototype : void 0, ut = ct ? ct.toString : void 0;
|
|
1808
|
+
function W(e) {
|
|
1809
|
+
var t = -1, n = e ? e.length : 0;
|
|
1810
|
+
for (this.clear(); ++t < n; ) {
|
|
1811
|
+
var r = e[t];
|
|
1812
|
+
this.set(r[0], r[1]);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
function Ir() {
|
|
1816
|
+
this.__data__ = oe ? oe(null) : {};
|
|
1817
|
+
}
|
|
1818
|
+
function Or(e) {
|
|
1819
|
+
return this.has(e) && delete this.__data__[e];
|
|
1820
|
+
}
|
|
1821
|
+
function Ar(e) {
|
|
1822
|
+
var t = this.__data__;
|
|
1823
|
+
if (oe) {
|
|
1824
|
+
var n = t[e];
|
|
1825
|
+
return n === Lt ? void 0 : n;
|
|
1826
|
+
}
|
|
1827
|
+
return je.call(t, e) ? t[e] : void 0;
|
|
1828
|
+
}
|
|
1829
|
+
function Tr(e) {
|
|
1830
|
+
var t = this.__data__;
|
|
1831
|
+
return oe ? t[e] !== void 0 : je.call(t, e);
|
|
1832
|
+
}
|
|
1833
|
+
function Nr(e, t) {
|
|
1834
|
+
var n = this.__data__;
|
|
1835
|
+
return n[e] = oe && t === void 0 ? Lt : t, this;
|
|
1836
|
+
}
|
|
1837
|
+
W.prototype.clear = Ir;
|
|
1838
|
+
W.prototype.delete = Or;
|
|
1839
|
+
W.prototype.get = Ar;
|
|
1840
|
+
W.prototype.has = Tr;
|
|
1841
|
+
W.prototype.set = Nr;
|
|
1842
|
+
function ne(e) {
|
|
1843
|
+
var t = -1, n = e ? e.length : 0;
|
|
1844
|
+
for (this.clear(); ++t < n; ) {
|
|
1845
|
+
var r = e[t];
|
|
1846
|
+
this.set(r[0], r[1]);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
function kr() {
|
|
1850
|
+
this.__data__ = [];
|
|
1851
|
+
}
|
|
1852
|
+
function Rr(e) {
|
|
1853
|
+
var t = this.__data__, n = Ce(t, e);
|
|
1854
|
+
if (n < 0)
|
|
1855
|
+
return !1;
|
|
1856
|
+
var r = t.length - 1;
|
|
1857
|
+
return n == r ? t.pop() : Fr.call(t, n, 1), !0;
|
|
1858
|
+
}
|
|
1859
|
+
function Mr(e) {
|
|
1860
|
+
var t = this.__data__, n = Ce(t, e);
|
|
1861
|
+
return n < 0 ? void 0 : t[n][1];
|
|
1862
|
+
}
|
|
1863
|
+
function $r(e) {
|
|
1864
|
+
return Ce(this.__data__, e) > -1;
|
|
1865
|
+
}
|
|
1866
|
+
function Lr(e, t) {
|
|
1867
|
+
var n = this.__data__, r = Ce(n, e);
|
|
1868
|
+
return r < 0 ? n.push([e, t]) : n[r][1] = t, this;
|
|
1869
|
+
}
|
|
1870
|
+
ne.prototype.clear = kr;
|
|
1871
|
+
ne.prototype.delete = Rr;
|
|
1872
|
+
ne.prototype.get = Mr;
|
|
1873
|
+
ne.prototype.has = $r;
|
|
1874
|
+
ne.prototype.set = Lr;
|
|
1875
|
+
function H(e) {
|
|
1876
|
+
var t = -1, n = e ? e.length : 0;
|
|
1877
|
+
for (this.clear(); ++t < n; ) {
|
|
1878
|
+
var r = e[t];
|
|
1879
|
+
this.set(r[0], r[1]);
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
function qr() {
|
|
1883
|
+
this.__data__ = {
|
|
1884
|
+
hash: new W(),
|
|
1885
|
+
map: new (xr || ne)(),
|
|
1886
|
+
string: new W()
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
function Gr(e) {
|
|
1890
|
+
return Ee(this, e).delete(e);
|
|
1891
|
+
}
|
|
1892
|
+
function Kr(e) {
|
|
1893
|
+
return Ee(this, e).get(e);
|
|
1894
|
+
}
|
|
1895
|
+
function Ur(e) {
|
|
1896
|
+
return Ee(this, e).has(e);
|
|
1897
|
+
}
|
|
1898
|
+
function jr(e, t) {
|
|
1899
|
+
return Ee(this, e).set(e, t), this;
|
|
1900
|
+
}
|
|
1901
|
+
H.prototype.clear = qr;
|
|
1902
|
+
H.prototype.delete = Gr;
|
|
1903
|
+
H.prototype.get = Kr;
|
|
1904
|
+
H.prototype.has = Ur;
|
|
1905
|
+
H.prototype.set = jr;
|
|
1906
|
+
function Ce(e, t) {
|
|
1907
|
+
for (var n = e.length; n--; )
|
|
1908
|
+
if (es(e[n][0], t))
|
|
1909
|
+
return n;
|
|
1910
|
+
return -1;
|
|
1911
|
+
}
|
|
1912
|
+
function Qr(e, t) {
|
|
1913
|
+
t = Br(t, e) ? [t] : Hr(t);
|
|
1914
|
+
for (var n = 0, r = t.length; e != null && n < r; )
|
|
1915
|
+
e = e[Xr(t[n++])];
|
|
1916
|
+
return n && n == r ? e : void 0;
|
|
1917
|
+
}
|
|
1918
|
+
function zr(e) {
|
|
1919
|
+
if (!Qt(e) || Jr(e))
|
|
1920
|
+
return !1;
|
|
1921
|
+
var t = ts(e) || br(e) ? Dr : wr;
|
|
1922
|
+
return t.test(Zr(e));
|
|
1923
|
+
}
|
|
1924
|
+
function Wr(e) {
|
|
1925
|
+
if (typeof e == "string")
|
|
1926
|
+
return e;
|
|
1927
|
+
if (ze(e))
|
|
1928
|
+
return ut ? ut.call(e) : "";
|
|
1929
|
+
var t = e + "";
|
|
1930
|
+
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
1931
|
+
}
|
|
1932
|
+
function Hr(e) {
|
|
1933
|
+
return jt(e) ? e : Vr(e);
|
|
1934
|
+
}
|
|
1935
|
+
function Ee(e, t) {
|
|
1936
|
+
var n = e.__data__;
|
|
1937
|
+
return Yr(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
|
|
1938
|
+
}
|
|
1939
|
+
function Ut(e, t) {
|
|
1940
|
+
var n = Er(e, t);
|
|
1941
|
+
return zr(n) ? n : void 0;
|
|
1942
|
+
}
|
|
1943
|
+
function Br(e, t) {
|
|
1944
|
+
if (jt(e))
|
|
1945
|
+
return !1;
|
|
1946
|
+
var n = typeof e;
|
|
1947
|
+
return n == "number" || n == "symbol" || n == "boolean" || e == null || ze(e) ? !0 : yr.test(e) || !pr.test(e) || t != null && e in Object(t);
|
|
1948
|
+
}
|
|
1949
|
+
function Yr(e) {
|
|
1950
|
+
var t = typeof e;
|
|
1951
|
+
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
|
|
1952
|
+
}
|
|
1953
|
+
function Jr(e) {
|
|
1954
|
+
return !!it && it in e;
|
|
1955
|
+
}
|
|
1956
|
+
var Vr = Qe(function(e) {
|
|
1957
|
+
e = rs(e);
|
|
1958
|
+
var t = [];
|
|
1959
|
+
return hr.test(e) && t.push(""), e.replace(mr, function(n, r, s, i) {
|
|
1960
|
+
t.push(s ? i.replace(_r, "$1") : r || n);
|
|
1961
|
+
}), t;
|
|
1962
|
+
});
|
|
1963
|
+
function Xr(e) {
|
|
1964
|
+
if (typeof e == "string" || ze(e))
|
|
1965
|
+
return e;
|
|
1966
|
+
var t = e + "";
|
|
1967
|
+
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
1968
|
+
}
|
|
1969
|
+
function Zr(e) {
|
|
1970
|
+
if (e != null) {
|
|
1971
|
+
try {
|
|
1972
|
+
return Gt.call(e);
|
|
1973
|
+
} catch {
|
|
1974
|
+
}
|
|
1975
|
+
try {
|
|
1976
|
+
return e + "";
|
|
1977
|
+
} catch {
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
return "";
|
|
1981
|
+
}
|
|
1982
|
+
function Qe(e, t) {
|
|
1983
|
+
if (typeof e != "function" || t && typeof t != "function")
|
|
1984
|
+
throw new TypeError(ur);
|
|
1985
|
+
var n = function() {
|
|
1986
|
+
var r = arguments, s = t ? t.apply(this, r) : r[0], i = n.cache;
|
|
1987
|
+
if (i.has(s))
|
|
1988
|
+
return i.get(s);
|
|
1989
|
+
var o = e.apply(this, r);
|
|
1990
|
+
return n.cache = i.set(s, o), o;
|
|
1991
|
+
};
|
|
1992
|
+
return n.cache = new (Qe.Cache || H)(), n;
|
|
1993
|
+
}
|
|
1994
|
+
Qe.Cache = H;
|
|
1995
|
+
function es(e, t) {
|
|
1996
|
+
return e === t || e !== e && t !== t;
|
|
1997
|
+
}
|
|
1998
|
+
var jt = Array.isArray;
|
|
1999
|
+
function ts(e) {
|
|
2000
|
+
var t = Qt(e) ? Kt.call(e) : "";
|
|
2001
|
+
return t == lr || t == dr;
|
|
2002
|
+
}
|
|
2003
|
+
function Qt(e) {
|
|
2004
|
+
var t = typeof e;
|
|
2005
|
+
return !!e && (t == "object" || t == "function");
|
|
2006
|
+
}
|
|
2007
|
+
function ns(e) {
|
|
2008
|
+
return !!e && typeof e == "object";
|
|
2009
|
+
}
|
|
2010
|
+
function ze(e) {
|
|
2011
|
+
return typeof e == "symbol" || ns(e) && Kt.call(e) == fr;
|
|
2012
|
+
}
|
|
2013
|
+
function rs(e) {
|
|
2014
|
+
return e == null ? "" : Wr(e);
|
|
2015
|
+
}
|
|
2016
|
+
function ss(e, t, n) {
|
|
2017
|
+
var r = e == null ? void 0 : Qr(e, t);
|
|
2018
|
+
return r === void 0 ? n : r;
|
|
2019
|
+
}
|
|
2020
|
+
var os = ss;
|
|
2021
|
+
const Y = /* @__PURE__ */ cr(os), Ws = ({
|
|
2022
|
+
pluginID: e,
|
|
2023
|
+
connectionID: t,
|
|
2024
|
+
resourceKey: n,
|
|
2025
|
+
idAccessor: r,
|
|
2026
|
+
namespaces: s = [],
|
|
2027
|
+
listParams: i = {},
|
|
2028
|
+
createParams: o = {}
|
|
2029
|
+
}) => {
|
|
2030
|
+
const a = P(e), c = G(), { showSnackbar: l } = $(), u = [a, t, n, s, "list"], y = (d, g) => [a, t, n, g, d];
|
|
2031
|
+
console.log("getting from key: ", `${a}/${t}/${n}`);
|
|
2032
|
+
const { mutateAsync: h } = v({
|
|
2033
|
+
mutationFn: async (d) => mt(a, t, n, T.CreateInput.createFrom({
|
|
2034
|
+
params: d.params || o,
|
|
2035
|
+
input: d.input,
|
|
2036
|
+
namespaces: s
|
|
2037
|
+
})),
|
|
2038
|
+
onSuccess: async (d) => {
|
|
2039
|
+
var C, R, ie, B, L, We, He, Be;
|
|
2040
|
+
let g = "";
|
|
2041
|
+
(C = d.result.metadata) != null && C.name ? g = d.result.metadata.name : (R = d.result) != null && R.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
|
+
const E = g ? `Resource ${g} created` : "Resource created";
|
|
2043
|
+
l(E, "success"), await c.invalidateQueries({ queryKey: u });
|
|
2044
|
+
},
|
|
2045
|
+
onError: I(l, "Failed to create resource")
|
|
2046
|
+
}), f = D({
|
|
2047
|
+
queryKey: u,
|
|
2048
|
+
queryFn: async () => ht(a, t, n, T.ListInput.createFrom({
|
|
2049
|
+
params: i,
|
|
2050
|
+
order: {
|
|
2051
|
+
by: "name",
|
|
2052
|
+
direction: !0
|
|
2053
|
+
},
|
|
2054
|
+
pagination: {
|
|
2055
|
+
page: 1,
|
|
2056
|
+
pageSize: 200
|
|
2057
|
+
},
|
|
2058
|
+
namespaces: s
|
|
2059
|
+
})),
|
|
2060
|
+
placeholderData: (d, g) => d,
|
|
2061
|
+
retry: !1
|
|
2062
|
+
}), m = _.useCallback((d) => {
|
|
2063
|
+
console.log("got a new resource", d), r && (c.setQueryData(u, (g) => le(g, (E) => {
|
|
2064
|
+
if (E || (E = T.ListResult.createFrom({
|
|
2065
|
+
result: [],
|
|
2066
|
+
success: !0,
|
|
2067
|
+
pagination: {}
|
|
2068
|
+
})), E.result.findIndex((R) => Y(d.data, r) === Y(R, r)) === -1) {
|
|
2069
|
+
E.result.push(d.data);
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2072
|
+
})), c.setQueryData(y(d.id, d.namespace), { result: d.data }));
|
|
2073
|
+
}, []), p = _.useCallback((d) => {
|
|
2074
|
+
console.log("got an updated resource", d), r && (c.setQueryData(u, (g) => le(g, (E) => {
|
|
2075
|
+
E || (E = T.ListResult.createFrom({
|
|
2076
|
+
result: [],
|
|
2077
|
+
success: !0,
|
|
2078
|
+
pagination: {}
|
|
2079
|
+
}));
|
|
2080
|
+
const C = E.result.findIndex((R) => Y(d.newData, r) === Y(R, r));
|
|
2081
|
+
if (C !== -1) {
|
|
2082
|
+
E.result[C] = d.newData;
|
|
2083
|
+
return;
|
|
2084
|
+
}
|
|
2085
|
+
})), c.setQueryData(y(d.id, d.namespace), { result: d.newData }));
|
|
2086
|
+
}, []), S = _.useCallback((d) => {
|
|
2087
|
+
console.log("got a deleted resource", d), r && c.setQueryData(u, (g) => le(g, (E) => {
|
|
2088
|
+
if (!E)
|
|
2089
|
+
return;
|
|
2090
|
+
const C = E.result.findIndex((R) => Y(d.data, r) === Y(R, r));
|
|
2091
|
+
if (C !== -1) {
|
|
2092
|
+
E.result.splice(C, 1);
|
|
2093
|
+
return;
|
|
2094
|
+
}
|
|
2095
|
+
}));
|
|
2096
|
+
}, []);
|
|
2097
|
+
_.useEffect(() => {
|
|
2098
|
+
if (!r)
|
|
2099
|
+
return;
|
|
2100
|
+
const d = A(`${a}/${t}/${n}/ADD`, m), g = A(`${a}/${t}/${n}/UPDATE`, p), E = A(`${a}/${t}/${n}/DELETE`, S);
|
|
2101
|
+
return () => {
|
|
2102
|
+
d(), g(), E();
|
|
2103
|
+
};
|
|
2104
|
+
}, []);
|
|
2105
|
+
const [w, b] = _.useState(
|
|
2106
|
+
x.Pending
|
|
2107
|
+
);
|
|
2108
|
+
return _.useEffect(() => A(
|
|
2109
|
+
`${a}/${t}/informer/STATE`,
|
|
2110
|
+
(g) => {
|
|
2111
|
+
g.resourceKey === n && b(g.state);
|
|
2112
|
+
}
|
|
2113
|
+
), [a, t, n]), {
|
|
2114
|
+
/**
|
|
2115
|
+
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
2116
|
+
* when the resources are updated or deleted via the returned create and remove mutation functions, or
|
|
2117
|
+
* the per-resource hook mutation functions.
|
|
2118
|
+
*/
|
|
2119
|
+
resources: f,
|
|
2120
|
+
/**
|
|
2121
|
+
* Create a new resource. A set of optional parameters can be passed to customize the create behavior,
|
|
2122
|
+
* which if specified, will add additional default behavior set via the hook options.
|
|
2123
|
+
*
|
|
2124
|
+
* @params opts Optional parameters to pass to the resource create operation
|
|
2125
|
+
*/
|
|
2126
|
+
create: h,
|
|
2127
|
+
/** Current informer state for this resource type */
|
|
2128
|
+
informerState: w,
|
|
2129
|
+
/** Whether the informer is currently syncing */
|
|
2130
|
+
isSyncing: w === x.Syncing,
|
|
2131
|
+
/** Whether the informer has fully synced */
|
|
2132
|
+
isSynced: w === x.Synced,
|
|
2133
|
+
/** Whether the informer encountered an error */
|
|
2134
|
+
informerError: w === x.Error
|
|
2135
|
+
};
|
|
2136
|
+
}, Hs = ({ pluginID: e }) => {
|
|
2137
|
+
const t = P(e), { showSnackbar: n } = $(), r = v({
|
|
2138
|
+
mutationFn: async ({ opts: o, input: a }) => mt(
|
|
2139
|
+
t,
|
|
2140
|
+
o.connectionID,
|
|
2141
|
+
o.resourceKey,
|
|
2142
|
+
T.CreateInput.createFrom({
|
|
2143
|
+
params: { ...o.params, ...a.params },
|
|
2144
|
+
input: { ...o.params, ...a.input },
|
|
2145
|
+
id: o.resourceID,
|
|
2146
|
+
namespace: o.namespace
|
|
2147
|
+
})
|
|
2148
|
+
),
|
|
2149
|
+
onSuccess: (o, { opts: a }) => {
|
|
2150
|
+
n(`Resource ${a.resourceID} created`, "success");
|
|
2151
|
+
},
|
|
2152
|
+
onError(o, { opts: a }) {
|
|
2153
|
+
X(n, o, `Failed to create resource ${a.resourceID}`);
|
|
2154
|
+
}
|
|
2155
|
+
}), s = v({
|
|
2156
|
+
mutationFn: async ({ opts: o, input: a }) => pt(
|
|
2157
|
+
t,
|
|
2158
|
+
o.connectionID,
|
|
2159
|
+
o.resourceKey,
|
|
2160
|
+
T.UpdateInput.createFrom({
|
|
2161
|
+
params: { ...o.params, ...a.params },
|
|
2162
|
+
input: { ...o.params, ...a.input },
|
|
2163
|
+
id: o.resourceID,
|
|
2164
|
+
namespace: o.namespace
|
|
2165
|
+
})
|
|
2166
|
+
),
|
|
2167
|
+
onSuccess: (o, { opts: a }) => {
|
|
2168
|
+
n(`Resource ${a.resourceID} updated`, "success");
|
|
2169
|
+
},
|
|
2170
|
+
onError(o, { opts: a }) {
|
|
2171
|
+
X(n, o, `Failed to update resource ${a.resourceID}`);
|
|
2172
|
+
}
|
|
2173
|
+
}), i = v({
|
|
2174
|
+
mutationFn: async ({ opts: o, input: a }) => yt(
|
|
2175
|
+
t,
|
|
2176
|
+
o.connectionID,
|
|
2177
|
+
o.resourceKey,
|
|
2178
|
+
T.DeleteInput.createFrom({
|
|
2179
|
+
...a,
|
|
2180
|
+
params: { ...o.params, ...a.params },
|
|
2181
|
+
input: { ...o.params, ...a.input },
|
|
2182
|
+
id: o.resourceID,
|
|
2183
|
+
namespace: o.namespace
|
|
2184
|
+
})
|
|
2185
|
+
),
|
|
2186
|
+
onSuccess: (o, { opts: a }) => {
|
|
2187
|
+
n(`Resource ${a.resourceID} deleted`, "success");
|
|
2188
|
+
},
|
|
2189
|
+
onError(o, { opts: a }) {
|
|
2190
|
+
X(n, o, `Failed to delete resource ${a.resourceID}`);
|
|
2191
|
+
}
|
|
2192
|
+
});
|
|
2193
|
+
return {
|
|
2194
|
+
create: r.mutateAsync,
|
|
2195
|
+
update: s.mutateAsync,
|
|
2196
|
+
remove: i.mutateAsync
|
|
2197
|
+
};
|
|
2198
|
+
}, Bs = ({
|
|
2199
|
+
pluginID: e,
|
|
2200
|
+
connectionID: t,
|
|
2201
|
+
resourceKey: n,
|
|
2202
|
+
enabled: r = !0
|
|
2203
|
+
}) => {
|
|
2204
|
+
const s = P(e), i = D({
|
|
2205
|
+
queryKey: ["RESOURCE_ACTIONS", s, t, n],
|
|
2206
|
+
queryFn: () => Pn(s, t, n),
|
|
2207
|
+
enabled: r && !!s && !!t && !!n,
|
|
2208
|
+
staleTime: 5 * 60 * 1e3
|
|
2209
|
+
// actions don't change often
|
|
2210
|
+
});
|
|
2211
|
+
return {
|
|
2212
|
+
actions: i.data ?? [],
|
|
2213
|
+
isLoading: i.isLoading,
|
|
2214
|
+
error: i.error
|
|
2215
|
+
};
|
|
2216
|
+
}, Ys = ({
|
|
2217
|
+
pluginID: e,
|
|
2218
|
+
connectionID: t,
|
|
2219
|
+
resourceKey: n
|
|
2220
|
+
}) => {
|
|
2221
|
+
const r = P(e), s = G(), { showSnackbar: i } = $(), o = v({
|
|
2222
|
+
mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => Dn(
|
|
2223
|
+
r,
|
|
2224
|
+
t,
|
|
2225
|
+
n,
|
|
2226
|
+
a,
|
|
2227
|
+
T.ActionInput.createFrom({ id: c, namespace: l, params: u })
|
|
2228
|
+
),
|
|
2229
|
+
onSuccess: (a) => {
|
|
2230
|
+
a.message && i(a.message, "success"), s.invalidateQueries({
|
|
2231
|
+
queryKey: ["RESOURCES", r, t, n]
|
|
2232
|
+
});
|
|
2233
|
+
},
|
|
2234
|
+
onError: (a, c) => {
|
|
2235
|
+
X(i, a, `Failed to execute action "${c.actionID}"`);
|
|
2236
|
+
}
|
|
2237
|
+
});
|
|
2238
|
+
return {
|
|
2239
|
+
executeAction: o.mutateAsync,
|
|
2240
|
+
isExecuting: o.isPending,
|
|
2241
|
+
error: o.error
|
|
2242
|
+
};
|
|
2243
|
+
}, Js = ({
|
|
2244
|
+
pluginID: e,
|
|
2245
|
+
connectionID: t,
|
|
2246
|
+
enabled: n = !0
|
|
2247
|
+
}) => {
|
|
2248
|
+
const r = P(e), s = D({
|
|
2249
|
+
queryKey: ["EDITOR_SCHEMAS", r, t],
|
|
2250
|
+
queryFn: () => Fn(r, t),
|
|
2251
|
+
enabled: n && !!r && !!t,
|
|
2252
|
+
staleTime: 10 * 60 * 1e3,
|
|
2253
|
+
// schemas are fairly stable per connection
|
|
2254
|
+
retry: 1
|
|
2255
|
+
});
|
|
2256
|
+
return {
|
|
2257
|
+
schemas: s.data ?? [],
|
|
2258
|
+
isLoading: s.isLoading,
|
|
2259
|
+
error: s.error,
|
|
2260
|
+
refetch: s.refetch
|
|
2261
|
+
};
|
|
2262
|
+
}, Vs = ({
|
|
2263
|
+
pluginID: e,
|
|
2264
|
+
connectionID: t,
|
|
2265
|
+
enabled: n = !0
|
|
2266
|
+
}) => {
|
|
2267
|
+
const r = P(e), s = G(), i = [r, t, "informer-state"], o = D({
|
|
2268
|
+
queryKey: i,
|
|
2269
|
+
queryFn: () => xn(r, t),
|
|
2270
|
+
enabled: n && !!r && !!t
|
|
2271
|
+
});
|
|
2272
|
+
j(() => !n || !r || !t ? void 0 : A(
|
|
2273
|
+
`${r}/${t}/informer/STATE`,
|
|
2274
|
+
(u) => {
|
|
2275
|
+
s.setQueryData(i, (y) => y && le(y, (h) => {
|
|
2276
|
+
h.resources[u.resourceKey] = u.state, h.resourceCounts[u.resourceKey] = u.resourceCount;
|
|
2277
|
+
let f = 0, m = 0;
|
|
2278
|
+
for (const p of Object.values(h.resources))
|
|
2279
|
+
p === x.Synced && f++, p === x.Error && m++;
|
|
2280
|
+
h.syncedCount = f, h.errorCount = m;
|
|
2281
|
+
}));
|
|
2282
|
+
}
|
|
2283
|
+
), [r, t, n]);
|
|
2284
|
+
const a = o.data;
|
|
2285
|
+
let c = 0;
|
|
2286
|
+
if (a != null && a.resources)
|
|
2287
|
+
for (const l of Object.values(a.resources))
|
|
2288
|
+
(l === x.Synced || l === x.Error || l === x.Cancelled) && c++;
|
|
2289
|
+
return {
|
|
2290
|
+
/** Full summary query result */
|
|
2291
|
+
summary: o,
|
|
2292
|
+
/** Get the state of a specific resource type's informer */
|
|
2293
|
+
getResourceState: (l) => a == null ? void 0 : a.resources[l],
|
|
2294
|
+
/** Whether all registered informers have reached a terminal state */
|
|
2295
|
+
isFullySynced: a ? a.totalResources > 0 && c === a.totalResources : !1,
|
|
2296
|
+
/** Sync progress as a 0-1 fraction (terminal states / total) */
|
|
2297
|
+
syncProgress: a && a.totalResources > 0 ? c / a.totalResources : 0,
|
|
2298
|
+
/** Number of informers that encountered errors */
|
|
2299
|
+
errorCount: (a == null ? void 0 : a.errorCount) ?? 0
|
|
2300
|
+
};
|
|
2301
|
+
}, Xs = () => {
|
|
2302
|
+
const [e, t] = q(/* @__PURE__ */ new Map()), n = de(/* @__PURE__ */ new Map()), r = de(/* @__PURE__ */ new Map()), s = V((l) => {
|
|
2303
|
+
const u = qe(l), y = Ot(n.current, l), h = Ft(y);
|
|
2304
|
+
if (t((f) => {
|
|
2305
|
+
const m = new Map(f);
|
|
2306
|
+
return m.set(u, h), m;
|
|
2307
|
+
}), r.current.has(u) && (clearTimeout(r.current.get(u)), r.current.delete(u)), fe(h)) {
|
|
2308
|
+
const f = setTimeout(() => {
|
|
2309
|
+
t((m) => {
|
|
2310
|
+
const p = new Map(m);
|
|
2311
|
+
return p.delete(u), p;
|
|
2312
|
+
}), n.current.delete(u), r.current.delete(u);
|
|
2313
|
+
}, 5e3);
|
|
2314
|
+
r.current.set(u, f);
|
|
2315
|
+
}
|
|
2316
|
+
}, []);
|
|
2317
|
+
j(() => {
|
|
2318
|
+
const l = A("informer/STATE", s);
|
|
2319
|
+
return () => {
|
|
2320
|
+
l();
|
|
2321
|
+
for (const u of r.current.values())
|
|
2322
|
+
clearTimeout(u);
|
|
2323
|
+
};
|
|
2324
|
+
}, [s]);
|
|
2325
|
+
const i = Array.from(e.values()), o = xt(i), a = i.find((l) => !fe(l)) ?? i[0] ?? null, c = It(i);
|
|
2326
|
+
return {
|
|
2327
|
+
/** All tracked syncs */
|
|
2328
|
+
syncs: i,
|
|
2329
|
+
/** Whether any connection is actively syncing */
|
|
2330
|
+
hasSyncing: o,
|
|
2331
|
+
/** The primary (first incomplete) sync or most recent */
|
|
2332
|
+
primarySync: a,
|
|
2333
|
+
/** Aggregate progress across all connections (0-1) */
|
|
2334
|
+
aggregateProgress: c
|
|
2335
|
+
};
|
|
2336
|
+
}, is = () => {
|
|
2337
|
+
const e = _.useContext(Et);
|
|
2338
|
+
if (!e) throw new Error("useOperations must be used within an OperationsProvider");
|
|
2339
|
+
return e;
|
|
2340
|
+
}, Zs = ({
|
|
2341
|
+
pluginID: e,
|
|
2342
|
+
connectionID: t,
|
|
2343
|
+
resourceKey: n
|
|
2344
|
+
}) => {
|
|
2345
|
+
const r = P(e), { showSnackbar: s } = $(), { addOperation: i, updateOperation: o } = is(), a = _.useRef([]);
|
|
2346
|
+
return _.useEffect(() => () => {
|
|
2347
|
+
a.current.forEach((l) => l());
|
|
2348
|
+
}, []), { startStreamAction: _.useCallback(
|
|
2349
|
+
async ({ actionID: l, id: u, namespace: y, label: h, params: f = {} }) => {
|
|
2350
|
+
try {
|
|
2351
|
+
const m = await In(
|
|
2352
|
+
r,
|
|
2353
|
+
t,
|
|
2354
|
+
n,
|
|
2355
|
+
l,
|
|
2356
|
+
T.ActionInput.createFrom({ id: u, namespace: y, params: f })
|
|
2357
|
+
);
|
|
2358
|
+
i({
|
|
2359
|
+
id: m,
|
|
2360
|
+
label: h,
|
|
2361
|
+
resourceKey: n,
|
|
2362
|
+
resourceName: u,
|
|
2363
|
+
namespace: y,
|
|
2364
|
+
connectionID: t,
|
|
2365
|
+
status: "running",
|
|
2366
|
+
startedAt: Date.now()
|
|
2367
|
+
});
|
|
2368
|
+
const p = `action/stream/${m}`, S = A(p, (w) => {
|
|
2369
|
+
var b, d, g, E;
|
|
2370
|
+
switch (w.type) {
|
|
2371
|
+
case "progress": {
|
|
2372
|
+
const C = w.data ?? {};
|
|
2373
|
+
o(m, {
|
|
2374
|
+
message: C.message,
|
|
2375
|
+
progress: C.ready !== void 0 && C.desired !== void 0 ? { ready: C.ready, desired: C.desired } : void 0
|
|
2376
|
+
});
|
|
2377
|
+
break;
|
|
2378
|
+
}
|
|
2379
|
+
case "complete":
|
|
2380
|
+
o(m, {
|
|
2381
|
+
status: "completed",
|
|
2382
|
+
message: ((b = w.data) == null ? void 0 : b.message) ?? "Completed",
|
|
2383
|
+
completedAt: Date.now()
|
|
2384
|
+
}), s(((d = w.data) == null ? void 0 : d.message) ?? h + " completed", "success"), be(p);
|
|
2385
|
+
break;
|
|
2386
|
+
case "error":
|
|
2387
|
+
o(m, {
|
|
2388
|
+
status: "error",
|
|
2389
|
+
message: ((g = w.data) == null ? void 0 : g.message) ?? "Failed",
|
|
2390
|
+
completedAt: Date.now()
|
|
2391
|
+
}), s(((E = w.data) == null ? void 0 : E.message) ?? h + " failed", "error"), be(p);
|
|
2392
|
+
break;
|
|
2393
|
+
}
|
|
2394
|
+
});
|
|
2395
|
+
return a.current.push(() => {
|
|
2396
|
+
S(), be(p);
|
|
2397
|
+
}), m;
|
|
2398
|
+
} catch (m) {
|
|
2399
|
+
throw X(s, m, `Failed to start "${l}"`), m;
|
|
2400
|
+
}
|
|
2401
|
+
},
|
|
2402
|
+
[r, t, n, i, o, s]
|
|
2403
|
+
) };
|
|
2404
|
+
}, eo = () => {
|
|
2405
|
+
const e = _.useContext(Ct);
|
|
2406
|
+
if (!e)
|
|
2407
|
+
throw new Error("useSettings must be used within a SettingsProvider");
|
|
2408
|
+
return e;
|
|
2409
|
+
}, to = ({ to: e, withinContext: t, ...n }) => {
|
|
2410
|
+
const { meta: r } = Le();
|
|
2411
|
+
r.id || console.error("Link used outside of a plugin context");
|
|
2412
|
+
const s = `/_plugin/${r.id}${e.startsWith("/") ? "" : "/"}${e}`;
|
|
2413
|
+
return _.useMemo(() => /* @__PURE__ */ F(Bt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
|
|
2414
|
+
};
|
|
2415
|
+
function no() {
|
|
2416
|
+
const e = Yt(), t = Jt(), { meta: n } = Le();
|
|
2417
|
+
n.id || console.error("usePluginRouter used outside of a plugin context");
|
|
2418
|
+
const r = `/_plugin/${n.id}`, s = t.pathname.startsWith(r) ? t.pathname.slice(r.length) || "/" : t.pathname, i = (o, a) => {
|
|
2419
|
+
const { ...c } = a ?? {};
|
|
2420
|
+
o.startsWith("/") ? e(`${r}${o}`, c) : e(o, c);
|
|
2421
|
+
};
|
|
2422
|
+
return Ht(() => ({
|
|
2423
|
+
location: t,
|
|
2424
|
+
navigate: i,
|
|
2425
|
+
pluginPath: s
|
|
2426
|
+
}), [t.pathname]);
|
|
2427
|
+
}
|
|
2428
|
+
class ro {
|
|
2429
|
+
}
|
|
2430
|
+
class so {
|
|
2431
|
+
constructor() {
|
|
2432
|
+
M(this, "_extensions");
|
|
2433
|
+
/**
|
|
2434
|
+
* The root component to render for the application window.
|
|
2435
|
+
*/
|
|
2436
|
+
M(this, "root");
|
|
2437
|
+
/**
|
|
2438
|
+
* Various pages to render under the root component. These can be navigated to using
|
|
2439
|
+
* the built-in navigation system both programatically and through Links.
|
|
2440
|
+
*
|
|
2441
|
+
* @example
|
|
2442
|
+
* Programatically:
|
|
2443
|
+
* ```
|
|
2444
|
+
* import { usePluginNavigation } from '@omniviewdev/runtime';
|
|
2445
|
+
* const MyComponent = () => {
|
|
2446
|
+
* const { navigate } = usePluginNavigation();
|
|
2447
|
+
*
|
|
2448
|
+
* const goToPage = () => {
|
|
2449
|
+
* navigate('some-page')
|
|
2450
|
+
* }
|
|
2451
|
+
*
|
|
2452
|
+
* }
|
|
2453
|
+
* ```
|
|
2454
|
+
*
|
|
2455
|
+
* Using Links:
|
|
2456
|
+
* ```
|
|
2457
|
+
* import { Link } from '@omniviewdev/runtime';
|
|
2458
|
+
* const MyComponent = () => {
|
|
2459
|
+
* return (
|
|
2460
|
+
* <Link to="some-page">
|
|
2461
|
+
* )
|
|
2462
|
+
* }
|
|
2463
|
+
* ```
|
|
2464
|
+
*
|
|
2465
|
+
*/
|
|
2466
|
+
M(this, "pages");
|
|
2467
|
+
M(this, "_routes");
|
|
2468
|
+
}
|
|
2469
|
+
get extensions() {
|
|
2470
|
+
return this._extensions || [];
|
|
2471
|
+
}
|
|
2472
|
+
get Routes() {
|
|
2473
|
+
var t;
|
|
2474
|
+
if (!this._routes && this.root)
|
|
2475
|
+
return [{
|
|
2476
|
+
path: "",
|
|
2477
|
+
index: !0,
|
|
2478
|
+
Component: this.root
|
|
2479
|
+
}];
|
|
2480
|
+
if (!((t = this._routes) != null && t.length))
|
|
2481
|
+
throw new Error("cannot use plugin without a root page or router");
|
|
2482
|
+
return this._routes;
|
|
2483
|
+
}
|
|
2484
|
+
/**
|
|
2485
|
+
* Get's the route provider component to render within the plugin view
|
|
2486
|
+
*/
|
|
2487
|
+
get Window() {
|
|
2488
|
+
if (!this._routes && this.root)
|
|
2489
|
+
return /* @__PURE__ */ F(this.root, {});
|
|
2490
|
+
const t = Vt(this._routes || []);
|
|
2491
|
+
return /* @__PURE__ */ F(Xt, { router: t });
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* Register extension points for other plugins to extend the functionality
|
|
2495
|
+
* of the plugin. All extension points registered will be name as such:
|
|
2496
|
+
*
|
|
2497
|
+
* `${plugin_id}/${extension_point_id}`
|
|
2498
|
+
*/
|
|
2499
|
+
registerExtensionPoints(t) {
|
|
2500
|
+
return this._extensions = t || [], this;
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* Set the component displayed under:
|
|
2504
|
+
* /_plugin/${plugin_id}/*
|
|
2505
|
+
*
|
|
2506
|
+
* If the NavModel is configured, the page will have a managed frame, otheriwse it has full control.
|
|
2507
|
+
*/
|
|
2508
|
+
setRootPage(t) {
|
|
2509
|
+
return this.root = t, this;
|
|
2510
|
+
}
|
|
2511
|
+
/**
|
|
2512
|
+
* Adds a page to the plugin window. This page will be displayed under:
|
|
2513
|
+
*/
|
|
2514
|
+
withPage(t, n) {
|
|
2515
|
+
return this.pages || (this.pages = {}), this.pages[t] ? (console.warn(
|
|
2516
|
+
"Cannot register page with the same name. Please use a different name."
|
|
2517
|
+
), this) : (this.pages[t] = n, this);
|
|
2518
|
+
}
|
|
2519
|
+
withRoutes(t) {
|
|
2520
|
+
return this._routes = t, this;
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
var as = /* @__PURE__ */ ((e) => (e.MISSING_MANIFEST = "MISSING_MANIFEST", e.MISSING_PLUGIN = "MISSING_PLUGIN", e.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", e))(as || {});
|
|
2524
|
+
export {
|
|
2525
|
+
J as ALL_SESSIONS_KEY,
|
|
2526
|
+
Mn as BottomDrawerContext,
|
|
2527
|
+
Ln as ConfirmationModalContext,
|
|
2528
|
+
xe as ErrorTypes,
|
|
2529
|
+
vs as ExtensionPointRegistry,
|
|
2530
|
+
Qn as ExtensionPointStore,
|
|
2531
|
+
bs as ExtensionProvider,
|
|
2532
|
+
x as InformerResourceState,
|
|
2533
|
+
Hn as InformerSyncPolicy,
|
|
2534
|
+
to as Link,
|
|
2535
|
+
Et as OperationsContext,
|
|
2536
|
+
Ss as OperationsProvider,
|
|
2537
|
+
$e as PluginContext,
|
|
2538
|
+
gs as PluginContextProvider,
|
|
2539
|
+
as as PluginErrorCode,
|
|
2540
|
+
so as PluginWindow,
|
|
2541
|
+
ro as PluginWindowRootProps,
|
|
2542
|
+
$n as RightDrawerContext,
|
|
2543
|
+
Ct as SettingsContext,
|
|
2544
|
+
ws as SettingsProvider,
|
|
2545
|
+
Ps as SnackbarProvider,
|
|
2546
|
+
kn as actionToSnackbar,
|
|
2547
|
+
Wn as connectionListQueryKey,
|
|
2548
|
+
I as createErrorHandler,
|
|
2549
|
+
Rn as defaultState,
|
|
2550
|
+
wt as isCancelledError,
|
|
2551
|
+
K as parseAppError,
|
|
2552
|
+
X as showAppError,
|
|
2553
|
+
Xs as useActiveSyncs,
|
|
2554
|
+
At as useBottomDrawer,
|
|
2555
|
+
qs as useConfirmationModal,
|
|
2556
|
+
Ds as useConnection,
|
|
2557
|
+
xs as useConnectionNamespaces,
|
|
2558
|
+
Is as useConnectionStatus,
|
|
2559
|
+
Fs as useConnections,
|
|
2560
|
+
Js as useEditorSchemas,
|
|
2561
|
+
Ts as useExec,
|
|
2562
|
+
Ys as useExecuteAction,
|
|
2563
|
+
Cs as useExtensionPoint,
|
|
2564
|
+
Es as useExtensionPointComponents,
|
|
2565
|
+
Pt as useExtensionRegistry,
|
|
2566
|
+
Vs as useInformerState,
|
|
2567
|
+
Ns as useLogs,
|
|
2568
|
+
ks as useMetricProviders,
|
|
2569
|
+
Jn as useMetricProvidersForResource,
|
|
2570
|
+
Ms as useMetricStream,
|
|
2571
|
+
is as useOperations,
|
|
2572
|
+
Le as usePluginContext,
|
|
2573
|
+
Os as usePluginData,
|
|
2574
|
+
no as usePluginRouter,
|
|
2575
|
+
_s as usePluginSettings,
|
|
2576
|
+
$s as usePortForwardSessions,
|
|
2577
|
+
P as useResolvedPluginId,
|
|
2578
|
+
Gs as useResource,
|
|
2579
|
+
Bs as useResourceActions,
|
|
2580
|
+
Ks as useResourceAreaComponent,
|
|
2581
|
+
Us as useResourceGroups,
|
|
2582
|
+
Rs as useResourceMetrics,
|
|
2583
|
+
Hs as useResourceMutations,
|
|
2584
|
+
Ls as useResourcePortForwarder,
|
|
2585
|
+
js as useResourceSearch,
|
|
2586
|
+
Qs as useResourceType,
|
|
2587
|
+
zs as useResourceTypes,
|
|
2588
|
+
Ws as useResources,
|
|
2589
|
+
As as useRightDrawer,
|
|
2590
|
+
eo as useSettings,
|
|
2591
|
+
$ as useSnackbar,
|
|
2592
|
+
Zs as useStreamAction
|
|
2593
|
+
};
|