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