react-semaphor 0.1.398 → 0.1.399
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 +2 -2
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +2 -2
- package/dist/chunks/analyze-result-contract-CUO5QmqV.js +1797 -0
- package/dist/chunks/analyze-result-contract-OqFtOCpZ.js +1 -0
- package/dist/chunks/{calendar-preferences-dialog-49fcEPXS.js → calendar-preferences-dialog-9SvYDLp6.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-DwLeBLy2.js → calendar-preferences-dialog-B3fnFtJt.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-cgPKz1yX.js → dashboard-briefing-launcher-APVyc9al.js} +4 -4
- package/dist/chunks/{dashboard-briefing-launcher-CgkSKkZR.js → dashboard-briefing-launcher-D3R4R7ww.js} +1 -1
- package/dist/chunks/{dashboard-controls-VMFm3OP4.js → dashboard-controls-CHDQlMZ9.js} +5 -5
- package/dist/chunks/{dashboard-controls-D12ZSUP_.js → dashboard-controls-v7jslCXR.js} +1 -1
- package/dist/chunks/{dashboard-json-C-GG5yC7.js → dashboard-json-DF_syvRu.js} +3 -3
- package/dist/chunks/{dashboard-json-CvK0oI24.js → dashboard-json-L1Qo5xcX.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-B5KB7dx4.js → edit-dashboard-visual-DwfIWUe-.js} +4 -4
- package/dist/chunks/{edit-dashboard-visual-ql99faTz.js → edit-dashboard-visual-qdruQruO.js} +1 -1
- package/dist/chunks/{index-CQmKDEbe.js → index-BdVymLVq.js} +5 -5
- package/dist/chunks/{index-DXCBPLDu.js → index-DH7hOGQl.js} +2 -2
- package/dist/chunks/{switch-BXQAlSuW.js → switch-BiU6-YSY.js} +1 -1
- package/dist/chunks/{switch-B79Hn4Qh.js → switch-CYG3dY8r.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Bw5LRkf9.js → use-create-flow-overlay-state-CwUkhLBL.js} +3 -3
- package/dist/chunks/{use-create-flow-overlay-state-7MFN3PWX.js → use-create-flow-overlay-state-qe7DHQKr.js} +1 -1
- package/dist/chunks/{validators-4EGCWWga.js → validators-B1Mgdr3T.js} +279 -242
- package/dist/chunks/{validators-CPtkrola.js → validators-DFOX0tYY.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +2 -2
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-sdk/index.cjs +2 -2
- package/dist/data-app-sdk/index.js +3 -2
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +20 -12
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +101 -2
- package/dist/types/dashboard-assistant.d.ts +14 -0
- package/dist/types/dashboard-authoring.d.ts +6 -0
- package/dist/types/data-app-builder.d.ts +6 -0
- package/dist/types/data-app-sdk-adapters.d.ts +7 -0
- package/dist/types/data-app-sdk-validation.d.ts +15 -0
- package/dist/types/data-app-sdk.d.ts +18 -0
- package/dist/types/main.d.ts +6 -0
- package/package.json +1 -1
- package/dist/chunks/analyze-result-contract-C9Gv2_qW.js +0 -1585
- package/dist/chunks/analyze-result-contract-Zgg-Bbpj.js +0 -1
|
@@ -0,0 +1,1797 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
const M = {
|
|
3
|
+
answerSummary: "string",
|
|
4
|
+
responseDetail: "responseDetail",
|
|
5
|
+
mode: "string",
|
|
6
|
+
comparisonType: "string",
|
|
7
|
+
executionResult: "executionResult",
|
|
8
|
+
compiledQuery: "unknown",
|
|
9
|
+
data: "unknown",
|
|
10
|
+
resultSets: "record",
|
|
11
|
+
analysisWarnings: "unknownArray",
|
|
12
|
+
columns: "unknownArray",
|
|
13
|
+
records: "recordArray",
|
|
14
|
+
rowCount: "number",
|
|
15
|
+
rowLimitExceeded: "boolean",
|
|
16
|
+
output: "string",
|
|
17
|
+
querySpec: "unknown",
|
|
18
|
+
metadata: "record",
|
|
19
|
+
validation: "validationResult",
|
|
20
|
+
coverage: "coverage",
|
|
21
|
+
diagnosticFeedback: "diagnosticFeedback",
|
|
22
|
+
missingFields: "stringArray",
|
|
23
|
+
warnings: "unknownArray",
|
|
24
|
+
comparison: "unknown",
|
|
25
|
+
population: "population",
|
|
26
|
+
comparisons: "recordArray",
|
|
27
|
+
fieldsUsed: "compactExecutionFieldArray",
|
|
28
|
+
primary: "recordArray",
|
|
29
|
+
contributors: "recordArray",
|
|
30
|
+
segments: "recordArray",
|
|
31
|
+
periodChanges: "recordArray",
|
|
32
|
+
changes: "recordArray",
|
|
33
|
+
largestNegativeChanges: "recordArray",
|
|
34
|
+
largestPositiveChanges: "recordArray",
|
|
35
|
+
drivers: "recordArray",
|
|
36
|
+
absoluteDeltaDrivers: "recordArray",
|
|
37
|
+
largestNegativeDrivers: "recordArray",
|
|
38
|
+
largestPositiveDrivers: "recordArray",
|
|
39
|
+
periodRows: "recordArray",
|
|
40
|
+
sql: "unknown",
|
|
41
|
+
omitted: "stringArray"
|
|
42
|
+
}, N = "semaphor-data-app-codegen-summary/v1", Ho = "semaphor-data-app-codegen-summary-validator/v2", ge = /* @__PURE__ */ new Set([
|
|
43
|
+
"metric",
|
|
44
|
+
"records",
|
|
45
|
+
"matrix",
|
|
46
|
+
"analysis",
|
|
47
|
+
"sql_fallback"
|
|
48
|
+
]), he = /* @__PURE__ */ new Set([
|
|
49
|
+
"semaphor.metric",
|
|
50
|
+
"semaphor.records",
|
|
51
|
+
"semaphor.matrix",
|
|
52
|
+
"semaphor.analysis",
|
|
53
|
+
"semaphor.sql"
|
|
54
|
+
]), fe = /* @__PURE__ */ new Set([
|
|
55
|
+
"absolute_delta",
|
|
56
|
+
"largest_negative",
|
|
57
|
+
"largest_positive",
|
|
58
|
+
"positive_and_negative",
|
|
59
|
+
"all"
|
|
60
|
+
]), Y = /* @__PURE__ */ new Set([
|
|
61
|
+
"source",
|
|
62
|
+
"id",
|
|
63
|
+
"label",
|
|
64
|
+
"measures",
|
|
65
|
+
"primaryMeasure",
|
|
66
|
+
"dateField",
|
|
67
|
+
"timeGrain",
|
|
68
|
+
"dimensions",
|
|
69
|
+
"comparison",
|
|
70
|
+
"orderBy",
|
|
71
|
+
"filters",
|
|
72
|
+
"relationshipHint",
|
|
73
|
+
"limit",
|
|
74
|
+
"derivedFields"
|
|
75
|
+
]), be = /* @__PURE__ */ new Set([
|
|
76
|
+
...Y,
|
|
77
|
+
"analysis",
|
|
78
|
+
"timeWindow",
|
|
79
|
+
"filters",
|
|
80
|
+
"driverMode",
|
|
81
|
+
"includePopulation",
|
|
82
|
+
"calendarContext",
|
|
83
|
+
"chartTitle",
|
|
84
|
+
"chartType"
|
|
85
|
+
]), ye = /* @__PURE__ */ new Set([
|
|
86
|
+
"source",
|
|
87
|
+
"id",
|
|
88
|
+
"label",
|
|
89
|
+
"fields",
|
|
90
|
+
"dateField",
|
|
91
|
+
"timeGrain",
|
|
92
|
+
"timeWindow",
|
|
93
|
+
"filters",
|
|
94
|
+
"orderBy",
|
|
95
|
+
"relationshipHint",
|
|
96
|
+
"limit",
|
|
97
|
+
"pagination",
|
|
98
|
+
"totals",
|
|
99
|
+
"derivedFields"
|
|
100
|
+
]), ve = /* @__PURE__ */ new Set([
|
|
101
|
+
"source",
|
|
102
|
+
"id",
|
|
103
|
+
"label",
|
|
104
|
+
"filters",
|
|
105
|
+
"relationshipHint",
|
|
106
|
+
"rows",
|
|
107
|
+
"columns",
|
|
108
|
+
"values",
|
|
109
|
+
"totals",
|
|
110
|
+
"sort",
|
|
111
|
+
"expansion",
|
|
112
|
+
"layout",
|
|
113
|
+
"displayLimits"
|
|
114
|
+
]), $e = /* @__PURE__ */ new Set([
|
|
115
|
+
"source",
|
|
116
|
+
"id",
|
|
117
|
+
"label",
|
|
118
|
+
"sql",
|
|
119
|
+
"defaultParameters",
|
|
120
|
+
"pythonCode",
|
|
121
|
+
"fields",
|
|
122
|
+
"limit",
|
|
123
|
+
"pagination",
|
|
124
|
+
"rationale"
|
|
125
|
+
]), Se = /* @__PURE__ */ new Set([
|
|
126
|
+
"kpi",
|
|
127
|
+
"line_chart",
|
|
128
|
+
"bar_chart",
|
|
129
|
+
"stacked_bar_chart",
|
|
130
|
+
"pie_chart",
|
|
131
|
+
"donut_chart",
|
|
132
|
+
"area_chart",
|
|
133
|
+
"table",
|
|
134
|
+
"matrix",
|
|
135
|
+
"narrative",
|
|
136
|
+
"text_block",
|
|
137
|
+
"custom"
|
|
138
|
+
]), we = /* @__PURE__ */ new Set([
|
|
139
|
+
"missing_measure",
|
|
140
|
+
"missing_dimension",
|
|
141
|
+
"missing_date",
|
|
142
|
+
"missing_relationship",
|
|
143
|
+
"missing_semantic_role",
|
|
144
|
+
"missing_current_app_state",
|
|
145
|
+
"unsupported_change_intent",
|
|
146
|
+
"ambiguous_field_grounding",
|
|
147
|
+
"invalid_ranker_output",
|
|
148
|
+
"latest_snapshot_selector_not_modeled",
|
|
149
|
+
"unsupported_grain",
|
|
150
|
+
"requires_sql_escape_hatch",
|
|
151
|
+
"unsupported_sdk_capability"
|
|
152
|
+
]);
|
|
153
|
+
function Qo(i) {
|
|
154
|
+
return W(i).ok;
|
|
155
|
+
}
|
|
156
|
+
function W(i) {
|
|
157
|
+
const t = [];
|
|
158
|
+
if (!i || typeof i != "object")
|
|
159
|
+
return { ok: !1, issues: ["Summary must be an object."] };
|
|
160
|
+
const o = i;
|
|
161
|
+
return o.schemaVersion !== N && t.push(
|
|
162
|
+
`schemaVersion must be ${N}.`
|
|
163
|
+
), (typeof o.title != "string" || !o.title.trim()) && t.push("title is required."), Array.isArray(o.sources) || t.push("sources must be an array."), Array.isArray(o.inputs) || t.push("inputs must be an array."), Array.isArray(o.views) || t.push("views must be an array."), Array.isArray(o.filterContracts) || t.push("filterContracts must be an array."), (!o.implementationChecklist || typeof o.implementationChecklist != "object") && t.push("implementationChecklist must be an object."), o.implementationChecklist && typeof o.implementationChecklist == "object" && t.push(
|
|
164
|
+
...Ae(o.implementationChecklist)
|
|
165
|
+
), Array.isArray(o.sources) && o.sources.forEach((s, r) => {
|
|
166
|
+
t.push(...w(s, `sources.${r}`));
|
|
167
|
+
}), Array.isArray(o.inputs) && o.inputs.forEach((s, r) => {
|
|
168
|
+
t.push(...Ie(s, `inputs.${r}`));
|
|
169
|
+
}), Array.isArray(o.views) && o.views.forEach((s, r) => {
|
|
170
|
+
t.push(..._e(s, `views.${r}`));
|
|
171
|
+
}), Array.isArray(o.filterContracts) && o.filterContracts.forEach((s, r) => {
|
|
172
|
+
t.push(
|
|
173
|
+
...xe(s, `filterContracts.${r}`)
|
|
174
|
+
);
|
|
175
|
+
}), o.unsupportedInsights !== void 0 && (Array.isArray(o.unsupportedInsights) ? o.unsupportedInsights.forEach((s, r) => {
|
|
176
|
+
t.push(
|
|
177
|
+
...We(
|
|
178
|
+
s,
|
|
179
|
+
`unsupportedInsights.${r}`
|
|
180
|
+
)
|
|
181
|
+
);
|
|
182
|
+
}) : t.push("unsupportedInsights must be an array.")), t.push(...ke(o)), { ok: t.length === 0, issues: t };
|
|
183
|
+
}
|
|
184
|
+
function ke(i) {
|
|
185
|
+
const t = Array.isArray(i.unsupportedInsights) && i.unsupportedInsights.some(
|
|
186
|
+
(l) => {
|
|
187
|
+
var u;
|
|
188
|
+
return ((u = a(l)) == null ? void 0 : u.reason) === "missing_relationship";
|
|
189
|
+
}
|
|
190
|
+
), o = Array.isArray(i.views) && i.views.some((l) => {
|
|
191
|
+
var p;
|
|
192
|
+
const u = a((p = a(l)) == null ? void 0 : p.computation);
|
|
193
|
+
return (u == null ? void 0 : u.kind) === "unsupported" && u.reason === "missing_relationship";
|
|
194
|
+
});
|
|
195
|
+
if (!t && !o)
|
|
196
|
+
return [];
|
|
197
|
+
const s = [], r = a(i.validation);
|
|
198
|
+
(r == null ? void 0 : r.status) !== "blocked" && s.push(
|
|
199
|
+
"validation.status must be blocked when missing_relationship gaps are present."
|
|
200
|
+
);
|
|
201
|
+
const n = a(i.nextRequiredTool);
|
|
202
|
+
return (n == null ? void 0 : n.name) !== "semaphor_propose_semantic_model_change" && s.push(
|
|
203
|
+
"nextRequiredTool.name must be semaphor_propose_semantic_model_change when missing_relationship gaps are present."
|
|
204
|
+
), s;
|
|
205
|
+
}
|
|
206
|
+
function w(i, t) {
|
|
207
|
+
const o = a(i);
|
|
208
|
+
return o ? o.kind === "semantic" ? typeof o.domainId == "string" && o.domainId.trim() && typeof o.datasetName == "string" && o.datasetName.trim() ? [] : [`${t} must include sourceKey or a supported source identity.`] : typeof o.sourceKey == "string" && o.sourceKey.trim() ? [] : o.kind === "physical" && typeof o.tableName == "string" && o.tableName.trim() && typeof o.connectionId == "string" && o.connectionId.trim() ? [] : o.kind === "sql" && typeof o.connectionId == "string" && o.connectionId.trim() ? [] : [`${t} must include sourceKey or a supported source identity.`] : [`${t} must be an object.`];
|
|
209
|
+
}
|
|
210
|
+
function Ae(i) {
|
|
211
|
+
const t = a(i);
|
|
212
|
+
if (!t)
|
|
213
|
+
return ["implementationChecklist must be an object."];
|
|
214
|
+
const o = [], s = [
|
|
215
|
+
"requiredDevtools",
|
|
216
|
+
"requiredInputOptions",
|
|
217
|
+
"filterScopeByInput",
|
|
218
|
+
"bindingsByView",
|
|
219
|
+
"validationCommands",
|
|
220
|
+
"browserSmokeChecks"
|
|
221
|
+
];
|
|
222
|
+
for (const n of s)
|
|
223
|
+
n in t || o.push(`implementationChecklist.${n} is required.`);
|
|
224
|
+
const r = a(t.requiredDevtools);
|
|
225
|
+
return r ? typeof r.mountRootDevtools != "boolean" && o.push(
|
|
226
|
+
"implementationChecklist.requiredDevtools.mountRootDevtools must be a boolean."
|
|
227
|
+
) : o.push("implementationChecklist.requiredDevtools must be an object."), Array.isArray(t.requiredInputOptions) || o.push(
|
|
228
|
+
"implementationChecklist.requiredInputOptions must be an array."
|
|
229
|
+
), Array.isArray(t.filterScopeByInput) || o.push("implementationChecklist.filterScopeByInput must be an array."), a(t.bindingsByView) || o.push("implementationChecklist.bindingsByView must be an object."), g(t.validationCommands) || o.push(
|
|
230
|
+
"implementationChecklist.validationCommands must be an array of strings."
|
|
231
|
+
), g(t.browserSmokeChecks) || o.push(
|
|
232
|
+
"implementationChecklist.browserSmokeChecks must be an array of strings."
|
|
233
|
+
), o;
|
|
234
|
+
}
|
|
235
|
+
function Ie(i, t) {
|
|
236
|
+
const o = a(i);
|
|
237
|
+
if (!o)
|
|
238
|
+
return [`${t} must be an object.`];
|
|
239
|
+
const s = [];
|
|
240
|
+
return (typeof o.id != "string" || !o.id.trim()) && s.push(`${t}.id is required.`), o.fieldRef && s.push(...d(o.fieldRef, `${t}.fieldRef`)), s.push(...Z(o.optionQuery, `${t}.optionQuery`)), g(o.appliesToViewIds) || s.push(`${t}.appliesToViewIds must be an array of strings.`), o.bindings !== void 0 && !Array.isArray(o.bindings) && s.push(`${t}.bindings must be an array.`), Array.isArray(o.bindings) && o.bindings.forEach((r, n) => {
|
|
241
|
+
const l = a(r);
|
|
242
|
+
if (!l) {
|
|
243
|
+
s.push(`${t}.bindings.${n} must be an object.`);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
g(l.appliesToViewIds) || s.push(
|
|
247
|
+
`${t}.bindings.${n}.appliesToViewIds must be an array of strings.`
|
|
248
|
+
), s.push(
|
|
249
|
+
...d(
|
|
250
|
+
l.fieldRef,
|
|
251
|
+
`${t}.bindings.${n}.fieldRef`
|
|
252
|
+
)
|
|
253
|
+
);
|
|
254
|
+
}), s;
|
|
255
|
+
}
|
|
256
|
+
function _e(i, t) {
|
|
257
|
+
const o = a(i);
|
|
258
|
+
if (!o)
|
|
259
|
+
return [`${t} must be an object.`];
|
|
260
|
+
const s = [];
|
|
261
|
+
if ((typeof o.id != "string" || !o.id.trim()) && s.push(`${t}.id is required.`), o.visualSpec !== void 0 && s.push(...Le(o.visualSpec, `${t}.visualSpec`)), o.computation !== void 0 && s.push(...Ye(o.computation, `${t}.computation`)), Ve(o))
|
|
262
|
+
return o.fields !== void 0 && (Array.isArray(o.fields) ? o.fields.forEach((n, l) => {
|
|
263
|
+
s.push(...d(n, `${t}.fields.${l}`));
|
|
264
|
+
}) : s.push(`${t}.fields must be an array.`)), o.queryKind !== void 0 && s.push(`${t}.queryKind is not allowed for non-executable views.`), o.sdkBuilder !== void 0 && s.push(`${t}.sdkBuilder is not allowed for non-executable views.`), o.sdkSpec !== void 0 && s.push(`${t}.sdkSpec is not allowed for non-executable views.`), s;
|
|
265
|
+
if (!Array.isArray(o.fields))
|
|
266
|
+
return s.push(`${t}.fields must be an array.`), (o.sdkSpec !== void 0 || o.sdkBuilder !== void 0) && s.push(`${t}.fields must be an array for executable views.`), s;
|
|
267
|
+
o.fields.forEach((n, l) => {
|
|
268
|
+
s.push(...d(n, `${t}.fields.${l}`));
|
|
269
|
+
}), $(o.queryKind) || s.push(`${t}.queryKind must be a supported codegen query kind.`), o.sdkBuilder !== void 0 && !J(o.sdkBuilder) && s.push(`${t}.sdkBuilder must be a supported SDK builder.`);
|
|
270
|
+
const r = a(o.computation);
|
|
271
|
+
return (r == null ? void 0 : r.kind) === "server_query" && $(o.queryKind) && $(r.queryKind) && r.queryKind !== o.queryKind && s.push(`${t}.computation.queryKind must match queryKind.`), s.push(
|
|
272
|
+
...Ee({
|
|
273
|
+
value: o.sdkSpec,
|
|
274
|
+
path: `${t}.sdkSpec`,
|
|
275
|
+
queryKind: typeof o.queryKind == "string" ? o.queryKind : void 0,
|
|
276
|
+
sdkBuilder: typeof o.sdkBuilder == "string" ? o.sdkBuilder : void 0
|
|
277
|
+
}),
|
|
278
|
+
...je(o, `${t}`)
|
|
279
|
+
), s;
|
|
280
|
+
}
|
|
281
|
+
function je(i, t) {
|
|
282
|
+
var L, G;
|
|
283
|
+
const o = a((L = a(i.visualSpec)) == null ? void 0 : L.tableBehavior);
|
|
284
|
+
if (!o)
|
|
285
|
+
return [];
|
|
286
|
+
const s = a(o.totals);
|
|
287
|
+
if (!s)
|
|
288
|
+
return [];
|
|
289
|
+
const r = a(i.sdkSpec), n = a(r == null ? void 0 : r.spec), l = a(n == null ? void 0 : n.totals), u = [], p = typeof (r == null ? void 0 : r.builder) == "string" ? r.builder : void 0, me = (G = a(o.pagination)) == null ? void 0 : G.mode;
|
|
290
|
+
return s.mode === "server" && (p !== "semaphor.records" && u.push(
|
|
291
|
+
`${t}.visualSpec.tableBehavior.totals.mode server is only supported for semaphor.records views.`
|
|
292
|
+
), !l || l.mode !== "server" ? u.push(
|
|
293
|
+
`${t}.sdkSpec.spec.totals.mode must be server when tableBehavior.totals.mode is server.`
|
|
294
|
+
) : u.push(
|
|
295
|
+
...Re({
|
|
296
|
+
left: s.measures,
|
|
297
|
+
right: l.measures,
|
|
298
|
+
leftPath: `${t}.visualSpec.tableBehavior.totals.measures`,
|
|
299
|
+
rightPath: `${t}.sdkSpec.spec.totals.measures`
|
|
300
|
+
})
|
|
301
|
+
)), s.mode !== "server" && l && u.push(
|
|
302
|
+
`${t}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`
|
|
303
|
+
), s.mode === "local" && me === "server" && u.push(
|
|
304
|
+
`${t}.visualSpec.tableBehavior.totals.mode must not be local for server-paginated tables.`
|
|
305
|
+
), p === "semaphor.sql" && s.mode !== "none" && u.push(
|
|
306
|
+
`${t}.visualSpec.tableBehavior.totals.mode must be none for semaphor.sql views.`
|
|
307
|
+
), p === "semaphor.sql" && l && u.push(`${t}.sdkSpec.spec.totals is not supported for semaphor.sql.`), u;
|
|
308
|
+
}
|
|
309
|
+
function Re({
|
|
310
|
+
left: i,
|
|
311
|
+
right: t,
|
|
312
|
+
leftPath: o,
|
|
313
|
+
rightPath: s
|
|
314
|
+
}) {
|
|
315
|
+
if (!Array.isArray(i) || !Array.isArray(t))
|
|
316
|
+
return [`${s} must match ${o}.`];
|
|
317
|
+
const r = [];
|
|
318
|
+
return i.length !== t.length ? (r.push(`${s} must match ${o}.`), r) : (i.forEach((n, l) => {
|
|
319
|
+
Ce(
|
|
320
|
+
a(n),
|
|
321
|
+
a(t[l])
|
|
322
|
+
) || r.push(`${s}.${l} must match ${o}.${l}.`);
|
|
323
|
+
}), r);
|
|
324
|
+
}
|
|
325
|
+
function Ce(i, t) {
|
|
326
|
+
return !i || !t ? !1 : i.name === t.name && (i.role || "measure") === (t.role || "measure") && U(i) === U(t) && qe(i, t);
|
|
327
|
+
}
|
|
328
|
+
function U(i) {
|
|
329
|
+
return typeof i.aggregate == "string" ? i.aggregate.toUpperCase() : "SUM";
|
|
330
|
+
}
|
|
331
|
+
function qe(i, t) {
|
|
332
|
+
const o = typeof i.sourceKey == "string" ? i.sourceKey : void 0, s = typeof t.sourceKey == "string" ? t.sourceKey : void 0;
|
|
333
|
+
if (o || s)
|
|
334
|
+
return o === s;
|
|
335
|
+
const r = a(i.source), n = a(t.source);
|
|
336
|
+
return !r || !n || r.kind !== n.kind ? !1 : r.kind === "semantic" ? r.domainId === n.domainId && r.datasetName === n.datasetName && (r.datasetId === void 0 || n.datasetId === void 0 || r.datasetId === n.datasetId) : r.kind === "physical" ? r.connectionId === n.connectionId && r.tableName === n.tableName : r.kind === "sql" ? r.connectionId === n.connectionId : !1;
|
|
337
|
+
}
|
|
338
|
+
function xe(i, t) {
|
|
339
|
+
const o = a(i);
|
|
340
|
+
if (!o)
|
|
341
|
+
return [`${t} must be an object.`];
|
|
342
|
+
const s = [];
|
|
343
|
+
if (o.fieldRef && s.push(
|
|
344
|
+
...d(o.fieldRef, `${t}.fieldRef`)
|
|
345
|
+
), (typeof o.inputId != "string" || !o.inputId.trim()) && s.push(`${t}.inputId is required.`), s.push(
|
|
346
|
+
...Z(o.optionQuery, `${t}.optionQuery`)
|
|
347
|
+
), g(o.appliesToViewIds) || s.push(`${t}.appliesToViewIds must be an array of strings.`), g(o.notAppliedToViewIds) || s.push(`${t}.notAppliedToViewIds must be an array of strings.`), !Array.isArray(o.bindings))
|
|
348
|
+
s.push(`${t}.bindings must be an array.`);
|
|
349
|
+
else {
|
|
350
|
+
const r = g(o.appliesToViewIds) ? new Set(o.appliesToViewIds) : void 0, n = g(
|
|
351
|
+
o.notAppliedToViewIds
|
|
352
|
+
) ? new Set(o.notAppliedToViewIds) : void 0;
|
|
353
|
+
o.bindings.forEach((l, u) => {
|
|
354
|
+
const p = a(l);
|
|
355
|
+
if (!p) {
|
|
356
|
+
s.push(`${t}.bindings.${u} must be an object.`);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
typeof p.viewId != "string" || !p.viewId ? s.push(`${t}.bindings.${u}.viewId is required.`) : (r && !r.has(p.viewId) && s.push(
|
|
360
|
+
`${t}.bindings.${u}.viewId must be included in appliesToViewIds.`
|
|
361
|
+
), n != null && n.has(p.viewId) && s.push(
|
|
362
|
+
`${t}.bindings.${u}.viewId must not be listed in notAppliedToViewIds.`
|
|
363
|
+
)), s.push(
|
|
364
|
+
...d(
|
|
365
|
+
p.fieldRef,
|
|
366
|
+
`${t}.bindings.${u}.fieldRef`
|
|
367
|
+
)
|
|
368
|
+
);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
return s;
|
|
372
|
+
}
|
|
373
|
+
function Z(i, t) {
|
|
374
|
+
if (i === void 0)
|
|
375
|
+
return [];
|
|
376
|
+
const o = a(i);
|
|
377
|
+
if (!o)
|
|
378
|
+
return [`${t} must be an object.`];
|
|
379
|
+
const s = [
|
|
380
|
+
...h(
|
|
381
|
+
o.valueFieldRef,
|
|
382
|
+
`${t}.valueFieldRef`
|
|
383
|
+
),
|
|
384
|
+
...h(
|
|
385
|
+
o.labelFieldRef,
|
|
386
|
+
`${t}.labelFieldRef`
|
|
387
|
+
),
|
|
388
|
+
...h(
|
|
389
|
+
o.filterFieldRef,
|
|
390
|
+
`${t}.filterFieldRef`
|
|
391
|
+
)
|
|
392
|
+
];
|
|
393
|
+
return o.builder !== "semaphor.inputOptions" && s.push(`${t}.builder must be semaphor.inputOptions.`), typeof o.sourceKey != "string" && o.source === void 0 && s.push(`${t} must include source or sourceKey.`), o.source !== void 0 && s.push(...w(o.source, `${t}.source`)), a(o.valueFieldRef) || s.push(`${t}.valueFieldRef is required.`), a(o.labelFieldRef) || s.push(`${t}.labelFieldRef is required.`), o.limit !== void 0 && (typeof o.limit != "number" || !Number.isInteger(o.limit) || o.limit <= 0) && s.push(`${t}.limit must be a positive integer.`), s;
|
|
394
|
+
}
|
|
395
|
+
function Ee(i) {
|
|
396
|
+
var r;
|
|
397
|
+
const t = a(i.value);
|
|
398
|
+
if (!t)
|
|
399
|
+
return [`${i.path} is required for executable views.`];
|
|
400
|
+
const o = [];
|
|
401
|
+
if (!J(t.builder))
|
|
402
|
+
return o.push(`${i.path}.builder must be a supported SDK builder.`), o;
|
|
403
|
+
i.sdkBuilder && t.builder !== i.sdkBuilder && o.push(`${i.path}.builder must match sdkBuilder.`), i.queryKind && $(i.queryKind) && t.builder !== Pe(i.queryKind) && o.push(`${i.path}.builder must match queryKind.`);
|
|
404
|
+
const s = a(t.spec);
|
|
405
|
+
if (!s)
|
|
406
|
+
return o.push(`${i.path}.spec must be an object.`), o;
|
|
407
|
+
switch (t.builder) {
|
|
408
|
+
case "semaphor.metric":
|
|
409
|
+
o.push(
|
|
410
|
+
...v(s, Y, `${i.path}.spec`),
|
|
411
|
+
...I(s, i.path),
|
|
412
|
+
...E(s.measures, `${i.path}.spec.measures`),
|
|
413
|
+
...h(
|
|
414
|
+
s.primaryMeasure,
|
|
415
|
+
`${i.path}.spec.primaryMeasure`
|
|
416
|
+
),
|
|
417
|
+
...h(
|
|
418
|
+
s.dateField,
|
|
419
|
+
`${i.path}.spec.dateField`
|
|
420
|
+
),
|
|
421
|
+
...F(
|
|
422
|
+
s.dimensions,
|
|
423
|
+
`${i.path}.spec.dimensions`
|
|
424
|
+
),
|
|
425
|
+
...T(s.orderBy, `${i.path}.spec.orderBy`),
|
|
426
|
+
..._(s.filters, `${i.path}.spec.filters`)
|
|
427
|
+
);
|
|
428
|
+
break;
|
|
429
|
+
case "semaphor.analysis":
|
|
430
|
+
o.push(
|
|
431
|
+
...v(s, be, `${i.path}.spec`),
|
|
432
|
+
...I(s, i.path),
|
|
433
|
+
...E(s.measures, `${i.path}.spec.measures`),
|
|
434
|
+
...h(
|
|
435
|
+
s.primaryMeasure,
|
|
436
|
+
`${i.path}.spec.primaryMeasure`
|
|
437
|
+
),
|
|
438
|
+
...h(
|
|
439
|
+
s.dateField,
|
|
440
|
+
`${i.path}.spec.dateField`
|
|
441
|
+
),
|
|
442
|
+
...F(
|
|
443
|
+
s.dimensions,
|
|
444
|
+
`${i.path}.spec.dimensions`
|
|
445
|
+
),
|
|
446
|
+
...T(s.orderBy, `${i.path}.spec.orderBy`),
|
|
447
|
+
..._(s.filters, `${i.path}.spec.filters`),
|
|
448
|
+
...Fe(s, `${i.path}.spec`)
|
|
449
|
+
);
|
|
450
|
+
break;
|
|
451
|
+
case "semaphor.records":
|
|
452
|
+
o.push(
|
|
453
|
+
...v(s, ye, `${i.path}.spec`),
|
|
454
|
+
...I(s, i.path),
|
|
455
|
+
...E(s.fields, `${i.path}.spec.fields`),
|
|
456
|
+
...h(
|
|
457
|
+
s.dateField,
|
|
458
|
+
`${i.path}.spec.dateField`
|
|
459
|
+
),
|
|
460
|
+
...T(s.orderBy, `${i.path}.spec.orderBy`),
|
|
461
|
+
..._(s.filters, `${i.path}.spec.filters`),
|
|
462
|
+
...Te(
|
|
463
|
+
s.totals,
|
|
464
|
+
`${i.path}.spec.totals`
|
|
465
|
+
)
|
|
466
|
+
);
|
|
467
|
+
break;
|
|
468
|
+
case "semaphor.matrix":
|
|
469
|
+
o.push(
|
|
470
|
+
...v(s, ve, `${i.path}.spec`),
|
|
471
|
+
...De(s, i.path),
|
|
472
|
+
...Ne(s.rows, `${i.path}.spec.rows`),
|
|
473
|
+
...Oe(
|
|
474
|
+
s.columns,
|
|
475
|
+
`${i.path}.spec.columns`
|
|
476
|
+
),
|
|
477
|
+
...Ke(s.values, `${i.path}.spec.values`),
|
|
478
|
+
...Me(s.sort, `${i.path}.spec.sort`),
|
|
479
|
+
..._(s.filters, `${i.path}.spec.filters`)
|
|
480
|
+
);
|
|
481
|
+
break;
|
|
482
|
+
case "semaphor.sql":
|
|
483
|
+
o.push(
|
|
484
|
+
...v(s, $e, `${i.path}.spec`),
|
|
485
|
+
...I(s, i.path)
|
|
486
|
+
), ((r = a(s.source)) == null ? void 0 : r.kind) !== "sql" && o.push(`${i.path}.spec.source.kind must be sql.`), (typeof s.sql != "string" || !s.sql.trim()) && o.push(`${i.path}.spec.sql is required.`), o.push(
|
|
487
|
+
...F(
|
|
488
|
+
s.fields,
|
|
489
|
+
`${i.path}.spec.fields`
|
|
490
|
+
)
|
|
491
|
+
);
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
return o;
|
|
495
|
+
}
|
|
496
|
+
function Fe(i, t) {
|
|
497
|
+
const o = [];
|
|
498
|
+
if (i.driverMode !== void 0 && !fe.has(i.driverMode) && o.push(`${t}.driverMode must be a supported analysis driver mode.`), i.includePopulation !== void 0 && typeof i.includePopulation != "boolean" && o.push(`${t}.includePopulation must be a boolean.`), i.calendarContext !== void 0) {
|
|
499
|
+
const s = a(i.calendarContext);
|
|
500
|
+
if (!s)
|
|
501
|
+
o.push(`${t}.calendarContext must be an object.`);
|
|
502
|
+
else {
|
|
503
|
+
s.tz !== void 0 && typeof s.tz != "string" && o.push(`${t}.calendarContext.tz must be a string.`), s.weekStart !== void 0 && (typeof s.weekStart != "number" || !Number.isInteger(s.weekStart) || s.weekStart < 0 || s.weekStart > 6) && o.push(
|
|
504
|
+
`${t}.calendarContext.weekStart must be an integer between 0 and 6.`
|
|
505
|
+
);
|
|
506
|
+
const r = s.anchor;
|
|
507
|
+
if (r !== void 0 && r !== "now") {
|
|
508
|
+
const n = a(r);
|
|
509
|
+
(!n || typeof n.iso != "string" || !n.iso.trim()) && o.push(`${t}.calendarContext.anchor must be now or { iso }.`);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return o;
|
|
514
|
+
}
|
|
515
|
+
function Te(i, t) {
|
|
516
|
+
if (i === void 0)
|
|
517
|
+
return [];
|
|
518
|
+
const o = a(i);
|
|
519
|
+
if (!o)
|
|
520
|
+
return [`${t} must be an object.`];
|
|
521
|
+
const s = [];
|
|
522
|
+
return o.mode !== "server" && s.push(`${t}.mode must be server.`), !Array.isArray(o.measures) || o.measures.length === 0 ? s.push(`${t}.measures must include at least one measure.`) : o.measures.forEach((r, n) => {
|
|
523
|
+
var l;
|
|
524
|
+
s.push(
|
|
525
|
+
...ee(
|
|
526
|
+
r,
|
|
527
|
+
`${t}.measures.${n}`
|
|
528
|
+
)
|
|
529
|
+
), ((l = a(r)) == null ? void 0 : l.role) !== "measure" && s.push(`${t}.measures.${n}.role must be measure.`);
|
|
530
|
+
}), s;
|
|
531
|
+
}
|
|
532
|
+
function v(i, t, o) {
|
|
533
|
+
const s = [];
|
|
534
|
+
return Object.keys(i).forEach((r) => {
|
|
535
|
+
t.has(r) || s.push(`${o}.${r} is not supported for this SDK builder.`);
|
|
536
|
+
}), s;
|
|
537
|
+
}
|
|
538
|
+
function I(i, t) {
|
|
539
|
+
return a(i.source) ? w(i.source, `${t}.spec.source`) : [`${t}.spec.source must be an object.`];
|
|
540
|
+
}
|
|
541
|
+
function De(i, t) {
|
|
542
|
+
const o = a(i.source);
|
|
543
|
+
if (!o)
|
|
544
|
+
return [`${t}.spec.source must be an object.`];
|
|
545
|
+
const s = w(i.source, `${t}.spec.source`);
|
|
546
|
+
return o.kind !== "semantic" && o.kind !== "physical" && s.push(`${t}.spec.source.kind must be semantic or physical.`), s;
|
|
547
|
+
}
|
|
548
|
+
function E(i, t) {
|
|
549
|
+
const o = B(i, t);
|
|
550
|
+
return Array.isArray(i) && i.forEach((s, r) => {
|
|
551
|
+
o.push(...d(s, `${t}.${r}`));
|
|
552
|
+
}), o;
|
|
553
|
+
}
|
|
554
|
+
function F(i, t) {
|
|
555
|
+
if (i === void 0)
|
|
556
|
+
return [];
|
|
557
|
+
if (!Array.isArray(i))
|
|
558
|
+
return [`${t} must be an array.`];
|
|
559
|
+
const o = [];
|
|
560
|
+
return i.forEach((s, r) => {
|
|
561
|
+
o.push(...d(s, `${t}.${r}`));
|
|
562
|
+
}), o;
|
|
563
|
+
}
|
|
564
|
+
function T(i, t) {
|
|
565
|
+
if (i === void 0)
|
|
566
|
+
return [];
|
|
567
|
+
const o = a(i);
|
|
568
|
+
return o ? [
|
|
569
|
+
...d(o.field, `${t}.field`),
|
|
570
|
+
...X(o.direction, `${t}.direction`)
|
|
571
|
+
] : [`${t} must be an object.`];
|
|
572
|
+
}
|
|
573
|
+
function Ne(i, t) {
|
|
574
|
+
const o = B(i, t);
|
|
575
|
+
return Array.isArray(i) && i.forEach((s, r) => {
|
|
576
|
+
const n = a(s);
|
|
577
|
+
if (!n) {
|
|
578
|
+
o.push(`${t}.${r} must be an object.`);
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
o.push(
|
|
582
|
+
...d(n.field, `${t}.${r}.field`)
|
|
583
|
+
);
|
|
584
|
+
}), o;
|
|
585
|
+
}
|
|
586
|
+
function Oe(i, t) {
|
|
587
|
+
if (i === void 0)
|
|
588
|
+
return [];
|
|
589
|
+
const o = [];
|
|
590
|
+
return Array.isArray(i) ? (i.forEach((s, r) => {
|
|
591
|
+
const n = a(s);
|
|
592
|
+
if (!n) {
|
|
593
|
+
o.push(`${t}.${r} must be an object.`);
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
o.push(
|
|
597
|
+
...d(n.field, `${t}.${r}.field`)
|
|
598
|
+
);
|
|
599
|
+
}), o) : [`${t} must be an array.`];
|
|
600
|
+
}
|
|
601
|
+
function Ke(i, t) {
|
|
602
|
+
const o = B(i, t);
|
|
603
|
+
return Array.isArray(i) && i.forEach((s, r) => {
|
|
604
|
+
const n = a(s);
|
|
605
|
+
if (!n) {
|
|
606
|
+
o.push(`${t}.${r} must be an object.`);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
o.push(
|
|
610
|
+
...d(n.field, `${t}.${r}.field`)
|
|
611
|
+
);
|
|
612
|
+
}), o;
|
|
613
|
+
}
|
|
614
|
+
function Me(i, t) {
|
|
615
|
+
if (i === void 0)
|
|
616
|
+
return [];
|
|
617
|
+
if (!Array.isArray(i))
|
|
618
|
+
return [`${t} must be an array.`];
|
|
619
|
+
const o = [];
|
|
620
|
+
return i.forEach((s, r) => {
|
|
621
|
+
const n = a(s);
|
|
622
|
+
if (!n) {
|
|
623
|
+
o.push(`${t}.${r} must be an object.`);
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
n.axis !== "row" && n.axis !== "column" && o.push(`${t}.${r}.axis must be row or column.`), o.push(
|
|
627
|
+
...X(n.direction, `${t}.${r}.direction`),
|
|
628
|
+
...Be(n.by, `${t}.${r}.by`)
|
|
629
|
+
);
|
|
630
|
+
}), o;
|
|
631
|
+
}
|
|
632
|
+
function Be(i, t) {
|
|
633
|
+
const o = a(i);
|
|
634
|
+
if (!o)
|
|
635
|
+
return [`${t} must be an object.`];
|
|
636
|
+
switch (o.kind) {
|
|
637
|
+
case "label":
|
|
638
|
+
return [];
|
|
639
|
+
case "field":
|
|
640
|
+
return d(o.field, `${t}.field`);
|
|
641
|
+
case "value":
|
|
642
|
+
return typeof o.valueId != "string" || !o.valueId.trim() ? [`${t}.valueId is required.`] : [];
|
|
643
|
+
default:
|
|
644
|
+
return [`${t}.kind must be label, field, or value.`];
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
function X(i, t) {
|
|
648
|
+
return i === "asc" || i === "desc" ? [] : [`${t} must be asc or desc.`];
|
|
649
|
+
}
|
|
650
|
+
function _(i, t) {
|
|
651
|
+
if (i === void 0)
|
|
652
|
+
return [];
|
|
653
|
+
if (!Array.isArray(i))
|
|
654
|
+
return [`${t} must be an array.`];
|
|
655
|
+
const o = [];
|
|
656
|
+
return i.forEach((s, r) => {
|
|
657
|
+
const n = a(s);
|
|
658
|
+
if (!n) {
|
|
659
|
+
o.push(`${t}.${r} must be an object.`);
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
o.push(...d(n.field, `${t}.${r}.field`));
|
|
663
|
+
}), o;
|
|
664
|
+
}
|
|
665
|
+
function B(i, t) {
|
|
666
|
+
return !Array.isArray(i) || i.length === 0 ? [`${t} must be a non-empty array.`] : [];
|
|
667
|
+
}
|
|
668
|
+
function Pe(i) {
|
|
669
|
+
switch (i) {
|
|
670
|
+
case "metric":
|
|
671
|
+
return "semaphor.metric";
|
|
672
|
+
case "records":
|
|
673
|
+
return "semaphor.records";
|
|
674
|
+
case "matrix":
|
|
675
|
+
return "semaphor.matrix";
|
|
676
|
+
case "analysis":
|
|
677
|
+
return "semaphor.analysis";
|
|
678
|
+
case "sql_fallback":
|
|
679
|
+
return "semaphor.sql";
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
function Ve(i) {
|
|
683
|
+
const t = a(i.computation), o = a(i.visualSpec);
|
|
684
|
+
return (t == null ? void 0 : t.kind) === "presentation_only" || (t == null ? void 0 : t.kind) === "derived" || (t == null ? void 0 : t.kind) === "unsupported" || i.visual === "text_block" || (o == null ? void 0 : o.visualType) === "text_block";
|
|
685
|
+
}
|
|
686
|
+
function Le(i, t) {
|
|
687
|
+
const o = a(i);
|
|
688
|
+
if (!o)
|
|
689
|
+
return [`${t} must be an object.`];
|
|
690
|
+
const s = [];
|
|
691
|
+
return Se.has(o.visualType) || s.push(`${t}.visualType must be a supported visual type.`), o.limit !== void 0 && (typeof o.limit != "number" || !Number.isInteger(o.limit) || o.limit <= 0) && s.push(`${t}.limit must be a positive integer.`), o.tableBehavior !== void 0 && s.push(
|
|
692
|
+
...Ge(
|
|
693
|
+
o.tableBehavior,
|
|
694
|
+
`${t}.tableBehavior`
|
|
695
|
+
)
|
|
696
|
+
), s;
|
|
697
|
+
}
|
|
698
|
+
function Ge(i, t) {
|
|
699
|
+
const o = a(i);
|
|
700
|
+
if (!o)
|
|
701
|
+
return [`${t} must be an object.`];
|
|
702
|
+
const s = [];
|
|
703
|
+
return o.tableMode !== "bounded" && o.tableMode !== "server_paginated" && o.tableMode !== "server_windowed" && s.push(`${t}.tableMode must be a supported table mode.`), s.push(
|
|
704
|
+
...Ue(o.height, `${t}.height`),
|
|
705
|
+
...ze(o.pagination, `${t}.pagination`),
|
|
706
|
+
...He(o.sorting, `${t}.sorting`),
|
|
707
|
+
...Qe(o.totals, `${t}.totals`)
|
|
708
|
+
), typeof o.serverSideRequired != "boolean" && s.push(`${t}.serverSideRequired must be a boolean.`), s;
|
|
709
|
+
}
|
|
710
|
+
function Ue(i, t) {
|
|
711
|
+
const o = a(i);
|
|
712
|
+
if (!o)
|
|
713
|
+
return [`${t} must be an object.`];
|
|
714
|
+
const s = [];
|
|
715
|
+
return (typeof o.maxPx != "number" || !Number.isInteger(o.maxPx) || o.maxPx <= 0) && s.push(`${t}.maxPx must be a positive integer.`), o.scroll !== "vertical" && o.scroll !== "both" && s.push(`${t}.scroll must be vertical or both.`), typeof o.stickyHeader != "boolean" && s.push(`${t}.stickyHeader must be a boolean.`), s;
|
|
716
|
+
}
|
|
717
|
+
function ze(i, t) {
|
|
718
|
+
const o = a(i);
|
|
719
|
+
if (!o)
|
|
720
|
+
return [`${t} must be an object.`];
|
|
721
|
+
const s = [];
|
|
722
|
+
return o.mode !== "none" && o.mode !== "server" && o.mode !== "client_for_bounded_rows" && s.push(`${t}.mode must be a supported pagination mode.`), o.pageSize !== void 0 && (typeof o.pageSize != "number" || !Number.isInteger(o.pageSize) || o.pageSize <= 0) && s.push(`${t}.pageSize must be a positive integer.`), o.readsFrom !== void 0 && o.readsFrom !== "result.pagination" && s.push(`${t}.readsFrom must be result.pagination.`), s;
|
|
723
|
+
}
|
|
724
|
+
function He(i, t) {
|
|
725
|
+
const o = a(i);
|
|
726
|
+
if (!o)
|
|
727
|
+
return [`${t} must be an object.`];
|
|
728
|
+
const s = [];
|
|
729
|
+
return o.mode !== "server" && o.mode !== "client_for_bounded_rows" && s.push(`${t}.mode must be a supported sorting mode.`), o.defaultField !== void 0 && (typeof o.defaultField != "string" || !o.defaultField.trim()) && s.push(`${t}.defaultField must be a non-empty string.`), o.defaultDirection !== void 0 && o.defaultDirection !== "asc" && o.defaultDirection !== "desc" && s.push(`${t}.defaultDirection must be asc or desc.`), o.resetPageOnChange !== void 0 && typeof o.resetPageOnChange != "boolean" && s.push(`${t}.resetPageOnChange must be a boolean.`), s;
|
|
730
|
+
}
|
|
731
|
+
function Qe(i, t) {
|
|
732
|
+
const o = a(i);
|
|
733
|
+
if (!o)
|
|
734
|
+
return [`${t} must be an object.`];
|
|
735
|
+
const s = [];
|
|
736
|
+
return o.mode !== "none" && o.mode !== "server" && o.mode !== "local" ? (s.push(`${t}.mode must be none, server, or local.`), s) : o.mode === "none" ? (o.measures !== void 0 && s.push(`${t}.measures is not allowed when mode is none.`), o.label !== void 0 && s.push(`${t}.label is not allowed when mode is none.`), s) : o.mode === "server" ? (!Array.isArray(o.measures) || o.measures.length === 0 ? s.push(`${t}.measures must include at least one measure when mode is server.`) : o.measures.forEach((r, n) => {
|
|
737
|
+
var l;
|
|
738
|
+
s.push(
|
|
739
|
+
...ee(
|
|
740
|
+
r,
|
|
741
|
+
`${t}.measures.${n}`
|
|
742
|
+
)
|
|
743
|
+
), ((l = a(r)) == null ? void 0 : l.role) !== "measure" && s.push(`${t}.measures.${n}.role must be measure.`);
|
|
744
|
+
}), o.label !== void 0 && s.push(`${t}.label is not allowed when mode is server.`), s) : (o.mode === "local" && (o.label !== "Displayed rows" && o.label !== "Current page" && s.push(`${t}.label must be Displayed rows or Current page when mode is local.`), o.measures !== void 0 && s.push(`${t}.measures is not allowed when mode is local.`)), s);
|
|
745
|
+
}
|
|
746
|
+
function Ye(i, t) {
|
|
747
|
+
const o = a(i);
|
|
748
|
+
if (!o)
|
|
749
|
+
return [`${t} must be an object.`];
|
|
750
|
+
const s = [];
|
|
751
|
+
switch (o.kind) {
|
|
752
|
+
case "server_query":
|
|
753
|
+
$(o.queryKind) || s.push(`${t}.queryKind must be a supported codegen query kind.`), o.queryOwnership !== void 0 && o.queryOwnership !== "view_owned" && o.queryOwnership !== "shared_query" && s.push(
|
|
754
|
+
`${t}.queryOwnership must be view_owned or shared_query.`
|
|
755
|
+
), o.sourceKeys !== void 0 && !g(o.sourceKeys) && s.push(`${t}.sourceKeys must be an array of strings.`), o.fieldNames !== void 0 && !g(o.fieldNames) && s.push(`${t}.fieldNames must be an array of strings.`);
|
|
756
|
+
break;
|
|
757
|
+
case "derived":
|
|
758
|
+
(typeof o.upstreamViewId != "string" || !o.upstreamViewId.trim()) && s.push(`${t}.upstreamViewId is required.`), (typeof o.derivation != "string" || !o.derivation.trim()) && s.push(`${t}.derivation is required.`);
|
|
759
|
+
break;
|
|
760
|
+
case "presentation_only":
|
|
761
|
+
break;
|
|
762
|
+
case "unsupported":
|
|
763
|
+
(typeof o.reason != "string" || !o.reason.trim()) && s.push(`${t}.reason is required.`), (typeof o.suggestedModelingFix != "string" || !o.suggestedModelingFix.trim()) && s.push(`${t}.suggestedModelingFix is required.`);
|
|
764
|
+
break;
|
|
765
|
+
default:
|
|
766
|
+
s.push(`${t}.kind must be a supported computation kind.`);
|
|
767
|
+
}
|
|
768
|
+
return s;
|
|
769
|
+
}
|
|
770
|
+
function We(i, t) {
|
|
771
|
+
const o = a(i);
|
|
772
|
+
if (!o)
|
|
773
|
+
return [`${t} must be an object.`];
|
|
774
|
+
const s = [];
|
|
775
|
+
for (const n of ["title", "requestedQuestion", "suggestedModelingFix"])
|
|
776
|
+
(typeof o[n] != "string" || !o[n].trim()) && s.push(`${t}.${n} is required.`);
|
|
777
|
+
return we.has(o.reason) || s.push(`${t}.reason must be a supported unsupported insight reason.`), (o.relationshipCandidate !== void 0 || o.nextRepairAction !== void 0) && o.reason !== "missing_relationship" && s.push(
|
|
778
|
+
`${t} relationship repair metadata is only valid for missing_relationship unsupported insights.`
|
|
779
|
+
), o.relationshipCandidate !== void 0 && s.push(
|
|
780
|
+
...Xe(
|
|
781
|
+
o.relationshipCandidate,
|
|
782
|
+
`${t}.relationshipCandidate`
|
|
783
|
+
)
|
|
784
|
+
), o.nextRepairAction !== void 0 && s.push(
|
|
785
|
+
...Ze(
|
|
786
|
+
o.nextRepairAction,
|
|
787
|
+
`${t}.nextRepairAction`
|
|
788
|
+
)
|
|
789
|
+
), s;
|
|
790
|
+
}
|
|
791
|
+
function Ze(i, t) {
|
|
792
|
+
const o = a(i);
|
|
793
|
+
if (!o)
|
|
794
|
+
return [`${t} must be an object.`];
|
|
795
|
+
const s = [], r = /* @__PURE__ */ new Set(["tool", "reason"]);
|
|
796
|
+
return Object.keys(o).forEach((n) => {
|
|
797
|
+
r.has(n) || s.push(
|
|
798
|
+
`${t}.${n} is not supported; repair actions support only tool and reason.`
|
|
799
|
+
);
|
|
800
|
+
}), o.tool !== "semaphor_propose_semantic_model_change" && s.push(
|
|
801
|
+
`${t}.tool must be semaphor_propose_semantic_model_change.`
|
|
802
|
+
), o.reason !== "missing_relationship" && s.push(`${t}.reason must be missing_relationship.`), s;
|
|
803
|
+
}
|
|
804
|
+
function Xe(i, t) {
|
|
805
|
+
const o = a(i);
|
|
806
|
+
if (!o)
|
|
807
|
+
return [`${t} must be an object.`];
|
|
808
|
+
const s = [], r = /* @__PURE__ */ new Set(["source", "sourceFields", "target", "targetFields"]);
|
|
809
|
+
Object.keys(o).forEach((n) => {
|
|
810
|
+
r.has(n) || s.push(
|
|
811
|
+
`${t}.${n} is not supported; relationship candidates support only source, sourceFields, target, and targetFields.`
|
|
812
|
+
);
|
|
813
|
+
}), s.push(
|
|
814
|
+
...z(o.source, `${t}.source`)
|
|
815
|
+
), s.push(
|
|
816
|
+
...z(o.target, `${t}.target`)
|
|
817
|
+
);
|
|
818
|
+
for (const n of ["sourceFields", "targetFields"]) {
|
|
819
|
+
const l = o[n];
|
|
820
|
+
if (!Array.isArray(l) || l.length === 0) {
|
|
821
|
+
s.push(`${t}.${n} must be a non-empty endpoint field array.`);
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
l.forEach((u, p) => {
|
|
825
|
+
s.push(
|
|
826
|
+
...Je(u, `${t}.${n}.${p}`)
|
|
827
|
+
);
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
return s;
|
|
831
|
+
}
|
|
832
|
+
function Je(i, t) {
|
|
833
|
+
const o = a(i);
|
|
834
|
+
if (!o)
|
|
835
|
+
return [`${t} must be an object.`];
|
|
836
|
+
const s = [], r = /* @__PURE__ */ new Set(["name", "label", "role", "dataType"]);
|
|
837
|
+
return Object.keys(o).forEach((n) => {
|
|
838
|
+
r.has(n) || s.push(
|
|
839
|
+
`${t}.${n} is not supported; relationship candidate fields are scoped by their endpoint and support only name, label, role, and dataType.`
|
|
840
|
+
);
|
|
841
|
+
}), (typeof o.name != "string" || !o.name.trim()) && s.push(`${t}.name must be a non-empty string.`), o.role !== void 0 && (typeof o.role != "string" || !["dimension", "measure", "date", "id", "unknown"].includes(o.role)) && s.push(`${t}.role must be dimension, measure, date, id, or unknown.`), o.dataType !== void 0 && (typeof o.dataType != "string" || !["string", "number", "boolean", "date", "datetime", "unknown"].includes(
|
|
842
|
+
o.dataType
|
|
843
|
+
)) && s.push(
|
|
844
|
+
`${t}.dataType must be string, number, boolean, date, datetime, or unknown.`
|
|
845
|
+
), s;
|
|
846
|
+
}
|
|
847
|
+
function z(i, t) {
|
|
848
|
+
const o = a(i);
|
|
849
|
+
if (!o)
|
|
850
|
+
return [`${t} must be an object.`];
|
|
851
|
+
const s = [], r = /* @__PURE__ */ new Set([
|
|
852
|
+
"kind",
|
|
853
|
+
"domainId",
|
|
854
|
+
"datasetName",
|
|
855
|
+
"datasetId",
|
|
856
|
+
"label",
|
|
857
|
+
"sourceKey"
|
|
858
|
+
]);
|
|
859
|
+
return Object.keys(o).forEach((n) => {
|
|
860
|
+
r.has(n) || s.push(
|
|
861
|
+
`${t}.${n} is not supported; relationship candidate sources support only semantic identity fields.`
|
|
862
|
+
);
|
|
863
|
+
}), o.kind !== "semantic" && s.push(`${t} must use semantic source identity.`), (typeof o.domainId != "string" || !o.domainId.trim() || typeof o.datasetName != "string" || !o.datasetName.trim()) && s.push(`${t} must include semantic domainId and datasetName.`), s;
|
|
864
|
+
}
|
|
865
|
+
function $(i) {
|
|
866
|
+
return ge.has(i);
|
|
867
|
+
}
|
|
868
|
+
function J(i) {
|
|
869
|
+
return he.has(i);
|
|
870
|
+
}
|
|
871
|
+
function h(i, t) {
|
|
872
|
+
return i === void 0 ? [] : d(i, t);
|
|
873
|
+
}
|
|
874
|
+
function d(i, t) {
|
|
875
|
+
const o = a(i);
|
|
876
|
+
if (!o)
|
|
877
|
+
return [`${t} must be an object.`];
|
|
878
|
+
const s = [];
|
|
879
|
+
return (typeof o.name != "string" || !o.name.trim()) && s.push(`${t}.name is required.`), !o.source && typeof o.sourceKey != "string" && s.push(`${t} must include source or sourceKey.`), s;
|
|
880
|
+
}
|
|
881
|
+
function ee(i, t) {
|
|
882
|
+
const o = a(i), s = d(i, t);
|
|
883
|
+
if (!o || typeof o.sourceKey == "string" && o.sourceKey.trim())
|
|
884
|
+
return s;
|
|
885
|
+
if (o.source !== void 0) {
|
|
886
|
+
const n = w(o.source, `${t}.source`);
|
|
887
|
+
return n.length === 0 || s.push(...n), s;
|
|
888
|
+
}
|
|
889
|
+
return s.includes(`${t} must include source or sourceKey.`) || s.push(`${t} must include source or sourceKey.`), s;
|
|
890
|
+
}
|
|
891
|
+
function a(i) {
|
|
892
|
+
return i && typeof i == "object" && !Array.isArray(i) ? i : void 0;
|
|
893
|
+
}
|
|
894
|
+
function g(i) {
|
|
895
|
+
return Array.isArray(i) && i.every((t) => typeof t == "string");
|
|
896
|
+
}
|
|
897
|
+
const m = e.record(e.string(), e.unknown()), R = e.array(m), c = e.enum([
|
|
898
|
+
"SUM",
|
|
899
|
+
"COUNT",
|
|
900
|
+
"AVG",
|
|
901
|
+
"MIN",
|
|
902
|
+
"MAX",
|
|
903
|
+
"MEDIAN",
|
|
904
|
+
"DISTINCT"
|
|
905
|
+
]), C = e.enum([
|
|
906
|
+
"postgres",
|
|
907
|
+
"mysql",
|
|
908
|
+
"mssql",
|
|
909
|
+
"snowflake",
|
|
910
|
+
"clickhouse",
|
|
911
|
+
"bigquery",
|
|
912
|
+
"redshift",
|
|
913
|
+
"duckdb",
|
|
914
|
+
"sqlite",
|
|
915
|
+
"unknown"
|
|
916
|
+
]), oe = e.enum([
|
|
917
|
+
"hour",
|
|
918
|
+
"day",
|
|
919
|
+
"week",
|
|
920
|
+
"month",
|
|
921
|
+
"quarter",
|
|
922
|
+
"year"
|
|
923
|
+
]), q = e.enum([
|
|
924
|
+
"dimension",
|
|
925
|
+
"measure",
|
|
926
|
+
"date",
|
|
927
|
+
"id",
|
|
928
|
+
"unknown"
|
|
929
|
+
]), x = e.enum([
|
|
930
|
+
"string",
|
|
931
|
+
"number",
|
|
932
|
+
"boolean",
|
|
933
|
+
"date",
|
|
934
|
+
"datetime",
|
|
935
|
+
"unknown"
|
|
936
|
+
]), te = e.enum([
|
|
937
|
+
"semantic_model",
|
|
938
|
+
"caller_override",
|
|
939
|
+
"default_sum"
|
|
940
|
+
]), j = e.union([e.number(), e.string(), e.null()]), D = e.enum([
|
|
941
|
+
"millisecond",
|
|
942
|
+
"second",
|
|
943
|
+
"minute",
|
|
944
|
+
"hour",
|
|
945
|
+
"day"
|
|
946
|
+
]), se = e.union([
|
|
947
|
+
e.object({
|
|
948
|
+
type: e.enum(["number", "currency", "percent", "percentage", "scientific"]),
|
|
949
|
+
locale: e.string().optional(),
|
|
950
|
+
minimumFractionDigits: e.number().optional(),
|
|
951
|
+
maximumFractionDigits: e.number().optional(),
|
|
952
|
+
useGrouping: e.boolean().optional(),
|
|
953
|
+
prefix: e.string().optional(),
|
|
954
|
+
suffix: e.string().optional(),
|
|
955
|
+
negativeStyle: e.enum(["minus", "parentheses"]).optional(),
|
|
956
|
+
compact: e.boolean().optional(),
|
|
957
|
+
scale: e.number().optional(),
|
|
958
|
+
currency: e.string().optional(),
|
|
959
|
+
percentValueMode: e.enum(["fraction", "whole"]).optional()
|
|
960
|
+
}).passthrough(),
|
|
961
|
+
e.object({
|
|
962
|
+
type: e.enum(["date", "datetime"]),
|
|
963
|
+
locale: e.string().optional(),
|
|
964
|
+
pattern: e.string().optional(),
|
|
965
|
+
relative: e.boolean().optional(),
|
|
966
|
+
timezone: e.string().optional(),
|
|
967
|
+
sourceTimezone: e.string().optional(),
|
|
968
|
+
prefix: e.string().optional(),
|
|
969
|
+
suffix: e.string().optional()
|
|
970
|
+
}).passthrough(),
|
|
971
|
+
e.object({
|
|
972
|
+
type: e.literal("duration"),
|
|
973
|
+
inputUnit: D.optional(),
|
|
974
|
+
outputStyle: e.enum(["compact", "digital", "long"]).optional(),
|
|
975
|
+
largestUnit: D.optional(),
|
|
976
|
+
smallestUnit: D.optional(),
|
|
977
|
+
maxUnits: e.number().optional(),
|
|
978
|
+
prefix: e.string().optional(),
|
|
979
|
+
suffix: e.string().optional(),
|
|
980
|
+
negativeStyle: e.enum(["minus", "parentheses"]).optional()
|
|
981
|
+
}).passthrough(),
|
|
982
|
+
e.object({
|
|
983
|
+
type: e.literal("string"),
|
|
984
|
+
prefix: e.string().optional(),
|
|
985
|
+
suffix: e.string().optional()
|
|
986
|
+
}).passthrough()
|
|
987
|
+
]), eo = e.union([
|
|
988
|
+
e.object({ kind: e.literal("defaultAggregate") }).passthrough(),
|
|
989
|
+
e.object({ kind: e.literal("blank") }).passthrough(),
|
|
990
|
+
e.object({
|
|
991
|
+
kind: e.literal("labelOnly"),
|
|
992
|
+
label: e.string().optional()
|
|
993
|
+
}).passthrough(),
|
|
994
|
+
e.object({
|
|
995
|
+
kind: e.literal("customAggregate"),
|
|
996
|
+
aggregate: c
|
|
997
|
+
}).passthrough(),
|
|
998
|
+
e.object({ kind: e.literal("percentOfParent") }).passthrough(),
|
|
999
|
+
e.object({ kind: e.literal("percentOfGrandTotal") }).passthrough(),
|
|
1000
|
+
e.object({
|
|
1001
|
+
kind: e.literal("customExpression"),
|
|
1002
|
+
expressionId: e.string()
|
|
1003
|
+
}).passthrough()
|
|
1004
|
+
]);
|
|
1005
|
+
function k(i, t) {
|
|
1006
|
+
return e.object(i).passthrough().superRefine((o, s) => {
|
|
1007
|
+
for (const r of t)
|
|
1008
|
+
Object.prototype.hasOwnProperty.call(o, r) || s.addIssue({
|
|
1009
|
+
code: "custom",
|
|
1010
|
+
path: [r],
|
|
1011
|
+
message: `Required field "${r}" is missing.`
|
|
1012
|
+
});
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
const ie = e.object({
|
|
1016
|
+
kind: e.literal("semantic"),
|
|
1017
|
+
domainId: e.string(),
|
|
1018
|
+
datasetName: e.string(),
|
|
1019
|
+
datasetId: e.string().optional(),
|
|
1020
|
+
label: e.string().optional(),
|
|
1021
|
+
connectionId: e.string().optional()
|
|
1022
|
+
}).passthrough(), oo = e.object({
|
|
1023
|
+
kind: e.literal("physical"),
|
|
1024
|
+
connectionId: e.string(),
|
|
1025
|
+
connectionType: e.string().optional(),
|
|
1026
|
+
tableName: e.string(),
|
|
1027
|
+
databaseName: e.string().optional(),
|
|
1028
|
+
schemaName: e.string().optional(),
|
|
1029
|
+
label: e.string().optional(),
|
|
1030
|
+
dialect: C.optional()
|
|
1031
|
+
}).passthrough(), to = e.object({
|
|
1032
|
+
kind: e.literal("sql"),
|
|
1033
|
+
connectionId: e.string(),
|
|
1034
|
+
dialect: C.optional(),
|
|
1035
|
+
label: e.string().optional()
|
|
1036
|
+
}).passthrough(), S = e.union([
|
|
1037
|
+
ie,
|
|
1038
|
+
oo,
|
|
1039
|
+
to
|
|
1040
|
+
]), y = e.object({
|
|
1041
|
+
name: e.string(),
|
|
1042
|
+
label: e.string().optional(),
|
|
1043
|
+
role: q.optional(),
|
|
1044
|
+
dataType: x.optional(),
|
|
1045
|
+
source: S.optional(),
|
|
1046
|
+
aggregate: c.optional()
|
|
1047
|
+
}).passthrough(), so = e.object({
|
|
1048
|
+
kind: e.literal("field"),
|
|
1049
|
+
field: y,
|
|
1050
|
+
aggregate: c.optional()
|
|
1051
|
+
}).passthrough(), re = e.object({
|
|
1052
|
+
kind: e.literal("derived_field"),
|
|
1053
|
+
name: e.string(),
|
|
1054
|
+
label: e.string(),
|
|
1055
|
+
description: e.string().optional(),
|
|
1056
|
+
resultRole: q,
|
|
1057
|
+
dataType: x,
|
|
1058
|
+
computeStage: e.enum(["row", "aggregate"]),
|
|
1059
|
+
expression: e.string(),
|
|
1060
|
+
expressionLanguage: e.literal("semaphor_sql_template").optional(),
|
|
1061
|
+
inputs: e.record(so),
|
|
1062
|
+
defaultAggregate: c.optional(),
|
|
1063
|
+
aggregationBehavior: e.enum([
|
|
1064
|
+
"additive",
|
|
1065
|
+
"non_additive",
|
|
1066
|
+
"ratio_of_sums",
|
|
1067
|
+
"weighted",
|
|
1068
|
+
"pre_aggregated",
|
|
1069
|
+
"snapshot"
|
|
1070
|
+
]).optional(),
|
|
1071
|
+
aggregationStrategy: e.enum([
|
|
1072
|
+
"default",
|
|
1073
|
+
"symmetric_aggregate",
|
|
1074
|
+
"aggregate_then_join",
|
|
1075
|
+
"weighted"
|
|
1076
|
+
]).optional(),
|
|
1077
|
+
format: se.optional(),
|
|
1078
|
+
tags: e.array(e.string()).optional()
|
|
1079
|
+
}).passthrough(), P = y.and(
|
|
1080
|
+
e.object({
|
|
1081
|
+
semanticAggregate: c.optional(),
|
|
1082
|
+
effectiveAggregate: c.optional(),
|
|
1083
|
+
aggregateSource: te.optional(),
|
|
1084
|
+
derivedField: re.optional()
|
|
1085
|
+
}).passthrough()
|
|
1086
|
+
), io = ie, ro = e.object({
|
|
1087
|
+
kind: e.literal("physical"),
|
|
1088
|
+
connectionId: e.string().optional(),
|
|
1089
|
+
connectionType: e.string().optional(),
|
|
1090
|
+
tableName: e.string(),
|
|
1091
|
+
databaseName: e.string().optional(),
|
|
1092
|
+
schemaName: e.string().optional(),
|
|
1093
|
+
label: e.string().optional(),
|
|
1094
|
+
dialect: C.optional()
|
|
1095
|
+
}).passthrough(), no = e.object({
|
|
1096
|
+
kind: e.literal("sql"),
|
|
1097
|
+
connectionId: e.string().optional(),
|
|
1098
|
+
dialect: C.optional(),
|
|
1099
|
+
label: e.string().optional()
|
|
1100
|
+
}).passthrough(), ao = e.union([
|
|
1101
|
+
io,
|
|
1102
|
+
ro,
|
|
1103
|
+
no
|
|
1104
|
+
]), lo = e.object({
|
|
1105
|
+
key: e.string().optional(),
|
|
1106
|
+
name: e.string(),
|
|
1107
|
+
label: e.string().optional(),
|
|
1108
|
+
role: q.optional(),
|
|
1109
|
+
dataType: x.optional(),
|
|
1110
|
+
source: ao.optional(),
|
|
1111
|
+
aggregate: c.optional(),
|
|
1112
|
+
semanticAggregate: c.optional(),
|
|
1113
|
+
effectiveAggregate: c.optional(),
|
|
1114
|
+
aggregateSource: te.optional(),
|
|
1115
|
+
derivedField: e.never().optional()
|
|
1116
|
+
}).passthrough(), O = e.object({
|
|
1117
|
+
key: e.string(),
|
|
1118
|
+
name: e.string(),
|
|
1119
|
+
label: e.string(),
|
|
1120
|
+
role: q.optional(),
|
|
1121
|
+
dataType: x.optional(),
|
|
1122
|
+
aggregate: c.optional(),
|
|
1123
|
+
source: S.optional(),
|
|
1124
|
+
derivedField: re.optional()
|
|
1125
|
+
}).passthrough(), ne = e.object({
|
|
1126
|
+
code: e.string(),
|
|
1127
|
+
message: e.string().optional(),
|
|
1128
|
+
invalidField: e.string().optional(),
|
|
1129
|
+
fieldRole: e.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
|
|
1130
|
+
validMeasureCandidates: e.array(e.string()).optional(),
|
|
1131
|
+
validDateCandidates: e.array(e.string()).optional(),
|
|
1132
|
+
validDimensionCandidates: e.array(e.string()).optional(),
|
|
1133
|
+
recommendedNextStep: e.string()
|
|
1134
|
+
}).passthrough(), K = e.object({
|
|
1135
|
+
code: e.string(),
|
|
1136
|
+
message: e.string(),
|
|
1137
|
+
path: e.string().optional(),
|
|
1138
|
+
fieldRole: e.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
|
|
1139
|
+
repairHint: ne.optional()
|
|
1140
|
+
}).passthrough(), ae = e.object({
|
|
1141
|
+
ok: e.boolean(),
|
|
1142
|
+
errors: e.array(K),
|
|
1143
|
+
warnings: e.array(K),
|
|
1144
|
+
repairHints: e.array(ne)
|
|
1145
|
+
}).passthrough(), uo = e.object({
|
|
1146
|
+
page: e.number(),
|
|
1147
|
+
pageSize: e.number(),
|
|
1148
|
+
pageCount: e.number(),
|
|
1149
|
+
totalCount: e.number(),
|
|
1150
|
+
hasNextPage: e.boolean(),
|
|
1151
|
+
hasPrevPage: e.boolean()
|
|
1152
|
+
}).passthrough(), A = {
|
|
1153
|
+
intentId: e.string().optional(),
|
|
1154
|
+
queryPath: e.enum(["query_spec", "sql", "sql_python"]),
|
|
1155
|
+
warnings: e.array(e.string()).optional(),
|
|
1156
|
+
rowCount: e.number().optional(),
|
|
1157
|
+
rowLimitExceeded: e.boolean().optional(),
|
|
1158
|
+
limit: e.number().optional(),
|
|
1159
|
+
pagination: uo.optional()
|
|
1160
|
+
}, co = e.object({
|
|
1161
|
+
...A,
|
|
1162
|
+
kind: e.literal("metric"),
|
|
1163
|
+
value: j,
|
|
1164
|
+
measures: e.record(j).optional(),
|
|
1165
|
+
comparison: e.object({
|
|
1166
|
+
kind: e.enum(["previous_period", "previous_year", "target"]),
|
|
1167
|
+
value: j.optional(),
|
|
1168
|
+
delta: e.union([e.number(), e.null()]).optional(),
|
|
1169
|
+
deltaPercent: e.union([e.number(), e.null()]).optional()
|
|
1170
|
+
}).passthrough().optional(),
|
|
1171
|
+
records: R.optional()
|
|
1172
|
+
}).passthrough(), po = e.object({
|
|
1173
|
+
...A,
|
|
1174
|
+
kind: e.literal("records"),
|
|
1175
|
+
columns: e.array(O),
|
|
1176
|
+
records: R,
|
|
1177
|
+
totals: e.object({
|
|
1178
|
+
mode: e.literal("server"),
|
|
1179
|
+
scope: e.literal("filtered_result"),
|
|
1180
|
+
row: e.record(e.string(), e.unknown()),
|
|
1181
|
+
columns: e.array(O).optional()
|
|
1182
|
+
}).passthrough().optional()
|
|
1183
|
+
}).passthrough(), mo = e.object({
|
|
1184
|
+
...A,
|
|
1185
|
+
kind: e.literal("inputOptions"),
|
|
1186
|
+
options: e.array(
|
|
1187
|
+
k(
|
|
1188
|
+
{
|
|
1189
|
+
label: e.string(),
|
|
1190
|
+
value: e.unknown(),
|
|
1191
|
+
count: e.number().optional(),
|
|
1192
|
+
disambiguation: e.array(e.string()).optional()
|
|
1193
|
+
},
|
|
1194
|
+
["value"]
|
|
1195
|
+
)
|
|
1196
|
+
)
|
|
1197
|
+
}).passthrough(), go = e.object({
|
|
1198
|
+
...A,
|
|
1199
|
+
kind: e.literal("sql"),
|
|
1200
|
+
columns: e.array(O),
|
|
1201
|
+
records: R,
|
|
1202
|
+
sqlShape: e.object({
|
|
1203
|
+
statementType: e.string().optional(),
|
|
1204
|
+
explicitLimit: e.number().optional(),
|
|
1205
|
+
hasPythonCode: e.boolean().optional()
|
|
1206
|
+
}).passthrough().optional()
|
|
1207
|
+
}).passthrough(), ho = e.object({
|
|
1208
|
+
enabled: e.boolean().optional(),
|
|
1209
|
+
position: e.enum(["before", "after"]).optional(),
|
|
1210
|
+
label: e.string().optional()
|
|
1211
|
+
}).passthrough(), H = e.object({
|
|
1212
|
+
id: e.enum(["rows", "columns"]),
|
|
1213
|
+
levels: e.array(
|
|
1214
|
+
e.object({
|
|
1215
|
+
instanceId: e.string(),
|
|
1216
|
+
fieldKey: e.string(),
|
|
1217
|
+
label: e.string(),
|
|
1218
|
+
field: y,
|
|
1219
|
+
grain: oe.optional(),
|
|
1220
|
+
subtotal: ho.optional()
|
|
1221
|
+
}).passthrough()
|
|
1222
|
+
),
|
|
1223
|
+
nodeIds: e.array(e.string())
|
|
1224
|
+
}).passthrough(), b = k(
|
|
1225
|
+
{
|
|
1226
|
+
instanceId: e.string(),
|
|
1227
|
+
fieldKey: e.string(),
|
|
1228
|
+
value: e.unknown(),
|
|
1229
|
+
label: e.string()
|
|
1230
|
+
},
|
|
1231
|
+
["value"]
|
|
1232
|
+
), fo = e.union([
|
|
1233
|
+
e.object({ kind: e.literal("label") }).passthrough(),
|
|
1234
|
+
e.object({
|
|
1235
|
+
kind: e.literal("field"),
|
|
1236
|
+
field: y,
|
|
1237
|
+
aggregate: c.optional()
|
|
1238
|
+
}).passthrough(),
|
|
1239
|
+
e.object({
|
|
1240
|
+
kind: e.literal("value"),
|
|
1241
|
+
valueId: e.string(),
|
|
1242
|
+
rowPath: e.array(b).optional(),
|
|
1243
|
+
columnPath: e.array(b).optional()
|
|
1244
|
+
}).passthrough()
|
|
1245
|
+
]), bo = e.enum([
|
|
1246
|
+
"present",
|
|
1247
|
+
"presentNull",
|
|
1248
|
+
"missing",
|
|
1249
|
+
"densified"
|
|
1250
|
+
]), yo = e.enum([
|
|
1251
|
+
"value",
|
|
1252
|
+
"rowSubtotal",
|
|
1253
|
+
"columnSubtotal",
|
|
1254
|
+
"subtotalIntersection",
|
|
1255
|
+
"rowGrandTotal",
|
|
1256
|
+
"columnGrandTotal",
|
|
1257
|
+
"matrixGrandTotal"
|
|
1258
|
+
]), vo = e.object({
|
|
1259
|
+
instanceId: e.string(),
|
|
1260
|
+
fieldKey: e.string(),
|
|
1261
|
+
field: y,
|
|
1262
|
+
role: e.enum(["row", "column", "measure", "sort", "filter"]),
|
|
1263
|
+
label: e.string().optional()
|
|
1264
|
+
}).passthrough(), $o = e.union([
|
|
1265
|
+
e.object({
|
|
1266
|
+
kind: e.literal("additive"),
|
|
1267
|
+
aggregate: c.optional()
|
|
1268
|
+
}).passthrough(),
|
|
1269
|
+
e.object({
|
|
1270
|
+
kind: e.literal("semiAdditive"),
|
|
1271
|
+
aggregate: c.optional(),
|
|
1272
|
+
grain: oe.optional()
|
|
1273
|
+
}).passthrough(),
|
|
1274
|
+
e.object({
|
|
1275
|
+
kind: e.literal("nonAdditive"),
|
|
1276
|
+
aggregate: c.optional()
|
|
1277
|
+
}).passthrough(),
|
|
1278
|
+
e.object({
|
|
1279
|
+
kind: e.literal("ratio"),
|
|
1280
|
+
numeratorMeasureInstanceId: e.string().optional(),
|
|
1281
|
+
denominatorMeasureInstanceId: e.string().optional()
|
|
1282
|
+
}).passthrough(),
|
|
1283
|
+
e.object({
|
|
1284
|
+
kind: e.literal("custom"),
|
|
1285
|
+
expressionId: e.string().optional()
|
|
1286
|
+
}).passthrough()
|
|
1287
|
+
]), So = e.object({
|
|
1288
|
+
instanceId: e.string(),
|
|
1289
|
+
fieldKey: e.string(),
|
|
1290
|
+
label: e.string(),
|
|
1291
|
+
field: y,
|
|
1292
|
+
aggregate: c.optional(),
|
|
1293
|
+
format: se.optional(),
|
|
1294
|
+
totalBehavior: eo.optional(),
|
|
1295
|
+
semantics: $o
|
|
1296
|
+
}).passthrough(), wo = e.object({
|
|
1297
|
+
id: e.string(),
|
|
1298
|
+
measureId: e.string(),
|
|
1299
|
+
aggregate: c.optional(),
|
|
1300
|
+
label: e.string().optional(),
|
|
1301
|
+
source: e.enum([
|
|
1302
|
+
"measureDefault",
|
|
1303
|
+
"rowSubtotal",
|
|
1304
|
+
"columnSubtotal",
|
|
1305
|
+
"subtotalIntersection",
|
|
1306
|
+
"rowGrandTotal",
|
|
1307
|
+
"columnGrandTotal",
|
|
1308
|
+
"matrixGrandTotal",
|
|
1309
|
+
"custom"
|
|
1310
|
+
]),
|
|
1311
|
+
scope: e.object({
|
|
1312
|
+
rowLevelId: e.string().optional(),
|
|
1313
|
+
columnLevelId: e.string().optional(),
|
|
1314
|
+
rowNodeId: e.string().optional(),
|
|
1315
|
+
columnNodeId: e.string().optional()
|
|
1316
|
+
}).passthrough().optional()
|
|
1317
|
+
}).passthrough(), ko = e.object({
|
|
1318
|
+
kind: e.string(),
|
|
1319
|
+
label: e.string().optional(),
|
|
1320
|
+
payload: e.record(e.string(), e.unknown()).optional()
|
|
1321
|
+
}).passthrough(), Ao = k(
|
|
1322
|
+
{
|
|
1323
|
+
id: e.string(),
|
|
1324
|
+
axis: e.enum(["row", "column"]),
|
|
1325
|
+
path: e.array(b),
|
|
1326
|
+
level: e.number(),
|
|
1327
|
+
label: e.string(),
|
|
1328
|
+
value: e.unknown(),
|
|
1329
|
+
parentId: e.string().optional(),
|
|
1330
|
+
hasChildren: e.boolean(),
|
|
1331
|
+
isExpanded: e.boolean().optional(),
|
|
1332
|
+
isSubtotal: e.boolean().optional(),
|
|
1333
|
+
isGrandTotal: e.boolean().optional(),
|
|
1334
|
+
subtotalFunction: c.optional(),
|
|
1335
|
+
childCount: e.number().optional(),
|
|
1336
|
+
actions: e.array(ko).optional()
|
|
1337
|
+
},
|
|
1338
|
+
["value"]
|
|
1339
|
+
), Io = e.object({
|
|
1340
|
+
rowHeaderLevels: e.array(
|
|
1341
|
+
e.object({
|
|
1342
|
+
id: e.string(),
|
|
1343
|
+
label: e.string(),
|
|
1344
|
+
fieldInstanceId: e.string()
|
|
1345
|
+
}).passthrough()
|
|
1346
|
+
),
|
|
1347
|
+
columnHeaderRows: e.array(
|
|
1348
|
+
e.object({
|
|
1349
|
+
id: e.string(),
|
|
1350
|
+
cells: e.array(
|
|
1351
|
+
e.object({
|
|
1352
|
+
id: e.string(),
|
|
1353
|
+
label: e.string(),
|
|
1354
|
+
role: e.enum([
|
|
1355
|
+
"rowHeader",
|
|
1356
|
+
"columnHeader",
|
|
1357
|
+
"measureHeader",
|
|
1358
|
+
"subtotal",
|
|
1359
|
+
"grandTotal"
|
|
1360
|
+
]),
|
|
1361
|
+
colSpan: e.number(),
|
|
1362
|
+
rowSpan: e.number(),
|
|
1363
|
+
columnPath: e.array(b),
|
|
1364
|
+
measureInstanceId: e.string().optional()
|
|
1365
|
+
}).passthrough()
|
|
1366
|
+
)
|
|
1367
|
+
}).passthrough()
|
|
1368
|
+
),
|
|
1369
|
+
columns: e.array(
|
|
1370
|
+
e.object({
|
|
1371
|
+
id: e.string(),
|
|
1372
|
+
label: e.string(),
|
|
1373
|
+
columnNodeId: e.string().optional(),
|
|
1374
|
+
columnPath: e.array(b),
|
|
1375
|
+
measureInstanceId: e.string(),
|
|
1376
|
+
role: e.enum(["value", "columnSubtotal", "columnGrandTotal"])
|
|
1377
|
+
}).passthrough()
|
|
1378
|
+
)
|
|
1379
|
+
}).passthrough(), _o = k(
|
|
1380
|
+
{
|
|
1381
|
+
rowId: e.string(),
|
|
1382
|
+
columnId: e.string().optional(),
|
|
1383
|
+
measureId: e.string(),
|
|
1384
|
+
value: e.unknown(),
|
|
1385
|
+
formattedValue: e.string().optional(),
|
|
1386
|
+
presence: bo,
|
|
1387
|
+
role: yo,
|
|
1388
|
+
calculationId: e.string().optional()
|
|
1389
|
+
},
|
|
1390
|
+
["value"]
|
|
1391
|
+
), jo = e.object({
|
|
1392
|
+
rows: e.boolean().optional(),
|
|
1393
|
+
columns: e.boolean().optional(),
|
|
1394
|
+
grandTotal: e.union([
|
|
1395
|
+
e.boolean(),
|
|
1396
|
+
e.object({
|
|
1397
|
+
rows: e.boolean().optional(),
|
|
1398
|
+
columns: e.boolean().optional()
|
|
1399
|
+
}).passthrough()
|
|
1400
|
+
]).optional()
|
|
1401
|
+
}).passthrough(), Ro = k(
|
|
1402
|
+
{
|
|
1403
|
+
id: e.string(),
|
|
1404
|
+
axis: e.enum(["row", "column"]),
|
|
1405
|
+
targetInstanceId: e.string().optional(),
|
|
1406
|
+
direction: e.enum(["asc", "desc"]),
|
|
1407
|
+
nulls: e.enum(["warehouseDefault", "first", "last"]).optional(),
|
|
1408
|
+
scope: e.enum(["global", "withinParent"]).optional(),
|
|
1409
|
+
by: fo
|
|
1410
|
+
},
|
|
1411
|
+
["by"]
|
|
1412
|
+
), Co = e.object({
|
|
1413
|
+
rowOffset: e.number().optional(),
|
|
1414
|
+
rowLimit: e.number().optional(),
|
|
1415
|
+
columnOffset: e.number().optional(),
|
|
1416
|
+
columnLimit: e.number().optional(),
|
|
1417
|
+
hasMoreRows: e.boolean().optional(),
|
|
1418
|
+
hasMoreColumns: e.boolean().optional()
|
|
1419
|
+
}).passthrough(), qo = e.object({
|
|
1420
|
+
axis: e.enum(["row", "column"]),
|
|
1421
|
+
path: e.array(b),
|
|
1422
|
+
depth: e.number().optional()
|
|
1423
|
+
}).passthrough(), xo = e.object({
|
|
1424
|
+
rowLazyLoading: e.boolean().optional(),
|
|
1425
|
+
columnLazyLoading: e.boolean().optional(),
|
|
1426
|
+
expandableRowNodeIds: e.array(e.string()).optional(),
|
|
1427
|
+
expandableColumnNodeIds: e.array(e.string()).optional(),
|
|
1428
|
+
nextRequests: e.array(qo).optional()
|
|
1429
|
+
}).passthrough(), Eo = e.object({
|
|
1430
|
+
domains: e.record(
|
|
1431
|
+
e.object({
|
|
1432
|
+
min: e.number().optional(),
|
|
1433
|
+
max: e.number().optional()
|
|
1434
|
+
}).passthrough()
|
|
1435
|
+
).optional(),
|
|
1436
|
+
rules: e.array(e.record(e.string(), e.unknown())).optional()
|
|
1437
|
+
}).passthrough(), Fo = e.object({
|
|
1438
|
+
...A,
|
|
1439
|
+
kind: e.literal("matrix"),
|
|
1440
|
+
schemaVersion: e.literal(1),
|
|
1441
|
+
shape: e.enum(["hierarchical", "pivot"]),
|
|
1442
|
+
capabilities: e.array(e.string()),
|
|
1443
|
+
executionMetadata: e.record(e.string(), e.unknown()),
|
|
1444
|
+
fieldsById: e.record(e.string(), vo),
|
|
1445
|
+
measuresById: e.record(e.string(), So),
|
|
1446
|
+
calculationsById: e.record(e.string(), wo).optional(),
|
|
1447
|
+
axes: e.object({
|
|
1448
|
+
rows: H,
|
|
1449
|
+
columns: H
|
|
1450
|
+
}).passthrough(),
|
|
1451
|
+
nodesById: e.record(e.string(), Ao),
|
|
1452
|
+
layout: Io,
|
|
1453
|
+
cells: e.array(_o),
|
|
1454
|
+
totals: jo,
|
|
1455
|
+
sort: e.array(Ro),
|
|
1456
|
+
formattingContext: Eo,
|
|
1457
|
+
pageInfo: Co.optional(),
|
|
1458
|
+
expansion: xo.optional()
|
|
1459
|
+
}).passthrough(), To = e.union([
|
|
1460
|
+
co,
|
|
1461
|
+
po,
|
|
1462
|
+
mo,
|
|
1463
|
+
go,
|
|
1464
|
+
Fo
|
|
1465
|
+
]), Do = e.object({
|
|
1466
|
+
status: e.enum([
|
|
1467
|
+
"not_required",
|
|
1468
|
+
"resolved",
|
|
1469
|
+
"missing",
|
|
1470
|
+
"ambiguous",
|
|
1471
|
+
"fanout_risk",
|
|
1472
|
+
"unknown"
|
|
1473
|
+
]),
|
|
1474
|
+
requiredSources: e.array(S).optional(),
|
|
1475
|
+
relationshipsUsed: e.array(e.string()).optional(),
|
|
1476
|
+
missingSources: e.array(e.string()).optional(),
|
|
1477
|
+
warnings: e.array(e.string()).optional(),
|
|
1478
|
+
message: e.string().optional(),
|
|
1479
|
+
recommendedNextStep: e.string().optional(),
|
|
1480
|
+
joinPlanSummary: e.object({
|
|
1481
|
+
baseSource: S.optional(),
|
|
1482
|
+
joinedSources: e.array(S).optional(),
|
|
1483
|
+
joinCount: e.number().optional()
|
|
1484
|
+
}).passthrough().optional(),
|
|
1485
|
+
fanoutRisk: e.object({
|
|
1486
|
+
status: e.enum(["none", "warning", "error", "unknown"]),
|
|
1487
|
+
message: e.string().optional()
|
|
1488
|
+
}).passthrough().optional()
|
|
1489
|
+
}).passthrough(), Q = e.enum([
|
|
1490
|
+
"ambiguous_fields",
|
|
1491
|
+
"empty_result",
|
|
1492
|
+
"missing_grounded_fields",
|
|
1493
|
+
"missing_relationship",
|
|
1494
|
+
"no_grounded_query",
|
|
1495
|
+
"partial_result",
|
|
1496
|
+
"presentation_incomplete",
|
|
1497
|
+
"query_validation_failed",
|
|
1498
|
+
"unsafe_join"
|
|
1499
|
+
]), le = e.object({
|
|
1500
|
+
version: e.literal(1),
|
|
1501
|
+
status: e.enum(["answered", "partial", "blocked"]),
|
|
1502
|
+
summary: e.string(),
|
|
1503
|
+
answered: e.array(
|
|
1504
|
+
e.object({
|
|
1505
|
+
slotId: e.string().optional(),
|
|
1506
|
+
queryId: e.string().optional(),
|
|
1507
|
+
summary: e.string(),
|
|
1508
|
+
evidenceIds: e.array(e.string()).optional(),
|
|
1509
|
+
fieldsUsed: e.array(P).optional()
|
|
1510
|
+
}).passthrough()
|
|
1511
|
+
),
|
|
1512
|
+
blocked: e.array(
|
|
1513
|
+
e.object({
|
|
1514
|
+
slotId: e.string().optional(),
|
|
1515
|
+
queryId: e.string().optional(),
|
|
1516
|
+
reasonCode: Q,
|
|
1517
|
+
message: e.string(),
|
|
1518
|
+
missingFields: e.array(e.string()).optional(),
|
|
1519
|
+
availableFields: e.array(e.string()).optional(),
|
|
1520
|
+
ambiguousFields: e.array(e.string()).optional(),
|
|
1521
|
+
missingRelationships: e.array(e.string()).optional(),
|
|
1522
|
+
evidenceIds: e.array(e.string()).optional(),
|
|
1523
|
+
neededFromUser: e.array(e.string()).optional(),
|
|
1524
|
+
recommendedNextStep: e.string().optional()
|
|
1525
|
+
}).passthrough()
|
|
1526
|
+
),
|
|
1527
|
+
semanticModelRecommendations: e.array(
|
|
1528
|
+
e.object({
|
|
1529
|
+
reasonCode: Q,
|
|
1530
|
+
message: e.string(),
|
|
1531
|
+
recommendedNextStep: e.string().optional()
|
|
1532
|
+
}).passthrough()
|
|
1533
|
+
).optional()
|
|
1534
|
+
}).passthrough(), ue = e.object({
|
|
1535
|
+
scope: e.literal("filtered_query"),
|
|
1536
|
+
measures: e.record(j)
|
|
1537
|
+
}).passthrough(), ce = e.object({
|
|
1538
|
+
answeredObligations: e.array(e.string()),
|
|
1539
|
+
missingObligations: e.array(e.string()),
|
|
1540
|
+
warnings: e.array(K).optional()
|
|
1541
|
+
}).passthrough(), No = e.object({
|
|
1542
|
+
intentId: e.string().optional(),
|
|
1543
|
+
queryId: e.string().optional(),
|
|
1544
|
+
status: e.enum(["answered", "partial", "failed"]),
|
|
1545
|
+
resultShape: e.enum([
|
|
1546
|
+
"metric",
|
|
1547
|
+
"records",
|
|
1548
|
+
"inputOptions",
|
|
1549
|
+
"sql",
|
|
1550
|
+
"matrix",
|
|
1551
|
+
"period_change",
|
|
1552
|
+
"analysis"
|
|
1553
|
+
]).optional(),
|
|
1554
|
+
intent: e.unknown().optional(),
|
|
1555
|
+
compiledQuery: e.unknown().optional(),
|
|
1556
|
+
fieldsUsed: e.array(P).optional(),
|
|
1557
|
+
result: To.optional(),
|
|
1558
|
+
validation: ae,
|
|
1559
|
+
coverage: ce.optional(),
|
|
1560
|
+
missingFields: e.array(e.string()).optional(),
|
|
1561
|
+
warnings: e.array(e.string()).optional(),
|
|
1562
|
+
relationshipDiagnostics: Do.optional(),
|
|
1563
|
+
diagnosticFeedback: le.optional(),
|
|
1564
|
+
population: ue.optional(),
|
|
1565
|
+
metadata: e.record(e.string(), e.unknown()).optional()
|
|
1566
|
+
}).passthrough();
|
|
1567
|
+
function Oo(i) {
|
|
1568
|
+
switch (i) {
|
|
1569
|
+
case "boolean":
|
|
1570
|
+
return e.boolean().optional();
|
|
1571
|
+
case "compactExecutionFieldArray":
|
|
1572
|
+
return e.array(lo).optional();
|
|
1573
|
+
case "coverage":
|
|
1574
|
+
return ce.optional();
|
|
1575
|
+
case "diagnosticFeedback":
|
|
1576
|
+
return le.optional();
|
|
1577
|
+
case "executionFieldArray":
|
|
1578
|
+
return e.array(P).optional();
|
|
1579
|
+
case "executionResult":
|
|
1580
|
+
return No.optional();
|
|
1581
|
+
case "number":
|
|
1582
|
+
return e.number().finite().optional();
|
|
1583
|
+
case "population":
|
|
1584
|
+
return ue.optional();
|
|
1585
|
+
case "record":
|
|
1586
|
+
return m.optional();
|
|
1587
|
+
case "recordArray":
|
|
1588
|
+
return R.optional();
|
|
1589
|
+
case "responseDetail":
|
|
1590
|
+
return e.enum(["compact", "standard", "debug"]).optional();
|
|
1591
|
+
case "string":
|
|
1592
|
+
return e.string().optional();
|
|
1593
|
+
case "stringArray":
|
|
1594
|
+
return e.array(e.string()).optional();
|
|
1595
|
+
case "unknown":
|
|
1596
|
+
return e.unknown().optional();
|
|
1597
|
+
case "unknownArray":
|
|
1598
|
+
return e.array(e.unknown()).optional();
|
|
1599
|
+
case "validationResult":
|
|
1600
|
+
return ae.optional();
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
const Ko = Object.fromEntries(
|
|
1604
|
+
Object.entries(M).map(
|
|
1605
|
+
([i, t]) => [i, Oo(t)]
|
|
1606
|
+
)
|
|
1607
|
+
), Mo = e.object(Ko).strict(), V = e.object({
|
|
1608
|
+
sourceKey: e.string().optional(),
|
|
1609
|
+
kind: e.enum(["semantic", "physical", "sql"]).optional(),
|
|
1610
|
+
domainId: e.string().optional(),
|
|
1611
|
+
datasetName: e.string().optional(),
|
|
1612
|
+
datasetId: e.string().optional(),
|
|
1613
|
+
connectionId: e.string().optional(),
|
|
1614
|
+
tableName: e.string().optional(),
|
|
1615
|
+
label: e.string().optional()
|
|
1616
|
+
}).passthrough(), f = e.object({
|
|
1617
|
+
name: e.string(),
|
|
1618
|
+
label: e.string().optional(),
|
|
1619
|
+
role: e.enum(["dimension", "measure", "date", "id", "unknown"]).optional(),
|
|
1620
|
+
dataType: e.enum(["string", "number", "boolean", "date", "datetime", "unknown"]).optional(),
|
|
1621
|
+
aggregate: c.optional(),
|
|
1622
|
+
sourceKey: e.string().optional(),
|
|
1623
|
+
source: V.optional()
|
|
1624
|
+
}).passthrough(), de = e.object({
|
|
1625
|
+
id: e.string().optional(),
|
|
1626
|
+
builder: e.literal("semaphor.inputOptions"),
|
|
1627
|
+
source: V.optional(),
|
|
1628
|
+
sourceKey: e.string().optional(),
|
|
1629
|
+
valueFieldRef: f,
|
|
1630
|
+
labelFieldRef: f,
|
|
1631
|
+
filterFieldRef: f.optional(),
|
|
1632
|
+
population: e.unknown().optional(),
|
|
1633
|
+
dependencies: e.unknown().optional(),
|
|
1634
|
+
limit: e.number().int().positive().optional(),
|
|
1635
|
+
spec: m.optional()
|
|
1636
|
+
}).passthrough(), pe = e.object({
|
|
1637
|
+
appliesToViewIds: e.array(e.string()).optional(),
|
|
1638
|
+
viewId: e.string().optional(),
|
|
1639
|
+
fieldRef: f,
|
|
1640
|
+
relationshipHint: e.unknown().optional(),
|
|
1641
|
+
relationshipsUsed: e.array(m).optional()
|
|
1642
|
+
}).passthrough(), Bo = e.object({
|
|
1643
|
+
id: e.string(),
|
|
1644
|
+
label: e.string().optional(),
|
|
1645
|
+
type: e.string().optional(),
|
|
1646
|
+
serverSide: e.boolean().optional(),
|
|
1647
|
+
fieldRef: f.optional(),
|
|
1648
|
+
optionQuery: de.optional(),
|
|
1649
|
+
bindings: e.array(pe).optional(),
|
|
1650
|
+
appliesToViewIds: e.array(e.string()),
|
|
1651
|
+
relationshipHint: e.unknown().optional(),
|
|
1652
|
+
relationshipsUsed: e.array(m).optional()
|
|
1653
|
+
}).passthrough(), Po = e.object({
|
|
1654
|
+
builder: e.enum([
|
|
1655
|
+
"semaphor.metric",
|
|
1656
|
+
"semaphor.records",
|
|
1657
|
+
"semaphor.matrix",
|
|
1658
|
+
"semaphor.analysis",
|
|
1659
|
+
"semaphor.sql"
|
|
1660
|
+
]),
|
|
1661
|
+
spec: m,
|
|
1662
|
+
fallbackReason: m.optional()
|
|
1663
|
+
}).passthrough(), Vo = e.object({
|
|
1664
|
+
id: e.string(),
|
|
1665
|
+
title: e.string().optional(),
|
|
1666
|
+
purpose: e.string().optional(),
|
|
1667
|
+
sourcePresentation: e.object({
|
|
1668
|
+
sourceKeys: e.array(e.string()).optional(),
|
|
1669
|
+
sourceLabels: e.array(e.string()).optional()
|
|
1670
|
+
}).passthrough().optional(),
|
|
1671
|
+
visual: e.string().optional(),
|
|
1672
|
+
visualSpec: m.optional(),
|
|
1673
|
+
queryKind: e.enum(["metric", "records", "matrix", "analysis", "sql_fallback"]).optional(),
|
|
1674
|
+
sdkBuilder: e.enum([
|
|
1675
|
+
"semaphor.metric",
|
|
1676
|
+
"semaphor.records",
|
|
1677
|
+
"semaphor.matrix",
|
|
1678
|
+
"semaphor.analysis",
|
|
1679
|
+
"semaphor.sql"
|
|
1680
|
+
]).optional(),
|
|
1681
|
+
sdkSpec: Po.optional(),
|
|
1682
|
+
fields: e.array(f).optional(),
|
|
1683
|
+
computation: m.optional(),
|
|
1684
|
+
uxExpectations: e.array(e.string()).optional(),
|
|
1685
|
+
validation: m.optional()
|
|
1686
|
+
}).passthrough(), Lo = e.object({
|
|
1687
|
+
inputId: e.string(),
|
|
1688
|
+
label: e.string().optional(),
|
|
1689
|
+
type: e.string().optional(),
|
|
1690
|
+
serverSide: e.boolean().optional(),
|
|
1691
|
+
fieldRef: f.optional(),
|
|
1692
|
+
optionQuery: de.optional(),
|
|
1693
|
+
bindings: e.array(pe),
|
|
1694
|
+
appliesToViewIds: e.array(e.string()),
|
|
1695
|
+
notAppliedToViewIds: e.array(e.string())
|
|
1696
|
+
}).passthrough(), Yo = e.object({
|
|
1697
|
+
schemaVersion: e.literal(N),
|
|
1698
|
+
title: e.string(),
|
|
1699
|
+
purpose: e.string().optional(),
|
|
1700
|
+
userGoal: e.string().optional(),
|
|
1701
|
+
nextStep: e.string().optional(),
|
|
1702
|
+
sources: e.array(V),
|
|
1703
|
+
inputs: e.array(Bo),
|
|
1704
|
+
views: e.array(Vo),
|
|
1705
|
+
filterContracts: e.array(Lo),
|
|
1706
|
+
implementationChecklist: e.object({
|
|
1707
|
+
schemaVersion: e.string().optional(),
|
|
1708
|
+
requiredDevtools: e.object({
|
|
1709
|
+
mountRootDevtools: e.boolean(),
|
|
1710
|
+
providerDebugBridge: e.string().optional(),
|
|
1711
|
+
panelPosition: e.string().optional(),
|
|
1712
|
+
forbidden: e.array(e.string()).optional()
|
|
1713
|
+
}).passthrough(),
|
|
1714
|
+
requiredInputOptions: e.array(m),
|
|
1715
|
+
filterScopeByInput: e.array(m),
|
|
1716
|
+
bindingsByView: e.record(e.string(), e.array(m)),
|
|
1717
|
+
validationCommands: e.array(e.string()),
|
|
1718
|
+
browserSmokeChecks: e.array(e.string())
|
|
1719
|
+
}).passthrough(),
|
|
1720
|
+
nextRequiredTool: e.object({
|
|
1721
|
+
name: e.string(),
|
|
1722
|
+
reason: e.string().optional()
|
|
1723
|
+
}).optional(),
|
|
1724
|
+
unsupportedInsights: e.array(
|
|
1725
|
+
e.object({
|
|
1726
|
+
title: e.string(),
|
|
1727
|
+
requestedQuestion: e.string(),
|
|
1728
|
+
reason: e.string(),
|
|
1729
|
+
suggestedModelingFix: e.string()
|
|
1730
|
+
}).passthrough()
|
|
1731
|
+
).optional(),
|
|
1732
|
+
assumptions: e.array(e.string()).optional(),
|
|
1733
|
+
validation: m.optional()
|
|
1734
|
+
}).passthrough().superRefine((i, t) => {
|
|
1735
|
+
const o = W(i);
|
|
1736
|
+
for (const s of o.issues)
|
|
1737
|
+
t.addIssue({
|
|
1738
|
+
code: e.ZodIssueCode.custom,
|
|
1739
|
+
message: s
|
|
1740
|
+
});
|
|
1741
|
+
}), Go = new Set(
|
|
1742
|
+
Object.keys(M)
|
|
1743
|
+
);
|
|
1744
|
+
function Wo() {
|
|
1745
|
+
return Object.keys(
|
|
1746
|
+
M
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
function Uo(i) {
|
|
1750
|
+
return Go.has(i);
|
|
1751
|
+
}
|
|
1752
|
+
function Zo(i) {
|
|
1753
|
+
if (!i || typeof i != "object" || Array.isArray(i))
|
|
1754
|
+
throw new Error("Semaphor analyze result must be an object.");
|
|
1755
|
+
const o = Object.keys(i).filter(
|
|
1756
|
+
(s) => !Uo(s)
|
|
1757
|
+
);
|
|
1758
|
+
if (o.length)
|
|
1759
|
+
throw new Error(
|
|
1760
|
+
`Semaphor analyze result contains unsupported top-level field(s): ${o.join(", ")}.`
|
|
1761
|
+
);
|
|
1762
|
+
return Mo.parse(i);
|
|
1763
|
+
}
|
|
1764
|
+
export {
|
|
1765
|
+
ce as A,
|
|
1766
|
+
No as B,
|
|
1767
|
+
Ko as C,
|
|
1768
|
+
Mo as D,
|
|
1769
|
+
Yo as E,
|
|
1770
|
+
M as S,
|
|
1771
|
+
N as a,
|
|
1772
|
+
Ho as b,
|
|
1773
|
+
Qo as c,
|
|
1774
|
+
oo as d,
|
|
1775
|
+
to as e,
|
|
1776
|
+
S as f,
|
|
1777
|
+
Wo as g,
|
|
1778
|
+
y as h,
|
|
1779
|
+
Uo as i,
|
|
1780
|
+
re as j,
|
|
1781
|
+
P as k,
|
|
1782
|
+
O as l,
|
|
1783
|
+
K as m,
|
|
1784
|
+
ae as n,
|
|
1785
|
+
co as o,
|
|
1786
|
+
Zo as p,
|
|
1787
|
+
po as q,
|
|
1788
|
+
mo as r,
|
|
1789
|
+
ie as s,
|
|
1790
|
+
go as t,
|
|
1791
|
+
Fo as u,
|
|
1792
|
+
W as v,
|
|
1793
|
+
To as w,
|
|
1794
|
+
Do as x,
|
|
1795
|
+
le as y,
|
|
1796
|
+
ue as z
|
|
1797
|
+
};
|