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