react-semaphor 0.1.527 → 0.1.528
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.js +206 -195
- package/dist/brand-studio/index.js +2 -2
- package/dist/briefings/index.js +3 -3
- package/dist/chunks/{calculated-field-identity-DEhjPSr-.js → calculated-field-identity-DUu-tCQw.js} +2 -2
- package/dist/chunks/{card-config-utils-BlIbwkuD.js → card-config-utils-BdPceiw8.js} +3 -3
- package/dist/chunks/{dashboard-JNHR0_cZ.js → dashboard-BkskKMck.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-D9pFByPh.js → dashboard-briefing-launcher-Bb0RhGRC.js} +8 -8
- package/dist/chunks/{dashboard-controls-CJI5ZWMq.js → dashboard-controls-loWTHPMi.js} +10 -10
- package/dist/chunks/{dashboard-json-DLdrFry-.js → dashboard-json-DUci_SOR.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-D5LjWle1.js → edit-dashboard-visual-z9WN26w7.js} +14 -14
- package/dist/chunks/{editor-action-buttons-G91NQKxU.js → editor-action-buttons-CGSFK9S-.js} +5 -5
- package/dist/chunks/{field-aggregations-DeVQLIsP.js → field-aggregations-CdXSo1pb.js} +2 -2
- package/dist/chunks/{index-BvJOYbNv.js → index-CTYnXU85.js} +348 -357
- package/dist/chunks/{matrix-card-DY45yiUM.js → matrix-card-DhykwdZs.js} +1 -1
- package/dist/chunks/{matrix-control-sources-BypfLZsK.js → matrix-control-sources-BV9ywFtJ.js} +4 -4
- package/dist/chunks/{matrix-formatter-BoKU3MzZ.js → matrix-formatter-1Mm8x8w7.js} +2 -2
- package/dist/chunks/matrix-operation-contract-Dp7kFpVk.js +1383 -0
- package/dist/chunks/{pivot-header-presentation-D5v8uyjj.js → pivot-header-presentation-CZa3556D.js} +3 -3
- package/dist/chunks/{pivot-result-lifecycle-BWrPhlGT.js → pivot-result-lifecycle-Bqdtknud.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-D3hxu4sE.js → report-preferences-dialog-VV0-Ro6F.js} +6 -6
- package/dist/chunks/{selection-reducer-C7Um5XN-.js → selection-reducer-IZjBSU6Z.js} +1 -1
- package/dist/chunks/{semantic-format-BjBMOSoo.js → semantic-format-BBLvfwua.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-D46I_4g7.js → semaphor-ready-indicator-DbA4mVQL.js} +9356 -9408
- package/dist/chunks/{slider-B6LELqx6.js → slider-DpiJG8lv.js} +7 -7
- package/dist/chunks/{switch-_7uBAbYx.js → switch-C4YH-W1X.js} +6 -6
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +8 -8
- package/dist/data-app-sdk/index.js +3 -3
- package/dist/data-app-sdk-adapters/index.js +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/format-utils/index.js +5 -5
- package/dist/index.js +13 -13
- package/dist/surfboard/index.js +1 -1
- package/dist/types/lib/types/semantic-types.d.ts +4 -2
- package/dist/types/lib/utils/aggregate-expression-utils.d.ts +0 -4
- package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +89 -0
- package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +32 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +38 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +10 -1
- package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +63 -0
- package/package.json +1 -1
- package/dist/chunks/matrix-operation-contract-BV02rLhu.js +0 -809
|
@@ -1,809 +0,0 @@
|
|
|
1
|
-
import { z as e } from "zod";
|
|
2
|
-
import { a5 as p, $ as T, aa as k, bl as E, B as m, a6 as te, bf as x, bm as se, aX as re, a0 as ne, b0 as oe, b1 as ie, b4 as ce, b5 as le, aQ as S, aV as A, aK as ue, a_ as me, a$ as M, aH as de, aG as pe, aW as he, aN as ge, aO as ye, w as z, aS as fe, s as be, q as B, E as Se, A as Ie, m as we } from "./validators-CQcG0EPN.js";
|
|
3
|
-
const j = {
|
|
4
|
-
answerSummary: "string",
|
|
5
|
-
responseDetail: "responseDetail",
|
|
6
|
-
mode: "string",
|
|
7
|
-
comparisonKind: "string",
|
|
8
|
-
executionResult: "executionResult",
|
|
9
|
-
compiledQuery: "unknown",
|
|
10
|
-
data: "unknown",
|
|
11
|
-
resultSets: "record",
|
|
12
|
-
analysisWarnings: "unknownArray",
|
|
13
|
-
columns: "unknownArray",
|
|
14
|
-
records: "recordArray",
|
|
15
|
-
rowCount: "number",
|
|
16
|
-
rowLimitExceeded: "boolean",
|
|
17
|
-
output: "string",
|
|
18
|
-
querySpec: "unknown",
|
|
19
|
-
metadata: "record",
|
|
20
|
-
validation: "validationResult",
|
|
21
|
-
coverage: "coverage",
|
|
22
|
-
diagnosticFeedback: "diagnosticFeedback",
|
|
23
|
-
missingFields: "stringArray",
|
|
24
|
-
warnings: "unknownArray",
|
|
25
|
-
comparison: "unknown",
|
|
26
|
-
population: "population",
|
|
27
|
-
comparisons: "recordArray",
|
|
28
|
-
fieldsUsed: "compactExecutionFieldArray",
|
|
29
|
-
primary: "recordArray",
|
|
30
|
-
contributors: "recordArray",
|
|
31
|
-
segments: "recordArray",
|
|
32
|
-
periodChanges: "recordArray",
|
|
33
|
-
changes: "recordArray",
|
|
34
|
-
largestNegativeChanges: "recordArray",
|
|
35
|
-
largestPositiveChanges: "recordArray",
|
|
36
|
-
drivers: "recordArray",
|
|
37
|
-
absoluteDeltaDrivers: "recordArray",
|
|
38
|
-
largestNegativeDrivers: "recordArray",
|
|
39
|
-
largestPositiveDrivers: "recordArray",
|
|
40
|
-
periodRows: "recordArray",
|
|
41
|
-
sql: "unknown",
|
|
42
|
-
omitted: "stringArray"
|
|
43
|
-
}, ia = Object.freeze({
|
|
44
|
-
coordinates: 2e4,
|
|
45
|
-
responseBytes: 5 * 1024 * 1024
|
|
46
|
-
}), y = e.string().uuid(), u = e.string().min(1), ke = e.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
47
|
-
function l(a, t, s) {
|
|
48
|
-
a.addIssue({ code: "custom", path: t, message: s });
|
|
49
|
-
}
|
|
50
|
-
function h(a, t, s) {
|
|
51
|
-
new Set(a).size !== a.length && l(t, s, "Duplicate identity.");
|
|
52
|
-
}
|
|
53
|
-
const ve = e.object({
|
|
54
|
-
id: u,
|
|
55
|
-
axis: T,
|
|
56
|
-
parent: p,
|
|
57
|
-
position: e.union([
|
|
58
|
-
e.object({ kind: e.literal("first") }).strict(),
|
|
59
|
-
e.object({ kind: e.enum(["after", "before"]), cursor: u }).strict()
|
|
60
|
-
]),
|
|
61
|
-
size: ke
|
|
62
|
-
}).strict(), P = e.object({
|
|
63
|
-
paths: e.array(p).readonly(),
|
|
64
|
-
pageIds: e.array(u).readonly()
|
|
65
|
-
}).strict(), xe = e.object({
|
|
66
|
-
id: u,
|
|
67
|
-
rows: P,
|
|
68
|
-
columns: P,
|
|
69
|
-
measureIds: e.array(y).min(1).readonly()
|
|
70
|
-
}).strict(), D = e.object({
|
|
71
|
-
pages: e.array(ve).readonly(),
|
|
72
|
-
blocks: e.array(xe).readonly()
|
|
73
|
-
}).strict().superRefine((a, t) => {
|
|
74
|
-
!a.pages.length && !a.blocks.length && l(t, [], "Request at least one page or block."), h(
|
|
75
|
-
[...a.pages, ...a.blocks].map((s) => s.id),
|
|
76
|
-
t,
|
|
77
|
-
[]
|
|
78
|
-
);
|
|
79
|
-
for (const s of a.blocks) {
|
|
80
|
-
h(s.measureIds, t, ["blocks", s.id, "measureIds"]);
|
|
81
|
-
for (const r of ["rows", "columns"])
|
|
82
|
-
for (const n of s[r].pageIds)
|
|
83
|
-
a.pages.some(
|
|
84
|
-
(i) => i.id === n && i.axis === r
|
|
85
|
-
) || l(
|
|
86
|
-
t,
|
|
87
|
-
["blocks", s.id, r],
|
|
88
|
-
"Page reference must name a page on this axis in this operation."
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}), ca = e.object({ spec: k, request: D }).strict().superRefine(({ spec: a, request: t }, s) => {
|
|
92
|
-
for (const r of t.pages)
|
|
93
|
-
E(
|
|
94
|
-
a,
|
|
95
|
-
r.axis,
|
|
96
|
-
r.parent,
|
|
97
|
-
s,
|
|
98
|
-
["pages", r.id],
|
|
99
|
-
!0
|
|
100
|
-
), r.parent.length >= a[r.axis].length && l(
|
|
101
|
-
s,
|
|
102
|
-
["pages", r.id],
|
|
103
|
-
"Cannot request children of a leaf or empty axis."
|
|
104
|
-
);
|
|
105
|
-
for (const r of t.blocks) {
|
|
106
|
-
r.measureIds.some((n) => !a.measures.some((i) => i.id === n)) && l(s, ["blocks", r.id], "Unknown block measure.");
|
|
107
|
-
for (const n of ["rows", "columns"])
|
|
108
|
-
for (const i of r[n].paths)
|
|
109
|
-
E(a, n, i, s, ["blocks", r.id, n]);
|
|
110
|
-
}
|
|
111
|
-
}), Ae = e.object({
|
|
112
|
-
requestId: u,
|
|
113
|
-
axis: T,
|
|
114
|
-
parent: p,
|
|
115
|
-
members: e.array(e.object({ path: p }).strict()).readonly(),
|
|
116
|
-
before: u.nullable(),
|
|
117
|
-
after: u.nullable(),
|
|
118
|
-
exactCount: e.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()
|
|
119
|
-
}).strict().superRefine((a, t) => {
|
|
120
|
-
a.parent.some((r) => r.member.kind === "others") && l(t, ["parent"], "Others has no children.");
|
|
121
|
-
const s = a.members.filter(
|
|
122
|
-
({ path: r }) => {
|
|
123
|
-
var n;
|
|
124
|
-
return ((n = r[r.length - 1]) == null ? void 0 : n.member.kind) === "others";
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
s.length > 1 && l(t, ["members"], "A page may contain Others only once."), s.length && (a.members[a.members.length - 1] !== s[0] && l(t, ["members"], "Others must be the last page member."), a.after !== null && l(t, ["after"], "Others must end the branch.")), new Set(
|
|
128
|
-
a.members.map(
|
|
129
|
-
(r) => {
|
|
130
|
-
var n;
|
|
131
|
-
return (n = r.path[r.path.length - 1]) == null ? void 0 : n.levelId;
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
).size > 1 && l(t, ["members"], "One page must contain one child level."), h(
|
|
135
|
-
a.members.map((r) => m(r.path)),
|
|
136
|
-
t,
|
|
137
|
-
["members"]
|
|
138
|
-
);
|
|
139
|
-
for (const r of a.members)
|
|
140
|
-
(r.path.length !== a.parent.length + 1 || m(r.path.slice(0, -1)) !== m(a.parent)) && l(t, ["members"], "Page members must be immediate children.");
|
|
141
|
-
}), L = e.object({
|
|
142
|
-
rowPaths: e.array(p).readonly(),
|
|
143
|
-
columnPaths: e.array(p).readonly(),
|
|
144
|
-
measureIds: e.array(y).readonly()
|
|
145
|
-
}).strict();
|
|
146
|
-
function W(a, t) {
|
|
147
|
-
const s = a.rowPaths.map(m), r = a.columnPaths.map(m);
|
|
148
|
-
return h(s, t, ["coverage", "rowPaths"]), h(r, t, ["coverage", "columnPaths"]), h(a.measureIds, t, ["coverage", "measureIds"]), { rows: s, columns: r };
|
|
149
|
-
}
|
|
150
|
-
const je = e.object({
|
|
151
|
-
requestId: u,
|
|
152
|
-
coverage: L,
|
|
153
|
-
cells: e.array(
|
|
154
|
-
te.extend({ value: x }).strict()
|
|
155
|
-
).readonly()
|
|
156
|
-
}).strict().superRefine((a, t) => {
|
|
157
|
-
const { rows: s, columns: r } = W(a.coverage, t), n = new Set(s), i = new Set(r), o = new Set(a.coverage.measureIds);
|
|
158
|
-
h(
|
|
159
|
-
a.cells.map(
|
|
160
|
-
(c) => JSON.stringify([
|
|
161
|
-
m(c.rowPath),
|
|
162
|
-
m(c.columnPath),
|
|
163
|
-
c.measureId
|
|
164
|
-
])
|
|
165
|
-
),
|
|
166
|
-
t,
|
|
167
|
-
["cells"]
|
|
168
|
-
);
|
|
169
|
-
for (const c of a.cells)
|
|
170
|
-
(!n.has(m(c.rowPath)) || !i.has(m(c.columnPath)) || !o.has(c.measureId)) && l(t, ["cells"], "Cell is outside certified coverage.");
|
|
171
|
-
}), I = e.number().int().nonnegative(), Re = e.object({
|
|
172
|
-
requestId: u,
|
|
173
|
-
coverage: L,
|
|
174
|
-
values: e.array(
|
|
175
|
-
e.tuple([I, I, I, x]).readonly()
|
|
176
|
-
).readonly()
|
|
177
|
-
}).strict().superRefine((a, t) => {
|
|
178
|
-
W(a.coverage, t);
|
|
179
|
-
const { rowPaths: s, columnPaths: r, measureIds: n } = a.coverage, i = /* @__PURE__ */ new Set();
|
|
180
|
-
for (const [o, c, d] of a.values) {
|
|
181
|
-
if (o >= s.length || c >= r.length || d >= n.length) {
|
|
182
|
-
l(t, ["values"], "Cell is outside certified coverage.");
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
const g = `${o},${c},${d}`;
|
|
186
|
-
i.has(g) && l(t, ["values"], "Duplicate identity."), i.add(g);
|
|
187
|
-
}
|
|
188
|
-
}), _ = e.object({
|
|
189
|
-
id: y,
|
|
190
|
-
column: re,
|
|
191
|
-
nativeDataType: u,
|
|
192
|
-
semanticFormat: se.optional()
|
|
193
|
-
}).strict(), K = e.object({
|
|
194
|
-
levels: e.array(_).readonly(),
|
|
195
|
-
measures: e.array(_).readonly()
|
|
196
|
-
}).strict(), R = e.object({
|
|
197
|
-
code: e.enum([
|
|
198
|
-
"invalid_request",
|
|
199
|
-
"unsupported_capability",
|
|
200
|
-
"stale_cursor",
|
|
201
|
-
"forbidden",
|
|
202
|
-
"budget_exceeded",
|
|
203
|
-
"source_truncated",
|
|
204
|
-
"execution_failed",
|
|
205
|
-
"cancelled"
|
|
206
|
-
]),
|
|
207
|
-
message: u,
|
|
208
|
-
/** Technical cause for dashboard owners; never shown as the primary copy. */
|
|
209
|
-
detail: u.optional(),
|
|
210
|
-
retryable: e.boolean(),
|
|
211
|
-
scope: e.union([
|
|
212
|
-
e.object({ kind: e.literal("operation") }).strict(),
|
|
213
|
-
e.object({ kind: e.enum(["page", "block"]), requestId: u }).strict()
|
|
214
|
-
])
|
|
215
|
-
}).strict(), Ce = e.object({
|
|
216
|
-
dialect: e.enum(["postgres", "clickhouse", "duckdb"]),
|
|
217
|
-
aggregates: e.array(ne).readonly()
|
|
218
|
-
}).strict();
|
|
219
|
-
function U(a) {
|
|
220
|
-
return e.object({
|
|
221
|
-
queryIdentity: u,
|
|
222
|
-
descriptors: K,
|
|
223
|
-
capabilities: Ce,
|
|
224
|
-
pages: e.array(Ae).readonly(),
|
|
225
|
-
blocks: e.array(a).readonly(),
|
|
226
|
-
failures: e.array(R).readonly()
|
|
227
|
-
}).strict().superRefine((t, s) => {
|
|
228
|
-
const r = new Set(
|
|
229
|
-
t.descriptors.levels.map((o) => o.id)
|
|
230
|
-
), n = new Set(
|
|
231
|
-
t.descriptors.measures.map((o) => o.id)
|
|
232
|
-
), i = t.pages.flatMap((o) => [
|
|
233
|
-
o.parent,
|
|
234
|
-
...o.members.map((c) => c.path)
|
|
235
|
-
]);
|
|
236
|
-
for (const o of t.blocks)
|
|
237
|
-
i.push(...o.coverage.rowPaths, ...o.coverage.columnPaths), o.coverage.measureIds.some((c) => !n.has(c)) && l(
|
|
238
|
-
s,
|
|
239
|
-
["blocks", o.requestId],
|
|
240
|
-
"Coverage references an unknown measure descriptor."
|
|
241
|
-
);
|
|
242
|
-
i.some((o) => o.some((c) => !r.has(c.levelId))) && l(
|
|
243
|
-
s,
|
|
244
|
-
["descriptors"],
|
|
245
|
-
"Acquired paths require level descriptors."
|
|
246
|
-
), h(
|
|
247
|
-
[...t.descriptors.levels, ...t.descriptors.measures].map(
|
|
248
|
-
(o) => o.id
|
|
249
|
-
),
|
|
250
|
-
s,
|
|
251
|
-
["descriptors"]
|
|
252
|
-
), h(
|
|
253
|
-
[...t.pages, ...t.blocks].map((o) => o.requestId),
|
|
254
|
-
s,
|
|
255
|
-
[]
|
|
256
|
-
), h(
|
|
257
|
-
t.failures.map(
|
|
258
|
-
(o) => o.scope.kind === "operation" ? "operation" : o.scope.requestId
|
|
259
|
-
),
|
|
260
|
-
s,
|
|
261
|
-
["failures"]
|
|
262
|
-
);
|
|
263
|
-
for (const o of t.failures)
|
|
264
|
-
if (o.scope.kind === "operation")
|
|
265
|
-
l(
|
|
266
|
-
s,
|
|
267
|
-
["failures"],
|
|
268
|
-
"Operation failure cannot accompany acquired data."
|
|
269
|
-
);
|
|
270
|
-
else {
|
|
271
|
-
const c = o.scope.requestId;
|
|
272
|
-
[...t.pages, ...t.blocks].some(
|
|
273
|
-
(d) => d.requestId === c
|
|
274
|
-
) && l(
|
|
275
|
-
s,
|
|
276
|
-
["failures"],
|
|
277
|
-
"A requested unit cannot both succeed and fail."
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
const $ = U(
|
|
283
|
-
je
|
|
284
|
-
), Ee = U(
|
|
285
|
-
Re
|
|
286
|
-
);
|
|
287
|
-
function V(a) {
|
|
288
|
-
return e.union([
|
|
289
|
-
e.object({
|
|
290
|
-
status: e.enum(["success", "partial"]),
|
|
291
|
-
window: a
|
|
292
|
-
}).strict(),
|
|
293
|
-
e.object({ status: e.literal("failed"), failure: R }).strict()
|
|
294
|
-
]).superRefine((t, s) => {
|
|
295
|
-
const r = t;
|
|
296
|
-
if (r.status === "failed") return;
|
|
297
|
-
const { window: n } = r;
|
|
298
|
-
!n.pages.length && !n.blocks.length && l(
|
|
299
|
-
s,
|
|
300
|
-
["window"],
|
|
301
|
-
"A window outcome requires successful acquired work."
|
|
302
|
-
), r.status === "success" != (n.failures.length === 0) && l(s, ["status"], "Status must match failure coverage.");
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
const la = V(
|
|
306
|
-
$
|
|
307
|
-
), ua = V(
|
|
308
|
-
Ee
|
|
309
|
-
);
|
|
310
|
-
function Pe(a) {
|
|
311
|
-
const { rowPaths: t, columnPaths: s, measureIds: r } = a.coverage, n = (d) => new Map(d.map((g, f) => [g, f])), i = n(t.map(m)), o = n(s.map(m)), c = n(r);
|
|
312
|
-
return {
|
|
313
|
-
requestId: a.requestId,
|
|
314
|
-
coverage: a.coverage,
|
|
315
|
-
values: a.cells.map((d) => {
|
|
316
|
-
const g = i.get(m(d.rowPath)), f = o.get(m(d.columnPath)), C = c.get(d.measureId);
|
|
317
|
-
if (g === void 0 || f === void 0 || C === void 0)
|
|
318
|
-
throw new Error("Cell is outside certified coverage.");
|
|
319
|
-
return [g, f, C, d.value];
|
|
320
|
-
})
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
function _e(a) {
|
|
324
|
-
const { rowPaths: t, columnPaths: s, measureIds: r } = a.coverage;
|
|
325
|
-
return {
|
|
326
|
-
requestId: a.requestId,
|
|
327
|
-
coverage: a.coverage,
|
|
328
|
-
cells: a.values.map(([n, i, o, c]) => ({
|
|
329
|
-
rowPath: t[n],
|
|
330
|
-
columnPath: s[i],
|
|
331
|
-
measureId: r[o],
|
|
332
|
-
value: c
|
|
333
|
-
}))
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
function qe(a) {
|
|
337
|
-
return { ...a, blocks: a.blocks.map(Pe) };
|
|
338
|
-
}
|
|
339
|
-
function ma(a) {
|
|
340
|
-
return { ...a, blocks: a.blocks.map(_e) };
|
|
341
|
-
}
|
|
342
|
-
function da(a) {
|
|
343
|
-
return a.status === "failed" ? a : { status: a.status, window: qe(a.window) };
|
|
344
|
-
}
|
|
345
|
-
const J = e.object({
|
|
346
|
-
kind: e.literal("matrix"),
|
|
347
|
-
window: $
|
|
348
|
-
}).strict(), Z = e.enum(["member", "subtotal", "grand_total"]), Fe = e.discriminatedUnion("kind", [
|
|
349
|
-
e.object({ kind: e.literal("hierarchy"), label: e.string() }).strict(),
|
|
350
|
-
e.object({ kind: e.literal("level"), levelId: y, label: e.string() }).strict(),
|
|
351
|
-
e.object({
|
|
352
|
-
kind: e.literal("measure"),
|
|
353
|
-
measureId: y,
|
|
354
|
-
columnPath: p,
|
|
355
|
-
role: Z,
|
|
356
|
-
label: e.string()
|
|
357
|
-
}).strict()
|
|
358
|
-
]), Ne = e.object({
|
|
359
|
-
columns: e.array(Fe).readonly(),
|
|
360
|
-
descriptors: K
|
|
361
|
-
}).strict(), q = e.union([
|
|
362
|
-
e.object({
|
|
363
|
-
kind: e.literal("value"),
|
|
364
|
-
value: x.refine(
|
|
365
|
-
(a) => a !== null
|
|
366
|
-
)
|
|
367
|
-
}).strict(),
|
|
368
|
-
e.object({ kind: e.enum(["null", "empty"]) }).strict()
|
|
369
|
-
]), Oe = e.discriminatedUnion("kind", [
|
|
370
|
-
e.object({
|
|
371
|
-
kind: e.literal("layout"),
|
|
372
|
-
rowPath: p,
|
|
373
|
-
role: Z,
|
|
374
|
-
values: e.array(q).readonly()
|
|
375
|
-
}).strict(),
|
|
376
|
-
e.object({
|
|
377
|
-
kind: e.literal("flat"),
|
|
378
|
-
rowPath: p,
|
|
379
|
-
columnPath: p,
|
|
380
|
-
values: e.array(q).readonly()
|
|
381
|
-
}).strict()
|
|
382
|
-
]), pa = e.discriminatedUnion("kind", [
|
|
383
|
-
e.object({
|
|
384
|
-
kind: e.literal("layout"),
|
|
385
|
-
layout: Ne,
|
|
386
|
-
next: u
|
|
387
|
-
}).strict(),
|
|
388
|
-
e.object({
|
|
389
|
-
kind: e.literal("rows"),
|
|
390
|
-
rows: e.array(Oe).readonly(),
|
|
391
|
-
next: u.nullable()
|
|
392
|
-
}).strict()
|
|
393
|
-
]), Te = e.union([
|
|
394
|
-
oe,
|
|
395
|
-
ie,
|
|
396
|
-
ce,
|
|
397
|
-
le,
|
|
398
|
-
J
|
|
399
|
-
]), Me = e.object({
|
|
400
|
-
status: e.enum([
|
|
401
|
-
"not_required",
|
|
402
|
-
"resolved",
|
|
403
|
-
"missing",
|
|
404
|
-
"ambiguous",
|
|
405
|
-
"fanout_risk",
|
|
406
|
-
"unknown"
|
|
407
|
-
]),
|
|
408
|
-
requiredSources: e.array(S).optional(),
|
|
409
|
-
relationshipsUsed: e.array(e.string()).optional(),
|
|
410
|
-
missingSources: e.array(e.string()).optional(),
|
|
411
|
-
warnings: e.array(e.string()).optional(),
|
|
412
|
-
message: e.string().optional(),
|
|
413
|
-
recommendedNextStep: e.string().optional(),
|
|
414
|
-
joinPlanSummary: e.object({
|
|
415
|
-
baseSource: S.optional(),
|
|
416
|
-
joinedSources: e.array(S).optional(),
|
|
417
|
-
joinCount: e.number().optional()
|
|
418
|
-
}).passthrough().optional(),
|
|
419
|
-
fanoutRisk: e.object({
|
|
420
|
-
status: e.enum(["none", "warning", "error", "unknown"]),
|
|
421
|
-
message: e.string().optional()
|
|
422
|
-
}).passthrough().optional()
|
|
423
|
-
}).passthrough(), F = e.enum([
|
|
424
|
-
"ambiguous_fields",
|
|
425
|
-
"empty_result",
|
|
426
|
-
"missing_grounded_fields",
|
|
427
|
-
"missing_relationship",
|
|
428
|
-
"no_grounded_query",
|
|
429
|
-
"partial_result",
|
|
430
|
-
"presentation_incomplete",
|
|
431
|
-
"query_validation_failed",
|
|
432
|
-
"unsafe_join"
|
|
433
|
-
]), X = e.object({
|
|
434
|
-
version: e.literal(1),
|
|
435
|
-
status: e.enum(["answered", "partial", "blocked"]),
|
|
436
|
-
summary: e.string(),
|
|
437
|
-
answered: e.array(
|
|
438
|
-
e.object({
|
|
439
|
-
slotId: e.string().optional(),
|
|
440
|
-
queryId: e.string().optional(),
|
|
441
|
-
summary: e.string(),
|
|
442
|
-
evidenceIds: e.array(e.string()).optional(),
|
|
443
|
-
fieldsUsed: e.array(A).optional()
|
|
444
|
-
}).passthrough()
|
|
445
|
-
),
|
|
446
|
-
blocked: e.array(
|
|
447
|
-
e.object({
|
|
448
|
-
slotId: e.string().optional(),
|
|
449
|
-
queryId: e.string().optional(),
|
|
450
|
-
reasonCode: F,
|
|
451
|
-
message: e.string(),
|
|
452
|
-
missingFields: e.array(e.string()).optional(),
|
|
453
|
-
availableFields: e.array(e.string()).optional(),
|
|
454
|
-
ambiguousFields: e.array(e.string()).optional(),
|
|
455
|
-
missingRelationships: e.array(e.string()).optional(),
|
|
456
|
-
evidenceIds: e.array(e.string()).optional(),
|
|
457
|
-
neededFromUser: e.array(e.string()).optional(),
|
|
458
|
-
recommendedNextStep: e.string().optional()
|
|
459
|
-
}).passthrough()
|
|
460
|
-
),
|
|
461
|
-
semanticModelRecommendations: e.array(
|
|
462
|
-
e.object({
|
|
463
|
-
reasonCode: F,
|
|
464
|
-
message: e.string(),
|
|
465
|
-
recommendedNextStep: e.string().optional()
|
|
466
|
-
}).passthrough()
|
|
467
|
-
).optional()
|
|
468
|
-
}).passthrough(), Q = e.object({
|
|
469
|
-
scope: e.literal("filtered_query"),
|
|
470
|
-
measures: e.record(ue)
|
|
471
|
-
}).passthrough(), G = e.object({
|
|
472
|
-
answeredObligations: e.array(e.string()),
|
|
473
|
-
missingObligations: e.array(e.string()),
|
|
474
|
-
warnings: e.array(me).optional()
|
|
475
|
-
}).passthrough(), H = e.object({
|
|
476
|
-
intentId: e.string().optional(),
|
|
477
|
-
queryId: e.string().optional(),
|
|
478
|
-
status: e.enum(["answered", "partial", "failed"]),
|
|
479
|
-
resultShape: e.enum([
|
|
480
|
-
"metric",
|
|
481
|
-
"records",
|
|
482
|
-
"inputOptions",
|
|
483
|
-
"sql",
|
|
484
|
-
"matrix",
|
|
485
|
-
"period_change",
|
|
486
|
-
"analysis"
|
|
487
|
-
]).optional(),
|
|
488
|
-
intent: e.unknown().optional(),
|
|
489
|
-
compiledQuery: e.unknown().optional(),
|
|
490
|
-
fieldsUsed: e.array(A).optional(),
|
|
491
|
-
result: Te.optional(),
|
|
492
|
-
validation: M,
|
|
493
|
-
coverage: G.optional(),
|
|
494
|
-
missingFields: e.array(e.string()).optional(),
|
|
495
|
-
warnings: e.array(e.string()).optional(),
|
|
496
|
-
relationshipDiagnostics: Me.optional(),
|
|
497
|
-
diagnosticFeedback: X.optional(),
|
|
498
|
-
population: Q.optional(),
|
|
499
|
-
metadata: e.record(e.string(), e.unknown()).optional()
|
|
500
|
-
}).passthrough(), ze = H;
|
|
501
|
-
function Be(a) {
|
|
502
|
-
switch (a) {
|
|
503
|
-
case "boolean":
|
|
504
|
-
return e.boolean().optional();
|
|
505
|
-
case "compactExecutionFieldArray":
|
|
506
|
-
return e.array(he).optional();
|
|
507
|
-
case "coverage":
|
|
508
|
-
return G.optional();
|
|
509
|
-
case "diagnosticFeedback":
|
|
510
|
-
return X.optional();
|
|
511
|
-
case "executionFieldArray":
|
|
512
|
-
return e.array(A).optional();
|
|
513
|
-
case "executionResult":
|
|
514
|
-
return ze.optional();
|
|
515
|
-
case "number":
|
|
516
|
-
return e.number().finite().optional();
|
|
517
|
-
case "population":
|
|
518
|
-
return Q.optional();
|
|
519
|
-
case "record":
|
|
520
|
-
return pe.optional();
|
|
521
|
-
case "recordArray":
|
|
522
|
-
return de.optional();
|
|
523
|
-
case "responseDetail":
|
|
524
|
-
return e.enum(["compact", "standard", "debug"]).optional();
|
|
525
|
-
case "string":
|
|
526
|
-
return e.string().optional();
|
|
527
|
-
case "stringArray":
|
|
528
|
-
return e.array(e.string()).optional();
|
|
529
|
-
case "unknown":
|
|
530
|
-
return e.unknown().optional();
|
|
531
|
-
case "unknownArray":
|
|
532
|
-
return e.array(e.unknown()).optional();
|
|
533
|
-
case "validationResult":
|
|
534
|
-
return M.optional();
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
const De = Object.fromEntries(
|
|
538
|
-
Object.entries(j).map(
|
|
539
|
-
([a, t]) => [a, Be(t)]
|
|
540
|
-
)
|
|
541
|
-
), Le = e.object(De).strict(), We = new Set(
|
|
542
|
-
Object.keys(j)
|
|
543
|
-
);
|
|
544
|
-
function ha() {
|
|
545
|
-
return Object.keys(
|
|
546
|
-
j
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
function Ke(a) {
|
|
550
|
-
return We.has(a);
|
|
551
|
-
}
|
|
552
|
-
function ga(a) {
|
|
553
|
-
if (!a || typeof a != "object" || Array.isArray(a))
|
|
554
|
-
throw new Error("Semaphor analyze result must be an object.");
|
|
555
|
-
const s = Object.keys(a).filter(
|
|
556
|
-
(r) => !Ke(r)
|
|
557
|
-
);
|
|
558
|
-
if (s.length)
|
|
559
|
-
throw new Error(
|
|
560
|
-
`Semaphor analyze result contains unsupported top-level field(s): ${s.join(", ")}.`
|
|
561
|
-
);
|
|
562
|
-
return Le.parse(a);
|
|
563
|
-
}
|
|
564
|
-
const Y = 100, b = "selection:";
|
|
565
|
-
function ee(a) {
|
|
566
|
-
return [
|
|
567
|
-
B(a.source),
|
|
568
|
-
Se(a.name),
|
|
569
|
-
a.sourceField ?? ""
|
|
570
|
-
].join("::");
|
|
571
|
-
}
|
|
572
|
-
function ya(a) {
|
|
573
|
-
return `${b}${a}`;
|
|
574
|
-
}
|
|
575
|
-
function Ue(a) {
|
|
576
|
-
return a.startsWith(b) && a.length > b.length;
|
|
577
|
-
}
|
|
578
|
-
function fa(a) {
|
|
579
|
-
return Ue(a) ? a.slice(b.length) : void 0;
|
|
580
|
-
}
|
|
581
|
-
function ae(a) {
|
|
582
|
-
if (!a) return "";
|
|
583
|
-
const t = a.calendar.fiscalCalendar;
|
|
584
|
-
return JSON.stringify([
|
|
585
|
-
a.granularity,
|
|
586
|
-
a.calendar.tz,
|
|
587
|
-
a.calendar.weekStart,
|
|
588
|
-
t ? [t.kind, t.yearStartMonth] : null
|
|
589
|
-
]);
|
|
590
|
-
}
|
|
591
|
-
function $e(a) {
|
|
592
|
-
return JSON.stringify([
|
|
593
|
-
ee(a.field),
|
|
594
|
-
a.operator,
|
|
595
|
-
a.operator === "isNull" ? null : a.value,
|
|
596
|
-
ae(a.temporalBucket)
|
|
597
|
-
]);
|
|
598
|
-
}
|
|
599
|
-
function N(a) {
|
|
600
|
-
return JSON.stringify(a.conditions.map($e).sort());
|
|
601
|
-
}
|
|
602
|
-
function v(a) {
|
|
603
|
-
return JSON.stringify([
|
|
604
|
-
B(a.field.source),
|
|
605
|
-
a.field.name,
|
|
606
|
-
a.operator,
|
|
607
|
-
a.operator === "isNull" ? null : a.value,
|
|
608
|
-
ae(a.temporalBucket)
|
|
609
|
-
]);
|
|
610
|
-
}
|
|
611
|
-
function O(a) {
|
|
612
|
-
return JSON.stringify(
|
|
613
|
-
a.conditions.map(v).sort()
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
|
-
function ba(a) {
|
|
617
|
-
const t = a.map((s) => s.id);
|
|
618
|
-
if (new Set(t).size !== t.length)
|
|
619
|
-
throw new Error("Data App selections require one active selection per id.");
|
|
620
|
-
return a.map((s) => ({
|
|
621
|
-
...s,
|
|
622
|
-
tuples: s.tuples.map((r) => ({
|
|
623
|
-
...r,
|
|
624
|
-
conditions: [...r.conditions].sort(
|
|
625
|
-
(n, i) => w(
|
|
626
|
-
v(n),
|
|
627
|
-
v(i)
|
|
628
|
-
)
|
|
629
|
-
)
|
|
630
|
-
})).sort(
|
|
631
|
-
(r, n) => w(
|
|
632
|
-
O(r),
|
|
633
|
-
O(n)
|
|
634
|
-
)
|
|
635
|
-
)
|
|
636
|
-
})).sort((s, r) => w(s.id, r.id));
|
|
637
|
-
}
|
|
638
|
-
function w(a, t) {
|
|
639
|
-
return a < t ? -1 : a > t ? 1 : 0;
|
|
640
|
-
}
|
|
641
|
-
function Sa(a, t) {
|
|
642
|
-
return N(a) === N(t);
|
|
643
|
-
}
|
|
644
|
-
const Ve = "(Blank)";
|
|
645
|
-
function Ia(a) {
|
|
646
|
-
return a.conditions.map((t) => t.label ? t.label : t.operator === "isNull" || t.value === null ? Ve : String(t.value)).join(" · ");
|
|
647
|
-
}
|
|
648
|
-
const Je = e.union([
|
|
649
|
-
ge,
|
|
650
|
-
ye
|
|
651
|
-
]), Ze = e.object({
|
|
652
|
-
name: e.string().min(1),
|
|
653
|
-
source: Je,
|
|
654
|
-
dataType: e.enum(["string", "number", "boolean", "date", "datetime"]),
|
|
655
|
-
sourceField: e.string().min(1).optional()
|
|
656
|
-
}).strict(), Xe = e.object({
|
|
657
|
-
field: Ze,
|
|
658
|
-
operator: e.enum(["=", "isNull"]),
|
|
659
|
-
value: e.union([e.string(), e.number().finite(), e.null()]),
|
|
660
|
-
label: e.string().optional(),
|
|
661
|
-
temporalBucket: z.optional()
|
|
662
|
-
}).strict().superRefine((a, t) => {
|
|
663
|
-
a.operator === "isNull" != (a.value === null) && t.addIssue({
|
|
664
|
-
code: e.ZodIssueCode.custom,
|
|
665
|
-
message: "isNull carries a null value, and only isNull does.",
|
|
666
|
-
path: ["value"]
|
|
667
|
-
});
|
|
668
|
-
}), Qe = e.object({
|
|
669
|
-
conditions: e.array(Xe).min(1)
|
|
670
|
-
}).strict().superRefine((a, t) => {
|
|
671
|
-
const s = a.conditions.map((r) => ee(r.field));
|
|
672
|
-
new Set(s).size !== s.length && t.addIssue({
|
|
673
|
-
code: e.ZodIssueCode.custom,
|
|
674
|
-
message: "A tuple holds one condition per field.",
|
|
675
|
-
path: ["conditions"]
|
|
676
|
-
});
|
|
677
|
-
}), wa = e.object({
|
|
678
|
-
kind: e.literal("selection"),
|
|
679
|
-
sourceCardId: e.string().min(1),
|
|
680
|
-
tuples: e.array(Qe).min(1).max(Y)
|
|
681
|
-
}).strict(), Ge = e.object({
|
|
682
|
-
field: fe,
|
|
683
|
-
operator: e.enum(["=", "isNull"]),
|
|
684
|
-
value: e.union([e.string(), e.number().finite(), e.null()]),
|
|
685
|
-
temporalBucket: z.optional()
|
|
686
|
-
}).strict().superRefine((a, t) => {
|
|
687
|
-
a.operator === "isNull" != (a.value === null) && t.addIssue({
|
|
688
|
-
code: e.ZodIssueCode.custom,
|
|
689
|
-
message: "isNull carries a null value, and only isNull does.",
|
|
690
|
-
path: ["value"]
|
|
691
|
-
});
|
|
692
|
-
}), He = e.object({
|
|
693
|
-
conditions: e.array(Ge).min(1)
|
|
694
|
-
}).strict().superRefine((a, t) => {
|
|
695
|
-
for (let s = 0; s < a.conditions.length; s += 1) {
|
|
696
|
-
const r = a.conditions[s];
|
|
697
|
-
a.conditions.findIndex(
|
|
698
|
-
(i, o) => o < s && be(i.field, r.field)
|
|
699
|
-
) !== -1 && t.addIssue({
|
|
700
|
-
code: e.ZodIssueCode.custom,
|
|
701
|
-
message: "A selection tuple can contain only one condition per field.",
|
|
702
|
-
path: ["conditions", s, "field"]
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
}), ka = e.object({
|
|
706
|
-
id: e.string().min(1),
|
|
707
|
-
tuples: e.array(He).min(1).max(Y)
|
|
708
|
-
}).strict(), Ye = e.object({ key: e.string().min(1), nativeText: e.string().nullable() }).strict(), ea = e.object({
|
|
709
|
-
executionInstant: e.string().refine((a) => Ie(a) !== null, {
|
|
710
|
-
message: "executionInstant must be an ISO instant"
|
|
711
|
-
}),
|
|
712
|
-
dataAnchors: e.array(Ye).default([])
|
|
713
|
-
}).strict().refine(
|
|
714
|
-
(a) => new Set(a.dataAnchors.map((t) => t.key)).size === a.dataAnchors.length,
|
|
715
|
-
{ message: "dataAnchors keys must be unique", path: ["dataAnchors"] }
|
|
716
|
-
);
|
|
717
|
-
function va(a) {
|
|
718
|
-
if (a == null) return;
|
|
719
|
-
const t = ea.safeParse(a);
|
|
720
|
-
return t.success ? t.data : void 0;
|
|
721
|
-
}
|
|
722
|
-
const aa = e.object({
|
|
723
|
-
intent: we,
|
|
724
|
-
matrixWindowRequest: D
|
|
725
|
-
}).strict(), ta = e.object({
|
|
726
|
-
runtimeFilters: k.innerType().shape.filters,
|
|
727
|
-
runtimeSorts: k.innerType().shape.sorts.optional()
|
|
728
|
-
});
|
|
729
|
-
function xa(a) {
|
|
730
|
-
return ta.parse(a);
|
|
731
|
-
}
|
|
732
|
-
const sa = {
|
|
733
|
-
// A window executes a governed statement set, not one compiled query.
|
|
734
|
-
compiledQuery: e.never().optional(),
|
|
735
|
-
intent: aa.shape.intent,
|
|
736
|
-
resultShape: e.literal("matrix"),
|
|
737
|
-
result: J.optional(),
|
|
738
|
-
metadata: e.object({ rowLimitExceeded: e.boolean(), matrixFailure: R.optional() }).passthrough()
|
|
739
|
-
}, ra = H.extend(sa), Aa = ra.superRefine((a, t) => {
|
|
740
|
-
a.status === "failed" == !!a.result && t.addIssue({ code: "custom", message: "Only answered or partial Matrix execution carries a window." }), a.result && a.status === "partial" != a.result.window.failures.length > 0 && t.addIssue({ code: "custom", message: "Matrix execution status must match acquired window failures." });
|
|
741
|
-
});
|
|
742
|
-
export {
|
|
743
|
-
_e as $,
|
|
744
|
-
Sa as A,
|
|
745
|
-
Ia as B,
|
|
746
|
-
Ze as C,
|
|
747
|
-
Xe as D,
|
|
748
|
-
Qe as E,
|
|
749
|
-
wa as F,
|
|
750
|
-
Ge as G,
|
|
751
|
-
He as H,
|
|
752
|
-
ea as I,
|
|
753
|
-
va as J,
|
|
754
|
-
ve as K,
|
|
755
|
-
P as L,
|
|
756
|
-
ia as M,
|
|
757
|
-
xe as N,
|
|
758
|
-
ca as O,
|
|
759
|
-
Ae as P,
|
|
760
|
-
je as Q,
|
|
761
|
-
Re as R,
|
|
762
|
-
j as S,
|
|
763
|
-
_ as T,
|
|
764
|
-
R as U,
|
|
765
|
-
Ce as V,
|
|
766
|
-
$ as W,
|
|
767
|
-
Ee as X,
|
|
768
|
-
la as Y,
|
|
769
|
-
ua as Z,
|
|
770
|
-
Pe as _,
|
|
771
|
-
ka as a,
|
|
772
|
-
qe as a0,
|
|
773
|
-
ma as a1,
|
|
774
|
-
da as a2,
|
|
775
|
-
Fe as a3,
|
|
776
|
-
Ne as a4,
|
|
777
|
-
q as a5,
|
|
778
|
-
Oe as a6,
|
|
779
|
-
pa as a7,
|
|
780
|
-
ta as a8,
|
|
781
|
-
xa as a9,
|
|
782
|
-
Aa as aa,
|
|
783
|
-
aa as ab,
|
|
784
|
-
Me as b,
|
|
785
|
-
ba as c,
|
|
786
|
-
X as d,
|
|
787
|
-
Q as e,
|
|
788
|
-
G as f,
|
|
789
|
-
ha as g,
|
|
790
|
-
H as h,
|
|
791
|
-
Ke as i,
|
|
792
|
-
ze as j,
|
|
793
|
-
De as k,
|
|
794
|
-
Le as l,
|
|
795
|
-
D as m,
|
|
796
|
-
J as n,
|
|
797
|
-
Y as o,
|
|
798
|
-
ga as p,
|
|
799
|
-
ee as q,
|
|
800
|
-
ya as r,
|
|
801
|
-
Te as s,
|
|
802
|
-
Ue as t,
|
|
803
|
-
fa as u,
|
|
804
|
-
ae as v,
|
|
805
|
-
$e as w,
|
|
806
|
-
N as x,
|
|
807
|
-
v as y,
|
|
808
|
-
O as z
|
|
809
|
-
};
|