react-semaphor 0.1.497 → 0.1.499
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +22 -22
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/{calculated-field-identity-Cq9GwHfE.js → calculated-field-identity-BC2NViZZ.js} +75 -65
- package/dist/chunks/{calculated-field-identity-DTfyvvLC.cjs → calculated-field-identity-CtYhhZoG.cjs} +1 -1
- package/dist/chunks/{constants-CC3WKmqC.js → constants-CTRduy1g.js} +5 -5
- package/dist/chunks/{constants-DIuhVR6J.cjs → constants-DNgpRMaX.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-72HdqDbJ.js → dashboard-briefing-launcher-Bp6SBVb6.js} +9 -9
- package/dist/chunks/{dashboard-briefing-launcher-CZZuHl61.cjs → dashboard-briefing-launcher-Dtzn9Tqg.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-B7YP9m8Y.cjs → dashboard-controls-CLw5VQ2x.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-BwisKmY9.js → dashboard-controls-DDI3atQf.js} +11 -11
- package/dist/chunks/{dashboard-date-comparison-definition-Bqti6YAo.js → dashboard-date-comparison-definition-C1vJshiP.js} +6 -6
- package/dist/chunks/{dashboard-date-comparison-definition-C69F-zaC.cjs → dashboard-date-comparison-definition-CWz_Yte8.cjs} +1 -1
- package/dist/chunks/{dashboard-json-B6GTxo8h.cjs → dashboard-json-BnT6W7Lt.cjs} +1 -1
- package/dist/chunks/{dashboard-json-C5Cu7-zC.js → dashboard-json-rHLrTBbN.js} +7 -7
- package/dist/chunks/{edit-dashboard-visual-drzAIBe2.js → edit-dashboard-visual-BH2LkjHV.js} +7536 -7584
- package/dist/chunks/edit-dashboard-visual-DqAMe8XW.cjs +172 -0
- package/dist/chunks/{editor-action-buttons-Cm_fqm5R.cjs → editor-action-buttons-Boq8MLya.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-B8HjvmzM.js → editor-action-buttons-DUEK2-kM.js} +6 -6
- package/dist/chunks/{field-aggregations-naKZ7S2Q.cjs → field-aggregations-mlkON_QA.cjs} +1 -1
- package/dist/chunks/{field-aggregations-C8kZqMTD.js → field-aggregations-tLaXZ2VJ.js} +19 -19
- package/dist/chunks/field-dependencies-R7MrlW6D.cjs +1 -0
- package/dist/chunks/field-dependencies-ZE2klbHO.js +182 -0
- package/dist/chunks/{index-oll4m-qi.js → index-BVIet238.js} +11 -11
- package/dist/chunks/{index-CCa-A-Yx.cjs → index-Bh3SlWJS.cjs} +1 -1
- package/dist/chunks/{index-Cg8HZmMI.js → index-CEm8bwwd.js} +38146 -37887
- package/dist/chunks/index-Gos2ij10.cjs +1417 -0
- package/dist/chunks/{matrix-analytical-definition-B1xhoCak.js → matrix-analytical-definition-CIVFNNnF.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-BK5y9XHH.cjs → matrix-analytical-definition-wIEDXvV5.cjs} +1 -1
- package/dist/chunks/{matrix-card-BEb6hr8i.js → matrix-card-BVvKHL7s.js} +2 -2
- package/dist/chunks/{matrix-card-Ii8yYSnw.cjs → matrix-card-Dh0J0_Of.cjs} +1 -1
- package/dist/chunks/matrix-control-sources-CjnsBREg.js +605 -0
- package/dist/chunks/matrix-control-sources-a67fwoOO.cjs +1 -0
- package/dist/chunks/{matrix-definition-CZM5-YJX.js → matrix-definition-BEXCfZAe.js} +3 -3
- package/dist/chunks/{matrix-definition-CSNthxru.cjs → matrix-definition-CKVi4VVg.cjs} +1 -1
- package/dist/chunks/{matrix-formatter-CiXzpX6X.js → matrix-formatter-BTPfthsa.js} +33 -33
- package/dist/chunks/{matrix-formatter-C19PZAal.cjs → matrix-formatter-CWtdnbfv.cjs} +1 -1
- package/dist/chunks/{matrix-member-presentation-CabW8mJc.js → matrix-member-presentation-DiDUvZts.js} +1 -1
- package/dist/chunks/{matrix-member-presentation-CQHvq18l.cjs → matrix-member-presentation-e_KZoZOx.cjs} +1 -1
- package/dist/chunks/{matrix-operation-contract-0Nor-C71.js → matrix-operation-contract-CPgckXxm.js} +164 -164
- package/dist/chunks/{matrix-operation-contract-o9GXbiHw.cjs → matrix-operation-contract-thtFuUYf.cjs} +1 -1
- package/dist/chunks/{metric-comparison-DeiOjEm5.cjs → metric-comparison-CAqV6VnZ.cjs} +1 -1
- package/dist/chunks/{metric-comparison-Br8l0WkK.js → metric-comparison-Dgyq1I3d.js} +1 -1
- package/dist/chunks/{pivot-header-presentation-DRv-cSIP.cjs → pivot-header-presentation-DUXM-VOP.cjs} +1 -1
- package/dist/chunks/{pivot-header-presentation-DW-ti5ek.js → pivot-header-presentation-DcCO8-Ij.js} +3 -3
- package/dist/chunks/{pivot-result-identity-sZc1RaIz.js → pivot-result-identity-Be1zm0AV.js} +1 -1
- package/dist/chunks/{pivot-result-identity-DEenUrMj.cjs → pivot-result-identity-DJyF4I2K.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DJ40gdwk.js → pivot-result-lifecycle-DpSZOMOZ.js} +7 -7
- package/dist/chunks/{pivot-result-lifecycle-D81qcCcZ.cjs → pivot-result-lifecycle-E_huAPev.cjs} +1 -1
- package/dist/chunks/{raw-temporal-DDTt2yv5.cjs → raw-temporal-DYoPBY6B.cjs} +1 -1
- package/dist/chunks/{raw-temporal-DHCZrFe7.js → raw-temporal-DfnRBxQn.js} +2 -2
- package/dist/chunks/{raw-temporal-contract-CkvdtPYA.js → raw-temporal-contract-CNwYygW2.js} +1 -1
- package/dist/chunks/{raw-temporal-contract-BcbV56Rc.cjs → raw-temporal-contract-D1_n2pBj.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-KI7AgU11.js → report-preferences-dialog-8nfXNWvl.js} +6 -6
- package/dist/chunks/{report-preferences-dialog-BOGeoFLL.cjs → report-preferences-dialog-CW59SyVZ.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-lSIvyKm2.cjs → report-runtime-context-CqFbgZq9.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-BlDpc-F-.js → report-runtime-context-Dln1qvGS.js} +5 -5
- package/dist/chunks/{semantic-format--_VEin18.cjs → semantic-format-C7Goni6h.cjs} +1 -1
- package/dist/chunks/{semantic-format-ew5zviaT.js → semantic-format-PKQt2EAz.js} +2 -2
- package/dist/chunks/{source-entity-resolution-DPjslVgx.cjs → source-entity-resolution-BMKxwdKN.cjs} +1 -1
- package/dist/chunks/{source-entity-resolution-79Rihbk3.js → source-entity-resolution-BSZ07Sl6.js} +18 -18
- package/dist/chunks/{switch-DlLDM7Pu.js → switch-B4wVqV4L.js} +1292 -1280
- package/dist/chunks/{switch-wR8lV0zN.cjs → switch-DVjKkt22.cjs} +24 -24
- package/dist/chunks/{temporal-bucket-contract-BYR6tj6F.cjs → temporal-bucket-contract-CSdspcYj.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-contract-C-kKQ_W4.js → temporal-bucket-contract-_WCvDnvn.js} +1 -1
- package/dist/chunks/{update-policy-BCtFr2Qh.cjs → update-policy-BESKAspa.cjs} +1 -1
- package/dist/chunks/{update-policy-CP_A1IVD.js → update-policy-BWbXhkk-.js} +2 -2
- package/dist/chunks/{validators-D-_IT-Xw.js → validators-CHlnnHuS.js} +1105 -1041
- package/dist/chunks/validators-D2F_uxxP.cjs +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +112 -107
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +1 -1
- package/dist/data-app-codegen-node/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +232 -232
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +5 -5
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +16 -16
- package/dist/index.cjs +1 -1
- package/dist/index.js +97 -93
- package/dist/report-runtime-context/index.cjs +1 -1
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +15 -0
- package/dist/types/briefings.d.ts +16 -1
- package/dist/types/dashboard-assistant.d.ts +15 -0
- package/dist/types/dashboard-authoring.d.ts +49 -1
- package/dist/types/dashboard.d.ts +23 -1
- package/dist/types/data-app-builder.d.ts +15 -0
- package/dist/types/data-app-codegen-node.d.ts +15 -0
- package/dist/types/data-app-codegen.d.ts +15 -0
- package/dist/types/data-app-sdk-adapters.d.ts +15 -0
- package/dist/types/data-app-sdk-validation.d.ts +15 -0
- package/dist/types/data-app-sdk.d.ts +15 -0
- package/dist/types/format-utils.d.ts +15 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +34 -21
- package/dist/types/main.d.ts +74 -6
- package/dist/types/shared.d.ts +16 -1
- package/dist/types/surfboard.d.ts +23 -1
- package/dist/types/types.d.ts +172 -6
- package/package.json +1 -1
- package/dist/chunks/edit-dashboard-visual-DqBcJ1bo.cjs +0 -172
- package/dist/chunks/index-B8-qrqSa.cjs +0 -1417
- package/dist/chunks/matrix-control-sources-CdegRBcA.cjs +0 -1
- package/dist/chunks/matrix-control-sources-cbYmqWNg.js +0 -523
- package/dist/chunks/token-types-BIYFAsGq.js +0 -8
- package/dist/chunks/token-types-CkAGFhiW.cjs +0 -1
- package/dist/chunks/validators-ux2obZB9.cjs +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { z as i } from "zod";
|
|
2
|
-
const
|
|
2
|
+
const Ot = [
|
|
3
3
|
"missing_dependency",
|
|
4
4
|
"missing_relationship",
|
|
5
5
|
"population_required",
|
|
6
6
|
"ambiguous_relationship"
|
|
7
7
|
];
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function ea(e) {
|
|
9
|
+
return Ot.includes(
|
|
10
10
|
e
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const De = 200, z = [
|
|
14
14
|
"second",
|
|
15
15
|
"minute",
|
|
16
16
|
"hour",
|
|
@@ -20,44 +20,44 @@ const Re = 200, G = [
|
|
|
20
20
|
"quarter",
|
|
21
21
|
"year"
|
|
22
22
|
];
|
|
23
|
-
function
|
|
24
|
-
return typeof e == "string" &&
|
|
23
|
+
function ta(e) {
|
|
24
|
+
return typeof e == "string" && z.includes(e);
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const Yt = [
|
|
27
27
|
"week_of_short",
|
|
28
28
|
"week_of_long",
|
|
29
29
|
"quarter_short",
|
|
30
30
|
"quarter_long",
|
|
31
31
|
"fiscal_quarter_short",
|
|
32
32
|
"fiscal_year"
|
|
33
|
-
],
|
|
33
|
+
], ia = {
|
|
34
34
|
invalidMetadata: "invalid_raw_temporal_metadata"
|
|
35
35
|
};
|
|
36
|
-
function
|
|
36
|
+
function Pt(e) {
|
|
37
37
|
return e === "second" || e === "minute" || e === "hour" ? "datetime" : "date";
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const na = {
|
|
40
40
|
missingMetadata: "missing_temporal_bucket_metadata",
|
|
41
41
|
invalidMetadata: "invalid_temporal_bucket_metadata",
|
|
42
42
|
invalidValue: "invalid_temporal_bucket_value"
|
|
43
|
-
},
|
|
44
|
-
function
|
|
43
|
+
}, aa = "__auto_count__";
|
|
44
|
+
function Bt(e) {
|
|
45
45
|
return typeof e == "string" || typeof e == "number" && Number.isFinite(e) || typeof e == "boolean";
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return !Array.isArray(e) || e.length === 0 || e.length >
|
|
47
|
+
function qt(e) {
|
|
48
|
+
return !Array.isArray(e) || e.length === 0 || e.length > De || !e.every(Bt) ? {
|
|
49
49
|
ok: !1,
|
|
50
|
-
error: `matchValues must be 1 to ${
|
|
50
|
+
error: `matchValues must be 1 to ${De} string, number or boolean values.`
|
|
51
51
|
} : { ok: !0, values: e };
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Lt(e) {
|
|
54
54
|
try {
|
|
55
55
|
return new Intl.DateTimeFormat("en-US", { timeZone: e }).format(), !0;
|
|
56
56
|
} catch {
|
|
57
57
|
return !1;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const Ut = i.record(i.string(), i.unknown()), O = i.array(Ut), R = i.enum([
|
|
61
61
|
"SUM",
|
|
62
62
|
"COUNT",
|
|
63
63
|
"AVG",
|
|
@@ -65,7 +65,7 @@ const Bt = i.record(i.string(), i.unknown()), O = i.array(Bt), F = i.enum([
|
|
|
65
65
|
"MAX",
|
|
66
66
|
"MEDIAN",
|
|
67
67
|
"DISTINCT"
|
|
68
|
-
]),
|
|
68
|
+
]), K = i.enum([
|
|
69
69
|
"postgres",
|
|
70
70
|
"mysql",
|
|
71
71
|
"mssql",
|
|
@@ -76,40 +76,40 @@ const Bt = i.record(i.string(), i.unknown()), O = i.array(Bt), F = i.enum([
|
|
|
76
76
|
"duckdb",
|
|
77
77
|
"sqlite",
|
|
78
78
|
"unknown"
|
|
79
|
-
]),
|
|
79
|
+
]), U = i.enum(z), Q = i.enum([
|
|
80
80
|
"dimension",
|
|
81
81
|
"measure",
|
|
82
82
|
"date",
|
|
83
83
|
"id",
|
|
84
84
|
"unknown"
|
|
85
|
-
]),
|
|
85
|
+
]), W = i.enum([
|
|
86
86
|
"string",
|
|
87
87
|
"number",
|
|
88
88
|
"boolean",
|
|
89
89
|
"date",
|
|
90
90
|
"datetime",
|
|
91
91
|
"unknown"
|
|
92
|
-
]),
|
|
92
|
+
]), te = i.union([i.number(), i.string(), i.null()]), ie = i.enum([
|
|
93
93
|
"millisecond",
|
|
94
94
|
"second",
|
|
95
95
|
"minute",
|
|
96
96
|
"hour",
|
|
97
97
|
"day"
|
|
98
|
-
]),
|
|
98
|
+
]), Vt = i.enum(Yt), Ht = i.discriminatedUnion("mode", [
|
|
99
99
|
i.object({ mode: i.literal("auto") }).strict(),
|
|
100
100
|
i.object({
|
|
101
101
|
mode: i.literal("preset"),
|
|
102
|
-
preset:
|
|
102
|
+
preset: Vt
|
|
103
103
|
}).strict(),
|
|
104
104
|
i.object({
|
|
105
105
|
mode: i.literal("pattern"),
|
|
106
106
|
pattern: i.string().min(1)
|
|
107
107
|
}).strict()
|
|
108
|
-
]),
|
|
108
|
+
]), X = i.object({
|
|
109
109
|
type: i.literal("temporal_bucket"),
|
|
110
|
-
presentation:
|
|
111
|
-
}).strict(),
|
|
112
|
-
tz: i.string().min(1).refine(
|
|
110
|
+
presentation: Ht
|
|
111
|
+
}).strict(), Gt = i.object({
|
|
112
|
+
tz: i.string().min(1).refine(Lt, {
|
|
113
113
|
message: "tz must be a valid IANA timezone"
|
|
114
114
|
}),
|
|
115
115
|
weekStart: i.number().int().min(0).max(6),
|
|
@@ -117,14 +117,14 @@ const Bt = i.record(i.string(), i.unknown()), O = i.array(Bt), F = i.enum([
|
|
|
117
117
|
kind: i.literal("month_aligned"),
|
|
118
118
|
yearStartMonth: i.number().int().min(1).max(12)
|
|
119
119
|
}).strict().optional()
|
|
120
|
-
}).strict(),
|
|
120
|
+
}).strict(), re = i.object({
|
|
121
121
|
kind: i.literal("temporal_bucket"),
|
|
122
|
-
granularity:
|
|
123
|
-
calendar:
|
|
124
|
-
}).strict(),
|
|
122
|
+
granularity: U,
|
|
123
|
+
calendar: Gt
|
|
124
|
+
}).strict(), zt = i.object({
|
|
125
125
|
kind: i.literal("raw_temporal"),
|
|
126
126
|
valueKind: i.enum(["date", "wall_datetime", "instant"])
|
|
127
|
-
}).strict(),
|
|
127
|
+
}).strict(), he = i.union([
|
|
128
128
|
i.object({
|
|
129
129
|
type: i.enum([
|
|
130
130
|
"number",
|
|
@@ -163,10 +163,10 @@ const Bt = i.record(i.string(), i.unknown()), O = i.array(Bt), F = i.enum([
|
|
|
163
163
|
}).passthrough(),
|
|
164
164
|
i.object({
|
|
165
165
|
type: i.literal("duration"),
|
|
166
|
-
inputUnit:
|
|
166
|
+
inputUnit: ie.optional(),
|
|
167
167
|
outputStyle: i.enum(["compact", "digital", "long"]).optional(),
|
|
168
|
-
largestUnit:
|
|
169
|
-
smallestUnit:
|
|
168
|
+
largestUnit: ie.optional(),
|
|
169
|
+
smallestUnit: ie.optional(),
|
|
170
170
|
maxUnits: i.number().optional(),
|
|
171
171
|
prefix: i.string().optional(),
|
|
172
172
|
suffix: i.string().optional(),
|
|
@@ -178,7 +178,7 @@ const Bt = i.record(i.string(), i.unknown()), O = i.array(Bt), F = i.enum([
|
|
|
178
178
|
suffix: i.string().optional()
|
|
179
179
|
}).passthrough()
|
|
180
180
|
]);
|
|
181
|
-
function
|
|
181
|
+
function Kt(e, t) {
|
|
182
182
|
return i.object(e).passthrough().superRefine((n, o) => {
|
|
183
183
|
for (const a of t)
|
|
184
184
|
Object.prototype.hasOwnProperty.call(n, a) || o.addIssue({
|
|
@@ -188,14 +188,14 @@ function Ht(e, t) {
|
|
|
188
188
|
});
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
const
|
|
191
|
+
const _e = i.object({
|
|
192
192
|
kind: i.literal("semantic"),
|
|
193
193
|
domainId: i.string(),
|
|
194
194
|
datasetName: i.string(),
|
|
195
195
|
datasetId: i.string().optional(),
|
|
196
196
|
label: i.string().optional(),
|
|
197
197
|
connectionId: i.string().optional()
|
|
198
|
-
}).passthrough(),
|
|
198
|
+
}).passthrough(), Qe = i.object({
|
|
199
199
|
kind: i.literal("physical"),
|
|
200
200
|
connectionId: i.string(),
|
|
201
201
|
connectionType: i.string().optional(),
|
|
@@ -203,39 +203,39 @@ const ge = i.object({
|
|
|
203
203
|
databaseName: i.string().optional(),
|
|
204
204
|
schemaName: i.string().optional(),
|
|
205
205
|
label: i.string().optional(),
|
|
206
|
-
dialect:
|
|
207
|
-
}).passthrough(),
|
|
206
|
+
dialect: K.optional()
|
|
207
|
+
}).passthrough(), Qt = i.object({
|
|
208
208
|
kind: i.literal("sql"),
|
|
209
209
|
connectionId: i.string(),
|
|
210
|
-
dialect:
|
|
210
|
+
dialect: K.optional(),
|
|
211
211
|
label: i.string().optional()
|
|
212
|
-
}).passthrough(),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
]),
|
|
212
|
+
}).passthrough(), We = i.union([
|
|
213
|
+
_e,
|
|
214
|
+
Qe,
|
|
215
|
+
Qt
|
|
216
|
+
]), Xe = i.object({
|
|
217
217
|
name: i.string(),
|
|
218
218
|
label: i.string().optional(),
|
|
219
|
-
role:
|
|
220
|
-
dataType:
|
|
221
|
-
source:
|
|
222
|
-
aggregate:
|
|
223
|
-
}).passthrough(),
|
|
219
|
+
role: Q.optional(),
|
|
220
|
+
dataType: W.optional(),
|
|
221
|
+
source: We.optional(),
|
|
222
|
+
aggregate: R.optional()
|
|
223
|
+
}).passthrough(), Ze = Xe, Wt = i.object({
|
|
224
224
|
kind: i.literal("field"),
|
|
225
|
-
field:
|
|
226
|
-
aggregate:
|
|
227
|
-
}).passthrough(),
|
|
225
|
+
field: Ze,
|
|
226
|
+
aggregate: R.optional()
|
|
227
|
+
}).passthrough(), Je = i.object({
|
|
228
228
|
kind: i.literal("derived_field"),
|
|
229
229
|
name: i.string(),
|
|
230
230
|
label: i.string(),
|
|
231
231
|
description: i.string().optional(),
|
|
232
|
-
resultRole:
|
|
233
|
-
dataType:
|
|
232
|
+
resultRole: Q,
|
|
233
|
+
dataType: W,
|
|
234
234
|
computeStage: i.enum(["row", "aggregate"]),
|
|
235
235
|
expression: i.string(),
|
|
236
236
|
expressionLanguage: i.literal("semaphor_sql_template").optional(),
|
|
237
|
-
inputs: i.record(
|
|
238
|
-
defaultAggregate:
|
|
237
|
+
inputs: i.record(Wt),
|
|
238
|
+
defaultAggregate: R.optional(),
|
|
239
239
|
aggregationBehavior: i.enum([
|
|
240
240
|
"additive",
|
|
241
241
|
"non_additive",
|
|
@@ -250,13 +250,13 @@ const ge = i.object({
|
|
|
250
250
|
"aggregate_then_join",
|
|
251
251
|
"weighted"
|
|
252
252
|
]).optional(),
|
|
253
|
-
format:
|
|
253
|
+
format: he.optional(),
|
|
254
254
|
tags: i.array(i.string()).optional()
|
|
255
|
-
}).passthrough(),
|
|
255
|
+
}).passthrough(), et = Je, oa = Ze.and(
|
|
256
256
|
i.object({
|
|
257
|
-
derivedField:
|
|
257
|
+
derivedField: et.optional()
|
|
258
258
|
}).passthrough()
|
|
259
|
-
),
|
|
259
|
+
), Xt = _e, Zt = i.object({
|
|
260
260
|
kind: i.literal("physical"),
|
|
261
261
|
connectionId: i.string().optional(),
|
|
262
262
|
connectionType: i.string().optional(),
|
|
@@ -264,36 +264,36 @@ const ge = i.object({
|
|
|
264
264
|
databaseName: i.string().optional(),
|
|
265
265
|
schemaName: i.string().optional(),
|
|
266
266
|
label: i.string().optional(),
|
|
267
|
-
dialect:
|
|
268
|
-
}).passthrough(),
|
|
267
|
+
dialect: K.optional()
|
|
268
|
+
}).passthrough(), Jt = i.object({
|
|
269
269
|
kind: i.literal("sql"),
|
|
270
270
|
connectionId: i.string().optional(),
|
|
271
|
-
dialect:
|
|
271
|
+
dialect: K.optional(),
|
|
272
272
|
label: i.string().optional()
|
|
273
|
-
}).passthrough(),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
]),
|
|
273
|
+
}).passthrough(), ei = i.union([
|
|
274
|
+
Xt,
|
|
275
|
+
Zt,
|
|
276
|
+
Jt
|
|
277
|
+
]), sa = i.object({
|
|
278
278
|
key: i.string().optional(),
|
|
279
279
|
name: i.string(),
|
|
280
280
|
label: i.string().optional(),
|
|
281
|
-
role:
|
|
282
|
-
dataType:
|
|
283
|
-
source:
|
|
284
|
-
aggregate:
|
|
281
|
+
role: Q.optional(),
|
|
282
|
+
dataType: W.optional(),
|
|
283
|
+
source: ei.optional(),
|
|
284
|
+
aggregate: R.optional(),
|
|
285
285
|
derivedField: i.never().optional()
|
|
286
286
|
}).passthrough(), j = i.object({
|
|
287
287
|
key: i.string(),
|
|
288
288
|
name: i.string(),
|
|
289
289
|
label: i.string(),
|
|
290
|
-
role:
|
|
291
|
-
dataType:
|
|
292
|
-
aggregate:
|
|
293
|
-
source:
|
|
294
|
-
derivedField:
|
|
295
|
-
temporalBucket:
|
|
296
|
-
rawTemporal:
|
|
290
|
+
role: Q.optional(),
|
|
291
|
+
dataType: W.optional(),
|
|
292
|
+
aggregate: R.optional(),
|
|
293
|
+
source: We.optional(),
|
|
294
|
+
derivedField: et.optional(),
|
|
295
|
+
temporalBucket: re.optional(),
|
|
296
|
+
rawTemporal: zt.optional(),
|
|
297
297
|
pivotIdentity: i.object({
|
|
298
298
|
metricId: i.string().min(1),
|
|
299
299
|
metricAlias: i.string().min(1),
|
|
@@ -301,7 +301,7 @@ const ge = i.object({
|
|
|
301
301
|
i.object({
|
|
302
302
|
fieldId: i.string().min(1),
|
|
303
303
|
value: i.string().nullable(),
|
|
304
|
-
temporalBucket:
|
|
304
|
+
temporalBucket: re.optional()
|
|
305
305
|
}).strict()
|
|
306
306
|
)
|
|
307
307
|
}).strict().optional()
|
|
@@ -311,7 +311,7 @@ const ge = i.object({
|
|
|
311
311
|
path: ["rawTemporal"],
|
|
312
312
|
message: "A result column cannot carry both temporalBucket and rawTemporal metadata."
|
|
313
313
|
}), e.temporalBucket) {
|
|
314
|
-
const n =
|
|
314
|
+
const n = Pt(
|
|
315
315
|
e.temporalBucket.granularity
|
|
316
316
|
);
|
|
317
317
|
e.dataType !== n && t.addIssue({
|
|
@@ -328,13 +328,13 @@ const ge = i.object({
|
|
|
328
328
|
message: `${e.rawTemporal.valueKind} raw temporal values require dataType ${n}.`
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
}),
|
|
331
|
+
}), ra = i.object({
|
|
332
332
|
records: O,
|
|
333
333
|
columns: i.array(j).optional()
|
|
334
|
-
}).passthrough(),
|
|
334
|
+
}).passthrough(), la = i.object({
|
|
335
335
|
records: O,
|
|
336
336
|
columns: i.array(j)
|
|
337
|
-
}).passthrough(),
|
|
337
|
+
}).passthrough(), tt = i.object({
|
|
338
338
|
code: i.string(),
|
|
339
339
|
message: i.string().optional(),
|
|
340
340
|
invalidField: i.string().optional(),
|
|
@@ -343,47 +343,47 @@ const ge = i.object({
|
|
|
343
343
|
validDateCandidates: i.array(i.string()).optional(),
|
|
344
344
|
validDimensionCandidates: i.array(i.string()).optional(),
|
|
345
345
|
recommendedNextStep: i.string()
|
|
346
|
-
}).passthrough(),
|
|
346
|
+
}).passthrough(), Ne = i.object({
|
|
347
347
|
code: i.string(),
|
|
348
348
|
message: i.string(),
|
|
349
349
|
path: i.string().optional(),
|
|
350
350
|
fieldRole: i.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
|
|
351
|
-
repairHint:
|
|
352
|
-
}).passthrough(),
|
|
351
|
+
repairHint: tt.optional()
|
|
352
|
+
}).passthrough(), da = i.object({
|
|
353
353
|
ok: i.boolean(),
|
|
354
|
-
errors: i.array(
|
|
355
|
-
warnings: i.array(
|
|
356
|
-
repairHints: i.array(
|
|
357
|
-
}).passthrough(),
|
|
354
|
+
errors: i.array(Ne),
|
|
355
|
+
warnings: i.array(Ne),
|
|
356
|
+
repairHints: i.array(tt)
|
|
357
|
+
}).passthrough(), ti = i.object({
|
|
358
358
|
page: i.number(),
|
|
359
359
|
pageSize: i.number(),
|
|
360
360
|
pageCount: i.number(),
|
|
361
361
|
totalCount: i.number(),
|
|
362
362
|
hasNextPage: i.boolean(),
|
|
363
363
|
hasPrevPage: i.boolean()
|
|
364
|
-
}).passthrough(),
|
|
364
|
+
}).passthrough(), Z = {
|
|
365
365
|
intentId: i.string().optional(),
|
|
366
366
|
queryPath: i.enum(["query_spec", "sql", "sql_python"]),
|
|
367
367
|
warnings: i.array(i.string()).optional(),
|
|
368
368
|
rowCount: i.number().optional(),
|
|
369
369
|
rowLimitExceeded: i.boolean().optional(),
|
|
370
370
|
limit: i.number().optional(),
|
|
371
|
-
pagination:
|
|
372
|
-
},
|
|
373
|
-
...
|
|
371
|
+
pagination: ti.optional()
|
|
372
|
+
}, ua = i.object({
|
|
373
|
+
...Z,
|
|
374
374
|
kind: i.literal("metric"),
|
|
375
|
-
primaryValue:
|
|
376
|
-
measures: i.record(
|
|
375
|
+
primaryValue: te,
|
|
376
|
+
measures: i.record(te).optional(),
|
|
377
377
|
missingMeasures: i.array(i.string()).optional(),
|
|
378
378
|
comparison: i.object({
|
|
379
379
|
kind: i.enum(["previous_period", "previous_year", "target"]),
|
|
380
|
-
value:
|
|
380
|
+
value: te.optional(),
|
|
381
381
|
delta: i.union([i.number(), i.null()]).optional(),
|
|
382
382
|
deltaPercent: i.union([i.number(), i.null()]).optional()
|
|
383
383
|
}).passthrough().optional(),
|
|
384
384
|
records: O.optional()
|
|
385
|
-
}).passthrough(),
|
|
386
|
-
...
|
|
385
|
+
}).passthrough(), ca = i.object({
|
|
386
|
+
...Z,
|
|
387
387
|
kind: i.literal("records"),
|
|
388
388
|
columns: i.array(j),
|
|
389
389
|
records: O,
|
|
@@ -393,7 +393,7 @@ const ge = i.object({
|
|
|
393
393
|
row: i.record(i.string(), i.unknown()),
|
|
394
394
|
columns: i.array(j).optional()
|
|
395
395
|
}).passthrough().optional()
|
|
396
|
-
}).passthrough(),
|
|
396
|
+
}).passthrough(), ii = i.object({
|
|
397
397
|
inputId: i.string().min(1),
|
|
398
398
|
status: i.enum(["applied", "inactive", "skipped", "overridden", "error"]),
|
|
399
399
|
reason: i.enum([
|
|
@@ -406,16 +406,16 @@ const ge = i.object({
|
|
|
406
406
|
"unsupported_dependency",
|
|
407
407
|
"override_not_eligible"
|
|
408
408
|
]).optional()
|
|
409
|
-
}),
|
|
409
|
+
}), ni = i.object({
|
|
410
410
|
complete: i.boolean(),
|
|
411
411
|
reason: i.enum(["unsupported", "truncated"]).optional()
|
|
412
|
-
}),
|
|
413
|
-
...
|
|
412
|
+
}), pa = i.object({
|
|
413
|
+
...Z,
|
|
414
414
|
kind: i.literal("inputOptions"),
|
|
415
|
-
dependencyOutcomes: i.array(
|
|
416
|
-
match:
|
|
415
|
+
dependencyOutcomes: i.array(ii).optional(),
|
|
416
|
+
match: ni.optional(),
|
|
417
417
|
options: i.array(
|
|
418
|
-
|
|
418
|
+
Kt(
|
|
419
419
|
{
|
|
420
420
|
label: i.string(),
|
|
421
421
|
value: i.unknown(),
|
|
@@ -425,8 +425,8 @@ const ge = i.object({
|
|
|
425
425
|
["value"]
|
|
426
426
|
)
|
|
427
427
|
)
|
|
428
|
-
}).passthrough(),
|
|
429
|
-
...
|
|
428
|
+
}).passthrough(), ma = i.object({
|
|
429
|
+
...Z,
|
|
430
430
|
kind: i.literal("sql"),
|
|
431
431
|
columns: i.array(j),
|
|
432
432
|
records: O,
|
|
@@ -436,25 +436,25 @@ const ge = i.object({
|
|
|
436
436
|
hasPythonCode: i.boolean().optional()
|
|
437
437
|
}).passthrough().optional()
|
|
438
438
|
}).passthrough();
|
|
439
|
-
function
|
|
439
|
+
function r(e, t, n) {
|
|
440
440
|
return n ? { code: e, message: t, path: n } : { code: e, message: t };
|
|
441
441
|
}
|
|
442
442
|
function p(e) {
|
|
443
443
|
return typeof e == "string" && e.trim().length > 0;
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function ai(e) {
|
|
446
446
|
const t = /* @__PURE__ */ new Set();
|
|
447
|
-
return
|
|
447
|
+
return oi(e, (n) => (t.add(n), `{${n}}`)), Array.from(t);
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function oi(e, t) {
|
|
450
450
|
let n = "", o = 0, a = 0;
|
|
451
451
|
for (; a < e.length; ) {
|
|
452
|
-
const
|
|
453
|
-
if (
|
|
454
|
-
a =
|
|
452
|
+
const s = e[a];
|
|
453
|
+
if (s === "'" || s === '"') {
|
|
454
|
+
a = si(e, a);
|
|
455
455
|
continue;
|
|
456
456
|
}
|
|
457
|
-
if (
|
|
457
|
+
if (s === "{") {
|
|
458
458
|
const l = e.indexOf("}", a + 1);
|
|
459
459
|
if (l === -1) {
|
|
460
460
|
a += 1;
|
|
@@ -468,7 +468,7 @@ function ii(e, t) {
|
|
|
468
468
|
}
|
|
469
469
|
return n + e.slice(o);
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function si(e, t) {
|
|
472
472
|
const n = e[t];
|
|
473
473
|
let o = t + 1;
|
|
474
474
|
for (; o < e.length; ) {
|
|
@@ -486,7 +486,7 @@ function ni(e, t) {
|
|
|
486
486
|
function f(e) {
|
|
487
487
|
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
488
488
|
}
|
|
489
|
-
const
|
|
489
|
+
const ri = /* @__PURE__ */ new Set([
|
|
490
490
|
"SUM",
|
|
491
491
|
"COUNT",
|
|
492
492
|
"AVG",
|
|
@@ -495,22 +495,22 @@ const ai = /* @__PURE__ */ new Set([
|
|
|
495
495
|
"MEDIAN",
|
|
496
496
|
"DISTINCT"
|
|
497
497
|
]);
|
|
498
|
-
function
|
|
498
|
+
function be(e, t, n) {
|
|
499
499
|
if (!e || typeof e != "object") {
|
|
500
500
|
n.push(
|
|
501
|
-
|
|
501
|
+
r("missing_source", "Analytics intent needs a source.", t)
|
|
502
502
|
);
|
|
503
503
|
return;
|
|
504
504
|
}
|
|
505
505
|
if (e.kind === "semantic") {
|
|
506
506
|
p(e.domainId) || n.push(
|
|
507
|
-
|
|
507
|
+
r(
|
|
508
508
|
"missing_semantic_domain",
|
|
509
509
|
"Semantic source needs a domainId.",
|
|
510
510
|
`${t}.domainId`
|
|
511
511
|
)
|
|
512
512
|
), p(e.datasetName) || n.push(
|
|
513
|
-
|
|
513
|
+
r(
|
|
514
514
|
"missing_dataset_name",
|
|
515
515
|
"Semantic source needs a datasetName.",
|
|
516
516
|
`${t}.datasetName`
|
|
@@ -520,13 +520,13 @@ function he(e, t, n) {
|
|
|
520
520
|
}
|
|
521
521
|
if (e.kind === "physical") {
|
|
522
522
|
p(e.connectionId) || n.push(
|
|
523
|
-
|
|
523
|
+
r(
|
|
524
524
|
"missing_connection_id",
|
|
525
525
|
"Physical source needs a connectionId.",
|
|
526
526
|
`${t}.connectionId`
|
|
527
527
|
)
|
|
528
528
|
), p(e.tableName) || n.push(
|
|
529
|
-
|
|
529
|
+
r(
|
|
530
530
|
"missing_table_name",
|
|
531
531
|
"Physical source needs a tableName.",
|
|
532
532
|
`${t}.tableName`
|
|
@@ -536,7 +536,7 @@ function he(e, t, n) {
|
|
|
536
536
|
}
|
|
537
537
|
if (e.kind === "sql") {
|
|
538
538
|
p(e.connectionId) || n.push(
|
|
539
|
-
|
|
539
|
+
r(
|
|
540
540
|
"missing_connection_id",
|
|
541
541
|
"SQL source needs a connectionId.",
|
|
542
542
|
`${t}.connectionId`
|
|
@@ -545,47 +545,47 @@ function he(e, t, n) {
|
|
|
545
545
|
return;
|
|
546
546
|
}
|
|
547
547
|
n.push(
|
|
548
|
-
|
|
548
|
+
r("invalid_source_kind", "Source kind is not supported.", t)
|
|
549
549
|
);
|
|
550
550
|
}
|
|
551
551
|
function b(e, t, n, o = {}) {
|
|
552
552
|
if (!e || !f(e)) {
|
|
553
553
|
o.required && n.push(
|
|
554
|
-
|
|
554
|
+
r("missing_field_ref", "Field reference needs a name.", t)
|
|
555
555
|
);
|
|
556
556
|
return;
|
|
557
557
|
}
|
|
558
558
|
p(e.name) || n.push(
|
|
559
|
-
|
|
559
|
+
r(
|
|
560
560
|
"missing_field_ref",
|
|
561
561
|
"Field reference needs a name.",
|
|
562
562
|
`${t}.name`
|
|
563
563
|
)
|
|
564
|
-
), e.source !== void 0 &&
|
|
564
|
+
), e.source !== void 0 && be(e.source, `${t}.source`, n), ye(e.aggregate, `${t}.aggregate`, n);
|
|
565
565
|
}
|
|
566
|
-
function
|
|
567
|
-
e !== void 0 && (typeof e != "string" || !
|
|
568
|
-
|
|
566
|
+
function ye(e, t, n) {
|
|
567
|
+
e !== void 0 && (typeof e != "string" || !ri.has(e)) && n.push(
|
|
568
|
+
r(
|
|
569
569
|
"invalid_aggregate",
|
|
570
570
|
"Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
|
|
571
571
|
t
|
|
572
572
|
)
|
|
573
573
|
);
|
|
574
574
|
}
|
|
575
|
-
const
|
|
575
|
+
const li = /* @__PURE__ */ new Set([
|
|
576
576
|
"measure",
|
|
577
577
|
"dimension",
|
|
578
578
|
"date",
|
|
579
579
|
"id",
|
|
580
580
|
"unknown"
|
|
581
|
-
]),
|
|
581
|
+
]), di = /* @__PURE__ */ new Set(["row", "aggregate"]), it = /* @__PURE__ */ new Set([
|
|
582
582
|
"string",
|
|
583
583
|
"number",
|
|
584
584
|
"boolean",
|
|
585
585
|
"date",
|
|
586
586
|
"datetime",
|
|
587
587
|
"unknown"
|
|
588
|
-
]),
|
|
588
|
+
]), ui = /* @__PURE__ */ new Set([
|
|
589
589
|
"number",
|
|
590
590
|
"currency",
|
|
591
591
|
"percent",
|
|
@@ -596,19 +596,19 @@ const oi = /* @__PURE__ */ new Set([
|
|
|
596
596
|
"duration",
|
|
597
597
|
"string",
|
|
598
598
|
"temporal_bucket"
|
|
599
|
-
]),
|
|
599
|
+
]), ci = /* @__PURE__ */ new Set([
|
|
600
600
|
"millisecond",
|
|
601
601
|
"second",
|
|
602
602
|
"minute",
|
|
603
603
|
"hour",
|
|
604
604
|
"day"
|
|
605
|
-
]),
|
|
606
|
-
function
|
|
605
|
+
]), pi = /* @__PURE__ */ new Set(["compact", "digital", "long"]);
|
|
606
|
+
function nt(e, t, n) {
|
|
607
607
|
if (e === void 0)
|
|
608
608
|
return;
|
|
609
609
|
if (!f(e)) {
|
|
610
610
|
n.push(
|
|
611
|
-
|
|
611
|
+
r(
|
|
612
612
|
"invalid_value_format",
|
|
613
613
|
"Value format must be a structured object.",
|
|
614
614
|
t
|
|
@@ -617,95 +617,95 @@ function Je(e, t, n) {
|
|
|
617
617
|
return;
|
|
618
618
|
}
|
|
619
619
|
const o = e;
|
|
620
|
-
(typeof o.type != "string" || !
|
|
621
|
-
|
|
620
|
+
(typeof o.type != "string" || !ui.has(o.type)) && n.push(
|
|
621
|
+
r(
|
|
622
622
|
"invalid_value_format_type",
|
|
623
623
|
"Value format type must be number, currency, percent, percentage, scientific, date, datetime, duration, string, or temporal_bucket.",
|
|
624
624
|
`${t}.type`
|
|
625
625
|
)
|
|
626
|
-
), o.type === "temporal_bucket" && !
|
|
627
|
-
|
|
626
|
+
), o.type === "temporal_bucket" && !X.safeParse(e).success && n.push(
|
|
627
|
+
r(
|
|
628
628
|
"invalid_temporal_bucket_format",
|
|
629
629
|
"Temporal bucket format must contain a valid auto, preset, or pattern presentation.",
|
|
630
630
|
t
|
|
631
631
|
)
|
|
632
632
|
), (o.type === "number" || o.type === "currency" || o.type === "percent" || o.type === "percentage" || o.type === "scientific") && Object.prototype.hasOwnProperty.call(e, "locale") && n.push(
|
|
633
|
-
|
|
633
|
+
r(
|
|
634
634
|
"invalid_value_format",
|
|
635
635
|
"Numeric value formats cannot define viewer locale.",
|
|
636
636
|
`${t}.locale`
|
|
637
637
|
)
|
|
638
|
-
),
|
|
638
|
+
), B(
|
|
639
639
|
e.minimumFractionDigits,
|
|
640
640
|
`${t}.minimumFractionDigits`,
|
|
641
641
|
n
|
|
642
|
-
),
|
|
642
|
+
), B(
|
|
643
643
|
e.maximumFractionDigits,
|
|
644
644
|
`${t}.maximumFractionDigits`,
|
|
645
645
|
n
|
|
646
|
-
),
|
|
647
|
-
|
|
646
|
+
), B(e.scale, `${t}.scale`, n), B(e.maxUnits, `${t}.maxUnits`, n), e.useGrouping !== void 0 && typeof e.useGrouping != "boolean" && n.push(
|
|
647
|
+
r(
|
|
648
648
|
"invalid_value_format_use_grouping",
|
|
649
649
|
"Value format useGrouping must be boolean.",
|
|
650
650
|
`${t}.useGrouping`
|
|
651
651
|
)
|
|
652
652
|
), e.negativeStyle !== void 0 && e.negativeStyle !== "minus" && e.negativeStyle !== "parentheses" && n.push(
|
|
653
|
-
|
|
653
|
+
r(
|
|
654
654
|
"invalid_value_format_negative_style",
|
|
655
655
|
"Value format negativeStyle must be minus or parentheses.",
|
|
656
656
|
`${t}.negativeStyle`
|
|
657
657
|
)
|
|
658
658
|
), e.percentValueMode !== void 0 && e.percentValueMode !== "fraction" && e.percentValueMode !== "whole" && n.push(
|
|
659
|
-
|
|
659
|
+
r(
|
|
660
660
|
"invalid_value_format_percent_mode",
|
|
661
661
|
"Value format percentValueMode must be fraction or whole.",
|
|
662
662
|
`${t}.percentValueMode`
|
|
663
663
|
)
|
|
664
664
|
);
|
|
665
665
|
for (const a of ["inputUnit", "largestUnit", "smallestUnit"]) {
|
|
666
|
-
const
|
|
667
|
-
|
|
668
|
-
|
|
666
|
+
const s = e[a];
|
|
667
|
+
s !== void 0 && (typeof s != "string" || !ci.has(s)) && n.push(
|
|
668
|
+
r(
|
|
669
669
|
"invalid_value_format_duration_unit",
|
|
670
670
|
"Duration format units must be millisecond, second, minute, hour, or day.",
|
|
671
671
|
`${t}.${a}`
|
|
672
672
|
)
|
|
673
673
|
);
|
|
674
674
|
}
|
|
675
|
-
e.outputStyle !== void 0 && (typeof e.outputStyle != "string" || !
|
|
676
|
-
|
|
675
|
+
e.outputStyle !== void 0 && (typeof e.outputStyle != "string" || !pi.has(e.outputStyle)) && n.push(
|
|
676
|
+
r(
|
|
677
677
|
"invalid_value_format_duration_style",
|
|
678
678
|
"Duration format outputStyle must be compact, digital, or long.",
|
|
679
679
|
`${t}.outputStyle`
|
|
680
680
|
)
|
|
681
681
|
);
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function B(e, t, n) {
|
|
684
684
|
e !== void 0 && (typeof e != "number" || !Number.isFinite(e)) && n.push(
|
|
685
|
-
|
|
685
|
+
r(
|
|
686
686
|
"invalid_value_format_number",
|
|
687
687
|
"Value format numeric options must be finite numbers.",
|
|
688
688
|
t
|
|
689
689
|
)
|
|
690
690
|
);
|
|
691
691
|
}
|
|
692
|
-
const
|
|
692
|
+
const mi = /* @__PURE__ */ new Set([
|
|
693
693
|
"additive",
|
|
694
694
|
"non_additive",
|
|
695
695
|
"ratio_of_sums",
|
|
696
696
|
"weighted",
|
|
697
697
|
"pre_aggregated",
|
|
698
698
|
"snapshot"
|
|
699
|
-
]),
|
|
699
|
+
]), fi = /* @__PURE__ */ new Set([
|
|
700
700
|
"default",
|
|
701
701
|
"symmetric_aggregate",
|
|
702
702
|
"aggregate_then_join",
|
|
703
703
|
"weighted"
|
|
704
704
|
]);
|
|
705
|
-
function
|
|
705
|
+
function gi(e, t, n) {
|
|
706
706
|
if (!e || !f(e)) {
|
|
707
707
|
n.push(
|
|
708
|
-
|
|
708
|
+
r(
|
|
709
709
|
"invalid_derived_field_input",
|
|
710
710
|
"Derived field inputs must be structured input references.",
|
|
711
711
|
t
|
|
@@ -714,114 +714,114 @@ function pi(e, t, n) {
|
|
|
714
714
|
return;
|
|
715
715
|
}
|
|
716
716
|
if (e.kind === "field") {
|
|
717
|
-
b(e.field, `${t}.field`, n, { required: !0 }),
|
|
717
|
+
b(e.field, `${t}.field`, n, { required: !0 }), ye(e.aggregate, `${t}.aggregate`, n);
|
|
718
718
|
return;
|
|
719
719
|
}
|
|
720
720
|
n.push(
|
|
721
|
-
|
|
721
|
+
r(
|
|
722
722
|
"invalid_derived_field_input",
|
|
723
723
|
"Derived field input kind must be field.",
|
|
724
724
|
`${t}.kind`
|
|
725
725
|
)
|
|
726
726
|
);
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function ve(e) {
|
|
729
729
|
const t = [];
|
|
730
730
|
if (!f(e))
|
|
731
731
|
return t.push(
|
|
732
|
-
|
|
732
|
+
r(
|
|
733
733
|
"invalid_derived_field",
|
|
734
734
|
"Derived field definition must be a structured object."
|
|
735
735
|
)
|
|
736
736
|
), { ok: !1, errors: t, warnings: [] };
|
|
737
737
|
if (e.kind !== "derived_field" && t.push(
|
|
738
|
-
|
|
738
|
+
r(
|
|
739
739
|
"invalid_derived_field_kind",
|
|
740
740
|
"Derived field kind must be derived_field.",
|
|
741
741
|
"kind"
|
|
742
742
|
)
|
|
743
743
|
), p(e.name) || t.push(
|
|
744
|
-
|
|
744
|
+
r(
|
|
745
745
|
"invalid_derived_field_name",
|
|
746
746
|
"Derived field needs a name.",
|
|
747
747
|
"name"
|
|
748
748
|
)
|
|
749
749
|
), p(e.label) || t.push(
|
|
750
|
-
|
|
750
|
+
r(
|
|
751
751
|
"invalid_derived_field_label",
|
|
752
752
|
"Derived field needs a label.",
|
|
753
753
|
"label"
|
|
754
754
|
)
|
|
755
|
-
),
|
|
756
|
-
|
|
755
|
+
), li.has(e.resultRole) || t.push(
|
|
756
|
+
r(
|
|
757
757
|
"invalid_derived_field_role",
|
|
758
758
|
"Derived field resultRole must be measure, dimension, date, id, or unknown.",
|
|
759
759
|
"resultRole"
|
|
760
760
|
)
|
|
761
|
-
),
|
|
762
|
-
|
|
761
|
+
), it.has(e.dataType) || t.push(
|
|
762
|
+
r(
|
|
763
763
|
"invalid_derived_field_data_type",
|
|
764
764
|
"Derived field dataType must be string, number, boolean, date, datetime, or unknown.",
|
|
765
765
|
"dataType"
|
|
766
766
|
)
|
|
767
|
-
),
|
|
768
|
-
|
|
767
|
+
), di.has(e.computeStage) || t.push(
|
|
768
|
+
r(
|
|
769
769
|
"invalid_derived_field_compute_stage",
|
|
770
770
|
"Derived field computeStage must be row or aggregate.",
|
|
771
771
|
"computeStage"
|
|
772
772
|
)
|
|
773
773
|
), e.computeStage === "aggregate" && e.resultRole !== "measure" && t.push(
|
|
774
|
-
|
|
774
|
+
r(
|
|
775
775
|
"invalid_derived_field_compute_stage",
|
|
776
776
|
"Aggregate-stage derived fields must have resultRole measure.",
|
|
777
777
|
"computeStage"
|
|
778
778
|
)
|
|
779
779
|
), e.resultRole !== "measure" && e.defaultAggregate !== void 0 && t.push(
|
|
780
|
-
|
|
780
|
+
r(
|
|
781
781
|
"invalid_derived_field_aggregate",
|
|
782
782
|
"Only measure derived fields may declare defaultAggregate.",
|
|
783
783
|
"defaultAggregate"
|
|
784
784
|
)
|
|
785
785
|
), e.computeStage === "row" && e.resultRole === "measure" && e.defaultAggregate === void 0 && t.push(
|
|
786
|
-
|
|
786
|
+
r(
|
|
787
787
|
"missing_derived_field_default_aggregate",
|
|
788
788
|
"Row-stage measure derived fields must declare defaultAggregate so row results have explicit rollup semantics.",
|
|
789
789
|
"defaultAggregate"
|
|
790
790
|
)
|
|
791
|
-
),
|
|
791
|
+
), ye(
|
|
792
792
|
e.defaultAggregate,
|
|
793
793
|
"defaultAggregate",
|
|
794
794
|
t
|
|
795
|
-
), e.aggregationBehavior !== void 0 && !
|
|
795
|
+
), e.aggregationBehavior !== void 0 && !mi.has(
|
|
796
796
|
e.aggregationBehavior
|
|
797
797
|
) && t.push(
|
|
798
|
-
|
|
798
|
+
r(
|
|
799
799
|
"invalid_derived_field_aggregation_behavior",
|
|
800
800
|
"Derived field aggregationBehavior is not supported.",
|
|
801
801
|
"aggregationBehavior"
|
|
802
802
|
)
|
|
803
|
-
), e.aggregationStrategy !== void 0 && !
|
|
803
|
+
), e.aggregationStrategy !== void 0 && !fi.has(
|
|
804
804
|
e.aggregationStrategy
|
|
805
805
|
) && t.push(
|
|
806
|
-
|
|
806
|
+
r(
|
|
807
807
|
"invalid_derived_field_aggregation_strategy",
|
|
808
808
|
"Derived field aggregationStrategy is not supported.",
|
|
809
809
|
"aggregationStrategy"
|
|
810
810
|
)
|
|
811
811
|
), p(e.expression) || t.push(
|
|
812
|
-
|
|
812
|
+
r(
|
|
813
813
|
"invalid_derived_field_expression",
|
|
814
814
|
"Derived field needs a named-token expression.",
|
|
815
815
|
"expression"
|
|
816
816
|
)
|
|
817
817
|
), e.expressionLanguage !== void 0 && e.expressionLanguage !== "semaphor_sql_template" && t.push(
|
|
818
|
-
|
|
818
|
+
r(
|
|
819
819
|
"invalid_derived_field_expression_language",
|
|
820
820
|
"Derived field expressionLanguage must be semaphor_sql_template.",
|
|
821
821
|
"expressionLanguage"
|
|
822
822
|
)
|
|
823
823
|
), !f(e.inputs) || Object.keys(e.inputs).length === 0 ? t.push(
|
|
824
|
-
|
|
824
|
+
r(
|
|
825
825
|
"invalid_derived_field_inputs",
|
|
826
826
|
"Derived field needs at least one typed input.",
|
|
827
827
|
"inputs"
|
|
@@ -829,7 +829,7 @@ function et(e) {
|
|
|
829
829
|
) : Object.entries(e.inputs).forEach(([o, a]) => {
|
|
830
830
|
if (!p(o)) {
|
|
831
831
|
t.push(
|
|
832
|
-
|
|
832
|
+
r(
|
|
833
833
|
"invalid_derived_field_input_name",
|
|
834
834
|
"Derived field input names must be non-empty strings.",
|
|
835
835
|
"inputs"
|
|
@@ -837,28 +837,28 @@ function et(e) {
|
|
|
837
837
|
);
|
|
838
838
|
return;
|
|
839
839
|
}
|
|
840
|
-
|
|
840
|
+
gi(
|
|
841
841
|
a,
|
|
842
842
|
`inputs.${o}`,
|
|
843
843
|
t
|
|
844
844
|
);
|
|
845
845
|
}), p(e.expression) && f(e.inputs)) {
|
|
846
|
-
const o =
|
|
846
|
+
const o = ai(
|
|
847
847
|
e.expression
|
|
848
|
-
), a = new Set(o),
|
|
848
|
+
), a = new Set(o), s = Object.keys(e.inputs).filter(
|
|
849
849
|
(l) => p(l)
|
|
850
850
|
);
|
|
851
851
|
o.forEach((l) => {
|
|
852
852
|
Object.prototype.hasOwnProperty.call(e.inputs, l) || t.push(
|
|
853
|
-
|
|
853
|
+
r(
|
|
854
854
|
"invalid_derived_field_expression_token",
|
|
855
855
|
`Derived field expression token "{${l}}" needs a matching inputs.${l} entry.`,
|
|
856
856
|
"expression"
|
|
857
857
|
)
|
|
858
858
|
);
|
|
859
|
-
}),
|
|
859
|
+
}), s.forEach((l) => {
|
|
860
860
|
a.has(l) || t.push(
|
|
861
|
-
|
|
861
|
+
r(
|
|
862
862
|
"unused_derived_field_input",
|
|
863
863
|
`Derived field input "${l}" is not referenced by expression.`,
|
|
864
864
|
`inputs.${l}`
|
|
@@ -868,68 +868,68 @@ function et(e) {
|
|
|
868
868
|
}
|
|
869
869
|
const n = e.format;
|
|
870
870
|
return f(n) && n.type === "temporal_bucket" ? t.push(
|
|
871
|
-
|
|
871
|
+
r(
|
|
872
872
|
"invalid_derived_field_format",
|
|
873
873
|
"Derived field computation metadata cannot own temporal bucket presentation; declare grain and format on the grouped field.",
|
|
874
874
|
"format"
|
|
875
875
|
)
|
|
876
|
-
) :
|
|
877
|
-
|
|
876
|
+
) : nt(n, "format", t), e.tags !== void 0 && (!Array.isArray(e.tags) || e.tags.some((o) => !p(o))) && t.push(
|
|
877
|
+
r(
|
|
878
878
|
"invalid_derived_field_tags",
|
|
879
879
|
"Derived field tags must be non-empty strings.",
|
|
880
880
|
"tags"
|
|
881
881
|
)
|
|
882
882
|
), { ok: t.length === 0, errors: t, warnings: [] };
|
|
883
883
|
}
|
|
884
|
-
const M = i.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), [
|
|
885
|
-
|
|
884
|
+
const M = i.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), [hi, _i, bi, yi] = he.options, at = i.union([
|
|
885
|
+
hi.innerType().omit({ locale: !0 }).strict().superRefine((e, t) => {
|
|
886
886
|
const { minimumFractionDigits: n = 0, maximumFractionDigits: o = 2 } = e;
|
|
887
887
|
(![n, o].every((a) => Number.isInteger(a) && a >= 0 && a <= 20) || n > o) && t.addIssue({
|
|
888
888
|
code: "custom",
|
|
889
889
|
message: "Fraction digits must be integers from 0 to 20 with minimum <= maximum."
|
|
890
890
|
}), e.scale !== void 0 && !Number.isFinite(e.scale) && t.addIssue({ code: "custom", message: "Scale must be finite." });
|
|
891
891
|
}),
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
]),
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
]),
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
]),
|
|
892
|
+
_i.strict(),
|
|
893
|
+
bi.strict(),
|
|
894
|
+
yi.strict()
|
|
895
|
+
]), Ee = i.union([
|
|
896
|
+
at,
|
|
897
|
+
X
|
|
898
|
+
]), Se = i.union([
|
|
899
|
+
_e.extend({ domainId: M, datasetName: M }).strict(),
|
|
900
|
+
Qe.extend({ connectionId: M, tableName: M }).strict()
|
|
901
|
+
]), ot = Xe.extend({
|
|
902
902
|
name: M,
|
|
903
|
-
source:
|
|
904
|
-
}).strict(),
|
|
905
|
-
format:
|
|
903
|
+
source: Se.optional()
|
|
904
|
+
}).strict(), Ie = Je.extend({
|
|
905
|
+
format: at.optional(),
|
|
906
906
|
inputs: i.record(
|
|
907
907
|
i.object({
|
|
908
908
|
kind: i.literal("field"),
|
|
909
|
-
field:
|
|
910
|
-
aggregate:
|
|
909
|
+
field: ot,
|
|
910
|
+
aggregate: R.optional()
|
|
911
911
|
}).strict()
|
|
912
912
|
)
|
|
913
913
|
}).strict().superRefine((e, t) => {
|
|
914
914
|
var n;
|
|
915
|
-
for (const o of
|
|
915
|
+
for (const o of ve(e).errors)
|
|
916
916
|
t.addIssue({
|
|
917
917
|
code: "custom",
|
|
918
918
|
path: ((n = o.path) == null ? void 0 : n.split(".")) ?? [],
|
|
919
919
|
message: o.message
|
|
920
920
|
});
|
|
921
|
-
}),
|
|
922
|
-
derivedField:
|
|
921
|
+
}), vi = ot.extend({
|
|
922
|
+
derivedField: Ie.optional()
|
|
923
923
|
}).strict();
|
|
924
|
-
function
|
|
924
|
+
function ke(e) {
|
|
925
925
|
return typeof e == "string" ? e.trim().toLowerCase() : "";
|
|
926
926
|
}
|
|
927
|
-
function
|
|
927
|
+
function Si(e) {
|
|
928
928
|
return String(
|
|
929
929
|
e.column_name || e.name || e.qualifiedFieldName || ""
|
|
930
930
|
);
|
|
931
931
|
}
|
|
932
|
-
function
|
|
932
|
+
function Ii(e) {
|
|
933
933
|
return Array.from(
|
|
934
934
|
new Set(
|
|
935
935
|
[e.column_name, e.name, e.qualifiedFieldName, e.alias].filter(
|
|
@@ -938,11 +938,11 @@ function yi(e) {
|
|
|
938
938
|
)
|
|
939
939
|
);
|
|
940
940
|
}
|
|
941
|
-
function
|
|
942
|
-
const t =
|
|
943
|
-
return t ?
|
|
941
|
+
function st(e) {
|
|
942
|
+
const t = lt(e);
|
|
943
|
+
return t ? Ai(t) ? "number" : t.includes("timestamp") || t.includes("datetime") || t.startsWith("time") ? "datetime" : t.includes("date") ? "date" : t.includes("bool") ? "boolean" : "string" : "unknown";
|
|
944
944
|
}
|
|
945
|
-
const
|
|
945
|
+
const ne = /* @__PURE__ */ new Map([
|
|
946
946
|
// Integer families (PostgreSQL, ClickHouse, DuckDB, MySQL).
|
|
947
947
|
["int", "integer"],
|
|
948
948
|
["uint", "integer"],
|
|
@@ -970,80 +970,80 @@ const ie = /* @__PURE__ */ new Map([
|
|
|
970
970
|
["money", null],
|
|
971
971
|
["currency", null],
|
|
972
972
|
["percent", null]
|
|
973
|
-
]),
|
|
974
|
-
function
|
|
973
|
+
]), ki = ["int", "uint", "decimal", "float"];
|
|
974
|
+
function wi(e) {
|
|
975
975
|
return e.length > 0 && Array.from(e).every((t) => t >= "0" && t <= "9");
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function rt(e) {
|
|
978
978
|
const t = e.split(/[\s(]/, 1)[0] || "";
|
|
979
|
-
if (
|
|
980
|
-
return { numeric: !0, kind:
|
|
981
|
-
const n =
|
|
982
|
-
(o) => t.startsWith(o) &&
|
|
979
|
+
if (ne.has(t))
|
|
980
|
+
return { numeric: !0, kind: ne.get(t) ?? null };
|
|
981
|
+
const n = ki.find(
|
|
982
|
+
(o) => t.startsWith(o) && wi(t.slice(o.length))
|
|
983
983
|
);
|
|
984
|
-
return n ? { numeric: !0, kind:
|
|
984
|
+
return n ? { numeric: !0, kind: ne.get(n) ?? null } : { numeric: !1, kind: null };
|
|
985
985
|
}
|
|
986
|
-
function
|
|
987
|
-
return
|
|
986
|
+
function Ai(e) {
|
|
987
|
+
return rt(e).numeric;
|
|
988
988
|
}
|
|
989
|
-
function
|
|
990
|
-
return
|
|
989
|
+
function xi(e) {
|
|
990
|
+
return rt(lt(e)).kind;
|
|
991
991
|
}
|
|
992
|
-
function
|
|
993
|
-
let t =
|
|
992
|
+
function lt(e) {
|
|
993
|
+
let t = ke(e), n = "";
|
|
994
994
|
for (; t && t !== n; )
|
|
995
|
-
n = t, t =
|
|
995
|
+
n = t, t = je(t, "nullable"), t = je(t, "lowcardinality");
|
|
996
996
|
return t;
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function je(e, t) {
|
|
999
999
|
const n = `${t}(`;
|
|
1000
1000
|
return !e.startsWith(n) || !e.endsWith(")") ? e : e.slice(n.length, -1).trim();
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1003
|
-
const t =
|
|
1002
|
+
function Fi(e) {
|
|
1003
|
+
const t = st(e);
|
|
1004
1004
|
return t === "date" || t === "datetime";
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1007
|
-
return
|
|
1006
|
+
function dt(e) {
|
|
1007
|
+
return Fi(e.dataType || e.data_type);
|
|
1008
1008
|
}
|
|
1009
|
-
function
|
|
1010
|
-
const t =
|
|
1009
|
+
function ut(e) {
|
|
1010
|
+
const t = ct(e);
|
|
1011
1011
|
return t === "id" || t === "row_id";
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1014
|
-
const t =
|
|
1015
|
-
return
|
|
1013
|
+
function $e(e) {
|
|
1014
|
+
const t = ct(e);
|
|
1015
|
+
return ut(e) || t.endsWith("_id") || t.endsWith("_key") || t.endsWith("_number");
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1018
|
-
return
|
|
1019
|
-
|
|
1017
|
+
function ct(e) {
|
|
1018
|
+
return ke(
|
|
1019
|
+
Si(e) || e.name || e.alias
|
|
1020
1020
|
).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1023
|
-
const n =
|
|
1024
|
-
return n === "metric" || n === "measure" ? !t.excludeIdentifiers ||
|
|
1022
|
+
function pt(e, t = {}) {
|
|
1023
|
+
const n = ke(e.role);
|
|
1024
|
+
return n === "metric" || n === "measure" ? !t.excludeIdentifiers || !$e(e) : n === "groupby" || n === "dimension" || n === "date" || n === "id" ? !1 : st(
|
|
1025
1025
|
e.dataType || e.data_type
|
|
1026
|
-
) === "number" && (!t.excludeIdentifiers ||
|
|
1026
|
+
) === "number" && (!t.excludeIdentifiers || !$e(e));
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1029
|
-
return !
|
|
1028
|
+
function fa(e) {
|
|
1029
|
+
return !pt(e) && !dt(e);
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function ga(e) {
|
|
1032
1032
|
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
1033
1033
|
for (const a of e) {
|
|
1034
|
-
if (
|
|
1034
|
+
if (ut(a))
|
|
1035
1035
|
continue;
|
|
1036
|
-
const
|
|
1037
|
-
if (
|
|
1038
|
-
if (
|
|
1039
|
-
|
|
1036
|
+
const s = Ii(a);
|
|
1037
|
+
if (s.length !== 0) {
|
|
1038
|
+
if (dt(a)) {
|
|
1039
|
+
s.forEach((l) => n.add(l));
|
|
1040
1040
|
continue;
|
|
1041
1041
|
}
|
|
1042
|
-
if (
|
|
1043
|
-
|
|
1042
|
+
if (pt(a, { excludeIdentifiers: !0 })) {
|
|
1043
|
+
s.forEach((l) => t.add(l));
|
|
1044
1044
|
continue;
|
|
1045
1045
|
}
|
|
1046
|
-
|
|
1046
|
+
s.forEach((l) => o.add(l));
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
1049
|
return {
|
|
@@ -1053,7 +1053,7 @@ function ua(e) {
|
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
1055
1055
|
const D = 16 * 1024;
|
|
1056
|
-
function
|
|
1056
|
+
function V(e) {
|
|
1057
1057
|
const t = /^([+-]?)(?:(\d+)(?:\.(\d*))?|\.(\d+))(?:[eE]([+-]?\d+))?$/.exec(e);
|
|
1058
1058
|
return t ? {
|
|
1059
1059
|
sign: t[1],
|
|
@@ -1062,91 +1062,91 @@ function U(e) {
|
|
|
1062
1062
|
exponent: Number(t[5] ?? "0")
|
|
1063
1063
|
} : null;
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1066
|
-
const { sign: t, whole: n, fraction: o = "", exponent: a } = e,
|
|
1065
|
+
function Ce(e) {
|
|
1066
|
+
const { sign: t, whole: n, fraction: o = "", exponent: a } = e, s = (n + o).replace(/^0+/, ""), l = s.replace(/0+$/, ""), d = a - o.length + s.length - l.length;
|
|
1067
1067
|
return !Number.isSafeInteger(a) || !Number.isSafeInteger(d) ? null : l ? `${t === "-" ? "-" : ""}${l}e${d}` : "0";
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
const t =
|
|
1069
|
+
function Ri(e) {
|
|
1070
|
+
const t = V(e);
|
|
1071
1071
|
if (!t) return null;
|
|
1072
1072
|
const n = t.sign === "+" ? e.slice(1) : e, o = Number(e);
|
|
1073
1073
|
if (!Number.isFinite(o)) return n;
|
|
1074
|
-
const a =
|
|
1075
|
-
return a !== null &&
|
|
1074
|
+
const a = Ce(t), s = V(String(o));
|
|
1075
|
+
return a !== null && s !== null && a === Ce(s) ? o : n;
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function Ti(e) {
|
|
1078
1078
|
if (e.length > D)
|
|
1079
1079
|
throw new RangeError("Exact numeric text exceeds 16 KiB.");
|
|
1080
|
-
const t =
|
|
1080
|
+
const t = V(e);
|
|
1081
1081
|
if (!t) throw new TypeError("Expected finite decimal text.");
|
|
1082
|
-
const { sign: n, whole: o, fraction: a, exponent:
|
|
1083
|
-
return
|
|
1082
|
+
const { sign: n, whole: o, fraction: a, exponent: s } = t, l = `${n}${o || "0"}${a ? `.${a}` : ""}`;
|
|
1083
|
+
return x(`${l}e${s}`);
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function x(e) {
|
|
1086
1086
|
if (e.length > D)
|
|
1087
1087
|
throw new RangeError("Exact numeric text exceeds 16 KiB.");
|
|
1088
|
-
const t =
|
|
1088
|
+
const t = V(e);
|
|
1089
1089
|
if (!t || t.whole === "" || t.fraction === "")
|
|
1090
1090
|
throw new TypeError("Expected finite decimal text.");
|
|
1091
|
-
const { sign: n, whole: o, fraction: a = "", exponent:
|
|
1092
|
-
if (!Number.isSafeInteger(
|
|
1091
|
+
const { sign: n, whole: o, fraction: a = "", exponent: s } = t;
|
|
1092
|
+
if (!Number.isSafeInteger(s) || Math.abs(s) > D)
|
|
1093
1093
|
throw new RangeError("Exact numeric exponent exceeds the text budget.");
|
|
1094
|
-
const l = o + a, d = o.length +
|
|
1094
|
+
const l = o + a, d = o.length + s;
|
|
1095
1095
|
if (Math.max(l.length, d) + Math.max(0, -d) + 3 > D)
|
|
1096
1096
|
throw new RangeError("Normalized exact numeric text exceeds 16 KiB.");
|
|
1097
1097
|
let u;
|
|
1098
1098
|
d <= 0 ? u = `0.${"0".repeat(-d)}${l}` : d >= l.length ? u = l + "0".repeat(d - l.length) : u = `${l.slice(0, d)}.${l.slice(d)}`;
|
|
1099
|
-
const [m,
|
|
1100
|
-
return n === "-" &&
|
|
1099
|
+
const [m, _ = ""] = u.split("."), y = m.replace(/^0+(?=\d)/, ""), w = _.replace(/0+$/, ""), h = y + (w ? `.${w}` : "");
|
|
1100
|
+
return n === "-" && h !== "0" ? `-${h}` : h;
|
|
1101
1101
|
}
|
|
1102
|
-
function
|
|
1102
|
+
function mt(e, t) {
|
|
1103
1103
|
const n = e.startsWith("-"), o = t.startsWith("-");
|
|
1104
1104
|
if (n !== o) return n ? -1 : 1;
|
|
1105
|
-
const [a,
|
|
1105
|
+
const [a, s = ""] = (n ? e.slice(1) : e).split("."), [l, d = ""] = (o ? t.slice(1) : t).split(".");
|
|
1106
1106
|
let c = Math.sign(a.length - l.length);
|
|
1107
1107
|
if (!c && a !== l && (c = a < l ? -1 : 1), !c) {
|
|
1108
|
-
const u = Math.max(
|
|
1109
|
-
c = m ===
|
|
1108
|
+
const u = Math.max(s.length, d.length), m = s.padEnd(u, "0"), _ = d.padEnd(u, "0");
|
|
1109
|
+
c = m === _ ? 0 : m < _ ? -1 : 1;
|
|
1110
1110
|
}
|
|
1111
1111
|
return c === 0 ? 0 : n ? -c : c;
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1113
|
+
function ha(e, t) {
|
|
1114
1114
|
if (typeof t == "number" && !Number.isFinite(t))
|
|
1115
1115
|
throw new TypeError("Numeric scale must be finite.");
|
|
1116
|
-
const n = [e,
|
|
1117
|
-
const [l, d = ""] =
|
|
1116
|
+
const n = [e, x(String(t))].map((s) => {
|
|
1117
|
+
const [l, d = ""] = s.split(".");
|
|
1118
1118
|
return { coefficient: BigInt(l + d), digits: d.length };
|
|
1119
1119
|
}), o = n[0].coefficient * n[1].coefficient, a = n[0].digits + n[1].digits;
|
|
1120
|
-
return
|
|
1120
|
+
return x(`${o}e-${a}`);
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1122
|
+
function Mi(e) {
|
|
1123
1123
|
try {
|
|
1124
|
-
return
|
|
1124
|
+
return x(e) === e;
|
|
1125
1125
|
} catch {
|
|
1126
1126
|
return !1;
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
const
|
|
1129
|
+
const ft = i.object({
|
|
1130
1130
|
kind: i.literal("exact_number"),
|
|
1131
1131
|
type: i.enum(["integer", "decimal"]),
|
|
1132
|
-
value: i.string().max(D).refine(
|
|
1132
|
+
value: i.string().max(D).refine(Mi, "Expected canonical decimal text.")
|
|
1133
1133
|
}).strict().superRefine((e, t) => {
|
|
1134
1134
|
e.type === "integer" && e.value.includes(".") && t.addIssue({ code: "custom", path: ["value"], message: "An integer cannot have fractional digits." });
|
|
1135
|
-
}),
|
|
1135
|
+
}), L = i.union([
|
|
1136
1136
|
i.null(),
|
|
1137
1137
|
i.string(),
|
|
1138
1138
|
i.boolean(),
|
|
1139
1139
|
i.number().finite(),
|
|
1140
|
-
|
|
1140
|
+
ft
|
|
1141
1141
|
]);
|
|
1142
|
-
function
|
|
1143
|
-
return
|
|
1142
|
+
function Di(e, t) {
|
|
1143
|
+
return ft.parse({ kind: "exact_number", type: t, value: x(e) });
|
|
1144
1144
|
}
|
|
1145
|
-
function
|
|
1145
|
+
function H(e) {
|
|
1146
1146
|
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";
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1149
|
-
const t =
|
|
1148
|
+
function _a(e) {
|
|
1149
|
+
const t = xi(e.nativeDataType);
|
|
1150
1150
|
if (!t) throw new TypeError("Numeric result type is not established.");
|
|
1151
1151
|
if (e.value === null) return null;
|
|
1152
1152
|
if (t === "float") {
|
|
@@ -1156,12 +1156,12 @@ function pa(e) {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
if (e.exactText === void 0)
|
|
1158
1158
|
throw new TypeError("Exact numeric sidecar is required; rounded result values cannot substitute.");
|
|
1159
|
-
return
|
|
1159
|
+
return Di(e.exactText, t);
|
|
1160
1160
|
}
|
|
1161
|
-
const
|
|
1162
|
-
i.object({ kind: i.literal("value"), value:
|
|
1163
|
-
i.object({ kind: i.literal("others"), rankingId:
|
|
1164
|
-
]),
|
|
1161
|
+
const we = i.string().uuid(), Ae = i.enum(["rows", "columns"]), Ni = i.enum(["member", "subtotal", "grand_total", "others"]), Ei = i.discriminatedUnion("kind", [
|
|
1162
|
+
i.object({ kind: i.literal("value"), value: L }).strict(),
|
|
1163
|
+
i.object({ kind: i.literal("others"), rankingId: we }).strict()
|
|
1164
|
+
]), F = i.array(i.object({ levelId: we, member: Ei }).strict()).readonly().superRefine((e, t) => {
|
|
1165
1165
|
new Set(e.map((n) => n.levelId)).size !== e.length && t.addIssue({
|
|
1166
1166
|
code: "custom",
|
|
1167
1167
|
path: [],
|
|
@@ -1173,12 +1173,12 @@ const Se = i.string().uuid(), Ie = i.enum(["rows", "columns"]), Ti = i.enum(["me
|
|
|
1173
1173
|
path: [],
|
|
1174
1174
|
message: "Others is terminal."
|
|
1175
1175
|
});
|
|
1176
|
-
}),
|
|
1177
|
-
rowPath:
|
|
1178
|
-
columnPath:
|
|
1179
|
-
measureId:
|
|
1176
|
+
}), ba = i.object({
|
|
1177
|
+
rowPath: F,
|
|
1178
|
+
columnPath: F,
|
|
1179
|
+
measureId: we
|
|
1180
1180
|
}).strict();
|
|
1181
|
-
function
|
|
1181
|
+
function gt(e) {
|
|
1182
1182
|
return JSON.stringify(
|
|
1183
1183
|
e.map(({ levelId: t, member: n }) => [
|
|
1184
1184
|
t,
|
|
@@ -1186,11 +1186,11 @@ function pt(e) {
|
|
|
1186
1186
|
])
|
|
1187
1187
|
);
|
|
1188
1188
|
}
|
|
1189
|
-
const
|
|
1190
|
-
function
|
|
1189
|
+
const le = "SEMAPHOR_CALCULATED_FIELD", ji = "calculated_fields";
|
|
1190
|
+
function $i(e) {
|
|
1191
1191
|
return (e == null ? void 0 : e.sourceField) || (e == null ? void 0 : e.name) || "";
|
|
1192
1192
|
}
|
|
1193
|
-
const
|
|
1193
|
+
const Ci = [
|
|
1194
1194
|
// Day granularity formats
|
|
1195
1195
|
"MM-DD-YYYY",
|
|
1196
1196
|
"YYYY-MM-DD",
|
|
@@ -1225,36 +1225,90 @@ const Ni = [
|
|
|
1225
1225
|
// Custom format
|
|
1226
1226
|
"custom"
|
|
1227
1227
|
];
|
|
1228
|
-
function
|
|
1228
|
+
function ya(e) {
|
|
1229
1229
|
return e.role === "metric" && "expression" in e && !!e.expression;
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function va(e) {
|
|
1232
1232
|
return !!e.expression;
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1235
|
-
return !!e.expression;
|
|
1234
|
+
function Oi(e) {
|
|
1235
|
+
return !!(e && (e.calculationRepresentation || e.expression || e.derivedField || e.calculatedFieldOrigin || e.calculatedFormula || de(e)));
|
|
1236
|
+
}
|
|
1237
|
+
function ht(e) {
|
|
1238
|
+
var _, y, w;
|
|
1239
|
+
if (!e)
|
|
1240
|
+
return {
|
|
1241
|
+
representation: "physical",
|
|
1242
|
+
ownership: "local",
|
|
1243
|
+
completeness: "not-calculated",
|
|
1244
|
+
runtimeExecutable: !1,
|
|
1245
|
+
legacyManual: !1
|
|
1246
|
+
};
|
|
1247
|
+
const t = e.fieldScope === "domain" ? "domain" : "local", n = ((_ = e.derivedField) == null ? void 0 : _.computeStage) || ((y = e.calculatedFormula) == null ? void 0 : y.computeStage), o = !e.calculatedFormula || Array.isArray(e.calculatedFormula.inputFields) && e.calculatedFormula.inputFields.every((h) => {
|
|
1248
|
+
const P = h && $i(h);
|
|
1249
|
+
return typeof P == "string" && !!P.trim();
|
|
1250
|
+
}), a = typeof e.expression == "string" && !!e.expression.trim() && o, s = e.calculationRepresentation;
|
|
1251
|
+
if (e.derivedField || s === "typed-derived") {
|
|
1252
|
+
const h = e.derivedField !== void 0 && ve(e.derivedField).ok;
|
|
1253
|
+
return {
|
|
1254
|
+
representation: "typed-derived",
|
|
1255
|
+
ownership: t,
|
|
1256
|
+
completeness: (!s || s === "typed-derived") && h && (!e.expression && !e.calculatedFormula || a) ? "complete" : "incomplete",
|
|
1257
|
+
computeStage: n,
|
|
1258
|
+
runtimeExecutable: a,
|
|
1259
|
+
legacyManual: !1
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
if (!(!!s || Oi(e)))
|
|
1263
|
+
return {
|
|
1264
|
+
representation: "physical",
|
|
1265
|
+
ownership: t,
|
|
1266
|
+
completeness: "not-calculated",
|
|
1267
|
+
runtimeExecutable: !1,
|
|
1268
|
+
legacyManual: !1
|
|
1269
|
+
};
|
|
1270
|
+
const d = n || (e.role === "groupby" || ((w = e.calculatedFieldOrigin) == null ? void 0 : w.role) === "groupby" ? "row" : void 0), c = t === "domain" || de(e) || e.fieldScope === "card" || e.fieldScope === "sheet" || e.fieldScope === "dashboard" ? "manual" : "inline-expression", u = s === "manual" || s === "inline-expression" ? s : c, m = (!s || s === "manual" || s === "inline-expression") && !(s === "inline-expression" && de(e));
|
|
1271
|
+
return {
|
|
1272
|
+
representation: u,
|
|
1273
|
+
ownership: t,
|
|
1274
|
+
completeness: a && m ? "complete" : "incomplete",
|
|
1275
|
+
computeStage: d,
|
|
1276
|
+
runtimeExecutable: a,
|
|
1277
|
+
legacyManual: u === "manual" && t === "local" && !d
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1280
|
+
function Sa(e) {
|
|
1281
|
+
if (e.calculationRepresentation) return e;
|
|
1282
|
+
const { representation: t } = ht(e);
|
|
1283
|
+
return t === "physical" ? e : { ...e, calculationRepresentation: t };
|
|
1236
1284
|
}
|
|
1237
|
-
function
|
|
1285
|
+
function Ia(e) {
|
|
1286
|
+
return ht(e).computeStage;
|
|
1287
|
+
}
|
|
1288
|
+
function ka(e, t) {
|
|
1289
|
+
return e === "aggregate" && t === "default";
|
|
1290
|
+
}
|
|
1291
|
+
function wa(e) {
|
|
1238
1292
|
var n, o;
|
|
1239
1293
|
const t = e;
|
|
1240
1294
|
return !!(t != null && t.expression && ((o = (n = t.calculatedFormula) == null ? void 0 : n.inputFields) != null && o.length));
|
|
1241
1295
|
}
|
|
1242
|
-
function
|
|
1243
|
-
return !!(e && (e.entityName ===
|
|
1296
|
+
function Aa(e) {
|
|
1297
|
+
return !!(e && (e.entityName === le || e.entityId === le));
|
|
1244
1298
|
}
|
|
1245
|
-
function
|
|
1299
|
+
function de(e) {
|
|
1246
1300
|
return e ? [e.entityName, e.entityId, e.qualifiedEntityName].some(
|
|
1247
|
-
(t) => t ===
|
|
1301
|
+
(t) => t === le || t === ji
|
|
1248
1302
|
) : !1;
|
|
1249
1303
|
}
|
|
1250
|
-
var
|
|
1251
|
-
const [
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
]),
|
|
1304
|
+
var Yi = /* @__PURE__ */ ((e) => (e.SUBTOTAL = "__SUBTOTAL__", e.TOTAL = "__TOTAL__", e.ALL = "__ALL__", e))(Yi || {});
|
|
1305
|
+
const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
|
|
1306
|
+
Pi.innerType().strict(),
|
|
1307
|
+
Bi.extend({ type: i.literal("date") }).strict(),
|
|
1308
|
+
qi.strict(),
|
|
1309
|
+
Li.strict(),
|
|
1310
|
+
X
|
|
1311
|
+
]), v = i.string().min(1), Oe = i.enum(["groupby", "metric", "sortby", "pivotby", "detail"]), _t = i.enum([
|
|
1258
1312
|
"table",
|
|
1259
1313
|
"view",
|
|
1260
1314
|
"materialized view",
|
|
@@ -1263,8 +1317,8 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1263
1317
|
"dataset",
|
|
1264
1318
|
"url",
|
|
1265
1319
|
"upload"
|
|
1266
|
-
]),
|
|
1267
|
-
connectionId:
|
|
1320
|
+
]), ae = i.object({
|
|
1321
|
+
connectionId: v,
|
|
1268
1322
|
connectionType: i.enum([
|
|
1269
1323
|
"GoogleSheets",
|
|
1270
1324
|
"FileUpload",
|
|
@@ -1280,13 +1334,13 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1280
1334
|
"API",
|
|
1281
1335
|
"none"
|
|
1282
1336
|
]),
|
|
1283
|
-
type:
|
|
1284
|
-
name:
|
|
1337
|
+
type: _t,
|
|
1338
|
+
name: v,
|
|
1285
1339
|
// Grounded relationship plans retain semantic identity and display metadata.
|
|
1286
1340
|
// SQL stays server-resolved; it is not accepted inside a join entity.
|
|
1287
1341
|
alias: i.string().optional(),
|
|
1288
|
-
id:
|
|
1289
|
-
domainId:
|
|
1342
|
+
id: v.optional(),
|
|
1343
|
+
domainId: v.optional(),
|
|
1290
1344
|
datasetType: i.enum(["physical", "virtual"]).optional(),
|
|
1291
1345
|
label: i.string().optional(),
|
|
1292
1346
|
description: i.string().optional(),
|
|
@@ -1303,36 +1357,41 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1303
1357
|
"duckdb",
|
|
1304
1358
|
"mssql"
|
|
1305
1359
|
]).optional()
|
|
1306
|
-
}).strict(),
|
|
1360
|
+
}).strict(), G = i.lazy(
|
|
1307
1361
|
() => i.object({
|
|
1308
|
-
id:
|
|
1309
|
-
name:
|
|
1362
|
+
id: v,
|
|
1363
|
+
name: v,
|
|
1310
1364
|
label: i.string(),
|
|
1311
1365
|
/** Set when `label` was synthesized from `name`; see `Field.derivedLabel`. */
|
|
1312
1366
|
derivedLabel: i.string().optional(),
|
|
1313
|
-
qualifiedFieldName:
|
|
1314
|
-
dataType:
|
|
1315
|
-
entityId:
|
|
1316
|
-
entityName:
|
|
1317
|
-
entityType:
|
|
1367
|
+
qualifiedFieldName: v,
|
|
1368
|
+
dataType: v,
|
|
1369
|
+
entityId: v,
|
|
1370
|
+
entityName: v,
|
|
1371
|
+
entityType: _t,
|
|
1318
1372
|
alias: i.string().optional(),
|
|
1319
1373
|
sourceField: i.string().optional(),
|
|
1320
|
-
source:
|
|
1374
|
+
source: Se.optional(),
|
|
1321
1375
|
nativeDataType: i.string().optional(),
|
|
1322
1376
|
description: i.string().optional(),
|
|
1323
1377
|
qualifiedEntityName: i.string().optional(),
|
|
1324
|
-
dateFormat: i.enum(
|
|
1378
|
+
dateFormat: i.enum(Ci).optional(),
|
|
1325
1379
|
customFormat: i.string().optional(),
|
|
1326
|
-
granularity:
|
|
1327
|
-
role:
|
|
1380
|
+
granularity: U.optional(),
|
|
1381
|
+
role: Oe.optional(),
|
|
1382
|
+
calculationRepresentation: i.enum(["inline-expression", "manual", "typed-derived"]).optional(),
|
|
1383
|
+
calculatedFieldOrigin: i.object({ id: v, role: Oe.optional() }).strict().optional(),
|
|
1384
|
+
aggregateOrigin: i.enum(["default", "explicit"]).optional(),
|
|
1385
|
+
labelOrigin: i.enum(["semantic", "override"]).optional(),
|
|
1386
|
+
formatOrigin: i.enum(["semantic", "override"]).optional(),
|
|
1328
1387
|
expression: i.string().optional(),
|
|
1329
|
-
derivedField:
|
|
1330
|
-
format:
|
|
1388
|
+
derivedField: Ie.optional(),
|
|
1389
|
+
format: Ui.optional(),
|
|
1331
1390
|
semanticTemporalPresentation: i.object({
|
|
1332
|
-
granularity:
|
|
1333
|
-
format:
|
|
1391
|
+
granularity: U,
|
|
1392
|
+
format: X
|
|
1334
1393
|
}).strict().optional(),
|
|
1335
|
-
aggregate:
|
|
1394
|
+
aggregate: R.optional(),
|
|
1336
1395
|
fieldScope: i.enum(["card", "sheet", "dashboard", "domain"]).optional(),
|
|
1337
1396
|
calculatedFormula: i.object({
|
|
1338
1397
|
operation: i.enum([
|
|
@@ -1345,19 +1404,20 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1345
1404
|
"scale",
|
|
1346
1405
|
"custom"
|
|
1347
1406
|
]),
|
|
1348
|
-
inputFields: i.array(
|
|
1349
|
-
constant: i.number().finite().optional()
|
|
1407
|
+
inputFields: i.array(G),
|
|
1408
|
+
constant: i.number().finite().optional(),
|
|
1409
|
+
computeStage: i.enum(["row", "aggregate"]).optional()
|
|
1350
1410
|
}).strict().optional()
|
|
1351
1411
|
}).strict()
|
|
1352
|
-
),
|
|
1412
|
+
), Vi = i.union([
|
|
1353
1413
|
i.string(),
|
|
1354
1414
|
i.number().finite(),
|
|
1355
1415
|
i.boolean(),
|
|
1356
1416
|
i.date(),
|
|
1357
1417
|
i.null()
|
|
1358
|
-
]),
|
|
1359
|
-
id:
|
|
1360
|
-
field:
|
|
1418
|
+
]), Hi = i.object({
|
|
1419
|
+
id: v,
|
|
1420
|
+
field: G,
|
|
1361
1421
|
operator: i.enum([
|
|
1362
1422
|
"=",
|
|
1363
1423
|
"!=",
|
|
@@ -1377,9 +1437,9 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1377
1437
|
"isNull",
|
|
1378
1438
|
"isNotNull"
|
|
1379
1439
|
]),
|
|
1380
|
-
value: i.union([
|
|
1440
|
+
value: i.union([Vi, i.array(i.string()), i.array(i.number().finite())]),
|
|
1381
1441
|
label: i.string().optional(),
|
|
1382
|
-
temporalBucket:
|
|
1442
|
+
temporalBucket: re.optional()
|
|
1383
1443
|
}).strict().superRefine((e, t) => {
|
|
1384
1444
|
const { operator: n, value: o } = e;
|
|
1385
1445
|
(n === "between" || n === "not between") && (!Array.isArray(o) || o.length !== 2) && t.addIssue({
|
|
@@ -1391,21 +1451,21 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1391
1451
|
path: ["value"],
|
|
1392
1452
|
message: "Membership requires an array."
|
|
1393
1453
|
});
|
|
1394
|
-
}),
|
|
1454
|
+
}), bt = i.lazy(
|
|
1395
1455
|
() => i.object({
|
|
1396
|
-
id:
|
|
1456
|
+
id: v,
|
|
1397
1457
|
logicalOperator: i.enum(["AND", "OR"]),
|
|
1398
1458
|
negate: i.boolean(),
|
|
1399
|
-
conditions: i.array(
|
|
1400
|
-
groups: i.array(
|
|
1459
|
+
conditions: i.array(Hi),
|
|
1460
|
+
groups: i.array(bt)
|
|
1401
1461
|
}).strict()
|
|
1402
|
-
),
|
|
1403
|
-
baseEntity:
|
|
1462
|
+
), Gi = i.object({
|
|
1463
|
+
baseEntity: ae,
|
|
1404
1464
|
joins: i.array(
|
|
1405
1465
|
i.object({
|
|
1406
|
-
id:
|
|
1407
|
-
source:
|
|
1408
|
-
target:
|
|
1466
|
+
id: v,
|
|
1467
|
+
source: ae,
|
|
1468
|
+
target: ae,
|
|
1409
1469
|
joinType: i.enum(["INNER", "LEFT", "RIGHT", "FULL"]),
|
|
1410
1470
|
sequence: i.number().int().nonnegative(),
|
|
1411
1471
|
relationshipId: i.string().optional(),
|
|
@@ -1414,13 +1474,13 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1414
1474
|
relationshipTraversalDirection: i.enum(["forward", "reverse"]).optional(),
|
|
1415
1475
|
joinKeyGroups: i.array(
|
|
1416
1476
|
i.object({
|
|
1417
|
-
id:
|
|
1477
|
+
id: v,
|
|
1418
1478
|
operator: i.enum(["AND", "OR"]),
|
|
1419
1479
|
keys: i.array(
|
|
1420
1480
|
i.object({
|
|
1421
1481
|
id: i.string().optional(),
|
|
1422
|
-
source:
|
|
1423
|
-
target:
|
|
1482
|
+
source: G,
|
|
1483
|
+
target: G,
|
|
1424
1484
|
operator: i.enum(["=", "!=", ">", ">=", "<", "<="])
|
|
1425
1485
|
}).strict()
|
|
1426
1486
|
).min(1)
|
|
@@ -1428,14 +1488,14 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1428
1488
|
).min(1)
|
|
1429
1489
|
}).strict()
|
|
1430
1490
|
)
|
|
1431
|
-
}).strict(),
|
|
1432
|
-
axis:
|
|
1491
|
+
}).strict(), zi = i.object({
|
|
1492
|
+
axis: Ae,
|
|
1433
1493
|
levelId: i.string().uuid().optional(),
|
|
1434
1494
|
// Persisted table preferences are edited through Immer; runtime paths remain readonly.
|
|
1435
|
-
oppositePath:
|
|
1436
|
-
}).strict(), I = i.string().min(1),
|
|
1495
|
+
oppositePath: F.transform((e) => [...e]).optional()
|
|
1496
|
+
}).strict(), I = i.string().min(1), Ki = i.array(
|
|
1437
1497
|
i.enum(["body", "header", "footer", "subtotal", "grandTotal"])
|
|
1438
|
-
),
|
|
1498
|
+
), Qi = i.enum(["normal", "medium", "semibold", "bold"]), Wi = i.enum(["none", "underline", "line-through"]), yt = i.object({
|
|
1439
1499
|
version: i.literal(1),
|
|
1440
1500
|
rules: i.array(
|
|
1441
1501
|
i.object({
|
|
@@ -1444,11 +1504,11 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1444
1504
|
enabled: i.boolean().optional(),
|
|
1445
1505
|
target: i.object({
|
|
1446
1506
|
level: i.enum(["cell", "row"]),
|
|
1447
|
-
matrix:
|
|
1507
|
+
matrix: zi.optional(),
|
|
1448
1508
|
columnIds: i.array(I).optional(),
|
|
1449
1509
|
conditionColumnId: I.optional(),
|
|
1450
1510
|
applyToColumnIds: i.array(I).optional(),
|
|
1451
|
-
tableParts:
|
|
1511
|
+
tableParts: Ki.optional(),
|
|
1452
1512
|
rowRoles: i.array(i.string()).optional(),
|
|
1453
1513
|
depth: i.number().int().nonnegative().optional(),
|
|
1454
1514
|
includeTotals: i.boolean().optional(),
|
|
@@ -1459,13 +1519,13 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1459
1519
|
kind: i.literal("comparison"),
|
|
1460
1520
|
columnId: I,
|
|
1461
1521
|
operator: i.enum(["eq", "neq", "gt", "gte", "lt", "lte"]),
|
|
1462
|
-
value:
|
|
1522
|
+
value: L
|
|
1463
1523
|
}).strict(),
|
|
1464
1524
|
i.object({
|
|
1465
1525
|
kind: i.literal("between"),
|
|
1466
1526
|
columnId: I,
|
|
1467
|
-
min:
|
|
1468
|
-
max:
|
|
1527
|
+
min: L,
|
|
1528
|
+
max: L,
|
|
1469
1529
|
inclusive: i.boolean().optional()
|
|
1470
1530
|
}).strict(),
|
|
1471
1531
|
i.object({
|
|
@@ -1512,64 +1572,64 @@ const [ji, $i, Ci, Oi] = fe.options, Yi = i.union([
|
|
|
1512
1572
|
style: i.object({
|
|
1513
1573
|
backgroundColor: i.string().optional(),
|
|
1514
1574
|
textColor: i.string().optional(),
|
|
1515
|
-
fontWeight:
|
|
1575
|
+
fontWeight: Qi.optional(),
|
|
1516
1576
|
italic: i.boolean().optional(),
|
|
1517
|
-
textDecoration:
|
|
1577
|
+
textDecoration: Wi.optional(),
|
|
1518
1578
|
icon: i.enum(["arrowUp", "arrowDown", "warning", "check", "x"]).optional(),
|
|
1519
1579
|
dataBar: i.object({ color: i.string(), showValue: i.boolean() }).strict().optional()
|
|
1520
1580
|
}).strict().optional()
|
|
1521
1581
|
}).strict()
|
|
1522
1582
|
)
|
|
1523
1583
|
}).strict();
|
|
1524
|
-
function
|
|
1525
|
-
const n = (
|
|
1526
|
-
if (
|
|
1527
|
-
const l = typeof
|
|
1584
|
+
function xa(e, t) {
|
|
1585
|
+
const n = (s) => {
|
|
1586
|
+
if (H(s)) return s.value;
|
|
1587
|
+
const l = typeof s == "string" ? Ri(s.trim()) ?? ue(s) : ue(s);
|
|
1528
1588
|
if (l === null) return null;
|
|
1529
1589
|
try {
|
|
1530
|
-
return
|
|
1590
|
+
return Ti(String(l));
|
|
1531
1591
|
} catch {
|
|
1532
1592
|
return null;
|
|
1533
1593
|
}
|
|
1534
1594
|
}, o = n(e), a = n(t);
|
|
1535
|
-
return o === null || a === null ? null :
|
|
1595
|
+
return o === null || a === null ? null : mt(o, a);
|
|
1536
1596
|
}
|
|
1537
|
-
function
|
|
1538
|
-
const o =
|
|
1597
|
+
function Fa(e, t, n) {
|
|
1598
|
+
const o = Ji(e);
|
|
1539
1599
|
if (o === null) return null;
|
|
1540
1600
|
if (typeof o == "number" && typeof t == "number" && typeof n == "number") {
|
|
1541
|
-
const
|
|
1542
|
-
return { ratio:
|
|
1601
|
+
const h = en(o, t, n);
|
|
1602
|
+
return { ratio: h, midpointComparison: Math.sign(h - 0.5) };
|
|
1543
1603
|
}
|
|
1544
|
-
if ([t, n].some((
|
|
1545
|
-
const a = [o, t, n].map((
|
|
1546
|
-
const
|
|
1547
|
-
return { coefficient:
|
|
1548
|
-
}),
|
|
1549
|
-
(
|
|
1604
|
+
if ([t, n].some((h) => typeof h == "number" && !Number.isFinite(h))) return null;
|
|
1605
|
+
const a = [o, t, n].map((h) => {
|
|
1606
|
+
const P = typeof h == "number" ? x(String(h)) : h.value, [Ct, Me = ""] = P.split(".");
|
|
1607
|
+
return { coefficient: Ct + Me, scale: Me.length };
|
|
1608
|
+
}), s = Math.max(...a.map((h) => h.scale)), [l, d, c] = a.map(
|
|
1609
|
+
(h) => BigInt(h.coefficient) * 10n ** BigInt(s - h.scale)
|
|
1550
1610
|
), u = c - d, m = l - d;
|
|
1551
1611
|
if (u <= 0n)
|
|
1552
1612
|
return {
|
|
1553
1613
|
ratio: l >= c ? 1 : 0,
|
|
1554
1614
|
midpointComparison: l >= c ? 1 : -1
|
|
1555
1615
|
};
|
|
1556
|
-
const
|
|
1557
|
-
return { ratio: m <= 0n ? 0 : m >= u ? 1 : Number(m * 1000000000n / u) / 1e9, midpointComparison:
|
|
1616
|
+
const _ = m * 2n - u, y = _ < 0n ? -1 : _ > 0n ? 1 : 0;
|
|
1617
|
+
return { ratio: m <= 0n ? 0 : m >= u ? 1 : Number(m * 1000000000n / u) / 1e9, midpointComparison: y };
|
|
1558
1618
|
}
|
|
1559
|
-
function
|
|
1619
|
+
function Ra(e) {
|
|
1560
1620
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
1561
1621
|
}
|
|
1562
|
-
function
|
|
1622
|
+
function Ta(e) {
|
|
1563
1623
|
return e.enabled !== !1;
|
|
1564
1624
|
}
|
|
1565
|
-
function
|
|
1625
|
+
function Ma(e) {
|
|
1566
1626
|
return e.kind === "topBottom" || e.kind === "colorScale" && e.range === "auto" || e.kind === "dataBar" && e.range === "auto";
|
|
1567
1627
|
}
|
|
1568
|
-
function
|
|
1628
|
+
function Xi(e) {
|
|
1569
1629
|
return e.columnId;
|
|
1570
1630
|
}
|
|
1571
|
-
function
|
|
1572
|
-
const t = [
|
|
1631
|
+
function Zi(e) {
|
|
1632
|
+
const t = [Xi(e.condition)];
|
|
1573
1633
|
return { validationRefs: [.../* @__PURE__ */ new Set([
|
|
1574
1634
|
...t,
|
|
1575
1635
|
...e.target.conditionColumnId === void 0 ? [] : [e.target.conditionColumnId],
|
|
@@ -1577,7 +1637,7 @@ function zi(e) {
|
|
|
1577
1637
|
...e.target.applyToColumnIds ?? []
|
|
1578
1638
|
])], evaluationInputs: t };
|
|
1579
1639
|
}
|
|
1580
|
-
function
|
|
1640
|
+
function ue(e) {
|
|
1581
1641
|
if (typeof e == "number")
|
|
1582
1642
|
return Number.isFinite(e) ? e : null;
|
|
1583
1643
|
if (typeof e == "string" && e.trim() !== "") {
|
|
@@ -1586,30 +1646,30 @@ function le(e) {
|
|
|
1586
1646
|
}
|
|
1587
1647
|
return null;
|
|
1588
1648
|
}
|
|
1589
|
-
function
|
|
1590
|
-
return
|
|
1649
|
+
function Ji(e) {
|
|
1650
|
+
return H(e) ? e : ue(e);
|
|
1591
1651
|
}
|
|
1592
|
-
function
|
|
1652
|
+
function Da(e) {
|
|
1593
1653
|
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
1594
1654
|
for (const o of e)
|
|
1595
|
-
|
|
1655
|
+
H(o) ? n.add(o.value) : t.add(o);
|
|
1596
1656
|
return {
|
|
1597
|
-
has: (o) =>
|
|
1657
|
+
has: (o) => H(o) ? n.has(o.value) : t.has(o)
|
|
1598
1658
|
};
|
|
1599
1659
|
}
|
|
1600
|
-
function
|
|
1601
|
-
return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) :
|
|
1602
|
-
typeof e == "number" ?
|
|
1603
|
-
typeof t == "number" ?
|
|
1660
|
+
function Na(e, t) {
|
|
1661
|
+
return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) : mt(
|
|
1662
|
+
typeof e == "number" ? x(String(e)) : e.value,
|
|
1663
|
+
typeof t == "number" ? x(String(t)) : t.value
|
|
1604
1664
|
);
|
|
1605
1665
|
}
|
|
1606
|
-
function
|
|
1666
|
+
function Ea(e) {
|
|
1607
1667
|
return e == null || e === "";
|
|
1608
1668
|
}
|
|
1609
|
-
function
|
|
1669
|
+
function en(e, t, n) {
|
|
1610
1670
|
return !Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) ? 0 : n === t ? e >= n ? 1 : 0 : Math.max(0, Math.min(1, (e - t) / (n - t)));
|
|
1611
1671
|
}
|
|
1612
|
-
function
|
|
1672
|
+
function tn(e) {
|
|
1613
1673
|
switch (e) {
|
|
1614
1674
|
case "bold":
|
|
1615
1675
|
return 700;
|
|
@@ -1623,105 +1683,105 @@ function Wi(e) {
|
|
|
1623
1683
|
return;
|
|
1624
1684
|
}
|
|
1625
1685
|
}
|
|
1626
|
-
function
|
|
1627
|
-
return e ?
|
|
1628
|
-
fontWeight:
|
|
1686
|
+
function ja(e) {
|
|
1687
|
+
return e ? vt({
|
|
1688
|
+
fontWeight: tn(e.fontWeight),
|
|
1629
1689
|
fontStyle: e.italic ? "italic" : void 0,
|
|
1630
1690
|
color: e.textColor,
|
|
1631
1691
|
backgroundColor: e.backgroundColor,
|
|
1632
1692
|
textDecoration: e.textDecoration
|
|
1633
1693
|
}) : {};
|
|
1634
1694
|
}
|
|
1635
|
-
function
|
|
1695
|
+
function $a(...e) {
|
|
1636
1696
|
return Object.assign(
|
|
1637
1697
|
{},
|
|
1638
|
-
...e.filter((t) => !!t).map(
|
|
1698
|
+
...e.filter((t) => !!t).map(vt)
|
|
1639
1699
|
);
|
|
1640
1700
|
}
|
|
1641
|
-
function
|
|
1701
|
+
function vt(e) {
|
|
1642
1702
|
return Object.fromEntries(
|
|
1643
1703
|
Object.entries(e).filter(([, t]) => t !== void 0)
|
|
1644
1704
|
);
|
|
1645
1705
|
}
|
|
1646
|
-
const S = i.string().uuid(),
|
|
1706
|
+
const S = i.string().uuid(), nn = i.string().min(1), an = i.number().int().positive().max(Number.MAX_SAFE_INTEGER), on = i.enum([
|
|
1647
1707
|
"SUM",
|
|
1648
1708
|
"COUNT",
|
|
1649
1709
|
"DISTINCT",
|
|
1650
1710
|
"AVG",
|
|
1651
1711
|
"MIN",
|
|
1652
1712
|
"MAX"
|
|
1653
|
-
]),
|
|
1713
|
+
]), St = vi.omit({
|
|
1654
1714
|
aggregate: !0
|
|
1655
|
-
}),
|
|
1715
|
+
}), sn = {
|
|
1656
1716
|
id: S,
|
|
1657
|
-
field:
|
|
1658
|
-
grain:
|
|
1659
|
-
},
|
|
1717
|
+
field: St,
|
|
1718
|
+
grain: U.optional()
|
|
1719
|
+
}, ce = i.object(sn).strict(), rn = i.object({
|
|
1660
1720
|
id: S,
|
|
1661
1721
|
kind: i.literal("aggregate"),
|
|
1662
|
-
field:
|
|
1663
|
-
aggregate:
|
|
1664
|
-
}).strict(),
|
|
1722
|
+
field: St,
|
|
1723
|
+
aggregate: on
|
|
1724
|
+
}).strict(), ln = i.object({
|
|
1665
1725
|
id: S,
|
|
1666
1726
|
kind: i.literal("calculated"),
|
|
1667
|
-
definition:
|
|
1668
|
-
}).strict(),
|
|
1727
|
+
definition: Ie
|
|
1728
|
+
}).strict(), It = i.discriminatedUnion("kind", [rn, ln]), dn = i.discriminatedUnion("kind", [
|
|
1669
1729
|
i.object({ kind: i.literal("member") }).strict(),
|
|
1670
1730
|
i.object({
|
|
1671
1731
|
kind: i.literal("measure"),
|
|
1672
1732
|
measureId: S,
|
|
1673
|
-
oppositePath:
|
|
1733
|
+
oppositePath: F
|
|
1674
1734
|
}).strict()
|
|
1675
|
-
]),
|
|
1676
|
-
axis:
|
|
1735
|
+
]), kt = i.object({
|
|
1736
|
+
axis: Ae,
|
|
1677
1737
|
levelId: S,
|
|
1678
1738
|
scope: i.discriminatedUnion("kind", [
|
|
1679
1739
|
i.object({ kind: i.literal("level") }).strict(),
|
|
1680
|
-
i.object({ kind: i.literal("branch"), parent:
|
|
1740
|
+
i.object({ kind: i.literal("branch"), parent: F }).strict()
|
|
1681
1741
|
]),
|
|
1682
|
-
target:
|
|
1742
|
+
target: dn,
|
|
1683
1743
|
direction: i.enum(["asc", "desc"]),
|
|
1684
1744
|
nulls: i.enum(["first", "last"])
|
|
1685
|
-
}).strict(),
|
|
1745
|
+
}).strict(), un = i.object({
|
|
1686
1746
|
id: S,
|
|
1687
|
-
axis:
|
|
1747
|
+
axis: Ae,
|
|
1688
1748
|
levelId: S,
|
|
1689
1749
|
direction: i.enum(["top", "bottom"]),
|
|
1690
|
-
count:
|
|
1750
|
+
count: an,
|
|
1691
1751
|
measureId: S,
|
|
1692
|
-
oppositePath:
|
|
1752
|
+
oppositePath: F,
|
|
1693
1753
|
others: i.boolean()
|
|
1694
|
-
}).strict(),
|
|
1695
|
-
source:
|
|
1696
|
-
rows: i.array(
|
|
1697
|
-
columns: i.array(
|
|
1698
|
-
measures: i.array(
|
|
1699
|
-
filters:
|
|
1700
|
-
joinPlan:
|
|
1701
|
-
relationshipHint: i.object({ relationshipIds: i.array(
|
|
1702
|
-
sorts: i.array(
|
|
1703
|
-
rankings: i.array(
|
|
1754
|
+
}).strict(), wt = i.object({
|
|
1755
|
+
source: Se,
|
|
1756
|
+
rows: i.array(ce).min(1).readonly(),
|
|
1757
|
+
columns: i.array(ce).readonly(),
|
|
1758
|
+
measures: i.array(It).min(1).readonly(),
|
|
1759
|
+
filters: bt.optional(),
|
|
1760
|
+
joinPlan: Gi.optional(),
|
|
1761
|
+
relationshipHint: i.object({ relationshipIds: i.array(nn).optional() }).strict().optional(),
|
|
1762
|
+
sorts: i.array(kt).readonly(),
|
|
1763
|
+
rankings: i.array(un).readonly()
|
|
1704
1764
|
}).strict();
|
|
1705
|
-
function
|
|
1765
|
+
function At(e) {
|
|
1706
1766
|
return JSON.stringify([
|
|
1707
1767
|
e.axis,
|
|
1708
1768
|
e.levelId,
|
|
1709
1769
|
e.scope.kind,
|
|
1710
|
-
e.scope.kind === "branch" ?
|
|
1770
|
+
e.scope.kind === "branch" ? gt(e.scope.parent) : null
|
|
1711
1771
|
]);
|
|
1712
1772
|
}
|
|
1713
1773
|
function g(e, t, n) {
|
|
1714
1774
|
e.addIssue({ code: "custom", path: t, message: n });
|
|
1715
1775
|
}
|
|
1716
|
-
function
|
|
1776
|
+
function A(e, t, n) {
|
|
1717
1777
|
new Set(e).size !== e.length && g(t, n, "Duplicate identity.");
|
|
1718
1778
|
}
|
|
1719
|
-
function $(e, t, n, o, a,
|
|
1779
|
+
function $(e, t, n, o, a, s = !1) {
|
|
1720
1780
|
n.length > e[t].length && g(o, a, "Path exceeds axis depth."), n.forEach((l, d) => {
|
|
1721
1781
|
var c;
|
|
1722
1782
|
if (l.levelId !== ((c = e[t][d]) == null ? void 0 : c.id) && g(o, [...a, d], "Path must be an ordered axis prefix."), l.member.kind === "others") {
|
|
1723
1783
|
const u = l.member.rankingId;
|
|
1724
|
-
(
|
|
1784
|
+
(s || d !== n.length - 1 || !e.rankings.some(
|
|
1725
1785
|
(m) => m.id === u && m.others && m.axis === t && m.levelId === l.levelId
|
|
1726
1786
|
)) && g(
|
|
1727
1787
|
o,
|
|
@@ -1731,9 +1791,9 @@ function $(e, t, n, o, a, r = !1) {
|
|
|
1731
1791
|
}
|
|
1732
1792
|
});
|
|
1733
1793
|
}
|
|
1734
|
-
function
|
|
1735
|
-
|
|
1736
|
-
const l = [...o,
|
|
1794
|
+
function xt(e, t, n, o) {
|
|
1795
|
+
A(t.map(At), n, o), t.forEach((a, s) => {
|
|
1796
|
+
const l = [...o, s], d = e[a.axis].findIndex((c) => c.id === a.levelId);
|
|
1737
1797
|
if (d < 0 && g(n, l, "Sort level is not on its axis."), a.scope.kind === "branch" && ($(
|
|
1738
1798
|
e,
|
|
1739
1799
|
a.axis,
|
|
@@ -1758,35 +1818,35 @@ function It(e, t, n, o) {
|
|
|
1758
1818
|
}
|
|
1759
1819
|
});
|
|
1760
1820
|
}
|
|
1761
|
-
function
|
|
1821
|
+
function q(e, t, n, o) {
|
|
1762
1822
|
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) && g(
|
|
1763
1823
|
n,
|
|
1764
1824
|
o,
|
|
1765
1825
|
"Field source must belong to the same semantic domain or physical connection."
|
|
1766
1826
|
);
|
|
1767
1827
|
}
|
|
1768
|
-
function
|
|
1828
|
+
function oe(e, t, n) {
|
|
1769
1829
|
(e.defaultAggregate === "MEDIAN" || Object.values(e.inputs).some(
|
|
1770
1830
|
(o) => o.aggregate === "MEDIAN" || o.field.aggregate === "MEDIAN"
|
|
1771
1831
|
)) && g(t, n, "MEDIAN dependencies are not supported at launch."), (e.aggregationBehavior === "snapshot" || e.aggregationBehavior === "weighted" || e.aggregationStrategy === "weighted") && g(t, n, "This measure semantic requires a later capability.");
|
|
1772
1832
|
}
|
|
1773
|
-
function
|
|
1774
|
-
|
|
1833
|
+
function Ft(e, t) {
|
|
1834
|
+
A(
|
|
1775
1835
|
[...e.rows, ...e.columns, ...e.measures].map((a) => a.id),
|
|
1776
1836
|
t,
|
|
1777
1837
|
[]
|
|
1778
|
-
),
|
|
1838
|
+
), A(
|
|
1779
1839
|
e.rankings.map((a) => a.id),
|
|
1780
1840
|
t,
|
|
1781
1841
|
["rankings"]
|
|
1782
|
-
),
|
|
1842
|
+
), A(
|
|
1783
1843
|
e.rankings.map((a) => JSON.stringify([a.axis, a.levelId])),
|
|
1784
1844
|
t,
|
|
1785
1845
|
["rankings"]
|
|
1786
1846
|
);
|
|
1787
1847
|
for (const a of ["rows", "columns"])
|
|
1788
|
-
e[a].forEach((
|
|
1789
|
-
|
|
1848
|
+
e[a].forEach((s, l) => {
|
|
1849
|
+
s.grain && s.field.dataType !== void 0 && !["date", "datetime", "unknown"].includes(s.field.dataType) && g(t, [a, l, "grain"], "Grain requires a temporal field.");
|
|
1790
1850
|
});
|
|
1791
1851
|
const n = [
|
|
1792
1852
|
...e.rows,
|
|
@@ -1794,7 +1854,7 @@ function kt(e, t) {
|
|
|
1794
1854
|
...e.measures.filter((a) => a.kind === "aggregate")
|
|
1795
1855
|
];
|
|
1796
1856
|
for (const a of n)
|
|
1797
|
-
if (
|
|
1857
|
+
if (q(a.field.source, e.source, t, [
|
|
1798
1858
|
a.id,
|
|
1799
1859
|
"field",
|
|
1800
1860
|
"source"
|
|
@@ -1803,9 +1863,9 @@ function kt(e, t) {
|
|
|
1803
1863
|
t,
|
|
1804
1864
|
[a.id],
|
|
1805
1865
|
"Aggregate-stage calculations cannot be grouped or wrapped in an aggregate."
|
|
1806
|
-
),
|
|
1807
|
-
for (const
|
|
1808
|
-
|
|
1866
|
+
), oe(a.field.derivedField, t, [a.id]);
|
|
1867
|
+
for (const s of Object.values(a.field.derivedField.inputs))
|
|
1868
|
+
q(s.field.source, e.source, t, [a.id, "inputs"]);
|
|
1809
1869
|
}
|
|
1810
1870
|
for (const a of e.measures)
|
|
1811
1871
|
if (a.kind === "calculated") {
|
|
@@ -1813,72 +1873,72 @@ function kt(e, t) {
|
|
|
1813
1873
|
t,
|
|
1814
1874
|
[a.id],
|
|
1815
1875
|
"Calculated measures require aggregate stage and measure role."
|
|
1816
|
-
),
|
|
1817
|
-
for (const
|
|
1818
|
-
|
|
1876
|
+
), oe(a.definition, t, [a.id]);
|
|
1877
|
+
for (const s of Object.values(a.definition.inputs))
|
|
1878
|
+
q(s.field.source, e.source, t, [
|
|
1819
1879
|
a.id,
|
|
1820
1880
|
"inputs"
|
|
1821
1881
|
]);
|
|
1822
1882
|
}
|
|
1823
1883
|
const o = (a) => {
|
|
1824
|
-
const
|
|
1884
|
+
const s = (l, d) => {
|
|
1825
1885
|
var c, u;
|
|
1826
1886
|
if ((l.aggregate || ((c = l.derivedField) == null ? void 0 : c.computeStage) === "aggregate") && g(t, d, "Aggregate/HAVING filters are not supported."), l.derivedField) {
|
|
1827
|
-
|
|
1887
|
+
oe(l.derivedField, t, d);
|
|
1828
1888
|
for (const m of Object.values(l.derivedField.inputs))
|
|
1829
|
-
|
|
1889
|
+
q(m.field.source, e.source, t, d);
|
|
1830
1890
|
}
|
|
1831
1891
|
for (const m of ((u = l.calculatedFormula) == null ? void 0 : u.inputFields) ?? [])
|
|
1832
|
-
|
|
1892
|
+
s(m, d);
|
|
1833
1893
|
};
|
|
1834
1894
|
for (const l of a.conditions)
|
|
1835
|
-
|
|
1895
|
+
s(l.field, ["filters", l.id]);
|
|
1836
1896
|
a.groups.forEach(o);
|
|
1837
1897
|
};
|
|
1838
1898
|
if (e.filters && o(e.filters), e.joinPlan) {
|
|
1839
1899
|
const a = [
|
|
1840
1900
|
e.joinPlan.baseEntity,
|
|
1841
|
-
...e.joinPlan.joins.flatMap((
|
|
1901
|
+
...e.joinPlan.joins.flatMap((s) => [s.source, s.target])
|
|
1842
1902
|
];
|
|
1843
|
-
(new Set(a.map((
|
|
1844
|
-
e.joinPlan.joins.map((
|
|
1903
|
+
(new Set(a.map((s) => s.connectionId)).size > 1 || e.source.kind === "physical" && a[0].connectionId !== e.source.connectionId) && g(t, ["joinPlan"], "Joins must stay within the source connection."), A(
|
|
1904
|
+
e.joinPlan.joins.map((s) => s.id),
|
|
1845
1905
|
t,
|
|
1846
1906
|
["joinPlan", "joins"]
|
|
1847
1907
|
);
|
|
1848
1908
|
}
|
|
1849
|
-
|
|
1850
|
-
(!e[a.axis].some((l) => l.id === a.levelId) || !e.measures.some((l) => l.id === a.measureId)) && g(t, ["rankings",
|
|
1909
|
+
xt(e, e.sorts, t, ["sorts"]), e.rankings.forEach((a, s) => {
|
|
1910
|
+
(!e[a.axis].some((l) => l.id === a.levelId) || !e.measures.some((l) => l.id === a.measureId)) && g(t, ["rankings", s], "Unknown ranking level or measure."), $(
|
|
1851
1911
|
e,
|
|
1852
1912
|
a.axis === "rows" ? "columns" : "rows",
|
|
1853
1913
|
a.oppositePath,
|
|
1854
1914
|
t,
|
|
1855
|
-
["rankings",
|
|
1915
|
+
["rankings", s, "oppositePath"],
|
|
1856
1916
|
!0
|
|
1857
1917
|
);
|
|
1858
1918
|
});
|
|
1859
1919
|
}
|
|
1860
|
-
const Y =
|
|
1861
|
-
rows: i.array(
|
|
1862
|
-
measures: i.array(
|
|
1863
|
-
}),
|
|
1920
|
+
const Y = wt.superRefine(Ft), cn = wt.extend({
|
|
1921
|
+
rows: i.array(ce).readonly(),
|
|
1922
|
+
measures: i.array(It).readonly()
|
|
1923
|
+
}), pn = cn.superRefine(Ft), mn = Y.innerType().extend({ kind: i.literal("matrix") }), fn = mn.superRefine(({ kind: e, ...t }, n) => {
|
|
1864
1924
|
const o = Y.safeParse(t);
|
|
1865
1925
|
o.success || o.error.issues.forEach((a) => n.addIssue(a));
|
|
1866
|
-
}),
|
|
1926
|
+
}), Ye = i.object({
|
|
1867
1927
|
visible: i.boolean(),
|
|
1868
1928
|
position: i.enum(["before", "after"]),
|
|
1869
1929
|
label: i.string().optional()
|
|
1870
|
-
}).strict(),
|
|
1871
|
-
grand:
|
|
1872
|
-
levels: i.record(S,
|
|
1873
|
-
}).strict(),
|
|
1874
|
-
rules: i.array(
|
|
1875
|
-
target:
|
|
1876
|
-
rowRoles: i.array(
|
|
1930
|
+
}).strict(), Pe = i.object({
|
|
1931
|
+
grand: Ye,
|
|
1932
|
+
levels: i.record(S, Ye).readonly()
|
|
1933
|
+
}).strict(), Be = yt.shape.rules.element, gn = yt.extend({
|
|
1934
|
+
rules: i.array(Be.extend({
|
|
1935
|
+
target: Be.shape.target.extend({
|
|
1936
|
+
rowRoles: i.array(Ni).optional()
|
|
1877
1937
|
})
|
|
1878
1938
|
}))
|
|
1879
1939
|
}).superRefine((e, t) => {
|
|
1880
1940
|
var n;
|
|
1881
|
-
|
|
1941
|
+
A(e.rules.map((o) => o.id), t, ["rules"]);
|
|
1882
1942
|
for (const o of e.rules) {
|
|
1883
1943
|
const a = o.condition;
|
|
1884
1944
|
a.kind === "topBottom" && g(
|
|
@@ -1900,13 +1960,13 @@ const Y = vt.superRefine(kt), sn = vt.extend({
|
|
|
1900
1960
|
);
|
|
1901
1961
|
}
|
|
1902
1962
|
});
|
|
1903
|
-
function
|
|
1904
|
-
for (const
|
|
1905
|
-
const l = [...a, "rules",
|
|
1906
|
-
d && (d.levelId !== void 0 && !t[d.axis].some((c) => c.id === d.levelId) && g(o, [...l, "target", "matrix", "levelId"], "Conditional-format level is not on the selected axis."), d.oppositePath !== void 0 && $(t, d.axis === "rows" ? "columns" : "rows", d.oppositePath, o, [...l, "target", "matrix", "oppositePath"])),
|
|
1963
|
+
function hn(e, t, n, o, a = []) {
|
|
1964
|
+
for (const s of e.rules) {
|
|
1965
|
+
const l = [...a, "rules", s.id], d = s.target.matrix;
|
|
1966
|
+
d && (d.levelId !== void 0 && !t[d.axis].some((c) => c.id === d.levelId) && g(o, [...l, "target", "matrix", "levelId"], "Conditional-format level is not on the selected axis."), d.oppositePath !== void 0 && $(t, d.axis === "rows" ? "columns" : "rows", d.oppositePath, o, [...l, "target", "matrix", "oppositePath"])), Zi(s).validationRefs.some((c) => !n.has(c)) && g(o, l, "Conditional rules must reference displayed measures.");
|
|
1907
1967
|
}
|
|
1908
1968
|
}
|
|
1909
|
-
const
|
|
1969
|
+
const _n = {
|
|
1910
1970
|
layout: i.discriminatedUnion("kind", [
|
|
1911
1971
|
i.object({ kind: i.literal("compact") }).strict(),
|
|
1912
1972
|
i.object({ kind: i.literal("tabular"), repeatLabels: i.boolean() }).strict()
|
|
@@ -1914,27 +1974,27 @@ const pn = {
|
|
|
1914
1974
|
absence: i.object({ emptyText: i.string(), nullText: i.string() }).strict(),
|
|
1915
1975
|
levelLabels: i.record(S, i.string()).readonly(),
|
|
1916
1976
|
measureLabels: i.record(S, i.string()).readonly(),
|
|
1917
|
-
levelFormats: i.record(S,
|
|
1918
|
-
measureFormats: i.record(S,
|
|
1919
|
-
totals: i.object({ rows:
|
|
1920
|
-
conditionalFormatting:
|
|
1921
|
-
},
|
|
1977
|
+
levelFormats: i.record(S, Ee).readonly(),
|
|
1978
|
+
measureFormats: i.record(S, Ee).readonly(),
|
|
1979
|
+
totals: i.object({ rows: Pe, columns: Pe }).strict(),
|
|
1980
|
+
conditionalFormatting: gn.optional()
|
|
1981
|
+
}, xe = i.object(_n).strict(), bn = i.object({
|
|
1922
1982
|
depth: i.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
1923
1983
|
overrides: i.array(
|
|
1924
|
-
i.object({ path:
|
|
1984
|
+
i.object({ path: F, expanded: i.boolean() }).strict()
|
|
1925
1985
|
).readonly()
|
|
1926
|
-
}).strict(),
|
|
1927
|
-
(e, t) =>
|
|
1928
|
-
e.overrides.map((n) =>
|
|
1986
|
+
}).strict(), qe = bn.superRefine(
|
|
1987
|
+
(e, t) => A(
|
|
1988
|
+
e.overrides.map((n) => gt(n.path)),
|
|
1929
1989
|
t,
|
|
1930
1990
|
["overrides"]
|
|
1931
1991
|
)
|
|
1932
|
-
),
|
|
1933
|
-
(e, t) =>
|
|
1992
|
+
), yn = { rows: qe, columns: qe }, J = i.object(yn).strict(), vn = J.extend({ sorts: i.array(kt).readonly() }).strict(), Sn = vn.superRefine(
|
|
1993
|
+
(e, t) => A(e.sorts.map(At), t, ["sorts"])
|
|
1934
1994
|
);
|
|
1935
|
-
function
|
|
1995
|
+
function ee(e, t) {
|
|
1936
1996
|
var c;
|
|
1937
|
-
const { spec: n, presentation: o, defaults: a, session:
|
|
1997
|
+
const { spec: n, presentation: o, defaults: a, session: s } = e, l = new Set([...n.rows, ...n.columns].map((u) => u.id)), d = new Set(n.measures.map((u) => u.id));
|
|
1938
1998
|
for (const u of [
|
|
1939
1999
|
"levelLabels",
|
|
1940
2000
|
"levelFormats",
|
|
@@ -1942,10 +2002,10 @@ function J(e, t) {
|
|
|
1942
2002
|
"measureFormats"
|
|
1943
2003
|
]) {
|
|
1944
2004
|
const m = u.startsWith("level") ? l : d;
|
|
1945
|
-
for (const
|
|
1946
|
-
m.has(
|
|
2005
|
+
for (const _ of Object.keys(o[u]))
|
|
2006
|
+
m.has(_) || g(
|
|
1947
2007
|
t,
|
|
1948
|
-
["presentation", u,
|
|
2008
|
+
["presentation", u, _],
|
|
1949
2009
|
"Unknown presentation reference."
|
|
1950
2010
|
);
|
|
1951
2011
|
}
|
|
@@ -1956,34 +2016,34 @@ function J(e, t) {
|
|
|
1956
2016
|
"Measures cannot own temporal bucket formats."
|
|
1957
2017
|
);
|
|
1958
2018
|
for (const [u, m] of Object.entries(o.levelFormats))
|
|
1959
|
-
m.type === "temporal_bucket" && !((c = [...n.rows, ...n.columns].find((
|
|
2019
|
+
m.type === "temporal_bucket" && !((c = [...n.rows, ...n.columns].find((_) => _.id === u)) != null && c.grain) && g(
|
|
1960
2020
|
t,
|
|
1961
2021
|
["presentation", "levelFormats", u],
|
|
1962
2022
|
"Temporal bucket formats require a grain."
|
|
1963
2023
|
);
|
|
1964
2024
|
for (const u of ["rows", "columns"]) {
|
|
1965
2025
|
const m = Object.keys(o.totals[u].levels);
|
|
1966
|
-
(m.length !== n[u].length || m.some((
|
|
2026
|
+
(m.length !== n[u].length || m.some((_) => !n[u].some((y) => y.id === _))) && g(
|
|
1967
2027
|
t,
|
|
1968
2028
|
["presentation", "totals", u],
|
|
1969
2029
|
"Subtotal map must contain exactly the current axis levels."
|
|
1970
2030
|
);
|
|
1971
|
-
for (const
|
|
1972
|
-
for (const
|
|
2031
|
+
for (const _ of [a, ...s ? [s] : []])
|
|
2032
|
+
for (const y of _[u].overrides)
|
|
1973
2033
|
$(
|
|
1974
2034
|
n,
|
|
1975
2035
|
u,
|
|
1976
|
-
|
|
2036
|
+
y.path,
|
|
1977
2037
|
t,
|
|
1978
2038
|
[u, "overrides"],
|
|
1979
2039
|
!0
|
|
1980
|
-
),
|
|
2040
|
+
), y.path.length || g(
|
|
1981
2041
|
t,
|
|
1982
2042
|
[u, "overrides"],
|
|
1983
2043
|
"Use depth to expand/collapse the root."
|
|
1984
2044
|
);
|
|
1985
2045
|
}
|
|
1986
|
-
|
|
2046
|
+
s && xt(n, s.sorts, t, ["session", "sorts"]), o.conditionalFormatting && hn(
|
|
1987
2047
|
o.conditionalFormatting,
|
|
1988
2048
|
n,
|
|
1989
2049
|
d,
|
|
@@ -1991,32 +2051,32 @@ function J(e, t) {
|
|
|
1991
2051
|
["presentation", "conditionalFormatting"]
|
|
1992
2052
|
);
|
|
1993
2053
|
}
|
|
1994
|
-
const
|
|
2054
|
+
const In = i.object({
|
|
1995
2055
|
spec: Y,
|
|
1996
|
-
presentation:
|
|
1997
|
-
defaults:
|
|
1998
|
-
session:
|
|
1999
|
-
}).strict(),
|
|
2056
|
+
presentation: xe,
|
|
2057
|
+
defaults: J,
|
|
2058
|
+
session: Sn.optional()
|
|
2059
|
+
}).strict(), Ca = In.superRefine(ee), kn = i.object({
|
|
2000
2060
|
version: i.literal(1),
|
|
2001
2061
|
spec: Y,
|
|
2002
|
-
presentation:
|
|
2003
|
-
defaultView:
|
|
2004
|
-
}).strict(),
|
|
2005
|
-
(e, t) =>
|
|
2006
|
-
),
|
|
2007
|
-
spec:
|
|
2008
|
-
}),
|
|
2009
|
-
|
|
2062
|
+
presentation: xe,
|
|
2063
|
+
defaultView: J
|
|
2064
|
+
}).strict(), wn = kn.superRefine(
|
|
2065
|
+
(e, t) => ee({ ...e, defaults: e.defaultView }, t)
|
|
2066
|
+
), An = wn.innerType().extend({
|
|
2067
|
+
spec: pn
|
|
2068
|
+
}), Oa = An.superRefine((e, t) => ee({ ...e, defaults: e.defaultView }, t)), Le = i.object({ spec: Y, presentation: xe }).strict(), xn = i.union([
|
|
2069
|
+
Le.extend({
|
|
2010
2070
|
mode: i.literal("layout"),
|
|
2011
2071
|
format: i.enum(["csv", "xlsx", "pdf"]),
|
|
2012
2072
|
expansion: i.union([
|
|
2013
|
-
|
|
2073
|
+
J.extend({ kind: i.literal("current") }).strict(),
|
|
2014
2074
|
i.object({ kind: i.literal("all") }).strict()
|
|
2015
2075
|
])
|
|
2016
2076
|
}).strict(),
|
|
2017
|
-
|
|
2018
|
-
]),
|
|
2019
|
-
(e, t) =>
|
|
2077
|
+
Le.extend({ mode: i.literal("flat"), format: i.literal("csv") }).strict()
|
|
2078
|
+
]), Ya = xn.superRefine(
|
|
2079
|
+
(e, t) => ee(
|
|
2020
2080
|
{
|
|
2021
2081
|
...e,
|
|
2022
2082
|
defaults: e.mode === "layout" && e.expansion.kind === "current" ? e.expansion : {
|
|
@@ -2027,17 +2087,17 @@ const _n = i.object({
|
|
|
2027
2087
|
t
|
|
2028
2088
|
)
|
|
2029
2089
|
);
|
|
2030
|
-
function
|
|
2090
|
+
function Pa(e) {
|
|
2031
2091
|
return e && "id" in e ? e.id : void 0;
|
|
2032
2092
|
}
|
|
2033
|
-
const
|
|
2093
|
+
const Fn = "SUM";
|
|
2034
2094
|
function k(e) {
|
|
2035
2095
|
return typeof e == "string" && e.trim().length > 0;
|
|
2036
2096
|
}
|
|
2037
2097
|
function N(e) {
|
|
2038
2098
|
return k(e) ? e.trim().toLowerCase() : "";
|
|
2039
2099
|
}
|
|
2040
|
-
function
|
|
2100
|
+
function Ba(e) {
|
|
2041
2101
|
const t = k(e.id) ? e.id.trim() : void 0;
|
|
2042
2102
|
if (!t) return;
|
|
2043
2103
|
const n = N(t), o = k(e.table) ? e.table.trim() : void 0;
|
|
@@ -2049,7 +2109,7 @@ function T(e) {
|
|
|
2049
2109
|
if (t)
|
|
2050
2110
|
return N(t) === N(e.datasetName) ? void 0 : t;
|
|
2051
2111
|
}
|
|
2052
|
-
function
|
|
2112
|
+
function Rt(e) {
|
|
2053
2113
|
if (e.kind !== "semantic") return e;
|
|
2054
2114
|
const t = T(e), { datasetId: n, ...o } = e;
|
|
2055
2115
|
return {
|
|
@@ -2057,10 +2117,10 @@ function wt(e) {
|
|
|
2057
2117
|
...t ? { datasetId: t } : {}
|
|
2058
2118
|
};
|
|
2059
2119
|
}
|
|
2060
|
-
function
|
|
2120
|
+
function qa(e) {
|
|
2061
2121
|
return e ? e.kind === "semantic" ? !!(k(e.domainId) && (k(e.datasetId) || k(e.datasetName))) : e.kind === "physical" ? k(e.connectionId) && k(e.tableName) : k(e.connectionId) : !1;
|
|
2062
2122
|
}
|
|
2063
|
-
function
|
|
2123
|
+
function pe(e) {
|
|
2064
2124
|
if (!e)
|
|
2065
2125
|
return "";
|
|
2066
2126
|
if (e.kind === "semantic") {
|
|
@@ -2084,7 +2144,7 @@ function ue(e) {
|
|
|
2084
2144
|
e.label || ""
|
|
2085
2145
|
].join(":");
|
|
2086
2146
|
}
|
|
2087
|
-
function
|
|
2147
|
+
function Fe(e, t) {
|
|
2088
2148
|
if (!e || !t)
|
|
2089
2149
|
return e === t;
|
|
2090
2150
|
if (e.kind !== t.kind)
|
|
@@ -2095,10 +2155,10 @@ function we(e, t) {
|
|
|
2095
2155
|
const n = T(e), o = T(t);
|
|
2096
2156
|
return n && o ? n === o : e.datasetName === t.datasetName;
|
|
2097
2157
|
}
|
|
2098
|
-
return
|
|
2158
|
+
return pe(e) === pe(t);
|
|
2099
2159
|
}
|
|
2100
|
-
function
|
|
2101
|
-
return e.kind !== "semantic" || t.kind !== "semantic" ? e :
|
|
2160
|
+
function Tt(e, t) {
|
|
2161
|
+
return e.kind !== "semantic" || t.kind !== "semantic" ? e : Rt({
|
|
2102
2162
|
...e,
|
|
2103
2163
|
datasetName: e.datasetName || t.datasetName,
|
|
2104
2164
|
datasetId: T(e) || T(t),
|
|
@@ -2106,79 +2166,79 @@ function At(e, t) {
|
|
|
2106
2166
|
connectionId: e.connectionId || t.connectionId
|
|
2107
2167
|
});
|
|
2108
2168
|
}
|
|
2109
|
-
function
|
|
2169
|
+
function La(e) {
|
|
2110
2170
|
const t = [];
|
|
2111
2171
|
for (const n of e) {
|
|
2112
|
-
const o =
|
|
2172
|
+
const o = Rt(
|
|
2113
2173
|
n
|
|
2114
2174
|
), a = t.findIndex(
|
|
2115
|
-
(
|
|
2175
|
+
(s) => Fe(s, o)
|
|
2116
2176
|
);
|
|
2117
2177
|
if (a === -1) {
|
|
2118
2178
|
t.push(o);
|
|
2119
2179
|
continue;
|
|
2120
2180
|
}
|
|
2121
|
-
t[a] =
|
|
2181
|
+
t[a] = Tt(
|
|
2122
2182
|
t[a],
|
|
2123
2183
|
o
|
|
2124
2184
|
);
|
|
2125
2185
|
}
|
|
2126
2186
|
return t;
|
|
2127
2187
|
}
|
|
2128
|
-
function
|
|
2129
|
-
return e.name === t.name &&
|
|
2188
|
+
function Rn(e, t) {
|
|
2189
|
+
return e.name === t.name && Fe(e.source, t.source);
|
|
2130
2190
|
}
|
|
2131
|
-
function
|
|
2191
|
+
function Ua(e) {
|
|
2132
2192
|
return [
|
|
2133
|
-
e.source ?
|
|
2134
|
-
|
|
2193
|
+
e.source ? pe(e.source) : "unknown",
|
|
2194
|
+
Mt(e),
|
|
2135
2195
|
e.name
|
|
2136
2196
|
].filter(Boolean).join(":");
|
|
2137
2197
|
}
|
|
2138
|
-
function
|
|
2139
|
-
return
|
|
2140
|
-
e.aggregate ||
|
|
2198
|
+
function Mt(e) {
|
|
2199
|
+
return Tn(
|
|
2200
|
+
e.aggregate || Fn
|
|
2141
2201
|
);
|
|
2142
2202
|
}
|
|
2143
|
-
function
|
|
2203
|
+
function Tn(e) {
|
|
2144
2204
|
return e.trim().toUpperCase();
|
|
2145
2205
|
}
|
|
2146
|
-
function
|
|
2206
|
+
function Va(e, t) {
|
|
2147
2207
|
return {
|
|
2148
2208
|
...e,
|
|
2149
2209
|
label: e.label || t.label,
|
|
2150
2210
|
role: e.role || t.role,
|
|
2151
2211
|
dataType: e.dataType || t.dataType,
|
|
2152
|
-
source: e.source && t.source ?
|
|
2212
|
+
source: e.source && t.source ? Tt(e.source, t.source) : e.source || t.source
|
|
2153
2213
|
};
|
|
2154
2214
|
}
|
|
2155
|
-
function
|
|
2215
|
+
function Mn(e) {
|
|
2156
2216
|
for (let t = 0; t < e.length; t += 1) {
|
|
2157
2217
|
const n = e[t];
|
|
2158
2218
|
if (e.some(
|
|
2159
|
-
(o, a) => a !== t &&
|
|
2219
|
+
(o, a) => a !== t && Nt(o, n)
|
|
2160
2220
|
))
|
|
2161
2221
|
return !1;
|
|
2162
2222
|
}
|
|
2163
2223
|
return !0;
|
|
2164
2224
|
}
|
|
2165
|
-
function
|
|
2166
|
-
return
|
|
2225
|
+
function Dt(e, t) {
|
|
2226
|
+
return Rn(e, t);
|
|
2167
2227
|
}
|
|
2168
|
-
function
|
|
2169
|
-
return
|
|
2228
|
+
function Nt(e, t) {
|
|
2229
|
+
return Dt(e, t) && C(e) === C(t);
|
|
2170
2230
|
}
|
|
2171
|
-
function
|
|
2231
|
+
function Dn(e) {
|
|
2172
2232
|
return `Metric intent has duplicate measure "${e.name}" with the same aggregate (${C(e)}). Use different aggregates to request both, or remove one entry.`;
|
|
2173
2233
|
}
|
|
2174
|
-
function
|
|
2234
|
+
function Ue(e) {
|
|
2175
2235
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
2176
2236
|
}
|
|
2177
|
-
function
|
|
2237
|
+
function Nn(e, t, n) {
|
|
2178
2238
|
if (e !== void 0) {
|
|
2179
2239
|
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
2180
2240
|
n.push(
|
|
2181
|
-
|
|
2241
|
+
r(
|
|
2182
2242
|
"invalid_sql_default_parameters",
|
|
2183
2243
|
"SQL defaultParameters must be an object keyed by parameter name.",
|
|
2184
2244
|
t
|
|
@@ -2189,7 +2249,7 @@ function Fn(e, t, n) {
|
|
|
2189
2249
|
Object.entries(e).forEach(([o, a]) => {
|
|
2190
2250
|
if (!o.trim()) {
|
|
2191
2251
|
n.push(
|
|
2192
|
-
|
|
2252
|
+
r(
|
|
2193
2253
|
"invalid_sql_default_parameter_name",
|
|
2194
2254
|
"SQL defaultParameters names must be non-empty strings.",
|
|
2195
2255
|
`${t}.${o}`
|
|
@@ -2197,8 +2257,8 @@ function Fn(e, t, n) {
|
|
|
2197
2257
|
);
|
|
2198
2258
|
return;
|
|
2199
2259
|
}
|
|
2200
|
-
(Array.isArray(a) ? a.every(
|
|
2201
|
-
|
|
2260
|
+
(Array.isArray(a) ? a.every(Ue) : Ue(a)) || n.push(
|
|
2261
|
+
r(
|
|
2202
2262
|
"invalid_sql_default_parameter_value",
|
|
2203
2263
|
"SQL defaultParameters values must be strings, numbers, booleans, nulls, or arrays of those scalar values.",
|
|
2204
2264
|
`${t}.${o}`
|
|
@@ -2207,72 +2267,72 @@ function Fn(e, t, n) {
|
|
|
2207
2267
|
});
|
|
2208
2268
|
}
|
|
2209
2269
|
}
|
|
2210
|
-
function
|
|
2211
|
-
return
|
|
2270
|
+
function En(e, t) {
|
|
2271
|
+
return Re(e, t).length === 1;
|
|
2212
2272
|
}
|
|
2213
|
-
function
|
|
2214
|
-
return
|
|
2273
|
+
function jn(e, t) {
|
|
2274
|
+
return Re(e, t).length === 1;
|
|
2215
2275
|
}
|
|
2216
|
-
function
|
|
2276
|
+
function Re(e, t) {
|
|
2217
2277
|
return t.filter(
|
|
2218
|
-
(o) =>
|
|
2278
|
+
(o) => $n(e, o)
|
|
2219
2279
|
);
|
|
2220
2280
|
}
|
|
2221
|
-
function
|
|
2222
|
-
return
|
|
2281
|
+
function $n(e, t) {
|
|
2282
|
+
return Cn(e, t) ? e.source ? Dt(t, e) : !0 : !1;
|
|
2223
2283
|
}
|
|
2224
|
-
function
|
|
2225
|
-
return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role ||
|
|
2284
|
+
function Cn(e, t) {
|
|
2285
|
+
return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role || On(e, t) && C(t) !== C(e));
|
|
2226
2286
|
}
|
|
2227
|
-
function
|
|
2287
|
+
function On(e, t) {
|
|
2228
2288
|
return e.role === "measure" || t.role === "measure" || e.aggregate !== void 0 || t.aggregate !== void 0;
|
|
2229
2289
|
}
|
|
2230
2290
|
function C(e) {
|
|
2231
|
-
return
|
|
2291
|
+
return Mt(e);
|
|
2232
2292
|
}
|
|
2233
|
-
const
|
|
2234
|
-
function
|
|
2293
|
+
const Yn = /^(\d{4})-(\d{2})-(\d{2})$/, Et = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
2294
|
+
function me(e) {
|
|
2235
2295
|
if (typeof e != "string")
|
|
2236
2296
|
return null;
|
|
2237
|
-
const t = e.trim(), n =
|
|
2297
|
+
const t = e.trim(), n = Yn.exec(t);
|
|
2238
2298
|
if (n) {
|
|
2239
|
-
const [,
|
|
2240
|
-
return
|
|
2299
|
+
const [, y, w, h] = n;
|
|
2300
|
+
return Ve(y, w, h) ? new Date(Date.UTC(Number(y), Number(w) - 1, Number(h))) : null;
|
|
2241
2301
|
}
|
|
2242
|
-
const o =
|
|
2302
|
+
const o = Et.exec(t);
|
|
2243
2303
|
if (!o)
|
|
2244
2304
|
return null;
|
|
2245
|
-
const [, a,
|
|
2246
|
-
if (!
|
|
2305
|
+
const [, a, s, l, d, c, u = "00", , m] = o;
|
|
2306
|
+
if (!Ve(a, s, l) || !E(d, 0, 23) || !E(c, 0, 59) || !E(u, 0, 59) || !Pn(m))
|
|
2247
2307
|
return null;
|
|
2248
|
-
const
|
|
2249
|
-
return Number.isFinite(
|
|
2308
|
+
const _ = new Date(t);
|
|
2309
|
+
return Number.isFinite(_.getTime()) ? _ : null;
|
|
2250
2310
|
}
|
|
2251
|
-
function
|
|
2252
|
-
return typeof e != "string" || !
|
|
2311
|
+
function Ha(e) {
|
|
2312
|
+
return typeof e != "string" || !Et.test(e.trim()) ? null : me(e);
|
|
2253
2313
|
}
|
|
2254
|
-
function
|
|
2255
|
-
const o = Number(e), a = Number(t),
|
|
2256
|
-
if (!Number.isInteger(o) || !Number.isInteger(a) || !Number.isInteger(
|
|
2314
|
+
function Ve(e, t, n) {
|
|
2315
|
+
const o = Number(e), a = Number(t), s = Number(n);
|
|
2316
|
+
if (!Number.isInteger(o) || !Number.isInteger(a) || !Number.isInteger(s) || a < 1 || a > 12)
|
|
2257
2317
|
return !1;
|
|
2258
|
-
const l = new Date(Date.UTC(o, a - 1,
|
|
2259
|
-
return l.getUTCFullYear() === o && l.getUTCMonth() === a - 1 && l.getUTCDate() ===
|
|
2318
|
+
const l = new Date(Date.UTC(o, a - 1, s));
|
|
2319
|
+
return l.getUTCFullYear() === o && l.getUTCMonth() === a - 1 && l.getUTCDate() === s;
|
|
2260
2320
|
}
|
|
2261
2321
|
function E(e, t, n) {
|
|
2262
2322
|
const o = Number(e);
|
|
2263
2323
|
return Number.isInteger(o) && o >= t && o <= n;
|
|
2264
2324
|
}
|
|
2265
|
-
function
|
|
2325
|
+
function Pn(e) {
|
|
2266
2326
|
if (e === "Z")
|
|
2267
2327
|
return !0;
|
|
2268
2328
|
const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
|
|
2269
2329
|
return !!(t && E(t[2], 0, 23) && E(t[3], 0, 59));
|
|
2270
2330
|
}
|
|
2271
|
-
function
|
|
2331
|
+
function He(e, t, n) {
|
|
2272
2332
|
if (e !== void 0) {
|
|
2273
2333
|
if (!f(e)) {
|
|
2274
2334
|
n.push(
|
|
2275
|
-
|
|
2335
|
+
r(
|
|
2276
2336
|
"invalid_pagination",
|
|
2277
2337
|
"Pagination must be an object with positive integer page and pageSize.",
|
|
2278
2338
|
t
|
|
@@ -2281,13 +2341,13 @@ function qe(e, t, n) {
|
|
|
2281
2341
|
return;
|
|
2282
2342
|
}
|
|
2283
2343
|
(!Number.isInteger(e.page) || typeof e.page != "number" || e.page < 1) && n.push(
|
|
2284
|
-
|
|
2344
|
+
r(
|
|
2285
2345
|
"invalid_pagination_page",
|
|
2286
2346
|
"Pagination page must be a positive integer.",
|
|
2287
2347
|
`${t}.page`
|
|
2288
2348
|
)
|
|
2289
2349
|
), (!Number.isInteger(e.pageSize) || typeof e.pageSize != "number" || e.pageSize < 1) && n.push(
|
|
2290
|
-
|
|
2350
|
+
r(
|
|
2291
2351
|
"invalid_pagination_page_size",
|
|
2292
2352
|
"Pagination pageSize must be a positive integer.",
|
|
2293
2353
|
`${t}.pageSize`
|
|
@@ -2295,7 +2355,7 @@ function qe(e, t, n) {
|
|
|
2295
2355
|
);
|
|
2296
2356
|
}
|
|
2297
2357
|
}
|
|
2298
|
-
function
|
|
2358
|
+
function Ge(e) {
|
|
2299
2359
|
const t = /* @__PURE__ */ new Set();
|
|
2300
2360
|
for (const n of e) {
|
|
2301
2361
|
if (t.has(n))
|
|
@@ -2304,10 +2364,10 @@ function Le(e) {
|
|
|
2304
2364
|
}
|
|
2305
2365
|
return null;
|
|
2306
2366
|
}
|
|
2307
|
-
function
|
|
2367
|
+
function Bn(e, t, n) {
|
|
2308
2368
|
if (!f(e)) {
|
|
2309
2369
|
n.push(
|
|
2310
|
-
|
|
2370
|
+
r(
|
|
2311
2371
|
"invalid_input_binding",
|
|
2312
2372
|
"Input bindings must be structured objects.",
|
|
2313
2373
|
t
|
|
@@ -2316,27 +2376,27 @@ function $n(e, t, n) {
|
|
|
2316
2376
|
return;
|
|
2317
2377
|
}
|
|
2318
2378
|
p(e.inputId) || n.push(
|
|
2319
|
-
|
|
2379
|
+
r(
|
|
2320
2380
|
"invalid_input_binding",
|
|
2321
2381
|
"Input bindings need a non-empty inputId.",
|
|
2322
2382
|
`${t}.inputId`
|
|
2323
2383
|
)
|
|
2324
2384
|
), e.kind !== void 0 && e.kind !== "filter" && e.kind !== "control" && n.push(
|
|
2325
|
-
|
|
2385
|
+
r(
|
|
2326
2386
|
"invalid_input_binding",
|
|
2327
2387
|
"Input binding kind must be filter or control.",
|
|
2328
2388
|
`${t}.kind`
|
|
2329
2389
|
)
|
|
2330
|
-
), e.field !== void 0 && b(e.field, `${t}.field`, n), e.relationshipHint !== void 0 &&
|
|
2390
|
+
), e.field !== void 0 && b(e.field, `${t}.field`, n), e.relationshipHint !== void 0 && Te(
|
|
2331
2391
|
e.relationshipHint,
|
|
2332
2392
|
`${t}.relationshipHint`,
|
|
2333
2393
|
n
|
|
2334
2394
|
);
|
|
2335
2395
|
}
|
|
2336
|
-
function
|
|
2396
|
+
function Te(e, t, n) {
|
|
2337
2397
|
if (!f(e)) {
|
|
2338
2398
|
n.push(
|
|
2339
|
-
|
|
2399
|
+
r(
|
|
2340
2400
|
"invalid_relationship_hint",
|
|
2341
2401
|
"Relationship hints must be structured objects.",
|
|
2342
2402
|
t
|
|
@@ -2345,39 +2405,39 @@ function xe(e, t, n) {
|
|
|
2345
2405
|
return;
|
|
2346
2406
|
}
|
|
2347
2407
|
e.relationshipIds !== void 0 && (!Array.isArray(e.relationshipIds) || e.relationshipIds.some((o) => !p(o))) && n.push(
|
|
2348
|
-
|
|
2408
|
+
r(
|
|
2349
2409
|
"invalid_relationship_hint",
|
|
2350
2410
|
"Relationship hint relationshipIds must be non-empty strings.",
|
|
2351
2411
|
`${t}.relationshipIds`
|
|
2352
2412
|
)
|
|
2353
2413
|
);
|
|
2354
2414
|
}
|
|
2355
|
-
function
|
|
2415
|
+
function qn(e, t) {
|
|
2356
2416
|
var o, a;
|
|
2357
2417
|
if (((o = e.source) == null ? void 0 : o.kind) !== "semantic" && ((a = e.source) == null ? void 0 : a.kind) !== "physical" && t.push(
|
|
2358
|
-
|
|
2418
|
+
r(
|
|
2359
2419
|
"invalid_input_options_source",
|
|
2360
2420
|
"Input options must use a semantic or physical source.",
|
|
2361
2421
|
"source"
|
|
2362
2422
|
)
|
|
2363
2423
|
), p(e.inputId) || t.push(
|
|
2364
|
-
|
|
2424
|
+
r(
|
|
2365
2425
|
"missing_input_options_input_id",
|
|
2366
2426
|
"Input options intent needs the inputId it populates.",
|
|
2367
2427
|
"inputId"
|
|
2368
2428
|
)
|
|
2369
2429
|
), e.search !== void 0 && typeof e.search != "string" && t.push(
|
|
2370
|
-
|
|
2430
|
+
r(
|
|
2371
2431
|
"invalid_input_options_search",
|
|
2372
2432
|
"Input options search must be a string.",
|
|
2373
2433
|
"search"
|
|
2374
2434
|
)
|
|
2375
2435
|
), e.matchValues !== void 0) {
|
|
2376
|
-
const
|
|
2377
|
-
|
|
2378
|
-
|
|
2436
|
+
const s = qt(e.matchValues);
|
|
2437
|
+
s.ok || t.push(
|
|
2438
|
+
r("invalid_input_options_match_values", s.error, "matchValues")
|
|
2379
2439
|
), typeof e.search == "string" && e.search.trim() && t.push(
|
|
2380
|
-
|
|
2440
|
+
r(
|
|
2381
2441
|
"invalid_input_options_match_values",
|
|
2382
2442
|
"Input options matchValues cannot be combined with search.",
|
|
2383
2443
|
"matchValues"
|
|
@@ -2385,13 +2445,13 @@ function Cn(e, t) {
|
|
|
2385
2445
|
);
|
|
2386
2446
|
}
|
|
2387
2447
|
if (e.limit !== void 0 && (typeof e.limit != "number" || !Number.isFinite(e.limit) || !Number.isInteger(e.limit) || e.limit <= 0) && t.push(
|
|
2388
|
-
|
|
2448
|
+
r(
|
|
2389
2449
|
"invalid_input_options_limit",
|
|
2390
2450
|
"Input options limit must be a positive finite number.",
|
|
2391
2451
|
"limit"
|
|
2392
2452
|
)
|
|
2393
2453
|
), (!e.labelField || !p(e.labelField.name)) && t.push(
|
|
2394
|
-
|
|
2454
|
+
r(
|
|
2395
2455
|
"missing_input_options_label_field",
|
|
2396
2456
|
"Input options intent needs a labelField.",
|
|
2397
2457
|
"labelField"
|
|
@@ -2399,7 +2459,7 @@ function Cn(e, t) {
|
|
|
2399
2459
|
), b(e.labelField, "labelField", t, {
|
|
2400
2460
|
required: !0
|
|
2401
2461
|
}), (!e.valueField || !p(e.valueField.name)) && t.push(
|
|
2402
|
-
|
|
2462
|
+
r(
|
|
2403
2463
|
"missing_input_options_value_field",
|
|
2404
2464
|
"Input options intent needs a valueField.",
|
|
2405
2465
|
"valueField"
|
|
@@ -2408,12 +2468,12 @@ function Cn(e, t) {
|
|
|
2408
2468
|
required: !0
|
|
2409
2469
|
}), e.searchField !== void 0 && b(e.searchField, "searchField", t, {
|
|
2410
2470
|
required: !0
|
|
2411
|
-
}), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((
|
|
2412
|
-
b(
|
|
2471
|
+
}), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((s, l) => {
|
|
2472
|
+
b(s, `disambiguationFields.${l}`, t, {
|
|
2413
2473
|
required: !0
|
|
2414
2474
|
});
|
|
2415
2475
|
}) : t.push(
|
|
2416
|
-
|
|
2476
|
+
r(
|
|
2417
2477
|
"invalid_input_options_disambiguation_fields",
|
|
2418
2478
|
"Input options disambiguationFields must be an array of field refs.",
|
|
2419
2479
|
"disambiguationFields"
|
|
@@ -2422,71 +2482,71 @@ function Cn(e, t) {
|
|
|
2422
2482
|
{ field: e.labelField, path: "labelField" },
|
|
2423
2483
|
{ field: e.valueField, path: "valueField" },
|
|
2424
2484
|
...e.searchField ? [{ field: e.searchField, path: "searchField" }] : [],
|
|
2425
|
-
...Array.isArray(e.disambiguationFields) ? e.disambiguationFields.map((
|
|
2426
|
-
field:
|
|
2485
|
+
...Array.isArray(e.disambiguationFields) ? e.disambiguationFields.map((s, l) => ({
|
|
2486
|
+
field: s,
|
|
2427
2487
|
path: `disambiguationFields.${l}`
|
|
2428
2488
|
})) : []
|
|
2429
|
-
].forEach(({ field:
|
|
2430
|
-
|
|
2431
|
-
|
|
2489
|
+
].forEach(({ field: s, path: l }) => {
|
|
2490
|
+
s != null && s.source && !Fe(s.source, e.source) && t.push(
|
|
2491
|
+
r(
|
|
2432
2492
|
"input_options_field_source_mismatch",
|
|
2433
2493
|
"Input option fields must belong to the declared option source.",
|
|
2434
2494
|
`${l}.source`
|
|
2435
2495
|
)
|
|
2436
2496
|
);
|
|
2437
2497
|
}), e.dependencies !== void 0) {
|
|
2438
|
-
const
|
|
2498
|
+
const s = Un(
|
|
2439
2499
|
e.dependencies
|
|
2440
2500
|
);
|
|
2441
|
-
t.push(...
|
|
2501
|
+
t.push(...s.errors), s.ok && Hn(e, t);
|
|
2442
2502
|
}
|
|
2443
2503
|
if (e.population !== void 0) {
|
|
2444
|
-
const
|
|
2445
|
-
if (!f(
|
|
2504
|
+
const s = e.population;
|
|
2505
|
+
if (!f(s))
|
|
2446
2506
|
t.push(
|
|
2447
|
-
|
|
2507
|
+
r(
|
|
2448
2508
|
"invalid_input_options_population",
|
|
2449
2509
|
"Input options population must be a structured object.",
|
|
2450
2510
|
"population"
|
|
2451
2511
|
)
|
|
2452
2512
|
);
|
|
2453
2513
|
else {
|
|
2454
|
-
const l =
|
|
2514
|
+
const l = s.kind;
|
|
2455
2515
|
l !== "option_source" && l !== "related_population" && t.push(
|
|
2456
|
-
|
|
2516
|
+
r(
|
|
2457
2517
|
"invalid_input_options_population",
|
|
2458
2518
|
"Input options population kind must be option_source or related_population.",
|
|
2459
2519
|
"population.kind"
|
|
2460
2520
|
)
|
|
2461
|
-
), l === "option_source" &&
|
|
2462
|
-
|
|
2521
|
+
), l === "option_source" && s.baseSource !== void 0 && t.push(
|
|
2522
|
+
r(
|
|
2463
2523
|
"invalid_input_options_population",
|
|
2464
2524
|
"Input options population baseSource is only valid for related_population.",
|
|
2465
2525
|
"population.baseSource"
|
|
2466
2526
|
)
|
|
2467
|
-
), l === "option_source" &&
|
|
2468
|
-
|
|
2527
|
+
), l === "option_source" && s.relationshipHint !== void 0 && t.push(
|
|
2528
|
+
r(
|
|
2469
2529
|
"invalid_input_options_population",
|
|
2470
2530
|
"Input options population relationshipHint is only valid for related_population.",
|
|
2471
2531
|
"population.relationshipHint"
|
|
2472
2532
|
)
|
|
2473
|
-
), l === "related_population" && (
|
|
2474
|
-
|
|
2533
|
+
), l === "related_population" && (be(
|
|
2534
|
+
s.baseSource,
|
|
2475
2535
|
"population.baseSource",
|
|
2476
2536
|
t
|
|
2477
|
-
),
|
|
2478
|
-
|
|
2537
|
+
), s.relationshipHint !== void 0 && Te(
|
|
2538
|
+
s.relationshipHint,
|
|
2479
2539
|
"population.relationshipHint",
|
|
2480
2540
|
t
|
|
2481
2541
|
));
|
|
2482
2542
|
}
|
|
2483
2543
|
}
|
|
2484
2544
|
}
|
|
2485
|
-
function
|
|
2545
|
+
function Ln(e, t) {
|
|
2486
2546
|
if (!(!("inputs" in e) || e.inputs === void 0)) {
|
|
2487
2547
|
if (!Array.isArray(e.inputs)) {
|
|
2488
2548
|
t.push(
|
|
2489
|
-
|
|
2549
|
+
r(
|
|
2490
2550
|
"invalid_input_binding",
|
|
2491
2551
|
"Analytics intent inputs must be an array of input bindings.",
|
|
2492
2552
|
"inputs"
|
|
@@ -2495,15 +2555,15 @@ function On(e, t) {
|
|
|
2495
2555
|
return;
|
|
2496
2556
|
}
|
|
2497
2557
|
e.inputs.forEach(
|
|
2498
|
-
(n, o) =>
|
|
2558
|
+
(n, o) => Bn(n, `inputs.${o}`, t)
|
|
2499
2559
|
);
|
|
2500
2560
|
}
|
|
2501
2561
|
}
|
|
2502
|
-
function
|
|
2562
|
+
function Un(e, t = "protocol") {
|
|
2503
2563
|
const n = [];
|
|
2504
2564
|
if (!f(e))
|
|
2505
2565
|
return n.push(
|
|
2506
|
-
|
|
2566
|
+
r(
|
|
2507
2567
|
"invalid_input_options_dependencies",
|
|
2508
2568
|
"Input options dependencies must be a structured object.",
|
|
2509
2569
|
"dependencies"
|
|
@@ -2511,88 +2571,88 @@ function Yn(e, t = "protocol") {
|
|
|
2511
2571
|
), { ok: !1, errors: n, warnings: [] };
|
|
2512
2572
|
const o = e, a = o.mode;
|
|
2513
2573
|
if (a !== void 0 && a !== "independent" && a !== "explicit" && a !== "all_applicable" && n.push(
|
|
2514
|
-
|
|
2574
|
+
r(
|
|
2515
2575
|
"invalid_input_options_dependencies",
|
|
2516
2576
|
"Input options dependencies mode must be independent, explicit, or all_applicable.",
|
|
2517
2577
|
"dependencies.mode"
|
|
2518
2578
|
)
|
|
2519
|
-
),
|
|
2579
|
+
), se(
|
|
2520
2580
|
o.includeInputIds,
|
|
2521
2581
|
"dependencies.includeInputIds",
|
|
2522
2582
|
n,
|
|
2523
2583
|
"Input options includeInputIds must be non-empty strings."
|
|
2524
|
-
),
|
|
2584
|
+
), se(
|
|
2525
2585
|
o.excludeInputIds,
|
|
2526
2586
|
"dependencies.excludeInputIds",
|
|
2527
2587
|
n,
|
|
2528
2588
|
"Input options excludeInputIds must be non-empty strings."
|
|
2529
2589
|
), a === "all_applicable" && o.includeInputIds !== void 0 && n.push(
|
|
2530
|
-
|
|
2590
|
+
r(
|
|
2531
2591
|
"invalid_input_options_dependencies",
|
|
2532
2592
|
"All applicable dependencies cannot specify includeInputIds.",
|
|
2533
2593
|
"dependencies.includeInputIds"
|
|
2534
2594
|
)
|
|
2535
|
-
),
|
|
2595
|
+
), se(
|
|
2536
2596
|
o.omitInputIds,
|
|
2537
2597
|
"dependencies.omitInputIds",
|
|
2538
2598
|
n,
|
|
2539
2599
|
"Input options omitInputIds must be non-empty strings."
|
|
2540
2600
|
), Array.isArray(o.omitInputIds)) {
|
|
2541
|
-
const
|
|
2601
|
+
const s = new Set(
|
|
2542
2602
|
Array.isArray(o.includeInputIds) ? o.includeInputIds : []
|
|
2543
2603
|
);
|
|
2544
|
-
(a !== "explicit" || new Set(o.omitInputIds).size !== o.omitInputIds.length || o.omitInputIds.some((l) => !
|
|
2545
|
-
|
|
2604
|
+
(a !== "explicit" || new Set(o.omitInputIds).size !== o.omitInputIds.length || o.omitInputIds.some((l) => !s.has(l))) && n.push(
|
|
2605
|
+
r(
|
|
2546
2606
|
"invalid_input_options_dependencies",
|
|
2547
2607
|
"A browse override may only omit unique ids from an explicit includeInputIds list.",
|
|
2548
2608
|
"dependencies.omitInputIds"
|
|
2549
2609
|
)
|
|
2550
2610
|
);
|
|
2551
2611
|
}
|
|
2552
|
-
return t === "dashboard" &&
|
|
2612
|
+
return t === "dashboard" && Vn(o, n), { ok: n.length === 0, errors: n, warnings: [] };
|
|
2553
2613
|
}
|
|
2554
|
-
function
|
|
2614
|
+
function Vn(e, t) {
|
|
2555
2615
|
const { mode: n, includeInputIds: o, excludeInputIds: a } = e;
|
|
2556
2616
|
n === void 0 && t.push(
|
|
2557
|
-
|
|
2617
|
+
r(
|
|
2558
2618
|
"invalid_input_options_dependencies",
|
|
2559
2619
|
"Dashboard option dependencies must declare a mode.",
|
|
2560
2620
|
"dependencies.mode"
|
|
2561
2621
|
)
|
|
2562
2622
|
);
|
|
2563
|
-
for (const [
|
|
2623
|
+
for (const [s, l] of [
|
|
2564
2624
|
["dependencies.includeInputIds", o],
|
|
2565
2625
|
["dependencies.excludeInputIds", a]
|
|
2566
2626
|
])
|
|
2567
2627
|
Array.isArray(l) && new Set(l).size !== l.length && t.push(
|
|
2568
|
-
|
|
2628
|
+
r(
|
|
2569
2629
|
"invalid_input_options_dependencies",
|
|
2570
2630
|
"Dashboard option dependency input IDs must be unique.",
|
|
2571
|
-
|
|
2631
|
+
s
|
|
2572
2632
|
)
|
|
2573
2633
|
);
|
|
2574
2634
|
n === "independent" && (o !== void 0 || a !== void 0) && t.push(
|
|
2575
|
-
|
|
2635
|
+
r(
|
|
2576
2636
|
"invalid_input_options_dependencies",
|
|
2577
2637
|
"Independent dashboard dependencies cannot specify input IDs.",
|
|
2578
2638
|
"dependencies"
|
|
2579
2639
|
)
|
|
2580
2640
|
), n === "explicit" && (!Array.isArray(o) || o.length === 0 || a !== void 0) && t.push(
|
|
2581
|
-
|
|
2641
|
+
r(
|
|
2582
2642
|
"invalid_input_options_dependencies",
|
|
2583
2643
|
"Explicit dashboard dependencies require included input IDs and cannot specify exclusions.",
|
|
2584
2644
|
"dependencies"
|
|
2585
2645
|
)
|
|
2586
2646
|
);
|
|
2587
2647
|
}
|
|
2588
|
-
function
|
|
2589
|
-
var a,
|
|
2648
|
+
function Hn(e, t) {
|
|
2649
|
+
var a, s, l;
|
|
2590
2650
|
const n = new Set(
|
|
2591
2651
|
Array.isArray(e.inputs) ? e.inputs.map((d) => f(d) ? d.inputId : void 0).filter((d) => typeof d == "string") : []
|
|
2592
2652
|
), o = new Set(((a = e.dependencies) == null ? void 0 : a.omitInputIds) || []);
|
|
2593
|
-
for (const d of ((
|
|
2653
|
+
for (const d of ((s = e.dependencies) == null ? void 0 : s.includeInputIds) || [])
|
|
2594
2654
|
!n.has(d) && !o.has(d) && t.push(
|
|
2595
|
-
|
|
2655
|
+
r(
|
|
2596
2656
|
"invalid_input_options_dependencies",
|
|
2597
2657
|
`Input options dependency "${d}" is not declared in inputs.`,
|
|
2598
2658
|
"dependencies.includeInputIds"
|
|
@@ -2600,21 +2660,21 @@ function Bn(e, t) {
|
|
|
2600
2660
|
);
|
|
2601
2661
|
for (const d of ((l = e.dependencies) == null ? void 0 : l.excludeInputIds) || [])
|
|
2602
2662
|
d !== e.inputId && !n.has(d) && t.push(
|
|
2603
|
-
|
|
2663
|
+
r(
|
|
2604
2664
|
"invalid_input_options_dependencies",
|
|
2605
2665
|
`Input options dependency exclusion "${d}" is not the populated inputId and is not declared in inputs.`,
|
|
2606
2666
|
"dependencies.excludeInputIds"
|
|
2607
2667
|
)
|
|
2608
2668
|
);
|
|
2609
2669
|
}
|
|
2610
|
-
function
|
|
2611
|
-
e !== void 0 && (!Array.isArray(e) || e.some((a) => !p(a))) && n.push(
|
|
2670
|
+
function se(e, t, n, o) {
|
|
2671
|
+
e !== void 0 && (!Array.isArray(e) || e.some((a) => !p(a))) && n.push(r("invalid_input_options_dependencies", o, t));
|
|
2612
2672
|
}
|
|
2613
|
-
const
|
|
2614
|
-
function
|
|
2673
|
+
const Gn = new Set(z);
|
|
2674
|
+
function zn(e, t, n) {
|
|
2615
2675
|
if (f(e) && e.type === "temporal_bucket") {
|
|
2616
2676
|
n.push(
|
|
2617
|
-
|
|
2677
|
+
r(
|
|
2618
2678
|
"invalid_scalar_value_format",
|
|
2619
2679
|
"Scalar and measure slots cannot own temporal bucket presentation; declare it with grain on a grouped field or axis.",
|
|
2620
2680
|
t
|
|
@@ -2622,12 +2682,12 @@ function Ln(e, t, n) {
|
|
|
2622
2682
|
);
|
|
2623
2683
|
return;
|
|
2624
2684
|
}
|
|
2625
|
-
|
|
2685
|
+
nt(e, t, n);
|
|
2626
2686
|
}
|
|
2627
|
-
function
|
|
2687
|
+
function ze(e, t, n) {
|
|
2628
2688
|
if (!f(e)) {
|
|
2629
2689
|
n.push(
|
|
2630
|
-
|
|
2690
|
+
r(
|
|
2631
2691
|
"invalid_result_column_ref",
|
|
2632
2692
|
"Result calculation references must use columnKey or field.",
|
|
2633
2693
|
t
|
|
@@ -2638,7 +2698,7 @@ function Ue(e, t, n) {
|
|
|
2638
2698
|
const o = p(e.columnKey), a = f(e.field);
|
|
2639
2699
|
if (o === a) {
|
|
2640
2700
|
n.push(
|
|
2641
|
-
|
|
2701
|
+
r(
|
|
2642
2702
|
"invalid_result_column_ref",
|
|
2643
2703
|
"Result calculation references must identify exactly one of columnKey or field.",
|
|
2644
2704
|
t
|
|
@@ -2650,10 +2710,10 @@ function Ue(e, t, n) {
|
|
|
2650
2710
|
required: !0
|
|
2651
2711
|
});
|
|
2652
2712
|
}
|
|
2653
|
-
function
|
|
2713
|
+
function Kn(e, t, n) {
|
|
2654
2714
|
if (!f(e)) {
|
|
2655
2715
|
n.push(
|
|
2656
|
-
|
|
2716
|
+
r(
|
|
2657
2717
|
"invalid_result_calculation_output",
|
|
2658
2718
|
"Result calculation output must be a structured object.",
|
|
2659
2719
|
t
|
|
@@ -2662,25 +2722,25 @@ function Un(e, t, n) {
|
|
|
2662
2722
|
return;
|
|
2663
2723
|
}
|
|
2664
2724
|
p(e.key) || n.push(
|
|
2665
|
-
|
|
2725
|
+
r(
|
|
2666
2726
|
"invalid_result_calculation_output",
|
|
2667
2727
|
"Result calculation output needs a stable key.",
|
|
2668
2728
|
`${t}.key`
|
|
2669
2729
|
)
|
|
2670
|
-
), e.dataType !== void 0 && (typeof e.dataType != "string" || !
|
|
2671
|
-
|
|
2730
|
+
), e.dataType !== void 0 && (typeof e.dataType != "string" || !it.has(e.dataType)) && n.push(
|
|
2731
|
+
r(
|
|
2672
2732
|
"invalid_result_calculation_output",
|
|
2673
2733
|
"Result calculation output dataType must be string, number, boolean, date, datetime, or unknown.",
|
|
2674
2734
|
`${t}.dataType`
|
|
2675
2735
|
)
|
|
2676
|
-
),
|
|
2736
|
+
), zn(e.format, `${t}.format`, n);
|
|
2677
2737
|
}
|
|
2678
|
-
function
|
|
2738
|
+
function Qn(e, t) {
|
|
2679
2739
|
if (e.analysis === void 0)
|
|
2680
2740
|
return;
|
|
2681
2741
|
if (!f(e.analysis)) {
|
|
2682
2742
|
t.push(
|
|
2683
|
-
|
|
2743
|
+
r(
|
|
2684
2744
|
"invalid_measure_analysis",
|
|
2685
2745
|
"Metric analysis must be a structured object.",
|
|
2686
2746
|
"analysis"
|
|
@@ -2690,7 +2750,7 @@ function Vn(e, t) {
|
|
|
2690
2750
|
}
|
|
2691
2751
|
if (e.analysis.kind !== "period_change") {
|
|
2692
2752
|
t.push(
|
|
2693
|
-
|
|
2753
|
+
r(
|
|
2694
2754
|
"invalid_measure_analysis",
|
|
2695
2755
|
"Metric analysis kind is not supported.",
|
|
2696
2756
|
"analysis.kind"
|
|
@@ -2699,31 +2759,31 @@ function Vn(e, t) {
|
|
|
2699
2759
|
return;
|
|
2700
2760
|
}
|
|
2701
2761
|
e.dateField || t.push(
|
|
2702
|
-
|
|
2762
|
+
r(
|
|
2703
2763
|
"missing_analysis_date_field",
|
|
2704
2764
|
"Period-change analysis needs a dateField.",
|
|
2705
2765
|
"dateField"
|
|
2706
2766
|
)
|
|
2707
2767
|
), e.timeGrain || t.push(
|
|
2708
|
-
|
|
2768
|
+
r(
|
|
2709
2769
|
"missing_analysis_time_grain",
|
|
2710
2770
|
"Period-change analysis needs a timeGrain.",
|
|
2711
2771
|
"timeGrain"
|
|
2712
2772
|
)
|
|
2713
2773
|
), e.analysis.orderBy !== void 0 && e.analysis.orderBy !== "absolute_change" && e.analysis.orderBy !== "positive_change" && e.analysis.orderBy !== "negative_change" && e.analysis.orderBy !== "period" && t.push(
|
|
2714
|
-
|
|
2774
|
+
r(
|
|
2715
2775
|
"invalid_measure_analysis",
|
|
2716
2776
|
"Period-change analysis orderBy must be absolute_change, positive_change, negative_change, or period.",
|
|
2717
2777
|
"analysis.orderBy"
|
|
2718
2778
|
)
|
|
2719
2779
|
);
|
|
2720
2780
|
const { timeWindow: n } = e.analysis;
|
|
2721
|
-
n !== void 0 &&
|
|
2781
|
+
n !== void 0 && fe(n, "analysis.timeWindow", t);
|
|
2722
2782
|
}
|
|
2723
|
-
function
|
|
2783
|
+
function fe(e, t, n) {
|
|
2724
2784
|
if (!f(e)) {
|
|
2725
2785
|
n.push(
|
|
2726
|
-
|
|
2786
|
+
r(
|
|
2727
2787
|
"invalid_time_window",
|
|
2728
2788
|
"Time window must be a structured object.",
|
|
2729
2789
|
t
|
|
@@ -2732,40 +2792,40 @@ function pe(e, t, n) {
|
|
|
2732
2792
|
return;
|
|
2733
2793
|
}
|
|
2734
2794
|
if (e.kind !== void 0 && e.kind !== "relative" && e.kind !== "absolute" && n.push(
|
|
2735
|
-
|
|
2795
|
+
r(
|
|
2736
2796
|
"invalid_time_window",
|
|
2737
2797
|
"Time window kind must be relative or absolute.",
|
|
2738
2798
|
`${t}.kind`
|
|
2739
2799
|
)
|
|
2740
2800
|
), e.kind === "absolute") {
|
|
2741
2801
|
if (p(e.start) || n.push(
|
|
2742
|
-
|
|
2802
|
+
r(
|
|
2743
2803
|
"invalid_time_window",
|
|
2744
2804
|
"Absolute time window start must be a non-empty ISO date or timestamp string.",
|
|
2745
2805
|
`${t}.start`
|
|
2746
2806
|
)
|
|
2747
2807
|
), p(e.end) || n.push(
|
|
2748
|
-
|
|
2808
|
+
r(
|
|
2749
2809
|
"invalid_time_window",
|
|
2750
2810
|
"Absolute time window end must be a non-empty ISO date or timestamp string.",
|
|
2751
2811
|
`${t}.end`
|
|
2752
2812
|
)
|
|
2753
2813
|
), p(e.start) && p(e.end)) {
|
|
2754
|
-
const o =
|
|
2814
|
+
const o = me(e.start), a = me(e.end);
|
|
2755
2815
|
o || n.push(
|
|
2756
|
-
|
|
2816
|
+
r(
|
|
2757
2817
|
"invalid_time_window",
|
|
2758
2818
|
"Absolute time window start must be a valid ISO date or timestamp.",
|
|
2759
2819
|
`${t}.start`
|
|
2760
2820
|
)
|
|
2761
2821
|
), a || n.push(
|
|
2762
|
-
|
|
2822
|
+
r(
|
|
2763
2823
|
"invalid_time_window",
|
|
2764
2824
|
"Absolute time window end must be a valid ISO date or timestamp.",
|
|
2765
2825
|
`${t}.end`
|
|
2766
2826
|
)
|
|
2767
2827
|
), o && a && o.getTime() > a.getTime() && n.push(
|
|
2768
|
-
|
|
2828
|
+
r(
|
|
2769
2829
|
"invalid_time_window",
|
|
2770
2830
|
"Absolute time window start must be before or equal to end.",
|
|
2771
2831
|
t
|
|
@@ -2774,37 +2834,37 @@ function pe(e, t, n) {
|
|
|
2774
2834
|
}
|
|
2775
2835
|
return;
|
|
2776
2836
|
}
|
|
2777
|
-
(typeof e.unit != "string" || !
|
|
2778
|
-
|
|
2837
|
+
(typeof e.unit != "string" || !Gn.has(e.unit)) && n.push(
|
|
2838
|
+
r(
|
|
2779
2839
|
"invalid_time_window",
|
|
2780
|
-
`Time window unit must be one of: ${
|
|
2840
|
+
`Time window unit must be one of: ${z.join(", ")}.`,
|
|
2781
2841
|
`${t}.unit`
|
|
2782
2842
|
)
|
|
2783
2843
|
), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && n.push(
|
|
2784
|
-
|
|
2844
|
+
r(
|
|
2785
2845
|
"invalid_time_window",
|
|
2786
2846
|
"Time window value must be a positive number.",
|
|
2787
2847
|
`${t}.value`
|
|
2788
2848
|
)
|
|
2789
2849
|
), e.anchor !== void 0 && e.anchor !== "now" && e.anchor !== "latest_available" && n.push(
|
|
2790
|
-
|
|
2850
|
+
r(
|
|
2791
2851
|
"invalid_time_window",
|
|
2792
2852
|
"Time window anchor must be now or latest_available.",
|
|
2793
2853
|
`${t}.anchor`
|
|
2794
2854
|
)
|
|
2795
2855
|
), e.completeness !== void 0 && e.completeness !== "include_partial" && e.completeness !== "complete_periods" && n.push(
|
|
2796
|
-
|
|
2856
|
+
r(
|
|
2797
2857
|
"invalid_time_window",
|
|
2798
2858
|
"Time window completeness must be include_partial or complete_periods.",
|
|
2799
2859
|
`${t}.completeness`
|
|
2800
2860
|
)
|
|
2801
2861
|
);
|
|
2802
2862
|
}
|
|
2803
|
-
function
|
|
2863
|
+
function ge(e, t, n) {
|
|
2804
2864
|
if (e !== void 0) {
|
|
2805
2865
|
if (!Array.isArray(e)) {
|
|
2806
2866
|
n.push(
|
|
2807
|
-
|
|
2867
|
+
r(
|
|
2808
2868
|
"invalid_analytics_filters",
|
|
2809
2869
|
"Analytics filters must be an array.",
|
|
2810
2870
|
t
|
|
@@ -2814,62 +2874,62 @@ function me(e, t, n) {
|
|
|
2814
2874
|
}
|
|
2815
2875
|
e.forEach((o, a) => {
|
|
2816
2876
|
var c;
|
|
2817
|
-
const
|
|
2877
|
+
const s = `${t}.${a}`;
|
|
2818
2878
|
if (!f(o)) {
|
|
2819
2879
|
n.push(
|
|
2820
|
-
|
|
2880
|
+
r(
|
|
2821
2881
|
"invalid_analytics_filter",
|
|
2822
2882
|
"Analytics filter must be a structured object.",
|
|
2823
|
-
|
|
2883
|
+
s
|
|
2824
2884
|
)
|
|
2825
2885
|
);
|
|
2826
2886
|
return;
|
|
2827
2887
|
}
|
|
2828
2888
|
const l = o;
|
|
2829
|
-
b(l.field, `${
|
|
2889
|
+
b(l.field, `${s}.field`, n, {
|
|
2830
2890
|
required: !0
|
|
2831
2891
|
}), l.scope !== void 0 && l.scope !== "row" && l.scope !== "aggregate" && n.push(
|
|
2832
|
-
|
|
2892
|
+
r(
|
|
2833
2893
|
"invalid_analytics_filter_scope",
|
|
2834
2894
|
"Analytics filter scope must be row or aggregate.",
|
|
2835
|
-
`${
|
|
2895
|
+
`${s}.scope`
|
|
2836
2896
|
)
|
|
2837
2897
|
), l.scope === "aggregate" && ((c = l.field) == null ? void 0 : c.role) !== void 0 && l.field.role !== "measure" && n.push(
|
|
2838
|
-
|
|
2898
|
+
r(
|
|
2839
2899
|
"invalid_analytics_filter_scope",
|
|
2840
2900
|
"Aggregate-scope analytics filters must target a measure field.",
|
|
2841
|
-
`${
|
|
2901
|
+
`${s}.scope`
|
|
2842
2902
|
)
|
|
2843
2903
|
);
|
|
2844
2904
|
const d = l.operator === "is_null" || l.operator === "is_not_null";
|
|
2845
2905
|
if (l.operator !== void 0 && l.operator !== "=" && l.operator !== "!=" && l.operator !== "in" && l.operator !== "not_in" && l.operator !== "contains" && l.operator !== "not_contains" && l.operator !== "between" && l.operator !== "not_between" && l.operator !== ">" && l.operator !== ">=" && l.operator !== "<" && l.operator !== "<=" && l.operator !== "is_null" && l.operator !== "is_not_null" && n.push(
|
|
2846
|
-
|
|
2906
|
+
r(
|
|
2847
2907
|
"invalid_analytics_filter_operator",
|
|
2848
2908
|
"Analytics filter operator is not supported.",
|
|
2849
|
-
`${
|
|
2909
|
+
`${s}.operator`
|
|
2850
2910
|
)
|
|
2851
2911
|
), l.values === void 0 && !d && n.push(
|
|
2852
|
-
|
|
2912
|
+
r(
|
|
2853
2913
|
"missing_analytics_filter_value",
|
|
2854
2914
|
"Analytics filter needs values unless it is a null check.",
|
|
2855
|
-
|
|
2915
|
+
s
|
|
2856
2916
|
)
|
|
2857
2917
|
), d && l.values !== void 0) {
|
|
2858
2918
|
n.push(
|
|
2859
|
-
|
|
2919
|
+
r(
|
|
2860
2920
|
"invalid_analytics_filter_values",
|
|
2861
2921
|
"Null-check analytics filters must not include values.",
|
|
2862
|
-
`${
|
|
2922
|
+
`${s}.values`
|
|
2863
2923
|
)
|
|
2864
2924
|
);
|
|
2865
2925
|
return;
|
|
2866
2926
|
}
|
|
2867
2927
|
if (l.values !== void 0 && !Array.isArray(l.values)) {
|
|
2868
2928
|
n.push(
|
|
2869
|
-
|
|
2929
|
+
r(
|
|
2870
2930
|
"invalid_analytics_filter_values",
|
|
2871
2931
|
"Analytics filter values must be an array when provided.",
|
|
2872
|
-
`${
|
|
2932
|
+
`${s}.values`
|
|
2873
2933
|
)
|
|
2874
2934
|
);
|
|
2875
2935
|
return;
|
|
@@ -2878,68 +2938,68 @@ function me(e, t, n) {
|
|
|
2878
2938
|
const u = l.values.length;
|
|
2879
2939
|
if (l.operator === "between" || l.operator === "not_between") {
|
|
2880
2940
|
u !== 2 && n.push(
|
|
2881
|
-
|
|
2941
|
+
r(
|
|
2882
2942
|
"invalid_analytics_filter_values",
|
|
2883
2943
|
"Between analytics filters must include exactly two values.",
|
|
2884
|
-
`${
|
|
2944
|
+
`${s}.values`
|
|
2885
2945
|
)
|
|
2886
2946
|
);
|
|
2887
2947
|
return;
|
|
2888
2948
|
}
|
|
2889
2949
|
(l.operator === "contains" || l.operator === "not_contains" || l.operator === "=" || l.operator === "!=" || l.operator === ">" || l.operator === ">=" || l.operator === "<" || l.operator === "<=" || l.operator === void 0) && u !== 1 && n.push(
|
|
2890
|
-
|
|
2950
|
+
r(
|
|
2891
2951
|
"invalid_analytics_filter_values",
|
|
2892
2952
|
"Scalar analytics filters must include exactly one value. Use in/not_in for multiple values.",
|
|
2893
|
-
`${
|
|
2953
|
+
`${s}.values`
|
|
2894
2954
|
)
|
|
2895
2955
|
);
|
|
2896
2956
|
}
|
|
2897
2957
|
});
|
|
2898
2958
|
}
|
|
2899
2959
|
}
|
|
2900
|
-
function
|
|
2960
|
+
function Ga(e) {
|
|
2901
2961
|
const t = [];
|
|
2902
2962
|
if (!f(e))
|
|
2903
2963
|
return t.push(
|
|
2904
|
-
|
|
2964
|
+
r(
|
|
2905
2965
|
"invalid_result_calculation",
|
|
2906
2966
|
"Result calculation must be a structured object."
|
|
2907
2967
|
)
|
|
2908
2968
|
), { ok: !1, errors: t, warnings: [] };
|
|
2909
2969
|
if (p(e.id) || t.push(
|
|
2910
|
-
|
|
2970
|
+
r(
|
|
2911
2971
|
"invalid_result_calculation_id",
|
|
2912
2972
|
"Result calculation needs an id.",
|
|
2913
2973
|
"id"
|
|
2914
2974
|
)
|
|
2915
2975
|
), p(e.label) || t.push(
|
|
2916
|
-
|
|
2976
|
+
r(
|
|
2917
2977
|
"invalid_result_calculation_label",
|
|
2918
2978
|
"Result calculation needs a label.",
|
|
2919
2979
|
"label"
|
|
2920
2980
|
)
|
|
2921
2981
|
), e.kind !== "percent_of_total" && e.kind !== "rank" && e.kind !== "running_total" && e.kind !== "previous_row_delta" && t.push(
|
|
2922
|
-
|
|
2982
|
+
r(
|
|
2923
2983
|
"invalid_result_calculation_kind",
|
|
2924
2984
|
"Result calculation kind must be percent_of_total, rank, running_total, or previous_row_delta.",
|
|
2925
2985
|
"kind"
|
|
2926
2986
|
)
|
|
2927
|
-
),
|
|
2987
|
+
), ze(e.input, "input", t), Kn(e.output, "output", t), e.kind === "percent_of_total") {
|
|
2928
2988
|
const n = e.denominator;
|
|
2929
2989
|
n !== void 0 && (f(n) ? n.scope === "population" ? (b(n.metric, "denominator.metric", t, {
|
|
2930
2990
|
required: !0
|
|
2931
|
-
}),
|
|
2991
|
+
}), ge(
|
|
2932
2992
|
n.filters,
|
|
2933
2993
|
"denominator.filters",
|
|
2934
2994
|
t
|
|
2935
2995
|
)) : n.scope !== "returned_result" && t.push(
|
|
2936
|
-
|
|
2996
|
+
r(
|
|
2937
2997
|
"invalid_result_calculation_denominator",
|
|
2938
2998
|
"Percent-of-total denominator scope must be returned_result or population.",
|
|
2939
2999
|
"denominator.scope"
|
|
2940
3000
|
)
|
|
2941
3001
|
) : t.push(
|
|
2942
|
-
|
|
3002
|
+
r(
|
|
2943
3003
|
"invalid_result_calculation_denominator",
|
|
2944
3004
|
"Percent-of-total denominator must be a structured object.",
|
|
2945
3005
|
"denominator"
|
|
@@ -2947,21 +3007,21 @@ function qa(e) {
|
|
|
2947
3007
|
));
|
|
2948
3008
|
}
|
|
2949
3009
|
return e.kind === "rank" && e.order !== void 0 && e.order !== "asc" && e.order !== "desc" && t.push(
|
|
2950
|
-
|
|
3010
|
+
r(
|
|
2951
3011
|
"invalid_result_calculation_order",
|
|
2952
3012
|
"Rank result calculation order must be asc or desc.",
|
|
2953
3013
|
"order"
|
|
2954
3014
|
)
|
|
2955
|
-
), (e.kind === "running_total" || e.kind === "previous_row_delta") && e.orderBy !== void 0 &&
|
|
3015
|
+
), (e.kind === "running_total" || e.kind === "previous_row_delta") && e.orderBy !== void 0 && ze(e.orderBy, "orderBy", t), { ok: t.length === 0, errors: t, warnings: [] };
|
|
2956
3016
|
}
|
|
2957
|
-
function
|
|
3017
|
+
function jt(e) {
|
|
2958
3018
|
var o;
|
|
2959
3019
|
const t = [], n = [];
|
|
2960
3020
|
if (!e || typeof e != "object")
|
|
2961
3021
|
return {
|
|
2962
3022
|
ok: !1,
|
|
2963
3023
|
errors: [
|
|
2964
|
-
|
|
3024
|
+
r(
|
|
2965
3025
|
"invalid_analytics_intent",
|
|
2966
3026
|
"Analytics intent must be a structured object."
|
|
2967
3027
|
)
|
|
@@ -2975,101 +3035,101 @@ function Mt(e) {
|
|
|
2975
3035
|
]
|
|
2976
3036
|
};
|
|
2977
3037
|
if (e.kind === "matrix") {
|
|
2978
|
-
const a =
|
|
2979
|
-
return a.success || t.push(...a.error.issues.map((
|
|
3038
|
+
const a = fn.safeParse(e);
|
|
3039
|
+
return a.success || t.push(...a.error.issues.map((s) => r("invalid_matrix_intent", s.message, s.path.join(".")))), { ok: t.length === 0, errors: t, warnings: n, repairHints: Ke(t) };
|
|
2980
3040
|
}
|
|
2981
3041
|
if (e.version !== void 0 && e.version !== 1 && t.push(
|
|
2982
|
-
|
|
3042
|
+
r(
|
|
2983
3043
|
"invalid_version",
|
|
2984
3044
|
"Analytics intent version must be 1.",
|
|
2985
3045
|
"version"
|
|
2986
3046
|
)
|
|
2987
|
-
),
|
|
3047
|
+
), be(e.source, "source", t), Wn(e, t), Ln(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && Te(
|
|
2988
3048
|
e.relationshipHint,
|
|
2989
3049
|
"relationshipHint",
|
|
2990
3050
|
t
|
|
2991
3051
|
), e.kind === "metric") {
|
|
2992
3052
|
const a = Array.isArray(e.measures) ? e.measures.filter(
|
|
2993
|
-
(
|
|
3053
|
+
(s) => f(s) && p(s.name)
|
|
2994
3054
|
) : [];
|
|
2995
3055
|
if (!Array.isArray(e.measures) || e.measures.length === 0 ? t.push(
|
|
2996
|
-
|
|
3056
|
+
r(
|
|
2997
3057
|
"missing_measure",
|
|
2998
3058
|
"Metric intent needs at least one measure.",
|
|
2999
3059
|
"measures"
|
|
3000
3060
|
)
|
|
3001
3061
|
) : e.measures.some(
|
|
3002
|
-
(
|
|
3062
|
+
(s) => !f(s) || !p(s.name)
|
|
3003
3063
|
) && t.push(
|
|
3004
|
-
|
|
3064
|
+
r(
|
|
3005
3065
|
"invalid_measure_list",
|
|
3006
3066
|
"Metric intent measures must be an array of field references with names.",
|
|
3007
3067
|
"measures"
|
|
3008
3068
|
)
|
|
3009
|
-
), a.forEach((
|
|
3010
|
-
b(
|
|
3069
|
+
), a.forEach((s, l) => {
|
|
3070
|
+
b(s, `measures.${l}`, t, {
|
|
3011
3071
|
required: !0
|
|
3012
3072
|
});
|
|
3013
|
-
}), a.length > 0 && !
|
|
3014
|
-
const
|
|
3073
|
+
}), a.length > 0 && !Mn(a)) {
|
|
3074
|
+
const s = a.find(
|
|
3015
3075
|
(l, d) => a.some(
|
|
3016
|
-
(c, u) => u !== d &&
|
|
3076
|
+
(c, u) => u !== d && Nt(c, l)
|
|
3017
3077
|
)
|
|
3018
3078
|
);
|
|
3019
|
-
|
|
3020
|
-
|
|
3079
|
+
s && t.push(
|
|
3080
|
+
r(
|
|
3021
3081
|
"duplicate_measure",
|
|
3022
|
-
|
|
3082
|
+
Dn(s),
|
|
3023
3083
|
"measures"
|
|
3024
3084
|
)
|
|
3025
3085
|
);
|
|
3026
3086
|
}
|
|
3027
|
-
if (f(e.primaryMeasure) && p(e.primaryMeasure.name) &&
|
|
3087
|
+
if (f(e.primaryMeasure) && p(e.primaryMeasure.name) && Re(
|
|
3028
3088
|
e.primaryMeasure,
|
|
3029
3089
|
a
|
|
3030
3090
|
).length > 1 && t.push(
|
|
3031
|
-
|
|
3091
|
+
r(
|
|
3032
3092
|
"ambiguous_primary_measure",
|
|
3033
3093
|
"Metric intent primaryMeasure must identify exactly one selected measure.",
|
|
3034
3094
|
"primaryMeasure"
|
|
3035
3095
|
)
|
|
3036
3096
|
), e.primaryMeasure !== void 0 && (b(e.primaryMeasure, "primaryMeasure", t, {
|
|
3037
3097
|
required: !0
|
|
3038
|
-
}), f(e.primaryMeasure) && p(e.primaryMeasure.name) && a.length > 0 && !
|
|
3098
|
+
}), f(e.primaryMeasure) && p(e.primaryMeasure.name) && a.length > 0 && !En(
|
|
3039
3099
|
e.primaryMeasure,
|
|
3040
3100
|
a
|
|
3041
3101
|
) && t.push(
|
|
3042
|
-
|
|
3102
|
+
r(
|
|
3043
3103
|
"invalid_primary_measure",
|
|
3044
3104
|
"Metric intent primaryMeasure must match one measure field reference.",
|
|
3045
3105
|
"primaryMeasure"
|
|
3046
3106
|
)
|
|
3047
3107
|
)), e.dimensions !== void 0 && !Array.isArray(e.dimensions) ? t.push(
|
|
3048
|
-
|
|
3108
|
+
r(
|
|
3049
3109
|
"invalid_measure_dimensions",
|
|
3050
3110
|
"Metric intent dimensions must be an array of field references.",
|
|
3051
3111
|
"dimensions"
|
|
3052
3112
|
)
|
|
3053
3113
|
) : Array.isArray(e.dimensions) && e.dimensions.some(
|
|
3054
|
-
(
|
|
3114
|
+
(s) => !f(s) || !p(s.name)
|
|
3055
3115
|
) && t.push(
|
|
3056
|
-
|
|
3116
|
+
r(
|
|
3057
3117
|
"invalid_measure_dimensions",
|
|
3058
3118
|
"Metric intent dimensions must be an array of field references with names.",
|
|
3059
3119
|
"dimensions"
|
|
3060
3120
|
)
|
|
3061
|
-
), e.dateField !== void 0 && b(e.dateField, "dateField", t), e.timeWindow !== void 0 && (
|
|
3062
|
-
|
|
3121
|
+
), e.dateField !== void 0 && b(e.dateField, "dateField", t), e.timeWindow !== void 0 && (fe(e.timeWindow, "timeWindow", t), e.dateField || t.push(
|
|
3122
|
+
r(
|
|
3063
3123
|
"missing_time_window_date_field",
|
|
3064
3124
|
"Metric timeWindow needs a dateField.",
|
|
3065
3125
|
"dateField"
|
|
3066
3126
|
)
|
|
3067
|
-
)),
|
|
3068
|
-
b(
|
|
3127
|
+
)), ge(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((s, l) => {
|
|
3128
|
+
b(s, `dimensions.${l}`, t);
|
|
3069
3129
|
}), e.orderBy !== void 0) {
|
|
3070
3130
|
if (!f(e.orderBy))
|
|
3071
3131
|
t.push(
|
|
3072
|
-
|
|
3132
|
+
r(
|
|
3073
3133
|
"invalid_measure_order_by",
|
|
3074
3134
|
"Metric intent orderBy must be a structured object.",
|
|
3075
3135
|
"orderBy"
|
|
@@ -3078,24 +3138,24 @@ function Mt(e) {
|
|
|
3078
3138
|
else if (b(e.orderBy.field, "orderBy.field", t, {
|
|
3079
3139
|
required: !0
|
|
3080
3140
|
}), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
|
|
3081
|
-
|
|
3141
|
+
r(
|
|
3082
3142
|
"invalid_measure_order_direction",
|
|
3083
3143
|
"Metric intent orderBy direction must be asc or desc.",
|
|
3084
3144
|
"orderBy.direction"
|
|
3085
3145
|
)
|
|
3086
3146
|
), f(e.orderBy.field) && p(e.orderBy.field.name)) {
|
|
3087
|
-
const
|
|
3147
|
+
const s = [
|
|
3088
3148
|
...a,
|
|
3089
3149
|
...e.timeGrain && e.dateField && f(e.dateField) ? [e.dateField] : [],
|
|
3090
3150
|
...Array.isArray(e.dimensions) ? e.dimensions.filter(
|
|
3091
3151
|
(l) => f(l) && p(l.name)
|
|
3092
3152
|
) : []
|
|
3093
3153
|
];
|
|
3094
|
-
|
|
3154
|
+
s.length > 0 && !jn(
|
|
3095
3155
|
e.orderBy.field,
|
|
3096
|
-
|
|
3156
|
+
s
|
|
3097
3157
|
) && t.push(
|
|
3098
|
-
|
|
3158
|
+
r(
|
|
3099
3159
|
"invalid_measure_order_by",
|
|
3100
3160
|
"Metric intent orderBy.field must match one selected measure, grouped dateField, or dimension.",
|
|
3101
3161
|
"orderBy.field"
|
|
@@ -3103,10 +3163,10 @@ function Mt(e) {
|
|
|
3103
3163
|
);
|
|
3104
3164
|
}
|
|
3105
3165
|
}
|
|
3106
|
-
|
|
3166
|
+
Qn(e, t);
|
|
3107
3167
|
} else if (e.kind === "records") {
|
|
3108
3168
|
if (!Array.isArray(e.fields) || e.fields.length === 0 ? t.push(
|
|
3109
|
-
|
|
3169
|
+
r(
|
|
3110
3170
|
"missing_record_fields",
|
|
3111
3171
|
"Records intent needs at least one field.",
|
|
3112
3172
|
"fields"
|
|
@@ -3114,37 +3174,37 @@ function Mt(e) {
|
|
|
3114
3174
|
) : e.fields.some(
|
|
3115
3175
|
(a) => !f(a) || !p(a.name)
|
|
3116
3176
|
) && t.push(
|
|
3117
|
-
|
|
3177
|
+
r(
|
|
3118
3178
|
"invalid_record_fields",
|
|
3119
3179
|
"Records intent fields must be field references with names.",
|
|
3120
3180
|
"fields"
|
|
3121
3181
|
)
|
|
3122
|
-
), Array.isArray(e.fields) && e.fields.forEach((a,
|
|
3123
|
-
b(a, `fields.${
|
|
3124
|
-
}), e.dateField !== void 0 && b(e.dateField, "dateField", t),
|
|
3125
|
-
|
|
3182
|
+
), Array.isArray(e.fields) && e.fields.forEach((a, s) => {
|
|
3183
|
+
b(a, `fields.${s}`, t);
|
|
3184
|
+
}), e.dateField !== void 0 && b(e.dateField, "dateField", t), He(e.pagination, "pagination", t), e.timeWindow !== void 0 && (fe(e.timeWindow, "timeWindow", t), e.dateField || t.push(
|
|
3185
|
+
r(
|
|
3126
3186
|
"missing_time_window_date_field",
|
|
3127
3187
|
"Records timeWindow needs a dateField.",
|
|
3128
3188
|
"dateField"
|
|
3129
3189
|
)
|
|
3130
|
-
)),
|
|
3190
|
+
)), ge(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((a, s) => {
|
|
3131
3191
|
f(a) && a.scope === "aggregate" && t.push(
|
|
3132
|
-
|
|
3192
|
+
r(
|
|
3133
3193
|
"unsupported_record_filter_scope",
|
|
3134
3194
|
"Records intents support row-scope filters only. Use a metric intent for aggregate-scope filters.",
|
|
3135
|
-
`filters.${
|
|
3195
|
+
`filters.${s}.scope`
|
|
3136
3196
|
)
|
|
3137
3197
|
);
|
|
3138
3198
|
}), e.orderBy !== void 0 && (f(e.orderBy) ? (b(e.orderBy.field, "orderBy.field", t, {
|
|
3139
3199
|
required: !0
|
|
3140
3200
|
}), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
|
|
3141
|
-
|
|
3201
|
+
r(
|
|
3142
3202
|
"invalid_record_order_direction",
|
|
3143
3203
|
"Records intent orderBy direction must be asc or desc.",
|
|
3144
3204
|
"orderBy.direction"
|
|
3145
3205
|
)
|
|
3146
3206
|
)) : t.push(
|
|
3147
|
-
|
|
3207
|
+
r(
|
|
3148
3208
|
"invalid_record_order_by",
|
|
3149
3209
|
"Records intent orderBy must be a structured object.",
|
|
3150
3210
|
"orderBy"
|
|
@@ -3152,7 +3212,7 @@ function Mt(e) {
|
|
|
3152
3212
|
)), e.totals !== void 0)
|
|
3153
3213
|
if (!f(e.totals))
|
|
3154
3214
|
t.push(
|
|
3155
|
-
|
|
3215
|
+
r(
|
|
3156
3216
|
"invalid_records_totals",
|
|
3157
3217
|
"Records totals must be a structured server totals request.",
|
|
3158
3218
|
"totals"
|
|
@@ -3160,7 +3220,7 @@ function Mt(e) {
|
|
|
3160
3220
|
);
|
|
3161
3221
|
else {
|
|
3162
3222
|
e.totals.mode !== "server" && t.push(
|
|
3163
|
-
|
|
3223
|
+
r(
|
|
3164
3224
|
"invalid_records_totals",
|
|
3165
3225
|
"Records totals mode must be server.",
|
|
3166
3226
|
"totals.mode"
|
|
@@ -3168,16 +3228,16 @@ function Mt(e) {
|
|
|
3168
3228
|
);
|
|
3169
3229
|
const a = e.totals.measures;
|
|
3170
3230
|
!Array.isArray(a) || a.length === 0 ? t.push(
|
|
3171
|
-
|
|
3231
|
+
r(
|
|
3172
3232
|
"missing_records_totals_measures",
|
|
3173
3233
|
"Records server totals need at least one measure.",
|
|
3174
3234
|
"totals.measures"
|
|
3175
3235
|
)
|
|
3176
|
-
) : a.forEach((
|
|
3177
|
-
b(
|
|
3236
|
+
) : a.forEach((s, l) => {
|
|
3237
|
+
b(s, `totals.measures.${l}`, t, {
|
|
3178
3238
|
required: !0
|
|
3179
|
-
}), (!f(
|
|
3180
|
-
|
|
3239
|
+
}), (!f(s) || s.role !== "measure") && t.push(
|
|
3240
|
+
r(
|
|
3181
3241
|
"invalid_records_totals_measure",
|
|
3182
3242
|
"Records server totals measures must be measure field references.",
|
|
3183
3243
|
`totals.measures.${l}.role`
|
|
@@ -3185,22 +3245,22 @@ function Mt(e) {
|
|
|
3185
3245
|
);
|
|
3186
3246
|
});
|
|
3187
3247
|
}
|
|
3188
|
-
} else e.kind === "inputOptions" ?
|
|
3189
|
-
|
|
3248
|
+
} else e.kind === "inputOptions" ? qn(e, t) : e.kind === "sql" ? (((o = e.source) == null ? void 0 : o.kind) !== "sql" && t.push(
|
|
3249
|
+
r(
|
|
3190
3250
|
"invalid_sql_source",
|
|
3191
3251
|
"SQL analytics intent must use a SQL execution source.",
|
|
3192
3252
|
"source"
|
|
3193
3253
|
)
|
|
3194
3254
|
), p(e.sql) || t.push(
|
|
3195
|
-
|
|
3196
|
-
),
|
|
3255
|
+
r("missing_sql", "SQL analytics intent needs SQL text.", "sql")
|
|
3256
|
+
), Nn(
|
|
3197
3257
|
e.defaultParameters,
|
|
3198
3258
|
"defaultParameters",
|
|
3199
3259
|
t
|
|
3200
|
-
), Array.isArray(e.fields) && e.fields.forEach((a,
|
|
3201
|
-
b(a, `fields.${
|
|
3202
|
-
}),
|
|
3203
|
-
|
|
3260
|
+
), Array.isArray(e.fields) && e.fields.forEach((a, s) => {
|
|
3261
|
+
b(a, `fields.${s}`, t);
|
|
3262
|
+
}), He(e.pagination, "pagination", t)) : t.push(
|
|
3263
|
+
r(
|
|
3204
3264
|
"invalid_analytics_kind",
|
|
3205
3265
|
"Analytics kind is not supported.",
|
|
3206
3266
|
"kind"
|
|
@@ -3210,14 +3270,14 @@ function Mt(e) {
|
|
|
3210
3270
|
ok: t.length === 0,
|
|
3211
3271
|
errors: t,
|
|
3212
3272
|
warnings: n,
|
|
3213
|
-
repairHints:
|
|
3273
|
+
repairHints: Ke(t)
|
|
3214
3274
|
};
|
|
3215
3275
|
}
|
|
3216
|
-
function
|
|
3276
|
+
function Wn(e, t) {
|
|
3217
3277
|
if (!(!("derivedFields" in e) || e.derivedFields === void 0)) {
|
|
3218
3278
|
if (!Array.isArray(e.derivedFields)) {
|
|
3219
3279
|
t.push(
|
|
3220
|
-
|
|
3280
|
+
r(
|
|
3221
3281
|
"invalid_derived_fields",
|
|
3222
3282
|
"Analytics intent derivedFields must be an array of derived field definitions.",
|
|
3223
3283
|
"derivedFields"
|
|
@@ -3226,24 +3286,24 @@ function Hn(e, t) {
|
|
|
3226
3286
|
return;
|
|
3227
3287
|
}
|
|
3228
3288
|
e.derivedFields.forEach((n, o) => {
|
|
3229
|
-
|
|
3289
|
+
ve(
|
|
3230
3290
|
n
|
|
3231
|
-
).errors.forEach((
|
|
3291
|
+
).errors.forEach((s) => {
|
|
3232
3292
|
t.push({
|
|
3233
|
-
...
|
|
3234
|
-
path:
|
|
3293
|
+
...s,
|
|
3294
|
+
path: s.path ? `derivedFields.${o}.${s.path}` : `derivedFields.${o}`
|
|
3235
3295
|
});
|
|
3236
3296
|
});
|
|
3237
3297
|
});
|
|
3238
3298
|
}
|
|
3239
3299
|
}
|
|
3240
|
-
function
|
|
3300
|
+
function Xn(e) {
|
|
3241
3301
|
const t = [], n = [];
|
|
3242
3302
|
if (!e || typeof e != "object")
|
|
3243
3303
|
return {
|
|
3244
3304
|
ok: !1,
|
|
3245
3305
|
errors: [
|
|
3246
|
-
|
|
3306
|
+
r(
|
|
3247
3307
|
"invalid_operation_intent",
|
|
3248
3308
|
"Operation intent must be a structured object."
|
|
3249
3309
|
)
|
|
@@ -3257,27 +3317,27 @@ function Gn(e) {
|
|
|
3257
3317
|
]
|
|
3258
3318
|
};
|
|
3259
3319
|
if (e.version !== 1 && t.push(
|
|
3260
|
-
|
|
3320
|
+
r(
|
|
3261
3321
|
"invalid_version",
|
|
3262
3322
|
"Operation intent version must be 1.",
|
|
3263
3323
|
"version"
|
|
3264
3324
|
)
|
|
3265
3325
|
), e.kind === "answer_obligations")
|
|
3266
3326
|
!Array.isArray(e.obligations) || e.obligations.length === 0 ? t.push(
|
|
3267
|
-
|
|
3327
|
+
r(
|
|
3268
3328
|
"missing_obligations",
|
|
3269
3329
|
"Answer-obligations operation intent needs at least one obligation.",
|
|
3270
3330
|
"obligations"
|
|
3271
3331
|
)
|
|
3272
3332
|
) : e.obligations.forEach((o, a) => {
|
|
3273
3333
|
p(o.id) || t.push(
|
|
3274
|
-
|
|
3334
|
+
r(
|
|
3275
3335
|
"missing_obligation_id",
|
|
3276
3336
|
"Each analytics obligation needs an id.",
|
|
3277
3337
|
`obligations.${a}.id`
|
|
3278
3338
|
)
|
|
3279
3339
|
), p(o.prompt) || t.push(
|
|
3280
|
-
|
|
3340
|
+
r(
|
|
3281
3341
|
"missing_obligation_prompt",
|
|
3282
3342
|
"Each analytics obligation needs a prompt.",
|
|
3283
3343
|
`obligations.${a}.prompt`
|
|
@@ -3286,20 +3346,20 @@ function Gn(e) {
|
|
|
3286
3346
|
});
|
|
3287
3347
|
else if (e.kind === "dashboard_change" || e.kind === "data_app_change") {
|
|
3288
3348
|
if (p(e.instruction) || t.push(
|
|
3289
|
-
|
|
3349
|
+
r(
|
|
3290
3350
|
"missing_instruction",
|
|
3291
3351
|
"Change operation intent needs an instruction.",
|
|
3292
3352
|
"instruction"
|
|
3293
3353
|
)
|
|
3294
3354
|
), e.analyticsIntent) {
|
|
3295
|
-
const o =
|
|
3355
|
+
const o = jt(
|
|
3296
3356
|
e.analyticsIntent
|
|
3297
3357
|
);
|
|
3298
3358
|
t.push(...o.errors), n.push(...o.warnings);
|
|
3299
3359
|
}
|
|
3300
3360
|
} else
|
|
3301
3361
|
t.push(
|
|
3302
|
-
|
|
3362
|
+
r(
|
|
3303
3363
|
"invalid_operation_kind",
|
|
3304
3364
|
"Operation intent kind is not supported.",
|
|
3305
3365
|
"kind"
|
|
@@ -3309,16 +3369,16 @@ function Gn(e) {
|
|
|
3309
3369
|
ok: t.length === 0,
|
|
3310
3370
|
errors: t,
|
|
3311
3371
|
warnings: n,
|
|
3312
|
-
repairHints:
|
|
3372
|
+
repairHints: $t(t)
|
|
3313
3373
|
};
|
|
3314
3374
|
}
|
|
3315
|
-
function
|
|
3375
|
+
function za(e) {
|
|
3316
3376
|
const t = [], n = [];
|
|
3317
3377
|
if (!e || typeof e != "object")
|
|
3318
3378
|
return {
|
|
3319
3379
|
ok: !1,
|
|
3320
3380
|
errors: [
|
|
3321
|
-
|
|
3381
|
+
r(
|
|
3322
3382
|
"invalid_recovery_plan",
|
|
3323
3383
|
"Analytics recovery plan must be a structured object."
|
|
3324
3384
|
)
|
|
@@ -3332,19 +3392,19 @@ function La(e) {
|
|
|
3332
3392
|
]
|
|
3333
3393
|
};
|
|
3334
3394
|
e.version !== 1 && t.push(
|
|
3335
|
-
|
|
3395
|
+
r("invalid_version", "Recovery plan version must be 1.", "version")
|
|
3336
3396
|
), e.kind !== "analytics_recovery_plan" && t.push(
|
|
3337
|
-
|
|
3397
|
+
r(
|
|
3338
3398
|
"invalid_recovery_plan_kind",
|
|
3339
3399
|
"Recovery plan kind must be analytics_recovery_plan.",
|
|
3340
3400
|
"kind"
|
|
3341
3401
|
)
|
|
3342
3402
|
);
|
|
3343
|
-
const o =
|
|
3403
|
+
const o = Xn(
|
|
3344
3404
|
e.operationIntent
|
|
3345
3405
|
);
|
|
3346
3406
|
return t.push(...o.errors), n.push(...o.warnings), Array.isArray(e.plannedToolCalls) || t.push(
|
|
3347
|
-
|
|
3407
|
+
r(
|
|
3348
3408
|
"invalid_planned_tool_calls",
|
|
3349
3409
|
"Recovery plan plannedToolCalls must be an array.",
|
|
3350
3410
|
"plannedToolCalls"
|
|
@@ -3353,16 +3413,16 @@ function La(e) {
|
|
|
3353
3413
|
ok: t.length === 0,
|
|
3354
3414
|
errors: t,
|
|
3355
3415
|
warnings: n,
|
|
3356
|
-
repairHints:
|
|
3416
|
+
repairHints: $t(t)
|
|
3357
3417
|
};
|
|
3358
3418
|
}
|
|
3359
|
-
function
|
|
3419
|
+
function $t(e) {
|
|
3360
3420
|
return e.map((t) => ({
|
|
3361
3421
|
code: t.code,
|
|
3362
3422
|
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."
|
|
3363
3423
|
}));
|
|
3364
3424
|
}
|
|
3365
|
-
function
|
|
3425
|
+
function Ke(e) {
|
|
3366
3426
|
return e.map((t) => {
|
|
3367
3427
|
switch (t.code) {
|
|
3368
3428
|
case "invalid_matrix_intent":
|
|
@@ -3450,18 +3510,18 @@ function Ve(e) {
|
|
|
3450
3510
|
}
|
|
3451
3511
|
}).filter((t) => !!t);
|
|
3452
3512
|
}
|
|
3453
|
-
function
|
|
3513
|
+
function Zn(e, t, n, o) {
|
|
3454
3514
|
if (!e || typeof e != "object") {
|
|
3455
3515
|
n.push(
|
|
3456
|
-
|
|
3516
|
+
r("invalid_view", "Dashboard view must be an object.", t)
|
|
3457
3517
|
);
|
|
3458
3518
|
return;
|
|
3459
3519
|
}
|
|
3460
3520
|
if (p(e.title) || n.push(
|
|
3461
|
-
|
|
3521
|
+
r("missing_view_title", "Dashboard view needs a title.", t)
|
|
3462
3522
|
), !e.presentation || typeof e.presentation != "object") {
|
|
3463
3523
|
n.push(
|
|
3464
|
-
|
|
3524
|
+
r(
|
|
3465
3525
|
"missing_presentation",
|
|
3466
3526
|
"Dashboard view needs a presentation.",
|
|
3467
3527
|
`${t}.presentation`
|
|
@@ -3471,7 +3531,7 @@ function zn(e, t, n, o) {
|
|
|
3471
3531
|
}
|
|
3472
3532
|
if (e.presentation.kind === "text") {
|
|
3473
3533
|
p(e.text) || o.push(
|
|
3474
|
-
|
|
3534
|
+
r(
|
|
3475
3535
|
"missing_text_content",
|
|
3476
3536
|
"Text views should include text content.",
|
|
3477
3537
|
`${t}.text`
|
|
@@ -3481,7 +3541,7 @@ function zn(e, t, n, o) {
|
|
|
3481
3541
|
}
|
|
3482
3542
|
if (!e.analytics) {
|
|
3483
3543
|
n.push(
|
|
3484
|
-
|
|
3544
|
+
r(
|
|
3485
3545
|
"missing_view_analytics",
|
|
3486
3546
|
"Non-text dashboard views need analytics intent.",
|
|
3487
3547
|
`${t}.analytics`
|
|
@@ -3490,37 +3550,37 @@ function zn(e, t, n, o) {
|
|
|
3490
3550
|
return;
|
|
3491
3551
|
}
|
|
3492
3552
|
e.presentation.kind === "matrixTable" && e.analytics.kind !== "matrix" && n.push(
|
|
3493
|
-
|
|
3553
|
+
r(
|
|
3494
3554
|
"invalid_matrix_view_analytics",
|
|
3495
3555
|
"Matrix table views need matrix analytics intent.",
|
|
3496
3556
|
`${t}.analytics.kind`
|
|
3497
3557
|
)
|
|
3498
3558
|
);
|
|
3499
|
-
const a =
|
|
3500
|
-
for (const
|
|
3559
|
+
const a = jt(e.analytics);
|
|
3560
|
+
for (const s of a.errors)
|
|
3501
3561
|
n.push(
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
`${t}.analytics${
|
|
3562
|
+
r(
|
|
3563
|
+
s.code,
|
|
3564
|
+
s.message,
|
|
3565
|
+
`${t}.analytics${s.path ? `.${s.path}` : ""}`
|
|
3506
3566
|
)
|
|
3507
3567
|
);
|
|
3508
|
-
for (const
|
|
3568
|
+
for (const s of a.warnings)
|
|
3509
3569
|
o.push(
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
`${t}.analytics${
|
|
3570
|
+
r(
|
|
3571
|
+
s.code,
|
|
3572
|
+
s.message,
|
|
3573
|
+
`${t}.analytics${s.path ? `.${s.path}` : ""}`
|
|
3514
3574
|
)
|
|
3515
3575
|
);
|
|
3516
3576
|
}
|
|
3517
|
-
function
|
|
3577
|
+
function Ka(e) {
|
|
3518
3578
|
const t = [], n = [];
|
|
3519
3579
|
if (!e || typeof e != "object")
|
|
3520
3580
|
return {
|
|
3521
3581
|
ok: !1,
|
|
3522
3582
|
errors: [
|
|
3523
|
-
|
|
3583
|
+
r(
|
|
3524
3584
|
"invalid_dashboard_intent",
|
|
3525
3585
|
"Dashboard intent must be a structured object."
|
|
3526
3586
|
)
|
|
@@ -3528,17 +3588,17 @@ function Ua(e) {
|
|
|
3528
3588
|
warnings: n
|
|
3529
3589
|
};
|
|
3530
3590
|
e.version !== 1 && t.push(
|
|
3531
|
-
|
|
3591
|
+
r("invalid_version", "Dashboard intent version must be 1.")
|
|
3532
3592
|
), e.kind !== "dashboard" && t.push(
|
|
3533
|
-
|
|
3593
|
+
r("invalid_kind", "Experience intent kind must be dashboard.")
|
|
3534
3594
|
), p(e.title) || t.push(
|
|
3535
|
-
|
|
3595
|
+
r("missing_title", "Dashboard intent needs a title.", "title")
|
|
3536
3596
|
);
|
|
3537
|
-
const o = Array.isArray(e.inputs) ? e.inputs : [], a =
|
|
3597
|
+
const o = Array.isArray(e.inputs) ? e.inputs : [], a = Ge(
|
|
3538
3598
|
o.filter(f).map((c) => c.id).filter((c) => typeof c == "string")
|
|
3539
3599
|
);
|
|
3540
3600
|
a && t.push(
|
|
3541
|
-
|
|
3601
|
+
r(
|
|
3542
3602
|
"duplicate_input_id",
|
|
3543
3603
|
`Duplicate input id: ${a}.`,
|
|
3544
3604
|
"inputs"
|
|
@@ -3548,41 +3608,41 @@ function Ua(e) {
|
|
|
3548
3608
|
const m = `inputs.${c}`;
|
|
3549
3609
|
if (!f(u)) {
|
|
3550
3610
|
t.push(
|
|
3551
|
-
|
|
3611
|
+
r("invalid_input", "Dashboard input must be an object.", m)
|
|
3552
3612
|
);
|
|
3553
3613
|
continue;
|
|
3554
3614
|
}
|
|
3555
3615
|
p(u.id) || t.push(
|
|
3556
|
-
|
|
3616
|
+
r("missing_input_id", "Input needs an id.", `${m}.id`)
|
|
3557
3617
|
), p(u.label) || t.push(
|
|
3558
|
-
|
|
3618
|
+
r("missing_input_label", "Input needs a label.", `${m}.label`)
|
|
3559
3619
|
), !u.field || !p(u.field.name) ? t.push(
|
|
3560
|
-
|
|
3620
|
+
r("missing_input_field", "Input needs a field.", `${m}.field`)
|
|
3561
3621
|
) : b(u.field, `${m}.field`, t);
|
|
3562
3622
|
}
|
|
3563
|
-
const
|
|
3564
|
-
|
|
3565
|
-
|
|
3623
|
+
const s = Array.isArray(e.sections) ? e.sections : [];
|
|
3624
|
+
s.length === 0 && t.push(
|
|
3625
|
+
r(
|
|
3566
3626
|
"missing_sections",
|
|
3567
3627
|
"Dashboard intent needs at least one section.",
|
|
3568
3628
|
"sections"
|
|
3569
3629
|
)
|
|
3570
3630
|
);
|
|
3571
|
-
const l =
|
|
3631
|
+
const l = s.flatMap(
|
|
3572
3632
|
(c) => c && typeof c == "object" && Array.isArray(c.views) ? c.views.filter(f).map((u) => u.id).filter((u) => !!u) : []
|
|
3573
|
-
), d =
|
|
3633
|
+
), d = Ge(l);
|
|
3574
3634
|
d && t.push(
|
|
3575
|
-
|
|
3635
|
+
r(
|
|
3576
3636
|
"duplicate_view_id",
|
|
3577
3637
|
`Duplicate dashboard view id: ${d}.`,
|
|
3578
3638
|
"sections"
|
|
3579
3639
|
)
|
|
3580
3640
|
);
|
|
3581
|
-
for (const [c, u] of
|
|
3641
|
+
for (const [c, u] of s.entries()) {
|
|
3582
3642
|
const m = `sections.${c}`;
|
|
3583
3643
|
if (!u || typeof u != "object") {
|
|
3584
3644
|
t.push(
|
|
3585
|
-
|
|
3645
|
+
r(
|
|
3586
3646
|
"invalid_section",
|
|
3587
3647
|
"Dashboard section must be an object.",
|
|
3588
3648
|
m
|
|
@@ -3591,14 +3651,14 @@ function Ua(e) {
|
|
|
3591
3651
|
continue;
|
|
3592
3652
|
}
|
|
3593
3653
|
if (p(u.title) || t.push(
|
|
3594
|
-
|
|
3654
|
+
r(
|
|
3595
3655
|
"missing_section_title",
|
|
3596
3656
|
"Dashboard section needs a title.",
|
|
3597
3657
|
m
|
|
3598
3658
|
)
|
|
3599
3659
|
), !Array.isArray(u.views) || u.views.length === 0) {
|
|
3600
3660
|
t.push(
|
|
3601
|
-
|
|
3661
|
+
r(
|
|
3602
3662
|
"missing_section_views",
|
|
3603
3663
|
"Dashboard section needs at least one view.",
|
|
3604
3664
|
`${m}.views`
|
|
@@ -3606,10 +3666,10 @@ function Ua(e) {
|
|
|
3606
3666
|
);
|
|
3607
3667
|
continue;
|
|
3608
3668
|
}
|
|
3609
|
-
for (const [
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
`${m}.views.${
|
|
3669
|
+
for (const [_, y] of u.views.entries())
|
|
3670
|
+
Zn(
|
|
3671
|
+
y,
|
|
3672
|
+
`${m}.views.${_}`,
|
|
3613
3673
|
t,
|
|
3614
3674
|
n
|
|
3615
3675
|
);
|
|
@@ -3617,149 +3677,153 @@ function Ua(e) {
|
|
|
3617
3677
|
return { ok: t.length === 0, errors: t, warnings: n };
|
|
3618
3678
|
}
|
|
3619
3679
|
export {
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3680
|
+
Se as $,
|
|
3681
|
+
qa as A,
|
|
3682
|
+
Ni as B,
|
|
3683
|
+
le as C,
|
|
3684
|
+
Ci as D,
|
|
3685
|
+
Ae as E,
|
|
3686
|
+
on as F,
|
|
3687
|
+
St as G,
|
|
3688
|
+
ce as H,
|
|
3689
|
+
It as I,
|
|
3690
|
+
Ei as J,
|
|
3691
|
+
F as K,
|
|
3692
|
+
ji as L,
|
|
3693
|
+
ba as M,
|
|
3694
|
+
dn as N,
|
|
3695
|
+
kt as O,
|
|
3696
|
+
Yi as P,
|
|
3697
|
+
un as Q,
|
|
3698
|
+
ia as R,
|
|
3699
|
+
gt as S,
|
|
3700
|
+
na as T,
|
|
3701
|
+
Y as U,
|
|
3702
|
+
Ye as V,
|
|
3703
|
+
xe as W,
|
|
3704
|
+
qe as X,
|
|
3705
|
+
J as Y,
|
|
3706
|
+
Sn as Z,
|
|
3707
|
+
Ya as _,
|
|
3708
|
+
va as a,
|
|
3709
|
+
Tt as a$,
|
|
3710
|
+
Ot as a0,
|
|
3711
|
+
ea as a1,
|
|
3712
|
+
De as a2,
|
|
3713
|
+
z as a3,
|
|
3714
|
+
ta as a4,
|
|
3715
|
+
Yt as a5,
|
|
3716
|
+
aa as a6,
|
|
3717
|
+
Bt as a7,
|
|
3718
|
+
qt as a8,
|
|
3719
|
+
me as a9,
|
|
3720
|
+
he as aA,
|
|
3721
|
+
_e as aB,
|
|
3722
|
+
Qe as aC,
|
|
3723
|
+
Qt as aD,
|
|
3664
3724
|
We as aE,
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3725
|
+
Xe as aF,
|
|
3726
|
+
Ze as aG,
|
|
3727
|
+
Je as aH,
|
|
3728
|
+
et as aI,
|
|
3729
|
+
oa as aJ,
|
|
3730
|
+
sa as aK,
|
|
3731
|
+
j as aL,
|
|
3732
|
+
ra as aM,
|
|
3733
|
+
la as aN,
|
|
3734
|
+
Ne as aO,
|
|
3735
|
+
da as aP,
|
|
3736
|
+
ua as aQ,
|
|
3737
|
+
ca as aR,
|
|
3738
|
+
ii as aS,
|
|
3739
|
+
ni as aT,
|
|
3740
|
+
pa as aU,
|
|
3741
|
+
ma as aV,
|
|
3742
|
+
Pa as aW,
|
|
3743
|
+
Ba as aX,
|
|
3744
|
+
T as aY,
|
|
3745
|
+
Rt as aZ,
|
|
3746
|
+
Fe as a_,
|
|
3747
|
+
Un as aa,
|
|
3748
|
+
Ga as ab,
|
|
3749
|
+
jt as ac,
|
|
3750
|
+
Xn as ad,
|
|
3751
|
+
za as ae,
|
|
3752
|
+
Ka as af,
|
|
3753
|
+
ve as ag,
|
|
3754
|
+
ke as ah,
|
|
3755
|
+
Si as ai,
|
|
3756
|
+
Ii as aj,
|
|
3757
|
+
st as ak,
|
|
3758
|
+
xi as al,
|
|
3759
|
+
Fi as am,
|
|
3760
|
+
dt as an,
|
|
3761
|
+
ut as ao,
|
|
3762
|
+
$e as ap,
|
|
3763
|
+
pt as aq,
|
|
3764
|
+
fa as ar,
|
|
3765
|
+
ga as as,
|
|
3766
|
+
Ut as at,
|
|
3767
|
+
O as au,
|
|
3768
|
+
R as av,
|
|
3769
|
+
U as aw,
|
|
3770
|
+
te as ax,
|
|
3771
|
+
X as ay,
|
|
3772
|
+
zt as az,
|
|
3773
|
+
Oi as b,
|
|
3774
|
+
Ua as b0,
|
|
3775
|
+
ft as b1,
|
|
3776
|
+
L as b2,
|
|
3777
|
+
Di as b3,
|
|
3778
|
+
H as b4,
|
|
3779
|
+
_a as b5,
|
|
3780
|
+
x as b6,
|
|
3781
|
+
Ri as b7,
|
|
3782
|
+
ha as b8,
|
|
3783
|
+
mt as b9,
|
|
3784
|
+
$ as ba,
|
|
3785
|
+
Ee as bb,
|
|
3786
|
+
Zi as bc,
|
|
3787
|
+
gn as bd,
|
|
3788
|
+
Ra as be,
|
|
3789
|
+
zi as bf,
|
|
3790
|
+
$a as bg,
|
|
3791
|
+
ja as bh,
|
|
3792
|
+
Ta as bi,
|
|
3793
|
+
Ma as bj,
|
|
3794
|
+
Xi as bk,
|
|
3795
|
+
Ji as bl,
|
|
3796
|
+
Na as bm,
|
|
3797
|
+
Da as bn,
|
|
3798
|
+
Ea as bo,
|
|
3799
|
+
xa as bp,
|
|
3800
|
+
ue as bq,
|
|
3801
|
+
Fa as br,
|
|
3802
|
+
hn as bs,
|
|
3803
|
+
Ie as bt,
|
|
3804
|
+
oi as bu,
|
|
3805
|
+
ht as c,
|
|
3806
|
+
Ia as d,
|
|
3807
|
+
Aa as e,
|
|
3808
|
+
de as f,
|
|
3809
|
+
$i as g,
|
|
3810
|
+
wa as h,
|
|
3811
|
+
ya as i,
|
|
3812
|
+
Lt as j,
|
|
3813
|
+
Rn as k,
|
|
3814
|
+
Mt as l,
|
|
3815
|
+
fn as m,
|
|
3816
|
+
Sa as n,
|
|
3817
|
+
At as o,
|
|
3818
|
+
Va as p,
|
|
3819
|
+
pe as q,
|
|
3820
|
+
Oa as r,
|
|
3821
|
+
ka as s,
|
|
3822
|
+
wn as t,
|
|
3823
|
+
La as u,
|
|
3824
|
+
re as v,
|
|
3825
|
+
Pt as w,
|
|
3826
|
+
pn as x,
|
|
3827
|
+
Ca as y,
|
|
3828
|
+
Ha as z
|
|
3765
3829
|
};
|