@omniviewdev/runtime 0.3.0 → 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/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 +1192 -1600
- 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/watch.d.ts +4 -5
- package/package.json +17 -13
- package/LICENSE +0 -661
- package/dist/Client-07zrOerN.js +0 -636
- package/dist/Client-CLvQWnuz.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 -48
- 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 j, useMutation 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 $e = E.createContext(void 0), L = {
|
|
|
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 z(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
|
|
139
|
+
function Ge(t, e) {
|
|
138
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: (i =
|
|
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 }), o(d),
|
|
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
|
-
|
|
256
|
+
const je = re(void 0), Gr = ({ children: t }) => {
|
|
257
|
+
const [e, n] = q({}), r = () => {
|
|
258
|
+
mt().then((i) => {
|
|
257
259
|
console.log("Fetched settings:", i), n(i);
|
|
258
260
|
}).catch((i) => {
|
|
259
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,90 +292,90 @@ 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
|
-
}, []), i =
|
|
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(() => i(
|
|
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 o =
|
|
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
|
-
function
|
|
366
|
-
const
|
|
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(
|
|
367
369
|
(o) => {
|
|
368
370
|
const a = [];
|
|
369
|
-
return
|
|
370
|
-
for (const
|
|
371
|
-
|
|
371
|
+
return e && a.push(e.subscribe(o)), r && a.push(r.subscribe(o)), () => {
|
|
372
|
+
for (const c of a)
|
|
373
|
+
c();
|
|
372
374
|
};
|
|
373
375
|
},
|
|
374
|
-
[
|
|
376
|
+
[e, t, r]
|
|
375
377
|
), i = M(() => {
|
|
376
|
-
const o =
|
|
378
|
+
const o = e == null ? void 0 : e.getExtensionPoint(t);
|
|
377
379
|
if (!o) {
|
|
378
380
|
if (n.current && n.current.store === void 0)
|
|
379
381
|
return n.current.sentinel;
|
|
@@ -383,34 +385,34 @@ function vs(e) {
|
|
|
383
385
|
const a = n.current;
|
|
384
386
|
if (a && a.store === o && a.version === o.version)
|
|
385
387
|
return a.sentinel;
|
|
386
|
-
const
|
|
387
|
-
return n.current = { store: o, version: o.version, sentinel:
|
|
388
|
-
}, [
|
|
389
|
-
return
|
|
390
|
-
}
|
|
391
|
-
const
|
|
392
|
-
const n =
|
|
393
|
-
return
|
|
394
|
-
n.current ===
|
|
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,
|
|
395
397
|
"You can't change the extension registry after it has been rendered"
|
|
396
|
-
), /* @__PURE__ */
|
|
397
|
-
},
|
|
398
|
-
if (!
|
|
399
|
-
throw new TypeError(`extensionName is required to be a string and can't be: "${
|
|
400
|
-
return
|
|
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();
|
|
401
403
|
};
|
|
402
|
-
class
|
|
403
|
-
constructor(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
this.id =
|
|
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;
|
|
414
416
|
}
|
|
415
417
|
get pluginId() {
|
|
416
418
|
return this._pluginId;
|
|
@@ -421,32 +423,32 @@ class Wn {
|
|
|
421
423
|
/**
|
|
422
424
|
* Register a contribution. Throws if the contribution ID already exists.
|
|
423
425
|
*/
|
|
424
|
-
register(
|
|
425
|
-
if (this._contributions.has(
|
|
426
|
+
register(e) {
|
|
427
|
+
if (this._contributions.has(e.id))
|
|
426
428
|
throw new Error(
|
|
427
|
-
`Contribution with id "${
|
|
429
|
+
`Contribution with id "${e.id}" already exists in extension point "${this.id}"`
|
|
428
430
|
);
|
|
429
|
-
this._contributions.set(
|
|
431
|
+
this._contributions.set(e.id, e), this._invalidateCache(), this._notify();
|
|
430
432
|
}
|
|
431
433
|
/**
|
|
432
434
|
* Unregister a contribution by ID.
|
|
433
435
|
*/
|
|
434
|
-
unregister(
|
|
435
|
-
this._contributions.delete(
|
|
436
|
+
unregister(e) {
|
|
437
|
+
this._contributions.delete(e) && (this._invalidateCache(), this._notify());
|
|
436
438
|
}
|
|
437
439
|
/**
|
|
438
440
|
* Synchronously provide matched values for the given context.
|
|
439
441
|
* In single mode, matcher is applied first, then select (or first match) picks one.
|
|
440
442
|
* In multiple mode, all matched contributions are returned in deterministic order.
|
|
441
443
|
*/
|
|
442
|
-
provide(
|
|
443
|
-
return this._getMatched(
|
|
444
|
+
provide(e) {
|
|
445
|
+
return this._getMatched(e).map((r) => r.value);
|
|
444
446
|
}
|
|
445
447
|
/**
|
|
446
448
|
* Synchronously list matched contribution registrations for the given context.
|
|
447
449
|
*/
|
|
448
|
-
list(
|
|
449
|
-
return this._getMatched(
|
|
450
|
+
list(e) {
|
|
451
|
+
return this._getMatched(e);
|
|
450
452
|
}
|
|
451
453
|
/**
|
|
452
454
|
* List all contributions regardless of context/matcher.
|
|
@@ -457,55 +459,55 @@ class Wn {
|
|
|
457
459
|
/**
|
|
458
460
|
* Subscribe to changes in this store. Returns an unsubscribe function.
|
|
459
461
|
*/
|
|
460
|
-
subscribe(
|
|
461
|
-
return this._listeners.add(
|
|
462
|
-
this._listeners.delete(
|
|
462
|
+
subscribe(e) {
|
|
463
|
+
return this._listeners.add(e), () => {
|
|
464
|
+
this._listeners.delete(e);
|
|
463
465
|
};
|
|
464
466
|
}
|
|
465
467
|
/**
|
|
466
468
|
* Remove all contributions owned by the given plugin.
|
|
467
469
|
*/
|
|
468
|
-
removeContributionsByPlugin(
|
|
470
|
+
removeContributionsByPlugin(e) {
|
|
469
471
|
let n = !1;
|
|
470
472
|
for (const [r, s] of this._contributions)
|
|
471
|
-
s.plugin ===
|
|
473
|
+
s.plugin === e && (this._contributions.delete(r), n = !0);
|
|
472
474
|
n && (this._invalidateCache(), this._notify());
|
|
473
475
|
}
|
|
474
476
|
// --- private ---
|
|
475
|
-
_getMatched(
|
|
476
|
-
const n = this._getCacheKey(
|
|
477
|
+
_getMatched(e) {
|
|
478
|
+
const n = this._getCacheKey(e);
|
|
477
479
|
if (n != null) {
|
|
478
480
|
const s = this._lookupCache.get(n);
|
|
479
481
|
if (s) {
|
|
480
482
|
const i = s.map((o) => this._contributions.get(o)).filter((o) => o != null);
|
|
481
|
-
return this._applyMode(i,
|
|
483
|
+
return this._applyMode(i, e);
|
|
482
484
|
}
|
|
483
485
|
}
|
|
484
486
|
let r = this._sortDeterministic(Array.from(this._contributions.values()));
|
|
485
|
-
return this._matcher &&
|
|
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);
|
|
486
488
|
}
|
|
487
|
-
_applyMode(
|
|
489
|
+
_applyMode(e, n) {
|
|
488
490
|
if (this.mode === "single") {
|
|
489
491
|
if (this._select) {
|
|
490
|
-
const r = this._select(
|
|
492
|
+
const r = this._select(e, n);
|
|
491
493
|
return r ? [r] : [];
|
|
492
494
|
}
|
|
493
|
-
return
|
|
495
|
+
return e.length > 0 ? [e[0]] : [];
|
|
494
496
|
}
|
|
495
|
-
return
|
|
497
|
+
return e;
|
|
496
498
|
}
|
|
497
499
|
/**
|
|
498
500
|
* Sort contributions deterministically: plugin ascending, then id ascending.
|
|
499
501
|
*/
|
|
500
|
-
_sortDeterministic(
|
|
501
|
-
return [...
|
|
502
|
+
_sortDeterministic(e) {
|
|
503
|
+
return [...e].sort((n, r) => {
|
|
502
504
|
const s = n.plugin.localeCompare(r.plugin);
|
|
503
505
|
return s !== 0 ? s : n.id.localeCompare(r.id);
|
|
504
506
|
});
|
|
505
507
|
}
|
|
506
|
-
_getCacheKey(
|
|
507
|
-
if (
|
|
508
|
-
const n =
|
|
508
|
+
_getCacheKey(e) {
|
|
509
|
+
if (e != null && typeof e == "object" && "getCacheKey" in e) {
|
|
510
|
+
const n = e.getCacheKey;
|
|
509
511
|
if (typeof n == "function")
|
|
510
512
|
return n();
|
|
511
513
|
}
|
|
@@ -515,46 +517,46 @@ class Wn {
|
|
|
515
517
|
}
|
|
516
518
|
_notify() {
|
|
517
519
|
this._version++;
|
|
518
|
-
for (const
|
|
519
|
-
|
|
520
|
+
for (const e of this._listeners)
|
|
521
|
+
e();
|
|
520
522
|
}
|
|
521
523
|
}
|
|
522
|
-
class
|
|
523
|
-
constructor(
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
if (
|
|
528
|
-
for (const n of
|
|
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)
|
|
529
531
|
this.addExtensionPoint(n);
|
|
530
532
|
}
|
|
531
533
|
/**
|
|
532
534
|
* Add a new extension point to the registry.
|
|
533
535
|
* Throws if the extension point ID already exists.
|
|
534
536
|
*/
|
|
535
|
-
addExtensionPoint(
|
|
536
|
-
const n =
|
|
537
|
+
addExtensionPoint(e) {
|
|
538
|
+
const n = ue(e.id);
|
|
537
539
|
if (this._stores.has(n)) {
|
|
538
540
|
const s = this._stores.get(n);
|
|
539
541
|
throw new Error(
|
|
540
542
|
`Extension point "${n}" already exists (owned by "${s.pluginId ?? "unknown"}")`
|
|
541
543
|
);
|
|
542
544
|
}
|
|
543
|
-
const r = new
|
|
545
|
+
const r = new Cn({ ...e, id: n });
|
|
544
546
|
this._stores.set(n, r), this._storeUnsubs.set(n, r.subscribe(() => this._notify())), this._notify();
|
|
545
547
|
}
|
|
546
548
|
/**
|
|
547
549
|
* Get an extension point store by ID.
|
|
548
550
|
*/
|
|
549
|
-
getExtensionPoint(
|
|
550
|
-
const n =
|
|
551
|
+
getExtensionPoint(e) {
|
|
552
|
+
const n = ue(e);
|
|
551
553
|
return this._stores.get(n);
|
|
552
554
|
}
|
|
553
555
|
/**
|
|
554
556
|
* Check if an extension point exists.
|
|
555
557
|
*/
|
|
556
|
-
hasExtensionPoint(
|
|
557
|
-
const n =
|
|
558
|
+
hasExtensionPoint(e) {
|
|
559
|
+
const n = ue(e);
|
|
558
560
|
return this._stores.has(n);
|
|
559
561
|
}
|
|
560
562
|
/**
|
|
@@ -566,121 +568,120 @@ class Ps {
|
|
|
566
568
|
/**
|
|
567
569
|
* Remove all extension points owned by the given plugin.
|
|
568
570
|
*/
|
|
569
|
-
removeExtensionPoints(
|
|
571
|
+
removeExtensionPoints(e) {
|
|
570
572
|
var r;
|
|
571
573
|
let n = !1;
|
|
572
574
|
for (const [s, i] of this._stores)
|
|
573
|
-
i.pluginId ===
|
|
575
|
+
i.pluginId === e && ((r = this._storeUnsubs.get(s)) == null || r(), this._storeUnsubs.delete(s), this._stores.delete(s), n = !0);
|
|
574
576
|
n && this._notify();
|
|
575
577
|
}
|
|
576
578
|
/**
|
|
577
579
|
* Remove all contributions from the given plugin across all extension points.
|
|
578
580
|
*/
|
|
579
|
-
removeContributions(
|
|
581
|
+
removeContributions(e) {
|
|
580
582
|
for (const n of this._stores.values())
|
|
581
|
-
n.removeContributionsByPlugin(
|
|
583
|
+
n.removeContributionsByPlugin(e);
|
|
582
584
|
this._notify();
|
|
583
585
|
}
|
|
584
586
|
/**
|
|
585
587
|
* Subscribe to registry-level changes (extension points added/removed, contributions changed).
|
|
586
588
|
* Returns an unsubscribe function.
|
|
587
589
|
*/
|
|
588
|
-
subscribe(
|
|
589
|
-
return this._listeners.add(
|
|
590
|
-
this._listeners.delete(
|
|
590
|
+
subscribe(e) {
|
|
591
|
+
return this._listeners.add(e), () => {
|
|
592
|
+
this._listeners.delete(e);
|
|
591
593
|
};
|
|
592
594
|
}
|
|
593
595
|
_notify() {
|
|
594
|
-
for (const
|
|
595
|
-
|
|
596
|
+
for (const e of this._listeners)
|
|
597
|
+
e();
|
|
596
598
|
}
|
|
597
599
|
}
|
|
598
|
-
const
|
|
600
|
+
const He = re(void 0), vn = {
|
|
599
601
|
default: "info",
|
|
600
602
|
info: "info",
|
|
601
603
|
success: "success",
|
|
602
604
|
warning: "warning",
|
|
603
|
-
error: "
|
|
604
|
-
},
|
|
605
|
-
const {
|
|
605
|
+
error: "danger"
|
|
606
|
+
}, Hr = ({ children: t }) => {
|
|
607
|
+
const { toast: e } = cn(), [n, r] = v.useState([]), s = (o) => {
|
|
606
608
|
r((a) => [...a, o]);
|
|
607
|
-
}, i = (o, a,
|
|
609
|
+
}, i = (o, a, c) => {
|
|
608
610
|
const l = typeof o == "object";
|
|
609
|
-
let
|
|
611
|
+
let u = "", y = "info", f, d = 5e3, p;
|
|
610
612
|
if (l) {
|
|
611
|
-
if (
|
|
612
|
-
if (n.includes(
|
|
613
|
+
if (u = o.message, o.showOnce) {
|
|
614
|
+
if (n.includes(u))
|
|
613
615
|
return;
|
|
614
|
-
s(
|
|
616
|
+
s(u);
|
|
615
617
|
}
|
|
616
|
-
|
|
618
|
+
y = o.status, f = o.details, d = o.autoHideDuration ?? 5e3, p = o.actions;
|
|
617
619
|
} else
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
severity:
|
|
621
|
-
title:
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
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]
|
|
625
626
|
});
|
|
626
627
|
};
|
|
627
|
-
return /* @__PURE__ */
|
|
628
|
-
},
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
628
|
+
return /* @__PURE__ */ A(He.Provider, { value: { showSnackbar: i }, children: t });
|
|
629
|
+
}, U = () => {
|
|
630
|
+
const t = Y(He);
|
|
631
|
+
if (t === void 0)
|
|
631
632
|
throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
|
|
632
|
-
return
|
|
633
|
+
return t;
|
|
633
634
|
};
|
|
634
|
-
function
|
|
635
|
-
const
|
|
635
|
+
function P(t) {
|
|
636
|
+
const e = Y(ye), n = (e == null ? void 0 : e.pluginId) ?? t;
|
|
636
637
|
if (!n)
|
|
637
638
|
throw new Error(
|
|
638
639
|
"pluginID must be provided either via PluginContext or as an explicit parameter"
|
|
639
640
|
);
|
|
640
641
|
return n;
|
|
641
642
|
}
|
|
642
|
-
const
|
|
643
|
-
const n =
|
|
644
|
-
mutationFn: async () =>
|
|
645
|
-
onSuccess(
|
|
646
|
-
r.setQueryData(i,
|
|
647
|
-
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]
|
|
648
649
|
});
|
|
649
650
|
},
|
|
650
|
-
onError:
|
|
651
|
-
}), { mutateAsync: a } =
|
|
652
|
-
mutationFn: async () =>
|
|
653
|
-
onSuccess(
|
|
654
|
-
r.setQueryData(i,
|
|
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);
|
|
655
656
|
},
|
|
656
|
-
onError:
|
|
657
|
-
}), { mutateAsync:
|
|
658
|
-
mutationFn: async (
|
|
659
|
-
onSuccess(
|
|
660
|
-
s({ message: `Connection ${f} successfully updated`, status: "success" }), r.setQueryData(i,
|
|
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(
|
|
661
662
|
{ queryKey: [n, "connection", "list"] },
|
|
662
|
-
(d) => d == null ? void 0 : d.map((
|
|
663
|
+
(d) => d == null ? void 0 : d.map((p) => p.id === e ? y : p)
|
|
663
664
|
);
|
|
664
665
|
},
|
|
665
|
-
onError:
|
|
666
|
-
}), { mutateAsync: l } =
|
|
667
|
-
mutationFn: async () =>
|
|
666
|
+
onError: k(s, "Failed to update connection")
|
|
667
|
+
}), { mutateAsync: l } = D({
|
|
668
|
+
mutationFn: async () => wt(n, e),
|
|
668
669
|
onSuccess() {
|
|
669
670
|
s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(i, void 0), r.setQueriesData(
|
|
670
671
|
{ queryKey: [n, "connection", "list"] },
|
|
671
|
-
(
|
|
672
|
+
(y) => y == null ? void 0 : y.filter((f) => f.id !== e)
|
|
672
673
|
);
|
|
673
674
|
},
|
|
674
|
-
onError:
|
|
675
|
-
}), c = P({
|
|
676
|
-
queryKey: i,
|
|
677
|
-
queryFn: async () => tn(n, t)
|
|
675
|
+
onError: k(s, "Failed to remove connection")
|
|
678
676
|
});
|
|
679
677
|
return {
|
|
680
678
|
/**
|
|
681
679
|
* Get the connection
|
|
682
680
|
*/
|
|
683
|
-
connection:
|
|
681
|
+
connection: O({
|
|
682
|
+
queryKey: i,
|
|
683
|
+
queryFn: async () => Et(n, e)
|
|
684
|
+
}),
|
|
684
685
|
/**
|
|
685
686
|
* Start the connection
|
|
686
687
|
*/
|
|
@@ -692,216 +693,258 @@ const Rs = ({ pluginID: e, connectionID: t }) => {
|
|
|
692
693
|
/**
|
|
693
694
|
* Update the connection.
|
|
694
695
|
*/
|
|
695
|
-
updateConnection:
|
|
696
|
+
updateConnection: c,
|
|
696
697
|
/**
|
|
697
698
|
* Delete the connection
|
|
698
699
|
*/
|
|
699
700
|
deleteConnection: l
|
|
700
701
|
};
|
|
701
|
-
},
|
|
702
|
-
const
|
|
703
|
-
mutationFn: async (l) =>
|
|
704
|
-
onError:
|
|
705
|
-
}), { mutateAsync: o } =
|
|
706
|
-
mutationFn: async (l) =>
|
|
707
|
-
onError:
|
|
708
|
-
}), a =
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
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);
|
|
713
715
|
return () => {
|
|
714
716
|
l();
|
|
715
717
|
};
|
|
716
|
-
}, []), {
|
|
717
|
-
connections:
|
|
718
|
+
}, [e, a]), {
|
|
719
|
+
connections: O({
|
|
718
720
|
queryKey: s,
|
|
719
721
|
queryFn: async () => {
|
|
720
722
|
try {
|
|
721
|
-
return await
|
|
723
|
+
return await vt(e);
|
|
722
724
|
} catch (l) {
|
|
723
|
-
console.log(l),
|
|
725
|
+
console.log(l), k(r, "Failed to load connections")(l);
|
|
724
726
|
}
|
|
725
727
|
return [];
|
|
726
728
|
},
|
|
727
729
|
staleTime: 3e4,
|
|
728
|
-
placeholderData:
|
|
730
|
+
placeholderData: Ue
|
|
729
731
|
}),
|
|
730
732
|
startWatch: i,
|
|
731
733
|
stopWatch: o
|
|
732
734
|
};
|
|
733
|
-
},
|
|
734
|
-
const n =
|
|
735
|
+
}, Jr = ({ pluginID: t, connectionID: e }) => {
|
|
736
|
+
const n = P(t);
|
|
735
737
|
return {
|
|
736
738
|
/**
|
|
737
739
|
* Get the connection
|
|
738
740
|
*/
|
|
739
|
-
namespaces:
|
|
740
|
-
queryKey: [n, "connection", "namespaces",
|
|
741
|
-
queryFn: async () =>
|
|
741
|
+
namespaces: O({
|
|
742
|
+
queryKey: [n, "connection", "namespaces", e],
|
|
743
|
+
queryFn: async () => bt(n, e)
|
|
742
744
|
})
|
|
743
745
|
};
|
|
744
|
-
},
|
|
745
|
-
function
|
|
746
|
-
const
|
|
746
|
+
}, I = un(Vt, "WatchState");
|
|
747
|
+
function pe(t) {
|
|
748
|
+
const e = Object.values(t.states), n = e.length;
|
|
747
749
|
let r = 0, s = 0, i = 0, o = 0;
|
|
748
|
-
for (const
|
|
749
|
-
|
|
750
|
-
const a = n - o,
|
|
751
|
-
(
|
|
752
|
-
).length, l = a > 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;
|
|
753
755
|
return {
|
|
754
|
-
pluginID:
|
|
755
|
-
connectionID:
|
|
756
|
+
pluginID: t.pluginID,
|
|
757
|
+
connectionID: t.connectionID,
|
|
756
758
|
totalResources: n,
|
|
757
759
|
watchedTotal: a,
|
|
758
760
|
syncedCount: r,
|
|
759
761
|
errorCount: s,
|
|
760
762
|
forbiddenCount: i,
|
|
761
763
|
skippedCount: o,
|
|
762
|
-
doneCount:
|
|
764
|
+
doneCount: c,
|
|
763
765
|
progress: l
|
|
764
766
|
};
|
|
765
767
|
}
|
|
766
|
-
function
|
|
767
|
-
return
|
|
768
|
+
function ne(t) {
|
|
769
|
+
return t.watchedTotal > 0 && t.doneCount >= t.watchedTotal;
|
|
768
770
|
}
|
|
769
|
-
function
|
|
770
|
-
return
|
|
771
|
+
function ze(t) {
|
|
772
|
+
return t.some((e) => !ne(e));
|
|
771
773
|
}
|
|
772
|
-
function
|
|
773
|
-
const
|
|
774
|
-
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;
|
|
775
777
|
}
|
|
776
|
-
function
|
|
777
|
-
return `${
|
|
778
|
+
function ge(t) {
|
|
779
|
+
return `${t.pluginId}/${t.connection}`;
|
|
778
780
|
}
|
|
779
|
-
function
|
|
780
|
-
const n =
|
|
781
|
-
|
|
781
|
+
function Je(t, e) {
|
|
782
|
+
const n = ge(e);
|
|
783
|
+
t.has(n) || t.set(n, {
|
|
782
784
|
states: {},
|
|
783
|
-
pluginID:
|
|
784
|
-
connectionID:
|
|
785
|
+
pluginID: e.pluginId,
|
|
786
|
+
connectionID: e.connection
|
|
785
787
|
});
|
|
786
|
-
const r =
|
|
787
|
-
return r.states[
|
|
788
|
+
const r = t.get(n);
|
|
789
|
+
return r.states[e.resourceKey] = e.state, r;
|
|
788
790
|
}
|
|
789
|
-
function
|
|
790
|
-
const [
|
|
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());
|
|
791
793
|
G(() => {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
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
|
+
}
|
|
810
832
|
}
|
|
811
|
-
|
|
812
|
-
r(m), t(p), i(S);
|
|
833
|
+
r(b), e(F), i(w);
|
|
813
834
|
}).catch(() => {
|
|
814
835
|
});
|
|
815
|
-
}, []), G(() =>
|
|
816
|
-
const
|
|
817
|
-
|
|
818
|
-
const
|
|
819
|
-
return
|
|
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;
|
|
820
841
|
}), i((S) => {
|
|
821
|
-
const
|
|
822
|
-
return
|
|
823
|
-
}), o.current.delete(
|
|
824
|
-
const
|
|
825
|
-
return
|
|
826
|
-
}),
|
|
827
|
-
|
|
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);
|
|
828
853
|
}).catch(() => {
|
|
829
854
|
});
|
|
830
855
|
}), []);
|
|
831
|
-
const
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
if (
|
|
835
|
-
const
|
|
836
|
-
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;
|
|
837
862
|
});
|
|
838
|
-
const
|
|
839
|
-
i((
|
|
840
|
-
const
|
|
841
|
-
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;
|
|
842
867
|
});
|
|
843
868
|
}, []);
|
|
844
|
-
G(() =>
|
|
845
|
-
const u = M(async (
|
|
846
|
-
await
|
|
847
|
-
}, []),
|
|
848
|
-
await
|
|
849
|
-
}, []),
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
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) ?? "",
|
|
857
897
|
isStarted: !0,
|
|
858
|
-
sync:
|
|
859
|
-
isSyncing:
|
|
860
|
-
hasErrors:
|
|
898
|
+
sync: E,
|
|
899
|
+
isSyncing: R,
|
|
900
|
+
hasErrors: L || N != null,
|
|
901
|
+
pluginFailed: N != null,
|
|
902
|
+
pluginError: N
|
|
861
903
|
});
|
|
862
904
|
}
|
|
863
|
-
const
|
|
864
|
-
for (const
|
|
865
|
-
const
|
|
866
|
-
|
|
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);
|
|
867
909
|
}
|
|
868
|
-
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);
|
|
869
911
|
return {
|
|
870
|
-
entries:
|
|
871
|
-
grouped:
|
|
872
|
-
connectedCount:
|
|
873
|
-
syncingCount:
|
|
874
|
-
errorCount:
|
|
875
|
-
|
|
876
|
-
|
|
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(_),
|
|
877
920
|
disconnect: u,
|
|
878
|
-
retryWatch:
|
|
921
|
+
retryWatch: y,
|
|
922
|
+
retryPlugin: f
|
|
879
923
|
};
|
|
880
924
|
}
|
|
881
|
-
function
|
|
882
|
-
return
|
|
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;
|
|
883
927
|
}
|
|
884
|
-
function
|
|
885
|
-
|
|
886
|
-
}
|
|
887
|
-
function Ns(e, t, n) {
|
|
888
|
-
const r = D(e), s = j(), i = [r, "data", t], o = P({
|
|
928
|
+
function Xr(t, e, n) {
|
|
929
|
+
const r = P(t), s = j(), i = [r, "data", e], o = O({
|
|
889
930
|
queryKey: i,
|
|
890
931
|
queryFn: async () => {
|
|
891
|
-
const
|
|
892
|
-
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);
|
|
893
936
|
}
|
|
894
|
-
}), a =
|
|
895
|
-
mutationFn: async (
|
|
896
|
-
await
|
|
937
|
+
}), a = D({
|
|
938
|
+
mutationFn: async (c) => {
|
|
939
|
+
await Pt(r, e, c);
|
|
897
940
|
},
|
|
898
|
-
onMutate: async (
|
|
941
|
+
onMutate: async (c) => {
|
|
899
942
|
await s.cancelQueries({ queryKey: i });
|
|
900
943
|
const l = s.getQueryData(i);
|
|
901
|
-
return s.setQueryData(i,
|
|
944
|
+
return s.setQueryData(i, c), { previous: l };
|
|
902
945
|
},
|
|
903
|
-
onError: (
|
|
904
|
-
(
|
|
946
|
+
onError: (c, l, u) => {
|
|
947
|
+
(u == null ? void 0 : u.previous) !== void 0 && s.setQueryData(i, u.previous);
|
|
905
948
|
},
|
|
906
949
|
onSettled: () => {
|
|
907
950
|
s.invalidateQueries({ queryKey: i });
|
|
@@ -909,127 +952,129 @@ function Ns(e, t, n) {
|
|
|
909
952
|
});
|
|
910
953
|
return {
|
|
911
954
|
data: o.data ?? n,
|
|
912
|
-
update: async (
|
|
913
|
-
await a.mutateAsync(
|
|
955
|
+
update: async (c) => {
|
|
956
|
+
await a.mutateAsync(c);
|
|
914
957
|
},
|
|
915
958
|
isLoading: o.isLoading
|
|
916
959
|
};
|
|
917
960
|
}
|
|
918
|
-
const
|
|
919
|
-
const
|
|
920
|
-
if (!
|
|
921
|
-
return
|
|
922
|
-
},
|
|
923
|
-
const
|
|
924
|
-
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)
|
|
925
968
|
throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
|
|
926
|
-
return
|
|
927
|
-
},
|
|
928
|
-
const
|
|
969
|
+
return t;
|
|
970
|
+
}, es = ({ pluginID: t }) => {
|
|
971
|
+
const e = P(t), { showSnackbar: n } = U(), { createTab: r, updateTab: s } = Ze();
|
|
929
972
|
return {
|
|
930
|
-
createSession:
|
|
931
|
-
mutationFn: async ({ connectionID: o, icon: a, label:
|
|
932
|
-
const
|
|
973
|
+
createSession: D({
|
|
974
|
+
mutationFn: async ({ connectionID: o, icon: a, label: c, opts: l }) => {
|
|
975
|
+
const u = `pending-${crypto.randomUUID()}`;
|
|
933
976
|
r({
|
|
934
|
-
id:
|
|
935
|
-
title:
|
|
977
|
+
id: u,
|
|
978
|
+
title: c ?? "Connecting...",
|
|
936
979
|
variant: "terminal",
|
|
937
980
|
icon: a ?? "LuSquareTerminal",
|
|
938
981
|
properties: {
|
|
939
982
|
status: "connecting",
|
|
940
|
-
pluginID:
|
|
983
|
+
pluginID: e,
|
|
941
984
|
connectionID: o,
|
|
942
985
|
opts: { ...l }
|
|
943
986
|
}
|
|
944
987
|
});
|
|
945
|
-
const
|
|
988
|
+
const y = en.createFrom({
|
|
946
989
|
command: ["/bin/bash"],
|
|
947
990
|
tty: !0,
|
|
948
991
|
...l
|
|
949
992
|
});
|
|
950
993
|
try {
|
|
951
|
-
const f = await
|
|
994
|
+
const f = await Ot(e, o, y);
|
|
995
|
+
if (!f) throw new Error("Failed to create session: null response");
|
|
952
996
|
s(
|
|
953
|
-
{ id:
|
|
997
|
+
{ id: u },
|
|
954
998
|
{
|
|
955
999
|
id: f.id,
|
|
956
|
-
title:
|
|
957
|
-
properties: { status: "connected", pluginID:
|
|
1000
|
+
title: c ?? `Session ${f.id.substring(0, 8)}`,
|
|
1001
|
+
properties: { status: "connected", pluginID: e, connectionID: o, opts: { ...l } }
|
|
958
1002
|
}
|
|
959
1003
|
);
|
|
960
1004
|
} catch (f) {
|
|
961
|
-
const d =
|
|
1005
|
+
const d = Q(f);
|
|
962
1006
|
s(
|
|
963
|
-
{ id:
|
|
1007
|
+
{ id: u },
|
|
964
1008
|
{
|
|
965
|
-
properties: { status: "error", error: d.detail, pluginID:
|
|
1009
|
+
properties: { status: "error", error: d.detail, pluginID: e, connectionID: o, opts: { ...l } }
|
|
966
1010
|
}
|
|
967
|
-
),
|
|
1011
|
+
), z(n, f, "Failed to start session");
|
|
968
1012
|
}
|
|
969
1013
|
}
|
|
970
1014
|
}).mutateAsync
|
|
971
1015
|
};
|
|
972
|
-
},
|
|
973
|
-
const
|
|
1016
|
+
}, ts = ({ pluginID: t }) => {
|
|
1017
|
+
const e = P(t), { showSnackbar: n } = U(), { createTab: r } = Ze(), s = D({
|
|
974
1018
|
mutationFn: async ({
|
|
975
1019
|
connectionID: o,
|
|
976
1020
|
resourceKey: a,
|
|
977
|
-
resourceID:
|
|
1021
|
+
resourceID: c,
|
|
978
1022
|
resourceData: l,
|
|
979
|
-
icon:
|
|
980
|
-
label:
|
|
1023
|
+
icon: u,
|
|
1024
|
+
label: y,
|
|
981
1025
|
target: f,
|
|
982
1026
|
follow: d = !0,
|
|
983
|
-
tailLines:
|
|
984
|
-
params:
|
|
1027
|
+
tailLines: p = 1e3,
|
|
1028
|
+
params: _
|
|
985
1029
|
}) => {
|
|
986
|
-
const
|
|
1030
|
+
const C = tn.createFrom({
|
|
987
1031
|
resource_key: a,
|
|
988
|
-
resource_id:
|
|
1032
|
+
resource_id: c,
|
|
989
1033
|
resource_data: l,
|
|
990
|
-
options:
|
|
1034
|
+
options: nn.createFrom({
|
|
991
1035
|
target: f ?? "",
|
|
992
1036
|
follow: d,
|
|
993
1037
|
include_previous: !1,
|
|
994
1038
|
include_timestamps: !0,
|
|
995
|
-
tail_lines:
|
|
1039
|
+
tail_lines: p,
|
|
996
1040
|
since_seconds: 0,
|
|
997
1041
|
limit_bytes: 0,
|
|
998
1042
|
include_source_events: !0,
|
|
999
|
-
params:
|
|
1043
|
+
params: _ ?? {}
|
|
1000
1044
|
})
|
|
1001
|
-
}),
|
|
1045
|
+
}), g = await Tt(e, o, C);
|
|
1046
|
+
if (!g) throw new Error("Failed to create log session: null response");
|
|
1002
1047
|
return r({
|
|
1003
|
-
id:
|
|
1004
|
-
title:
|
|
1048
|
+
id: g.id,
|
|
1049
|
+
title: y ?? `Logs ${g.id.substring(0, 8)}`,
|
|
1005
1050
|
variant: "logs",
|
|
1006
|
-
icon:
|
|
1007
|
-
}),
|
|
1051
|
+
icon: u ?? "LuLogs"
|
|
1052
|
+
}), g;
|
|
1008
1053
|
},
|
|
1009
|
-
onError:
|
|
1010
|
-
}), i =
|
|
1054
|
+
onError: k(n, "Failed to start log session")
|
|
1055
|
+
}), i = D({
|
|
1011
1056
|
mutationFn: async (o) => {
|
|
1012
|
-
await
|
|
1057
|
+
await At(o);
|
|
1013
1058
|
},
|
|
1014
|
-
onError:
|
|
1059
|
+
onError: k(n, "Failed to close log session")
|
|
1015
1060
|
});
|
|
1016
1061
|
return {
|
|
1017
1062
|
createLogSession: s.mutateAsync,
|
|
1018
1063
|
closeLogSession: i.mutateAsync
|
|
1019
1064
|
};
|
|
1020
|
-
},
|
|
1065
|
+
}, ns = () => O({
|
|
1021
1066
|
queryKey: ["metric", "providers"],
|
|
1022
|
-
queryFn:
|
|
1067
|
+
queryFn: xt,
|
|
1023
1068
|
staleTime: 3e4
|
|
1024
|
-
}),
|
|
1025
|
-
queryKey: ["metric", "providers",
|
|
1026
|
-
queryFn: () =>
|
|
1027
|
-
enabled: !!
|
|
1069
|
+
}), In = (t) => O({
|
|
1070
|
+
queryKey: ["metric", "providers", t],
|
|
1071
|
+
queryFn: () => Nt(t),
|
|
1072
|
+
enabled: !!t,
|
|
1028
1073
|
staleTime: 3e4
|
|
1029
|
-
}),
|
|
1030
|
-
var
|
|
1074
|
+
}), rs = (t) => {
|
|
1075
|
+
var C, g;
|
|
1031
1076
|
const {
|
|
1032
|
-
connectionID:
|
|
1077
|
+
connectionID: e,
|
|
1033
1078
|
resourceKey: n,
|
|
1034
1079
|
resourceID: r,
|
|
1035
1080
|
resourceNamespace: s = "",
|
|
@@ -1037,245 +1082,253 @@ const xs = () => {
|
|
|
1037
1082
|
metricIDs: o = [],
|
|
1038
1083
|
shape: a = 0,
|
|
1039
1084
|
// CURRENT
|
|
1040
|
-
timeRange:
|
|
1085
|
+
timeRange: c,
|
|
1041
1086
|
refreshInterval: l = 0,
|
|
1042
|
-
enabled:
|
|
1043
|
-
} =
|
|
1044
|
-
data:
|
|
1087
|
+
enabled: u = !0
|
|
1088
|
+
} = t, {
|
|
1089
|
+
data: y,
|
|
1045
1090
|
isLoading: f
|
|
1046
|
-
} =
|
|
1047
|
-
Math.floor((
|
|
1091
|
+
} = In(n), d = y ?? [], p = c ? Math.max(
|
|
1092
|
+
Math.floor((c.end.getTime() - c.start.getTime()) / 250),
|
|
1048
1093
|
15e3
|
|
1049
|
-
) * 1e6 : 0,
|
|
1094
|
+
) * 1e6 : 0, _ = O({
|
|
1050
1095
|
queryKey: [
|
|
1051
1096
|
"metric",
|
|
1052
1097
|
"query",
|
|
1053
|
-
|
|
1098
|
+
e,
|
|
1054
1099
|
n,
|
|
1055
1100
|
r,
|
|
1056
1101
|
s,
|
|
1057
1102
|
o,
|
|
1058
1103
|
a,
|
|
1059
|
-
(
|
|
1060
|
-
(
|
|
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()
|
|
1061
1106
|
],
|
|
1062
|
-
queryFn: () =>
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
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,
|
|
1075
1125
|
refetchInterval: l > 0 ? l : void 0,
|
|
1076
1126
|
staleTime: 5e3,
|
|
1077
1127
|
// Keep previous data visible while fetching new data (e.g. on time range change)
|
|
1078
1128
|
// to prevent the chart from blinking empty.
|
|
1079
|
-
placeholderData:
|
|
1129
|
+
placeholderData: Ue
|
|
1080
1130
|
});
|
|
1081
1131
|
return {
|
|
1082
|
-
data:
|
|
1132
|
+
data: _.data ?? void 0,
|
|
1083
1133
|
providers: d,
|
|
1084
|
-
isLoading: f ||
|
|
1085
|
-
error:
|
|
1086
|
-
refetch:
|
|
1134
|
+
isLoading: f || _.isLoading,
|
|
1135
|
+
error: _.error,
|
|
1136
|
+
refetch: _.refetch
|
|
1087
1137
|
};
|
|
1088
|
-
},
|
|
1138
|
+
}, ss = (t) => {
|
|
1089
1139
|
const {
|
|
1090
|
-
pluginID:
|
|
1140
|
+
pluginID: e,
|
|
1091
1141
|
connectionID: n,
|
|
1092
1142
|
resourceKey: r,
|
|
1093
1143
|
resourceID: s,
|
|
1094
1144
|
resourceNamespace: i = "",
|
|
1095
1145
|
resourceData: o = {},
|
|
1096
1146
|
metricIDs: a = [],
|
|
1097
|
-
interval:
|
|
1147
|
+
interval: c = 1e4,
|
|
1098
1148
|
enabled: l = !0
|
|
1099
|
-
} =
|
|
1100
|
-
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))
|
|
1101
1151
|
try {
|
|
1102
|
-
const
|
|
1152
|
+
const w = await Mt(u, n, {
|
|
1103
1153
|
resource_key: r,
|
|
1104
1154
|
resource_id: s,
|
|
1105
1155
|
resource_namespace: i,
|
|
1106
1156
|
resource_data: o,
|
|
1107
1157
|
metric_ids: a,
|
|
1108
|
-
interval:
|
|
1158
|
+
interval: c * 1e6
|
|
1109
1159
|
// ms to nanoseconds for Go time.Duration
|
|
1110
1160
|
});
|
|
1111
|
-
|
|
1112
|
-
const
|
|
1161
|
+
p(w), C(!0), m(null);
|
|
1162
|
+
const S = x(`core/metrics/data/${w}`, (R) => {
|
|
1163
|
+
const L = R.data;
|
|
1113
1164
|
try {
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1116
|
-
} catch (
|
|
1117
|
-
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);
|
|
1118
1169
|
}
|
|
1119
|
-
}),
|
|
1170
|
+
}), E = x(`core/metrics/error/${w}`, (R) => {
|
|
1171
|
+
const L = R.data;
|
|
1120
1172
|
try {
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1173
|
+
const N = JSON.parse(L);
|
|
1174
|
+
m(N.error || "Unknown error");
|
|
1123
1175
|
} catch {
|
|
1124
|
-
|
|
1176
|
+
m("Failed to parse metric stream error");
|
|
1125
1177
|
}
|
|
1126
1178
|
});
|
|
1127
|
-
|
|
1128
|
-
|
|
1179
|
+
h.current = () => {
|
|
1180
|
+
S(), E();
|
|
1129
1181
|
};
|
|
1130
|
-
} catch (
|
|
1131
|
-
|
|
1182
|
+
} catch (w) {
|
|
1183
|
+
m(w instanceof Error ? w.message : String(w));
|
|
1132
1184
|
}
|
|
1133
|
-
}, [
|
|
1185
|
+
}, [u, n, r, s, i, a, c, l]), F = M(async () => {
|
|
1134
1186
|
if (d)
|
|
1135
1187
|
try {
|
|
1136
|
-
await
|
|
1137
|
-
} catch (
|
|
1138
|
-
console.error("Failed to unsubscribe:",
|
|
1188
|
+
await Ee(d);
|
|
1189
|
+
} catch (w) {
|
|
1190
|
+
console.error("Failed to unsubscribe:", w);
|
|
1139
1191
|
}
|
|
1140
|
-
|
|
1192
|
+
h.current && (h.current(), h.current = null), p(null), C(!1);
|
|
1141
1193
|
}, [d]);
|
|
1142
1194
|
return G(() => () => {
|
|
1143
|
-
d &&
|
|
1195
|
+
d && Ee(d).catch(console.error), h.current && h.current();
|
|
1144
1196
|
}, [d]), {
|
|
1145
|
-
data:
|
|
1197
|
+
data: y,
|
|
1146
1198
|
subscriptionID: d,
|
|
1147
|
-
isStreaming:
|
|
1148
|
-
error:
|
|
1149
|
-
start:
|
|
1150
|
-
stop:
|
|
1199
|
+
isStreaming: _,
|
|
1200
|
+
error: g,
|
|
1201
|
+
start: b,
|
|
1202
|
+
stop: F
|
|
1151
1203
|
};
|
|
1152
|
-
},
|
|
1153
|
-
function
|
|
1154
|
-
const { showSnackbar:
|
|
1155
|
-
queryKey: [...
|
|
1156
|
-
queryFn: async () =>
|
|
1157
|
-
if (
|
|
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 [];
|
|
1158
1210
|
throw i;
|
|
1159
1211
|
}),
|
|
1160
1212
|
retry: !1
|
|
1161
1213
|
});
|
|
1162
1214
|
G(() => {
|
|
1163
|
-
const i =
|
|
1164
|
-
|
|
1165
|
-
}), o =
|
|
1166
|
-
|
|
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] });
|
|
1167
1219
|
});
|
|
1168
1220
|
return () => {
|
|
1169
1221
|
i(), o();
|
|
1170
1222
|
};
|
|
1171
|
-
}, [
|
|
1172
|
-
const r = n.data ?? [], s =
|
|
1173
|
-
mutationFn: async (i) =>
|
|
1174
|
-
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"),
|
|
1175
1227
|
onSuccess: async () => {
|
|
1176
|
-
await
|
|
1228
|
+
await e.invalidateQueries({ queryKey: [...H] });
|
|
1177
1229
|
}
|
|
1178
1230
|
});
|
|
1179
1231
|
return {
|
|
1180
1232
|
sessions: n,
|
|
1181
1233
|
activeSessions: r,
|
|
1182
1234
|
closeSession: s.mutateAsync,
|
|
1183
|
-
openInBrowser: (i) =>
|
|
1235
|
+
openInBrowser: (i) => qe(`http://localhost:${i}`)
|
|
1184
1236
|
};
|
|
1185
1237
|
}
|
|
1186
|
-
function
|
|
1187
|
-
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({
|
|
1188
1240
|
queryKey: s,
|
|
1189
|
-
queryFn: async () =>
|
|
1241
|
+
queryFn: async () => $t(r, e, rn.createFrom({
|
|
1190
1242
|
resource_id: n,
|
|
1191
|
-
connection_id:
|
|
1192
|
-
})).catch((
|
|
1193
|
-
const
|
|
1194
|
-
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 }), []);
|
|
1195
1247
|
}),
|
|
1196
1248
|
retry: !1
|
|
1197
|
-
}),
|
|
1198
|
-
mutationFn: async ({ opts:
|
|
1199
|
-
const
|
|
1200
|
-
local_port:
|
|
1201
|
-
remote_port:
|
|
1202
|
-
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",
|
|
1203
1255
|
connection_type: "RESOURCE",
|
|
1204
1256
|
connection: {
|
|
1205
|
-
resource_data:
|
|
1206
|
-
connection_id:
|
|
1257
|
+
resource_data: u.resource,
|
|
1258
|
+
connection_id: e,
|
|
1207
1259
|
plugin_id: r,
|
|
1208
|
-
resource_id:
|
|
1209
|
-
resource_key:
|
|
1260
|
+
resource_id: u.resourceId,
|
|
1261
|
+
resource_key: u.resourceKey
|
|
1210
1262
|
},
|
|
1211
|
-
labels:
|
|
1212
|
-
params:
|
|
1213
|
-
}), f = await
|
|
1214
|
-
|
|
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;
|
|
1215
1268
|
},
|
|
1216
|
-
onError:
|
|
1269
|
+
onError: k(i, "Failed to start port forwarding session"),
|
|
1217
1270
|
onSuccess: async () => {
|
|
1218
1271
|
await Promise.all([
|
|
1219
1272
|
o.invalidateQueries({ queryKey: s }),
|
|
1220
|
-
o.invalidateQueries({ queryKey: [...
|
|
1273
|
+
o.invalidateQueries({ queryKey: [...H] })
|
|
1221
1274
|
]);
|
|
1222
1275
|
}
|
|
1223
|
-
}), l =
|
|
1224
|
-
mutationFn: async ({ opts:
|
|
1225
|
-
onError:
|
|
1276
|
+
}), l = D({
|
|
1277
|
+
mutationFn: async ({ opts: u }) => Pe(u.sessionID),
|
|
1278
|
+
onError: k(i, "Failed to close port forwarding session"),
|
|
1226
1279
|
onSuccess: async () => {
|
|
1227
1280
|
await Promise.all([
|
|
1228
1281
|
o.invalidateQueries({ queryKey: s }),
|
|
1229
|
-
o.invalidateQueries({ queryKey: [...
|
|
1282
|
+
o.invalidateQueries({ queryKey: [...H] })
|
|
1230
1283
|
]);
|
|
1231
1284
|
}
|
|
1232
1285
|
});
|
|
1233
1286
|
return {
|
|
1234
1287
|
sessions: a,
|
|
1235
|
-
forward:
|
|
1288
|
+
forward: c.mutateAsync,
|
|
1236
1289
|
close: l.mutateAsync
|
|
1237
1290
|
};
|
|
1238
1291
|
}
|
|
1239
|
-
const
|
|
1240
|
-
const
|
|
1241
|
-
if (!
|
|
1242
|
-
return
|
|
1243
|
-
},
|
|
1244
|
-
pluginID:
|
|
1245
|
-
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,
|
|
1246
1299
|
resourceKey: n,
|
|
1247
1300
|
resourceID: r,
|
|
1248
1301
|
namespace: s = ""
|
|
1249
1302
|
}) => {
|
|
1250
|
-
const i =
|
|
1251
|
-
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({
|
|
1252
1305
|
input: f.input,
|
|
1253
1306
|
id: r,
|
|
1254
1307
|
namespace: s
|
|
1255
1308
|
})),
|
|
1256
1309
|
onSuccess: async () => {
|
|
1257
|
-
a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey:
|
|
1310
|
+
a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey: c });
|
|
1258
1311
|
},
|
|
1259
|
-
onError:
|
|
1260
|
-
}), { mutateAsync:
|
|
1261
|
-
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({
|
|
1262
1315
|
id: r,
|
|
1263
1316
|
namespace: s,
|
|
1264
1317
|
gracePeriodSeconds: f.gracePeriodSeconds
|
|
1265
1318
|
})),
|
|
1266
1319
|
onSuccess: async () => {
|
|
1267
|
-
a(`Resource ${r} deleted`, "success"), await o.invalidateQueries({ queryKey:
|
|
1320
|
+
a(`Resource ${r} deleted`, "success"), await o.invalidateQueries({ queryKey: c });
|
|
1268
1321
|
},
|
|
1269
|
-
onError:
|
|
1322
|
+
onError: k(a, `Failed to delete resource ${r}`)
|
|
1270
1323
|
});
|
|
1271
1324
|
return {
|
|
1272
1325
|
/**
|
|
1273
1326
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1274
1327
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1275
1328
|
*/
|
|
1276
|
-
resource:
|
|
1277
|
-
queryKey:
|
|
1278
|
-
queryFn: async () =>
|
|
1329
|
+
resource: O({
|
|
1330
|
+
queryKey: c,
|
|
1331
|
+
queryFn: async () => qt(i, e, n, on.createFrom({
|
|
1279
1332
|
id: r,
|
|
1280
1333
|
namespace: s
|
|
1281
1334
|
})),
|
|
@@ -1294,890 +1347,425 @@ const js = () => {
|
|
|
1294
1347
|
*
|
|
1295
1348
|
* @params {object} opts Optional parameters to pass to the resource delete
|
|
1296
1349
|
*/
|
|
1297
|
-
remove:
|
|
1350
|
+
remove: u
|
|
1298
1351
|
};
|
|
1299
|
-
},
|
|
1300
|
-
const
|
|
1352
|
+
}, us = (t) => {
|
|
1353
|
+
const e = ["component", t.plugin, t.resource, t.area];
|
|
1301
1354
|
return {
|
|
1302
1355
|
/**
|
|
1303
1356
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1304
1357
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1305
1358
|
*/
|
|
1306
|
-
component:
|
|
1307
|
-
queryKey:
|
|
1308
|
-
queryFn: async () =>
|
|
1359
|
+
component: O({
|
|
1360
|
+
queryKey: e,
|
|
1361
|
+
queryFn: async () => Wt(t)
|
|
1309
1362
|
})
|
|
1310
1363
|
};
|
|
1311
|
-
},
|
|
1312
|
-
const n =
|
|
1364
|
+
}, ls = ({ pluginID: t, connectionID: e }) => {
|
|
1365
|
+
const n = P(t);
|
|
1313
1366
|
return {
|
|
1314
1367
|
/**
|
|
1315
|
-
* The
|
|
1368
|
+
* The resource groups for the given plugin and connection.
|
|
1316
1369
|
*/
|
|
1317
|
-
groups:
|
|
1370
|
+
groups: O({
|
|
1318
1371
|
queryKey: [n, "resource_groups", "list"],
|
|
1319
|
-
queryFn: async () =>
|
|
1372
|
+
queryFn: async () => Gt(n, e),
|
|
1320
1373
|
retry: !1
|
|
1321
1374
|
})
|
|
1322
1375
|
};
|
|
1323
|
-
},
|
|
1324
|
-
pluginID:
|
|
1325
|
-
connectionID:
|
|
1376
|
+
}, ds = ({
|
|
1377
|
+
pluginID: t,
|
|
1378
|
+
connectionID: e,
|
|
1326
1379
|
searches: n
|
|
1327
1380
|
}) => {
|
|
1328
|
-
const r =
|
|
1329
|
-
return
|
|
1381
|
+
const r = P(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
|
|
1382
|
+
return an({
|
|
1330
1383
|
queries: n.map((o) => ({
|
|
1331
1384
|
queryKey: s(o),
|
|
1332
|
-
queryFn: async () =>
|
|
1385
|
+
queryFn: async () => Ae(r, e, o.key, Me.createFrom({
|
|
1333
1386
|
order: [{ field: "name", descending: !1 }],
|
|
1334
1387
|
pagination: { page: 1, pageSize: 200 },
|
|
1335
1388
|
namespaces: o.namespaces
|
|
1336
|
-
})).then((a) => (console.log(a.result), a.result && o.postFilter ? Object.values(a.result).filter(o.postFilter) : Object.values(a.result || {}))),
|
|
1389
|
+
})).then((a) => a ? (console.log(a.result), a.result && o.postFilter ? Object.values(a.result).filter(o.postFilter) : Object.values(a.result || {})) : []),
|
|
1337
1390
|
retry: !1
|
|
1338
1391
|
}))
|
|
1339
1392
|
});
|
|
1340
|
-
},
|
|
1341
|
-
const n =
|
|
1393
|
+
}, fs = ({ pluginID: t, resourceKey: e }) => {
|
|
1394
|
+
const n = P(t);
|
|
1342
1395
|
return {
|
|
1343
1396
|
/**
|
|
1344
1397
|
* The current settings from the provider.
|
|
1345
1398
|
*/
|
|
1346
|
-
resourceType:
|
|
1347
|
-
queryKey: [n, "resources",
|
|
1348
|
-
queryFn: async () =>
|
|
1399
|
+
resourceType: O({
|
|
1400
|
+
queryKey: [n, "resources", e],
|
|
1401
|
+
queryFn: async () => jt(n, e),
|
|
1349
1402
|
retry: !1
|
|
1350
1403
|
})
|
|
1351
1404
|
};
|
|
1352
|
-
},
|
|
1353
|
-
const n =
|
|
1405
|
+
}, ps = ({ pluginID: t, connectionID: e }) => {
|
|
1406
|
+
const n = P(t);
|
|
1354
1407
|
return {
|
|
1355
1408
|
/**
|
|
1356
|
-
* The
|
|
1409
|
+
* The resource types for the given plugin and connection.
|
|
1357
1410
|
*/
|
|
1358
|
-
types:
|
|
1359
|
-
queryKey: [n, "resources", "list"],
|
|
1360
|
-
queryFn: async () =>
|
|
1411
|
+
types: O({
|
|
1412
|
+
queryKey: [n, "resources", "list", e],
|
|
1413
|
+
queryFn: async () => Qt(n, e),
|
|
1361
1414
|
retry: !1
|
|
1362
1415
|
})
|
|
1363
1416
|
};
|
|
1364
1417
|
};
|
|
1365
|
-
var
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
1369
|
-
},
|
|
1370
|
-
function(e) {
|
|
1371
|
-
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}'`;
|
|
1372
|
-
},
|
|
1373
|
-
"This object has been frozen and should not be mutated",
|
|
1374
|
-
function(e) {
|
|
1375
|
-
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
|
|
1376
|
-
},
|
|
1377
|
-
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
1378
|
-
"Immer forbids circular references",
|
|
1379
|
-
"The first or second argument to `produce` must be a function",
|
|
1380
|
-
"The third argument to `produce` must be a function or undefined",
|
|
1381
|
-
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
1382
|
-
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
1383
|
-
function(e) {
|
|
1384
|
-
return `'current' expects a draft, got: ${e}`;
|
|
1385
|
-
},
|
|
1386
|
-
"Object.defineProperty() cannot be used on an Immer draft",
|
|
1387
|
-
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
1388
|
-
"Immer only supports deleting array indices",
|
|
1389
|
-
"Immer only supports setting array indices and the 'length' property",
|
|
1390
|
-
function(e) {
|
|
1391
|
-
return `'original' expects a draft, got: ${e}`;
|
|
1392
|
-
}
|
|
1393
|
-
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
1394
|
-
// See Patches.ts for additional errors
|
|
1395
|
-
] : [];
|
|
1396
|
-
function T(e, ...t) {
|
|
1397
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1398
|
-
const n = Xn[e], r = typeof n == "function" ? n.apply(null, t) : n;
|
|
1399
|
-
throw new Error(`[Immer] ${r}`);
|
|
1400
|
-
}
|
|
1401
|
-
throw new Error(
|
|
1402
|
-
`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
|
|
1403
|
-
);
|
|
1404
|
-
}
|
|
1405
|
-
var ee = Object.getPrototypeOf;
|
|
1406
|
-
function te(e) {
|
|
1407
|
-
return !!e && !!e[x];
|
|
1408
|
-
}
|
|
1409
|
-
function B(e) {
|
|
1410
|
-
var t;
|
|
1411
|
-
return e ? It(e) || Array.isArray(e) || !!e[Ve] || !!((t = e.constructor) != null && t[Ve]) || me(e) || _e(e) : !1;
|
|
1412
|
-
}
|
|
1413
|
-
var Zn = Object.prototype.constructor.toString();
|
|
1414
|
-
function It(e) {
|
|
1415
|
-
if (!e || typeof e != "object")
|
|
1416
|
-
return !1;
|
|
1417
|
-
const t = ee(e);
|
|
1418
|
-
if (t === null)
|
|
1419
|
-
return !0;
|
|
1420
|
-
const n = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
|
|
1421
|
-
return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) === Zn;
|
|
1422
|
-
}
|
|
1423
|
-
function fe(e, t) {
|
|
1424
|
-
ge(e) === 0 ? Reflect.ownKeys(e).forEach((n) => {
|
|
1425
|
-
t(n, e[n], e);
|
|
1426
|
-
}) : e.forEach((n, r) => t(r, n, e));
|
|
1427
|
-
}
|
|
1428
|
-
function ge(e) {
|
|
1429
|
-
const t = e[x];
|
|
1430
|
-
return t ? t.type_ : Array.isArray(e) ? 1 : me(e) ? 2 : _e(e) ? 3 : 0;
|
|
1431
|
-
}
|
|
1432
|
-
function Ae(e, t) {
|
|
1433
|
-
return ge(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
1434
|
-
}
|
|
1435
|
-
function Rt(e, t, n) {
|
|
1436
|
-
const r = ge(e);
|
|
1437
|
-
r === 2 ? e.set(t, n) : r === 3 ? e.add(n) : e[t] = n;
|
|
1438
|
-
}
|
|
1439
|
-
function er(e, t) {
|
|
1440
|
-
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
1441
|
-
}
|
|
1442
|
-
function me(e) {
|
|
1443
|
-
return e instanceof Map;
|
|
1444
|
-
}
|
|
1445
|
-
function _e(e) {
|
|
1446
|
-
return e instanceof Set;
|
|
1447
|
-
}
|
|
1448
|
-
function W(e) {
|
|
1449
|
-
return e.copy_ || e.base_;
|
|
1450
|
-
}
|
|
1451
|
-
function Ne(e, t) {
|
|
1452
|
-
if (me(e))
|
|
1453
|
-
return new Map(e);
|
|
1454
|
-
if (_e(e))
|
|
1455
|
-
return new Set(e);
|
|
1456
|
-
if (Array.isArray(e))
|
|
1457
|
-
return Array.prototype.slice.call(e);
|
|
1458
|
-
const n = It(e);
|
|
1459
|
-
if (t === !0 || t === "class_only" && !n) {
|
|
1460
|
-
const r = Object.getOwnPropertyDescriptors(e);
|
|
1461
|
-
delete r[x];
|
|
1462
|
-
let s = Reflect.ownKeys(r);
|
|
1463
|
-
for (let i = 0; i < s.length; i++) {
|
|
1464
|
-
const o = s[i], a = r[o];
|
|
1465
|
-
a.writable === !1 && (a.writable = !0, a.configurable = !0), (a.get || a.set) && (r[o] = {
|
|
1466
|
-
configurable: !0,
|
|
1467
|
-
writable: !0,
|
|
1468
|
-
// could live with !!desc.set as well here...
|
|
1469
|
-
enumerable: a.enumerable,
|
|
1470
|
-
value: e[o]
|
|
1471
|
-
});
|
|
1472
|
-
}
|
|
1473
|
-
return Object.create(ee(e), r);
|
|
1474
|
-
} else {
|
|
1475
|
-
const r = ee(e);
|
|
1476
|
-
if (r !== null && n)
|
|
1477
|
-
return { ...e };
|
|
1478
|
-
const s = Object.create(r);
|
|
1479
|
-
return Object.assign(s, e);
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
function Ge(e, t = !1) {
|
|
1483
|
-
return Se(e) || te(e) || !B(e) || (ge(e) > 1 && (e.set = e.add = e.clear = e.delete = tr), Object.freeze(e), t && Object.entries(e).forEach(([n, r]) => Ge(r, !0))), e;
|
|
1484
|
-
}
|
|
1485
|
-
function tr() {
|
|
1486
|
-
T(2);
|
|
1487
|
-
}
|
|
1488
|
-
function Se(e) {
|
|
1489
|
-
return Object.isFrozen(e);
|
|
1490
|
-
}
|
|
1491
|
-
var nr = {};
|
|
1492
|
-
function H(e) {
|
|
1493
|
-
const t = nr[e];
|
|
1494
|
-
return t || T(0, e), t;
|
|
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;
|
|
1495
1421
|
}
|
|
1496
|
-
var
|
|
1497
|
-
function
|
|
1498
|
-
return
|
|
1499
|
-
}
|
|
1500
|
-
function rr(e, t) {
|
|
1501
|
-
return {
|
|
1502
|
-
drafts_: [],
|
|
1503
|
-
parent_: e,
|
|
1504
|
-
immer_: t,
|
|
1505
|
-
// Whenever the modified draft contains a draft from another scope, we
|
|
1506
|
-
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
1507
|
-
canAutoFreeze_: !0,
|
|
1508
|
-
unfinalizedDrafts_: 0
|
|
1509
|
-
};
|
|
1510
|
-
}
|
|
1511
|
-
function Xe(e, t) {
|
|
1512
|
-
t && (H("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
1513
|
-
}
|
|
1514
|
-
function xe(e) {
|
|
1515
|
-
ke(e), e.drafts_.forEach(sr), e.drafts_ = null;
|
|
1516
|
-
}
|
|
1517
|
-
function ke(e) {
|
|
1518
|
-
e === oe && (oe = e.parent_);
|
|
1519
|
-
}
|
|
1520
|
-
function Ze(e) {
|
|
1521
|
-
return oe = rr(oe, e);
|
|
1522
|
-
}
|
|
1523
|
-
function sr(e) {
|
|
1524
|
-
const t = e[x];
|
|
1525
|
-
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
|
|
1526
|
-
}
|
|
1527
|
-
function et(e, t) {
|
|
1528
|
-
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
1529
|
-
const n = t.drafts_[0];
|
|
1530
|
-
return e !== void 0 && e !== n ? (n[x].modified_ && (xe(t), T(4)), B(e) && (e = pe(t, e), t.parent_ || ye(t, e)), t.patches_ && H("Patches").generateReplacementPatches_(
|
|
1531
|
-
n[x].base_,
|
|
1532
|
-
e,
|
|
1533
|
-
t.patches_,
|
|
1534
|
-
t.inversePatches_
|
|
1535
|
-
)) : e = pe(t, n, []), xe(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Pt ? e : void 0;
|
|
1536
|
-
}
|
|
1537
|
-
function pe(e, t, n) {
|
|
1538
|
-
if (Se(t))
|
|
1539
|
-
return t;
|
|
1540
|
-
const r = t[x];
|
|
1541
|
-
if (!r)
|
|
1542
|
-
return fe(
|
|
1543
|
-
t,
|
|
1544
|
-
(s, i) => tt(e, r, t, s, i, n)
|
|
1545
|
-
), t;
|
|
1546
|
-
if (r.scope_ !== e)
|
|
1547
|
-
return t;
|
|
1548
|
-
if (!r.modified_)
|
|
1549
|
-
return ye(e, r.base_, !0), r.base_;
|
|
1550
|
-
if (!r.finalized_) {
|
|
1551
|
-
r.finalized_ = !0, r.scope_.unfinalizedDrafts_--;
|
|
1552
|
-
const s = r.copy_;
|
|
1553
|
-
let i = s, o = !1;
|
|
1554
|
-
r.type_ === 3 && (i = new Set(s), s.clear(), o = !0), fe(
|
|
1555
|
-
i,
|
|
1556
|
-
(a, u) => tt(e, r, s, a, u, n, o)
|
|
1557
|
-
), ye(e, s, !1), n && e.patches_ && H("Patches").generatePatches_(
|
|
1558
|
-
r,
|
|
1559
|
-
n,
|
|
1560
|
-
e.patches_,
|
|
1561
|
-
e.inversePatches_
|
|
1562
|
-
);
|
|
1563
|
-
}
|
|
1564
|
-
return r.copy_;
|
|
1565
|
-
}
|
|
1566
|
-
function tt(e, t, n, r, s, i, o) {
|
|
1567
|
-
if (process.env.NODE_ENV !== "production" && s === n && T(5), te(s)) {
|
|
1568
|
-
const a = i && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
1569
|
-
!Ae(t.assigned_, r) ? i.concat(r) : void 0, u = pe(e, s, a);
|
|
1570
|
-
if (Rt(n, r, u), te(u))
|
|
1571
|
-
e.canAutoFreeze_ = !1;
|
|
1572
|
-
else
|
|
1573
|
-
return;
|
|
1574
|
-
} else o && n.add(s);
|
|
1575
|
-
if (B(s) && !Se(s)) {
|
|
1576
|
-
if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
|
|
1577
|
-
return;
|
|
1578
|
-
pe(e, s), (!t || !t.scope_.parent_) && typeof r != "symbol" && Object.prototype.propertyIsEnumerable.call(n, r) && ye(e, s);
|
|
1579
|
-
}
|
|
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];
|
|
1580
1425
|
}
|
|
1581
|
-
function
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
function or(e, t) {
|
|
1585
|
-
const n = Array.isArray(e), r = {
|
|
1586
|
-
type_: n ? 1 : 0,
|
|
1587
|
-
// Track which produce call this is associated with.
|
|
1588
|
-
scope_: t ? t.scope_ : Ft(),
|
|
1589
|
-
// True for both shallow and deep changes.
|
|
1590
|
-
modified_: !1,
|
|
1591
|
-
// Used during finalization.
|
|
1592
|
-
finalized_: !1,
|
|
1593
|
-
// Track which properties have been assigned (true) or deleted (false).
|
|
1594
|
-
assigned_: {},
|
|
1595
|
-
// The parent draft state.
|
|
1596
|
-
parent_: t,
|
|
1597
|
-
// The base state.
|
|
1598
|
-
base_: e,
|
|
1599
|
-
// The base proxy.
|
|
1600
|
-
draft_: null,
|
|
1601
|
-
// set below
|
|
1602
|
-
// The base copy with any updated values.
|
|
1603
|
-
copy_: null,
|
|
1604
|
-
// Called by the `produce` function.
|
|
1605
|
-
revoke_: null,
|
|
1606
|
-
isManual_: !1
|
|
1607
|
-
};
|
|
1608
|
-
let s = r, i = je;
|
|
1609
|
-
n && (s = [r], i = ie);
|
|
1610
|
-
const { revoke: o, proxy: a } = Proxy.revocable(s, i);
|
|
1611
|
-
return r.draft_ = a, r.revoke_ = o, a;
|
|
1612
|
-
}
|
|
1613
|
-
var je = {
|
|
1614
|
-
get(e, t) {
|
|
1615
|
-
if (t === x)
|
|
1616
|
-
return e;
|
|
1617
|
-
const n = W(e);
|
|
1618
|
-
if (!Ae(n, t))
|
|
1619
|
-
return ir(e, n, t);
|
|
1620
|
-
const r = n[t];
|
|
1621
|
-
return e.finalized_ || !B(r) ? r : r === Pe(e.base_, t) ? (Ie(e), e.copy_[t] = Le(r, e)) : r;
|
|
1622
|
-
},
|
|
1623
|
-
has(e, t) {
|
|
1624
|
-
return t in W(e);
|
|
1625
|
-
},
|
|
1626
|
-
ownKeys(e) {
|
|
1627
|
-
return Reflect.ownKeys(W(e));
|
|
1628
|
-
},
|
|
1629
|
-
set(e, t, n) {
|
|
1630
|
-
const r = Ot(W(e), t);
|
|
1631
|
-
if (r != null && r.set)
|
|
1632
|
-
return r.set.call(e.draft_, n), !0;
|
|
1633
|
-
if (!e.modified_) {
|
|
1634
|
-
const s = Pe(W(e), t), i = s == null ? void 0 : s[x];
|
|
1635
|
-
if (i && i.base_ === n)
|
|
1636
|
-
return e.copy_[t] = n, e.assigned_[t] = !1, !0;
|
|
1637
|
-
if (er(n, s) && (n !== void 0 || Ae(e.base_, t)))
|
|
1638
|
-
return !0;
|
|
1639
|
-
Ie(e), Me(e);
|
|
1640
|
-
}
|
|
1641
|
-
return e.copy_[t] === n && // special case: handle new props with value 'undefined'
|
|
1642
|
-
(n !== void 0 || t in e.copy_) || // special case: NaN
|
|
1643
|
-
Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n, e.assigned_[t] = !0), !0;
|
|
1644
|
-
},
|
|
1645
|
-
deleteProperty(e, t) {
|
|
1646
|
-
return Pe(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, Ie(e), Me(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
|
|
1647
|
-
},
|
|
1648
|
-
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
1649
|
-
// the same guarantee in ES5 mode.
|
|
1650
|
-
getOwnPropertyDescriptor(e, t) {
|
|
1651
|
-
const n = W(e), r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
1652
|
-
return r && {
|
|
1653
|
-
writable: !0,
|
|
1654
|
-
configurable: e.type_ !== 1 || t !== "length",
|
|
1655
|
-
enumerable: r.enumerable,
|
|
1656
|
-
value: n[t]
|
|
1657
|
-
};
|
|
1658
|
-
},
|
|
1659
|
-
defineProperty() {
|
|
1660
|
-
T(11);
|
|
1661
|
-
},
|
|
1662
|
-
getPrototypeOf(e) {
|
|
1663
|
-
return ee(e.base_);
|
|
1664
|
-
},
|
|
1665
|
-
setPrototypeOf() {
|
|
1666
|
-
T(12);
|
|
1667
|
-
}
|
|
1668
|
-
}, ie = {};
|
|
1669
|
-
fe(je, (e, t) => {
|
|
1670
|
-
ie[e] = function() {
|
|
1671
|
-
return arguments[0] = arguments[0][0], t.apply(this, arguments);
|
|
1672
|
-
};
|
|
1673
|
-
});
|
|
1674
|
-
ie.deleteProperty = function(e, t) {
|
|
1675
|
-
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && T(13), ie.set.call(this, e, t, void 0);
|
|
1676
|
-
};
|
|
1677
|
-
ie.set = function(e, t, n) {
|
|
1678
|
-
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && T(14), je.set.call(this, e[0], t, n, e[0]);
|
|
1679
|
-
};
|
|
1680
|
-
function Pe(e, t) {
|
|
1681
|
-
const n = e[x];
|
|
1682
|
-
return (n ? W(n) : e)[t];
|
|
1683
|
-
}
|
|
1684
|
-
function ir(e, t, n) {
|
|
1685
|
-
var s;
|
|
1686
|
-
const r = Ot(t, n);
|
|
1687
|
-
return r ? "value" in r ? r.value : (
|
|
1688
|
-
// This is a very special case, if the prop is a getter defined by the
|
|
1689
|
-
// prototype, we should invoke it with the draft as context!
|
|
1690
|
-
(s = r.get) == null ? void 0 : s.call(e.draft_)
|
|
1691
|
-
) : void 0;
|
|
1692
|
-
}
|
|
1693
|
-
function Ot(e, t) {
|
|
1694
|
-
if (!(t in e))
|
|
1695
|
-
return;
|
|
1696
|
-
let n = ee(e);
|
|
1697
|
-
for (; n; ) {
|
|
1698
|
-
const r = Object.getOwnPropertyDescriptor(n, t);
|
|
1699
|
-
if (r)
|
|
1700
|
-
return r;
|
|
1701
|
-
n = ee(n);
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
function Me(e) {
|
|
1705
|
-
e.modified_ || (e.modified_ = !0, e.parent_ && Me(e.parent_));
|
|
1706
|
-
}
|
|
1707
|
-
function Ie(e) {
|
|
1708
|
-
e.copy_ || (e.copy_ = Ne(
|
|
1709
|
-
e.base_,
|
|
1710
|
-
e.scope_.immer_.useStrictShallowCopy_
|
|
1711
|
-
));
|
|
1712
|
-
}
|
|
1713
|
-
var ar = class {
|
|
1714
|
-
constructor(e) {
|
|
1715
|
-
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, n, r) => {
|
|
1716
|
-
if (typeof t == "function" && typeof n != "function") {
|
|
1717
|
-
const i = n;
|
|
1718
|
-
n = t;
|
|
1719
|
-
const o = this;
|
|
1720
|
-
return function(u = i, ...l) {
|
|
1721
|
-
return o.produce(u, (c) => n.call(this, c, ...l));
|
|
1722
|
-
};
|
|
1723
|
-
}
|
|
1724
|
-
typeof n != "function" && T(6), r !== void 0 && typeof r != "function" && T(7);
|
|
1725
|
-
let s;
|
|
1726
|
-
if (B(t)) {
|
|
1727
|
-
const i = Ze(this), o = Le(t, void 0);
|
|
1728
|
-
let a = !0;
|
|
1729
|
-
try {
|
|
1730
|
-
s = n(o), a = !1;
|
|
1731
|
-
} finally {
|
|
1732
|
-
a ? xe(i) : ke(i);
|
|
1733
|
-
}
|
|
1734
|
-
return Xe(i, r), et(s, i);
|
|
1735
|
-
} else if (!t || typeof t != "object") {
|
|
1736
|
-
if (s = n(t), s === void 0 && (s = t), s === Pt && (s = void 0), this.autoFreeze_ && Ge(s, !0), r) {
|
|
1737
|
-
const i = [], o = [];
|
|
1738
|
-
H("Patches").generateReplacementPatches_(t, s, i, o), r(i, o);
|
|
1739
|
-
}
|
|
1740
|
-
return s;
|
|
1741
|
-
} else
|
|
1742
|
-
T(1, t);
|
|
1743
|
-
}, this.produceWithPatches = (t, n) => {
|
|
1744
|
-
if (typeof t == "function")
|
|
1745
|
-
return (o, ...a) => this.produceWithPatches(o, (u) => t(u, ...a));
|
|
1746
|
-
let r, s;
|
|
1747
|
-
return [this.produce(t, n, (o, a) => {
|
|
1748
|
-
r = o, s = a;
|
|
1749
|
-
}), r, s];
|
|
1750
|
-
}, typeof (e == null ? void 0 : e.autoFreeze) == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof (e == null ? void 0 : e.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy);
|
|
1751
|
-
}
|
|
1752
|
-
createDraft(e) {
|
|
1753
|
-
B(e) || T(8), te(e) && (e = cr(e));
|
|
1754
|
-
const t = Ze(this), n = Le(e, void 0);
|
|
1755
|
-
return n[x].isManual_ = !0, ke(t), n;
|
|
1756
|
-
}
|
|
1757
|
-
finishDraft(e, t) {
|
|
1758
|
-
const n = e && e[x];
|
|
1759
|
-
(!n || !n.isManual_) && T(9);
|
|
1760
|
-
const { scope_: r } = n;
|
|
1761
|
-
return Xe(r, t), et(void 0, r);
|
|
1762
|
-
}
|
|
1763
|
-
/**
|
|
1764
|
-
* Pass true to automatically freeze all copies created by Immer.
|
|
1765
|
-
*
|
|
1766
|
-
* By default, auto-freezing is enabled.
|
|
1767
|
-
*/
|
|
1768
|
-
setAutoFreeze(e) {
|
|
1769
|
-
this.autoFreeze_ = e;
|
|
1770
|
-
}
|
|
1771
|
-
/**
|
|
1772
|
-
* Pass true to enable strict shallow copy.
|
|
1773
|
-
*
|
|
1774
|
-
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
1775
|
-
*/
|
|
1776
|
-
setUseStrictShallowCopy(e) {
|
|
1777
|
-
this.useStrictShallowCopy_ = e;
|
|
1778
|
-
}
|
|
1779
|
-
applyPatches(e, t) {
|
|
1780
|
-
let n;
|
|
1781
|
-
for (n = t.length - 1; n >= 0; n--) {
|
|
1782
|
-
const s = t[n];
|
|
1783
|
-
if (s.path.length === 0 && s.op === "replace") {
|
|
1784
|
-
e = s.value;
|
|
1785
|
-
break;
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
n > -1 && (t = t.slice(n + 1));
|
|
1789
|
-
const r = H("Patches").applyPatches_;
|
|
1790
|
-
return te(e) ? r(e, t) : this.produce(
|
|
1791
|
-
e,
|
|
1792
|
-
(s) => r(s, t)
|
|
1793
|
-
);
|
|
1794
|
-
}
|
|
1795
|
-
};
|
|
1796
|
-
function Le(e, t) {
|
|
1797
|
-
const n = me(e) ? H("MapSet").proxyMap_(e, t) : _e(e) ? H("MapSet").proxySet_(e, t) : or(e, t);
|
|
1798
|
-
return (t ? t.scope_ : Ft()).drafts_.push(n), n;
|
|
1799
|
-
}
|
|
1800
|
-
function cr(e) {
|
|
1801
|
-
return te(e) || T(10, e), Tt(e);
|
|
1802
|
-
}
|
|
1803
|
-
function Tt(e) {
|
|
1804
|
-
if (!B(e) || Se(e))
|
|
1805
|
-
return e;
|
|
1806
|
-
const t = e[x];
|
|
1807
|
-
let n;
|
|
1808
|
-
if (t) {
|
|
1809
|
-
if (!t.modified_)
|
|
1810
|
-
return t.base_;
|
|
1811
|
-
t.finalized_ = !0, n = Ne(e, t.scope_.immer_.useStrictShallowCopy_);
|
|
1812
|
-
} else
|
|
1813
|
-
n = Ne(e, !0);
|
|
1814
|
-
return fe(n, (r, s) => {
|
|
1815
|
-
Rt(n, r, Tt(s));
|
|
1816
|
-
}), t && (t.finalized_ = !1), n;
|
|
1817
|
-
}
|
|
1818
|
-
var k = new ar(), At = k.produce;
|
|
1819
|
-
k.produceWithPatches.bind(
|
|
1820
|
-
k
|
|
1821
|
-
);
|
|
1822
|
-
k.setAutoFreeze.bind(k);
|
|
1823
|
-
k.setUseStrictShallowCopy.bind(k);
|
|
1824
|
-
k.applyPatches.bind(k);
|
|
1825
|
-
k.createDraft.bind(k);
|
|
1826
|
-
k.finishDraft.bind(k);
|
|
1827
|
-
var le = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1828
|
-
function ur(e) {
|
|
1829
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1830
|
-
}
|
|
1831
|
-
var lr = "Expected a function", Nt = "__lodash_hash_undefined__", dr = "[object Function]", fr = "[object GeneratorFunction]", pr = "[object Symbol]", yr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, hr = /^\w*$/, gr = /^\./, mr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, _r = /[\\^$.*+?()[\]{}|]/g, Sr = /\\(\\)?/g, Er = /^\[object .+?Constructor\]$/, wr = typeof le == "object" && le && le.Object === Object && le, Cr = typeof self == "object" && self && self.Object === Object && self, ze = wr || Cr || Function("return this")();
|
|
1832
|
-
function br(e, t) {
|
|
1833
|
-
return e == null ? void 0 : e[t];
|
|
1834
|
-
}
|
|
1835
|
-
function vr(e) {
|
|
1836
|
-
var t = !1;
|
|
1837
|
-
if (e != null && typeof e.toString != "function")
|
|
1426
|
+
function Gn(t) {
|
|
1427
|
+
var e = !1;
|
|
1428
|
+
if (t != null && typeof t.toString != "function")
|
|
1838
1429
|
try {
|
|
1839
|
-
|
|
1430
|
+
e = !!(t + "");
|
|
1840
1431
|
} catch {
|
|
1841
1432
|
}
|
|
1842
|
-
return
|
|
1433
|
+
return e;
|
|
1843
1434
|
}
|
|
1844
|
-
var
|
|
1845
|
-
var
|
|
1846
|
-
return
|
|
1847
|
-
}(),
|
|
1848
|
-
"^" +
|
|
1849
|
-
),
|
|
1850
|
-
function
|
|
1851
|
-
var
|
|
1852
|
-
for (this.clear(); ++
|
|
1853
|
-
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];
|
|
1854
1445
|
this.set(r[0], r[1]);
|
|
1855
1446
|
}
|
|
1856
1447
|
}
|
|
1857
|
-
function
|
|
1858
|
-
this.__data__ =
|
|
1448
|
+
function zn() {
|
|
1449
|
+
this.__data__ = Z ? Z(null) : {};
|
|
1859
1450
|
}
|
|
1860
|
-
function
|
|
1861
|
-
return this.has(
|
|
1451
|
+
function Yn(t) {
|
|
1452
|
+
return this.has(t) && delete this.__data__[t];
|
|
1862
1453
|
}
|
|
1863
|
-
function
|
|
1864
|
-
var
|
|
1865
|
-
if (
|
|
1866
|
-
var n = t
|
|
1867
|
-
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;
|
|
1868
1459
|
}
|
|
1869
|
-
return
|
|
1460
|
+
return Se.call(e, t) ? e[t] : void 0;
|
|
1870
1461
|
}
|
|
1871
|
-
function
|
|
1872
|
-
var
|
|
1873
|
-
return
|
|
1462
|
+
function Zn(t) {
|
|
1463
|
+
var e = this.__data__;
|
|
1464
|
+
return Z ? e[t] !== void 0 : Se.call(e, t);
|
|
1874
1465
|
}
|
|
1875
|
-
function
|
|
1466
|
+
function Xn(t, e) {
|
|
1876
1467
|
var n = this.__data__;
|
|
1877
|
-
return n[
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
function
|
|
1885
|
-
var
|
|
1886
|
-
for (this.clear(); ++
|
|
1887
|
-
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];
|
|
1888
1479
|
this.set(r[0], r[1]);
|
|
1889
1480
|
}
|
|
1890
1481
|
}
|
|
1891
|
-
function
|
|
1482
|
+
function Vn() {
|
|
1892
1483
|
this.__data__ = [];
|
|
1893
1484
|
}
|
|
1894
|
-
function
|
|
1895
|
-
var
|
|
1485
|
+
function er(t) {
|
|
1486
|
+
var e = this.__data__, n = se(e, t);
|
|
1896
1487
|
if (n < 0)
|
|
1897
1488
|
return !1;
|
|
1898
|
-
var r =
|
|
1899
|
-
return n == r ?
|
|
1900
|
-
}
|
|
1901
|
-
function
|
|
1902
|
-
var
|
|
1903
|
-
return n < 0 ? void 0 :
|
|
1904
|
-
}
|
|
1905
|
-
function
|
|
1906
|
-
return
|
|
1907
|
-
}
|
|
1908
|
-
function
|
|
1909
|
-
var n = this.__data__, r =
|
|
1910
|
-
return r < 0 ? n.push([
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
function
|
|
1918
|
-
var
|
|
1919
|
-
for (this.clear(); ++
|
|
1920
|
-
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];
|
|
1921
1512
|
this.set(r[0], r[1]);
|
|
1922
1513
|
}
|
|
1923
1514
|
}
|
|
1924
|
-
function
|
|
1515
|
+
function sr() {
|
|
1925
1516
|
this.__data__ = {
|
|
1926
|
-
hash: new
|
|
1927
|
-
map: new (
|
|
1928
|
-
string: new
|
|
1517
|
+
hash: new K(),
|
|
1518
|
+
map: new (Hn || J)(),
|
|
1519
|
+
string: new K()
|
|
1929
1520
|
};
|
|
1930
1521
|
}
|
|
1931
|
-
function
|
|
1932
|
-
return
|
|
1522
|
+
function or(t) {
|
|
1523
|
+
return oe(this, t).delete(t);
|
|
1933
1524
|
}
|
|
1934
|
-
function
|
|
1935
|
-
return
|
|
1525
|
+
function ir(t) {
|
|
1526
|
+
return oe(this, t).get(t);
|
|
1936
1527
|
}
|
|
1937
|
-
function
|
|
1938
|
-
return
|
|
1528
|
+
function ar(t) {
|
|
1529
|
+
return oe(this, t).has(t);
|
|
1939
1530
|
}
|
|
1940
|
-
function
|
|
1941
|
-
return
|
|
1531
|
+
function cr(t, e) {
|
|
1532
|
+
return oe(this, t).set(t, e), this;
|
|
1942
1533
|
}
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
function
|
|
1949
|
-
for (var n =
|
|
1950
|
-
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))
|
|
1951
1542
|
return n;
|
|
1952
1543
|
return -1;
|
|
1953
1544
|
}
|
|
1954
|
-
function
|
|
1955
|
-
|
|
1956
|
-
for (var n = 0, r =
|
|
1957
|
-
|
|
1958
|
-
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;
|
|
1959
1550
|
}
|
|
1960
|
-
function
|
|
1961
|
-
if (!
|
|
1551
|
+
function lr(t) {
|
|
1552
|
+
if (!st(t) || hr(t))
|
|
1962
1553
|
return !1;
|
|
1963
|
-
var
|
|
1964
|
-
return
|
|
1554
|
+
var e = wr(t) || Gn(t) ? Kn : $n;
|
|
1555
|
+
return e.test(Sr(t));
|
|
1965
1556
|
}
|
|
1966
|
-
function
|
|
1967
|
-
if (typeof
|
|
1968
|
-
return
|
|
1969
|
-
if (
|
|
1970
|
-
return
|
|
1971
|
-
var
|
|
1972
|
-
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;
|
|
1973
1564
|
}
|
|
1974
|
-
function
|
|
1975
|
-
return
|
|
1565
|
+
function fr(t) {
|
|
1566
|
+
return rt(t) ? t : gr(t);
|
|
1976
1567
|
}
|
|
1977
|
-
function
|
|
1978
|
-
var n =
|
|
1979
|
-
return
|
|
1568
|
+
function oe(t, e) {
|
|
1569
|
+
var n = t.__data__;
|
|
1570
|
+
return yr(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
1980
1571
|
}
|
|
1981
|
-
function
|
|
1982
|
-
var n =
|
|
1983
|
-
return
|
|
1572
|
+
function nt(t, e) {
|
|
1573
|
+
var n = Wn(t, e);
|
|
1574
|
+
return lr(n) ? n : void 0;
|
|
1984
1575
|
}
|
|
1985
|
-
function
|
|
1986
|
-
if (
|
|
1576
|
+
function pr(t, e) {
|
|
1577
|
+
if (rt(t))
|
|
1987
1578
|
return !1;
|
|
1988
|
-
var n = typeof
|
|
1989
|
-
return n == "number" || n == "symbol" || n == "boolean" ||
|
|
1990
|
-
}
|
|
1991
|
-
function
|
|
1992
|
-
var
|
|
1993
|
-
return
|
|
1994
|
-
}
|
|
1995
|
-
function
|
|
1996
|
-
return !!
|
|
1997
|
-
}
|
|
1998
|
-
var
|
|
1999
|
-
|
|
2000
|
-
var
|
|
2001
|
-
return
|
|
2002
|
-
|
|
2003
|
-
}),
|
|
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;
|
|
2004
1595
|
});
|
|
2005
|
-
function
|
|
2006
|
-
if (typeof
|
|
2007
|
-
return
|
|
2008
|
-
var
|
|
2009
|
-
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;
|
|
2010
1601
|
}
|
|
2011
|
-
function
|
|
2012
|
-
if (
|
|
1602
|
+
function Sr(t) {
|
|
1603
|
+
if (t != null) {
|
|
2013
1604
|
try {
|
|
2014
|
-
return
|
|
1605
|
+
return et.call(t);
|
|
2015
1606
|
} catch {
|
|
2016
1607
|
}
|
|
2017
1608
|
try {
|
|
2018
|
-
return
|
|
1609
|
+
return t + "";
|
|
2019
1610
|
} catch {
|
|
2020
1611
|
}
|
|
2021
1612
|
}
|
|
2022
1613
|
return "";
|
|
2023
1614
|
}
|
|
2024
|
-
function
|
|
2025
|
-
if (typeof
|
|
2026
|
-
throw new TypeError(
|
|
1615
|
+
function _e(t, e) {
|
|
1616
|
+
if (typeof t != "function" || e && typeof e != "function")
|
|
1617
|
+
throw new TypeError(Dn);
|
|
2027
1618
|
var n = function() {
|
|
2028
|
-
var r = arguments, s =
|
|
1619
|
+
var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
|
|
2029
1620
|
if (i.has(s))
|
|
2030
1621
|
return i.get(s);
|
|
2031
|
-
var o =
|
|
1622
|
+
var o = t.apply(this, r);
|
|
2032
1623
|
return n.cache = i.set(s, o), o;
|
|
2033
1624
|
};
|
|
2034
|
-
return n.cache = new (
|
|
1625
|
+
return n.cache = new (_e.Cache || B)(), n;
|
|
2035
1626
|
}
|
|
2036
|
-
|
|
2037
|
-
function
|
|
2038
|
-
return
|
|
1627
|
+
_e.Cache = B;
|
|
1628
|
+
function _r(t, e) {
|
|
1629
|
+
return t === e || t !== t && e !== e;
|
|
2039
1630
|
}
|
|
2040
|
-
var
|
|
2041
|
-
function
|
|
2042
|
-
var
|
|
2043
|
-
return
|
|
1631
|
+
var rt = Array.isArray;
|
|
1632
|
+
function wr(t) {
|
|
1633
|
+
var e = st(t) ? tt.call(t) : "";
|
|
1634
|
+
return e == Pn || e == On;
|
|
2044
1635
|
}
|
|
2045
|
-
function
|
|
2046
|
-
var
|
|
2047
|
-
return !!
|
|
1636
|
+
function st(t) {
|
|
1637
|
+
var e = typeof t;
|
|
1638
|
+
return !!t && (e == "object" || e == "function");
|
|
2048
1639
|
}
|
|
2049
|
-
function
|
|
2050
|
-
return !!
|
|
1640
|
+
function Er(t) {
|
|
1641
|
+
return !!t && typeof t == "object";
|
|
2051
1642
|
}
|
|
2052
|
-
function
|
|
2053
|
-
return typeof
|
|
1643
|
+
function we(t) {
|
|
1644
|
+
return typeof t == "symbol" || Er(t) && tt.call(t) == Tn;
|
|
2054
1645
|
}
|
|
2055
|
-
function
|
|
2056
|
-
return
|
|
1646
|
+
function Cr(t) {
|
|
1647
|
+
return t == null ? "" : dr(t);
|
|
2057
1648
|
}
|
|
2058
|
-
function
|
|
2059
|
-
var r =
|
|
1649
|
+
function vr(t, e, n) {
|
|
1650
|
+
var r = t == null ? void 0 : ur(t, e);
|
|
2060
1651
|
return r === void 0 ? n : r;
|
|
2061
1652
|
}
|
|
2062
|
-
var
|
|
2063
|
-
const
|
|
2064
|
-
function
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
break;
|
|
2073
|
-
}
|
|
2074
|
-
case "UPDATE": {
|
|
2075
|
-
const o = s.result.findIndex(
|
|
2076
|
-
(a) => V(i.payload.data, n) === V(a, n)
|
|
2077
|
-
);
|
|
2078
|
-
o !== -1 && (s.result[o] = i.payload.data);
|
|
2079
|
-
break;
|
|
2080
|
-
}
|
|
2081
|
-
case "DELETE": {
|
|
2082
|
-
const o = s.result.findIndex(
|
|
2083
|
-
(a) => V(i.payload.data, n) === V(a, n)
|
|
2084
|
-
);
|
|
2085
|
-
o !== -1 && s.result.splice(o, 1);
|
|
2086
|
-
break;
|
|
2087
|
-
}
|
|
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;
|
|
2088
1663
|
}
|
|
2089
|
-
|
|
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 };
|
|
2090
1677
|
}
|
|
2091
|
-
function
|
|
2092
|
-
const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a =
|
|
2093
|
-
|
|
2094
|
-
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(() => {
|
|
2095
1682
|
const d = a.current;
|
|
2096
|
-
if (a.current = [],
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
(
|
|
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)
|
|
2100
1687
|
);
|
|
2101
|
-
for (const
|
|
2102
|
-
(
|
|
2103
|
-
n(
|
|
2104
|
-
{ 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 }
|
|
2105
1692
|
);
|
|
2106
1693
|
}
|
|
2107
|
-
}, [
|
|
1694
|
+
}, [t, e, n, r]), f = M(
|
|
2108
1695
|
(d) => {
|
|
2109
|
-
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));
|
|
2110
1697
|
},
|
|
2111
|
-
[
|
|
1698
|
+
[y, o]
|
|
2112
1699
|
);
|
|
2113
1700
|
return G(() => () => {
|
|
2114
|
-
|
|
1701
|
+
c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
2115
1702
|
}, []), f;
|
|
2116
1703
|
}
|
|
2117
|
-
const
|
|
2118
|
-
pluginID:
|
|
2119
|
-
connectionID:
|
|
1704
|
+
const ys = ({
|
|
1705
|
+
pluginID: t,
|
|
1706
|
+
connectionID: e,
|
|
2120
1707
|
resourceKey: n,
|
|
2121
1708
|
idAccessor: r,
|
|
2122
1709
|
namespaces: s
|
|
2123
1710
|
}) => {
|
|
2124
|
-
const i =
|
|
2125
|
-
() => [i,
|
|
2126
|
-
[i,
|
|
2127
|
-
),
|
|
2128
|
-
(
|
|
2129
|
-
[i,
|
|
2130
|
-
), { mutateAsync:
|
|
2131
|
-
mutationFn: async (
|
|
2132
|
-
input:
|
|
2133
|
-
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] : "")
|
|
2134
1721
|
})),
|
|
2135
|
-
onSuccess: async (
|
|
2136
|
-
var
|
|
2137
|
-
const
|
|
2138
|
-
let
|
|
2139
|
-
(
|
|
2140
|
-
const
|
|
2141
|
-
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 });
|
|
2142
1729
|
},
|
|
2143
|
-
onError:
|
|
2144
|
-
}), f =
|
|
1730
|
+
onError: k(a, "Failed to create resource")
|
|
1731
|
+
}), f = O({
|
|
2145
1732
|
queryKey: l,
|
|
2146
|
-
queryFn: async () =>
|
|
1733
|
+
queryFn: async () => Ae(i, e, n, Me.createFrom({
|
|
2147
1734
|
order: [{ field: "name", descending: !1 }],
|
|
2148
1735
|
pagination: { page: 1, pageSize: 200 },
|
|
2149
|
-
namespaces:
|
|
1736
|
+
namespaces: c
|
|
2150
1737
|
})),
|
|
2151
|
-
placeholderData: (
|
|
1738
|
+
placeholderData: (C, g) => C,
|
|
2152
1739
|
retry: !1
|
|
2153
|
-
}), [d,
|
|
2154
|
-
|
|
1740
|
+
}), [d, p] = v.useState(
|
|
1741
|
+
I.WatchStateIdle
|
|
2155
1742
|
);
|
|
2156
|
-
|
|
2157
|
-
`${i}/${
|
|
2158
|
-
(
|
|
2159
|
-
|
|
1743
|
+
v.useEffect(() => x(
|
|
1744
|
+
`${i}/${e}/watch/STATE`,
|
|
1745
|
+
(g) => {
|
|
1746
|
+
const m = g.data;
|
|
1747
|
+
m.resourceKey === n && p(m.state);
|
|
2160
1748
|
}
|
|
2161
|
-
), [i,
|
|
2162
|
-
const
|
|
2163
|
-
return
|
|
1749
|
+
), [i, e, n]);
|
|
1750
|
+
const _ = Ir(o, l, u, r, d);
|
|
1751
|
+
return v.useEffect(() => {
|
|
2164
1752
|
if (!r)
|
|
2165
1753
|
return;
|
|
2166
|
-
|
|
2167
|
-
const
|
|
2168
|
-
`${i}/${
|
|
2169
|
-
(
|
|
2170
|
-
),
|
|
2171
|
-
`${i}/${
|
|
2172
|
-
(
|
|
2173
|
-
),
|
|
2174
|
-
`${i}/${
|
|
2175
|
-
(
|
|
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 })
|
|
2176
1764
|
);
|
|
2177
1765
|
return () => {
|
|
2178
|
-
|
|
1766
|
+
C(), g(), m(), Bt(i, e, n);
|
|
2179
1767
|
};
|
|
2180
|
-
}, [i,
|
|
1768
|
+
}, [i, e, n, _]), {
|
|
2181
1769
|
/**
|
|
2182
1770
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
2183
1771
|
* when the resources are updated or deleted via the returned create and remove mutation functions, or
|
|
@@ -2190,23 +1778,23 @@ const Ys = ({
|
|
|
2190
1778
|
*
|
|
2191
1779
|
* @params opts Optional parameters to pass to the resource create operation
|
|
2192
1780
|
*/
|
|
2193
|
-
create:
|
|
1781
|
+
create: y,
|
|
2194
1782
|
/** Current watch state for this resource type */
|
|
2195
1783
|
watchState: d,
|
|
2196
1784
|
/** Whether the watch is currently syncing */
|
|
2197
|
-
isSyncing: d ===
|
|
1785
|
+
isSyncing: d === I.WatchStateSyncing,
|
|
2198
1786
|
/** Whether the watch has fully synced */
|
|
2199
|
-
isSynced: d ===
|
|
1787
|
+
isSynced: d === I.WatchStateSynced,
|
|
2200
1788
|
/** Whether the watch encountered an error */
|
|
2201
|
-
watchError: d ===
|
|
1789
|
+
watchError: d === I.WatchStateError
|
|
2202
1790
|
};
|
|
2203
|
-
},
|
|
2204
|
-
const
|
|
2205
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
2206
|
-
|
|
1791
|
+
}, hs = ({ pluginID: t }) => {
|
|
1792
|
+
const e = P(t), { showSnackbar: n } = U(), r = D({
|
|
1793
|
+
mutationFn: async ({ opts: o, input: a }) => xe(
|
|
1794
|
+
e,
|
|
2207
1795
|
o.connectionID,
|
|
2208
1796
|
o.resourceKey,
|
|
2209
|
-
|
|
1797
|
+
Le.createFrom({
|
|
2210
1798
|
input: a.input,
|
|
2211
1799
|
namespace: a.namespace ?? o.namespace ?? ""
|
|
2212
1800
|
})
|
|
@@ -2215,14 +1803,14 @@ const Ys = ({
|
|
|
2215
1803
|
n(`Resource ${a.resourceID} created`, "success");
|
|
2216
1804
|
},
|
|
2217
1805
|
onError(o, { opts: a }) {
|
|
2218
|
-
|
|
1806
|
+
z(n, o, `Failed to create resource ${a.resourceID}`);
|
|
2219
1807
|
}
|
|
2220
|
-
}), s =
|
|
2221
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
2222
|
-
|
|
1808
|
+
}), s = D({
|
|
1809
|
+
mutationFn: async ({ opts: o, input: a }) => Oe(
|
|
1810
|
+
e,
|
|
2223
1811
|
o.connectionID,
|
|
2224
1812
|
o.resourceKey,
|
|
2225
|
-
|
|
1813
|
+
Ne.createFrom({
|
|
2226
1814
|
input: a.input,
|
|
2227
1815
|
id: o.resourceID,
|
|
2228
1816
|
namespace: o.namespace ?? ""
|
|
@@ -2232,14 +1820,14 @@ const Ys = ({
|
|
|
2232
1820
|
n(`Resource ${a.resourceID} updated`, "success");
|
|
2233
1821
|
},
|
|
2234
1822
|
onError(o, { opts: a }) {
|
|
2235
|
-
|
|
1823
|
+
z(n, o, `Failed to update resource ${a.resourceID}`);
|
|
2236
1824
|
}
|
|
2237
|
-
}), i =
|
|
2238
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
2239
|
-
|
|
1825
|
+
}), i = D({
|
|
1826
|
+
mutationFn: async ({ opts: o, input: a }) => Te(
|
|
1827
|
+
e,
|
|
2240
1828
|
o.connectionID,
|
|
2241
1829
|
o.resourceKey,
|
|
2242
|
-
|
|
1830
|
+
ke.createFrom({
|
|
2243
1831
|
id: o.resourceID,
|
|
2244
1832
|
namespace: o.namespace ?? "",
|
|
2245
1833
|
gracePeriodSeconds: a.gracePeriodSeconds
|
|
@@ -2249,7 +1837,7 @@ const Ys = ({
|
|
|
2249
1837
|
n(`Resource ${a.resourceID} deleted`, "success");
|
|
2250
1838
|
},
|
|
2251
1839
|
onError(o, { opts: a }) {
|
|
2252
|
-
|
|
1840
|
+
z(n, o, `Failed to delete resource ${a.resourceID}`);
|
|
2253
1841
|
}
|
|
2254
1842
|
});
|
|
2255
1843
|
return {
|
|
@@ -2257,16 +1845,16 @@ const Ys = ({
|
|
|
2257
1845
|
update: s.mutateAsync,
|
|
2258
1846
|
remove: i.mutateAsync
|
|
2259
1847
|
};
|
|
2260
|
-
},
|
|
2261
|
-
pluginID:
|
|
2262
|
-
connectionID:
|
|
1848
|
+
}, gs = ({
|
|
1849
|
+
pluginID: t,
|
|
1850
|
+
connectionID: e,
|
|
2263
1851
|
resourceKey: n,
|
|
2264
1852
|
enabled: r = !0
|
|
2265
1853
|
}) => {
|
|
2266
|
-
const s =
|
|
2267
|
-
queryKey: ["RESOURCE_ACTIONS", s,
|
|
2268
|
-
queryFn: () =>
|
|
2269
|
-
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,
|
|
2270
1858
|
staleTime: 5 * 60 * 1e3
|
|
2271
1859
|
// actions don't change often
|
|
2272
1860
|
});
|
|
@@ -2275,26 +1863,26 @@ const Ys = ({
|
|
|
2275
1863
|
isLoading: i.isLoading,
|
|
2276
1864
|
error: i.error
|
|
2277
1865
|
};
|
|
2278
|
-
},
|
|
2279
|
-
pluginID:
|
|
2280
|
-
connectionID:
|
|
1866
|
+
}, ms = ({
|
|
1867
|
+
pluginID: t,
|
|
1868
|
+
connectionID: e,
|
|
2281
1869
|
resourceKey: n
|
|
2282
1870
|
}) => {
|
|
2283
|
-
const r =
|
|
2284
|
-
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(
|
|
2285
1873
|
r,
|
|
2286
|
-
|
|
1874
|
+
e,
|
|
2287
1875
|
n,
|
|
2288
1876
|
a,
|
|
2289
|
-
|
|
1877
|
+
$e.createFrom({ id: c, namespace: l, params: u })
|
|
2290
1878
|
),
|
|
2291
1879
|
onSuccess: (a) => {
|
|
2292
|
-
a.message && i(a.message, "success"), s.invalidateQueries({
|
|
2293
|
-
queryKey: ["RESOURCES", r,
|
|
1880
|
+
a != null && a.message && i(a.message, "success"), s.invalidateQueries({
|
|
1881
|
+
queryKey: ["RESOURCES", r, e, n]
|
|
2294
1882
|
});
|
|
2295
1883
|
},
|
|
2296
|
-
onError: (a,
|
|
2297
|
-
|
|
1884
|
+
onError: (a, c) => {
|
|
1885
|
+
z(i, a, `Failed to execute action "${c.actionID}"`);
|
|
2298
1886
|
}
|
|
2299
1887
|
});
|
|
2300
1888
|
return {
|
|
@@ -2302,15 +1890,15 @@ const Ys = ({
|
|
|
2302
1890
|
isExecuting: o.isPending,
|
|
2303
1891
|
error: o.error
|
|
2304
1892
|
};
|
|
2305
|
-
},
|
|
2306
|
-
pluginID:
|
|
2307
|
-
connectionID:
|
|
1893
|
+
}, Ss = ({
|
|
1894
|
+
pluginID: t,
|
|
1895
|
+
connectionID: e,
|
|
2308
1896
|
enabled: n = !0
|
|
2309
1897
|
}) => {
|
|
2310
|
-
const r =
|
|
2311
|
-
queryKey: ["EDITOR_SCHEMAS", r,
|
|
2312
|
-
queryFn: () =>
|
|
2313
|
-
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,
|
|
2314
1902
|
staleTime: 10 * 60 * 1e3,
|
|
2315
1903
|
// schemas are fairly stable per connection
|
|
2316
1904
|
retry: 1
|
|
@@ -2321,46 +1909,49 @@ const Ys = ({
|
|
|
2321
1909
|
error: s.error,
|
|
2322
1910
|
refetch: s.refetch
|
|
2323
1911
|
};
|
|
2324
|
-
},
|
|
2325
|
-
pluginID:
|
|
2326
|
-
connectionID:
|
|
1912
|
+
}, _s = ({
|
|
1913
|
+
pluginID: t,
|
|
1914
|
+
connectionID: e,
|
|
2327
1915
|
enabled: n = !0
|
|
2328
1916
|
}) => {
|
|
2329
|
-
const r =
|
|
2330
|
-
s.setQueryData(i, (d) =>
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
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({
|
|
2338
1927
|
queryKey: i,
|
|
2339
1928
|
queryFn: async () => {
|
|
2340
|
-
const f = await
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
const m
|
|
2345
|
-
|
|
2346
|
-
|
|
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);
|
|
2347
1938
|
return {
|
|
2348
1939
|
connection: f.connectionId,
|
|
2349
1940
|
resources: d,
|
|
2350
|
-
resourceCounts:
|
|
1941
|
+
resourceCounts: C,
|
|
2351
1942
|
totalResources: Object.keys(d).length,
|
|
2352
|
-
syncedCount:
|
|
2353
|
-
errorCount:
|
|
1943
|
+
syncedCount: p,
|
|
1944
|
+
errorCount: _
|
|
2354
1945
|
};
|
|
2355
1946
|
},
|
|
2356
|
-
enabled: n && !!r && !!
|
|
1947
|
+
enabled: n && !!r && !!e,
|
|
2357
1948
|
refetchInterval: (f) => {
|
|
2358
1949
|
const d = f.state.data;
|
|
2359
1950
|
if (!d || d.totalResources === 0) return 3e3;
|
|
2360
|
-
let
|
|
2361
|
-
for (const
|
|
2362
|
-
(
|
|
2363
|
-
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;
|
|
2364
1955
|
}
|
|
2365
1956
|
});
|
|
2366
1957
|
G(() => {
|
|
@@ -2369,63 +1960,64 @@ const Ys = ({
|
|
|
2369
1960
|
const f = o.current;
|
|
2370
1961
|
o.current = [];
|
|
2371
1962
|
for (const d of f)
|
|
2372
|
-
|
|
2373
|
-
}, [l.data,
|
|
2374
|
-
if (!n || !r || !
|
|
1963
|
+
c(d);
|
|
1964
|
+
}, [l.data, c]), G(() => {
|
|
1965
|
+
if (!n || !r || !e)
|
|
2375
1966
|
return;
|
|
2376
1967
|
a.current = !1, o.current = [];
|
|
2377
|
-
const f =
|
|
2378
|
-
`${r}/${
|
|
1968
|
+
const f = x(
|
|
1969
|
+
`${r}/${e}/watch/STATE`,
|
|
2379
1970
|
(d) => {
|
|
2380
|
-
|
|
1971
|
+
const p = d.data;
|
|
1972
|
+
a.current ? c(p) : o.current.push(p);
|
|
2381
1973
|
}
|
|
2382
1974
|
);
|
|
2383
1975
|
return () => {
|
|
2384
1976
|
f(), a.current = !1, o.current = [];
|
|
2385
1977
|
};
|
|
2386
|
-
}, [r,
|
|
2387
|
-
const
|
|
2388
|
-
let
|
|
2389
|
-
if (
|
|
2390
|
-
for (const f of Object.values(
|
|
2391
|
-
(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++;
|
|
2392
1984
|
return {
|
|
2393
1985
|
/** Full summary query result */
|
|
2394
1986
|
summary: l,
|
|
2395
1987
|
/** Get the state of a specific resource type's watch */
|
|
2396
|
-
getResourceState: (f) =>
|
|
1988
|
+
getResourceState: (f) => u == null ? void 0 : u.resources[f],
|
|
2397
1989
|
/** Whether all registered watches have reached a terminal state */
|
|
2398
|
-
isFullySynced:
|
|
1990
|
+
isFullySynced: u ? u.totalResources > 0 && y === u.totalResources : !1,
|
|
2399
1991
|
/** Sync progress as a 0-1 fraction (terminal states / total) */
|
|
2400
|
-
syncProgress:
|
|
1992
|
+
syncProgress: u && u.totalResources > 0 ? y / u.totalResources : 0,
|
|
2401
1993
|
/** Number of watches that encountered errors */
|
|
2402
|
-
errorCount: (
|
|
1994
|
+
errorCount: (u == null ? void 0 : u.errorCount) ?? 0
|
|
2403
1995
|
};
|
|
2404
|
-
},
|
|
2405
|
-
const [
|
|
2406
|
-
const
|
|
2407
|
-
if (
|
|
2408
|
-
const
|
|
2409
|
-
return
|
|
2410
|
-
}), r.current.has(
|
|
2411
|
-
const
|
|
2412
|
-
|
|
2413
|
-
const
|
|
2414
|
-
return
|
|
2415
|
-
}), 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);
|
|
2416
2008
|
}, 5e3);
|
|
2417
|
-
r.current.set(
|
|
2009
|
+
r.current.set(y, p);
|
|
2418
2010
|
}
|
|
2419
2011
|
}, []);
|
|
2420
2012
|
G(() => {
|
|
2421
|
-
const l =
|
|
2013
|
+
const l = x("watch/STATE", s);
|
|
2422
2014
|
return () => {
|
|
2423
2015
|
l();
|
|
2424
|
-
for (const
|
|
2425
|
-
clearTimeout(
|
|
2016
|
+
for (const u of r.current.values())
|
|
2017
|
+
clearTimeout(u);
|
|
2426
2018
|
};
|
|
2427
2019
|
}, [s]);
|
|
2428
|
-
const i = Array.from(
|
|
2020
|
+
const i = Array.from(t.values()), o = ze(i), a = i.find((l) => !ne(l)) ?? i[0] ?? null, c = Ye(i);
|
|
2429
2021
|
return {
|
|
2430
2022
|
/** All tracked syncs */
|
|
2431
2023
|
syncs: i,
|
|
@@ -2434,109 +2026,110 @@ const Ys = ({
|
|
|
2434
2026
|
/** The primary (first incomplete) sync or most recent */
|
|
2435
2027
|
primarySync: a,
|
|
2436
2028
|
/** Aggregate progress across all connections (0-1) */
|
|
2437
|
-
aggregateProgress:
|
|
2029
|
+
aggregateProgress: c
|
|
2438
2030
|
};
|
|
2439
|
-
},
|
|
2440
|
-
const
|
|
2441
|
-
if (!
|
|
2442
|
-
return
|
|
2443
|
-
},
|
|
2444
|
-
pluginID:
|
|
2445
|
-
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,
|
|
2446
2038
|
resourceKey: n
|
|
2447
2039
|
}) => {
|
|
2448
|
-
const r =
|
|
2449
|
-
return
|
|
2040
|
+
const r = P(t), { showSnackbar: s } = U(), { addOperation: i, updateOperation: o } = Rr(), a = v.useRef([]);
|
|
2041
|
+
return v.useEffect(() => () => {
|
|
2450
2042
|
a.current.forEach((l) => l());
|
|
2451
|
-
}, []), { startStreamAction:
|
|
2452
|
-
async ({ actionID: l, id:
|
|
2043
|
+
}, []), { startStreamAction: v.useCallback(
|
|
2044
|
+
async ({ actionID: l, id: u, namespace: y, label: f, params: d = {} }) => {
|
|
2453
2045
|
try {
|
|
2454
|
-
const
|
|
2046
|
+
const p = await Zt(
|
|
2455
2047
|
r,
|
|
2456
|
-
|
|
2048
|
+
e,
|
|
2457
2049
|
n,
|
|
2458
2050
|
l,
|
|
2459
|
-
|
|
2051
|
+
$e.createFrom({ id: u, namespace: y, params: d })
|
|
2460
2052
|
);
|
|
2461
2053
|
i({
|
|
2462
|
-
id:
|
|
2054
|
+
id: p,
|
|
2463
2055
|
label: f,
|
|
2464
2056
|
resourceKey: n,
|
|
2465
|
-
resourceName:
|
|
2466
|
-
namespace:
|
|
2467
|
-
connectionID:
|
|
2057
|
+
resourceName: u,
|
|
2058
|
+
namespace: y,
|
|
2059
|
+
connectionID: e,
|
|
2468
2060
|
status: "running",
|
|
2469
2061
|
startedAt: Date.now()
|
|
2470
2062
|
});
|
|
2471
|
-
const
|
|
2472
|
-
var
|
|
2473
|
-
|
|
2063
|
+
const _ = `action/stream/${p}`, C = x(_, (g) => {
|
|
2064
|
+
var h, b, F, w;
|
|
2065
|
+
const m = g.data;
|
|
2066
|
+
switch (m.type) {
|
|
2474
2067
|
case "progress": {
|
|
2475
|
-
const
|
|
2476
|
-
o(
|
|
2477
|
-
message:
|
|
2478
|
-
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
|
|
2479
2072
|
});
|
|
2480
2073
|
break;
|
|
2481
2074
|
}
|
|
2482
2075
|
case "complete":
|
|
2483
|
-
o(
|
|
2076
|
+
o(p, {
|
|
2484
2077
|
status: "completed",
|
|
2485
|
-
message: ((
|
|
2078
|
+
message: ((h = m.data) == null ? void 0 : h.message) ?? "Completed",
|
|
2486
2079
|
completedAt: Date.now()
|
|
2487
|
-
}), s(((
|
|
2080
|
+
}), s(((b = m.data) == null ? void 0 : b.message) ?? f + " completed", "success"), ae(_);
|
|
2488
2081
|
break;
|
|
2489
2082
|
case "error":
|
|
2490
|
-
o(
|
|
2083
|
+
o(p, {
|
|
2491
2084
|
status: "error",
|
|
2492
|
-
message: ((
|
|
2085
|
+
message: ((F = m.data) == null ? void 0 : F.message) ?? "Failed",
|
|
2493
2086
|
completedAt: Date.now()
|
|
2494
|
-
}), s(((
|
|
2087
|
+
}), s(((w = m.data) == null ? void 0 : w.message) ?? f + " failed", "error"), ae(_);
|
|
2495
2088
|
break;
|
|
2496
2089
|
}
|
|
2497
2090
|
});
|
|
2498
2091
|
return a.current.push(() => {
|
|
2499
|
-
|
|
2500
|
-
}),
|
|
2501
|
-
} catch (
|
|
2502
|
-
throw
|
|
2092
|
+
C(), ae(_);
|
|
2093
|
+
}), p;
|
|
2094
|
+
} catch (p) {
|
|
2095
|
+
throw z(s, p, `Failed to start "${l}"`), p;
|
|
2503
2096
|
}
|
|
2504
2097
|
},
|
|
2505
|
-
[r,
|
|
2098
|
+
[r, e, n, i, o, s]
|
|
2506
2099
|
) };
|
|
2507
|
-
},
|
|
2508
|
-
const
|
|
2509
|
-
if (!
|
|
2100
|
+
}, Cs = () => {
|
|
2101
|
+
const t = v.useContext(je);
|
|
2102
|
+
if (!t)
|
|
2510
2103
|
throw new Error("useSettings must be used within a SettingsProvider");
|
|
2511
|
-
return
|
|
2512
|
-
},
|
|
2513
|
-
const { pluginId: r } =
|
|
2104
|
+
return t;
|
|
2105
|
+
}, vs = ({ to: t, withinContext: e, ...n }) => {
|
|
2106
|
+
const { pluginId: r } = he();
|
|
2514
2107
|
r || console.error("Link used outside of a plugin context");
|
|
2515
|
-
const s = `/_plugin/${r}${
|
|
2516
|
-
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]);
|
|
2517
2110
|
};
|
|
2518
|
-
function
|
|
2519
|
-
const
|
|
2111
|
+
function bs() {
|
|
2112
|
+
const t = dt(), e = ft(), { pluginId: n } = he();
|
|
2520
2113
|
n || console.error("usePluginRouter used outside of a plugin context");
|
|
2521
|
-
const r = `/_plugin/${n}`, s =
|
|
2522
|
-
const { ...
|
|
2523
|
-
o.startsWith("/") ?
|
|
2524
|
-
}, [
|
|
2525
|
-
return
|
|
2526
|
-
location:
|
|
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,
|
|
2527
2120
|
navigate: i,
|
|
2528
2121
|
pluginPath: s
|
|
2529
|
-
}), [
|
|
2122
|
+
}), [e, i, s]);
|
|
2530
2123
|
}
|
|
2531
|
-
class
|
|
2124
|
+
class Fs {
|
|
2532
2125
|
}
|
|
2533
|
-
class
|
|
2126
|
+
class Is {
|
|
2534
2127
|
constructor() {
|
|
2535
|
-
|
|
2128
|
+
T(this, "_extensions");
|
|
2536
2129
|
/**
|
|
2537
2130
|
* The root component to render for the application window.
|
|
2538
2131
|
*/
|
|
2539
|
-
|
|
2132
|
+
T(this, "root");
|
|
2540
2133
|
/**
|
|
2541
2134
|
* Various pages to render under the root component. These can be navigated to using
|
|
2542
2135
|
* the built-in navigation system both programatically and through Links.
|
|
@@ -2566,21 +2159,21 @@ class ao {
|
|
|
2566
2159
|
* ```
|
|
2567
2160
|
*
|
|
2568
2161
|
*/
|
|
2569
|
-
|
|
2570
|
-
|
|
2162
|
+
T(this, "pages");
|
|
2163
|
+
T(this, "_routes");
|
|
2571
2164
|
}
|
|
2572
2165
|
get extensions() {
|
|
2573
2166
|
return this._extensions || [];
|
|
2574
2167
|
}
|
|
2575
2168
|
get Routes() {
|
|
2576
|
-
var
|
|
2169
|
+
var e;
|
|
2577
2170
|
if (!this._routes && this.root)
|
|
2578
2171
|
return [{
|
|
2579
2172
|
path: "",
|
|
2580
2173
|
index: !0,
|
|
2581
2174
|
Component: this.root
|
|
2582
2175
|
}];
|
|
2583
|
-
if (!((
|
|
2176
|
+
if (!((e = this._routes) != null && e.length))
|
|
2584
2177
|
throw new Error("cannot use plugin without a root page or router");
|
|
2585
2178
|
return this._routes;
|
|
2586
2179
|
}
|
|
@@ -2589,9 +2182,9 @@ class ao {
|
|
|
2589
2182
|
*/
|
|
2590
2183
|
get Window() {
|
|
2591
2184
|
if (!this._routes && this.root)
|
|
2592
|
-
return /* @__PURE__ */
|
|
2593
|
-
const
|
|
2594
|
-
return /* @__PURE__ */
|
|
2185
|
+
return /* @__PURE__ */ A(this.root, {});
|
|
2186
|
+
const e = pt(this._routes || []);
|
|
2187
|
+
return /* @__PURE__ */ A(yt, { router: e });
|
|
2595
2188
|
}
|
|
2596
2189
|
/**
|
|
2597
2190
|
* Register extension points for other plugins to extend the functionality
|
|
@@ -2599,8 +2192,8 @@ class ao {
|
|
|
2599
2192
|
*
|
|
2600
2193
|
* `${plugin_id}/${extension_point_id}`
|
|
2601
2194
|
*/
|
|
2602
|
-
registerExtensionPoints(
|
|
2603
|
-
return this._extensions =
|
|
2195
|
+
registerExtensionPoints(e) {
|
|
2196
|
+
return this._extensions = e || [], this;
|
|
2604
2197
|
}
|
|
2605
2198
|
/**
|
|
2606
2199
|
* Set the component displayed under:
|
|
@@ -2608,100 +2201,99 @@ class ao {
|
|
|
2608
2201
|
*
|
|
2609
2202
|
* If the NavModel is configured, the page will have a managed frame, otheriwse it has full control.
|
|
2610
2203
|
*/
|
|
2611
|
-
setRootPage(
|
|
2612
|
-
return this.root =
|
|
2204
|
+
setRootPage(e) {
|
|
2205
|
+
return this.root = e, this;
|
|
2613
2206
|
}
|
|
2614
2207
|
/**
|
|
2615
2208
|
* Adds a page to the plugin window. This page will be displayed under:
|
|
2616
2209
|
*/
|
|
2617
|
-
withPage(
|
|
2618
|
-
return this.pages || (this.pages = {}), this.pages[
|
|
2210
|
+
withPage(e, n) {
|
|
2211
|
+
return this.pages || (this.pages = {}), this.pages[e] ? (console.warn(
|
|
2619
2212
|
"Cannot register page with the same name. Please use a different name."
|
|
2620
|
-
), this) : (this.pages[
|
|
2213
|
+
), this) : (this.pages[e] = n, this);
|
|
2621
2214
|
}
|
|
2622
|
-
withRoutes(
|
|
2623
|
-
return this._routes =
|
|
2215
|
+
withRoutes(e) {
|
|
2216
|
+
return this._routes = e, this;
|
|
2624
2217
|
}
|
|
2625
2218
|
}
|
|
2626
|
-
var
|
|
2627
|
-
const
|
|
2628
|
-
const
|
|
2629
|
-
return
|
|
2630
|
-
group:
|
|
2631
|
-
version:
|
|
2632
|
-
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]
|
|
2633
2226
|
};
|
|
2634
|
-
},
|
|
2227
|
+
}, Ds = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
2635
2228
|
export {
|
|
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
|
-
|
|
2705
|
-
|
|
2706
|
-
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
|
|
2707
2299
|
};
|