react-semaphor 0.1.596 → 0.1.598
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 +329 -322
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +7 -7
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/{aggregate-measure-field-DHlDj0Pc.js → aggregate-measure-field-DtKcEjG5.js} +2 -2
- package/dist/chunks/{assistant-chat-DodZKMI6.js → assistant-chat-DrI442Ld.js} +13 -13
- package/dist/chunks/{bookmark-impact-Dh-wiTs3.js → bookmark-impact-C6uWtNWF.js} +3 -3
- package/dist/chunks/{bookmark-state-Be2W3s6t.js → bookmark-state-BfeKmj5s.js} +4 -4
- package/dist/chunks/{card-filter-builder-BZIj-ib3.js → card-filter-builder-CSKCSpNo.js} +58 -58
- package/dist/chunks/{comparison-window-caption-DmMFtNP5.js → comparison-window-caption-3bum5j00.js} +5 -5
- package/dist/chunks/{dashboard-BCd8aKDN.js → dashboard-PYd63LbL.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CE_z5Gh1.js → dashboard-briefing-launcher-C2AuKs10.js} +1157 -1152
- package/dist/chunks/{dashboard-controls-IG2KRX1y.js → dashboard-controls-BSbhyIkY.js} +15 -15
- package/dist/chunks/{dashboard-json-o-XrNqNW.js → dashboard-json-Bd1rxD3y.js} +4 -4
- package/dist/chunks/{dates-B-bKEsiu.js → dates-DHMCf-F7.js} +8 -8
- package/dist/chunks/{edit-dashboard-visual-HPTVtWGk.js → edit-dashboard-visual-D_0ZiWev.js} +498 -496
- package/dist/chunks/{filter-line-BpdPq1D2.js → filter-line-BdLyPYjH.js} +5 -5
- package/dist/chunks/{filter-reach-copy-DoXmRmk-.js → filter-reach-copy-Dxn-mTuG.js} +1301 -1222
- package/dist/chunks/{filter-value-text-CDQCIREQ.js → filter-value-text-C6g-nDUW.js} +4 -4
- package/dist/chunks/{index-C0jX5wlM.js → index-BHSDE54O.js} +5 -5
- package/dist/chunks/{layout-grid-DoFIfQGd.js → layout-grid-CYR-LVpl.js} +1 -1
- package/dist/chunks/{list-filter-BeTQxjNy.js → list-filter-B67GsjTw.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-CyWOwLmE.js → matrix-analytical-definition-C0IGLTZH.js} +21 -21
- package/dist/chunks/matrix-member-presentation-D5BIYuy5.js +258 -0
- package/dist/chunks/{matrix-operation-contract-CAanJeCj.js → matrix-operation-contract-RckfqkQm.js} +15 -15
- package/dist/chunks/{metric-comparison-BeKnUD08.js → metric-comparison-DsE8wdRh.js} +1 -1
- package/dist/chunks/{paintbrush-KeaU1L1a.js → paintbrush-xDDRjIyF.js} +1 -1
- package/dist/chunks/{palette-BcFJLeXB.js → palette-CbOgFCy2.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-Dt0E1Wou.js → pivot-result-contract-expectations-Cnq55Uno.js} +44 -44
- package/dist/chunks/{pivot-result-identity-BKUjYO1u.js → pivot-result-identity-b4-ugQhm.js} +1 -1
- package/dist/chunks/{raw-temporal-value-BzdgeDa7.js → raw-temporal-value-B9W38mi3.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-CgskMwZJ.js → report-preferences-dialog-DTu3a7ce.js} +13 -13
- package/dist/chunks/{report-runtime-context-g4Zp_TU9.js → report-runtime-context-BvJkcbar.js} +1 -1
- package/dist/chunks/{resolve-dashboard-input-context-DfJshnw8.js → resolve-dashboard-input-context-Bw-DesV2.js} +4771 -4712
- package/dist/chunks/{save-C9CZAk6V.js → save-BgvAsp6X.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-DdhPU2Kq.js → saved-dashboard-context-BFh0oOnF.js} +7 -7
- package/dist/chunks/{selection-filter-compiler-BclSpK3P.js → selection-filter-compiler-DHYsq3yM.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-BuasVClR.js → semaphor-ready-indicator-WvgHMnj8.js} +33384 -32853
- package/dist/chunks/{shelf-drop-preview-context-DjOcz0mb.js → shelf-drop-preview-context-D6HgYFJp.js} +5 -5
- package/dist/chunks/{stored-dashboard-D6FtWx_3.js → stored-dashboard-vlG0Knxi.js} +94 -94
- package/dist/chunks/{style-sheet-parts-DM_Mw_sm.js → style-sheet-parts-ClmvtkSC.js} +2 -2
- package/dist/chunks/{table-export-sheet-DBlFMvE8.js → table-export-sheet-Bv6tVuMu.js} +1 -1
- package/dist/chunks/{token-types-BB2ImFx6.js → token-types-eMdcuB6j.js} +1 -1
- package/dist/chunks/{upload-CMTCg47S.js → upload-ClUeK8F0.js} +1 -1
- package/dist/chunks/{validators-BlEWWX9O.js → validators-DwhBEvnh.js} +1074 -1065
- package/dist/chunks/{variable-draft-CxdgKDCx.js → variable-draft-CauoSBN0.js} +4 -4
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1752 -1684
- package/dist/format-utils/index.js +13 -13
- package/dist/index.js +18 -18
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/shared/unsaved-changes/unsaved-changes-alert.d.ts +2 -1
- package/dist/types/components/sharing-and-management/hooks/paged-list.d.ts +22 -0
- package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +17 -2
- package/dist/types/index.js +5 -5
- package/dist/types/lib/hooks/use-dashboard-unsaved-changes-check.d.ts +9 -1
- package/dist/types/lib/utils/filter-default-value-utils.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/catalog-field-grounding.d.ts +7 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +1 -0
- package/dist/types/shared/analytics-protocol/numeric-range-options.d.ts +46 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +45 -0
- package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/filter-model/number-condition-spec.d.ts +24 -0
- package/dist/types/shared/dashboard-authoring/filter-model/number-range-setting.d.ts +47 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +6 -2
- package/package.json +1 -1
- package/dist/chunks/matrix-member-presentation-Bj2YcHAP.js +0 -169
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { M as
|
|
2
|
-
import { z as
|
|
1
|
+
import { M as Pe, z as Z, y as Bt, E as Wt, F as Ut, H as Vt, J as Ht, x as zt, h as it, j as pe, k as Gt, o as Qt, b as Xt, d as Kt } from "./analytics-base-schemas-8wz9vqn_.js";
|
|
2
|
+
import { z as s } from "zod";
|
|
3
3
|
function Zt(e) {
|
|
4
4
|
return typeof e == "string" || typeof e == "number" && Number.isFinite(e) || typeof e == "boolean";
|
|
5
5
|
}
|
|
6
6
|
function Jt(e) {
|
|
7
|
-
return !Array.isArray(e) || e.length === 0 || e.length >
|
|
7
|
+
return !Array.isArray(e) || e.length === 0 || e.length > Pe || !e.every(Zt) ? {
|
|
8
8
|
ok: !1,
|
|
9
|
-
error: `matchValues must be 1 to ${
|
|
9
|
+
error: `matchValues must be 1 to ${Pe} string, number or boolean values.`
|
|
10
10
|
} : { ok: !0, values: e };
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
errorMap: (
|
|
16
|
-
if (
|
|
17
|
-
const
|
|
18
|
-
const b =
|
|
12
|
+
function en(e, t) {
|
|
13
|
+
const n = e.map((i, o) => `${t[o]} ${nn(i)}`);
|
|
14
|
+
return s.union(e, {
|
|
15
|
+
errorMap: (i, o) => {
|
|
16
|
+
if (i.code !== s.ZodIssueCode.invalid_union) return { message: o.defaultError };
|
|
17
|
+
const a = i.path.length, r = o.data && typeof o.data == "object" && !Array.isArray(o.data) ? Object.keys(o.data) : [], l = i.unionErrors.map((p, f) => {
|
|
18
|
+
const b = tn(e[f]);
|
|
19
19
|
return { index: f, issues: p.issues, overlap: b ? r.filter((A) => b.includes(A)).length : 0 };
|
|
20
|
-
}).filter(({ issues: p }) => !p.every((f) => f.code ===
|
|
20
|
+
}).filter(({ issues: p }) => !p.every((f) => f.code === s.ZodIssueCode.invalid_type && f.path.length === a)).filter(({ overlap: p }) => !r.length || p > 0);
|
|
21
21
|
if (!l.length) {
|
|
22
22
|
const p = r.length ? ` Its keys (${r.join(", ")}) belong to none of them.` : "";
|
|
23
|
-
return { message: `Matches none of: ${
|
|
23
|
+
return { message: `Matches none of: ${n.join("; ")}.${p}` };
|
|
24
24
|
}
|
|
25
25
|
const c = l.reduce(
|
|
26
26
|
(p, f) => f.overlap > p.overlap || f.overlap === p.overlap && f.issues.length < p.issues.length ? f : p
|
|
27
27
|
), m = c.issues.slice(0, 4).map((p) => {
|
|
28
|
-
const f = p.path.slice(
|
|
28
|
+
const f = p.path.slice(a).join(".");
|
|
29
29
|
return f ? `${p.message} at ${f}` : p.message;
|
|
30
30
|
}), u = c.issues.length > 4 ? ` (and ${c.issues.length - 4} more)` : "";
|
|
31
31
|
return {
|
|
32
|
-
message: `Matches none of: ${
|
|
32
|
+
message: `Matches none of: ${n.join("; ")}. Nearest is the ${t[c.index]}: ${m.join("; ")}${u}`
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function tn(e) {
|
|
38
38
|
let t = e;
|
|
39
|
-
for (; t instanceof
|
|
40
|
-
return t instanceof
|
|
39
|
+
for (; t instanceof s.ZodEffects; ) t = t._def.schema;
|
|
40
|
+
return t instanceof s.ZodObject ? Object.keys(t.shape) : void 0;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function nn(e) {
|
|
43
43
|
let t = e;
|
|
44
|
-
for (; t instanceof
|
|
45
|
-
return t instanceof
|
|
44
|
+
for (; t instanceof s.ZodEffects; ) t = t._def.schema;
|
|
45
|
+
return t instanceof s.ZodObject ? `{ ${Object.entries(t.shape).map(([i, o]) => o.isOptional() ? `${i}?` : i).join(", ")} }` : "";
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const an = {
|
|
48
48
|
minute: 5256e3,
|
|
49
49
|
hour: 87600,
|
|
50
50
|
day: 3650,
|
|
@@ -52,65 +52,65 @@ const ni = {
|
|
|
52
52
|
month: 120,
|
|
53
53
|
quarter: 40,
|
|
54
54
|
year: 10
|
|
55
|
-
}, N =
|
|
56
|
-
lastSubDay:
|
|
57
|
-
mode:
|
|
55
|
+
}, N = s.enum(["day", "week", "month", "quarter", "year"]), sn = s.enum(["minute", "hour"]), rn = s.enum(["minute", "hour", "day", "week", "month", "quarter", "year"]), fe = s.number().int().positive(), J = s.number().int(), D = {
|
|
56
|
+
lastSubDay: s.object({
|
|
57
|
+
mode: s.literal("last"),
|
|
58
58
|
n: fe,
|
|
59
|
-
unit:
|
|
60
|
-
complete:
|
|
61
|
-
relativeTo:
|
|
59
|
+
unit: sn,
|
|
60
|
+
complete: s.literal(!1).optional(),
|
|
61
|
+
relativeTo: s.literal("latest_data").optional()
|
|
62
62
|
}),
|
|
63
|
-
last:
|
|
64
|
-
mode:
|
|
63
|
+
last: s.object({
|
|
64
|
+
mode: s.literal("last"),
|
|
65
65
|
n: fe,
|
|
66
66
|
unit: N,
|
|
67
|
-
complete:
|
|
68
|
-
relativeTo:
|
|
67
|
+
complete: s.boolean().optional(),
|
|
68
|
+
relativeTo: s.literal("latest_data").optional()
|
|
69
69
|
}),
|
|
70
|
-
this:
|
|
71
|
-
mode:
|
|
70
|
+
this: s.object({
|
|
71
|
+
mode: s.literal("this"),
|
|
72
72
|
unit: N,
|
|
73
|
-
toDate:
|
|
74
|
-
boundary:
|
|
73
|
+
toDate: s.boolean().optional(),
|
|
74
|
+
boundary: s.enum(["first_day", "last_day"]).optional()
|
|
75
75
|
}),
|
|
76
|
-
previous:
|
|
77
|
-
between:
|
|
76
|
+
previous: s.object({ mode: s.literal("previous"), unit: N }),
|
|
77
|
+
between: s.object({ mode: s.literal("between"), unit: N, from: J, to: J })
|
|
78
78
|
}, he = {
|
|
79
79
|
check: (e) => e.boundary === void 0 || e.unit === "month",
|
|
80
80
|
message: 'A month boundary requires unit "month".'
|
|
81
|
-
},
|
|
82
|
-
kind:
|
|
81
|
+
}, at = (e) => s.object({
|
|
82
|
+
kind: s.literal("periods"),
|
|
83
83
|
unit: N,
|
|
84
84
|
from: J,
|
|
85
85
|
to: J,
|
|
86
|
-
toDate:
|
|
87
|
-
anchor:
|
|
88
|
-
}),
|
|
89
|
-
periods:
|
|
90
|
-
rolling:
|
|
91
|
-
kind:
|
|
92
|
-
unit:
|
|
86
|
+
toDate: s.boolean().optional(),
|
|
87
|
+
anchor: s.union([s.enum(["now", "latest_data"]), e])
|
|
88
|
+
}), st = s.object({ lastComplete: N }), rt = at(st.strict()).strict(), W = {
|
|
89
|
+
periods: at(st),
|
|
90
|
+
rolling: s.object({
|
|
91
|
+
kind: s.literal("rolling"),
|
|
92
|
+
unit: rn,
|
|
93
93
|
n: fe,
|
|
94
|
-
anchor:
|
|
94
|
+
anchor: s.enum(["now", "latest_data"])
|
|
95
95
|
}),
|
|
96
|
-
monthDay:
|
|
97
|
-
},
|
|
98
|
-
function
|
|
99
|
-
return
|
|
96
|
+
monthDay: s.object({ kind: s.literal("monthDay"), day: s.enum(["first", "last"]) })
|
|
97
|
+
}, on = { "<": "start", ">=": "start", "<=": "end", ">": "end" };
|
|
98
|
+
function ot(e) {
|
|
99
|
+
return on[e];
|
|
100
100
|
}
|
|
101
101
|
function ua(e, t) {
|
|
102
|
-
const
|
|
103
|
-
return
|
|
102
|
+
const n = ot(e);
|
|
103
|
+
return n === "start" ? [t[0]] : n === "end" ? [t[1]] : [t[0], t[1]];
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
return e === "between" || e === "not between" ? !0 :
|
|
105
|
+
function dn(e, t) {
|
|
106
|
+
return e === "between" || e === "not between" ? !0 : ot(e) ? !t || t.kind === "monthDay" || t.anchor !== "latest_data" : !1;
|
|
107
107
|
}
|
|
108
108
|
function F(e, t = {}) {
|
|
109
|
-
const
|
|
110
|
-
if (!(!
|
|
111
|
-
return
|
|
109
|
+
const n = ln(e);
|
|
110
|
+
if (!(!n || dt(n, t)))
|
|
111
|
+
return un(n);
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function dt(e, t = {}) {
|
|
114
114
|
if (e.kind === "periods")
|
|
115
115
|
return e.from > e.to ? { rule: "W1", message: `from (${e.from}) is after to (${e.to}).`, path: "from" } : e.toDate && e.to !== 0 ? { rule: "W2", message: `toDate needs to 0, not ${e.to}.`, path: "toDate" } : typeof e.anchor == "object" && e.to > 0 ? {
|
|
116
116
|
rule: "W3",
|
|
@@ -120,11 +120,11 @@ function rt(e, t = {}) {
|
|
|
120
120
|
if (e.kind !== "rolling") return;
|
|
121
121
|
if (!Number.isInteger(e.n) || e.n < 1)
|
|
122
122
|
return { rule: "W4", message: `n (${e.n}) must be a whole number of at least 1.`, path: "n" };
|
|
123
|
-
const
|
|
124
|
-
if (t.authoring && e.n >
|
|
125
|
-
return { rule: "limit", message: `At most ${
|
|
123
|
+
const n = an[e.unit];
|
|
124
|
+
if (t.authoring && e.n > n)
|
|
125
|
+
return { rule: "limit", message: `At most ${n} ${e.unit}s (ten years).`, path: "n", max: n };
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function ln(e) {
|
|
128
128
|
if (!e || typeof e != "object") return;
|
|
129
129
|
if ("kind" in e) {
|
|
130
130
|
for (const r of Object.values(W)) {
|
|
@@ -133,36 +133,36 @@ function di(e) {
|
|
|
133
133
|
}
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
const t = D.lastSubDay.safeParse(e),
|
|
137
|
-
if (
|
|
138
|
-
const { n: r, unit: l, complete: c, relativeTo: m } =
|
|
136
|
+
const t = D.lastSubDay.safeParse(e), n = t.success ? t : D.last.safeParse(e);
|
|
137
|
+
if (n.success) {
|
|
138
|
+
const { n: r, unit: l, complete: c, relativeTo: m } = n.data, u = m ?? "now";
|
|
139
139
|
return c ? { kind: "periods", unit: l, from: -r, to: -1, anchor: u } : { kind: "rolling", unit: l, n: r, anchor: u };
|
|
140
140
|
}
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
143
|
-
const { unit: r, toDate: l, boundary: c } =
|
|
144
|
-
return he.check(
|
|
141
|
+
const i = D.this.safeParse(e);
|
|
142
|
+
if (i.success) {
|
|
143
|
+
const { unit: r, toDate: l, boundary: c } = i.data;
|
|
144
|
+
return he.check(i.data) ? c ? { kind: "monthDay", day: c === "first_day" ? "first" : "last" } : { kind: "periods", unit: r, from: 0, to: 0, ...l ? { toDate: !0 } : {}, anchor: "now" } : void 0;
|
|
145
145
|
}
|
|
146
146
|
const o = D.previous.safeParse(e);
|
|
147
147
|
if (o.success)
|
|
148
148
|
return { kind: "periods", unit: o.data.unit, from: -1, to: -1, anchor: "now" };
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
const { unit: r, from: l, to: c } =
|
|
149
|
+
const a = D.between.safeParse(e);
|
|
150
|
+
if (a.success) {
|
|
151
|
+
const { unit: r, from: l, to: c } = a.data;
|
|
152
152
|
return { kind: "periods", unit: r, from: l, to: c, anchor: "now" };
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function un(e) {
|
|
156
156
|
switch (e.kind) {
|
|
157
157
|
case "periods": {
|
|
158
|
-
const { unit: t, anchor:
|
|
159
|
-
return typeof
|
|
158
|
+
const { unit: t, anchor: n } = e;
|
|
159
|
+
return typeof n == "object" && n.lastComplete === t ? { kind: "periods", unit: t, from: e.from - 1, to: e.to - 1, anchor: "now" } : {
|
|
160
160
|
kind: "periods",
|
|
161
161
|
unit: t,
|
|
162
162
|
from: e.from,
|
|
163
163
|
to: e.to,
|
|
164
164
|
...e.toDate ? { toDate: !0 } : {},
|
|
165
|
-
anchor: typeof
|
|
165
|
+
anchor: typeof n == "object" ? { lastComplete: n.lastComplete } : n
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
case "rolling":
|
|
@@ -171,22 +171,22 @@ function li(e) {
|
|
|
171
171
|
return { kind: "monthDay", day: e.day };
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
const y = (e, t,
|
|
175
|
-
const o = F(
|
|
174
|
+
const y = (e, t, n, i) => {
|
|
175
|
+
const o = F(i);
|
|
176
176
|
if (!o) throw new Error(`The preset ${e} is not a relative date window.`);
|
|
177
|
-
return { id: e, label: t, category:
|
|
178
|
-
}, v = (e, t,
|
|
177
|
+
return { id: e, label: t, category: n, window: o };
|
|
178
|
+
}, v = (e, t, n) => ({
|
|
179
179
|
kind: "periods",
|
|
180
180
|
unit: e,
|
|
181
181
|
from: t,
|
|
182
|
-
to:
|
|
182
|
+
to: n,
|
|
183
183
|
anchor: "now"
|
|
184
184
|
}), C = (e, t) => ({
|
|
185
185
|
kind: "rolling",
|
|
186
186
|
unit: e,
|
|
187
187
|
n: t,
|
|
188
188
|
anchor: "now"
|
|
189
|
-
}),
|
|
189
|
+
}), cn = [
|
|
190
190
|
y("last_30_minutes", "Last 30 minutes", "time", C("minute", 30)),
|
|
191
191
|
y("last_1_hour", "Last 1 hour", "time", C("hour", 1)),
|
|
192
192
|
y("last_4_hours", "Last 4 hours", "time", C("hour", 4)),
|
|
@@ -223,28 +223,28 @@ const y = (e, t, i, n) => {
|
|
|
223
223
|
anchor: { lastComplete: "month" }
|
|
224
224
|
})
|
|
225
225
|
];
|
|
226
|
-
function
|
|
227
|
-
return
|
|
226
|
+
function mn(e, t) {
|
|
227
|
+
return qe(e) === qe(t);
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function qe(e) {
|
|
230
230
|
return JSON.stringify(
|
|
231
231
|
e,
|
|
232
|
-
(t,
|
|
232
|
+
(t, n) => n && typeof n == "object" && !Array.isArray(n) ? Object.fromEntries(Object.entries(n).sort(([i], [o]) => i < o ? -1 : i > o ? 1 : 0)) : n
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
const t =
|
|
235
|
+
function Be(e) {
|
|
236
|
+
const t = cn.find((n) => lt(n.window, e));
|
|
237
237
|
return {
|
|
238
|
-
label: t ? t.label :
|
|
238
|
+
label: t ? t.label : hn(e),
|
|
239
239
|
...t ? { presetId: t.id } : {},
|
|
240
|
-
definition:
|
|
240
|
+
definition: ct(e)
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
|
-
function
|
|
244
|
-
const
|
|
245
|
-
return
|
|
243
|
+
function pn(e, t) {
|
|
244
|
+
const n = F(e), i = F(t);
|
|
245
|
+
return n && i ? lt(n, i) : n || i ? !1 : mn(e ?? null, t ?? null);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function lt(e, t) {
|
|
248
248
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
249
249
|
}
|
|
250
250
|
const M = (e, t) => Math.abs(e) === 1 ? t : `${t}s`;
|
|
@@ -252,25 +252,25 @@ function G(e, t) {
|
|
|
252
252
|
if (e === 0) return t === "day" ? "today" : `this ${t}`;
|
|
253
253
|
if (e === -1) return t === "day" ? "yesterday" : `last ${t}`;
|
|
254
254
|
if (e === 1) return t === "day" ? "tomorrow" : `next ${t}`;
|
|
255
|
-
const
|
|
256
|
-
return e < 0 ? `${
|
|
255
|
+
const n = Math.abs(e);
|
|
256
|
+
return e < 0 ? `${n} ${M(n, t)} ago` : `${n} ${M(n, t)} ahead`;
|
|
257
257
|
}
|
|
258
|
-
const oe = (e) => e.charAt(0).toUpperCase() + e.slice(1),
|
|
258
|
+
const oe = (e) => e.charAt(0).toUpperCase() + e.slice(1), fn = {
|
|
259
259
|
day: "yesterday",
|
|
260
260
|
week: "last week",
|
|
261
261
|
month: "last month",
|
|
262
262
|
quarter: "last quarter",
|
|
263
263
|
year: "last year"
|
|
264
264
|
};
|
|
265
|
-
function
|
|
265
|
+
function ut(e) {
|
|
266
266
|
return F({ kind: "periods", unit: e.unit, from: e.from, to: e.to, anchor: "now" });
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function hn(e) {
|
|
269
269
|
if (e.kind === "periods" && typeof e.anchor == "object")
|
|
270
|
-
return `${
|
|
270
|
+
return `${Be(ut(e)).label}, as of end of ${fn[e.anchor.lastComplete]}`;
|
|
271
271
|
if (e.kind !== "monthDay" && e.anchor === "latest_data") {
|
|
272
272
|
const t = F({ ...e, anchor: "now" });
|
|
273
|
-
return `${
|
|
273
|
+
return `${Be(t).label} of data`;
|
|
274
274
|
}
|
|
275
275
|
switch (e.kind) {
|
|
276
276
|
case "monthDay":
|
|
@@ -278,13 +278,13 @@ function fi(e) {
|
|
|
278
278
|
case "rolling":
|
|
279
279
|
return `Last ${e.n} ${M(e.n, e.unit)}`;
|
|
280
280
|
case "periods": {
|
|
281
|
-
const { unit: t, from:
|
|
281
|
+
const { unit: t, from: n, to: i } = e;
|
|
282
282
|
if (e.toDate)
|
|
283
|
-
return
|
|
284
|
-
if (
|
|
285
|
-
if (
|
|
283
|
+
return n === 0 ? `This ${t} to date` : `${oe(G(n, t))} to date`;
|
|
284
|
+
if (i === -1 && n <= -2) return `Last ${-n} ${M(-n, t)}`;
|
|
285
|
+
if (n === i) return oe(G(n, t));
|
|
286
286
|
const o = t === "day" ? "today" : `this ${t}`;
|
|
287
|
-
return
|
|
287
|
+
return i === 0 && n < 0 ? `Last ${1 - n} ${M(1 - n, t)}, including ${o}` : n === 1 && i >= 2 ? `Next ${i} ${M(i, t)}` : n === 0 && i > 0 ? `Next ${i + 1} ${M(i + 1, t)}, including ${o}` : `${oe(G(n, t))} to ${G(i, t)}`;
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
}
|
|
@@ -292,7 +292,7 @@ const L = (e, t) => `${e} ${t}${Math.abs(e) === 1 ? "" : "s"}`;
|
|
|
292
292
|
function O(e, t) {
|
|
293
293
|
return e === 0 ? `the current ${t}` : e < 0 ? `${L(-e, t)} before the current one` : `${L(e, t)} after the current one`;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function ct(e) {
|
|
296
296
|
switch (e.kind) {
|
|
297
297
|
case "monthDay":
|
|
298
298
|
return e.day === "first" ? "the first day of the current month" : "the last day of the current month";
|
|
@@ -301,22 +301,22 @@ function lt(e) {
|
|
|
301
301
|
return e.anchor === "latest_data" ? `the last ${t}, up to the latest date in the data` : `the last ${t}, up to now`;
|
|
302
302
|
}
|
|
303
303
|
case "periods": {
|
|
304
|
-
const { unit: t, from:
|
|
304
|
+
const { unit: t, from: n, to: i } = e;
|
|
305
305
|
if (typeof e.anchor == "object") {
|
|
306
306
|
const r = `the end of the last complete ${e.anchor.lastComplete}`;
|
|
307
|
-
return e.toDate ?
|
|
307
|
+
return e.toDate ? n === 0 ? `the current ${t} up to ${r}` : `from ${O(n, t)} up to ${r}` : `${ct(ut(e))}, as of ${r}`;
|
|
308
308
|
}
|
|
309
|
-
if (e.anchor === "latest_data" &&
|
|
310
|
-
return `the ${L(-
|
|
309
|
+
if (e.anchor === "latest_data" && i === -1)
|
|
310
|
+
return `the ${L(-n, t)} before the ${t} of the latest date in the data, whole ${t}s only`;
|
|
311
311
|
const o = e.anchor === "latest_data" ? "the latest date in the data" : "now";
|
|
312
312
|
if (e.toDate)
|
|
313
|
-
return
|
|
314
|
-
const
|
|
315
|
-
return
|
|
313
|
+
return n === 0 ? `the current ${t} up to ${o}` : `from ${O(n, t)} up to ${o}`;
|
|
314
|
+
const a = e.anchor === "latest_data" ? ", counted from the latest date in the data" : "";
|
|
315
|
+
return n === 0 && i === 0 ? `the whole current ${t}${a}` : n === -1 && i === -1 ? `the ${t} before the current one` : i === -1 ? `the ${L(-n, t)} before the current ${t}, whole ${t}s only` : n === i ? `${O(n, t)}${a}` : `from ${O(n, t)} through ${O(i, t)}${a}`;
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
const
|
|
319
|
+
const mt = "Not a relative date window", gn = s.union([
|
|
320
320
|
D.lastSubDay.strict(),
|
|
321
321
|
D.last.strict(),
|
|
322
322
|
D.this.strict().refine(he.check, {
|
|
@@ -325,117 +325,117 @@ const ut = "Not a relative date window", hi = a.union([
|
|
|
325
325
|
}),
|
|
326
326
|
D.previous.strict(),
|
|
327
327
|
D.between.strict(),
|
|
328
|
-
|
|
328
|
+
rt,
|
|
329
329
|
W.rolling.strict(),
|
|
330
330
|
W.monthDay.strict()
|
|
331
331
|
]).transform((e, t) => {
|
|
332
|
-
const
|
|
333
|
-
return
|
|
332
|
+
const n = F(e);
|
|
333
|
+
return n || (t.addIssue({ code: s.ZodIssueCode.custom, message: mt }), s.NEVER);
|
|
334
334
|
}), E = {
|
|
335
|
-
periods:
|
|
335
|
+
periods: rt,
|
|
336
336
|
rolling: W.rolling.strict(),
|
|
337
337
|
monthDay: W.monthDay.strict()
|
|
338
|
-
}, ca =
|
|
339
|
-
const
|
|
340
|
-
return
|
|
338
|
+
}, ca = s.union([E.periods, E.rolling, E.monthDay]).transform((e, t) => {
|
|
339
|
+
const n = F(e, { authoring: !0 });
|
|
340
|
+
return n || (t.addIssue({ code: s.ZodIssueCode.custom, message: mt }), s.NEVER);
|
|
341
341
|
});
|
|
342
342
|
function Q(e) {
|
|
343
343
|
return e.kind === "absolute";
|
|
344
344
|
}
|
|
345
|
-
const X = "Use { kind: 'periods', unit, from, to, anchor } for whole periods (the last 3 complete months: from -3, to -1; this month: from 0, to 0) or { kind: 'rolling', unit, n, anchor } for elapsed time.",
|
|
345
|
+
const X = "Use { kind: 'periods', unit, from, to, anchor } for whole periods (the last 3 complete months: from -3, to -1; this month: from 0, to 0) or { kind: 'rolling', unit, n, anchor } for elapsed time.", yn = "Ask the user which.", Ie = /* @__PURE__ */ new Set(["minute", "hour"]);
|
|
346
346
|
function ma(e, t) {
|
|
347
347
|
if (!e || !t) return e === t;
|
|
348
348
|
if (Q(e) || Q(t)) {
|
|
349
349
|
if (!Q(e) || !Q(t)) return !1;
|
|
350
|
-
const
|
|
350
|
+
const n = (i) => {
|
|
351
351
|
var o;
|
|
352
|
-
return (o =
|
|
352
|
+
return (o = ie(i)) == null ? void 0 : o.getTime();
|
|
353
353
|
};
|
|
354
|
-
return
|
|
354
|
+
return n(e.start) === n(t.start) && n(e.end) === n(t.end);
|
|
355
355
|
}
|
|
356
|
-
return
|
|
356
|
+
return pn(e, t);
|
|
357
357
|
}
|
|
358
358
|
function Se(e, t) {
|
|
359
|
-
const
|
|
360
|
-
return
|
|
359
|
+
const n = ft(e, t);
|
|
360
|
+
return n.ok ? n : { ok: !1, refusal: $n(n.problem, t) };
|
|
361
361
|
}
|
|
362
|
-
function pa(e, t,
|
|
363
|
-
const
|
|
364
|
-
if (!
|
|
365
|
-
return { ...
|
|
362
|
+
function pa(e, t, n) {
|
|
363
|
+
const i = Se(e, t);
|
|
364
|
+
if (!i.ok)
|
|
365
|
+
return { ...i.refusal, message: `${i.refusal.message} It stays while ${n} is left out.` };
|
|
366
366
|
}
|
|
367
|
-
const
|
|
367
|
+
const _n = s.object({ kind: s.literal("absolute"), start: s.string(), end: s.string() }).strict(), bn = { kind: "monthDay", day: "first" };
|
|
368
368
|
function fa(e) {
|
|
369
|
-
const t = typeof e == "function" ? e : () => e,
|
|
370
|
-
[E.periods, E.rolling, E.monthDay,
|
|
369
|
+
const t = typeof e == "function" ? e : () => e, n = en(
|
|
370
|
+
[E.periods, E.rolling, E.monthDay, _n],
|
|
371
371
|
["periods window", "rolling window", "month day window", "absolute window"]
|
|
372
372
|
);
|
|
373
|
-
return
|
|
374
|
-
const
|
|
375
|
-
return
|
|
376
|
-
code:
|
|
377
|
-
message:
|
|
378
|
-
...
|
|
379
|
-
}),
|
|
380
|
-
},
|
|
373
|
+
return s.preprocess((i, o) => {
|
|
374
|
+
const a = Se(i, { use: t(o.path) });
|
|
375
|
+
return a.ok ? a.window : (o.addIssue({
|
|
376
|
+
code: s.ZodIssueCode.custom,
|
|
377
|
+
message: pt(a.refusal),
|
|
378
|
+
...a.refusal.path ? { path: [a.refusal.path] } : {}
|
|
379
|
+
}), bn);
|
|
380
|
+
}, n);
|
|
381
381
|
}
|
|
382
382
|
const ge = " Fix: ";
|
|
383
|
-
function
|
|
383
|
+
function pt(e) {
|
|
384
384
|
return `${e.message}${ge}${e.fix}`;
|
|
385
385
|
}
|
|
386
386
|
function ha(e) {
|
|
387
387
|
const t = e.indexOf(ge);
|
|
388
388
|
return t > 0 ? { message: e.slice(0, t), fix: e.slice(t + ge.length) } : void 0;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function ft(e, t) {
|
|
391
391
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
392
392
|
return w("not_a_window", "timeWindow must be an object.", `Send a window. ${X}`, []);
|
|
393
|
-
const
|
|
394
|
-
if ("value" in
|
|
393
|
+
const n = e;
|
|
394
|
+
if ("value" in n || "completeness" in n || "period" in n || n.kind === "relative" || n.kind === "calendar")
|
|
395
395
|
return w("old_form", "timeWindow uses the window form: kind periods or rolling, with an anchor.", X, []);
|
|
396
|
-
if (
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
396
|
+
if (n.kind === "absolute") return vn(n, t);
|
|
397
|
+
const i = n.kind;
|
|
398
|
+
if (i !== "periods" && i !== "rolling" && i !== "monthDay")
|
|
399
399
|
return w(
|
|
400
400
|
"not_a_window",
|
|
401
|
-
`timeWindow kind must be periods, rolling, monthDay or absolute${
|
|
401
|
+
`timeWindow kind must be periods, rolling, monthDay or absolute${i === void 0 ? "" : `, not ${JSON.stringify(i)}`}.`,
|
|
402
402
|
X,
|
|
403
403
|
[],
|
|
404
404
|
"kind"
|
|
405
405
|
);
|
|
406
|
-
if (
|
|
407
|
-
if (
|
|
408
|
-
if (
|
|
409
|
-
const o = E[
|
|
406
|
+
if (i !== "monthDay" && n.anchor === void 0) return In(n, t);
|
|
407
|
+
if (n.unit === "second") return Sn(n);
|
|
408
|
+
if (i === "periods" && typeof n.unit == "string" && Ie.has(n.unit)) return wn(n);
|
|
409
|
+
const o = E[i].safeParse(n);
|
|
410
410
|
if (!o.success) {
|
|
411
411
|
const m = o.error.issues[0], u = m.path.join(".");
|
|
412
412
|
return w(
|
|
413
413
|
"not_a_window",
|
|
414
414
|
`timeWindow ${u ? `${u}: ` : ""}${m.message}.`,
|
|
415
|
-
`Send a ${
|
|
415
|
+
`Send a ${i} window: ${xn(i)}.`,
|
|
416
416
|
[],
|
|
417
417
|
u || void 0
|
|
418
418
|
);
|
|
419
419
|
}
|
|
420
|
-
const
|
|
420
|
+
const a = o.data, r = dt(a, { authoring: !0 });
|
|
421
421
|
if (r) {
|
|
422
|
-
if (r.rule === "limit" &&
|
|
422
|
+
if (r.rule === "limit" && a.kind === "rolling")
|
|
423
423
|
return w(
|
|
424
424
|
"over_limit",
|
|
425
425
|
r.message,
|
|
426
426
|
`Use at most ${r.max}, or the same span in a longer unit.`,
|
|
427
|
-
[{ ...
|
|
427
|
+
[{ ...a, n: r.max }],
|
|
428
428
|
"n"
|
|
429
429
|
);
|
|
430
|
-
const m = r.rule === "W1" &&
|
|
431
|
-
return w("not_a_window", r.message,
|
|
430
|
+
const m = r.rule === "W1" && a.kind === "periods" ? [{ ...a, from: a.to, to: a.from }] : [];
|
|
431
|
+
return w("not_a_window", r.message, Dn(r.rule), m, r.path);
|
|
432
432
|
}
|
|
433
|
-
const l =
|
|
433
|
+
const l = kn(a, t);
|
|
434
434
|
if (l) return l;
|
|
435
|
-
const c = F(
|
|
435
|
+
const c = F(a, { authoring: !0 });
|
|
436
436
|
return c ? { ok: !0, window: c } : w("not_a_window", "timeWindow is not a window.", X, []);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function vn(e, t) {
|
|
439
439
|
if (t.use === "filterDefault")
|
|
440
440
|
return w(
|
|
441
441
|
"absolute_default",
|
|
@@ -443,52 +443,52 @@ function bi(e, t) {
|
|
|
443
443
|
"Use a window that moves with time, or leave defaultPeriod out.",
|
|
444
444
|
[{ kind: "periods", unit: "month", from: -1, to: -1, anchor: "now" }]
|
|
445
445
|
);
|
|
446
|
-
const
|
|
447
|
-
return !
|
|
446
|
+
const n = typeof e.start == "string" ? ie(e.start) : null, i = typeof e.end == "string" ? ie(e.end) : null;
|
|
447
|
+
return !n || !i || n.getTime() > i.getTime() ? w(
|
|
448
448
|
"absolute_invalid",
|
|
449
449
|
"start and end must be ISO dates or timestamps, start first.",
|
|
450
450
|
"Send start before end, as YYYY-MM-DD or an ISO timestamp.",
|
|
451
451
|
[],
|
|
452
|
-
|
|
452
|
+
n ? "end" : "start"
|
|
453
453
|
) : { ok: !0, window: { kind: "absolute", start: e.start, end: e.end } };
|
|
454
454
|
}
|
|
455
|
-
function
|
|
456
|
-
const
|
|
455
|
+
function In(e, t) {
|
|
456
|
+
const n = typeof e.unit == "string" ? e.unit : "month", i = [
|
|
457
457
|
{ anchor: "now", words: '"now" counts from the run' },
|
|
458
458
|
...t.use === "filterDefault" ? [] : [{ anchor: "latest_data", words: '"latest_data" from the newest row' }],
|
|
459
|
-
...e.kind === "periods" ? [{ anchor: { lastComplete:
|
|
459
|
+
...e.kind === "periods" ? [{ anchor: { lastComplete: n }, words: `{ "lastComplete": "${n}" } ends at the last complete ${n}` }] : []
|
|
460
460
|
];
|
|
461
461
|
return w(
|
|
462
462
|
"missing_anchor",
|
|
463
463
|
"A window needs an anchor: where it counts from.",
|
|
464
|
-
`Add an anchor: ${
|
|
465
|
-
|
|
464
|
+
`Add an anchor: ${i.map((o) => o.words).join(", ")}.`,
|
|
465
|
+
i.map((o) => ({ ...e, anchor: o.anchor })),
|
|
466
466
|
"anchor"
|
|
467
467
|
);
|
|
468
468
|
}
|
|
469
|
-
function
|
|
470
|
-
const t = typeof e.n == "number" ? e.n : 0,
|
|
469
|
+
function Sn(e) {
|
|
470
|
+
const t = typeof e.n == "number" ? e.n : 0, n = [.../* @__PURE__ */ new Set([Math.floor(t / 60), Math.ceil(t / 60)])].filter((i) => i >= 1);
|
|
471
471
|
return w(
|
|
472
472
|
"seconds",
|
|
473
473
|
"Windows count minutes, not seconds.",
|
|
474
474
|
"Round to whole minutes.",
|
|
475
|
-
|
|
475
|
+
n.map((i) => ({ kind: "rolling", unit: "minute", n: i, anchor: e.anchor })),
|
|
476
476
|
"unit"
|
|
477
477
|
);
|
|
478
478
|
}
|
|
479
|
-
function
|
|
480
|
-
const t = typeof e.from == "number" ? e.from : 0,
|
|
479
|
+
function wn(e) {
|
|
480
|
+
const t = typeof e.from == "number" ? e.from : 0, i = (typeof e.to == "number" ? e.to : 0) - t + 1;
|
|
481
481
|
return w(
|
|
482
482
|
"sub_day_periods",
|
|
483
483
|
"Minutes and hours count elapsed time; there are no whole-minute or whole-hour periods.",
|
|
484
|
-
`The nearest is the last ${
|
|
485
|
-
|
|
484
|
+
`The nearest is the last ${i} ${String(e.unit)}s up to the anchor.`,
|
|
485
|
+
i >= 1 ? [{ kind: "rolling", unit: e.unit, n: i, anchor: e.anchor }] : [],
|
|
486
486
|
"unit"
|
|
487
487
|
);
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function kn(e, t) {
|
|
490
490
|
if (!(t.use === "analysis" || e.kind === "monthDay")) {
|
|
491
|
-
if (e.kind === "rolling" && !Ie.has(e.unit)) return
|
|
491
|
+
if (e.kind === "rolling" && !Ie.has(e.unit)) return An(e);
|
|
492
492
|
if (e.kind === "rolling" && t.columnHasTime === !1)
|
|
493
493
|
return w(
|
|
494
494
|
"sub_day_on_date",
|
|
@@ -510,40 +510,40 @@ function wi(e, t) {
|
|
|
510
510
|
);
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
function
|
|
514
|
-
const t = e.unit,
|
|
515
|
-
return w("rolling_days_saved", `A saved card or default counts whole ${t}s.`,
|
|
513
|
+
function An(e) {
|
|
514
|
+
const t = e.unit, n = e.n === 1 ? `Choose the current ${t} so far, or the last complete ${t}.` : `Choose the current ${t} so far and the ${e.n - 1} before it, or the last ${e.n} complete ${t}s.`;
|
|
515
|
+
return w("rolling_days_saved", `A saved card or default counts whole ${t}s.`, n, [
|
|
516
516
|
{ kind: "periods", unit: t, from: 1 - e.n, to: 0, anchor: e.anchor },
|
|
517
517
|
{ kind: "periods", unit: t, from: -e.n, to: -1, anchor: e.anchor }
|
|
518
518
|
]);
|
|
519
519
|
}
|
|
520
|
-
function
|
|
521
|
-
const
|
|
520
|
+
function $n(e, t) {
|
|
521
|
+
const n = [], i = /* @__PURE__ */ new Set(), o = [e.sentence], a = (m, u) => {
|
|
522
522
|
for (const p of m) {
|
|
523
|
-
const f =
|
|
523
|
+
const f = ft(p, t);
|
|
524
524
|
if (f.ok) {
|
|
525
525
|
const b = JSON.stringify(p);
|
|
526
|
-
|
|
527
|
-
} else u < 4 && f.problem.repairs.length && (o.includes(f.problem.sentence) || o.push(f.problem.sentence),
|
|
526
|
+
i.has(b) || (i.add(b), n.push(p));
|
|
527
|
+
} else u < 4 && f.problem.repairs.length && (o.includes(f.problem.sentence) || o.push(f.problem.sentence), a(f.problem.repairs, u + 1));
|
|
528
528
|
}
|
|
529
529
|
};
|
|
530
|
-
|
|
530
|
+
a(e.repairs, 0);
|
|
531
531
|
let r = o.join(" ");
|
|
532
|
-
const l =
|
|
533
|
-
t.use !== "analysis" && t.columnHasTime === void 0 && l && (r = `${r.replace(/\.$/, "")}, if the date field has a time of day.`),
|
|
534
|
-
const c =
|
|
532
|
+
const l = n.some((m) => "unit" in m && Ie.has(String(m.unit)));
|
|
533
|
+
t.use !== "analysis" && t.columnHasTime === void 0 && l && (r = `${r.replace(/\.$/, "")}, if the date field has a time of day.`), n.length > 1 && (r = `${r} ${yn}`);
|
|
534
|
+
const c = n.length ? ` ${n.length > 1 ? "Send one of" : "Send"}: ${n.map((m) => JSON.stringify(m)).join("; ")}.` : "";
|
|
535
535
|
return {
|
|
536
536
|
reason: e.reason,
|
|
537
537
|
message: e.message,
|
|
538
538
|
fix: `${r}${c}`,
|
|
539
|
-
suggestions:
|
|
539
|
+
suggestions: n,
|
|
540
540
|
...e.path ? { path: e.path } : {}
|
|
541
541
|
};
|
|
542
542
|
}
|
|
543
|
-
function w(e, t,
|
|
544
|
-
return { ok: !1, problem: { reason: e, message: t, sentence:
|
|
543
|
+
function w(e, t, n, i, o) {
|
|
544
|
+
return { ok: !1, problem: { reason: e, message: t, sentence: n, repairs: i, ...o ? { path: o } : {} } };
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Dn(e) {
|
|
547
547
|
switch (e) {
|
|
548
548
|
case "W1":
|
|
549
549
|
return "from must be at most to; -1 is the period before the anchor's.";
|
|
@@ -556,7 +556,7 @@ function $i(e) {
|
|
|
556
556
|
return "n is a whole number of at least 1.";
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function xn(e) {
|
|
560
560
|
switch (e) {
|
|
561
561
|
case "periods":
|
|
562
562
|
return "{ kind: 'periods', unit: day | week | month | quarter | year, from, to, toDate?: true, anchor: 'now' | 'latest_data' | { lastComplete: unit } }";
|
|
@@ -566,57 +566,57 @@ function Di(e) {
|
|
|
566
566
|
return "{ kind: 'monthDay', day: 'first' | 'last' }";
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
|
-
function d(e, t,
|
|
570
|
-
return
|
|
569
|
+
function d(e, t, n) {
|
|
570
|
+
return n ? { code: e, message: t, path: n } : { code: e, message: t };
|
|
571
571
|
}
|
|
572
572
|
function h(e) {
|
|
573
573
|
return typeof e == "string" && e.trim().length > 0;
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function Fn(e) {
|
|
576
576
|
const t = /* @__PURE__ */ new Set();
|
|
577
|
-
return
|
|
577
|
+
return Mn(e, (n) => (t.add(n), `{${n}}`)), Array.from(t);
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
let
|
|
579
|
+
function Mn(e, t) {
|
|
580
|
+
let n = "", i = 0, o = 0;
|
|
581
581
|
for (; o < e.length; ) {
|
|
582
|
-
const
|
|
583
|
-
if (
|
|
584
|
-
o =
|
|
582
|
+
const a = e[o];
|
|
583
|
+
if (a === "'" || a === '"') {
|
|
584
|
+
o = En(e, o);
|
|
585
585
|
continue;
|
|
586
586
|
}
|
|
587
|
-
if (
|
|
587
|
+
if (a === "{") {
|
|
588
588
|
const r = e.indexOf("}", o + 1);
|
|
589
589
|
if (r === -1) {
|
|
590
590
|
o += 1;
|
|
591
591
|
continue;
|
|
592
592
|
}
|
|
593
593
|
const l = e.slice(o + 1, r);
|
|
594
|
-
/^[A-Za-z_][A-Za-z0-9_]*$/.test(l) && (
|
|
594
|
+
/^[A-Za-z_][A-Za-z0-9_]*$/.test(l) && (n += e.slice(i, o) + t(l), i = r + 1), o = r + 1;
|
|
595
595
|
continue;
|
|
596
596
|
}
|
|
597
597
|
o += 1;
|
|
598
598
|
}
|
|
599
|
-
return
|
|
600
|
-
}
|
|
601
|
-
function
|
|
602
|
-
const
|
|
603
|
-
let
|
|
604
|
-
for (;
|
|
605
|
-
if (e[
|
|
606
|
-
if (e[
|
|
607
|
-
|
|
599
|
+
return n + e.slice(i);
|
|
600
|
+
}
|
|
601
|
+
function En(e, t) {
|
|
602
|
+
const n = e[t];
|
|
603
|
+
let i = t + 1;
|
|
604
|
+
for (; i < e.length; ) {
|
|
605
|
+
if (e[i] === n) {
|
|
606
|
+
if (e[i + 1] === n) {
|
|
607
|
+
i += 2;
|
|
608
608
|
continue;
|
|
609
609
|
}
|
|
610
|
-
return
|
|
610
|
+
return i + 1;
|
|
611
611
|
}
|
|
612
|
-
|
|
612
|
+
i += 1;
|
|
613
613
|
}
|
|
614
614
|
return e.length;
|
|
615
615
|
}
|
|
616
616
|
function g(e) {
|
|
617
617
|
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
618
618
|
}
|
|
619
|
-
const
|
|
619
|
+
const Nn = /* @__PURE__ */ new Set([
|
|
620
620
|
"SUM",
|
|
621
621
|
"COUNT",
|
|
622
622
|
"AVG",
|
|
@@ -625,21 +625,21 @@ const Ei = /* @__PURE__ */ new Set([
|
|
|
625
625
|
"MEDIAN",
|
|
626
626
|
"DISTINCT"
|
|
627
627
|
]);
|
|
628
|
-
function we(e, t,
|
|
628
|
+
function we(e, t, n) {
|
|
629
629
|
if (!e || typeof e != "object") {
|
|
630
|
-
|
|
630
|
+
n.push(
|
|
631
631
|
d("missing_source", "Analytics intent needs a source.", t)
|
|
632
632
|
);
|
|
633
633
|
return;
|
|
634
634
|
}
|
|
635
635
|
if (e.kind === "semantic") {
|
|
636
|
-
h(e.domainId) ||
|
|
636
|
+
h(e.domainId) || n.push(
|
|
637
637
|
d(
|
|
638
638
|
"missing_semantic_domain",
|
|
639
639
|
"Semantic source needs a domainId.",
|
|
640
640
|
`${t}.domainId`
|
|
641
641
|
)
|
|
642
|
-
), h(e.datasetName) ||
|
|
642
|
+
), h(e.datasetName) || n.push(
|
|
643
643
|
d(
|
|
644
644
|
"missing_dataset_name",
|
|
645
645
|
"Semantic source needs a datasetName.",
|
|
@@ -649,13 +649,13 @@ function we(e, t, i) {
|
|
|
649
649
|
return;
|
|
650
650
|
}
|
|
651
651
|
if (e.kind === "physical") {
|
|
652
|
-
h(e.connectionId) ||
|
|
652
|
+
h(e.connectionId) || n.push(
|
|
653
653
|
d(
|
|
654
654
|
"missing_connection_id",
|
|
655
655
|
"Physical source needs a connectionId.",
|
|
656
656
|
`${t}.connectionId`
|
|
657
657
|
)
|
|
658
|
-
), h(e.tableName) ||
|
|
658
|
+
), h(e.tableName) || n.push(
|
|
659
659
|
d(
|
|
660
660
|
"missing_table_name",
|
|
661
661
|
"Physical source needs a tableName.",
|
|
@@ -665,7 +665,7 @@ function we(e, t, i) {
|
|
|
665
665
|
return;
|
|
666
666
|
}
|
|
667
667
|
if (e.kind === "sql") {
|
|
668
|
-
h(e.connectionId) ||
|
|
668
|
+
h(e.connectionId) || n.push(
|
|
669
669
|
d(
|
|
670
670
|
"missing_connection_id",
|
|
671
671
|
"SQL source needs a connectionId.",
|
|
@@ -674,27 +674,27 @@ function we(e, t, i) {
|
|
|
674
674
|
);
|
|
675
675
|
return;
|
|
676
676
|
}
|
|
677
|
-
|
|
677
|
+
n.push(
|
|
678
678
|
d("invalid_source_kind", "Source kind is not supported.", t)
|
|
679
679
|
);
|
|
680
680
|
}
|
|
681
|
-
function I(e, t,
|
|
681
|
+
function I(e, t, n, i = {}) {
|
|
682
682
|
if (!e || !g(e)) {
|
|
683
|
-
|
|
683
|
+
i.required && n.push(
|
|
684
684
|
d("missing_field_ref", "Field reference needs a name.", t)
|
|
685
685
|
);
|
|
686
686
|
return;
|
|
687
687
|
}
|
|
688
|
-
h(e.name) ||
|
|
688
|
+
h(e.name) || n.push(
|
|
689
689
|
d(
|
|
690
690
|
"missing_field_ref",
|
|
691
691
|
"Field reference needs a name.",
|
|
692
692
|
`${t}.name`
|
|
693
693
|
)
|
|
694
|
-
), e.source !== void 0 && we(e.source, `${t}.source`,
|
|
694
|
+
), e.source !== void 0 && we(e.source, `${t}.source`, n), ke(e.aggregate, `${t}.aggregate`, n);
|
|
695
695
|
}
|
|
696
|
-
function ke(e, t,
|
|
697
|
-
e !== void 0 && (typeof e != "string" || !
|
|
696
|
+
function ke(e, t, n) {
|
|
697
|
+
e !== void 0 && (typeof e != "string" || !Nn.has(e)) && n.push(
|
|
698
698
|
d(
|
|
699
699
|
"invalid_aggregate",
|
|
700
700
|
"Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
|
|
@@ -702,13 +702,13 @@ function ke(e, t, i) {
|
|
|
702
702
|
)
|
|
703
703
|
);
|
|
704
704
|
}
|
|
705
|
-
const
|
|
705
|
+
const Tn = /* @__PURE__ */ new Set([
|
|
706
706
|
"measure",
|
|
707
707
|
"dimension",
|
|
708
708
|
"date",
|
|
709
709
|
"id",
|
|
710
710
|
"unknown"
|
|
711
|
-
]),
|
|
711
|
+
]), Rn = /* @__PURE__ */ new Set(["row", "aggregate"]), jn = /* @__PURE__ */ new Set([
|
|
712
712
|
"string",
|
|
713
713
|
"number",
|
|
714
714
|
"boolean",
|
|
@@ -716,11 +716,11 @@ const Ni = /* @__PURE__ */ new Set([
|
|
|
716
716
|
"datetime",
|
|
717
717
|
"unknown"
|
|
718
718
|
]);
|
|
719
|
-
function
|
|
719
|
+
function Cn(e, t, n) {
|
|
720
720
|
if (e === void 0)
|
|
721
721
|
return;
|
|
722
722
|
if (!g(e)) {
|
|
723
|
-
|
|
723
|
+
n.push(
|
|
724
724
|
d(
|
|
725
725
|
"invalid_value_format",
|
|
726
726
|
"Value format must be a structured object.",
|
|
@@ -729,34 +729,34 @@ function ji(e, t, i) {
|
|
|
729
729
|
);
|
|
730
730
|
return;
|
|
731
731
|
}
|
|
732
|
-
const
|
|
733
|
-
if (
|
|
732
|
+
const i = (e.type === "temporal_bucket" ? Z : Bt).safeParse(e);
|
|
733
|
+
if (i.success) return;
|
|
734
734
|
const o = e.type === "temporal_bucket" ? "invalid_temporal_bucket_format" : "invalid_value_format";
|
|
735
|
-
for (const
|
|
736
|
-
|
|
735
|
+
for (const a of i.error.issues)
|
|
736
|
+
n.push(
|
|
737
737
|
d(
|
|
738
738
|
o,
|
|
739
|
-
|
|
740
|
-
[t, ...
|
|
739
|
+
a.message,
|
|
740
|
+
[t, ...a.path.map(String)].filter(Boolean).join(".")
|
|
741
741
|
)
|
|
742
742
|
);
|
|
743
743
|
}
|
|
744
|
-
const
|
|
744
|
+
const On = /* @__PURE__ */ new Set([
|
|
745
745
|
"additive",
|
|
746
746
|
"non_additive",
|
|
747
747
|
"ratio_of_sums",
|
|
748
748
|
"weighted",
|
|
749
749
|
"pre_aggregated",
|
|
750
750
|
"snapshot"
|
|
751
|
-
]),
|
|
751
|
+
]), Yn = /* @__PURE__ */ new Set([
|
|
752
752
|
"default",
|
|
753
753
|
"symmetric_aggregate",
|
|
754
754
|
"aggregate_then_join",
|
|
755
755
|
"weighted"
|
|
756
756
|
]);
|
|
757
|
-
function
|
|
757
|
+
function Ln(e, t, n) {
|
|
758
758
|
if (!e || !g(e)) {
|
|
759
|
-
|
|
759
|
+
n.push(
|
|
760
760
|
d(
|
|
761
761
|
"invalid_derived_field_input",
|
|
762
762
|
"Derived field inputs must be structured input references.",
|
|
@@ -766,10 +766,10 @@ function Yi(e, t, i) {
|
|
|
766
766
|
return;
|
|
767
767
|
}
|
|
768
768
|
if (e.kind === "field") {
|
|
769
|
-
I(e.field, `${t}.field`,
|
|
769
|
+
I(e.field, `${t}.field`, n, { required: !0 }), ke(e.aggregate, `${t}.aggregate`, n);
|
|
770
770
|
return;
|
|
771
771
|
}
|
|
772
|
-
|
|
772
|
+
n.push(
|
|
773
773
|
d(
|
|
774
774
|
"invalid_derived_field_input",
|
|
775
775
|
"Derived field input kind must be field.",
|
|
@@ -804,19 +804,19 @@ function Ae(e) {
|
|
|
804
804
|
"Derived field needs a label.",
|
|
805
805
|
"label"
|
|
806
806
|
)
|
|
807
|
-
),
|
|
807
|
+
), Tn.has(e.resultRole) || t.push(
|
|
808
808
|
d(
|
|
809
809
|
"invalid_derived_field_role",
|
|
810
810
|
"Derived field resultRole must be measure, dimension, date, id, or unknown.",
|
|
811
811
|
"resultRole"
|
|
812
812
|
)
|
|
813
|
-
),
|
|
813
|
+
), jn.has(e.dataType) || t.push(
|
|
814
814
|
d(
|
|
815
815
|
"invalid_derived_field_data_type",
|
|
816
816
|
"Derived field dataType must be string, number, boolean, date, datetime, or unknown.",
|
|
817
817
|
"dataType"
|
|
818
818
|
)
|
|
819
|
-
),
|
|
819
|
+
), Rn.has(e.computeStage) || t.push(
|
|
820
820
|
d(
|
|
821
821
|
"invalid_derived_field_compute_stage",
|
|
822
822
|
"Derived field computeStage must be row or aggregate.",
|
|
@@ -844,7 +844,7 @@ function Ae(e) {
|
|
|
844
844
|
e.defaultAggregate,
|
|
845
845
|
"defaultAggregate",
|
|
846
846
|
t
|
|
847
|
-
), e.aggregationBehavior !== void 0 && !
|
|
847
|
+
), e.aggregationBehavior !== void 0 && !On.has(
|
|
848
848
|
e.aggregationBehavior
|
|
849
849
|
) && t.push(
|
|
850
850
|
d(
|
|
@@ -852,7 +852,7 @@ function Ae(e) {
|
|
|
852
852
|
"Derived field aggregationBehavior is not supported.",
|
|
853
853
|
"aggregationBehavior"
|
|
854
854
|
)
|
|
855
|
-
), e.aggregationStrategy !== void 0 && !
|
|
855
|
+
), e.aggregationStrategy !== void 0 && !Yn.has(
|
|
856
856
|
e.aggregationStrategy
|
|
857
857
|
) && t.push(
|
|
858
858
|
d(
|
|
@@ -878,8 +878,8 @@ function Ae(e) {
|
|
|
878
878
|
"Derived field needs at least one typed input.",
|
|
879
879
|
"inputs"
|
|
880
880
|
)
|
|
881
|
-
) : Object.entries(e.inputs).forEach(([
|
|
882
|
-
if (!h(
|
|
881
|
+
) : Object.entries(e.inputs).forEach(([i, o]) => {
|
|
882
|
+
if (!h(i)) {
|
|
883
883
|
t.push(
|
|
884
884
|
d(
|
|
885
885
|
"invalid_derived_field_input_name",
|
|
@@ -889,18 +889,18 @@ function Ae(e) {
|
|
|
889
889
|
);
|
|
890
890
|
return;
|
|
891
891
|
}
|
|
892
|
-
|
|
892
|
+
Ln(
|
|
893
893
|
o,
|
|
894
|
-
`inputs.${
|
|
894
|
+
`inputs.${i}`,
|
|
895
895
|
t
|
|
896
896
|
);
|
|
897
897
|
}), h(e.expression) && g(e.inputs)) {
|
|
898
|
-
const
|
|
898
|
+
const i = Fn(
|
|
899
899
|
e.expression
|
|
900
|
-
), o = new Set(
|
|
900
|
+
), o = new Set(i), a = Object.keys(e.inputs).filter(
|
|
901
901
|
(r) => h(r)
|
|
902
902
|
);
|
|
903
|
-
|
|
903
|
+
i.forEach((r) => {
|
|
904
904
|
Object.prototype.hasOwnProperty.call(e.inputs, r) || t.push(
|
|
905
905
|
d(
|
|
906
906
|
"invalid_derived_field_expression_token",
|
|
@@ -908,7 +908,7 @@ function Ae(e) {
|
|
|
908
908
|
"expression"
|
|
909
909
|
)
|
|
910
910
|
);
|
|
911
|
-
}),
|
|
911
|
+
}), a.forEach((r) => {
|
|
912
912
|
o.has(r) || t.push(
|
|
913
913
|
d(
|
|
914
914
|
"unused_derived_field_input",
|
|
@@ -918,14 +918,14 @@ function Ae(e) {
|
|
|
918
918
|
);
|
|
919
919
|
});
|
|
920
920
|
}
|
|
921
|
-
const
|
|
922
|
-
return g(
|
|
921
|
+
const n = e.format;
|
|
922
|
+
return g(n) && n.type === "temporal_bucket" ? t.push(
|
|
923
923
|
d(
|
|
924
924
|
"invalid_derived_field_format",
|
|
925
925
|
"Derived field computation metadata cannot own temporal bucket presentation; declare grain and format on the grouped field.",
|
|
926
926
|
"format"
|
|
927
927
|
)
|
|
928
|
-
) :
|
|
928
|
+
) : Cn(n, "format", t), e.tags !== void 0 && (!Array.isArray(e.tags) || e.tags.some((i) => !h(i))) && t.push(
|
|
929
929
|
d(
|
|
930
930
|
"invalid_derived_field_tags",
|
|
931
931
|
"Derived field tags must be non-empty strings.",
|
|
@@ -933,41 +933,41 @@ function Ae(e) {
|
|
|
933
933
|
)
|
|
934
934
|
), { ok: t.length === 0, errors: t, warnings: [] };
|
|
935
935
|
}
|
|
936
|
-
const Y =
|
|
936
|
+
const Y = s.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), $e = s.union([
|
|
937
937
|
Wt.extend({ domainId: Y, datasetName: Y }).strict(),
|
|
938
938
|
Ut.extend({ connectionId: Y, tableName: Y }).strict()
|
|
939
|
-
]),
|
|
939
|
+
]), ht = Vt.extend({
|
|
940
940
|
name: Y,
|
|
941
941
|
source: $e.optional()
|
|
942
942
|
}).strict(), De = Ht.extend({
|
|
943
943
|
format: zt.optional(),
|
|
944
|
-
inputs:
|
|
945
|
-
|
|
946
|
-
kind:
|
|
947
|
-
field:
|
|
948
|
-
aggregate:
|
|
944
|
+
inputs: s.record(
|
|
945
|
+
s.object({
|
|
946
|
+
kind: s.literal("field"),
|
|
947
|
+
field: ht,
|
|
948
|
+
aggregate: it.optional()
|
|
949
949
|
}).strict()
|
|
950
950
|
)
|
|
951
951
|
}).strict().superRefine((e, t) => {
|
|
952
|
-
var
|
|
953
|
-
for (const
|
|
952
|
+
var n;
|
|
953
|
+
for (const i of Ae(e).errors)
|
|
954
954
|
t.addIssue({
|
|
955
955
|
code: "custom",
|
|
956
|
-
path: ((
|
|
957
|
-
message:
|
|
956
|
+
path: ((n = i.path) == null ? void 0 : n.split(".")) ?? [],
|
|
957
|
+
message: i.message
|
|
958
958
|
});
|
|
959
|
-
}),
|
|
959
|
+
}), Pn = ht.extend({
|
|
960
960
|
derivedField: De.optional()
|
|
961
961
|
}).strict();
|
|
962
962
|
function xe(e) {
|
|
963
963
|
return typeof e == "string" ? e.trim().toLowerCase() : "";
|
|
964
964
|
}
|
|
965
|
-
function
|
|
965
|
+
function qn(e) {
|
|
966
966
|
return String(
|
|
967
967
|
e.column_name || e.name || e.qualifiedFieldName || ""
|
|
968
968
|
);
|
|
969
969
|
}
|
|
970
|
-
function
|
|
970
|
+
function Bn(e) {
|
|
971
971
|
return Array.from(
|
|
972
972
|
new Set(
|
|
973
973
|
[e.column_name, e.name, e.qualifiedFieldName, e.alias].filter(
|
|
@@ -977,8 +977,8 @@ function qi(e) {
|
|
|
977
977
|
);
|
|
978
978
|
}
|
|
979
979
|
function Fe(e) {
|
|
980
|
-
const t =
|
|
981
|
-
return t ?
|
|
980
|
+
const t = Ee(e);
|
|
981
|
+
return t ? Hn(t) ? "number" : t.includes("timestamp") || t.includes("datetime") || t.startsWith("time") ? "datetime" : t.includes("date") ? "date" : t.includes("bool") ? "boolean" : "string" : "unknown";
|
|
982
982
|
}
|
|
983
983
|
const de = /* @__PURE__ */ new Map([
|
|
984
984
|
// Integer families (PostgreSQL, ClickHouse, DuckDB, MySQL).
|
|
@@ -1009,93 +1009,101 @@ const de = /* @__PURE__ */ new Map([
|
|
|
1009
1009
|
["money", null],
|
|
1010
1010
|
["currency", null],
|
|
1011
1011
|
["percent", null]
|
|
1012
|
-
]),
|
|
1013
|
-
function
|
|
1012
|
+
]), Wn = ["int", "uint", "decimal", "float"];
|
|
1013
|
+
function Un(e) {
|
|
1014
1014
|
return e.length > 0 && Array.from(e).every((t) => t >= "0" && t <= "9");
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1017
|
-
var
|
|
1018
|
-
const t = (
|
|
1016
|
+
function Vn(e) {
|
|
1017
|
+
var n;
|
|
1018
|
+
const t = (n = /^number\s*\(\s*\d+\s*,\s*(\d+)\s*\)$/.exec(e)) == null ? void 0 : n[1];
|
|
1019
1019
|
return t === void 0 ? null : Number(t) === 0 ? "integer" : "decimal";
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1021
|
+
function Me(e) {
|
|
1022
1022
|
const t = e.split(/[\s(]/, 1)[0] || "";
|
|
1023
1023
|
if (t === "number")
|
|
1024
|
-
return { numeric: !0, kind:
|
|
1024
|
+
return { numeric: !0, kind: Vn(e) };
|
|
1025
1025
|
if (de.has(t))
|
|
1026
1026
|
return { numeric: !0, kind: de.get(t) ?? null };
|
|
1027
|
-
const
|
|
1028
|
-
(
|
|
1027
|
+
const n = Wn.find(
|
|
1028
|
+
(i) => t.startsWith(i) && Un(t.slice(i.length))
|
|
1029
1029
|
);
|
|
1030
|
-
return
|
|
1030
|
+
return n ? { numeric: !0, kind: de.get(n) ?? null } : { numeric: !1, kind: null };
|
|
1031
1031
|
}
|
|
1032
|
-
function
|
|
1033
|
-
return
|
|
1032
|
+
function Hn(e) {
|
|
1033
|
+
return Me(e).numeric;
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1036
|
-
return
|
|
1035
|
+
function zn(e) {
|
|
1036
|
+
return Me(Ee(e)).kind;
|
|
1037
1037
|
}
|
|
1038
|
-
function
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1038
|
+
function ga(e) {
|
|
1039
|
+
var o, a;
|
|
1040
|
+
const t = Ee(e), n = Me(t).kind;
|
|
1041
|
+
if (n === "integer") return 0;
|
|
1042
|
+
if (n !== "decimal") return null;
|
|
1043
|
+
const i = ((o = /^(?:decimal|numeric|number)\s*\(\s*\d+\s*,\s*(\d+)\s*\)$/.exec(t)) == null ? void 0 : o[1]) ?? ((a = /^decimal(?:32|64|128|256)\s*\(\s*(\d+)\s*\)$/.exec(t)) == null ? void 0 : a[1]);
|
|
1044
|
+
return i === void 0 ? null : Number(i);
|
|
1045
|
+
}
|
|
1046
|
+
function Ee(e) {
|
|
1047
|
+
let t = xe(e), n = "";
|
|
1048
|
+
for (; t && t !== n; )
|
|
1049
|
+
n = t, t = We(t, "nullable"), t = We(t, "lowcardinality");
|
|
1042
1050
|
return t;
|
|
1043
1051
|
}
|
|
1044
|
-
function
|
|
1045
|
-
const
|
|
1046
|
-
return !e.startsWith(
|
|
1052
|
+
function We(e, t) {
|
|
1053
|
+
const n = `${t}(`;
|
|
1054
|
+
return !e.startsWith(n) || !e.endsWith(")") ? e : e.slice(n.length, -1).trim();
|
|
1047
1055
|
}
|
|
1048
|
-
function
|
|
1056
|
+
function Gn(e) {
|
|
1049
1057
|
const t = Fe(e);
|
|
1050
1058
|
return t === "date" || t === "datetime";
|
|
1051
1059
|
}
|
|
1052
1060
|
function gt(e) {
|
|
1053
|
-
return
|
|
1061
|
+
return Gn(e.dataType || e.data_type);
|
|
1054
1062
|
}
|
|
1055
1063
|
function yt(e) {
|
|
1056
1064
|
const t = _t(e);
|
|
1057
1065
|
return t === "id" || t === "row_id";
|
|
1058
1066
|
}
|
|
1059
|
-
function
|
|
1067
|
+
function Ue(e) {
|
|
1060
1068
|
const t = _t(e);
|
|
1061
1069
|
return yt(e) || t.endsWith("_id") || t.endsWith("_key") || t.endsWith("_number");
|
|
1062
1070
|
}
|
|
1063
1071
|
function _t(e) {
|
|
1064
1072
|
return xe(
|
|
1065
|
-
|
|
1073
|
+
qn(e) || e.name || e.alias
|
|
1066
1074
|
).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
1067
1075
|
}
|
|
1068
1076
|
function bt(e, t = {}) {
|
|
1069
|
-
const
|
|
1070
|
-
return
|
|
1077
|
+
const n = xe(e.role);
|
|
1078
|
+
return n === "metric" || n === "measure" ? !t.excludeIdentifiers || !Ue(e) : n === "groupby" || n === "dimension" || n === "date" || n === "id" ? !1 : Fe(
|
|
1071
1079
|
e.dataType || e.data_type
|
|
1072
|
-
) === "number" && (!t.excludeIdentifiers || !
|
|
1080
|
+
) === "number" && (!t.excludeIdentifiers || !Ue(e));
|
|
1073
1081
|
}
|
|
1074
|
-
function
|
|
1082
|
+
function ya(e) {
|
|
1075
1083
|
return !bt(e) && !gt(e);
|
|
1076
1084
|
}
|
|
1077
|
-
function
|
|
1078
|
-
const t = /* @__PURE__ */ new Set(),
|
|
1085
|
+
function _a(e) {
|
|
1086
|
+
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
1079
1087
|
for (const o of e) {
|
|
1080
1088
|
if (yt(o))
|
|
1081
1089
|
continue;
|
|
1082
|
-
const
|
|
1083
|
-
if (
|
|
1090
|
+
const a = Bn(o);
|
|
1091
|
+
if (a.length !== 0) {
|
|
1084
1092
|
if (gt(o)) {
|
|
1085
|
-
|
|
1093
|
+
a.forEach((r) => n.add(r));
|
|
1086
1094
|
continue;
|
|
1087
1095
|
}
|
|
1088
1096
|
if (bt(o, { excludeIdentifiers: !0 })) {
|
|
1089
|
-
|
|
1097
|
+
a.forEach((r) => t.add(r));
|
|
1090
1098
|
continue;
|
|
1091
1099
|
}
|
|
1092
|
-
|
|
1100
|
+
a.forEach((r) => i.add(r));
|
|
1093
1101
|
}
|
|
1094
1102
|
}
|
|
1095
1103
|
return {
|
|
1096
1104
|
validMeasureCandidates: Array.from(t).sort(),
|
|
1097
|
-
validDateCandidates: Array.from(
|
|
1098
|
-
validDimensionCandidates: Array.from(
|
|
1105
|
+
validDateCandidates: Array.from(n).sort(),
|
|
1106
|
+
validDimensionCandidates: Array.from(i).sort()
|
|
1099
1107
|
};
|
|
1100
1108
|
}
|
|
1101
1109
|
const P = 16 * 1024;
|
|
@@ -1108,25 +1116,25 @@ function ee(e) {
|
|
|
1108
1116
|
exponent: Number(t[5] ?? "0")
|
|
1109
1117
|
} : null;
|
|
1110
1118
|
}
|
|
1111
|
-
function
|
|
1112
|
-
const { sign: t, whole:
|
|
1119
|
+
function Ve(e) {
|
|
1120
|
+
const { sign: t, whole: n, fraction: i = "", exponent: o } = e, a = (n + i).replace(/^0+/, ""), r = a.replace(/0+$/, ""), l = o - i.length + a.length - r.length;
|
|
1113
1121
|
return !Number.isSafeInteger(o) || !Number.isSafeInteger(l) ? null : r ? `${t === "-" ? "-" : ""}${r}e${l}` : "0";
|
|
1114
1122
|
}
|
|
1115
|
-
function
|
|
1123
|
+
function ba(e) {
|
|
1116
1124
|
const t = ee(e);
|
|
1117
1125
|
if (!t) return null;
|
|
1118
|
-
const
|
|
1119
|
-
if (!Number.isFinite(
|
|
1120
|
-
const o =
|
|
1121
|
-
return o !== null &&
|
|
1126
|
+
const n = t.sign === "+" ? e.slice(1) : e, i = Number(e);
|
|
1127
|
+
if (!Number.isFinite(i)) return n;
|
|
1128
|
+
const o = Ve(t), a = ee(String(i));
|
|
1129
|
+
return o !== null && a !== null && o === Ve(a) ? i : n;
|
|
1122
1130
|
}
|
|
1123
|
-
function
|
|
1131
|
+
function va(e) {
|
|
1124
1132
|
if (e.length > P)
|
|
1125
1133
|
throw new RangeError("Exact numeric text exceeds 16 KiB.");
|
|
1126
1134
|
const t = ee(e);
|
|
1127
1135
|
if (!t) throw new TypeError("Expected finite decimal text.");
|
|
1128
|
-
const { sign:
|
|
1129
|
-
return U(`${r}e${
|
|
1136
|
+
const { sign: n, whole: i, fraction: o, exponent: a } = t, r = `${n}${i || "0"}${o ? `.${o}` : ""}`;
|
|
1137
|
+
return U(`${r}e${a}`);
|
|
1130
1138
|
}
|
|
1131
1139
|
function U(e) {
|
|
1132
1140
|
if (e.length > P)
|
|
@@ -1134,65 +1142,65 @@ function U(e) {
|
|
|
1134
1142
|
const t = ee(e);
|
|
1135
1143
|
if (!t || t.whole === "" || t.fraction === "")
|
|
1136
1144
|
throw new TypeError("Expected finite decimal text.");
|
|
1137
|
-
const { sign:
|
|
1138
|
-
if (!Number.isSafeInteger(
|
|
1145
|
+
const { sign: n, whole: i, fraction: o = "", exponent: a } = t;
|
|
1146
|
+
if (!Number.isSafeInteger(a) || Math.abs(a) > P)
|
|
1139
1147
|
throw new RangeError("Exact numeric exponent exceeds the text budget.");
|
|
1140
|
-
const r =
|
|
1148
|
+
const r = i + o, l = i.length + a;
|
|
1141
1149
|
if (Math.max(r.length, l) + Math.max(0, -l) + 3 > P)
|
|
1142
1150
|
throw new RangeError("Normalized exact numeric text exceeds 16 KiB.");
|
|
1143
1151
|
let m;
|
|
1144
1152
|
l <= 0 ? m = `0.${"0".repeat(-l)}${r}` : l >= r.length ? m = r + "0".repeat(l - r.length) : m = `${r.slice(0, l)}.${r.slice(l)}`;
|
|
1145
1153
|
const [u, p = ""] = m.split("."), f = u.replace(/^0+(?=\d)/, ""), b = p.replace(/0+$/, ""), A = f + (b ? `.${b}` : "");
|
|
1146
|
-
return
|
|
1154
|
+
return n === "-" && A !== "0" ? `-${A}` : A;
|
|
1147
1155
|
}
|
|
1148
|
-
function
|
|
1149
|
-
const
|
|
1150
|
-
if (
|
|
1151
|
-
const [o,
|
|
1156
|
+
function Ia(e, t) {
|
|
1157
|
+
const n = e.startsWith("-"), i = t.startsWith("-");
|
|
1158
|
+
if (n !== i) return n ? -1 : 1;
|
|
1159
|
+
const [o, a = ""] = (n ? e.slice(1) : e).split("."), [r, l = ""] = (i ? t.slice(1) : t).split(".");
|
|
1152
1160
|
let c = Math.sign(o.length - r.length);
|
|
1153
1161
|
if (!c && o !== r && (c = o < r ? -1 : 1), !c) {
|
|
1154
|
-
const m = Math.max(
|
|
1162
|
+
const m = Math.max(a.length, l.length), u = a.padEnd(m, "0"), p = l.padEnd(m, "0");
|
|
1155
1163
|
c = u === p ? 0 : u < p ? -1 : 1;
|
|
1156
1164
|
}
|
|
1157
|
-
return c === 0 ? 0 :
|
|
1165
|
+
return c === 0 ? 0 : n ? -c : c;
|
|
1158
1166
|
}
|
|
1159
|
-
function
|
|
1167
|
+
function Sa(e, t) {
|
|
1160
1168
|
if (typeof t == "number" && !Number.isFinite(t))
|
|
1161
1169
|
throw new TypeError("Numeric scale must be finite.");
|
|
1162
|
-
const
|
|
1163
|
-
const [r, l = ""] =
|
|
1170
|
+
const n = [e, U(String(t))].map((a) => {
|
|
1171
|
+
const [r, l = ""] = a.split(".");
|
|
1164
1172
|
return { coefficient: BigInt(r + l), digits: l.length };
|
|
1165
|
-
}),
|
|
1166
|
-
return U(`${
|
|
1173
|
+
}), i = n[0].coefficient * n[1].coefficient, o = n[0].digits + n[1].digits;
|
|
1174
|
+
return U(`${i}e-${o}`);
|
|
1167
1175
|
}
|
|
1168
|
-
function
|
|
1176
|
+
function Qn(e) {
|
|
1169
1177
|
try {
|
|
1170
1178
|
return U(e) === e;
|
|
1171
1179
|
} catch {
|
|
1172
1180
|
return !1;
|
|
1173
1181
|
}
|
|
1174
1182
|
}
|
|
1175
|
-
const vt =
|
|
1176
|
-
kind:
|
|
1177
|
-
type:
|
|
1178
|
-
value:
|
|
1183
|
+
const vt = s.object({
|
|
1184
|
+
kind: s.literal("exact_number"),
|
|
1185
|
+
type: s.enum(["integer", "decimal"]),
|
|
1186
|
+
value: s.string().max(P).refine(Qn, "Expected canonical decimal text.")
|
|
1179
1187
|
}).strict().superRefine((e, t) => {
|
|
1180
1188
|
e.type === "integer" && e.value.includes(".") && t.addIssue({ code: "custom", path: ["value"], message: "An integer cannot have fractional digits." });
|
|
1181
|
-
}),
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1189
|
+
}), Xn = s.union([
|
|
1190
|
+
s.null(),
|
|
1191
|
+
s.string(),
|
|
1192
|
+
s.boolean(),
|
|
1193
|
+
s.number().finite(),
|
|
1186
1194
|
vt
|
|
1187
1195
|
]);
|
|
1188
|
-
function
|
|
1196
|
+
function Kn(e, t) {
|
|
1189
1197
|
return vt.parse({ kind: "exact_number", type: t, value: U(e) });
|
|
1190
1198
|
}
|
|
1191
|
-
function
|
|
1199
|
+
function wa(e) {
|
|
1192
1200
|
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";
|
|
1193
1201
|
}
|
|
1194
|
-
function
|
|
1195
|
-
const t =
|
|
1202
|
+
function ka(e) {
|
|
1203
|
+
const t = zn(e.nativeDataType);
|
|
1196
1204
|
if (!t) throw new TypeError("Numeric result type is not established.");
|
|
1197
1205
|
if (e.value === null) return null;
|
|
1198
1206
|
if (t === "float") {
|
|
@@ -1202,41 +1210,41 @@ function wa(e) {
|
|
|
1202
1210
|
}
|
|
1203
1211
|
if (e.exactText === void 0)
|
|
1204
1212
|
throw new TypeError("Exact numeric sidecar is required; rounded result values cannot substitute.");
|
|
1205
|
-
return
|
|
1213
|
+
return Kn(e.exactText, t);
|
|
1206
1214
|
}
|
|
1207
|
-
const
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
]), T =
|
|
1211
|
-
new Set(e.map((
|
|
1215
|
+
const Ne = s.string().uuid(), Te = s.enum(["rows", "columns"]), Aa = s.enum(["member", "subtotal", "grand_total", "others"]), Zn = s.discriminatedUnion("kind", [
|
|
1216
|
+
s.object({ kind: s.literal("value"), value: Xn }).strict(),
|
|
1217
|
+
s.object({ kind: s.literal("others"), rankingId: Ne }).strict()
|
|
1218
|
+
]), T = s.array(s.object({ levelId: Ne, member: Zn }).strict()).readonly().superRefine((e, t) => {
|
|
1219
|
+
new Set(e.map((n) => n.levelId)).size !== e.length && t.addIssue({
|
|
1212
1220
|
code: "custom",
|
|
1213
1221
|
path: [],
|
|
1214
1222
|
message: "Duplicate identity."
|
|
1215
1223
|
}), e.some(
|
|
1216
|
-
(
|
|
1224
|
+
(n, i) => n.member.kind === "others" && i !== e.length - 1
|
|
1217
1225
|
) && t.addIssue({
|
|
1218
1226
|
code: "custom",
|
|
1219
1227
|
path: [],
|
|
1220
1228
|
message: "Others is terminal."
|
|
1221
1229
|
});
|
|
1222
|
-
}),
|
|
1230
|
+
}), $a = s.object({
|
|
1223
1231
|
rowPath: T,
|
|
1224
1232
|
columnPath: T,
|
|
1225
|
-
measureId:
|
|
1233
|
+
measureId: Ne
|
|
1226
1234
|
}).strict();
|
|
1227
1235
|
function It(e) {
|
|
1228
1236
|
return JSON.stringify(
|
|
1229
|
-
e.map(({ levelId: t, member:
|
|
1237
|
+
e.map(({ levelId: t, member: n }) => [
|
|
1230
1238
|
t,
|
|
1231
|
-
|
|
1239
|
+
n.kind === "others" ? ["others", n.rankingId] : typeof n.value == "object" && n.value !== null ? ["exact_number", n.value.value] : [typeof n.value, n.value]
|
|
1232
1240
|
])
|
|
1233
1241
|
);
|
|
1234
1242
|
}
|
|
1235
|
-
const ye = "SEMAPHOR_CALCULATED_FIELD",
|
|
1236
|
-
function
|
|
1243
|
+
const ye = "SEMAPHOR_CALCULATED_FIELD", Jn = "calculated_fields";
|
|
1244
|
+
function ei(e) {
|
|
1237
1245
|
return (e == null ? void 0 : e.sourceField) || (e == null ? void 0 : e.name) || "";
|
|
1238
1246
|
}
|
|
1239
|
-
const
|
|
1247
|
+
const ti = [
|
|
1240
1248
|
// Day granularity formats
|
|
1241
1249
|
"MM-DD-YYYY",
|
|
1242
1250
|
"YYYY-MM-DD",
|
|
@@ -1271,13 +1279,13 @@ const en = [
|
|
|
1271
1279
|
// Custom format
|
|
1272
1280
|
"custom"
|
|
1273
1281
|
];
|
|
1274
|
-
function
|
|
1282
|
+
function Da(e) {
|
|
1275
1283
|
return e.role === "metric" && "expression" in e && !!e.expression;
|
|
1276
1284
|
}
|
|
1277
|
-
function
|
|
1285
|
+
function xa(e) {
|
|
1278
1286
|
return !!e.expression;
|
|
1279
1287
|
}
|
|
1280
|
-
function
|
|
1288
|
+
function ni(e) {
|
|
1281
1289
|
return !!(e && (e.calculationRepresentation || e.expression || e.derivedField || e.calculatedFieldOrigin || e.calculatedFormula || _e(e)));
|
|
1282
1290
|
}
|
|
1283
1291
|
function St(e) {
|
|
@@ -1290,22 +1298,22 @@ function St(e) {
|
|
|
1290
1298
|
runtimeExecutable: !1,
|
|
1291
1299
|
legacyManual: !1
|
|
1292
1300
|
};
|
|
1293
|
-
const t = e.fieldScope === "domain" ? "domain" : "local",
|
|
1294
|
-
const
|
|
1295
|
-
return typeof
|
|
1296
|
-
}), o = typeof e.expression == "string" && !!e.expression.trim() &&
|
|
1297
|
-
if (e.derivedField ||
|
|
1301
|
+
const t = e.fieldScope === "domain" ? "domain" : "local", n = ((p = e.derivedField) == null ? void 0 : p.computeStage) || ((f = e.calculatedFormula) == null ? void 0 : f.computeStage), i = !e.calculatedFormula || Array.isArray(e.calculatedFormula.inputFields) && e.calculatedFormula.inputFields.every((A) => {
|
|
1302
|
+
const Le = A && ei(A);
|
|
1303
|
+
return typeof Le == "string" && !!Le.trim();
|
|
1304
|
+
}), o = typeof e.expression == "string" && !!e.expression.trim() && i, a = e.calculationRepresentation;
|
|
1305
|
+
if (e.derivedField || a === "typed-derived") {
|
|
1298
1306
|
const A = e.derivedField !== void 0 && Ae(e.derivedField).ok;
|
|
1299
1307
|
return {
|
|
1300
1308
|
representation: "typed-derived",
|
|
1301
1309
|
ownership: t,
|
|
1302
|
-
completeness: (!
|
|
1303
|
-
computeStage:
|
|
1310
|
+
completeness: (!a || a === "typed-derived") && A && (!e.expression && !e.calculatedFormula || o) ? "complete" : "incomplete",
|
|
1311
|
+
computeStage: n,
|
|
1304
1312
|
runtimeExecutable: o,
|
|
1305
1313
|
legacyManual: !1
|
|
1306
1314
|
};
|
|
1307
1315
|
}
|
|
1308
|
-
if (!(!!
|
|
1316
|
+
if (!(!!a || ni(e)))
|
|
1309
1317
|
return {
|
|
1310
1318
|
representation: "physical",
|
|
1311
1319
|
ownership: t,
|
|
@@ -1313,7 +1321,7 @@ function St(e) {
|
|
|
1313
1321
|
runtimeExecutable: !1,
|
|
1314
1322
|
legacyManual: !1
|
|
1315
1323
|
};
|
|
1316
|
-
const l =
|
|
1324
|
+
const l = n || (e.role === "groupby" || ((b = e.calculatedFieldOrigin) == null ? void 0 : b.role) === "groupby" ? "row" : void 0), c = t === "domain" || _e(e) || e.fieldScope === "card" || e.fieldScope === "sheet" || e.fieldScope === "dashboard" ? "manual" : "inline-expression", m = a === "manual" || a === "inline-expression" ? a : c, u = (!a || a === "manual" || a === "inline-expression") && !(a === "inline-expression" && _e(e));
|
|
1317
1325
|
return {
|
|
1318
1326
|
representation: m,
|
|
1319
1327
|
ownership: t,
|
|
@@ -1323,63 +1331,63 @@ function St(e) {
|
|
|
1323
1331
|
legacyManual: m === "manual" && t === "local" && !l
|
|
1324
1332
|
};
|
|
1325
1333
|
}
|
|
1326
|
-
function
|
|
1334
|
+
function Fa(e) {
|
|
1327
1335
|
if (e.calculationRepresentation) return e;
|
|
1328
1336
|
const { representation: t } = St(e);
|
|
1329
1337
|
return t === "physical" ? e : { ...e, calculationRepresentation: t };
|
|
1330
1338
|
}
|
|
1331
|
-
function
|
|
1339
|
+
function Ma(e) {
|
|
1332
1340
|
return St(e).computeStage;
|
|
1333
1341
|
}
|
|
1334
|
-
function
|
|
1342
|
+
function Ea(e, t) {
|
|
1335
1343
|
return e === "aggregate" && t === "default";
|
|
1336
1344
|
}
|
|
1337
|
-
function
|
|
1338
|
-
var
|
|
1345
|
+
function Na(e) {
|
|
1346
|
+
var n, i;
|
|
1339
1347
|
const t = e;
|
|
1340
|
-
return !!(t != null && t.expression && ((
|
|
1348
|
+
return !!(t != null && t.expression && ((i = (n = t.calculatedFormula) == null ? void 0 : n.inputFields) != null && i.length));
|
|
1341
1349
|
}
|
|
1342
|
-
function
|
|
1350
|
+
function Ta(e) {
|
|
1343
1351
|
return !!(e && (e.entityName === ye || e.entityId === ye));
|
|
1344
1352
|
}
|
|
1345
1353
|
function _e(e) {
|
|
1346
1354
|
return e ? [e.entityName, e.entityId, e.qualifiedEntityName].some(
|
|
1347
|
-
(t) => t === ye || t ===
|
|
1355
|
+
(t) => t === ye || t === Jn
|
|
1348
1356
|
) : !1;
|
|
1349
1357
|
}
|
|
1350
|
-
function
|
|
1358
|
+
function ii(e) {
|
|
1351
1359
|
const t = kt(e);
|
|
1352
1360
|
return t.length > 0 ? t.join(".") : void 0;
|
|
1353
1361
|
}
|
|
1354
|
-
function
|
|
1355
|
-
const t =
|
|
1362
|
+
function Ra(e) {
|
|
1363
|
+
const t = ii(
|
|
1356
1364
|
e.qualifiedName
|
|
1357
|
-
),
|
|
1358
|
-
if (
|
|
1359
|
-
const
|
|
1360
|
-
let o =
|
|
1361
|
-
for (let
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
e.capabilities.prefixLevels[
|
|
1365
|
-
|
|
1365
|
+
), n = (t == null ? void 0 : t.split(".")) || [];
|
|
1366
|
+
if (n.length === 0) return {};
|
|
1367
|
+
const i = {};
|
|
1368
|
+
let o = n.length - 1;
|
|
1369
|
+
for (let a = e.capabilities.prefixLevels.length - 1; a >= 0 && o >= 0; a -= 1, o -= 1)
|
|
1370
|
+
ri(
|
|
1371
|
+
i,
|
|
1372
|
+
e.capabilities.prefixLevels[a],
|
|
1373
|
+
n[o]
|
|
1366
1374
|
);
|
|
1367
|
-
return
|
|
1375
|
+
return i;
|
|
1368
1376
|
}
|
|
1369
|
-
function
|
|
1377
|
+
function ja(e) {
|
|
1370
1378
|
return !e.left.tableName || !e.right.tableName ? !1 : e.capabilities.prefixLevels.every((t) => {
|
|
1371
|
-
const
|
|
1372
|
-
return !
|
|
1379
|
+
const n = R(e.left, t), i = R(e.right, t);
|
|
1380
|
+
return !n || !i || n === i;
|
|
1373
1381
|
});
|
|
1374
1382
|
}
|
|
1375
|
-
function
|
|
1383
|
+
function Ca(e) {
|
|
1376
1384
|
return e.capabilities.prefixLevels.every((t) => {
|
|
1377
|
-
const
|
|
1378
|
-
return
|
|
1385
|
+
const n = R(e.requested, t);
|
|
1386
|
+
return n ? R(e.allowed, t) === n : !0;
|
|
1379
1387
|
});
|
|
1380
1388
|
}
|
|
1381
1389
|
function wt(e, t = {}) {
|
|
1382
|
-
const
|
|
1390
|
+
const n = V(e), i = {
|
|
1383
1391
|
connectionId: t.connectionId,
|
|
1384
1392
|
connectionType: e,
|
|
1385
1393
|
path: ["database", "schema", "table"],
|
|
@@ -1392,27 +1400,27 @@ function wt(e, t = {}) {
|
|
|
1392
1400
|
dialect: "postgres",
|
|
1393
1401
|
supportsFilterClause: !0
|
|
1394
1402
|
};
|
|
1395
|
-
return
|
|
1396
|
-
...
|
|
1403
|
+
return n.includes("postgres") ? {
|
|
1404
|
+
...i,
|
|
1397
1405
|
prefixLevels: ["schema", "table"],
|
|
1398
1406
|
dialect: "postgres"
|
|
1399
|
-
} :
|
|
1400
|
-
...
|
|
1407
|
+
} : n.includes("mysql") ? {
|
|
1408
|
+
...i,
|
|
1401
1409
|
prefixLevels: ["database", "table"],
|
|
1402
1410
|
dialect: "mysql",
|
|
1403
1411
|
supportsFilterClause: !1
|
|
1404
|
-
} :
|
|
1405
|
-
...
|
|
1412
|
+
} : n.includes("mssql") || n.includes("sqlserver") ? {
|
|
1413
|
+
...i,
|
|
1406
1414
|
dialect: "mssql",
|
|
1407
1415
|
supportsFilterClause: !1
|
|
1408
|
-
} :
|
|
1409
|
-
...
|
|
1416
|
+
} : n.includes("redshift") ? {
|
|
1417
|
+
...i,
|
|
1410
1418
|
prefixLevels: ["schema", "table"],
|
|
1411
1419
|
dialect: "redshift"
|
|
1412
|
-
} :
|
|
1413
|
-
...
|
|
1420
|
+
} : n.includes("snowflake") ? {
|
|
1421
|
+
...i,
|
|
1414
1422
|
dialect: "snowflake"
|
|
1415
|
-
} :
|
|
1423
|
+
} : n.includes("clickhouse") ? {
|
|
1416
1424
|
connectionId: t.connectionId,
|
|
1417
1425
|
connectionType: e,
|
|
1418
1426
|
path: ["database", "table"],
|
|
@@ -1423,17 +1431,17 @@ function wt(e, t = {}) {
|
|
|
1423
1431
|
prefixLevels: ["database", "table"],
|
|
1424
1432
|
dialect: "clickhouse",
|
|
1425
1433
|
supportsFilterClause: !1
|
|
1426
|
-
} :
|
|
1434
|
+
} : n === "s3" || n === "api" ? {
|
|
1427
1435
|
connectionId: t.connectionId,
|
|
1428
1436
|
connectionType: e,
|
|
1429
1437
|
path: ["table"],
|
|
1430
1438
|
labels: {
|
|
1431
|
-
table:
|
|
1439
|
+
table: n === "api" ? "API Table" : "File Table"
|
|
1432
1440
|
},
|
|
1433
1441
|
prefixLevels: ["table"],
|
|
1434
1442
|
dialect: "duckdb",
|
|
1435
1443
|
supportsFilterClause: !0
|
|
1436
|
-
} :
|
|
1444
|
+
} : n === "googlesheets" || n === "fileupload" ? {
|
|
1437
1445
|
connectionId: t.connectionId,
|
|
1438
1446
|
connectionType: e,
|
|
1439
1447
|
path: ["table"],
|
|
@@ -1443,8 +1451,8 @@ function wt(e, t = {}) {
|
|
|
1443
1451
|
prefixLevels: ["table"],
|
|
1444
1452
|
dialect: "postgres",
|
|
1445
1453
|
supportsFilterClause: !0
|
|
1446
|
-
} :
|
|
1447
|
-
...
|
|
1454
|
+
} : n === "bigquery" ? {
|
|
1455
|
+
...i,
|
|
1448
1456
|
labels: {
|
|
1449
1457
|
database: "Project",
|
|
1450
1458
|
schema: "Dataset",
|
|
@@ -1453,9 +1461,9 @@ function wt(e, t = {}) {
|
|
|
1453
1461
|
prefixLevels: ["schema", "table"],
|
|
1454
1462
|
dialect: "bigquery",
|
|
1455
1463
|
supportsFilterClause: !1
|
|
1456
|
-
} :
|
|
1464
|
+
} : i;
|
|
1457
1465
|
}
|
|
1458
|
-
const
|
|
1466
|
+
const Re = [
|
|
1459
1467
|
"GoogleSheets",
|
|
1460
1468
|
"FileUpload",
|
|
1461
1469
|
"MySQL",
|
|
@@ -1469,30 +1477,30 @@ const Ne = [
|
|
|
1469
1477
|
"API",
|
|
1470
1478
|
"none"
|
|
1471
1479
|
];
|
|
1472
|
-
function
|
|
1480
|
+
function Oa(e) {
|
|
1473
1481
|
if (!e) return;
|
|
1474
|
-
const t =
|
|
1475
|
-
(
|
|
1482
|
+
const t = Re.filter(
|
|
1483
|
+
(n) => n !== "none" && wt(n).dialect === e
|
|
1476
1484
|
);
|
|
1477
1485
|
return t.length === 1 ? t[0] : void 0;
|
|
1478
1486
|
}
|
|
1479
|
-
const
|
|
1487
|
+
const ai = {
|
|
1480
1488
|
postgres: "PostgreSQL",
|
|
1481
1489
|
sqlserver: "MSSQL"
|
|
1482
1490
|
};
|
|
1483
|
-
function
|
|
1491
|
+
function Ya(e) {
|
|
1484
1492
|
const t = V(e);
|
|
1485
1493
|
if (t)
|
|
1486
|
-
return
|
|
1487
|
-
(
|
|
1488
|
-
) ??
|
|
1494
|
+
return Re.find(
|
|
1495
|
+
(n) => V(n) === t
|
|
1496
|
+
) ?? ai[t];
|
|
1489
1497
|
}
|
|
1490
|
-
function
|
|
1491
|
-
return
|
|
1498
|
+
function La(e, t = {}) {
|
|
1499
|
+
return si(
|
|
1492
1500
|
e
|
|
1493
1501
|
) ? wt(e, t) : void 0;
|
|
1494
1502
|
}
|
|
1495
|
-
function
|
|
1503
|
+
function si(e) {
|
|
1496
1504
|
const t = V(e);
|
|
1497
1505
|
if (t.includes("postgres")) return "postgres";
|
|
1498
1506
|
if (t.includes("mysql")) return "mysql";
|
|
@@ -1504,7 +1512,7 @@ function sn(e) {
|
|
|
1504
1512
|
if (t === "s3" || t === "api" || t === "googlesheets" || t === "fileupload" || t === "bigquery")
|
|
1505
1513
|
return t;
|
|
1506
1514
|
}
|
|
1507
|
-
function
|
|
1515
|
+
function Pa(e) {
|
|
1508
1516
|
const t = V(e);
|
|
1509
1517
|
switch (t) {
|
|
1510
1518
|
case "mysql":
|
|
@@ -1525,59 +1533,59 @@ function La(e) {
|
|
|
1525
1533
|
return "unknown";
|
|
1526
1534
|
}
|
|
1527
1535
|
}
|
|
1528
|
-
function
|
|
1536
|
+
function qa(e) {
|
|
1529
1537
|
return e.capabilities.prefixLevels.every(
|
|
1530
1538
|
(t) => !!R(e.source, t)
|
|
1531
1539
|
);
|
|
1532
1540
|
}
|
|
1533
|
-
function
|
|
1534
|
-
const t = e.quoteIdentifier ??
|
|
1535
|
-
return e.capabilities.prefixLevels.map((
|
|
1541
|
+
function Ba(e) {
|
|
1542
|
+
const t = e.quoteIdentifier ?? li;
|
|
1543
|
+
return e.capabilities.prefixLevels.map((n) => R(e.source, n)).filter((n) => !!n).map((n) => t(n, e.capabilities.dialect)).join(".");
|
|
1536
1544
|
}
|
|
1537
1545
|
function R(e, t) {
|
|
1538
1546
|
return t === "database" ? e.databaseName : t === "schema" ? e.schemaName : e.tableName;
|
|
1539
1547
|
}
|
|
1540
|
-
function
|
|
1541
|
-
t === "database" ? e.databaseName =
|
|
1548
|
+
function ri(e, t, n) {
|
|
1549
|
+
t === "database" ? e.databaseName = n : t === "schema" ? e.schemaName = n : e.tableName = n;
|
|
1542
1550
|
}
|
|
1543
|
-
const
|
|
1551
|
+
const oi = [
|
|
1544
1552
|
['"', '"'],
|
|
1545
1553
|
["`", "`"],
|
|
1546
1554
|
["[", "]"]
|
|
1547
1555
|
];
|
|
1548
|
-
function
|
|
1556
|
+
function di(e) {
|
|
1549
1557
|
const t = e.trim();
|
|
1550
|
-
for (const [
|
|
1551
|
-
if (t.length >= 2 && t.startsWith(
|
|
1552
|
-
return t.slice(1, -1).split(
|
|
1558
|
+
for (const [n, i] of oi)
|
|
1559
|
+
if (t.length >= 2 && t.startsWith(n) && t.endsWith(i))
|
|
1560
|
+
return t.slice(1, -1).split(i + i).join(i);
|
|
1553
1561
|
return t;
|
|
1554
1562
|
}
|
|
1555
1563
|
function kt(e) {
|
|
1556
1564
|
const t = e == null ? void 0 : e.trim();
|
|
1557
1565
|
if (!t) return [];
|
|
1558
|
-
const
|
|
1559
|
-
return
|
|
1566
|
+
const n = t.split(".").map(di);
|
|
1567
|
+
return n.some((i) => !i) ? [] : n;
|
|
1560
1568
|
}
|
|
1561
|
-
function
|
|
1569
|
+
function Wa(e) {
|
|
1562
1570
|
const t = kt(e ?? void 0);
|
|
1563
1571
|
return t[t.length - 1] || "";
|
|
1564
1572
|
}
|
|
1565
|
-
function
|
|
1573
|
+
function li(e, t) {
|
|
1566
1574
|
return t === "mysql" || t === "bigquery" || t === "clickhouse" || t === "duckdb" ? `\`${e.replace(/`/g, "``")}\`` : t === "mssql" ? `[${e.replace(/]/g, "]]")}]` : `"${e.replace(/"/g, '""')}"`;
|
|
1567
1575
|
}
|
|
1568
1576
|
function V(e) {
|
|
1569
1577
|
if (typeof e != "string")
|
|
1570
1578
|
return "";
|
|
1571
1579
|
const t = [];
|
|
1572
|
-
for (const
|
|
1573
|
-
|
|
1580
|
+
for (const n of e.trim().toLowerCase())
|
|
1581
|
+
ui(n) && t.push(n);
|
|
1574
1582
|
return t.join("");
|
|
1575
1583
|
}
|
|
1576
|
-
function
|
|
1584
|
+
function ui(e) {
|
|
1577
1585
|
const t = e.charCodeAt(0);
|
|
1578
1586
|
return t >= 48 && t <= 57 || t >= 97 && t <= 122;
|
|
1579
1587
|
}
|
|
1580
|
-
const k =
|
|
1588
|
+
const k = s.string().min(1), He = s.enum(["groupby", "metric", "sortby", "pivotby", "detail"]), At = s.enum([
|
|
1581
1589
|
"table",
|
|
1582
1590
|
"view",
|
|
1583
1591
|
"materialized view",
|
|
@@ -1586,23 +1594,23 @@ const k = a.string().min(1), Ue = a.enum(["groupby", "metric", "sortby", "pivotb
|
|
|
1586
1594
|
"dataset",
|
|
1587
1595
|
"url",
|
|
1588
1596
|
"upload"
|
|
1589
|
-
]), le =
|
|
1597
|
+
]), le = s.object({
|
|
1590
1598
|
connectionId: k,
|
|
1591
|
-
connectionType:
|
|
1599
|
+
connectionType: s.enum(Re),
|
|
1592
1600
|
type: At,
|
|
1593
1601
|
name: k,
|
|
1594
1602
|
// Grounded relationship plans retain semantic identity and display metadata.
|
|
1595
1603
|
// SQL stays server-resolved; it is not accepted inside a join entity.
|
|
1596
|
-
alias:
|
|
1604
|
+
alias: s.string().optional(),
|
|
1597
1605
|
id: k.optional(),
|
|
1598
1606
|
domainId: k.optional(),
|
|
1599
|
-
datasetType:
|
|
1600
|
-
label:
|
|
1601
|
-
description:
|
|
1602
|
-
dbObjectType:
|
|
1603
|
-
database:
|
|
1604
|
-
schema:
|
|
1605
|
-
dialect:
|
|
1607
|
+
datasetType: s.enum(["physical", "virtual"]).optional(),
|
|
1608
|
+
label: s.string().optional(),
|
|
1609
|
+
description: s.string().optional(),
|
|
1610
|
+
dbObjectType: s.string().optional(),
|
|
1611
|
+
database: s.string().optional(),
|
|
1612
|
+
schema: s.string().optional(),
|
|
1613
|
+
dialect: s.enum([
|
|
1606
1614
|
"mysql",
|
|
1607
1615
|
"postgres",
|
|
1608
1616
|
"bigquery",
|
|
@@ -1612,46 +1620,46 @@ const k = a.string().min(1), Ue = a.enum(["groupby", "metric", "sortby", "pivotb
|
|
|
1612
1620
|
"duckdb",
|
|
1613
1621
|
"mssql"
|
|
1614
1622
|
]).optional()
|
|
1615
|
-
}).strict(), te =
|
|
1616
|
-
() =>
|
|
1623
|
+
}).strict(), te = s.lazy(
|
|
1624
|
+
() => s.object({
|
|
1617
1625
|
id: k,
|
|
1618
1626
|
name: k,
|
|
1619
|
-
label:
|
|
1627
|
+
label: s.string(),
|
|
1620
1628
|
/** Set when `label` was synthesized from `name`; see `Field.derivedLabel`. */
|
|
1621
|
-
derivedLabel:
|
|
1629
|
+
derivedLabel: s.string().optional(),
|
|
1622
1630
|
qualifiedFieldName: k,
|
|
1623
1631
|
dataType: k,
|
|
1624
1632
|
entityId: k,
|
|
1625
1633
|
entityName: k,
|
|
1626
1634
|
entityType: At,
|
|
1627
|
-
alias:
|
|
1628
|
-
sourceField:
|
|
1635
|
+
alias: s.string().optional(),
|
|
1636
|
+
sourceField: s.string().optional(),
|
|
1629
1637
|
source: $e.optional(),
|
|
1630
|
-
nativeDataType:
|
|
1631
|
-
description:
|
|
1632
|
-
qualifiedEntityName:
|
|
1633
|
-
dateFormat:
|
|
1634
|
-
customFormat:
|
|
1638
|
+
nativeDataType: s.string().optional(),
|
|
1639
|
+
description: s.string().optional(),
|
|
1640
|
+
qualifiedEntityName: s.string().optional(),
|
|
1641
|
+
dateFormat: s.enum(ti).optional(),
|
|
1642
|
+
customFormat: s.string().optional(),
|
|
1635
1643
|
granularity: pe.optional(),
|
|
1636
|
-
role:
|
|
1637
|
-
calculationRepresentation:
|
|
1638
|
-
calculatedFieldOrigin:
|
|
1639
|
-
aggregateOrigin:
|
|
1640
|
-
labelOrigin:
|
|
1641
|
-
formatOrigin:
|
|
1642
|
-
expression:
|
|
1644
|
+
role: He.optional(),
|
|
1645
|
+
calculationRepresentation: s.enum(["inline-expression", "manual", "typed-derived"]).optional(),
|
|
1646
|
+
calculatedFieldOrigin: s.object({ id: k, role: He.optional() }).strict().optional(),
|
|
1647
|
+
aggregateOrigin: s.enum(["default", "explicit"]).optional(),
|
|
1648
|
+
labelOrigin: s.enum(["semantic", "override"]).optional(),
|
|
1649
|
+
formatOrigin: s.enum(["semantic", "override"]).optional(),
|
|
1650
|
+
expression: s.string().optional(),
|
|
1643
1651
|
derivedField: De.optional(),
|
|
1644
1652
|
format: Z.optional(),
|
|
1645
|
-
semanticTemporalPresentation:
|
|
1653
|
+
semanticTemporalPresentation: s.object({
|
|
1646
1654
|
granularity: pe,
|
|
1647
1655
|
format: Gt
|
|
1648
1656
|
}).strict().optional(),
|
|
1649
|
-
aggregate:
|
|
1657
|
+
aggregate: it.optional(),
|
|
1650
1658
|
/** DG-D1: Automatic grain on a Group by date. */
|
|
1651
|
-
grainMode:
|
|
1652
|
-
fieldScope:
|
|
1653
|
-
calculatedFormula:
|
|
1654
|
-
operation:
|
|
1659
|
+
grainMode: s.literal("automatic").optional(),
|
|
1660
|
+
fieldScope: s.enum(["card", "sheet", "dashboard", "domain"]).optional(),
|
|
1661
|
+
calculatedFormula: s.object({
|
|
1662
|
+
operation: s.enum([
|
|
1655
1663
|
"sum",
|
|
1656
1664
|
"difference",
|
|
1657
1665
|
"product",
|
|
@@ -1661,21 +1669,21 @@ const k = a.string().min(1), Ue = a.enum(["groupby", "metric", "sortby", "pivotb
|
|
|
1661
1669
|
"scale",
|
|
1662
1670
|
"custom"
|
|
1663
1671
|
]),
|
|
1664
|
-
inputFields:
|
|
1665
|
-
constant:
|
|
1666
|
-
computeStage:
|
|
1672
|
+
inputFields: s.array(te),
|
|
1673
|
+
constant: s.number().finite().optional(),
|
|
1674
|
+
computeStage: s.enum(["row", "aggregate"]).optional()
|
|
1667
1675
|
}).strict().optional()
|
|
1668
1676
|
}).strict()
|
|
1669
|
-
),
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
]),
|
|
1677
|
+
), ci = s.union([
|
|
1678
|
+
s.string(),
|
|
1679
|
+
s.number().finite(),
|
|
1680
|
+
s.boolean(),
|
|
1681
|
+
s.date(),
|
|
1682
|
+
s.null()
|
|
1683
|
+
]), mi = s.object({
|
|
1676
1684
|
id: k,
|
|
1677
1685
|
field: te,
|
|
1678
|
-
operator:
|
|
1686
|
+
operator: s.enum([
|
|
1679
1687
|
"=",
|
|
1680
1688
|
"!=",
|
|
1681
1689
|
">",
|
|
@@ -1694,75 +1702,75 @@ const k = a.string().min(1), Ue = a.enum(["groupby", "metric", "sortby", "pivotb
|
|
|
1694
1702
|
"isNull",
|
|
1695
1703
|
"isNotNull"
|
|
1696
1704
|
]),
|
|
1697
|
-
value:
|
|
1698
|
-
label:
|
|
1705
|
+
value: s.union([ci, s.array(s.string()), s.array(s.number().finite())]),
|
|
1706
|
+
label: s.string().optional(),
|
|
1699
1707
|
temporalBucket: Xt.optional(),
|
|
1700
1708
|
rawTemporal: Qt.optional(),
|
|
1701
|
-
relativeMeta:
|
|
1702
|
-
latestValue:
|
|
1703
|
-
latestValuePolicy:
|
|
1709
|
+
relativeMeta: gn.optional(),
|
|
1710
|
+
latestValue: s.literal(!0).optional(),
|
|
1711
|
+
latestValuePolicy: s.literal("snapshot").optional()
|
|
1704
1712
|
}).strict().superRefine((e, t) => {
|
|
1705
|
-
const { operator:
|
|
1706
|
-
if ((
|
|
1713
|
+
const { operator: n, value: i } = e;
|
|
1714
|
+
if ((n === "between" || n === "not between") && (!Array.isArray(i) || i.length !== 2) && t.addIssue({
|
|
1707
1715
|
code: "custom",
|
|
1708
1716
|
path: ["value"],
|
|
1709
1717
|
message: "Between requires two endpoints."
|
|
1710
|
-
}), e.relativeMeta && !
|
|
1718
|
+
}), e.relativeMeta && !dn(n, F(e.relativeMeta)) && t.addIssue({
|
|
1711
1719
|
code: "custom",
|
|
1712
1720
|
path: ["relativeMeta"],
|
|
1713
1721
|
message: "A relative date runs under between, not between, <, <=, > or >=; a window counted from the newest row only under between or not between."
|
|
1714
1722
|
}), e.latestValue) {
|
|
1715
|
-
const
|
|
1716
|
-
(
|
|
1723
|
+
const a = [e.field.nativeDataType, e.field.dataType].map((r) => Fe(r)).some((r) => r === "date" || r === "datetime");
|
|
1724
|
+
(n !== "=" || !a) && t.addIssue({
|
|
1717
1725
|
code: "custom",
|
|
1718
1726
|
path: ["latestValue"],
|
|
1719
1727
|
message: "Latest value requires = on a date or timestamp field."
|
|
1720
1728
|
});
|
|
1721
1729
|
}
|
|
1722
|
-
(
|
|
1730
|
+
(n === "in" || n === "not in") && !Array.isArray(i) && t.addIssue({
|
|
1723
1731
|
code: "custom",
|
|
1724
1732
|
path: ["value"],
|
|
1725
1733
|
message: "Membership requires an array."
|
|
1726
1734
|
});
|
|
1727
|
-
}), $t =
|
|
1728
|
-
() =>
|
|
1735
|
+
}), $t = s.lazy(
|
|
1736
|
+
() => s.object({
|
|
1729
1737
|
id: k,
|
|
1730
|
-
logicalOperator:
|
|
1731
|
-
negate:
|
|
1732
|
-
conditions:
|
|
1733
|
-
groups:
|
|
1738
|
+
logicalOperator: s.enum(["AND", "OR"]),
|
|
1739
|
+
negate: s.boolean(),
|
|
1740
|
+
conditions: s.array(mi),
|
|
1741
|
+
groups: s.array($t)
|
|
1734
1742
|
}).strict()
|
|
1735
|
-
),
|
|
1743
|
+
), pi = s.object({
|
|
1736
1744
|
baseEntity: le,
|
|
1737
|
-
joins:
|
|
1738
|
-
|
|
1745
|
+
joins: s.array(
|
|
1746
|
+
s.object({
|
|
1739
1747
|
id: k,
|
|
1740
1748
|
source: le,
|
|
1741
1749
|
target: le,
|
|
1742
|
-
joinType:
|
|
1743
|
-
sequence:
|
|
1744
|
-
autoResolved:
|
|
1745
|
-
relationshipId:
|
|
1746
|
-
relationshipName:
|
|
1747
|
-
relationshipCardinality:
|
|
1748
|
-
relationshipTraversalDirection:
|
|
1749
|
-
joinKeyGroups:
|
|
1750
|
-
|
|
1750
|
+
joinType: s.enum(["INNER", "LEFT", "RIGHT", "FULL"]),
|
|
1751
|
+
sequence: s.number().int().nonnegative(),
|
|
1752
|
+
autoResolved: s.boolean().optional(),
|
|
1753
|
+
relationshipId: s.string().optional(),
|
|
1754
|
+
relationshipName: s.string().optional(),
|
|
1755
|
+
relationshipCardinality: s.enum(["one_to_one", "one_to_many", "many_to_one", "many_to_many"]).optional(),
|
|
1756
|
+
relationshipTraversalDirection: s.enum(["forward", "reverse"]).optional(),
|
|
1757
|
+
joinKeyGroups: s.array(
|
|
1758
|
+
s.object({
|
|
1751
1759
|
id: k,
|
|
1752
|
-
operator:
|
|
1753
|
-
keys:
|
|
1754
|
-
|
|
1755
|
-
id:
|
|
1760
|
+
operator: s.enum(["AND", "OR"]),
|
|
1761
|
+
keys: s.array(
|
|
1762
|
+
s.object({
|
|
1763
|
+
id: s.string().optional(),
|
|
1756
1764
|
source: te,
|
|
1757
1765
|
target: te,
|
|
1758
|
-
operator:
|
|
1766
|
+
operator: s.enum(["=", "!=", ">", ">=", "<", "<="])
|
|
1759
1767
|
}).strict()
|
|
1760
1768
|
).min(1)
|
|
1761
1769
|
}).strict()
|
|
1762
1770
|
).min(1)
|
|
1763
1771
|
}).strict()
|
|
1764
1772
|
)
|
|
1765
|
-
}).strict(), S =
|
|
1773
|
+
}).strict(), S = s.string().uuid(), fi = s.string().min(1), hi = s.number().int().positive().max(Number.MAX_SAFE_INTEGER), gi = s.enum([
|
|
1766
1774
|
"SUM",
|
|
1767
1775
|
"COUNT",
|
|
1768
1776
|
"DISTINCT",
|
|
@@ -1770,71 +1778,71 @@ const k = a.string().min(1), Ue = a.enum(["groupby", "metric", "sortby", "pivotb
|
|
|
1770
1778
|
"MIN",
|
|
1771
1779
|
"MAX",
|
|
1772
1780
|
"MEDIAN"
|
|
1773
|
-
]), Dt =
|
|
1781
|
+
]), Dt = Pn.omit({
|
|
1774
1782
|
aggregate: !0
|
|
1775
|
-
}),
|
|
1783
|
+
}), yi = {
|
|
1776
1784
|
id: S,
|
|
1777
1785
|
field: Dt,
|
|
1778
1786
|
grain: pe.optional()
|
|
1779
|
-
}, be =
|
|
1787
|
+
}, be = s.object(yi).strict(), _i = s.object({
|
|
1780
1788
|
id: S,
|
|
1781
|
-
kind:
|
|
1789
|
+
kind: s.literal("aggregate"),
|
|
1782
1790
|
field: Dt,
|
|
1783
|
-
aggregate:
|
|
1784
|
-
}).strict(),
|
|
1791
|
+
aggregate: gi
|
|
1792
|
+
}).strict(), bi = s.object({
|
|
1785
1793
|
id: S,
|
|
1786
|
-
kind:
|
|
1794
|
+
kind: s.literal("calculated"),
|
|
1787
1795
|
definition: De
|
|
1788
|
-
}).strict(), xt =
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
kind:
|
|
1796
|
+
}).strict(), xt = s.discriminatedUnion("kind", [_i, bi]), vi = s.discriminatedUnion("kind", [
|
|
1797
|
+
s.object({ kind: s.literal("member") }).strict(),
|
|
1798
|
+
s.object({
|
|
1799
|
+
kind: s.literal("measure"),
|
|
1792
1800
|
measureId: S,
|
|
1793
1801
|
oppositePath: T
|
|
1794
1802
|
}).strict()
|
|
1795
|
-
]),
|
|
1796
|
-
axis:
|
|
1803
|
+
]), Ii = {
|
|
1804
|
+
axis: Te,
|
|
1797
1805
|
levelId: S,
|
|
1798
|
-
scope:
|
|
1799
|
-
|
|
1800
|
-
|
|
1806
|
+
scope: s.discriminatedUnion("kind", [
|
|
1807
|
+
s.object({ kind: s.literal("level") }).strict(),
|
|
1808
|
+
s.object({ kind: s.literal("branch"), parent: T }).strict()
|
|
1801
1809
|
]),
|
|
1802
|
-
target:
|
|
1803
|
-
direction:
|
|
1804
|
-
nulls:
|
|
1805
|
-
}, Ft =
|
|
1810
|
+
target: vi,
|
|
1811
|
+
direction: s.enum(["asc", "desc"]),
|
|
1812
|
+
nulls: s.enum(["first", "last"])
|
|
1813
|
+
}, Ft = s.object(Ii).strict(), Si = s.object({
|
|
1806
1814
|
id: S,
|
|
1807
|
-
axis:
|
|
1815
|
+
axis: Te,
|
|
1808
1816
|
levelId: S,
|
|
1809
|
-
direction:
|
|
1810
|
-
count:
|
|
1817
|
+
direction: s.enum(["top", "bottom"]),
|
|
1818
|
+
count: hi,
|
|
1811
1819
|
measureId: S,
|
|
1812
1820
|
oppositePath: T,
|
|
1813
|
-
others:
|
|
1814
|
-
}).strict(), ue =
|
|
1821
|
+
others: s.boolean()
|
|
1822
|
+
}).strict(), ue = s.number().finite(), wi = s.object({
|
|
1815
1823
|
id: S,
|
|
1816
|
-
axis:
|
|
1824
|
+
axis: Te,
|
|
1817
1825
|
levelId: S,
|
|
1818
1826
|
measureId: S,
|
|
1819
|
-
operator:
|
|
1820
|
-
value:
|
|
1827
|
+
operator: s.enum(["=", "!=", ">", ">=", "<", "<=", "between", "not between"]),
|
|
1828
|
+
value: s.union([
|
|
1821
1829
|
ue,
|
|
1822
|
-
|
|
1830
|
+
s.tuple([ue, ue]).readonly()
|
|
1823
1831
|
])
|
|
1824
1832
|
}).strict().superRefine((e, t) => {
|
|
1825
|
-
const
|
|
1826
|
-
|
|
1827
|
-
}), Mt =
|
|
1833
|
+
const n = e.operator === "between" || e.operator === "not between";
|
|
1834
|
+
n !== Array.isArray(e.value) ? _(t, ["value"], n ? "A range condition needs a low and a high bound." : "A comparison needs one number.") : n && e.value[0] > e.value[1] && _(t, ["value"], "The low bound must not exceed the high bound.");
|
|
1835
|
+
}), Mt = s.object({
|
|
1828
1836
|
source: $e,
|
|
1829
|
-
rows:
|
|
1830
|
-
columns:
|
|
1831
|
-
measures:
|
|
1837
|
+
rows: s.array(be).min(1).readonly(),
|
|
1838
|
+
columns: s.array(be).readonly(),
|
|
1839
|
+
measures: s.array(xt).min(1).readonly(),
|
|
1832
1840
|
filters: $t.optional(),
|
|
1833
|
-
joinPlan:
|
|
1834
|
-
relationshipHint:
|
|
1835
|
-
sorts:
|
|
1836
|
-
rankings:
|
|
1837
|
-
measureFilters:
|
|
1841
|
+
joinPlan: pi.optional(),
|
|
1842
|
+
relationshipHint: s.object({ relationshipIds: s.array(fi).optional() }).strict().optional(),
|
|
1843
|
+
sorts: s.array(Ft).readonly(),
|
|
1844
|
+
rankings: s.array(Si).readonly(),
|
|
1845
|
+
measureFilters: s.array(wi).readonly().optional()
|
|
1838
1846
|
}).strict();
|
|
1839
1847
|
function Et(e) {
|
|
1840
1848
|
return JSON.stringify([
|
|
@@ -1844,115 +1852,115 @@ function Et(e) {
|
|
|
1844
1852
|
e.scope.kind === "branch" ? It(e.scope.parent) : null
|
|
1845
1853
|
]);
|
|
1846
1854
|
}
|
|
1847
|
-
function _(e, t,
|
|
1848
|
-
e.addIssue({ code: "custom", path: t, message:
|
|
1855
|
+
function _(e, t, n) {
|
|
1856
|
+
e.addIssue({ code: "custom", path: t, message: n });
|
|
1849
1857
|
}
|
|
1850
|
-
function x(e, t,
|
|
1851
|
-
new Set(e).size !== e.length && _(t,
|
|
1858
|
+
function x(e, t, n) {
|
|
1859
|
+
new Set(e).size !== e.length && _(t, n, "Duplicate identity.");
|
|
1852
1860
|
}
|
|
1853
|
-
function
|
|
1854
|
-
|
|
1861
|
+
function ne(e, t, n, i, o, a = !1) {
|
|
1862
|
+
n.length > e[t].length && _(i, o, "Path exceeds axis depth."), n.forEach((r, l) => {
|
|
1855
1863
|
var c;
|
|
1856
|
-
if (r.levelId !== ((c = e[t][l]) == null ? void 0 : c.id) && _(
|
|
1864
|
+
if (r.levelId !== ((c = e[t][l]) == null ? void 0 : c.id) && _(i, [...o, l], "Path must be an ordered axis prefix."), r.member.kind === "others") {
|
|
1857
1865
|
const m = r.member.rankingId;
|
|
1858
|
-
(
|
|
1866
|
+
(a || l !== n.length - 1 || !e.rankings.some(
|
|
1859
1867
|
(u) => u.id === m && u.others && u.axis === t && u.levelId === r.levelId
|
|
1860
1868
|
)) && _(
|
|
1861
|
-
|
|
1869
|
+
i,
|
|
1862
1870
|
[...o, l],
|
|
1863
1871
|
"Others must terminate a path at its enabled ranking and cannot be a sort/rank target."
|
|
1864
1872
|
);
|
|
1865
1873
|
}
|
|
1866
1874
|
});
|
|
1867
1875
|
}
|
|
1868
|
-
function Nt(e, t,
|
|
1869
|
-
x(t.map(Et),
|
|
1870
|
-
const r = [...
|
|
1871
|
-
if (l < 0 && _(
|
|
1876
|
+
function Nt(e, t, n, i) {
|
|
1877
|
+
x(t.map(Et), n, i), t.forEach((o, a) => {
|
|
1878
|
+
const r = [...i, a], l = e[o.axis].findIndex((c) => c.id === o.levelId);
|
|
1879
|
+
if (l < 0 && _(n, r, "Sort level is not on its axis."), o.scope.kind === "branch" && (ne(
|
|
1872
1880
|
e,
|
|
1873
1881
|
o.axis,
|
|
1874
1882
|
o.scope.parent,
|
|
1875
|
-
|
|
1883
|
+
n,
|
|
1876
1884
|
[...r, "scope", "parent"],
|
|
1877
1885
|
!0
|
|
1878
1886
|
), o.scope.parent.length !== l && _(
|
|
1879
|
-
|
|
1887
|
+
n,
|
|
1880
1888
|
r,
|
|
1881
1889
|
"Branch sort must name the immediate parent of its level."
|
|
1882
1890
|
)), o.target.kind === "measure") {
|
|
1883
1891
|
const c = o.target.measureId;
|
|
1884
|
-
e.measures.some((m) => m.id === c) || _(
|
|
1892
|
+
e.measures.some((m) => m.id === c) || _(n, r, "Unknown sort measure."), ne(
|
|
1885
1893
|
e,
|
|
1886
1894
|
o.axis === "rows" ? "columns" : "rows",
|
|
1887
1895
|
o.target.oppositePath,
|
|
1888
|
-
|
|
1896
|
+
n,
|
|
1889
1897
|
[...r, "target", "oppositePath"],
|
|
1890
1898
|
!0
|
|
1891
1899
|
);
|
|
1892
1900
|
}
|
|
1893
1901
|
});
|
|
1894
1902
|
}
|
|
1895
|
-
function K(e, t,
|
|
1903
|
+
function K(e, t, n, i) {
|
|
1896
1904
|
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) && _(
|
|
1897
|
-
i,
|
|
1898
1905
|
n,
|
|
1906
|
+
i,
|
|
1899
1907
|
"Field source must belong to the same semantic domain or physical connection."
|
|
1900
1908
|
);
|
|
1901
1909
|
}
|
|
1902
|
-
function ce(e, t,
|
|
1903
|
-
(e.aggregationBehavior === "snapshot" || e.aggregationBehavior === "weighted" || e.aggregationStrategy === "weighted") && _(t,
|
|
1910
|
+
function ce(e, t, n) {
|
|
1911
|
+
(e.aggregationBehavior === "snapshot" || e.aggregationBehavior === "weighted" || e.aggregationStrategy === "weighted") && _(t, n, "This measure semantic requires a later capability.");
|
|
1904
1912
|
}
|
|
1905
1913
|
function Tt(e, t) {
|
|
1906
1914
|
x(
|
|
1907
|
-
[...e.rows, ...e.columns, ...e.measures].map((
|
|
1915
|
+
[...e.rows, ...e.columns, ...e.measures].map((a) => a.id),
|
|
1908
1916
|
t,
|
|
1909
1917
|
[]
|
|
1910
1918
|
), x(
|
|
1911
|
-
e.rankings.map((
|
|
1919
|
+
e.rankings.map((a) => a.id),
|
|
1912
1920
|
t,
|
|
1913
1921
|
["rankings"]
|
|
1914
1922
|
), x(
|
|
1915
|
-
e.rankings.map((
|
|
1923
|
+
e.rankings.map((a) => JSON.stringify([a.axis, a.levelId])),
|
|
1916
1924
|
t,
|
|
1917
1925
|
["rankings"]
|
|
1918
1926
|
);
|
|
1919
|
-
for (const
|
|
1920
|
-
e[
|
|
1921
|
-
r.grain && r.field.dataType !== void 0 && !["date", "datetime", "unknown"].includes(r.field.dataType) && _(t, [
|
|
1927
|
+
for (const a of ["rows", "columns"])
|
|
1928
|
+
e[a].forEach((r, l) => {
|
|
1929
|
+
r.grain && r.field.dataType !== void 0 && !["date", "datetime", "unknown"].includes(r.field.dataType) && _(t, [a, l, "grain"], "Grain requires a temporal field.");
|
|
1922
1930
|
});
|
|
1923
|
-
const
|
|
1931
|
+
const n = [
|
|
1924
1932
|
...e.rows,
|
|
1925
1933
|
...e.columns,
|
|
1926
|
-
...e.measures.filter((
|
|
1934
|
+
...e.measures.filter((a) => a.kind === "aggregate")
|
|
1927
1935
|
];
|
|
1928
|
-
for (const
|
|
1929
|
-
if (K(
|
|
1930
|
-
|
|
1936
|
+
for (const a of n)
|
|
1937
|
+
if (K(a.field.source, e.source, t, [
|
|
1938
|
+
a.id,
|
|
1931
1939
|
"field",
|
|
1932
1940
|
"source"
|
|
1933
|
-
]),
|
|
1934
|
-
|
|
1941
|
+
]), a.field.derivedField) {
|
|
1942
|
+
a.field.derivedField.computeStage !== "row" && _(
|
|
1935
1943
|
t,
|
|
1936
|
-
[
|
|
1944
|
+
[a.id],
|
|
1937
1945
|
"Aggregate-stage calculations cannot be grouped or wrapped in an aggregate."
|
|
1938
|
-
), ce(
|
|
1939
|
-
for (const r of Object.values(
|
|
1940
|
-
K(r.field.source, e.source, t, [
|
|
1946
|
+
), ce(a.field.derivedField, t, [a.id]);
|
|
1947
|
+
for (const r of Object.values(a.field.derivedField.inputs))
|
|
1948
|
+
K(r.field.source, e.source, t, [a.id, "inputs"]);
|
|
1941
1949
|
}
|
|
1942
|
-
for (const
|
|
1943
|
-
if (
|
|
1944
|
-
(
|
|
1950
|
+
for (const a of e.measures)
|
|
1951
|
+
if (a.kind === "calculated") {
|
|
1952
|
+
(a.definition.computeStage !== "aggregate" || a.definition.resultRole !== "measure") && _(
|
|
1945
1953
|
t,
|
|
1946
|
-
[
|
|
1954
|
+
[a.id],
|
|
1947
1955
|
"Calculated measures require aggregate stage and measure role."
|
|
1948
|
-
), ce(
|
|
1949
|
-
for (const r of Object.values(
|
|
1956
|
+
), ce(a.definition, t, [a.id]);
|
|
1957
|
+
for (const r of Object.values(a.definition.inputs))
|
|
1950
1958
|
K(r.field.source, e.source, t, [
|
|
1951
|
-
|
|
1959
|
+
a.id,
|
|
1952
1960
|
"inputs"
|
|
1953
1961
|
]);
|
|
1954
1962
|
}
|
|
1955
|
-
const
|
|
1963
|
+
const i = (a) => {
|
|
1956
1964
|
const r = (l, c) => {
|
|
1957
1965
|
var m, u;
|
|
1958
1966
|
if ((l.aggregate || ((m = l.derivedField) == null ? void 0 : m.computeStage) === "aggregate") && _(t, c, "Aggregate/HAVING filters are not supported."), l.derivedField) {
|
|
@@ -1963,16 +1971,16 @@ function Tt(e, t) {
|
|
|
1963
1971
|
for (const p of ((u = l.calculatedFormula) == null ? void 0 : u.inputFields) ?? [])
|
|
1964
1972
|
r(p, c);
|
|
1965
1973
|
};
|
|
1966
|
-
for (const l of
|
|
1974
|
+
for (const l of a.conditions)
|
|
1967
1975
|
r(l.field, ["filters", l.id]);
|
|
1968
|
-
|
|
1976
|
+
a.groups.forEach(i);
|
|
1969
1977
|
};
|
|
1970
|
-
if (e.filters &&
|
|
1971
|
-
const
|
|
1978
|
+
if (e.filters && i(e.filters), e.joinPlan) {
|
|
1979
|
+
const a = [
|
|
1972
1980
|
e.joinPlan.baseEntity,
|
|
1973
1981
|
...e.joinPlan.joins.flatMap((r) => [r.source, r.target])
|
|
1974
1982
|
];
|
|
1975
|
-
(new Set(
|
|
1983
|
+
(new Set(a.map((r) => r.connectionId)).size > 1 || e.source.kind === "physical" && a[0].connectionId !== e.source.connectionId) && _(t, ["joinPlan"], "Joins must stay within the source connection."), x(
|
|
1976
1984
|
e.joinPlan.joins.map((r) => r.id),
|
|
1977
1985
|
t,
|
|
1978
1986
|
["joinPlan", "joins"]
|
|
@@ -1980,70 +1988,70 @@ function Tt(e, t) {
|
|
|
1980
1988
|
}
|
|
1981
1989
|
Nt(e, e.sorts, t, ["sorts"]);
|
|
1982
1990
|
const o = e.measureFilters ?? [];
|
|
1983
|
-
x(o.map((
|
|
1984
|
-
o.map((
|
|
1991
|
+
x(o.map((a) => a.id), t, ["measureFilters"]), x(
|
|
1992
|
+
o.map((a) => JSON.stringify([a.axis, a.levelId])),
|
|
1985
1993
|
t,
|
|
1986
1994
|
["measureFilters"]
|
|
1987
|
-
), o.forEach((
|
|
1988
|
-
(!e[
|
|
1989
|
-
}), e.rankings.forEach((
|
|
1990
|
-
(!e[
|
|
1995
|
+
), o.forEach((a, r) => {
|
|
1996
|
+
(!e[a.axis].some((l) => l.id === a.levelId) || !e.measures.some((l) => l.id === a.measureId)) && _(t, ["measureFilters", r], "Unknown measure filter level or measure.");
|
|
1997
|
+
}), e.rankings.forEach((a, r) => {
|
|
1998
|
+
(!e[a.axis].some((l) => l.id === a.levelId) || !e.measures.some((l) => l.id === a.measureId)) && _(t, ["rankings", r], "Unknown ranking level or measure."), ne(
|
|
1991
1999
|
e,
|
|
1992
|
-
|
|
1993
|
-
|
|
2000
|
+
a.axis === "rows" ? "columns" : "rows",
|
|
2001
|
+
a.oppositePath,
|
|
1994
2002
|
t,
|
|
1995
2003
|
["rankings", r, "oppositePath"],
|
|
1996
2004
|
!0
|
|
1997
2005
|
);
|
|
1998
2006
|
});
|
|
1999
2007
|
}
|
|
2000
|
-
const z = Mt.superRefine(Tt),
|
|
2001
|
-
rows:
|
|
2002
|
-
measures:
|
|
2003
|
-
}),
|
|
2004
|
-
const
|
|
2005
|
-
|
|
2006
|
-
}),
|
|
2007
|
-
visible:
|
|
2008
|
-
position:
|
|
2008
|
+
const z = Mt.superRefine(Tt), ki = Mt.extend({
|
|
2009
|
+
rows: s.array(be).readonly(),
|
|
2010
|
+
measures: s.array(xt).readonly()
|
|
2011
|
+
}), Ai = ki.superRefine(Tt), $i = z.innerType().extend({ kind: s.literal("matrix") }), Di = $i.superRefine(({ kind: e, ...t }, n) => {
|
|
2012
|
+
const i = z.safeParse(t);
|
|
2013
|
+
i.success || i.error.issues.forEach((o) => n.addIssue(o));
|
|
2014
|
+
}), xi = "{member}", ze = s.object({
|
|
2015
|
+
visible: s.boolean(),
|
|
2016
|
+
position: s.enum(["before", "after"]),
|
|
2009
2017
|
/** As written; a subtotal's `{member}` becomes its member's name. */
|
|
2010
|
-
label:
|
|
2011
|
-
}).strict(),
|
|
2012
|
-
grand:
|
|
2013
|
-
levels:
|
|
2018
|
+
label: s.string().optional()
|
|
2019
|
+
}).strict(), Ge = s.object({
|
|
2020
|
+
grand: ze,
|
|
2021
|
+
levels: s.record(S, ze).readonly(),
|
|
2014
2022
|
/**
|
|
2015
2023
|
* Skip a subtotal that only repeats one row: an expanded group with
|
|
2016
2024
|
* exactly one child shows no subtotal. Off when absent.
|
|
2017
2025
|
*/
|
|
2018
|
-
skipRedundant:
|
|
2019
|
-
}).strict(),
|
|
2020
|
-
layout:
|
|
2021
|
-
|
|
2022
|
-
|
|
2026
|
+
skipRedundant: s.boolean().optional()
|
|
2027
|
+
}).strict(), Fi = {
|
|
2028
|
+
layout: s.discriminatedUnion("kind", [
|
|
2029
|
+
s.object({ kind: s.literal("compact") }).strict(),
|
|
2030
|
+
s.object({ kind: s.literal("tabular"), repeatLabels: s.boolean() }).strict()
|
|
2023
2031
|
]),
|
|
2024
|
-
absence:
|
|
2025
|
-
levelLabels:
|
|
2026
|
-
measureLabels:
|
|
2027
|
-
levelFormats:
|
|
2028
|
-
measureFormats:
|
|
2029
|
-
totals:
|
|
2030
|
-
},
|
|
2031
|
-
depth:
|
|
2032
|
-
overrides:
|
|
2033
|
-
|
|
2032
|
+
absence: s.object({ emptyText: s.string(), nullText: s.string() }).strict(),
|
|
2033
|
+
levelLabels: s.record(S, s.string()).readonly(),
|
|
2034
|
+
measureLabels: s.record(S, s.string()).readonly(),
|
|
2035
|
+
levelFormats: s.record(S, Z).readonly(),
|
|
2036
|
+
measureFormats: s.record(S, Z).readonly(),
|
|
2037
|
+
totals: s.object({ rows: Ge, columns: Ge }).strict()
|
|
2038
|
+
}, je = s.object(Fi).strict(), Mi = s.object({
|
|
2039
|
+
depth: s.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
2040
|
+
overrides: s.array(
|
|
2041
|
+
s.object({ path: T, expanded: s.boolean() }).strict()
|
|
2034
2042
|
).readonly()
|
|
2035
|
-
}).strict(),
|
|
2043
|
+
}).strict(), Qe = Mi.superRefine(
|
|
2036
2044
|
(e, t) => x(
|
|
2037
|
-
e.overrides.map((
|
|
2045
|
+
e.overrides.map((n) => It(n.path)),
|
|
2038
2046
|
t,
|
|
2039
2047
|
["overrides"]
|
|
2040
2048
|
)
|
|
2041
|
-
),
|
|
2049
|
+
), Ei = { rows: Qe, columns: Qe }, se = s.object(Ei).strict(), Ni = se.extend({ sorts: s.array(Ft).readonly() }).strict(), Ti = Ni.superRefine(
|
|
2042
2050
|
(e, t) => x(e.sorts.map(Et), t, ["sorts"])
|
|
2043
2051
|
);
|
|
2044
2052
|
function re(e, t) {
|
|
2045
2053
|
var c, m;
|
|
2046
|
-
const { spec:
|
|
2054
|
+
const { spec: n, presentation: i, defaults: o, session: a } = e, r = new Set([...n.rows, ...n.columns].map((u) => u.id)), l = new Set(n.measures.map((u) => u.id));
|
|
2047
2055
|
for (const u of [
|
|
2048
2056
|
"levelLabels",
|
|
2049
2057
|
"levelFormats",
|
|
@@ -2051,43 +2059,43 @@ function re(e, t) {
|
|
|
2051
2059
|
"measureFormats"
|
|
2052
2060
|
]) {
|
|
2053
2061
|
const p = u.startsWith("level") ? r : l;
|
|
2054
|
-
for (const f of Object.keys(
|
|
2062
|
+
for (const f of Object.keys(i[u]))
|
|
2055
2063
|
p.has(f) || _(
|
|
2056
2064
|
t,
|
|
2057
2065
|
["presentation", u, f],
|
|
2058
2066
|
"Unknown presentation reference."
|
|
2059
2067
|
);
|
|
2060
2068
|
}
|
|
2061
|
-
for (const [u, p] of Object.entries(
|
|
2069
|
+
for (const [u, p] of Object.entries(i.measureFormats))
|
|
2062
2070
|
p.type === "temporal_bucket" && _(
|
|
2063
2071
|
t,
|
|
2064
2072
|
["presentation", "measureFormats", u],
|
|
2065
2073
|
"Measures cannot own temporal bucket formats."
|
|
2066
2074
|
);
|
|
2067
|
-
for (const [u, p] of Object.entries(
|
|
2068
|
-
p.type === "temporal_bucket" && !((c = [...
|
|
2075
|
+
for (const [u, p] of Object.entries(i.levelFormats))
|
|
2076
|
+
p.type === "temporal_bucket" && !((c = [...n.rows, ...n.columns].find((f) => f.id === u)) != null && c.grain) && _(
|
|
2069
2077
|
t,
|
|
2070
2078
|
["presentation", "levelFormats", u],
|
|
2071
2079
|
"Temporal bucket formats require a grain."
|
|
2072
2080
|
);
|
|
2073
2081
|
for (const u of ["rows", "columns"]) {
|
|
2074
|
-
(m =
|
|
2075
|
-
|
|
2082
|
+
(m = i.totals[u].grand.label) != null && m.includes(
|
|
2083
|
+
xi
|
|
2076
2084
|
) && _(
|
|
2077
2085
|
t,
|
|
2078
2086
|
["presentation", "totals", u, "grand", "label"],
|
|
2079
2087
|
"The grand total has no member, so its label cannot use {member}."
|
|
2080
2088
|
);
|
|
2081
|
-
const p = Object.keys(
|
|
2082
|
-
(p.length !==
|
|
2089
|
+
const p = Object.keys(i.totals[u].levels);
|
|
2090
|
+
(p.length !== n[u].length || p.some((f) => !n[u].some((b) => b.id === f))) && _(
|
|
2083
2091
|
t,
|
|
2084
2092
|
["presentation", "totals", u],
|
|
2085
2093
|
"Subtotal map must contain exactly the current axis levels."
|
|
2086
2094
|
);
|
|
2087
|
-
for (const f of [o, ...
|
|
2095
|
+
for (const f of [o, ...a ? [a] : []])
|
|
2088
2096
|
for (const b of f[u].overrides)
|
|
2089
|
-
|
|
2090
|
-
|
|
2097
|
+
ne(
|
|
2098
|
+
n,
|
|
2091
2099
|
u,
|
|
2092
2100
|
b.path,
|
|
2093
2101
|
t,
|
|
@@ -2099,33 +2107,33 @@ function re(e, t) {
|
|
|
2099
2107
|
"Use depth to expand/collapse the root."
|
|
2100
2108
|
);
|
|
2101
2109
|
}
|
|
2102
|
-
|
|
2110
|
+
a && Nt(n, a.sorts, t, ["session", "sorts"]);
|
|
2103
2111
|
}
|
|
2104
|
-
const
|
|
2112
|
+
const Ri = s.object({
|
|
2105
2113
|
spec: z,
|
|
2106
|
-
presentation:
|
|
2114
|
+
presentation: je,
|
|
2107
2115
|
defaults: se,
|
|
2108
|
-
session:
|
|
2109
|
-
}).strict(),
|
|
2110
|
-
version:
|
|
2116
|
+
session: Ti.optional()
|
|
2117
|
+
}).strict(), Ua = Ri.superRefine(re), ji = s.object({
|
|
2118
|
+
version: s.literal(1),
|
|
2111
2119
|
spec: z,
|
|
2112
|
-
presentation:
|
|
2120
|
+
presentation: je,
|
|
2113
2121
|
defaultView: se
|
|
2114
|
-
}).strict(),
|
|
2122
|
+
}).strict(), Ci = ji.superRefine(
|
|
2115
2123
|
(e, t) => re({ ...e, defaults: e.defaultView }, t)
|
|
2116
|
-
),
|
|
2117
|
-
spec:
|
|
2118
|
-
}),
|
|
2119
|
-
|
|
2120
|
-
mode:
|
|
2121
|
-
format:
|
|
2122
|
-
expansion:
|
|
2123
|
-
se.extend({ kind:
|
|
2124
|
-
|
|
2124
|
+
), Oi = Ci.innerType().extend({
|
|
2125
|
+
spec: Ai
|
|
2126
|
+
}), Va = Oi.superRefine((e, t) => re({ ...e, defaults: e.defaultView }, t)), Xe = s.object({ spec: z, presentation: je }).strict(), Yi = s.union([
|
|
2127
|
+
Xe.extend({
|
|
2128
|
+
mode: s.literal("layout"),
|
|
2129
|
+
format: s.enum(["csv", "xlsx", "pdf"]),
|
|
2130
|
+
expansion: s.union([
|
|
2131
|
+
se.extend({ kind: s.literal("current") }).strict(),
|
|
2132
|
+
s.object({ kind: s.literal("all") }).strict()
|
|
2125
2133
|
])
|
|
2126
2134
|
}).strict(),
|
|
2127
|
-
|
|
2128
|
-
]),
|
|
2135
|
+
Xe.extend({ mode: s.literal("flat"), format: s.enum(["csv", "xlsx"]) }).strict()
|
|
2136
|
+
]), Ha = Yi.superRefine(
|
|
2129
2137
|
(e, t) => re(
|
|
2130
2138
|
{
|
|
2131
2139
|
...e,
|
|
@@ -2137,21 +2145,21 @@ const Rn = a.object({
|
|
|
2137
2145
|
t
|
|
2138
2146
|
)
|
|
2139
2147
|
);
|
|
2140
|
-
function
|
|
2148
|
+
function za(e) {
|
|
2141
2149
|
return e && "id" in e ? e.id : void 0;
|
|
2142
2150
|
}
|
|
2143
|
-
const
|
|
2151
|
+
const Li = "SUM";
|
|
2144
2152
|
function $(e) {
|
|
2145
2153
|
return typeof e == "string" && e.trim().length > 0;
|
|
2146
2154
|
}
|
|
2147
2155
|
function q(e) {
|
|
2148
2156
|
return $(e) ? e.trim().toLowerCase() : "";
|
|
2149
2157
|
}
|
|
2150
|
-
function
|
|
2158
|
+
function Ga(e) {
|
|
2151
2159
|
const t = $(e.id) ? e.id.trim() : void 0;
|
|
2152
2160
|
if (!t) return;
|
|
2153
|
-
const
|
|
2154
|
-
if (!(
|
|
2161
|
+
const n = q(t), i = $(e.table) ? e.table.trim() : void 0;
|
|
2162
|
+
if (!(n === q(e.name) || i && n === q(i)))
|
|
2155
2163
|
return t;
|
|
2156
2164
|
}
|
|
2157
2165
|
function j(e) {
|
|
@@ -2161,13 +2169,13 @@ function j(e) {
|
|
|
2161
2169
|
}
|
|
2162
2170
|
function Rt(e) {
|
|
2163
2171
|
if (e.kind !== "semantic") return e;
|
|
2164
|
-
const t = j(e), { datasetId:
|
|
2172
|
+
const t = j(e), { datasetId: n, ...i } = e;
|
|
2165
2173
|
return {
|
|
2166
|
-
...
|
|
2174
|
+
...i,
|
|
2167
2175
|
...t ? { datasetId: t } : {}
|
|
2168
2176
|
};
|
|
2169
2177
|
}
|
|
2170
|
-
function
|
|
2178
|
+
function Qa(e) {
|
|
2171
2179
|
return e ? e.kind === "semantic" ? !!($(e.domainId) && ($(e.datasetId) || $(e.datasetName))) : e.kind === "physical" ? $(e.connectionId) && $(e.tableName) : $(e.connectionId) : !1;
|
|
2172
2180
|
}
|
|
2173
2181
|
function ve(e) {
|
|
@@ -2194,7 +2202,7 @@ function ve(e) {
|
|
|
2194
2202
|
e.label || ""
|
|
2195
2203
|
].join(":");
|
|
2196
2204
|
}
|
|
2197
|
-
function
|
|
2205
|
+
function Ce(e, t) {
|
|
2198
2206
|
if (!e || !t)
|
|
2199
2207
|
return e === t;
|
|
2200
2208
|
if (e.kind !== t.kind)
|
|
@@ -2202,8 +2210,8 @@ function Re(e, t) {
|
|
|
2202
2210
|
if (e.kind === "semantic" && t.kind === "semantic") {
|
|
2203
2211
|
if (e.domainId !== t.domainId)
|
|
2204
2212
|
return !1;
|
|
2205
|
-
const
|
|
2206
|
-
return
|
|
2213
|
+
const n = j(e), i = j(t);
|
|
2214
|
+
return n && i ? n === i : e.datasetName === t.datasetName;
|
|
2207
2215
|
}
|
|
2208
2216
|
return ve(e) === ve(t);
|
|
2209
2217
|
}
|
|
@@ -2216,29 +2224,29 @@ function jt(e, t) {
|
|
|
2216
2224
|
connectionId: e.connectionId || t.connectionId
|
|
2217
2225
|
});
|
|
2218
2226
|
}
|
|
2219
|
-
function
|
|
2227
|
+
function Xa(e) {
|
|
2220
2228
|
const t = [];
|
|
2221
|
-
for (const
|
|
2222
|
-
const
|
|
2223
|
-
|
|
2229
|
+
for (const n of e) {
|
|
2230
|
+
const i = Rt(
|
|
2231
|
+
n
|
|
2224
2232
|
), o = t.findIndex(
|
|
2225
|
-
(
|
|
2233
|
+
(a) => Ce(a, i)
|
|
2226
2234
|
);
|
|
2227
2235
|
if (o === -1) {
|
|
2228
|
-
t.push(
|
|
2236
|
+
t.push(i);
|
|
2229
2237
|
continue;
|
|
2230
2238
|
}
|
|
2231
2239
|
t[o] = jt(
|
|
2232
2240
|
t[o],
|
|
2233
|
-
|
|
2241
|
+
i
|
|
2234
2242
|
);
|
|
2235
2243
|
}
|
|
2236
2244
|
return t;
|
|
2237
2245
|
}
|
|
2238
|
-
function
|
|
2239
|
-
return e.name === t.name &&
|
|
2246
|
+
function Pi(e, t) {
|
|
2247
|
+
return e.name === t.name && Ce(e.source, t.source);
|
|
2240
2248
|
}
|
|
2241
|
-
function
|
|
2249
|
+
function Ka(e) {
|
|
2242
2250
|
return [
|
|
2243
2251
|
e.source ? ve(e.source) : "unknown",
|
|
2244
2252
|
Ct(e),
|
|
@@ -2246,14 +2254,14 @@ function Xa(e) {
|
|
|
2246
2254
|
].filter(Boolean).join(":");
|
|
2247
2255
|
}
|
|
2248
2256
|
function Ct(e) {
|
|
2249
|
-
return
|
|
2250
|
-
e.aggregate ||
|
|
2257
|
+
return qi(
|
|
2258
|
+
e.aggregate || Li
|
|
2251
2259
|
);
|
|
2252
2260
|
}
|
|
2253
|
-
function
|
|
2261
|
+
function qi(e) {
|
|
2254
2262
|
return e.trim().toUpperCase();
|
|
2255
2263
|
}
|
|
2256
|
-
function
|
|
2264
|
+
function Za(e, t) {
|
|
2257
2265
|
return {
|
|
2258
2266
|
...e,
|
|
2259
2267
|
label: e.label || t.label,
|
|
@@ -2262,32 +2270,32 @@ function Ka(e, t) {
|
|
|
2262
2270
|
source: e.source && t.source ? jt(e.source, t.source) : e.source || t.source
|
|
2263
2271
|
};
|
|
2264
2272
|
}
|
|
2265
|
-
function
|
|
2273
|
+
function Bi(e) {
|
|
2266
2274
|
for (let t = 0; t < e.length; t += 1) {
|
|
2267
|
-
const
|
|
2275
|
+
const n = e[t];
|
|
2268
2276
|
if (e.some(
|
|
2269
|
-
(
|
|
2277
|
+
(i, o) => o !== t && Yt(i, n)
|
|
2270
2278
|
))
|
|
2271
2279
|
return !1;
|
|
2272
2280
|
}
|
|
2273
2281
|
return !0;
|
|
2274
2282
|
}
|
|
2275
2283
|
function Ot(e, t) {
|
|
2276
|
-
return
|
|
2284
|
+
return Pi(e, t);
|
|
2277
2285
|
}
|
|
2278
2286
|
function Yt(e, t) {
|
|
2279
2287
|
return Ot(e, t) && H(e) === H(t);
|
|
2280
2288
|
}
|
|
2281
|
-
function
|
|
2289
|
+
function Wi(e) {
|
|
2282
2290
|
return `Metric intent has duplicate measure "${e.name}" with the same aggregate (${H(e)}). Use different aggregates to request both, or remove one entry.`;
|
|
2283
2291
|
}
|
|
2284
|
-
function
|
|
2292
|
+
function Ke(e) {
|
|
2285
2293
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
2286
2294
|
}
|
|
2287
|
-
function
|
|
2295
|
+
function Ui(e, t, n) {
|
|
2288
2296
|
if (e !== void 0) {
|
|
2289
2297
|
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
2290
|
-
|
|
2298
|
+
n.push(
|
|
2291
2299
|
d(
|
|
2292
2300
|
"invalid_sql_default_parameters",
|
|
2293
2301
|
"SQL defaultParameters must be an object keyed by parameter name.",
|
|
@@ -2296,92 +2304,92 @@ function Un(e, t, i) {
|
|
|
2296
2304
|
);
|
|
2297
2305
|
return;
|
|
2298
2306
|
}
|
|
2299
|
-
Object.entries(e).forEach(([
|
|
2300
|
-
if (!
|
|
2301
|
-
|
|
2307
|
+
Object.entries(e).forEach(([i, o]) => {
|
|
2308
|
+
if (!i.trim()) {
|
|
2309
|
+
n.push(
|
|
2302
2310
|
d(
|
|
2303
2311
|
"invalid_sql_default_parameter_name",
|
|
2304
2312
|
"SQL defaultParameters names must be non-empty strings.",
|
|
2305
|
-
`${t}.${
|
|
2313
|
+
`${t}.${i}`
|
|
2306
2314
|
)
|
|
2307
2315
|
);
|
|
2308
2316
|
return;
|
|
2309
2317
|
}
|
|
2310
|
-
(Array.isArray(o) ? o.every(
|
|
2318
|
+
(Array.isArray(o) ? o.every(Ke) : Ke(o)) || n.push(
|
|
2311
2319
|
d(
|
|
2312
2320
|
"invalid_sql_default_parameter_value",
|
|
2313
2321
|
"SQL defaultParameters values must be strings, numbers, booleans, nulls, or arrays of those scalar values.",
|
|
2314
|
-
`${t}.${
|
|
2322
|
+
`${t}.${i}`
|
|
2315
2323
|
)
|
|
2316
2324
|
);
|
|
2317
2325
|
});
|
|
2318
2326
|
}
|
|
2319
2327
|
}
|
|
2320
|
-
function
|
|
2321
|
-
return
|
|
2328
|
+
function Vi(e, t) {
|
|
2329
|
+
return Oe(e, t).length === 1;
|
|
2322
2330
|
}
|
|
2323
|
-
function
|
|
2324
|
-
return
|
|
2331
|
+
function Hi(e, t) {
|
|
2332
|
+
return Oe(e, t).length === 1;
|
|
2325
2333
|
}
|
|
2326
|
-
function
|
|
2334
|
+
function Oe(e, t) {
|
|
2327
2335
|
return t.filter(
|
|
2328
|
-
(
|
|
2336
|
+
(i) => zi(e, i)
|
|
2329
2337
|
);
|
|
2330
2338
|
}
|
|
2331
|
-
function
|
|
2332
|
-
return
|
|
2339
|
+
function zi(e, t) {
|
|
2340
|
+
return Gi(e, t) ? e.source ? Ot(t, e) : !0 : !1;
|
|
2333
2341
|
}
|
|
2334
|
-
function
|
|
2335
|
-
return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role ||
|
|
2342
|
+
function Gi(e, t) {
|
|
2343
|
+
return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role || Qi(e, t) && H(t) !== H(e));
|
|
2336
2344
|
}
|
|
2337
|
-
function
|
|
2345
|
+
function Qi(e, t) {
|
|
2338
2346
|
return e.role === "measure" || t.role === "measure" || e.aggregate !== void 0 || t.aggregate !== void 0;
|
|
2339
2347
|
}
|
|
2340
2348
|
function H(e) {
|
|
2341
2349
|
return Ct(e);
|
|
2342
2350
|
}
|
|
2343
|
-
const
|
|
2344
|
-
function
|
|
2351
|
+
const Xi = /^(\d{4})-(\d{2})-(\d{2})$/, Lt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
2352
|
+
function ie(e) {
|
|
2345
2353
|
if (typeof e != "string")
|
|
2346
2354
|
return null;
|
|
2347
|
-
const t = e.trim(),
|
|
2348
|
-
if (
|
|
2349
|
-
const [, f, b, A] =
|
|
2350
|
-
return
|
|
2355
|
+
const t = e.trim(), n = Xi.exec(t);
|
|
2356
|
+
if (n) {
|
|
2357
|
+
const [, f, b, A] = n;
|
|
2358
|
+
return Ze(f, b, A) ? new Date(Date.UTC(Number(f), Number(b) - 1, Number(A))) : null;
|
|
2351
2359
|
}
|
|
2352
|
-
const
|
|
2353
|
-
if (!
|
|
2360
|
+
const i = Lt.exec(t);
|
|
2361
|
+
if (!i)
|
|
2354
2362
|
return null;
|
|
2355
|
-
const [, o,
|
|
2356
|
-
if (!
|
|
2363
|
+
const [, o, a, r, l, c, m = "00", , u] = i;
|
|
2364
|
+
if (!Ze(o, a, r) || !B(l, 0, 23) || !B(c, 0, 59) || !B(m, 0, 59) || !Ki(u))
|
|
2357
2365
|
return null;
|
|
2358
2366
|
const p = new Date(t);
|
|
2359
2367
|
return Number.isFinite(p.getTime()) ? p : null;
|
|
2360
2368
|
}
|
|
2361
|
-
function
|
|
2362
|
-
return typeof e != "string" || !Lt.test(e.trim()) ? null :
|
|
2369
|
+
function Ja(e) {
|
|
2370
|
+
return typeof e != "string" || !Lt.test(e.trim()) ? null : ie(e);
|
|
2363
2371
|
}
|
|
2364
|
-
function
|
|
2365
|
-
const
|
|
2366
|
-
if (!Number.isInteger(
|
|
2372
|
+
function Ze(e, t, n) {
|
|
2373
|
+
const i = Number(e), o = Number(t), a = Number(n);
|
|
2374
|
+
if (!Number.isInteger(i) || !Number.isInteger(o) || !Number.isInteger(a) || o < 1 || o > 12)
|
|
2367
2375
|
return !1;
|
|
2368
|
-
const r = new Date(Date.UTC(
|
|
2369
|
-
return r.getUTCFullYear() ===
|
|
2376
|
+
const r = new Date(Date.UTC(i, o - 1, a));
|
|
2377
|
+
return r.getUTCFullYear() === i && r.getUTCMonth() === o - 1 && r.getUTCDate() === a;
|
|
2370
2378
|
}
|
|
2371
|
-
function B(e, t,
|
|
2372
|
-
const
|
|
2373
|
-
return Number.isInteger(
|
|
2379
|
+
function B(e, t, n) {
|
|
2380
|
+
const i = Number(e);
|
|
2381
|
+
return Number.isInteger(i) && i >= t && i <= n;
|
|
2374
2382
|
}
|
|
2375
|
-
function
|
|
2383
|
+
function Ki(e) {
|
|
2376
2384
|
if (e === "Z")
|
|
2377
2385
|
return !0;
|
|
2378
2386
|
const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
|
|
2379
2387
|
return !!(t && B(t[2], 0, 23) && B(t[3], 0, 59));
|
|
2380
2388
|
}
|
|
2381
|
-
function
|
|
2389
|
+
function Je(e, t, n) {
|
|
2382
2390
|
if (e !== void 0) {
|
|
2383
2391
|
if (!g(e)) {
|
|
2384
|
-
|
|
2392
|
+
n.push(
|
|
2385
2393
|
d(
|
|
2386
2394
|
"invalid_pagination",
|
|
2387
2395
|
"Pagination must be an object with positive integer page and pageSize.",
|
|
@@ -2390,13 +2398,13 @@ function Ke(e, t, i) {
|
|
|
2390
2398
|
);
|
|
2391
2399
|
return;
|
|
2392
2400
|
}
|
|
2393
|
-
(!Number.isInteger(e.page) || typeof e.page != "number" || e.page < 1) &&
|
|
2401
|
+
(!Number.isInteger(e.page) || typeof e.page != "number" || e.page < 1) && n.push(
|
|
2394
2402
|
d(
|
|
2395
2403
|
"invalid_pagination_page",
|
|
2396
2404
|
"Pagination page must be a positive integer.",
|
|
2397
2405
|
`${t}.page`
|
|
2398
2406
|
)
|
|
2399
|
-
), (!Number.isInteger(e.pageSize) || typeof e.pageSize != "number" || e.pageSize < 1) &&
|
|
2407
|
+
), (!Number.isInteger(e.pageSize) || typeof e.pageSize != "number" || e.pageSize < 1) && n.push(
|
|
2400
2408
|
d(
|
|
2401
2409
|
"invalid_pagination_page_size",
|
|
2402
2410
|
"Pagination pageSize must be a positive integer.",
|
|
@@ -2405,18 +2413,18 @@ function Ke(e, t, i) {
|
|
|
2405
2413
|
);
|
|
2406
2414
|
}
|
|
2407
2415
|
}
|
|
2408
|
-
function
|
|
2416
|
+
function et(e) {
|
|
2409
2417
|
const t = /* @__PURE__ */ new Set();
|
|
2410
|
-
for (const
|
|
2411
|
-
if (t.has(
|
|
2412
|
-
return
|
|
2413
|
-
t.add(
|
|
2418
|
+
for (const n of e) {
|
|
2419
|
+
if (t.has(n))
|
|
2420
|
+
return n;
|
|
2421
|
+
t.add(n);
|
|
2414
2422
|
}
|
|
2415
2423
|
return null;
|
|
2416
2424
|
}
|
|
2417
|
-
function
|
|
2425
|
+
function Zi(e, t, n) {
|
|
2418
2426
|
if (!g(e)) {
|
|
2419
|
-
|
|
2427
|
+
n.push(
|
|
2420
2428
|
d(
|
|
2421
2429
|
"invalid_input_binding",
|
|
2422
2430
|
"Input bindings must be structured objects.",
|
|
@@ -2425,27 +2433,27 @@ function Zn(e, t, i) {
|
|
|
2425
2433
|
);
|
|
2426
2434
|
return;
|
|
2427
2435
|
}
|
|
2428
|
-
h(e.inputId) ||
|
|
2436
|
+
h(e.inputId) || n.push(
|
|
2429
2437
|
d(
|
|
2430
2438
|
"invalid_input_binding",
|
|
2431
2439
|
"Input bindings need a non-empty inputId.",
|
|
2432
2440
|
`${t}.inputId`
|
|
2433
2441
|
)
|
|
2434
|
-
), e.kind !== void 0 && e.kind !== "filter" && e.kind !== "control" &&
|
|
2442
|
+
), e.kind !== void 0 && e.kind !== "filter" && e.kind !== "control" && n.push(
|
|
2435
2443
|
d(
|
|
2436
2444
|
"invalid_input_binding",
|
|
2437
2445
|
"Input binding kind must be filter or control.",
|
|
2438
2446
|
`${t}.kind`
|
|
2439
2447
|
)
|
|
2440
|
-
), e.field !== void 0 && I(e.field, `${t}.field`,
|
|
2448
|
+
), e.field !== void 0 && I(e.field, `${t}.field`, n), e.relationshipHint !== void 0 && Ye(
|
|
2441
2449
|
e.relationshipHint,
|
|
2442
2450
|
`${t}.relationshipHint`,
|
|
2443
|
-
|
|
2451
|
+
n
|
|
2444
2452
|
);
|
|
2445
2453
|
}
|
|
2446
|
-
function
|
|
2454
|
+
function Ye(e, t, n) {
|
|
2447
2455
|
if (!g(e)) {
|
|
2448
|
-
|
|
2456
|
+
n.push(
|
|
2449
2457
|
d(
|
|
2450
2458
|
"invalid_relationship_hint",
|
|
2451
2459
|
"Relationship hints must be structured objects.",
|
|
@@ -2454,7 +2462,7 @@ function Ce(e, t, i) {
|
|
|
2454
2462
|
);
|
|
2455
2463
|
return;
|
|
2456
2464
|
}
|
|
2457
|
-
e.relationshipIds !== void 0 && (!Array.isArray(e.relationshipIds) || e.relationshipIds.some((
|
|
2465
|
+
e.relationshipIds !== void 0 && (!Array.isArray(e.relationshipIds) || e.relationshipIds.some((i) => !h(i))) && n.push(
|
|
2458
2466
|
d(
|
|
2459
2467
|
"invalid_relationship_hint",
|
|
2460
2468
|
"Relationship hint relationshipIds must be non-empty strings.",
|
|
@@ -2462,9 +2470,9 @@ function Ce(e, t, i) {
|
|
|
2462
2470
|
)
|
|
2463
2471
|
);
|
|
2464
2472
|
}
|
|
2465
|
-
function
|
|
2466
|
-
var
|
|
2467
|
-
if (((
|
|
2473
|
+
function Ji(e, t) {
|
|
2474
|
+
var i, o;
|
|
2475
|
+
if (((i = e.source) == null ? void 0 : i.kind) !== "semantic" && ((o = e.source) == null ? void 0 : o.kind) !== "physical" && t.push(
|
|
2468
2476
|
d(
|
|
2469
2477
|
"invalid_input_options_source",
|
|
2470
2478
|
"Input options must use a semantic or physical source.",
|
|
@@ -2483,9 +2491,9 @@ function Jn(e, t) {
|
|
|
2483
2491
|
"search"
|
|
2484
2492
|
)
|
|
2485
2493
|
), e.matchValues !== void 0) {
|
|
2486
|
-
const
|
|
2487
|
-
|
|
2488
|
-
d("invalid_input_options_match_values",
|
|
2494
|
+
const a = Jt(e.matchValues);
|
|
2495
|
+
a.ok || t.push(
|
|
2496
|
+
d("invalid_input_options_match_values", a.error, "matchValues")
|
|
2489
2497
|
), typeof e.search == "string" && e.search.trim() && t.push(
|
|
2490
2498
|
d(
|
|
2491
2499
|
"invalid_input_options_match_values",
|
|
@@ -2518,8 +2526,8 @@ function Jn(e, t) {
|
|
|
2518
2526
|
required: !0
|
|
2519
2527
|
}), e.searchField !== void 0 && I(e.searchField, "searchField", t, {
|
|
2520
2528
|
required: !0
|
|
2521
|
-
}), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((
|
|
2522
|
-
I(
|
|
2529
|
+
}), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((a, r) => {
|
|
2530
|
+
I(a, `disambiguationFields.${r}`, t, {
|
|
2523
2531
|
required: !0
|
|
2524
2532
|
});
|
|
2525
2533
|
}) : t.push(
|
|
@@ -2532,12 +2540,12 @@ function Jn(e, t) {
|
|
|
2532
2540
|
{ field: e.labelField, path: "labelField" },
|
|
2533
2541
|
{ field: e.valueField, path: "valueField" },
|
|
2534
2542
|
...e.searchField ? [{ field: e.searchField, path: "searchField" }] : [],
|
|
2535
|
-
...Array.isArray(e.disambiguationFields) ? e.disambiguationFields.map((
|
|
2536
|
-
field:
|
|
2543
|
+
...Array.isArray(e.disambiguationFields) ? e.disambiguationFields.map((a, r) => ({
|
|
2544
|
+
field: a,
|
|
2537
2545
|
path: `disambiguationFields.${r}`
|
|
2538
2546
|
})) : []
|
|
2539
|
-
].forEach(({ field:
|
|
2540
|
-
|
|
2547
|
+
].forEach(({ field: a, path: r }) => {
|
|
2548
|
+
a != null && a.source && !Ce(a.source, e.source) && t.push(
|
|
2541
2549
|
d(
|
|
2542
2550
|
"input_options_field_source_mismatch",
|
|
2543
2551
|
"Input option fields must belong to the declared option source.",
|
|
@@ -2545,14 +2553,14 @@ function Jn(e, t) {
|
|
|
2545
2553
|
)
|
|
2546
2554
|
);
|
|
2547
2555
|
}), e.dependencies !== void 0) {
|
|
2548
|
-
const
|
|
2556
|
+
const a = ta(
|
|
2549
2557
|
e.dependencies
|
|
2550
2558
|
);
|
|
2551
|
-
t.push(...
|
|
2559
|
+
t.push(...a.errors), a.ok && ia(e, t);
|
|
2552
2560
|
}
|
|
2553
2561
|
if (e.population !== void 0) {
|
|
2554
|
-
const
|
|
2555
|
-
if (!g(
|
|
2562
|
+
const a = e.population;
|
|
2563
|
+
if (!g(a))
|
|
2556
2564
|
t.push(
|
|
2557
2565
|
d(
|
|
2558
2566
|
"invalid_input_options_population",
|
|
@@ -2561,31 +2569,31 @@ function Jn(e, t) {
|
|
|
2561
2569
|
)
|
|
2562
2570
|
);
|
|
2563
2571
|
else {
|
|
2564
|
-
const r =
|
|
2572
|
+
const r = a.kind;
|
|
2565
2573
|
r !== "option_source" && r !== "related_population" && t.push(
|
|
2566
2574
|
d(
|
|
2567
2575
|
"invalid_input_options_population",
|
|
2568
2576
|
"Input options population kind must be option_source or related_population.",
|
|
2569
2577
|
"population.kind"
|
|
2570
2578
|
)
|
|
2571
|
-
), r === "option_source" &&
|
|
2579
|
+
), r === "option_source" && a.baseSource !== void 0 && t.push(
|
|
2572
2580
|
d(
|
|
2573
2581
|
"invalid_input_options_population",
|
|
2574
2582
|
"Input options population baseSource is only valid for related_population.",
|
|
2575
2583
|
"population.baseSource"
|
|
2576
2584
|
)
|
|
2577
|
-
), r === "option_source" &&
|
|
2585
|
+
), r === "option_source" && a.relationshipHint !== void 0 && t.push(
|
|
2578
2586
|
d(
|
|
2579
2587
|
"invalid_input_options_population",
|
|
2580
2588
|
"Input options population relationshipHint is only valid for related_population.",
|
|
2581
2589
|
"population.relationshipHint"
|
|
2582
2590
|
)
|
|
2583
2591
|
), r === "related_population" && (we(
|
|
2584
|
-
|
|
2592
|
+
a.baseSource,
|
|
2585
2593
|
"population.baseSource",
|
|
2586
2594
|
t
|
|
2587
|
-
),
|
|
2588
|
-
|
|
2595
|
+
), a.relationshipHint !== void 0 && Ye(
|
|
2596
|
+
a.relationshipHint,
|
|
2589
2597
|
"population.relationshipHint",
|
|
2590
2598
|
t
|
|
2591
2599
|
));
|
|
@@ -2605,53 +2613,53 @@ function ea(e, t) {
|
|
|
2605
2613
|
return;
|
|
2606
2614
|
}
|
|
2607
2615
|
e.inputs.forEach(
|
|
2608
|
-
(
|
|
2616
|
+
(n, i) => Zi(n, `inputs.${i}`, t)
|
|
2609
2617
|
);
|
|
2610
2618
|
}
|
|
2611
2619
|
}
|
|
2612
2620
|
function ta(e, t = "protocol") {
|
|
2613
|
-
const
|
|
2621
|
+
const n = [];
|
|
2614
2622
|
if (!g(e))
|
|
2615
|
-
return
|
|
2623
|
+
return n.push(
|
|
2616
2624
|
d(
|
|
2617
2625
|
"invalid_input_options_dependencies",
|
|
2618
2626
|
"Input options dependencies must be a structured object.",
|
|
2619
2627
|
"dependencies"
|
|
2620
2628
|
)
|
|
2621
|
-
), { ok: !1, errors:
|
|
2622
|
-
const
|
|
2623
|
-
if (o !== void 0 && o !== "independent" && o !== "explicit" && o !== "all_applicable" &&
|
|
2629
|
+
), { ok: !1, errors: n, warnings: [] };
|
|
2630
|
+
const i = e, o = i.mode;
|
|
2631
|
+
if (o !== void 0 && o !== "independent" && o !== "explicit" && o !== "all_applicable" && n.push(
|
|
2624
2632
|
d(
|
|
2625
2633
|
"invalid_input_options_dependencies",
|
|
2626
2634
|
"Input options dependencies mode must be independent, explicit, or all_applicable.",
|
|
2627
2635
|
"dependencies.mode"
|
|
2628
2636
|
)
|
|
2629
2637
|
), me(
|
|
2630
|
-
|
|
2638
|
+
i.includeInputIds,
|
|
2631
2639
|
"dependencies.includeInputIds",
|
|
2632
|
-
|
|
2640
|
+
n,
|
|
2633
2641
|
"Input options includeInputIds must be non-empty strings."
|
|
2634
2642
|
), me(
|
|
2635
|
-
|
|
2643
|
+
i.excludeInputIds,
|
|
2636
2644
|
"dependencies.excludeInputIds",
|
|
2637
|
-
|
|
2645
|
+
n,
|
|
2638
2646
|
"Input options excludeInputIds must be non-empty strings."
|
|
2639
|
-
), o === "all_applicable" &&
|
|
2647
|
+
), o === "all_applicable" && i.includeInputIds !== void 0 && n.push(
|
|
2640
2648
|
d(
|
|
2641
2649
|
"invalid_input_options_dependencies",
|
|
2642
2650
|
"All applicable dependencies cannot specify includeInputIds.",
|
|
2643
2651
|
"dependencies.includeInputIds"
|
|
2644
2652
|
)
|
|
2645
2653
|
), me(
|
|
2646
|
-
|
|
2654
|
+
i.omitInputIds,
|
|
2647
2655
|
"dependencies.omitInputIds",
|
|
2648
|
-
|
|
2656
|
+
n,
|
|
2649
2657
|
"Input options omitInputIds must be non-empty strings."
|
|
2650
|
-
), Array.isArray(
|
|
2651
|
-
const
|
|
2652
|
-
Array.isArray(
|
|
2658
|
+
), Array.isArray(i.omitInputIds)) {
|
|
2659
|
+
const a = new Set(
|
|
2660
|
+
Array.isArray(i.includeInputIds) ? i.includeInputIds : []
|
|
2653
2661
|
);
|
|
2654
|
-
(o !== "explicit" || new Set(
|
|
2662
|
+
(o !== "explicit" || new Set(i.omitInputIds).size !== i.omitInputIds.length || i.omitInputIds.some((r) => !a.has(r))) && n.push(
|
|
2655
2663
|
d(
|
|
2656
2664
|
"invalid_input_options_dependencies",
|
|
2657
2665
|
"A browse override may only omit unique ids from an explicit includeInputIds list.",
|
|
@@ -2659,35 +2667,35 @@ function ta(e, t = "protocol") {
|
|
|
2659
2667
|
)
|
|
2660
2668
|
);
|
|
2661
2669
|
}
|
|
2662
|
-
return t === "dashboard" &&
|
|
2670
|
+
return t === "dashboard" && na(i, n), { ok: n.length === 0, errors: n, warnings: [] };
|
|
2663
2671
|
}
|
|
2664
|
-
function
|
|
2665
|
-
const { mode:
|
|
2666
|
-
|
|
2672
|
+
function na(e, t) {
|
|
2673
|
+
const { mode: n, includeInputIds: i, excludeInputIds: o } = e;
|
|
2674
|
+
n === void 0 && t.push(
|
|
2667
2675
|
d(
|
|
2668
2676
|
"invalid_input_options_dependencies",
|
|
2669
2677
|
"Dashboard option dependencies must declare a mode.",
|
|
2670
2678
|
"dependencies.mode"
|
|
2671
2679
|
)
|
|
2672
2680
|
);
|
|
2673
|
-
for (const [
|
|
2674
|
-
["dependencies.includeInputIds",
|
|
2681
|
+
for (const [a, r] of [
|
|
2682
|
+
["dependencies.includeInputIds", i],
|
|
2675
2683
|
["dependencies.excludeInputIds", o]
|
|
2676
2684
|
])
|
|
2677
2685
|
Array.isArray(r) && new Set(r).size !== r.length && t.push(
|
|
2678
2686
|
d(
|
|
2679
2687
|
"invalid_input_options_dependencies",
|
|
2680
2688
|
"Dashboard option dependency input IDs must be unique.",
|
|
2681
|
-
|
|
2689
|
+
a
|
|
2682
2690
|
)
|
|
2683
2691
|
);
|
|
2684
|
-
|
|
2692
|
+
n === "independent" && (i !== void 0 || o !== void 0) && t.push(
|
|
2685
2693
|
d(
|
|
2686
2694
|
"invalid_input_options_dependencies",
|
|
2687
2695
|
"Independent dashboard dependencies cannot specify input IDs.",
|
|
2688
2696
|
"dependencies"
|
|
2689
2697
|
)
|
|
2690
|
-
),
|
|
2698
|
+
), n === "explicit" && (!Array.isArray(i) || i.length === 0 || o !== void 0) && t.push(
|
|
2691
2699
|
d(
|
|
2692
2700
|
"invalid_input_options_dependencies",
|
|
2693
2701
|
"Explicit dashboard dependencies require included input IDs and cannot specify exclusions.",
|
|
@@ -2695,13 +2703,13 @@ function ia(e, t) {
|
|
|
2695
2703
|
)
|
|
2696
2704
|
);
|
|
2697
2705
|
}
|
|
2698
|
-
function
|
|
2699
|
-
var o,
|
|
2700
|
-
const
|
|
2706
|
+
function ia(e, t) {
|
|
2707
|
+
var o, a, r;
|
|
2708
|
+
const n = new Set(
|
|
2701
2709
|
Array.isArray(e.inputs) ? e.inputs.map((l) => g(l) ? l.inputId : void 0).filter((l) => typeof l == "string") : []
|
|
2702
|
-
),
|
|
2703
|
-
for (const l of ((
|
|
2704
|
-
!
|
|
2710
|
+
), i = new Set(((o = e.dependencies) == null ? void 0 : o.omitInputIds) || []);
|
|
2711
|
+
for (const l of ((a = e.dependencies) == null ? void 0 : a.includeInputIds) || [])
|
|
2712
|
+
!n.has(l) && !i.has(l) && t.push(
|
|
2705
2713
|
d(
|
|
2706
2714
|
"invalid_input_options_dependencies",
|
|
2707
2715
|
`Input options dependency "${l}" is not declared in inputs.`,
|
|
@@ -2709,7 +2717,7 @@ function na(e, t) {
|
|
|
2709
2717
|
)
|
|
2710
2718
|
);
|
|
2711
2719
|
for (const l of ((r = e.dependencies) == null ? void 0 : r.excludeInputIds) || [])
|
|
2712
|
-
l !== e.inputId && !
|
|
2720
|
+
l !== e.inputId && !n.has(l) && t.push(
|
|
2713
2721
|
d(
|
|
2714
2722
|
"invalid_input_options_dependencies",
|
|
2715
2723
|
`Input options dependency exclusion "${l}" is not the populated inputId and is not declared in inputs.`,
|
|
@@ -2717,8 +2725,8 @@ function na(e, t) {
|
|
|
2717
2725
|
)
|
|
2718
2726
|
);
|
|
2719
2727
|
}
|
|
2720
|
-
function me(e, t,
|
|
2721
|
-
e !== void 0 && (!Array.isArray(e) || e.some((o) => !h(o))) &&
|
|
2728
|
+
function me(e, t, n, i) {
|
|
2729
|
+
e !== void 0 && (!Array.isArray(e) || e.some((o) => !h(o))) && n.push(d("invalid_input_options_dependencies", i, t));
|
|
2722
2730
|
}
|
|
2723
2731
|
new Set(Kt);
|
|
2724
2732
|
function aa(e, t) {
|
|
@@ -2763,23 +2771,23 @@ function aa(e, t) {
|
|
|
2763
2771
|
"analysis.orderBy"
|
|
2764
2772
|
)
|
|
2765
2773
|
);
|
|
2766
|
-
const { timeWindow:
|
|
2767
|
-
|
|
2774
|
+
const { timeWindow: n } = e.analysis;
|
|
2775
|
+
n !== void 0 && ae(n, "analysis.timeWindow", t);
|
|
2768
2776
|
}
|
|
2769
|
-
function ae(e, t,
|
|
2770
|
-
const
|
|
2771
|
-
|
|
2777
|
+
function ae(e, t, n) {
|
|
2778
|
+
const i = Se(e, { use: "analysis" });
|
|
2779
|
+
i.ok || n.push(
|
|
2772
2780
|
d(
|
|
2773
2781
|
"invalid_time_window",
|
|
2774
|
-
|
|
2775
|
-
|
|
2782
|
+
pt(i.refusal),
|
|
2783
|
+
i.refusal.path ? `${t}.${i.refusal.path}` : t
|
|
2776
2784
|
)
|
|
2777
2785
|
);
|
|
2778
2786
|
}
|
|
2779
|
-
function
|
|
2787
|
+
function tt(e, t, n) {
|
|
2780
2788
|
if (e !== void 0) {
|
|
2781
2789
|
if (!Array.isArray(e)) {
|
|
2782
|
-
|
|
2790
|
+
n.push(
|
|
2783
2791
|
d(
|
|
2784
2792
|
"invalid_analytics_filters",
|
|
2785
2793
|
"Analytics filters must be an array.",
|
|
@@ -2788,64 +2796,64 @@ function Je(e, t, i) {
|
|
|
2788
2796
|
);
|
|
2789
2797
|
return;
|
|
2790
2798
|
}
|
|
2791
|
-
e.forEach((
|
|
2799
|
+
e.forEach((i, o) => {
|
|
2792
2800
|
var c;
|
|
2793
|
-
const
|
|
2794
|
-
if (!g(
|
|
2795
|
-
|
|
2801
|
+
const a = `${t}.${o}`;
|
|
2802
|
+
if (!g(i)) {
|
|
2803
|
+
n.push(
|
|
2796
2804
|
d(
|
|
2797
2805
|
"invalid_analytics_filter",
|
|
2798
2806
|
"Analytics filter must be a structured object.",
|
|
2799
|
-
|
|
2807
|
+
a
|
|
2800
2808
|
)
|
|
2801
2809
|
);
|
|
2802
2810
|
return;
|
|
2803
2811
|
}
|
|
2804
|
-
const r =
|
|
2805
|
-
I(r.field, `${
|
|
2812
|
+
const r = i;
|
|
2813
|
+
I(r.field, `${a}.field`, n, {
|
|
2806
2814
|
required: !0
|
|
2807
|
-
}), r.scope !== void 0 && r.scope !== "row" && r.scope !== "aggregate" &&
|
|
2815
|
+
}), r.scope !== void 0 && r.scope !== "row" && r.scope !== "aggregate" && n.push(
|
|
2808
2816
|
d(
|
|
2809
2817
|
"invalid_analytics_filter_scope",
|
|
2810
2818
|
"Analytics filter scope must be row or aggregate.",
|
|
2811
|
-
`${
|
|
2819
|
+
`${a}.scope`
|
|
2812
2820
|
)
|
|
2813
|
-
), r.scope === "aggregate" && ((c = r.field) == null ? void 0 : c.role) !== void 0 && r.field.role !== "measure" &&
|
|
2821
|
+
), r.scope === "aggregate" && ((c = r.field) == null ? void 0 : c.role) !== void 0 && r.field.role !== "measure" && n.push(
|
|
2814
2822
|
d(
|
|
2815
2823
|
"invalid_analytics_filter_scope",
|
|
2816
2824
|
"Aggregate-scope analytics filters must target a measure field.",
|
|
2817
|
-
`${
|
|
2825
|
+
`${a}.scope`
|
|
2818
2826
|
)
|
|
2819
2827
|
);
|
|
2820
2828
|
const l = r.operator === "is_null" || r.operator === "is_not_null";
|
|
2821
|
-
if (r.operator !== void 0 && r.operator !== "=" && r.operator !== "!=" && r.operator !== "in" && r.operator !== "not_in" && r.operator !== "contains" && r.operator !== "not_contains" && r.operator !== "between" && r.operator !== "not_between" && r.operator !== ">" && r.operator !== ">=" && r.operator !== "<" && r.operator !== "<=" && r.operator !== "is_null" && r.operator !== "is_not_null" &&
|
|
2829
|
+
if (r.operator !== void 0 && r.operator !== "=" && r.operator !== "!=" && r.operator !== "in" && r.operator !== "not_in" && r.operator !== "contains" && r.operator !== "not_contains" && r.operator !== "between" && r.operator !== "not_between" && r.operator !== ">" && r.operator !== ">=" && r.operator !== "<" && r.operator !== "<=" && r.operator !== "is_null" && r.operator !== "is_not_null" && n.push(
|
|
2822
2830
|
d(
|
|
2823
2831
|
"invalid_analytics_filter_operator",
|
|
2824
2832
|
"Analytics filter operator is not supported.",
|
|
2825
|
-
`${
|
|
2833
|
+
`${a}.operator`
|
|
2826
2834
|
)
|
|
2827
|
-
), r.values === void 0 && !l &&
|
|
2835
|
+
), r.values === void 0 && !l && n.push(
|
|
2828
2836
|
d(
|
|
2829
2837
|
"missing_analytics_filter_value",
|
|
2830
2838
|
"Analytics filter needs values unless it is a null check.",
|
|
2831
|
-
|
|
2839
|
+
a
|
|
2832
2840
|
)
|
|
2833
2841
|
), l && r.values !== void 0) {
|
|
2834
|
-
|
|
2842
|
+
n.push(
|
|
2835
2843
|
d(
|
|
2836
2844
|
"invalid_analytics_filter_values",
|
|
2837
2845
|
"Null-check analytics filters must not include values.",
|
|
2838
|
-
`${
|
|
2846
|
+
`${a}.values`
|
|
2839
2847
|
)
|
|
2840
2848
|
);
|
|
2841
2849
|
return;
|
|
2842
2850
|
}
|
|
2843
2851
|
if (r.values !== void 0 && !Array.isArray(r.values)) {
|
|
2844
|
-
|
|
2852
|
+
n.push(
|
|
2845
2853
|
d(
|
|
2846
2854
|
"invalid_analytics_filter_values",
|
|
2847
2855
|
"Analytics filter values must be an array when provided.",
|
|
2848
|
-
`${
|
|
2856
|
+
`${a}.values`
|
|
2849
2857
|
)
|
|
2850
2858
|
);
|
|
2851
2859
|
return;
|
|
@@ -2853,20 +2861,20 @@ function Je(e, t, i) {
|
|
|
2853
2861
|
if (r.values !== void 0) {
|
|
2854
2862
|
const m = r.values.length;
|
|
2855
2863
|
if (r.operator === "between" || r.operator === "not_between") {
|
|
2856
|
-
m !== 2 &&
|
|
2864
|
+
m !== 2 && n.push(
|
|
2857
2865
|
d(
|
|
2858
2866
|
"invalid_analytics_filter_values",
|
|
2859
2867
|
"Between analytics filters must include exactly two values.",
|
|
2860
|
-
`${
|
|
2868
|
+
`${a}.values`
|
|
2861
2869
|
)
|
|
2862
2870
|
);
|
|
2863
2871
|
return;
|
|
2864
2872
|
}
|
|
2865
|
-
(r.operator === "contains" || r.operator === "not_contains" || r.operator === "=" || r.operator === "!=" || r.operator === ">" || r.operator === ">=" || r.operator === "<" || r.operator === "<=" || r.operator === void 0) && m !== 1 &&
|
|
2873
|
+
(r.operator === "contains" || r.operator === "not_contains" || r.operator === "=" || r.operator === "!=" || r.operator === ">" || r.operator === ">=" || r.operator === "<" || r.operator === "<=" || r.operator === void 0) && m !== 1 && n.push(
|
|
2866
2874
|
d(
|
|
2867
2875
|
"invalid_analytics_filter_values",
|
|
2868
2876
|
"Scalar analytics filters must include exactly one value. Use in/not_in for multiple values.",
|
|
2869
|
-
`${
|
|
2877
|
+
`${a}.values`
|
|
2870
2878
|
)
|
|
2871
2879
|
);
|
|
2872
2880
|
}
|
|
@@ -2874,8 +2882,8 @@ function Je(e, t, i) {
|
|
|
2874
2882
|
}
|
|
2875
2883
|
}
|
|
2876
2884
|
function Pt(e) {
|
|
2877
|
-
var
|
|
2878
|
-
const t = [],
|
|
2885
|
+
var i;
|
|
2886
|
+
const t = [], n = [];
|
|
2879
2887
|
if (!e || typeof e != "object")
|
|
2880
2888
|
return {
|
|
2881
2889
|
ok: !1,
|
|
@@ -2885,7 +2893,7 @@ function Pt(e) {
|
|
|
2885
2893
|
"Analytics intent must be a structured object."
|
|
2886
2894
|
)
|
|
2887
2895
|
],
|
|
2888
|
-
warnings:
|
|
2896
|
+
warnings: n,
|
|
2889
2897
|
repairHints: [
|
|
2890
2898
|
{
|
|
2891
2899
|
code: "invalid_analytics_intent",
|
|
@@ -2894,8 +2902,8 @@ function Pt(e) {
|
|
|
2894
2902
|
]
|
|
2895
2903
|
};
|
|
2896
2904
|
if (e.kind === "matrix") {
|
|
2897
|
-
const o =
|
|
2898
|
-
return o.success || t.push(...o.error.issues.map((
|
|
2905
|
+
const o = Di.safeParse(e);
|
|
2906
|
+
return o.success || t.push(...o.error.issues.map((a) => d("invalid_matrix_intent", a.message, a.path.join(".")))), { ok: t.length === 0, errors: t, warnings: n, repairHints: nt(t) };
|
|
2899
2907
|
}
|
|
2900
2908
|
if (e.version !== void 0 && e.version !== 1 && t.push(
|
|
2901
2909
|
d(
|
|
@@ -2903,13 +2911,13 @@ function Pt(e) {
|
|
|
2903
2911
|
"Analytics intent version must be 1.",
|
|
2904
2912
|
"version"
|
|
2905
2913
|
)
|
|
2906
|
-
), we(e.source, "source", t), sa(e, t), ea(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 &&
|
|
2914
|
+
), we(e.source, "source", t), sa(e, t), ea(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && Ye(
|
|
2907
2915
|
e.relationshipHint,
|
|
2908
2916
|
"relationshipHint",
|
|
2909
2917
|
t
|
|
2910
2918
|
), e.kind === "metric") {
|
|
2911
2919
|
const o = Array.isArray(e.measures) ? e.measures.filter(
|
|
2912
|
-
(
|
|
2920
|
+
(a) => g(a) && h(a.name)
|
|
2913
2921
|
) : [];
|
|
2914
2922
|
if (!Array.isArray(e.measures) || e.measures.length === 0 ? t.push(
|
|
2915
2923
|
d(
|
|
@@ -2918,32 +2926,32 @@ function Pt(e) {
|
|
|
2918
2926
|
"measures"
|
|
2919
2927
|
)
|
|
2920
2928
|
) : e.measures.some(
|
|
2921
|
-
(
|
|
2929
|
+
(a) => !g(a) || !h(a.name)
|
|
2922
2930
|
) && t.push(
|
|
2923
2931
|
d(
|
|
2924
2932
|
"invalid_measure_list",
|
|
2925
2933
|
"Metric intent measures must be an array of field references with names.",
|
|
2926
2934
|
"measures"
|
|
2927
2935
|
)
|
|
2928
|
-
), o.forEach((
|
|
2929
|
-
I(
|
|
2936
|
+
), o.forEach((a, r) => {
|
|
2937
|
+
I(a, `measures.${r}`, t, {
|
|
2930
2938
|
required: !0
|
|
2931
2939
|
});
|
|
2932
|
-
}), o.length > 0 && !
|
|
2933
|
-
const
|
|
2940
|
+
}), o.length > 0 && !Bi(o)) {
|
|
2941
|
+
const a = o.find(
|
|
2934
2942
|
(r, l) => o.some(
|
|
2935
2943
|
(c, m) => m !== l && Yt(c, r)
|
|
2936
2944
|
)
|
|
2937
2945
|
);
|
|
2938
|
-
|
|
2946
|
+
a && t.push(
|
|
2939
2947
|
d(
|
|
2940
2948
|
"duplicate_measure",
|
|
2941
|
-
|
|
2949
|
+
Wi(a),
|
|
2942
2950
|
"measures"
|
|
2943
2951
|
)
|
|
2944
2952
|
);
|
|
2945
2953
|
}
|
|
2946
|
-
if (g(e.primaryMeasure) && h(e.primaryMeasure.name) &&
|
|
2954
|
+
if (g(e.primaryMeasure) && h(e.primaryMeasure.name) && Oe(
|
|
2947
2955
|
e.primaryMeasure,
|
|
2948
2956
|
o
|
|
2949
2957
|
).length > 1 && t.push(
|
|
@@ -2954,7 +2962,7 @@ function Pt(e) {
|
|
|
2954
2962
|
)
|
|
2955
2963
|
), e.primaryMeasure !== void 0 && (I(e.primaryMeasure, "primaryMeasure", t, {
|
|
2956
2964
|
required: !0
|
|
2957
|
-
}), g(e.primaryMeasure) && h(e.primaryMeasure.name) && o.length > 0 && !
|
|
2965
|
+
}), g(e.primaryMeasure) && h(e.primaryMeasure.name) && o.length > 0 && !Vi(
|
|
2958
2966
|
e.primaryMeasure,
|
|
2959
2967
|
o
|
|
2960
2968
|
) && t.push(
|
|
@@ -2970,7 +2978,7 @@ function Pt(e) {
|
|
|
2970
2978
|
"dimensions"
|
|
2971
2979
|
)
|
|
2972
2980
|
) : Array.isArray(e.dimensions) && e.dimensions.some(
|
|
2973
|
-
(
|
|
2981
|
+
(a) => !g(a) || !h(a.name)
|
|
2974
2982
|
) && t.push(
|
|
2975
2983
|
d(
|
|
2976
2984
|
"invalid_measure_dimensions",
|
|
@@ -2983,8 +2991,8 @@ function Pt(e) {
|
|
|
2983
2991
|
"Metric timeWindow needs a dateField.",
|
|
2984
2992
|
"dateField"
|
|
2985
2993
|
)
|
|
2986
|
-
)),
|
|
2987
|
-
I(
|
|
2994
|
+
)), tt(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((a, r) => {
|
|
2995
|
+
I(a, `dimensions.${r}`, t);
|
|
2988
2996
|
}), e.orderBy !== void 0) {
|
|
2989
2997
|
if (!g(e.orderBy))
|
|
2990
2998
|
t.push(
|
|
@@ -3003,16 +3011,16 @@ function Pt(e) {
|
|
|
3003
3011
|
"orderBy.direction"
|
|
3004
3012
|
)
|
|
3005
3013
|
), g(e.orderBy.field) && h(e.orderBy.field.name)) {
|
|
3006
|
-
const
|
|
3014
|
+
const a = [
|
|
3007
3015
|
...o,
|
|
3008
3016
|
...e.timeGrain && e.dateField && g(e.dateField) ? [e.dateField] : [],
|
|
3009
3017
|
...Array.isArray(e.dimensions) ? e.dimensions.filter(
|
|
3010
3018
|
(r) => g(r) && h(r.name)
|
|
3011
3019
|
) : []
|
|
3012
3020
|
];
|
|
3013
|
-
|
|
3021
|
+
a.length > 0 && !Hi(
|
|
3014
3022
|
e.orderBy.field,
|
|
3015
|
-
|
|
3023
|
+
a
|
|
3016
3024
|
) && t.push(
|
|
3017
3025
|
d(
|
|
3018
3026
|
"invalid_measure_order_by",
|
|
@@ -3038,20 +3046,20 @@ function Pt(e) {
|
|
|
3038
3046
|
"Records intent fields must be field references with names.",
|
|
3039
3047
|
"fields"
|
|
3040
3048
|
)
|
|
3041
|
-
), Array.isArray(e.fields) && e.fields.forEach((o,
|
|
3042
|
-
I(o, `fields.${
|
|
3043
|
-
}), e.dateField !== void 0 && I(e.dateField, "dateField", t),
|
|
3049
|
+
), Array.isArray(e.fields) && e.fields.forEach((o, a) => {
|
|
3050
|
+
I(o, `fields.${a}`, t);
|
|
3051
|
+
}), e.dateField !== void 0 && I(e.dateField, "dateField", t), Je(e.pagination, "pagination", t), e.timeWindow !== void 0 && (ae(e.timeWindow, "timeWindow", t), e.dateField || t.push(
|
|
3044
3052
|
d(
|
|
3045
3053
|
"missing_time_window_date_field",
|
|
3046
3054
|
"Records timeWindow needs a dateField.",
|
|
3047
3055
|
"dateField"
|
|
3048
3056
|
)
|
|
3049
|
-
)),
|
|
3057
|
+
)), tt(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((o, a) => {
|
|
3050
3058
|
g(o) && o.scope === "aggregate" && t.push(
|
|
3051
3059
|
d(
|
|
3052
3060
|
"unsupported_record_filter_scope",
|
|
3053
3061
|
"Records intents support row-scope filters only. Use a metric intent for aggregate-scope filters.",
|
|
3054
|
-
`filters.${
|
|
3062
|
+
`filters.${a}.scope`
|
|
3055
3063
|
)
|
|
3056
3064
|
);
|
|
3057
3065
|
}), e.orderBy !== void 0 && (g(e.orderBy) ? (I(e.orderBy.field, "orderBy.field", t, {
|
|
@@ -3092,10 +3100,10 @@ function Pt(e) {
|
|
|
3092
3100
|
"Records server totals need at least one measure.",
|
|
3093
3101
|
"totals.measures"
|
|
3094
3102
|
)
|
|
3095
|
-
) : o.forEach((
|
|
3096
|
-
I(
|
|
3103
|
+
) : o.forEach((a, r) => {
|
|
3104
|
+
I(a, `totals.measures.${r}`, t, {
|
|
3097
3105
|
required: !0
|
|
3098
|
-
}), (!g(
|
|
3106
|
+
}), (!g(a) || a.role !== "measure") && t.push(
|
|
3099
3107
|
d(
|
|
3100
3108
|
"invalid_records_totals_measure",
|
|
3101
3109
|
"Records server totals measures must be measure field references.",
|
|
@@ -3104,7 +3112,7 @@ function Pt(e) {
|
|
|
3104
3112
|
);
|
|
3105
3113
|
});
|
|
3106
3114
|
}
|
|
3107
|
-
} else e.kind === "inputOptions" ?
|
|
3115
|
+
} else e.kind === "inputOptions" ? Ji(e, t) : e.kind === "sql" ? (((i = e.source) == null ? void 0 : i.kind) !== "sql" && t.push(
|
|
3108
3116
|
d(
|
|
3109
3117
|
"invalid_sql_source",
|
|
3110
3118
|
"SQL analytics intent must use a SQL execution source.",
|
|
@@ -3112,13 +3120,13 @@ function Pt(e) {
|
|
|
3112
3120
|
)
|
|
3113
3121
|
), h(e.sql) || t.push(
|
|
3114
3122
|
d("missing_sql", "SQL analytics intent needs SQL text.", "sql")
|
|
3115
|
-
),
|
|
3123
|
+
), Ui(
|
|
3116
3124
|
e.defaultParameters,
|
|
3117
3125
|
"defaultParameters",
|
|
3118
3126
|
t
|
|
3119
|
-
), Array.isArray(e.fields) && e.fields.forEach((o,
|
|
3120
|
-
I(o, `fields.${
|
|
3121
|
-
}),
|
|
3127
|
+
), Array.isArray(e.fields) && e.fields.forEach((o, a) => {
|
|
3128
|
+
I(o, `fields.${a}`, t);
|
|
3129
|
+
}), Je(e.pagination, "pagination", t)) : t.push(
|
|
3122
3130
|
d(
|
|
3123
3131
|
"invalid_analytics_kind",
|
|
3124
3132
|
"Analytics kind is not supported.",
|
|
@@ -3128,8 +3136,8 @@ function Pt(e) {
|
|
|
3128
3136
|
return {
|
|
3129
3137
|
ok: t.length === 0,
|
|
3130
3138
|
errors: t,
|
|
3131
|
-
warnings:
|
|
3132
|
-
repairHints:
|
|
3139
|
+
warnings: n,
|
|
3140
|
+
repairHints: nt(t)
|
|
3133
3141
|
};
|
|
3134
3142
|
}
|
|
3135
3143
|
function sa(e, t) {
|
|
@@ -3144,20 +3152,20 @@ function sa(e, t) {
|
|
|
3144
3152
|
);
|
|
3145
3153
|
return;
|
|
3146
3154
|
}
|
|
3147
|
-
e.derivedFields.forEach((
|
|
3155
|
+
e.derivedFields.forEach((n, i) => {
|
|
3148
3156
|
Ae(
|
|
3149
|
-
|
|
3150
|
-
).errors.forEach((
|
|
3157
|
+
n
|
|
3158
|
+
).errors.forEach((a) => {
|
|
3151
3159
|
t.push({
|
|
3152
|
-
...
|
|
3153
|
-
path:
|
|
3160
|
+
...a,
|
|
3161
|
+
path: a.path ? `derivedFields.${i}.${a.path}` : `derivedFields.${i}`
|
|
3154
3162
|
});
|
|
3155
3163
|
});
|
|
3156
3164
|
});
|
|
3157
3165
|
}
|
|
3158
3166
|
}
|
|
3159
3167
|
function ra(e) {
|
|
3160
|
-
const t = [],
|
|
3168
|
+
const t = [], n = [];
|
|
3161
3169
|
if (!e || typeof e != "object")
|
|
3162
3170
|
return {
|
|
3163
3171
|
ok: !1,
|
|
@@ -3167,7 +3175,7 @@ function ra(e) {
|
|
|
3167
3175
|
"Operation intent must be a structured object."
|
|
3168
3176
|
)
|
|
3169
3177
|
],
|
|
3170
|
-
warnings:
|
|
3178
|
+
warnings: n,
|
|
3171
3179
|
repairHints: [
|
|
3172
3180
|
{
|
|
3173
3181
|
code: "invalid_operation_intent",
|
|
@@ -3188,14 +3196,14 @@ function ra(e) {
|
|
|
3188
3196
|
"Answer-obligations operation intent needs at least one obligation.",
|
|
3189
3197
|
"obligations"
|
|
3190
3198
|
)
|
|
3191
|
-
) : e.obligations.forEach((
|
|
3192
|
-
h(
|
|
3199
|
+
) : e.obligations.forEach((i, o) => {
|
|
3200
|
+
h(i.id) || t.push(
|
|
3193
3201
|
d(
|
|
3194
3202
|
"missing_obligation_id",
|
|
3195
3203
|
"Each analytics obligation needs an id.",
|
|
3196
3204
|
`obligations.${o}.id`
|
|
3197
3205
|
)
|
|
3198
|
-
),
|
|
3206
|
+
), i.timeWindow !== void 0 && ae(i.timeWindow, `obligations.${o}.timeWindow`, t), h(i.prompt) || t.push(
|
|
3199
3207
|
d(
|
|
3200
3208
|
"missing_obligation_prompt",
|
|
3201
3209
|
"Each analytics obligation needs a prompt.",
|
|
@@ -3211,10 +3219,10 @@ function ra(e) {
|
|
|
3211
3219
|
"instruction"
|
|
3212
3220
|
)
|
|
3213
3221
|
), e.analyticsIntent) {
|
|
3214
|
-
const
|
|
3222
|
+
const i = Pt(
|
|
3215
3223
|
e.analyticsIntent
|
|
3216
3224
|
);
|
|
3217
|
-
t.push(...
|
|
3225
|
+
t.push(...i.errors), n.push(...i.warnings);
|
|
3218
3226
|
}
|
|
3219
3227
|
} else
|
|
3220
3228
|
t.push(
|
|
@@ -3227,12 +3235,12 @@ function ra(e) {
|
|
|
3227
3235
|
return {
|
|
3228
3236
|
ok: t.length === 0,
|
|
3229
3237
|
errors: t,
|
|
3230
|
-
warnings:
|
|
3238
|
+
warnings: n,
|
|
3231
3239
|
repairHints: qt(t)
|
|
3232
3240
|
};
|
|
3233
3241
|
}
|
|
3234
|
-
function
|
|
3235
|
-
const t = [],
|
|
3242
|
+
function es(e) {
|
|
3243
|
+
const t = [], n = [];
|
|
3236
3244
|
if (!e || typeof e != "object")
|
|
3237
3245
|
return {
|
|
3238
3246
|
ok: !1,
|
|
@@ -3242,7 +3250,7 @@ function Ja(e) {
|
|
|
3242
3250
|
"Analytics recovery plan must be a structured object."
|
|
3243
3251
|
)
|
|
3244
3252
|
],
|
|
3245
|
-
warnings:
|
|
3253
|
+
warnings: n,
|
|
3246
3254
|
repairHints: [
|
|
3247
3255
|
{
|
|
3248
3256
|
code: "invalid_recovery_plan",
|
|
@@ -3259,10 +3267,10 @@ function Ja(e) {
|
|
|
3259
3267
|
"kind"
|
|
3260
3268
|
)
|
|
3261
3269
|
);
|
|
3262
|
-
const
|
|
3270
|
+
const i = ra(
|
|
3263
3271
|
e.operationIntent
|
|
3264
3272
|
);
|
|
3265
|
-
return t.push(...
|
|
3273
|
+
return t.push(...i.errors), n.push(...i.warnings), Array.isArray(e.plannedToolCalls) || t.push(
|
|
3266
3274
|
d(
|
|
3267
3275
|
"invalid_planned_tool_calls",
|
|
3268
3276
|
"Recovery plan plannedToolCalls must be an array.",
|
|
@@ -3271,7 +3279,7 @@ function Ja(e) {
|
|
|
3271
3279
|
), {
|
|
3272
3280
|
ok: t.length === 0,
|
|
3273
3281
|
errors: t,
|
|
3274
|
-
warnings:
|
|
3282
|
+
warnings: n,
|
|
3275
3283
|
repairHints: qt(t)
|
|
3276
3284
|
};
|
|
3277
3285
|
}
|
|
@@ -3281,7 +3289,7 @@ function qt(e) {
|
|
|
3281
3289
|
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."
|
|
3282
3290
|
}));
|
|
3283
3291
|
}
|
|
3284
|
-
function
|
|
3292
|
+
function nt(e) {
|
|
3285
3293
|
return e.map((t) => {
|
|
3286
3294
|
switch (t.code) {
|
|
3287
3295
|
case "invalid_matrix_intent":
|
|
@@ -3369,17 +3377,17 @@ function et(e) {
|
|
|
3369
3377
|
}
|
|
3370
3378
|
}).filter((t) => !!t);
|
|
3371
3379
|
}
|
|
3372
|
-
function oa(e, t,
|
|
3380
|
+
function oa(e, t, n, i) {
|
|
3373
3381
|
if (!e || typeof e != "object") {
|
|
3374
|
-
|
|
3382
|
+
n.push(
|
|
3375
3383
|
d("invalid_view", "Dashboard view must be an object.", t)
|
|
3376
3384
|
);
|
|
3377
3385
|
return;
|
|
3378
3386
|
}
|
|
3379
|
-
if (h(e.title) ||
|
|
3387
|
+
if (h(e.title) || n.push(
|
|
3380
3388
|
d("missing_view_title", "Dashboard view needs a title.", t)
|
|
3381
3389
|
), !e.presentation || typeof e.presentation != "object") {
|
|
3382
|
-
|
|
3390
|
+
n.push(
|
|
3383
3391
|
d(
|
|
3384
3392
|
"missing_presentation",
|
|
3385
3393
|
"Dashboard view needs a presentation.",
|
|
@@ -3389,7 +3397,7 @@ function oa(e, t, i, n) {
|
|
|
3389
3397
|
return;
|
|
3390
3398
|
}
|
|
3391
3399
|
if (e.presentation.kind === "text") {
|
|
3392
|
-
h(e.text) ||
|
|
3400
|
+
h(e.text) || i.push(
|
|
3393
3401
|
d(
|
|
3394
3402
|
"missing_text_content",
|
|
3395
3403
|
"Text views should include text content.",
|
|
@@ -3399,7 +3407,7 @@ function oa(e, t, i, n) {
|
|
|
3399
3407
|
return;
|
|
3400
3408
|
}
|
|
3401
3409
|
if (!e.analytics) {
|
|
3402
|
-
|
|
3410
|
+
n.push(
|
|
3403
3411
|
d(
|
|
3404
3412
|
"missing_view_analytics",
|
|
3405
3413
|
"Non-text dashboard views need analytics intent.",
|
|
@@ -3408,7 +3416,7 @@ function oa(e, t, i, n) {
|
|
|
3408
3416
|
);
|
|
3409
3417
|
return;
|
|
3410
3418
|
}
|
|
3411
|
-
e.presentation.kind === "matrixTable" && e.analytics.kind !== "matrix" &&
|
|
3419
|
+
e.presentation.kind === "matrixTable" && e.analytics.kind !== "matrix" && n.push(
|
|
3412
3420
|
d(
|
|
3413
3421
|
"invalid_matrix_view_analytics",
|
|
3414
3422
|
"Matrix table views need matrix analytics intent.",
|
|
@@ -3416,25 +3424,25 @@ function oa(e, t, i, n) {
|
|
|
3416
3424
|
)
|
|
3417
3425
|
);
|
|
3418
3426
|
const o = Pt(e.analytics);
|
|
3419
|
-
for (const
|
|
3420
|
-
|
|
3427
|
+
for (const a of o.errors)
|
|
3428
|
+
n.push(
|
|
3421
3429
|
d(
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
`${t}.analytics${
|
|
3430
|
+
a.code,
|
|
3431
|
+
a.message,
|
|
3432
|
+
`${t}.analytics${a.path ? `.${a.path}` : ""}`
|
|
3425
3433
|
)
|
|
3426
3434
|
);
|
|
3427
|
-
for (const
|
|
3428
|
-
|
|
3435
|
+
for (const a of o.warnings)
|
|
3436
|
+
i.push(
|
|
3429
3437
|
d(
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
`${t}.analytics${
|
|
3438
|
+
a.code,
|
|
3439
|
+
a.message,
|
|
3440
|
+
`${t}.analytics${a.path ? `.${a.path}` : ""}`
|
|
3433
3441
|
)
|
|
3434
3442
|
);
|
|
3435
3443
|
}
|
|
3436
|
-
function
|
|
3437
|
-
const t = [],
|
|
3444
|
+
function ts(e) {
|
|
3445
|
+
const t = [], n = [];
|
|
3438
3446
|
if (!e || typeof e != "object")
|
|
3439
3447
|
return {
|
|
3440
3448
|
ok: !1,
|
|
@@ -3444,7 +3452,7 @@ function es(e) {
|
|
|
3444
3452
|
"Dashboard intent must be a structured object."
|
|
3445
3453
|
)
|
|
3446
3454
|
],
|
|
3447
|
-
warnings:
|
|
3455
|
+
warnings: n
|
|
3448
3456
|
};
|
|
3449
3457
|
e.version !== 1 && t.push(
|
|
3450
3458
|
d("invalid_version", "Dashboard intent version must be 1.")
|
|
@@ -3453,8 +3461,8 @@ function es(e) {
|
|
|
3453
3461
|
), h(e.title) || t.push(
|
|
3454
3462
|
d("missing_title", "Dashboard intent needs a title.", "title")
|
|
3455
3463
|
);
|
|
3456
|
-
const
|
|
3457
|
-
|
|
3464
|
+
const i = Array.isArray(e.inputs) ? e.inputs : [], o = et(
|
|
3465
|
+
i.filter(g).map((c) => c.id).filter((c) => typeof c == "string")
|
|
3458
3466
|
);
|
|
3459
3467
|
o && t.push(
|
|
3460
3468
|
d(
|
|
@@ -3463,7 +3471,7 @@ function es(e) {
|
|
|
3463
3471
|
"inputs"
|
|
3464
3472
|
)
|
|
3465
3473
|
);
|
|
3466
|
-
for (const [c, m] of
|
|
3474
|
+
for (const [c, m] of i.entries()) {
|
|
3467
3475
|
const u = `inputs.${c}`;
|
|
3468
3476
|
if (!g(m)) {
|
|
3469
3477
|
t.push(
|
|
@@ -3479,17 +3487,17 @@ function es(e) {
|
|
|
3479
3487
|
d("missing_input_field", "Input needs a field.", `${u}.field`)
|
|
3480
3488
|
) : I(m.field, `${u}.field`, t);
|
|
3481
3489
|
}
|
|
3482
|
-
const
|
|
3483
|
-
|
|
3490
|
+
const a = Array.isArray(e.sections) ? e.sections : [];
|
|
3491
|
+
a.length === 0 && t.push(
|
|
3484
3492
|
d(
|
|
3485
3493
|
"missing_sections",
|
|
3486
3494
|
"Dashboard intent needs at least one section.",
|
|
3487
3495
|
"sections"
|
|
3488
3496
|
)
|
|
3489
3497
|
);
|
|
3490
|
-
const r =
|
|
3498
|
+
const r = a.flatMap(
|
|
3491
3499
|
(c) => c && typeof c == "object" && Array.isArray(c.views) ? c.views.filter(g).map((m) => m.id).filter((m) => !!m) : []
|
|
3492
|
-
), l =
|
|
3500
|
+
), l = et(r);
|
|
3493
3501
|
l && t.push(
|
|
3494
3502
|
d(
|
|
3495
3503
|
"duplicate_view_id",
|
|
@@ -3497,7 +3505,7 @@ function es(e) {
|
|
|
3497
3505
|
"sections"
|
|
3498
3506
|
)
|
|
3499
3507
|
);
|
|
3500
|
-
for (const [c, m] of
|
|
3508
|
+
for (const [c, m] of a.entries()) {
|
|
3501
3509
|
const u = `sections.${c}`;
|
|
3502
3510
|
if (!m || typeof m != "object") {
|
|
3503
3511
|
t.push(
|
|
@@ -3530,138 +3538,139 @@ function es(e) {
|
|
|
3530
3538
|
f,
|
|
3531
3539
|
`${u}.views.${p}`,
|
|
3532
3540
|
t,
|
|
3533
|
-
|
|
3541
|
+
n
|
|
3534
3542
|
);
|
|
3535
3543
|
}
|
|
3536
|
-
return { ok: t.length === 0, errors: t, warnings:
|
|
3544
|
+
return { ok: t.length === 0, errors: t, warnings: n };
|
|
3537
3545
|
}
|
|
3538
3546
|
export {
|
|
3539
3547
|
Pt as $,
|
|
3540
3548
|
xt as A,
|
|
3541
|
-
|
|
3549
|
+
Zn as B,
|
|
3542
3550
|
ye as C,
|
|
3543
|
-
|
|
3551
|
+
ti as D,
|
|
3544
3552
|
T as E,
|
|
3545
|
-
|
|
3546
|
-
|
|
3553
|
+
$a as F,
|
|
3554
|
+
vi as G,
|
|
3547
3555
|
Ft as H,
|
|
3548
|
-
|
|
3549
|
-
|
|
3556
|
+
Si as I,
|
|
3557
|
+
wi as J,
|
|
3550
3558
|
Et as K,
|
|
3551
|
-
|
|
3559
|
+
Jn as L,
|
|
3552
3560
|
z as M,
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3561
|
+
ze as N,
|
|
3562
|
+
xi as O,
|
|
3563
|
+
je as P,
|
|
3564
|
+
Qe as Q,
|
|
3557
3565
|
se as R,
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3566
|
+
Ti as S,
|
|
3567
|
+
Ua as T,
|
|
3568
|
+
Ci as U,
|
|
3569
|
+
Ha as V,
|
|
3562
3570
|
$e as W,
|
|
3563
3571
|
Zt as X,
|
|
3564
3572
|
Jt as Y,
|
|
3565
|
-
|
|
3573
|
+
ie as Z,
|
|
3566
3574
|
ta as _,
|
|
3567
|
-
|
|
3568
|
-
|
|
3575
|
+
xa as a,
|
|
3576
|
+
Di as a$,
|
|
3569
3577
|
ra as a0,
|
|
3570
|
-
|
|
3571
|
-
|
|
3578
|
+
es as a1,
|
|
3579
|
+
ts as a2,
|
|
3572
3580
|
Ae as a3,
|
|
3573
3581
|
xe as a4,
|
|
3574
|
-
|
|
3575
|
-
|
|
3582
|
+
qn as a5,
|
|
3583
|
+
Bn as a6,
|
|
3576
3584
|
Fe as a7,
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3585
|
+
zn as a8,
|
|
3586
|
+
ga as a9,
|
|
3587
|
+
jt as aA,
|
|
3580
3588
|
Xa as aB,
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3589
|
+
Ka as aC,
|
|
3590
|
+
Ct as aD,
|
|
3591
|
+
Za as aE,
|
|
3592
|
+
ua as aF,
|
|
3593
|
+
dt as aG,
|
|
3594
|
+
pn as aH,
|
|
3595
|
+
cn as aI,
|
|
3596
|
+
ca as aJ,
|
|
3597
|
+
E as aK,
|
|
3598
|
+
gn as aL,
|
|
3599
|
+
an as aM,
|
|
3600
|
+
Q as aN,
|
|
3601
|
+
ma as aO,
|
|
3602
|
+
Se as aP,
|
|
3603
|
+
pa as aQ,
|
|
3604
|
+
fa as aR,
|
|
3605
|
+
pt as aS,
|
|
3606
|
+
ha as aT,
|
|
3607
|
+
vt as aU,
|
|
3608
|
+
Xn as aV,
|
|
3609
|
+
Kn as aW,
|
|
3602
3610
|
wa as aX,
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
+
ka as aY,
|
|
3612
|
+
U as aZ,
|
|
3613
|
+
ba as a_,
|
|
3614
|
+
Gn as aa,
|
|
3615
|
+
gt as ab,
|
|
3616
|
+
yt as ac,
|
|
3617
|
+
Ue as ad,
|
|
3618
|
+
bt as ae,
|
|
3611
3619
|
ya as af,
|
|
3612
|
-
|
|
3613
|
-
|
|
3620
|
+
_a as ag,
|
|
3621
|
+
ii as ah,
|
|
3614
3622
|
Ra as ai,
|
|
3615
3623
|
ja as aj,
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3624
|
+
Ca as ak,
|
|
3625
|
+
wt as al,
|
|
3626
|
+
Re as am,
|
|
3619
3627
|
Oa as an,
|
|
3620
3628
|
Ya as ao,
|
|
3621
|
-
|
|
3622
|
-
|
|
3629
|
+
La as ap,
|
|
3630
|
+
si as aq,
|
|
3623
3631
|
Pa as ar,
|
|
3624
3632
|
qa as as,
|
|
3625
3633
|
Ba as at,
|
|
3626
|
-
|
|
3634
|
+
Wa as au,
|
|
3627
3635
|
za as av,
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3636
|
+
Ga as aw,
|
|
3637
|
+
j as ax,
|
|
3638
|
+
Rt as ay,
|
|
3639
|
+
Ce as az,
|
|
3640
|
+
ni as b,
|
|
3641
|
+
ne as b0,
|
|
3642
|
+
mn as b1,
|
|
3643
|
+
Sa as b2,
|
|
3644
|
+
Ia as b3,
|
|
3645
|
+
Ai as b4,
|
|
3646
|
+
Va as b5,
|
|
3647
|
+
De as b6,
|
|
3648
|
+
Mn as b7,
|
|
3649
|
+
He as b8,
|
|
3650
|
+
va as b9,
|
|
3651
|
+
en as ba,
|
|
3643
3652
|
St as c,
|
|
3644
|
-
|
|
3645
|
-
|
|
3653
|
+
Ma as d,
|
|
3654
|
+
Na as e,
|
|
3646
3655
|
_e as f,
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3656
|
+
ei as g,
|
|
3657
|
+
Ta as h,
|
|
3658
|
+
Da as i,
|
|
3659
|
+
Be as j,
|
|
3660
|
+
dn as k,
|
|
3661
|
+
ot as l,
|
|
3653
3662
|
It as m,
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3663
|
+
Fa as n,
|
|
3664
|
+
Qa as o,
|
|
3665
|
+
Ja as p,
|
|
3666
|
+
Pi as q,
|
|
3658
3667
|
F as r,
|
|
3659
|
-
|
|
3668
|
+
Ea as s,
|
|
3660
3669
|
ve as t,
|
|
3661
3670
|
$t as u,
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3671
|
+
Aa as v,
|
|
3672
|
+
Te as w,
|
|
3673
|
+
gi as x,
|
|
3665
3674
|
Dt as y,
|
|
3666
3675
|
be as z
|
|
3667
3676
|
};
|