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