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