react-semaphor 0.1.558 → 0.1.560
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.js +368 -358
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +9 -9
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/analytics-base-schemas-CHLxsPfX.js +630 -0
- package/dist/chunks/{assistant-chat-BCWoP6Rf.js → assistant-chat-Bu2fFm_I.js} +206 -207
- package/dist/chunks/{bookmark-state-PjQpxbG7.js → bookmark-state-BFY9oNmr.js} +3 -3
- package/dist/chunks/{braces-D5Ucy7q1.js → braces-Da41xfUd.js} +1 -1
- package/dist/chunks/{comparison-window-caption-Dc7BaCMz.js → comparison-window-caption-4FNkMrzE.js} +213 -213
- package/dist/chunks/{context-DVy4HOU0.js → context-BgPDzLHZ.js} +1 -1
- package/dist/chunks/{custom-visual-inputs-B-DLRGrV.js → custom-visual-inputs-Dz-enUNR.js} +1 -1
- package/dist/chunks/{dashboard-wK6Bai4V.js → dashboard-_MeBuy67.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Coqghdn6.js → dashboard-briefing-launcher-CEi4Pr_v.js} +1152 -1166
- package/dist/chunks/{dashboard-controls-BYWSM2RM.js → dashboard-controls-Bi7fyG-4.js} +98 -98
- package/dist/chunks/{dashboard-json-pPTB5gj0.js → dashboard-json-B1mU_OMa.js} +5 -5
- package/dist/chunks/{document-dashboard-inputs-PY_7Xm55.js → document-dashboard-inputs-CkWfDB8c.js} +64 -64
- package/dist/chunks/{edit-dashboard-visual-BODxuUeq.js → edit-dashboard-visual-0CJN31Y3.js} +8274 -8514
- package/dist/chunks/filter-reach-copy-BF4w4kI2.js +3738 -0
- package/dist/chunks/{filter-value-text-CUBpotVN.js → filter-value-text-CRC-K_l_.js} +3 -3
- package/dist/chunks/{global-date-filter-utils-BsFqnnbA.js → global-date-filter-utils-D8365uPH.js} +4088 -3416
- package/dist/chunks/{index-DP_wQl0v.js → index-DtHidOPV.js} +579 -604
- package/dist/chunks/{layout-grid-CkoXmv0L.js → layout-grid-BvsH4RY2.js} +1 -1
- package/dist/chunks/{list-filter-B4i25kuc.js → list-filter-Dg0otx5E.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-4GTUDheD.js → matrix-analytical-definition-CM18W8w6.js} +41 -41
- package/dist/chunks/{matrix-card-fS_4O7zA.js → matrix-card-HPskLaPy.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-Dj7HaAHC.js → matrix-member-presentation-Bbrfrke4.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-CpgLZ7E5.js → matrix-operation-contract-WPv4R-H_.js} +130 -130
- package/dist/chunks/{metric-comparison-C8LY7GG5.js → metric-comparison-ljMKYZKa.js} +2 -2
- package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-Ccn1zaxl.js} +1 -1
- package/dist/chunks/{palette-stlpjVk4.js → palette-Bsh376zO.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-DMk-mKhG.js → pivot-result-contract-expectations-Bl5suy4-.js} +602 -696
- package/dist/chunks/{pivot-result-identity-CrQ54Xbj.js → pivot-result-identity-vS9TSh4f.js} +1 -1
- package/dist/chunks/{raw-temporal-presentation-BI2z2LlB.js → raw-temporal-presentation-BHm7s-hz.js} +230 -274
- package/dist/chunks/{report-preferences-dialog-Dc-YyVwf.js → report-preferences-dialog-BV8L0SeS.js} +55 -55
- package/dist/chunks/{report-runtime-context-CohdtiMg.js → report-runtime-context-BZQh9ywy.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-BZYI1hB0.js → resolve-dashboard-input-context-CAMiWvyR.js} +2021 -2239
- package/dist/chunks/{save-C1dgxgAu.js → save-B5EAsgQF.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CIBoMq46.js → saved-dashboard-context-n2Wn11cV.js} +57 -57
- package/dist/chunks/{selection-reducer-_d6aKJnj.js → selection-reducer-D0YnaAD9.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-ERTLU7B4.js → semaphor-ready-indicator-XLBLOJ2V.js} +38446 -39176
- package/dist/chunks/{shelf-drop-preview-context-fEnx6iL_.js → shelf-drop-preview-context-DHMa54a-.js} +570 -570
- package/dist/chunks/source-entity-resolution-dUG5VWRm.js +607 -0
- package/dist/chunks/{switch-BqUan2mN.js → switch-ByxH4M7t.js} +3 -3
- package/dist/chunks/{table-export-sheet-CTCTA_bd.js → table-export-sheet-C_GdeTYU.js} +1 -1
- package/dist/chunks/{table-settings-DF1gdVQR.js → table-settings-Imz0FgWi.js} +8 -8
- package/dist/chunks/{temporal-input-presentation-DoSniQj1.js → temporal-input-presentation-uvNK_tM0.js} +1109 -820
- package/dist/chunks/{token-types-DFyLflLY.js → token-types-CQtXUVMy.js} +1 -1
- package/dist/chunks/{upload-DcoyjkRV.js → upload-wbR-NVzq.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-xhb9YFg-.js → use-create-flow-overlay-state-CEBaLOKC.js} +6 -6
- package/dist/chunks/validators-CXTneCA4.js +3453 -0
- package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-B1n_WjW3.js} +1 -1
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +2207 -1496
- package/dist/data-app-sdk/index.js +20 -20
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +6 -6
- package/dist/format-utils/index.js +181 -176
- package/dist/index.js +22 -22
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/editor/editor-aside/utils.d.ts +1 -1
- package/dist/types/components/visual/data-table/types/data-table.d.ts +5 -20
- package/dist/types/index.js +6 -6
- package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
- package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
- package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
- package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
- package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
- package/dist/types/lib/stores/editor-store.d.ts +39 -9
- package/dist/types/lib/stores/table-actions.d.ts +9 -3
- package/dist/types/lib/table-formatting/index.d.ts +0 -2
- package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
- package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
- package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
- package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
- package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
- package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
- package/dist/types/lib/types/common-types.d.ts +40 -47
- package/dist/types/lib/types/explorer-types.d.ts +13 -44
- package/dist/types/lib/utils/card-config-utils.d.ts +9 -1
- package/dist/types/lib/utils/card-definition.d.ts +9 -187
- package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +159 -513
- package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
- package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
- package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
- package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
- package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
- package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
- package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
- package/dist/types/shared/analytics-protocol/source-capabilities.d.ts +21 -0
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
- package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
- package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +24 -24
- package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +4 -2
- package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
- package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
- package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +5 -1
- package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
- package/dist/types/shared/format-utils/index.d.ts +2 -0
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
- package/dist/types/shared/format-utils/raw-temporal.d.ts +15 -1
- package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
- package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
- package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
- package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
- package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
- package/package.json +1 -1
- package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
- package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
- package/dist/chunks/filter-reach-copy-BvJH9JO-.js +0 -3411
- package/dist/chunks/source-entity-resolution-DXW1HpKf.js +0 -816
- package/dist/chunks/validators-hmfNNQz8.js +0 -3595
- package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
- package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
|
@@ -1,149 +1,151 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { D as
|
|
5
|
-
import { N as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "../chunks/matrix-operation-contract-
|
|
10
|
-
import "../chunks/analytics-base-schemas-
|
|
1
|
+
var ia = Object.defineProperty;
|
|
2
|
+
var da = (e, t, a) => t in e ? ia(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var Be = (e, t, a) => da(e, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
+
import { D as vt, r as Bt, b as ca, c as la, a as St, d as ua } from "../chunks/filter-reach-copy-BF4w4kI2.js";
|
|
5
|
+
import { N as er, R as tr, f as ar, j as or, l as nr, k as sr, u as rr, q as ir, e as dr, i as cr, x as lr, z as ur, K as fr, L as mr, s as hr, y as pr, H as gr, t as br, E as yr, m as Ir, n as _r, p as Cr, g as vr, o as Sr, h as $r, F as wr, B as Fr, A as xr, J as Tr, I as kr, v as Dr, w as Ar, G as Rr, C as Or } from "../chunks/filter-reach-copy-BF4w4kI2.js";
|
|
6
|
+
import { Q as fa, R as ma, S as Ve, T as ha, U as pa, V as ga, W as ba, X as ya, Y as Ia, Z as _a, _ as Ca, $ as va, a0 as he, a1 as Sa, a2 as $a, a3 as ve, a4 as wa, a5 as Fa, a6 as Ze, a7 as Vt, a8 as me, a9 as fe, aa as ze, ab as xa, ac as et, ad as Ta, ae as ka, af as Da, ag as $t, ah as Aa, ai as Ra, aj as jt, ak as ue, al as wt, am as Oa, an as Ea, ao as Qe, ap as Na, aq as Ft, ar as Pa, as as xt, at as qa, au as ye, av as Ma, aw as Tt, c as La, ax as Ba, ay as Va, az as ja, aA as Ka, aB as kt, aC as Ua, aD as Ga, aE as za, aF as Qa, aG as Ha, aH as Ya, aI as Wa, aJ as Ja, aK as Xa, aL as je, aM as Za, aN as eo, aO as to, aP as ao, aQ as oo, aR as no, aS as so, aT as ro, aU as io, aV as co } from "../chunks/global-date-filter-utils-D8365uPH.js";
|
|
7
|
+
import { cM as Nr, b4 as Pr, cn as qr, co as Mr, cD as Lr, cC as Br, cw as Vr, cE as jr, cF as Kr, c1 as Ur, c2 as Gr, c3 as zr, b_ as Qr, b$ as Hr, c0 as Yr, bW as Wr, bX as Jr, bZ as Xr, bY as Zr, c4 as ei, cZ as ti, cp as ai, bn as oi, bm as ni, ch as si, cO as ri, bx as ii, bh as di, cS as ci, cA as li, cB as ui, b1 as fi, cR as mi, bA as hi, d4 as pi, cP as gi, bN as bi, cv as yi, c5 as Ii, bO as _i, c$ as Ci, aY as vi, d2 as Si, cT as $i, cz as wi, aZ as Fi, d5 as xi, d3 as Ti, cg as ki, cf as Di, br as Ai, bd as Ri, bj as Oi, cX as Ei, bI as Ni, d as Pi, b as qi, bB as Mi, a_ as Li, cL as Bi, da as Vi, be as ji, bf as Ki, bg as Ui, bw as Gi, by as zi, ck as Qi, g as Hi, bV as Yi, bF as Wi, bU as Ji, bR as Xi, cl as Zi, b6 as ed, b7 as td, cV as ad, bC as od, bo as nd, cx as sd, bt as rd, cJ as id, bi as dd, cb as cd, d9 as ld, b2 as ud, cd as fd, ce as md, cY as hd, bL as pd, bE as gd, bG as bd, bs as yd, bH as Id, cG as _d, cU as Cd, a$ as vd, cN as Sd, bK as $d, bp as wd, bQ as Fd, cH as xd, ci as Td, cj as kd, b5 as Dd, c_ as Ad, d6 as Rd, cm as Od, ct as Ed, bT as Nd, b9 as Pd, cI as qd, cW as Md, aW as Ld, cK as Bd, bM as Vd, bq as jd, c7 as Kd, bc as Ud, bk as Gd, bl as zd, cq as Qd, cr as Hd, bb as Yd, c9 as Wd, ca as Jd, c8 as Xd, b8 as Zd, d8 as ec, bS as tc, cs as ac, bJ as oc, cy as nc, aX as sc, ba as rc, bP as ic, cc as dc, b3 as cc, cQ as lc, bz as uc, bD as fc, b0 as mc, c6 as hc, d7 as pc, d1 as gc, bv as bc, bu as yc, cu as Ic, d0 as _c } from "../chunks/global-date-filter-utils-D8365uPH.js";
|
|
8
|
+
import { H as lo, aC as tt, aD as uo, ab as Kt, aj as Ut, ae as fo, al as Gt, aR as mo, aP as zt, aQ as ho } from "../chunks/validators-CXTneCA4.js";
|
|
9
|
+
import "../chunks/matrix-operation-contract-WPv4R-H_.js";
|
|
10
|
+
import { x as at, k as po, u as go, q as bo, p as yo, m as Io, t as pe, e as _o } from "../chunks/analytics-base-schemas-CHLxsPfX.js";
|
|
11
11
|
import "zod";
|
|
12
|
-
import { a as
|
|
13
|
-
import { n as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
12
|
+
import { a as Co, r as vo } from "../chunks/index-CJW5BdWT.js";
|
|
13
|
+
import { n as So } from "../chunks/operators-B3zZoskU.js";
|
|
14
|
+
import { r as $o } from "../chunks/raw-temporal-presentation-BHm7s-hz.js";
|
|
15
|
+
import { d as vc, e as Sc, c as $c } from "../chunks/raw-temporal-presentation-BHm7s-hz.js";
|
|
16
|
+
import { w as ie } from "../chunks/table-settings-Imz0FgWi.js";
|
|
17
|
+
import { D as Fc, y as xc, z as Tc, G as kc, F as Dc, x as Ac, H as Rc, B as Oc, A as Ec, v as Nc } from "../chunks/table-settings-Imz0FgWi.js";
|
|
18
|
+
import { v as Oe, w as wo, x as Fo } from "../chunks/resolve-dashboard-input-context-CAMiWvyR.js";
|
|
19
|
+
import { L as qc, Q as Mc, W as Lc, R as Bc, b as Vc, U as jc, P as Kc, A as Uc, X as Gc, Y as zc, T as Qc, I as Hc, J as Yc, N as Wc, B as Jc, C as Xc, O as Zc, M as el, y as tl, z as al, p as ol, V as nl, K as sl, G as rl, S as il, D as dl, F as cl, E as ll, H as ul } from "../chunks/resolve-dashboard-input-context-CAMiWvyR.js";
|
|
20
|
+
import { aj as xo } from "../chunks/temporal-input-presentation-uvNK_tM0.js";
|
|
21
|
+
import { am as ml, al as hl, ah as pl, ak as gl, an as bl, af as yl } from "../chunks/temporal-input-presentation-uvNK_tM0.js";
|
|
22
|
+
import { e as To, w as ko, r as Do } from "../chunks/metric-comparison-ljMKYZKa.js";
|
|
23
|
+
import { p as Ao } from "../chunks/report-runtime-context-BZQh9ywy.js";
|
|
24
|
+
import { i as _l, a as Cl, m as vl, b as Sl, r as $l } from "../chunks/matrix-card-HPskLaPy.js";
|
|
25
|
+
import { n as Dt, t as Ro } from "../chunks/matrix-analytical-definition-CM18W8w6.js";
|
|
24
26
|
import "../chunks/index-CuHybtft.js";
|
|
25
27
|
import "../value-format-preferences/index.js";
|
|
26
28
|
import "../chunks/_commonjsHelpers-DimLPMtv.js";
|
|
27
|
-
function
|
|
29
|
+
function ee(e) {
|
|
28
30
|
return e && typeof e == "object" ? e : null;
|
|
29
31
|
}
|
|
30
|
-
function
|
|
32
|
+
function ne(e) {
|
|
31
33
|
return typeof e == "string" ? e : null;
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
var t, a,
|
|
35
|
-
return !!(e && typeof e == "object") && (((t =
|
|
35
|
+
function Oo(e) {
|
|
36
|
+
var t, a, o;
|
|
37
|
+
return !!(e && typeof e == "object") && (((t = ee(e)) == null ? void 0 : t.kind) === "semantic" || ((a = ee(e)) == null ? void 0 : a.kind) === "physical" || ((o = ee(e)) == null ? void 0 : o.kind) === "sql");
|
|
36
38
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
39
|
+
function $e(e) {
|
|
40
|
+
return Oo(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
|
|
39
41
|
}
|
|
40
|
-
function
|
|
41
|
-
return
|
|
42
|
+
function qs(e) {
|
|
43
|
+
return lo(e);
|
|
42
44
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
45
|
+
function Qt(e, t) {
|
|
46
|
+
return tt(e, t);
|
|
45
47
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
48
|
+
function Eo(e, t) {
|
|
49
|
+
return uo(e, t);
|
|
48
50
|
}
|
|
49
|
-
function
|
|
51
|
+
function Ee(e) {
|
|
50
52
|
const t = [];
|
|
51
53
|
for (const a of e) {
|
|
52
|
-
const
|
|
53
|
-
(
|
|
54
|
+
const o = t.findIndex(
|
|
55
|
+
(n) => Qt(n, a)
|
|
54
56
|
);
|
|
55
|
-
|
|
56
|
-
t[
|
|
57
|
+
o === -1 ? t.push(a) : t[o] = Eo(
|
|
58
|
+
t[o],
|
|
57
59
|
a
|
|
58
60
|
);
|
|
59
61
|
}
|
|
60
62
|
return t;
|
|
61
63
|
}
|
|
62
|
-
function
|
|
63
|
-
return
|
|
64
|
+
function Ms(e) {
|
|
65
|
+
return Ee(e)[0];
|
|
64
66
|
}
|
|
65
|
-
function
|
|
66
|
-
return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !
|
|
67
|
+
function He(e, t) {
|
|
68
|
+
return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !tt(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
|
|
67
69
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
70
|
+
function Ye(e) {
|
|
71
|
+
return $e(e) ? e : void 0;
|
|
70
72
|
}
|
|
71
|
-
function
|
|
73
|
+
function At(e, t) {
|
|
72
74
|
if (!(e.kind !== "semantic" || e.connectionId))
|
|
73
75
|
return t.find(
|
|
74
|
-
(a) => (a == null ? void 0 : a.kind) === "semantic" &&
|
|
76
|
+
(a) => (a == null ? void 0 : a.kind) === "semantic" && tt(e, a) && !!a.connectionId
|
|
75
77
|
);
|
|
76
78
|
}
|
|
77
|
-
function
|
|
78
|
-
const a =
|
|
79
|
-
return a ?
|
|
79
|
+
function oe(e, t) {
|
|
80
|
+
const a = Ye(e == null ? void 0 : e.source);
|
|
81
|
+
return a ? He(a, t) : void 0;
|
|
80
82
|
}
|
|
81
|
-
function
|
|
83
|
+
function No({
|
|
82
84
|
explicitSource: e,
|
|
83
85
|
field: t,
|
|
84
86
|
defaultSource: a,
|
|
85
|
-
fallbackSources:
|
|
87
|
+
fallbackSources: o
|
|
86
88
|
}) {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
const n = [a, ...o || []], r = Ye(e), s = r ? He(
|
|
90
|
+
r,
|
|
91
|
+
At(r, n)
|
|
90
92
|
) : void 0;
|
|
91
|
-
if (
|
|
92
|
-
return
|
|
93
|
+
if (s)
|
|
94
|
+
return s;
|
|
93
95
|
if (e !== void 0)
|
|
94
96
|
return;
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
const i = oe(t, a), d = i ? He(
|
|
98
|
+
i,
|
|
99
|
+
At(i, n)
|
|
98
100
|
) : void 0;
|
|
99
|
-
if (
|
|
100
|
-
return
|
|
101
|
+
if (d)
|
|
102
|
+
return d;
|
|
101
103
|
if ((t == null ? void 0 : t.source) === void 0)
|
|
102
|
-
return
|
|
104
|
+
return Ye(a);
|
|
103
105
|
}
|
|
104
|
-
function
|
|
106
|
+
function Ls(e, t) {
|
|
105
107
|
if (!(e != null && e.name) || !(t != null && t.name) || e.name !== t.name)
|
|
106
108
|
return !1;
|
|
107
|
-
const a =
|
|
108
|
-
return !a || !
|
|
109
|
+
const a = oe(e), o = oe(t);
|
|
110
|
+
return !a || !o ? !0 : Qt(a, o);
|
|
109
111
|
}
|
|
110
|
-
function
|
|
112
|
+
function ce(e) {
|
|
111
113
|
var t;
|
|
112
|
-
return
|
|
114
|
+
return ne((t = ee(e)) == null ? void 0 : t.kind);
|
|
113
115
|
}
|
|
114
|
-
function
|
|
116
|
+
function Ht(e) {
|
|
115
117
|
var t, a;
|
|
116
|
-
return
|
|
118
|
+
return ce(e) !== "semantic" ? null : ((a = ne((t = ee(e)) == null ? void 0 : t.domainId)) == null ? void 0 : a.trim()) || null;
|
|
117
119
|
}
|
|
118
|
-
function
|
|
120
|
+
function Po(e) {
|
|
119
121
|
var t;
|
|
120
|
-
return
|
|
122
|
+
return ce(e) !== "semantic" ? null : ne((t = ee(e)) == null ? void 0 : t.datasetName);
|
|
121
123
|
}
|
|
122
|
-
function
|
|
124
|
+
function qo(e) {
|
|
123
125
|
var t;
|
|
124
|
-
return
|
|
126
|
+
return ce(e) !== "semantic" ? null : ne((t = ee(e)) == null ? void 0 : t.datasetId);
|
|
125
127
|
}
|
|
126
|
-
function
|
|
128
|
+
function Mo(e) {
|
|
127
129
|
var t;
|
|
128
|
-
return
|
|
130
|
+
return ce(e) !== "physical" ? null : ne((t = ee(e)) == null ? void 0 : t.connectionId);
|
|
129
131
|
}
|
|
130
|
-
function
|
|
132
|
+
function Lo(e) {
|
|
131
133
|
var t;
|
|
132
|
-
return
|
|
134
|
+
return ce(e) !== "physical" ? null : ne((t = ee(e)) == null ? void 0 : t.tableName);
|
|
133
135
|
}
|
|
134
|
-
function
|
|
136
|
+
function Bo(e) {
|
|
135
137
|
var t;
|
|
136
|
-
return
|
|
138
|
+
return ce(e) !== "physical" ? "" : ne((t = ee(e)) == null ? void 0 : t.databaseName) || "";
|
|
137
139
|
}
|
|
138
|
-
function
|
|
140
|
+
function Vo(e) {
|
|
139
141
|
var t;
|
|
140
|
-
return
|
|
142
|
+
return ce(e) !== "physical" ? "" : ne((t = ee(e)) == null ? void 0 : t.schemaName) || "";
|
|
141
143
|
}
|
|
142
|
-
function
|
|
144
|
+
function jo(e) {
|
|
143
145
|
if (e.analyticsIntent && typeof e.analyticsIntent == "object" && "source" in e.analyticsIntent)
|
|
144
146
|
return e.analyticsIntent.source;
|
|
145
147
|
}
|
|
146
|
-
function
|
|
148
|
+
function Ko({
|
|
147
149
|
datasets: e,
|
|
148
150
|
requireAtLeastOne: t
|
|
149
151
|
}) {
|
|
@@ -151,27 +153,27 @@ function Xa({
|
|
|
151
153
|
return { ok: !1, issue: "invalid_dataset_count" };
|
|
152
154
|
if (e.length <= 1)
|
|
153
155
|
return { ok: !0 };
|
|
154
|
-
const a = e.map(
|
|
155
|
-
return a.some((
|
|
156
|
+
const a = e.map(Ht), o = new Set(a.filter(Boolean));
|
|
157
|
+
return a.some((n) => !n) || o.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
|
|
156
158
|
}
|
|
157
|
-
function
|
|
159
|
+
function ot(e, t) {
|
|
158
160
|
if (!t)
|
|
159
161
|
return !1;
|
|
160
162
|
if (t.kind === "semantic") {
|
|
161
|
-
const a =
|
|
162
|
-
return
|
|
163
|
+
const a = qo(e);
|
|
164
|
+
return Ht(e) === t.domainId ? a && t.datasetId ? a === t.datasetId : Po(e) === t.datasetName : !1;
|
|
163
165
|
}
|
|
164
|
-
return t.kind === "physical" ?
|
|
166
|
+
return t.kind === "physical" ? Mo(e) === t.connectionId && Lo(e) === t.tableName && Bo(e) === (t.databaseName || "") && Vo(e) === (t.schemaName || "") : !1;
|
|
165
167
|
}
|
|
166
|
-
function
|
|
168
|
+
function Bs(e, t) {
|
|
167
169
|
return e.find(
|
|
168
|
-
(a) =>
|
|
170
|
+
(a) => ot(a, t)
|
|
169
171
|
);
|
|
170
172
|
}
|
|
171
173
|
function M(e, t, a) {
|
|
172
174
|
return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
|
|
173
175
|
}
|
|
174
|
-
function
|
|
176
|
+
function Te(e) {
|
|
175
177
|
const t = /* @__PURE__ */ new Set();
|
|
176
178
|
for (const a of e) {
|
|
177
179
|
if (t.has(a))
|
|
@@ -180,15 +182,15 @@ function ye(e) {
|
|
|
180
182
|
}
|
|
181
183
|
return null;
|
|
182
184
|
}
|
|
183
|
-
function
|
|
185
|
+
function Uo({
|
|
184
186
|
card: e,
|
|
185
187
|
datasets: t,
|
|
186
188
|
errors: a
|
|
187
189
|
}) {
|
|
188
190
|
if (e.type === "text")
|
|
189
191
|
return;
|
|
190
|
-
const
|
|
191
|
-
if (!
|
|
192
|
+
const o = jo(e);
|
|
193
|
+
if (!o) {
|
|
192
194
|
if (t.length <= 1)
|
|
193
195
|
return;
|
|
194
196
|
a.push(
|
|
@@ -200,7 +202,7 @@ function Ja({
|
|
|
200
202
|
);
|
|
201
203
|
return;
|
|
202
204
|
}
|
|
203
|
-
t.some((
|
|
205
|
+
t.some((n) => ot(n, o)) || a.push(
|
|
204
206
|
M(
|
|
205
207
|
"invalid_card_analytics_source",
|
|
206
208
|
"Dashboard cards with an explicit analytics source must use one of the selected datasets.",
|
|
@@ -208,57 +210,57 @@ function Ja({
|
|
|
208
210
|
)
|
|
209
211
|
);
|
|
210
212
|
}
|
|
211
|
-
function
|
|
213
|
+
function ke(e) {
|
|
212
214
|
return e.map((t) => t == null ? void 0 : t.source).filter((t) => !!t);
|
|
213
215
|
}
|
|
214
|
-
function
|
|
216
|
+
function Ke(e) {
|
|
215
217
|
return Array.isArray(e) ? e.filter(
|
|
216
218
|
(t) => !!(t && typeof t == "object")
|
|
217
219
|
) : [];
|
|
218
220
|
}
|
|
219
|
-
function
|
|
221
|
+
function Rt(e) {
|
|
220
222
|
return Array.isArray(e) ? e.filter(
|
|
221
223
|
(t) => !!(t && typeof t == "object")
|
|
222
224
|
) : [];
|
|
223
225
|
}
|
|
224
|
-
function
|
|
225
|
-
var a,
|
|
226
|
+
function Go(e) {
|
|
227
|
+
var a, o;
|
|
226
228
|
if (!e)
|
|
227
229
|
return [];
|
|
228
230
|
const t = [e.source];
|
|
229
231
|
return e.kind === "metric" ? t.push(
|
|
230
|
-
...
|
|
231
|
-
...
|
|
232
|
+
...ke([
|
|
233
|
+
...Ke(e.measures),
|
|
232
234
|
e.primaryMeasure,
|
|
233
235
|
e.dateField,
|
|
234
|
-
...
|
|
235
|
-
...
|
|
236
|
+
...Ke(e.dimensions),
|
|
237
|
+
...Rt(e.filters).map((n) => n.field)
|
|
236
238
|
])
|
|
237
239
|
) : e.kind === "records" ? t.push(
|
|
238
|
-
...
|
|
239
|
-
...
|
|
240
|
+
...ke([
|
|
241
|
+
...Ke(e.fields),
|
|
240
242
|
e.dateField,
|
|
241
243
|
(a = e.orderBy) == null ? void 0 : a.field,
|
|
242
|
-
...
|
|
244
|
+
...Rt(e.filters).map((n) => n.field)
|
|
243
245
|
])
|
|
244
|
-
) : e.kind === "inputOptions" ? (((
|
|
245
|
-
...
|
|
246
|
+
) : e.kind === "inputOptions" ? (((o = e.population) == null ? void 0 : o.kind) === "related_population" && t.push(e.population.baseSource), t.push(
|
|
247
|
+
...ke([
|
|
246
248
|
e.labelField,
|
|
247
249
|
e.valueField,
|
|
248
250
|
e.searchField,
|
|
249
251
|
...e.disambiguationFields || []
|
|
250
252
|
])
|
|
251
|
-
)) : e.kind === "sql" && t.push(...
|
|
253
|
+
)) : e.kind === "sql" && t.push(...ke(e.fields || [])), t;
|
|
252
254
|
}
|
|
253
|
-
function
|
|
255
|
+
function zo({
|
|
254
256
|
card: e,
|
|
255
257
|
datasets: t,
|
|
256
258
|
errors: a
|
|
257
259
|
}) {
|
|
258
260
|
if (e.type !== "text") {
|
|
259
|
-
for (const
|
|
260
|
-
if (
|
|
261
|
-
(
|
|
261
|
+
for (const o of Go(e.analyticsIntent))
|
|
262
|
+
if (o && !t.some(
|
|
263
|
+
(n) => ot(n, o)
|
|
262
264
|
)) {
|
|
263
265
|
a.push(
|
|
264
266
|
M(
|
|
@@ -271,34 +273,34 @@ function es({
|
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
275
|
}
|
|
274
|
-
function
|
|
276
|
+
function Qo({
|
|
275
277
|
card: e,
|
|
276
278
|
errors: t
|
|
277
279
|
}) {
|
|
278
280
|
if (e.type === "text" || !e.analyticsIntent)
|
|
279
281
|
return;
|
|
280
|
-
const a =
|
|
282
|
+
const a = Kt(e.analyticsIntent);
|
|
281
283
|
if (!a.ok)
|
|
282
|
-
for (const
|
|
284
|
+
for (const o of a.errors)
|
|
283
285
|
t.push(
|
|
284
286
|
M(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
+
o.code,
|
|
288
|
+
o.path ? `${o.path}: ${o.message}` : o.message,
|
|
287
289
|
e.id
|
|
288
290
|
)
|
|
289
291
|
);
|
|
290
292
|
}
|
|
291
|
-
function
|
|
293
|
+
function Ho({
|
|
292
294
|
datasets: e,
|
|
293
295
|
errors: t,
|
|
294
296
|
requireAtLeastOne: a
|
|
295
297
|
}) {
|
|
296
|
-
const
|
|
298
|
+
const o = Ko({
|
|
297
299
|
datasets: e,
|
|
298
300
|
requireAtLeastOne: a
|
|
299
301
|
});
|
|
300
|
-
if (!
|
|
301
|
-
if (
|
|
302
|
+
if (!o.ok) {
|
|
303
|
+
if (o.issue === "invalid_dataset_count") {
|
|
302
304
|
t.push(
|
|
303
305
|
M(
|
|
304
306
|
"invalid_dataset_count",
|
|
@@ -315,7 +317,7 @@ function as({
|
|
|
315
317
|
);
|
|
316
318
|
}
|
|
317
319
|
}
|
|
318
|
-
function
|
|
320
|
+
function Yo({
|
|
319
321
|
input: e,
|
|
320
322
|
errors: t
|
|
321
323
|
}) {
|
|
@@ -327,7 +329,7 @@ function ss({
|
|
|
327
329
|
)
|
|
328
330
|
);
|
|
329
331
|
}
|
|
330
|
-
function
|
|
332
|
+
function Wo({
|
|
331
333
|
card: e,
|
|
332
334
|
errors: t
|
|
333
335
|
}) {
|
|
@@ -337,13 +339,13 @@ function is({
|
|
|
337
339
|
"Dashboard authoring accepts click-to-filter settings only through card.clickToFilter.",
|
|
338
340
|
e.id
|
|
339
341
|
)
|
|
340
|
-
), e.clickToFilter !== void 0 && !
|
|
342
|
+
), e.clickToFilter !== void 0 && !fa.safeParse(e.clickToFilter).success && t.push(
|
|
341
343
|
M(
|
|
342
344
|
"invalid_click_to_filter",
|
|
343
345
|
"Dashboard card clickToFilter settings do not match the canonical schema.",
|
|
344
346
|
e.id
|
|
345
347
|
)
|
|
346
|
-
), e.respondsToSelections !== void 0 && !
|
|
348
|
+
), e.respondsToSelections !== void 0 && !ma.safeParse(e.respondsToSelections).success && t.push(
|
|
347
349
|
M(
|
|
348
350
|
"invalid_responds_to_selections",
|
|
349
351
|
"Dashboard card respondsToSelections must be a boolean.",
|
|
@@ -351,8 +353,8 @@ function is({
|
|
|
351
353
|
)
|
|
352
354
|
);
|
|
353
355
|
}
|
|
354
|
-
function
|
|
355
|
-
var
|
|
356
|
+
function Jo(e) {
|
|
357
|
+
var S, u;
|
|
356
358
|
const t = [];
|
|
357
359
|
if (!e || typeof e != "object")
|
|
358
360
|
return {
|
|
@@ -365,103 +367,103 @@ function ns(e) {
|
|
|
365
367
|
],
|
|
366
368
|
warnings: []
|
|
367
369
|
};
|
|
368
|
-
const a = e,
|
|
369
|
-
a.version !== 1 && t.push(M("invalid_version", "Dashboard plan version must be 1.")), (
|
|
370
|
-
const
|
|
371
|
-
|
|
370
|
+
const a = e, o = [...a.warnings || []];
|
|
371
|
+
a.version !== 1 && t.push(M("invalid_version", "Dashboard plan version must be 1.")), (S = a.title) != null && S.trim() || t.push(M("missing_title", "Dashboard plan needs a title."));
|
|
372
|
+
const n = Array.isArray(a.datasets) ? a.datasets : [], r = Array.isArray(a.sheets) ? a.sheets : [];
|
|
373
|
+
Ho({ datasets: n, errors: t, requireAtLeastOne: !0 }), r.length !== 1 && t.push(
|
|
372
374
|
M(
|
|
373
375
|
"invalid_sheet_count",
|
|
374
376
|
"MVP dashboard authoring creates exactly one dashboard sheet."
|
|
375
377
|
)
|
|
376
378
|
);
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
+
const s = r[0];
|
|
380
|
+
s && s.kind !== "dashboard" && t.push(
|
|
379
381
|
M("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
|
|
380
382
|
);
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
+
const i = (s == null ? void 0 : s.cards) || [];
|
|
384
|
+
i.length > vt && t.push(
|
|
383
385
|
M(
|
|
384
386
|
"too_many_cards",
|
|
385
|
-
`Generated dashboards can contain at most ${
|
|
387
|
+
`Generated dashboards can contain at most ${vt} cards.`
|
|
386
388
|
)
|
|
387
389
|
);
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
M("duplicate_card_id", `Duplicate generated card id: ${
|
|
390
|
+
const d = Te(i.map((g) => g.id));
|
|
391
|
+
d && t.push(
|
|
392
|
+
M("duplicate_card_id", `Duplicate generated card id: ${d}.`)
|
|
391
393
|
);
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
+
const c = Te(i.map((g) => g.frameId));
|
|
395
|
+
c && t.push(
|
|
394
396
|
M(
|
|
395
397
|
"duplicate_frame_id",
|
|
396
|
-
`Duplicate generated frame id: ${
|
|
398
|
+
`Duplicate generated frame id: ${c}.`
|
|
397
399
|
)
|
|
398
400
|
);
|
|
399
|
-
for (const
|
|
400
|
-
(
|
|
401
|
+
for (const g of i)
|
|
402
|
+
(u = g.title) != null && u.trim() || t.push(M("missing_card_title", "Card title is required.", g.id)), g.type === "custom" && t.push(
|
|
401
403
|
M(
|
|
402
404
|
"custom_visual_out_of_scope",
|
|
403
405
|
"Whole-dashboard authoring supports built-in visual types only.",
|
|
404
|
-
|
|
406
|
+
g.id
|
|
405
407
|
)
|
|
406
|
-
),
|
|
408
|
+
), g.type !== "text" && !g.analyticsIntent && o.push(
|
|
407
409
|
M(
|
|
408
410
|
"missing_analytics_intent",
|
|
409
411
|
"Non-text card has no analytics intent and may be skipped by the app layer.",
|
|
410
|
-
|
|
412
|
+
g.id
|
|
411
413
|
)
|
|
412
|
-
),
|
|
413
|
-
const
|
|
414
|
-
|
|
414
|
+
), Uo({ card: g, datasets: n, errors: t }), Qo({ card: g, errors: t }), zo({ card: g, datasets: n, errors: t }), Wo({ card: g, errors: t });
|
|
415
|
+
const p = Array.isArray(a.filterInputs) ? a.filterInputs : [], _ = p.map((g) => g.id), b = Te(_);
|
|
416
|
+
b && t.push(
|
|
415
417
|
M(
|
|
416
418
|
"duplicate_input_id",
|
|
417
|
-
`Duplicate dashboard input id: ${
|
|
419
|
+
`Duplicate dashboard input id: ${b}.`
|
|
418
420
|
)
|
|
419
421
|
);
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
+
const v = p.map((g) => g.variableName).filter(Boolean) || [], m = Te(v);
|
|
423
|
+
m && t.push(
|
|
422
424
|
M(
|
|
423
425
|
"duplicate_input_variable",
|
|
424
|
-
`Duplicate dashboard input variable name: ${
|
|
426
|
+
`Duplicate dashboard input variable name: ${m}.`
|
|
425
427
|
)
|
|
426
428
|
);
|
|
427
|
-
for (const
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
for (const
|
|
431
|
-
|
|
429
|
+
for (const g of p)
|
|
430
|
+
Yo({ input: g, errors: t });
|
|
431
|
+
const f = Array.isArray(a.calculatedFields) ? a.calculatedFields : [];
|
|
432
|
+
for (const g of f)
|
|
433
|
+
g.scope === "domain" && g.reuseOnly !== !0 && t.push(
|
|
432
434
|
M(
|
|
433
435
|
"domain_calculated_field_create_out_of_scope",
|
|
434
|
-
`Creating domain calculated field "${
|
|
436
|
+
`Creating domain calculated field "${g.name}" is outside MVP.`
|
|
435
437
|
)
|
|
436
438
|
);
|
|
437
|
-
return { ok: t.length === 0, errors: t, warnings:
|
|
439
|
+
return { ok: t.length === 0, errors: t, warnings: o };
|
|
438
440
|
}
|
|
439
|
-
function
|
|
440
|
-
const t =
|
|
441
|
+
function Xo(e) {
|
|
442
|
+
const t = Ut(e);
|
|
441
443
|
return t === "datetime" ? "date" : t === "unknown" ? "string" : t;
|
|
442
444
|
}
|
|
443
|
-
function
|
|
445
|
+
function Zo(e) {
|
|
444
446
|
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
445
447
|
}
|
|
446
|
-
function
|
|
447
|
-
return
|
|
448
|
+
function en(e) {
|
|
449
|
+
return Zo(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
|
|
448
450
|
}
|
|
449
|
-
function
|
|
451
|
+
function tn(e) {
|
|
450
452
|
return e.filter(
|
|
451
453
|
(t) => typeof t == "string" || typeof t == "number"
|
|
452
454
|
);
|
|
453
455
|
}
|
|
454
|
-
function
|
|
456
|
+
function an(e) {
|
|
455
457
|
return e.filter(
|
|
456
458
|
(t) => t instanceof Date || typeof t == "string"
|
|
457
459
|
);
|
|
458
460
|
}
|
|
459
|
-
function
|
|
461
|
+
function Yt(e, t) {
|
|
460
462
|
if (t === void 0)
|
|
461
463
|
return;
|
|
462
|
-
const a =
|
|
463
|
-
if (
|
|
464
|
-
return
|
|
464
|
+
const a = Xo(e.dataType), o = e.operation || "in";
|
|
465
|
+
if (en(t))
|
|
466
|
+
return Ve({
|
|
465
467
|
definition: e,
|
|
466
468
|
sourceValue: t,
|
|
467
469
|
value: {
|
|
@@ -474,13 +476,13 @@ function Tt(e, t) {
|
|
|
474
476
|
semanticContext: e.semanticContext
|
|
475
477
|
}
|
|
476
478
|
});
|
|
477
|
-
if (
|
|
478
|
-
return
|
|
479
|
+
if (o === "is null" || o === "is not null")
|
|
480
|
+
return Ve({
|
|
479
481
|
definition: e,
|
|
480
482
|
value: {
|
|
481
483
|
filterId: e.id,
|
|
482
484
|
name: e.column,
|
|
483
|
-
operation:
|
|
485
|
+
operation: o,
|
|
484
486
|
valueType: a,
|
|
485
487
|
values: [],
|
|
486
488
|
dataType: e.dataType,
|
|
@@ -488,42 +490,42 @@ function Tt(e, t) {
|
|
|
488
490
|
semanticContext: e.semanticContext
|
|
489
491
|
}
|
|
490
492
|
});
|
|
491
|
-
const
|
|
492
|
-
if (
|
|
493
|
-
return
|
|
493
|
+
const n = Array.isArray(t) ? t : [t], r = a === "date" ? an(n) : tn(n);
|
|
494
|
+
if (r.length !== 0 && !((o === "between" || o === "not between") && r.length < 2))
|
|
495
|
+
return Ve({
|
|
494
496
|
definition: e,
|
|
495
497
|
value: {
|
|
496
498
|
filterId: e.id,
|
|
497
499
|
name: e.column,
|
|
498
|
-
operation:
|
|
500
|
+
operation: o,
|
|
499
501
|
valueType: a,
|
|
500
|
-
values:
|
|
502
|
+
values: r,
|
|
501
503
|
dataType: e.dataType,
|
|
502
504
|
fieldMeta: e.fieldMeta,
|
|
503
505
|
semanticContext: e.semanticContext
|
|
504
506
|
}
|
|
505
507
|
});
|
|
506
508
|
}
|
|
507
|
-
function
|
|
509
|
+
function Wt(e, t, a) {
|
|
508
510
|
return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
|
|
509
511
|
}
|
|
510
|
-
function
|
|
511
|
-
const
|
|
512
|
-
(
|
|
513
|
-
).map((
|
|
514
|
-
return
|
|
512
|
+
function on(e, t, a) {
|
|
513
|
+
const o = (t || []).filter(
|
|
514
|
+
(n) => n.scope === "card" && n.targetCardId === a
|
|
515
|
+
).map((n) => n.field).filter(Boolean);
|
|
516
|
+
return o.length === 0 ? e : {
|
|
515
517
|
...e,
|
|
516
518
|
calculatedFields: [
|
|
517
519
|
...e.calculatedFields || [],
|
|
518
|
-
...
|
|
520
|
+
...o
|
|
519
521
|
]
|
|
520
522
|
};
|
|
521
523
|
}
|
|
522
|
-
function
|
|
524
|
+
function nn(e, t, a) {
|
|
523
525
|
return t.clickToFilter === void 0 && t.respondsToSelections === void 0 ? e : {
|
|
524
526
|
...e,
|
|
525
527
|
...t.clickToFilter ? {
|
|
526
|
-
clickToFilter:
|
|
528
|
+
clickToFilter: ha(
|
|
527
529
|
t.clickToFilter,
|
|
528
530
|
{ cardIds: Object.fromEntries(a) }
|
|
529
531
|
)
|
|
@@ -531,111 +533,111 @@ function hs(e, t, a) {
|
|
|
531
533
|
...t.respondsToSelections !== void 0 ? { respondsToSelections: t.respondsToSelections } : {}
|
|
532
534
|
};
|
|
533
535
|
}
|
|
534
|
-
function
|
|
536
|
+
function sn(e, t) {
|
|
535
537
|
if (!e) return e;
|
|
536
|
-
const a =
|
|
538
|
+
const a = ga(e, {
|
|
537
539
|
renamedCardIds: t,
|
|
538
540
|
keepOnlyRenamedCardIds: !0
|
|
539
541
|
});
|
|
540
|
-
return
|
|
542
|
+
return ba(a) ? null : a;
|
|
541
543
|
}
|
|
542
|
-
function
|
|
543
|
-
const a = {},
|
|
544
|
+
function rn(e, t) {
|
|
545
|
+
const a = {}, o = [];
|
|
544
546
|
return {
|
|
545
547
|
inputs: (e.filterInputs || []).flatMap(
|
|
546
|
-
(
|
|
547
|
-
const
|
|
548
|
-
if (
|
|
549
|
-
return
|
|
550
|
-
|
|
548
|
+
(r, s) => {
|
|
549
|
+
const i = sn(r.scope, t);
|
|
550
|
+
if (i === null)
|
|
551
|
+
return o.push(
|
|
552
|
+
Wt(
|
|
551
553
|
"filter_input_scope_empty",
|
|
552
|
-
`Filter input "${
|
|
554
|
+
`Filter input "${r.label}" was skipped because all scoped cards or tabs were skipped during query validation.`
|
|
553
555
|
)
|
|
554
556
|
), [];
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
|
|
557
|
+
const d = Yt(
|
|
558
|
+
r.filter,
|
|
559
|
+
r.defaultValue
|
|
558
560
|
);
|
|
559
|
-
return
|
|
561
|
+
return d && (a.shared ?? (a.shared = {}), a.shared[r.id] = {
|
|
560
562
|
status: "set",
|
|
561
563
|
value: {
|
|
562
564
|
kind: "filter",
|
|
563
|
-
filterValue:
|
|
565
|
+
filterValue: d
|
|
564
566
|
}
|
|
565
567
|
}), [
|
|
566
568
|
{
|
|
567
|
-
id:
|
|
569
|
+
id: r.id,
|
|
568
570
|
kind: "filter",
|
|
569
|
-
label:
|
|
570
|
-
variableName:
|
|
571
|
-
scope:
|
|
571
|
+
label: r.label,
|
|
572
|
+
variableName: r.variableName,
|
|
573
|
+
scope: i || { kind: "allSheets", sheetKinds: ["dashboard"] },
|
|
572
574
|
runtimeScope: "shared",
|
|
573
575
|
presentation: {
|
|
574
576
|
placement: "toolbar",
|
|
575
|
-
order:
|
|
577
|
+
order: s
|
|
576
578
|
},
|
|
577
579
|
exports: ["label", "value", "start", "end", "range"],
|
|
578
580
|
// Reach is the scope (S-1): a filter definition stores none.
|
|
579
|
-
filter:
|
|
581
|
+
filter: pa(r.filter)
|
|
580
582
|
}
|
|
581
583
|
];
|
|
582
584
|
}
|
|
583
585
|
),
|
|
584
|
-
warnings:
|
|
586
|
+
warnings: o,
|
|
585
587
|
defaultInputValues: a.shared && Object.keys(a.shared).length > 0 ? a : void 0
|
|
586
588
|
};
|
|
587
589
|
}
|
|
588
|
-
function
|
|
589
|
-
var
|
|
590
|
-
const t =
|
|
590
|
+
function Vs(e) {
|
|
591
|
+
var f, S;
|
|
592
|
+
const t = Jo(e.plan);
|
|
591
593
|
if (!t.ok)
|
|
592
594
|
throw new Error(
|
|
593
|
-
t.errors.map((
|
|
595
|
+
t.errors.map((u) => u.message).join(`
|
|
594
596
|
`) || "Dashboard plan is invalid."
|
|
595
597
|
);
|
|
596
|
-
const a = e.plan.sheets[0],
|
|
597
|
-
e.cardArtifacts.map((
|
|
598
|
-
),
|
|
599
|
-
e.cardArtifacts.map((
|
|
600
|
-
|
|
601
|
-
|
|
598
|
+
const a = e.plan.sheets[0], o = [...t.warnings], n = [], r = new Map(
|
|
599
|
+
e.cardArtifacts.map((u) => [u.planCardId, u])
|
|
600
|
+
), s = new Map(
|
|
601
|
+
e.cardArtifacts.map((u) => [
|
|
602
|
+
u.planCardId,
|
|
603
|
+
u.card.id
|
|
602
604
|
])
|
|
603
|
-
),
|
|
604
|
-
for (const
|
|
605
|
-
const
|
|
606
|
-
if (!
|
|
607
|
-
const
|
|
605
|
+
), i = [];
|
|
606
|
+
for (const u of a.cards) {
|
|
607
|
+
const g = r.get(u.id);
|
|
608
|
+
if (!g) {
|
|
609
|
+
const $ = Wt(
|
|
608
610
|
"missing_card_artifact",
|
|
609
|
-
`Card "${
|
|
610
|
-
|
|
611
|
+
`Card "${u.title}" was skipped because no generated artifact was supplied.`,
|
|
612
|
+
u.id
|
|
611
613
|
);
|
|
612
|
-
|
|
614
|
+
n.push($);
|
|
613
615
|
continue;
|
|
614
616
|
}
|
|
615
|
-
|
|
616
|
-
const F =
|
|
617
|
-
|
|
618
|
-
|
|
617
|
+
o.push(...g.warnings || []);
|
|
618
|
+
const F = nn(
|
|
619
|
+
on(
|
|
620
|
+
g.card,
|
|
619
621
|
e.plan.calculatedFields,
|
|
620
|
-
|
|
622
|
+
u.id
|
|
621
623
|
),
|
|
622
|
-
|
|
623
|
-
|
|
624
|
+
u,
|
|
625
|
+
s
|
|
624
626
|
);
|
|
625
|
-
|
|
626
|
-
id:
|
|
627
|
+
i.push({
|
|
628
|
+
id: u.frameId,
|
|
627
629
|
cards: [F],
|
|
628
630
|
activeCardId: F.id
|
|
629
631
|
});
|
|
630
632
|
}
|
|
631
|
-
if (
|
|
633
|
+
if (i.length === 0)
|
|
632
634
|
throw new Error("Dashboard plan did not produce any persistable cards.");
|
|
633
|
-
const { inputs:
|
|
634
|
-
|
|
635
|
-
const
|
|
636
|
-
(
|
|
637
|
-
).map(({ frame:
|
|
638
|
-
if (
|
|
635
|
+
const { inputs: d, defaultInputValues: c, warnings: p } = rn(e.plan, s);
|
|
636
|
+
o.push(...p);
|
|
637
|
+
const _ = new Map(a.cards.map((u) => [u.frameId, u.priority])), b = i.map((u, g) => ({ frame: u, index: g })).sort(
|
|
638
|
+
(u, g) => (_.get(u.frame.id) ?? 0) - (_.get(g.frame.id) ?? 0) || u.index - g.index
|
|
639
|
+
).map(({ frame: u }) => u), v = Co({ id: a.id, frames: b, layouts: void 0 }, { kind: "arrange" });
|
|
640
|
+
if (!v.ok) throw new Error(v.failure.message);
|
|
639
641
|
return { dashboard: {
|
|
640
642
|
id: e.dashboardId,
|
|
641
643
|
title: e.plan.title,
|
|
@@ -649,151 +651,151 @@ function li(e) {
|
|
|
649
651
|
kind: "dashboard",
|
|
650
652
|
title: a.title,
|
|
651
653
|
description: a.description,
|
|
652
|
-
frames:
|
|
653
|
-
layouts:
|
|
654
|
-
customizedBreakpoints:
|
|
655
|
-
calculatedFields: (
|
|
654
|
+
frames: v.frames,
|
|
655
|
+
layouts: v.layouts,
|
|
656
|
+
customizedBreakpoints: v.customizedBreakpoints,
|
|
657
|
+
calculatedFields: (f = e.plan.calculatedFields) == null ? void 0 : f.filter((u) => u.scope === "sheet" && u.field).map((u) => u.field)
|
|
656
658
|
}
|
|
657
659
|
],
|
|
658
|
-
calculatedFields: (
|
|
659
|
-
inputs:
|
|
660
|
-
...
|
|
661
|
-
}, warnings:
|
|
660
|
+
calculatedFields: (S = e.plan.calculatedFields) == null ? void 0 : S.filter((u) => u.scope === "dashboard" && u.field).map((u) => u.field),
|
|
661
|
+
inputs: d,
|
|
662
|
+
...c ? { defaultInputValues: c } : {}
|
|
663
|
+
}, warnings: o, skippedOperations: n };
|
|
662
664
|
}
|
|
663
|
-
function
|
|
665
|
+
function X(e, t, a) {
|
|
664
666
|
return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
|
|
665
667
|
}
|
|
666
|
-
function
|
|
668
|
+
function _e(e, t) {
|
|
667
669
|
return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || t;
|
|
668
670
|
}
|
|
669
|
-
function
|
|
671
|
+
function Jt(e, t) {
|
|
670
672
|
if (!t.has(e))
|
|
671
673
|
return t.add(e), e;
|
|
672
|
-
let a = 2,
|
|
673
|
-
for (; t.has(
|
|
674
|
-
a += 1,
|
|
675
|
-
return t.add(
|
|
674
|
+
let a = 2, o = `${e}-${a}`;
|
|
675
|
+
for (; t.has(o); )
|
|
676
|
+
a += 1, o = `${e}-${a}`;
|
|
677
|
+
return t.add(o), o;
|
|
676
678
|
}
|
|
677
|
-
function
|
|
679
|
+
function we(e) {
|
|
678
680
|
return !!(e && typeof e == "object");
|
|
679
681
|
}
|
|
680
|
-
function
|
|
682
|
+
function Xt(e) {
|
|
681
683
|
return Array.isArray(e.inputs) ? e.inputs.filter(
|
|
682
|
-
(t) =>
|
|
684
|
+
(t) => we(t) && typeof t.id == "string"
|
|
683
685
|
) : [];
|
|
684
686
|
}
|
|
685
|
-
function
|
|
687
|
+
function nt(e) {
|
|
686
688
|
return Array.isArray(e.sections) ? e.sections.filter(
|
|
687
|
-
(t) =>
|
|
689
|
+
(t) => we(t)
|
|
688
690
|
) : [];
|
|
689
691
|
}
|
|
690
|
-
function
|
|
692
|
+
function st(e) {
|
|
691
693
|
return Array.isArray(e.views) ? e.views.filter(
|
|
692
|
-
(t) =>
|
|
694
|
+
(t) => we(t)
|
|
693
695
|
) : [];
|
|
694
696
|
}
|
|
695
|
-
function
|
|
697
|
+
function re(e) {
|
|
696
698
|
if (!Array.isArray(e))
|
|
697
699
|
return [];
|
|
698
700
|
const t = [];
|
|
699
701
|
for (const a of e) {
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
+
const o = oe(a);
|
|
703
|
+
o && t.push(o);
|
|
702
704
|
}
|
|
703
705
|
return t;
|
|
704
706
|
}
|
|
705
|
-
function
|
|
706
|
-
var
|
|
707
|
+
function dn(e) {
|
|
708
|
+
var o, n, r;
|
|
707
709
|
if (!e)
|
|
708
710
|
return [];
|
|
709
711
|
const t = [];
|
|
710
|
-
if (
|
|
711
|
-
t.push(...
|
|
712
|
-
const
|
|
713
|
-
|
|
714
|
-
...
|
|
715
|
-
(
|
|
712
|
+
if ($e(e.source) && t.push(e.source), e.kind === "metric") {
|
|
713
|
+
t.push(...re(e.measures));
|
|
714
|
+
const s = oe(e.dateField);
|
|
715
|
+
s && t.push(s), t.push(...re(e.dimensions)), t.push(
|
|
716
|
+
...re(
|
|
717
|
+
(o = e.filters) == null ? void 0 : o.map((i) => i.field)
|
|
716
718
|
)
|
|
717
719
|
);
|
|
718
720
|
} else if (e.kind === "records") {
|
|
719
|
-
const
|
|
720
|
-
|
|
721
|
-
...
|
|
722
|
-
(
|
|
721
|
+
const s = oe(e.dateField);
|
|
722
|
+
s && t.push(s), t.push(...re(e.fields)), t.push(
|
|
723
|
+
...re(
|
|
724
|
+
(n = e.filters) == null ? void 0 : n.map((i) => i.field)
|
|
723
725
|
)
|
|
724
726
|
);
|
|
725
|
-
} else e.kind === "inputOptions" ? (((
|
|
726
|
-
...
|
|
727
|
+
} else e.kind === "inputOptions" ? (((r = e.population) == null ? void 0 : r.kind) === "related_population" && $e(e.population.baseSource) && t.push(e.population.baseSource), t.push(
|
|
728
|
+
...re([
|
|
727
729
|
e.labelField,
|
|
728
730
|
e.valueField,
|
|
729
731
|
e.searchField,
|
|
730
732
|
...e.disambiguationFields || []
|
|
731
|
-
].filter((
|
|
732
|
-
)) : e.kind === "sql" && t.push(...
|
|
733
|
+
].filter((s) => !!s))
|
|
734
|
+
)) : e.kind === "sql" && t.push(...re(e.fields));
|
|
733
735
|
const a = "inputs" in e && Array.isArray(e.inputs) ? e.inputs : [];
|
|
734
|
-
for (const
|
|
735
|
-
const
|
|
736
|
-
|
|
736
|
+
for (const s of a) {
|
|
737
|
+
const i = oe(s.field);
|
|
738
|
+
i && t.push(i);
|
|
737
739
|
}
|
|
738
740
|
return t;
|
|
739
741
|
}
|
|
740
|
-
function
|
|
742
|
+
function cn(e) {
|
|
741
743
|
const t = [];
|
|
742
|
-
for (const a of
|
|
743
|
-
const
|
|
744
|
-
|
|
744
|
+
for (const a of Xt(e)) {
|
|
745
|
+
const o = oe(a.field);
|
|
746
|
+
o && t.push(o);
|
|
745
747
|
}
|
|
746
|
-
for (const a of
|
|
747
|
-
for (const
|
|
748
|
-
t.push(...
|
|
748
|
+
for (const a of nt(e))
|
|
749
|
+
for (const o of st(a))
|
|
750
|
+
t.push(...dn(o.analytics));
|
|
749
751
|
return t;
|
|
750
752
|
}
|
|
751
|
-
function
|
|
753
|
+
function ln(e) {
|
|
752
754
|
var a;
|
|
753
755
|
const t = [];
|
|
754
|
-
for (const
|
|
755
|
-
for (const
|
|
756
|
-
|
|
756
|
+
for (const o of nt(e))
|
|
757
|
+
for (const n of st(o))
|
|
758
|
+
$e((a = n.analytics) == null ? void 0 : a.source) && t.push(n.analytics.source);
|
|
757
759
|
return t;
|
|
758
760
|
}
|
|
759
|
-
function
|
|
760
|
-
const a =
|
|
761
|
+
function un(e, t) {
|
|
762
|
+
const a = Ee(e).filter($e);
|
|
761
763
|
if (a.length === 0)
|
|
762
764
|
return t.push(
|
|
763
|
-
|
|
765
|
+
X(
|
|
764
766
|
"missing_materializable_dataset",
|
|
765
767
|
"No semantic or physical source could be converted into the current dashboard authoring dataset reference."
|
|
766
768
|
)
|
|
767
769
|
), [];
|
|
768
|
-
const
|
|
770
|
+
const o = a.every((r) => r.kind === "semantic"), n = Array.from(
|
|
769
771
|
new Set(
|
|
770
|
-
a.filter((
|
|
772
|
+
a.filter((r) => r.kind === "semantic").map((r) => r.domainId)
|
|
771
773
|
)
|
|
772
774
|
);
|
|
773
|
-
return a.length > 1 && (!
|
|
774
|
-
|
|
775
|
+
return a.length > 1 && (!o || n.length !== 1) ? (t.push(
|
|
776
|
+
X(
|
|
775
777
|
"multiple_datasets_out_of_scope",
|
|
776
778
|
"The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest."
|
|
777
779
|
)
|
|
778
780
|
), [a[0]]) : a;
|
|
779
781
|
}
|
|
780
|
-
function
|
|
781
|
-
const a =
|
|
782
|
-
|
|
782
|
+
function fn(e, t) {
|
|
783
|
+
const a = nt(e), o = Xt(e), n = Ee(cn(e)), r = Ee(
|
|
784
|
+
ln(e)
|
|
783
785
|
);
|
|
784
786
|
return {
|
|
785
787
|
sections: a,
|
|
786
|
-
inputs:
|
|
787
|
-
sources:
|
|
788
|
-
primarySources:
|
|
789
|
-
defaultSource:
|
|
790
|
-
datasets:
|
|
788
|
+
inputs: o,
|
|
789
|
+
sources: n,
|
|
790
|
+
primarySources: r,
|
|
791
|
+
defaultSource: r.length === 1 ? r[0] : void 0,
|
|
792
|
+
datasets: un(n, t)
|
|
791
793
|
};
|
|
792
794
|
}
|
|
793
|
-
function
|
|
794
|
-
return e &&
|
|
795
|
+
function mn(e) {
|
|
796
|
+
return e && Kt(e).ok ? e : void 0;
|
|
795
797
|
}
|
|
796
|
-
function
|
|
798
|
+
function hn(e) {
|
|
797
799
|
var t;
|
|
798
800
|
switch ((t = e.presentation) == null ? void 0 : t.kind) {
|
|
799
801
|
case "kpi":
|
|
@@ -812,12 +814,12 @@ function Cs(e) {
|
|
|
812
814
|
return null;
|
|
813
815
|
}
|
|
814
816
|
}
|
|
815
|
-
function
|
|
816
|
-
var t, a,
|
|
817
|
-
return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((a = e.presentation) == null ? void 0 : a.kind) === "table" ? "table" : ((
|
|
817
|
+
function pn(e) {
|
|
818
|
+
var t, a, o;
|
|
819
|
+
return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((a = e.presentation) == null ? void 0 : a.kind) === "table" ? "table" : ((o = e.presentation) == null ? void 0 : o.kind) === "text" ? "text" : "chart";
|
|
818
820
|
}
|
|
819
|
-
function
|
|
820
|
-
const t =
|
|
821
|
+
function gn(e) {
|
|
822
|
+
const t = So(e);
|
|
821
823
|
switch (t) {
|
|
822
824
|
case "not_in":
|
|
823
825
|
return "not in";
|
|
@@ -831,77 +833,77 @@ function vs(e) {
|
|
|
831
833
|
return t || "in";
|
|
832
834
|
}
|
|
833
835
|
}
|
|
834
|
-
function
|
|
835
|
-
return
|
|
836
|
+
function bn(e) {
|
|
837
|
+
return we(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
|
|
836
838
|
}
|
|
837
|
-
function
|
|
839
|
+
function yn(e) {
|
|
838
840
|
if (!(!e || e.kind !== "physical"))
|
|
839
841
|
return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
|
|
840
842
|
}
|
|
841
|
-
function
|
|
843
|
+
function In(e, t, a, o, n, r) {
|
|
842
844
|
if (e.kind !== "filter")
|
|
843
|
-
return
|
|
844
|
-
|
|
845
|
+
return r.push(
|
|
846
|
+
X(
|
|
845
847
|
"control_inputs_deferred",
|
|
846
848
|
`Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`
|
|
847
849
|
)
|
|
848
850
|
), null;
|
|
849
|
-
if (!
|
|
850
|
-
return
|
|
851
|
-
|
|
851
|
+
if (!we(e.field) || typeof e.field.name != "string")
|
|
852
|
+
return r.push(
|
|
853
|
+
X(
|
|
852
854
|
"filter_requires_field",
|
|
853
855
|
`Filter "${e.label || e.id}" needs a field before the dashboard compiler can materialize it.`
|
|
854
856
|
)
|
|
855
857
|
), null;
|
|
856
|
-
const
|
|
858
|
+
const s = No({
|
|
857
859
|
explicitSource: void 0,
|
|
858
860
|
field: e.field,
|
|
859
861
|
defaultSource: t,
|
|
860
862
|
fallbackSources: a
|
|
861
|
-
}),
|
|
862
|
-
if (!
|
|
863
|
-
return
|
|
864
|
-
|
|
863
|
+
}), i = (s == null ? void 0 : s.kind) === "semantic" || (s == null ? void 0 : s.kind) === "physical" ? s.connectionId : void 0;
|
|
864
|
+
if (!i)
|
|
865
|
+
return r.push(
|
|
866
|
+
X(
|
|
865
867
|
"filter_requires_connection_id",
|
|
866
868
|
`Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`
|
|
867
869
|
)
|
|
868
870
|
), null;
|
|
869
|
-
const
|
|
870
|
-
id: `filter-${
|
|
871
|
-
|
|
872
|
-
|
|
871
|
+
const p = {
|
|
872
|
+
id: `filter-${Jt(
|
|
873
|
+
_e(e.id, e.field.name),
|
|
874
|
+
n
|
|
873
875
|
)}`,
|
|
874
876
|
variableName: e.id,
|
|
875
|
-
connectionId:
|
|
877
|
+
connectionId: i,
|
|
876
878
|
title: e.label,
|
|
877
879
|
column: e.field.name,
|
|
878
|
-
dataType:
|
|
879
|
-
qualifiedTableName:
|
|
880
|
+
dataType: bn(e),
|
|
881
|
+
qualifiedTableName: yn(s),
|
|
880
882
|
sql: "",
|
|
881
|
-
operation:
|
|
883
|
+
operation: gn(e.operator),
|
|
882
884
|
type: e.multi === !1 ? "single" : "multiple",
|
|
883
885
|
location: "dashboard",
|
|
884
|
-
fieldMeta: (
|
|
886
|
+
fieldMeta: (s == null ? void 0 : s.kind) === "semantic" ? {
|
|
885
887
|
name: e.field.name,
|
|
886
888
|
qualifiedFieldName: e.field.name,
|
|
887
889
|
dataType: e.field.dataType,
|
|
888
890
|
role: e.field.role === "measure" ? "metric" : "groupby"
|
|
889
891
|
} : void 0,
|
|
890
|
-
semanticContext: (
|
|
891
|
-
semanticDomainId:
|
|
892
|
-
connectionId:
|
|
893
|
-
} : (
|
|
894
|
-
connectionId:
|
|
895
|
-
connectionType:
|
|
892
|
+
semanticContext: (s == null ? void 0 : s.kind) === "semantic" ? {
|
|
893
|
+
semanticDomainId: s.domainId,
|
|
894
|
+
connectionId: s.connectionId
|
|
895
|
+
} : (s == null ? void 0 : s.kind) === "physical" ? {
|
|
896
|
+
connectionId: s.connectionId,
|
|
897
|
+
connectionType: s.connectionType,
|
|
896
898
|
selectedEntities: [
|
|
897
899
|
{
|
|
898
900
|
type: "table",
|
|
899
|
-
connectionId:
|
|
900
|
-
connectionType:
|
|
901
|
-
dialect:
|
|
902
|
-
database:
|
|
903
|
-
schema:
|
|
904
|
-
name:
|
|
901
|
+
connectionId: s.connectionId,
|
|
902
|
+
connectionType: s.connectionType,
|
|
903
|
+
dialect: s.dialect,
|
|
904
|
+
database: s.databaseName,
|
|
905
|
+
schema: s.schemaName,
|
|
906
|
+
name: s.tableName
|
|
905
907
|
}
|
|
906
908
|
]
|
|
907
909
|
} : void 0
|
|
@@ -910,38 +912,38 @@ function Ts(e, t, a, s, r, n) {
|
|
|
910
912
|
id: e.id,
|
|
911
913
|
label: e.label,
|
|
912
914
|
variableName: e.id,
|
|
913
|
-
scope:
|
|
914
|
-
filter:
|
|
915
|
-
defaultValue:
|
|
916
|
-
|
|
915
|
+
scope: o,
|
|
916
|
+
filter: p,
|
|
917
|
+
defaultValue: Yt(
|
|
918
|
+
p,
|
|
917
919
|
e.defaultValue
|
|
918
920
|
)
|
|
919
921
|
};
|
|
920
922
|
}
|
|
921
|
-
function
|
|
923
|
+
function Ue(e) {
|
|
922
924
|
const t = [], a = [];
|
|
923
|
-
for (const
|
|
924
|
-
const
|
|
925
|
-
|
|
925
|
+
for (const o of e.viewIds) {
|
|
926
|
+
const n = e.viewIdToCardId.get(o);
|
|
927
|
+
n ? t.push(n) : a.push(o);
|
|
926
928
|
}
|
|
927
929
|
return a.length > 0 && e.warnings.push(
|
|
928
|
-
|
|
930
|
+
X(
|
|
929
931
|
"input_scope_view_not_found",
|
|
930
932
|
`Filter "${e.inputLabel}" referenced unknown view ids: ${a.join(", ")}.`
|
|
931
933
|
)
|
|
932
934
|
), Array.from(new Set(t));
|
|
933
935
|
}
|
|
934
|
-
function
|
|
935
|
-
var
|
|
936
|
+
function _n(e) {
|
|
937
|
+
var o, n;
|
|
936
938
|
if (!e.protocolScope) {
|
|
937
|
-
const
|
|
938
|
-
return
|
|
939
|
+
const r = Array.from(new Set(e.boundCardIds));
|
|
940
|
+
return r.length > 0 && r.length < e.allCardIds.length ? { kind: "cards", cardIds: r } : void 0;
|
|
939
941
|
}
|
|
940
942
|
if (e.protocolScope.level === "dashboard") {
|
|
941
|
-
if (!((
|
|
943
|
+
if (!((o = e.protocolScope.excludeViewIds) != null && o.length))
|
|
942
944
|
return;
|
|
943
|
-
const
|
|
944
|
-
|
|
945
|
+
const r = new Set(
|
|
946
|
+
Ue({
|
|
945
947
|
inputLabel: e.inputLabel,
|
|
946
948
|
viewIds: e.protocolScope.excludeViewIds,
|
|
947
949
|
viewIdToCardId: e.viewIdToCardId,
|
|
@@ -950,35 +952,35 @@ function Ds(e) {
|
|
|
950
952
|
);
|
|
951
953
|
return {
|
|
952
954
|
kind: "cards",
|
|
953
|
-
cardIds: e.allCardIds.filter((
|
|
955
|
+
cardIds: e.allCardIds.filter((s) => !r.has(s))
|
|
954
956
|
};
|
|
955
957
|
}
|
|
956
958
|
if (e.protocolScope.level === "view") {
|
|
957
|
-
const
|
|
959
|
+
const r = Ue({
|
|
958
960
|
inputLabel: e.inputLabel,
|
|
959
961
|
viewIds: e.protocolScope.viewIds,
|
|
960
962
|
viewIdToCardId: e.viewIdToCardId,
|
|
961
963
|
warnings: e.warnings
|
|
962
964
|
});
|
|
963
|
-
return
|
|
964
|
-
|
|
965
|
+
return r.length === 0 ? (e.warnings.push(
|
|
966
|
+
X(
|
|
965
967
|
"input_scope_has_no_materialized_cards",
|
|
966
968
|
`Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`
|
|
967
969
|
)
|
|
968
|
-
), null) : { kind: "cards", cardIds:
|
|
970
|
+
), null) : { kind: "cards", cardIds: r };
|
|
969
971
|
}
|
|
970
972
|
const t = e.sectionIdToCardIds.get(e.protocolScope.sectionId) || [];
|
|
971
973
|
if (t.length === 0)
|
|
972
974
|
return e.warnings.push(
|
|
973
|
-
|
|
975
|
+
X(
|
|
974
976
|
"input_scope_section_not_found",
|
|
975
977
|
`Filter "${e.inputLabel}" was deferred because section "${e.protocolScope.sectionId}" does not match any materialized cards.`
|
|
976
978
|
)
|
|
977
979
|
), null;
|
|
978
|
-
if (!((
|
|
980
|
+
if (!((n = e.protocolScope.excludeViewIds) != null && n.length))
|
|
979
981
|
return { kind: "cards", cardIds: t };
|
|
980
982
|
const a = new Set(
|
|
981
|
-
|
|
983
|
+
Ue({
|
|
982
984
|
inputLabel: e.inputLabel,
|
|
983
985
|
viewIds: e.protocolScope.excludeViewIds,
|
|
984
986
|
viewIdToCardId: e.viewIdToCardId,
|
|
@@ -987,107 +989,107 @@ function Ds(e) {
|
|
|
987
989
|
);
|
|
988
990
|
return {
|
|
989
991
|
kind: "cards",
|
|
990
|
-
cardIds: t.filter((
|
|
992
|
+
cardIds: t.filter((r) => !a.has(r))
|
|
991
993
|
};
|
|
992
994
|
}
|
|
993
|
-
function
|
|
994
|
-
var
|
|
995
|
-
const t = [], a =
|
|
996
|
-
for (const
|
|
997
|
-
t.push(
|
|
998
|
-
for (const
|
|
999
|
-
t.push(
|
|
1000
|
-
const
|
|
1001
|
-
let
|
|
1002
|
-
for (const [
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1005
|
-
for (const [
|
|
1006
|
-
const N =
|
|
1007
|
-
|
|
1008
|
-
`card-${
|
|
995
|
+
function js(e) {
|
|
996
|
+
var v, m, f;
|
|
997
|
+
const t = [], a = fo(e);
|
|
998
|
+
for (const S of a.warnings)
|
|
999
|
+
t.push(X(S.code, S.message));
|
|
1000
|
+
for (const S of a.errors)
|
|
1001
|
+
t.push(X(S.code, S.message));
|
|
1002
|
+
const o = fn(e, t), n = [], r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
|
|
1003
|
+
let p = 0;
|
|
1004
|
+
for (const [S, u] of o.sections.entries()) {
|
|
1005
|
+
const g = typeof u.title == "string" ? u.title : `Section ${S + 1}`, F = u.id || _e(g, `section-${S + 1}`);
|
|
1006
|
+
s.set(F, []);
|
|
1007
|
+
for (const [$, x] of st(u).entries()) {
|
|
1008
|
+
const N = hn(x), k = _e(
|
|
1009
|
+
x.id || `${g}-${x.title || `View ${$ + 1}`}`,
|
|
1010
|
+
`card-${S + 1}-${$ + 1}`
|
|
1009
1011
|
);
|
|
1010
1012
|
if (!N) {
|
|
1011
1013
|
t.push(
|
|
1012
|
-
|
|
1014
|
+
X(
|
|
1013
1015
|
"unsupported_presentation",
|
|
1014
|
-
`Dashboard presentation "${((
|
|
1015
|
-
`card-${
|
|
1016
|
+
`Dashboard presentation "${((v = x.presentation) == null ? void 0 : v.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
|
|
1017
|
+
`card-${k}`
|
|
1016
1018
|
)
|
|
1017
1019
|
);
|
|
1018
1020
|
continue;
|
|
1019
1021
|
}
|
|
1020
|
-
if (((
|
|
1022
|
+
if (((m = x.analytics) == null ? void 0 : m.kind) === "sql") {
|
|
1021
1023
|
t.push(
|
|
1022
|
-
|
|
1024
|
+
X(
|
|
1023
1025
|
"sql_intent_deferred",
|
|
1024
1026
|
"SQL analytics intent is valid protocol, but the current dashboard authoring adapter only materializes semantic and physical config-card intents.",
|
|
1025
|
-
`card-${
|
|
1027
|
+
`card-${k}`
|
|
1026
1028
|
)
|
|
1027
1029
|
);
|
|
1028
1030
|
continue;
|
|
1029
1031
|
}
|
|
1030
|
-
const O =
|
|
1031
|
-
|
|
1032
|
-
const V =
|
|
1033
|
-
for (const
|
|
1034
|
-
const L =
|
|
1035
|
-
L.push(E),
|
|
1032
|
+
const O = Jt(k, d), E = `card-${O}`;
|
|
1033
|
+
x.id && r.set(x.id, E), (f = s.get(F)) == null || f.push(E);
|
|
1034
|
+
const V = x.analytics && "inputs" in x.analytics ? x.analytics.inputs : void 0;
|
|
1035
|
+
for (const W of V || []) {
|
|
1036
|
+
const L = i.get(W.inputId) || [];
|
|
1037
|
+
L.push(E), i.set(W.inputId, L);
|
|
1036
1038
|
}
|
|
1037
|
-
|
|
1039
|
+
n.push({
|
|
1038
1040
|
id: E,
|
|
1039
1041
|
frameId: `frame-${O}`,
|
|
1040
|
-
title:
|
|
1041
|
-
description:
|
|
1042
|
+
title: x.title,
|
|
1043
|
+
description: x.description,
|
|
1042
1044
|
type: N,
|
|
1043
|
-
role:
|
|
1044
|
-
priority:
|
|
1045
|
-
section:
|
|
1046
|
-
analyticsIntent:
|
|
1047
|
-
text:
|
|
1048
|
-
}),
|
|
1045
|
+
role: pn(x),
|
|
1046
|
+
priority: p,
|
|
1047
|
+
section: g,
|
|
1048
|
+
analyticsIntent: mn(x.analytics),
|
|
1049
|
+
text: x.text
|
|
1050
|
+
}), p += 1;
|
|
1049
1051
|
}
|
|
1050
1052
|
}
|
|
1051
|
-
const
|
|
1052
|
-
const
|
|
1053
|
-
protocolScope:
|
|
1054
|
-
inputLabel:
|
|
1055
|
-
allCardIds:
|
|
1056
|
-
boundCardIds:
|
|
1057
|
-
viewIdToCardId:
|
|
1058
|
-
sectionIdToCardIds:
|
|
1053
|
+
const _ = o.inputs.map((S) => {
|
|
1054
|
+
const u = _n({
|
|
1055
|
+
protocolScope: S.scope,
|
|
1056
|
+
inputLabel: S.label,
|
|
1057
|
+
allCardIds: n.map((g) => g.id),
|
|
1058
|
+
boundCardIds: i.get(S.id) || [],
|
|
1059
|
+
viewIdToCardId: r,
|
|
1060
|
+
sectionIdToCardIds: s,
|
|
1059
1061
|
warnings: t
|
|
1060
1062
|
});
|
|
1061
|
-
return
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1063
|
+
return u === null ? null : In(
|
|
1064
|
+
S,
|
|
1065
|
+
o.defaultSource,
|
|
1066
|
+
o.sources,
|
|
1067
|
+
u,
|
|
1065
1068
|
c,
|
|
1066
|
-
b,
|
|
1067
1069
|
t
|
|
1068
1070
|
);
|
|
1069
|
-
}).filter((
|
|
1071
|
+
}).filter((S) => !!S);
|
|
1070
1072
|
return { plan: {
|
|
1071
1073
|
version: 1,
|
|
1072
|
-
id: `plan-${
|
|
1074
|
+
id: `plan-${_e(e.title, "dashboard")}`,
|
|
1073
1075
|
title: e.title,
|
|
1074
1076
|
description: e.description,
|
|
1075
|
-
datasets:
|
|
1077
|
+
datasets: o.datasets,
|
|
1076
1078
|
sheets: [
|
|
1077
1079
|
{
|
|
1078
|
-
id: `sheet-${
|
|
1080
|
+
id: `sheet-${_e(e.title, "dashboard")}`,
|
|
1079
1081
|
title: e.title,
|
|
1080
1082
|
description: e.description,
|
|
1081
1083
|
kind: "dashboard",
|
|
1082
|
-
cards:
|
|
1084
|
+
cards: n
|
|
1083
1085
|
}
|
|
1084
1086
|
],
|
|
1085
|
-
filterInputs:
|
|
1087
|
+
filterInputs: _.length ? _ : void 0,
|
|
1086
1088
|
warnings: t.length ? t : void 0,
|
|
1087
|
-
unresolvedRequests: a.ok ? void 0 : a.errors.map((
|
|
1089
|
+
unresolvedRequests: a.ok ? void 0 : a.errors.map((S) => S.message)
|
|
1088
1090
|
}, warnings: t };
|
|
1089
1091
|
}
|
|
1090
|
-
const
|
|
1092
|
+
const Ks = [
|
|
1091
1093
|
"cardType",
|
|
1092
1094
|
"sql",
|
|
1093
1095
|
"python",
|
|
@@ -1102,958 +1104,958 @@ const ui = [
|
|
|
1102
1104
|
"resolvedPrimaryDateField",
|
|
1103
1105
|
"globalDateComparison",
|
|
1104
1106
|
"calendarContext"
|
|
1105
|
-
],
|
|
1107
|
+
], Us = [
|
|
1106
1108
|
"cardId",
|
|
1107
1109
|
"cardTitle",
|
|
1108
1110
|
"cache_config",
|
|
1109
1111
|
"queryConfig",
|
|
1110
1112
|
"tableConfig"
|
|
1111
1113
|
];
|
|
1112
|
-
class
|
|
1113
|
-
constructor(a,
|
|
1114
|
+
class Z extends Error {
|
|
1115
|
+
constructor(a, o, n) {
|
|
1114
1116
|
super(a);
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
Object.setPrototypeOf(this,
|
|
1117
|
+
Be(this, "field");
|
|
1118
|
+
Be(this, "details");
|
|
1119
|
+
Object.setPrototypeOf(this, Z.prototype), this.name = "CardQueryRequestError", this.field = o, this.details = n;
|
|
1118
1120
|
}
|
|
1119
1121
|
}
|
|
1120
|
-
function
|
|
1122
|
+
function rt(e) {
|
|
1121
1123
|
return e.label ? `${e.label}.` : "";
|
|
1122
1124
|
}
|
|
1123
|
-
function
|
|
1125
|
+
function de(e) {
|
|
1124
1126
|
return !e || typeof e != "object" || Array.isArray(e) ? {} : { ...e };
|
|
1125
1127
|
}
|
|
1126
|
-
function
|
|
1128
|
+
function De(e) {
|
|
1127
1129
|
return typeof e == "string" ? e : "";
|
|
1128
1130
|
}
|
|
1129
|
-
function
|
|
1130
|
-
const a =
|
|
1131
|
+
function Cn(e, t = {}) {
|
|
1132
|
+
const a = de(e), o = rt(t), n = {};
|
|
1131
1133
|
if (a.calendarContext !== void 0) {
|
|
1132
|
-
const
|
|
1133
|
-
if (!
|
|
1134
|
-
throw new
|
|
1135
|
-
`${
|
|
1134
|
+
const s = Ao(a.calendarContext);
|
|
1135
|
+
if (!s.ok)
|
|
1136
|
+
throw new Z(
|
|
1137
|
+
`${o}calendarContext: ${s.issues.map((i) => i.message).join("; ")}`,
|
|
1136
1138
|
"calendarContext",
|
|
1137
|
-
|
|
1139
|
+
s.issues
|
|
1138
1140
|
);
|
|
1139
|
-
|
|
1141
|
+
n.calendarContext = s.value;
|
|
1140
1142
|
}
|
|
1141
|
-
const
|
|
1142
|
-
if (!
|
|
1143
|
-
throw new
|
|
1144
|
-
`${
|
|
1143
|
+
const r = ya(a.resolvedPrimaryDateField);
|
|
1144
|
+
if (!r.ok)
|
|
1145
|
+
throw new Z(
|
|
1146
|
+
`${o}${Ia(r.issues)}`,
|
|
1145
1147
|
"resolvedPrimaryDateField",
|
|
1146
|
-
|
|
1148
|
+
r.issues
|
|
1147
1149
|
);
|
|
1148
|
-
if (a.resolvedPrimaryDateField && (
|
|
1149
|
-
const
|
|
1150
|
-
if (!
|
|
1151
|
-
throw new
|
|
1152
|
-
`${
|
|
1150
|
+
if (a.resolvedPrimaryDateField && (n.resolvedPrimaryDateField = a.resolvedPrimaryDateField), a.globalDateComparison !== void 0) {
|
|
1151
|
+
const s = To(a.globalDateComparison);
|
|
1152
|
+
if (!s.ok)
|
|
1153
|
+
throw new Z(
|
|
1154
|
+
`${o}Invalid globalDateComparison: ${s.errors.map((i) => `${i.path}: ${i.message}`).join("; ")}`,
|
|
1153
1155
|
"globalDateComparison",
|
|
1154
|
-
|
|
1156
|
+
s.errors
|
|
1155
1157
|
);
|
|
1156
|
-
|
|
1158
|
+
n.globalDateComparison = ko(
|
|
1157
1159
|
a.globalDateComparison
|
|
1158
1160
|
);
|
|
1159
1161
|
}
|
|
1160
|
-
return
|
|
1162
|
+
return n;
|
|
1161
1163
|
}
|
|
1162
|
-
function
|
|
1163
|
-
const a =
|
|
1164
|
+
function Gs(e, t = {}) {
|
|
1165
|
+
const a = de(e), o = rt(t), n = {};
|
|
1164
1166
|
if (a.pagination !== void 0) {
|
|
1165
|
-
const
|
|
1166
|
-
if (!Number.isInteger(
|
|
1167
|
-
throw new
|
|
1168
|
-
`${
|
|
1167
|
+
const r = de(a.pagination), s = r.page, i = r.pageSize;
|
|
1168
|
+
if (!Number.isInteger(s) || s < 1 || !Number.isInteger(i) || i < 1)
|
|
1169
|
+
throw new Z(
|
|
1170
|
+
`${o}pagination must name a page and a page size of at least 1`,
|
|
1169
1171
|
"pagination"
|
|
1170
1172
|
);
|
|
1171
|
-
|
|
1173
|
+
n.pagination = { page: s, pageSize: i };
|
|
1172
1174
|
}
|
|
1173
1175
|
if (a.tableTotalsRequest !== void 0) {
|
|
1174
1176
|
if (!a.tableTotalsRequest || typeof a.tableTotalsRequest != "object" || Array.isArray(a.tableTotalsRequest))
|
|
1175
|
-
throw new
|
|
1176
|
-
|
|
1177
|
+
throw new Z(`${o}tableTotalsRequest must be an object`, "tableTotalsRequest");
|
|
1178
|
+
n.tableTotalsRequest = a.tableTotalsRequest;
|
|
1177
1179
|
}
|
|
1178
1180
|
if (a.sourceRowProbe !== void 0) {
|
|
1179
|
-
const
|
|
1180
|
-
if (!Number.isInteger(
|
|
1181
|
-
throw new
|
|
1182
|
-
`${
|
|
1181
|
+
const r = de(a.sourceRowProbe).limit;
|
|
1182
|
+
if (!Number.isInteger(r) || r < 1)
|
|
1183
|
+
throw new Z(
|
|
1184
|
+
`${o}sourceRowProbe must name a limit of at least 1`,
|
|
1183
1185
|
"sourceRowProbe"
|
|
1184
1186
|
);
|
|
1185
|
-
if (
|
|
1186
|
-
throw new
|
|
1187
|
-
`${
|
|
1187
|
+
if (n.pagination)
|
|
1188
|
+
throw new Z(
|
|
1189
|
+
`${o}sourceRowProbe cannot be combined with pagination`,
|
|
1188
1190
|
"sourceRowProbe"
|
|
1189
1191
|
);
|
|
1190
|
-
|
|
1192
|
+
n.sourceRowProbe = { limit: r };
|
|
1191
1193
|
}
|
|
1192
|
-
return
|
|
1194
|
+
return n;
|
|
1193
1195
|
}
|
|
1194
|
-
function
|
|
1195
|
-
const a =
|
|
1196
|
-
if (!
|
|
1197
|
-
const
|
|
1198
|
-
if (!
|
|
1199
|
-
const
|
|
1200
|
-
if (
|
|
1201
|
-
throw
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1204
|
-
if (
|
|
1205
|
-
const
|
|
1206
|
-
hasExecutableConfig:
|
|
1207
|
-
sql:
|
|
1208
|
-
normalizedPython:
|
|
1196
|
+
function zs(e, t = {}) {
|
|
1197
|
+
const a = de(e), o = rt(t), n = (f) => new Z(`${o}${f} is required`, f), r = De(a.connection_id).trim();
|
|
1198
|
+
if (!r) throw n("connection_id");
|
|
1199
|
+
const s = De(a.cardType).trim();
|
|
1200
|
+
if (!s) throw n("cardType");
|
|
1201
|
+
const i = a.resultOwner;
|
|
1202
|
+
if (i !== "config" && i !== "freeform" && i !== "none")
|
|
1203
|
+
throw n("resultOwner");
|
|
1204
|
+
const d = de(a.cardConfig), c = De(a.sql), p = De(a.python), _ = !!t.configOptional || Object.keys(d).length > 0;
|
|
1205
|
+
if (i === "config" && !_) throw n("cardConfig");
|
|
1206
|
+
if (i === "freeform" && !c.trim()) throw n("sql");
|
|
1207
|
+
const b = _a({
|
|
1208
|
+
hasExecutableConfig: _,
|
|
1209
|
+
sql: c,
|
|
1210
|
+
normalizedPython: p
|
|
1209
1211
|
});
|
|
1210
|
-
if (
|
|
1211
|
-
throw new
|
|
1212
|
-
`${
|
|
1212
|
+
if (i !== b)
|
|
1213
|
+
throw new Z(
|
|
1214
|
+
`${o}resultOwner must match the normalized execution owner "${b}"`,
|
|
1213
1215
|
"resultOwner"
|
|
1214
1216
|
);
|
|
1215
|
-
if (
|
|
1216
|
-
const
|
|
1217
|
-
if (Object.keys(
|
|
1218
|
-
const
|
|
1217
|
+
if (i === "none") throw n("cardConfig");
|
|
1218
|
+
const v = de(a.cardDataSource);
|
|
1219
|
+
if (Object.keys(v).length === 0) throw n("cardDataSource");
|
|
1220
|
+
const m = Ca({
|
|
1219
1221
|
controlValues: a.controlValues,
|
|
1220
1222
|
controlDefinitions: a.controlDefinitions,
|
|
1221
1223
|
cardControlDefinitions: a.cardControlDefinitions,
|
|
1222
1224
|
controlBindings: a.controlBindings
|
|
1223
1225
|
});
|
|
1224
1226
|
return {
|
|
1225
|
-
connection_id:
|
|
1226
|
-
cardType:
|
|
1227
|
-
sql:
|
|
1228
|
-
python:
|
|
1229
|
-
resultOwner:
|
|
1230
|
-
cardConfig:
|
|
1231
|
-
cardDataSource:
|
|
1227
|
+
connection_id: r,
|
|
1228
|
+
cardType: s,
|
|
1229
|
+
sql: c,
|
|
1230
|
+
python: p,
|
|
1231
|
+
resultOwner: i,
|
|
1232
|
+
cardConfig: d,
|
|
1233
|
+
cardDataSource: v,
|
|
1232
1234
|
active_filters: Array.isArray(a.active_filters) ? a.active_filters : [],
|
|
1233
|
-
controlValues:
|
|
1234
|
-
controlDefinitions:
|
|
1235
|
-
cardControlDefinitions:
|
|
1236
|
-
controlBindings:
|
|
1237
|
-
...
|
|
1235
|
+
controlValues: m.controlValues,
|
|
1236
|
+
controlDefinitions: m.controlDefinitions,
|
|
1237
|
+
cardControlDefinitions: m.cardControlDefinitions,
|
|
1238
|
+
controlBindings: m.controlBindings,
|
|
1239
|
+
...Cn(a, t)
|
|
1238
1240
|
};
|
|
1239
1241
|
}
|
|
1240
|
-
const
|
|
1242
|
+
const vn = {
|
|
1241
1243
|
global_date: "The date filter for the whole report can't be changed through the MCP. Change it in the editor; removing or excluding it works.",
|
|
1242
1244
|
not_semantic: "This filter reads a database table, not a dataset, so it can't be changed through the MCP. Change it in the editor; removing or excluding it works.",
|
|
1243
1245
|
scope_not_expressible: "This filter applies to chosen cards rather than whole sheets, so it can't be changed through the MCP. Change it in the editor; removing or excluding it works."
|
|
1244
1246
|
};
|
|
1245
|
-
function
|
|
1246
|
-
var
|
|
1247
|
-
const
|
|
1247
|
+
function Sn(e, t, a = {}) {
|
|
1248
|
+
var i;
|
|
1249
|
+
const o = he(e), n = Sa(t.scope), r = new Set(ie(e).map((d) => d.cardId)), s = {
|
|
1248
1250
|
reaches: [],
|
|
1249
1251
|
excluded: [
|
|
1250
1252
|
.../* @__PURE__ */ new Set([
|
|
1251
|
-
...(((
|
|
1252
|
-
...
|
|
1253
|
+
...(((i = t.application) == null ? void 0 : i.cards) ?? []).filter((d) => d.kind === "excluded").map((d) => d.cardId),
|
|
1254
|
+
...n.filter((d) => r.has(d))
|
|
1253
1255
|
])
|
|
1254
1256
|
],
|
|
1255
1257
|
notReached: []
|
|
1256
1258
|
};
|
|
1257
1259
|
if (t.filter.kind === "global-date") {
|
|
1258
|
-
const
|
|
1259
|
-
return
|
|
1260
|
+
const d = new Set(s.excluded);
|
|
1261
|
+
return s.reaches = $a(e, t.filter).filter(({ card: c }) => !d.has(c.id) && ve(c)).map(({ card: c }) => c.id), s;
|
|
1260
1262
|
}
|
|
1261
|
-
for (const
|
|
1262
|
-
const
|
|
1263
|
-
const
|
|
1263
|
+
for (const d of o.reachedCards({ inputId: t.id })) {
|
|
1264
|
+
const c = Oe(t, d.card, a), p = c.reach, _ = () => {
|
|
1265
|
+
const b = ve(d.card);
|
|
1264
1266
|
return {
|
|
1265
|
-
cardId:
|
|
1266
|
-
title:
|
|
1267
|
-
...(
|
|
1267
|
+
cardId: d.cardId,
|
|
1268
|
+
title: d.card.title ?? "",
|
|
1269
|
+
...(b == null ? void 0 : b.kind) === "semantic" ? { datasetName: b.datasetName } : {}
|
|
1268
1270
|
};
|
|
1269
1271
|
};
|
|
1270
|
-
switch (
|
|
1272
|
+
switch (p) {
|
|
1271
1273
|
case "bound":
|
|
1272
1274
|
case "automatic":
|
|
1273
1275
|
case "sql":
|
|
1274
1276
|
case "relationshipApplied":
|
|
1275
|
-
|
|
1277
|
+
s.reaches.push(d.cardId);
|
|
1276
1278
|
break;
|
|
1277
1279
|
case "blocked":
|
|
1278
1280
|
case "ambiguous":
|
|
1279
|
-
(
|
|
1281
|
+
(s.blocked ?? (s.blocked = [])).push({ cardId: d.cardId, title: d.card.title ?? "", reason: p });
|
|
1280
1282
|
break;
|
|
1281
1283
|
case "relationship":
|
|
1282
|
-
(
|
|
1284
|
+
(s.relationshipPending ?? (s.relationshipPending = [])).push(_());
|
|
1283
1285
|
break;
|
|
1284
1286
|
case "excluded":
|
|
1285
1287
|
break;
|
|
1286
1288
|
case "notApplicable":
|
|
1287
|
-
|
|
1289
|
+
ve(d.card) && s.notReached.push({ ..._(), ...c.reason ? { reason: c.reason } : {} });
|
|
1288
1290
|
break;
|
|
1289
1291
|
default: {
|
|
1290
|
-
const
|
|
1291
|
-
throw new Error(`Unhandled filter reach ${String(
|
|
1292
|
+
const b = p;
|
|
1293
|
+
throw new Error(`Unhandled filter reach ${String(b)}`);
|
|
1292
1294
|
}
|
|
1293
1295
|
}
|
|
1294
1296
|
}
|
|
1295
|
-
return
|
|
1297
|
+
return s;
|
|
1296
1298
|
}
|
|
1297
|
-
function
|
|
1298
|
-
var
|
|
1299
|
+
function $n(e, t) {
|
|
1300
|
+
var n;
|
|
1299
1301
|
const a = t.scope;
|
|
1300
1302
|
if (a.kind === "allSheets") {
|
|
1301
|
-
if ((
|
|
1302
|
-
const
|
|
1303
|
+
if ((n = a.sheetKinds) != null && n.length && !a.sheetKinds.includes("dashboard")) return;
|
|
1304
|
+
const r = wa(a);
|
|
1303
1305
|
return {
|
|
1304
1306
|
sheetIds: "all",
|
|
1305
|
-
...
|
|
1306
|
-
...
|
|
1307
|
+
...r.length ? { exceptSheetIds: [...r] } : {},
|
|
1308
|
+
...Fa(a) ? { includesDocumentSheets: !0 } : {}
|
|
1307
1309
|
};
|
|
1308
1310
|
}
|
|
1309
1311
|
if (a.kind !== "sheets") return;
|
|
1310
|
-
const
|
|
1312
|
+
const o = [...Ze(e).values()].filter((r) => Vt(t, r));
|
|
1311
1313
|
return {
|
|
1312
|
-
sheetIds:
|
|
1314
|
+
sheetIds: o.filter((r) => r.sheetKind === "dashboard").map((r) => r.sheetId),
|
|
1313
1315
|
// Document sheets it names stay through a change of sheets (`withUnstatedScopeParts`).
|
|
1314
|
-
...
|
|
1316
|
+
...o.some((r) => r.sheetKind === "document") ? { includesDocumentSheets: !0 } : {}
|
|
1315
1317
|
};
|
|
1316
1318
|
}
|
|
1317
|
-
function
|
|
1319
|
+
function Zt(e, t) {
|
|
1318
1320
|
return e ?? { tz: "UTC", weekStart: 1, anchor: { iso: t ?? "1970-01-01T00:00:00.000Z" } };
|
|
1319
1321
|
}
|
|
1320
|
-
function
|
|
1321
|
-
var
|
|
1322
|
-
const { input:
|
|
1323
|
-
filterId:
|
|
1324
|
-
label:
|
|
1322
|
+
function ea(e, t, a, o) {
|
|
1323
|
+
var f, S, u;
|
|
1324
|
+
const { input: n } = t, r = Sn(e, n, o), s = (g, F) => ({
|
|
1325
|
+
filterId: n.id,
|
|
1326
|
+
label: n.label,
|
|
1325
1327
|
editable: !1,
|
|
1326
1328
|
kind: F,
|
|
1327
|
-
notEditable: { reason:
|
|
1328
|
-
reaches:
|
|
1329
|
-
excluded:
|
|
1330
|
-
...
|
|
1331
|
-
...
|
|
1329
|
+
notEditable: { reason: g, message: vn[g] },
|
|
1330
|
+
reaches: r.reaches,
|
|
1331
|
+
excluded: r.excluded,
|
|
1332
|
+
...r.blocked ? { blocked: r.blocked } : {},
|
|
1333
|
+
...r.relationshipPending ? { relationshipPending: r.relationshipPending } : {}
|
|
1332
1334
|
});
|
|
1333
|
-
if (
|
|
1334
|
-
const
|
|
1335
|
-
if (
|
|
1336
|
-
const
|
|
1337
|
-
if (!
|
|
1338
|
-
const
|
|
1335
|
+
if (n.filter.kind === "global-date") return s("global_date", "global_date");
|
|
1336
|
+
const i = va(n.filter).filter((g) => g.kind === "semantic");
|
|
1337
|
+
if (i.length !== 1 || i[0].kind !== "semantic") return s("not_semantic", "field");
|
|
1338
|
+
const d = $n(e, n);
|
|
1339
|
+
if (!d || t.origin !== "embeddedInput") return s("scope_not_expressible", "field");
|
|
1340
|
+
const c = ((f = n.filter.fieldMeta) == null ? void 0 : f.name) ?? ((S = n.filter.column) == null ? void 0 : S.split(".").pop()) ?? "", p = Bt({
|
|
1339
1341
|
dashboard: e,
|
|
1340
|
-
target: { kind: "dashboardInput", input:
|
|
1341
|
-
calendar:
|
|
1342
|
-
}).value,
|
|
1342
|
+
target: { kind: "dashboardInput", input: n, scope: {} },
|
|
1343
|
+
calendar: Zt(a, void 0)
|
|
1344
|
+
}).value, _ = Gt(n.filter.dataType), b = _ || (u = p == null ? void 0 : p.values) == null ? void 0 : u.filter((g) => ["string", "number", "boolean"].includes(typeof g)), v = p && "relativeMeta" in p ? p.relativeMeta : void 0, m = _ && v ? mo(v) : null;
|
|
1343
1345
|
return {
|
|
1344
|
-
filterId:
|
|
1345
|
-
label:
|
|
1346
|
+
filterId: n.id,
|
|
1347
|
+
label: n.label,
|
|
1346
1348
|
editable: !0,
|
|
1347
|
-
domainId:
|
|
1348
|
-
datasetName:
|
|
1349
|
-
field:
|
|
1350
|
-
selection:
|
|
1351
|
-
...
|
|
1352
|
-
...
|
|
1353
|
-
...
|
|
1354
|
-
...
|
|
1355
|
-
...
|
|
1349
|
+
domainId: i[0].domainId,
|
|
1350
|
+
datasetName: i[0].datasetName,
|
|
1351
|
+
field: c,
|
|
1352
|
+
selection: n.filter.type === "single" ? "single" : "multiple",
|
|
1353
|
+
...b != null && b.length ? { defaultValues: b } : {},
|
|
1354
|
+
...m ? { defaultPeriod: m } : {},
|
|
1355
|
+
..._ ? { datePicker: n.filter.dateSelectionMode === "day" ? "day" : n.filter.dateSelectionMode === "months" ? "month" : "range" } : {},
|
|
1356
|
+
...d,
|
|
1357
|
+
...r
|
|
1356
1358
|
};
|
|
1357
1359
|
}
|
|
1358
|
-
function
|
|
1359
|
-
return
|
|
1360
|
+
function ta(e, t, a) {
|
|
1361
|
+
return he(e).inputs.map((o) => ea(e, o, t, a));
|
|
1360
1362
|
}
|
|
1361
|
-
function
|
|
1362
|
-
const
|
|
1363
|
-
return
|
|
1363
|
+
function Se(e, t, a, o) {
|
|
1364
|
+
const n = he(e).findFilterInput({ inputId: t });
|
|
1365
|
+
return n ? ea(e, n, a, o) : void 0;
|
|
1364
1366
|
}
|
|
1365
|
-
function
|
|
1366
|
-
var
|
|
1367
|
-
const
|
|
1368
|
-
if (!
|
|
1369
|
-
const
|
|
1370
|
-
if ("sql" in t) return
|
|
1371
|
-
const
|
|
1367
|
+
function wn(e, t, a, o, n) {
|
|
1368
|
+
var u, g, F, $, x, N;
|
|
1369
|
+
const r = me(e, { sql: !0 });
|
|
1370
|
+
if (!r.editable) return [r.message];
|
|
1371
|
+
const s = r.query, i = t;
|
|
1372
|
+
if ("sql" in t) return i.sql === s.sql && i.connectionId === s.connectionId ? [] : ["the SQL"];
|
|
1373
|
+
const d = (o == null ? void 0 : o.source.kind) === "semantic" ? me({
|
|
1372
1374
|
id: e.id,
|
|
1373
1375
|
title: e.title,
|
|
1374
|
-
type:
|
|
1375
|
-
dataSource:
|
|
1376
|
-
connectionId:
|
|
1377
|
-
config:
|
|
1376
|
+
type: o.type,
|
|
1377
|
+
dataSource: o.source.dataSource,
|
|
1378
|
+
connectionId: o.source.connectionId,
|
|
1379
|
+
config: o.config
|
|
1378
1380
|
}, { sql: !0 }) : void 0;
|
|
1379
|
-
if (
|
|
1380
|
-
const
|
|
1381
|
-
const V = O ?? [],
|
|
1382
|
-
(V.length !==
|
|
1381
|
+
if (d && !d.editable) return ["the compiled query"];
|
|
1382
|
+
const c = d != null && d.editable ? d.query : void 0, p = String(i.datasetName ?? ""), _ = [], b = (k) => fe(k, p), v = (k, O, E) => {
|
|
1383
|
+
const V = O ?? [], W = E ?? [];
|
|
1384
|
+
(V.length !== W.length || V.some((L, P) => b(L) !== b(W[P]))) && _.push(k);
|
|
1383
1385
|
};
|
|
1384
|
-
for (const
|
|
1385
|
-
if (
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1386
|
+
for (const k of ["domainId", "datasetName"]) i[k] !== s[k] && _.push(k);
|
|
1387
|
+
if (v("measures", i.measures, s.measures), v("columns", i.columns, s.columns), a || r.matrix) {
|
|
1388
|
+
const k = (E) => new Set(((E == null ? void 0 : E.columns) ?? []).map(b)), O = (E, V) => (E ?? []).filter((W) => !k(V).has(b(W)));
|
|
1389
|
+
v("dimensions", O(i.dimensions, a), O(s.dimensions, r.matrix)), v("matrix.columns", a == null ? void 0 : a.columns, (u = r.matrix) == null ? void 0 : u.columns);
|
|
1388
1390
|
} else
|
|
1389
|
-
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1392
|
-
const
|
|
1393
|
-
(
|
|
1394
|
-
const E =
|
|
1395
|
-
E &&
|
|
1391
|
+
v("dimensions", i.dimensions, s.dimensions);
|
|
1392
|
+
const m = i.timeWindow !== void 0 && !i.timeGrain, f = m && s.timeWindow === void 0 ? void 0 : m && i.dateField === void 0 ? c == null ? void 0 : c.dateField : i.dateField;
|
|
1393
|
+
f !== void 0 && (s.dateField === void 0 || b(f) !== b(s.dateField)) && _.push("dateField"), i.timeGrain !== void 0 && i.timeGrain !== s.timeGrain && _.push("timeGrain");
|
|
1394
|
+
const S = (g = e.config) != null && g.matrix ? e.config.matrix.spec.measures.map((k) => k.kind === "aggregate" ? { aggregate: k.aggregate } : {}) : ((F = e.config) == null ? void 0 : F.metricColumns) ?? [];
|
|
1395
|
+
(i.measures ?? []).forEach((k, O) => {
|
|
1396
|
+
const E = k && typeof k == "object" ? k.aggregate : void 0;
|
|
1397
|
+
E && Dt(S[O] ?? {}) !== E && _.push(`the aggregate of measures[${O}]`);
|
|
1396
1398
|
});
|
|
1397
|
-
for (const { key:
|
|
1398
|
-
|
|
1399
|
-
if (!
|
|
1400
|
-
const
|
|
1401
|
-
let O =
|
|
1402
|
-
const E =
|
|
1403
|
-
const
|
|
1404
|
-
return
|
|
1399
|
+
for (const { key: k, label: O } of ze(t))
|
|
1400
|
+
xa(e, k) !== O && _.push(`the label "${O}"`);
|
|
1401
|
+
if (!n || n.aspects.includes("filters")) {
|
|
1402
|
+
const k = i.filters ?? [];
|
|
1403
|
+
let O = s.filters ?? [];
|
|
1404
|
+
const E = i.timeWindow, V = s.timeWindow, W = (L, P) => {
|
|
1405
|
+
const U = (Me) => JSON.stringify((Me ?? []).map(String));
|
|
1406
|
+
return b(L.field) === b(P.field) && L.operator === P.operator && (L.scope ?? "row") === (P.scope ?? "row") && (typeof L.field == "object" ? L.field.aggregate : void 0) === (typeof P.field == "object" ? P.field.aggregate : void 0) && (L.values === void 0 || U(L.values) === U(P.values));
|
|
1405
1407
|
};
|
|
1406
1408
|
if (E && !V) {
|
|
1407
|
-
const L = ((
|
|
1408
|
-
(
|
|
1409
|
+
const L = ((c == null ? void 0 : c.filters) ?? []).filter(
|
|
1410
|
+
(P) => !(c != null && c.timeWindow) && !k.some((U) => W(U, P))
|
|
1409
1411
|
);
|
|
1410
|
-
(!L.length || L.some((
|
|
1411
|
-
} else E ? Object.keys(E).filter((
|
|
1412
|
-
(
|
|
1412
|
+
(!L.length || L.some((P) => !O.some((U) => W(P, U)))) && _.push("timeWindow"), O = O.filter((P) => !L.some((U) => W(U, P)));
|
|
1413
|
+
} else E ? Object.keys(E).filter((P) => !(P === "kind" && E.kind === "relative" && (V == null ? void 0 : V.kind) === void 0)).some((P) => !et(E[P], V == null ? void 0 : V[P])) && _.push("timeWindow") : V && _.push("timeWindow");
|
|
1414
|
+
(k.length !== O.length || k.some((L, P) => !W(L, O[P]))) && _.push("filters");
|
|
1413
1415
|
}
|
|
1414
|
-
if (
|
|
1415
|
-
const
|
|
1416
|
-
(!O || !E || O.direction !==
|
|
1416
|
+
if (i.orderBy !== void 0) {
|
|
1417
|
+
const k = i.orderBy, O = (x = ($ = e.config) == null ? void 0 : $.sortByColumns) == null ? void 0 : x[0], E = O && Ta(e.config ?? {}, O), V = k.field && typeof k.field == "object" ? k.field.aggregate : void 0;
|
|
1418
|
+
(!O || !E || O.direction !== k.direction || b(k.field) !== ka(E.name, Da(E)) || V !== void 0 && Dt(E) !== V) && _.push("orderBy");
|
|
1417
1419
|
}
|
|
1418
|
-
return
|
|
1420
|
+
return i.limit !== void 0 && ((N = e.config) == null ? void 0 : N.rowLimit) !== i.limit && _.push("limit"), _;
|
|
1419
1421
|
}
|
|
1420
|
-
class
|
|
1422
|
+
class Ie extends Error {
|
|
1421
1423
|
}
|
|
1422
|
-
const
|
|
1424
|
+
const We = (e) => (e ?? "").trim().toLowerCase(), Ne = Ma, Ot = { measures: ja, records: Va, sql: Ba }, Ae = {
|
|
1423
1425
|
measures: "a measures query (measures, with optional dimensions)",
|
|
1424
1426
|
records: "a records query (columns)",
|
|
1425
1427
|
sql: "a SQL query"
|
|
1426
1428
|
};
|
|
1427
|
-
function
|
|
1428
|
-
return t.path.reduce((a,
|
|
1429
|
-
}
|
|
1430
|
-
async function
|
|
1431
|
-
var
|
|
1432
|
-
const
|
|
1433
|
-
let
|
|
1434
|
-
if (t.length >
|
|
1429
|
+
function aa(e, t) {
|
|
1430
|
+
return t.path.reduce((a, o) => typeof o == "number" ? `${a}[${o}]` : `${a}.${o}`, e);
|
|
1431
|
+
}
|
|
1432
|
+
async function Qs(e, t, a) {
|
|
1433
|
+
var lt, ut, ft, mt, ht, pt, gt, bt, yt;
|
|
1434
|
+
const o = [], n = [], r = [], s = [], i = /* @__PURE__ */ new Set(), d = [], c = /* @__PURE__ */ new Map(), p = { calendar: a.calendar }, _ = a.relationshipReach ? { relationshipReach: a.relationshipReach } : {};
|
|
1435
|
+
let b = e, v = 0;
|
|
1436
|
+
if (t.length > $t)
|
|
1435
1437
|
return {
|
|
1436
1438
|
ok: !1,
|
|
1437
1439
|
problems: [
|
|
1438
1440
|
{
|
|
1439
1441
|
code: "too_many_changes",
|
|
1440
|
-
message: `A proposal takes at most ${
|
|
1442
|
+
message: `A proposal takes at most ${$t} changes; this one has ${t.length}.`,
|
|
1441
1443
|
path: "changes",
|
|
1442
1444
|
fix: "Split the changes into several proposals."
|
|
1443
1445
|
}
|
|
1444
1446
|
]
|
|
1445
1447
|
};
|
|
1446
|
-
const
|
|
1447
|
-
if (t.forEach((
|
|
1448
|
-
const
|
|
1449
|
-
if (
|
|
1450
|
-
|
|
1448
|
+
const m = [];
|
|
1449
|
+
if (t.forEach((I, l) => {
|
|
1450
|
+
const h = Aa.safeParse(I);
|
|
1451
|
+
if (h.success) {
|
|
1452
|
+
m.push(h.data);
|
|
1451
1453
|
return;
|
|
1452
1454
|
}
|
|
1453
|
-
for (const
|
|
1454
|
-
|
|
1455
|
+
for (const y of h.error.issues)
|
|
1456
|
+
o.push({
|
|
1455
1457
|
code: "invalid_change",
|
|
1456
|
-
message:
|
|
1457
|
-
path:
|
|
1458
|
+
message: y.message,
|
|
1459
|
+
path: aa(`changes[${l}]`, y),
|
|
1458
1460
|
fix: "Send the change in the shape the tool schema gives."
|
|
1459
1461
|
});
|
|
1460
|
-
}),
|
|
1461
|
-
const
|
|
1462
|
-
throw
|
|
1463
|
-
},
|
|
1464
|
-
a.capabilities.sql ||
|
|
1462
|
+
}), o.length) return { ok: !1, problems: o };
|
|
1463
|
+
const f = (I) => {
|
|
1464
|
+
throw o.push(I), new Ie();
|
|
1465
|
+
}, S = (I) => {
|
|
1466
|
+
a.capabilities.sql || f({
|
|
1465
1467
|
code: "capability_required",
|
|
1466
1468
|
message: "This change creates, reads or changes a SQL card, which needs SQL access.",
|
|
1467
|
-
path:
|
|
1469
|
+
path: I,
|
|
1468
1470
|
fix: "Use a measures or records query, or ask an administrator for SQL access."
|
|
1469
|
-
}),
|
|
1470
|
-
},
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1473
|
-
},
|
|
1474
|
-
if (
|
|
1475
|
-
const
|
|
1476
|
-
return (!
|
|
1471
|
+
}), i.add("sql");
|
|
1472
|
+
}, u = (I, l) => {
|
|
1473
|
+
const h = St(b, [I], p);
|
|
1474
|
+
h.ok ? (b = h.dashboard, r.push(I)) : f({ code: "invalid_change", message: h.failedAt.message, path: l, ...h.failedAt.fix ? { fix: h.failedAt.fix } : {} });
|
|
1475
|
+
}, g = (I, l) => {
|
|
1476
|
+
if (I.startsWith("$")) {
|
|
1477
|
+
const h = c.get(I);
|
|
1478
|
+
return (!h || h.kind !== "card") && f({
|
|
1477
1479
|
code: "handle_unknown",
|
|
1478
|
-
message: `${
|
|
1479
|
-
path:
|
|
1480
|
+
message: `${I} isn't a card handle defined earlier in this list.`,
|
|
1481
|
+
path: l,
|
|
1480
1482
|
fix: "Define the handle with an earlier card.add, or use the card id from the outline."
|
|
1481
|
-
}),
|
|
1483
|
+
}), h.id;
|
|
1482
1484
|
}
|
|
1483
|
-
return
|
|
1485
|
+
return ie(b).some((h) => h.cardId === I) || f({
|
|
1484
1486
|
code: "card_not_found",
|
|
1485
|
-
message: `There's no card ${
|
|
1486
|
-
path:
|
|
1487
|
+
message: `There's no card ${I} on this dashboard.`,
|
|
1488
|
+
path: l,
|
|
1487
1489
|
fix: "Read the outline again and use its card ids."
|
|
1488
|
-
}),
|
|
1489
|
-
}, F = (
|
|
1490
|
-
if (
|
|
1491
|
-
const
|
|
1492
|
-
return (!
|
|
1490
|
+
}), I;
|
|
1491
|
+
}, F = (I, l) => {
|
|
1492
|
+
if (I.startsWith("$")) {
|
|
1493
|
+
const y = c.get(I);
|
|
1494
|
+
return (!y || y.kind !== "filter") && f({
|
|
1493
1495
|
code: "handle_unknown",
|
|
1494
|
-
message: `${
|
|
1495
|
-
path:
|
|
1496
|
+
message: `${I} isn't a filter handle defined earlier in this list.`,
|
|
1497
|
+
path: l,
|
|
1496
1498
|
fix: "Define the handle with an earlier filter.add, or use the filter id from the outline."
|
|
1497
|
-
}),
|
|
1499
|
+
}), y.id;
|
|
1498
1500
|
}
|
|
1499
|
-
return (Array.isArray(
|
|
1501
|
+
return (Array.isArray(b.inputs) ? b.inputs : []).some((y) => y.id === I && y.kind === "filter") || f({
|
|
1500
1502
|
code: "filter_not_found",
|
|
1501
|
-
message: `There's no filter ${
|
|
1502
|
-
path:
|
|
1503
|
+
message: `There's no filter ${I} on this dashboard.`,
|
|
1504
|
+
path: l,
|
|
1503
1505
|
fix: "Read the outline again and use its filter ids."
|
|
1504
|
-
}),
|
|
1505
|
-
},
|
|
1506
|
-
const
|
|
1507
|
-
return
|
|
1508
|
-
},
|
|
1509
|
-
var
|
|
1510
|
-
for (const
|
|
1511
|
-
const
|
|
1512
|
-
if (
|
|
1506
|
+
}), I;
|
|
1507
|
+
}, $ = () => (b.sheets ?? []).filter((I) => !Tt(I)), x = () => $().map((I) => ({ sheetId: I.id, title: I.title ?? "" })), N = (I, l) => {
|
|
1508
|
+
const h = (b.sheets ?? []).find((y) => y.id === I);
|
|
1509
|
+
return h || f({ code: "sheet_not_found", message: `There's no sheet ${I} on this dashboard.`, path: l, fix: "Read the outline again and use its sheet ids.", details: { sheets: x() } }), Tt(h) && f({ code: "sheet_not_a_grid", message: `"${h.title}" is a Document sheet.`, path: l, fix: "Add the card to a grid sheet; Document sheets are changed in the editor.", details: { sheets: x() } }), h;
|
|
1510
|
+
}, k = (I, l, h, y) => {
|
|
1511
|
+
var R;
|
|
1512
|
+
for (const D of Ka(l, h)) f({ ...D, path: `${y}.${D.path}` });
|
|
1513
|
+
const C = ye[I], T = Ne(l), w = l.dateField;
|
|
1514
|
+
if (w && typeof w != "string" && w.label && !l.timeGrain && f({
|
|
1513
1515
|
code: "invalid_change",
|
|
1514
1516
|
message: "A label names a column, and the date field is a column only when the card groups by it.",
|
|
1515
|
-
path: `${
|
|
1517
|
+
path: `${y}.query.dateField.label`,
|
|
1516
1518
|
fix: "Send timeGrain to group by the date, or leave the label out."
|
|
1517
|
-
}), !
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1519
|
+
}), !C.forms.includes(T)) {
|
|
1520
|
+
const D = Object.keys(ye).filter((A) => ye[A].forms.includes(T));
|
|
1521
|
+
f({
|
|
1520
1522
|
code: "type_not_supported",
|
|
1521
|
-
message: `A ${
|
|
1522
|
-
path: `${
|
|
1523
|
-
fix: `Send ${
|
|
1523
|
+
message: `A ${I.replace(/_/g, " ")} card takes ${C.forms.map((A) => Ae[A]).join(" or ")}, not ${Ae[T]}.`,
|
|
1524
|
+
path: `${y}.query`,
|
|
1525
|
+
fix: `Send ${C.forms.map((A) => Ae[A]).join(" or ")}, or use a type this query fits: ${D.join(", ")}.`
|
|
1524
1526
|
});
|
|
1525
1527
|
}
|
|
1526
|
-
if (
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1528
|
+
if (T === "measures") {
|
|
1529
|
+
const D = l, A = D.measures.length;
|
|
1530
|
+
C.measures && (A < C.measures.min || C.measures.max !== void 0 && A > C.measures.max) && f({
|
|
1529
1531
|
code: "type_not_supported",
|
|
1530
|
-
message: `A ${
|
|
1531
|
-
path: `${
|
|
1532
|
+
message: `A ${I.replace(/_/g, " ")} card shows exactly ${C.measures.max} measure.`,
|
|
1533
|
+
path: `${y}.query.measures`,
|
|
1532
1534
|
fix: "Send one measure, or use a table or chart for several."
|
|
1533
|
-
}), !
|
|
1535
|
+
}), !C.dimensions && ((R = D.dimensions) != null && R.length) && f({
|
|
1534
1536
|
code: "type_not_supported",
|
|
1535
|
-
message: `A ${
|
|
1536
|
-
path: `${
|
|
1537
|
+
message: `A ${I.replace(/_/g, " ")} card shows one number, so it has no dimensions.`,
|
|
1538
|
+
path: `${y}.query.dimensions`,
|
|
1537
1539
|
fix: "Remove the dimensions, or use a table or chart."
|
|
1538
|
-
}),
|
|
1540
|
+
}), I === "matrix" && (D.orderBy || D.limit) && f({
|
|
1539
1541
|
code: "type_not_supported",
|
|
1540
1542
|
message: "A Matrix's sorting and top N are set in the editor.",
|
|
1541
|
-
path: `${
|
|
1543
|
+
path: `${y}.query`,
|
|
1542
1544
|
fix: "Leave out orderBy and limit for a Matrix."
|
|
1543
1545
|
});
|
|
1544
1546
|
}
|
|
1545
|
-
if (
|
|
1547
|
+
if (C.matrixColumns && !h && f({
|
|
1546
1548
|
code: "type_not_supported",
|
|
1547
1549
|
message: "A Matrix needs matrix.columns: the query fields that run across the top.",
|
|
1548
|
-
path: `${
|
|
1550
|
+
path: `${y}.matrix`,
|
|
1549
1551
|
fix: "Send matrix: { columns: [...] } naming dimensions or the date field of the query (an empty list puts nothing across the top)."
|
|
1550
|
-
}), !
|
|
1551
|
-
const
|
|
1552
|
-
|
|
1552
|
+
}), !C.matrixColumns && h && f({ code: "type_not_supported", message: "matrix.columns is only for Matrix cards.", path: `${y}.matrix`, fix: 'Leave out matrix, or use type "matrix".' }), h && T === "measures") {
|
|
1553
|
+
const D = l, A = D.datasetName, j = [...D.dimensions ?? [], ...D.timeGrain && D.dateField ? [D.dateField] : []];
|
|
1554
|
+
j.length && h.columns.length >= j.length && j.every((q) => h.columns.some((B) => fe(B, A) === fe(q, A))) && f({
|
|
1553
1555
|
code: "type_not_supported",
|
|
1554
1556
|
message: "A Matrix needs at least one field down the side.",
|
|
1555
|
-
path: `${
|
|
1557
|
+
path: `${y}.matrix.columns`,
|
|
1556
1558
|
fix: "Leave one dimension or the date field out of matrix.columns."
|
|
1557
1559
|
});
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1560
|
-
|
|
1560
|
+
const Y = new Set([...D.dimensions ?? [], ...D.dateField ? [D.dateField] : []].map((q) => fe(q, A)));
|
|
1561
|
+
h.columns.forEach((q, B) => {
|
|
1562
|
+
Y.has(fe(q, A)) || f({
|
|
1561
1563
|
code: "type_not_supported",
|
|
1562
|
-
message: `"${
|
|
1563
|
-
path: `${
|
|
1564
|
+
message: `"${kt(q)}" isn't one of the query's dimensions or its date field.`,
|
|
1565
|
+
path: `${y}.matrix.columns[${B}]`,
|
|
1564
1566
|
fix: "Name dimensions or the date field of the query in matrix.columns."
|
|
1565
1567
|
});
|
|
1566
1568
|
});
|
|
1567
1569
|
}
|
|
1568
|
-
}, O = (
|
|
1569
|
-
code:
|
|
1570
|
-
message:
|
|
1571
|
-
path: `${
|
|
1572
|
-
fix:
|
|
1573
|
-
details: { reason: "not_expressible", ..."parts" in
|
|
1574
|
-
}), E = (
|
|
1575
|
-
const
|
|
1576
|
-
|
|
1570
|
+
}, O = (I, l) => f({
|
|
1571
|
+
code: I.code === "query_not_kept" ? "card_not_editable" : "invalid_change",
|
|
1572
|
+
message: I.message,
|
|
1573
|
+
path: `${l}.query`,
|
|
1574
|
+
fix: I.code === "query_not_kept" ? "Tell the user to make this change in the editor." : "Read the outline again and propose again.",
|
|
1575
|
+
details: { reason: "not_expressible", ..."parts" in I ? { parts: I.parts } : {} }
|
|
1576
|
+
}), E = (I, l, h, y, C, T, w) => {
|
|
1577
|
+
const R = wn(I, l, h, T, w);
|
|
1578
|
+
R.length && f({
|
|
1577
1579
|
code: "card_not_editable",
|
|
1578
|
-
message: `As changed, "${
|
|
1579
|
-
path: `${
|
|
1580
|
+
message: `As changed, "${C}" wouldn't run the query asked for, so make this change in the editor.`,
|
|
1581
|
+
path: `${y}.query`,
|
|
1580
1582
|
fix: "Tell the user to make this change in the editor.",
|
|
1581
|
-
details: { reason: "not_expressible", detail: `doesn't hold: ${
|
|
1583
|
+
details: { reason: "not_expressible", detail: `doesn't hold: ${R.join(", ")}` }
|
|
1582
1584
|
});
|
|
1583
|
-
}, V = async (
|
|
1584
|
-
const
|
|
1585
|
-
if ("sql" in
|
|
1586
|
-
return
|
|
1587
|
-
const
|
|
1588
|
-
if (!
|
|
1589
|
-
throw
|
|
1590
|
-
|
|
1591
|
-
let
|
|
1592
|
-
const
|
|
1593
|
-
if (
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1585
|
+
}, V = async (I, l, h, y) => {
|
|
1586
|
+
const C = wt(I);
|
|
1587
|
+
if ("sql" in l)
|
|
1588
|
+
return S(`${y}.query`), { type: C, source: { kind: "sql", connectionId: l.connectionId, sql: l.sql } };
|
|
1589
|
+
const T = C === "matrixTable" || C === "detailTable" ? "table" : C, w = await a.compileCardQuery({ query: l, chartType: T });
|
|
1590
|
+
if (!w.ok)
|
|
1591
|
+
throw o.push(...w.problems.map((A) => ({ ...A, path: A.path ? `${y}.query.${A.path}` : `${y}.query` }))), new Ie();
|
|
1592
|
+
n.push(...w.warnings.map((A) => ({ ...A, path: A.path ?? `${y}.query` })));
|
|
1593
|
+
let R = { ...w.part, type: C };
|
|
1594
|
+
const D = R.config ?? {};
|
|
1595
|
+
if (C === "detailTable") {
|
|
1596
|
+
const A = Ua(Ga("table", "detailTable", D)) ?? {};
|
|
1597
|
+
R = { ...R, config: xn(A) };
|
|
1596
1598
|
}
|
|
1597
|
-
return
|
|
1598
|
-
},
|
|
1599
|
-
var
|
|
1600
|
-
const
|
|
1601
|
-
if (
|
|
1602
|
-
const
|
|
1603
|
-
(
|
|
1599
|
+
return C === "matrixTable" && (R = await W(R, D, l, h, y)), Tn(R, ze(l));
|
|
1600
|
+
}, W = async (I, l, h, y, C) => {
|
|
1601
|
+
var Y;
|
|
1602
|
+
const T = await a.loadCardSource({ domainId: h.domainId, datasetName: h.datasetName });
|
|
1603
|
+
if (T || f({ code: "field_not_found", message: `The dataset "${h.datasetName}" isn't available.`, path: `${C}.query.datasetName`, fix: "Find datasets with semaphor_list_datasets." }), I.source.kind !== "semantic") throw new Ie();
|
|
1604
|
+
const w = { id: "scratch", title: "", type: "table", dataSource: I.source.dataSource, config: l }, R = Ha(w, "matrixTable", { catalog: T.fields, createId: a.newId }), D = R.status === "changed" ? (Y = R.card.config) == null ? void 0 : Y.matrix : void 0;
|
|
1605
|
+
(R.status !== "changed" || R.leftOut.length || !D) && f({
|
|
1604
1606
|
code: "type_not_supported",
|
|
1605
|
-
message:
|
|
1606
|
-
path: `${
|
|
1607
|
+
message: R.status === "changed" && R.leftOut.length ? `These fields can't run in a Matrix: ${R.leftOut.join(", ")}.` : "This query can't be shown as a Matrix.",
|
|
1608
|
+
path: `${C}.query`,
|
|
1607
1609
|
fix: "Use plain dataset fields for a Matrix, or use a table."
|
|
1608
1610
|
});
|
|
1609
|
-
let
|
|
1610
|
-
const
|
|
1611
|
-
for (const [
|
|
1612
|
-
const
|
|
1613
|
-
(z) =>
|
|
1611
|
+
let A = D;
|
|
1612
|
+
const j = h.datasetName;
|
|
1613
|
+
for (const [q, B] of y.columns.entries()) {
|
|
1614
|
+
const K = [...A.spec.rows, ...A.spec.columns].find(
|
|
1615
|
+
(z) => Ya(z.field) === fe(B, j)
|
|
1614
1616
|
);
|
|
1615
|
-
|
|
1617
|
+
K || f({ code: "type_not_supported", message: `"${kt(B)}" isn't a level of this Matrix.`, path: `${C}.matrix.columns[${q}]`, fix: "Name dimensions or the date field of the query in matrix.columns." }), A = Wa(A, Ja(A.spec, K.id, "columns")).config;
|
|
1616
1618
|
}
|
|
1617
|
-
return { ...
|
|
1618
|
-
}, L = /* @__PURE__ */ new Map(),
|
|
1619
|
-
for (const [
|
|
1620
|
-
const
|
|
1619
|
+
return { ...I, config: { matrix: A } };
|
|
1620
|
+
}, L = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map();
|
|
1621
|
+
for (const [I, l] of m.entries()) {
|
|
1622
|
+
const h = `changes[${I}]`;
|
|
1621
1623
|
try {
|
|
1622
|
-
switch (
|
|
1624
|
+
switch (l.op) {
|
|
1623
1625
|
case "card.add": {
|
|
1624
|
-
const
|
|
1625
|
-
const B =
|
|
1626
|
+
const y = l.position && typeof l.position == "object" ? (() => {
|
|
1627
|
+
const B = g(l.position.after, `${h}.position.after`), K = ie(b).find(
|
|
1626
1628
|
(z) => z.cardId === B && z.kind === "frameCard"
|
|
1627
1629
|
);
|
|
1628
|
-
return !
|
|
1630
|
+
return !K || K.kind !== "frameCard" ? f({
|
|
1629
1631
|
code: "card_not_found",
|
|
1630
|
-
message: `${
|
|
1631
|
-
path: `${
|
|
1632
|
+
message: `${l.position.after} isn't a card on a grid sheet.`,
|
|
1633
|
+
path: `${h}.position.after`,
|
|
1632
1634
|
fix: "Use a cardId from semaphor_get_dashboard_details on the same sheet, or a handle from this proposal."
|
|
1633
|
-
}) : (
|
|
1635
|
+
}) : (l.sheetId && l.sheetId !== K.sheetId && f({
|
|
1634
1636
|
code: "invalid_change",
|
|
1635
|
-
message: `position.after names a card on another sheet than ${
|
|
1636
|
-
path: `${
|
|
1637
|
+
message: `position.after names a card on another sheet than ${l.sheetId}.`,
|
|
1638
|
+
path: `${h}.position.after`,
|
|
1637
1639
|
fix: "Leave out sheetId, or name the card's sheet."
|
|
1638
|
-
}), { sheetId:
|
|
1639
|
-
})() : void 0,
|
|
1640
|
-
const B =
|
|
1641
|
-
return B.length !== 1 &&
|
|
1640
|
+
}), { sheetId: K.sheetId, frameId: K.frameId });
|
|
1641
|
+
})() : void 0, C = y ? N(y.sheetId, `${h}.position.after`) : l.sheetId ? N(l.sheetId, `${h}.sheetId`) : (() => {
|
|
1642
|
+
const B = $();
|
|
1643
|
+
return B.length !== 1 && f({
|
|
1642
1644
|
code: B.length ? "sheet_required" : "sheet_not_a_grid",
|
|
1643
1645
|
message: B.length ? "This dashboard has several grid sheets; say which one gets the card." : "This dashboard has no grid sheet to add a card to.",
|
|
1644
|
-
path: `${
|
|
1646
|
+
path: `${h}.sheetId`,
|
|
1645
1647
|
fix: B.length ? "Send sheetId: one of details.sheets." : "Add a grid sheet in the editor first.",
|
|
1646
|
-
details: { sheets:
|
|
1648
|
+
details: { sheets: x() }
|
|
1647
1649
|
}), B[0];
|
|
1648
1650
|
})();
|
|
1649
|
-
|
|
1650
|
-
const
|
|
1651
|
-
...
|
|
1652
|
-
type:
|
|
1653
|
-
},
|
|
1654
|
-
|
|
1655
|
-
const
|
|
1656
|
-
E(
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1651
|
+
k(l.type, l.query, l.matrix, h);
|
|
1652
|
+
const T = await V(l.type, l.query, l.matrix, h), w = {
|
|
1653
|
+
...la({ id: a.newId(), title: l.title, ...l.description ? { description: l.description } : {} }),
|
|
1654
|
+
type: T.type
|
|
1655
|
+
}, R = xt(w, T);
|
|
1656
|
+
R.ok || f({ code: "invalid_change", message: R.message, path: h });
|
|
1657
|
+
const D = R.ok ? R.card : w;
|
|
1658
|
+
E(D, l.query, l.matrix, h, l.title, T);
|
|
1659
|
+
const A = { id: a.newId(), cards: [D], activeCardId: D.id }, j = y ? { after: y.frameId } : typeof l.position == "string" ? l.position : void 0, Y = j || l.width ? { ...j ? { position: j } : {}, ...l.width ? { width: l.width } : {} } : void 0;
|
|
1660
|
+
u({ op: "card.add", sheetId: C.id, frame: A, ...Y ? { placement: Y } : {}, changeIndex: I }, h);
|
|
1661
|
+
const q = l.handle ?? `$card_${++v}`;
|
|
1662
|
+
c.has(q) && f({ code: "invalid_change", message: `The handle ${q} is defined twice.`, path: `${h}.handle`, fix: "Give each new card or filter its own handle." }), c.set(q, { kind: "card", id: D.id, title: l.title }), s.push({ ref: q, kind: "card", id: D.id, title: l.title, changeIndex: I }), d.push(D.id);
|
|
1661
1663
|
break;
|
|
1662
1664
|
}
|
|
1663
1665
|
case "card.update": {
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1666
|
-
const
|
|
1667
|
-
((
|
|
1666
|
+
const y = g(l.cardId, `${h}.cardId`), C = ue(b, y);
|
|
1667
|
+
C || f({ code: "card_not_editable", message: "Cards in Document sections are changed in the editor.", path: `${h}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "document_section" } });
|
|
1668
|
+
const T = C.card, w = me(T, { sql: !0 });
|
|
1669
|
+
((lt = w.source) == null ? void 0 : lt.kind) === "sql" && S(`${h}.cardId`), w.editable || f({
|
|
1668
1670
|
code: "card_not_editable",
|
|
1669
|
-
message:
|
|
1670
|
-
path: `${
|
|
1671
|
-
fix:
|
|
1672
|
-
details: { reason:
|
|
1673
|
-
}),
|
|
1671
|
+
message: w.message,
|
|
1672
|
+
path: `${h}.cardId`,
|
|
1673
|
+
fix: w.reason === "needs_sql_access" ? "Ask for SQL access." : "Tell the user to change it in the editor.",
|
|
1674
|
+
details: { reason: w.reason, ...w.detail ? { detail: w.detail } : {} }
|
|
1675
|
+
}), C.frame.visualId && n.push({
|
|
1674
1676
|
code: "detaches_linked_visual",
|
|
1675
|
-
message: `"${
|
|
1676
|
-
path:
|
|
1677
|
-
details: { cardIds: [
|
|
1677
|
+
message: `"${T.title}" will stop following its library visual and become local to this dashboard.`,
|
|
1678
|
+
path: h,
|
|
1679
|
+
details: { cardIds: [y] }
|
|
1678
1680
|
});
|
|
1679
|
-
let
|
|
1680
|
-
const
|
|
1681
|
-
if (
|
|
1682
|
-
const
|
|
1683
|
-
...
|
|
1684
|
-
...
|
|
1681
|
+
let R = !1;
|
|
1682
|
+
const D = l.type ? wt(l.type) : void 0;
|
|
1683
|
+
if (D && D !== T.type) {
|
|
1684
|
+
const A = w.editable ? w.source : void 0, j = Oa(T, D), Y = j && A && A.kind === "semantic" ? (ut = await a.loadCardSource({ domainId: A.domainId, datasetName: A.datasetName })) == null ? void 0 : ut.fields : void 0, q = [], B = Ea(T, D, {
|
|
1685
|
+
...Y ? { catalog: Y } : {},
|
|
1686
|
+
...j && !Y ? { catalogLoading: !0 } : {},
|
|
1685
1687
|
createId: () => {
|
|
1686
|
-
const
|
|
1687
|
-
return
|
|
1688
|
+
const K = a.newId();
|
|
1689
|
+
return q.push(K), K;
|
|
1688
1690
|
}
|
|
1689
1691
|
});
|
|
1690
|
-
if (B.status === "refused" &&
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1692
|
+
if (B.status === "refused" && f({ code: "type_not_supported", message: "The card's dataset fields couldn't be loaded for a change to or from a Matrix.", path: `${h}.type`, fix: "Send a complete query with the type change." }), B.status === "changed") {
|
|
1693
|
+
const K = [...B.leftOut, ...B.droppedPreferences];
|
|
1694
|
+
K.length && n.push({
|
|
1693
1695
|
code: "type_change_drops",
|
|
1694
|
-
message: `Changing "${
|
|
1695
|
-
path: `${
|
|
1696
|
-
details: { dropped:
|
|
1697
|
-
}),
|
|
1698
|
-
{ op: "card.update", cardId:
|
|
1699
|
-
`${
|
|
1700
|
-
),
|
|
1696
|
+
message: `Changing "${T.title}" to ${l.type.replace(/_/g, " ")} leaves out ${K.join(", ")}.`,
|
|
1697
|
+
path: `${h}.type`,
|
|
1698
|
+
details: { dropped: K }
|
|
1699
|
+
}), u(
|
|
1700
|
+
{ op: "card.update", cardId: y, update: { kind: "retype", type: D, ...Y ? { catalog: Y } : {}, newIds: q }, changeIndex: I },
|
|
1701
|
+
`${h}.type`
|
|
1702
|
+
), R = !0;
|
|
1701
1703
|
}
|
|
1702
1704
|
}
|
|
1703
|
-
if (
|
|
1704
|
-
const
|
|
1705
|
-
|
|
1706
|
-
const z =
|
|
1707
|
-
|
|
1708
|
-
let
|
|
1709
|
-
if (z && !("sql" in
|
|
1710
|
-
const { orderBy:
|
|
1711
|
-
|
|
1705
|
+
if (l.query || l.matrix) {
|
|
1706
|
+
const A = ue(b, y).card, j = me(A, { sql: !0 }), Y = j.editable ? j.query : void 0, q = An(Y, l.query ?? {}, `${h}.query`, f), B = Qe(A.type), K = l.matrix ?? (j.editable ? j.matrix : void 0);
|
|
1707
|
+
k(B, q, K, h);
|
|
1708
|
+
const z = j.editable ? Na(j.query, q, j.matrix, K) : void 0, It = !z || z.aspects.length > 0, be = z && !("sql" in q) ? ze(q).filter((te) => !Ft(z, te.key.role)) : [], _t = Pa(A, z, be.map((te) => te.key.role));
|
|
1709
|
+
_t && O(_t, h);
|
|
1710
|
+
let Le = q;
|
|
1711
|
+
if (z && !("sql" in q) && q.orderBy && !z.aspects.includes("order") && ["metric", "group_by", "detail"].some((te) => Ft(z, te))) {
|
|
1712
|
+
const { orderBy: te, ...Fe } = q;
|
|
1713
|
+
Le = Fe;
|
|
1712
1714
|
}
|
|
1713
|
-
let
|
|
1714
|
-
if (
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
const
|
|
1718
|
-
if (
|
|
1715
|
+
let Ct;
|
|
1716
|
+
if (It) {
|
|
1717
|
+
const te = await V(B, Le, K, h);
|
|
1718
|
+
Ct = te;
|
|
1719
|
+
const Fe = z ? { ...te, change: z } : te, se = xt(A, Fe);
|
|
1720
|
+
if (se.ok || O(se, h), se.ok && se.droppedBindings.length && n.push({
|
|
1719
1721
|
code: "control_binding_dropped",
|
|
1720
|
-
message: `"${
|
|
1721
|
-
path: `${
|
|
1722
|
+
message: `"${A.title}" loses the controls bound to the levels or measures this change removes; they stop changing this card.`,
|
|
1723
|
+
path: `${h}.query`,
|
|
1722
1724
|
fix: "Keep those fields in the query, or tell the user the controls no longer apply to this card.",
|
|
1723
|
-
details: { controlIds:
|
|
1724
|
-
}),
|
|
1725
|
-
for (const
|
|
1726
|
-
|
|
1725
|
+
details: { controlIds: se.droppedBindings }
|
|
1726
|
+
}), se.ok)
|
|
1727
|
+
for (const xe of se.keptLabels)
|
|
1728
|
+
n.push({
|
|
1727
1729
|
code: "label_kept_after_change",
|
|
1728
|
-
message: `"${
|
|
1729
|
-
path: `${
|
|
1730
|
+
message: `"${A.title}" keeps the label "${xe.label}" on ${xe.field}, whose aggregate or time grain changed.`,
|
|
1731
|
+
path: `${h}.query`,
|
|
1730
1732
|
fix: "State a new label on the field ref if the old one no longer fits.",
|
|
1731
|
-
details: { columns: [{ label:
|
|
1733
|
+
details: { columns: [{ label: xe.label, field: xe.field }] }
|
|
1732
1734
|
});
|
|
1733
|
-
|
|
1735
|
+
u({ op: "card.update", cardId: y, update: { kind: "requery", query: Fe }, changeIndex: I }, `${h}.query`), R = !0;
|
|
1734
1736
|
}
|
|
1735
|
-
|
|
1737
|
+
be.length && qa(ue(b, y).card, be).changed.length && u({ op: "card.update", cardId: y, update: { kind: "relabel", labels: be }, changeIndex: I }, `${h}.query`), (It || be.length) && E(ue(b, y).card, Le, K, h, A.title ?? "", Ct, z);
|
|
1736
1738
|
}
|
|
1737
|
-
(
|
|
1739
|
+
(l.title !== void 0 || l.description !== void 0) && u(
|
|
1738
1740
|
{
|
|
1739
1741
|
op: "card.update",
|
|
1740
|
-
cardId:
|
|
1742
|
+
cardId: y,
|
|
1741
1743
|
update: {
|
|
1742
1744
|
kind: "rename",
|
|
1743
|
-
...
|
|
1744
|
-
...
|
|
1745
|
+
...l.title !== void 0 ? { title: l.title } : {},
|
|
1746
|
+
...l.description !== void 0 ? { description: l.description } : {}
|
|
1745
1747
|
},
|
|
1746
|
-
changeIndex:
|
|
1748
|
+
changeIndex: I
|
|
1747
1749
|
},
|
|
1748
|
-
|
|
1749
|
-
),
|
|
1750
|
+
h
|
|
1751
|
+
), R && !d.includes(y) && d.push(y), s.push({ ref: l.cardId, kind: "card", id: y, title: T.title ?? "", changeIndex: I });
|
|
1750
1752
|
break;
|
|
1751
1753
|
}
|
|
1752
1754
|
case "card.remove": {
|
|
1753
|
-
const
|
|
1754
|
-
|
|
1755
|
-
var
|
|
1756
|
-
return ((
|
|
1757
|
-
}) &&
|
|
1755
|
+
const y = g(l.cardId, `${h}.cardId`), C = ue(b, y);
|
|
1756
|
+
C || f({ code: "card_not_editable", message: "Cards in Document sections are removed in the editor.", path: `${h}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "document_section" } }), C.frame.cards.some((w) => {
|
|
1757
|
+
var R, D;
|
|
1758
|
+
return ((R = w.customCardPreferences) == null ? void 0 : R.visualType) === "multiple" || !!((D = w.customCardPreferences) != null && D.dataInputCardIds);
|
|
1759
|
+
}) && C.frame.cards.length > 1 && f({ code: "card_not_editable", message: "This card is an input of a custom visual; remove it in the editor.", path: `${h}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "custom" } }), C.frame.visualId && C.frame.cards.length > 1 && n.push({
|
|
1758
1760
|
code: "detaches_linked_visual",
|
|
1759
|
-
message: `Removing "${
|
|
1760
|
-
path:
|
|
1761
|
-
details: { cardIds:
|
|
1762
|
-
}),
|
|
1761
|
+
message: `Removing "${C.card.title}" makes the rest of its tile local to this dashboard; it stops following its library visual.`,
|
|
1762
|
+
path: h,
|
|
1763
|
+
details: { cardIds: C.frame.cards.filter((w) => w.id !== y).map((w) => w.id) }
|
|
1764
|
+
}), u({ op: "card.remove", cardId: y, changeIndex: I }, h), s.push({ ref: l.cardId, kind: "card", id: y, title: C.card.title ?? "", changeIndex: I });
|
|
1763
1765
|
break;
|
|
1764
1766
|
}
|
|
1765
1767
|
case "filter.add": {
|
|
1766
|
-
const
|
|
1767
|
-
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1768
|
+
const y = await a.loadCardSource({ domainId: l.domainId, datasetName: l.datasetName });
|
|
1769
|
+
y || f({ code: "field_not_found", message: `The dataset "${l.datasetName}" isn't available in this domain.`, path: `${h}.datasetName`, fix: "Find datasets with semaphor_list_datasets." });
|
|
1770
|
+
const C = jt(y.fields, l.field, l.datasetName);
|
|
1771
|
+
C || f({
|
|
1770
1772
|
code: "field_not_found",
|
|
1771
|
-
message: `"${
|
|
1772
|
-
path: `${
|
|
1773
|
+
message: `"${l.field}" isn't a field of ${l.datasetName}.`,
|
|
1774
|
+
path: `${h}.field`,
|
|
1773
1775
|
fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
|
|
1774
|
-
details: { available:
|
|
1776
|
+
details: { available: y.fields.slice(0, 20).map((A) => A.name) }
|
|
1775
1777
|
});
|
|
1776
|
-
const
|
|
1777
|
-
field:
|
|
1778
|
-
dataSource:
|
|
1779
|
-
connectionId:
|
|
1780
|
-
connectionType:
|
|
1781
|
-
scope:
|
|
1782
|
-
existingInputs: Array.isArray(
|
|
1778
|
+
const T = Et(l.sheetIds, h, N), w = ca({
|
|
1779
|
+
field: C,
|
|
1780
|
+
dataSource: y.dataSource,
|
|
1781
|
+
connectionId: y.connectionId,
|
|
1782
|
+
connectionType: y.connectionType,
|
|
1783
|
+
scope: T,
|
|
1784
|
+
existingInputs: Array.isArray(b.inputs) ? b.inputs : [],
|
|
1783
1785
|
createId: a.newId,
|
|
1784
|
-
label:
|
|
1785
|
-
}),
|
|
1786
|
-
|
|
1787
|
-
const
|
|
1788
|
-
|
|
1786
|
+
label: l.label
|
|
1787
|
+
}), R = { ...w.filter };
|
|
1788
|
+
R.dateSelectionMode || (R.type = l.selection ?? "multiple"), l.defaultValues && (R.defaultValues = l.defaultValues), l.defaultPeriod && (R.defaultDateFilter = Nt(l.defaultPeriod, C, `${h}.defaultPeriod`, f)), u({ op: "filter.add", input: { ...w, filter: R }, changeIndex: I }, h), L.set(w.id, { sheetIds: l.sheetIds ?? "all", changeIndex: I }), (l.defaultValues !== void 0 || l.defaultPeriod !== void 0) && P.set(w.id, { values: l.defaultValues, period: l.defaultPeriod, changeIndex: I });
|
|
1789
|
+
const D = l.handle;
|
|
1790
|
+
D && (c.has(D) && f({ code: "invalid_change", message: `The handle ${D} is defined twice.`, path: `${h}.handle`, fix: "Give each new card or filter its own handle." }), c.set(D, { kind: "filter", id: w.id, title: l.label })), s.push({ ref: D ?? w.id, kind: "filter", id: w.id, title: l.label, changeIndex: I });
|
|
1789
1791
|
break;
|
|
1790
1792
|
}
|
|
1791
1793
|
case "filter.update": {
|
|
1792
|
-
const
|
|
1793
|
-
|
|
1794
|
+
const y = F(l.filterId, `${h}.filterId`), C = Se(b, y, void 0, _);
|
|
1795
|
+
C != null && C.editable || f({
|
|
1794
1796
|
code: "filter_not_editable",
|
|
1795
|
-
message:
|
|
1796
|
-
path: `${
|
|
1797
|
+
message: C && !C.editable ? C.notEditable.message : "This filter can't be changed through the MCP.",
|
|
1798
|
+
path: `${h}.filterId`,
|
|
1797
1799
|
fix: "Tell the user to change it in the editor; removing or excluding it works."
|
|
1798
1800
|
});
|
|
1799
|
-
const
|
|
1800
|
-
if ((
|
|
1801
|
-
const
|
|
1802
|
-
let
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
{ dataType:
|
|
1806
|
-
`${
|
|
1807
|
-
|
|
1801
|
+
const T = (b.inputs ?? []).find((A) => A.id === y);
|
|
1802
|
+
if ((T == null ? void 0 : T.kind) !== "filter" || !T.filter) throw new Ie();
|
|
1803
|
+
const w = { ...T.filter };
|
|
1804
|
+
let R = !1;
|
|
1805
|
+
l.selection && (w.type = l.selection), l.defaultValues !== void 0 && (R = !0, l.defaultValues === null ? delete w.defaultValues : w.defaultValues = l.defaultValues), l.defaultPeriod !== void 0 && (R = !0, l.defaultPeriod === null ? delete w.defaultDateFilter : w.defaultDateFilter = Nt(
|
|
1806
|
+
l.defaultPeriod,
|
|
1807
|
+
{ dataType: w.dataType },
|
|
1808
|
+
`${h}.defaultPeriod`,
|
|
1809
|
+
f
|
|
1808
1810
|
));
|
|
1809
|
-
const
|
|
1810
|
-
...
|
|
1811
|
-
...
|
|
1811
|
+
const D = {
|
|
1812
|
+
...l.label !== void 0 ? { label: l.label } : {},
|
|
1813
|
+
...l.selection !== void 0 || R ? { definition: w } : {},
|
|
1812
1814
|
// A change of sheets states the sheets; what else the scope says (the cards it leaves out,
|
|
1813
1815
|
// whether it covers Document sheets) stays.
|
|
1814
|
-
...
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
new Set([...
|
|
1816
|
+
...l.sheetIds !== void 0 ? { scope: Ra(
|
|
1817
|
+
T.scope,
|
|
1818
|
+
Et(l.sheetIds ?? void 0, h, N),
|
|
1819
|
+
new Set([...Ze(b).values()].filter((A) => A.sheetKind === "document").map((A) => A.sheetId))
|
|
1818
1820
|
) } : {},
|
|
1819
|
-
...
|
|
1821
|
+
...R ? { values: { defaultChanged: !0, target: {} } } : {}
|
|
1820
1822
|
};
|
|
1821
|
-
|
|
1823
|
+
u({ op: "filter.update", filterId: y, settings: D, changeIndex: I }, h), l.sheetIds !== void 0 && L.set(y, { sheetIds: l.sheetIds ?? "all", changeIndex: I }), R && P.set(y, { values: l.defaultValues, period: l.defaultPeriod, changeIndex: I }), s.push({ ref: l.filterId, kind: "filter", id: y, title: T.label, changeIndex: I });
|
|
1822
1824
|
break;
|
|
1823
1825
|
}
|
|
1824
1826
|
case "filter.remove": {
|
|
1825
|
-
const
|
|
1826
|
-
|
|
1827
|
+
const y = F(l.filterId, `${h}.filterId`), C = ((ft = (b.inputs ?? []).find((T) => T.id === y)) == null ? void 0 : ft.label) ?? "";
|
|
1828
|
+
u({ op: "filter.remove", filterId: y, changeIndex: I }, h), s.push({ ref: l.filterId, kind: "filter", id: y, title: C, changeIndex: I });
|
|
1827
1829
|
break;
|
|
1828
1830
|
}
|
|
1829
1831
|
case "filter.bind": {
|
|
1830
|
-
const
|
|
1831
|
-
|
|
1832
|
+
const y = F(l.filterId, `${h}.filterId`), C = Se(b, y, void 0, _);
|
|
1833
|
+
C != null && C.editable || f({
|
|
1832
1834
|
code: "filter_not_editable",
|
|
1833
|
-
message:
|
|
1834
|
-
path: `${
|
|
1835
|
+
message: C && !C.editable ? C.notEditable.message : "This filter can't be changed through the MCP.",
|
|
1836
|
+
path: `${h}.filterId`,
|
|
1835
1837
|
fix: "Tell the user to change it in the editor; removing or excluding it works."
|
|
1836
1838
|
});
|
|
1837
|
-
const
|
|
1838
|
-
|
|
1839
|
+
const T = g(l.cardId, `${h}.cardId`), w = ie(b).find((D) => D.cardId === T).card, R = await Rn(w, l.field, a, `${h}.field`, f);
|
|
1840
|
+
u({ op: "filter.bind", filterId: y, cardId: T, binding: { kind: "bound", cardId: T, bindingId: a.newId(), target: R }, changeIndex: I }, h), s.push({ ref: l.filterId, kind: "filter", id: y, title: C.label, changeIndex: I });
|
|
1839
1841
|
break;
|
|
1840
1842
|
}
|
|
1841
1843
|
case "layout.arrange": {
|
|
1842
|
-
const
|
|
1843
|
-
const
|
|
1844
|
-
return
|
|
1845
|
-
code:
|
|
1846
|
-
message:
|
|
1847
|
-
path: `${
|
|
1848
|
-
fix:
|
|
1849
|
-
details: { sheets:
|
|
1850
|
-
}),
|
|
1844
|
+
const y = l.sheetId ? N(l.sheetId, `${h}.sheetId`) : (() => {
|
|
1845
|
+
const C = $();
|
|
1846
|
+
return C.length !== 1 && f({
|
|
1847
|
+
code: C.length ? "sheet_required" : "sheet_not_a_grid",
|
|
1848
|
+
message: C.length ? "This dashboard has several grid sheets; say which one to arrange." : "This dashboard has no grid sheet to arrange.",
|
|
1849
|
+
path: `${h}.sheetId`,
|
|
1850
|
+
fix: C.length ? "Send sheetId: one of details.sheets." : "Add a grid sheet in the editor first.",
|
|
1851
|
+
details: { sheets: x() }
|
|
1852
|
+
}), C[0];
|
|
1851
1853
|
})();
|
|
1852
|
-
|
|
1854
|
+
u({ op: "layout.arrange", sheetId: y.id, ...l.keepOrder ? { keepOrder: !0 } : {}, changeIndex: I }, h);
|
|
1853
1855
|
break;
|
|
1854
1856
|
}
|
|
1855
1857
|
case "filter.exclude": {
|
|
1856
|
-
const
|
|
1857
|
-
|
|
1858
|
+
const y = F(l.filterId, `${h}.filterId`), C = g(l.cardId, `${h}.cardId`), T = ((mt = (b.inputs ?? []).find((w) => w.id === y)) == null ? void 0 : mt.label) ?? "";
|
|
1859
|
+
u({ op: "filter.exclude", filterId: y, cardId: C, changeIndex: I }, h), s.push({ ref: l.filterId, kind: "filter", id: y, title: T, changeIndex: I });
|
|
1858
1860
|
break;
|
|
1859
1861
|
}
|
|
1860
1862
|
}
|
|
1861
|
-
} catch (
|
|
1862
|
-
if (!(
|
|
1863
|
+
} catch (y) {
|
|
1864
|
+
if (!(y instanceof Ie)) throw y;
|
|
1863
1865
|
}
|
|
1864
1866
|
}
|
|
1865
|
-
if (
|
|
1866
|
-
const
|
|
1867
|
-
if (!
|
|
1867
|
+
if (o.length) return { ok: !1, problems: o };
|
|
1868
|
+
const U = St(e, r, p);
|
|
1869
|
+
if (!U.ok)
|
|
1868
1870
|
return {
|
|
1869
1871
|
ok: !1,
|
|
1870
1872
|
problems: [
|
|
1871
1873
|
{
|
|
1872
1874
|
code: "invalid_change",
|
|
1873
|
-
message:
|
|
1874
|
-
path: `changes[${((
|
|
1875
|
+
message: U.failedAt.message,
|
|
1876
|
+
path: `changes[${((ht = r[U.failedAt.index]) == null ? void 0 : ht.changeIndex) ?? 0}]`,
|
|
1875
1877
|
fix: "Read the outline again and propose again."
|
|
1876
1878
|
}
|
|
1877
1879
|
]
|
|
1878
1880
|
};
|
|
1879
|
-
for (const
|
|
1880
|
-
const
|
|
1881
|
-
if (!
|
|
1882
|
-
const
|
|
1883
|
-
|
|
1881
|
+
for (const I of d) {
|
|
1882
|
+
const l = ue(U.dashboard, I);
|
|
1883
|
+
if (!l) continue;
|
|
1884
|
+
const h = ((pt = r.find((w) => it(w) === I)) == null ? void 0 : pt.changeIndex) ?? 0, y = me(l.card, { sql: !0 }), C = Qe(l.card.type);
|
|
1885
|
+
y.editable && ("sql" in y.query ? !!y.query.sql : "measures" in y.query ? y.query.measures.length > 0 : y.query.columns.length > 0) && ((gt = ye[C]) == null ? void 0 : gt.forms.includes(Ne(y.query))) || o.push({
|
|
1884
1886
|
code: "type_not_supported",
|
|
1885
|
-
message: `As changed, "${
|
|
1886
|
-
path: `changes[${
|
|
1887
|
-
fix: `Send a complete query with the type change: ${((
|
|
1887
|
+
message: `As changed, "${l.card.title}" would have no query a ${C.replace(/_/g, " ")} can run.`,
|
|
1888
|
+
path: `changes[${h}]`,
|
|
1889
|
+
fix: `Send a complete query with the type change: ${((bt = ye[C]) == null ? void 0 : bt.forms.map((w) => Ae[w]).join(" or ")) ?? "a measures query"}.`
|
|
1888
1890
|
});
|
|
1889
1891
|
}
|
|
1890
|
-
if (
|
|
1891
|
-
for (const
|
|
1892
|
-
if (
|
|
1893
|
-
const
|
|
1894
|
-
if (!(
|
|
1895
|
-
const
|
|
1896
|
-
const
|
|
1897
|
-
for (const
|
|
1898
|
-
const
|
|
1899
|
-
domainId:
|
|
1900
|
-
fromDataset:
|
|
1901
|
-
field:
|
|
1902
|
-
toDataset:
|
|
1892
|
+
if (o.push(...kn(e, U.dashboard, r, L, _)), o.push(...Dn(U.dashboard, P, a.calendar)), o.length) return { ok: !1, problems: o };
|
|
1893
|
+
for (const I of r) {
|
|
1894
|
+
if (I.op !== "filter.add" && !(I.op === "filter.update" && I.settings.scope)) continue;
|
|
1895
|
+
const l = I.op === "filter.add" ? I.input.id : I.filterId, h = Se(U.dashboard, l, void 0, _);
|
|
1896
|
+
if (!(h != null && h.editable)) continue;
|
|
1897
|
+
const y = async (T) => {
|
|
1898
|
+
const w = [];
|
|
1899
|
+
for (const R of T) {
|
|
1900
|
+
const D = R.datasetName ? await a.findRelationshipFields({
|
|
1901
|
+
domainId: h.domainId,
|
|
1902
|
+
fromDataset: h.datasetName,
|
|
1903
|
+
field: h.field,
|
|
1904
|
+
toDataset: R.datasetName
|
|
1903
1905
|
}) : [];
|
|
1904
|
-
|
|
1906
|
+
w.push({ ...R, suggestedFields: D });
|
|
1905
1907
|
}
|
|
1906
|
-
return
|
|
1907
|
-
},
|
|
1908
|
-
if (
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1908
|
+
return w;
|
|
1909
|
+
}, C = (T) => T.map((w) => `"${w.title}"`).join(", ");
|
|
1910
|
+
if (h.notReached.length) {
|
|
1911
|
+
const T = await y(h.notReached);
|
|
1912
|
+
n.push({
|
|
1911
1913
|
code: "filter_not_reaching_cards",
|
|
1912
|
-
message: `"${
|
|
1913
|
-
path: `changes[${
|
|
1914
|
+
message: `"${h.label}" doesn't reach ${T.length} card${T.length === 1 ? "" : "s"} on its sheets: ${C(T)}.`,
|
|
1915
|
+
path: `changes[${I.changeIndex ?? 0}]`,
|
|
1914
1916
|
fix: "Add filter.bind with one of the suggested fields to reach a card, or leave it unfiltered.",
|
|
1915
|
-
details: { cards:
|
|
1917
|
+
details: { cards: T }
|
|
1916
1918
|
});
|
|
1917
1919
|
}
|
|
1918
|
-
if ((
|
|
1919
|
-
const
|
|
1920
|
-
|
|
1920
|
+
if ((yt = h.relationshipPending) != null && yt.length) {
|
|
1921
|
+
const T = await y(h.relationshipPending);
|
|
1922
|
+
n.push({
|
|
1921
1923
|
code: "filter_reach_through_relationships",
|
|
1922
|
-
message: `"${
|
|
1923
|
-
path: `changes[${
|
|
1924
|
+
message: `"${h.label}" may reach ${T.length} card${T.length === 1 ? "" : "s"} on its sheets through the domain's relationships: ${C(T)}. Whether it applies is decided when each card runs.`,
|
|
1925
|
+
path: `changes[${I.changeIndex ?? 0}]`,
|
|
1924
1926
|
fix: "Add filter.bind with one of the suggested fields to make it certain, or leave it to the relationships.",
|
|
1925
|
-
details: { cards:
|
|
1927
|
+
details: { cards: T }
|
|
1926
1928
|
});
|
|
1927
1929
|
}
|
|
1928
1930
|
}
|
|
1929
|
-
const
|
|
1931
|
+
const Me = Fn(U.dashboard, r, U.descriptions, _);
|
|
1930
1932
|
return {
|
|
1931
1933
|
ok: !0,
|
|
1932
|
-
operations:
|
|
1933
|
-
context:
|
|
1934
|
-
dashboard:
|
|
1935
|
-
refs:
|
|
1936
|
-
descriptions:
|
|
1937
|
-
changedCardIds:
|
|
1938
|
-
requires: [...
|
|
1939
|
-
warnings:
|
|
1934
|
+
operations: r,
|
|
1935
|
+
context: p,
|
|
1936
|
+
dashboard: U.dashboard,
|
|
1937
|
+
refs: s,
|
|
1938
|
+
descriptions: Me,
|
|
1939
|
+
changedCardIds: d,
|
|
1940
|
+
requires: [...i],
|
|
1941
|
+
warnings: n
|
|
1940
1942
|
};
|
|
1941
1943
|
}
|
|
1942
|
-
function
|
|
1943
|
-
const
|
|
1944
|
-
if (!r.length) return [...a];
|
|
1945
|
-
const n = Rt(e, void 0, s);
|
|
1944
|
+
function Fn(e, t, a, o) {
|
|
1945
|
+
const n = t.filter((d) => d.op === "card.add");
|
|
1946
1946
|
if (!n.length) return [...a];
|
|
1947
|
-
const
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
const
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
...p.length ? [
|
|
1947
|
+
const r = ta(e, void 0, o);
|
|
1948
|
+
if (!r.length) return [...a];
|
|
1949
|
+
const s = (d) => za(d.map((c) => `"${c}"`)), i = /* @__PURE__ */ new Map();
|
|
1950
|
+
for (const d of n) {
|
|
1951
|
+
const c = it(d);
|
|
1952
|
+
if (!c || d.changeIndex === void 0) continue;
|
|
1953
|
+
const p = r.filter((m) => m.reaches.includes(c)).map((m) => m.label), _ = r.filter((m) => {
|
|
1954
|
+
var f;
|
|
1955
|
+
return "notReached" in m && ((f = m.notReached) == null ? void 0 : f.some((S) => S.cardId === c));
|
|
1956
|
+
}).map((m) => m.label), b = r.filter((m) => {
|
|
1957
|
+
var f;
|
|
1958
|
+
return (f = m.relationshipPending) == null ? void 0 : f.some((S) => S.cardId === c);
|
|
1959
|
+
}).map((m) => m.label), v = [
|
|
1960
|
+
...p.length ? [`The dashboard's ${s(p)} filter${p.length === 1 ? " applies" : "s apply"} to it.`] : [],
|
|
1961
|
+
..._.length ? [`${s(_)} ${_.length === 1 ? "doesn't" : "don't"} reach it.`] : [],
|
|
1962
|
+
...b.length ? [`${s(b)} may reach it through the domain's relationships.`] : []
|
|
1961
1963
|
];
|
|
1962
|
-
|
|
1964
|
+
v.length && i.set(d.changeIndex, v.join(" "));
|
|
1963
1965
|
}
|
|
1964
|
-
return a.map((
|
|
1965
|
-
const
|
|
1966
|
-
return
|
|
1966
|
+
return a.map((d) => {
|
|
1967
|
+
const c = d.changeIndex === void 0 ? void 0 : i.get(d.changeIndex);
|
|
1968
|
+
return c ? { ...d, sentence: `${d.sentence} ${c}` } : d;
|
|
1967
1969
|
});
|
|
1968
1970
|
}
|
|
1969
|
-
function
|
|
1971
|
+
function it(e) {
|
|
1970
1972
|
var t;
|
|
1971
1973
|
if (e.op === "card.update" || e.op === "card.remove") return e.cardId;
|
|
1972
1974
|
if (e.op === "card.add") return (t = e.frame.cards[0]) == null ? void 0 : t.id;
|
|
1973
1975
|
}
|
|
1974
|
-
function
|
|
1976
|
+
function xn(e) {
|
|
1975
1977
|
return Object.fromEntries(
|
|
1976
|
-
|
|
1978
|
+
Qa.flatMap((t) => e[t] === void 0 ? [] : [[t, e[t]]])
|
|
1977
1979
|
);
|
|
1978
1980
|
}
|
|
1979
|
-
function
|
|
1981
|
+
function Tn(e, t) {
|
|
1980
1982
|
if (!t.length || !e.config) return e;
|
|
1981
|
-
const a = { ...e.config },
|
|
1983
|
+
const a = { ...e.config }, o = [];
|
|
1982
1984
|
if (a.matrix) {
|
|
1983
|
-
const
|
|
1984
|
-
for (const { key:
|
|
1985
|
-
if (
|
|
1986
|
-
const
|
|
1987
|
-
if (
|
|
1988
|
-
|
|
1985
|
+
const r = a.matrix, s = Xa(r), i = [...r.spec.rows, ...r.spec.columns], d = { ...r.presentation.levelLabels }, c = { ...r.presentation.measureLabels };
|
|
1986
|
+
for (const { key: p, label: _ } of t) {
|
|
1987
|
+
if (p.role === "metric") {
|
|
1988
|
+
const b = s.measures.findIndex((v) => je(v, p));
|
|
1989
|
+
if (b < 0) continue;
|
|
1990
|
+
c[r.spec.measures[b].id] = _;
|
|
1989
1991
|
} else {
|
|
1990
|
-
const
|
|
1991
|
-
if (
|
|
1992
|
-
|
|
1992
|
+
const b = s.levels.findIndex((v) => je(v, p));
|
|
1993
|
+
if (b < 0) continue;
|
|
1994
|
+
d[i[b].id] = _;
|
|
1993
1995
|
}
|
|
1994
|
-
|
|
1996
|
+
o.push(p);
|
|
1995
1997
|
}
|
|
1996
|
-
return a.matrix = { ...
|
|
1998
|
+
return a.matrix = { ...r, presentation: { ...r.presentation, levelLabels: d, measureLabels: c } }, { ...e, config: a, statedLabels: o };
|
|
1997
1999
|
}
|
|
1998
|
-
const
|
|
1999
|
-
for (const { key:
|
|
2000
|
-
const
|
|
2001
|
-
|
|
2000
|
+
const n = { metric: "metricColumns", group_by: "groupByColumns", detail: "detailColumns" };
|
|
2001
|
+
for (const { key: r, label: s } of t) {
|
|
2002
|
+
const i = [...a[n[r.role]] ?? []], d = Za(r.role, i).findIndex((c) => je(c, r));
|
|
2003
|
+
d < 0 || (i[d] = Ro(i[d], s), a[n[r.role]] = i, o.push(r));
|
|
2002
2004
|
}
|
|
2003
|
-
return { ...e, config: a, statedLabels:
|
|
2004
|
-
}
|
|
2005
|
-
function
|
|
2006
|
-
var
|
|
2007
|
-
const
|
|
2008
|
-
var
|
|
2009
|
-
return ((F = (
|
|
2010
|
-
},
|
|
2005
|
+
return { ...e, config: a, statedLabels: o };
|
|
2006
|
+
}
|
|
2007
|
+
function kn(e, t, a, o, n) {
|
|
2008
|
+
var S;
|
|
2009
|
+
const r = [], s = new Map(ie(t).map((u) => [u.cardId, u])), i = Ze(t), d = he(t), c = (u) => {
|
|
2010
|
+
var g, F;
|
|
2011
|
+
return ((F = (g = t.sheets) == null ? void 0 : g.find(($) => $.id === u)) == null ? void 0 : F.title) ?? u;
|
|
2012
|
+
}, p = (u, g) => {
|
|
2011
2013
|
var F;
|
|
2012
|
-
return ((F = [...a].reverse().find((
|
|
2013
|
-
},
|
|
2014
|
-
const F =
|
|
2015
|
-
if (
|
|
2014
|
+
return ((F = [...a].reverse().find(($) => it($) === g || "filterId" in $ && $.filterId === u)) == null ? void 0 : F.changeIndex) ?? 0;
|
|
2015
|
+
}, _ = (u, g) => {
|
|
2016
|
+
const F = d.findFilterInput({ inputId: u }).input, $ = s.get(g), x = `"${$.card.title ?? ""}"`, N = `"${F.label}"`;
|
|
2017
|
+
if ($.kind === "documentSectionCard")
|
|
2016
2018
|
return {
|
|
2017
2019
|
reason: "document_section",
|
|
2018
|
-
message: `${
|
|
2020
|
+
message: `${x} is in a Document section, which takes only the filters its Document sheet shows.`,
|
|
2019
2021
|
fix: "Tell the user to change where the filter shows in the editor."
|
|
2020
2022
|
};
|
|
2021
|
-
const
|
|
2022
|
-
if (
|
|
2023
|
+
const k = i.get($.sheetId);
|
|
2024
|
+
if (k && !Vt(F, k))
|
|
2023
2025
|
return {
|
|
2024
2026
|
reason: "outside_sheets",
|
|
2025
|
-
message: `${N} isn't shown on "${
|
|
2027
|
+
message: `${N} isn't shown on "${c($.sheetId)}", so it can't filter ${x}.`,
|
|
2026
2028
|
fix: "Show it on that sheet first with filter.update sheetIds (null for every sheet), in the same proposal."
|
|
2027
2029
|
};
|
|
2028
|
-
const O =
|
|
2030
|
+
const O = wo(F, $.card);
|
|
2029
2031
|
switch (O.status) {
|
|
2030
2032
|
case "incompatible":
|
|
2031
|
-
return { reason: "incompatible_field", message: `${
|
|
2033
|
+
return { reason: "incompatible_field", message: `${x} can't take ${N}'s values on that field: their types differ.`, fix: "Bind a field of the same type (filter.bind)." };
|
|
2032
2034
|
case "stale":
|
|
2033
2035
|
return {
|
|
2034
2036
|
reason: "field_not_on_card",
|
|
2035
|
-
message: `${
|
|
2037
|
+
message: `${x} doesn't have the field ${N} is bound to.`,
|
|
2036
2038
|
fix: "Bind a field the card has (filter.bind), or exclude the card (filter.exclude), in the same proposal."
|
|
2037
2039
|
};
|
|
2038
2040
|
case "ambiguous":
|
|
2039
2041
|
return {
|
|
2040
2042
|
reason: "ambiguous_field",
|
|
2041
|
-
message: `${
|
|
2043
|
+
message: `${x} has more than one field ${N} could filter.`,
|
|
2042
2044
|
fix: "Bind the field it should use (filter.bind), or exclude the card (filter.exclude), in the same proposal."
|
|
2043
2045
|
};
|
|
2044
2046
|
case "relationship": {
|
|
2045
|
-
const E =
|
|
2047
|
+
const E = Oe(F, $.card, n);
|
|
2046
2048
|
return E.reach === "blocked" ? {
|
|
2047
2049
|
reason: "relationship_route_changed",
|
|
2048
|
-
message: `The relationships ${
|
|
2050
|
+
message: `The relationships ${x} used for ${N} changed in the domain.`,
|
|
2049
2051
|
fix: "Tell the user to choose the relationship again in the filter's Cards tab."
|
|
2050
2052
|
} : E.reason === "relationship_ambiguous" ? {
|
|
2051
2053
|
reason: "relationship_ambiguous",
|
|
2052
|
-
message: `${N} connects to ${
|
|
2054
|
+
message: `${N} connects to ${x} through more than one path.`,
|
|
2053
2055
|
fix: "Tell the user to choose a path in the filter's Cards tab, or bind a field the card has (filter.bind)."
|
|
2054
2056
|
} : {
|
|
2055
2057
|
reason: "relationship_pending",
|
|
2056
|
-
message: `${N} may reach ${
|
|
2058
|
+
message: `${N} may reach ${x} through the domain's relationships; whether it applies is decided when the card runs.`,
|
|
2057
2059
|
fix: "Bind a field the card has (filter.bind) to make it certain, or leave it to the relationships."
|
|
2058
2060
|
};
|
|
2059
2061
|
}
|
|
@@ -2064,533 +2066,1242 @@ function qs(e, t, a, s, r) {
|
|
|
2064
2066
|
case "automatic":
|
|
2065
2067
|
case "passthrough":
|
|
2066
2068
|
case "notApplicable":
|
|
2067
|
-
return { reason: "filter_settings_override", message: `${N} still wouldn't filter ${
|
|
2069
|
+
return { reason: "filter_settings_override", message: `${N} still wouldn't filter ${x}: its settings leave that card out.`, fix: "Tell the user to change the filter's settings in the editor." };
|
|
2068
2070
|
default: {
|
|
2069
2071
|
const E = O;
|
|
2070
2072
|
throw new Error(`Unhandled filter card target ${String(E.status)}`);
|
|
2071
2073
|
}
|
|
2072
2074
|
}
|
|
2073
|
-
},
|
|
2074
|
-
for (const
|
|
2075
|
-
(
|
|
2076
|
-
for (const
|
|
2077
|
-
const
|
|
2078
|
-
if (!
|
|
2079
|
-
const
|
|
2080
|
-
if (
|
|
2081
|
-
|
|
2082
|
-
const
|
|
2083
|
-
|
|
2075
|
+
}, b = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Map();
|
|
2076
|
+
for (const u of a)
|
|
2077
|
+
(u.op === "filter.bind" || u.op === "filter.exclude") && v.set(`${u.filterId}|${u.cardId}`, u);
|
|
2078
|
+
for (const u of v.values()) {
|
|
2079
|
+
const g = Se(t, u.filterId, void 0, n), F = s.get(u.cardId);
|
|
2080
|
+
if (!g || !F) continue;
|
|
2081
|
+
const $ = g.reaches.includes(u.cardId);
|
|
2082
|
+
if (u.op === "filter.bind" ? $ : !$) continue;
|
|
2083
|
+
b.add(`${u.filterId}|${u.cardId}`);
|
|
2084
|
+
const x = u.op === "filter.bind" ? _(u.filterId, u.cardId) : { reason: "filter_settings_override", message: `"${g.label}" would still filter "${F.card.title ?? ""}".`, fix: "Tell the user to change the filter's settings in the editor." };
|
|
2085
|
+
r.push({
|
|
2084
2086
|
code: "filter_not_editable",
|
|
2085
|
-
message:
|
|
2086
|
-
path: `changes[${
|
|
2087
|
-
fix:
|
|
2088
|
-
details: { reason:
|
|
2087
|
+
message: x.message,
|
|
2088
|
+
path: `changes[${u.changeIndex ?? 0}]`,
|
|
2089
|
+
fix: x.fix,
|
|
2090
|
+
details: { reason: x.reason, cardId: u.cardId }
|
|
2089
2091
|
});
|
|
2090
2092
|
}
|
|
2091
|
-
for (const [
|
|
2092
|
-
const F =
|
|
2093
|
+
for (const [u, g] of o) {
|
|
2094
|
+
const F = Se(t, u, void 0, n);
|
|
2093
2095
|
if (!F) continue;
|
|
2094
|
-
const
|
|
2096
|
+
const $ = F.editable && ((S = F.exceptSheetIds) == null ? void 0 : S.some((k) => {
|
|
2095
2097
|
var O;
|
|
2096
|
-
return ((O =
|
|
2097
|
-
})),
|
|
2098
|
-
|
|
2098
|
+
return ((O = i.get(k)) == null ? void 0 : O.sheetKind) === "dashboard";
|
|
2099
|
+
})), x = F.editable && !$ ? F.sheetIds : void 0, N = g.sheetIds === "all" ? "all" : [...g.sheetIds].sort();
|
|
2100
|
+
et(x === "all" || !x ? x : [...x].sort(), N) || r.push({
|
|
2099
2101
|
code: "filter_not_editable",
|
|
2100
2102
|
message: `"${F.label}" wouldn't show on the sheets asked for. Change where it shows in the editor.`,
|
|
2101
|
-
path: `changes[${
|
|
2103
|
+
path: `changes[${g.changeIndex}].sheetIds`,
|
|
2102
2104
|
fix: "Tell the user to change the filter's sheets in the editor.",
|
|
2103
|
-
details: { reason: "filter_settings_override", ...
|
|
2105
|
+
details: { reason: "filter_settings_override", ...x ? { sheetIds: x } : {} }
|
|
2104
2106
|
});
|
|
2105
2107
|
}
|
|
2106
|
-
const
|
|
2107
|
-
for (const
|
|
2108
|
-
const
|
|
2109
|
-
for (const F of
|
|
2110
|
-
if (
|
|
2111
|
-
const
|
|
2112
|
-
if (
|
|
2113
|
-
const N =
|
|
2114
|
-
|
|
2108
|
+
const m = he(e), f = (u) => u === "blocked" || u === "ambiguous";
|
|
2109
|
+
for (const u of d.inputs) {
|
|
2110
|
+
const g = u.input.id;
|
|
2111
|
+
for (const F of d.reachedCards({ inputId: g })) {
|
|
2112
|
+
if (b.has(`${g}|${F.cardId}`) || !f(Oe(u.input, F.card, n).reach)) continue;
|
|
2113
|
+
const $ = m.findFilterInput({ inputId: g }), x = $ && m.reachedCards({ inputId: g }).find((k) => k.cardId === F.cardId);
|
|
2114
|
+
if ($ && x && f(Oe($.input, x.card, n).reach)) continue;
|
|
2115
|
+
const N = _(g, F.cardId);
|
|
2116
|
+
r.push({
|
|
2115
2117
|
code: "invalid_change",
|
|
2116
|
-
message: `${N.message} The card would stop showing data while "${
|
|
2117
|
-
path: `changes[${
|
|
2118
|
+
message: `${N.message} The card would stop showing data while "${u.input.label}" has a value.`,
|
|
2119
|
+
path: `changes[${p(g, F.cardId)}]`,
|
|
2118
2120
|
fix: N.fix,
|
|
2119
|
-
details: { reason: N.reason, filterId:
|
|
2121
|
+
details: { reason: N.reason, filterId: g, cardId: F.cardId }
|
|
2120
2122
|
});
|
|
2121
2123
|
}
|
|
2122
2124
|
}
|
|
2123
|
-
return
|
|
2125
|
+
return r;
|
|
2124
2126
|
}
|
|
2125
|
-
function
|
|
2126
|
-
const
|
|
2127
|
-
for (const [
|
|
2128
|
-
const
|
|
2129
|
-
if (!
|
|
2130
|
-
const
|
|
2127
|
+
function Dn(e, t, a) {
|
|
2128
|
+
const o = [], n = he(e);
|
|
2129
|
+
for (const [r, s] of t) {
|
|
2130
|
+
const i = n.findFilterInput({ inputId: r });
|
|
2131
|
+
if (!i) continue;
|
|
2132
|
+
const d = Bt({ dashboard: e, target: { kind: "dashboardInput", input: i.input, scope: {} }, calendar: a }).value, c = i.input.filter.dateSelectionMode, p = c === "day" ? "its date picker takes one day" : void 0, _ = (b, v) => o.push({
|
|
2131
2133
|
code: "filter_not_editable",
|
|
2132
|
-
message:
|
|
2133
|
-
path: `changes[${
|
|
2134
|
-
fix:
|
|
2135
|
-
details: { reason: "default_not_applied", ...
|
|
2134
|
+
message: b,
|
|
2135
|
+
path: `changes[${s.changeIndex}]`,
|
|
2136
|
+
fix: v,
|
|
2137
|
+
details: { reason: "default_not_applied", ...c ? { datePicker: c } : {} }
|
|
2136
2138
|
});
|
|
2137
|
-
if (
|
|
2138
|
-
const
|
|
2139
|
-
(
|
|
2140
|
-
`"${
|
|
2141
|
-
|
|
2139
|
+
if (s.period) {
|
|
2140
|
+
const b = zt(s.period), v = d && "relativeMeta" in d ? d.relativeMeta : void 0;
|
|
2141
|
+
(!v || !et(v, b)) && _(
|
|
2142
|
+
`"${i.input.label}" wouldn't load with that default${p ? `: ${p}` : ""}.`,
|
|
2143
|
+
p ? "Ask for a default the picker can take, or tell the user to make it a date range in the editor." : "Tell the user to change the filter's default in the editor."
|
|
2142
2144
|
);
|
|
2143
|
-
} else if (
|
|
2144
|
-
const
|
|
2145
|
-
(!
|
|
2145
|
+
} else if (s.values) {
|
|
2146
|
+
const b = (v) => JSON.stringify((v ?? []).map(String).sort());
|
|
2147
|
+
(!d || b(d.values) !== b(s.values)) && _(`"${i.input.label}" wouldn't load with those values.`, "Tell the user to change the filter's default in the editor.");
|
|
2146
2148
|
} else
|
|
2147
|
-
(
|
|
2149
|
+
(Gt(i.input.filter.dataType) ? s.period === null : s.values === null) && d && _(`"${i.input.label}" would still load with a default.`, "Tell the user to change the filter's default in the editor.");
|
|
2148
2150
|
}
|
|
2149
|
-
return
|
|
2151
|
+
return o;
|
|
2150
2152
|
}
|
|
2151
|
-
function
|
|
2152
|
-
const
|
|
2153
|
-
if (!e ||
|
|
2154
|
-
const
|
|
2155
|
-
return
|
|
2153
|
+
function An(e, t, a, o) {
|
|
2154
|
+
const n = Object.fromEntries(Object.entries(t).filter(([, p]) => p != null)), r = Ne(n), s = Ne(e), i = (p) => Ot[p].safeParse(n);
|
|
2155
|
+
if (!e || r && r !== s) {
|
|
2156
|
+
const p = r ?? s, _ = p ? i(p) : void 0;
|
|
2157
|
+
return _ != null && _.success ? _.data : o({
|
|
2156
2158
|
code: e ? "query_form_mismatch" : "type_not_supported",
|
|
2157
2159
|
message: e ? "This patch changes the query's form (measures, records or SQL) without a complete query." : "This card's current query can't be patched; send a complete query.",
|
|
2158
2160
|
path: a,
|
|
2159
2161
|
fix: "Send a complete query of the new form: domainId, datasetName and measures (or columns), or connectionId and sql."
|
|
2160
2162
|
});
|
|
2161
2163
|
}
|
|
2162
|
-
const
|
|
2163
|
-
for (const [
|
|
2164
|
-
|
|
2165
|
-
const
|
|
2166
|
-
if (!
|
|
2167
|
-
const
|
|
2168
|
-
return
|
|
2169
|
-
code: (
|
|
2170
|
-
message: (
|
|
2171
|
-
path:
|
|
2164
|
+
const d = { ...e };
|
|
2165
|
+
for (const [p, _] of Object.entries(t))
|
|
2166
|
+
_ !== void 0 && (_ === null ? delete d[p] : d[p] = _);
|
|
2167
|
+
const c = Ot[s].safeParse(d);
|
|
2168
|
+
if (!c.success) {
|
|
2169
|
+
const p = c.error.issues[0];
|
|
2170
|
+
return o({
|
|
2171
|
+
code: (p == null ? void 0 : p.code) === "unrecognized_keys" ? "query_form_mismatch" : "invalid_change",
|
|
2172
|
+
message: (p == null ? void 0 : p.message) ?? "The merged query is not valid.",
|
|
2173
|
+
path: p ? aa(a, p) : a,
|
|
2172
2174
|
fix: "Patch only keys of the card's query form, or send a complete query of a new form."
|
|
2173
2175
|
});
|
|
2174
2176
|
}
|
|
2175
|
-
return
|
|
2176
|
-
}
|
|
2177
|
-
function
|
|
2178
|
-
return e ? (e.forEach((
|
|
2179
|
-
}
|
|
2180
|
-
function
|
|
2181
|
-
["date", "datetime", "timestamp"].some((
|
|
2182
|
-
const
|
|
2183
|
-
if (!
|
|
2184
|
-
const
|
|
2185
|
-
if (!
|
|
2186
|
-
const
|
|
2187
|
-
return
|
|
2177
|
+
return c.data;
|
|
2178
|
+
}
|
|
2179
|
+
function Et(e, t, a) {
|
|
2180
|
+
return e ? (e.forEach((o, n) => a(o, `${t}.sheetIds[${n}]`)), { kind: "sheets", sheetIds: [...e] }) : { kind: "allSheets", sheetKinds: ["dashboard"] };
|
|
2181
|
+
}
|
|
2182
|
+
function Nt(e, t, a, o) {
|
|
2183
|
+
["date", "datetime", "timestamp"].some((s) => We(t.dataType).includes(s)) || o({ code: "invalid_change", message: "defaultPeriod is for date filters.", path: a, fix: "Use defaultValues for this field." });
|
|
2184
|
+
const r = zt(e);
|
|
2185
|
+
if (!r) {
|
|
2186
|
+
const s = "anchor" in e && e.anchor === "latest_available";
|
|
2187
|
+
if (!s && ho(e)) {
|
|
2188
|
+
const i = e.unit;
|
|
2189
|
+
return o({
|
|
2188
2190
|
code: "invalid_change",
|
|
2189
|
-
message: `A filter's default can't count a partial ${
|
|
2191
|
+
message: `A filter's default can't count a partial ${i} back from now; its presets are whole days with today, complete ${i}s, or a calendar ${i}.`,
|
|
2190
2192
|
path: a,
|
|
2191
|
-
fix: `Use completeness "complete_periods", days ({ unit: "day", value: N }), or { kind: "calendar", unit: "${
|
|
2193
|
+
fix: `Use completeness "complete_periods", days ({ unit: "day", value: N }), or { kind: "calendar", unit: "${i}", period: "this", toDate: true }; ask the user which they mean.`
|
|
2192
2194
|
});
|
|
2193
2195
|
}
|
|
2194
|
-
return
|
|
2196
|
+
return o({
|
|
2195
2197
|
code: "invalid_change",
|
|
2196
|
-
message:
|
|
2198
|
+
message: s ? "A filter's default runs to now, not to the latest available data." : "This period can't be a filter's default.",
|
|
2197
2199
|
path: a,
|
|
2198
|
-
fix:
|
|
2200
|
+
fix: s ? "Leave out anchor (a filter default runs to now)." : 'Use days ({ unit: "day", value: N }), complete periods, or a calendar window ({ kind: "calendar", unit, period }).'
|
|
2199
2201
|
});
|
|
2200
2202
|
}
|
|
2201
|
-
return
|
|
2203
|
+
return r;
|
|
2202
2204
|
}
|
|
2203
|
-
async function
|
|
2204
|
-
const
|
|
2205
|
-
if (!
|
|
2206
|
-
return
|
|
2205
|
+
async function Rn(e, t, a, o, n) {
|
|
2206
|
+
const r = La(e), s = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((m) => m.source) : [], i = ve(e), d = typeof t == "string" ? (i == null ? void 0 : i.kind) === "semantic" ? i.datasetName : void 0 : t.datasetName, c = s.find((m) => m.kind === "semantic" && We(m.datasetName) === We(d));
|
|
2207
|
+
if (!c || c.kind !== "semantic")
|
|
2208
|
+
return n({
|
|
2207
2209
|
code: "field_not_found",
|
|
2208
|
-
message: `"${e.title}" doesn't read ${
|
|
2209
|
-
path:
|
|
2210
|
+
message: `"${e.title}" doesn't read ${d ? `the dataset ${d}` : "a dataset"}.`,
|
|
2211
|
+
path: o,
|
|
2210
2212
|
fix: "Name a field of the card's own dataset, or { name, datasetName } for a dataset its query joins."
|
|
2211
2213
|
});
|
|
2212
|
-
const
|
|
2213
|
-
return
|
|
2214
|
+
const p = await a.loadCardSource({ domainId: c.domainId, datasetName: c.datasetName }), _ = typeof t == "string" ? t : t.name, b = p ? jt(p.fields, _, c.datasetName) : void 0, v = b ? ua(c, { column_name: b.name, data_type: b.dataType, ...b.sourceField ? { sourceField: b.sourceField } : {} }) : void 0;
|
|
2215
|
+
return v || n({
|
|
2214
2216
|
code: "field_not_found",
|
|
2215
|
-
message: `"${
|
|
2216
|
-
path:
|
|
2217
|
+
message: `"${_}" isn't a field of ${c.datasetName}.`,
|
|
2218
|
+
path: o,
|
|
2217
2219
|
fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
|
|
2218
|
-
details: { available: ((
|
|
2220
|
+
details: { available: ((p == null ? void 0 : p.fields) ?? []).slice(0, 20).map((m) => m.name) }
|
|
2219
2221
|
});
|
|
2220
2222
|
}
|
|
2221
|
-
const
|
|
2222
|
-
function
|
|
2223
|
-
var
|
|
2224
|
-
const a = (
|
|
2225
|
-
(
|
|
2226
|
-
),
|
|
2227
|
-
(e.sheets ?? []).flatMap((
|
|
2228
|
-
),
|
|
2229
|
-
(
|
|
2230
|
-
},
|
|
2231
|
-
sheetId:
|
|
2232
|
-
title:
|
|
2233
|
-
kind:
|
|
2234
|
-
...
|
|
2235
|
-
cards:
|
|
2236
|
-
var
|
|
2237
|
-
const
|
|
2238
|
-
if (
|
|
2239
|
-
const N =
|
|
2240
|
-
return
|
|
2223
|
+
const On = 50;
|
|
2224
|
+
function Hs(e, t) {
|
|
2225
|
+
var b, v;
|
|
2226
|
+
const a = (b = t.sheetIds) != null && b.length ? new Set(t.sheetIds) : void 0, o = (v = t.cardIds) != null && v.length ? new Set(t.cardIds) : void 0, n = (e.sheets ?? []).filter((m) => !a || a.has(m.id)), r = ie(e).filter(
|
|
2227
|
+
(m) => (!a || a.has(m.sheetId)) && (!o || o.has(m.cardId))
|
|
2228
|
+
), s = r.length > (t.maxQueryCards ?? On), i = new Map(
|
|
2229
|
+
(e.sheets ?? []).flatMap((m) => (m.frames ?? []).map((f) => [f.id, f]))
|
|
2230
|
+
), d = /* @__PURE__ */ new Map(), c = (m) => {
|
|
2231
|
+
(m == null ? void 0 : m.kind) === "semantic" && d.set(`${m.domainId}|${m.datasetName}`, { domainId: m.domainId, datasetName: m.datasetName });
|
|
2232
|
+
}, p = n.map((m) => ({
|
|
2233
|
+
sheetId: m.id,
|
|
2234
|
+
title: m.title ?? "",
|
|
2235
|
+
kind: m.kind === "document" ? "document" : "dashboard",
|
|
2236
|
+
...m.kind === "document" ? {} : { layout: En(m) },
|
|
2237
|
+
cards: r.filter((f) => f.sheetId === m.id).map((f) => {
|
|
2238
|
+
var x;
|
|
2239
|
+
const S = f.card, u = f.kind === "frameCard" ? (x = i.get(f.frameId)) == null ? void 0 : x.visualId : void 0, g = u ? { linkedVisualId: u } : {}, F = { cardId: f.cardId, title: S.title ?? "" };
|
|
2240
|
+
if (f.kind !== "frameCard") {
|
|
2241
|
+
const N = ve(S);
|
|
2242
|
+
return c(N), {
|
|
2241
2243
|
...F,
|
|
2242
|
-
type:
|
|
2244
|
+
type: Qe(S.type),
|
|
2243
2245
|
...N ? { source: N } : {},
|
|
2244
2246
|
editable: !1,
|
|
2245
|
-
notEditable:
|
|
2247
|
+
notEditable: f.kind === "documentSectionCard" ? { reason: "document_section", message: "Cards in Document sections can't be changed through the MCP yet. Change them in the editor." } : {
|
|
2246
2248
|
reason: "not_expressible",
|
|
2247
2249
|
message: "This card isn't in a tile, so it can't be changed through the MCP. Change it in the editor.",
|
|
2248
2250
|
detail: "a card outside a tile"
|
|
2249
2251
|
}
|
|
2250
2252
|
};
|
|
2251
2253
|
}
|
|
2252
|
-
const
|
|
2253
|
-
return
|
|
2254
|
+
const $ = me(S, { sql: t.sql });
|
|
2255
|
+
return c($.source), $.editable ? {
|
|
2254
2256
|
...F,
|
|
2255
|
-
type:
|
|
2256
|
-
source:
|
|
2257
|
-
...
|
|
2257
|
+
type: $.type,
|
|
2258
|
+
source: $.source,
|
|
2259
|
+
...g,
|
|
2258
2260
|
editable: !0,
|
|
2259
|
-
...
|
|
2261
|
+
...s ? {} : { query: $.query, ...$.matrix ? { matrix: $.matrix } : {} }
|
|
2260
2262
|
} : {
|
|
2261
2263
|
...F,
|
|
2262
|
-
type:
|
|
2263
|
-
|
|
2264
|
-
...
|
|
2264
|
+
type: $.type,
|
|
2265
|
+
...$.source ? { source: $.source } : {},
|
|
2266
|
+
...g,
|
|
2265
2267
|
editable: !1,
|
|
2266
|
-
notEditable: { reason:
|
|
2268
|
+
notEditable: { reason: $.reason, message: $.message, ...$.detail ? { detail: $.detail } : {} }
|
|
2267
2269
|
};
|
|
2268
2270
|
})
|
|
2269
|
-
})),
|
|
2271
|
+
})), _ = ta(e, Zt(t.calendar, t.updatedAt), {
|
|
2270
2272
|
...t.relationshipReach ? { relationshipReach: t.relationshipReach } : {}
|
|
2271
2273
|
});
|
|
2272
|
-
for (const
|
|
2273
|
-
|
|
2274
|
+
for (const m of _)
|
|
2275
|
+
m.editable && d.set(`${m.domainId}|${m.datasetName}`, { domainId: m.domainId, datasetName: m.datasetName });
|
|
2274
2276
|
return {
|
|
2275
2277
|
dashboardId: t.dashboardId,
|
|
2276
2278
|
title: e.title ?? "",
|
|
2277
2279
|
updatedAt: t.updatedAt,
|
|
2278
2280
|
access: t.access,
|
|
2279
|
-
datasets: [...
|
|
2280
|
-
sheets:
|
|
2281
|
-
filters:
|
|
2282
|
-
...
|
|
2281
|
+
datasets: [...d.values()],
|
|
2282
|
+
sheets: p,
|
|
2283
|
+
filters: _,
|
|
2284
|
+
...s ? { truncated: !0 } : {}
|
|
2283
2285
|
};
|
|
2284
2286
|
}
|
|
2285
|
-
function
|
|
2287
|
+
function En(e) {
|
|
2286
2288
|
const t = new Map((e.frames ?? []).map((a) => [a.id, a]));
|
|
2287
|
-
return
|
|
2288
|
-
tiles: a.tiles.map((
|
|
2289
|
-
var
|
|
2290
|
-
const
|
|
2291
|
-
return { cardIds:
|
|
2289
|
+
return vo(e).rows.map((a) => ({
|
|
2290
|
+
tiles: a.tiles.map((o) => {
|
|
2291
|
+
var i, d;
|
|
2292
|
+
const n = ((i = t.get(o.frameId)) == null ? void 0 : i.cards) ?? [], r = (d = t.get(o.frameId)) == null ? void 0 : d.activeCardId, s = n.map((c) => c.id);
|
|
2293
|
+
return { cardIds: r && s.includes(r) ? [r, ...s.filter((c) => c !== r)] : s, width: o.width };
|
|
2292
2294
|
})
|
|
2293
2295
|
}));
|
|
2294
2296
|
}
|
|
2297
|
+
function Q(e) {
|
|
2298
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
2299
|
+
}
|
|
2300
|
+
function ae(e, t) {
|
|
2301
|
+
return Q(e) && Object.prototype.hasOwnProperty.call(e, t) && e[t] !== void 0;
|
|
2302
|
+
}
|
|
2303
|
+
const J = ae, Nn = ["metricColumns", "groupByColumns", "detailColumns", "pivotByColumns", "sortByColumns"], Pn = ["xAxisConfig", "yAxisConfig", "secondaryYAxisConfig", "tooltipConfig", "dataLabelsConfig"], qn = '`format` on the matching column in `config.metricColumns`, `groupByColumns` or `detailColumns`; for a SQL or Python card, `preferences.sqlColumns["<column>"].format`', Re = "`preferences.conditionalFormatting`, with columns named by card column id";
|
|
2304
|
+
function Mn(e) {
|
|
2305
|
+
switch (e.type) {
|
|
2306
|
+
case "number":
|
|
2307
|
+
case "currency":
|
|
2308
|
+
case "percent":
|
|
2309
|
+
case "scientific":
|
|
2310
|
+
return Io;
|
|
2311
|
+
case "date":
|
|
2312
|
+
return yo;
|
|
2313
|
+
case "duration":
|
|
2314
|
+
return bo;
|
|
2315
|
+
case "string":
|
|
2316
|
+
return go;
|
|
2317
|
+
case "temporal_bucket":
|
|
2318
|
+
return po;
|
|
2319
|
+
default:
|
|
2320
|
+
return at;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
function Ce(e, t, a) {
|
|
2324
|
+
if (a === void 0) return;
|
|
2325
|
+
const o = Q(a) ? Mn(a).safeParse(a) : at.safeParse(a);
|
|
2326
|
+
if (!o.success)
|
|
2327
|
+
for (const n of o.error.issues) {
|
|
2328
|
+
const r = n.code === "unrecognized_keys" ? n.keys : [n.path.length ? String(n.path[n.path.length - 1]) : "type"];
|
|
2329
|
+
for (const s of r)
|
|
2330
|
+
e.push({
|
|
2331
|
+
path: [t, ...n.path.map(String), ...n.code === "unrecognized_keys" ? [s] : []].join("."),
|
|
2332
|
+
field: s,
|
|
2333
|
+
replacement: s === "locale" ? "nothing: the viewer's locale applies" : n.code === "unrecognized_keys" ? "nothing: the stored format type has no such key" : `a value the stored format type accepts (${n.message})`
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
function Ge(e, t, a) {
|
|
2338
|
+
if (Q(a)) {
|
|
2339
|
+
for (const o of ["dateFormat", "customFormat"])
|
|
2340
|
+
J(a, o) && e.push({ path: `${t}.${o}`, field: o, replacement: "`format` on this column (a temporal bucket or date format)" });
|
|
2341
|
+
Ce(e, `${t}.format`, a.format);
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
function oa(e, t) {
|
|
2345
|
+
const a = [], o = e.config;
|
|
2346
|
+
for (const m of Nn) {
|
|
2347
|
+
const f = o == null ? void 0 : o[m];
|
|
2348
|
+
Array.isArray(f) && f.forEach((S, u) => Ge(a, `${t}.config.${m}[${u}]`, S));
|
|
2349
|
+
}
|
|
2350
|
+
const n = Q(o == null ? void 0 : o.matrix) ? o.matrix : void 0, r = Q(n == null ? void 0 : n.presentation) ? n.presentation : void 0;
|
|
2351
|
+
for (const m of ["measureFormats", "levelFormats"]) {
|
|
2352
|
+
const f = r == null ? void 0 : r[m];
|
|
2353
|
+
if (Q(f)) for (const [S, u] of Object.entries(f)) Ce(a, `${t}.config.matrix.presentation.${m}.${S}`, u);
|
|
2354
|
+
}
|
|
2355
|
+
J(r, "conditionalFormatting") && a.push({ path: `${t}.config.matrix.presentation.conditionalFormatting`, field: "conditionalFormatting", replacement: Re });
|
|
2356
|
+
const s = e.interactionConfig, i = s == null ? void 0 : s.drillHierarchies;
|
|
2357
|
+
Array.isArray(i) && i.forEach((m, f) => {
|
|
2358
|
+
Q(m) && (Ge(a, `${t}.interactionConfig.drillHierarchies[${f}].baseField`, m.baseField), Array.isArray(m.steps) && m.steps.forEach((S, u) => {
|
|
2359
|
+
Q(S) && Ge(a, `${t}.interactionConfig.drillHierarchies[${f}].steps[${u}].field`, S.field);
|
|
2360
|
+
}));
|
|
2361
|
+
});
|
|
2362
|
+
const d = e.preferences;
|
|
2363
|
+
if (!d) return a;
|
|
2364
|
+
const c = `${t}.preferences`;
|
|
2365
|
+
if (J(d, "formatNumber")) {
|
|
2366
|
+
const m = d.formatNumber, f = Q(m) && Object.keys(m).every((S) => S === "colorRanges");
|
|
2367
|
+
a.push(
|
|
2368
|
+
f ? { path: `${c}.formatNumber.colorRanges`, field: "colorRanges", replacement: `${Re} (a rule on the KPI's value)` } : { path: `${c}.formatNumber`, field: "formatNumber", replacement: "`format` on each measure in `config.metricColumns`; for a SQL KPI, `preferences.sqlKpiValue.format`" }
|
|
2369
|
+
);
|
|
2370
|
+
}
|
|
2371
|
+
J(d, "numberAxisFormat") && a.push({ path: `${c}.numberAxisFormat`, field: "numberAxisFormat", replacement: "`valueFormat` on `preferences.yAxisConfig` (or the axis it formats)" }), J(d, "columnSettings") && a.push({ path: `${c}.columnSettings`, field: "columnSettings", replacement: "`preferences.tablePrefs.columnSettingsMap`, keyed by column" });
|
|
2372
|
+
const p = d.kpiVisualOptions;
|
|
2373
|
+
J(p, "formatOptions") && a.push({ path: `${c}.kpiVisualOptions.formatOptions`, field: "formatOptions", replacement: "`format` on each measure in `config.metricColumns`; for a SQL KPI, `preferences.sqlKpiValue.format`" }), J(p, "queryComparisonPolarity") && a.push({ path: `${c}.kpiVisualOptions.queryComparisonPolarity`, field: "queryComparisonPolarity", replacement: "`preferences.sqlKpiValue.comparisonPolarity`" });
|
|
2374
|
+
const _ = d.tablePrefs;
|
|
2375
|
+
J(_, "conditionalFormatting") && a.push({ path: `${c}.tablePrefs.conditionalFormatting`, field: "conditionalFormatting", replacement: Re });
|
|
2376
|
+
const b = _ == null ? void 0 : _.columnSettingsMap;
|
|
2377
|
+
if (Q(b))
|
|
2378
|
+
for (const [m, f] of Object.entries(b)) {
|
|
2379
|
+
if (!Q(f)) continue;
|
|
2380
|
+
const S = `${c}.tablePrefs.columnSettingsMap.${m}`;
|
|
2381
|
+
for (const u of ["numberFormat", "dateFormat", "inheritMetricFormat"])
|
|
2382
|
+
J(f, u) && a.push({ path: `${S}.${u}`, field: u, replacement: u === "inheritMetricFormat" ? "nothing: a column follows its `format`" : qn });
|
|
2383
|
+
J(f, "colorRanges") && a.push({ path: `${S}.colorRanges`, field: "colorRanges", replacement: Re });
|
|
2384
|
+
}
|
|
2385
|
+
for (const m of Pn) {
|
|
2386
|
+
const f = d[m];
|
|
2387
|
+
if (Q(f)) {
|
|
2388
|
+
for (const S of ["formatMode", "mode", "formatOptions"])
|
|
2389
|
+
J(f, S) && a.push({ path: `${c}.${m}.${S}`, field: S, replacement: `\`preferences.${m}.valueFormat\` (absent means the column's format)` });
|
|
2390
|
+
m === "dataLabelsConfig" && J(f, "format") && a.push({ path: `${c}.${m}.format`, field: "format", replacement: "`preferences.dataLabelsConfig.valueFormat`" }), Ce(a, `${c}.${m}.valueFormat`, f.valueFormat);
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
const v = d.sqlColumns;
|
|
2394
|
+
if (Q(v))
|
|
2395
|
+
for (const [m, f] of Object.entries(v))
|
|
2396
|
+
Q(f) && Ce(a, `${c}.sqlColumns.${m}.format`, f.format);
|
|
2397
|
+
return Q(d.sqlKpiValue) && Ce(a, `${c}.sqlKpiValue.format`, d.sqlKpiValue.format), a;
|
|
2398
|
+
}
|
|
2399
|
+
function Ln(e) {
|
|
2400
|
+
const t = `sheets[id=${e.sheetId}]`;
|
|
2401
|
+
switch (e.kind) {
|
|
2402
|
+
case "sheetCard":
|
|
2403
|
+
return `${t}.cards[id=${e.cardId}]`;
|
|
2404
|
+
case "frameCard":
|
|
2405
|
+
return `${t}.frames[id=${e.frameId}].cards[id=${e.cardId}]`;
|
|
2406
|
+
case "documentSectionCard":
|
|
2407
|
+
return `${t}.document.sections[id=${e.sectionId}].cards[id=${e.cardId}]`;
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
function na(e) {
|
|
2411
|
+
if (!Q(e)) return [];
|
|
2412
|
+
if (Array.isArray(e.sheets))
|
|
2413
|
+
return ie(e).map((a) => ({
|
|
2414
|
+
card: a.card,
|
|
2415
|
+
at: Ln(a)
|
|
2416
|
+
}));
|
|
2417
|
+
const t = e;
|
|
2418
|
+
return Array.isArray(t.cards) ? t.cards.map((a) => ({ card: a, at: `cards[id=${a.id}]` })) : [];
|
|
2419
|
+
}
|
|
2420
|
+
function Ys(e) {
|
|
2421
|
+
return na(e).flatMap(({ card: t, at: a }) => oa(t, a));
|
|
2422
|
+
}
|
|
2423
|
+
function Bn(e, t) {
|
|
2424
|
+
var r;
|
|
2425
|
+
const a = (r = e.preferences) == null ? void 0 : r.conditionalFormatting;
|
|
2426
|
+
if (a === void 0) return [];
|
|
2427
|
+
const o = `${t}.preferences.conditionalFormatting`, n = eo.safeParse(a);
|
|
2428
|
+
return n.success ? to(e).map((s) => ({
|
|
2429
|
+
code: "invalid_conditional_formatting",
|
|
2430
|
+
path: `${o}.rules[id=${s.ruleId}].${s.path}`,
|
|
2431
|
+
message: s.message
|
|
2432
|
+
})) : n.error.issues.map((s) => ({
|
|
2433
|
+
code: "invalid_conditional_formatting",
|
|
2434
|
+
path: [o, ...s.path.map((i) => typeof i == "number" ? `[${i}]` : i)].join(".").replace(/\.\[/g, "["),
|
|
2435
|
+
message: s.message
|
|
2436
|
+
}));
|
|
2437
|
+
}
|
|
2438
|
+
function Ws(e) {
|
|
2439
|
+
return na(e).flatMap(({ card: t, at: a }) => [
|
|
2440
|
+
...oa(t, a).map((o) => ({
|
|
2441
|
+
code: "retired_presentation_field",
|
|
2442
|
+
path: o.path,
|
|
2443
|
+
message: `\`${o.field}\` is retired: use ${o.replacement}.`
|
|
2444
|
+
})),
|
|
2445
|
+
...Bn(t, a)
|
|
2446
|
+
]);
|
|
2447
|
+
}
|
|
2448
|
+
const dt = [
|
|
2449
|
+
"metricColumns",
|
|
2450
|
+
"groupByColumns",
|
|
2451
|
+
"detailColumns",
|
|
2452
|
+
"pivotByColumns",
|
|
2453
|
+
"sortByColumns"
|
|
2454
|
+
], Vn = [
|
|
2455
|
+
"xAxisConfig",
|
|
2456
|
+
"yAxisConfig",
|
|
2457
|
+
"secondaryYAxisConfig",
|
|
2458
|
+
"tooltipConfig",
|
|
2459
|
+
"dataLabelsConfig"
|
|
2460
|
+
];
|
|
2461
|
+
function G(e) {
|
|
2462
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
2463
|
+
}
|
|
2464
|
+
function sa(e, t) {
|
|
2465
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
2466
|
+
}
|
|
2467
|
+
function le(e, t) {
|
|
2468
|
+
const a = (o) => G(o) ? Object.fromEntries(
|
|
2469
|
+
Object.keys(o).sort().map((n) => [n, a(o[n])])
|
|
2470
|
+
) : o;
|
|
2471
|
+
return sa(a(e), a(t));
|
|
2472
|
+
}
|
|
2473
|
+
function Pe(e) {
|
|
2474
|
+
const t = Ut(e);
|
|
2475
|
+
return t === "date" || t === "datetime";
|
|
2476
|
+
}
|
|
2477
|
+
function ra(e) {
|
|
2478
|
+
var t, a;
|
|
2479
|
+
return !!((t = e.sql) != null && t.trim() || (a = e.python) != null && a.trim());
|
|
2480
|
+
}
|
|
2481
|
+
function jn(e) {
|
|
2482
|
+
var t;
|
|
2483
|
+
return e.type === "kpi" && !!((t = e.sql) != null && t.trim());
|
|
2484
|
+
}
|
|
2485
|
+
function Je(e) {
|
|
2486
|
+
return e.type === "table" || e.type === "detailTable";
|
|
2487
|
+
}
|
|
2488
|
+
function H(e, t) {
|
|
2489
|
+
var o;
|
|
2490
|
+
const a = (o = e.config) == null ? void 0 : o[t];
|
|
2491
|
+
return Array.isArray(a) ? a : [];
|
|
2492
|
+
}
|
|
2493
|
+
function Kn(e, t) {
|
|
2494
|
+
for (const a of dt) {
|
|
2495
|
+
const o = H(e, a).indexOf(t);
|
|
2496
|
+
if (o >= 0) return `config.${a}[${o}]`;
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
function ge(e, t) {
|
|
2500
|
+
let a = !1;
|
|
2501
|
+
for (const o of t)
|
|
2502
|
+
Object.prototype.hasOwnProperty.call(e, o) && (delete e[o], a = !0);
|
|
2503
|
+
return a;
|
|
2504
|
+
}
|
|
2505
|
+
function qe(e, t, a, o) {
|
|
2506
|
+
t.format = a, t.formatOrigin = "override", e.changes.push({
|
|
2507
|
+
path: o,
|
|
2508
|
+
action: "moved",
|
|
2509
|
+
to: `${Kn(e.card, t) ?? "config"}.format`
|
|
2510
|
+
});
|
|
2511
|
+
}
|
|
2512
|
+
function ct(e) {
|
|
2513
|
+
if (!G(e)) return;
|
|
2514
|
+
if (e.type === "temporal_bucket") return pe(e);
|
|
2515
|
+
const t = pe(e);
|
|
2516
|
+
return (t == null ? void 0 : t.type) === "currency" && t.currency === void 0 && xo(e) ? { ...t, currency: "USD" } : t;
|
|
2517
|
+
}
|
|
2518
|
+
function Xe(e, t, a) {
|
|
2519
|
+
if (!(!ae(t, "dateFormat") && !ae(t, "customFormat"))) {
|
|
2520
|
+
if (Pe(t.dataType) && t.format == null && t.dateFormat != null) {
|
|
2521
|
+
const o = io({
|
|
2522
|
+
fieldId: t.id,
|
|
2523
|
+
dataType: t.dataType,
|
|
2524
|
+
granularity: t.granularity,
|
|
2525
|
+
dateFormat: t.dateFormat,
|
|
2526
|
+
customFormat: t.customFormat
|
|
2527
|
+
});
|
|
2528
|
+
o.ok && (t.format = o.format, t.formatOrigin = "override", e.changes.push({
|
|
2529
|
+
path: `${a}.dateFormat`,
|
|
2530
|
+
action: "moved",
|
|
2531
|
+
to: `${a}.format`
|
|
2532
|
+
}));
|
|
2533
|
+
}
|
|
2534
|
+
ge(t, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${a}.dateFormat`, action: "removed" });
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
function Un(e, t, a) {
|
|
2538
|
+
if (!ae(t, "dateFormat") && !ae(t, "customFormat")) return;
|
|
2539
|
+
const o = t.dateFormat === "custom" ? t.customFormat : t.dateFormat;
|
|
2540
|
+
e.card.type === "detailTable" && Pe(t.dataType) && !t.format && typeof o == "string" && o.trim() ? (t.format = { type: "date", pattern: o }, t.formatOrigin = "override", e.changes.push({
|
|
2541
|
+
path: `${a}.dateFormat`,
|
|
2542
|
+
action: "moved",
|
|
2543
|
+
to: `${a}.format`
|
|
2544
|
+
})) : e.card.type === "detailTable" && Pe(t.dataType) && t.format && typeof o == "string" && o.trim() && !le(t.format, { type: "date", pattern: o }) && e.unconverted.push({
|
|
2545
|
+
path: `${a}.dateFormat`,
|
|
2546
|
+
reason: "detail_date_beside_format",
|
|
2547
|
+
detail: "A detail date pattern on a column that has a format of its own."
|
|
2548
|
+
}), ge(t, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${a}.dateFormat`, action: "removed" });
|
|
2549
|
+
}
|
|
2550
|
+
function Gn(e, t, a, o) {
|
|
2551
|
+
if (t.format !== void 0) {
|
|
2552
|
+
const n = ct(t.format);
|
|
2553
|
+
n ? le(n, t.format) || (t.format = n, e.changes.push({ path: `${o}.format`, action: "cleaned" })) : (delete t.format, e.changes.push({ path: `${o}.format`, action: "removed" }));
|
|
2554
|
+
}
|
|
2555
|
+
a === "groupByColumns" || a === "pivotByColumns" ? Xe(e, t, o) : a === "detailColumns" ? Un(e, t, o) : ge(t, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${o}.dateFormat`, action: "removed" });
|
|
2556
|
+
}
|
|
2557
|
+
function zn(e, t) {
|
|
2558
|
+
for (const a of dt)
|
|
2559
|
+
H(e.card, a).forEach((o, n) => {
|
|
2560
|
+
var s;
|
|
2561
|
+
if (!o.format || o.formatOrigin) return;
|
|
2562
|
+
const r = (s = t.modelFormatFor) == null ? void 0 : s.call(t, o);
|
|
2563
|
+
o.formatOrigin = r && le(pe(r), o.format) ? "semantic" : "override", e.changes.push({
|
|
2564
|
+
path: `config.${a}[${n}].formatOrigin`,
|
|
2565
|
+
action: "marked"
|
|
2566
|
+
});
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2569
|
+
function Qn(e) {
|
|
2570
|
+
var a;
|
|
2571
|
+
const t = (a = e.card.interactionConfig) == null ? void 0 : a.drillHierarchies;
|
|
2572
|
+
Array.isArray(t) && t.forEach((o, n) => {
|
|
2573
|
+
if (!G(o)) return;
|
|
2574
|
+
const r = `interactionConfig.drillHierarchies[${n}]`;
|
|
2575
|
+
G(o.baseField) && Xe(e, o.baseField, `${r}.baseField`), Array.isArray(o.steps) && o.steps.forEach((s, i) => {
|
|
2576
|
+
if (G(s) && G(s.field)) {
|
|
2577
|
+
const d = s.field, c = `${r}.steps[${i}].field`;
|
|
2578
|
+
if (d.format !== void 0) {
|
|
2579
|
+
const p = ct(d.format);
|
|
2580
|
+
p && !le(p, d.format) && (d.format = p, e.changes.push({ path: `${c}.format`, action: "cleaned" }));
|
|
2581
|
+
}
|
|
2582
|
+
Xe(e, d, c);
|
|
2583
|
+
}
|
|
2584
|
+
});
|
|
2585
|
+
});
|
|
2586
|
+
}
|
|
2587
|
+
const Hn = [
|
|
2588
|
+
"numberFormat",
|
|
2589
|
+
"dateFormat",
|
|
2590
|
+
"inheritMetricFormat",
|
|
2591
|
+
"colorRanges"
|
|
2592
|
+
];
|
|
2593
|
+
function Yn(e, t) {
|
|
2594
|
+
const a = (n) => n == null ? void 0 : n.trim().toLowerCase(), o = a(t);
|
|
2595
|
+
return [
|
|
2596
|
+
e.id,
|
|
2597
|
+
e.alias,
|
|
2598
|
+
e.name,
|
|
2599
|
+
e.qualifiedFieldName,
|
|
2600
|
+
e.label,
|
|
2601
|
+
e.role === "metric" ? Do(e) : void 0
|
|
2602
|
+
].some((n) => n !== void 0 && a(n) === o);
|
|
2603
|
+
}
|
|
2604
|
+
function Pt(e, t) {
|
|
2605
|
+
const a = co(e, { columnId: t });
|
|
2606
|
+
if (a) return a;
|
|
2607
|
+
const o = [
|
|
2608
|
+
...H(e, "detailColumns"),
|
|
2609
|
+
...H(e, "metricColumns"),
|
|
2610
|
+
...H(e, "groupByColumns")
|
|
2611
|
+
].filter((n) => Yn(n, t));
|
|
2612
|
+
return o.length === 1 ? o[0] : void 0;
|
|
2613
|
+
}
|
|
2614
|
+
function Wn(e) {
|
|
2615
|
+
return e.type === "number" && G(e.numberFormat) && e.inheritMetricFormat !== !0;
|
|
2616
|
+
}
|
|
2617
|
+
function Jn(e, t) {
|
|
2618
|
+
var a;
|
|
2619
|
+
return Pe(t.dataType) ? H(e, "detailColumns").includes(t) ? e.type === "detailTable" : _o(t.granularity) || ((a = t.format) == null ? void 0 : a.type) === "temporal_bucket" || t.semanticTemporalPresentation != null : !1;
|
|
2620
|
+
}
|
|
2621
|
+
function qt(e, t, a, o) {
|
|
2622
|
+
var s;
|
|
2623
|
+
const n = (s = e.card).preferences ?? (s.preferences = {}), r = n.sqlColumns ?? (n.sqlColumns = {});
|
|
2624
|
+
r[t] = { ...r[t], format: a }, e.changes.push({ path: o, action: "moved", to: `preferences.sqlColumns[${JSON.stringify(t)}].format` });
|
|
2625
|
+
}
|
|
2626
|
+
function Xn(e) {
|
|
2627
|
+
const [t, ...a] = e;
|
|
2628
|
+
if (!t) return;
|
|
2629
|
+
const o = Object.fromEntries(
|
|
2630
|
+
Object.entries(t).filter(([n, r]) => a.every((s) => sa(s[n], r)))
|
|
2631
|
+
);
|
|
2632
|
+
return at.safeParse(o).success ? o : void 0;
|
|
2633
|
+
}
|
|
2634
|
+
function Zn(e, t) {
|
|
2635
|
+
const a = e.card, o = $o({
|
|
2636
|
+
groupByColumns: H(a, "groupByColumns"),
|
|
2637
|
+
metricColumns: H(a, "metricColumns"),
|
|
2638
|
+
pivotByColumns: H(a, "pivotByColumns"),
|
|
2639
|
+
detailColumns: a.type === "detailTable" ? H(a, "detailColumns") : []
|
|
2640
|
+
});
|
|
2641
|
+
for (const [n, r] of t) {
|
|
2642
|
+
const s = r.find((d) => d.key === o.get(n)), i = s ?? r[0];
|
|
2643
|
+
if (qe(e, n, i.format, i.from), !s)
|
|
2644
|
+
for (const d of r)
|
|
2645
|
+
d !== i && !le(d.format, i.format) && e.unconverted.push({
|
|
2646
|
+
path: d.from,
|
|
2647
|
+
reason: "ambiguous_column_setting",
|
|
2648
|
+
detail: `"${d.key}" and "${i.key}" both name ${n.id}.`
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
function es(e, t) {
|
|
2653
|
+
var r;
|
|
2654
|
+
if (!t.length) return;
|
|
2655
|
+
const a = H(e.card, "metricColumns"), o = a.length === 1 ? a[0] : void 0, n = o && !o.format ? Xn(t.map((s) => s.format)) : void 0;
|
|
2656
|
+
o && n && qe(e, o, n, t[0].from);
|
|
2657
|
+
for (const s of t)
|
|
2658
|
+
if (!(o != null && o.format && le(s.format, o.format))) {
|
|
2659
|
+
if (!a.length) {
|
|
2660
|
+
e.unconverted.push({
|
|
2661
|
+
path: s.from,
|
|
2662
|
+
reason: "generated_count_pivot_format",
|
|
2663
|
+
detail: `"${s.key}" is one pivot value's column on a table with no measure; it formats the row count the query adds.`
|
|
2664
|
+
});
|
|
2665
|
+
continue;
|
|
2666
|
+
}
|
|
2667
|
+
e.unconverted.push(
|
|
2668
|
+
((r = o == null ? void 0 : o.format) == null ? void 0 : r.type) === s.format.type ? {
|
|
2669
|
+
path: s.from,
|
|
2670
|
+
reason: "pivot_value_format_difference",
|
|
2671
|
+
detail: `"${s.key}" is one pivot value's column; its format differs from its measure's, which every pivot value now shows.`
|
|
2672
|
+
} : {
|
|
2673
|
+
path: s.from,
|
|
2674
|
+
reason: "per_pivot_value_format",
|
|
2675
|
+
detail: `"${s.key}" is one pivot value's column; a card column holds one format for every pivot value.`
|
|
2676
|
+
}
|
|
2677
|
+
);
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
function ts(e) {
|
|
2681
|
+
var d;
|
|
2682
|
+
const t = (d = e.card.preferences) == null ? void 0 : d.tablePrefs, a = t == null ? void 0 : t.columnSettingsMap;
|
|
2683
|
+
if (!G(a)) return;
|
|
2684
|
+
const o = e.card, n = ra(o), r = H(o, "pivotByColumns").length > 0, s = /* @__PURE__ */ new Map(), i = [];
|
|
2685
|
+
for (const [c, p] of Object.entries(a)) {
|
|
2686
|
+
if (!G(p)) continue;
|
|
2687
|
+
const _ = p, b = `preferences.tablePrefs.columnSettingsMap[${JSON.stringify(c)}]`;
|
|
2688
|
+
if (Wn(_)) {
|
|
2689
|
+
const v = ao(_.numberFormat);
|
|
2690
|
+
if (v && n)
|
|
2691
|
+
qt(e, c, v, `${b}.numberFormat`);
|
|
2692
|
+
else if (v && Je(o)) {
|
|
2693
|
+
const m = Pt(o, c), f = { key: c, format: v, from: `${b}.numberFormat` };
|
|
2694
|
+
m ? s.set(m, [...s.get(m) ?? [], f]) : r ? i.push(f) : e.unconverted.push({
|
|
2695
|
+
path: f.from,
|
|
2696
|
+
reason: "unmatched_column_setting",
|
|
2697
|
+
detail: `"${c}" names no card column.`
|
|
2698
|
+
});
|
|
2699
|
+
} else v && o.type !== "matrixTable" && o.type !== "kpi" && H(o, "metricColumns").some(
|
|
2700
|
+
(f) => f.comparison != null
|
|
2701
|
+
) && e.unconverted.push({
|
|
2702
|
+
path: `${b}.numberFormat`,
|
|
2703
|
+
reason: "chart_comparison_column_setting",
|
|
2704
|
+
detail: `"${c}" formats this chart's comparison tooltip only.`
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2707
|
+
if (G(_.dateFormat)) {
|
|
2708
|
+
const v = _.type === "date";
|
|
2709
|
+
if (v && n)
|
|
2710
|
+
qt(e, c, oo(_.dateFormat), `${b}.dateFormat`);
|
|
2711
|
+
else if (v && Je(o)) {
|
|
2712
|
+
const m = Pt(o, c);
|
|
2713
|
+
(!m || !Jn(o, m)) && e.unconverted.push({
|
|
2714
|
+
path: `${b}.dateFormat`,
|
|
2715
|
+
reason: "config_column_date_setting",
|
|
2716
|
+
detail: `"${c}"'s download formats its dates with this setting.`
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
for (const v of Hn)
|
|
2721
|
+
Object.prototype.hasOwnProperty.call(_, v) && (delete _[v], e.changes.push({ path: `${b}.${v}`, action: "removed" }));
|
|
2722
|
+
}
|
|
2723
|
+
Zn(e, s), es(e, i);
|
|
2724
|
+
}
|
|
2725
|
+
function as(e) {
|
|
2726
|
+
return Object.keys(e).some(
|
|
2727
|
+
(t) => t !== "enabled" && t !== "colorRanges" && e[t] !== void 0
|
|
2728
|
+
);
|
|
2729
|
+
}
|
|
2730
|
+
function os(e) {
|
|
2731
|
+
return (e == null ? void 0 : e.enabled) === !1 || (e == null ? void 0 : e.enabled) === "false";
|
|
2732
|
+
}
|
|
2733
|
+
function ns(e) {
|
|
2734
|
+
const t = e.card, a = t.preferences;
|
|
2735
|
+
if (!a) return;
|
|
2736
|
+
const o = a.kpiVisualOptions, n = G(o == null ? void 0 : o.formatOptions) ? o.formatOptions : void 0, r = a, s = G(r.formatNumber) ? r.formatNumber : void 0, i = n ? pe(no(n)) : void 0, d = s && as(s) ? pe(so(s)) : void 0;
|
|
2737
|
+
if (t.type === "kpi") {
|
|
2738
|
+
if (os(s) && e.unconverted.push({
|
|
2739
|
+
path: "preferences.formatNumber.enabled",
|
|
2740
|
+
reason: "raw_display",
|
|
2741
|
+
detail: "Formatting is switched off on this KPI."
|
|
2742
|
+
}), jn(t)) {
|
|
2743
|
+
const c = i ?? d, p = o == null ? void 0 : o.queryComparisonPolarity;
|
|
2744
|
+
(c || p) && (a.sqlKpiValue = {
|
|
2745
|
+
...a.sqlKpiValue,
|
|
2746
|
+
...c ? { format: c } : {},
|
|
2747
|
+
...p ? { comparisonPolarity: p } : {}
|
|
2748
|
+
}, e.changes.push({
|
|
2749
|
+
path: i ? "preferences.kpiVisualOptions.formatOptions" : "preferences.formatNumber",
|
|
2750
|
+
action: "moved",
|
|
2751
|
+
to: "preferences.sqlKpiValue"
|
|
2752
|
+
}));
|
|
2753
|
+
} else
|
|
2754
|
+
H(t, "metricColumns").forEach((p) => {
|
|
2755
|
+
i ? qe(e, p, i, "preferences.kpiVisualOptions.formatOptions") : d && !p.format && qe(e, p, d, "preferences.formatNumber");
|
|
2756
|
+
});
|
|
2757
|
+
ss(e, s);
|
|
2758
|
+
} else if (d) {
|
|
2759
|
+
const c = H(t, "metricColumns");
|
|
2760
|
+
ra(t) ? e.unconverted.push({
|
|
2761
|
+
path: "preferences.formatNumber",
|
|
2762
|
+
reason: "sql_card_wide_format",
|
|
2763
|
+
detail: "A card-wide number format on a SQL or Python card."
|
|
2764
|
+
}) : !Je(t) && t.type !== "matrixTable" && c.some((p) => !p.format) && e.unconverted.push({
|
|
2765
|
+
path: "preferences.formatNumber",
|
|
2766
|
+
reason: "chart_card_wide_format",
|
|
2767
|
+
detail: "A card-wide number format on a chart measure without a format of its own."
|
|
2768
|
+
});
|
|
2769
|
+
}
|
|
2770
|
+
if (!s && ae(r, "formatNumber") && (delete r.formatNumber, e.changes.push({ path: "preferences.formatNumber", action: "removed" })), s) {
|
|
2771
|
+
const c = s.colorRanges;
|
|
2772
|
+
Array.isArray(c) && c.length > 0 ? r.formatNumber = { colorRanges: c } : delete r.formatNumber, e.changes.push({ path: "preferences.formatNumber", action: "removed" });
|
|
2773
|
+
}
|
|
2774
|
+
o && ge(o, ["formatOptions", "queryComparisonPolarity"]) && (e.changes.push({ path: "preferences.kpiVisualOptions.formatOptions", action: "removed" }), Object.keys(o).length === 0 && delete a.kpiVisualOptions);
|
|
2775
|
+
for (const c of ["numberAxisFormat", "columnSettings"])
|
|
2776
|
+
ge(a, [c]) && e.changes.push({ path: `preferences.${c}`, action: "removed" });
|
|
2777
|
+
}
|
|
2778
|
+
function ss(e, t) {
|
|
2779
|
+
var r;
|
|
2780
|
+
const a = t == null ? void 0 : t.decimalPlaces, o = e.card.preferences;
|
|
2781
|
+
if (typeof a != "number" || ((r = o.comparisonPresentation) == null ? void 0 : r.precision) !== void 0) return;
|
|
2782
|
+
const n = Fo(a);
|
|
2783
|
+
n !== void 0 && (o.comparisonPresentation = {
|
|
2784
|
+
...o.comparisonPresentation,
|
|
2785
|
+
precision: n
|
|
2786
|
+
}, e.changes.push({
|
|
2787
|
+
path: "preferences.formatNumber.decimalPlaces",
|
|
2788
|
+
action: "moved",
|
|
2789
|
+
to: "preferences.comparisonPresentation.precision"
|
|
2790
|
+
}));
|
|
2791
|
+
}
|
|
2792
|
+
const rs = /* @__PURE__ */ new Set(["number", "currency", "percent", "scientific", "date", "duration"]);
|
|
2793
|
+
function is(e) {
|
|
2794
|
+
const t = e.card.preferences;
|
|
2795
|
+
if (t)
|
|
2796
|
+
for (const a of Vn) {
|
|
2797
|
+
const o = t[a];
|
|
2798
|
+
if (!G(o)) continue;
|
|
2799
|
+
const n = `preferences.${a}`, r = G(o.formatOptions) ? o.formatOptions : void 0, s = a === "dataLabelsConfig" && typeof o.format == "string" ? o.format : void 0, i = o.formatMode === "override" || o.formatMode === "inherit" ? o.formatMode : o.mode === "override" || o.mode === "inherit" ? o.mode : void 0, d = i ?? (s === "none" ? "raw" : s && s !== "auto" || r ? "override" : "inherit");
|
|
2800
|
+
if (d === "raw" || i === void 0 && s === "none")
|
|
2801
|
+
e.unconverted.push({ path: `${n}.format`, reason: "raw_display", detail: "Data labels show raw values." });
|
|
2802
|
+
else if (d === "override") {
|
|
2803
|
+
const c = r && r.type ? r : s && rs.has(s) ? { ...r, type: s } : r, p = c ? pe(ro(c, { preserveOmittedProperties: !0 })) : void 0;
|
|
2804
|
+
p && (o.valueFormat = p, e.changes.push({ path: `${n}.formatOptions`, action: "moved", to: `${n}.valueFormat` }));
|
|
2805
|
+
}
|
|
2806
|
+
ge(o, ["formatMode", "mode", "formatOptions", ...a === "dataLabelsConfig" ? ["format"] : []]) && e.changes.push({ path: `${n}.formatMode`, action: "removed" });
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
function ds(e) {
|
|
2810
|
+
var o;
|
|
2811
|
+
const t = (o = e.card.config) == null ? void 0 : o.matrix, a = G(t) && G(t.presentation) ? t.presentation : void 0;
|
|
2812
|
+
if (a)
|
|
2813
|
+
for (const n of ["measureFormats", "levelFormats"]) {
|
|
2814
|
+
const r = a[n];
|
|
2815
|
+
if (G(r))
|
|
2816
|
+
for (const [s, i] of Object.entries(r)) {
|
|
2817
|
+
const d = ct(i);
|
|
2818
|
+
d && !le(d, i) && (r[s] = d, e.changes.push({ path: `config.matrix.presentation.${n}[${JSON.stringify(s)}]`, action: "cleaned" }));
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
function cs(e, t = {}) {
|
|
2823
|
+
const a = { card: structuredClone(e), changes: [], unconverted: [] };
|
|
2824
|
+
for (const o of dt)
|
|
2825
|
+
H(a.card, o).forEach((n, r) => {
|
|
2826
|
+
G(n) && Gn(a, n, o, `config.${o}[${r}]`);
|
|
2827
|
+
});
|
|
2828
|
+
return Qn(a), ts(a), ns(a), is(a), ds(a), zn(a, t), a.changes.length === 0 && a.unconverted.length === 0 ? { card: e, changes: [], unconverted: [] } : a;
|
|
2829
|
+
}
|
|
2830
|
+
const ls = "__semaphor_unassigned_trigger__", us = "__NULL__";
|
|
2831
|
+
function fs(e) {
|
|
2832
|
+
var t, a;
|
|
2833
|
+
return !!((t = e.sql) != null && t.trim() || (a = e.python) != null && a.trim());
|
|
2834
|
+
}
|
|
2835
|
+
function ms(e) {
|
|
2836
|
+
const t = e.config;
|
|
2837
|
+
return t ? e.type === "detailTable" ? t.detailColumns ?? [] : [...t.detailColumns ?? [], ...t.metricColumns ?? [], ...t.groupByColumns ?? []] : [];
|
|
2838
|
+
}
|
|
2839
|
+
function Mt(e) {
|
|
2840
|
+
return [e.id, e.alias, e.name, e.qualifiedFieldName, e.label];
|
|
2841
|
+
}
|
|
2842
|
+
function hs(e, t) {
|
|
2843
|
+
var c, p;
|
|
2844
|
+
const a = ((c = e.config) == null ? void 0 : c.metricColumns) ?? [], o = ((p = e.config) == null ? void 0 : p.pivotByColumns) ?? [];
|
|
2845
|
+
if (a.length !== 1 || o.length !== 1) return { reason: "pivot_key_form" };
|
|
2846
|
+
const n = a[0], r = o[0], s = n.aliasTemplate ?? "", i = s.includes(`{{${r.name}}}`) || s.includes(`{{${r.entityName}.${r.name}}}`), d = !!(n.valueAliases && Object.keys(n.valueAliases).length);
|
|
2847
|
+
return i || d || /["'`\t\n\r]/.test(t) || t.startsWith("col_") ? { reason: "pivot_key_form" } : {
|
|
2848
|
+
ref: {
|
|
2849
|
+
kind: "pivot",
|
|
2850
|
+
metricId: n.id,
|
|
2851
|
+
members: [{ fieldId: r.id, value: t === us ? null : t }]
|
|
2852
|
+
}
|
|
2853
|
+
};
|
|
2854
|
+
}
|
|
2855
|
+
function ps(e, t) {
|
|
2856
|
+
var s, i;
|
|
2857
|
+
if (t === ls) return { reason: "unassigned_trigger" };
|
|
2858
|
+
if (fs(e)) return { ref: { kind: "result", key: t } };
|
|
2859
|
+
const a = ms(e), o = a.filter((d) => Mt(d).includes(t)), n = o.length ? o : a.filter((d) => Mt(d).some((c) => (c == null ? void 0 : c.trim().toLowerCase()) === t.trim().toLowerCase())), r = [...new Set(n.map((d) => d.id))];
|
|
2860
|
+
return r.length === 1 ? { ref: { kind: "field", fieldId: r[0] } } : r.length > 1 ? { reason: "ambiguous_column" } : (i = (s = e.config) == null ? void 0 : s.pivotByColumns) != null && i.length ? hs(e, t) : { reason: "no_matching_column" };
|
|
2861
|
+
}
|
|
2862
|
+
function Lt(e, t, a, o, n) {
|
|
2863
|
+
const r = (k, O, E) => {
|
|
2864
|
+
o.push({ ruleId: e.id, name: e.name, enabled: e.enabled !== !1, path: `${a}.${k}`, reference: O, reason: E });
|
|
2865
|
+
}, s = e.condition.columnId ?? "", i = t(s);
|
|
2866
|
+
if (!("ref" in i)) return r("condition.columnId", s, i.reason);
|
|
2867
|
+
const d = e.target.level, c = d === "row" ? e.target.applyToColumnIds : e.target.columnIds;
|
|
2868
|
+
if (d === "cell" && !(c != null && c.length) && e.enabled !== !1)
|
|
2869
|
+
return r("target.columnIds", "", "every_column");
|
|
2870
|
+
const p = [];
|
|
2871
|
+
for (const [k, O] of (c ?? []).entries()) {
|
|
2872
|
+
const E = t(O);
|
|
2873
|
+
if (!("ref" in E))
|
|
2874
|
+
return r(`target.${d === "row" ? "applyToColumnIds" : "columnIds"}[${k}]`, O, E.reason);
|
|
2875
|
+
p.push(E.ref);
|
|
2876
|
+
}
|
|
2877
|
+
const {
|
|
2878
|
+
columnIds: _,
|
|
2879
|
+
applyToColumnIds: b,
|
|
2880
|
+
conditionColumnId: v,
|
|
2881
|
+
matrix: m,
|
|
2882
|
+
rowRoles: f,
|
|
2883
|
+
depth: S,
|
|
2884
|
+
includeTotals: u,
|
|
2885
|
+
includeSubtotals: g,
|
|
2886
|
+
...F
|
|
2887
|
+
} = e.target, { columnId: $, ...x } = e.condition, N = {
|
|
2888
|
+
...F,
|
|
2889
|
+
...p.length ? { columns: p } : {},
|
|
2890
|
+
// The Matrix scope means something only on a Matrix card.
|
|
2891
|
+
...n ? {
|
|
2892
|
+
...m !== void 0 ? { matrix: m } : {},
|
|
2893
|
+
...f !== void 0 ? { rowRoles: f } : {},
|
|
2894
|
+
...S !== void 0 ? { depth: S } : {},
|
|
2895
|
+
...u !== void 0 ? { includeTotals: u } : {},
|
|
2896
|
+
...g !== void 0 ? { includeSubtotals: g } : {}
|
|
2897
|
+
} : {}
|
|
2898
|
+
};
|
|
2899
|
+
return {
|
|
2900
|
+
...e,
|
|
2901
|
+
condition: { ...x, column: i.ref },
|
|
2902
|
+
target: N
|
|
2903
|
+
};
|
|
2904
|
+
}
|
|
2905
|
+
function gs(e, t) {
|
|
2906
|
+
var n, r, s;
|
|
2907
|
+
const a = (n = e.sql) != null && n.trim() ? { kind: "sqlKpiValue" } : (s = (r = e.config) == null ? void 0 : r.metricColumns) != null && s[0] ? { kind: "field", fieldId: e.config.metricColumns[0].id } : void 0;
|
|
2908
|
+
if (!a) return [];
|
|
2909
|
+
const o = (i) => i === null ? 0 : typeof i == "number" || typeof i == "string" || typeof i == "boolean" ? Number(i) : NaN;
|
|
2910
|
+
return t.flatMap((i, d) => {
|
|
2911
|
+
if (!i || typeof i != "object") return [];
|
|
2912
|
+
const { start: c, end: p, color: _ } = i, b = o(c), v = o(p);
|
|
2913
|
+
if (Number.isNaN(b) || Number.isNaN(v) || b > v || b === 1 / 0 || v === -1 / 0) return [];
|
|
2914
|
+
const m = b === -1 / 0 ? void 0 : b, f = v === 1 / 0 ? void 0 : v, S = m !== void 0 && f !== void 0 ? { kind: "between", column: a, min: m, max: f, inclusive: !0 } : m !== void 0 ? { kind: "comparison", column: a, operator: "gte", value: m } : f !== void 0 ? { kind: "comparison", column: a, operator: "lte", value: f } : { kind: "blank", column: a, isBlank: !1 }, u = typeof _ == "string" ? _ : "";
|
|
2915
|
+
return [{ id: `kpi-color-range-${d + 1}`, condition: S, target: { level: "cell" }, style: { textColor: u } }];
|
|
2916
|
+
}).reverse();
|
|
2917
|
+
}
|
|
2918
|
+
function bs(e) {
|
|
2919
|
+
var p, _, b, v, m, f, S;
|
|
2920
|
+
const t = structuredClone(e), a = [], o = [], n = [], r = (u) => {
|
|
2921
|
+
a.some((g) => g.from.startsWith(u)) || a.push({ ruleId: "", action: "removed", from: u });
|
|
2922
|
+
}, s = (p = t.preferences) == null ? void 0 : p.tablePrefs;
|
|
2923
|
+
if (s && ae(s, "conditionalFormatting")) {
|
|
2924
|
+
const u = s.conditionalFormatting, g = "preferences.tablePrefs.conditionalFormatting", F = t.type === "table" || t.type === "detailTable";
|
|
2925
|
+
((u == null ? void 0 : u.rules) ?? []).forEach(($, x) => {
|
|
2926
|
+
var k;
|
|
2927
|
+
if (!F || ((k = $.target) == null ? void 0 : k.matrix) !== void 0) {
|
|
2928
|
+
a.push({ ruleId: $.id, action: "removed", from: `${g}.rules[${x}]` });
|
|
2929
|
+
return;
|
|
2930
|
+
}
|
|
2931
|
+
const N = Lt($, (O) => ps(t, O), `${g}.rules[${x}]`, o, !1);
|
|
2932
|
+
N && (n.push(N), a.push({ ruleId: $.id, action: "moved", from: `${g}.rules[${x}]` }));
|
|
2933
|
+
}), delete s.conditionalFormatting, o.some(($) => $.path.startsWith(g)) || r(g);
|
|
2934
|
+
}
|
|
2935
|
+
const i = (b = (_ = t.config) == null ? void 0 : _.matrix) == null ? void 0 : b.presentation;
|
|
2936
|
+
if (i && ae(i, "conditionalFormatting")) {
|
|
2937
|
+
const u = i.conditionalFormatting, g = "config.matrix.presentation.conditionalFormatting", F = new Set((m = (v = t.config) == null ? void 0 : v.matrix) == null ? void 0 : m.spec.measures.map(($) => $.id));
|
|
2938
|
+
((u == null ? void 0 : u.rules) ?? []).forEach(($, x) => {
|
|
2939
|
+
const N = Lt(
|
|
2940
|
+
$,
|
|
2941
|
+
(k) => F.has(k) ? { ref: { kind: "matrixMeasure", measureId: k } } : { reason: "no_matching_column" },
|
|
2942
|
+
`${g}.rules[${x}]`,
|
|
2943
|
+
o,
|
|
2944
|
+
!0
|
|
2945
|
+
);
|
|
2946
|
+
N && (n.push(N), a.push({ ruleId: $.id, action: "moved", from: `${g}.rules[${x}]` }));
|
|
2947
|
+
}), delete i.conditionalFormatting, o.some(($) => $.path.startsWith(g)) || r(g);
|
|
2948
|
+
}
|
|
2949
|
+
const d = t.preferences, c = d == null ? void 0 : d.formatNumber;
|
|
2950
|
+
if (c && ae(c, "colorRanges")) {
|
|
2951
|
+
const u = Array.isArray(c.colorRanges) ? c.colorRanges : [];
|
|
2952
|
+
if (t.type === "kpi") {
|
|
2953
|
+
const g = gs(t, u);
|
|
2954
|
+
n.push(...g), g.forEach((F) => a.push({ ruleId: F.id, action: "moved", from: "preferences.formatNumber.colorRanges" }));
|
|
2955
|
+
}
|
|
2956
|
+
delete c.colorRanges, Object.keys(c).length === 0 && delete d.formatNumber, a.some((g) => g.from === "preferences.formatNumber.colorRanges") || a.push({ ruleId: "", action: "removed", from: "preferences.formatNumber.colorRanges" });
|
|
2957
|
+
}
|
|
2958
|
+
if (!a.length && !o.length) return { card: e, changes: [], unresolved: [] };
|
|
2959
|
+
if (n.length) {
|
|
2960
|
+
const u = ((S = (f = t.preferences) == null ? void 0 : f.conditionalFormatting) == null ? void 0 : S.rules) ?? [], g = new Set(u.map((F) => F.id));
|
|
2961
|
+
t.preferences = {
|
|
2962
|
+
...t.preferences,
|
|
2963
|
+
conditionalFormatting: {
|
|
2964
|
+
version: 1,
|
|
2965
|
+
rules: [...u, ...n.filter((F) => !g.has(F.id))]
|
|
2966
|
+
}
|
|
2967
|
+
};
|
|
2968
|
+
}
|
|
2969
|
+
return { card: t, changes: a, unresolved: o };
|
|
2970
|
+
}
|
|
2971
|
+
function Js(e, t = {}) {
|
|
2972
|
+
const { only: a, ...o } = t, n = a === "rules" ? void 0 : cs(e, o), r = a === "formats" ? void 0 : bs((n == null ? void 0 : n.card) ?? e);
|
|
2973
|
+
return { card: (r == null ? void 0 : r.card) ?? (n == null ? void 0 : n.card) ?? e, formats: n, rules: r };
|
|
2974
|
+
}
|
|
2295
2975
|
export {
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2976
|
+
Nr as AGGREGATES,
|
|
2977
|
+
Pr as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
|
|
2978
|
+
qr as CALCULATED_FIELDS_GROUP_ID,
|
|
2979
|
+
Mr as CALCULATED_FIELDS_GROUP_NAME,
|
|
2980
|
+
Lr as CARD_CONFIG_KEY_CLASSES,
|
|
2981
|
+
Br as CARD_KEY_CLASSES,
|
|
2982
|
+
Qa as CARD_QUERY_CONFIG_KEYS,
|
|
2983
|
+
Us as CARD_QUERY_REQUEST_DESCRIPTIVE_FIELDS,
|
|
2984
|
+
Ks as CARD_QUERY_REQUEST_EXECUTED_FIELDS,
|
|
2985
|
+
Vr as CARD_TYPES,
|
|
2986
|
+
ye as CARD_TYPE_RULES,
|
|
2987
|
+
jr as COLUMN_KEY_CLASSES,
|
|
2988
|
+
Kr as COLUMN_PRESENTATION_KEYS,
|
|
2989
|
+
Ur as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
|
|
2990
|
+
Gr as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
|
|
2991
|
+
zr as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
|
|
2992
|
+
Qr as CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE,
|
|
2993
|
+
Hr as CONTROL_DEFINITION_DUPLICATE_ERROR_CODE,
|
|
2994
|
+
Yr as CONTROL_DEFINITION_INVALID_ERROR_CODE,
|
|
2995
|
+
Wr as CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE,
|
|
2996
|
+
Jr as CONTROL_REFERENCE_MISSING_ERROR_CODE,
|
|
2997
|
+
Xr as CONTROL_VALUE_INVALID_ERROR_CODE,
|
|
2998
|
+
Zr as CONTROL_VALUE_MISSING_ERROR_CODE,
|
|
2999
|
+
Z as CardQueryRequestError,
|
|
3000
|
+
ei as ControlResolutionError,
|
|
3001
|
+
vt as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
|
|
3002
|
+
ti as DASHBOARD_CHANGE_OPS,
|
|
3003
|
+
ai as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
|
|
3004
|
+
Fc as DASHBOARD_FILTER_OPERATIONS,
|
|
3005
|
+
oi as DASHBOARD_INPUT_RUNTIME_SCOPE_KINDS,
|
|
3006
|
+
xc as DOCUMENT_KPI_SECTION_MAX_CARDS,
|
|
3007
|
+
Tc as DOCUMENT_KPI_SECTION_MAX_TILES,
|
|
3008
|
+
ni as DashboardFilterMappingContractError,
|
|
3009
|
+
si as ExecutionControlContractError,
|
|
3010
|
+
ri as FILTER_OPERATORS,
|
|
3011
|
+
ii as FilterModelError,
|
|
3012
|
+
di as LEGACY_TABLE_CARD_TYPES,
|
|
3013
|
+
qc as LEGACY_TABLE_ROUTING_ID_NAMESPACE,
|
|
3014
|
+
$t as MAX_PROPOSED_CHANGES,
|
|
3015
|
+
ci as MAX_QUERY_LIMIT,
|
|
3016
|
+
er as NEW_CARD_TYPE,
|
|
3017
|
+
li as QUERY_ASPECTS,
|
|
3018
|
+
ui as QUERY_CONFIG_KEY_ASPECTS,
|
|
3019
|
+
tr as RELATIONSHIP_ROUTE_CHANGED_MESSAGE,
|
|
3020
|
+
fi as SEMAPHOR_CARTESIAN_CHART_TYPES,
|
|
3021
|
+
mi as TIME_GRAINS,
|
|
3022
|
+
hi as TOOLBAR_FILTER_REACH_FIELDS,
|
|
3023
|
+
pi as acceptedColumnRefKinds,
|
|
3024
|
+
gi as analyticsFilterSchema,
|
|
3025
|
+
Mc as applyCardReferenceRemapping,
|
|
3026
|
+
St as applyDashboardOperations,
|
|
3027
|
+
Lc as applyFilterApplicability,
|
|
3028
|
+
ar as applyFilterSettingsChange,
|
|
3029
|
+
Bc as applyGroupByOverride,
|
|
3030
|
+
bi as applyLinkedClickToFilterOverrides,
|
|
3031
|
+
yi as applyOptionDependencyOverride,
|
|
3032
|
+
or as buildCardExportFormatOptions,
|
|
3033
|
+
Vc as buildCardExportQueryContext,
|
|
3034
|
+
nr as buildCardExportRequest,
|
|
3035
|
+
sr as buildCardExportRequestFromOptions,
|
|
3036
|
+
rr as buildColumnCatalog,
|
|
3037
|
+
Ii as buildControlDefinitionIndex,
|
|
3038
|
+
La as buildDashboardCardSourceIndex,
|
|
3039
|
+
ir as buildEntityColumnGroup,
|
|
3040
|
+
dr as buildFilterInputFromDefinition,
|
|
3041
|
+
ca as buildFilterInputFromField,
|
|
3042
|
+
_i as buildLinkedClickToFilterOverrides,
|
|
3043
|
+
Ci as buildProposeChangeInputSchema,
|
|
3044
|
+
vi as buildSavedEditorCard,
|
|
3045
|
+
cr as buildTableExportFormatOptions,
|
|
3046
|
+
lr as cardColumnRefForKey,
|
|
3047
|
+
Si as cardColumnRefSchema,
|
|
3048
|
+
eo as cardConditionalFormattingSchema,
|
|
3049
|
+
$i as cardQueryPatchSchema,
|
|
3050
|
+
wi as cardTypeSentenceName,
|
|
3051
|
+
Ha as changeCardType,
|
|
3052
|
+
Fi as changeMatrixEditor,
|
|
3053
|
+
to as checkConditionalRuleColumns,
|
|
3054
|
+
Ws as checkPresentationStores,
|
|
3055
|
+
fa as clickToFilterSettingsSchema,
|
|
3056
|
+
jc as collectJoinPlanIdentifiers,
|
|
3057
|
+
Da as columnDataset,
|
|
3058
|
+
Ya as columnFieldKey,
|
|
3059
|
+
Za as columnKeys,
|
|
3060
|
+
xi as columnRefIssue,
|
|
3061
|
+
ur as columnRefKey,
|
|
3062
|
+
Vs as compileDashboardFromPlan,
|
|
3063
|
+
Kc as composeCardReferenceRemapping,
|
|
3064
|
+
Ti as conditionalRuleSchema,
|
|
3065
|
+
ki as controlBindingExecutionSchema,
|
|
3066
|
+
Di as controlDefinitionExecutionSchema,
|
|
3067
|
+
Pa as controlRefusal,
|
|
3068
|
+
Ai as createDashboardFilterBindingId,
|
|
3069
|
+
ml as createMatrixAuthoringDraft,
|
|
3070
|
+
hl as createMatrixConfig,
|
|
3071
|
+
la as createNewCard,
|
|
3072
|
+
ot as dashboardAuthoringDatasetMatchesSource,
|
|
3073
|
+
Ls as dashboardAuthoringFieldsReferToSameTarget,
|
|
3074
|
+
oe as dashboardAuthoringSourceFromField,
|
|
3075
|
+
qs as dashboardAuthoringSourceKey,
|
|
3076
|
+
Qt as dashboardAuthoringSourcesReferToSameDataset,
|
|
3077
|
+
Ri as dashboardCardFilterSourceInventoryContains,
|
|
3078
|
+
Aa as dashboardChangeSchema,
|
|
3079
|
+
Oi as dashboardFilterTargetMatchesLogicalValue,
|
|
3080
|
+
kc as dashboardFilterValueTypeForDataType,
|
|
3081
|
+
Ei as dashboardGenerateSchema,
|
|
3082
|
+
Fa as dashboardInputScopeIncludesDocumentSheets,
|
|
3083
|
+
js as dashboardPlanFromSemaphorDashboardIntent,
|
|
3084
|
+
Ni as defaultClickToFilterSettings,
|
|
3085
|
+
Uc as describeDashboardFilterCardReach,
|
|
3086
|
+
Oe as describeDashboardFilterCardReachDetail,
|
|
3087
|
+
Na as describeQueryChange,
|
|
3088
|
+
fr as describeRelationshipRoute,
|
|
3089
|
+
mr as describeRelationshipSkip,
|
|
3090
|
+
Pi as doesDashboardInputApplyToTarget,
|
|
3091
|
+
qi as doesDashboardInputSurviveCarriedContext,
|
|
3092
|
+
Mi as doesToolbarFilterReachTab,
|
|
3093
|
+
hr as domainCalculatedFields,
|
|
3094
|
+
Li as dropMatrixEditorField,
|
|
3095
|
+
pr as evaluateConditionalRules,
|
|
3096
|
+
ka as fieldIdentityKey,
|
|
3097
|
+
Bi as fieldRefSchema,
|
|
3098
|
+
Gc as filterApplicabilityContextForCard,
|
|
3099
|
+
gr as filterReachPreviewAnswers,
|
|
3100
|
+
zc as filterValueReachForCard,
|
|
3101
|
+
Vi as filterValueSemanticDataset,
|
|
3102
|
+
jt as findCatalogField,
|
|
3103
|
+
Bs as findDashboardAuthoringDatasetForSource,
|
|
3104
|
+
ji as findDashboardCardExecutableSource,
|
|
3105
|
+
Ki as findDashboardCardPinnedCatalogSource,
|
|
3106
|
+
Ui as findDashboardSqlPinnedCatalogSource,
|
|
3107
|
+
oa as findRetiredCardPresentationFields,
|
|
3108
|
+
Ys as findRetiredPresentationFields,
|
|
3109
|
+
Ta as findSortedColumn,
|
|
3110
|
+
br as flattenEntityColumns,
|
|
3111
|
+
Gi as foldPrototypeDocumentInputs,
|
|
3112
|
+
zi as formatFilterModelIssues,
|
|
3113
|
+
Ia as formatResolvedPrimaryDateFieldIssues,
|
|
3114
|
+
Qc as formatSkippedFilterWarnings,
|
|
3115
|
+
yr as fromEditableRules,
|
|
3116
|
+
Ir as getCalculatedFieldAggregateOverrides,
|
|
3117
|
+
Qi as getCalculatedFieldNamespace,
|
|
3118
|
+
_r as getCalculatedFieldParameters,
|
|
3119
|
+
Cr as getCalculatedFieldShelfOverrides,
|
|
3120
|
+
Hi as getCardDefinition,
|
|
3121
|
+
Yi as getColumnCatalogFieldId,
|
|
3122
|
+
jo as getDashboardAuthoringCardSource,
|
|
3123
|
+
vr as getDashboardFilterSubscriptionHint,
|
|
3124
|
+
Wi as getDashboardGlobalDateFilter,
|
|
3125
|
+
Dc as getDocumentKpiSectionShapeIssues,
|
|
3126
|
+
Ac as getDocumentSectionCards,
|
|
3127
|
+
Sr as getDomainCalculatedSelectionOverrides,
|
|
3128
|
+
Ji as getFieldAggregationOptions,
|
|
3129
|
+
Xi as getMatrixBindingTargets,
|
|
3130
|
+
pl as getMatrixLevelLabel,
|
|
3131
|
+
gl as getMatrixMeasureLabel,
|
|
3132
|
+
Zi as getStableDomainCalculatedFieldId,
|
|
3133
|
+
ed as getTemporalBucketAuthoringOptions,
|
|
3134
|
+
td as getTemporalBucketAuthoringSelection,
|
|
3135
|
+
ad as handleSchema,
|
|
3136
|
+
$r as hasDashboardFilterSubscription,
|
|
3137
|
+
ae as hasStoredKey,
|
|
3138
|
+
od as hasToolbarFilterReachField,
|
|
3139
|
+
Hc as hostFilterValueFor,
|
|
3140
|
+
Yc as hostFilterValuesToSlots,
|
|
3141
|
+
_l as inspectMatrixCardConfig,
|
|
3142
|
+
Wc as isAdHocFilterValueOnTab,
|
|
3143
|
+
nd as isAllowedDashboardInputScopeCombination,
|
|
3144
|
+
sd as isCardType,
|
|
3145
|
+
Rc as isDashboardFilterOperationCompatible,
|
|
3146
|
+
Vt as isDashboardInputOnTab,
|
|
3147
|
+
rd as isDashboardInputOwnedBySheet,
|
|
3148
|
+
ba as isDashboardInputScopeEmpty,
|
|
3149
|
+
id as isGroupedDate,
|
|
3150
|
+
dd as isLegacyTableCard,
|
|
3151
|
+
$e as isMaterializableDashboardAuthoringSource,
|
|
3152
|
+
cd as isPresentationCurrencyBinding,
|
|
3153
|
+
ld as isSemanticAutoJoinCard,
|
|
3154
|
+
ud as isSemaphorCartesianChartType,
|
|
3155
|
+
Oo as isSemaphorSourceRef,
|
|
3156
|
+
fd as isStructuralControlBinding,
|
|
3157
|
+
md as isValidControlOptionPresentation,
|
|
3158
|
+
wr as kpiValueColumn,
|
|
3159
|
+
xa as labelAt,
|
|
3160
|
+
hd as layoutArrangeSchema,
|
|
3161
|
+
Jc as legacyTableRoutingIds,
|
|
3162
|
+
Xc as legacyTableRoutingTarget,
|
|
3163
|
+
pd as linkedClickToFilterOverridesSchema,
|
|
3164
|
+
Zc as listAdHocFilterValuesOnTab,
|
|
3165
|
+
ie as listDashboardCardLocations,
|
|
3166
|
+
gd as listDashboardFilterDefinitions,
|
|
3167
|
+
bd as listDashboardFilterInputsOnTab,
|
|
3168
|
+
yd as listDashboardInputReachKeys,
|
|
3169
|
+
Sa as listDashboardInputScopeExceptedCardIds,
|
|
3170
|
+
wa as listDashboardInputScopeExceptedSheetIds,
|
|
3171
|
+
Ze as listDashboardTabTargets,
|
|
3172
|
+
el as listFilterInputValueTargets,
|
|
3173
|
+
Id as listStoredFilterDefinitions,
|
|
3174
|
+
Oc as mapDashboardCards,
|
|
3175
|
+
Ec as mapDocumentSectionCards,
|
|
3176
|
+
Fr as mapRuleColumns,
|
|
3177
|
+
_d as matchColumns,
|
|
3178
|
+
tl as matrixCatalogSources,
|
|
3179
|
+
Xa as matrixColumnKeys,
|
|
3180
|
+
Cd as matrixColumnsSchema,
|
|
3181
|
+
Cl as matrixDefinitionFieldRefs,
|
|
3182
|
+
vl as matrixDefinitionFields,
|
|
3183
|
+
Sl as matrixDefinitionSources,
|
|
3184
|
+
vd as matrixEditorCatalogFromFields,
|
|
3185
|
+
al as matrixExecutionSources,
|
|
3186
|
+
Sd as measureRefSchema,
|
|
3187
|
+
Ee as mergeDashboardAuthoringSources,
|
|
3188
|
+
bl as mergeMatrixSorts,
|
|
3189
|
+
ja as metricCardQuerySchema,
|
|
3190
|
+
Ja as moveMatrixLevel,
|
|
3191
|
+
$d as normalizeClickToFilterSettings,
|
|
3192
|
+
wd as normalizeDashboardInputs,
|
|
3193
|
+
Fd as normalizeLegacyLinkedTargetOverrides,
|
|
3194
|
+
xd as occurrenceKeys,
|
|
3195
|
+
Zt as outlineCalendar,
|
|
3196
|
+
Hs as outlineDashboard,
|
|
3197
|
+
Se as outlineFilter,
|
|
3198
|
+
ta as outlineFilters,
|
|
3199
|
+
zs as parseCardQueryRequest,
|
|
3200
|
+
Cn as parseCardQueryRequestContext,
|
|
3201
|
+
Gs as parseCardQueryRequestExtras,
|
|
3202
|
+
xr as parseColumnRefKey,
|
|
3203
|
+
Td as parseExecutionControlBindingsShallow,
|
|
3204
|
+
Ca as parseExecutionControlContext,
|
|
3205
|
+
kd as parseExecutionControlContract,
|
|
3206
|
+
qa as planCardLabels,
|
|
3207
|
+
xt as planCardRequery,
|
|
3208
|
+
Tr as pluralDatasetLabel,
|
|
3209
|
+
Eo as preferDashboardAuthoringSourceMetadata,
|
|
3210
|
+
Ms as preferredDashboardAuthoringSource,
|
|
3211
|
+
ol as prepareLoadedDashboard,
|
|
3212
|
+
Dd as previewTemporalBucketAuthoringFormat,
|
|
3213
|
+
Ad as proposedChangeSchema,
|
|
3214
|
+
nl as pruneUnrelatedCalculatedFilters,
|
|
3215
|
+
Ma as queryForm,
|
|
3216
|
+
Rd as readCardConditionalRules,
|
|
3217
|
+
me as readCardQuery,
|
|
3218
|
+
ve as readCardSource,
|
|
3219
|
+
he as readDashboardFilterModel,
|
|
3220
|
+
Od as readExactDomainCalculatedFieldReference,
|
|
3221
|
+
kr as readFilterReachResponse,
|
|
3222
|
+
sl as readFilterValueList,
|
|
3223
|
+
$l as readMatrixCardConfig,
|
|
3224
|
+
Ed as rebindDashboardOptionDependencyInputId,
|
|
3225
|
+
Ft as rebuildsRole,
|
|
3226
|
+
Nd as reconcileMatrixSpecStructure,
|
|
3227
|
+
Pd as reconcileTemporalBucketAuthoringFormat,
|
|
3228
|
+
Va as recordsCardQuerySchema,
|
|
3229
|
+
qd as refDataset,
|
|
3230
|
+
fe as refKey,
|
|
3231
|
+
kt as refName,
|
|
3232
|
+
Md as relationshipAddSchema,
|
|
3233
|
+
Ld as relationshipRouteTarget,
|
|
3234
|
+
Bd as relativeToTimeWindow,
|
|
3235
|
+
ha as remapClickToFilterReferences,
|
|
3236
|
+
Vd as remapLinkedClickToFilterOverrides,
|
|
3237
|
+
jd as requireNormalizedDashboardInputs,
|
|
3238
|
+
Kd as resolveBindingControlValue,
|
|
3239
|
+
vc as resolveCanonicalDetailResultRawKey,
|
|
3240
|
+
Sc as resolveCanonicalResultOutputKey,
|
|
3241
|
+
$o as resolveCanonicalResultOutputKeys,
|
|
3242
|
+
$c as resolveCanonicalResultRawKey,
|
|
3243
|
+
Dr as resolveCardColumnRef,
|
|
3244
|
+
Ar as resolveConditionalRules,
|
|
3245
|
+
No as resolveDashboardAuthoringSource,
|
|
3246
|
+
Qs as resolveDashboardChanges,
|
|
3247
|
+
Ud as resolveDashboardEntitySource,
|
|
3248
|
+
Gd as resolveDashboardFilterAutomaticTarget,
|
|
3249
|
+
zd as resolveDashboardFilterInheritedTarget,
|
|
3250
|
+
Qd as resolveDashboardOptionDependencies,
|
|
3251
|
+
Hd as resolveDashboardOptionPopulation,
|
|
3252
|
+
rl as resolveDashboardSqlFilterTarget,
|
|
3253
|
+
Yd as resolveFieldSelectedSource,
|
|
3254
|
+
Wd as resolveGroupByFieldTarget,
|
|
3255
|
+
Rr as resolveKpiValueStyle,
|
|
3256
|
+
il as resolveMatrixControlBindings,
|
|
3257
|
+
yl as resolveMatrixDefinition,
|
|
3258
|
+
Jd as resolveMetricFieldTarget,
|
|
3259
|
+
Xd as resolveScalarMappedValue,
|
|
3260
|
+
Zd as resolveTemporalBucketAuthoringFormat,
|
|
3261
|
+
_a as resolveTemporalResultOwner,
|
|
3262
|
+
ma as respondsToSelectionsSchema,
|
|
3263
|
+
ec as retainConditionalRules,
|
|
3264
|
+
tc as retainedMatrixPath,
|
|
3265
|
+
ga as rewriteDashboardInputScopeIds,
|
|
3266
|
+
dl as routeLegacyTableCard,
|
|
3267
|
+
cl as routeLegacyTableCards,
|
|
3268
|
+
ll as routeLegacyTableFrame,
|
|
3269
|
+
je as sameColumnKey,
|
|
3270
|
+
et as sameValue,
|
|
3271
|
+
ac as selectDashboardOptionDependencyInputIds,
|
|
3272
|
+
oc as selectionFieldFromExplorerField,
|
|
3273
|
+
nc as settableCardType,
|
|
3274
|
+
sc as sharedCardPreferences,
|
|
3275
|
+
rc as sharedTableDialect,
|
|
3276
|
+
Ba as sqlCardQuerySchema,
|
|
3277
|
+
ze as statedLabelsOf,
|
|
3278
|
+
ic as stripInstanceTargetsForLibrarySave,
|
|
3279
|
+
dc as structuralControlOverride,
|
|
3280
|
+
ea as summarizeFilter,
|
|
3281
|
+
cc as supportsCanonicalDashboardTemporalResult,
|
|
3282
|
+
lc as timeWindowSchema,
|
|
3283
|
+
wt as toChartType,
|
|
3284
|
+
Or as toEditableRules,
|
|
3285
|
+
Qe as toPublicCardType,
|
|
3286
|
+
uc as toolbarFilterInputFields,
|
|
3287
|
+
fc as toolbarFilterScope,
|
|
3288
|
+
mc as transformComparisonDocument,
|
|
3289
|
+
Wa as updateMatrixConfig,
|
|
3290
|
+
cs as upgradeCardFormats,
|
|
3291
|
+
Js as upgradeCardPresentation,
|
|
3292
|
+
bs as upgradeConditionalFormatting,
|
|
3293
|
+
ul as upgradeToStoredDashboard,
|
|
3294
|
+
hc as validateControlValue,
|
|
3295
|
+
Ko as validateDashboardAuthoringDatasetScope,
|
|
3296
|
+
Nc as validateDashboardFilterValues,
|
|
3297
|
+
Jo as validateDashboardPlan,
|
|
3298
|
+
ya as validateResolvedPrimaryDateFieldShape,
|
|
3299
|
+
pc as withCardConditionalRules,
|
|
3300
|
+
gc as withCardConfigSqlDatePatterns,
|
|
3301
|
+
bc as withCardExcludedFromScope,
|
|
3302
|
+
yc as withCardIncludedInScope,
|
|
3303
|
+
Ic as withDashboardOptionDependencyOverride,
|
|
3304
|
+
_c as withSqlDatePattern,
|
|
3305
|
+
Ra as withUnstatedScopeParts,
|
|
3306
|
+
pa as withoutToolbarFilterReachFields
|
|
2596
3307
|
};
|