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
|
@@ -0,0 +1,3453 @@
|
|
|
1
|
+
import { M as ve, x as O, w as It, y as St, z as kt, B as wt, D as At, v as xt, h as je, j as X, k as Ft, b as Dt, d as Ye } from "./analytics-base-schemas-CHLxsPfX.js";
|
|
2
|
+
import { z as a } from "zod";
|
|
3
|
+
function Mt(e) {
|
|
4
|
+
return typeof e == "string" || typeof e == "number" && Number.isFinite(e) || typeof e == "boolean";
|
|
5
|
+
}
|
|
6
|
+
function Et(e) {
|
|
7
|
+
return !Array.isArray(e) || e.length === 0 || e.length > ve || !e.every(Mt) ? {
|
|
8
|
+
ok: !1,
|
|
9
|
+
error: `matchValues must be 1 to ${ve} string, number or boolean values.`
|
|
10
|
+
} : { ok: !0, values: e };
|
|
11
|
+
}
|
|
12
|
+
const Tt = [
|
|
13
|
+
"day",
|
|
14
|
+
"week",
|
|
15
|
+
"month",
|
|
16
|
+
"quarter",
|
|
17
|
+
"year"
|
|
18
|
+
], Ma = ["this", "previous"], Nt = ["now", "latest_available"], Rt = [
|
|
19
|
+
"include_partial",
|
|
20
|
+
"complete_periods"
|
|
21
|
+
], Ea = {
|
|
22
|
+
second: 31536e4,
|
|
23
|
+
minute: 5256e3,
|
|
24
|
+
hour: 87600,
|
|
25
|
+
day: 3650,
|
|
26
|
+
week: 520,
|
|
27
|
+
month: 120,
|
|
28
|
+
quarter: 40,
|
|
29
|
+
year: 10
|
|
30
|
+
};
|
|
31
|
+
function $t(e) {
|
|
32
|
+
return e.anchor ?? "latest_available";
|
|
33
|
+
}
|
|
34
|
+
function M(e) {
|
|
35
|
+
return !!e && (e.kind === void 0 || e.kind === "relative");
|
|
36
|
+
}
|
|
37
|
+
function Ct(e) {
|
|
38
|
+
return (e == null ? void 0 : e.kind) === "calendar";
|
|
39
|
+
}
|
|
40
|
+
function Ta(e) {
|
|
41
|
+
return M(e) && e.anchor === "latest_available" || Yt(e) ? null : M(e) && e.unit === "day" && e.completeness !== "complete_periods" ? { mode: "between", unit: "day", from: 1 - e.value, to: 0 } : Ot(M(e) ? { ...e, anchor: "now" } : e);
|
|
42
|
+
}
|
|
43
|
+
const jt = /* @__PURE__ */ new Set(["week", "month", "quarter", "year"]);
|
|
44
|
+
function Yt(e) {
|
|
45
|
+
return M(e) && jt.has(e.unit) && e.completeness !== "complete_periods";
|
|
46
|
+
}
|
|
47
|
+
function Na(e) {
|
|
48
|
+
const t = e;
|
|
49
|
+
return t.mode === "between" ? t.unit === "day" && t.to === 0 && typeof t.from == "number" && t.from <= 0 ? { unit: "day", value: 1 - t.from } : null : t.mode === "last" && typeof t.n == "number" ? t.relativeTo === "latest_data" ? null : {
|
|
50
|
+
unit: t.unit,
|
|
51
|
+
value: t.n,
|
|
52
|
+
anchor: "now",
|
|
53
|
+
completeness: t.complete ? "complete_periods" : "include_partial"
|
|
54
|
+
} : t.mode === "this" ? t.boundary ? null : { kind: "calendar", unit: t.unit, period: "this", ...t.toDate ? { toDate: !0 } : {} } : t.mode === "previous" ? { kind: "calendar", unit: t.unit, period: "previous" } : null;
|
|
55
|
+
}
|
|
56
|
+
function Ot(e, t = {}) {
|
|
57
|
+
if (Ct(e))
|
|
58
|
+
return e.period === "previous" ? { mode: "previous", unit: e.unit } : {
|
|
59
|
+
mode: "this",
|
|
60
|
+
unit: e.unit,
|
|
61
|
+
...e.toDate ? { toDate: !0 } : {}
|
|
62
|
+
};
|
|
63
|
+
if (!M(e))
|
|
64
|
+
return null;
|
|
65
|
+
const i = $t(e) === "latest_available" ? { relativeTo: "latest_data" } : {}, s = e.value, l = (t.completeness ?? e.completeness) === "complete_periods";
|
|
66
|
+
switch (e.unit) {
|
|
67
|
+
case "second":
|
|
68
|
+
return null;
|
|
69
|
+
case "minute":
|
|
70
|
+
case "hour":
|
|
71
|
+
return l ? null : { mode: "last", n: s, unit: e.unit, ...i };
|
|
72
|
+
default:
|
|
73
|
+
return {
|
|
74
|
+
mode: "last",
|
|
75
|
+
n: s,
|
|
76
|
+
unit: e.unit,
|
|
77
|
+
...l ? { complete: !0 } : {},
|
|
78
|
+
...i
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function r(e, t, i) {
|
|
83
|
+
return i ? { code: e, message: t, path: i } : { code: e, message: t };
|
|
84
|
+
}
|
|
85
|
+
function c(e) {
|
|
86
|
+
return typeof e == "string" && e.trim().length > 0;
|
|
87
|
+
}
|
|
88
|
+
function Pt(e) {
|
|
89
|
+
const t = /* @__PURE__ */ new Set();
|
|
90
|
+
return qt(e, (i) => (t.add(i), `{${i}}`)), Array.from(t);
|
|
91
|
+
}
|
|
92
|
+
function qt(e, t) {
|
|
93
|
+
let i = "", s = 0, l = 0;
|
|
94
|
+
for (; l < e.length; ) {
|
|
95
|
+
const n = e[l];
|
|
96
|
+
if (n === "'" || n === '"') {
|
|
97
|
+
l = Lt(e, l);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (n === "{") {
|
|
101
|
+
const o = e.indexOf("}", l + 1);
|
|
102
|
+
if (o === -1) {
|
|
103
|
+
l += 1;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const d = e.slice(l + 1, o);
|
|
107
|
+
/^[A-Za-z_][A-Za-z0-9_]*$/.test(d) && (i += e.slice(s, l) + t(d), s = o + 1), l = o + 1;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
l += 1;
|
|
111
|
+
}
|
|
112
|
+
return i + e.slice(s);
|
|
113
|
+
}
|
|
114
|
+
function Lt(e, t) {
|
|
115
|
+
const i = e[t];
|
|
116
|
+
let s = t + 1;
|
|
117
|
+
for (; s < e.length; ) {
|
|
118
|
+
if (e[s] === i) {
|
|
119
|
+
if (e[s + 1] === i) {
|
|
120
|
+
s += 2;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
return s + 1;
|
|
124
|
+
}
|
|
125
|
+
s += 1;
|
|
126
|
+
}
|
|
127
|
+
return e.length;
|
|
128
|
+
}
|
|
129
|
+
function f(e) {
|
|
130
|
+
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
131
|
+
}
|
|
132
|
+
const Bt = /* @__PURE__ */ new Set([
|
|
133
|
+
"SUM",
|
|
134
|
+
"COUNT",
|
|
135
|
+
"AVG",
|
|
136
|
+
"MIN",
|
|
137
|
+
"MAX",
|
|
138
|
+
"MEDIAN",
|
|
139
|
+
"DISTINCT"
|
|
140
|
+
]);
|
|
141
|
+
function se(e, t, i) {
|
|
142
|
+
if (!e || typeof e != "object") {
|
|
143
|
+
i.push(
|
|
144
|
+
r("missing_source", "Analytics intent needs a source.", t)
|
|
145
|
+
);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (e.kind === "semantic") {
|
|
149
|
+
c(e.domainId) || i.push(
|
|
150
|
+
r(
|
|
151
|
+
"missing_semantic_domain",
|
|
152
|
+
"Semantic source needs a domainId.",
|
|
153
|
+
`${t}.domainId`
|
|
154
|
+
)
|
|
155
|
+
), c(e.datasetName) || i.push(
|
|
156
|
+
r(
|
|
157
|
+
"missing_dataset_name",
|
|
158
|
+
"Semantic source needs a datasetName.",
|
|
159
|
+
`${t}.datasetName`
|
|
160
|
+
)
|
|
161
|
+
);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (e.kind === "physical") {
|
|
165
|
+
c(e.connectionId) || i.push(
|
|
166
|
+
r(
|
|
167
|
+
"missing_connection_id",
|
|
168
|
+
"Physical source needs a connectionId.",
|
|
169
|
+
`${t}.connectionId`
|
|
170
|
+
)
|
|
171
|
+
), c(e.tableName) || i.push(
|
|
172
|
+
r(
|
|
173
|
+
"missing_table_name",
|
|
174
|
+
"Physical source needs a tableName.",
|
|
175
|
+
`${t}.tableName`
|
|
176
|
+
)
|
|
177
|
+
);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (e.kind === "sql") {
|
|
181
|
+
c(e.connectionId) || i.push(
|
|
182
|
+
r(
|
|
183
|
+
"missing_connection_id",
|
|
184
|
+
"SQL source needs a connectionId.",
|
|
185
|
+
`${t}.connectionId`
|
|
186
|
+
)
|
|
187
|
+
);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
i.push(
|
|
191
|
+
r("invalid_source_kind", "Source kind is not supported.", t)
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
function _(e, t, i, s = {}) {
|
|
195
|
+
if (!e || !f(e)) {
|
|
196
|
+
s.required && i.push(
|
|
197
|
+
r("missing_field_ref", "Field reference needs a name.", t)
|
|
198
|
+
);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
c(e.name) || i.push(
|
|
202
|
+
r(
|
|
203
|
+
"missing_field_ref",
|
|
204
|
+
"Field reference needs a name.",
|
|
205
|
+
`${t}.name`
|
|
206
|
+
)
|
|
207
|
+
), e.source !== void 0 && se(e.source, `${t}.source`, i), re(e.aggregate, `${t}.aggregate`, i);
|
|
208
|
+
}
|
|
209
|
+
function re(e, t, i) {
|
|
210
|
+
e !== void 0 && (typeof e != "string" || !Bt.has(e)) && i.push(
|
|
211
|
+
r(
|
|
212
|
+
"invalid_aggregate",
|
|
213
|
+
"Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
|
|
214
|
+
t
|
|
215
|
+
)
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
const Ht = /* @__PURE__ */ new Set([
|
|
219
|
+
"measure",
|
|
220
|
+
"dimension",
|
|
221
|
+
"date",
|
|
222
|
+
"id",
|
|
223
|
+
"unknown"
|
|
224
|
+
]), Vt = /* @__PURE__ */ new Set(["row", "aggregate"]), Oe = /* @__PURE__ */ new Set([
|
|
225
|
+
"string",
|
|
226
|
+
"number",
|
|
227
|
+
"boolean",
|
|
228
|
+
"date",
|
|
229
|
+
"datetime",
|
|
230
|
+
"unknown"
|
|
231
|
+
]);
|
|
232
|
+
function Pe(e, t, i) {
|
|
233
|
+
if (e === void 0)
|
|
234
|
+
return;
|
|
235
|
+
if (!f(e)) {
|
|
236
|
+
i.push(
|
|
237
|
+
r(
|
|
238
|
+
"invalid_value_format",
|
|
239
|
+
"Value format must be a structured object.",
|
|
240
|
+
t
|
|
241
|
+
)
|
|
242
|
+
);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const s = (e.type === "temporal_bucket" ? O : It).safeParse(e);
|
|
246
|
+
if (s.success) return;
|
|
247
|
+
const l = e.type === "temporal_bucket" ? "invalid_temporal_bucket_format" : "invalid_value_format";
|
|
248
|
+
for (const n of s.error.issues)
|
|
249
|
+
i.push(
|
|
250
|
+
r(
|
|
251
|
+
l,
|
|
252
|
+
n.message,
|
|
253
|
+
[t, ...n.path.map(String)].filter(Boolean).join(".")
|
|
254
|
+
)
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
const Ut = /* @__PURE__ */ new Set([
|
|
258
|
+
"additive",
|
|
259
|
+
"non_additive",
|
|
260
|
+
"ratio_of_sums",
|
|
261
|
+
"weighted",
|
|
262
|
+
"pre_aggregated",
|
|
263
|
+
"snapshot"
|
|
264
|
+
]), zt = /* @__PURE__ */ new Set([
|
|
265
|
+
"default",
|
|
266
|
+
"symmetric_aggregate",
|
|
267
|
+
"aggregate_then_join",
|
|
268
|
+
"weighted"
|
|
269
|
+
]);
|
|
270
|
+
function Gt(e, t, i) {
|
|
271
|
+
if (!e || !f(e)) {
|
|
272
|
+
i.push(
|
|
273
|
+
r(
|
|
274
|
+
"invalid_derived_field_input",
|
|
275
|
+
"Derived field inputs must be structured input references.",
|
|
276
|
+
t
|
|
277
|
+
)
|
|
278
|
+
);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (e.kind === "field") {
|
|
282
|
+
_(e.field, `${t}.field`, i, { required: !0 }), re(e.aggregate, `${t}.aggregate`, i);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
i.push(
|
|
286
|
+
r(
|
|
287
|
+
"invalid_derived_field_input",
|
|
288
|
+
"Derived field input kind must be field.",
|
|
289
|
+
`${t}.kind`
|
|
290
|
+
)
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
function oe(e) {
|
|
294
|
+
const t = [];
|
|
295
|
+
if (!f(e))
|
|
296
|
+
return t.push(
|
|
297
|
+
r(
|
|
298
|
+
"invalid_derived_field",
|
|
299
|
+
"Derived field definition must be a structured object."
|
|
300
|
+
)
|
|
301
|
+
), { ok: !1, errors: t, warnings: [] };
|
|
302
|
+
if (e.kind !== "derived_field" && t.push(
|
|
303
|
+
r(
|
|
304
|
+
"invalid_derived_field_kind",
|
|
305
|
+
"Derived field kind must be derived_field.",
|
|
306
|
+
"kind"
|
|
307
|
+
)
|
|
308
|
+
), c(e.name) || t.push(
|
|
309
|
+
r(
|
|
310
|
+
"invalid_derived_field_name",
|
|
311
|
+
"Derived field needs a name.",
|
|
312
|
+
"name"
|
|
313
|
+
)
|
|
314
|
+
), c(e.label) || t.push(
|
|
315
|
+
r(
|
|
316
|
+
"invalid_derived_field_label",
|
|
317
|
+
"Derived field needs a label.",
|
|
318
|
+
"label"
|
|
319
|
+
)
|
|
320
|
+
), Ht.has(e.resultRole) || t.push(
|
|
321
|
+
r(
|
|
322
|
+
"invalid_derived_field_role",
|
|
323
|
+
"Derived field resultRole must be measure, dimension, date, id, or unknown.",
|
|
324
|
+
"resultRole"
|
|
325
|
+
)
|
|
326
|
+
), Oe.has(e.dataType) || t.push(
|
|
327
|
+
r(
|
|
328
|
+
"invalid_derived_field_data_type",
|
|
329
|
+
"Derived field dataType must be string, number, boolean, date, datetime, or unknown.",
|
|
330
|
+
"dataType"
|
|
331
|
+
)
|
|
332
|
+
), Vt.has(e.computeStage) || t.push(
|
|
333
|
+
r(
|
|
334
|
+
"invalid_derived_field_compute_stage",
|
|
335
|
+
"Derived field computeStage must be row or aggregate.",
|
|
336
|
+
"computeStage"
|
|
337
|
+
)
|
|
338
|
+
), e.computeStage === "aggregate" && e.resultRole !== "measure" && t.push(
|
|
339
|
+
r(
|
|
340
|
+
"invalid_derived_field_compute_stage",
|
|
341
|
+
"Aggregate-stage derived fields must have resultRole measure.",
|
|
342
|
+
"computeStage"
|
|
343
|
+
)
|
|
344
|
+
), e.resultRole !== "measure" && e.defaultAggregate !== void 0 && t.push(
|
|
345
|
+
r(
|
|
346
|
+
"invalid_derived_field_aggregate",
|
|
347
|
+
"Only measure derived fields may declare defaultAggregate.",
|
|
348
|
+
"defaultAggregate"
|
|
349
|
+
)
|
|
350
|
+
), e.computeStage === "row" && e.resultRole === "measure" && e.defaultAggregate === void 0 && t.push(
|
|
351
|
+
r(
|
|
352
|
+
"missing_derived_field_default_aggregate",
|
|
353
|
+
"Row-stage measure derived fields must declare defaultAggregate so row results have explicit rollup semantics.",
|
|
354
|
+
"defaultAggregate"
|
|
355
|
+
)
|
|
356
|
+
), re(
|
|
357
|
+
e.defaultAggregate,
|
|
358
|
+
"defaultAggregate",
|
|
359
|
+
t
|
|
360
|
+
), e.aggregationBehavior !== void 0 && !Ut.has(
|
|
361
|
+
e.aggregationBehavior
|
|
362
|
+
) && t.push(
|
|
363
|
+
r(
|
|
364
|
+
"invalid_derived_field_aggregation_behavior",
|
|
365
|
+
"Derived field aggregationBehavior is not supported.",
|
|
366
|
+
"aggregationBehavior"
|
|
367
|
+
)
|
|
368
|
+
), e.aggregationStrategy !== void 0 && !zt.has(
|
|
369
|
+
e.aggregationStrategy
|
|
370
|
+
) && t.push(
|
|
371
|
+
r(
|
|
372
|
+
"invalid_derived_field_aggregation_strategy",
|
|
373
|
+
"Derived field aggregationStrategy is not supported.",
|
|
374
|
+
"aggregationStrategy"
|
|
375
|
+
)
|
|
376
|
+
), c(e.expression) || t.push(
|
|
377
|
+
r(
|
|
378
|
+
"invalid_derived_field_expression",
|
|
379
|
+
"Derived field needs a named-token expression.",
|
|
380
|
+
"expression"
|
|
381
|
+
)
|
|
382
|
+
), e.expressionLanguage !== void 0 && e.expressionLanguage !== "semaphor_sql_template" && t.push(
|
|
383
|
+
r(
|
|
384
|
+
"invalid_derived_field_expression_language",
|
|
385
|
+
"Derived field expressionLanguage must be semaphor_sql_template.",
|
|
386
|
+
"expressionLanguage"
|
|
387
|
+
)
|
|
388
|
+
), !f(e.inputs) || Object.keys(e.inputs).length === 0 ? t.push(
|
|
389
|
+
r(
|
|
390
|
+
"invalid_derived_field_inputs",
|
|
391
|
+
"Derived field needs at least one typed input.",
|
|
392
|
+
"inputs"
|
|
393
|
+
)
|
|
394
|
+
) : Object.entries(e.inputs).forEach(([s, l]) => {
|
|
395
|
+
if (!c(s)) {
|
|
396
|
+
t.push(
|
|
397
|
+
r(
|
|
398
|
+
"invalid_derived_field_input_name",
|
|
399
|
+
"Derived field input names must be non-empty strings.",
|
|
400
|
+
"inputs"
|
|
401
|
+
)
|
|
402
|
+
);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
Gt(
|
|
406
|
+
l,
|
|
407
|
+
`inputs.${s}`,
|
|
408
|
+
t
|
|
409
|
+
);
|
|
410
|
+
}), c(e.expression) && f(e.inputs)) {
|
|
411
|
+
const s = Pt(
|
|
412
|
+
e.expression
|
|
413
|
+
), l = new Set(s), n = Object.keys(e.inputs).filter(
|
|
414
|
+
(o) => c(o)
|
|
415
|
+
);
|
|
416
|
+
s.forEach((o) => {
|
|
417
|
+
Object.prototype.hasOwnProperty.call(e.inputs, o) || t.push(
|
|
418
|
+
r(
|
|
419
|
+
"invalid_derived_field_expression_token",
|
|
420
|
+
`Derived field expression token "{${o}}" needs a matching inputs.${o} entry.`,
|
|
421
|
+
"expression"
|
|
422
|
+
)
|
|
423
|
+
);
|
|
424
|
+
}), n.forEach((o) => {
|
|
425
|
+
l.has(o) || t.push(
|
|
426
|
+
r(
|
|
427
|
+
"unused_derived_field_input",
|
|
428
|
+
`Derived field input "${o}" is not referenced by expression.`,
|
|
429
|
+
`inputs.${o}`
|
|
430
|
+
)
|
|
431
|
+
);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
const i = e.format;
|
|
435
|
+
return f(i) && i.type === "temporal_bucket" ? t.push(
|
|
436
|
+
r(
|
|
437
|
+
"invalid_derived_field_format",
|
|
438
|
+
"Derived field computation metadata cannot own temporal bucket presentation; declare grain and format on the grouped field.",
|
|
439
|
+
"format"
|
|
440
|
+
)
|
|
441
|
+
) : Pe(i, "format", t), e.tags !== void 0 && (!Array.isArray(e.tags) || e.tags.some((s) => !c(s))) && t.push(
|
|
442
|
+
r(
|
|
443
|
+
"invalid_derived_field_tags",
|
|
444
|
+
"Derived field tags must be non-empty strings.",
|
|
445
|
+
"tags"
|
|
446
|
+
)
|
|
447
|
+
), { ok: t.length === 0, errors: t, warnings: [] };
|
|
448
|
+
}
|
|
449
|
+
const D = a.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), le = a.union([
|
|
450
|
+
St.extend({ domainId: D, datasetName: D }).strict(),
|
|
451
|
+
kt.extend({ connectionId: D, tableName: D }).strict()
|
|
452
|
+
]), qe = wt.extend({
|
|
453
|
+
name: D,
|
|
454
|
+
source: le.optional()
|
|
455
|
+
}).strict(), de = At.extend({
|
|
456
|
+
format: xt.optional(),
|
|
457
|
+
inputs: a.record(
|
|
458
|
+
a.object({
|
|
459
|
+
kind: a.literal("field"),
|
|
460
|
+
field: qe,
|
|
461
|
+
aggregate: je.optional()
|
|
462
|
+
}).strict()
|
|
463
|
+
)
|
|
464
|
+
}).strict().superRefine((e, t) => {
|
|
465
|
+
var i;
|
|
466
|
+
for (const s of oe(e).errors)
|
|
467
|
+
t.addIssue({
|
|
468
|
+
code: "custom",
|
|
469
|
+
path: ((i = s.path) == null ? void 0 : i.split(".")) ?? [],
|
|
470
|
+
message: s.message
|
|
471
|
+
});
|
|
472
|
+
}), Qt = qe.extend({
|
|
473
|
+
derivedField: de.optional()
|
|
474
|
+
}).strict();
|
|
475
|
+
function ue(e) {
|
|
476
|
+
return typeof e == "string" ? e.trim().toLowerCase() : "";
|
|
477
|
+
}
|
|
478
|
+
function Kt(e) {
|
|
479
|
+
return String(
|
|
480
|
+
e.column_name || e.name || e.qualifiedFieldName || ""
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
function Xt(e) {
|
|
484
|
+
return Array.from(
|
|
485
|
+
new Set(
|
|
486
|
+
[e.column_name, e.name, e.qualifiedFieldName, e.alias].filter(
|
|
487
|
+
(t) => typeof t == "string" && t.trim().length > 0
|
|
488
|
+
).map((t) => t.trim())
|
|
489
|
+
)
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
function ce(e) {
|
|
493
|
+
const t = Be(e);
|
|
494
|
+
return t ? ei(t) ? "number" : t.includes("timestamp") || t.includes("datetime") || t.startsWith("time") ? "datetime" : t.includes("date") ? "date" : t.includes("bool") ? "boolean" : "string" : "unknown";
|
|
495
|
+
}
|
|
496
|
+
const U = /* @__PURE__ */ new Map([
|
|
497
|
+
// Integer families (PostgreSQL, ClickHouse, DuckDB, MySQL).
|
|
498
|
+
["int", "integer"],
|
|
499
|
+
["uint", "integer"],
|
|
500
|
+
["integer", "integer"],
|
|
501
|
+
["uinteger", "integer"],
|
|
502
|
+
["bigint", "integer"],
|
|
503
|
+
["ubigint", "integer"],
|
|
504
|
+
["smallint", "integer"],
|
|
505
|
+
["usmallint", "integer"],
|
|
506
|
+
["tinyint", "integer"],
|
|
507
|
+
["utinyint", "integer"],
|
|
508
|
+
["mediumint", "integer"],
|
|
509
|
+
["hugeint", "integer"],
|
|
510
|
+
["uhugeint", "integer"],
|
|
511
|
+
// Exact decimal families.
|
|
512
|
+
["numeric", "decimal"],
|
|
513
|
+
["decimal", "decimal"],
|
|
514
|
+
// Binary floating point.
|
|
515
|
+
["float", "float"],
|
|
516
|
+
["double", "float"],
|
|
517
|
+
["real", "float"],
|
|
518
|
+
["bfloat16", "float"],
|
|
519
|
+
// Numeric for grounding; storage representation not established
|
|
520
|
+
// (`number(p, s)` with an explicit scale is resolved before this table).
|
|
521
|
+
["number", null],
|
|
522
|
+
["money", null],
|
|
523
|
+
["currency", null],
|
|
524
|
+
["percent", null]
|
|
525
|
+
]), Zt = ["int", "uint", "decimal", "float"];
|
|
526
|
+
function Jt(e) {
|
|
527
|
+
return e.length > 0 && Array.from(e).every((t) => t >= "0" && t <= "9");
|
|
528
|
+
}
|
|
529
|
+
function Wt(e) {
|
|
530
|
+
var i;
|
|
531
|
+
const t = (i = /^number\s*\(\s*\d+\s*,\s*(\d+)\s*\)$/.exec(e)) == null ? void 0 : i[1];
|
|
532
|
+
return t === void 0 ? null : Number(t) === 0 ? "integer" : "decimal";
|
|
533
|
+
}
|
|
534
|
+
function Le(e) {
|
|
535
|
+
const t = e.split(/[\s(]/, 1)[0] || "";
|
|
536
|
+
if (t === "number")
|
|
537
|
+
return { numeric: !0, kind: Wt(e) };
|
|
538
|
+
if (U.has(t))
|
|
539
|
+
return { numeric: !0, kind: U.get(t) ?? null };
|
|
540
|
+
const i = Zt.find(
|
|
541
|
+
(s) => t.startsWith(s) && Jt(t.slice(s.length))
|
|
542
|
+
);
|
|
543
|
+
return i ? { numeric: !0, kind: U.get(i) ?? null } : { numeric: !1, kind: null };
|
|
544
|
+
}
|
|
545
|
+
function ei(e) {
|
|
546
|
+
return Le(e).numeric;
|
|
547
|
+
}
|
|
548
|
+
function ti(e) {
|
|
549
|
+
return Le(Be(e)).kind;
|
|
550
|
+
}
|
|
551
|
+
function Be(e) {
|
|
552
|
+
let t = ue(e), i = "";
|
|
553
|
+
for (; t && t !== i; )
|
|
554
|
+
i = t, t = Ie(t, "nullable"), t = Ie(t, "lowcardinality");
|
|
555
|
+
return t;
|
|
556
|
+
}
|
|
557
|
+
function Ie(e, t) {
|
|
558
|
+
const i = `${t}(`;
|
|
559
|
+
return !e.startsWith(i) || !e.endsWith(")") ? e : e.slice(i.length, -1).trim();
|
|
560
|
+
}
|
|
561
|
+
function ii(e) {
|
|
562
|
+
const t = ce(e);
|
|
563
|
+
return t === "date" || t === "datetime";
|
|
564
|
+
}
|
|
565
|
+
function He(e) {
|
|
566
|
+
return ii(e.dataType || e.data_type);
|
|
567
|
+
}
|
|
568
|
+
function Ve(e) {
|
|
569
|
+
const t = Ue(e);
|
|
570
|
+
return t === "id" || t === "row_id";
|
|
571
|
+
}
|
|
572
|
+
function Se(e) {
|
|
573
|
+
const t = Ue(e);
|
|
574
|
+
return Ve(e) || t.endsWith("_id") || t.endsWith("_key") || t.endsWith("_number");
|
|
575
|
+
}
|
|
576
|
+
function Ue(e) {
|
|
577
|
+
return ue(
|
|
578
|
+
Kt(e) || e.name || e.alias
|
|
579
|
+
).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
580
|
+
}
|
|
581
|
+
function ze(e, t = {}) {
|
|
582
|
+
const i = ue(e.role);
|
|
583
|
+
return i === "metric" || i === "measure" ? !t.excludeIdentifiers || !Se(e) : i === "groupby" || i === "dimension" || i === "date" || i === "id" ? !1 : ce(
|
|
584
|
+
e.dataType || e.data_type
|
|
585
|
+
) === "number" && (!t.excludeIdentifiers || !Se(e));
|
|
586
|
+
}
|
|
587
|
+
function Ra(e) {
|
|
588
|
+
return !ze(e) && !He(e);
|
|
589
|
+
}
|
|
590
|
+
function $a(e) {
|
|
591
|
+
const t = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
592
|
+
for (const l of e) {
|
|
593
|
+
if (Ve(l))
|
|
594
|
+
continue;
|
|
595
|
+
const n = Xt(l);
|
|
596
|
+
if (n.length !== 0) {
|
|
597
|
+
if (He(l)) {
|
|
598
|
+
n.forEach((o) => i.add(o));
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
if (ze(l, { excludeIdentifiers: !0 })) {
|
|
602
|
+
n.forEach((o) => t.add(o));
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
n.forEach((o) => s.add(o));
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
return {
|
|
609
|
+
validMeasureCandidates: Array.from(t).sort(),
|
|
610
|
+
validDateCandidates: Array.from(i).sort(),
|
|
611
|
+
validDimensionCandidates: Array.from(s).sort()
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
const E = 16 * 1024;
|
|
615
|
+
function P(e) {
|
|
616
|
+
const t = /^([+-]?)(?:(\d+)(?:\.(\d*))?|\.(\d+))(?:[eE]([+-]?\d+))?$/.exec(e);
|
|
617
|
+
return t ? {
|
|
618
|
+
sign: t[1],
|
|
619
|
+
whole: t[2] ?? "",
|
|
620
|
+
fraction: t[3] ?? t[4],
|
|
621
|
+
exponent: Number(t[5] ?? "0")
|
|
622
|
+
} : null;
|
|
623
|
+
}
|
|
624
|
+
function ke(e) {
|
|
625
|
+
const { sign: t, whole: i, fraction: s = "", exponent: l } = e, n = (i + s).replace(/^0+/, ""), o = n.replace(/0+$/, ""), d = l - s.length + n.length - o.length;
|
|
626
|
+
return !Number.isSafeInteger(l) || !Number.isSafeInteger(d) ? null : o ? `${t === "-" ? "-" : ""}${o}e${d}` : "0";
|
|
627
|
+
}
|
|
628
|
+
function Ca(e) {
|
|
629
|
+
const t = P(e);
|
|
630
|
+
if (!t) return null;
|
|
631
|
+
const i = t.sign === "+" ? e.slice(1) : e, s = Number(e);
|
|
632
|
+
if (!Number.isFinite(s)) return i;
|
|
633
|
+
const l = ke(t), n = P(String(s));
|
|
634
|
+
return l !== null && n !== null && l === ke(n) ? s : i;
|
|
635
|
+
}
|
|
636
|
+
function ja(e) {
|
|
637
|
+
if (e.length > E)
|
|
638
|
+
throw new RangeError("Exact numeric text exceeds 16 KiB.");
|
|
639
|
+
const t = P(e);
|
|
640
|
+
if (!t) throw new TypeError("Expected finite decimal text.");
|
|
641
|
+
const { sign: i, whole: s, fraction: l, exponent: n } = t, o = `${i}${s || "0"}${l ? `.${l}` : ""}`;
|
|
642
|
+
return R(`${o}e${n}`);
|
|
643
|
+
}
|
|
644
|
+
function R(e) {
|
|
645
|
+
if (e.length > E)
|
|
646
|
+
throw new RangeError("Exact numeric text exceeds 16 KiB.");
|
|
647
|
+
const t = P(e);
|
|
648
|
+
if (!t || t.whole === "" || t.fraction === "")
|
|
649
|
+
throw new TypeError("Expected finite decimal text.");
|
|
650
|
+
const { sign: i, whole: s, fraction: l = "", exponent: n } = t;
|
|
651
|
+
if (!Number.isSafeInteger(n) || Math.abs(n) > E)
|
|
652
|
+
throw new RangeError("Exact numeric exponent exceeds the text budget.");
|
|
653
|
+
const o = s + l, d = s.length + n;
|
|
654
|
+
if (Math.max(o.length, d) + Math.max(0, -d) + 3 > E)
|
|
655
|
+
throw new RangeError("Normalized exact numeric text exceeds 16 KiB.");
|
|
656
|
+
let m;
|
|
657
|
+
d <= 0 ? m = `0.${"0".repeat(-d)}${o}` : d >= o.length ? m = o + "0".repeat(d - o.length) : m = `${o.slice(0, d)}.${o.slice(d)}`;
|
|
658
|
+
const [u, g = ""] = m.split("."), y = u.replace(/^0+(?=\d)/, ""), I = g.replace(/0+$/, ""), S = y + (I ? `.${I}` : "");
|
|
659
|
+
return i === "-" && S !== "0" ? `-${S}` : S;
|
|
660
|
+
}
|
|
661
|
+
function Ya(e, t) {
|
|
662
|
+
const i = e.startsWith("-"), s = t.startsWith("-");
|
|
663
|
+
if (i !== s) return i ? -1 : 1;
|
|
664
|
+
const [l, n = ""] = (i ? e.slice(1) : e).split("."), [o, d = ""] = (s ? t.slice(1) : t).split(".");
|
|
665
|
+
let p = Math.sign(l.length - o.length);
|
|
666
|
+
if (!p && l !== o && (p = l < o ? -1 : 1), !p) {
|
|
667
|
+
const m = Math.max(n.length, d.length), u = n.padEnd(m, "0"), g = d.padEnd(m, "0");
|
|
668
|
+
p = u === g ? 0 : u < g ? -1 : 1;
|
|
669
|
+
}
|
|
670
|
+
return p === 0 ? 0 : i ? -p : p;
|
|
671
|
+
}
|
|
672
|
+
function Oa(e, t) {
|
|
673
|
+
if (typeof t == "number" && !Number.isFinite(t))
|
|
674
|
+
throw new TypeError("Numeric scale must be finite.");
|
|
675
|
+
const i = [e, R(String(t))].map((n) => {
|
|
676
|
+
const [o, d = ""] = n.split(".");
|
|
677
|
+
return { coefficient: BigInt(o + d), digits: d.length };
|
|
678
|
+
}), s = i[0].coefficient * i[1].coefficient, l = i[0].digits + i[1].digits;
|
|
679
|
+
return R(`${s}e-${l}`);
|
|
680
|
+
}
|
|
681
|
+
function ai(e) {
|
|
682
|
+
try {
|
|
683
|
+
return R(e) === e;
|
|
684
|
+
} catch {
|
|
685
|
+
return !1;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
const Ge = a.object({
|
|
689
|
+
kind: a.literal("exact_number"),
|
|
690
|
+
type: a.enum(["integer", "decimal"]),
|
|
691
|
+
value: a.string().max(E).refine(ai, "Expected canonical decimal text.")
|
|
692
|
+
}).strict().superRefine((e, t) => {
|
|
693
|
+
e.type === "integer" && e.value.includes(".") && t.addIssue({ code: "custom", path: ["value"], message: "An integer cannot have fractional digits." });
|
|
694
|
+
}), ni = a.union([
|
|
695
|
+
a.null(),
|
|
696
|
+
a.string(),
|
|
697
|
+
a.boolean(),
|
|
698
|
+
a.number().finite(),
|
|
699
|
+
Ge
|
|
700
|
+
]);
|
|
701
|
+
function si(e, t) {
|
|
702
|
+
return Ge.parse({ kind: "exact_number", type: t, value: R(e) });
|
|
703
|
+
}
|
|
704
|
+
function Pa(e) {
|
|
705
|
+
return typeof e == "object" && e !== null && "kind" in e && e.kind === "exact_number" && "type" in e && (e.type === "integer" || e.type === "decimal") && "value" in e && typeof e.value == "string";
|
|
706
|
+
}
|
|
707
|
+
function qa(e) {
|
|
708
|
+
const t = ti(e.nativeDataType);
|
|
709
|
+
if (!t) throw new TypeError("Numeric result type is not established.");
|
|
710
|
+
if (e.value === null) return null;
|
|
711
|
+
if (t === "float") {
|
|
712
|
+
if (typeof e.value != "number" || !Number.isFinite(e.value))
|
|
713
|
+
throw new TypeError("Expected a finite floating-point result.");
|
|
714
|
+
return e.value;
|
|
715
|
+
}
|
|
716
|
+
if (e.exactText === void 0)
|
|
717
|
+
throw new TypeError("Exact numeric sidecar is required; rounded result values cannot substitute.");
|
|
718
|
+
return si(e.exactText, t);
|
|
719
|
+
}
|
|
720
|
+
const pe = a.string().uuid(), me = a.enum(["rows", "columns"]), La = a.enum(["member", "subtotal", "grand_total", "others"]), ri = a.discriminatedUnion("kind", [
|
|
721
|
+
a.object({ kind: a.literal("value"), value: ni }).strict(),
|
|
722
|
+
a.object({ kind: a.literal("others"), rankingId: pe }).strict()
|
|
723
|
+
]), A = a.array(a.object({ levelId: pe, member: ri }).strict()).readonly().superRefine((e, t) => {
|
|
724
|
+
new Set(e.map((i) => i.levelId)).size !== e.length && t.addIssue({
|
|
725
|
+
code: "custom",
|
|
726
|
+
path: [],
|
|
727
|
+
message: "Duplicate identity."
|
|
728
|
+
}), e.some(
|
|
729
|
+
(i, s) => i.member.kind === "others" && s !== e.length - 1
|
|
730
|
+
) && t.addIssue({
|
|
731
|
+
code: "custom",
|
|
732
|
+
path: [],
|
|
733
|
+
message: "Others is terminal."
|
|
734
|
+
});
|
|
735
|
+
}), Ba = a.object({
|
|
736
|
+
rowPath: A,
|
|
737
|
+
columnPath: A,
|
|
738
|
+
measureId: pe
|
|
739
|
+
}).strict();
|
|
740
|
+
function Qe(e) {
|
|
741
|
+
return JSON.stringify(
|
|
742
|
+
e.map(({ levelId: t, member: i }) => [
|
|
743
|
+
t,
|
|
744
|
+
i.kind === "others" ? ["others", i.rankingId] : typeof i.value == "object" && i.value !== null ? ["exact_number", i.value.value] : [typeof i.value, i.value]
|
|
745
|
+
])
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
const Z = "SEMAPHOR_CALCULATED_FIELD", oi = "calculated_fields";
|
|
749
|
+
function li(e) {
|
|
750
|
+
return (e == null ? void 0 : e.sourceField) || (e == null ? void 0 : e.name) || "";
|
|
751
|
+
}
|
|
752
|
+
const di = [
|
|
753
|
+
// Day granularity formats
|
|
754
|
+
"MM-DD-YYYY",
|
|
755
|
+
"YYYY-MM-DD",
|
|
756
|
+
"MM/DD/YYYY",
|
|
757
|
+
"DD/MM/YYYY",
|
|
758
|
+
"MMMM DD, YYYY",
|
|
759
|
+
"MMM DD, YYYY",
|
|
760
|
+
"DD MMM YYYY",
|
|
761
|
+
"YYYY-MM-DD HH:mm",
|
|
762
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
763
|
+
"YYYY-MM-DD HH:mm Z",
|
|
764
|
+
"YYYY-MM-DD HH:mm:ss Z",
|
|
765
|
+
// Week granularity formats
|
|
766
|
+
"Week of MMM DD, YYYY",
|
|
767
|
+
"Week of MMMM DD, YYYY",
|
|
768
|
+
"YYYY-WW",
|
|
769
|
+
// Month granularity formats
|
|
770
|
+
"MMM YYYY",
|
|
771
|
+
"MMMM YYYY",
|
|
772
|
+
"YYYY-MM",
|
|
773
|
+
"MM/YYYY",
|
|
774
|
+
"YYYY MMM",
|
|
775
|
+
// Quarter granularity formats
|
|
776
|
+
"Q1 YYYY",
|
|
777
|
+
"YYYY Q1",
|
|
778
|
+
"1st Quarter YYYY",
|
|
779
|
+
"YYYY-Q1",
|
|
780
|
+
"Quarter 1, YYYY",
|
|
781
|
+
// Year granularity formats
|
|
782
|
+
"YYYY",
|
|
783
|
+
"YY",
|
|
784
|
+
// Custom format
|
|
785
|
+
"custom"
|
|
786
|
+
];
|
|
787
|
+
function Ha(e) {
|
|
788
|
+
return e.role === "metric" && "expression" in e && !!e.expression;
|
|
789
|
+
}
|
|
790
|
+
function Va(e) {
|
|
791
|
+
return !!e.expression;
|
|
792
|
+
}
|
|
793
|
+
function ui(e) {
|
|
794
|
+
return !!(e && (e.calculationRepresentation || e.expression || e.derivedField || e.calculatedFieldOrigin || e.calculatedFormula || J(e)));
|
|
795
|
+
}
|
|
796
|
+
function Ke(e) {
|
|
797
|
+
var g, y, I;
|
|
798
|
+
if (!e)
|
|
799
|
+
return {
|
|
800
|
+
representation: "physical",
|
|
801
|
+
ownership: "local",
|
|
802
|
+
completeness: "not-calculated",
|
|
803
|
+
runtimeExecutable: !1,
|
|
804
|
+
legacyManual: !1
|
|
805
|
+
};
|
|
806
|
+
const t = e.fieldScope === "domain" ? "domain" : "local", i = ((g = e.derivedField) == null ? void 0 : g.computeStage) || ((y = e.calculatedFormula) == null ? void 0 : y.computeStage), s = !e.calculatedFormula || Array.isArray(e.calculatedFormula.inputFields) && e.calculatedFormula.inputFields.every((S) => {
|
|
807
|
+
const be = S && li(S);
|
|
808
|
+
return typeof be == "string" && !!be.trim();
|
|
809
|
+
}), l = typeof e.expression == "string" && !!e.expression.trim() && s, n = e.calculationRepresentation;
|
|
810
|
+
if (e.derivedField || n === "typed-derived") {
|
|
811
|
+
const S = e.derivedField !== void 0 && oe(e.derivedField).ok;
|
|
812
|
+
return {
|
|
813
|
+
representation: "typed-derived",
|
|
814
|
+
ownership: t,
|
|
815
|
+
completeness: (!n || n === "typed-derived") && S && (!e.expression && !e.calculatedFormula || l) ? "complete" : "incomplete",
|
|
816
|
+
computeStage: i,
|
|
817
|
+
runtimeExecutable: l,
|
|
818
|
+
legacyManual: !1
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
if (!(!!n || ui(e)))
|
|
822
|
+
return {
|
|
823
|
+
representation: "physical",
|
|
824
|
+
ownership: t,
|
|
825
|
+
completeness: "not-calculated",
|
|
826
|
+
runtimeExecutable: !1,
|
|
827
|
+
legacyManual: !1
|
|
828
|
+
};
|
|
829
|
+
const d = i || (e.role === "groupby" || ((I = e.calculatedFieldOrigin) == null ? void 0 : I.role) === "groupby" ? "row" : void 0), p = t === "domain" || J(e) || e.fieldScope === "card" || e.fieldScope === "sheet" || e.fieldScope === "dashboard" ? "manual" : "inline-expression", m = n === "manual" || n === "inline-expression" ? n : p, u = (!n || n === "manual" || n === "inline-expression") && !(n === "inline-expression" && J(e));
|
|
830
|
+
return {
|
|
831
|
+
representation: m,
|
|
832
|
+
ownership: t,
|
|
833
|
+
completeness: l && u ? "complete" : "incomplete",
|
|
834
|
+
computeStage: d,
|
|
835
|
+
runtimeExecutable: l,
|
|
836
|
+
legacyManual: m === "manual" && t === "local" && !d
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
function Ua(e) {
|
|
840
|
+
if (e.calculationRepresentation) return e;
|
|
841
|
+
const { representation: t } = Ke(e);
|
|
842
|
+
return t === "physical" ? e : { ...e, calculationRepresentation: t };
|
|
843
|
+
}
|
|
844
|
+
function za(e) {
|
|
845
|
+
return Ke(e).computeStage;
|
|
846
|
+
}
|
|
847
|
+
function Ga(e, t) {
|
|
848
|
+
return e === "aggregate" && t === "default";
|
|
849
|
+
}
|
|
850
|
+
function Qa(e) {
|
|
851
|
+
var i, s;
|
|
852
|
+
const t = e;
|
|
853
|
+
return !!(t != null && t.expression && ((s = (i = t.calculatedFormula) == null ? void 0 : i.inputFields) != null && s.length));
|
|
854
|
+
}
|
|
855
|
+
function Ka(e) {
|
|
856
|
+
return !!(e && (e.entityName === Z || e.entityId === Z));
|
|
857
|
+
}
|
|
858
|
+
function J(e) {
|
|
859
|
+
return e ? [e.entityName, e.entityId, e.qualifiedEntityName].some(
|
|
860
|
+
(t) => t === Z || t === oi
|
|
861
|
+
) : !1;
|
|
862
|
+
}
|
|
863
|
+
function ci(e) {
|
|
864
|
+
const t = Ze(e);
|
|
865
|
+
return t.length > 0 ? t.join(".") : void 0;
|
|
866
|
+
}
|
|
867
|
+
function Xa(e) {
|
|
868
|
+
const t = ci(
|
|
869
|
+
e.qualifiedName
|
|
870
|
+
), i = (t == null ? void 0 : t.split(".")) || [];
|
|
871
|
+
if (i.length === 0) return {};
|
|
872
|
+
const s = {};
|
|
873
|
+
let l = i.length - 1;
|
|
874
|
+
for (let n = e.capabilities.prefixLevels.length - 1; n >= 0 && l >= 0; n -= 1, l -= 1)
|
|
875
|
+
fi(
|
|
876
|
+
s,
|
|
877
|
+
e.capabilities.prefixLevels[n],
|
|
878
|
+
i[l]
|
|
879
|
+
);
|
|
880
|
+
return s;
|
|
881
|
+
}
|
|
882
|
+
function Za(e) {
|
|
883
|
+
return !e.left.tableName || !e.right.tableName ? !1 : e.capabilities.prefixLevels.every((t) => {
|
|
884
|
+
const i = x(e.left, t), s = x(e.right, t);
|
|
885
|
+
return !i || !s || i === s;
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
function Ja(e) {
|
|
889
|
+
return e.capabilities.prefixLevels.every((t) => {
|
|
890
|
+
const i = x(e.requested, t);
|
|
891
|
+
return i ? x(e.allowed, t) === i : !0;
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
function Xe(e, t = {}) {
|
|
895
|
+
const i = $(e), s = {
|
|
896
|
+
connectionId: t.connectionId,
|
|
897
|
+
connectionType: e,
|
|
898
|
+
path: ["database", "schema", "table"],
|
|
899
|
+
labels: {
|
|
900
|
+
database: "Database",
|
|
901
|
+
schema: "Schema",
|
|
902
|
+
table: "Table"
|
|
903
|
+
},
|
|
904
|
+
prefixLevels: ["database", "schema", "table"],
|
|
905
|
+
dialect: "postgres",
|
|
906
|
+
supportsFilterClause: !0
|
|
907
|
+
};
|
|
908
|
+
return i.includes("postgres") ? {
|
|
909
|
+
...s,
|
|
910
|
+
prefixLevels: ["schema", "table"],
|
|
911
|
+
dialect: "postgres"
|
|
912
|
+
} : i.includes("mysql") ? {
|
|
913
|
+
...s,
|
|
914
|
+
prefixLevels: ["database", "table"],
|
|
915
|
+
dialect: "mysql",
|
|
916
|
+
supportsFilterClause: !1
|
|
917
|
+
} : i.includes("mssql") || i.includes("sqlserver") ? {
|
|
918
|
+
...s,
|
|
919
|
+
dialect: "mssql",
|
|
920
|
+
supportsFilterClause: !1
|
|
921
|
+
} : i.includes("redshift") ? {
|
|
922
|
+
...s,
|
|
923
|
+
prefixLevels: ["schema", "table"],
|
|
924
|
+
dialect: "redshift"
|
|
925
|
+
} : i.includes("snowflake") ? {
|
|
926
|
+
...s,
|
|
927
|
+
dialect: "snowflake"
|
|
928
|
+
} : i.includes("clickhouse") ? {
|
|
929
|
+
connectionId: t.connectionId,
|
|
930
|
+
connectionType: e,
|
|
931
|
+
path: ["database", "table"],
|
|
932
|
+
labels: {
|
|
933
|
+
database: "Database",
|
|
934
|
+
table: "Table"
|
|
935
|
+
},
|
|
936
|
+
prefixLevels: ["database", "table"],
|
|
937
|
+
dialect: "clickhouse",
|
|
938
|
+
supportsFilterClause: !1
|
|
939
|
+
} : i === "s3" || i === "api" ? {
|
|
940
|
+
connectionId: t.connectionId,
|
|
941
|
+
connectionType: e,
|
|
942
|
+
path: ["table"],
|
|
943
|
+
labels: {
|
|
944
|
+
table: i === "api" ? "API Table" : "File Table"
|
|
945
|
+
},
|
|
946
|
+
prefixLevels: ["table"],
|
|
947
|
+
dialect: "duckdb",
|
|
948
|
+
supportsFilterClause: !0
|
|
949
|
+
} : i === "googlesheets" || i === "fileupload" ? {
|
|
950
|
+
connectionId: t.connectionId,
|
|
951
|
+
connectionType: e,
|
|
952
|
+
path: ["table"],
|
|
953
|
+
labels: {
|
|
954
|
+
table: "Table"
|
|
955
|
+
},
|
|
956
|
+
prefixLevels: ["table"],
|
|
957
|
+
dialect: "postgres",
|
|
958
|
+
supportsFilterClause: !0
|
|
959
|
+
} : i === "bigquery" ? {
|
|
960
|
+
...s,
|
|
961
|
+
labels: {
|
|
962
|
+
database: "Project",
|
|
963
|
+
schema: "Dataset",
|
|
964
|
+
table: "Table"
|
|
965
|
+
},
|
|
966
|
+
prefixLevels: ["schema", "table"],
|
|
967
|
+
dialect: "bigquery",
|
|
968
|
+
supportsFilterClause: !1
|
|
969
|
+
} : s;
|
|
970
|
+
}
|
|
971
|
+
const fe = [
|
|
972
|
+
"GoogleSheets",
|
|
973
|
+
"FileUpload",
|
|
974
|
+
"MySQL",
|
|
975
|
+
"MSSQL",
|
|
976
|
+
"PostgreSQL",
|
|
977
|
+
"BigQuery",
|
|
978
|
+
"Redshift",
|
|
979
|
+
"Snowflake",
|
|
980
|
+
"S3",
|
|
981
|
+
"clickhouse",
|
|
982
|
+
"API",
|
|
983
|
+
"none"
|
|
984
|
+
];
|
|
985
|
+
function Wa(e) {
|
|
986
|
+
if (!e) return;
|
|
987
|
+
const t = fe.filter(
|
|
988
|
+
(i) => i !== "none" && Xe(i).dialect === e
|
|
989
|
+
);
|
|
990
|
+
return t.length === 1 ? t[0] : void 0;
|
|
991
|
+
}
|
|
992
|
+
const pi = {
|
|
993
|
+
postgres: "PostgreSQL",
|
|
994
|
+
sqlserver: "MSSQL"
|
|
995
|
+
};
|
|
996
|
+
function en(e) {
|
|
997
|
+
const t = $(e);
|
|
998
|
+
if (t)
|
|
999
|
+
return fe.find(
|
|
1000
|
+
(i) => $(i) === t
|
|
1001
|
+
) ?? pi[t];
|
|
1002
|
+
}
|
|
1003
|
+
function tn(e, t = {}) {
|
|
1004
|
+
return mi(
|
|
1005
|
+
e
|
|
1006
|
+
) ? Xe(e, t) : void 0;
|
|
1007
|
+
}
|
|
1008
|
+
function mi(e) {
|
|
1009
|
+
const t = $(e);
|
|
1010
|
+
if (t.includes("postgres")) return "postgres";
|
|
1011
|
+
if (t.includes("mysql")) return "mysql";
|
|
1012
|
+
if (t.includes("mssql") || t.includes("sqlserver"))
|
|
1013
|
+
return "mssql";
|
|
1014
|
+
if (t.includes("redshift")) return "redshift";
|
|
1015
|
+
if (t.includes("snowflake")) return "snowflake";
|
|
1016
|
+
if (t.includes("clickhouse")) return "clickhouse";
|
|
1017
|
+
if (t === "s3" || t === "api" || t === "googlesheets" || t === "fileupload" || t === "bigquery")
|
|
1018
|
+
return t;
|
|
1019
|
+
}
|
|
1020
|
+
function an(e) {
|
|
1021
|
+
const t = $(e);
|
|
1022
|
+
switch (t) {
|
|
1023
|
+
case "mysql":
|
|
1024
|
+
case "bigquery":
|
|
1025
|
+
case "redshift":
|
|
1026
|
+
case "snowflake":
|
|
1027
|
+
case "clickhouse":
|
|
1028
|
+
case "duckdb":
|
|
1029
|
+
case "sqlite":
|
|
1030
|
+
return t;
|
|
1031
|
+
case "mssql":
|
|
1032
|
+
case "sqlserver":
|
|
1033
|
+
return "mssql";
|
|
1034
|
+
case "postgres":
|
|
1035
|
+
case "postgresql":
|
|
1036
|
+
return "postgres";
|
|
1037
|
+
default:
|
|
1038
|
+
return "unknown";
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
function nn(e) {
|
|
1042
|
+
return e.capabilities.prefixLevels.every(
|
|
1043
|
+
(t) => !!x(e.source, t)
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
function sn(e) {
|
|
1047
|
+
const t = e.quoteIdentifier ?? _i;
|
|
1048
|
+
return e.capabilities.prefixLevels.map((i) => x(e.source, i)).filter((i) => !!i).map((i) => t(i, e.capabilities.dialect)).join(".");
|
|
1049
|
+
}
|
|
1050
|
+
function x(e, t) {
|
|
1051
|
+
return t === "database" ? e.databaseName : t === "schema" ? e.schemaName : e.tableName;
|
|
1052
|
+
}
|
|
1053
|
+
function fi(e, t, i) {
|
|
1054
|
+
t === "database" ? e.databaseName = i : t === "schema" ? e.schemaName = i : e.tableName = i;
|
|
1055
|
+
}
|
|
1056
|
+
const gi = [
|
|
1057
|
+
['"', '"'],
|
|
1058
|
+
["`", "`"],
|
|
1059
|
+
["[", "]"]
|
|
1060
|
+
];
|
|
1061
|
+
function hi(e) {
|
|
1062
|
+
const t = e.trim();
|
|
1063
|
+
for (const [i, s] of gi)
|
|
1064
|
+
if (t.length >= 2 && t.startsWith(i) && t.endsWith(s))
|
|
1065
|
+
return t.slice(1, -1).split(s + s).join(s);
|
|
1066
|
+
return t;
|
|
1067
|
+
}
|
|
1068
|
+
function Ze(e) {
|
|
1069
|
+
const t = e == null ? void 0 : e.trim();
|
|
1070
|
+
if (!t) return [];
|
|
1071
|
+
const i = t.split(".").map(hi);
|
|
1072
|
+
return i.some((s) => !s) ? [] : i;
|
|
1073
|
+
}
|
|
1074
|
+
function rn(e) {
|
|
1075
|
+
const t = Ze(e ?? void 0);
|
|
1076
|
+
return t[t.length - 1] || "";
|
|
1077
|
+
}
|
|
1078
|
+
function _i(e, t) {
|
|
1079
|
+
return t === "mysql" || t === "bigquery" || t === "clickhouse" || t === "duckdb" ? `\`${e.replace(/`/g, "``")}\`` : t === "mssql" ? `[${e.replace(/]/g, "]]")}]` : `"${e.replace(/"/g, '""')}"`;
|
|
1080
|
+
}
|
|
1081
|
+
function $(e) {
|
|
1082
|
+
if (typeof e != "string")
|
|
1083
|
+
return "";
|
|
1084
|
+
const t = [];
|
|
1085
|
+
for (const i of e.trim().toLowerCase())
|
|
1086
|
+
yi(i) && t.push(i);
|
|
1087
|
+
return t.join("");
|
|
1088
|
+
}
|
|
1089
|
+
function yi(e) {
|
|
1090
|
+
const t = e.charCodeAt(0);
|
|
1091
|
+
return t >= 48 && t <= 57 || t >= 97 && t <= 122;
|
|
1092
|
+
}
|
|
1093
|
+
function on(e) {
|
|
1094
|
+
return typeof e == "object" && e !== null && e.mode === "last" && e.relativeTo === "latest_data";
|
|
1095
|
+
}
|
|
1096
|
+
function bi(e) {
|
|
1097
|
+
return e === "between" || e === "not between";
|
|
1098
|
+
}
|
|
1099
|
+
const B = a.enum(["day", "week", "month", "quarter", "year"]), vi = a.enum(["minute", "hour"]), Je = a.number().int().positive(), we = a.number().int(), We = a.object({
|
|
1100
|
+
mode: a.literal("last"),
|
|
1101
|
+
n: Je,
|
|
1102
|
+
unit: vi,
|
|
1103
|
+
complete: a.literal(!1).optional(),
|
|
1104
|
+
relativeTo: a.literal("latest_data").optional()
|
|
1105
|
+
}), et = a.object({
|
|
1106
|
+
mode: a.literal("last"),
|
|
1107
|
+
n: Je,
|
|
1108
|
+
unit: B,
|
|
1109
|
+
complete: a.boolean().optional(),
|
|
1110
|
+
relativeTo: a.literal("latest_data").optional()
|
|
1111
|
+
}), tt = a.object({
|
|
1112
|
+
mode: a.literal("this"),
|
|
1113
|
+
unit: B,
|
|
1114
|
+
toDate: a.boolean().optional(),
|
|
1115
|
+
boundary: a.enum(["first_day", "last_day"]).optional()
|
|
1116
|
+
}), it = a.object({ mode: a.literal("previous"), unit: B }), at = a.object({
|
|
1117
|
+
mode: a.literal("between"),
|
|
1118
|
+
unit: B,
|
|
1119
|
+
from: we,
|
|
1120
|
+
to: we
|
|
1121
|
+
}), W = {
|
|
1122
|
+
check: (e) => e.boundary === void 0 || e.unit === "month",
|
|
1123
|
+
message: 'A month boundary requires unit "month".'
|
|
1124
|
+
}, Ii = a.union([
|
|
1125
|
+
We.strict(),
|
|
1126
|
+
et.strict(),
|
|
1127
|
+
tt.strict().refine(W.check, {
|
|
1128
|
+
message: W.message,
|
|
1129
|
+
path: ["boundary"]
|
|
1130
|
+
}),
|
|
1131
|
+
it.strict(),
|
|
1132
|
+
at.strict()
|
|
1133
|
+
]), Si = a.union([
|
|
1134
|
+
We,
|
|
1135
|
+
et,
|
|
1136
|
+
tt.refine(W.check),
|
|
1137
|
+
it,
|
|
1138
|
+
at
|
|
1139
|
+
]);
|
|
1140
|
+
function ln(e) {
|
|
1141
|
+
const t = Si.safeParse(e);
|
|
1142
|
+
return t.success ? t.data : void 0;
|
|
1143
|
+
}
|
|
1144
|
+
const v = a.string().min(1), Ae = a.enum(["groupby", "metric", "sortby", "pivotby", "detail"]), nt = a.enum([
|
|
1145
|
+
"table",
|
|
1146
|
+
"view",
|
|
1147
|
+
"materialized view",
|
|
1148
|
+
"model",
|
|
1149
|
+
"file",
|
|
1150
|
+
"dataset",
|
|
1151
|
+
"url",
|
|
1152
|
+
"upload"
|
|
1153
|
+
]), z = a.object({
|
|
1154
|
+
connectionId: v,
|
|
1155
|
+
connectionType: a.enum(fe),
|
|
1156
|
+
type: nt,
|
|
1157
|
+
name: v,
|
|
1158
|
+
// Grounded relationship plans retain semantic identity and display metadata.
|
|
1159
|
+
// SQL stays server-resolved; it is not accepted inside a join entity.
|
|
1160
|
+
alias: a.string().optional(),
|
|
1161
|
+
id: v.optional(),
|
|
1162
|
+
domainId: v.optional(),
|
|
1163
|
+
datasetType: a.enum(["physical", "virtual"]).optional(),
|
|
1164
|
+
label: a.string().optional(),
|
|
1165
|
+
description: a.string().optional(),
|
|
1166
|
+
dbObjectType: a.string().optional(),
|
|
1167
|
+
database: a.string().optional(),
|
|
1168
|
+
schema: a.string().optional(),
|
|
1169
|
+
dialect: a.enum([
|
|
1170
|
+
"mysql",
|
|
1171
|
+
"postgres",
|
|
1172
|
+
"bigquery",
|
|
1173
|
+
"redshift",
|
|
1174
|
+
"snowflake",
|
|
1175
|
+
"clickhouse",
|
|
1176
|
+
"duckdb",
|
|
1177
|
+
"mssql"
|
|
1178
|
+
]).optional()
|
|
1179
|
+
}).strict(), q = a.lazy(
|
|
1180
|
+
() => a.object({
|
|
1181
|
+
id: v,
|
|
1182
|
+
name: v,
|
|
1183
|
+
label: a.string(),
|
|
1184
|
+
/** Set when `label` was synthesized from `name`; see `Field.derivedLabel`. */
|
|
1185
|
+
derivedLabel: a.string().optional(),
|
|
1186
|
+
qualifiedFieldName: v,
|
|
1187
|
+
dataType: v,
|
|
1188
|
+
entityId: v,
|
|
1189
|
+
entityName: v,
|
|
1190
|
+
entityType: nt,
|
|
1191
|
+
alias: a.string().optional(),
|
|
1192
|
+
sourceField: a.string().optional(),
|
|
1193
|
+
source: le.optional(),
|
|
1194
|
+
nativeDataType: a.string().optional(),
|
|
1195
|
+
description: a.string().optional(),
|
|
1196
|
+
qualifiedEntityName: a.string().optional(),
|
|
1197
|
+
dateFormat: a.enum(di).optional(),
|
|
1198
|
+
customFormat: a.string().optional(),
|
|
1199
|
+
granularity: X.optional(),
|
|
1200
|
+
role: Ae.optional(),
|
|
1201
|
+
calculationRepresentation: a.enum(["inline-expression", "manual", "typed-derived"]).optional(),
|
|
1202
|
+
calculatedFieldOrigin: a.object({ id: v, role: Ae.optional() }).strict().optional(),
|
|
1203
|
+
aggregateOrigin: a.enum(["default", "explicit"]).optional(),
|
|
1204
|
+
labelOrigin: a.enum(["semantic", "override"]).optional(),
|
|
1205
|
+
formatOrigin: a.enum(["semantic", "override"]).optional(),
|
|
1206
|
+
expression: a.string().optional(),
|
|
1207
|
+
derivedField: de.optional(),
|
|
1208
|
+
format: O.optional(),
|
|
1209
|
+
semanticTemporalPresentation: a.object({
|
|
1210
|
+
granularity: X,
|
|
1211
|
+
format: Ft
|
|
1212
|
+
}).strict().optional(),
|
|
1213
|
+
aggregate: je.optional(),
|
|
1214
|
+
fieldScope: a.enum(["card", "sheet", "dashboard", "domain"]).optional(),
|
|
1215
|
+
calculatedFormula: a.object({
|
|
1216
|
+
operation: a.enum([
|
|
1217
|
+
"sum",
|
|
1218
|
+
"difference",
|
|
1219
|
+
"product",
|
|
1220
|
+
"ratio",
|
|
1221
|
+
"change",
|
|
1222
|
+
"percentage",
|
|
1223
|
+
"scale",
|
|
1224
|
+
"custom"
|
|
1225
|
+
]),
|
|
1226
|
+
inputFields: a.array(q),
|
|
1227
|
+
constant: a.number().finite().optional(),
|
|
1228
|
+
computeStage: a.enum(["row", "aggregate"]).optional()
|
|
1229
|
+
}).strict().optional()
|
|
1230
|
+
}).strict()
|
|
1231
|
+
), ki = a.union([
|
|
1232
|
+
a.string(),
|
|
1233
|
+
a.number().finite(),
|
|
1234
|
+
a.boolean(),
|
|
1235
|
+
a.date(),
|
|
1236
|
+
a.null()
|
|
1237
|
+
]), wi = a.object({
|
|
1238
|
+
id: v,
|
|
1239
|
+
field: q,
|
|
1240
|
+
operator: a.enum([
|
|
1241
|
+
"=",
|
|
1242
|
+
"!=",
|
|
1243
|
+
">",
|
|
1244
|
+
">=",
|
|
1245
|
+
"<",
|
|
1246
|
+
"<=",
|
|
1247
|
+
"contains",
|
|
1248
|
+
"startsWith",
|
|
1249
|
+
"endsWith",
|
|
1250
|
+
"like",
|
|
1251
|
+
"not like",
|
|
1252
|
+
"in",
|
|
1253
|
+
"not in",
|
|
1254
|
+
"between",
|
|
1255
|
+
"not between",
|
|
1256
|
+
"isNull",
|
|
1257
|
+
"isNotNull"
|
|
1258
|
+
]),
|
|
1259
|
+
value: a.union([ki, a.array(a.string()), a.array(a.number().finite())]),
|
|
1260
|
+
label: a.string().optional(),
|
|
1261
|
+
temporalBucket: Dt.optional(),
|
|
1262
|
+
relativeMeta: Ii.optional(),
|
|
1263
|
+
latestValue: a.literal(!0).optional(),
|
|
1264
|
+
latestValuePolicy: a.literal("snapshot").optional()
|
|
1265
|
+
}).strict().superRefine((e, t) => {
|
|
1266
|
+
const { operator: i, value: s } = e;
|
|
1267
|
+
if ((i === "between" || i === "not between") && (!Array.isArray(s) || s.length !== 2) && t.addIssue({
|
|
1268
|
+
code: "custom",
|
|
1269
|
+
path: ["value"],
|
|
1270
|
+
message: "Between requires two endpoints."
|
|
1271
|
+
}), e.relativeMeta && !bi(i) && t.addIssue({
|
|
1272
|
+
code: "custom",
|
|
1273
|
+
path: ["relativeMeta"],
|
|
1274
|
+
message: "A relative date requires between or not between."
|
|
1275
|
+
}), e.latestValue) {
|
|
1276
|
+
const n = [e.field.nativeDataType, e.field.dataType].map((o) => ce(o)).some((o) => o === "date" || o === "datetime");
|
|
1277
|
+
(i !== "=" || !n) && t.addIssue({
|
|
1278
|
+
code: "custom",
|
|
1279
|
+
path: ["latestValue"],
|
|
1280
|
+
message: "Latest value requires = on a date or timestamp field."
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
(i === "in" || i === "not in") && !Array.isArray(s) && t.addIssue({
|
|
1284
|
+
code: "custom",
|
|
1285
|
+
path: ["value"],
|
|
1286
|
+
message: "Membership requires an array."
|
|
1287
|
+
});
|
|
1288
|
+
}), st = a.lazy(
|
|
1289
|
+
() => a.object({
|
|
1290
|
+
id: v,
|
|
1291
|
+
logicalOperator: a.enum(["AND", "OR"]),
|
|
1292
|
+
negate: a.boolean(),
|
|
1293
|
+
conditions: a.array(wi),
|
|
1294
|
+
groups: a.array(st)
|
|
1295
|
+
}).strict()
|
|
1296
|
+
), Ai = a.object({
|
|
1297
|
+
baseEntity: z,
|
|
1298
|
+
joins: a.array(
|
|
1299
|
+
a.object({
|
|
1300
|
+
id: v,
|
|
1301
|
+
source: z,
|
|
1302
|
+
target: z,
|
|
1303
|
+
joinType: a.enum(["INNER", "LEFT", "RIGHT", "FULL"]),
|
|
1304
|
+
sequence: a.number().int().nonnegative(),
|
|
1305
|
+
autoResolved: a.boolean().optional(),
|
|
1306
|
+
relationshipId: a.string().optional(),
|
|
1307
|
+
relationshipName: a.string().optional(),
|
|
1308
|
+
relationshipCardinality: a.enum(["one_to_one", "one_to_many", "many_to_one", "many_to_many"]).optional(),
|
|
1309
|
+
relationshipTraversalDirection: a.enum(["forward", "reverse"]).optional(),
|
|
1310
|
+
joinKeyGroups: a.array(
|
|
1311
|
+
a.object({
|
|
1312
|
+
id: v,
|
|
1313
|
+
operator: a.enum(["AND", "OR"]),
|
|
1314
|
+
keys: a.array(
|
|
1315
|
+
a.object({
|
|
1316
|
+
id: a.string().optional(),
|
|
1317
|
+
source: q,
|
|
1318
|
+
target: q,
|
|
1319
|
+
operator: a.enum(["=", "!=", ">", ">=", "<", "<="])
|
|
1320
|
+
}).strict()
|
|
1321
|
+
).min(1)
|
|
1322
|
+
}).strict()
|
|
1323
|
+
).min(1)
|
|
1324
|
+
}).strict()
|
|
1325
|
+
)
|
|
1326
|
+
}).strict(), b = a.string().uuid(), xi = a.string().min(1), Fi = a.number().int().positive().max(Number.MAX_SAFE_INTEGER), Di = a.enum([
|
|
1327
|
+
"SUM",
|
|
1328
|
+
"COUNT",
|
|
1329
|
+
"DISTINCT",
|
|
1330
|
+
"AVG",
|
|
1331
|
+
"MIN",
|
|
1332
|
+
"MAX",
|
|
1333
|
+
"MEDIAN"
|
|
1334
|
+
]), rt = Qt.omit({
|
|
1335
|
+
aggregate: !0
|
|
1336
|
+
}), Mi = {
|
|
1337
|
+
id: b,
|
|
1338
|
+
field: rt,
|
|
1339
|
+
grain: X.optional()
|
|
1340
|
+
}, ee = a.object(Mi).strict(), Ei = a.object({
|
|
1341
|
+
id: b,
|
|
1342
|
+
kind: a.literal("aggregate"),
|
|
1343
|
+
field: rt,
|
|
1344
|
+
aggregate: Di
|
|
1345
|
+
}).strict(), Ti = a.object({
|
|
1346
|
+
id: b,
|
|
1347
|
+
kind: a.literal("calculated"),
|
|
1348
|
+
definition: de
|
|
1349
|
+
}).strict(), ot = a.discriminatedUnion("kind", [Ei, Ti]), Ni = a.discriminatedUnion("kind", [
|
|
1350
|
+
a.object({ kind: a.literal("member") }).strict(),
|
|
1351
|
+
a.object({
|
|
1352
|
+
kind: a.literal("measure"),
|
|
1353
|
+
measureId: b,
|
|
1354
|
+
oppositePath: A
|
|
1355
|
+
}).strict()
|
|
1356
|
+
]), Ri = {
|
|
1357
|
+
axis: me,
|
|
1358
|
+
levelId: b,
|
|
1359
|
+
scope: a.discriminatedUnion("kind", [
|
|
1360
|
+
a.object({ kind: a.literal("level") }).strict(),
|
|
1361
|
+
a.object({ kind: a.literal("branch"), parent: A }).strict()
|
|
1362
|
+
]),
|
|
1363
|
+
target: Ni,
|
|
1364
|
+
direction: a.enum(["asc", "desc"]),
|
|
1365
|
+
nulls: a.enum(["first", "last"])
|
|
1366
|
+
}, lt = a.object(Ri).strict(), $i = a.object({
|
|
1367
|
+
id: b,
|
|
1368
|
+
axis: me,
|
|
1369
|
+
levelId: b,
|
|
1370
|
+
direction: a.enum(["top", "bottom"]),
|
|
1371
|
+
count: Fi,
|
|
1372
|
+
measureId: b,
|
|
1373
|
+
oppositePath: A,
|
|
1374
|
+
others: a.boolean()
|
|
1375
|
+
}).strict(), G = a.number().finite(), Ci = a.object({
|
|
1376
|
+
id: b,
|
|
1377
|
+
axis: me,
|
|
1378
|
+
levelId: b,
|
|
1379
|
+
measureId: b,
|
|
1380
|
+
operator: a.enum(["=", "!=", ">", ">=", "<", "<=", "between", "not between"]),
|
|
1381
|
+
value: a.union([
|
|
1382
|
+
G,
|
|
1383
|
+
a.tuple([G, G]).readonly()
|
|
1384
|
+
])
|
|
1385
|
+
}).strict().superRefine((e, t) => {
|
|
1386
|
+
const i = e.operator === "between" || e.operator === "not between";
|
|
1387
|
+
i !== Array.isArray(e.value) ? h(t, ["value"], i ? "A range condition needs a low and a high bound." : "A comparison needs one number.") : i && e.value[0] > e.value[1] && h(t, ["value"], "The low bound must not exceed the high bound.");
|
|
1388
|
+
}), dt = a.object({
|
|
1389
|
+
source: le,
|
|
1390
|
+
rows: a.array(ee).min(1).readonly(),
|
|
1391
|
+
columns: a.array(ee).readonly(),
|
|
1392
|
+
measures: a.array(ot).min(1).readonly(),
|
|
1393
|
+
filters: st.optional(),
|
|
1394
|
+
joinPlan: Ai.optional(),
|
|
1395
|
+
relationshipHint: a.object({ relationshipIds: a.array(xi).optional() }).strict().optional(),
|
|
1396
|
+
sorts: a.array(lt).readonly(),
|
|
1397
|
+
rankings: a.array($i).readonly(),
|
|
1398
|
+
measureFilters: a.array(Ci).readonly().optional()
|
|
1399
|
+
}).strict();
|
|
1400
|
+
function ut(e) {
|
|
1401
|
+
return JSON.stringify([
|
|
1402
|
+
e.axis,
|
|
1403
|
+
e.levelId,
|
|
1404
|
+
e.scope.kind,
|
|
1405
|
+
e.scope.kind === "branch" ? Qe(e.scope.parent) : null
|
|
1406
|
+
]);
|
|
1407
|
+
}
|
|
1408
|
+
function h(e, t, i) {
|
|
1409
|
+
e.addIssue({ code: "custom", path: t, message: i });
|
|
1410
|
+
}
|
|
1411
|
+
function w(e, t, i) {
|
|
1412
|
+
new Set(e).size !== e.length && h(t, i, "Duplicate identity.");
|
|
1413
|
+
}
|
|
1414
|
+
function L(e, t, i, s, l, n = !1) {
|
|
1415
|
+
i.length > e[t].length && h(s, l, "Path exceeds axis depth."), i.forEach((o, d) => {
|
|
1416
|
+
var p;
|
|
1417
|
+
if (o.levelId !== ((p = e[t][d]) == null ? void 0 : p.id) && h(s, [...l, d], "Path must be an ordered axis prefix."), o.member.kind === "others") {
|
|
1418
|
+
const m = o.member.rankingId;
|
|
1419
|
+
(n || d !== i.length - 1 || !e.rankings.some(
|
|
1420
|
+
(u) => u.id === m && u.others && u.axis === t && u.levelId === o.levelId
|
|
1421
|
+
)) && h(
|
|
1422
|
+
s,
|
|
1423
|
+
[...l, d],
|
|
1424
|
+
"Others must terminate a path at its enabled ranking and cannot be a sort/rank target."
|
|
1425
|
+
);
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
function ct(e, t, i, s) {
|
|
1430
|
+
w(t.map(ut), i, s), t.forEach((l, n) => {
|
|
1431
|
+
const o = [...s, n], d = e[l.axis].findIndex((p) => p.id === l.levelId);
|
|
1432
|
+
if (d < 0 && h(i, o, "Sort level is not on its axis."), l.scope.kind === "branch" && (L(
|
|
1433
|
+
e,
|
|
1434
|
+
l.axis,
|
|
1435
|
+
l.scope.parent,
|
|
1436
|
+
i,
|
|
1437
|
+
[...o, "scope", "parent"],
|
|
1438
|
+
!0
|
|
1439
|
+
), l.scope.parent.length !== d && h(
|
|
1440
|
+
i,
|
|
1441
|
+
o,
|
|
1442
|
+
"Branch sort must name the immediate parent of its level."
|
|
1443
|
+
)), l.target.kind === "measure") {
|
|
1444
|
+
const p = l.target.measureId;
|
|
1445
|
+
e.measures.some((m) => m.id === p) || h(i, o, "Unknown sort measure."), L(
|
|
1446
|
+
e,
|
|
1447
|
+
l.axis === "rows" ? "columns" : "rows",
|
|
1448
|
+
l.target.oppositePath,
|
|
1449
|
+
i,
|
|
1450
|
+
[...o, "target", "oppositePath"],
|
|
1451
|
+
!0
|
|
1452
|
+
);
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
function Y(e, t, i, s) {
|
|
1457
|
+
e && (e.kind !== t.kind || e.kind === "semantic" && t.kind === "semantic" && e.domainId !== t.domainId || e.kind === "physical" && t.kind === "physical" && e.connectionId !== t.connectionId) && h(
|
|
1458
|
+
i,
|
|
1459
|
+
s,
|
|
1460
|
+
"Field source must belong to the same semantic domain or physical connection."
|
|
1461
|
+
);
|
|
1462
|
+
}
|
|
1463
|
+
function Q(e, t, i) {
|
|
1464
|
+
(e.aggregationBehavior === "snapshot" || e.aggregationBehavior === "weighted" || e.aggregationStrategy === "weighted") && h(t, i, "This measure semantic requires a later capability.");
|
|
1465
|
+
}
|
|
1466
|
+
function pt(e, t) {
|
|
1467
|
+
w(
|
|
1468
|
+
[...e.rows, ...e.columns, ...e.measures].map((n) => n.id),
|
|
1469
|
+
t,
|
|
1470
|
+
[]
|
|
1471
|
+
), w(
|
|
1472
|
+
e.rankings.map((n) => n.id),
|
|
1473
|
+
t,
|
|
1474
|
+
["rankings"]
|
|
1475
|
+
), w(
|
|
1476
|
+
e.rankings.map((n) => JSON.stringify([n.axis, n.levelId])),
|
|
1477
|
+
t,
|
|
1478
|
+
["rankings"]
|
|
1479
|
+
);
|
|
1480
|
+
for (const n of ["rows", "columns"])
|
|
1481
|
+
e[n].forEach((o, d) => {
|
|
1482
|
+
o.grain && o.field.dataType !== void 0 && !["date", "datetime", "unknown"].includes(o.field.dataType) && h(t, [n, d, "grain"], "Grain requires a temporal field.");
|
|
1483
|
+
});
|
|
1484
|
+
const i = [
|
|
1485
|
+
...e.rows,
|
|
1486
|
+
...e.columns,
|
|
1487
|
+
...e.measures.filter((n) => n.kind === "aggregate")
|
|
1488
|
+
];
|
|
1489
|
+
for (const n of i)
|
|
1490
|
+
if (Y(n.field.source, e.source, t, [
|
|
1491
|
+
n.id,
|
|
1492
|
+
"field",
|
|
1493
|
+
"source"
|
|
1494
|
+
]), n.field.derivedField) {
|
|
1495
|
+
n.field.derivedField.computeStage !== "row" && h(
|
|
1496
|
+
t,
|
|
1497
|
+
[n.id],
|
|
1498
|
+
"Aggregate-stage calculations cannot be grouped or wrapped in an aggregate."
|
|
1499
|
+
), Q(n.field.derivedField, t, [n.id]);
|
|
1500
|
+
for (const o of Object.values(n.field.derivedField.inputs))
|
|
1501
|
+
Y(o.field.source, e.source, t, [n.id, "inputs"]);
|
|
1502
|
+
}
|
|
1503
|
+
for (const n of e.measures)
|
|
1504
|
+
if (n.kind === "calculated") {
|
|
1505
|
+
(n.definition.computeStage !== "aggregate" || n.definition.resultRole !== "measure") && h(
|
|
1506
|
+
t,
|
|
1507
|
+
[n.id],
|
|
1508
|
+
"Calculated measures require aggregate stage and measure role."
|
|
1509
|
+
), Q(n.definition, t, [n.id]);
|
|
1510
|
+
for (const o of Object.values(n.definition.inputs))
|
|
1511
|
+
Y(o.field.source, e.source, t, [
|
|
1512
|
+
n.id,
|
|
1513
|
+
"inputs"
|
|
1514
|
+
]);
|
|
1515
|
+
}
|
|
1516
|
+
const s = (n) => {
|
|
1517
|
+
const o = (d, p) => {
|
|
1518
|
+
var m, u;
|
|
1519
|
+
if ((d.aggregate || ((m = d.derivedField) == null ? void 0 : m.computeStage) === "aggregate") && h(t, p, "Aggregate/HAVING filters are not supported."), d.derivedField) {
|
|
1520
|
+
Q(d.derivedField, t, p);
|
|
1521
|
+
for (const g of Object.values(d.derivedField.inputs))
|
|
1522
|
+
Y(g.field.source, e.source, t, p);
|
|
1523
|
+
}
|
|
1524
|
+
for (const g of ((u = d.calculatedFormula) == null ? void 0 : u.inputFields) ?? [])
|
|
1525
|
+
o(g, p);
|
|
1526
|
+
};
|
|
1527
|
+
for (const d of n.conditions)
|
|
1528
|
+
o(d.field, ["filters", d.id]);
|
|
1529
|
+
n.groups.forEach(s);
|
|
1530
|
+
};
|
|
1531
|
+
if (e.filters && s(e.filters), e.joinPlan) {
|
|
1532
|
+
const n = [
|
|
1533
|
+
e.joinPlan.baseEntity,
|
|
1534
|
+
...e.joinPlan.joins.flatMap((o) => [o.source, o.target])
|
|
1535
|
+
];
|
|
1536
|
+
(new Set(n.map((o) => o.connectionId)).size > 1 || e.source.kind === "physical" && n[0].connectionId !== e.source.connectionId) && h(t, ["joinPlan"], "Joins must stay within the source connection."), w(
|
|
1537
|
+
e.joinPlan.joins.map((o) => o.id),
|
|
1538
|
+
t,
|
|
1539
|
+
["joinPlan", "joins"]
|
|
1540
|
+
);
|
|
1541
|
+
}
|
|
1542
|
+
ct(e, e.sorts, t, ["sorts"]);
|
|
1543
|
+
const l = e.measureFilters ?? [];
|
|
1544
|
+
w(l.map((n) => n.id), t, ["measureFilters"]), w(
|
|
1545
|
+
l.map((n) => JSON.stringify([n.axis, n.levelId])),
|
|
1546
|
+
t,
|
|
1547
|
+
["measureFilters"]
|
|
1548
|
+
), l.forEach((n, o) => {
|
|
1549
|
+
(!e[n.axis].some((d) => d.id === n.levelId) || !e.measures.some((d) => d.id === n.measureId)) && h(t, ["measureFilters", o], "Unknown measure filter level or measure.");
|
|
1550
|
+
}), e.rankings.forEach((n, o) => {
|
|
1551
|
+
(!e[n.axis].some((d) => d.id === n.levelId) || !e.measures.some((d) => d.id === n.measureId)) && h(t, ["rankings", o], "Unknown ranking level or measure."), L(
|
|
1552
|
+
e,
|
|
1553
|
+
n.axis === "rows" ? "columns" : "rows",
|
|
1554
|
+
n.oppositePath,
|
|
1555
|
+
t,
|
|
1556
|
+
["rankings", o, "oppositePath"],
|
|
1557
|
+
!0
|
|
1558
|
+
);
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
const j = dt.superRefine(pt), ji = dt.extend({
|
|
1562
|
+
rows: a.array(ee).readonly(),
|
|
1563
|
+
measures: a.array(ot).readonly()
|
|
1564
|
+
}), Yi = ji.superRefine(pt), Oi = j.innerType().extend({ kind: a.literal("matrix") }), Pi = Oi.superRefine(({ kind: e, ...t }, i) => {
|
|
1565
|
+
const s = j.safeParse(t);
|
|
1566
|
+
s.success || s.error.issues.forEach((l) => i.addIssue(l));
|
|
1567
|
+
}), qi = "{member}", xe = a.object({
|
|
1568
|
+
visible: a.boolean(),
|
|
1569
|
+
position: a.enum(["before", "after"]),
|
|
1570
|
+
/** As written; a subtotal's `{member}` becomes its member's name. */
|
|
1571
|
+
label: a.string().optional()
|
|
1572
|
+
}).strict(), Fe = a.object({
|
|
1573
|
+
grand: xe,
|
|
1574
|
+
levels: a.record(b, xe).readonly(),
|
|
1575
|
+
/**
|
|
1576
|
+
* Skip a subtotal that only repeats one row: an expanded group with
|
|
1577
|
+
* exactly one child shows no subtotal. Off when absent.
|
|
1578
|
+
*/
|
|
1579
|
+
skipRedundant: a.boolean().optional()
|
|
1580
|
+
}).strict(), Li = {
|
|
1581
|
+
layout: a.discriminatedUnion("kind", [
|
|
1582
|
+
a.object({ kind: a.literal("compact") }).strict(),
|
|
1583
|
+
a.object({ kind: a.literal("tabular"), repeatLabels: a.boolean() }).strict()
|
|
1584
|
+
]),
|
|
1585
|
+
absence: a.object({ emptyText: a.string(), nullText: a.string() }).strict(),
|
|
1586
|
+
levelLabels: a.record(b, a.string()).readonly(),
|
|
1587
|
+
measureLabels: a.record(b, a.string()).readonly(),
|
|
1588
|
+
levelFormats: a.record(b, O).readonly(),
|
|
1589
|
+
measureFormats: a.record(b, O).readonly(),
|
|
1590
|
+
totals: a.object({ rows: Fe, columns: Fe }).strict()
|
|
1591
|
+
}, ge = a.object(Li).strict(), Bi = a.object({
|
|
1592
|
+
depth: a.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
1593
|
+
overrides: a.array(
|
|
1594
|
+
a.object({ path: A, expanded: a.boolean() }).strict()
|
|
1595
|
+
).readonly()
|
|
1596
|
+
}).strict(), De = Bi.superRefine(
|
|
1597
|
+
(e, t) => w(
|
|
1598
|
+
e.overrides.map((i) => Qe(i.path)),
|
|
1599
|
+
t,
|
|
1600
|
+
["overrides"]
|
|
1601
|
+
)
|
|
1602
|
+
), Hi = { rows: De, columns: De }, H = a.object(Hi).strict(), Vi = H.extend({ sorts: a.array(lt).readonly() }).strict(), Ui = Vi.superRefine(
|
|
1603
|
+
(e, t) => w(e.sorts.map(ut), t, ["sorts"])
|
|
1604
|
+
);
|
|
1605
|
+
function V(e, t) {
|
|
1606
|
+
var p, m;
|
|
1607
|
+
const { spec: i, presentation: s, defaults: l, session: n } = e, o = new Set([...i.rows, ...i.columns].map((u) => u.id)), d = new Set(i.measures.map((u) => u.id));
|
|
1608
|
+
for (const u of [
|
|
1609
|
+
"levelLabels",
|
|
1610
|
+
"levelFormats",
|
|
1611
|
+
"measureLabels",
|
|
1612
|
+
"measureFormats"
|
|
1613
|
+
]) {
|
|
1614
|
+
const g = u.startsWith("level") ? o : d;
|
|
1615
|
+
for (const y of Object.keys(s[u]))
|
|
1616
|
+
g.has(y) || h(
|
|
1617
|
+
t,
|
|
1618
|
+
["presentation", u, y],
|
|
1619
|
+
"Unknown presentation reference."
|
|
1620
|
+
);
|
|
1621
|
+
}
|
|
1622
|
+
for (const [u, g] of Object.entries(s.measureFormats))
|
|
1623
|
+
g.type === "temporal_bucket" && h(
|
|
1624
|
+
t,
|
|
1625
|
+
["presentation", "measureFormats", u],
|
|
1626
|
+
"Measures cannot own temporal bucket formats."
|
|
1627
|
+
);
|
|
1628
|
+
for (const [u, g] of Object.entries(s.levelFormats))
|
|
1629
|
+
g.type === "temporal_bucket" && !((p = [...i.rows, ...i.columns].find((y) => y.id === u)) != null && p.grain) && h(
|
|
1630
|
+
t,
|
|
1631
|
+
["presentation", "levelFormats", u],
|
|
1632
|
+
"Temporal bucket formats require a grain."
|
|
1633
|
+
);
|
|
1634
|
+
for (const u of ["rows", "columns"]) {
|
|
1635
|
+
(m = s.totals[u].grand.label) != null && m.includes(
|
|
1636
|
+
qi
|
|
1637
|
+
) && h(
|
|
1638
|
+
t,
|
|
1639
|
+
["presentation", "totals", u, "grand", "label"],
|
|
1640
|
+
"The grand total has no member, so its label cannot use {member}."
|
|
1641
|
+
);
|
|
1642
|
+
const g = Object.keys(s.totals[u].levels);
|
|
1643
|
+
(g.length !== i[u].length || g.some((y) => !i[u].some((I) => I.id === y))) && h(
|
|
1644
|
+
t,
|
|
1645
|
+
["presentation", "totals", u],
|
|
1646
|
+
"Subtotal map must contain exactly the current axis levels."
|
|
1647
|
+
);
|
|
1648
|
+
for (const y of [l, ...n ? [n] : []])
|
|
1649
|
+
for (const I of y[u].overrides)
|
|
1650
|
+
L(
|
|
1651
|
+
i,
|
|
1652
|
+
u,
|
|
1653
|
+
I.path,
|
|
1654
|
+
t,
|
|
1655
|
+
[u, "overrides"],
|
|
1656
|
+
!0
|
|
1657
|
+
), I.path.length || h(
|
|
1658
|
+
t,
|
|
1659
|
+
[u, "overrides"],
|
|
1660
|
+
"Use depth to expand/collapse the root."
|
|
1661
|
+
);
|
|
1662
|
+
}
|
|
1663
|
+
n && ct(i, n.sorts, t, ["session", "sorts"]);
|
|
1664
|
+
}
|
|
1665
|
+
const zi = a.object({
|
|
1666
|
+
spec: j,
|
|
1667
|
+
presentation: ge,
|
|
1668
|
+
defaults: H,
|
|
1669
|
+
session: Ui.optional()
|
|
1670
|
+
}).strict(), dn = zi.superRefine(V), Gi = a.object({
|
|
1671
|
+
version: a.literal(1),
|
|
1672
|
+
spec: j,
|
|
1673
|
+
presentation: ge,
|
|
1674
|
+
defaultView: H
|
|
1675
|
+
}).strict(), Qi = Gi.superRefine(
|
|
1676
|
+
(e, t) => V({ ...e, defaults: e.defaultView }, t)
|
|
1677
|
+
), Ki = Qi.innerType().extend({
|
|
1678
|
+
spec: Yi
|
|
1679
|
+
}), un = Ki.superRefine((e, t) => V({ ...e, defaults: e.defaultView }, t)), Me = a.object({ spec: j, presentation: ge }).strict(), Xi = a.union([
|
|
1680
|
+
Me.extend({
|
|
1681
|
+
mode: a.literal("layout"),
|
|
1682
|
+
format: a.enum(["csv", "xlsx", "pdf"]),
|
|
1683
|
+
expansion: a.union([
|
|
1684
|
+
H.extend({ kind: a.literal("current") }).strict(),
|
|
1685
|
+
a.object({ kind: a.literal("all") }).strict()
|
|
1686
|
+
])
|
|
1687
|
+
}).strict(),
|
|
1688
|
+
Me.extend({ mode: a.literal("flat"), format: a.enum(["csv", "xlsx"]) }).strict()
|
|
1689
|
+
]), cn = Xi.superRefine(
|
|
1690
|
+
(e, t) => V(
|
|
1691
|
+
{
|
|
1692
|
+
...e,
|
|
1693
|
+
defaults: e.mode === "layout" && e.expansion.kind === "current" ? e.expansion : {
|
|
1694
|
+
rows: { depth: 0, overrides: [] },
|
|
1695
|
+
columns: { depth: 0, overrides: [] }
|
|
1696
|
+
}
|
|
1697
|
+
},
|
|
1698
|
+
t
|
|
1699
|
+
)
|
|
1700
|
+
);
|
|
1701
|
+
function pn(e) {
|
|
1702
|
+
return e && "id" in e ? e.id : void 0;
|
|
1703
|
+
}
|
|
1704
|
+
const Zi = "SUM";
|
|
1705
|
+
function k(e) {
|
|
1706
|
+
return typeof e == "string" && e.trim().length > 0;
|
|
1707
|
+
}
|
|
1708
|
+
function T(e) {
|
|
1709
|
+
return k(e) ? e.trim().toLowerCase() : "";
|
|
1710
|
+
}
|
|
1711
|
+
function mn(e) {
|
|
1712
|
+
const t = k(e.id) ? e.id.trim() : void 0;
|
|
1713
|
+
if (!t) return;
|
|
1714
|
+
const i = T(t), s = k(e.table) ? e.table.trim() : void 0;
|
|
1715
|
+
if (!(i === T(e.name) || s && i === T(s)))
|
|
1716
|
+
return t;
|
|
1717
|
+
}
|
|
1718
|
+
function F(e) {
|
|
1719
|
+
const t = k(e.datasetId) ? e.datasetId.trim() : void 0;
|
|
1720
|
+
if (t)
|
|
1721
|
+
return T(t) === T(e.datasetName) ? void 0 : t;
|
|
1722
|
+
}
|
|
1723
|
+
function mt(e) {
|
|
1724
|
+
if (e.kind !== "semantic") return e;
|
|
1725
|
+
const t = F(e), { datasetId: i, ...s } = e;
|
|
1726
|
+
return {
|
|
1727
|
+
...s,
|
|
1728
|
+
...t ? { datasetId: t } : {}
|
|
1729
|
+
};
|
|
1730
|
+
}
|
|
1731
|
+
function fn(e) {
|
|
1732
|
+
return e ? e.kind === "semantic" ? !!(k(e.domainId) && (k(e.datasetId) || k(e.datasetName))) : e.kind === "physical" ? k(e.connectionId) && k(e.tableName) : k(e.connectionId) : !1;
|
|
1733
|
+
}
|
|
1734
|
+
function te(e) {
|
|
1735
|
+
if (!e)
|
|
1736
|
+
return "";
|
|
1737
|
+
if (e.kind === "semantic") {
|
|
1738
|
+
const t = F(e);
|
|
1739
|
+
return [
|
|
1740
|
+
e.kind,
|
|
1741
|
+
e.domainId,
|
|
1742
|
+
t ? `datasetId:${t}` : `datasetName:${e.datasetName}`
|
|
1743
|
+
].join(":");
|
|
1744
|
+
}
|
|
1745
|
+
return e.kind === "physical" ? [
|
|
1746
|
+
e.kind,
|
|
1747
|
+
e.connectionId,
|
|
1748
|
+
e.databaseName || "",
|
|
1749
|
+
e.schemaName || "",
|
|
1750
|
+
e.tableName
|
|
1751
|
+
].join(":") : [
|
|
1752
|
+
e.kind,
|
|
1753
|
+
e.connectionId,
|
|
1754
|
+
e.dialect || "",
|
|
1755
|
+
e.label || ""
|
|
1756
|
+
].join(":");
|
|
1757
|
+
}
|
|
1758
|
+
function he(e, t) {
|
|
1759
|
+
if (!e || !t)
|
|
1760
|
+
return e === t;
|
|
1761
|
+
if (e.kind !== t.kind)
|
|
1762
|
+
return !1;
|
|
1763
|
+
if (e.kind === "semantic" && t.kind === "semantic") {
|
|
1764
|
+
if (e.domainId !== t.domainId)
|
|
1765
|
+
return !1;
|
|
1766
|
+
const i = F(e), s = F(t);
|
|
1767
|
+
return i && s ? i === s : e.datasetName === t.datasetName;
|
|
1768
|
+
}
|
|
1769
|
+
return te(e) === te(t);
|
|
1770
|
+
}
|
|
1771
|
+
function ft(e, t) {
|
|
1772
|
+
return e.kind !== "semantic" || t.kind !== "semantic" ? e : mt({
|
|
1773
|
+
...e,
|
|
1774
|
+
datasetName: e.datasetName || t.datasetName,
|
|
1775
|
+
datasetId: F(e) || F(t),
|
|
1776
|
+
label: e.label || t.label,
|
|
1777
|
+
connectionId: e.connectionId || t.connectionId
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
function gn(e) {
|
|
1781
|
+
const t = [];
|
|
1782
|
+
for (const i of e) {
|
|
1783
|
+
const s = mt(
|
|
1784
|
+
i
|
|
1785
|
+
), l = t.findIndex(
|
|
1786
|
+
(n) => he(n, s)
|
|
1787
|
+
);
|
|
1788
|
+
if (l === -1) {
|
|
1789
|
+
t.push(s);
|
|
1790
|
+
continue;
|
|
1791
|
+
}
|
|
1792
|
+
t[l] = ft(
|
|
1793
|
+
t[l],
|
|
1794
|
+
s
|
|
1795
|
+
);
|
|
1796
|
+
}
|
|
1797
|
+
return t;
|
|
1798
|
+
}
|
|
1799
|
+
function Ji(e, t) {
|
|
1800
|
+
return e.name === t.name && he(e.source, t.source);
|
|
1801
|
+
}
|
|
1802
|
+
function hn(e) {
|
|
1803
|
+
return [
|
|
1804
|
+
e.source ? te(e.source) : "unknown",
|
|
1805
|
+
gt(e),
|
|
1806
|
+
e.name
|
|
1807
|
+
].filter(Boolean).join(":");
|
|
1808
|
+
}
|
|
1809
|
+
function gt(e) {
|
|
1810
|
+
return Wi(
|
|
1811
|
+
e.aggregate || Zi
|
|
1812
|
+
);
|
|
1813
|
+
}
|
|
1814
|
+
function Wi(e) {
|
|
1815
|
+
return e.trim().toUpperCase();
|
|
1816
|
+
}
|
|
1817
|
+
function _n(e, t) {
|
|
1818
|
+
return {
|
|
1819
|
+
...e,
|
|
1820
|
+
label: e.label || t.label,
|
|
1821
|
+
role: e.role || t.role,
|
|
1822
|
+
dataType: e.dataType || t.dataType,
|
|
1823
|
+
source: e.source && t.source ? ft(e.source, t.source) : e.source || t.source
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
function ea(e) {
|
|
1827
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
1828
|
+
const i = e[t];
|
|
1829
|
+
if (e.some(
|
|
1830
|
+
(s, l) => l !== t && _t(s, i)
|
|
1831
|
+
))
|
|
1832
|
+
return !1;
|
|
1833
|
+
}
|
|
1834
|
+
return !0;
|
|
1835
|
+
}
|
|
1836
|
+
function ht(e, t) {
|
|
1837
|
+
return Ji(e, t);
|
|
1838
|
+
}
|
|
1839
|
+
function _t(e, t) {
|
|
1840
|
+
return ht(e, t) && C(e) === C(t);
|
|
1841
|
+
}
|
|
1842
|
+
function ta(e) {
|
|
1843
|
+
return `Metric intent has duplicate measure "${e.name}" with the same aggregate (${C(e)}). Use different aggregates to request both, or remove one entry.`;
|
|
1844
|
+
}
|
|
1845
|
+
function Ee(e) {
|
|
1846
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
1847
|
+
}
|
|
1848
|
+
function ia(e, t, i) {
|
|
1849
|
+
if (e !== void 0) {
|
|
1850
|
+
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
1851
|
+
i.push(
|
|
1852
|
+
r(
|
|
1853
|
+
"invalid_sql_default_parameters",
|
|
1854
|
+
"SQL defaultParameters must be an object keyed by parameter name.",
|
|
1855
|
+
t
|
|
1856
|
+
)
|
|
1857
|
+
);
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
Object.entries(e).forEach(([s, l]) => {
|
|
1861
|
+
if (!s.trim()) {
|
|
1862
|
+
i.push(
|
|
1863
|
+
r(
|
|
1864
|
+
"invalid_sql_default_parameter_name",
|
|
1865
|
+
"SQL defaultParameters names must be non-empty strings.",
|
|
1866
|
+
`${t}.${s}`
|
|
1867
|
+
)
|
|
1868
|
+
);
|
|
1869
|
+
return;
|
|
1870
|
+
}
|
|
1871
|
+
(Array.isArray(l) ? l.every(Ee) : Ee(l)) || i.push(
|
|
1872
|
+
r(
|
|
1873
|
+
"invalid_sql_default_parameter_value",
|
|
1874
|
+
"SQL defaultParameters values must be strings, numbers, booleans, nulls, or arrays of those scalar values.",
|
|
1875
|
+
`${t}.${s}`
|
|
1876
|
+
)
|
|
1877
|
+
);
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
function aa(e, t) {
|
|
1882
|
+
return _e(e, t).length === 1;
|
|
1883
|
+
}
|
|
1884
|
+
function na(e, t) {
|
|
1885
|
+
return _e(e, t).length === 1;
|
|
1886
|
+
}
|
|
1887
|
+
function _e(e, t) {
|
|
1888
|
+
return t.filter(
|
|
1889
|
+
(s) => sa(e, s)
|
|
1890
|
+
);
|
|
1891
|
+
}
|
|
1892
|
+
function sa(e, t) {
|
|
1893
|
+
return ra(e, t) ? e.source ? ht(t, e) : !0 : !1;
|
|
1894
|
+
}
|
|
1895
|
+
function ra(e, t) {
|
|
1896
|
+
return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role || oa(e, t) && C(t) !== C(e));
|
|
1897
|
+
}
|
|
1898
|
+
function oa(e, t) {
|
|
1899
|
+
return e.role === "measure" || t.role === "measure" || e.aggregate !== void 0 || t.aggregate !== void 0;
|
|
1900
|
+
}
|
|
1901
|
+
function C(e) {
|
|
1902
|
+
return gt(e);
|
|
1903
|
+
}
|
|
1904
|
+
const la = /^(\d{4})-(\d{2})-(\d{2})$/, yt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
1905
|
+
function ie(e) {
|
|
1906
|
+
if (typeof e != "string")
|
|
1907
|
+
return null;
|
|
1908
|
+
const t = e.trim(), i = la.exec(t);
|
|
1909
|
+
if (i) {
|
|
1910
|
+
const [, y, I, S] = i;
|
|
1911
|
+
return Te(y, I, S) ? new Date(Date.UTC(Number(y), Number(I) - 1, Number(S))) : null;
|
|
1912
|
+
}
|
|
1913
|
+
const s = yt.exec(t);
|
|
1914
|
+
if (!s)
|
|
1915
|
+
return null;
|
|
1916
|
+
const [, l, n, o, d, p, m = "00", , u] = s;
|
|
1917
|
+
if (!Te(l, n, o) || !N(d, 0, 23) || !N(p, 0, 59) || !N(m, 0, 59) || !da(u))
|
|
1918
|
+
return null;
|
|
1919
|
+
const g = new Date(t);
|
|
1920
|
+
return Number.isFinite(g.getTime()) ? g : null;
|
|
1921
|
+
}
|
|
1922
|
+
function yn(e) {
|
|
1923
|
+
return typeof e != "string" || !yt.test(e.trim()) ? null : ie(e);
|
|
1924
|
+
}
|
|
1925
|
+
function Te(e, t, i) {
|
|
1926
|
+
const s = Number(e), l = Number(t), n = Number(i);
|
|
1927
|
+
if (!Number.isInteger(s) || !Number.isInteger(l) || !Number.isInteger(n) || l < 1 || l > 12)
|
|
1928
|
+
return !1;
|
|
1929
|
+
const o = new Date(Date.UTC(s, l - 1, n));
|
|
1930
|
+
return o.getUTCFullYear() === s && o.getUTCMonth() === l - 1 && o.getUTCDate() === n;
|
|
1931
|
+
}
|
|
1932
|
+
function N(e, t, i) {
|
|
1933
|
+
const s = Number(e);
|
|
1934
|
+
return Number.isInteger(s) && s >= t && s <= i;
|
|
1935
|
+
}
|
|
1936
|
+
function da(e) {
|
|
1937
|
+
if (e === "Z")
|
|
1938
|
+
return !0;
|
|
1939
|
+
const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
|
|
1940
|
+
return !!(t && N(t[2], 0, 23) && N(t[3], 0, 59));
|
|
1941
|
+
}
|
|
1942
|
+
function Ne(e, t, i) {
|
|
1943
|
+
if (e !== void 0) {
|
|
1944
|
+
if (!f(e)) {
|
|
1945
|
+
i.push(
|
|
1946
|
+
r(
|
|
1947
|
+
"invalid_pagination",
|
|
1948
|
+
"Pagination must be an object with positive integer page and pageSize.",
|
|
1949
|
+
t
|
|
1950
|
+
)
|
|
1951
|
+
);
|
|
1952
|
+
return;
|
|
1953
|
+
}
|
|
1954
|
+
(!Number.isInteger(e.page) || typeof e.page != "number" || e.page < 1) && i.push(
|
|
1955
|
+
r(
|
|
1956
|
+
"invalid_pagination_page",
|
|
1957
|
+
"Pagination page must be a positive integer.",
|
|
1958
|
+
`${t}.page`
|
|
1959
|
+
)
|
|
1960
|
+
), (!Number.isInteger(e.pageSize) || typeof e.pageSize != "number" || e.pageSize < 1) && i.push(
|
|
1961
|
+
r(
|
|
1962
|
+
"invalid_pagination_page_size",
|
|
1963
|
+
"Pagination pageSize must be a positive integer.",
|
|
1964
|
+
`${t}.pageSize`
|
|
1965
|
+
)
|
|
1966
|
+
);
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
function Re(e) {
|
|
1970
|
+
const t = /* @__PURE__ */ new Set();
|
|
1971
|
+
for (const i of e) {
|
|
1972
|
+
if (t.has(i))
|
|
1973
|
+
return i;
|
|
1974
|
+
t.add(i);
|
|
1975
|
+
}
|
|
1976
|
+
return null;
|
|
1977
|
+
}
|
|
1978
|
+
function ua(e, t, i) {
|
|
1979
|
+
if (!f(e)) {
|
|
1980
|
+
i.push(
|
|
1981
|
+
r(
|
|
1982
|
+
"invalid_input_binding",
|
|
1983
|
+
"Input bindings must be structured objects.",
|
|
1984
|
+
t
|
|
1985
|
+
)
|
|
1986
|
+
);
|
|
1987
|
+
return;
|
|
1988
|
+
}
|
|
1989
|
+
c(e.inputId) || i.push(
|
|
1990
|
+
r(
|
|
1991
|
+
"invalid_input_binding",
|
|
1992
|
+
"Input bindings need a non-empty inputId.",
|
|
1993
|
+
`${t}.inputId`
|
|
1994
|
+
)
|
|
1995
|
+
), e.kind !== void 0 && e.kind !== "filter" && e.kind !== "control" && i.push(
|
|
1996
|
+
r(
|
|
1997
|
+
"invalid_input_binding",
|
|
1998
|
+
"Input binding kind must be filter or control.",
|
|
1999
|
+
`${t}.kind`
|
|
2000
|
+
)
|
|
2001
|
+
), e.field !== void 0 && _(e.field, `${t}.field`, i), e.relationshipHint !== void 0 && ye(
|
|
2002
|
+
e.relationshipHint,
|
|
2003
|
+
`${t}.relationshipHint`,
|
|
2004
|
+
i
|
|
2005
|
+
);
|
|
2006
|
+
}
|
|
2007
|
+
function ye(e, t, i) {
|
|
2008
|
+
if (!f(e)) {
|
|
2009
|
+
i.push(
|
|
2010
|
+
r(
|
|
2011
|
+
"invalid_relationship_hint",
|
|
2012
|
+
"Relationship hints must be structured objects.",
|
|
2013
|
+
t
|
|
2014
|
+
)
|
|
2015
|
+
);
|
|
2016
|
+
return;
|
|
2017
|
+
}
|
|
2018
|
+
e.relationshipIds !== void 0 && (!Array.isArray(e.relationshipIds) || e.relationshipIds.some((s) => !c(s))) && i.push(
|
|
2019
|
+
r(
|
|
2020
|
+
"invalid_relationship_hint",
|
|
2021
|
+
"Relationship hint relationshipIds must be non-empty strings.",
|
|
2022
|
+
`${t}.relationshipIds`
|
|
2023
|
+
)
|
|
2024
|
+
);
|
|
2025
|
+
}
|
|
2026
|
+
function ca(e, t) {
|
|
2027
|
+
var s, l;
|
|
2028
|
+
if (((s = e.source) == null ? void 0 : s.kind) !== "semantic" && ((l = e.source) == null ? void 0 : l.kind) !== "physical" && t.push(
|
|
2029
|
+
r(
|
|
2030
|
+
"invalid_input_options_source",
|
|
2031
|
+
"Input options must use a semantic or physical source.",
|
|
2032
|
+
"source"
|
|
2033
|
+
)
|
|
2034
|
+
), c(e.inputId) || t.push(
|
|
2035
|
+
r(
|
|
2036
|
+
"missing_input_options_input_id",
|
|
2037
|
+
"Input options intent needs the inputId it populates.",
|
|
2038
|
+
"inputId"
|
|
2039
|
+
)
|
|
2040
|
+
), e.search !== void 0 && typeof e.search != "string" && t.push(
|
|
2041
|
+
r(
|
|
2042
|
+
"invalid_input_options_search",
|
|
2043
|
+
"Input options search must be a string.",
|
|
2044
|
+
"search"
|
|
2045
|
+
)
|
|
2046
|
+
), e.matchValues !== void 0) {
|
|
2047
|
+
const n = Et(e.matchValues);
|
|
2048
|
+
n.ok || t.push(
|
|
2049
|
+
r("invalid_input_options_match_values", n.error, "matchValues")
|
|
2050
|
+
), typeof e.search == "string" && e.search.trim() && t.push(
|
|
2051
|
+
r(
|
|
2052
|
+
"invalid_input_options_match_values",
|
|
2053
|
+
"Input options matchValues cannot be combined with search.",
|
|
2054
|
+
"matchValues"
|
|
2055
|
+
)
|
|
2056
|
+
);
|
|
2057
|
+
}
|
|
2058
|
+
if (e.limit !== void 0 && (typeof e.limit != "number" || !Number.isFinite(e.limit) || !Number.isInteger(e.limit) || e.limit <= 0) && t.push(
|
|
2059
|
+
r(
|
|
2060
|
+
"invalid_input_options_limit",
|
|
2061
|
+
"Input options limit must be a positive finite number.",
|
|
2062
|
+
"limit"
|
|
2063
|
+
)
|
|
2064
|
+
), (!e.labelField || !c(e.labelField.name)) && t.push(
|
|
2065
|
+
r(
|
|
2066
|
+
"missing_input_options_label_field",
|
|
2067
|
+
"Input options intent needs a labelField.",
|
|
2068
|
+
"labelField"
|
|
2069
|
+
)
|
|
2070
|
+
), _(e.labelField, "labelField", t, {
|
|
2071
|
+
required: !0
|
|
2072
|
+
}), (!e.valueField || !c(e.valueField.name)) && t.push(
|
|
2073
|
+
r(
|
|
2074
|
+
"missing_input_options_value_field",
|
|
2075
|
+
"Input options intent needs a valueField.",
|
|
2076
|
+
"valueField"
|
|
2077
|
+
)
|
|
2078
|
+
), _(e.valueField, "valueField", t, {
|
|
2079
|
+
required: !0
|
|
2080
|
+
}), e.searchField !== void 0 && _(e.searchField, "searchField", t, {
|
|
2081
|
+
required: !0
|
|
2082
|
+
}), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((n, o) => {
|
|
2083
|
+
_(n, `disambiguationFields.${o}`, t, {
|
|
2084
|
+
required: !0
|
|
2085
|
+
});
|
|
2086
|
+
}) : t.push(
|
|
2087
|
+
r(
|
|
2088
|
+
"invalid_input_options_disambiguation_fields",
|
|
2089
|
+
"Input options disambiguationFields must be an array of field refs.",
|
|
2090
|
+
"disambiguationFields"
|
|
2091
|
+
)
|
|
2092
|
+
)), [
|
|
2093
|
+
{ field: e.labelField, path: "labelField" },
|
|
2094
|
+
{ field: e.valueField, path: "valueField" },
|
|
2095
|
+
...e.searchField ? [{ field: e.searchField, path: "searchField" }] : [],
|
|
2096
|
+
...Array.isArray(e.disambiguationFields) ? e.disambiguationFields.map((n, o) => ({
|
|
2097
|
+
field: n,
|
|
2098
|
+
path: `disambiguationFields.${o}`
|
|
2099
|
+
})) : []
|
|
2100
|
+
].forEach(({ field: n, path: o }) => {
|
|
2101
|
+
n != null && n.source && !he(n.source, e.source) && t.push(
|
|
2102
|
+
r(
|
|
2103
|
+
"input_options_field_source_mismatch",
|
|
2104
|
+
"Input option fields must belong to the declared option source.",
|
|
2105
|
+
`${o}.source`
|
|
2106
|
+
)
|
|
2107
|
+
);
|
|
2108
|
+
}), e.dependencies !== void 0) {
|
|
2109
|
+
const n = ma(
|
|
2110
|
+
e.dependencies
|
|
2111
|
+
);
|
|
2112
|
+
t.push(...n.errors), n.ok && ga(e, t);
|
|
2113
|
+
}
|
|
2114
|
+
if (e.population !== void 0) {
|
|
2115
|
+
const n = e.population;
|
|
2116
|
+
if (!f(n))
|
|
2117
|
+
t.push(
|
|
2118
|
+
r(
|
|
2119
|
+
"invalid_input_options_population",
|
|
2120
|
+
"Input options population must be a structured object.",
|
|
2121
|
+
"population"
|
|
2122
|
+
)
|
|
2123
|
+
);
|
|
2124
|
+
else {
|
|
2125
|
+
const o = n.kind;
|
|
2126
|
+
o !== "option_source" && o !== "related_population" && t.push(
|
|
2127
|
+
r(
|
|
2128
|
+
"invalid_input_options_population",
|
|
2129
|
+
"Input options population kind must be option_source or related_population.",
|
|
2130
|
+
"population.kind"
|
|
2131
|
+
)
|
|
2132
|
+
), o === "option_source" && n.baseSource !== void 0 && t.push(
|
|
2133
|
+
r(
|
|
2134
|
+
"invalid_input_options_population",
|
|
2135
|
+
"Input options population baseSource is only valid for related_population.",
|
|
2136
|
+
"population.baseSource"
|
|
2137
|
+
)
|
|
2138
|
+
), o === "option_source" && n.relationshipHint !== void 0 && t.push(
|
|
2139
|
+
r(
|
|
2140
|
+
"invalid_input_options_population",
|
|
2141
|
+
"Input options population relationshipHint is only valid for related_population.",
|
|
2142
|
+
"population.relationshipHint"
|
|
2143
|
+
)
|
|
2144
|
+
), o === "related_population" && (se(
|
|
2145
|
+
n.baseSource,
|
|
2146
|
+
"population.baseSource",
|
|
2147
|
+
t
|
|
2148
|
+
), n.relationshipHint !== void 0 && ye(
|
|
2149
|
+
n.relationshipHint,
|
|
2150
|
+
"population.relationshipHint",
|
|
2151
|
+
t
|
|
2152
|
+
));
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
function pa(e, t) {
|
|
2157
|
+
if (!(!("inputs" in e) || e.inputs === void 0)) {
|
|
2158
|
+
if (!Array.isArray(e.inputs)) {
|
|
2159
|
+
t.push(
|
|
2160
|
+
r(
|
|
2161
|
+
"invalid_input_binding",
|
|
2162
|
+
"Analytics intent inputs must be an array of input bindings.",
|
|
2163
|
+
"inputs"
|
|
2164
|
+
)
|
|
2165
|
+
);
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2168
|
+
e.inputs.forEach(
|
|
2169
|
+
(i, s) => ua(i, `inputs.${s}`, t)
|
|
2170
|
+
);
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
function ma(e, t = "protocol") {
|
|
2174
|
+
const i = [];
|
|
2175
|
+
if (!f(e))
|
|
2176
|
+
return i.push(
|
|
2177
|
+
r(
|
|
2178
|
+
"invalid_input_options_dependencies",
|
|
2179
|
+
"Input options dependencies must be a structured object.",
|
|
2180
|
+
"dependencies"
|
|
2181
|
+
)
|
|
2182
|
+
), { ok: !1, errors: i, warnings: [] };
|
|
2183
|
+
const s = e, l = s.mode;
|
|
2184
|
+
if (l !== void 0 && l !== "independent" && l !== "explicit" && l !== "all_applicable" && i.push(
|
|
2185
|
+
r(
|
|
2186
|
+
"invalid_input_options_dependencies",
|
|
2187
|
+
"Input options dependencies mode must be independent, explicit, or all_applicable.",
|
|
2188
|
+
"dependencies.mode"
|
|
2189
|
+
)
|
|
2190
|
+
), K(
|
|
2191
|
+
s.includeInputIds,
|
|
2192
|
+
"dependencies.includeInputIds",
|
|
2193
|
+
i,
|
|
2194
|
+
"Input options includeInputIds must be non-empty strings."
|
|
2195
|
+
), K(
|
|
2196
|
+
s.excludeInputIds,
|
|
2197
|
+
"dependencies.excludeInputIds",
|
|
2198
|
+
i,
|
|
2199
|
+
"Input options excludeInputIds must be non-empty strings."
|
|
2200
|
+
), l === "all_applicable" && s.includeInputIds !== void 0 && i.push(
|
|
2201
|
+
r(
|
|
2202
|
+
"invalid_input_options_dependencies",
|
|
2203
|
+
"All applicable dependencies cannot specify includeInputIds.",
|
|
2204
|
+
"dependencies.includeInputIds"
|
|
2205
|
+
)
|
|
2206
|
+
), K(
|
|
2207
|
+
s.omitInputIds,
|
|
2208
|
+
"dependencies.omitInputIds",
|
|
2209
|
+
i,
|
|
2210
|
+
"Input options omitInputIds must be non-empty strings."
|
|
2211
|
+
), Array.isArray(s.omitInputIds)) {
|
|
2212
|
+
const n = new Set(
|
|
2213
|
+
Array.isArray(s.includeInputIds) ? s.includeInputIds : []
|
|
2214
|
+
);
|
|
2215
|
+
(l !== "explicit" || new Set(s.omitInputIds).size !== s.omitInputIds.length || s.omitInputIds.some((o) => !n.has(o))) && i.push(
|
|
2216
|
+
r(
|
|
2217
|
+
"invalid_input_options_dependencies",
|
|
2218
|
+
"A browse override may only omit unique ids from an explicit includeInputIds list.",
|
|
2219
|
+
"dependencies.omitInputIds"
|
|
2220
|
+
)
|
|
2221
|
+
);
|
|
2222
|
+
}
|
|
2223
|
+
return t === "dashboard" && fa(s, i), { ok: i.length === 0, errors: i, warnings: [] };
|
|
2224
|
+
}
|
|
2225
|
+
function fa(e, t) {
|
|
2226
|
+
const { mode: i, includeInputIds: s, excludeInputIds: l } = e;
|
|
2227
|
+
i === void 0 && t.push(
|
|
2228
|
+
r(
|
|
2229
|
+
"invalid_input_options_dependencies",
|
|
2230
|
+
"Dashboard option dependencies must declare a mode.",
|
|
2231
|
+
"dependencies.mode"
|
|
2232
|
+
)
|
|
2233
|
+
);
|
|
2234
|
+
for (const [n, o] of [
|
|
2235
|
+
["dependencies.includeInputIds", s],
|
|
2236
|
+
["dependencies.excludeInputIds", l]
|
|
2237
|
+
])
|
|
2238
|
+
Array.isArray(o) && new Set(o).size !== o.length && t.push(
|
|
2239
|
+
r(
|
|
2240
|
+
"invalid_input_options_dependencies",
|
|
2241
|
+
"Dashboard option dependency input IDs must be unique.",
|
|
2242
|
+
n
|
|
2243
|
+
)
|
|
2244
|
+
);
|
|
2245
|
+
i === "independent" && (s !== void 0 || l !== void 0) && t.push(
|
|
2246
|
+
r(
|
|
2247
|
+
"invalid_input_options_dependencies",
|
|
2248
|
+
"Independent dashboard dependencies cannot specify input IDs.",
|
|
2249
|
+
"dependencies"
|
|
2250
|
+
)
|
|
2251
|
+
), i === "explicit" && (!Array.isArray(s) || s.length === 0 || l !== void 0) && t.push(
|
|
2252
|
+
r(
|
|
2253
|
+
"invalid_input_options_dependencies",
|
|
2254
|
+
"Explicit dashboard dependencies require included input IDs and cannot specify exclusions.",
|
|
2255
|
+
"dependencies"
|
|
2256
|
+
)
|
|
2257
|
+
);
|
|
2258
|
+
}
|
|
2259
|
+
function ga(e, t) {
|
|
2260
|
+
var l, n, o;
|
|
2261
|
+
const i = new Set(
|
|
2262
|
+
Array.isArray(e.inputs) ? e.inputs.map((d) => f(d) ? d.inputId : void 0).filter((d) => typeof d == "string") : []
|
|
2263
|
+
), s = new Set(((l = e.dependencies) == null ? void 0 : l.omitInputIds) || []);
|
|
2264
|
+
for (const d of ((n = e.dependencies) == null ? void 0 : n.includeInputIds) || [])
|
|
2265
|
+
!i.has(d) && !s.has(d) && t.push(
|
|
2266
|
+
r(
|
|
2267
|
+
"invalid_input_options_dependencies",
|
|
2268
|
+
`Input options dependency "${d}" is not declared in inputs.`,
|
|
2269
|
+
"dependencies.includeInputIds"
|
|
2270
|
+
)
|
|
2271
|
+
);
|
|
2272
|
+
for (const d of ((o = e.dependencies) == null ? void 0 : o.excludeInputIds) || [])
|
|
2273
|
+
d !== e.inputId && !i.has(d) && t.push(
|
|
2274
|
+
r(
|
|
2275
|
+
"invalid_input_options_dependencies",
|
|
2276
|
+
`Input options dependency exclusion "${d}" is not the populated inputId and is not declared in inputs.`,
|
|
2277
|
+
"dependencies.excludeInputIds"
|
|
2278
|
+
)
|
|
2279
|
+
);
|
|
2280
|
+
}
|
|
2281
|
+
function K(e, t, i, s) {
|
|
2282
|
+
e !== void 0 && (!Array.isArray(e) || e.some((l) => !c(l))) && i.push(r("invalid_input_options_dependencies", s, t));
|
|
2283
|
+
}
|
|
2284
|
+
const ha = new Set(Ye);
|
|
2285
|
+
function _a(e, t, i) {
|
|
2286
|
+
if (f(e) && e.type === "temporal_bucket") {
|
|
2287
|
+
i.push(
|
|
2288
|
+
r(
|
|
2289
|
+
"invalid_scalar_value_format",
|
|
2290
|
+
"Scalar and measure slots cannot own temporal bucket presentation; declare it with grain on a grouped field or axis.",
|
|
2291
|
+
t
|
|
2292
|
+
)
|
|
2293
|
+
);
|
|
2294
|
+
return;
|
|
2295
|
+
}
|
|
2296
|
+
Pe(e, t, i);
|
|
2297
|
+
}
|
|
2298
|
+
function $e(e, t, i) {
|
|
2299
|
+
if (!f(e)) {
|
|
2300
|
+
i.push(
|
|
2301
|
+
r(
|
|
2302
|
+
"invalid_result_column_ref",
|
|
2303
|
+
"Result calculation references must use columnKey or field.",
|
|
2304
|
+
t
|
|
2305
|
+
)
|
|
2306
|
+
);
|
|
2307
|
+
return;
|
|
2308
|
+
}
|
|
2309
|
+
const s = c(e.columnKey), l = f(e.field);
|
|
2310
|
+
if (s === l) {
|
|
2311
|
+
i.push(
|
|
2312
|
+
r(
|
|
2313
|
+
"invalid_result_column_ref",
|
|
2314
|
+
"Result calculation references must identify exactly one of columnKey or field.",
|
|
2315
|
+
t
|
|
2316
|
+
)
|
|
2317
|
+
);
|
|
2318
|
+
return;
|
|
2319
|
+
}
|
|
2320
|
+
l && _(e.field, `${t}.field`, i, {
|
|
2321
|
+
required: !0
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2324
|
+
function ya(e, t, i) {
|
|
2325
|
+
if (!f(e)) {
|
|
2326
|
+
i.push(
|
|
2327
|
+
r(
|
|
2328
|
+
"invalid_result_calculation_output",
|
|
2329
|
+
"Result calculation output must be a structured object.",
|
|
2330
|
+
t
|
|
2331
|
+
)
|
|
2332
|
+
);
|
|
2333
|
+
return;
|
|
2334
|
+
}
|
|
2335
|
+
c(e.key) || i.push(
|
|
2336
|
+
r(
|
|
2337
|
+
"invalid_result_calculation_output",
|
|
2338
|
+
"Result calculation output needs a stable key.",
|
|
2339
|
+
`${t}.key`
|
|
2340
|
+
)
|
|
2341
|
+
), e.dataType !== void 0 && (typeof e.dataType != "string" || !Oe.has(e.dataType)) && i.push(
|
|
2342
|
+
r(
|
|
2343
|
+
"invalid_result_calculation_output",
|
|
2344
|
+
"Result calculation output dataType must be string, number, boolean, date, datetime, or unknown.",
|
|
2345
|
+
`${t}.dataType`
|
|
2346
|
+
)
|
|
2347
|
+
), _a(e.format, `${t}.format`, i);
|
|
2348
|
+
}
|
|
2349
|
+
function ba(e, t) {
|
|
2350
|
+
if (e.analysis === void 0)
|
|
2351
|
+
return;
|
|
2352
|
+
if (!f(e.analysis)) {
|
|
2353
|
+
t.push(
|
|
2354
|
+
r(
|
|
2355
|
+
"invalid_measure_analysis",
|
|
2356
|
+
"Metric analysis must be a structured object.",
|
|
2357
|
+
"analysis"
|
|
2358
|
+
)
|
|
2359
|
+
);
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
if (e.analysis.kind !== "period_change") {
|
|
2363
|
+
t.push(
|
|
2364
|
+
r(
|
|
2365
|
+
"invalid_measure_analysis",
|
|
2366
|
+
"Metric analysis kind is not supported.",
|
|
2367
|
+
"analysis.kind"
|
|
2368
|
+
)
|
|
2369
|
+
);
|
|
2370
|
+
return;
|
|
2371
|
+
}
|
|
2372
|
+
e.dateField || t.push(
|
|
2373
|
+
r(
|
|
2374
|
+
"missing_analysis_date_field",
|
|
2375
|
+
"Period-change analysis needs a dateField.",
|
|
2376
|
+
"dateField"
|
|
2377
|
+
)
|
|
2378
|
+
), e.timeGrain || t.push(
|
|
2379
|
+
r(
|
|
2380
|
+
"missing_analysis_time_grain",
|
|
2381
|
+
"Period-change analysis needs a timeGrain.",
|
|
2382
|
+
"timeGrain"
|
|
2383
|
+
)
|
|
2384
|
+
), e.analysis.orderBy !== void 0 && e.analysis.orderBy !== "absolute_change" && e.analysis.orderBy !== "positive_change" && e.analysis.orderBy !== "negative_change" && e.analysis.orderBy !== "period" && t.push(
|
|
2385
|
+
r(
|
|
2386
|
+
"invalid_measure_analysis",
|
|
2387
|
+
"Period-change analysis orderBy must be absolute_change, positive_change, negative_change, or period.",
|
|
2388
|
+
"analysis.orderBy"
|
|
2389
|
+
)
|
|
2390
|
+
);
|
|
2391
|
+
const { timeWindow: i } = e.analysis;
|
|
2392
|
+
i !== void 0 && ae(i, "analysis.timeWindow", t);
|
|
2393
|
+
}
|
|
2394
|
+
const va = new Set(
|
|
2395
|
+
Tt
|
|
2396
|
+
), Ia = new Set(
|
|
2397
|
+
Nt
|
|
2398
|
+
), Sa = new Set(
|
|
2399
|
+
Rt
|
|
2400
|
+
);
|
|
2401
|
+
function ka(e, t, i) {
|
|
2402
|
+
va.has(e.unit) || i.push(
|
|
2403
|
+
r(
|
|
2404
|
+
"invalid_time_window",
|
|
2405
|
+
"Calendar time window unit must be one of: day, week, month, quarter, year.",
|
|
2406
|
+
`${t}.unit`
|
|
2407
|
+
)
|
|
2408
|
+
), e.period !== "this" && e.period !== "previous" && i.push(
|
|
2409
|
+
r(
|
|
2410
|
+
"invalid_time_window",
|
|
2411
|
+
"Calendar time window period must be this or previous.",
|
|
2412
|
+
`${t}.period`
|
|
2413
|
+
)
|
|
2414
|
+
), e.toDate !== void 0 && typeof e.toDate != "boolean" ? i.push(
|
|
2415
|
+
r(
|
|
2416
|
+
"invalid_time_window",
|
|
2417
|
+
"Calendar time window toDate must be a boolean.",
|
|
2418
|
+
`${t}.toDate`
|
|
2419
|
+
)
|
|
2420
|
+
) : e.toDate === !0 && e.period !== "this" && i.push(
|
|
2421
|
+
r(
|
|
2422
|
+
"invalid_time_window",
|
|
2423
|
+
"Calendar time window toDate is only allowed with period this.",
|
|
2424
|
+
`${t}.toDate`
|
|
2425
|
+
)
|
|
2426
|
+
);
|
|
2427
|
+
}
|
|
2428
|
+
function ae(e, t, i) {
|
|
2429
|
+
if (!f(e)) {
|
|
2430
|
+
i.push(
|
|
2431
|
+
r(
|
|
2432
|
+
"invalid_time_window",
|
|
2433
|
+
"Time window must be a structured object.",
|
|
2434
|
+
t
|
|
2435
|
+
)
|
|
2436
|
+
);
|
|
2437
|
+
return;
|
|
2438
|
+
}
|
|
2439
|
+
if (e.kind !== void 0 && e.kind !== "relative" && e.kind !== "calendar" && e.kind !== "absolute" && i.push(
|
|
2440
|
+
r(
|
|
2441
|
+
"invalid_time_window",
|
|
2442
|
+
"Time window kind must be relative, calendar or absolute.",
|
|
2443
|
+
`${t}.kind`
|
|
2444
|
+
)
|
|
2445
|
+
), e.kind === "calendar") {
|
|
2446
|
+
ka(e, t, i);
|
|
2447
|
+
return;
|
|
2448
|
+
}
|
|
2449
|
+
if (e.kind === "absolute") {
|
|
2450
|
+
if (c(e.start) || i.push(
|
|
2451
|
+
r(
|
|
2452
|
+
"invalid_time_window",
|
|
2453
|
+
"Absolute time window start must be a non-empty ISO date or timestamp string.",
|
|
2454
|
+
`${t}.start`
|
|
2455
|
+
)
|
|
2456
|
+
), c(e.end) || i.push(
|
|
2457
|
+
r(
|
|
2458
|
+
"invalid_time_window",
|
|
2459
|
+
"Absolute time window end must be a non-empty ISO date or timestamp string.",
|
|
2460
|
+
`${t}.end`
|
|
2461
|
+
)
|
|
2462
|
+
), c(e.start) && c(e.end)) {
|
|
2463
|
+
const s = ie(e.start), l = ie(e.end);
|
|
2464
|
+
s || i.push(
|
|
2465
|
+
r(
|
|
2466
|
+
"invalid_time_window",
|
|
2467
|
+
"Absolute time window start must be a valid ISO date or timestamp.",
|
|
2468
|
+
`${t}.start`
|
|
2469
|
+
)
|
|
2470
|
+
), l || i.push(
|
|
2471
|
+
r(
|
|
2472
|
+
"invalid_time_window",
|
|
2473
|
+
"Absolute time window end must be a valid ISO date or timestamp.",
|
|
2474
|
+
`${t}.end`
|
|
2475
|
+
)
|
|
2476
|
+
), s && l && s.getTime() > l.getTime() && i.push(
|
|
2477
|
+
r(
|
|
2478
|
+
"invalid_time_window",
|
|
2479
|
+
"Absolute time window start must be before or equal to end.",
|
|
2480
|
+
t
|
|
2481
|
+
)
|
|
2482
|
+
);
|
|
2483
|
+
}
|
|
2484
|
+
return;
|
|
2485
|
+
}
|
|
2486
|
+
(typeof e.unit != "string" || !ha.has(e.unit)) && i.push(
|
|
2487
|
+
r(
|
|
2488
|
+
"invalid_time_window",
|
|
2489
|
+
`Time window unit must be one of: ${Ye.join(", ")}.`,
|
|
2490
|
+
`${t}.unit`
|
|
2491
|
+
)
|
|
2492
|
+
), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && i.push(
|
|
2493
|
+
r(
|
|
2494
|
+
"invalid_time_window",
|
|
2495
|
+
"Time window value must be a positive number.",
|
|
2496
|
+
`${t}.value`
|
|
2497
|
+
)
|
|
2498
|
+
), e.anchor !== void 0 && !Ia.has(e.anchor) && i.push(
|
|
2499
|
+
r(
|
|
2500
|
+
"invalid_time_window",
|
|
2501
|
+
"Time window anchor must be now or latest_available.",
|
|
2502
|
+
`${t}.anchor`
|
|
2503
|
+
)
|
|
2504
|
+
), e.completeness !== void 0 && !Sa.has(e.completeness) && i.push(
|
|
2505
|
+
r(
|
|
2506
|
+
"invalid_time_window",
|
|
2507
|
+
"Time window completeness must be include_partial or complete_periods.",
|
|
2508
|
+
`${t}.completeness`
|
|
2509
|
+
)
|
|
2510
|
+
);
|
|
2511
|
+
}
|
|
2512
|
+
function ne(e, t, i) {
|
|
2513
|
+
if (e !== void 0) {
|
|
2514
|
+
if (!Array.isArray(e)) {
|
|
2515
|
+
i.push(
|
|
2516
|
+
r(
|
|
2517
|
+
"invalid_analytics_filters",
|
|
2518
|
+
"Analytics filters must be an array.",
|
|
2519
|
+
t
|
|
2520
|
+
)
|
|
2521
|
+
);
|
|
2522
|
+
return;
|
|
2523
|
+
}
|
|
2524
|
+
e.forEach((s, l) => {
|
|
2525
|
+
var p;
|
|
2526
|
+
const n = `${t}.${l}`;
|
|
2527
|
+
if (!f(s)) {
|
|
2528
|
+
i.push(
|
|
2529
|
+
r(
|
|
2530
|
+
"invalid_analytics_filter",
|
|
2531
|
+
"Analytics filter must be a structured object.",
|
|
2532
|
+
n
|
|
2533
|
+
)
|
|
2534
|
+
);
|
|
2535
|
+
return;
|
|
2536
|
+
}
|
|
2537
|
+
const o = s;
|
|
2538
|
+
_(o.field, `${n}.field`, i, {
|
|
2539
|
+
required: !0
|
|
2540
|
+
}), o.scope !== void 0 && o.scope !== "row" && o.scope !== "aggregate" && i.push(
|
|
2541
|
+
r(
|
|
2542
|
+
"invalid_analytics_filter_scope",
|
|
2543
|
+
"Analytics filter scope must be row or aggregate.",
|
|
2544
|
+
`${n}.scope`
|
|
2545
|
+
)
|
|
2546
|
+
), o.scope === "aggregate" && ((p = o.field) == null ? void 0 : p.role) !== void 0 && o.field.role !== "measure" && i.push(
|
|
2547
|
+
r(
|
|
2548
|
+
"invalid_analytics_filter_scope",
|
|
2549
|
+
"Aggregate-scope analytics filters must target a measure field.",
|
|
2550
|
+
`${n}.scope`
|
|
2551
|
+
)
|
|
2552
|
+
);
|
|
2553
|
+
const d = o.operator === "is_null" || o.operator === "is_not_null";
|
|
2554
|
+
if (o.operator !== void 0 && o.operator !== "=" && o.operator !== "!=" && o.operator !== "in" && o.operator !== "not_in" && o.operator !== "contains" && o.operator !== "not_contains" && o.operator !== "between" && o.operator !== "not_between" && o.operator !== ">" && o.operator !== ">=" && o.operator !== "<" && o.operator !== "<=" && o.operator !== "is_null" && o.operator !== "is_not_null" && i.push(
|
|
2555
|
+
r(
|
|
2556
|
+
"invalid_analytics_filter_operator",
|
|
2557
|
+
"Analytics filter operator is not supported.",
|
|
2558
|
+
`${n}.operator`
|
|
2559
|
+
)
|
|
2560
|
+
), o.values === void 0 && !d && i.push(
|
|
2561
|
+
r(
|
|
2562
|
+
"missing_analytics_filter_value",
|
|
2563
|
+
"Analytics filter needs values unless it is a null check.",
|
|
2564
|
+
n
|
|
2565
|
+
)
|
|
2566
|
+
), d && o.values !== void 0) {
|
|
2567
|
+
i.push(
|
|
2568
|
+
r(
|
|
2569
|
+
"invalid_analytics_filter_values",
|
|
2570
|
+
"Null-check analytics filters must not include values.",
|
|
2571
|
+
`${n}.values`
|
|
2572
|
+
)
|
|
2573
|
+
);
|
|
2574
|
+
return;
|
|
2575
|
+
}
|
|
2576
|
+
if (o.values !== void 0 && !Array.isArray(o.values)) {
|
|
2577
|
+
i.push(
|
|
2578
|
+
r(
|
|
2579
|
+
"invalid_analytics_filter_values",
|
|
2580
|
+
"Analytics filter values must be an array when provided.",
|
|
2581
|
+
`${n}.values`
|
|
2582
|
+
)
|
|
2583
|
+
);
|
|
2584
|
+
return;
|
|
2585
|
+
}
|
|
2586
|
+
if (o.values !== void 0) {
|
|
2587
|
+
const m = o.values.length;
|
|
2588
|
+
if (o.operator === "between" || o.operator === "not_between") {
|
|
2589
|
+
m !== 2 && i.push(
|
|
2590
|
+
r(
|
|
2591
|
+
"invalid_analytics_filter_values",
|
|
2592
|
+
"Between analytics filters must include exactly two values.",
|
|
2593
|
+
`${n}.values`
|
|
2594
|
+
)
|
|
2595
|
+
);
|
|
2596
|
+
return;
|
|
2597
|
+
}
|
|
2598
|
+
(o.operator === "contains" || o.operator === "not_contains" || o.operator === "=" || o.operator === "!=" || o.operator === ">" || o.operator === ">=" || o.operator === "<" || o.operator === "<=" || o.operator === void 0) && m !== 1 && i.push(
|
|
2599
|
+
r(
|
|
2600
|
+
"invalid_analytics_filter_values",
|
|
2601
|
+
"Scalar analytics filters must include exactly one value. Use in/not_in for multiple values.",
|
|
2602
|
+
`${n}.values`
|
|
2603
|
+
)
|
|
2604
|
+
);
|
|
2605
|
+
}
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
function bn(e) {
|
|
2610
|
+
const t = [];
|
|
2611
|
+
if (!f(e))
|
|
2612
|
+
return t.push(
|
|
2613
|
+
r(
|
|
2614
|
+
"invalid_result_calculation",
|
|
2615
|
+
"Result calculation must be a structured object."
|
|
2616
|
+
)
|
|
2617
|
+
), { ok: !1, errors: t, warnings: [] };
|
|
2618
|
+
if (c(e.id) || t.push(
|
|
2619
|
+
r(
|
|
2620
|
+
"invalid_result_calculation_id",
|
|
2621
|
+
"Result calculation needs an id.",
|
|
2622
|
+
"id"
|
|
2623
|
+
)
|
|
2624
|
+
), c(e.label) || t.push(
|
|
2625
|
+
r(
|
|
2626
|
+
"invalid_result_calculation_label",
|
|
2627
|
+
"Result calculation needs a label.",
|
|
2628
|
+
"label"
|
|
2629
|
+
)
|
|
2630
|
+
), e.kind !== "percent_of_total" && e.kind !== "rank" && e.kind !== "running_total" && e.kind !== "previous_row_delta" && t.push(
|
|
2631
|
+
r(
|
|
2632
|
+
"invalid_result_calculation_kind",
|
|
2633
|
+
"Result calculation kind must be percent_of_total, rank, running_total, or previous_row_delta.",
|
|
2634
|
+
"kind"
|
|
2635
|
+
)
|
|
2636
|
+
), $e(e.input, "input", t), ya(e.output, "output", t), e.kind === "percent_of_total") {
|
|
2637
|
+
const i = e.denominator;
|
|
2638
|
+
i !== void 0 && (f(i) ? i.scope === "population" ? (_(i.metric, "denominator.metric", t, {
|
|
2639
|
+
required: !0
|
|
2640
|
+
}), ne(
|
|
2641
|
+
i.filters,
|
|
2642
|
+
"denominator.filters",
|
|
2643
|
+
t
|
|
2644
|
+
)) : i.scope !== "returned_result" && t.push(
|
|
2645
|
+
r(
|
|
2646
|
+
"invalid_result_calculation_denominator",
|
|
2647
|
+
"Percent-of-total denominator scope must be returned_result or population.",
|
|
2648
|
+
"denominator.scope"
|
|
2649
|
+
)
|
|
2650
|
+
) : t.push(
|
|
2651
|
+
r(
|
|
2652
|
+
"invalid_result_calculation_denominator",
|
|
2653
|
+
"Percent-of-total denominator must be a structured object.",
|
|
2654
|
+
"denominator"
|
|
2655
|
+
)
|
|
2656
|
+
));
|
|
2657
|
+
}
|
|
2658
|
+
return e.kind === "rank" && e.order !== void 0 && e.order !== "asc" && e.order !== "desc" && t.push(
|
|
2659
|
+
r(
|
|
2660
|
+
"invalid_result_calculation_order",
|
|
2661
|
+
"Rank result calculation order must be asc or desc.",
|
|
2662
|
+
"order"
|
|
2663
|
+
)
|
|
2664
|
+
), (e.kind === "running_total" || e.kind === "previous_row_delta") && e.orderBy !== void 0 && $e(e.orderBy, "orderBy", t), { ok: t.length === 0, errors: t, warnings: [] };
|
|
2665
|
+
}
|
|
2666
|
+
function bt(e) {
|
|
2667
|
+
var s;
|
|
2668
|
+
const t = [], i = [];
|
|
2669
|
+
if (!e || typeof e != "object")
|
|
2670
|
+
return {
|
|
2671
|
+
ok: !1,
|
|
2672
|
+
errors: [
|
|
2673
|
+
r(
|
|
2674
|
+
"invalid_analytics_intent",
|
|
2675
|
+
"Analytics intent must be a structured object."
|
|
2676
|
+
)
|
|
2677
|
+
],
|
|
2678
|
+
warnings: i,
|
|
2679
|
+
repairHints: [
|
|
2680
|
+
{
|
|
2681
|
+
code: "invalid_analytics_intent",
|
|
2682
|
+
recommendedNextStep: "Send one structured analytics intent object with kind, source, and required fields."
|
|
2683
|
+
}
|
|
2684
|
+
]
|
|
2685
|
+
};
|
|
2686
|
+
if (e.kind === "matrix") {
|
|
2687
|
+
const l = Pi.safeParse(e);
|
|
2688
|
+
return l.success || t.push(...l.error.issues.map((n) => r("invalid_matrix_intent", n.message, n.path.join(".")))), { ok: t.length === 0, errors: t, warnings: i, repairHints: Ce(t) };
|
|
2689
|
+
}
|
|
2690
|
+
if (e.version !== void 0 && e.version !== 1 && t.push(
|
|
2691
|
+
r(
|
|
2692
|
+
"invalid_version",
|
|
2693
|
+
"Analytics intent version must be 1.",
|
|
2694
|
+
"version"
|
|
2695
|
+
)
|
|
2696
|
+
), se(e.source, "source", t), wa(e, t), pa(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && ye(
|
|
2697
|
+
e.relationshipHint,
|
|
2698
|
+
"relationshipHint",
|
|
2699
|
+
t
|
|
2700
|
+
), e.kind === "metric") {
|
|
2701
|
+
const l = Array.isArray(e.measures) ? e.measures.filter(
|
|
2702
|
+
(n) => f(n) && c(n.name)
|
|
2703
|
+
) : [];
|
|
2704
|
+
if (!Array.isArray(e.measures) || e.measures.length === 0 ? t.push(
|
|
2705
|
+
r(
|
|
2706
|
+
"missing_measure",
|
|
2707
|
+
"Metric intent needs at least one measure.",
|
|
2708
|
+
"measures"
|
|
2709
|
+
)
|
|
2710
|
+
) : e.measures.some(
|
|
2711
|
+
(n) => !f(n) || !c(n.name)
|
|
2712
|
+
) && t.push(
|
|
2713
|
+
r(
|
|
2714
|
+
"invalid_measure_list",
|
|
2715
|
+
"Metric intent measures must be an array of field references with names.",
|
|
2716
|
+
"measures"
|
|
2717
|
+
)
|
|
2718
|
+
), l.forEach((n, o) => {
|
|
2719
|
+
_(n, `measures.${o}`, t, {
|
|
2720
|
+
required: !0
|
|
2721
|
+
});
|
|
2722
|
+
}), l.length > 0 && !ea(l)) {
|
|
2723
|
+
const n = l.find(
|
|
2724
|
+
(o, d) => l.some(
|
|
2725
|
+
(p, m) => m !== d && _t(p, o)
|
|
2726
|
+
)
|
|
2727
|
+
);
|
|
2728
|
+
n && t.push(
|
|
2729
|
+
r(
|
|
2730
|
+
"duplicate_measure",
|
|
2731
|
+
ta(n),
|
|
2732
|
+
"measures"
|
|
2733
|
+
)
|
|
2734
|
+
);
|
|
2735
|
+
}
|
|
2736
|
+
if (f(e.primaryMeasure) && c(e.primaryMeasure.name) && _e(
|
|
2737
|
+
e.primaryMeasure,
|
|
2738
|
+
l
|
|
2739
|
+
).length > 1 && t.push(
|
|
2740
|
+
r(
|
|
2741
|
+
"ambiguous_primary_measure",
|
|
2742
|
+
"Metric intent primaryMeasure must identify exactly one selected measure.",
|
|
2743
|
+
"primaryMeasure"
|
|
2744
|
+
)
|
|
2745
|
+
), e.primaryMeasure !== void 0 && (_(e.primaryMeasure, "primaryMeasure", t, {
|
|
2746
|
+
required: !0
|
|
2747
|
+
}), f(e.primaryMeasure) && c(e.primaryMeasure.name) && l.length > 0 && !aa(
|
|
2748
|
+
e.primaryMeasure,
|
|
2749
|
+
l
|
|
2750
|
+
) && t.push(
|
|
2751
|
+
r(
|
|
2752
|
+
"invalid_primary_measure",
|
|
2753
|
+
"Metric intent primaryMeasure must match one measure field reference.",
|
|
2754
|
+
"primaryMeasure"
|
|
2755
|
+
)
|
|
2756
|
+
)), e.dimensions !== void 0 && !Array.isArray(e.dimensions) ? t.push(
|
|
2757
|
+
r(
|
|
2758
|
+
"invalid_measure_dimensions",
|
|
2759
|
+
"Metric intent dimensions must be an array of field references.",
|
|
2760
|
+
"dimensions"
|
|
2761
|
+
)
|
|
2762
|
+
) : Array.isArray(e.dimensions) && e.dimensions.some(
|
|
2763
|
+
(n) => !f(n) || !c(n.name)
|
|
2764
|
+
) && t.push(
|
|
2765
|
+
r(
|
|
2766
|
+
"invalid_measure_dimensions",
|
|
2767
|
+
"Metric intent dimensions must be an array of field references with names.",
|
|
2768
|
+
"dimensions"
|
|
2769
|
+
)
|
|
2770
|
+
), e.dateField !== void 0 && _(e.dateField, "dateField", t), e.timeWindow !== void 0 && (ae(e.timeWindow, "timeWindow", t), e.dateField || t.push(
|
|
2771
|
+
r(
|
|
2772
|
+
"missing_time_window_date_field",
|
|
2773
|
+
"Metric timeWindow needs a dateField.",
|
|
2774
|
+
"dateField"
|
|
2775
|
+
)
|
|
2776
|
+
)), ne(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((n, o) => {
|
|
2777
|
+
_(n, `dimensions.${o}`, t);
|
|
2778
|
+
}), e.orderBy !== void 0) {
|
|
2779
|
+
if (!f(e.orderBy))
|
|
2780
|
+
t.push(
|
|
2781
|
+
r(
|
|
2782
|
+
"invalid_measure_order_by",
|
|
2783
|
+
"Metric intent orderBy must be a structured object.",
|
|
2784
|
+
"orderBy"
|
|
2785
|
+
)
|
|
2786
|
+
);
|
|
2787
|
+
else if (_(e.orderBy.field, "orderBy.field", t, {
|
|
2788
|
+
required: !0
|
|
2789
|
+
}), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
|
|
2790
|
+
r(
|
|
2791
|
+
"invalid_measure_order_direction",
|
|
2792
|
+
"Metric intent orderBy direction must be asc or desc.",
|
|
2793
|
+
"orderBy.direction"
|
|
2794
|
+
)
|
|
2795
|
+
), f(e.orderBy.field) && c(e.orderBy.field.name)) {
|
|
2796
|
+
const n = [
|
|
2797
|
+
...l,
|
|
2798
|
+
...e.timeGrain && e.dateField && f(e.dateField) ? [e.dateField] : [],
|
|
2799
|
+
...Array.isArray(e.dimensions) ? e.dimensions.filter(
|
|
2800
|
+
(o) => f(o) && c(o.name)
|
|
2801
|
+
) : []
|
|
2802
|
+
];
|
|
2803
|
+
n.length > 0 && !na(
|
|
2804
|
+
e.orderBy.field,
|
|
2805
|
+
n
|
|
2806
|
+
) && t.push(
|
|
2807
|
+
r(
|
|
2808
|
+
"invalid_measure_order_by",
|
|
2809
|
+
"Metric intent orderBy.field must match one selected measure, grouped dateField, or dimension.",
|
|
2810
|
+
"orderBy.field"
|
|
2811
|
+
)
|
|
2812
|
+
);
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
ba(e, t);
|
|
2816
|
+
} else if (e.kind === "records") {
|
|
2817
|
+
if (!Array.isArray(e.fields) || e.fields.length === 0 ? t.push(
|
|
2818
|
+
r(
|
|
2819
|
+
"missing_record_fields",
|
|
2820
|
+
"Records intent needs at least one field.",
|
|
2821
|
+
"fields"
|
|
2822
|
+
)
|
|
2823
|
+
) : e.fields.some(
|
|
2824
|
+
(l) => !f(l) || !c(l.name)
|
|
2825
|
+
) && t.push(
|
|
2826
|
+
r(
|
|
2827
|
+
"invalid_record_fields",
|
|
2828
|
+
"Records intent fields must be field references with names.",
|
|
2829
|
+
"fields"
|
|
2830
|
+
)
|
|
2831
|
+
), Array.isArray(e.fields) && e.fields.forEach((l, n) => {
|
|
2832
|
+
_(l, `fields.${n}`, t);
|
|
2833
|
+
}), e.dateField !== void 0 && _(e.dateField, "dateField", t), Ne(e.pagination, "pagination", t), e.timeWindow !== void 0 && (ae(e.timeWindow, "timeWindow", t), e.dateField || t.push(
|
|
2834
|
+
r(
|
|
2835
|
+
"missing_time_window_date_field",
|
|
2836
|
+
"Records timeWindow needs a dateField.",
|
|
2837
|
+
"dateField"
|
|
2838
|
+
)
|
|
2839
|
+
)), ne(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((l, n) => {
|
|
2840
|
+
f(l) && l.scope === "aggregate" && t.push(
|
|
2841
|
+
r(
|
|
2842
|
+
"unsupported_record_filter_scope",
|
|
2843
|
+
"Records intents support row-scope filters only. Use a metric intent for aggregate-scope filters.",
|
|
2844
|
+
`filters.${n}.scope`
|
|
2845
|
+
)
|
|
2846
|
+
);
|
|
2847
|
+
}), e.orderBy !== void 0 && (f(e.orderBy) ? (_(e.orderBy.field, "orderBy.field", t, {
|
|
2848
|
+
required: !0
|
|
2849
|
+
}), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
|
|
2850
|
+
r(
|
|
2851
|
+
"invalid_record_order_direction",
|
|
2852
|
+
"Records intent orderBy direction must be asc or desc.",
|
|
2853
|
+
"orderBy.direction"
|
|
2854
|
+
)
|
|
2855
|
+
)) : t.push(
|
|
2856
|
+
r(
|
|
2857
|
+
"invalid_record_order_by",
|
|
2858
|
+
"Records intent orderBy must be a structured object.",
|
|
2859
|
+
"orderBy"
|
|
2860
|
+
)
|
|
2861
|
+
)), e.totals !== void 0)
|
|
2862
|
+
if (!f(e.totals))
|
|
2863
|
+
t.push(
|
|
2864
|
+
r(
|
|
2865
|
+
"invalid_records_totals",
|
|
2866
|
+
"Records totals must be a structured server totals request.",
|
|
2867
|
+
"totals"
|
|
2868
|
+
)
|
|
2869
|
+
);
|
|
2870
|
+
else {
|
|
2871
|
+
e.totals.mode !== "server" && t.push(
|
|
2872
|
+
r(
|
|
2873
|
+
"invalid_records_totals",
|
|
2874
|
+
"Records totals mode must be server.",
|
|
2875
|
+
"totals.mode"
|
|
2876
|
+
)
|
|
2877
|
+
);
|
|
2878
|
+
const l = e.totals.measures;
|
|
2879
|
+
!Array.isArray(l) || l.length === 0 ? t.push(
|
|
2880
|
+
r(
|
|
2881
|
+
"missing_records_totals_measures",
|
|
2882
|
+
"Records server totals need at least one measure.",
|
|
2883
|
+
"totals.measures"
|
|
2884
|
+
)
|
|
2885
|
+
) : l.forEach((n, o) => {
|
|
2886
|
+
_(n, `totals.measures.${o}`, t, {
|
|
2887
|
+
required: !0
|
|
2888
|
+
}), (!f(n) || n.role !== "measure") && t.push(
|
|
2889
|
+
r(
|
|
2890
|
+
"invalid_records_totals_measure",
|
|
2891
|
+
"Records server totals measures must be measure field references.",
|
|
2892
|
+
`totals.measures.${o}.role`
|
|
2893
|
+
)
|
|
2894
|
+
);
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
} else e.kind === "inputOptions" ? ca(e, t) : e.kind === "sql" ? (((s = e.source) == null ? void 0 : s.kind) !== "sql" && t.push(
|
|
2898
|
+
r(
|
|
2899
|
+
"invalid_sql_source",
|
|
2900
|
+
"SQL analytics intent must use a SQL execution source.",
|
|
2901
|
+
"source"
|
|
2902
|
+
)
|
|
2903
|
+
), c(e.sql) || t.push(
|
|
2904
|
+
r("missing_sql", "SQL analytics intent needs SQL text.", "sql")
|
|
2905
|
+
), ia(
|
|
2906
|
+
e.defaultParameters,
|
|
2907
|
+
"defaultParameters",
|
|
2908
|
+
t
|
|
2909
|
+
), Array.isArray(e.fields) && e.fields.forEach((l, n) => {
|
|
2910
|
+
_(l, `fields.${n}`, t);
|
|
2911
|
+
}), Ne(e.pagination, "pagination", t)) : t.push(
|
|
2912
|
+
r(
|
|
2913
|
+
"invalid_analytics_kind",
|
|
2914
|
+
"Analytics kind is not supported.",
|
|
2915
|
+
"kind"
|
|
2916
|
+
)
|
|
2917
|
+
);
|
|
2918
|
+
return {
|
|
2919
|
+
ok: t.length === 0,
|
|
2920
|
+
errors: t,
|
|
2921
|
+
warnings: i,
|
|
2922
|
+
repairHints: Ce(t)
|
|
2923
|
+
};
|
|
2924
|
+
}
|
|
2925
|
+
function wa(e, t) {
|
|
2926
|
+
if (!(!("derivedFields" in e) || e.derivedFields === void 0)) {
|
|
2927
|
+
if (!Array.isArray(e.derivedFields)) {
|
|
2928
|
+
t.push(
|
|
2929
|
+
r(
|
|
2930
|
+
"invalid_derived_fields",
|
|
2931
|
+
"Analytics intent derivedFields must be an array of derived field definitions.",
|
|
2932
|
+
"derivedFields"
|
|
2933
|
+
)
|
|
2934
|
+
);
|
|
2935
|
+
return;
|
|
2936
|
+
}
|
|
2937
|
+
e.derivedFields.forEach((i, s) => {
|
|
2938
|
+
oe(
|
|
2939
|
+
i
|
|
2940
|
+
).errors.forEach((n) => {
|
|
2941
|
+
t.push({
|
|
2942
|
+
...n,
|
|
2943
|
+
path: n.path ? `derivedFields.${s}.${n.path}` : `derivedFields.${s}`
|
|
2944
|
+
});
|
|
2945
|
+
});
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
function Aa(e) {
|
|
2950
|
+
const t = [], i = [];
|
|
2951
|
+
if (!e || typeof e != "object")
|
|
2952
|
+
return {
|
|
2953
|
+
ok: !1,
|
|
2954
|
+
errors: [
|
|
2955
|
+
r(
|
|
2956
|
+
"invalid_operation_intent",
|
|
2957
|
+
"Operation intent must be a structured object."
|
|
2958
|
+
)
|
|
2959
|
+
],
|
|
2960
|
+
warnings: i,
|
|
2961
|
+
repairHints: [
|
|
2962
|
+
{
|
|
2963
|
+
code: "invalid_operation_intent",
|
|
2964
|
+
recommendedNextStep: "Send one typed operation intent with version, kind, and required operation fields."
|
|
2965
|
+
}
|
|
2966
|
+
]
|
|
2967
|
+
};
|
|
2968
|
+
if (e.version !== 1 && t.push(
|
|
2969
|
+
r(
|
|
2970
|
+
"invalid_version",
|
|
2971
|
+
"Operation intent version must be 1.",
|
|
2972
|
+
"version"
|
|
2973
|
+
)
|
|
2974
|
+
), e.kind === "answer_obligations")
|
|
2975
|
+
!Array.isArray(e.obligations) || e.obligations.length === 0 ? t.push(
|
|
2976
|
+
r(
|
|
2977
|
+
"missing_obligations",
|
|
2978
|
+
"Answer-obligations operation intent needs at least one obligation.",
|
|
2979
|
+
"obligations"
|
|
2980
|
+
)
|
|
2981
|
+
) : e.obligations.forEach((s, l) => {
|
|
2982
|
+
c(s.id) || t.push(
|
|
2983
|
+
r(
|
|
2984
|
+
"missing_obligation_id",
|
|
2985
|
+
"Each analytics obligation needs an id.",
|
|
2986
|
+
`obligations.${l}.id`
|
|
2987
|
+
)
|
|
2988
|
+
), c(s.prompt) || t.push(
|
|
2989
|
+
r(
|
|
2990
|
+
"missing_obligation_prompt",
|
|
2991
|
+
"Each analytics obligation needs a prompt.",
|
|
2992
|
+
`obligations.${l}.prompt`
|
|
2993
|
+
)
|
|
2994
|
+
);
|
|
2995
|
+
});
|
|
2996
|
+
else if (e.kind === "dashboard_change") {
|
|
2997
|
+
if (c(e.instruction) || t.push(
|
|
2998
|
+
r(
|
|
2999
|
+
"missing_instruction",
|
|
3000
|
+
"Change operation intent needs an instruction.",
|
|
3001
|
+
"instruction"
|
|
3002
|
+
)
|
|
3003
|
+
), e.analyticsIntent) {
|
|
3004
|
+
const s = bt(
|
|
3005
|
+
e.analyticsIntent
|
|
3006
|
+
);
|
|
3007
|
+
t.push(...s.errors), i.push(...s.warnings);
|
|
3008
|
+
}
|
|
3009
|
+
} else
|
|
3010
|
+
t.push(
|
|
3011
|
+
r(
|
|
3012
|
+
"invalid_operation_kind",
|
|
3013
|
+
"Operation intent kind is not supported.",
|
|
3014
|
+
"kind"
|
|
3015
|
+
)
|
|
3016
|
+
);
|
|
3017
|
+
return {
|
|
3018
|
+
ok: t.length === 0,
|
|
3019
|
+
errors: t,
|
|
3020
|
+
warnings: i,
|
|
3021
|
+
repairHints: vt(t)
|
|
3022
|
+
};
|
|
3023
|
+
}
|
|
3024
|
+
function vn(e) {
|
|
3025
|
+
const t = [], i = [];
|
|
3026
|
+
if (!e || typeof e != "object")
|
|
3027
|
+
return {
|
|
3028
|
+
ok: !1,
|
|
3029
|
+
errors: [
|
|
3030
|
+
r(
|
|
3031
|
+
"invalid_recovery_plan",
|
|
3032
|
+
"Analytics recovery plan must be a structured object."
|
|
3033
|
+
)
|
|
3034
|
+
],
|
|
3035
|
+
warnings: i,
|
|
3036
|
+
repairHints: [
|
|
3037
|
+
{
|
|
3038
|
+
code: "invalid_recovery_plan",
|
|
3039
|
+
recommendedNextStep: "Return a typed recovery plan with operationIntent and plannedToolCalls."
|
|
3040
|
+
}
|
|
3041
|
+
]
|
|
3042
|
+
};
|
|
3043
|
+
e.version !== 1 && t.push(
|
|
3044
|
+
r("invalid_version", "Recovery plan version must be 1.", "version")
|
|
3045
|
+
), e.kind !== "analytics_recovery_plan" && t.push(
|
|
3046
|
+
r(
|
|
3047
|
+
"invalid_recovery_plan_kind",
|
|
3048
|
+
"Recovery plan kind must be analytics_recovery_plan.",
|
|
3049
|
+
"kind"
|
|
3050
|
+
)
|
|
3051
|
+
);
|
|
3052
|
+
const s = Aa(
|
|
3053
|
+
e.operationIntent
|
|
3054
|
+
);
|
|
3055
|
+
return t.push(...s.errors), i.push(...s.warnings), Array.isArray(e.plannedToolCalls) || t.push(
|
|
3056
|
+
r(
|
|
3057
|
+
"invalid_planned_tool_calls",
|
|
3058
|
+
"Recovery plan plannedToolCalls must be an array.",
|
|
3059
|
+
"plannedToolCalls"
|
|
3060
|
+
)
|
|
3061
|
+
), {
|
|
3062
|
+
ok: t.length === 0,
|
|
3063
|
+
errors: t,
|
|
3064
|
+
warnings: i,
|
|
3065
|
+
repairHints: vt(t)
|
|
3066
|
+
};
|
|
3067
|
+
}
|
|
3068
|
+
function vt(e) {
|
|
3069
|
+
return e.map((t) => ({
|
|
3070
|
+
code: t.code,
|
|
3071
|
+
recommendedNextStep: t.code === "missing_obligations" ? "Normalize the user request into one or more typed analytics obligations before recovery planning." : "Correct the operation/recovery contract shape before planning execution."
|
|
3072
|
+
}));
|
|
3073
|
+
}
|
|
3074
|
+
function Ce(e) {
|
|
3075
|
+
return e.map((t) => {
|
|
3076
|
+
switch (t.code) {
|
|
3077
|
+
case "invalid_matrix_intent":
|
|
3078
|
+
return {
|
|
3079
|
+
code: t.code,
|
|
3080
|
+
recommendedNextStep: `Correct MatrixSpec at ${t.path || "the definition"}: ${t.message} Keep presentation and matrixWindowRequest outside the intent.`
|
|
3081
|
+
};
|
|
3082
|
+
case "missing_source":
|
|
3083
|
+
return {
|
|
3084
|
+
code: t.code,
|
|
3085
|
+
fieldRole: "source",
|
|
3086
|
+
recommendedNextStep: "Provide a semantic, physical, or SQL source before executing analytics."
|
|
3087
|
+
};
|
|
3088
|
+
case "missing_measure":
|
|
3089
|
+
return {
|
|
3090
|
+
code: t.code,
|
|
3091
|
+
fieldRole: "measure",
|
|
3092
|
+
recommendedNextStep: "Choose one exact measure from the grounded schema candidates."
|
|
3093
|
+
};
|
|
3094
|
+
case "missing_record_fields":
|
|
3095
|
+
return {
|
|
3096
|
+
code: t.code,
|
|
3097
|
+
fieldRole: "dimension",
|
|
3098
|
+
recommendedNextStep: "Provide at least one field for the records intent."
|
|
3099
|
+
};
|
|
3100
|
+
case "missing_matrix_rows":
|
|
3101
|
+
return {
|
|
3102
|
+
code: t.code,
|
|
3103
|
+
fieldRole: "dimension",
|
|
3104
|
+
recommendedNextStep: "Choose at least one row axis level for the matrix table."
|
|
3105
|
+
};
|
|
3106
|
+
case "missing_matrix_values":
|
|
3107
|
+
return {
|
|
3108
|
+
code: t.code,
|
|
3109
|
+
fieldRole: "measure",
|
|
3110
|
+
recommendedNextStep: "Choose at least one value field for the matrix table."
|
|
3111
|
+
};
|
|
3112
|
+
case "unsupported_matrix_sql_source":
|
|
3113
|
+
return {
|
|
3114
|
+
code: t.code,
|
|
3115
|
+
fieldRole: "source",
|
|
3116
|
+
recommendedNextStep: "Use a semantic or explorer-backed source for matrix tables; raw SQL matrix tables are not supported."
|
|
3117
|
+
};
|
|
3118
|
+
case "missing_input_options_input_id":
|
|
3119
|
+
return {
|
|
3120
|
+
code: t.code,
|
|
3121
|
+
fieldRole: "input",
|
|
3122
|
+
recommendedNextStep: "Provide the inputId that these option values populate."
|
|
3123
|
+
};
|
|
3124
|
+
case "missing_input_options_label_field":
|
|
3125
|
+
return {
|
|
3126
|
+
code: t.code,
|
|
3127
|
+
fieldRole: "dimension",
|
|
3128
|
+
recommendedNextStep: "Provide the human-readable field used as option labels."
|
|
3129
|
+
};
|
|
3130
|
+
case "missing_input_options_value_field":
|
|
3131
|
+
return {
|
|
3132
|
+
code: t.code,
|
|
3133
|
+
fieldRole: "dimension",
|
|
3134
|
+
recommendedNextStep: "Provide the stable field used as option values."
|
|
3135
|
+
};
|
|
3136
|
+
case "missing_sql":
|
|
3137
|
+
return {
|
|
3138
|
+
code: t.code,
|
|
3139
|
+
fieldRole: "sql",
|
|
3140
|
+
recommendedNextStep: "Provide bounded read-only SQL with an explicit outer LIMIT."
|
|
3141
|
+
};
|
|
3142
|
+
case "conflicting_sql":
|
|
3143
|
+
return {
|
|
3144
|
+
code: t.code,
|
|
3145
|
+
fieldRole: "sql",
|
|
3146
|
+
recommendedNextStep: "Use one canonical SQL text location for the intent; prefer top-level sql."
|
|
3147
|
+
};
|
|
3148
|
+
case "missing_semantic_domain":
|
|
3149
|
+
case "missing_dataset_name":
|
|
3150
|
+
case "missing_connection_id":
|
|
3151
|
+
case "missing_table_name":
|
|
3152
|
+
return {
|
|
3153
|
+
code: t.code,
|
|
3154
|
+
fieldRole: "source",
|
|
3155
|
+
recommendedNextStep: "Use grounded catalog metadata to fill the missing source reference."
|
|
3156
|
+
};
|
|
3157
|
+
default:
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
3160
|
+
}).filter((t) => !!t);
|
|
3161
|
+
}
|
|
3162
|
+
function xa(e, t, i, s) {
|
|
3163
|
+
if (!e || typeof e != "object") {
|
|
3164
|
+
i.push(
|
|
3165
|
+
r("invalid_view", "Dashboard view must be an object.", t)
|
|
3166
|
+
);
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3169
|
+
if (c(e.title) || i.push(
|
|
3170
|
+
r("missing_view_title", "Dashboard view needs a title.", t)
|
|
3171
|
+
), !e.presentation || typeof e.presentation != "object") {
|
|
3172
|
+
i.push(
|
|
3173
|
+
r(
|
|
3174
|
+
"missing_presentation",
|
|
3175
|
+
"Dashboard view needs a presentation.",
|
|
3176
|
+
`${t}.presentation`
|
|
3177
|
+
)
|
|
3178
|
+
);
|
|
3179
|
+
return;
|
|
3180
|
+
}
|
|
3181
|
+
if (e.presentation.kind === "text") {
|
|
3182
|
+
c(e.text) || s.push(
|
|
3183
|
+
r(
|
|
3184
|
+
"missing_text_content",
|
|
3185
|
+
"Text views should include text content.",
|
|
3186
|
+
`${t}.text`
|
|
3187
|
+
)
|
|
3188
|
+
);
|
|
3189
|
+
return;
|
|
3190
|
+
}
|
|
3191
|
+
if (!e.analytics) {
|
|
3192
|
+
i.push(
|
|
3193
|
+
r(
|
|
3194
|
+
"missing_view_analytics",
|
|
3195
|
+
"Non-text dashboard views need analytics intent.",
|
|
3196
|
+
`${t}.analytics`
|
|
3197
|
+
)
|
|
3198
|
+
);
|
|
3199
|
+
return;
|
|
3200
|
+
}
|
|
3201
|
+
e.presentation.kind === "matrixTable" && e.analytics.kind !== "matrix" && i.push(
|
|
3202
|
+
r(
|
|
3203
|
+
"invalid_matrix_view_analytics",
|
|
3204
|
+
"Matrix table views need matrix analytics intent.",
|
|
3205
|
+
`${t}.analytics.kind`
|
|
3206
|
+
)
|
|
3207
|
+
);
|
|
3208
|
+
const l = bt(e.analytics);
|
|
3209
|
+
for (const n of l.errors)
|
|
3210
|
+
i.push(
|
|
3211
|
+
r(
|
|
3212
|
+
n.code,
|
|
3213
|
+
n.message,
|
|
3214
|
+
`${t}.analytics${n.path ? `.${n.path}` : ""}`
|
|
3215
|
+
)
|
|
3216
|
+
);
|
|
3217
|
+
for (const n of l.warnings)
|
|
3218
|
+
s.push(
|
|
3219
|
+
r(
|
|
3220
|
+
n.code,
|
|
3221
|
+
n.message,
|
|
3222
|
+
`${t}.analytics${n.path ? `.${n.path}` : ""}`
|
|
3223
|
+
)
|
|
3224
|
+
);
|
|
3225
|
+
}
|
|
3226
|
+
function In(e) {
|
|
3227
|
+
const t = [], i = [];
|
|
3228
|
+
if (!e || typeof e != "object")
|
|
3229
|
+
return {
|
|
3230
|
+
ok: !1,
|
|
3231
|
+
errors: [
|
|
3232
|
+
r(
|
|
3233
|
+
"invalid_dashboard_intent",
|
|
3234
|
+
"Dashboard intent must be a structured object."
|
|
3235
|
+
)
|
|
3236
|
+
],
|
|
3237
|
+
warnings: i
|
|
3238
|
+
};
|
|
3239
|
+
e.version !== 1 && t.push(
|
|
3240
|
+
r("invalid_version", "Dashboard intent version must be 1.")
|
|
3241
|
+
), e.kind !== "dashboard" && t.push(
|
|
3242
|
+
r("invalid_kind", "Experience intent kind must be dashboard.")
|
|
3243
|
+
), c(e.title) || t.push(
|
|
3244
|
+
r("missing_title", "Dashboard intent needs a title.", "title")
|
|
3245
|
+
);
|
|
3246
|
+
const s = Array.isArray(e.inputs) ? e.inputs : [], l = Re(
|
|
3247
|
+
s.filter(f).map((p) => p.id).filter((p) => typeof p == "string")
|
|
3248
|
+
);
|
|
3249
|
+
l && t.push(
|
|
3250
|
+
r(
|
|
3251
|
+
"duplicate_input_id",
|
|
3252
|
+
`Duplicate input id: ${l}.`,
|
|
3253
|
+
"inputs"
|
|
3254
|
+
)
|
|
3255
|
+
);
|
|
3256
|
+
for (const [p, m] of s.entries()) {
|
|
3257
|
+
const u = `inputs.${p}`;
|
|
3258
|
+
if (!f(m)) {
|
|
3259
|
+
t.push(
|
|
3260
|
+
r("invalid_input", "Dashboard input must be an object.", u)
|
|
3261
|
+
);
|
|
3262
|
+
continue;
|
|
3263
|
+
}
|
|
3264
|
+
c(m.id) || t.push(
|
|
3265
|
+
r("missing_input_id", "Input needs an id.", `${u}.id`)
|
|
3266
|
+
), c(m.label) || t.push(
|
|
3267
|
+
r("missing_input_label", "Input needs a label.", `${u}.label`)
|
|
3268
|
+
), !m.field || !c(m.field.name) ? t.push(
|
|
3269
|
+
r("missing_input_field", "Input needs a field.", `${u}.field`)
|
|
3270
|
+
) : _(m.field, `${u}.field`, t);
|
|
3271
|
+
}
|
|
3272
|
+
const n = Array.isArray(e.sections) ? e.sections : [];
|
|
3273
|
+
n.length === 0 && t.push(
|
|
3274
|
+
r(
|
|
3275
|
+
"missing_sections",
|
|
3276
|
+
"Dashboard intent needs at least one section.",
|
|
3277
|
+
"sections"
|
|
3278
|
+
)
|
|
3279
|
+
);
|
|
3280
|
+
const o = n.flatMap(
|
|
3281
|
+
(p) => p && typeof p == "object" && Array.isArray(p.views) ? p.views.filter(f).map((m) => m.id).filter((m) => !!m) : []
|
|
3282
|
+
), d = Re(o);
|
|
3283
|
+
d && t.push(
|
|
3284
|
+
r(
|
|
3285
|
+
"duplicate_view_id",
|
|
3286
|
+
`Duplicate dashboard view id: ${d}.`,
|
|
3287
|
+
"sections"
|
|
3288
|
+
)
|
|
3289
|
+
);
|
|
3290
|
+
for (const [p, m] of n.entries()) {
|
|
3291
|
+
const u = `sections.${p}`;
|
|
3292
|
+
if (!m || typeof m != "object") {
|
|
3293
|
+
t.push(
|
|
3294
|
+
r(
|
|
3295
|
+
"invalid_section",
|
|
3296
|
+
"Dashboard section must be an object.",
|
|
3297
|
+
u
|
|
3298
|
+
)
|
|
3299
|
+
);
|
|
3300
|
+
continue;
|
|
3301
|
+
}
|
|
3302
|
+
if (c(m.title) || t.push(
|
|
3303
|
+
r(
|
|
3304
|
+
"missing_section_title",
|
|
3305
|
+
"Dashboard section needs a title.",
|
|
3306
|
+
u
|
|
3307
|
+
)
|
|
3308
|
+
), !Array.isArray(m.views) || m.views.length === 0) {
|
|
3309
|
+
t.push(
|
|
3310
|
+
r(
|
|
3311
|
+
"missing_section_views",
|
|
3312
|
+
"Dashboard section needs at least one view.",
|
|
3313
|
+
`${u}.views`
|
|
3314
|
+
)
|
|
3315
|
+
);
|
|
3316
|
+
continue;
|
|
3317
|
+
}
|
|
3318
|
+
for (const [g, y] of m.views.entries())
|
|
3319
|
+
xa(
|
|
3320
|
+
y,
|
|
3321
|
+
`${u}.views.${g}`,
|
|
3322
|
+
t,
|
|
3323
|
+
i
|
|
3324
|
+
);
|
|
3325
|
+
}
|
|
3326
|
+
return { ok: t.length === 0, errors: t, warnings: i };
|
|
3327
|
+
}
|
|
3328
|
+
export {
|
|
3329
|
+
ge as $,
|
|
3330
|
+
mi as A,
|
|
3331
|
+
Xa as B,
|
|
3332
|
+
Z as C,
|
|
3333
|
+
di as D,
|
|
3334
|
+
mn as E,
|
|
3335
|
+
Ja as F,
|
|
3336
|
+
fn as G,
|
|
3337
|
+
te as H,
|
|
3338
|
+
st as I,
|
|
3339
|
+
La as J,
|
|
3340
|
+
me as K,
|
|
3341
|
+
oi as L,
|
|
3342
|
+
Di as M,
|
|
3343
|
+
rt as N,
|
|
3344
|
+
ee as O,
|
|
3345
|
+
ot as P,
|
|
3346
|
+
ri as Q,
|
|
3347
|
+
A as R,
|
|
3348
|
+
Ba as S,
|
|
3349
|
+
Ni as T,
|
|
3350
|
+
lt as U,
|
|
3351
|
+
$i as V,
|
|
3352
|
+
Ci as W,
|
|
3353
|
+
ut as X,
|
|
3354
|
+
j as Y,
|
|
3355
|
+
xe as Z,
|
|
3356
|
+
qi as _,
|
|
3357
|
+
gt as a,
|
|
3358
|
+
Oa as a$,
|
|
3359
|
+
De as a0,
|
|
3360
|
+
H as a1,
|
|
3361
|
+
Ui as a2,
|
|
3362
|
+
dn as a3,
|
|
3363
|
+
cn as a4,
|
|
3364
|
+
le as a5,
|
|
3365
|
+
Mt as a6,
|
|
3366
|
+
Et as a7,
|
|
3367
|
+
ie as a8,
|
|
3368
|
+
ma as a9,
|
|
3369
|
+
F as aA,
|
|
3370
|
+
mt as aB,
|
|
3371
|
+
he as aC,
|
|
3372
|
+
ft as aD,
|
|
3373
|
+
hn as aE,
|
|
3374
|
+
bi as aF,
|
|
3375
|
+
Ii as aG,
|
|
3376
|
+
Tt as aH,
|
|
3377
|
+
Ma as aI,
|
|
3378
|
+
Nt as aJ,
|
|
3379
|
+
Rt as aK,
|
|
3380
|
+
Ea as aL,
|
|
3381
|
+
$t as aM,
|
|
3382
|
+
M as aN,
|
|
3383
|
+
Ct as aO,
|
|
3384
|
+
Ta as aP,
|
|
3385
|
+
Yt as aQ,
|
|
3386
|
+
Na as aR,
|
|
3387
|
+
Ot as aS,
|
|
3388
|
+
Ge as aT,
|
|
3389
|
+
ni as aU,
|
|
3390
|
+
si as aV,
|
|
3391
|
+
Pa as aW,
|
|
3392
|
+
qa as aX,
|
|
3393
|
+
R as aY,
|
|
3394
|
+
Ca as aZ,
|
|
3395
|
+
L as a_,
|
|
3396
|
+
bn as aa,
|
|
3397
|
+
bt as ab,
|
|
3398
|
+
Aa as ac,
|
|
3399
|
+
vn as ad,
|
|
3400
|
+
In as ae,
|
|
3401
|
+
oe as af,
|
|
3402
|
+
ue as ag,
|
|
3403
|
+
Kt as ah,
|
|
3404
|
+
Xt as ai,
|
|
3405
|
+
ce as aj,
|
|
3406
|
+
ti as ak,
|
|
3407
|
+
ii as al,
|
|
3408
|
+
He as am,
|
|
3409
|
+
Ve as an,
|
|
3410
|
+
Se as ao,
|
|
3411
|
+
ze as ap,
|
|
3412
|
+
Ra as aq,
|
|
3413
|
+
$a as ar,
|
|
3414
|
+
Xe as as,
|
|
3415
|
+
fe as at,
|
|
3416
|
+
Wa as au,
|
|
3417
|
+
en as av,
|
|
3418
|
+
nn as aw,
|
|
3419
|
+
sn as ax,
|
|
3420
|
+
rn as ay,
|
|
3421
|
+
pn as az,
|
|
3422
|
+
Va as b,
|
|
3423
|
+
Ya as b0,
|
|
3424
|
+
Yi as b1,
|
|
3425
|
+
ja as b2,
|
|
3426
|
+
de as b3,
|
|
3427
|
+
qt as b4,
|
|
3428
|
+
Ae as b5,
|
|
3429
|
+
ui as c,
|
|
3430
|
+
Ke as d,
|
|
3431
|
+
za as e,
|
|
3432
|
+
Ga as f,
|
|
3433
|
+
li as g,
|
|
3434
|
+
Qa as h,
|
|
3435
|
+
Ha as i,
|
|
3436
|
+
Ka as j,
|
|
3437
|
+
J as k,
|
|
3438
|
+
un as l,
|
|
3439
|
+
Pi as m,
|
|
3440
|
+
Ua as n,
|
|
3441
|
+
Qi as o,
|
|
3442
|
+
_n as p,
|
|
3443
|
+
gn as q,
|
|
3444
|
+
yn as r,
|
|
3445
|
+
Ji as s,
|
|
3446
|
+
Qe as t,
|
|
3447
|
+
on as u,
|
|
3448
|
+
ln as v,
|
|
3449
|
+
tn as w,
|
|
3450
|
+
an as x,
|
|
3451
|
+
Za as y,
|
|
3452
|
+
ci as z
|
|
3453
|
+
};
|