@burdenoff/microfe-bigconsole 2026.1124.3 → 2026.1124.5
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/bigconsole/components/builder/inspector/AppearanceSection.js +12 -6
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.d.ts +2 -1
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.js +34 -34
- package/dist/bigconsole/components/fleet/FleetBindingsDialog.d.ts +19 -0
- package/dist/bigconsole/components/fleet/FleetBindingsDialog.js +287 -0
- package/dist/bigconsole/components/fleet/FleetChildrenPanel.js +194 -170
- package/dist/bigconsole/components/widgets/PropertiesPanel.js +489 -474
- package/dist/bigconsole/components/widgets/chart/ChartConfig.d.ts +1 -0
- package/dist/bigconsole/components/widgets/chart/ChartConfig.js +111 -107
- package/dist/bigconsole/components/widgets/chart/ChartFieldMappings.d.ts +8 -0
- package/dist/bigconsole/components/widgets/chart/ChartFieldMappings.js +85 -0
- package/dist/bigconsole/components/widgets/chart/chartMappingFields.d.ts +9 -0
- package/dist/bigconsole/components/widgets/chart/chartMappingFields.js +30 -0
- package/dist/bigconsole/components/widgets/chart/charts/funnelData.d.ts +2 -0
- package/dist/bigconsole/components/widgets/chart/charts/funnelData.js +11 -13
- package/dist/bigconsole/hooks/useFleetBindingActions.d.ts +23 -0
- package/dist/bigconsole/hooks/useFleetBindingActions.js +50 -0
- package/dist/bigconsole/hooks/useFleetBindings.d.ts +19 -0
- package/dist/bigconsole/hooks/useFleetBindings.js +140 -0
- package/dist/bigconsole/utils/fleetBindings.d.ts +49 -0
- package/dist/bigconsole/utils/fleetBindings.js +52 -0
- package/dist/bigconsole/utils/widgetBinding.js +57 -44
- package/dist/generated/wspace-operations.d.ts +109 -0
- package/dist/generated/wspace-operations.js +634 -131
- package/dist/generated/wspace-types.js +12 -10
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BindingsInput } from '../utils/fleetBindings';
|
|
2
|
+
export type BindingCopyState = 'APPLIED' | 'UNCHANGED' | 'INCOMPATIBLE';
|
|
3
|
+
export interface BindingCopyResult {
|
|
4
|
+
dashboardId: string;
|
|
5
|
+
name: string | null;
|
|
6
|
+
state: BindingCopyState;
|
|
7
|
+
reasonCode: string | null;
|
|
8
|
+
reason: string | null;
|
|
9
|
+
widgetsRebound: number;
|
|
10
|
+
widgetsKeptLocal: number;
|
|
11
|
+
}
|
|
12
|
+
export interface BindingResult {
|
|
13
|
+
preview: boolean;
|
|
14
|
+
appliedCount: number;
|
|
15
|
+
copies: BindingCopyResult[];
|
|
16
|
+
}
|
|
17
|
+
interface UseFleetBindingActionsResult {
|
|
18
|
+
busy: boolean;
|
|
19
|
+
preview: (input: BindingsInput) => Promise<BindingResult>;
|
|
20
|
+
apply: (input: BindingsInput) => Promise<BindingResult>;
|
|
21
|
+
}
|
|
22
|
+
export declare function useFleetBindingActions(): UseFleetBindingActionsResult;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PreviewCopyBindingsDocument as e, SetCopyBindingsDocument as t } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { useCallback as n, useState as r } from "react";
|
|
3
|
+
import { useApolloClient as i } from "@apollo/client/react";
|
|
4
|
+
// src/bigconsole/hooks/useFleetBindingActions.ts
|
|
5
|
+
var a = (e) => e === "APPLIED" ? "APPLIED" : e === "UNCHANGED" ? "UNCHANGED" : "INCOMPATIBLE", o = (e) => ({
|
|
6
|
+
preview: e.preview,
|
|
7
|
+
appliedCount: e.appliedCount,
|
|
8
|
+
copies: e.copies.map((e) => ({
|
|
9
|
+
dashboardId: e.dashboardId,
|
|
10
|
+
name: e.name ?? null,
|
|
11
|
+
state: a(e.state),
|
|
12
|
+
reasonCode: e.reasonCode ?? null,
|
|
13
|
+
reason: e.reason ?? null,
|
|
14
|
+
widgetsRebound: e.widgetsRebound,
|
|
15
|
+
widgetsKeptLocal: e.widgetsKeptLocal
|
|
16
|
+
}))
|
|
17
|
+
});
|
|
18
|
+
function s() {
|
|
19
|
+
let a = i(), [s, c] = r(!1), l = n(async (e) => {
|
|
20
|
+
c(!0);
|
|
21
|
+
try {
|
|
22
|
+
return await e();
|
|
23
|
+
} finally {
|
|
24
|
+
c(!1);
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
return {
|
|
28
|
+
busy: s,
|
|
29
|
+
preview: n((t) => l(async () => {
|
|
30
|
+
let n = (await a.query({
|
|
31
|
+
query: e,
|
|
32
|
+
variables: { input: t },
|
|
33
|
+
fetchPolicy: "no-cache",
|
|
34
|
+
errorPolicy: "none"
|
|
35
|
+
})).data?.previewCopyBindings;
|
|
36
|
+
if (!n) throw Error("The preview could not be made.");
|
|
37
|
+
return o(n);
|
|
38
|
+
}), [a, l]),
|
|
39
|
+
apply: n((e) => l(async () => {
|
|
40
|
+
let n = (await a.mutate({
|
|
41
|
+
mutation: t,
|
|
42
|
+
variables: { input: e },
|
|
43
|
+
errorPolicy: "none"
|
|
44
|
+
})).data?.setCopyBindings;
|
|
45
|
+
if (!n) throw Error("The data sources could not be changed.");
|
|
46
|
+
return o(n);
|
|
47
|
+
}), [a, l])
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export { s as useFleetBindingActions };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CopyBinding, MasterSources } from '../utils/fleetBindings';
|
|
2
|
+
export interface SinkChoice {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** One request for up to COPIES_PER_REQUEST copies: each is an alias of the same field. */
|
|
8
|
+
export declare const bindingsBatchDocument: (count: number) => import('graphql').DocumentNode;
|
|
9
|
+
interface UseFleetBindingsResult {
|
|
10
|
+
loading: boolean;
|
|
11
|
+
error: Error | null;
|
|
12
|
+
master: MasterSources;
|
|
13
|
+
sinks: ReadonlyMap<string, SinkChoice>;
|
|
14
|
+
sinksTruncated: boolean;
|
|
15
|
+
bindings: ReadonlyMap<string, readonly CopyBinding[]>;
|
|
16
|
+
refetch: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function useFleetBindings(masterId: string, copyIds: readonly string[], enabled: boolean): UseFleetBindingsResult;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import "../context/index.js";
|
|
2
|
+
import { useBigConsole as e } from "../context/BigConsoleContext.js";
|
|
3
|
+
import { FleetDataSinkChoicesDocument as t, FleetMasterSourcesDocument as n } from "../../generated/wspace-operations.js";
|
|
4
|
+
import { masterSources as r } from "../utils/fleetBindings.js";
|
|
5
|
+
import { useCallback as i, useEffect as a, useLayoutEffect as o, useRef as s, useState as c } from "react";
|
|
6
|
+
import { useApolloClient as l } from "@apollo/client/react";
|
|
7
|
+
import { gql as u } from "@apollo/client";
|
|
8
|
+
// src/bigconsole/hooks/useFleetBindings.ts
|
|
9
|
+
var d = 10, f = 100, p = 20, m = (e) => u`query FleetCopyBindings(${Array.from({ length: e }, (e, t) => `$c${t}: ID!`).join(", ")}) {
|
|
10
|
+
${Array.from({ length: e }, (e, t) => `c${t}: dashboardBindings(dashboardId: $c${t}) { kind masterRefId copyRefId }`).join("\n ")}
|
|
11
|
+
}`, h = (e) => typeof e == "object" && !!e && "kind" in e && typeof e.kind == "string" && "masterRefId" in e && typeof e.masterRefId == "string" && "copyRefId" in e && typeof e.copyRefId == "string", g = {
|
|
12
|
+
key: "",
|
|
13
|
+
master: {
|
|
14
|
+
sinks: [],
|
|
15
|
+
otherSourceWidgets: 0
|
|
16
|
+
},
|
|
17
|
+
sinks: /* @__PURE__ */ new Map(),
|
|
18
|
+
sinksTruncated: !1,
|
|
19
|
+
bindings: /* @__PURE__ */ new Map(),
|
|
20
|
+
error: null
|
|
21
|
+
};
|
|
22
|
+
function _(u, _, v) {
|
|
23
|
+
let { workspaceId: y, currentUser: b } = e(), x = l(), S = [..._].sort().join(","), C = `${y ?? ""}:${b?.id ?? ""}:${u}:${S}`, [w, T] = c(g), [E, D] = c(v), O = s(C), k = s(0);
|
|
24
|
+
o(() => (O.current = C, () => {
|
|
25
|
+
O.current = "", k.current += 1;
|
|
26
|
+
}), [C]);
|
|
27
|
+
let A = i(async () => {
|
|
28
|
+
if (O.current !== C) return;
|
|
29
|
+
let e = ++k.current, i = () => O.current === C && k.current === e, a = {
|
|
30
|
+
requiredWorkspaceAuth: !0,
|
|
31
|
+
requiredWorkspaceId: y,
|
|
32
|
+
queryDeduplication: !1
|
|
33
|
+
}, o = S ? S.split(",") : [];
|
|
34
|
+
try {
|
|
35
|
+
D(!0);
|
|
36
|
+
let e = async () => {
|
|
37
|
+
let e = await x.query({
|
|
38
|
+
query: n,
|
|
39
|
+
variables: { dashboardId: u },
|
|
40
|
+
fetchPolicy: "no-cache",
|
|
41
|
+
errorPolicy: "none",
|
|
42
|
+
context: a
|
|
43
|
+
});
|
|
44
|
+
return r(e.data?.listWidgetsByDashboard ?? []);
|
|
45
|
+
}, s = async (e) => {
|
|
46
|
+
let n = (await x.query({
|
|
47
|
+
query: t,
|
|
48
|
+
variables: {
|
|
49
|
+
first: f,
|
|
50
|
+
after: e
|
|
51
|
+
},
|
|
52
|
+
fetchPolicy: "no-cache",
|
|
53
|
+
errorPolicy: "none",
|
|
54
|
+
context: a
|
|
55
|
+
})).data?.listDataSinks;
|
|
56
|
+
return {
|
|
57
|
+
nodes: (n?.edges ?? []).map((e) => ({
|
|
58
|
+
id: e.node.id,
|
|
59
|
+
name: e.node.name ?? e.node.id,
|
|
60
|
+
isActive: e.node.isActive
|
|
61
|
+
})),
|
|
62
|
+
next: n?.pageInfo.hasNextPage ? n.pageInfo.endCursor ?? null : null
|
|
63
|
+
};
|
|
64
|
+
}, [c, l, g] = await Promise.all([
|
|
65
|
+
e(),
|
|
66
|
+
(async () => {
|
|
67
|
+
let e = /* @__PURE__ */ new Map(), t = null;
|
|
68
|
+
for (let n = 0; n < p; n += 1) {
|
|
69
|
+
let n = await s(t);
|
|
70
|
+
for (let t of n.nodes) e.set(t.id, t);
|
|
71
|
+
if (n.next === null) return {
|
|
72
|
+
sinks: e,
|
|
73
|
+
truncated: !1
|
|
74
|
+
};
|
|
75
|
+
t = n.next;
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
sinks: e,
|
|
79
|
+
truncated: !0
|
|
80
|
+
};
|
|
81
|
+
})(),
|
|
82
|
+
(async () => {
|
|
83
|
+
let e = [];
|
|
84
|
+
for (let t = 0; t < o.length; t += d) e.push(o.slice(t, t + d));
|
|
85
|
+
let t = /* @__PURE__ */ new Map();
|
|
86
|
+
return await Promise.all(e.map(async (e) => {
|
|
87
|
+
let n = await x.query({
|
|
88
|
+
query: m(e.length),
|
|
89
|
+
variables: Object.fromEntries(e.map((e, t) => [`c${t}`, e])),
|
|
90
|
+
fetchPolicy: "no-cache",
|
|
91
|
+
errorPolicy: "none",
|
|
92
|
+
context: a
|
|
93
|
+
});
|
|
94
|
+
e.forEach((e, r) => {
|
|
95
|
+
let i = n.data?.[`c${r}`];
|
|
96
|
+
if (!Array.isArray(i)) throw Error("The data sources of a copy could not be read");
|
|
97
|
+
t.set(e, i.filter(h));
|
|
98
|
+
});
|
|
99
|
+
})), t;
|
|
100
|
+
})()
|
|
101
|
+
]);
|
|
102
|
+
i() && T({
|
|
103
|
+
key: C,
|
|
104
|
+
master: c,
|
|
105
|
+
sinks: l.sinks,
|
|
106
|
+
sinksTruncated: l.truncated,
|
|
107
|
+
bindings: g,
|
|
108
|
+
error: null
|
|
109
|
+
});
|
|
110
|
+
} catch (e) {
|
|
111
|
+
i() && T({
|
|
112
|
+
...g,
|
|
113
|
+
key: C,
|
|
114
|
+
error: e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load the data sources")
|
|
115
|
+
});
|
|
116
|
+
} finally {
|
|
117
|
+
i() && D(!1);
|
|
118
|
+
}
|
|
119
|
+
}, [
|
|
120
|
+
x,
|
|
121
|
+
S,
|
|
122
|
+
C,
|
|
123
|
+
u,
|
|
124
|
+
y
|
|
125
|
+
]);
|
|
126
|
+
a(() => {
|
|
127
|
+
v && A();
|
|
128
|
+
}, [v, A]);
|
|
129
|
+
let j = w.key === C;
|
|
130
|
+
return {
|
|
131
|
+
loading: v && (E || !j),
|
|
132
|
+
error: j ? w.error : null,
|
|
133
|
+
master: j ? w.master : g.master,
|
|
134
|
+
sinks: j ? w.sinks : g.sinks,
|
|
135
|
+
sinksTruncated: j ? w.sinksTruncated : !1,
|
|
136
|
+
bindings: j ? w.bindings : g.bindings,
|
|
137
|
+
refetch: A
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export { m as bindingsBatchDocument, _ as useFleetBindings };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BigConsoleLinkBindingKind } from '../../generated/wspace-types';
|
|
2
|
+
/** What a widget reads from, by id. */
|
|
3
|
+
export interface WidgetSources {
|
|
4
|
+
dataSinkId?: string | null;
|
|
5
|
+
parserId?: string | null;
|
|
6
|
+
savedQueryId?: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface MasterSink {
|
|
9
|
+
id: string;
|
|
10
|
+
/** How many of the master's widgets read it. */
|
|
11
|
+
widgetCount: number;
|
|
12
|
+
}
|
|
13
|
+
export interface MasterSources {
|
|
14
|
+
sinks: MasterSink[];
|
|
15
|
+
/** Widgets that read through a parser or a saved query, whose source cannot be swapped here. */
|
|
16
|
+
otherSourceWidgets: number;
|
|
17
|
+
}
|
|
18
|
+
/** The data sinks the master's widgets read, most used first, and how many widgets read some other way. */
|
|
19
|
+
export declare function masterSources(widgets: readonly WidgetSources[]): MasterSources;
|
|
20
|
+
/** A copy's data source in place of one of the master's, as the server holds it. */
|
|
21
|
+
export interface CopyBinding {
|
|
22
|
+
kind: string;
|
|
23
|
+
masterRefId: string;
|
|
24
|
+
copyRefId: string;
|
|
25
|
+
}
|
|
26
|
+
/** What the copy reads in place of the master's data sink `from`: its own sink, or null for the master's. */
|
|
27
|
+
export declare function currentSink(bindings: readonly CopyBinding[] | undefined, from: string): string | null;
|
|
28
|
+
/** What a person has chosen: for each of the master's data sinks, for each copy, its sink (null = the master's). */
|
|
29
|
+
export type BindingDraft = Record<string, Record<string, string | null>>;
|
|
30
|
+
/** The choice for one copy and one master sink: what was picked, or what the copy reads now. */
|
|
31
|
+
export declare function chosenSink(draft: BindingDraft, bindings: ReadonlyMap<string, readonly CopyBinding[]>, copyId: string, from: string): string | null;
|
|
32
|
+
/** A choice made again to what the copy already reads is not a change: it is dropped from the draft. */
|
|
33
|
+
export declare function withChoice(draft: BindingDraft, bindings: ReadonlyMap<string, readonly CopyBinding[]>, copyId: string, from: string, to: string | null): BindingDraft;
|
|
34
|
+
export interface BindingsInput {
|
|
35
|
+
masterDashboardId: string;
|
|
36
|
+
copies: Array<{
|
|
37
|
+
copyDashboardId: string;
|
|
38
|
+
swaps: Array<{
|
|
39
|
+
from: string;
|
|
40
|
+
kind: BigConsoleLinkBindingKind;
|
|
41
|
+
to: string | null;
|
|
42
|
+
}>;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The request a draft amounts to: one entry per copy that changes, each with only the swaps that change it.
|
|
47
|
+
* Null when nothing changes, so there is nothing to preview. `copyIds` keeps the copies in the order shown.
|
|
48
|
+
*/
|
|
49
|
+
export declare function bindingsInput(masterDashboardId: string, draft: BindingDraft, copyIds: readonly string[]): BindingsInput | null;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BigConsoleLinkBindingKind as e } from "../../generated/wspace-types.js";
|
|
2
|
+
// src/bigconsole/utils/fleetBindings.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
5
|
+
for (let r of e) r.dataSinkId && t.set(r.dataSinkId, (t.get(r.dataSinkId) ?? 0) + 1), (r.parserId || r.savedQueryId) && (n += 1);
|
|
6
|
+
return {
|
|
7
|
+
sinks: [...t.entries()].map(([e, t]) => ({
|
|
8
|
+
id: e,
|
|
9
|
+
widgetCount: t
|
|
10
|
+
})).sort((e, t) => t.widgetCount - e.widgetCount || e.id.localeCompare(t.id)),
|
|
11
|
+
otherSourceWidgets: n
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function n(e, t) {
|
|
15
|
+
let n = e?.find((e) => e.kind === "DATA_SINK" && e.masterRefId === t);
|
|
16
|
+
return n ? n.copyRefId : null;
|
|
17
|
+
}
|
|
18
|
+
function r(e, t, r, i) {
|
|
19
|
+
let a = e[i]?.[r];
|
|
20
|
+
return a === void 0 ? n(t.get(r), i) : a;
|
|
21
|
+
}
|
|
22
|
+
function i(e, t, r, i, a) {
|
|
23
|
+
let o = {
|
|
24
|
+
...e,
|
|
25
|
+
[i]: { ...e[i] }
|
|
26
|
+
};
|
|
27
|
+
return a === n(t.get(r), i) ? (delete o[i]?.[r], Object.keys(o[i] ?? {}).length === 0 && delete o[i]) : o[i] = {
|
|
28
|
+
...o[i],
|
|
29
|
+
[r]: a
|
|
30
|
+
}, o;
|
|
31
|
+
}
|
|
32
|
+
function a(t, n, r) {
|
|
33
|
+
let i = r.flatMap((t) => {
|
|
34
|
+
let r = Object.keys(n).sort().flatMap((r) => {
|
|
35
|
+
let i = n[r]?.[t];
|
|
36
|
+
return i === void 0 ? [] : [{
|
|
37
|
+
from: r,
|
|
38
|
+
kind: e.DataSink,
|
|
39
|
+
to: i
|
|
40
|
+
}];
|
|
41
|
+
});
|
|
42
|
+
return r.length > 0 ? [{
|
|
43
|
+
copyDashboardId: t,
|
|
44
|
+
swaps: r
|
|
45
|
+
}] : [];
|
|
46
|
+
});
|
|
47
|
+
return i.length > 0 ? {
|
|
48
|
+
masterDashboardId: t,
|
|
49
|
+
copies: i
|
|
50
|
+
} : null;
|
|
51
|
+
}
|
|
52
|
+
export { a as bindingsInput, r as chosenSink, n as currentSink, t as masterSources, i as withChoice };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { resolveWidgetDataPath as e } from "./widgetDisplayData.js";
|
|
2
|
+
import { isHeatmapShape as t, validateWidgetShape as n } from "./widgetSampleShapes.js";
|
|
3
|
+
import { isShapedRetentionData as r, retentionFieldsFromConfig as i, retentionRows as a, tryNormalizeRetention as o } from "../components/widgets/retention/normalizeRetention.js";
|
|
3
4
|
// src/bigconsole/utils/widgetBinding.ts
|
|
4
|
-
var
|
|
5
|
+
var s = /* @__PURE__ */ new Set([
|
|
5
6
|
"DATASINK",
|
|
6
7
|
"REST_API",
|
|
7
8
|
"GRAPHQL",
|
|
8
9
|
"SQL",
|
|
9
10
|
"WEBSOCKET",
|
|
10
11
|
"MOCK"
|
|
11
|
-
]),
|
|
12
|
+
]), c = [
|
|
12
13
|
"labelField",
|
|
13
14
|
"valueField",
|
|
14
15
|
"xAxisField",
|
|
@@ -16,15 +17,15 @@ var o = /* @__PURE__ */ new Set([
|
|
|
16
17
|
"categoryField",
|
|
17
18
|
"seriesField"
|
|
18
19
|
];
|
|
19
|
-
function c(e) {
|
|
20
|
-
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
21
|
-
}
|
|
22
20
|
function l(e) {
|
|
23
|
-
return typeof e == "
|
|
21
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
24
22
|
}
|
|
25
23
|
function u(e) {
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
return typeof e == "string" && s.has(e);
|
|
25
|
+
}
|
|
26
|
+
function d(e) {
|
|
27
|
+
if (!l(e) || !l(e.source) || !u(e.source.kind)) return null;
|
|
28
|
+
let t = l(e.fields) ? Object.fromEntries(Object.entries(e.fields).filter((e) => typeof e[1] == "string")) : {};
|
|
28
29
|
return {
|
|
29
30
|
source: {
|
|
30
31
|
kind: e.source.kind,
|
|
@@ -34,11 +35,11 @@ function u(e) {
|
|
|
34
35
|
fields: t
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
let t = e.config ?? {}, n =
|
|
38
|
+
function f(e) {
|
|
39
|
+
let t = e.config ?? {}, n = d(t.binding);
|
|
39
40
|
if (n) return n;
|
|
40
|
-
let r =
|
|
41
|
-
for (let e of
|
|
41
|
+
let r = u(t.dataSourceType) ? t.dataSourceType : void 0, i = e.dataSinkId ? "DATASINK" : r ?? "DATASINK", a = {};
|
|
42
|
+
for (let e of c) {
|
|
42
43
|
let n = t[e];
|
|
43
44
|
typeof n == "string" && n.length > 0 && (a[e] = n);
|
|
44
45
|
}
|
|
@@ -51,20 +52,20 @@ function d(e) {
|
|
|
51
52
|
fields: a
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
55
|
+
function p(e) {
|
|
56
|
+
return f({
|
|
56
57
|
dataSinkId: e.dataSinkId ?? void 0,
|
|
57
58
|
parserId: e.parserId ?? void 0,
|
|
58
59
|
config: e.config ?? {}
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function m(e, t, n) {
|
|
62
63
|
let r = { ...e }, i = (e, t) => JSON.stringify(e) === JSON.stringify(t);
|
|
63
64
|
for (let e of Object.keys(n)) i(n[e], t[e]) || (r[e] = n[e]);
|
|
64
65
|
for (let e of Object.keys(t)) e in n || delete r[e];
|
|
65
66
|
return r;
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
+
function h(e, t) {
|
|
68
69
|
let n = {
|
|
69
70
|
source: {
|
|
70
71
|
kind: e.source.kind,
|
|
@@ -84,10 +85,10 @@ function m(e, t) {
|
|
|
84
85
|
parserId: n.parserId
|
|
85
86
|
};
|
|
86
87
|
}
|
|
87
|
-
function h(e, t) {
|
|
88
|
-
return t.replace(/^\$?\.?/, "").split(".").filter(Boolean).reduce((e, t) => c(e) ? e[t] : void 0, e);
|
|
89
|
-
}
|
|
90
88
|
function g(e, t) {
|
|
89
|
+
return t.replace(/^\$?\.?/, "").split(".").filter(Boolean).reduce((e, t) => l(e) ? e[t] : void 0, e);
|
|
90
|
+
}
|
|
91
|
+
function _(e, t) {
|
|
91
92
|
if (e.source.kind === "DATASINK" && !e.source.ref) return {
|
|
92
93
|
status: "unbound",
|
|
93
94
|
missingFields: []
|
|
@@ -96,28 +97,28 @@ function g(e, t) {
|
|
|
96
97
|
status: "bound",
|
|
97
98
|
missingFields: []
|
|
98
99
|
};
|
|
99
|
-
let n = Object.entries(e.fields).filter(([, e]) =>
|
|
100
|
+
let n = Object.entries(e.fields).filter(([, e]) => g(t, e) === void 0).map(([e]) => e);
|
|
100
101
|
return {
|
|
101
102
|
status: n.length > 0 ? "field_mismatch" : "bound",
|
|
102
103
|
missingFields: n
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
-
if (
|
|
106
|
+
function v(e, t, s) {
|
|
107
|
+
if (r(e)) return {
|
|
107
108
|
status: "bound",
|
|
108
109
|
missingFields: []
|
|
109
110
|
};
|
|
110
|
-
let c =
|
|
111
|
+
let c = a(e);
|
|
111
112
|
if (!c) {
|
|
112
|
-
let
|
|
113
|
+
let t = n("retention", e);
|
|
113
114
|
return {
|
|
114
|
-
status:
|
|
115
|
-
missingFields:
|
|
115
|
+
status: t.length > 0 ? "shape_mismatch" : "bound",
|
|
116
|
+
missingFields: t
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
|
-
let l =
|
|
119
|
+
let l = i(s), u = o(c, {
|
|
119
120
|
...l,
|
|
120
|
-
valueField:
|
|
121
|
+
valueField: t.fields.valueField ?? l.valueField
|
|
121
122
|
});
|
|
122
123
|
return u.error ? u.error.code === "missing_fields" ? {
|
|
123
124
|
status: "field_mismatch",
|
|
@@ -130,14 +131,26 @@ function _(e, o, s) {
|
|
|
130
131
|
missingFields: []
|
|
131
132
|
};
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
134
|
+
function y(n, r, i, a) {
|
|
135
|
+
if (i === "retention") return v(r, n, a);
|
|
136
|
+
if (i === "heatmap" && t(r)) return {
|
|
135
137
|
status: "bound",
|
|
136
138
|
missingFields: []
|
|
137
|
-
}
|
|
139
|
+
};
|
|
140
|
+
if (i === "chart" || i === "funnel_chart") {
|
|
141
|
+
let t = e(r, a);
|
|
142
|
+
if (Array.isArray(t) && t.length > 0) {
|
|
143
|
+
let e = Object.entries(n.fields).filter(([, e]) => !t.some((t) => l(t) && (Object.hasOwn(t, e) || g(t, e) !== void 0))).map(([e]) => e);
|
|
144
|
+
return {
|
|
145
|
+
status: e.length > 0 ? "field_mismatch" : "bound",
|
|
146
|
+
missingFields: e
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return _(n, Array.isArray(r) ? r[0] : r);
|
|
138
151
|
}
|
|
139
|
-
function
|
|
140
|
-
if (
|
|
152
|
+
function b({ binding: e, loading: t = !1, error: r, preview: i, previewComplete: a = !1, widgetType: o, mockData: s, hasParser: c, config: l }) {
|
|
153
|
+
if (t) return {
|
|
141
154
|
status: "loading",
|
|
142
155
|
missingFields: []
|
|
143
156
|
};
|
|
@@ -145,12 +158,12 @@ function y({ binding: e, loading: n = !1, error: r, preview: i, previewComplete:
|
|
|
145
158
|
status: "parser_error",
|
|
146
159
|
missingFields: []
|
|
147
160
|
};
|
|
148
|
-
let u =
|
|
161
|
+
let u = _(e);
|
|
149
162
|
if (u.status === "unbound") return u;
|
|
150
163
|
if (e.source.kind === "MOCK" && s !== void 0 && s !== "") {
|
|
151
|
-
let
|
|
164
|
+
let t = s;
|
|
152
165
|
if (typeof s == "string") try {
|
|
153
|
-
|
|
166
|
+
t = JSON.parse(s);
|
|
154
167
|
} catch {
|
|
155
168
|
return {
|
|
156
169
|
status: "invalid_sample",
|
|
@@ -158,10 +171,10 @@ function y({ binding: e, loading: n = !1, error: r, preview: i, previewComplete:
|
|
|
158
171
|
};
|
|
159
172
|
}
|
|
160
173
|
if (o === "retention") {
|
|
161
|
-
let
|
|
162
|
-
if (
|
|
174
|
+
let n = v(t, e, l);
|
|
175
|
+
if (n.status !== "bound") return n;
|
|
163
176
|
} else {
|
|
164
|
-
let e =
|
|
177
|
+
let e = n(o, t);
|
|
165
178
|
if (e.length > 0) return {
|
|
166
179
|
status: "shape_mismatch",
|
|
167
180
|
missingFields: e
|
|
@@ -174,12 +187,12 @@ function y({ binding: e, loading: n = !1, error: r, preview: i, previewComplete:
|
|
|
174
187
|
} : a ? i == null || Array.isArray(i) && i.length === 0 ? {
|
|
175
188
|
status: "no_data",
|
|
176
189
|
missingFields: []
|
|
177
|
-
} :
|
|
190
|
+
} : y(e, i, o, l) : u;
|
|
178
191
|
}
|
|
179
|
-
function
|
|
192
|
+
function x(e, t) {
|
|
180
193
|
return e?.success ? {
|
|
181
194
|
preview: e.output,
|
|
182
195
|
error: null
|
|
183
196
|
} : { error: e?.error || t };
|
|
184
197
|
}
|
|
185
|
-
export {
|
|
198
|
+
export { p as getBindingForWidget, f as getWidgetBinding, b as getWidgetBindingStatus, x as parserTestOutcome, m as reconcilePanelConfig, g as resolveBindingPath, h as serializeWidgetBinding, _ as validateWidgetBinding };
|