react-semaphor 0.1.498 → 0.1.500
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-BGIPbwBx.js → calculated-field-identity-BC2NViZZ.js} +73 -63
- package/dist/chunks/{calculated-field-identity-CEzmY7Bi.cjs → calculated-field-identity-CtYhhZoG.cjs} +1 -1
- package/dist/chunks/{constants-CKoIADZx.js → constants-CTRduy1g.js} +9 -9
- package/dist/chunks/{constants-CpBVuEea.cjs → constants-DNgpRMaX.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-BEmyxEd8.cjs → dashboard-briefing-launcher-BLJZ3Qgs.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-C8eAX-JN.js → dashboard-briefing-launcher-BXUyvRSV.js} +9 -9
- package/dist/chunks/{dashboard-controls-YvJe7cPL.cjs → dashboard-controls-Cd7otu4d.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-C_v7sbq4.js → dashboard-controls-Cpwyyh9l.js} +11 -11
- package/dist/chunks/{dashboard-date-comparison-definition-aANgeL-E.js → dashboard-date-comparison-definition-C1vJshiP.js} +6 -6
- package/dist/chunks/{dashboard-date-comparison-definition-Er8D33iq.cjs → dashboard-date-comparison-definition-CWz_Yte8.cjs} +1 -1
- package/dist/chunks/{dashboard-json-BaT3Yy8x.js → dashboard-json-BInzxESW.js} +7 -7
- package/dist/chunks/{dashboard-json-CSp5bXIV.cjs → dashboard-json-DCC670oo.cjs} +1 -1
- package/dist/chunks/edit-dashboard-visual-CIQ2Ow3V.cjs +172 -0
- package/dist/chunks/{edit-dashboard-visual-GWiW0jjy.js → edit-dashboard-visual-Dfmk5Qmc.js} +6183 -6212
- package/dist/chunks/{editor-action-buttons-CfZITZwQ.js → editor-action-buttons-DjP4MzoJ.js} +6 -6
- package/dist/chunks/{editor-action-buttons-BSC0nwgV.cjs → editor-action-buttons-fiZSPjDC.cjs} +1 -1
- package/dist/chunks/{field-aggregations-DLWbqnBW.cjs → field-aggregations-mlkON_QA.cjs} +1 -1
- package/dist/chunks/{field-aggregations-CxJWY4Ny.js → field-aggregations-tLaXZ2VJ.js} +13 -13
- package/dist/chunks/{field-dependencies-BiyQuGxZ.cjs → field-dependencies-R7MrlW6D.cjs} +1 -1
- package/dist/chunks/{field-dependencies-CNOgt39w.js → field-dependencies-ZE2klbHO.js} +1 -1
- package/dist/chunks/{index-BJfUMDHc.js → index-BVIet238.js} +42 -42
- package/dist/chunks/{index-C3RHKD3d.cjs → index-Bh3SlWJS.cjs} +1 -1
- package/dist/chunks/{index-DhBGtRkR.cjs → index-C6KtprFE.cjs} +233 -233
- package/dist/chunks/{index-DjbQVfS6.js → index-CBUb9M4R.js} +26553 -26545
- package/dist/chunks/{matrix-analytical-definition-s10yOPft.js → matrix-analytical-definition-CIVFNNnF.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-DbaMwlWM.cjs → matrix-analytical-definition-wIEDXvV5.cjs} +1 -1
- package/dist/chunks/{matrix-card-DGpXdK_Y.js → matrix-card-BVvKHL7s.js} +2 -2
- package/dist/chunks/{matrix-card-BitrcBVw.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-AP5W3wGc.js → matrix-definition-BEXCfZAe.js} +3 -3
- package/dist/chunks/{matrix-definition-C33isJ3k.cjs → matrix-definition-CKVi4VVg.cjs} +1 -1
- package/dist/chunks/{matrix-formatter-CZYFhdZ0.js → matrix-formatter-BTPfthsa.js} +41 -41
- package/dist/chunks/{matrix-formatter-UCXQxvV3.cjs → matrix-formatter-CWtdnbfv.cjs} +1 -1
- package/dist/chunks/{matrix-member-presentation-5-M0obIa.js → matrix-member-presentation-DiDUvZts.js} +1 -1
- package/dist/chunks/{matrix-member-presentation-DgIq9UG9.cjs → matrix-member-presentation-e_KZoZOx.cjs} +1 -1
- package/dist/chunks/{matrix-operation-contract-BFumahBa.js → matrix-operation-contract-CPgckXxm.js} +144 -144
- package/dist/chunks/{matrix-operation-contract-C0-V685e.cjs → matrix-operation-contract-thtFuUYf.cjs} +1 -1
- package/dist/chunks/{metric-comparison-ClKUI7Tu.cjs → metric-comparison-CAqV6VnZ.cjs} +1 -1
- package/dist/chunks/{metric-comparison-Df3HmmUE.js → metric-comparison-Dgyq1I3d.js} +1 -1
- package/dist/chunks/{pivot-header-presentation-CGWDx1V_.cjs → pivot-header-presentation-DUXM-VOP.cjs} +1 -1
- package/dist/chunks/{pivot-header-presentation-CAmKYLgn.js → pivot-header-presentation-DcCO8-Ij.js} +3 -3
- package/dist/chunks/{pivot-result-identity-DBeK76wx.js → pivot-result-identity-Be1zm0AV.js} +1 -1
- package/dist/chunks/{pivot-result-identity-0grcK7bY.cjs → pivot-result-identity-DJyF4I2K.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DVPJg7Gg.js → pivot-result-lifecycle-DpSZOMOZ.js} +7 -7
- package/dist/chunks/{pivot-result-lifecycle-CC0jWMFT.cjs → pivot-result-lifecycle-E_huAPev.cjs} +1 -1
- package/dist/chunks/{raw-temporal-Kc3mdzH7.cjs → raw-temporal-DYoPBY6B.cjs} +1 -1
- package/dist/chunks/{raw-temporal-T3PEaGmJ.js → raw-temporal-DfnRBxQn.js} +2 -2
- package/dist/chunks/{raw-temporal-contract-Ck5vJoQ6.js → raw-temporal-contract-CNwYygW2.js} +1 -1
- package/dist/chunks/{raw-temporal-contract-SwtP1jSh.cjs → raw-temporal-contract-D1_n2pBj.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-BcaEOgn2.cjs → report-preferences-dialog-BMs2Bt9t.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-B8DdDM7q.js → report-preferences-dialog-CWK7wxW6.js} +6 -6
- package/dist/chunks/{report-runtime-context-D3t8vyl9.cjs → report-runtime-context-CqFbgZq9.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-BziN1eg9.js → report-runtime-context-Dln1qvGS.js} +5 -5
- package/dist/chunks/{semantic-format-Ca-sdETk.cjs → semantic-format-C7Goni6h.cjs} +1 -1
- package/dist/chunks/{semantic-format-A3k--fpE.js → semantic-format-PKQt2EAz.js} +2 -2
- package/dist/chunks/{source-entity-resolution-CTUzMH2S.cjs → source-entity-resolution-BMKxwdKN.cjs} +1 -1
- package/dist/chunks/{source-entity-resolution-DX9C1ebK.js → source-entity-resolution-BSZ07Sl6.js} +19 -19
- package/dist/chunks/{switch-DV8zX7rV.js → switch-B4wVqV4L.js} +51 -50
- package/dist/chunks/{switch-CgycqpWv.cjs → switch-DVjKkt22.cjs} +12 -12
- package/dist/chunks/{temporal-bucket-contract-BBdvWsY0.cjs → temporal-bucket-contract-CSdspcYj.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-contract-lq7Jrif0.js → temporal-bucket-contract-_WCvDnvn.js} +1 -1
- package/dist/chunks/{update-policy-DIw_H9RT.cjs → update-policy-BESKAspa.cjs} +1 -1
- package/dist/chunks/{update-policy-EgZ1nRbd.js → update-policy-BWbXhkk-.js} +2 -2
- package/dist/chunks/{validators-CvLOGzT3.js → validators-CHlnnHuS.js} +1102 -1043
- 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 +4 -4
- 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 +81 -78
- 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 +30 -27
- package/dist/types/main.d.ts +67 -8
- package/dist/types/shared.d.ts +16 -1
- package/dist/types/surfboard.d.ts +23 -1
- package/dist/types/types.d.ts +67 -8
- package/package.json +1 -1
- package/dist/chunks/edit-dashboard-visual-_Wap0YGu.cjs +0 -172
- package/dist/chunks/matrix-control-sources-DdfST7Fo.cjs +0 -1
- package/dist/chunks/matrix-control-sources-Dxh6hOU9.js +0 -523
- package/dist/chunks/validators-mhiJSia7.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 ca(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 ma(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,40 +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
1236
|
}
|
|
1237
|
-
function
|
|
1238
|
-
var
|
|
1239
|
-
|
|
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
|
+
};
|
|
1240
1279
|
}
|
|
1241
|
-
function
|
|
1280
|
+
function Sa(e) {
|
|
1281
|
+
if (e.calculationRepresentation) return e;
|
|
1282
|
+
const { representation: t } = ht(e);
|
|
1283
|
+
return t === "physical" ? e : { ...e, calculationRepresentation: t };
|
|
1284
|
+
}
|
|
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) {
|
|
1242
1292
|
var n, o;
|
|
1243
1293
|
const t = e;
|
|
1244
1294
|
return !!(t != null && t.expression && ((o = (n = t.calculatedFormula) == null ? void 0 : n.inputFields) != null && o.length));
|
|
1245
1295
|
}
|
|
1246
|
-
function
|
|
1247
|
-
return !!(e && (e.entityName ===
|
|
1296
|
+
function Aa(e) {
|
|
1297
|
+
return !!(e && (e.entityName === le || e.entityId === le));
|
|
1248
1298
|
}
|
|
1249
|
-
function
|
|
1299
|
+
function de(e) {
|
|
1250
1300
|
return e ? [e.entityName, e.entityId, e.qualifiedEntityName].some(
|
|
1251
|
-
(t) => t ===
|
|
1301
|
+
(t) => t === le || t === ji
|
|
1252
1302
|
) : !1;
|
|
1253
1303
|
}
|
|
1254
|
-
var
|
|
1255
|
-
const [
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
]),
|
|
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([
|
|
1262
1312
|
"table",
|
|
1263
1313
|
"view",
|
|
1264
1314
|
"materialized view",
|
|
@@ -1267,8 +1317,8 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1267
1317
|
"dataset",
|
|
1268
1318
|
"url",
|
|
1269
1319
|
"upload"
|
|
1270
|
-
]),
|
|
1271
|
-
connectionId:
|
|
1320
|
+
]), ae = i.object({
|
|
1321
|
+
connectionId: v,
|
|
1272
1322
|
connectionType: i.enum([
|
|
1273
1323
|
"GoogleSheets",
|
|
1274
1324
|
"FileUpload",
|
|
@@ -1284,13 +1334,13 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1284
1334
|
"API",
|
|
1285
1335
|
"none"
|
|
1286
1336
|
]),
|
|
1287
|
-
type:
|
|
1288
|
-
name:
|
|
1337
|
+
type: _t,
|
|
1338
|
+
name: v,
|
|
1289
1339
|
// Grounded relationship plans retain semantic identity and display metadata.
|
|
1290
1340
|
// SQL stays server-resolved; it is not accepted inside a join entity.
|
|
1291
1341
|
alias: i.string().optional(),
|
|
1292
|
-
id:
|
|
1293
|
-
domainId:
|
|
1342
|
+
id: v.optional(),
|
|
1343
|
+
domainId: v.optional(),
|
|
1294
1344
|
datasetType: i.enum(["physical", "virtual"]).optional(),
|
|
1295
1345
|
label: i.string().optional(),
|
|
1296
1346
|
description: i.string().optional(),
|
|
@@ -1307,36 +1357,41 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1307
1357
|
"duckdb",
|
|
1308
1358
|
"mssql"
|
|
1309
1359
|
]).optional()
|
|
1310
|
-
}).strict(),
|
|
1360
|
+
}).strict(), G = i.lazy(
|
|
1311
1361
|
() => i.object({
|
|
1312
|
-
id:
|
|
1313
|
-
name:
|
|
1362
|
+
id: v,
|
|
1363
|
+
name: v,
|
|
1314
1364
|
label: i.string(),
|
|
1315
1365
|
/** Set when `label` was synthesized from `name`; see `Field.derivedLabel`. */
|
|
1316
1366
|
derivedLabel: i.string().optional(),
|
|
1317
|
-
qualifiedFieldName:
|
|
1318
|
-
dataType:
|
|
1319
|
-
entityId:
|
|
1320
|
-
entityName:
|
|
1321
|
-
entityType:
|
|
1367
|
+
qualifiedFieldName: v,
|
|
1368
|
+
dataType: v,
|
|
1369
|
+
entityId: v,
|
|
1370
|
+
entityName: v,
|
|
1371
|
+
entityType: _t,
|
|
1322
1372
|
alias: i.string().optional(),
|
|
1323
1373
|
sourceField: i.string().optional(),
|
|
1324
|
-
source:
|
|
1374
|
+
source: Se.optional(),
|
|
1325
1375
|
nativeDataType: i.string().optional(),
|
|
1326
1376
|
description: i.string().optional(),
|
|
1327
1377
|
qualifiedEntityName: i.string().optional(),
|
|
1328
|
-
dateFormat: i.enum(
|
|
1378
|
+
dateFormat: i.enum(Ci).optional(),
|
|
1329
1379
|
customFormat: i.string().optional(),
|
|
1330
|
-
granularity:
|
|
1331
|
-
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(),
|
|
1332
1387
|
expression: i.string().optional(),
|
|
1333
|
-
derivedField:
|
|
1334
|
-
format:
|
|
1388
|
+
derivedField: Ie.optional(),
|
|
1389
|
+
format: Ui.optional(),
|
|
1335
1390
|
semanticTemporalPresentation: i.object({
|
|
1336
|
-
granularity:
|
|
1337
|
-
format:
|
|
1391
|
+
granularity: U,
|
|
1392
|
+
format: X
|
|
1338
1393
|
}).strict().optional(),
|
|
1339
|
-
aggregate:
|
|
1394
|
+
aggregate: R.optional(),
|
|
1340
1395
|
fieldScope: i.enum(["card", "sheet", "dashboard", "domain"]).optional(),
|
|
1341
1396
|
calculatedFormula: i.object({
|
|
1342
1397
|
operation: i.enum([
|
|
@@ -1349,19 +1404,20 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1349
1404
|
"scale",
|
|
1350
1405
|
"custom"
|
|
1351
1406
|
]),
|
|
1352
|
-
inputFields: i.array(
|
|
1353
|
-
constant: i.number().finite().optional()
|
|
1407
|
+
inputFields: i.array(G),
|
|
1408
|
+
constant: i.number().finite().optional(),
|
|
1409
|
+
computeStage: i.enum(["row", "aggregate"]).optional()
|
|
1354
1410
|
}).strict().optional()
|
|
1355
1411
|
}).strict()
|
|
1356
|
-
),
|
|
1412
|
+
), Vi = i.union([
|
|
1357
1413
|
i.string(),
|
|
1358
1414
|
i.number().finite(),
|
|
1359
1415
|
i.boolean(),
|
|
1360
1416
|
i.date(),
|
|
1361
1417
|
i.null()
|
|
1362
|
-
]),
|
|
1363
|
-
id:
|
|
1364
|
-
field:
|
|
1418
|
+
]), Hi = i.object({
|
|
1419
|
+
id: v,
|
|
1420
|
+
field: G,
|
|
1365
1421
|
operator: i.enum([
|
|
1366
1422
|
"=",
|
|
1367
1423
|
"!=",
|
|
@@ -1381,9 +1437,9 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1381
1437
|
"isNull",
|
|
1382
1438
|
"isNotNull"
|
|
1383
1439
|
]),
|
|
1384
|
-
value: i.union([
|
|
1440
|
+
value: i.union([Vi, i.array(i.string()), i.array(i.number().finite())]),
|
|
1385
1441
|
label: i.string().optional(),
|
|
1386
|
-
temporalBucket:
|
|
1442
|
+
temporalBucket: re.optional()
|
|
1387
1443
|
}).strict().superRefine((e, t) => {
|
|
1388
1444
|
const { operator: n, value: o } = e;
|
|
1389
1445
|
(n === "between" || n === "not between") && (!Array.isArray(o) || o.length !== 2) && t.addIssue({
|
|
@@ -1395,21 +1451,21 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1395
1451
|
path: ["value"],
|
|
1396
1452
|
message: "Membership requires an array."
|
|
1397
1453
|
});
|
|
1398
|
-
}),
|
|
1454
|
+
}), bt = i.lazy(
|
|
1399
1455
|
() => i.object({
|
|
1400
|
-
id:
|
|
1456
|
+
id: v,
|
|
1401
1457
|
logicalOperator: i.enum(["AND", "OR"]),
|
|
1402
1458
|
negate: i.boolean(),
|
|
1403
|
-
conditions: i.array(
|
|
1404
|
-
groups: i.array(
|
|
1459
|
+
conditions: i.array(Hi),
|
|
1460
|
+
groups: i.array(bt)
|
|
1405
1461
|
}).strict()
|
|
1406
|
-
),
|
|
1407
|
-
baseEntity:
|
|
1462
|
+
), Gi = i.object({
|
|
1463
|
+
baseEntity: ae,
|
|
1408
1464
|
joins: i.array(
|
|
1409
1465
|
i.object({
|
|
1410
|
-
id:
|
|
1411
|
-
source:
|
|
1412
|
-
target:
|
|
1466
|
+
id: v,
|
|
1467
|
+
source: ae,
|
|
1468
|
+
target: ae,
|
|
1413
1469
|
joinType: i.enum(["INNER", "LEFT", "RIGHT", "FULL"]),
|
|
1414
1470
|
sequence: i.number().int().nonnegative(),
|
|
1415
1471
|
relationshipId: i.string().optional(),
|
|
@@ -1418,13 +1474,13 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1418
1474
|
relationshipTraversalDirection: i.enum(["forward", "reverse"]).optional(),
|
|
1419
1475
|
joinKeyGroups: i.array(
|
|
1420
1476
|
i.object({
|
|
1421
|
-
id:
|
|
1477
|
+
id: v,
|
|
1422
1478
|
operator: i.enum(["AND", "OR"]),
|
|
1423
1479
|
keys: i.array(
|
|
1424
1480
|
i.object({
|
|
1425
1481
|
id: i.string().optional(),
|
|
1426
|
-
source:
|
|
1427
|
-
target:
|
|
1482
|
+
source: G,
|
|
1483
|
+
target: G,
|
|
1428
1484
|
operator: i.enum(["=", "!=", ">", ">=", "<", "<="])
|
|
1429
1485
|
}).strict()
|
|
1430
1486
|
).min(1)
|
|
@@ -1432,14 +1488,14 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1432
1488
|
).min(1)
|
|
1433
1489
|
}).strict()
|
|
1434
1490
|
)
|
|
1435
|
-
}).strict(),
|
|
1436
|
-
axis:
|
|
1491
|
+
}).strict(), zi = i.object({
|
|
1492
|
+
axis: Ae,
|
|
1437
1493
|
levelId: i.string().uuid().optional(),
|
|
1438
1494
|
// Persisted table preferences are edited through Immer; runtime paths remain readonly.
|
|
1439
|
-
oppositePath:
|
|
1440
|
-
}).strict(), I = i.string().min(1),
|
|
1495
|
+
oppositePath: F.transform((e) => [...e]).optional()
|
|
1496
|
+
}).strict(), I = i.string().min(1), Ki = i.array(
|
|
1441
1497
|
i.enum(["body", "header", "footer", "subtotal", "grandTotal"])
|
|
1442
|
-
),
|
|
1498
|
+
), Qi = i.enum(["normal", "medium", "semibold", "bold"]), Wi = i.enum(["none", "underline", "line-through"]), yt = i.object({
|
|
1443
1499
|
version: i.literal(1),
|
|
1444
1500
|
rules: i.array(
|
|
1445
1501
|
i.object({
|
|
@@ -1448,11 +1504,11 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1448
1504
|
enabled: i.boolean().optional(),
|
|
1449
1505
|
target: i.object({
|
|
1450
1506
|
level: i.enum(["cell", "row"]),
|
|
1451
|
-
matrix:
|
|
1507
|
+
matrix: zi.optional(),
|
|
1452
1508
|
columnIds: i.array(I).optional(),
|
|
1453
1509
|
conditionColumnId: I.optional(),
|
|
1454
1510
|
applyToColumnIds: i.array(I).optional(),
|
|
1455
|
-
tableParts:
|
|
1511
|
+
tableParts: Ki.optional(),
|
|
1456
1512
|
rowRoles: i.array(i.string()).optional(),
|
|
1457
1513
|
depth: i.number().int().nonnegative().optional(),
|
|
1458
1514
|
includeTotals: i.boolean().optional(),
|
|
@@ -1463,13 +1519,13 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1463
1519
|
kind: i.literal("comparison"),
|
|
1464
1520
|
columnId: I,
|
|
1465
1521
|
operator: i.enum(["eq", "neq", "gt", "gte", "lt", "lte"]),
|
|
1466
|
-
value:
|
|
1522
|
+
value: L
|
|
1467
1523
|
}).strict(),
|
|
1468
1524
|
i.object({
|
|
1469
1525
|
kind: i.literal("between"),
|
|
1470
1526
|
columnId: I,
|
|
1471
|
-
min:
|
|
1472
|
-
max:
|
|
1527
|
+
min: L,
|
|
1528
|
+
max: L,
|
|
1473
1529
|
inclusive: i.boolean().optional()
|
|
1474
1530
|
}).strict(),
|
|
1475
1531
|
i.object({
|
|
@@ -1516,64 +1572,64 @@ const [$i, Ci, Oi, Yi] = fe.options, Pi = i.union([
|
|
|
1516
1572
|
style: i.object({
|
|
1517
1573
|
backgroundColor: i.string().optional(),
|
|
1518
1574
|
textColor: i.string().optional(),
|
|
1519
|
-
fontWeight:
|
|
1575
|
+
fontWeight: Qi.optional(),
|
|
1520
1576
|
italic: i.boolean().optional(),
|
|
1521
|
-
textDecoration:
|
|
1577
|
+
textDecoration: Wi.optional(),
|
|
1522
1578
|
icon: i.enum(["arrowUp", "arrowDown", "warning", "check", "x"]).optional(),
|
|
1523
1579
|
dataBar: i.object({ color: i.string(), showValue: i.boolean() }).strict().optional()
|
|
1524
1580
|
}).strict().optional()
|
|
1525
1581
|
}).strict()
|
|
1526
1582
|
)
|
|
1527
1583
|
}).strict();
|
|
1528
|
-
function
|
|
1529
|
-
const n = (
|
|
1530
|
-
if (
|
|
1531
|
-
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);
|
|
1532
1588
|
if (l === null) return null;
|
|
1533
1589
|
try {
|
|
1534
|
-
return
|
|
1590
|
+
return Ti(String(l));
|
|
1535
1591
|
} catch {
|
|
1536
1592
|
return null;
|
|
1537
1593
|
}
|
|
1538
1594
|
}, o = n(e), a = n(t);
|
|
1539
|
-
return o === null || a === null ? null :
|
|
1595
|
+
return o === null || a === null ? null : mt(o, a);
|
|
1540
1596
|
}
|
|
1541
|
-
function
|
|
1542
|
-
const o =
|
|
1597
|
+
function Fa(e, t, n) {
|
|
1598
|
+
const o = Ji(e);
|
|
1543
1599
|
if (o === null) return null;
|
|
1544
1600
|
if (typeof o == "number" && typeof t == "number" && typeof n == "number") {
|
|
1545
|
-
const
|
|
1546
|
-
return { ratio:
|
|
1601
|
+
const h = en(o, t, n);
|
|
1602
|
+
return { ratio: h, midpointComparison: Math.sign(h - 0.5) };
|
|
1547
1603
|
}
|
|
1548
|
-
if ([t, n].some((
|
|
1549
|
-
const a = [o, t, n].map((
|
|
1550
|
-
const
|
|
1551
|
-
return { coefficient:
|
|
1552
|
-
}),
|
|
1553
|
-
(
|
|
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)
|
|
1554
1610
|
), u = c - d, m = l - d;
|
|
1555
1611
|
if (u <= 0n)
|
|
1556
1612
|
return {
|
|
1557
1613
|
ratio: l >= c ? 1 : 0,
|
|
1558
1614
|
midpointComparison: l >= c ? 1 : -1
|
|
1559
1615
|
};
|
|
1560
|
-
const
|
|
1561
|
-
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 };
|
|
1562
1618
|
}
|
|
1563
|
-
function
|
|
1619
|
+
function Ra(e) {
|
|
1564
1620
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
1565
1621
|
}
|
|
1566
|
-
function
|
|
1622
|
+
function Ta(e) {
|
|
1567
1623
|
return e.enabled !== !1;
|
|
1568
1624
|
}
|
|
1569
|
-
function
|
|
1625
|
+
function Ma(e) {
|
|
1570
1626
|
return e.kind === "topBottom" || e.kind === "colorScale" && e.range === "auto" || e.kind === "dataBar" && e.range === "auto";
|
|
1571
1627
|
}
|
|
1572
|
-
function
|
|
1628
|
+
function Xi(e) {
|
|
1573
1629
|
return e.columnId;
|
|
1574
1630
|
}
|
|
1575
|
-
function
|
|
1576
|
-
const t = [
|
|
1631
|
+
function Zi(e) {
|
|
1632
|
+
const t = [Xi(e.condition)];
|
|
1577
1633
|
return { validationRefs: [.../* @__PURE__ */ new Set([
|
|
1578
1634
|
...t,
|
|
1579
1635
|
...e.target.conditionColumnId === void 0 ? [] : [e.target.conditionColumnId],
|
|
@@ -1581,7 +1637,7 @@ function Ki(e) {
|
|
|
1581
1637
|
...e.target.applyToColumnIds ?? []
|
|
1582
1638
|
])], evaluationInputs: t };
|
|
1583
1639
|
}
|
|
1584
|
-
function
|
|
1640
|
+
function ue(e) {
|
|
1585
1641
|
if (typeof e == "number")
|
|
1586
1642
|
return Number.isFinite(e) ? e : null;
|
|
1587
1643
|
if (typeof e == "string" && e.trim() !== "") {
|
|
@@ -1590,30 +1646,30 @@ function le(e) {
|
|
|
1590
1646
|
}
|
|
1591
1647
|
return null;
|
|
1592
1648
|
}
|
|
1593
|
-
function
|
|
1594
|
-
return
|
|
1649
|
+
function Ji(e) {
|
|
1650
|
+
return H(e) ? e : ue(e);
|
|
1595
1651
|
}
|
|
1596
|
-
function
|
|
1652
|
+
function Da(e) {
|
|
1597
1653
|
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
1598
1654
|
for (const o of e)
|
|
1599
|
-
|
|
1655
|
+
H(o) ? n.add(o.value) : t.add(o);
|
|
1600
1656
|
return {
|
|
1601
|
-
has: (o) =>
|
|
1657
|
+
has: (o) => H(o) ? n.has(o.value) : t.has(o)
|
|
1602
1658
|
};
|
|
1603
1659
|
}
|
|
1604
|
-
function
|
|
1605
|
-
return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) :
|
|
1606
|
-
typeof e == "number" ?
|
|
1607
|
-
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
|
|
1608
1664
|
);
|
|
1609
1665
|
}
|
|
1610
|
-
function
|
|
1666
|
+
function Ea(e) {
|
|
1611
1667
|
return e == null || e === "";
|
|
1612
1668
|
}
|
|
1613
|
-
function
|
|
1669
|
+
function en(e, t, n) {
|
|
1614
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)));
|
|
1615
1671
|
}
|
|
1616
|
-
function
|
|
1672
|
+
function tn(e) {
|
|
1617
1673
|
switch (e) {
|
|
1618
1674
|
case "bold":
|
|
1619
1675
|
return 700;
|
|
@@ -1627,105 +1683,105 @@ function Xi(e) {
|
|
|
1627
1683
|
return;
|
|
1628
1684
|
}
|
|
1629
1685
|
}
|
|
1630
|
-
function
|
|
1631
|
-
return e ?
|
|
1632
|
-
fontWeight:
|
|
1686
|
+
function ja(e) {
|
|
1687
|
+
return e ? vt({
|
|
1688
|
+
fontWeight: tn(e.fontWeight),
|
|
1633
1689
|
fontStyle: e.italic ? "italic" : void 0,
|
|
1634
1690
|
color: e.textColor,
|
|
1635
1691
|
backgroundColor: e.backgroundColor,
|
|
1636
1692
|
textDecoration: e.textDecoration
|
|
1637
1693
|
}) : {};
|
|
1638
1694
|
}
|
|
1639
|
-
function
|
|
1695
|
+
function $a(...e) {
|
|
1640
1696
|
return Object.assign(
|
|
1641
1697
|
{},
|
|
1642
|
-
...e.filter((t) => !!t).map(
|
|
1698
|
+
...e.filter((t) => !!t).map(vt)
|
|
1643
1699
|
);
|
|
1644
1700
|
}
|
|
1645
|
-
function
|
|
1701
|
+
function vt(e) {
|
|
1646
1702
|
return Object.fromEntries(
|
|
1647
1703
|
Object.entries(e).filter(([, t]) => t !== void 0)
|
|
1648
1704
|
);
|
|
1649
1705
|
}
|
|
1650
|
-
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([
|
|
1651
1707
|
"SUM",
|
|
1652
1708
|
"COUNT",
|
|
1653
1709
|
"DISTINCT",
|
|
1654
1710
|
"AVG",
|
|
1655
1711
|
"MIN",
|
|
1656
1712
|
"MAX"
|
|
1657
|
-
]),
|
|
1713
|
+
]), St = vi.omit({
|
|
1658
1714
|
aggregate: !0
|
|
1659
|
-
}),
|
|
1715
|
+
}), sn = {
|
|
1660
1716
|
id: S,
|
|
1661
|
-
field:
|
|
1662
|
-
grain:
|
|
1663
|
-
},
|
|
1717
|
+
field: St,
|
|
1718
|
+
grain: U.optional()
|
|
1719
|
+
}, ce = i.object(sn).strict(), rn = i.object({
|
|
1664
1720
|
id: S,
|
|
1665
1721
|
kind: i.literal("aggregate"),
|
|
1666
|
-
field:
|
|
1667
|
-
aggregate:
|
|
1668
|
-
}).strict(),
|
|
1722
|
+
field: St,
|
|
1723
|
+
aggregate: on
|
|
1724
|
+
}).strict(), ln = i.object({
|
|
1669
1725
|
id: S,
|
|
1670
1726
|
kind: i.literal("calculated"),
|
|
1671
|
-
definition:
|
|
1672
|
-
}).strict(),
|
|
1727
|
+
definition: Ie
|
|
1728
|
+
}).strict(), It = i.discriminatedUnion("kind", [rn, ln]), dn = i.discriminatedUnion("kind", [
|
|
1673
1729
|
i.object({ kind: i.literal("member") }).strict(),
|
|
1674
1730
|
i.object({
|
|
1675
1731
|
kind: i.literal("measure"),
|
|
1676
1732
|
measureId: S,
|
|
1677
|
-
oppositePath:
|
|
1733
|
+
oppositePath: F
|
|
1678
1734
|
}).strict()
|
|
1679
|
-
]),
|
|
1680
|
-
axis:
|
|
1735
|
+
]), kt = i.object({
|
|
1736
|
+
axis: Ae,
|
|
1681
1737
|
levelId: S,
|
|
1682
1738
|
scope: i.discriminatedUnion("kind", [
|
|
1683
1739
|
i.object({ kind: i.literal("level") }).strict(),
|
|
1684
|
-
i.object({ kind: i.literal("branch"), parent:
|
|
1740
|
+
i.object({ kind: i.literal("branch"), parent: F }).strict()
|
|
1685
1741
|
]),
|
|
1686
|
-
target:
|
|
1742
|
+
target: dn,
|
|
1687
1743
|
direction: i.enum(["asc", "desc"]),
|
|
1688
1744
|
nulls: i.enum(["first", "last"])
|
|
1689
|
-
}).strict(),
|
|
1745
|
+
}).strict(), un = i.object({
|
|
1690
1746
|
id: S,
|
|
1691
|
-
axis:
|
|
1747
|
+
axis: Ae,
|
|
1692
1748
|
levelId: S,
|
|
1693
1749
|
direction: i.enum(["top", "bottom"]),
|
|
1694
|
-
count:
|
|
1750
|
+
count: an,
|
|
1695
1751
|
measureId: S,
|
|
1696
|
-
oppositePath:
|
|
1752
|
+
oppositePath: F,
|
|
1697
1753
|
others: i.boolean()
|
|
1698
|
-
}).strict(),
|
|
1699
|
-
source:
|
|
1700
|
-
rows: i.array(
|
|
1701
|
-
columns: i.array(
|
|
1702
|
-
measures: i.array(
|
|
1703
|
-
filters:
|
|
1704
|
-
joinPlan:
|
|
1705
|
-
relationshipHint: i.object({ relationshipIds: i.array(
|
|
1706
|
-
sorts: i.array(
|
|
1707
|
-
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()
|
|
1708
1764
|
}).strict();
|
|
1709
|
-
function
|
|
1765
|
+
function At(e) {
|
|
1710
1766
|
return JSON.stringify([
|
|
1711
1767
|
e.axis,
|
|
1712
1768
|
e.levelId,
|
|
1713
1769
|
e.scope.kind,
|
|
1714
|
-
e.scope.kind === "branch" ?
|
|
1770
|
+
e.scope.kind === "branch" ? gt(e.scope.parent) : null
|
|
1715
1771
|
]);
|
|
1716
1772
|
}
|
|
1717
1773
|
function g(e, t, n) {
|
|
1718
1774
|
e.addIssue({ code: "custom", path: t, message: n });
|
|
1719
1775
|
}
|
|
1720
|
-
function
|
|
1776
|
+
function A(e, t, n) {
|
|
1721
1777
|
new Set(e).size !== e.length && g(t, n, "Duplicate identity.");
|
|
1722
1778
|
}
|
|
1723
|
-
function $(e, t, n, o, a,
|
|
1779
|
+
function $(e, t, n, o, a, s = !1) {
|
|
1724
1780
|
n.length > e[t].length && g(o, a, "Path exceeds axis depth."), n.forEach((l, d) => {
|
|
1725
1781
|
var c;
|
|
1726
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") {
|
|
1727
1783
|
const u = l.member.rankingId;
|
|
1728
|
-
(
|
|
1784
|
+
(s || d !== n.length - 1 || !e.rankings.some(
|
|
1729
1785
|
(m) => m.id === u && m.others && m.axis === t && m.levelId === l.levelId
|
|
1730
1786
|
)) && g(
|
|
1731
1787
|
o,
|
|
@@ -1735,9 +1791,9 @@ function $(e, t, n, o, a, r = !1) {
|
|
|
1735
1791
|
}
|
|
1736
1792
|
});
|
|
1737
1793
|
}
|
|
1738
|
-
function
|
|
1739
|
-
|
|
1740
|
-
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);
|
|
1741
1797
|
if (d < 0 && g(n, l, "Sort level is not on its axis."), a.scope.kind === "branch" && ($(
|
|
1742
1798
|
e,
|
|
1743
1799
|
a.axis,
|
|
@@ -1762,35 +1818,35 @@ function It(e, t, n, o) {
|
|
|
1762
1818
|
}
|
|
1763
1819
|
});
|
|
1764
1820
|
}
|
|
1765
|
-
function
|
|
1821
|
+
function q(e, t, n, o) {
|
|
1766
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(
|
|
1767
1823
|
n,
|
|
1768
1824
|
o,
|
|
1769
1825
|
"Field source must belong to the same semantic domain or physical connection."
|
|
1770
1826
|
);
|
|
1771
1827
|
}
|
|
1772
|
-
function
|
|
1828
|
+
function oe(e, t, n) {
|
|
1773
1829
|
(e.defaultAggregate === "MEDIAN" || Object.values(e.inputs).some(
|
|
1774
1830
|
(o) => o.aggregate === "MEDIAN" || o.field.aggregate === "MEDIAN"
|
|
1775
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.");
|
|
1776
1832
|
}
|
|
1777
|
-
function
|
|
1778
|
-
|
|
1833
|
+
function Ft(e, t) {
|
|
1834
|
+
A(
|
|
1779
1835
|
[...e.rows, ...e.columns, ...e.measures].map((a) => a.id),
|
|
1780
1836
|
t,
|
|
1781
1837
|
[]
|
|
1782
|
-
),
|
|
1838
|
+
), A(
|
|
1783
1839
|
e.rankings.map((a) => a.id),
|
|
1784
1840
|
t,
|
|
1785
1841
|
["rankings"]
|
|
1786
|
-
),
|
|
1842
|
+
), A(
|
|
1787
1843
|
e.rankings.map((a) => JSON.stringify([a.axis, a.levelId])),
|
|
1788
1844
|
t,
|
|
1789
1845
|
["rankings"]
|
|
1790
1846
|
);
|
|
1791
1847
|
for (const a of ["rows", "columns"])
|
|
1792
|
-
e[a].forEach((
|
|
1793
|
-
|
|
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.");
|
|
1794
1850
|
});
|
|
1795
1851
|
const n = [
|
|
1796
1852
|
...e.rows,
|
|
@@ -1798,7 +1854,7 @@ function kt(e, t) {
|
|
|
1798
1854
|
...e.measures.filter((a) => a.kind === "aggregate")
|
|
1799
1855
|
];
|
|
1800
1856
|
for (const a of n)
|
|
1801
|
-
if (
|
|
1857
|
+
if (q(a.field.source, e.source, t, [
|
|
1802
1858
|
a.id,
|
|
1803
1859
|
"field",
|
|
1804
1860
|
"source"
|
|
@@ -1807,9 +1863,9 @@ function kt(e, t) {
|
|
|
1807
1863
|
t,
|
|
1808
1864
|
[a.id],
|
|
1809
1865
|
"Aggregate-stage calculations cannot be grouped or wrapped in an aggregate."
|
|
1810
|
-
),
|
|
1811
|
-
for (const
|
|
1812
|
-
|
|
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"]);
|
|
1813
1869
|
}
|
|
1814
1870
|
for (const a of e.measures)
|
|
1815
1871
|
if (a.kind === "calculated") {
|
|
@@ -1817,72 +1873,72 @@ function kt(e, t) {
|
|
|
1817
1873
|
t,
|
|
1818
1874
|
[a.id],
|
|
1819
1875
|
"Calculated measures require aggregate stage and measure role."
|
|
1820
|
-
),
|
|
1821
|
-
for (const
|
|
1822
|
-
|
|
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, [
|
|
1823
1879
|
a.id,
|
|
1824
1880
|
"inputs"
|
|
1825
1881
|
]);
|
|
1826
1882
|
}
|
|
1827
1883
|
const o = (a) => {
|
|
1828
|
-
const
|
|
1884
|
+
const s = (l, d) => {
|
|
1829
1885
|
var c, u;
|
|
1830
1886
|
if ((l.aggregate || ((c = l.derivedField) == null ? void 0 : c.computeStage) === "aggregate") && g(t, d, "Aggregate/HAVING filters are not supported."), l.derivedField) {
|
|
1831
|
-
|
|
1887
|
+
oe(l.derivedField, t, d);
|
|
1832
1888
|
for (const m of Object.values(l.derivedField.inputs))
|
|
1833
|
-
|
|
1889
|
+
q(m.field.source, e.source, t, d);
|
|
1834
1890
|
}
|
|
1835
1891
|
for (const m of ((u = l.calculatedFormula) == null ? void 0 : u.inputFields) ?? [])
|
|
1836
|
-
|
|
1892
|
+
s(m, d);
|
|
1837
1893
|
};
|
|
1838
1894
|
for (const l of a.conditions)
|
|
1839
|
-
|
|
1895
|
+
s(l.field, ["filters", l.id]);
|
|
1840
1896
|
a.groups.forEach(o);
|
|
1841
1897
|
};
|
|
1842
1898
|
if (e.filters && o(e.filters), e.joinPlan) {
|
|
1843
1899
|
const a = [
|
|
1844
1900
|
e.joinPlan.baseEntity,
|
|
1845
|
-
...e.joinPlan.joins.flatMap((
|
|
1901
|
+
...e.joinPlan.joins.flatMap((s) => [s.source, s.target])
|
|
1846
1902
|
];
|
|
1847
|
-
(new Set(a.map((
|
|
1848
|
-
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),
|
|
1849
1905
|
t,
|
|
1850
1906
|
["joinPlan", "joins"]
|
|
1851
1907
|
);
|
|
1852
1908
|
}
|
|
1853
|
-
|
|
1854
|
-
(!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."), $(
|
|
1855
1911
|
e,
|
|
1856
1912
|
a.axis === "rows" ? "columns" : "rows",
|
|
1857
1913
|
a.oppositePath,
|
|
1858
1914
|
t,
|
|
1859
|
-
["rankings",
|
|
1915
|
+
["rankings", s, "oppositePath"],
|
|
1860
1916
|
!0
|
|
1861
1917
|
);
|
|
1862
1918
|
});
|
|
1863
1919
|
}
|
|
1864
|
-
const Y =
|
|
1865
|
-
rows: i.array(
|
|
1866
|
-
measures: i.array(
|
|
1867
|
-
}),
|
|
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) => {
|
|
1868
1924
|
const o = Y.safeParse(t);
|
|
1869
1925
|
o.success || o.error.issues.forEach((a) => n.addIssue(a));
|
|
1870
|
-
}),
|
|
1926
|
+
}), Ye = i.object({
|
|
1871
1927
|
visible: i.boolean(),
|
|
1872
1928
|
position: i.enum(["before", "after"]),
|
|
1873
1929
|
label: i.string().optional()
|
|
1874
|
-
}).strict(),
|
|
1875
|
-
grand:
|
|
1876
|
-
levels: i.record(S,
|
|
1877
|
-
}).strict(),
|
|
1878
|
-
rules: i.array(
|
|
1879
|
-
target:
|
|
1880
|
-
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()
|
|
1881
1937
|
})
|
|
1882
1938
|
}))
|
|
1883
1939
|
}).superRefine((e, t) => {
|
|
1884
1940
|
var n;
|
|
1885
|
-
|
|
1941
|
+
A(e.rules.map((o) => o.id), t, ["rules"]);
|
|
1886
1942
|
for (const o of e.rules) {
|
|
1887
1943
|
const a = o.condition;
|
|
1888
1944
|
a.kind === "topBottom" && g(
|
|
@@ -1904,13 +1960,13 @@ const Y = vt.superRefine(kt), rn = vt.extend({
|
|
|
1904
1960
|
);
|
|
1905
1961
|
}
|
|
1906
1962
|
});
|
|
1907
|
-
function
|
|
1908
|
-
for (const
|
|
1909
|
-
const l = [...a, "rules",
|
|
1910
|
-
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.");
|
|
1911
1967
|
}
|
|
1912
1968
|
}
|
|
1913
|
-
const
|
|
1969
|
+
const _n = {
|
|
1914
1970
|
layout: i.discriminatedUnion("kind", [
|
|
1915
1971
|
i.object({ kind: i.literal("compact") }).strict(),
|
|
1916
1972
|
i.object({ kind: i.literal("tabular"), repeatLabels: i.boolean() }).strict()
|
|
@@ -1918,27 +1974,27 @@ const mn = {
|
|
|
1918
1974
|
absence: i.object({ emptyText: i.string(), nullText: i.string() }).strict(),
|
|
1919
1975
|
levelLabels: i.record(S, i.string()).readonly(),
|
|
1920
1976
|
measureLabels: i.record(S, i.string()).readonly(),
|
|
1921
|
-
levelFormats: i.record(S,
|
|
1922
|
-
measureFormats: i.record(S,
|
|
1923
|
-
totals: i.object({ rows:
|
|
1924
|
-
conditionalFormatting:
|
|
1925
|
-
},
|
|
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({
|
|
1926
1982
|
depth: i.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
1927
1983
|
overrides: i.array(
|
|
1928
|
-
i.object({ path:
|
|
1984
|
+
i.object({ path: F, expanded: i.boolean() }).strict()
|
|
1929
1985
|
).readonly()
|
|
1930
|
-
}).strict(),
|
|
1931
|
-
(e, t) =>
|
|
1932
|
-
e.overrides.map((n) =>
|
|
1986
|
+
}).strict(), qe = bn.superRefine(
|
|
1987
|
+
(e, t) => A(
|
|
1988
|
+
e.overrides.map((n) => gt(n.path)),
|
|
1933
1989
|
t,
|
|
1934
1990
|
["overrides"]
|
|
1935
1991
|
)
|
|
1936
|
-
),
|
|
1937
|
-
(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"])
|
|
1938
1994
|
);
|
|
1939
|
-
function
|
|
1995
|
+
function ee(e, t) {
|
|
1940
1996
|
var c;
|
|
1941
|
-
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));
|
|
1942
1998
|
for (const u of [
|
|
1943
1999
|
"levelLabels",
|
|
1944
2000
|
"levelFormats",
|
|
@@ -1946,10 +2002,10 @@ function J(e, t) {
|
|
|
1946
2002
|
"measureFormats"
|
|
1947
2003
|
]) {
|
|
1948
2004
|
const m = u.startsWith("level") ? l : d;
|
|
1949
|
-
for (const
|
|
1950
|
-
m.has(
|
|
2005
|
+
for (const _ of Object.keys(o[u]))
|
|
2006
|
+
m.has(_) || g(
|
|
1951
2007
|
t,
|
|
1952
|
-
["presentation", u,
|
|
2008
|
+
["presentation", u, _],
|
|
1953
2009
|
"Unknown presentation reference."
|
|
1954
2010
|
);
|
|
1955
2011
|
}
|
|
@@ -1960,34 +2016,34 @@ function J(e, t) {
|
|
|
1960
2016
|
"Measures cannot own temporal bucket formats."
|
|
1961
2017
|
);
|
|
1962
2018
|
for (const [u, m] of Object.entries(o.levelFormats))
|
|
1963
|
-
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(
|
|
1964
2020
|
t,
|
|
1965
2021
|
["presentation", "levelFormats", u],
|
|
1966
2022
|
"Temporal bucket formats require a grain."
|
|
1967
2023
|
);
|
|
1968
2024
|
for (const u of ["rows", "columns"]) {
|
|
1969
2025
|
const m = Object.keys(o.totals[u].levels);
|
|
1970
|
-
(m.length !== n[u].length || m.some((
|
|
2026
|
+
(m.length !== n[u].length || m.some((_) => !n[u].some((y) => y.id === _))) && g(
|
|
1971
2027
|
t,
|
|
1972
2028
|
["presentation", "totals", u],
|
|
1973
2029
|
"Subtotal map must contain exactly the current axis levels."
|
|
1974
2030
|
);
|
|
1975
|
-
for (const
|
|
1976
|
-
for (const
|
|
2031
|
+
for (const _ of [a, ...s ? [s] : []])
|
|
2032
|
+
for (const y of _[u].overrides)
|
|
1977
2033
|
$(
|
|
1978
2034
|
n,
|
|
1979
2035
|
u,
|
|
1980
|
-
|
|
2036
|
+
y.path,
|
|
1981
2037
|
t,
|
|
1982
2038
|
[u, "overrides"],
|
|
1983
2039
|
!0
|
|
1984
|
-
),
|
|
2040
|
+
), y.path.length || g(
|
|
1985
2041
|
t,
|
|
1986
2042
|
[u, "overrides"],
|
|
1987
2043
|
"Use depth to expand/collapse the root."
|
|
1988
2044
|
);
|
|
1989
2045
|
}
|
|
1990
|
-
|
|
2046
|
+
s && xt(n, s.sorts, t, ["session", "sorts"]), o.conditionalFormatting && hn(
|
|
1991
2047
|
o.conditionalFormatting,
|
|
1992
2048
|
n,
|
|
1993
2049
|
d,
|
|
@@ -1995,32 +2051,32 @@ function J(e, t) {
|
|
|
1995
2051
|
["presentation", "conditionalFormatting"]
|
|
1996
2052
|
);
|
|
1997
2053
|
}
|
|
1998
|
-
const
|
|
2054
|
+
const In = i.object({
|
|
1999
2055
|
spec: Y,
|
|
2000
|
-
presentation:
|
|
2001
|
-
defaults:
|
|
2002
|
-
session:
|
|
2003
|
-
}).strict(),
|
|
2056
|
+
presentation: xe,
|
|
2057
|
+
defaults: J,
|
|
2058
|
+
session: Sn.optional()
|
|
2059
|
+
}).strict(), Ca = In.superRefine(ee), kn = i.object({
|
|
2004
2060
|
version: i.literal(1),
|
|
2005
2061
|
spec: Y,
|
|
2006
|
-
presentation:
|
|
2007
|
-
defaultView:
|
|
2008
|
-
}).strict(),
|
|
2009
|
-
(e, t) =>
|
|
2010
|
-
),
|
|
2011
|
-
spec:
|
|
2012
|
-
}),
|
|
2013
|
-
|
|
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({
|
|
2014
2070
|
mode: i.literal("layout"),
|
|
2015
2071
|
format: i.enum(["csv", "xlsx", "pdf"]),
|
|
2016
2072
|
expansion: i.union([
|
|
2017
|
-
|
|
2073
|
+
J.extend({ kind: i.literal("current") }).strict(),
|
|
2018
2074
|
i.object({ kind: i.literal("all") }).strict()
|
|
2019
2075
|
])
|
|
2020
2076
|
}).strict(),
|
|
2021
|
-
|
|
2022
|
-
]),
|
|
2023
|
-
(e, t) =>
|
|
2077
|
+
Le.extend({ mode: i.literal("flat"), format: i.literal("csv") }).strict()
|
|
2078
|
+
]), Ya = xn.superRefine(
|
|
2079
|
+
(e, t) => ee(
|
|
2024
2080
|
{
|
|
2025
2081
|
...e,
|
|
2026
2082
|
defaults: e.mode === "layout" && e.expansion.kind === "current" ? e.expansion : {
|
|
@@ -2031,17 +2087,17 @@ const bn = i.object({
|
|
|
2031
2087
|
t
|
|
2032
2088
|
)
|
|
2033
2089
|
);
|
|
2034
|
-
function
|
|
2090
|
+
function Pa(e) {
|
|
2035
2091
|
return e && "id" in e ? e.id : void 0;
|
|
2036
2092
|
}
|
|
2037
|
-
const
|
|
2093
|
+
const Fn = "SUM";
|
|
2038
2094
|
function k(e) {
|
|
2039
2095
|
return typeof e == "string" && e.trim().length > 0;
|
|
2040
2096
|
}
|
|
2041
2097
|
function N(e) {
|
|
2042
2098
|
return k(e) ? e.trim().toLowerCase() : "";
|
|
2043
2099
|
}
|
|
2044
|
-
function
|
|
2100
|
+
function Ba(e) {
|
|
2045
2101
|
const t = k(e.id) ? e.id.trim() : void 0;
|
|
2046
2102
|
if (!t) return;
|
|
2047
2103
|
const n = N(t), o = k(e.table) ? e.table.trim() : void 0;
|
|
@@ -2053,7 +2109,7 @@ function T(e) {
|
|
|
2053
2109
|
if (t)
|
|
2054
2110
|
return N(t) === N(e.datasetName) ? void 0 : t;
|
|
2055
2111
|
}
|
|
2056
|
-
function
|
|
2112
|
+
function Rt(e) {
|
|
2057
2113
|
if (e.kind !== "semantic") return e;
|
|
2058
2114
|
const t = T(e), { datasetId: n, ...o } = e;
|
|
2059
2115
|
return {
|
|
@@ -2061,10 +2117,10 @@ function wt(e) {
|
|
|
2061
2117
|
...t ? { datasetId: t } : {}
|
|
2062
2118
|
};
|
|
2063
2119
|
}
|
|
2064
|
-
function
|
|
2120
|
+
function qa(e) {
|
|
2065
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;
|
|
2066
2122
|
}
|
|
2067
|
-
function
|
|
2123
|
+
function pe(e) {
|
|
2068
2124
|
if (!e)
|
|
2069
2125
|
return "";
|
|
2070
2126
|
if (e.kind === "semantic") {
|
|
@@ -2088,7 +2144,7 @@ function ue(e) {
|
|
|
2088
2144
|
e.label || ""
|
|
2089
2145
|
].join(":");
|
|
2090
2146
|
}
|
|
2091
|
-
function
|
|
2147
|
+
function Fe(e, t) {
|
|
2092
2148
|
if (!e || !t)
|
|
2093
2149
|
return e === t;
|
|
2094
2150
|
if (e.kind !== t.kind)
|
|
@@ -2099,10 +2155,10 @@ function we(e, t) {
|
|
|
2099
2155
|
const n = T(e), o = T(t);
|
|
2100
2156
|
return n && o ? n === o : e.datasetName === t.datasetName;
|
|
2101
2157
|
}
|
|
2102
|
-
return
|
|
2158
|
+
return pe(e) === pe(t);
|
|
2103
2159
|
}
|
|
2104
|
-
function
|
|
2105
|
-
return e.kind !== "semantic" || t.kind !== "semantic" ? e :
|
|
2160
|
+
function Tt(e, t) {
|
|
2161
|
+
return e.kind !== "semantic" || t.kind !== "semantic" ? e : Rt({
|
|
2106
2162
|
...e,
|
|
2107
2163
|
datasetName: e.datasetName || t.datasetName,
|
|
2108
2164
|
datasetId: T(e) || T(t),
|
|
@@ -2110,79 +2166,79 @@ function At(e, t) {
|
|
|
2110
2166
|
connectionId: e.connectionId || t.connectionId
|
|
2111
2167
|
});
|
|
2112
2168
|
}
|
|
2113
|
-
function
|
|
2169
|
+
function La(e) {
|
|
2114
2170
|
const t = [];
|
|
2115
2171
|
for (const n of e) {
|
|
2116
|
-
const o =
|
|
2172
|
+
const o = Rt(
|
|
2117
2173
|
n
|
|
2118
2174
|
), a = t.findIndex(
|
|
2119
|
-
(
|
|
2175
|
+
(s) => Fe(s, o)
|
|
2120
2176
|
);
|
|
2121
2177
|
if (a === -1) {
|
|
2122
2178
|
t.push(o);
|
|
2123
2179
|
continue;
|
|
2124
2180
|
}
|
|
2125
|
-
t[a] =
|
|
2181
|
+
t[a] = Tt(
|
|
2126
2182
|
t[a],
|
|
2127
2183
|
o
|
|
2128
2184
|
);
|
|
2129
2185
|
}
|
|
2130
2186
|
return t;
|
|
2131
2187
|
}
|
|
2132
|
-
function
|
|
2133
|
-
return e.name === t.name &&
|
|
2188
|
+
function Rn(e, t) {
|
|
2189
|
+
return e.name === t.name && Fe(e.source, t.source);
|
|
2134
2190
|
}
|
|
2135
|
-
function
|
|
2191
|
+
function Ua(e) {
|
|
2136
2192
|
return [
|
|
2137
|
-
e.source ?
|
|
2138
|
-
|
|
2193
|
+
e.source ? pe(e.source) : "unknown",
|
|
2194
|
+
Mt(e),
|
|
2139
2195
|
e.name
|
|
2140
2196
|
].filter(Boolean).join(":");
|
|
2141
2197
|
}
|
|
2142
|
-
function
|
|
2143
|
-
return
|
|
2144
|
-
e.aggregate ||
|
|
2198
|
+
function Mt(e) {
|
|
2199
|
+
return Tn(
|
|
2200
|
+
e.aggregate || Fn
|
|
2145
2201
|
);
|
|
2146
2202
|
}
|
|
2147
|
-
function
|
|
2203
|
+
function Tn(e) {
|
|
2148
2204
|
return e.trim().toUpperCase();
|
|
2149
2205
|
}
|
|
2150
|
-
function
|
|
2206
|
+
function Va(e, t) {
|
|
2151
2207
|
return {
|
|
2152
2208
|
...e,
|
|
2153
2209
|
label: e.label || t.label,
|
|
2154
2210
|
role: e.role || t.role,
|
|
2155
2211
|
dataType: e.dataType || t.dataType,
|
|
2156
|
-
source: e.source && t.source ?
|
|
2212
|
+
source: e.source && t.source ? Tt(e.source, t.source) : e.source || t.source
|
|
2157
2213
|
};
|
|
2158
2214
|
}
|
|
2159
|
-
function
|
|
2215
|
+
function Mn(e) {
|
|
2160
2216
|
for (let t = 0; t < e.length; t += 1) {
|
|
2161
2217
|
const n = e[t];
|
|
2162
2218
|
if (e.some(
|
|
2163
|
-
(o, a) => a !== t &&
|
|
2219
|
+
(o, a) => a !== t && Nt(o, n)
|
|
2164
2220
|
))
|
|
2165
2221
|
return !1;
|
|
2166
2222
|
}
|
|
2167
2223
|
return !0;
|
|
2168
2224
|
}
|
|
2169
|
-
function
|
|
2170
|
-
return
|
|
2225
|
+
function Dt(e, t) {
|
|
2226
|
+
return Rn(e, t);
|
|
2171
2227
|
}
|
|
2172
|
-
function
|
|
2173
|
-
return
|
|
2228
|
+
function Nt(e, t) {
|
|
2229
|
+
return Dt(e, t) && C(e) === C(t);
|
|
2174
2230
|
}
|
|
2175
|
-
function
|
|
2231
|
+
function Dn(e) {
|
|
2176
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.`;
|
|
2177
2233
|
}
|
|
2178
|
-
function
|
|
2234
|
+
function Ue(e) {
|
|
2179
2235
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
2180
2236
|
}
|
|
2181
|
-
function
|
|
2237
|
+
function Nn(e, t, n) {
|
|
2182
2238
|
if (e !== void 0) {
|
|
2183
2239
|
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
2184
2240
|
n.push(
|
|
2185
|
-
|
|
2241
|
+
r(
|
|
2186
2242
|
"invalid_sql_default_parameters",
|
|
2187
2243
|
"SQL defaultParameters must be an object keyed by parameter name.",
|
|
2188
2244
|
t
|
|
@@ -2193,7 +2249,7 @@ function Rn(e, t, n) {
|
|
|
2193
2249
|
Object.entries(e).forEach(([o, a]) => {
|
|
2194
2250
|
if (!o.trim()) {
|
|
2195
2251
|
n.push(
|
|
2196
|
-
|
|
2252
|
+
r(
|
|
2197
2253
|
"invalid_sql_default_parameter_name",
|
|
2198
2254
|
"SQL defaultParameters names must be non-empty strings.",
|
|
2199
2255
|
`${t}.${o}`
|
|
@@ -2201,8 +2257,8 @@ function Rn(e, t, n) {
|
|
|
2201
2257
|
);
|
|
2202
2258
|
return;
|
|
2203
2259
|
}
|
|
2204
|
-
(Array.isArray(a) ? a.every(
|
|
2205
|
-
|
|
2260
|
+
(Array.isArray(a) ? a.every(Ue) : Ue(a)) || n.push(
|
|
2261
|
+
r(
|
|
2206
2262
|
"invalid_sql_default_parameter_value",
|
|
2207
2263
|
"SQL defaultParameters values must be strings, numbers, booleans, nulls, or arrays of those scalar values.",
|
|
2208
2264
|
`${t}.${o}`
|
|
@@ -2211,72 +2267,72 @@ function Rn(e, t, n) {
|
|
|
2211
2267
|
});
|
|
2212
2268
|
}
|
|
2213
2269
|
}
|
|
2214
|
-
function
|
|
2215
|
-
return
|
|
2270
|
+
function En(e, t) {
|
|
2271
|
+
return Re(e, t).length === 1;
|
|
2216
2272
|
}
|
|
2217
|
-
function
|
|
2218
|
-
return
|
|
2273
|
+
function jn(e, t) {
|
|
2274
|
+
return Re(e, t).length === 1;
|
|
2219
2275
|
}
|
|
2220
|
-
function
|
|
2276
|
+
function Re(e, t) {
|
|
2221
2277
|
return t.filter(
|
|
2222
|
-
(o) =>
|
|
2278
|
+
(o) => $n(e, o)
|
|
2223
2279
|
);
|
|
2224
2280
|
}
|
|
2225
|
-
function
|
|
2226
|
-
return
|
|
2281
|
+
function $n(e, t) {
|
|
2282
|
+
return Cn(e, t) ? e.source ? Dt(t, e) : !0 : !1;
|
|
2227
2283
|
}
|
|
2228
|
-
function
|
|
2229
|
-
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));
|
|
2230
2286
|
}
|
|
2231
|
-
function
|
|
2287
|
+
function On(e, t) {
|
|
2232
2288
|
return e.role === "measure" || t.role === "measure" || e.aggregate !== void 0 || t.aggregate !== void 0;
|
|
2233
2289
|
}
|
|
2234
2290
|
function C(e) {
|
|
2235
|
-
return
|
|
2291
|
+
return Mt(e);
|
|
2236
2292
|
}
|
|
2237
|
-
const
|
|
2238
|
-
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) {
|
|
2239
2295
|
if (typeof e != "string")
|
|
2240
2296
|
return null;
|
|
2241
|
-
const t = e.trim(), n =
|
|
2297
|
+
const t = e.trim(), n = Yn.exec(t);
|
|
2242
2298
|
if (n) {
|
|
2243
|
-
const [,
|
|
2244
|
-
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;
|
|
2245
2301
|
}
|
|
2246
|
-
const o =
|
|
2302
|
+
const o = Et.exec(t);
|
|
2247
2303
|
if (!o)
|
|
2248
2304
|
return null;
|
|
2249
|
-
const [, a,
|
|
2250
|
-
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))
|
|
2251
2307
|
return null;
|
|
2252
|
-
const
|
|
2253
|
-
return Number.isFinite(
|
|
2308
|
+
const _ = new Date(t);
|
|
2309
|
+
return Number.isFinite(_.getTime()) ? _ : null;
|
|
2254
2310
|
}
|
|
2255
|
-
function
|
|
2256
|
-
return typeof e != "string" || !
|
|
2311
|
+
function Ha(e) {
|
|
2312
|
+
return typeof e != "string" || !Et.test(e.trim()) ? null : me(e);
|
|
2257
2313
|
}
|
|
2258
|
-
function
|
|
2259
|
-
const o = Number(e), a = Number(t),
|
|
2260
|
-
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)
|
|
2261
2317
|
return !1;
|
|
2262
|
-
const l = new Date(Date.UTC(o, a - 1,
|
|
2263
|
-
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;
|
|
2264
2320
|
}
|
|
2265
2321
|
function E(e, t, n) {
|
|
2266
2322
|
const o = Number(e);
|
|
2267
2323
|
return Number.isInteger(o) && o >= t && o <= n;
|
|
2268
2324
|
}
|
|
2269
|
-
function
|
|
2325
|
+
function Pn(e) {
|
|
2270
2326
|
if (e === "Z")
|
|
2271
2327
|
return !0;
|
|
2272
2328
|
const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
|
|
2273
2329
|
return !!(t && E(t[2], 0, 23) && E(t[3], 0, 59));
|
|
2274
2330
|
}
|
|
2275
|
-
function
|
|
2331
|
+
function He(e, t, n) {
|
|
2276
2332
|
if (e !== void 0) {
|
|
2277
2333
|
if (!f(e)) {
|
|
2278
2334
|
n.push(
|
|
2279
|
-
|
|
2335
|
+
r(
|
|
2280
2336
|
"invalid_pagination",
|
|
2281
2337
|
"Pagination must be an object with positive integer page and pageSize.",
|
|
2282
2338
|
t
|
|
@@ -2285,13 +2341,13 @@ function qe(e, t, n) {
|
|
|
2285
2341
|
return;
|
|
2286
2342
|
}
|
|
2287
2343
|
(!Number.isInteger(e.page) || typeof e.page != "number" || e.page < 1) && n.push(
|
|
2288
|
-
|
|
2344
|
+
r(
|
|
2289
2345
|
"invalid_pagination_page",
|
|
2290
2346
|
"Pagination page must be a positive integer.",
|
|
2291
2347
|
`${t}.page`
|
|
2292
2348
|
)
|
|
2293
2349
|
), (!Number.isInteger(e.pageSize) || typeof e.pageSize != "number" || e.pageSize < 1) && n.push(
|
|
2294
|
-
|
|
2350
|
+
r(
|
|
2295
2351
|
"invalid_pagination_page_size",
|
|
2296
2352
|
"Pagination pageSize must be a positive integer.",
|
|
2297
2353
|
`${t}.pageSize`
|
|
@@ -2299,7 +2355,7 @@ function qe(e, t, n) {
|
|
|
2299
2355
|
);
|
|
2300
2356
|
}
|
|
2301
2357
|
}
|
|
2302
|
-
function
|
|
2358
|
+
function Ge(e) {
|
|
2303
2359
|
const t = /* @__PURE__ */ new Set();
|
|
2304
2360
|
for (const n of e) {
|
|
2305
2361
|
if (t.has(n))
|
|
@@ -2308,10 +2364,10 @@ function Le(e) {
|
|
|
2308
2364
|
}
|
|
2309
2365
|
return null;
|
|
2310
2366
|
}
|
|
2311
|
-
function
|
|
2367
|
+
function Bn(e, t, n) {
|
|
2312
2368
|
if (!f(e)) {
|
|
2313
2369
|
n.push(
|
|
2314
|
-
|
|
2370
|
+
r(
|
|
2315
2371
|
"invalid_input_binding",
|
|
2316
2372
|
"Input bindings must be structured objects.",
|
|
2317
2373
|
t
|
|
@@ -2320,27 +2376,27 @@ function Cn(e, t, n) {
|
|
|
2320
2376
|
return;
|
|
2321
2377
|
}
|
|
2322
2378
|
p(e.inputId) || n.push(
|
|
2323
|
-
|
|
2379
|
+
r(
|
|
2324
2380
|
"invalid_input_binding",
|
|
2325
2381
|
"Input bindings need a non-empty inputId.",
|
|
2326
2382
|
`${t}.inputId`
|
|
2327
2383
|
)
|
|
2328
2384
|
), e.kind !== void 0 && e.kind !== "filter" && e.kind !== "control" && n.push(
|
|
2329
|
-
|
|
2385
|
+
r(
|
|
2330
2386
|
"invalid_input_binding",
|
|
2331
2387
|
"Input binding kind must be filter or control.",
|
|
2332
2388
|
`${t}.kind`
|
|
2333
2389
|
)
|
|
2334
|
-
), 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(
|
|
2335
2391
|
e.relationshipHint,
|
|
2336
2392
|
`${t}.relationshipHint`,
|
|
2337
2393
|
n
|
|
2338
2394
|
);
|
|
2339
2395
|
}
|
|
2340
|
-
function
|
|
2396
|
+
function Te(e, t, n) {
|
|
2341
2397
|
if (!f(e)) {
|
|
2342
2398
|
n.push(
|
|
2343
|
-
|
|
2399
|
+
r(
|
|
2344
2400
|
"invalid_relationship_hint",
|
|
2345
2401
|
"Relationship hints must be structured objects.",
|
|
2346
2402
|
t
|
|
@@ -2349,39 +2405,39 @@ function xe(e, t, n) {
|
|
|
2349
2405
|
return;
|
|
2350
2406
|
}
|
|
2351
2407
|
e.relationshipIds !== void 0 && (!Array.isArray(e.relationshipIds) || e.relationshipIds.some((o) => !p(o))) && n.push(
|
|
2352
|
-
|
|
2408
|
+
r(
|
|
2353
2409
|
"invalid_relationship_hint",
|
|
2354
2410
|
"Relationship hint relationshipIds must be non-empty strings.",
|
|
2355
2411
|
`${t}.relationshipIds`
|
|
2356
2412
|
)
|
|
2357
2413
|
);
|
|
2358
2414
|
}
|
|
2359
|
-
function
|
|
2415
|
+
function qn(e, t) {
|
|
2360
2416
|
var o, a;
|
|
2361
2417
|
if (((o = e.source) == null ? void 0 : o.kind) !== "semantic" && ((a = e.source) == null ? void 0 : a.kind) !== "physical" && t.push(
|
|
2362
|
-
|
|
2418
|
+
r(
|
|
2363
2419
|
"invalid_input_options_source",
|
|
2364
2420
|
"Input options must use a semantic or physical source.",
|
|
2365
2421
|
"source"
|
|
2366
2422
|
)
|
|
2367
2423
|
), p(e.inputId) || t.push(
|
|
2368
|
-
|
|
2424
|
+
r(
|
|
2369
2425
|
"missing_input_options_input_id",
|
|
2370
2426
|
"Input options intent needs the inputId it populates.",
|
|
2371
2427
|
"inputId"
|
|
2372
2428
|
)
|
|
2373
2429
|
), e.search !== void 0 && typeof e.search != "string" && t.push(
|
|
2374
|
-
|
|
2430
|
+
r(
|
|
2375
2431
|
"invalid_input_options_search",
|
|
2376
2432
|
"Input options search must be a string.",
|
|
2377
2433
|
"search"
|
|
2378
2434
|
)
|
|
2379
2435
|
), e.matchValues !== void 0) {
|
|
2380
|
-
const
|
|
2381
|
-
|
|
2382
|
-
|
|
2436
|
+
const s = qt(e.matchValues);
|
|
2437
|
+
s.ok || t.push(
|
|
2438
|
+
r("invalid_input_options_match_values", s.error, "matchValues")
|
|
2383
2439
|
), typeof e.search == "string" && e.search.trim() && t.push(
|
|
2384
|
-
|
|
2440
|
+
r(
|
|
2385
2441
|
"invalid_input_options_match_values",
|
|
2386
2442
|
"Input options matchValues cannot be combined with search.",
|
|
2387
2443
|
"matchValues"
|
|
@@ -2389,13 +2445,13 @@ function On(e, t) {
|
|
|
2389
2445
|
);
|
|
2390
2446
|
}
|
|
2391
2447
|
if (e.limit !== void 0 && (typeof e.limit != "number" || !Number.isFinite(e.limit) || !Number.isInteger(e.limit) || e.limit <= 0) && t.push(
|
|
2392
|
-
|
|
2448
|
+
r(
|
|
2393
2449
|
"invalid_input_options_limit",
|
|
2394
2450
|
"Input options limit must be a positive finite number.",
|
|
2395
2451
|
"limit"
|
|
2396
2452
|
)
|
|
2397
2453
|
), (!e.labelField || !p(e.labelField.name)) && t.push(
|
|
2398
|
-
|
|
2454
|
+
r(
|
|
2399
2455
|
"missing_input_options_label_field",
|
|
2400
2456
|
"Input options intent needs a labelField.",
|
|
2401
2457
|
"labelField"
|
|
@@ -2403,7 +2459,7 @@ function On(e, t) {
|
|
|
2403
2459
|
), b(e.labelField, "labelField", t, {
|
|
2404
2460
|
required: !0
|
|
2405
2461
|
}), (!e.valueField || !p(e.valueField.name)) && t.push(
|
|
2406
|
-
|
|
2462
|
+
r(
|
|
2407
2463
|
"missing_input_options_value_field",
|
|
2408
2464
|
"Input options intent needs a valueField.",
|
|
2409
2465
|
"valueField"
|
|
@@ -2412,12 +2468,12 @@ function On(e, t) {
|
|
|
2412
2468
|
required: !0
|
|
2413
2469
|
}), e.searchField !== void 0 && b(e.searchField, "searchField", t, {
|
|
2414
2470
|
required: !0
|
|
2415
|
-
}), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((
|
|
2416
|
-
b(
|
|
2471
|
+
}), e.disambiguationFields !== void 0 && (Array.isArray(e.disambiguationFields) ? e.disambiguationFields.forEach((s, l) => {
|
|
2472
|
+
b(s, `disambiguationFields.${l}`, t, {
|
|
2417
2473
|
required: !0
|
|
2418
2474
|
});
|
|
2419
2475
|
}) : t.push(
|
|
2420
|
-
|
|
2476
|
+
r(
|
|
2421
2477
|
"invalid_input_options_disambiguation_fields",
|
|
2422
2478
|
"Input options disambiguationFields must be an array of field refs.",
|
|
2423
2479
|
"disambiguationFields"
|
|
@@ -2426,71 +2482,71 @@ function On(e, t) {
|
|
|
2426
2482
|
{ field: e.labelField, path: "labelField" },
|
|
2427
2483
|
{ field: e.valueField, path: "valueField" },
|
|
2428
2484
|
...e.searchField ? [{ field: e.searchField, path: "searchField" }] : [],
|
|
2429
|
-
...Array.isArray(e.disambiguationFields) ? e.disambiguationFields.map((
|
|
2430
|
-
field:
|
|
2485
|
+
...Array.isArray(e.disambiguationFields) ? e.disambiguationFields.map((s, l) => ({
|
|
2486
|
+
field: s,
|
|
2431
2487
|
path: `disambiguationFields.${l}`
|
|
2432
2488
|
})) : []
|
|
2433
|
-
].forEach(({ field:
|
|
2434
|
-
|
|
2435
|
-
|
|
2489
|
+
].forEach(({ field: s, path: l }) => {
|
|
2490
|
+
s != null && s.source && !Fe(s.source, e.source) && t.push(
|
|
2491
|
+
r(
|
|
2436
2492
|
"input_options_field_source_mismatch",
|
|
2437
2493
|
"Input option fields must belong to the declared option source.",
|
|
2438
2494
|
`${l}.source`
|
|
2439
2495
|
)
|
|
2440
2496
|
);
|
|
2441
2497
|
}), e.dependencies !== void 0) {
|
|
2442
|
-
const
|
|
2498
|
+
const s = Un(
|
|
2443
2499
|
e.dependencies
|
|
2444
2500
|
);
|
|
2445
|
-
t.push(...
|
|
2501
|
+
t.push(...s.errors), s.ok && Hn(e, t);
|
|
2446
2502
|
}
|
|
2447
2503
|
if (e.population !== void 0) {
|
|
2448
|
-
const
|
|
2449
|
-
if (!f(
|
|
2504
|
+
const s = e.population;
|
|
2505
|
+
if (!f(s))
|
|
2450
2506
|
t.push(
|
|
2451
|
-
|
|
2507
|
+
r(
|
|
2452
2508
|
"invalid_input_options_population",
|
|
2453
2509
|
"Input options population must be a structured object.",
|
|
2454
2510
|
"population"
|
|
2455
2511
|
)
|
|
2456
2512
|
);
|
|
2457
2513
|
else {
|
|
2458
|
-
const l =
|
|
2514
|
+
const l = s.kind;
|
|
2459
2515
|
l !== "option_source" && l !== "related_population" && t.push(
|
|
2460
|
-
|
|
2516
|
+
r(
|
|
2461
2517
|
"invalid_input_options_population",
|
|
2462
2518
|
"Input options population kind must be option_source or related_population.",
|
|
2463
2519
|
"population.kind"
|
|
2464
2520
|
)
|
|
2465
|
-
), l === "option_source" &&
|
|
2466
|
-
|
|
2521
|
+
), l === "option_source" && s.baseSource !== void 0 && t.push(
|
|
2522
|
+
r(
|
|
2467
2523
|
"invalid_input_options_population",
|
|
2468
2524
|
"Input options population baseSource is only valid for related_population.",
|
|
2469
2525
|
"population.baseSource"
|
|
2470
2526
|
)
|
|
2471
|
-
), l === "option_source" &&
|
|
2472
|
-
|
|
2527
|
+
), l === "option_source" && s.relationshipHint !== void 0 && t.push(
|
|
2528
|
+
r(
|
|
2473
2529
|
"invalid_input_options_population",
|
|
2474
2530
|
"Input options population relationshipHint is only valid for related_population.",
|
|
2475
2531
|
"population.relationshipHint"
|
|
2476
2532
|
)
|
|
2477
|
-
), l === "related_population" && (
|
|
2478
|
-
|
|
2533
|
+
), l === "related_population" && (be(
|
|
2534
|
+
s.baseSource,
|
|
2479
2535
|
"population.baseSource",
|
|
2480
2536
|
t
|
|
2481
|
-
),
|
|
2482
|
-
|
|
2537
|
+
), s.relationshipHint !== void 0 && Te(
|
|
2538
|
+
s.relationshipHint,
|
|
2483
2539
|
"population.relationshipHint",
|
|
2484
2540
|
t
|
|
2485
2541
|
));
|
|
2486
2542
|
}
|
|
2487
2543
|
}
|
|
2488
2544
|
}
|
|
2489
|
-
function
|
|
2545
|
+
function Ln(e, t) {
|
|
2490
2546
|
if (!(!("inputs" in e) || e.inputs === void 0)) {
|
|
2491
2547
|
if (!Array.isArray(e.inputs)) {
|
|
2492
2548
|
t.push(
|
|
2493
|
-
|
|
2549
|
+
r(
|
|
2494
2550
|
"invalid_input_binding",
|
|
2495
2551
|
"Analytics intent inputs must be an array of input bindings.",
|
|
2496
2552
|
"inputs"
|
|
@@ -2499,15 +2555,15 @@ function Yn(e, t) {
|
|
|
2499
2555
|
return;
|
|
2500
2556
|
}
|
|
2501
2557
|
e.inputs.forEach(
|
|
2502
|
-
(n, o) =>
|
|
2558
|
+
(n, o) => Bn(n, `inputs.${o}`, t)
|
|
2503
2559
|
);
|
|
2504
2560
|
}
|
|
2505
2561
|
}
|
|
2506
|
-
function
|
|
2562
|
+
function Un(e, t = "protocol") {
|
|
2507
2563
|
const n = [];
|
|
2508
2564
|
if (!f(e))
|
|
2509
2565
|
return n.push(
|
|
2510
|
-
|
|
2566
|
+
r(
|
|
2511
2567
|
"invalid_input_options_dependencies",
|
|
2512
2568
|
"Input options dependencies must be a structured object.",
|
|
2513
2569
|
"dependencies"
|
|
@@ -2515,88 +2571,88 @@ function Pn(e, t = "protocol") {
|
|
|
2515
2571
|
), { ok: !1, errors: n, warnings: [] };
|
|
2516
2572
|
const o = e, a = o.mode;
|
|
2517
2573
|
if (a !== void 0 && a !== "independent" && a !== "explicit" && a !== "all_applicable" && n.push(
|
|
2518
|
-
|
|
2574
|
+
r(
|
|
2519
2575
|
"invalid_input_options_dependencies",
|
|
2520
2576
|
"Input options dependencies mode must be independent, explicit, or all_applicable.",
|
|
2521
2577
|
"dependencies.mode"
|
|
2522
2578
|
)
|
|
2523
|
-
),
|
|
2579
|
+
), se(
|
|
2524
2580
|
o.includeInputIds,
|
|
2525
2581
|
"dependencies.includeInputIds",
|
|
2526
2582
|
n,
|
|
2527
2583
|
"Input options includeInputIds must be non-empty strings."
|
|
2528
|
-
),
|
|
2584
|
+
), se(
|
|
2529
2585
|
o.excludeInputIds,
|
|
2530
2586
|
"dependencies.excludeInputIds",
|
|
2531
2587
|
n,
|
|
2532
2588
|
"Input options excludeInputIds must be non-empty strings."
|
|
2533
2589
|
), a === "all_applicable" && o.includeInputIds !== void 0 && n.push(
|
|
2534
|
-
|
|
2590
|
+
r(
|
|
2535
2591
|
"invalid_input_options_dependencies",
|
|
2536
2592
|
"All applicable dependencies cannot specify includeInputIds.",
|
|
2537
2593
|
"dependencies.includeInputIds"
|
|
2538
2594
|
)
|
|
2539
|
-
),
|
|
2595
|
+
), se(
|
|
2540
2596
|
o.omitInputIds,
|
|
2541
2597
|
"dependencies.omitInputIds",
|
|
2542
2598
|
n,
|
|
2543
2599
|
"Input options omitInputIds must be non-empty strings."
|
|
2544
2600
|
), Array.isArray(o.omitInputIds)) {
|
|
2545
|
-
const
|
|
2601
|
+
const s = new Set(
|
|
2546
2602
|
Array.isArray(o.includeInputIds) ? o.includeInputIds : []
|
|
2547
2603
|
);
|
|
2548
|
-
(a !== "explicit" || new Set(o.omitInputIds).size !== o.omitInputIds.length || o.omitInputIds.some((l) => !
|
|
2549
|
-
|
|
2604
|
+
(a !== "explicit" || new Set(o.omitInputIds).size !== o.omitInputIds.length || o.omitInputIds.some((l) => !s.has(l))) && n.push(
|
|
2605
|
+
r(
|
|
2550
2606
|
"invalid_input_options_dependencies",
|
|
2551
2607
|
"A browse override may only omit unique ids from an explicit includeInputIds list.",
|
|
2552
2608
|
"dependencies.omitInputIds"
|
|
2553
2609
|
)
|
|
2554
2610
|
);
|
|
2555
2611
|
}
|
|
2556
|
-
return t === "dashboard" &&
|
|
2612
|
+
return t === "dashboard" && Vn(o, n), { ok: n.length === 0, errors: n, warnings: [] };
|
|
2557
2613
|
}
|
|
2558
|
-
function
|
|
2614
|
+
function Vn(e, t) {
|
|
2559
2615
|
const { mode: n, includeInputIds: o, excludeInputIds: a } = e;
|
|
2560
2616
|
n === void 0 && t.push(
|
|
2561
|
-
|
|
2617
|
+
r(
|
|
2562
2618
|
"invalid_input_options_dependencies",
|
|
2563
2619
|
"Dashboard option dependencies must declare a mode.",
|
|
2564
2620
|
"dependencies.mode"
|
|
2565
2621
|
)
|
|
2566
2622
|
);
|
|
2567
|
-
for (const [
|
|
2623
|
+
for (const [s, l] of [
|
|
2568
2624
|
["dependencies.includeInputIds", o],
|
|
2569
2625
|
["dependencies.excludeInputIds", a]
|
|
2570
2626
|
])
|
|
2571
2627
|
Array.isArray(l) && new Set(l).size !== l.length && t.push(
|
|
2572
|
-
|
|
2628
|
+
r(
|
|
2573
2629
|
"invalid_input_options_dependencies",
|
|
2574
2630
|
"Dashboard option dependency input IDs must be unique.",
|
|
2575
|
-
|
|
2631
|
+
s
|
|
2576
2632
|
)
|
|
2577
2633
|
);
|
|
2578
2634
|
n === "independent" && (o !== void 0 || a !== void 0) && t.push(
|
|
2579
|
-
|
|
2635
|
+
r(
|
|
2580
2636
|
"invalid_input_options_dependencies",
|
|
2581
2637
|
"Independent dashboard dependencies cannot specify input IDs.",
|
|
2582
2638
|
"dependencies"
|
|
2583
2639
|
)
|
|
2584
2640
|
), n === "explicit" && (!Array.isArray(o) || o.length === 0 || a !== void 0) && t.push(
|
|
2585
|
-
|
|
2641
|
+
r(
|
|
2586
2642
|
"invalid_input_options_dependencies",
|
|
2587
2643
|
"Explicit dashboard dependencies require included input IDs and cannot specify exclusions.",
|
|
2588
2644
|
"dependencies"
|
|
2589
2645
|
)
|
|
2590
2646
|
);
|
|
2591
2647
|
}
|
|
2592
|
-
function
|
|
2593
|
-
var a,
|
|
2648
|
+
function Hn(e, t) {
|
|
2649
|
+
var a, s, l;
|
|
2594
2650
|
const n = new Set(
|
|
2595
2651
|
Array.isArray(e.inputs) ? e.inputs.map((d) => f(d) ? d.inputId : void 0).filter((d) => typeof d == "string") : []
|
|
2596
2652
|
), o = new Set(((a = e.dependencies) == null ? void 0 : a.omitInputIds) || []);
|
|
2597
|
-
for (const d of ((
|
|
2653
|
+
for (const d of ((s = e.dependencies) == null ? void 0 : s.includeInputIds) || [])
|
|
2598
2654
|
!n.has(d) && !o.has(d) && t.push(
|
|
2599
|
-
|
|
2655
|
+
r(
|
|
2600
2656
|
"invalid_input_options_dependencies",
|
|
2601
2657
|
`Input options dependency "${d}" is not declared in inputs.`,
|
|
2602
2658
|
"dependencies.includeInputIds"
|
|
@@ -2604,21 +2660,21 @@ function qn(e, t) {
|
|
|
2604
2660
|
);
|
|
2605
2661
|
for (const d of ((l = e.dependencies) == null ? void 0 : l.excludeInputIds) || [])
|
|
2606
2662
|
d !== e.inputId && !n.has(d) && t.push(
|
|
2607
|
-
|
|
2663
|
+
r(
|
|
2608
2664
|
"invalid_input_options_dependencies",
|
|
2609
2665
|
`Input options dependency exclusion "${d}" is not the populated inputId and is not declared in inputs.`,
|
|
2610
2666
|
"dependencies.excludeInputIds"
|
|
2611
2667
|
)
|
|
2612
2668
|
);
|
|
2613
2669
|
}
|
|
2614
|
-
function
|
|
2615
|
-
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));
|
|
2616
2672
|
}
|
|
2617
|
-
const
|
|
2618
|
-
function
|
|
2673
|
+
const Gn = new Set(z);
|
|
2674
|
+
function zn(e, t, n) {
|
|
2619
2675
|
if (f(e) && e.type === "temporal_bucket") {
|
|
2620
2676
|
n.push(
|
|
2621
|
-
|
|
2677
|
+
r(
|
|
2622
2678
|
"invalid_scalar_value_format",
|
|
2623
2679
|
"Scalar and measure slots cannot own temporal bucket presentation; declare it with grain on a grouped field or axis.",
|
|
2624
2680
|
t
|
|
@@ -2626,12 +2682,12 @@ function Un(e, t, n) {
|
|
|
2626
2682
|
);
|
|
2627
2683
|
return;
|
|
2628
2684
|
}
|
|
2629
|
-
|
|
2685
|
+
nt(e, t, n);
|
|
2630
2686
|
}
|
|
2631
|
-
function
|
|
2687
|
+
function ze(e, t, n) {
|
|
2632
2688
|
if (!f(e)) {
|
|
2633
2689
|
n.push(
|
|
2634
|
-
|
|
2690
|
+
r(
|
|
2635
2691
|
"invalid_result_column_ref",
|
|
2636
2692
|
"Result calculation references must use columnKey or field.",
|
|
2637
2693
|
t
|
|
@@ -2642,7 +2698,7 @@ function Ue(e, t, n) {
|
|
|
2642
2698
|
const o = p(e.columnKey), a = f(e.field);
|
|
2643
2699
|
if (o === a) {
|
|
2644
2700
|
n.push(
|
|
2645
|
-
|
|
2701
|
+
r(
|
|
2646
2702
|
"invalid_result_column_ref",
|
|
2647
2703
|
"Result calculation references must identify exactly one of columnKey or field.",
|
|
2648
2704
|
t
|
|
@@ -2654,10 +2710,10 @@ function Ue(e, t, n) {
|
|
|
2654
2710
|
required: !0
|
|
2655
2711
|
});
|
|
2656
2712
|
}
|
|
2657
|
-
function
|
|
2713
|
+
function Kn(e, t, n) {
|
|
2658
2714
|
if (!f(e)) {
|
|
2659
2715
|
n.push(
|
|
2660
|
-
|
|
2716
|
+
r(
|
|
2661
2717
|
"invalid_result_calculation_output",
|
|
2662
2718
|
"Result calculation output must be a structured object.",
|
|
2663
2719
|
t
|
|
@@ -2666,25 +2722,25 @@ function Vn(e, t, n) {
|
|
|
2666
2722
|
return;
|
|
2667
2723
|
}
|
|
2668
2724
|
p(e.key) || n.push(
|
|
2669
|
-
|
|
2725
|
+
r(
|
|
2670
2726
|
"invalid_result_calculation_output",
|
|
2671
2727
|
"Result calculation output needs a stable key.",
|
|
2672
2728
|
`${t}.key`
|
|
2673
2729
|
)
|
|
2674
|
-
), e.dataType !== void 0 && (typeof e.dataType != "string" || !
|
|
2675
|
-
|
|
2730
|
+
), e.dataType !== void 0 && (typeof e.dataType != "string" || !it.has(e.dataType)) && n.push(
|
|
2731
|
+
r(
|
|
2676
2732
|
"invalid_result_calculation_output",
|
|
2677
2733
|
"Result calculation output dataType must be string, number, boolean, date, datetime, or unknown.",
|
|
2678
2734
|
`${t}.dataType`
|
|
2679
2735
|
)
|
|
2680
|
-
),
|
|
2736
|
+
), zn(e.format, `${t}.format`, n);
|
|
2681
2737
|
}
|
|
2682
|
-
function
|
|
2738
|
+
function Qn(e, t) {
|
|
2683
2739
|
if (e.analysis === void 0)
|
|
2684
2740
|
return;
|
|
2685
2741
|
if (!f(e.analysis)) {
|
|
2686
2742
|
t.push(
|
|
2687
|
-
|
|
2743
|
+
r(
|
|
2688
2744
|
"invalid_measure_analysis",
|
|
2689
2745
|
"Metric analysis must be a structured object.",
|
|
2690
2746
|
"analysis"
|
|
@@ -2694,7 +2750,7 @@ function Hn(e, t) {
|
|
|
2694
2750
|
}
|
|
2695
2751
|
if (e.analysis.kind !== "period_change") {
|
|
2696
2752
|
t.push(
|
|
2697
|
-
|
|
2753
|
+
r(
|
|
2698
2754
|
"invalid_measure_analysis",
|
|
2699
2755
|
"Metric analysis kind is not supported.",
|
|
2700
2756
|
"analysis.kind"
|
|
@@ -2703,31 +2759,31 @@ function Hn(e, t) {
|
|
|
2703
2759
|
return;
|
|
2704
2760
|
}
|
|
2705
2761
|
e.dateField || t.push(
|
|
2706
|
-
|
|
2762
|
+
r(
|
|
2707
2763
|
"missing_analysis_date_field",
|
|
2708
2764
|
"Period-change analysis needs a dateField.",
|
|
2709
2765
|
"dateField"
|
|
2710
2766
|
)
|
|
2711
2767
|
), e.timeGrain || t.push(
|
|
2712
|
-
|
|
2768
|
+
r(
|
|
2713
2769
|
"missing_analysis_time_grain",
|
|
2714
2770
|
"Period-change analysis needs a timeGrain.",
|
|
2715
2771
|
"timeGrain"
|
|
2716
2772
|
)
|
|
2717
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(
|
|
2718
|
-
|
|
2774
|
+
r(
|
|
2719
2775
|
"invalid_measure_analysis",
|
|
2720
2776
|
"Period-change analysis orderBy must be absolute_change, positive_change, negative_change, or period.",
|
|
2721
2777
|
"analysis.orderBy"
|
|
2722
2778
|
)
|
|
2723
2779
|
);
|
|
2724
2780
|
const { timeWindow: n } = e.analysis;
|
|
2725
|
-
n !== void 0 &&
|
|
2781
|
+
n !== void 0 && fe(n, "analysis.timeWindow", t);
|
|
2726
2782
|
}
|
|
2727
|
-
function
|
|
2783
|
+
function fe(e, t, n) {
|
|
2728
2784
|
if (!f(e)) {
|
|
2729
2785
|
n.push(
|
|
2730
|
-
|
|
2786
|
+
r(
|
|
2731
2787
|
"invalid_time_window",
|
|
2732
2788
|
"Time window must be a structured object.",
|
|
2733
2789
|
t
|
|
@@ -2736,40 +2792,40 @@ function pe(e, t, n) {
|
|
|
2736
2792
|
return;
|
|
2737
2793
|
}
|
|
2738
2794
|
if (e.kind !== void 0 && e.kind !== "relative" && e.kind !== "absolute" && n.push(
|
|
2739
|
-
|
|
2795
|
+
r(
|
|
2740
2796
|
"invalid_time_window",
|
|
2741
2797
|
"Time window kind must be relative or absolute.",
|
|
2742
2798
|
`${t}.kind`
|
|
2743
2799
|
)
|
|
2744
2800
|
), e.kind === "absolute") {
|
|
2745
2801
|
if (p(e.start) || n.push(
|
|
2746
|
-
|
|
2802
|
+
r(
|
|
2747
2803
|
"invalid_time_window",
|
|
2748
2804
|
"Absolute time window start must be a non-empty ISO date or timestamp string.",
|
|
2749
2805
|
`${t}.start`
|
|
2750
2806
|
)
|
|
2751
2807
|
), p(e.end) || n.push(
|
|
2752
|
-
|
|
2808
|
+
r(
|
|
2753
2809
|
"invalid_time_window",
|
|
2754
2810
|
"Absolute time window end must be a non-empty ISO date or timestamp string.",
|
|
2755
2811
|
`${t}.end`
|
|
2756
2812
|
)
|
|
2757
2813
|
), p(e.start) && p(e.end)) {
|
|
2758
|
-
const o =
|
|
2814
|
+
const o = me(e.start), a = me(e.end);
|
|
2759
2815
|
o || n.push(
|
|
2760
|
-
|
|
2816
|
+
r(
|
|
2761
2817
|
"invalid_time_window",
|
|
2762
2818
|
"Absolute time window start must be a valid ISO date or timestamp.",
|
|
2763
2819
|
`${t}.start`
|
|
2764
2820
|
)
|
|
2765
2821
|
), a || n.push(
|
|
2766
|
-
|
|
2822
|
+
r(
|
|
2767
2823
|
"invalid_time_window",
|
|
2768
2824
|
"Absolute time window end must be a valid ISO date or timestamp.",
|
|
2769
2825
|
`${t}.end`
|
|
2770
2826
|
)
|
|
2771
2827
|
), o && a && o.getTime() > a.getTime() && n.push(
|
|
2772
|
-
|
|
2828
|
+
r(
|
|
2773
2829
|
"invalid_time_window",
|
|
2774
2830
|
"Absolute time window start must be before or equal to end.",
|
|
2775
2831
|
t
|
|
@@ -2778,37 +2834,37 @@ function pe(e, t, n) {
|
|
|
2778
2834
|
}
|
|
2779
2835
|
return;
|
|
2780
2836
|
}
|
|
2781
|
-
(typeof e.unit != "string" || !
|
|
2782
|
-
|
|
2837
|
+
(typeof e.unit != "string" || !Gn.has(e.unit)) && n.push(
|
|
2838
|
+
r(
|
|
2783
2839
|
"invalid_time_window",
|
|
2784
|
-
`Time window unit must be one of: ${
|
|
2840
|
+
`Time window unit must be one of: ${z.join(", ")}.`,
|
|
2785
2841
|
`${t}.unit`
|
|
2786
2842
|
)
|
|
2787
2843
|
), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && n.push(
|
|
2788
|
-
|
|
2844
|
+
r(
|
|
2789
2845
|
"invalid_time_window",
|
|
2790
2846
|
"Time window value must be a positive number.",
|
|
2791
2847
|
`${t}.value`
|
|
2792
2848
|
)
|
|
2793
2849
|
), e.anchor !== void 0 && e.anchor !== "now" && e.anchor !== "latest_available" && n.push(
|
|
2794
|
-
|
|
2850
|
+
r(
|
|
2795
2851
|
"invalid_time_window",
|
|
2796
2852
|
"Time window anchor must be now or latest_available.",
|
|
2797
2853
|
`${t}.anchor`
|
|
2798
2854
|
)
|
|
2799
2855
|
), e.completeness !== void 0 && e.completeness !== "include_partial" && e.completeness !== "complete_periods" && n.push(
|
|
2800
|
-
|
|
2856
|
+
r(
|
|
2801
2857
|
"invalid_time_window",
|
|
2802
2858
|
"Time window completeness must be include_partial or complete_periods.",
|
|
2803
2859
|
`${t}.completeness`
|
|
2804
2860
|
)
|
|
2805
2861
|
);
|
|
2806
2862
|
}
|
|
2807
|
-
function
|
|
2863
|
+
function ge(e, t, n) {
|
|
2808
2864
|
if (e !== void 0) {
|
|
2809
2865
|
if (!Array.isArray(e)) {
|
|
2810
2866
|
n.push(
|
|
2811
|
-
|
|
2867
|
+
r(
|
|
2812
2868
|
"invalid_analytics_filters",
|
|
2813
2869
|
"Analytics filters must be an array.",
|
|
2814
2870
|
t
|
|
@@ -2818,62 +2874,62 @@ function me(e, t, n) {
|
|
|
2818
2874
|
}
|
|
2819
2875
|
e.forEach((o, a) => {
|
|
2820
2876
|
var c;
|
|
2821
|
-
const
|
|
2877
|
+
const s = `${t}.${a}`;
|
|
2822
2878
|
if (!f(o)) {
|
|
2823
2879
|
n.push(
|
|
2824
|
-
|
|
2880
|
+
r(
|
|
2825
2881
|
"invalid_analytics_filter",
|
|
2826
2882
|
"Analytics filter must be a structured object.",
|
|
2827
|
-
|
|
2883
|
+
s
|
|
2828
2884
|
)
|
|
2829
2885
|
);
|
|
2830
2886
|
return;
|
|
2831
2887
|
}
|
|
2832
2888
|
const l = o;
|
|
2833
|
-
b(l.field, `${
|
|
2889
|
+
b(l.field, `${s}.field`, n, {
|
|
2834
2890
|
required: !0
|
|
2835
2891
|
}), l.scope !== void 0 && l.scope !== "row" && l.scope !== "aggregate" && n.push(
|
|
2836
|
-
|
|
2892
|
+
r(
|
|
2837
2893
|
"invalid_analytics_filter_scope",
|
|
2838
2894
|
"Analytics filter scope must be row or aggregate.",
|
|
2839
|
-
`${
|
|
2895
|
+
`${s}.scope`
|
|
2840
2896
|
)
|
|
2841
2897
|
), l.scope === "aggregate" && ((c = l.field) == null ? void 0 : c.role) !== void 0 && l.field.role !== "measure" && n.push(
|
|
2842
|
-
|
|
2898
|
+
r(
|
|
2843
2899
|
"invalid_analytics_filter_scope",
|
|
2844
2900
|
"Aggregate-scope analytics filters must target a measure field.",
|
|
2845
|
-
`${
|
|
2901
|
+
`${s}.scope`
|
|
2846
2902
|
)
|
|
2847
2903
|
);
|
|
2848
2904
|
const d = l.operator === "is_null" || l.operator === "is_not_null";
|
|
2849
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(
|
|
2850
|
-
|
|
2906
|
+
r(
|
|
2851
2907
|
"invalid_analytics_filter_operator",
|
|
2852
2908
|
"Analytics filter operator is not supported.",
|
|
2853
|
-
`${
|
|
2909
|
+
`${s}.operator`
|
|
2854
2910
|
)
|
|
2855
2911
|
), l.values === void 0 && !d && n.push(
|
|
2856
|
-
|
|
2912
|
+
r(
|
|
2857
2913
|
"missing_analytics_filter_value",
|
|
2858
2914
|
"Analytics filter needs values unless it is a null check.",
|
|
2859
|
-
|
|
2915
|
+
s
|
|
2860
2916
|
)
|
|
2861
2917
|
), d && l.values !== void 0) {
|
|
2862
2918
|
n.push(
|
|
2863
|
-
|
|
2919
|
+
r(
|
|
2864
2920
|
"invalid_analytics_filter_values",
|
|
2865
2921
|
"Null-check analytics filters must not include values.",
|
|
2866
|
-
`${
|
|
2922
|
+
`${s}.values`
|
|
2867
2923
|
)
|
|
2868
2924
|
);
|
|
2869
2925
|
return;
|
|
2870
2926
|
}
|
|
2871
2927
|
if (l.values !== void 0 && !Array.isArray(l.values)) {
|
|
2872
2928
|
n.push(
|
|
2873
|
-
|
|
2929
|
+
r(
|
|
2874
2930
|
"invalid_analytics_filter_values",
|
|
2875
2931
|
"Analytics filter values must be an array when provided.",
|
|
2876
|
-
`${
|
|
2932
|
+
`${s}.values`
|
|
2877
2933
|
)
|
|
2878
2934
|
);
|
|
2879
2935
|
return;
|
|
@@ -2882,68 +2938,68 @@ function me(e, t, n) {
|
|
|
2882
2938
|
const u = l.values.length;
|
|
2883
2939
|
if (l.operator === "between" || l.operator === "not_between") {
|
|
2884
2940
|
u !== 2 && n.push(
|
|
2885
|
-
|
|
2941
|
+
r(
|
|
2886
2942
|
"invalid_analytics_filter_values",
|
|
2887
2943
|
"Between analytics filters must include exactly two values.",
|
|
2888
|
-
`${
|
|
2944
|
+
`${s}.values`
|
|
2889
2945
|
)
|
|
2890
2946
|
);
|
|
2891
2947
|
return;
|
|
2892
2948
|
}
|
|
2893
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(
|
|
2894
|
-
|
|
2950
|
+
r(
|
|
2895
2951
|
"invalid_analytics_filter_values",
|
|
2896
2952
|
"Scalar analytics filters must include exactly one value. Use in/not_in for multiple values.",
|
|
2897
|
-
`${
|
|
2953
|
+
`${s}.values`
|
|
2898
2954
|
)
|
|
2899
2955
|
);
|
|
2900
2956
|
}
|
|
2901
2957
|
});
|
|
2902
2958
|
}
|
|
2903
2959
|
}
|
|
2904
|
-
function
|
|
2960
|
+
function Ga(e) {
|
|
2905
2961
|
const t = [];
|
|
2906
2962
|
if (!f(e))
|
|
2907
2963
|
return t.push(
|
|
2908
|
-
|
|
2964
|
+
r(
|
|
2909
2965
|
"invalid_result_calculation",
|
|
2910
2966
|
"Result calculation must be a structured object."
|
|
2911
2967
|
)
|
|
2912
2968
|
), { ok: !1, errors: t, warnings: [] };
|
|
2913
2969
|
if (p(e.id) || t.push(
|
|
2914
|
-
|
|
2970
|
+
r(
|
|
2915
2971
|
"invalid_result_calculation_id",
|
|
2916
2972
|
"Result calculation needs an id.",
|
|
2917
2973
|
"id"
|
|
2918
2974
|
)
|
|
2919
2975
|
), p(e.label) || t.push(
|
|
2920
|
-
|
|
2976
|
+
r(
|
|
2921
2977
|
"invalid_result_calculation_label",
|
|
2922
2978
|
"Result calculation needs a label.",
|
|
2923
2979
|
"label"
|
|
2924
2980
|
)
|
|
2925
2981
|
), e.kind !== "percent_of_total" && e.kind !== "rank" && e.kind !== "running_total" && e.kind !== "previous_row_delta" && t.push(
|
|
2926
|
-
|
|
2982
|
+
r(
|
|
2927
2983
|
"invalid_result_calculation_kind",
|
|
2928
2984
|
"Result calculation kind must be percent_of_total, rank, running_total, or previous_row_delta.",
|
|
2929
2985
|
"kind"
|
|
2930
2986
|
)
|
|
2931
|
-
),
|
|
2987
|
+
), ze(e.input, "input", t), Kn(e.output, "output", t), e.kind === "percent_of_total") {
|
|
2932
2988
|
const n = e.denominator;
|
|
2933
2989
|
n !== void 0 && (f(n) ? n.scope === "population" ? (b(n.metric, "denominator.metric", t, {
|
|
2934
2990
|
required: !0
|
|
2935
|
-
}),
|
|
2991
|
+
}), ge(
|
|
2936
2992
|
n.filters,
|
|
2937
2993
|
"denominator.filters",
|
|
2938
2994
|
t
|
|
2939
2995
|
)) : n.scope !== "returned_result" && t.push(
|
|
2940
|
-
|
|
2996
|
+
r(
|
|
2941
2997
|
"invalid_result_calculation_denominator",
|
|
2942
2998
|
"Percent-of-total denominator scope must be returned_result or population.",
|
|
2943
2999
|
"denominator.scope"
|
|
2944
3000
|
)
|
|
2945
3001
|
) : t.push(
|
|
2946
|
-
|
|
3002
|
+
r(
|
|
2947
3003
|
"invalid_result_calculation_denominator",
|
|
2948
3004
|
"Percent-of-total denominator must be a structured object.",
|
|
2949
3005
|
"denominator"
|
|
@@ -2951,21 +3007,21 @@ function La(e) {
|
|
|
2951
3007
|
));
|
|
2952
3008
|
}
|
|
2953
3009
|
return e.kind === "rank" && e.order !== void 0 && e.order !== "asc" && e.order !== "desc" && t.push(
|
|
2954
|
-
|
|
3010
|
+
r(
|
|
2955
3011
|
"invalid_result_calculation_order",
|
|
2956
3012
|
"Rank result calculation order must be asc or desc.",
|
|
2957
3013
|
"order"
|
|
2958
3014
|
)
|
|
2959
|
-
), (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: [] };
|
|
2960
3016
|
}
|
|
2961
|
-
function
|
|
3017
|
+
function jt(e) {
|
|
2962
3018
|
var o;
|
|
2963
3019
|
const t = [], n = [];
|
|
2964
3020
|
if (!e || typeof e != "object")
|
|
2965
3021
|
return {
|
|
2966
3022
|
ok: !1,
|
|
2967
3023
|
errors: [
|
|
2968
|
-
|
|
3024
|
+
r(
|
|
2969
3025
|
"invalid_analytics_intent",
|
|
2970
3026
|
"Analytics intent must be a structured object."
|
|
2971
3027
|
)
|
|
@@ -2979,101 +3035,101 @@ function Mt(e) {
|
|
|
2979
3035
|
]
|
|
2980
3036
|
};
|
|
2981
3037
|
if (e.kind === "matrix") {
|
|
2982
|
-
const a =
|
|
2983
|
-
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) };
|
|
2984
3040
|
}
|
|
2985
3041
|
if (e.version !== void 0 && e.version !== 1 && t.push(
|
|
2986
|
-
|
|
3042
|
+
r(
|
|
2987
3043
|
"invalid_version",
|
|
2988
3044
|
"Analytics intent version must be 1.",
|
|
2989
3045
|
"version"
|
|
2990
3046
|
)
|
|
2991
|
-
),
|
|
3047
|
+
), be(e.source, "source", t), Wn(e, t), Ln(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && Te(
|
|
2992
3048
|
e.relationshipHint,
|
|
2993
3049
|
"relationshipHint",
|
|
2994
3050
|
t
|
|
2995
3051
|
), e.kind === "metric") {
|
|
2996
3052
|
const a = Array.isArray(e.measures) ? e.measures.filter(
|
|
2997
|
-
(
|
|
3053
|
+
(s) => f(s) && p(s.name)
|
|
2998
3054
|
) : [];
|
|
2999
3055
|
if (!Array.isArray(e.measures) || e.measures.length === 0 ? t.push(
|
|
3000
|
-
|
|
3056
|
+
r(
|
|
3001
3057
|
"missing_measure",
|
|
3002
3058
|
"Metric intent needs at least one measure.",
|
|
3003
3059
|
"measures"
|
|
3004
3060
|
)
|
|
3005
3061
|
) : e.measures.some(
|
|
3006
|
-
(
|
|
3062
|
+
(s) => !f(s) || !p(s.name)
|
|
3007
3063
|
) && t.push(
|
|
3008
|
-
|
|
3064
|
+
r(
|
|
3009
3065
|
"invalid_measure_list",
|
|
3010
3066
|
"Metric intent measures must be an array of field references with names.",
|
|
3011
3067
|
"measures"
|
|
3012
3068
|
)
|
|
3013
|
-
), a.forEach((
|
|
3014
|
-
b(
|
|
3069
|
+
), a.forEach((s, l) => {
|
|
3070
|
+
b(s, `measures.${l}`, t, {
|
|
3015
3071
|
required: !0
|
|
3016
3072
|
});
|
|
3017
|
-
}), a.length > 0 && !
|
|
3018
|
-
const
|
|
3073
|
+
}), a.length > 0 && !Mn(a)) {
|
|
3074
|
+
const s = a.find(
|
|
3019
3075
|
(l, d) => a.some(
|
|
3020
|
-
(c, u) => u !== d &&
|
|
3076
|
+
(c, u) => u !== d && Nt(c, l)
|
|
3021
3077
|
)
|
|
3022
3078
|
);
|
|
3023
|
-
|
|
3024
|
-
|
|
3079
|
+
s && t.push(
|
|
3080
|
+
r(
|
|
3025
3081
|
"duplicate_measure",
|
|
3026
|
-
|
|
3082
|
+
Dn(s),
|
|
3027
3083
|
"measures"
|
|
3028
3084
|
)
|
|
3029
3085
|
);
|
|
3030
3086
|
}
|
|
3031
|
-
if (f(e.primaryMeasure) && p(e.primaryMeasure.name) &&
|
|
3087
|
+
if (f(e.primaryMeasure) && p(e.primaryMeasure.name) && Re(
|
|
3032
3088
|
e.primaryMeasure,
|
|
3033
3089
|
a
|
|
3034
3090
|
).length > 1 && t.push(
|
|
3035
|
-
|
|
3091
|
+
r(
|
|
3036
3092
|
"ambiguous_primary_measure",
|
|
3037
3093
|
"Metric intent primaryMeasure must identify exactly one selected measure.",
|
|
3038
3094
|
"primaryMeasure"
|
|
3039
3095
|
)
|
|
3040
3096
|
), e.primaryMeasure !== void 0 && (b(e.primaryMeasure, "primaryMeasure", t, {
|
|
3041
3097
|
required: !0
|
|
3042
|
-
}), f(e.primaryMeasure) && p(e.primaryMeasure.name) && a.length > 0 && !
|
|
3098
|
+
}), f(e.primaryMeasure) && p(e.primaryMeasure.name) && a.length > 0 && !En(
|
|
3043
3099
|
e.primaryMeasure,
|
|
3044
3100
|
a
|
|
3045
3101
|
) && t.push(
|
|
3046
|
-
|
|
3102
|
+
r(
|
|
3047
3103
|
"invalid_primary_measure",
|
|
3048
3104
|
"Metric intent primaryMeasure must match one measure field reference.",
|
|
3049
3105
|
"primaryMeasure"
|
|
3050
3106
|
)
|
|
3051
3107
|
)), e.dimensions !== void 0 && !Array.isArray(e.dimensions) ? t.push(
|
|
3052
|
-
|
|
3108
|
+
r(
|
|
3053
3109
|
"invalid_measure_dimensions",
|
|
3054
3110
|
"Metric intent dimensions must be an array of field references.",
|
|
3055
3111
|
"dimensions"
|
|
3056
3112
|
)
|
|
3057
3113
|
) : Array.isArray(e.dimensions) && e.dimensions.some(
|
|
3058
|
-
(
|
|
3114
|
+
(s) => !f(s) || !p(s.name)
|
|
3059
3115
|
) && t.push(
|
|
3060
|
-
|
|
3116
|
+
r(
|
|
3061
3117
|
"invalid_measure_dimensions",
|
|
3062
3118
|
"Metric intent dimensions must be an array of field references with names.",
|
|
3063
3119
|
"dimensions"
|
|
3064
3120
|
)
|
|
3065
|
-
), e.dateField !== void 0 && b(e.dateField, "dateField", t), e.timeWindow !== void 0 && (
|
|
3066
|
-
|
|
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(
|
|
3067
3123
|
"missing_time_window_date_field",
|
|
3068
3124
|
"Metric timeWindow needs a dateField.",
|
|
3069
3125
|
"dateField"
|
|
3070
3126
|
)
|
|
3071
|
-
)),
|
|
3072
|
-
b(
|
|
3127
|
+
)), ge(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((s, l) => {
|
|
3128
|
+
b(s, `dimensions.${l}`, t);
|
|
3073
3129
|
}), e.orderBy !== void 0) {
|
|
3074
3130
|
if (!f(e.orderBy))
|
|
3075
3131
|
t.push(
|
|
3076
|
-
|
|
3132
|
+
r(
|
|
3077
3133
|
"invalid_measure_order_by",
|
|
3078
3134
|
"Metric intent orderBy must be a structured object.",
|
|
3079
3135
|
"orderBy"
|
|
@@ -3082,24 +3138,24 @@ function Mt(e) {
|
|
|
3082
3138
|
else if (b(e.orderBy.field, "orderBy.field", t, {
|
|
3083
3139
|
required: !0
|
|
3084
3140
|
}), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
|
|
3085
|
-
|
|
3141
|
+
r(
|
|
3086
3142
|
"invalid_measure_order_direction",
|
|
3087
3143
|
"Metric intent orderBy direction must be asc or desc.",
|
|
3088
3144
|
"orderBy.direction"
|
|
3089
3145
|
)
|
|
3090
3146
|
), f(e.orderBy.field) && p(e.orderBy.field.name)) {
|
|
3091
|
-
const
|
|
3147
|
+
const s = [
|
|
3092
3148
|
...a,
|
|
3093
3149
|
...e.timeGrain && e.dateField && f(e.dateField) ? [e.dateField] : [],
|
|
3094
3150
|
...Array.isArray(e.dimensions) ? e.dimensions.filter(
|
|
3095
3151
|
(l) => f(l) && p(l.name)
|
|
3096
3152
|
) : []
|
|
3097
3153
|
];
|
|
3098
|
-
|
|
3154
|
+
s.length > 0 && !jn(
|
|
3099
3155
|
e.orderBy.field,
|
|
3100
|
-
|
|
3156
|
+
s
|
|
3101
3157
|
) && t.push(
|
|
3102
|
-
|
|
3158
|
+
r(
|
|
3103
3159
|
"invalid_measure_order_by",
|
|
3104
3160
|
"Metric intent orderBy.field must match one selected measure, grouped dateField, or dimension.",
|
|
3105
3161
|
"orderBy.field"
|
|
@@ -3107,10 +3163,10 @@ function Mt(e) {
|
|
|
3107
3163
|
);
|
|
3108
3164
|
}
|
|
3109
3165
|
}
|
|
3110
|
-
|
|
3166
|
+
Qn(e, t);
|
|
3111
3167
|
} else if (e.kind === "records") {
|
|
3112
3168
|
if (!Array.isArray(e.fields) || e.fields.length === 0 ? t.push(
|
|
3113
|
-
|
|
3169
|
+
r(
|
|
3114
3170
|
"missing_record_fields",
|
|
3115
3171
|
"Records intent needs at least one field.",
|
|
3116
3172
|
"fields"
|
|
@@ -3118,37 +3174,37 @@ function Mt(e) {
|
|
|
3118
3174
|
) : e.fields.some(
|
|
3119
3175
|
(a) => !f(a) || !p(a.name)
|
|
3120
3176
|
) && t.push(
|
|
3121
|
-
|
|
3177
|
+
r(
|
|
3122
3178
|
"invalid_record_fields",
|
|
3123
3179
|
"Records intent fields must be field references with names.",
|
|
3124
3180
|
"fields"
|
|
3125
3181
|
)
|
|
3126
|
-
), Array.isArray(e.fields) && e.fields.forEach((a,
|
|
3127
|
-
b(a, `fields.${
|
|
3128
|
-
}), e.dateField !== void 0 && b(e.dateField, "dateField", t),
|
|
3129
|
-
|
|
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(
|
|
3130
3186
|
"missing_time_window_date_field",
|
|
3131
3187
|
"Records timeWindow needs a dateField.",
|
|
3132
3188
|
"dateField"
|
|
3133
3189
|
)
|
|
3134
|
-
)),
|
|
3190
|
+
)), ge(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((a, s) => {
|
|
3135
3191
|
f(a) && a.scope === "aggregate" && t.push(
|
|
3136
|
-
|
|
3192
|
+
r(
|
|
3137
3193
|
"unsupported_record_filter_scope",
|
|
3138
3194
|
"Records intents support row-scope filters only. Use a metric intent for aggregate-scope filters.",
|
|
3139
|
-
`filters.${
|
|
3195
|
+
`filters.${s}.scope`
|
|
3140
3196
|
)
|
|
3141
3197
|
);
|
|
3142
3198
|
}), e.orderBy !== void 0 && (f(e.orderBy) ? (b(e.orderBy.field, "orderBy.field", t, {
|
|
3143
3199
|
required: !0
|
|
3144
3200
|
}), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && t.push(
|
|
3145
|
-
|
|
3201
|
+
r(
|
|
3146
3202
|
"invalid_record_order_direction",
|
|
3147
3203
|
"Records intent orderBy direction must be asc or desc.",
|
|
3148
3204
|
"orderBy.direction"
|
|
3149
3205
|
)
|
|
3150
3206
|
)) : t.push(
|
|
3151
|
-
|
|
3207
|
+
r(
|
|
3152
3208
|
"invalid_record_order_by",
|
|
3153
3209
|
"Records intent orderBy must be a structured object.",
|
|
3154
3210
|
"orderBy"
|
|
@@ -3156,7 +3212,7 @@ function Mt(e) {
|
|
|
3156
3212
|
)), e.totals !== void 0)
|
|
3157
3213
|
if (!f(e.totals))
|
|
3158
3214
|
t.push(
|
|
3159
|
-
|
|
3215
|
+
r(
|
|
3160
3216
|
"invalid_records_totals",
|
|
3161
3217
|
"Records totals must be a structured server totals request.",
|
|
3162
3218
|
"totals"
|
|
@@ -3164,7 +3220,7 @@ function Mt(e) {
|
|
|
3164
3220
|
);
|
|
3165
3221
|
else {
|
|
3166
3222
|
e.totals.mode !== "server" && t.push(
|
|
3167
|
-
|
|
3223
|
+
r(
|
|
3168
3224
|
"invalid_records_totals",
|
|
3169
3225
|
"Records totals mode must be server.",
|
|
3170
3226
|
"totals.mode"
|
|
@@ -3172,16 +3228,16 @@ function Mt(e) {
|
|
|
3172
3228
|
);
|
|
3173
3229
|
const a = e.totals.measures;
|
|
3174
3230
|
!Array.isArray(a) || a.length === 0 ? t.push(
|
|
3175
|
-
|
|
3231
|
+
r(
|
|
3176
3232
|
"missing_records_totals_measures",
|
|
3177
3233
|
"Records server totals need at least one measure.",
|
|
3178
3234
|
"totals.measures"
|
|
3179
3235
|
)
|
|
3180
|
-
) : a.forEach((
|
|
3181
|
-
b(
|
|
3236
|
+
) : a.forEach((s, l) => {
|
|
3237
|
+
b(s, `totals.measures.${l}`, t, {
|
|
3182
3238
|
required: !0
|
|
3183
|
-
}), (!f(
|
|
3184
|
-
|
|
3239
|
+
}), (!f(s) || s.role !== "measure") && t.push(
|
|
3240
|
+
r(
|
|
3185
3241
|
"invalid_records_totals_measure",
|
|
3186
3242
|
"Records server totals measures must be measure field references.",
|
|
3187
3243
|
`totals.measures.${l}.role`
|
|
@@ -3189,22 +3245,22 @@ function Mt(e) {
|
|
|
3189
3245
|
);
|
|
3190
3246
|
});
|
|
3191
3247
|
}
|
|
3192
|
-
} else e.kind === "inputOptions" ?
|
|
3193
|
-
|
|
3248
|
+
} else e.kind === "inputOptions" ? qn(e, t) : e.kind === "sql" ? (((o = e.source) == null ? void 0 : o.kind) !== "sql" && t.push(
|
|
3249
|
+
r(
|
|
3194
3250
|
"invalid_sql_source",
|
|
3195
3251
|
"SQL analytics intent must use a SQL execution source.",
|
|
3196
3252
|
"source"
|
|
3197
3253
|
)
|
|
3198
3254
|
), p(e.sql) || t.push(
|
|
3199
|
-
|
|
3200
|
-
),
|
|
3255
|
+
r("missing_sql", "SQL analytics intent needs SQL text.", "sql")
|
|
3256
|
+
), Nn(
|
|
3201
3257
|
e.defaultParameters,
|
|
3202
3258
|
"defaultParameters",
|
|
3203
3259
|
t
|
|
3204
|
-
), Array.isArray(e.fields) && e.fields.forEach((a,
|
|
3205
|
-
b(a, `fields.${
|
|
3206
|
-
}),
|
|
3207
|
-
|
|
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(
|
|
3208
3264
|
"invalid_analytics_kind",
|
|
3209
3265
|
"Analytics kind is not supported.",
|
|
3210
3266
|
"kind"
|
|
@@ -3214,14 +3270,14 @@ function Mt(e) {
|
|
|
3214
3270
|
ok: t.length === 0,
|
|
3215
3271
|
errors: t,
|
|
3216
3272
|
warnings: n,
|
|
3217
|
-
repairHints:
|
|
3273
|
+
repairHints: Ke(t)
|
|
3218
3274
|
};
|
|
3219
3275
|
}
|
|
3220
|
-
function
|
|
3276
|
+
function Wn(e, t) {
|
|
3221
3277
|
if (!(!("derivedFields" in e) || e.derivedFields === void 0)) {
|
|
3222
3278
|
if (!Array.isArray(e.derivedFields)) {
|
|
3223
3279
|
t.push(
|
|
3224
|
-
|
|
3280
|
+
r(
|
|
3225
3281
|
"invalid_derived_fields",
|
|
3226
3282
|
"Analytics intent derivedFields must be an array of derived field definitions.",
|
|
3227
3283
|
"derivedFields"
|
|
@@ -3230,24 +3286,24 @@ function Gn(e, t) {
|
|
|
3230
3286
|
return;
|
|
3231
3287
|
}
|
|
3232
3288
|
e.derivedFields.forEach((n, o) => {
|
|
3233
|
-
|
|
3289
|
+
ve(
|
|
3234
3290
|
n
|
|
3235
|
-
).errors.forEach((
|
|
3291
|
+
).errors.forEach((s) => {
|
|
3236
3292
|
t.push({
|
|
3237
|
-
...
|
|
3238
|
-
path:
|
|
3293
|
+
...s,
|
|
3294
|
+
path: s.path ? `derivedFields.${o}.${s.path}` : `derivedFields.${o}`
|
|
3239
3295
|
});
|
|
3240
3296
|
});
|
|
3241
3297
|
});
|
|
3242
3298
|
}
|
|
3243
3299
|
}
|
|
3244
|
-
function
|
|
3300
|
+
function Xn(e) {
|
|
3245
3301
|
const t = [], n = [];
|
|
3246
3302
|
if (!e || typeof e != "object")
|
|
3247
3303
|
return {
|
|
3248
3304
|
ok: !1,
|
|
3249
3305
|
errors: [
|
|
3250
|
-
|
|
3306
|
+
r(
|
|
3251
3307
|
"invalid_operation_intent",
|
|
3252
3308
|
"Operation intent must be a structured object."
|
|
3253
3309
|
)
|
|
@@ -3261,27 +3317,27 @@ function zn(e) {
|
|
|
3261
3317
|
]
|
|
3262
3318
|
};
|
|
3263
3319
|
if (e.version !== 1 && t.push(
|
|
3264
|
-
|
|
3320
|
+
r(
|
|
3265
3321
|
"invalid_version",
|
|
3266
3322
|
"Operation intent version must be 1.",
|
|
3267
3323
|
"version"
|
|
3268
3324
|
)
|
|
3269
3325
|
), e.kind === "answer_obligations")
|
|
3270
3326
|
!Array.isArray(e.obligations) || e.obligations.length === 0 ? t.push(
|
|
3271
|
-
|
|
3327
|
+
r(
|
|
3272
3328
|
"missing_obligations",
|
|
3273
3329
|
"Answer-obligations operation intent needs at least one obligation.",
|
|
3274
3330
|
"obligations"
|
|
3275
3331
|
)
|
|
3276
3332
|
) : e.obligations.forEach((o, a) => {
|
|
3277
3333
|
p(o.id) || t.push(
|
|
3278
|
-
|
|
3334
|
+
r(
|
|
3279
3335
|
"missing_obligation_id",
|
|
3280
3336
|
"Each analytics obligation needs an id.",
|
|
3281
3337
|
`obligations.${a}.id`
|
|
3282
3338
|
)
|
|
3283
3339
|
), p(o.prompt) || t.push(
|
|
3284
|
-
|
|
3340
|
+
r(
|
|
3285
3341
|
"missing_obligation_prompt",
|
|
3286
3342
|
"Each analytics obligation needs a prompt.",
|
|
3287
3343
|
`obligations.${a}.prompt`
|
|
@@ -3290,20 +3346,20 @@ function zn(e) {
|
|
|
3290
3346
|
});
|
|
3291
3347
|
else if (e.kind === "dashboard_change" || e.kind === "data_app_change") {
|
|
3292
3348
|
if (p(e.instruction) || t.push(
|
|
3293
|
-
|
|
3349
|
+
r(
|
|
3294
3350
|
"missing_instruction",
|
|
3295
3351
|
"Change operation intent needs an instruction.",
|
|
3296
3352
|
"instruction"
|
|
3297
3353
|
)
|
|
3298
3354
|
), e.analyticsIntent) {
|
|
3299
|
-
const o =
|
|
3355
|
+
const o = jt(
|
|
3300
3356
|
e.analyticsIntent
|
|
3301
3357
|
);
|
|
3302
3358
|
t.push(...o.errors), n.push(...o.warnings);
|
|
3303
3359
|
}
|
|
3304
3360
|
} else
|
|
3305
3361
|
t.push(
|
|
3306
|
-
|
|
3362
|
+
r(
|
|
3307
3363
|
"invalid_operation_kind",
|
|
3308
3364
|
"Operation intent kind is not supported.",
|
|
3309
3365
|
"kind"
|
|
@@ -3313,16 +3369,16 @@ function zn(e) {
|
|
|
3313
3369
|
ok: t.length === 0,
|
|
3314
3370
|
errors: t,
|
|
3315
3371
|
warnings: n,
|
|
3316
|
-
repairHints:
|
|
3372
|
+
repairHints: $t(t)
|
|
3317
3373
|
};
|
|
3318
3374
|
}
|
|
3319
|
-
function
|
|
3375
|
+
function za(e) {
|
|
3320
3376
|
const t = [], n = [];
|
|
3321
3377
|
if (!e || typeof e != "object")
|
|
3322
3378
|
return {
|
|
3323
3379
|
ok: !1,
|
|
3324
3380
|
errors: [
|
|
3325
|
-
|
|
3381
|
+
r(
|
|
3326
3382
|
"invalid_recovery_plan",
|
|
3327
3383
|
"Analytics recovery plan must be a structured object."
|
|
3328
3384
|
)
|
|
@@ -3336,19 +3392,19 @@ function Ua(e) {
|
|
|
3336
3392
|
]
|
|
3337
3393
|
};
|
|
3338
3394
|
e.version !== 1 && t.push(
|
|
3339
|
-
|
|
3395
|
+
r("invalid_version", "Recovery plan version must be 1.", "version")
|
|
3340
3396
|
), e.kind !== "analytics_recovery_plan" && t.push(
|
|
3341
|
-
|
|
3397
|
+
r(
|
|
3342
3398
|
"invalid_recovery_plan_kind",
|
|
3343
3399
|
"Recovery plan kind must be analytics_recovery_plan.",
|
|
3344
3400
|
"kind"
|
|
3345
3401
|
)
|
|
3346
3402
|
);
|
|
3347
|
-
const o =
|
|
3403
|
+
const o = Xn(
|
|
3348
3404
|
e.operationIntent
|
|
3349
3405
|
);
|
|
3350
3406
|
return t.push(...o.errors), n.push(...o.warnings), Array.isArray(e.plannedToolCalls) || t.push(
|
|
3351
|
-
|
|
3407
|
+
r(
|
|
3352
3408
|
"invalid_planned_tool_calls",
|
|
3353
3409
|
"Recovery plan plannedToolCalls must be an array.",
|
|
3354
3410
|
"plannedToolCalls"
|
|
@@ -3357,16 +3413,16 @@ function Ua(e) {
|
|
|
3357
3413
|
ok: t.length === 0,
|
|
3358
3414
|
errors: t,
|
|
3359
3415
|
warnings: n,
|
|
3360
|
-
repairHints:
|
|
3416
|
+
repairHints: $t(t)
|
|
3361
3417
|
};
|
|
3362
3418
|
}
|
|
3363
|
-
function
|
|
3419
|
+
function $t(e) {
|
|
3364
3420
|
return e.map((t) => ({
|
|
3365
3421
|
code: t.code,
|
|
3366
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."
|
|
3367
3423
|
}));
|
|
3368
3424
|
}
|
|
3369
|
-
function
|
|
3425
|
+
function Ke(e) {
|
|
3370
3426
|
return e.map((t) => {
|
|
3371
3427
|
switch (t.code) {
|
|
3372
3428
|
case "invalid_matrix_intent":
|
|
@@ -3454,18 +3510,18 @@ function Ve(e) {
|
|
|
3454
3510
|
}
|
|
3455
3511
|
}).filter((t) => !!t);
|
|
3456
3512
|
}
|
|
3457
|
-
function
|
|
3513
|
+
function Zn(e, t, n, o) {
|
|
3458
3514
|
if (!e || typeof e != "object") {
|
|
3459
3515
|
n.push(
|
|
3460
|
-
|
|
3516
|
+
r("invalid_view", "Dashboard view must be an object.", t)
|
|
3461
3517
|
);
|
|
3462
3518
|
return;
|
|
3463
3519
|
}
|
|
3464
3520
|
if (p(e.title) || n.push(
|
|
3465
|
-
|
|
3521
|
+
r("missing_view_title", "Dashboard view needs a title.", t)
|
|
3466
3522
|
), !e.presentation || typeof e.presentation != "object") {
|
|
3467
3523
|
n.push(
|
|
3468
|
-
|
|
3524
|
+
r(
|
|
3469
3525
|
"missing_presentation",
|
|
3470
3526
|
"Dashboard view needs a presentation.",
|
|
3471
3527
|
`${t}.presentation`
|
|
@@ -3475,7 +3531,7 @@ function Kn(e, t, n, o) {
|
|
|
3475
3531
|
}
|
|
3476
3532
|
if (e.presentation.kind === "text") {
|
|
3477
3533
|
p(e.text) || o.push(
|
|
3478
|
-
|
|
3534
|
+
r(
|
|
3479
3535
|
"missing_text_content",
|
|
3480
3536
|
"Text views should include text content.",
|
|
3481
3537
|
`${t}.text`
|
|
@@ -3485,7 +3541,7 @@ function Kn(e, t, n, o) {
|
|
|
3485
3541
|
}
|
|
3486
3542
|
if (!e.analytics) {
|
|
3487
3543
|
n.push(
|
|
3488
|
-
|
|
3544
|
+
r(
|
|
3489
3545
|
"missing_view_analytics",
|
|
3490
3546
|
"Non-text dashboard views need analytics intent.",
|
|
3491
3547
|
`${t}.analytics`
|
|
@@ -3494,37 +3550,37 @@ function Kn(e, t, n, o) {
|
|
|
3494
3550
|
return;
|
|
3495
3551
|
}
|
|
3496
3552
|
e.presentation.kind === "matrixTable" && e.analytics.kind !== "matrix" && n.push(
|
|
3497
|
-
|
|
3553
|
+
r(
|
|
3498
3554
|
"invalid_matrix_view_analytics",
|
|
3499
3555
|
"Matrix table views need matrix analytics intent.",
|
|
3500
3556
|
`${t}.analytics.kind`
|
|
3501
3557
|
)
|
|
3502
3558
|
);
|
|
3503
|
-
const a =
|
|
3504
|
-
for (const
|
|
3559
|
+
const a = jt(e.analytics);
|
|
3560
|
+
for (const s of a.errors)
|
|
3505
3561
|
n.push(
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
`${t}.analytics${
|
|
3562
|
+
r(
|
|
3563
|
+
s.code,
|
|
3564
|
+
s.message,
|
|
3565
|
+
`${t}.analytics${s.path ? `.${s.path}` : ""}`
|
|
3510
3566
|
)
|
|
3511
3567
|
);
|
|
3512
|
-
for (const
|
|
3568
|
+
for (const s of a.warnings)
|
|
3513
3569
|
o.push(
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
`${t}.analytics${
|
|
3570
|
+
r(
|
|
3571
|
+
s.code,
|
|
3572
|
+
s.message,
|
|
3573
|
+
`${t}.analytics${s.path ? `.${s.path}` : ""}`
|
|
3518
3574
|
)
|
|
3519
3575
|
);
|
|
3520
3576
|
}
|
|
3521
|
-
function
|
|
3577
|
+
function Ka(e) {
|
|
3522
3578
|
const t = [], n = [];
|
|
3523
3579
|
if (!e || typeof e != "object")
|
|
3524
3580
|
return {
|
|
3525
3581
|
ok: !1,
|
|
3526
3582
|
errors: [
|
|
3527
|
-
|
|
3583
|
+
r(
|
|
3528
3584
|
"invalid_dashboard_intent",
|
|
3529
3585
|
"Dashboard intent must be a structured object."
|
|
3530
3586
|
)
|
|
@@ -3532,17 +3588,17 @@ function Va(e) {
|
|
|
3532
3588
|
warnings: n
|
|
3533
3589
|
};
|
|
3534
3590
|
e.version !== 1 && t.push(
|
|
3535
|
-
|
|
3591
|
+
r("invalid_version", "Dashboard intent version must be 1.")
|
|
3536
3592
|
), e.kind !== "dashboard" && t.push(
|
|
3537
|
-
|
|
3593
|
+
r("invalid_kind", "Experience intent kind must be dashboard.")
|
|
3538
3594
|
), p(e.title) || t.push(
|
|
3539
|
-
|
|
3595
|
+
r("missing_title", "Dashboard intent needs a title.", "title")
|
|
3540
3596
|
);
|
|
3541
|
-
const o = Array.isArray(e.inputs) ? e.inputs : [], a =
|
|
3597
|
+
const o = Array.isArray(e.inputs) ? e.inputs : [], a = Ge(
|
|
3542
3598
|
o.filter(f).map((c) => c.id).filter((c) => typeof c == "string")
|
|
3543
3599
|
);
|
|
3544
3600
|
a && t.push(
|
|
3545
|
-
|
|
3601
|
+
r(
|
|
3546
3602
|
"duplicate_input_id",
|
|
3547
3603
|
`Duplicate input id: ${a}.`,
|
|
3548
3604
|
"inputs"
|
|
@@ -3552,41 +3608,41 @@ function Va(e) {
|
|
|
3552
3608
|
const m = `inputs.${c}`;
|
|
3553
3609
|
if (!f(u)) {
|
|
3554
3610
|
t.push(
|
|
3555
|
-
|
|
3611
|
+
r("invalid_input", "Dashboard input must be an object.", m)
|
|
3556
3612
|
);
|
|
3557
3613
|
continue;
|
|
3558
3614
|
}
|
|
3559
3615
|
p(u.id) || t.push(
|
|
3560
|
-
|
|
3616
|
+
r("missing_input_id", "Input needs an id.", `${m}.id`)
|
|
3561
3617
|
), p(u.label) || t.push(
|
|
3562
|
-
|
|
3618
|
+
r("missing_input_label", "Input needs a label.", `${m}.label`)
|
|
3563
3619
|
), !u.field || !p(u.field.name) ? t.push(
|
|
3564
|
-
|
|
3620
|
+
r("missing_input_field", "Input needs a field.", `${m}.field`)
|
|
3565
3621
|
) : b(u.field, `${m}.field`, t);
|
|
3566
3622
|
}
|
|
3567
|
-
const
|
|
3568
|
-
|
|
3569
|
-
|
|
3623
|
+
const s = Array.isArray(e.sections) ? e.sections : [];
|
|
3624
|
+
s.length === 0 && t.push(
|
|
3625
|
+
r(
|
|
3570
3626
|
"missing_sections",
|
|
3571
3627
|
"Dashboard intent needs at least one section.",
|
|
3572
3628
|
"sections"
|
|
3573
3629
|
)
|
|
3574
3630
|
);
|
|
3575
|
-
const l =
|
|
3631
|
+
const l = s.flatMap(
|
|
3576
3632
|
(c) => c && typeof c == "object" && Array.isArray(c.views) ? c.views.filter(f).map((u) => u.id).filter((u) => !!u) : []
|
|
3577
|
-
), d =
|
|
3633
|
+
), d = Ge(l);
|
|
3578
3634
|
d && t.push(
|
|
3579
|
-
|
|
3635
|
+
r(
|
|
3580
3636
|
"duplicate_view_id",
|
|
3581
3637
|
`Duplicate dashboard view id: ${d}.`,
|
|
3582
3638
|
"sections"
|
|
3583
3639
|
)
|
|
3584
3640
|
);
|
|
3585
|
-
for (const [c, u] of
|
|
3641
|
+
for (const [c, u] of s.entries()) {
|
|
3586
3642
|
const m = `sections.${c}`;
|
|
3587
3643
|
if (!u || typeof u != "object") {
|
|
3588
3644
|
t.push(
|
|
3589
|
-
|
|
3645
|
+
r(
|
|
3590
3646
|
"invalid_section",
|
|
3591
3647
|
"Dashboard section must be an object.",
|
|
3592
3648
|
m
|
|
@@ -3595,14 +3651,14 @@ function Va(e) {
|
|
|
3595
3651
|
continue;
|
|
3596
3652
|
}
|
|
3597
3653
|
if (p(u.title) || t.push(
|
|
3598
|
-
|
|
3654
|
+
r(
|
|
3599
3655
|
"missing_section_title",
|
|
3600
3656
|
"Dashboard section needs a title.",
|
|
3601
3657
|
m
|
|
3602
3658
|
)
|
|
3603
3659
|
), !Array.isArray(u.views) || u.views.length === 0) {
|
|
3604
3660
|
t.push(
|
|
3605
|
-
|
|
3661
|
+
r(
|
|
3606
3662
|
"missing_section_views",
|
|
3607
3663
|
"Dashboard section needs at least one view.",
|
|
3608
3664
|
`${m}.views`
|
|
@@ -3610,10 +3666,10 @@ function Va(e) {
|
|
|
3610
3666
|
);
|
|
3611
3667
|
continue;
|
|
3612
3668
|
}
|
|
3613
|
-
for (const [
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
`${m}.views.${
|
|
3669
|
+
for (const [_, y] of u.views.entries())
|
|
3670
|
+
Zn(
|
|
3671
|
+
y,
|
|
3672
|
+
`${m}.views.${_}`,
|
|
3617
3673
|
t,
|
|
3618
3674
|
n
|
|
3619
3675
|
);
|
|
@@ -3621,150 +3677,153 @@ function Va(e) {
|
|
|
3621
3677
|
return { ok: t.length === 0, errors: t, warnings: n };
|
|
3622
3678
|
}
|
|
3623
3679
|
export {
|
|
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
|
-
|
|
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,
|
|
3659
3715
|
Yt as a5,
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
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
|
-
|
|
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,
|
|
3724
|
+
We as aE,
|
|
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,
|
|
3701
3757
|
st as ak,
|
|
3702
|
-
|
|
3703
|
-
|
|
3758
|
+
xi as al,
|
|
3759
|
+
Fi as am,
|
|
3704
3760
|
dt as an,
|
|
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
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
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
|
|
3770
3829
|
};
|