react-semaphor 0.1.334 → 0.1.336
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/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +100 -242
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +3 -3
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +435 -391
- package/dist/chunks/{braces-DlW7C5BH.js → braces-BLa_lORs.js} +1 -1
- package/dist/chunks/{braces-DYx37F5Z.js → braces-Q86XHDaD.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-CB5MA9gF.js → calendar-preferences-dialog-Bm7ji3k9.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-BLz4PrDX.js → calendar-preferences-dialog-Cocogo9H.js} +3 -3
- package/dist/chunks/catalog-field-grounding-DmT7aGUA.js +191 -0
- package/dist/chunks/catalog-field-grounding-VgVzDd25.js +1 -0
- package/dist/chunks/{chevrons-up-down-CP6oFMrt.js → chevrons-up-down-BBTZ5pAY.js} +1 -1
- package/dist/chunks/{chevrons-up-down-B_66pVv5.js → chevrons-up-down-CYuWasy_.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Bwz4mKOI.js → dashboard-briefing-launcher-BtqtLx1-.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-B7AxiecS.js → dashboard-briefing-launcher-DF4CoaRn.js} +4 -4
- package/dist/chunks/{dashboard-controls-DlN7FGW-.js → dashboard-controls-0VMAeMoa.js} +1 -1
- package/dist/chunks/{dashboard-controls-CbuKeeeP.js → dashboard-controls-B5U-VUxs.js} +6 -6
- package/dist/chunks/{dashboard-json-CeVrYTnR.js → dashboard-json-CqbLOfnr.js} +1 -1
- package/dist/chunks/{dashboard-json-gcpeSd5I.js → dashboard-json-Hmc0Ri5z.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-Kn1wtj-Z.js → edit-dashboard-visual-C0EDM0QB.js} +3 -3
- package/dist/chunks/{edit-dashboard-visual-BggRcCO2.js → edit-dashboard-visual-D4VVu-QQ.js} +1302 -1302
- package/dist/chunks/{index-CP3_hN7P.js → index-DE0vIuYG.js} +4 -4
- package/dist/chunks/{index-TA0tBZ1g.js → index-DzyUhzV3.js} +262 -270
- package/dist/chunks/{palette-BW7lzLOY.js → palette-B9AbDw0n.js} +1 -1
- package/dist/chunks/{palette-BueS2ZEM.js → palette-DalASD28.js} +1 -1
- package/dist/chunks/{resource-management-panel-vDrPcmXs.js → resource-management-panel-C4YydU9I.js} +3 -3
- package/dist/chunks/{resource-management-panel-DBYcMHVL.js → resource-management-panel-P9iNqBM1.js} +1 -1
- package/dist/chunks/{switch-B6fK1sl9.js → switch-BAYfpAEb.js} +1967 -2008
- package/dist/chunks/{switch-BT7khJGF.js → switch-CyRoZr5T.js} +35 -35
- package/dist/chunks/{use-create-flow-overlay-state-T8Su6dzu.js → use-create-flow-overlay-state-CbhjxI3W.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DPYHfe-S.js → use-create-flow-overlay-state-P1LMwQ89.js} +3 -3
- package/dist/chunks/{use-visual-utils-wqosOqyY.js → use-visual-utils-CV6_-y4p.js} +1 -1
- package/dist/chunks/{use-visual-utils-Daov8_1p.js → use-visual-utils-lB-3Zk0b.js} +2 -2
- package/dist/chunks/validators-BOqiGymD.js +660 -0
- package/dist/chunks/validators-BtFXY3S_.js +2 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +476 -453
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +1 -1
- package/dist/data-app-builder-browser-runtime/index.cjs +1 -1
- package/dist/data-app-builder-browser-runtime/index.js +4 -9
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +89 -80
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +183 -5
- package/dist/types/briefings.d.ts +12 -0
- package/dist/types/dashboard-authoring.d.ts +33 -4
- package/dist/types/data-app-builder.d.ts +30 -3
- package/dist/types/data-app-sdk.d.ts +32 -5
- package/dist/types/main.d.ts +34 -3
- package/package.json +1 -1
- package/dist/chunks/validators-DDAweCzB.js +0 -371
- package/dist/chunks/validators-odlRJblR.js +0 -2
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { b as ye } from "../chunks/catalog-field-grounding-DmT7aGUA.js";
|
|
2
|
+
import { c as _e, v as we } from "../chunks/validators-BOqiGymD.js";
|
|
3
|
+
const ve = [
|
|
3
4
|
"lg",
|
|
4
5
|
"md",
|
|
5
6
|
"sm",
|
|
6
7
|
"xs",
|
|
7
8
|
"xxs"
|
|
8
|
-
],
|
|
9
|
+
], B = 10;
|
|
9
10
|
function _(e) {
|
|
10
11
|
return e && typeof e == "object" ? e : null;
|
|
11
12
|
}
|
|
12
13
|
function k(e) {
|
|
13
14
|
return typeof e == "string" ? e : null;
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
+
function ke(e) {
|
|
16
17
|
var t, n, r;
|
|
17
18
|
return !!(e && typeof e == "object") && (((t = _(e)) == null ? void 0 : t.kind) === "semantic" || ((n = _(e)) == null ? void 0 : n.kind) === "physical" || ((r = _(e)) == null ? void 0 : r.kind) === "sql");
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
20
|
+
function R(e) {
|
|
21
|
+
return ke(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function re(e) {
|
|
23
24
|
return e.kind === "semantic" ? [
|
|
24
25
|
"semantic",
|
|
25
26
|
e.domainId,
|
|
@@ -33,13 +34,13 @@ function ee(e) {
|
|
|
33
34
|
e.tableName
|
|
34
35
|
].join(":") : ["sql", e.connectionId, e.sql].join(":");
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function G(e, t) {
|
|
37
38
|
return e.domainId !== t.domainId ? !1 : e.datasetId && t.datasetId ? e.datasetId === t.datasetId : e.datasetName === t.datasetName;
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
return e.kind === "semantic" && t.kind === "semantic" ?
|
|
40
|
+
function de(e, t) {
|
|
41
|
+
return e.kind === "semantic" && t.kind === "semantic" ? G(e, t) : re(e) === re(t);
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function Ae(e, t) {
|
|
43
44
|
return e.kind !== "semantic" || t.kind !== "semantic" ? e : {
|
|
44
45
|
...e,
|
|
45
46
|
datasetId: e.datasetId || t.datasetId,
|
|
@@ -47,104 +48,104 @@ function _e(e, t) {
|
|
|
47
48
|
connectionId: e.connectionId || t.connectionId
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function V(e) {
|
|
51
52
|
const t = [];
|
|
52
53
|
for (const n of e) {
|
|
53
54
|
const r = t.findIndex(
|
|
54
|
-
(
|
|
55
|
+
(a) => de(a, n)
|
|
55
56
|
);
|
|
56
|
-
r === -1 ? t.push(n) : t[r] =
|
|
57
|
+
r === -1 ? t.push(n) : t[r] = Ae(
|
|
57
58
|
t[r],
|
|
58
59
|
n
|
|
59
60
|
);
|
|
60
61
|
}
|
|
61
62
|
return t;
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
-
return
|
|
64
|
+
function kt(e) {
|
|
65
|
+
return V(e)[0];
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !
|
|
67
|
+
function O(e, t) {
|
|
68
|
+
return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !G(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
70
|
+
function W(e) {
|
|
71
|
+
return R(e) ? e : void 0;
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
+
function ae(e, t) {
|
|
73
74
|
if (!(e.kind !== "semantic" || e.connectionId))
|
|
74
75
|
return t.find(
|
|
75
|
-
(n) => (n == null ? void 0 : n.kind) === "semantic" &&
|
|
76
|
+
(n) => (n == null ? void 0 : n.kind) === "semantic" && G(e, n) && !!n.connectionId
|
|
76
77
|
);
|
|
77
78
|
}
|
|
78
79
|
function v(e, t) {
|
|
79
|
-
const n =
|
|
80
|
-
return n ?
|
|
80
|
+
const n = W(e == null ? void 0 : e.source);
|
|
81
|
+
return n ? O(n, t) : void 0;
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function Se({
|
|
83
84
|
explicitSource: e,
|
|
84
85
|
field: t,
|
|
85
86
|
defaultSource: n,
|
|
86
87
|
fallbackSources: r
|
|
87
88
|
}) {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const a = [n, ...r || []], i = W(e), s = i ? O(
|
|
90
|
+
i,
|
|
91
|
+
ae(i, a)
|
|
91
92
|
) : void 0;
|
|
92
93
|
if (s)
|
|
93
94
|
return s;
|
|
94
95
|
if (e !== void 0)
|
|
95
96
|
return;
|
|
96
|
-
const d = v(t, n), o = d ?
|
|
97
|
+
const d = v(t, n), o = d ? O(
|
|
97
98
|
d,
|
|
98
|
-
|
|
99
|
+
ae(d, a)
|
|
99
100
|
) : void 0;
|
|
100
101
|
if (o)
|
|
101
102
|
return o;
|
|
102
103
|
if ((t == null ? void 0 : t.source) === void 0)
|
|
103
|
-
return
|
|
104
|
+
return W(n);
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function Ce(e, t) {
|
|
106
107
|
if (!(e != null && e.name) || !(t != null && t.name) || e.name !== t.name)
|
|
107
108
|
return !1;
|
|
108
109
|
const n = v(e), r = v(t);
|
|
109
|
-
return !n || !r ? !0 :
|
|
110
|
+
return !n || !r ? !0 : de(n, r);
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
+
function S(e) {
|
|
112
113
|
var t;
|
|
113
114
|
return k((t = _(e)) == null ? void 0 : t.kind);
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
+
function ce(e) {
|
|
116
117
|
var t, n;
|
|
117
|
-
return
|
|
118
|
+
return S(e) !== "semantic" ? null : ((n = k((t = _(e)) == null ? void 0 : t.domainId)) == null ? void 0 : n.trim()) || null;
|
|
118
119
|
}
|
|
119
|
-
function
|
|
120
|
+
function De(e) {
|
|
120
121
|
var t;
|
|
121
|
-
return
|
|
122
|
+
return S(e) !== "semantic" ? null : k((t = _(e)) == null ? void 0 : t.datasetName);
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function xe(e) {
|
|
124
125
|
var t;
|
|
125
|
-
return
|
|
126
|
+
return S(e) !== "semantic" ? null : k((t = _(e)) == null ? void 0 : t.datasetId);
|
|
126
127
|
}
|
|
127
|
-
function
|
|
128
|
+
function Fe(e) {
|
|
128
129
|
var t;
|
|
129
|
-
return
|
|
130
|
+
return S(e) !== "physical" ? null : k((t = _(e)) == null ? void 0 : t.connectionId);
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
+
function Ne(e) {
|
|
132
133
|
var t;
|
|
133
|
-
return
|
|
134
|
+
return S(e) !== "physical" ? null : k((t = _(e)) == null ? void 0 : t.tableName);
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function Te(e) {
|
|
136
137
|
var t;
|
|
137
|
-
return
|
|
138
|
+
return S(e) !== "physical" ? "" : k((t = _(e)) == null ? void 0 : t.databaseName) || "";
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
+
function $e(e) {
|
|
140
141
|
var t;
|
|
141
|
-
return
|
|
142
|
+
return S(e) !== "physical" ? "" : k((t = _(e)) == null ? void 0 : t.schemaName) || "";
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
+
function Re(e) {
|
|
144
145
|
if (e.analyticsIntent && typeof e.analyticsIntent == "object" && "source" in e.analyticsIntent)
|
|
145
146
|
return e.analyticsIntent.source;
|
|
146
147
|
}
|
|
147
|
-
function
|
|
148
|
+
function Me({
|
|
148
149
|
datasets: e,
|
|
149
150
|
requireAtLeastOne: t
|
|
150
151
|
}) {
|
|
@@ -152,27 +153,27 @@ function Ne({
|
|
|
152
153
|
return { ok: !1, issue: "invalid_dataset_count" };
|
|
153
154
|
if (e.length <= 1)
|
|
154
155
|
return { ok: !0 };
|
|
155
|
-
const n = e.map(
|
|
156
|
-
return n.some((
|
|
156
|
+
const n = e.map(ce), r = new Set(n.filter(Boolean));
|
|
157
|
+
return n.some((a) => !a) || r.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
+
function H(e, t) {
|
|
159
160
|
if (!t)
|
|
160
161
|
return !1;
|
|
161
162
|
if (t.kind === "semantic") {
|
|
162
|
-
const n =
|
|
163
|
-
return
|
|
163
|
+
const n = xe(e);
|
|
164
|
+
return ce(e) === t.domainId ? n && t.datasetId ? n === t.datasetId : De(e) === t.datasetName : !1;
|
|
164
165
|
}
|
|
165
|
-
return t.kind === "physical" ?
|
|
166
|
+
return t.kind === "physical" ? Fe(e) === t.connectionId && Ne(e) === t.tableName && Te(e) === (t.databaseName || "") && $e(e) === (t.schemaName || "") : !1;
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
+
function At(e, t) {
|
|
168
169
|
return e.find(
|
|
169
|
-
(n) =>
|
|
170
|
+
(n) => H(n, t)
|
|
170
171
|
);
|
|
171
172
|
}
|
|
172
|
-
function
|
|
173
|
+
function f(e, t, n) {
|
|
173
174
|
return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
|
|
174
175
|
}
|
|
175
|
-
function
|
|
176
|
+
function q(e) {
|
|
176
177
|
const t = /* @__PURE__ */ new Set();
|
|
177
178
|
for (const n of e) {
|
|
178
179
|
if (t.has(n))
|
|
@@ -181,19 +182,19 @@ function $(e) {
|
|
|
181
182
|
}
|
|
182
183
|
return null;
|
|
183
184
|
}
|
|
184
|
-
function
|
|
185
|
+
function ue({
|
|
185
186
|
card: e,
|
|
186
187
|
datasets: t,
|
|
187
188
|
errors: n
|
|
188
189
|
}) {
|
|
189
190
|
if (e.type === "text")
|
|
190
191
|
return;
|
|
191
|
-
const r =
|
|
192
|
+
const r = Re(e);
|
|
192
193
|
if (!r) {
|
|
193
194
|
if (t.length <= 1)
|
|
194
195
|
return;
|
|
195
196
|
n.push(
|
|
196
|
-
|
|
197
|
+
f(
|
|
197
198
|
"missing_card_analytics_source",
|
|
198
199
|
"Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",
|
|
199
200
|
e.id
|
|
@@ -201,35 +202,40 @@ function se({
|
|
|
201
202
|
);
|
|
202
203
|
return;
|
|
203
204
|
}
|
|
204
|
-
t.some((
|
|
205
|
-
|
|
205
|
+
t.some((a) => H(a, r)) || n.push(
|
|
206
|
+
f(
|
|
206
207
|
"invalid_card_analytics_source",
|
|
207
208
|
"Dashboard cards with an explicit analytics source must use one of the selected datasets.",
|
|
208
209
|
e.id
|
|
209
210
|
)
|
|
210
211
|
);
|
|
211
212
|
}
|
|
212
|
-
function
|
|
213
|
+
function qe(e) {
|
|
213
214
|
var t;
|
|
214
215
|
return e ? [
|
|
216
|
+
...Array.isArray(e.metricRefs) ? e.metricRefs.map((n) => n.source) : [],
|
|
215
217
|
(t = e.dateFieldRef) == null ? void 0 : t.source,
|
|
216
|
-
...Array.isArray(e.dimensionRefs) ? e.dimensionRefs.map((n) => n.source) : []
|
|
218
|
+
...Array.isArray(e.dimensionRefs) ? e.dimensionRefs.map((n) => n.source) : [],
|
|
219
|
+
...Array.isArray(e.filters) ? e.filters.map((n) => {
|
|
220
|
+
var r;
|
|
221
|
+
return (r = n.field) == null ? void 0 : r.source;
|
|
222
|
+
}) : []
|
|
217
223
|
].filter(
|
|
218
224
|
(n) => !!n
|
|
219
225
|
) : [];
|
|
220
226
|
}
|
|
221
|
-
function
|
|
227
|
+
function le({
|
|
222
228
|
card: e,
|
|
223
229
|
datasets: t,
|
|
224
230
|
errors: n
|
|
225
231
|
}) {
|
|
226
232
|
if (e.type !== "text") {
|
|
227
|
-
for (const r of
|
|
233
|
+
for (const r of qe(e.query))
|
|
228
234
|
if (r && !t.some(
|
|
229
|
-
(
|
|
235
|
+
(a) => H(a, r)
|
|
230
236
|
)) {
|
|
231
237
|
n.push(
|
|
232
|
-
|
|
238
|
+
f(
|
|
233
239
|
"invalid_card_query_source",
|
|
234
240
|
"Dashboard card query field references must use one of the selected datasets.",
|
|
235
241
|
e.id
|
|
@@ -239,19 +245,19 @@ function oe({
|
|
|
239
245
|
}
|
|
240
246
|
}
|
|
241
247
|
}
|
|
242
|
-
function
|
|
248
|
+
function ie(e, t) {
|
|
243
249
|
return e.length === t.length && e.every((n, r) => n === t[r]);
|
|
244
250
|
}
|
|
245
|
-
function
|
|
251
|
+
function fe({
|
|
246
252
|
card: e,
|
|
247
253
|
errors: t
|
|
248
254
|
}) {
|
|
249
255
|
if (e.type === "text" || !e.query)
|
|
250
256
|
return;
|
|
251
|
-
const { dateField: n, dateFieldRef: r, dimensions:
|
|
257
|
+
const { dateField: n, dateFieldRef: r, dimensions: a, dimensionRefs: i, metrics: s, metricRefs: d } = e.query;
|
|
252
258
|
if (r && r.name !== n) {
|
|
253
259
|
t.push(
|
|
254
|
-
|
|
260
|
+
f(
|
|
255
261
|
"invalid_card_query_ref",
|
|
256
262
|
"Dashboard card source-aware date field reference must match the query date field.",
|
|
257
263
|
e.id
|
|
@@ -259,30 +265,43 @@ function de({
|
|
|
259
265
|
);
|
|
260
266
|
return;
|
|
261
267
|
}
|
|
262
|
-
if (
|
|
268
|
+
if (Array.isArray(d)) {
|
|
269
|
+
const p = Array.isArray(s) ? s : [], b = d.map((g) => g.name);
|
|
270
|
+
if (!ie(b, p)) {
|
|
271
|
+
t.push(
|
|
272
|
+
f(
|
|
273
|
+
"invalid_card_query_ref",
|
|
274
|
+
"Dashboard card source-aware metric references must match the query metrics.",
|
|
275
|
+
e.id
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (!Array.isArray(i))
|
|
263
282
|
return;
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
283
|
+
const o = Array.isArray(a) ? a : [], u = i.map((p) => p.name);
|
|
284
|
+
ie(u, o) || t.push(
|
|
285
|
+
f(
|
|
267
286
|
"invalid_card_query_ref",
|
|
268
287
|
"Dashboard card source-aware dimension references must match the query dimensions.",
|
|
269
288
|
e.id
|
|
270
289
|
)
|
|
271
290
|
);
|
|
272
291
|
}
|
|
273
|
-
function
|
|
292
|
+
function me({
|
|
274
293
|
datasets: e,
|
|
275
294
|
errors: t,
|
|
276
295
|
requireAtLeastOne: n
|
|
277
296
|
}) {
|
|
278
|
-
const r =
|
|
297
|
+
const r = Me({
|
|
279
298
|
datasets: e,
|
|
280
299
|
requireAtLeastOne: n
|
|
281
300
|
});
|
|
282
301
|
if (!r.ok) {
|
|
283
302
|
if (r.issue === "invalid_dataset_count") {
|
|
284
303
|
t.push(
|
|
285
|
-
|
|
304
|
+
f(
|
|
286
305
|
"invalid_dataset_count",
|
|
287
306
|
"Dashboard authoring requires at least one selected dataset."
|
|
288
307
|
)
|
|
@@ -290,21 +309,21 @@ function ce({
|
|
|
290
309
|
return;
|
|
291
310
|
}
|
|
292
311
|
t.push(
|
|
293
|
-
|
|
312
|
+
f(
|
|
294
313
|
"invalid_multi_dataset_scope",
|
|
295
314
|
"Multi-dataset dashboard authoring is limited to semantic datasets from one domain."
|
|
296
315
|
)
|
|
297
316
|
);
|
|
298
317
|
}
|
|
299
318
|
}
|
|
300
|
-
function
|
|
319
|
+
function Pe(e) {
|
|
301
320
|
var m, w;
|
|
302
321
|
const t = [];
|
|
303
322
|
if (!e || typeof e != "object")
|
|
304
323
|
return {
|
|
305
324
|
ok: !1,
|
|
306
325
|
errors: [
|
|
307
|
-
|
|
326
|
+
f(
|
|
308
327
|
"invalid_plan",
|
|
309
328
|
"Dashboard plan must be a structured object."
|
|
310
329
|
)
|
|
@@ -312,82 +331,82 @@ function Me(e) {
|
|
|
312
331
|
warnings: []
|
|
313
332
|
};
|
|
314
333
|
const n = e, r = [...n.warnings || []];
|
|
315
|
-
n.version !== 1 && t.push(
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
334
|
+
n.version !== 1 && t.push(f("invalid_version", "Dashboard plan version must be 1.")), (m = n.title) != null && m.trim() || t.push(f("missing_title", "Dashboard plan needs a title."));
|
|
335
|
+
const a = Array.isArray(n.datasets) ? n.datasets : [], i = Array.isArray(n.sheets) ? n.sheets : [];
|
|
336
|
+
me({ datasets: a, errors: t, requireAtLeastOne: !0 }), i.length !== 1 && t.push(
|
|
337
|
+
f(
|
|
319
338
|
"invalid_sheet_count",
|
|
320
339
|
"MVP dashboard authoring creates exactly one dashboard sheet."
|
|
321
340
|
)
|
|
322
341
|
);
|
|
323
|
-
const s =
|
|
342
|
+
const s = i[0];
|
|
324
343
|
s && s.kind !== "dashboard" && t.push(
|
|
325
|
-
|
|
344
|
+
f("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
|
|
326
345
|
);
|
|
327
346
|
const d = (s == null ? void 0 : s.cards) || [];
|
|
328
|
-
d.length >
|
|
329
|
-
|
|
347
|
+
d.length > B && t.push(
|
|
348
|
+
f(
|
|
330
349
|
"too_many_cards",
|
|
331
|
-
`Generated dashboards can contain at most ${
|
|
350
|
+
`Generated dashboards can contain at most ${B} cards.`
|
|
332
351
|
)
|
|
333
352
|
);
|
|
334
|
-
const o =
|
|
353
|
+
const o = q(d.map((l) => l.id));
|
|
335
354
|
o && t.push(
|
|
336
|
-
|
|
355
|
+
f("duplicate_card_id", `Duplicate generated card id: ${o}.`)
|
|
337
356
|
);
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
357
|
+
const u = q(d.map((l) => l.frameId));
|
|
358
|
+
u && t.push(
|
|
359
|
+
f(
|
|
341
360
|
"duplicate_frame_id",
|
|
342
|
-
`Duplicate generated frame id: ${
|
|
361
|
+
`Duplicate generated frame id: ${u}.`
|
|
343
362
|
)
|
|
344
363
|
);
|
|
345
364
|
for (const l of d)
|
|
346
|
-
(w = l.title) != null && w.trim() || t.push(
|
|
347
|
-
|
|
365
|
+
(w = l.title) != null && w.trim() || t.push(f("missing_card_title", "Card title is required.", l.id)), l.type === "custom" && t.push(
|
|
366
|
+
f(
|
|
348
367
|
"custom_visual_out_of_scope",
|
|
349
368
|
"Whole-dashboard authoring supports built-in visual types only.",
|
|
350
369
|
l.id
|
|
351
370
|
)
|
|
352
371
|
), l.type !== "text" && !l.query && r.push(
|
|
353
|
-
|
|
372
|
+
f(
|
|
354
373
|
"missing_query_intent",
|
|
355
374
|
"Non-text card has no query intent and may be skipped by the app layer.",
|
|
356
375
|
l.id
|
|
357
376
|
)
|
|
358
|
-
),
|
|
359
|
-
const p = Array.isArray(n.filterInputs) ? n.filterInputs : [],
|
|
360
|
-
|
|
361
|
-
|
|
377
|
+
), ue({ card: l, datasets: a, errors: t }), fe({ card: l, errors: t }), le({ card: l, datasets: a, errors: t });
|
|
378
|
+
const p = Array.isArray(n.filterInputs) ? n.filterInputs : [], b = p.map((l) => l.id), g = q(b);
|
|
379
|
+
g && t.push(
|
|
380
|
+
f(
|
|
362
381
|
"duplicate_input_id",
|
|
363
|
-
`Duplicate dashboard input id: ${
|
|
382
|
+
`Duplicate dashboard input id: ${g}.`
|
|
364
383
|
)
|
|
365
384
|
);
|
|
366
|
-
const c = p.map((l) => l.variableName).filter(Boolean) || [],
|
|
367
|
-
|
|
368
|
-
|
|
385
|
+
const c = p.map((l) => l.variableName).filter(Boolean) || [], I = q(c);
|
|
386
|
+
I && t.push(
|
|
387
|
+
f(
|
|
369
388
|
"duplicate_input_variable",
|
|
370
|
-
`Duplicate dashboard input variable name: ${
|
|
389
|
+
`Duplicate dashboard input variable name: ${I}.`
|
|
371
390
|
)
|
|
372
391
|
);
|
|
373
|
-
const
|
|
374
|
-
for (const l of
|
|
392
|
+
const A = Array.isArray(n.calculatedFields) ? n.calculatedFields : [];
|
|
393
|
+
for (const l of A)
|
|
375
394
|
l.scope === "domain" && l.reuseOnly !== !0 && t.push(
|
|
376
|
-
|
|
395
|
+
f(
|
|
377
396
|
"domain_calculated_field_create_out_of_scope",
|
|
378
397
|
`Creating domain calculated field "${l.name}" is outside MVP.`
|
|
379
398
|
)
|
|
380
399
|
);
|
|
381
400
|
return { ok: t.length === 0, errors: t, warnings: r };
|
|
382
401
|
}
|
|
383
|
-
function
|
|
402
|
+
function Be(e) {
|
|
384
403
|
var s;
|
|
385
404
|
const t = [];
|
|
386
405
|
if (!e || typeof e != "object")
|
|
387
406
|
return {
|
|
388
407
|
ok: !1,
|
|
389
408
|
errors: [
|
|
390
|
-
|
|
409
|
+
f(
|
|
391
410
|
"invalid_change_plan",
|
|
392
411
|
"Dashboard change plan must be a structured object."
|
|
393
412
|
)
|
|
@@ -396,38 +415,38 @@ function qe(e) {
|
|
|
396
415
|
};
|
|
397
416
|
const n = e, r = [...n.warnings || []];
|
|
398
417
|
n.version !== 1 && t.push(
|
|
399
|
-
|
|
418
|
+
f("invalid_version", "Dashboard change plan version must be 1.")
|
|
400
419
|
), (s = n.dashboardId) != null && s.trim() || t.push(
|
|
401
|
-
|
|
420
|
+
f("missing_dashboard_id", "Dashboard change plan needs a dashboard id.")
|
|
402
421
|
);
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
for (const d of
|
|
422
|
+
const a = Array.isArray(n.datasets) ? n.datasets : [], i = Array.isArray(n.operations) ? n.operations : [];
|
|
423
|
+
me({ datasets: a, errors: t, requireAtLeastOne: !1 });
|
|
424
|
+
for (const d of i) {
|
|
406
425
|
if (d.kind === "unsupported") {
|
|
407
426
|
r.push(
|
|
408
|
-
|
|
427
|
+
f("unsupported_operation", d.reason || d.requestedAction)
|
|
409
428
|
);
|
|
410
429
|
continue;
|
|
411
430
|
}
|
|
412
431
|
d.kind === "addCard" && d.card.type === "custom" && t.push(
|
|
413
|
-
|
|
432
|
+
f(
|
|
414
433
|
"custom_visual_out_of_scope",
|
|
415
434
|
"Whole-dashboard authoring supports built-in visual types only.",
|
|
416
435
|
d.card.id
|
|
417
436
|
)
|
|
418
|
-
), d.kind === "addCard" && (
|
|
437
|
+
), d.kind === "addCard" && (ue({
|
|
419
438
|
card: d.card,
|
|
420
|
-
datasets:
|
|
439
|
+
datasets: a,
|
|
421
440
|
errors: t
|
|
422
|
-
}),
|
|
441
|
+
}), fe({
|
|
423
442
|
card: d.card,
|
|
424
443
|
errors: t
|
|
425
|
-
}),
|
|
444
|
+
}), le({
|
|
426
445
|
card: d.card,
|
|
427
|
-
datasets:
|
|
446
|
+
datasets: a,
|
|
428
447
|
errors: t
|
|
429
448
|
})), d.kind === "addCalculatedField" && d.field.scope === "domain" && d.field.reuseOnly !== !0 && t.push(
|
|
430
|
-
|
|
449
|
+
f(
|
|
431
450
|
"domain_calculated_field_create_out_of_scope",
|
|
432
451
|
`Creating domain calculated field "${d.field.name}" is outside MVP.`
|
|
433
452
|
)
|
|
@@ -435,47 +454,47 @@ function qe(e) {
|
|
|
435
454
|
}
|
|
436
455
|
return { ok: t.length === 0, errors: t, warnings: r };
|
|
437
456
|
}
|
|
438
|
-
const
|
|
457
|
+
const Ve = {
|
|
439
458
|
lg: 48,
|
|
440
459
|
md: 36,
|
|
441
460
|
sm: 24,
|
|
442
461
|
xs: 12,
|
|
443
462
|
xxs: 6
|
|
444
463
|
};
|
|
445
|
-
function
|
|
446
|
-
let n = 0, r = 0,
|
|
447
|
-
return e.map((
|
|
448
|
-
const s = Math.min(
|
|
449
|
-
n > 0 && n + s > t && (n = 0, r +=
|
|
464
|
+
function ze(e, t) {
|
|
465
|
+
let n = 0, r = 0, a = 0;
|
|
466
|
+
return e.map((i) => {
|
|
467
|
+
const s = Math.min(i.w, t);
|
|
468
|
+
n > 0 && n + s > t && (n = 0, r += a, a = 0);
|
|
450
469
|
const d = {
|
|
451
|
-
i:
|
|
470
|
+
i: i.frameId,
|
|
452
471
|
x: n,
|
|
453
472
|
y: r,
|
|
454
473
|
w: s,
|
|
455
|
-
h:
|
|
456
|
-
minW: Math.min(
|
|
457
|
-
minH:
|
|
474
|
+
h: i.h,
|
|
475
|
+
minW: Math.min(i.minW, t),
|
|
476
|
+
minH: i.minH,
|
|
458
477
|
static: !1
|
|
459
478
|
};
|
|
460
|
-
return n += s,
|
|
479
|
+
return n += s, a = Math.max(a, i.h), d;
|
|
461
480
|
});
|
|
462
481
|
}
|
|
463
|
-
function
|
|
464
|
-
const t = [...e].sort((o,
|
|
465
|
-
return { kpis: n, introText: s, charts: r, tables:
|
|
482
|
+
function je(e) {
|
|
483
|
+
const t = [...e].sort((o, u) => o.priority - u.priority), n = t.filter((o) => o.role === "kpi"), r = t.filter((o) => o.role === "chart"), a = t.filter((o) => o.role === "table"), i = t.filter((o) => o.role === "text"), s = i.slice(0, 1), d = i.slice(s.length);
|
|
484
|
+
return { kpis: n, introText: s, charts: r, tables: a, supportingText: d };
|
|
466
485
|
}
|
|
467
|
-
function
|
|
486
|
+
function Le(e, t, n) {
|
|
468
487
|
return t === "xxs" || t === "xs" ? n : t === "sm" ? Math.min(12, n) : t === "md" ? e <= 1 || e === 2 ? 18 : 12 : e <= 1 || e === 2 ? 24 : e === 3 ? 16 : 12;
|
|
469
488
|
}
|
|
470
|
-
function
|
|
489
|
+
function Oe(e, t, n, r) {
|
|
471
490
|
return n === "xxs" || n === "xs" || n === "sm" || n === "md" || t === 1 || t % 2 === 1 && e === 0 ? r : r / 2;
|
|
472
491
|
}
|
|
473
|
-
function
|
|
474
|
-
const { item: t, band: n, index: r, bandCount:
|
|
492
|
+
function We(e) {
|
|
493
|
+
const { item: t, band: n, index: r, bandCount: a, breakpoint: i, columns: s } = e;
|
|
475
494
|
return n === "kpi" ? {
|
|
476
495
|
...t,
|
|
477
496
|
band: n,
|
|
478
|
-
w:
|
|
497
|
+
w: Le(a, i, s),
|
|
479
498
|
h: 15,
|
|
480
499
|
minW: Math.min(6, s),
|
|
481
500
|
minH: 12
|
|
@@ -483,84 +502,84 @@ function Le(e) {
|
|
|
483
502
|
...t,
|
|
484
503
|
band: n,
|
|
485
504
|
w: s,
|
|
486
|
-
h:
|
|
505
|
+
h: i === "xxs" || i === "xs" ? 34 : 38,
|
|
487
506
|
minW: Math.min(12, s),
|
|
488
507
|
minH: 18
|
|
489
508
|
} : n === "introText" ? {
|
|
490
509
|
...t,
|
|
491
510
|
band: n,
|
|
492
511
|
w: s,
|
|
493
|
-
h:
|
|
512
|
+
h: i === "xxs" || i === "xs" ? 12 : 10,
|
|
494
513
|
minW: Math.min(12, s),
|
|
495
514
|
minH: 8
|
|
496
515
|
} : n === "supportingText" ? {
|
|
497
516
|
...t,
|
|
498
517
|
band: n,
|
|
499
|
-
w:
|
|
500
|
-
h:
|
|
518
|
+
w: i === "lg" ? s / 2 : s,
|
|
519
|
+
h: i === "xxs" || i === "xs" ? 12 : 10,
|
|
501
520
|
minW: Math.min(12, s),
|
|
502
521
|
minH: 8
|
|
503
522
|
} : {
|
|
504
523
|
...t,
|
|
505
524
|
band: n,
|
|
506
|
-
w:
|
|
507
|
-
h:
|
|
525
|
+
w: Oe(r, a, i, s),
|
|
526
|
+
h: i === "xxs" || i === "xs" ? 28 : 30,
|
|
508
527
|
minW: Math.min(12, s),
|
|
509
528
|
minH: 16
|
|
510
529
|
};
|
|
511
530
|
}
|
|
512
|
-
function
|
|
531
|
+
function F(e, t, n, r) {
|
|
513
532
|
return e.map(
|
|
514
|
-
(
|
|
515
|
-
item:
|
|
533
|
+
(a, i) => We({
|
|
534
|
+
item: a,
|
|
516
535
|
band: t,
|
|
517
|
-
index:
|
|
536
|
+
index: i,
|
|
518
537
|
bandCount: e.length,
|
|
519
538
|
breakpoint: n,
|
|
520
539
|
columns: r
|
|
521
540
|
})
|
|
522
541
|
);
|
|
523
542
|
}
|
|
524
|
-
function
|
|
525
|
-
const t =
|
|
543
|
+
function U(e) {
|
|
544
|
+
const t = je(e);
|
|
526
545
|
return Object.fromEntries(
|
|
527
|
-
|
|
528
|
-
const r =
|
|
529
|
-
...
|
|
530
|
-
...
|
|
531
|
-
...
|
|
532
|
-
...
|
|
533
|
-
...
|
|
546
|
+
ve.map((n) => {
|
|
547
|
+
const r = Ve[n], a = [
|
|
548
|
+
...F(t.introText, "introText", n, r),
|
|
549
|
+
...F(t.kpis, "kpi", n, r),
|
|
550
|
+
...F(t.charts, "chart", n, r),
|
|
551
|
+
...F(t.tables, "table", n, r),
|
|
552
|
+
...F(t.supportingText, "supportingText", n, r)
|
|
534
553
|
];
|
|
535
|
-
return [n,
|
|
554
|
+
return [n, ze(a, r)];
|
|
536
555
|
})
|
|
537
556
|
);
|
|
538
557
|
}
|
|
539
|
-
function
|
|
540
|
-
const t =
|
|
541
|
-
return t
|
|
558
|
+
function Ee(e) {
|
|
559
|
+
const t = ye(e);
|
|
560
|
+
return t === "datetime" ? "date" : t === "unknown" ? "string" : t;
|
|
542
561
|
}
|
|
543
|
-
function
|
|
562
|
+
function Ge(e) {
|
|
544
563
|
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
545
564
|
}
|
|
546
|
-
function
|
|
547
|
-
return
|
|
565
|
+
function He(e) {
|
|
566
|
+
return Ge(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
|
|
548
567
|
}
|
|
549
|
-
function
|
|
568
|
+
function Ue(e) {
|
|
550
569
|
return e.filter(
|
|
551
570
|
(t) => typeof t == "string" || typeof t == "number"
|
|
552
571
|
);
|
|
553
572
|
}
|
|
554
|
-
function
|
|
573
|
+
function Ke(e) {
|
|
555
574
|
return e.filter(
|
|
556
575
|
(t) => t instanceof Date || typeof t == "string"
|
|
557
576
|
);
|
|
558
577
|
}
|
|
559
|
-
function
|
|
578
|
+
function K(e, t) {
|
|
560
579
|
if (t === void 0)
|
|
561
580
|
return;
|
|
562
|
-
const n =
|
|
563
|
-
if (
|
|
581
|
+
const n = Ee(e.dataType), r = e.operation || "in";
|
|
582
|
+
if (He(t))
|
|
564
583
|
return {
|
|
565
584
|
...t,
|
|
566
585
|
filterId: e.id,
|
|
@@ -581,26 +600,26 @@ function H(e, t) {
|
|
|
581
600
|
fieldMeta: e.fieldMeta,
|
|
582
601
|
semanticContext: e.semanticContext
|
|
583
602
|
};
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
603
|
+
const a = Array.isArray(t) ? t : [t], i = n === "date" ? Ke(a) : Ue(a);
|
|
604
|
+
if (i.length !== 0 && !((r === "between" || r === "not between") && i.length < 2))
|
|
586
605
|
return {
|
|
587
606
|
filterId: e.id,
|
|
588
607
|
name: e.column,
|
|
589
608
|
operation: r,
|
|
590
609
|
valueType: n,
|
|
591
|
-
values:
|
|
610
|
+
values: i,
|
|
592
611
|
dataType: e.dataType,
|
|
593
612
|
fieldMeta: e.fieldMeta,
|
|
594
613
|
semanticContext: e.semanticContext
|
|
595
614
|
};
|
|
596
615
|
}
|
|
597
|
-
function
|
|
616
|
+
function Qe(e, t, n) {
|
|
598
617
|
return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
|
|
599
618
|
}
|
|
600
|
-
function
|
|
619
|
+
function Je(e, t, n) {
|
|
601
620
|
const r = (t || []).filter(
|
|
602
|
-
(
|
|
603
|
-
).map((
|
|
621
|
+
(a) => a.scope === "card" && a.targetCardId === n
|
|
622
|
+
).map((a) => a.field).filter(Boolean);
|
|
604
623
|
return r.length === 0 ? e : {
|
|
605
624
|
...e,
|
|
606
625
|
calculatedFields: [
|
|
@@ -609,19 +628,19 @@ function Ue(e, t, n) {
|
|
|
609
628
|
]
|
|
610
629
|
};
|
|
611
630
|
}
|
|
612
|
-
function
|
|
631
|
+
function Xe(e) {
|
|
613
632
|
const t = {};
|
|
614
633
|
return {
|
|
615
|
-
inputs: (e.filterInputs || []).map((r,
|
|
616
|
-
const
|
|
634
|
+
inputs: (e.filterInputs || []).map((r, a) => {
|
|
635
|
+
const i = K(
|
|
617
636
|
r.filter,
|
|
618
637
|
r.defaultValue
|
|
619
638
|
);
|
|
620
|
-
return
|
|
639
|
+
return i && (t.shared ?? (t.shared = {}), t.shared[r.id] = {
|
|
621
640
|
status: "set",
|
|
622
641
|
value: {
|
|
623
642
|
kind: "filter",
|
|
624
|
-
filterValue:
|
|
643
|
+
filterValue: i
|
|
625
644
|
}
|
|
626
645
|
}), {
|
|
627
646
|
id: r.id,
|
|
@@ -632,7 +651,7 @@ function Ke(e) {
|
|
|
632
651
|
runtimeScope: "shared",
|
|
633
652
|
presentation: {
|
|
634
653
|
placement: "toolbar",
|
|
635
|
-
order:
|
|
654
|
+
order: a
|
|
636
655
|
},
|
|
637
656
|
exports: ["label", "value", "start", "end", "range"],
|
|
638
657
|
filter: r.filter
|
|
@@ -641,44 +660,44 @@ function Ke(e) {
|
|
|
641
660
|
defaultInputValues: t.shared && Object.keys(t.shared).length > 0 ? t : void 0
|
|
642
661
|
};
|
|
643
662
|
}
|
|
644
|
-
function
|
|
645
|
-
var
|
|
646
|
-
const t =
|
|
663
|
+
function St(e) {
|
|
664
|
+
var b, g;
|
|
665
|
+
const t = Pe(e.plan);
|
|
647
666
|
if (!t.ok)
|
|
648
667
|
throw new Error(
|
|
649
668
|
t.errors.map((c) => c.message).join(`
|
|
650
669
|
`) || "Dashboard plan is invalid."
|
|
651
670
|
);
|
|
652
|
-
const n = e.plan.sheets[0], r = [...t.warnings],
|
|
671
|
+
const n = e.plan.sheets[0], r = [...t.warnings], a = [], i = new Map(
|
|
653
672
|
e.cardArtifacts.map((c) => [c.planCardId, c])
|
|
654
673
|
), s = [];
|
|
655
674
|
for (const c of n.cards) {
|
|
656
|
-
const
|
|
657
|
-
if (!
|
|
658
|
-
const m =
|
|
675
|
+
const I = i.get(c.id);
|
|
676
|
+
if (!I) {
|
|
677
|
+
const m = Qe(
|
|
659
678
|
"missing_card_artifact",
|
|
660
679
|
`Card "${c.title}" was skipped because no generated artifact was supplied.`,
|
|
661
680
|
c.id
|
|
662
681
|
);
|
|
663
|
-
|
|
682
|
+
a.push(m);
|
|
664
683
|
continue;
|
|
665
684
|
}
|
|
666
|
-
r.push(...
|
|
667
|
-
const
|
|
668
|
-
|
|
685
|
+
r.push(...I.warnings || []);
|
|
686
|
+
const A = Je(
|
|
687
|
+
I.card,
|
|
669
688
|
e.plan.calculatedFields,
|
|
670
689
|
c.id
|
|
671
690
|
);
|
|
672
691
|
s.push({
|
|
673
692
|
id: c.frameId,
|
|
674
|
-
cards: [
|
|
675
|
-
activeCardId:
|
|
693
|
+
cards: [A],
|
|
694
|
+
activeCardId: A.id
|
|
676
695
|
});
|
|
677
696
|
}
|
|
678
697
|
if (s.length === 0)
|
|
679
698
|
throw new Error("Dashboard plan did not produce any persistable cards.");
|
|
680
|
-
const { inputs: d, defaultInputValues: o } =
|
|
681
|
-
n.cards.filter((c) => s.some((
|
|
699
|
+
const { inputs: d, defaultInputValues: o } = Xe(e.plan), u = U(
|
|
700
|
+
n.cards.filter((c) => s.some((I) => I.id === c.frameId)).map((c) => ({
|
|
682
701
|
frameId: c.frameId,
|
|
683
702
|
priority: c.priority,
|
|
684
703
|
role: c.role
|
|
@@ -695,93 +714,93 @@ function kt(e) {
|
|
|
695
714
|
title: n.title,
|
|
696
715
|
description: n.description,
|
|
697
716
|
frames: s,
|
|
698
|
-
layouts:
|
|
699
|
-
calculatedFields: (
|
|
717
|
+
layouts: u,
|
|
718
|
+
calculatedFields: (b = e.plan.calculatedFields) == null ? void 0 : b.filter((c) => c.scope === "sheet" && c.field).map((c) => c.field)
|
|
700
719
|
}
|
|
701
720
|
],
|
|
702
|
-
calculatedFields: (
|
|
721
|
+
calculatedFields: (g = e.plan.calculatedFields) == null ? void 0 : g.filter((c) => c.scope === "dashboard" && c.field).map((c) => c.field),
|
|
703
722
|
inputs: d,
|
|
704
723
|
...o ? { defaultInputValues: o } : {}
|
|
705
|
-
}, warnings: r, skippedOperations:
|
|
724
|
+
}, warnings: r, skippedOperations: a };
|
|
706
725
|
}
|
|
707
726
|
function C(e, t, n) {
|
|
708
727
|
return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
|
|
709
728
|
}
|
|
710
|
-
function
|
|
729
|
+
function Ye(e) {
|
|
711
730
|
return JSON.parse(JSON.stringify(e));
|
|
712
731
|
}
|
|
713
|
-
function
|
|
732
|
+
function Ze(e) {
|
|
714
733
|
var t;
|
|
715
734
|
return (t = e.sheets) == null ? void 0 : t.find(
|
|
716
735
|
(n) => (n.kind || "dashboard") === "dashboard"
|
|
717
736
|
);
|
|
718
737
|
}
|
|
719
|
-
function
|
|
738
|
+
function j(e, t) {
|
|
720
739
|
var n;
|
|
721
740
|
for (const r of e.sheets || [])
|
|
722
|
-
for (const
|
|
723
|
-
const
|
|
724
|
-
if (
|
|
725
|
-
return { sheet: r, frame:
|
|
741
|
+
for (const a of r.frames || []) {
|
|
742
|
+
const i = (n = a.cards) == null ? void 0 : n.find((s) => s.id === t);
|
|
743
|
+
if (i)
|
|
744
|
+
return { sheet: r, frame: a, card: i };
|
|
726
745
|
}
|
|
727
746
|
return null;
|
|
728
747
|
}
|
|
729
|
-
function
|
|
748
|
+
function pe(e) {
|
|
730
749
|
var n, r;
|
|
731
750
|
const t = (r = (n = e.cards) == null ? void 0 : n[0]) == null ? void 0 : r.type;
|
|
732
751
|
return t === "kpi" ? "kpi" : t === "table" || t === "detailTable" || t === "pivotTable" ? "table" : t === "text" ? "text" : "chart";
|
|
733
752
|
}
|
|
734
|
-
function
|
|
753
|
+
function et(e) {
|
|
735
754
|
var t;
|
|
736
755
|
return new Map(
|
|
737
756
|
(((t = e.layouts) == null ? void 0 : t.lg) || []).map((n, r) => [n.i, r])
|
|
738
757
|
);
|
|
739
758
|
}
|
|
740
|
-
function
|
|
741
|
-
const n =
|
|
759
|
+
function he(e, t = /* @__PURE__ */ new Map()) {
|
|
760
|
+
const n = et(e), r = Math.max(
|
|
742
761
|
n.size,
|
|
743
762
|
t.size
|
|
744
|
-
),
|
|
745
|
-
(
|
|
746
|
-
frameId:
|
|
747
|
-
role:
|
|
748
|
-
priority: t.get(
|
|
763
|
+
), a = (e.frames || []).map(
|
|
764
|
+
(i, s) => ({
|
|
765
|
+
frameId: i.id,
|
|
766
|
+
role: pe(i),
|
|
767
|
+
priority: t.get(i.id) ?? n.get(i.id) ?? r + s
|
|
749
768
|
})
|
|
750
769
|
);
|
|
751
|
-
e.layouts =
|
|
770
|
+
e.layouts = U(a);
|
|
752
771
|
}
|
|
753
|
-
function
|
|
772
|
+
function tt(e) {
|
|
754
773
|
return Object.values(e.layouts || {}).some((t) => t.length > 0);
|
|
755
774
|
}
|
|
756
|
-
function
|
|
757
|
-
if (!
|
|
758
|
-
|
|
775
|
+
function nt(e, t) {
|
|
776
|
+
if (!tt(e)) {
|
|
777
|
+
he(e);
|
|
759
778
|
return;
|
|
760
779
|
}
|
|
761
|
-
const n =
|
|
762
|
-
{ frameId: t.id, role:
|
|
780
|
+
const n = U([
|
|
781
|
+
{ frameId: t.id, role: pe(t), priority: 0 }
|
|
763
782
|
]);
|
|
764
783
|
e.layouts ?? (e.layouts = {});
|
|
765
|
-
for (const [r,
|
|
766
|
-
const
|
|
767
|
-
if (
|
|
784
|
+
for (const [r, a] of Object.entries(n)) {
|
|
785
|
+
const i = e.layouts[r] || [];
|
|
786
|
+
if (i.some((o) => o.i === t.id))
|
|
768
787
|
continue;
|
|
769
|
-
const s =
|
|
788
|
+
const s = a[0];
|
|
770
789
|
if (!s)
|
|
771
790
|
continue;
|
|
772
|
-
const d =
|
|
773
|
-
(o,
|
|
791
|
+
const d = i.reduce(
|
|
792
|
+
(o, u) => Math.max(o, u.y + u.h),
|
|
774
793
|
0
|
|
775
794
|
);
|
|
776
795
|
e.layouts[r] = [
|
|
777
|
-
...
|
|
796
|
+
...i,
|
|
778
797
|
{ ...s, y: d }
|
|
779
798
|
];
|
|
780
799
|
}
|
|
781
800
|
}
|
|
782
|
-
function
|
|
801
|
+
function rt(e, t) {
|
|
783
802
|
var r;
|
|
784
|
-
const n =
|
|
803
|
+
const n = K(
|
|
785
804
|
t.filter,
|
|
786
805
|
t.defaultValue
|
|
787
806
|
);
|
|
@@ -793,17 +812,17 @@ function et(e, t) {
|
|
|
793
812
|
}
|
|
794
813
|
});
|
|
795
814
|
}
|
|
796
|
-
function
|
|
815
|
+
function Ct(e) {
|
|
797
816
|
var d;
|
|
798
|
-
const t =
|
|
817
|
+
const t = Be(e.changePlan);
|
|
799
818
|
if (!t.ok)
|
|
800
819
|
throw new Error(
|
|
801
820
|
t.errors.map((o) => o.message).join(`
|
|
802
821
|
`) || "Dashboard change plan is invalid."
|
|
803
822
|
);
|
|
804
|
-
const n =
|
|
823
|
+
const n = Ye(e.dashboard), r = [...t.warnings], a = [], i = new Map(
|
|
805
824
|
e.cardArtifacts.map((o) => [o.planCardId, o])
|
|
806
|
-
), s =
|
|
825
|
+
), s = Ze(n);
|
|
807
826
|
if (!s)
|
|
808
827
|
throw new Error("Dashboard has no editable dashboard sheet.");
|
|
809
828
|
s.frames ?? (s.frames = []);
|
|
@@ -811,24 +830,24 @@ function St(e) {
|
|
|
811
830
|
switch (o.kind) {
|
|
812
831
|
case "addCard": {
|
|
813
832
|
if ((s.frames || []).reduce(
|
|
814
|
-
(
|
|
815
|
-
var
|
|
816
|
-
return
|
|
833
|
+
(g, c) => {
|
|
834
|
+
var I;
|
|
835
|
+
return g + (((I = c.cards) == null ? void 0 : I.length) || 0);
|
|
817
836
|
},
|
|
818
837
|
0
|
|
819
|
-
) >=
|
|
820
|
-
|
|
838
|
+
) >= B) {
|
|
839
|
+
a.push(
|
|
821
840
|
C(
|
|
822
841
|
"generated_card_limit_reached",
|
|
823
|
-
`MVP AI refinement is capped at ${
|
|
842
|
+
`MVP AI refinement is capped at ${B} cards.`,
|
|
824
843
|
o.card.id
|
|
825
844
|
)
|
|
826
845
|
);
|
|
827
846
|
break;
|
|
828
847
|
}
|
|
829
|
-
const p =
|
|
848
|
+
const p = i.get(o.card.id);
|
|
830
849
|
if (!p) {
|
|
831
|
-
|
|
850
|
+
a.push(
|
|
832
851
|
C(
|
|
833
852
|
"missing_card_artifact",
|
|
834
853
|
`Card "${o.card.title}" was skipped because no generated artifact was supplied.`,
|
|
@@ -837,17 +856,17 @@ function St(e) {
|
|
|
837
856
|
);
|
|
838
857
|
break;
|
|
839
858
|
}
|
|
840
|
-
const
|
|
859
|
+
const b = {
|
|
841
860
|
id: o.card.frameId,
|
|
842
861
|
cards: [p.card],
|
|
843
862
|
activeCardId: p.card.id
|
|
844
863
|
};
|
|
845
|
-
s.frames.push(
|
|
864
|
+
s.frames.push(b), nt(s, b);
|
|
846
865
|
break;
|
|
847
866
|
}
|
|
848
867
|
case "addFilterInput": {
|
|
849
868
|
n.inputs ?? (n.inputs = []);
|
|
850
|
-
const
|
|
869
|
+
const u = {
|
|
851
870
|
id: o.input.id,
|
|
852
871
|
kind: "filter",
|
|
853
872
|
label: o.input.label,
|
|
@@ -864,7 +883,7 @@ function St(e) {
|
|
|
864
883
|
exports: ["label", "value", "start", "end", "range"],
|
|
865
884
|
filter: o.input.filter
|
|
866
885
|
};
|
|
867
|
-
n.inputs.push(
|
|
886
|
+
n.inputs.push(u), rt(n, o.input);
|
|
868
887
|
break;
|
|
869
888
|
}
|
|
870
889
|
case "addCalculatedField": {
|
|
@@ -873,8 +892,8 @@ function St(e) {
|
|
|
873
892
|
else if (o.field.scope === "sheet" && o.field.field)
|
|
874
893
|
s.calculatedFields ?? (s.calculatedFields = []), s.calculatedFields.push(o.field.field);
|
|
875
894
|
else if (o.field.scope === "card" && o.field.field) {
|
|
876
|
-
const
|
|
877
|
-
|
|
895
|
+
const u = o.field.targetCardId ? j(n, o.field.targetCardId) : null;
|
|
896
|
+
u ? ((d = u.card).calculatedFields ?? (d.calculatedFields = []), u.card.calculatedFields.push(o.field.field)) : a.push(
|
|
878
897
|
C(
|
|
879
898
|
"missing_calculated_field_target",
|
|
880
899
|
`Calculated field "${o.field.name}" needs a valid target card.`
|
|
@@ -884,9 +903,9 @@ function St(e) {
|
|
|
884
903
|
break;
|
|
885
904
|
}
|
|
886
905
|
case "renameCard": {
|
|
887
|
-
const
|
|
888
|
-
if (!
|
|
889
|
-
|
|
906
|
+
const u = j(n, o.cardId);
|
|
907
|
+
if (!u) {
|
|
908
|
+
a.push(
|
|
890
909
|
C(
|
|
891
910
|
"card_not_found",
|
|
892
911
|
`Card "${o.cardId}" could not be renamed because it was not found.`,
|
|
@@ -895,16 +914,16 @@ function St(e) {
|
|
|
895
914
|
);
|
|
896
915
|
break;
|
|
897
916
|
}
|
|
898
|
-
|
|
917
|
+
u.card.title = o.title, o.description !== void 0 && (u.card.description = o.description);
|
|
899
918
|
break;
|
|
900
919
|
}
|
|
901
920
|
case "reorderCards": {
|
|
902
|
-
const
|
|
921
|
+
const u = /* @__PURE__ */ new Map();
|
|
903
922
|
for (let p = 0; p < o.cardIds.length; p += 1) {
|
|
904
|
-
const
|
|
905
|
-
|
|
923
|
+
const b = o.cardIds[p], g = j(n, b);
|
|
924
|
+
g && u.set(g.frame.id, p);
|
|
906
925
|
}
|
|
907
|
-
|
|
926
|
+
he(s, u);
|
|
908
927
|
break;
|
|
909
928
|
}
|
|
910
929
|
case "reuseCalculatedField":
|
|
@@ -916,20 +935,20 @@ function St(e) {
|
|
|
916
935
|
);
|
|
917
936
|
break;
|
|
918
937
|
case "unsupported":
|
|
919
|
-
|
|
938
|
+
a.push(
|
|
920
939
|
C("unsupported_operation", o.reason || o.requestedAction)
|
|
921
940
|
);
|
|
922
941
|
break;
|
|
923
942
|
}
|
|
924
|
-
return { dashboard: n, warnings: r, skippedOperations:
|
|
943
|
+
return { dashboard: n, warnings: r, skippedOperations: a };
|
|
925
944
|
}
|
|
926
|
-
function
|
|
945
|
+
function y(e, t, n) {
|
|
927
946
|
return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
|
|
928
947
|
}
|
|
929
|
-
function
|
|
948
|
+
function T(e, t) {
|
|
930
949
|
return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || t;
|
|
931
950
|
}
|
|
932
|
-
function
|
|
951
|
+
function be(e, t) {
|
|
933
952
|
if (!t.has(e))
|
|
934
953
|
return t.add(e), e;
|
|
935
954
|
let n = 2, r = `${e}-${n}`;
|
|
@@ -940,23 +959,23 @@ function fe(e, t) {
|
|
|
940
959
|
function x(e) {
|
|
941
960
|
return !!(e && typeof e == "object");
|
|
942
961
|
}
|
|
943
|
-
function
|
|
962
|
+
function Ie(e) {
|
|
944
963
|
return Array.isArray(e.inputs) ? e.inputs.filter(
|
|
945
964
|
(t) => x(t) && typeof t.id == "string"
|
|
946
965
|
) : [];
|
|
947
966
|
}
|
|
948
|
-
function
|
|
967
|
+
function Q(e) {
|
|
949
968
|
return Array.isArray(e.sections) ? e.sections.filter(
|
|
950
969
|
(t) => x(t)
|
|
951
970
|
) : [];
|
|
952
971
|
}
|
|
953
|
-
function
|
|
972
|
+
function J(e) {
|
|
954
973
|
return Array.isArray(e.views) ? e.views.filter(
|
|
955
974
|
(t) => x(t)
|
|
956
975
|
) : [];
|
|
957
976
|
}
|
|
958
|
-
function
|
|
959
|
-
return
|
|
977
|
+
function at(e) {
|
|
978
|
+
return R(e) ? e.kind === "semantic" ? {
|
|
960
979
|
kind: "semantic",
|
|
961
980
|
domainId: e.domainId,
|
|
962
981
|
datasetName: e.datasetName,
|
|
@@ -972,7 +991,7 @@ function tt(e) {
|
|
|
972
991
|
label: e.label
|
|
973
992
|
} : null : null;
|
|
974
993
|
}
|
|
975
|
-
function
|
|
994
|
+
function N(e) {
|
|
976
995
|
if (!Array.isArray(e))
|
|
977
996
|
return [];
|
|
978
997
|
const t = [];
|
|
@@ -982,114 +1001,114 @@ function B(e) {
|
|
|
982
1001
|
}
|
|
983
1002
|
return t;
|
|
984
1003
|
}
|
|
985
|
-
function
|
|
1004
|
+
function it(e) {
|
|
1005
|
+
var r;
|
|
986
1006
|
if (!e)
|
|
987
1007
|
return [];
|
|
988
1008
|
const t = [];
|
|
989
|
-
if (
|
|
990
|
-
|
|
991
|
-
|
|
1009
|
+
if (R(e.source) && t.push(e.source), e.kind === "metric") {
|
|
1010
|
+
t.push(...N(e.metricRefs));
|
|
1011
|
+
const a = v(e.dateField);
|
|
1012
|
+
a && t.push(a), t.push(...N(e.dimensions)), t.push(
|
|
1013
|
+
...N(
|
|
1014
|
+
(r = e.filters) == null ? void 0 : r.map((i) => i.field)
|
|
1015
|
+
)
|
|
1016
|
+
);
|
|
992
1017
|
} else if (e.kind === "records") {
|
|
993
|
-
const
|
|
994
|
-
|
|
1018
|
+
const a = v(e.dateField);
|
|
1019
|
+
a && t.push(a), t.push(...N(e.fields));
|
|
995
1020
|
} else if (e.kind === "inputOptions") {
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
} else e.kind === "sql" && t.push(...
|
|
1021
|
+
const a = v(e.field);
|
|
1022
|
+
a && t.push(a);
|
|
1023
|
+
} else e.kind === "sql" && t.push(...N(e.fields));
|
|
999
1024
|
const n = "inputs" in e && Array.isArray(e.inputs) ? e.inputs : [];
|
|
1000
|
-
for (const
|
|
1001
|
-
const i = v(
|
|
1025
|
+
for (const a of n) {
|
|
1026
|
+
const i = v(a.field);
|
|
1002
1027
|
i && t.push(i);
|
|
1003
1028
|
}
|
|
1004
1029
|
return t;
|
|
1005
1030
|
}
|
|
1006
|
-
function
|
|
1031
|
+
function st(e) {
|
|
1007
1032
|
const t = [];
|
|
1008
|
-
for (const n of
|
|
1009
|
-
|
|
1033
|
+
for (const n of Ie(e)) {
|
|
1034
|
+
R(n.source) && t.push(n.source);
|
|
1010
1035
|
const r = v(n.field);
|
|
1011
1036
|
r && t.push(r);
|
|
1012
1037
|
}
|
|
1013
|
-
for (const n of
|
|
1014
|
-
for (const r of
|
|
1015
|
-
t.push(...
|
|
1038
|
+
for (const n of Q(e))
|
|
1039
|
+
for (const r of J(n))
|
|
1040
|
+
t.push(...it(r.analytics));
|
|
1016
1041
|
return t;
|
|
1017
1042
|
}
|
|
1018
|
-
function
|
|
1043
|
+
function ot(e) {
|
|
1019
1044
|
var n;
|
|
1020
1045
|
const t = [];
|
|
1021
|
-
for (const r of
|
|
1022
|
-
for (const
|
|
1023
|
-
|
|
1046
|
+
for (const r of Q(e))
|
|
1047
|
+
for (const a of J(r))
|
|
1048
|
+
R((n = a.analytics) == null ? void 0 : n.source) && t.push(a.analytics.source);
|
|
1024
1049
|
return t;
|
|
1025
1050
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const n =
|
|
1051
|
+
function dt(e, t) {
|
|
1052
|
+
const n = V(e).map(at).filter((i) => !!i);
|
|
1028
1053
|
if (n.length === 0)
|
|
1029
1054
|
return t.push(
|
|
1030
|
-
|
|
1055
|
+
y(
|
|
1031
1056
|
"missing_materializable_dataset",
|
|
1032
1057
|
"No semantic or physical source could be converted into the current dashboard authoring dataset reference."
|
|
1033
1058
|
)
|
|
1034
1059
|
), [];
|
|
1035
|
-
const r = n.every((
|
|
1060
|
+
const r = n.every((i) => i.kind === "semantic"), a = Array.from(
|
|
1036
1061
|
new Set(
|
|
1037
|
-
n.filter((
|
|
1062
|
+
n.filter((i) => i.kind === "semantic").map((i) => i.domainId)
|
|
1038
1063
|
)
|
|
1039
1064
|
);
|
|
1040
|
-
return n.length > 1 && (!r ||
|
|
1041
|
-
|
|
1065
|
+
return n.length > 1 && (!r || a.length !== 1) ? (t.push(
|
|
1066
|
+
y(
|
|
1042
1067
|
"multiple_datasets_out_of_scope",
|
|
1043
1068
|
"The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest."
|
|
1044
1069
|
)
|
|
1045
1070
|
), [n[0]]) : n;
|
|
1046
1071
|
}
|
|
1047
|
-
function
|
|
1048
|
-
const n =
|
|
1049
|
-
|
|
1072
|
+
function ct(e, t) {
|
|
1073
|
+
const n = Q(e), r = Ie(e), a = V(st(e)), i = V(
|
|
1074
|
+
ot(e)
|
|
1050
1075
|
);
|
|
1051
1076
|
return {
|
|
1052
1077
|
sections: n,
|
|
1053
1078
|
inputs: r,
|
|
1054
|
-
sources:
|
|
1055
|
-
primarySources:
|
|
1056
|
-
defaultSource:
|
|
1057
|
-
datasets:
|
|
1079
|
+
sources: a,
|
|
1080
|
+
primarySources: i,
|
|
1081
|
+
defaultSource: i.length === 1 ? i[0] : void 0,
|
|
1082
|
+
datasets: dt(a, t)
|
|
1058
1083
|
};
|
|
1059
1084
|
}
|
|
1060
|
-
function
|
|
1061
|
-
return
|
|
1085
|
+
function se(e) {
|
|
1086
|
+
return E(e).map((t) => t.name).filter(Boolean);
|
|
1062
1087
|
}
|
|
1063
|
-
function
|
|
1088
|
+
function E(e) {
|
|
1064
1089
|
return (Array.isArray(e.fields) ? e.fields : []).filter(
|
|
1065
|
-
(t) => !
|
|
1090
|
+
(t) => !Ce(t, e.dateField)
|
|
1066
1091
|
);
|
|
1067
1092
|
}
|
|
1068
|
-
function
|
|
1093
|
+
function ut(e) {
|
|
1069
1094
|
const t = Array.isArray(e.metrics) ? e.metrics.filter(
|
|
1070
1095
|
(n) => typeof n == "string" && n.trim().length > 0
|
|
1071
1096
|
) : [];
|
|
1072
|
-
return Array.from(
|
|
1073
|
-
new Set(
|
|
1074
|
-
[e.metric, ...t].filter(
|
|
1075
|
-
(n) => typeof n == "string" && n.trim().length > 0
|
|
1076
|
-
)
|
|
1077
|
-
)
|
|
1078
|
-
);
|
|
1097
|
+
return Array.from(new Set(t));
|
|
1079
1098
|
}
|
|
1080
|
-
function
|
|
1099
|
+
function lt(e) {
|
|
1081
1100
|
return x(e) && typeof e.name == "string" && e.name.trim().length > 0;
|
|
1082
1101
|
}
|
|
1083
|
-
function
|
|
1102
|
+
function oe(e) {
|
|
1084
1103
|
if (!Array.isArray(e.dimensions))
|
|
1085
1104
|
return;
|
|
1086
|
-
const t = e.dimensions.filter(
|
|
1105
|
+
const t = e.dimensions.filter(lt).map((n) => n.name);
|
|
1087
1106
|
return t.length ? t : void 0;
|
|
1088
1107
|
}
|
|
1089
|
-
function
|
|
1108
|
+
function P(e) {
|
|
1090
1109
|
return e === "hour" ? "day" : e;
|
|
1091
1110
|
}
|
|
1092
|
-
function
|
|
1111
|
+
function $(e, t = {}) {
|
|
1093
1112
|
var n, r;
|
|
1094
1113
|
if (e != null && e.name) {
|
|
1095
1114
|
if (((n = e.source) == null ? void 0 : n.kind) === "semantic")
|
|
@@ -1120,43 +1139,45 @@ function j(e, t = {}) {
|
|
|
1120
1139
|
return { name: e.name };
|
|
1121
1140
|
}
|
|
1122
1141
|
}
|
|
1123
|
-
function
|
|
1142
|
+
function D(e) {
|
|
1124
1143
|
if (!Array.isArray(e))
|
|
1125
1144
|
return;
|
|
1126
|
-
const t = e.map((n) =>
|
|
1145
|
+
const t = e.map((n) => $(n, { includeUnsourced: !0 })).filter(Boolean);
|
|
1127
1146
|
if (t.length === e.length)
|
|
1128
1147
|
return t.some((n) => n.source) ? t : void 0;
|
|
1129
1148
|
}
|
|
1130
|
-
function
|
|
1149
|
+
function ft(e) {
|
|
1131
1150
|
var t, n;
|
|
1132
1151
|
if (e) {
|
|
1133
1152
|
if (e.kind === "metric")
|
|
1134
1153
|
return {
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1154
|
+
metrics: ut(e),
|
|
1155
|
+
...e.primaryMetric ? { primaryMetric: e.primaryMetric } : {},
|
|
1156
|
+
...(t = e.dateField) != null && t.name ? { dateField: e.dateField.name } : {},
|
|
1157
|
+
...D(e.metricRefs) ? { metricRefs: D(e.metricRefs) } : {},
|
|
1158
|
+
...$(e.dateField) ? { dateFieldRef: $(e.dateField) } : {},
|
|
1159
|
+
...P(e.timeGrain) ? { timeGrain: P(e.timeGrain) } : {},
|
|
1160
|
+
...oe(e) ? { dimensions: oe(e) } : {},
|
|
1161
|
+
...D(e.dimensions) ? { dimensionRefs: D(e.dimensions) } : {},
|
|
1162
|
+
...e.filters ? { filters: e.filters } : {},
|
|
1163
|
+
...e.limit !== void 0 ? { limit: e.limit } : {}
|
|
1143
1164
|
};
|
|
1144
1165
|
if (e.kind === "records")
|
|
1145
1166
|
return {
|
|
1146
1167
|
metrics: e.measures,
|
|
1147
|
-
|
|
1148
|
-
dateFieldRef:
|
|
1149
|
-
timeGrain:
|
|
1150
|
-
dimensions:
|
|
1151
|
-
dimensionRefs:
|
|
1152
|
-
limit: e.limit
|
|
1168
|
+
...(n = e.dateField) != null && n.name ? { dateField: e.dateField.name } : {},
|
|
1169
|
+
...$(e.dateField) ? { dateFieldRef: $(e.dateField) } : {},
|
|
1170
|
+
...P(e.timeGrain) ? { timeGrain: P(e.timeGrain) } : {},
|
|
1171
|
+
...se(e) ? { dimensions: se(e) } : {},
|
|
1172
|
+
...D(E(e)) ? { dimensionRefs: D(E(e)) } : {},
|
|
1173
|
+
...e.limit !== void 0 ? { limit: e.limit } : {}
|
|
1153
1174
|
};
|
|
1154
1175
|
}
|
|
1155
1176
|
}
|
|
1156
|
-
function ft(e) {
|
|
1157
|
-
return e && Ie(e).ok ? e : void 0;
|
|
1158
|
-
}
|
|
1159
1177
|
function mt(e) {
|
|
1178
|
+
return e && we(e).ok ? e : void 0;
|
|
1179
|
+
}
|
|
1180
|
+
function pt(e) {
|
|
1160
1181
|
var t;
|
|
1161
1182
|
switch ((t = e.presentation) == null ? void 0 : t.kind) {
|
|
1162
1183
|
case "kpi":
|
|
@@ -1175,68 +1196,70 @@ function mt(e) {
|
|
|
1175
1196
|
return null;
|
|
1176
1197
|
}
|
|
1177
1198
|
}
|
|
1178
|
-
function
|
|
1199
|
+
function ht(e) {
|
|
1179
1200
|
var t, n, r;
|
|
1180
1201
|
return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((n = e.presentation) == null ? void 0 : n.kind) === "table" ? "table" : ((r = e.presentation) == null ? void 0 : r.kind) === "text" ? "text" : "chart";
|
|
1181
1202
|
}
|
|
1182
|
-
function
|
|
1203
|
+
function bt(e) {
|
|
1183
1204
|
switch (e) {
|
|
1184
1205
|
case "not_in":
|
|
1185
1206
|
return "not in";
|
|
1207
|
+
case "not_between":
|
|
1208
|
+
return "not between";
|
|
1186
1209
|
case "contains":
|
|
1187
1210
|
return "like";
|
|
1188
1211
|
default:
|
|
1189
1212
|
return e || "in";
|
|
1190
1213
|
}
|
|
1191
1214
|
}
|
|
1192
|
-
function
|
|
1215
|
+
function It(e) {
|
|
1193
1216
|
return x(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
|
|
1194
1217
|
}
|
|
1195
|
-
function
|
|
1218
|
+
function gt(e) {
|
|
1196
1219
|
if (!(!e || e.kind !== "physical"))
|
|
1197
1220
|
return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
|
|
1198
1221
|
}
|
|
1199
|
-
function
|
|
1222
|
+
function yt(e, t, n, r, a, i) {
|
|
1200
1223
|
if (e.kind !== "filter")
|
|
1201
|
-
return
|
|
1202
|
-
|
|
1224
|
+
return i.push(
|
|
1225
|
+
y(
|
|
1203
1226
|
"control_inputs_deferred",
|
|
1204
1227
|
`Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`
|
|
1205
1228
|
)
|
|
1206
1229
|
), null;
|
|
1207
1230
|
if (!x(e.field) || typeof e.field.name != "string")
|
|
1208
|
-
return
|
|
1209
|
-
|
|
1231
|
+
return i.push(
|
|
1232
|
+
y(
|
|
1210
1233
|
"filter_requires_field",
|
|
1211
1234
|
`Filter "${e.label || e.id}" needs a field before the dashboard compiler can materialize it.`
|
|
1212
1235
|
)
|
|
1213
1236
|
), null;
|
|
1214
|
-
const s =
|
|
1237
|
+
const s = Se({
|
|
1215
1238
|
explicitSource: e.source,
|
|
1216
1239
|
field: e.field,
|
|
1217
1240
|
defaultSource: t,
|
|
1218
1241
|
fallbackSources: n
|
|
1219
1242
|
}), d = (s == null ? void 0 : s.kind) === "semantic" || (s == null ? void 0 : s.kind) === "physical" ? s.connectionId : void 0;
|
|
1220
1243
|
if (!d)
|
|
1221
|
-
return
|
|
1222
|
-
|
|
1244
|
+
return i.push(
|
|
1245
|
+
y(
|
|
1223
1246
|
"filter_requires_connection_id",
|
|
1224
1247
|
`Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`
|
|
1225
1248
|
)
|
|
1226
1249
|
), null;
|
|
1227
1250
|
const p = {
|
|
1228
|
-
id: `filter-${
|
|
1229
|
-
|
|
1230
|
-
|
|
1251
|
+
id: `filter-${be(
|
|
1252
|
+
T(e.id, e.field.name),
|
|
1253
|
+
a
|
|
1231
1254
|
)}`,
|
|
1232
1255
|
variableName: e.id,
|
|
1233
1256
|
connectionId: d,
|
|
1234
1257
|
title: e.label,
|
|
1235
1258
|
column: e.field.name,
|
|
1236
|
-
dataType:
|
|
1237
|
-
qualifiedTableName:
|
|
1259
|
+
dataType: It(e),
|
|
1260
|
+
qualifiedTableName: gt(s),
|
|
1238
1261
|
sql: "",
|
|
1239
|
-
operation:
|
|
1262
|
+
operation: bt(e.operator),
|
|
1240
1263
|
type: e.multi === !1 ? "single" : "multiple",
|
|
1241
1264
|
location: "dashboard",
|
|
1242
1265
|
displayMode: "toolbar",
|
|
@@ -1257,36 +1280,36 @@ function gt(e, t, n, r, i, a) {
|
|
|
1257
1280
|
variableName: e.id,
|
|
1258
1281
|
scope: r,
|
|
1259
1282
|
filter: p,
|
|
1260
|
-
defaultValue:
|
|
1283
|
+
defaultValue: K(
|
|
1261
1284
|
p,
|
|
1262
1285
|
e.defaultValue
|
|
1263
1286
|
)
|
|
1264
1287
|
};
|
|
1265
1288
|
}
|
|
1266
|
-
function
|
|
1289
|
+
function L(e) {
|
|
1267
1290
|
const t = [], n = [];
|
|
1268
1291
|
for (const r of e.viewIds) {
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1292
|
+
const a = e.viewIdToCardId.get(r);
|
|
1293
|
+
a ? t.push(a) : n.push(r);
|
|
1271
1294
|
}
|
|
1272
1295
|
return n.length > 0 && e.warnings.push(
|
|
1273
|
-
|
|
1296
|
+
y(
|
|
1274
1297
|
"input_scope_view_not_found",
|
|
1275
1298
|
`Filter "${e.inputLabel}" referenced unknown view ids: ${n.join(", ")}.`
|
|
1276
1299
|
)
|
|
1277
1300
|
), Array.from(new Set(t));
|
|
1278
1301
|
}
|
|
1279
|
-
function
|
|
1280
|
-
var r,
|
|
1302
|
+
function _t(e) {
|
|
1303
|
+
var r, a;
|
|
1281
1304
|
if (!e.protocolScope) {
|
|
1282
|
-
const
|
|
1283
|
-
return
|
|
1305
|
+
const i = Array.from(new Set(e.boundCardIds));
|
|
1306
|
+
return i.length > 0 && i.length < e.allCardIds.length ? { kind: "cards", cardIds: i } : void 0;
|
|
1284
1307
|
}
|
|
1285
1308
|
if (e.protocolScope.level === "dashboard") {
|
|
1286
1309
|
if (!((r = e.protocolScope.excludeViewIds) != null && r.length))
|
|
1287
1310
|
return;
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1311
|
+
const i = new Set(
|
|
1312
|
+
L({
|
|
1290
1313
|
inputLabel: e.inputLabel,
|
|
1291
1314
|
viewIds: e.protocolScope.excludeViewIds,
|
|
1292
1315
|
viewIdToCardId: e.viewIdToCardId,
|
|
@@ -1295,35 +1318,35 @@ function yt(e) {
|
|
|
1295
1318
|
);
|
|
1296
1319
|
return {
|
|
1297
1320
|
kind: "cards",
|
|
1298
|
-
cardIds: e.allCardIds.filter((s) => !
|
|
1321
|
+
cardIds: e.allCardIds.filter((s) => !i.has(s))
|
|
1299
1322
|
};
|
|
1300
1323
|
}
|
|
1301
1324
|
if (e.protocolScope.level === "view") {
|
|
1302
|
-
const
|
|
1325
|
+
const i = L({
|
|
1303
1326
|
inputLabel: e.inputLabel,
|
|
1304
1327
|
viewIds: e.protocolScope.viewIds,
|
|
1305
1328
|
viewIdToCardId: e.viewIdToCardId,
|
|
1306
1329
|
warnings: e.warnings
|
|
1307
1330
|
});
|
|
1308
|
-
return
|
|
1309
|
-
|
|
1331
|
+
return i.length === 0 ? (e.warnings.push(
|
|
1332
|
+
y(
|
|
1310
1333
|
"input_scope_has_no_materialized_cards",
|
|
1311
1334
|
`Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`
|
|
1312
1335
|
)
|
|
1313
|
-
), null) : { kind: "cards", cardIds:
|
|
1336
|
+
), null) : { kind: "cards", cardIds: i };
|
|
1314
1337
|
}
|
|
1315
1338
|
const t = e.sectionIdToCardIds.get(e.protocolScope.sectionId) || [];
|
|
1316
1339
|
if (t.length === 0)
|
|
1317
1340
|
return e.warnings.push(
|
|
1318
|
-
|
|
1341
|
+
y(
|
|
1319
1342
|
"input_scope_section_not_found",
|
|
1320
1343
|
`Filter "${e.inputLabel}" was deferred because section "${e.protocolScope.sectionId}" does not match any materialized cards.`
|
|
1321
1344
|
)
|
|
1322
1345
|
), null;
|
|
1323
|
-
if (!((
|
|
1346
|
+
if (!((a = e.protocolScope.excludeViewIds) != null && a.length))
|
|
1324
1347
|
return { kind: "cards", cardIds: t };
|
|
1325
1348
|
const n = new Set(
|
|
1326
|
-
|
|
1349
|
+
L({
|
|
1327
1350
|
inputLabel: e.inputLabel,
|
|
1328
1351
|
viewIds: e.protocolScope.excludeViewIds,
|
|
1329
1352
|
viewIdToCardId: e.viewIdToCardId,
|
|
@@ -1332,128 +1355,128 @@ function yt(e) {
|
|
|
1332
1355
|
);
|
|
1333
1356
|
return {
|
|
1334
1357
|
kind: "cards",
|
|
1335
|
-
cardIds: t.filter((
|
|
1358
|
+
cardIds: t.filter((i) => !n.has(i))
|
|
1336
1359
|
};
|
|
1337
1360
|
}
|
|
1338
|
-
function
|
|
1339
|
-
var c,
|
|
1340
|
-
const t = [], n =
|
|
1361
|
+
function Dt(e) {
|
|
1362
|
+
var c, I, A;
|
|
1363
|
+
const t = [], n = _e(e);
|
|
1341
1364
|
for (const m of n.warnings)
|
|
1342
|
-
t.push(
|
|
1365
|
+
t.push(y(m.code, m.message));
|
|
1343
1366
|
for (const m of n.errors)
|
|
1344
|
-
t.push(
|
|
1345
|
-
const r =
|
|
1367
|
+
t.push(y(m.code, m.message));
|
|
1368
|
+
const r = ct(e, t), a = [], i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
|
|
1346
1369
|
let p = 0;
|
|
1347
1370
|
for (const [m, w] of r.sections.entries()) {
|
|
1348
|
-
const l = typeof w.title == "string" ? w.title : `Section ${m + 1}`,
|
|
1349
|
-
s.set(
|
|
1350
|
-
for (const [
|
|
1351
|
-
const
|
|
1352
|
-
h.id || `${l}-${h.title || `View ${
|
|
1353
|
-
`card-${m + 1}-${
|
|
1371
|
+
const l = typeof w.title == "string" ? w.title : `Section ${m + 1}`, X = w.id || T(l, `section-${m + 1}`);
|
|
1372
|
+
s.set(X, []);
|
|
1373
|
+
for (const [Y, h] of J(w).entries()) {
|
|
1374
|
+
const Z = pt(h), z = T(
|
|
1375
|
+
h.id || `${l}-${h.title || `View ${Y + 1}`}`,
|
|
1376
|
+
`card-${m + 1}-${Y + 1}`
|
|
1354
1377
|
);
|
|
1355
|
-
if (!
|
|
1378
|
+
if (!Z) {
|
|
1356
1379
|
t.push(
|
|
1357
|
-
|
|
1380
|
+
y(
|
|
1358
1381
|
"unsupported_presentation",
|
|
1359
1382
|
`Dashboard presentation "${((c = h.presentation) == null ? void 0 : c.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
|
|
1360
|
-
`card-${
|
|
1383
|
+
`card-${z}`
|
|
1361
1384
|
)
|
|
1362
1385
|
);
|
|
1363
1386
|
continue;
|
|
1364
1387
|
}
|
|
1365
|
-
if (((
|
|
1388
|
+
if (((I = h.analytics) == null ? void 0 : I.kind) === "sql") {
|
|
1366
1389
|
t.push(
|
|
1367
|
-
|
|
1390
|
+
y(
|
|
1368
1391
|
"sql_intent_deferred",
|
|
1369
1392
|
"SQL analytics intent is valid protocol, but the current dashboard authoring adapter only materializes semantic and physical config-card intents.",
|
|
1370
|
-
`card-${
|
|
1393
|
+
`card-${z}`
|
|
1371
1394
|
)
|
|
1372
1395
|
);
|
|
1373
1396
|
continue;
|
|
1374
1397
|
}
|
|
1375
|
-
const
|
|
1376
|
-
h.id &&
|
|
1377
|
-
const
|
|
1378
|
-
for (const
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1398
|
+
const ee = be(z, o), M = `card-${ee}`;
|
|
1399
|
+
h.id && i.set(h.id, M), (A = s.get(X)) == null || A.push(M);
|
|
1400
|
+
const ge = h.analytics && "inputs" in h.analytics ? h.analytics.inputs : void 0;
|
|
1401
|
+
for (const te of ge || []) {
|
|
1402
|
+
const ne = d.get(te.inputId) || [];
|
|
1403
|
+
ne.push(M), d.set(te.inputId, ne);
|
|
1381
1404
|
}
|
|
1382
|
-
|
|
1383
|
-
id:
|
|
1384
|
-
frameId: `frame-${
|
|
1405
|
+
a.push({
|
|
1406
|
+
id: M,
|
|
1407
|
+
frameId: `frame-${ee}`,
|
|
1385
1408
|
title: h.title,
|
|
1386
1409
|
description: h.description,
|
|
1387
|
-
type:
|
|
1388
|
-
role:
|
|
1410
|
+
type: Z,
|
|
1411
|
+
role: ht(h),
|
|
1389
1412
|
priority: p,
|
|
1390
1413
|
section: l,
|
|
1391
|
-
query:
|
|
1392
|
-
analyticsIntent:
|
|
1414
|
+
query: ft(h.analytics),
|
|
1415
|
+
analyticsIntent: mt(h.analytics),
|
|
1393
1416
|
text: h.text
|
|
1394
1417
|
}), p += 1;
|
|
1395
1418
|
}
|
|
1396
1419
|
}
|
|
1397
|
-
const
|
|
1398
|
-
const w =
|
|
1420
|
+
const b = r.inputs.map((m) => {
|
|
1421
|
+
const w = _t({
|
|
1399
1422
|
protocolScope: m.scope,
|
|
1400
1423
|
inputLabel: m.label,
|
|
1401
|
-
allCardIds:
|
|
1424
|
+
allCardIds: a.map((l) => l.id),
|
|
1402
1425
|
boundCardIds: d.get(m.id) || [],
|
|
1403
|
-
viewIdToCardId:
|
|
1426
|
+
viewIdToCardId: i,
|
|
1404
1427
|
sectionIdToCardIds: s,
|
|
1405
1428
|
warnings: t
|
|
1406
1429
|
});
|
|
1407
|
-
return w === null ? null :
|
|
1430
|
+
return w === null ? null : yt(
|
|
1408
1431
|
m,
|
|
1409
1432
|
r.defaultSource,
|
|
1410
1433
|
r.sources,
|
|
1411
1434
|
w,
|
|
1412
|
-
|
|
1435
|
+
u,
|
|
1413
1436
|
t
|
|
1414
1437
|
);
|
|
1415
1438
|
}).filter((m) => !!m);
|
|
1416
1439
|
return { plan: {
|
|
1417
1440
|
version: 1,
|
|
1418
|
-
id: `plan-${
|
|
1441
|
+
id: `plan-${T(e.title, "dashboard")}`,
|
|
1419
1442
|
title: e.title,
|
|
1420
1443
|
description: e.description,
|
|
1421
1444
|
datasets: r.datasets,
|
|
1422
1445
|
sheets: [
|
|
1423
1446
|
{
|
|
1424
|
-
id: `sheet-${
|
|
1447
|
+
id: `sheet-${T(e.title, "dashboard")}`,
|
|
1425
1448
|
title: e.title,
|
|
1426
1449
|
description: e.description,
|
|
1427
1450
|
kind: "dashboard",
|
|
1428
|
-
cards:
|
|
1451
|
+
cards: a
|
|
1429
1452
|
}
|
|
1430
1453
|
],
|
|
1431
|
-
filterInputs:
|
|
1454
|
+
filterInputs: b.length ? b : void 0,
|
|
1432
1455
|
warnings: t.length ? t : void 0,
|
|
1433
1456
|
unresolvedRequests: n.ok ? void 0 : n.errors.map((m) => m.message)
|
|
1434
1457
|
}, warnings: t };
|
|
1435
1458
|
}
|
|
1436
1459
|
export {
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1460
|
+
ve as DASHBOARD_AUTHORING_BREAKPOINTS,
|
|
1461
|
+
B as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
|
|
1462
|
+
Ct as applyDashboardChangePlan,
|
|
1463
|
+
St as compileDashboardFromPlan,
|
|
1464
|
+
U as compileResponsiveDashboardLayouts,
|
|
1465
|
+
H as dashboardAuthoringDatasetMatchesSource,
|
|
1466
|
+
Ce as dashboardAuthoringFieldsReferToSameTarget,
|
|
1444
1467
|
v as dashboardAuthoringSourceFromField,
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1468
|
+
re as dashboardAuthoringSourceKey,
|
|
1469
|
+
de as dashboardAuthoringSourcesReferToSameDataset,
|
|
1470
|
+
Dt as dashboardPlanFromSemaphorDashboardIntent,
|
|
1471
|
+
At as findDashboardAuthoringDatasetForSource,
|
|
1472
|
+
Re as getDashboardAuthoringCardSource,
|
|
1473
|
+
R as isMaterializableDashboardAuthoringSource,
|
|
1474
|
+
ke as isSemaphorSourceRef,
|
|
1475
|
+
V as mergeDashboardAuthoringSources,
|
|
1476
|
+
Ae as preferDashboardAuthoringSourceMetadata,
|
|
1477
|
+
kt as preferredDashboardAuthoringSource,
|
|
1478
|
+
Se as resolveDashboardAuthoringSource,
|
|
1479
|
+
Me as validateDashboardAuthoringDatasetScope,
|
|
1480
|
+
Be as validateDashboardChangePlan,
|
|
1481
|
+
Pe as validateDashboardPlan
|
|
1459
1482
|
};
|