react-semaphor 0.1.601 → 0.1.602
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 +9 -9
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +7 -7
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/{assistant-chat-BE0XXzZP.js → assistant-chat-BWF3GYip.js} +12 -12
- package/dist/chunks/{bookmark-impact-DXDAN5AY.js → bookmark-impact-BF3iRx5a.js} +3 -3
- package/dist/chunks/{bookmark-state-BMyB3Tb6.js → bookmark-state-CBSTdW6q.js} +4 -4
- package/dist/chunks/{card-filter-builder-CE0-YVN5.js → card-filter-builder-B8XHwMY6.js} +394 -394
- package/dist/chunks/{comparison-window-caption-Dxj2CHOa.js → comparison-window-caption-W83qB4V5.js} +4 -4
- package/dist/chunks/{dashboard-mJKPFRbb.js → dashboard-DG5EIYYB.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CntwKyiZ.js → dashboard-briefing-launcher-CBSrhyWZ.js} +727 -718
- package/dist/chunks/{dashboard-controls-XO089DMg.js → dashboard-controls-D6ECO4N1.js} +15 -15
- package/dist/chunks/{dashboard-json-CQRiydUv.js → dashboard-json-DrJftBSL.js} +4 -4
- package/dist/chunks/{dates-B-Urp5OD.js → dates-Bz-qM5px.js} +10 -10
- package/dist/chunks/{edit-dashboard-visual-f-Dm-BLR.js → edit-dashboard-visual-BDYAJIbb.js} +1565 -1544
- package/dist/chunks/{filter-line-CKNMyNTQ.js → filter-line-BXT6y303.js} +6 -6
- package/dist/chunks/{filter-reach-copy-B8GGyVuR.js → filter-reach-copy-BukhZmzm.js} +1661 -1950
- package/dist/chunks/{filter-value-text-CRtKecI5.js → filter-value-text-D3-bf3_b.js} +4 -4
- package/dist/chunks/{index-DoPApnxg.js → index-BW0yozjs.js} +5 -5
- package/dist/chunks/{layout-grid-CiSCZdIr.js → layout-grid-Ds0diMeY.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-myf3D3Qx.js → matrix-analytical-definition-CgQgVeeI.js} +4 -4
- package/dist/chunks/{matrix-member-presentation-g0c_NpDW.js → matrix-member-presentation-DSBIIudt.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-C1SuOHLZ.js → matrix-operation-contract--DkNCOzd.js} +517 -514
- package/dist/chunks/{metric-comparison-Cm0G893W.js → metric-comparison-zMylnIkc.js} +1 -1
- package/dist/chunks/{paintbrush-DQIwqlck.js → paintbrush-CX8pao1j.js} +1 -1
- package/dist/chunks/{palette-Cun747Rg.js → palette-CuA0HlzF.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-C1Dyx8du.js → pivot-result-contract-expectations-C8KL7hPx.js} +8 -8
- package/dist/chunks/{pivot-result-identity-CBS-ssEp.js → pivot-result-identity-C1AOH1PS.js} +1 -1
- package/dist/chunks/{raw-temporal-value-DN_l-Tss.js → raw-temporal-value-E416F-0L.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-SDZEcG2x.js → report-preferences-dialog-CbuVNDGi.js} +13 -13
- package/dist/chunks/{report-runtime-context-BbedQdtc.js → report-runtime-context-E7USjN7E.js} +1 -1
- package/dist/chunks/{resolve-dashboard-input-context-DRBS0eRa.js → resolve-dashboard-input-context-CULCE_hM.js} +8417 -7052
- package/dist/chunks/{save-Dj5bjm7P.js → save-BKHlDONy.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-DWVlJcsa.js → saved-dashboard-context-C1WlOx5z.js} +32 -32
- package/dist/chunks/{selection-filter-compiler-DmAr7yqC.js → selection-filter-compiler-ifT8JCXS.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-OFOoAY-A.js → semaphor-ready-indicator-CBIRcDWs.js} +33414 -31523
- package/dist/chunks/{shelf-drop-preview-context-2swWypXu.js → shelf-drop-preview-context-xR69SMA8.js} +53 -53
- package/dist/chunks/{stored-dashboard-NtOuEX6a.js → stored-dashboard-BuM8vnWf.js} +739 -717
- package/dist/chunks/{style-sheet-parts-Qv4UcLAo.js → style-sheet-parts-Bt9ZNre8.js} +2 -2
- package/dist/chunks/{table-export-sheet-Do7ZB0_F.js → table-export-sheet-DVljtHkG.js} +1 -1
- package/dist/chunks/{token-types-Dy_aXO-U.js → token-types-D_xKgyVS.js} +1 -1
- package/dist/chunks/{upload-Bq-puSVy.js → upload-Dll_M7XQ.js} +1 -1
- package/dist/chunks/{validators-C7DFk3QK.js → validators-ClWHpYql.js} +2 -2
- package/dist/chunks/{variable-draft-Cy03qnEi.js → variable-draft-CDGGl53R.js} +27 -28
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +3086 -2578
- package/dist/format-utils/index.js +14 -14
- package/dist/index.js +71 -73
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/dashboard/dashboard-web-component.d.ts +7 -0
- package/dist/types/index.js +5 -5
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +1 -1
- package/dist/types/lib/query-context/assemble-card-query.d.ts +6 -1
- package/dist/types/lib/stores/dashboard-store.d.ts +30 -0
- package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +52 -0
- package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +129 -0
- package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts +46 -0
- package/dist/types/shared/dashboard-authoring/calculations/tokens.d.ts +36 -0
- package/dist/types/shared/dashboard-authoring/changes/calculation-change.d.ts +399 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +144 -2
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +21 -2
- package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +143 -266
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +46 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
- package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +133 -0
- package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +71 -0
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +18 -5
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -0
- package/dist/types/shared/usage-events/details.d.ts +2 -2
- package/dist/types/shared/usage-events/envelope.d.ts +2 -2
- package/package.json +1 -1
package/dist/chunks/{matrix-operation-contract-C1SuOHLZ.js → matrix-operation-contract--DkNCOzd.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z as t } from "zod";
|
|
2
|
-
import { z as
|
|
3
|
-
import { B as
|
|
2
|
+
import { z as Ue, P as De, X as qe, Y as Me, a0 as Be, a1 as Ge, s as U, L as $, n as ze, V as Ve, W as le, g as We, r as Ke, N as Xe, E as $e, F as Ze, o as ue, b as de, I as Ye } from "./analytics-base-schemas-DevrgqQb.js";
|
|
3
|
+
import { B as v, v as me, K as G, b0 as te, m as _, E as He, aV as Z, w as Qe, o as Je, q as pe, a3 as et, p as tt, a6 as nt, a$ as at } from "./validators-ClWHpYql.js";
|
|
4
4
|
const Y = {
|
|
5
5
|
answerSummary: "string",
|
|
6
6
|
responseDetail: "responseDetail",
|
|
@@ -41,7 +41,7 @@ const Y = {
|
|
|
41
41
|
periodRows: "recordArray",
|
|
42
42
|
sql: "unknown",
|
|
43
43
|
omitted: "stringArray"
|
|
44
|
-
},
|
|
44
|
+
}, he = [
|
|
45
45
|
/** The request can't run as asked (no specific validation code applies). */
|
|
46
46
|
"invalid_request",
|
|
47
47
|
/** No authored relationship connects the requested datasets. */
|
|
@@ -61,7 +61,7 @@ const Y = {
|
|
|
61
61
|
"timeout",
|
|
62
62
|
"budget_exceeded",
|
|
63
63
|
"cancelled"
|
|
64
|
-
],
|
|
64
|
+
], rt = {
|
|
65
65
|
invalid_request: 400,
|
|
66
66
|
missing_relationship: 400,
|
|
67
67
|
ambiguous_relationship: 400,
|
|
@@ -74,29 +74,29 @@ const Y = {
|
|
|
74
74
|
timeout: 504,
|
|
75
75
|
budget_exceeded: 413,
|
|
76
76
|
cancelled: 499
|
|
77
|
-
},
|
|
78
|
-
function
|
|
79
|
-
return typeof e == "string" &&
|
|
77
|
+
}, st = /* @__PURE__ */ new Set(["execution_failed", "timeout"]);
|
|
78
|
+
function ot(e) {
|
|
79
|
+
return typeof e == "string" && he.includes(e);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function it(e, n, a = {}) {
|
|
82
82
|
return {
|
|
83
83
|
code: e,
|
|
84
84
|
message: n,
|
|
85
85
|
...a.details ? { details: a.details } : {},
|
|
86
86
|
...a.nextStep ? { nextStep: a.nextStep } : {},
|
|
87
|
-
retryable:
|
|
88
|
-
status: a.status ??
|
|
87
|
+
retryable: st.has(e),
|
|
88
|
+
status: a.status ?? rt[e]
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function dn(e) {
|
|
92
92
|
if (!e || typeof e != "object") return;
|
|
93
93
|
const n = e.refusal ?? e;
|
|
94
94
|
if (!n || typeof n != "object") return;
|
|
95
95
|
const { code: a, message: r } = n;
|
|
96
|
-
if (!(!
|
|
96
|
+
if (!(!ot(a) || typeof r != "string"))
|
|
97
97
|
return n;
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const ct = {
|
|
100
100
|
invalid_request: { message: "This query configuration cannot run.", nextStep: "Check the selected fields, filters and parameters." },
|
|
101
101
|
missing_relationship: { message: "The selected data is not connected.", nextStep: "Choose related datasets or ask the owner to add a relationship." },
|
|
102
102
|
ambiguous_relationship: { message: "The selected data has more than one relationship path.", nextStep: "Choose the relationship to use." },
|
|
@@ -110,48 +110,48 @@ const it = {
|
|
|
110
110
|
budget_exceeded: { message: "The query exceeds this view’s limits.", nextStep: "Request fewer rows, columns or measures." },
|
|
111
111
|
cancelled: { message: "The query was cancelled.", nextStep: "Reload the view when ready." }
|
|
112
112
|
};
|
|
113
|
-
function
|
|
114
|
-
const n =
|
|
113
|
+
function mn(e) {
|
|
114
|
+
const n = ct[e.code], a = it(e.code, n.message, { nextStep: n.nextStep, status: e.status }), r = e.retryable ?? a.retryable;
|
|
115
115
|
return {
|
|
116
116
|
...a,
|
|
117
117
|
retryable: r,
|
|
118
118
|
...!r && a.retryable ? { nextStep: "Ask the owner to check the query." } : {}
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
...
|
|
121
|
+
const lt = [
|
|
122
|
+
...he,
|
|
123
123
|
"stale_cursor",
|
|
124
124
|
"source_truncated"
|
|
125
|
-
],
|
|
125
|
+
], pn = Object.freeze({
|
|
126
126
|
coordinates: 2e4,
|
|
127
127
|
responseBytes: 5 * 1024 * 1024
|
|
128
|
-
}),
|
|
128
|
+
}), P = t.string().uuid(), b = t.string().min(1), ut = t.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
129
129
|
function f(e, n, a) {
|
|
130
130
|
e.addIssue({ code: "custom", path: n, message: a });
|
|
131
131
|
}
|
|
132
132
|
function T(e, n, a) {
|
|
133
133
|
new Set(e).size !== e.length && f(n, a, "Duplicate identity.");
|
|
134
134
|
}
|
|
135
|
-
const
|
|
136
|
-
id:
|
|
137
|
-
axis:
|
|
138
|
-
parent:
|
|
135
|
+
const dt = t.object({
|
|
136
|
+
id: b,
|
|
137
|
+
axis: me,
|
|
138
|
+
parent: v,
|
|
139
139
|
position: t.union([
|
|
140
140
|
t.object({ kind: t.literal("first") }).strict(),
|
|
141
|
-
t.object({ kind: t.enum(["after", "before"]), cursor:
|
|
141
|
+
t.object({ kind: t.enum(["after", "before"]), cursor: b }).strict()
|
|
142
142
|
]),
|
|
143
|
-
size:
|
|
144
|
-
}).strict(),
|
|
145
|
-
paths: t.array(
|
|
146
|
-
pageIds: t.array(
|
|
147
|
-
}).strict(),
|
|
148
|
-
id:
|
|
149
|
-
rows:
|
|
150
|
-
columns:
|
|
151
|
-
measureIds: t.array(
|
|
152
|
-
}).strict(),
|
|
153
|
-
pages: t.array(
|
|
154
|
-
blocks: t.array(
|
|
143
|
+
size: ut
|
|
144
|
+
}).strict(), ne = t.object({
|
|
145
|
+
paths: t.array(v).readonly(),
|
|
146
|
+
pageIds: t.array(b).readonly()
|
|
147
|
+
}).strict(), mt = t.object({
|
|
148
|
+
id: b,
|
|
149
|
+
rows: ne,
|
|
150
|
+
columns: ne,
|
|
151
|
+
measureIds: t.array(P).min(1).readonly()
|
|
152
|
+
}).strict(), fe = t.object({
|
|
153
|
+
pages: t.array(dt).readonly(),
|
|
154
|
+
blocks: t.array(mt).readonly()
|
|
155
155
|
}).strict().superRefine((e, n) => {
|
|
156
156
|
!e.pages.length && !e.blocks.length && f(n, [], "Request at least one page or block."), T(
|
|
157
157
|
[...e.pages, ...e.blocks].map((a) => a.id),
|
|
@@ -170,9 +170,9 @@ const ut = t.object({
|
|
|
170
170
|
"Page reference must name a page on this axis in this operation."
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
|
-
}),
|
|
173
|
+
}), hn = t.object({ spec: G, request: fe }).strict().superRefine(({ spec: e, request: n }, a) => {
|
|
174
174
|
for (const r of n.pages)
|
|
175
|
-
|
|
175
|
+
te(
|
|
176
176
|
e,
|
|
177
177
|
r.axis,
|
|
178
178
|
r.parent,
|
|
@@ -188,15 +188,15 @@ const ut = t.object({
|
|
|
188
188
|
r.measureIds.some((s) => !e.measures.some((c) => c.id === s)) && f(a, ["blocks", r.id], "Unknown block measure.");
|
|
189
189
|
for (const s of ["rows", "columns"])
|
|
190
190
|
for (const c of r[s].paths)
|
|
191
|
-
|
|
191
|
+
te(e, s, c, a, ["blocks", r.id, s]);
|
|
192
192
|
}
|
|
193
|
-
}),
|
|
194
|
-
requestId:
|
|
195
|
-
axis:
|
|
196
|
-
parent:
|
|
197
|
-
members: t.array(t.object({ path:
|
|
198
|
-
before:
|
|
199
|
-
after:
|
|
193
|
+
}), pt = t.object({
|
|
194
|
+
requestId: b,
|
|
195
|
+
axis: me,
|
|
196
|
+
parent: v,
|
|
197
|
+
members: t.array(t.object({ path: v }).strict()).readonly(),
|
|
198
|
+
before: b.nullable(),
|
|
199
|
+
after: b.nullable(),
|
|
200
200
|
exactCount: t.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()
|
|
201
201
|
}).strict().superRefine((e, n) => {
|
|
202
202
|
e.parent.some((r) => r.member.kind === "others") && f(n, ["parent"], "Others has no children.");
|
|
@@ -214,139 +214,139 @@ const ut = t.object({
|
|
|
214
214
|
}
|
|
215
215
|
)
|
|
216
216
|
).size > 1 && f(n, ["members"], "One page must contain one child level."), T(
|
|
217
|
-
e.members.map((r) =>
|
|
217
|
+
e.members.map((r) => _(r.path)),
|
|
218
218
|
n,
|
|
219
219
|
["members"]
|
|
220
220
|
);
|
|
221
221
|
for (const r of e.members)
|
|
222
|
-
(r.path.length !== e.parent.length + 1 ||
|
|
223
|
-
}),
|
|
224
|
-
rowPaths: t.array(
|
|
225
|
-
columnPaths: t.array(
|
|
226
|
-
measureIds: t.array(
|
|
222
|
+
(r.path.length !== e.parent.length + 1 || _(r.path.slice(0, -1)) !== _(e.parent)) && f(n, ["members"], "Page members must be immediate children.");
|
|
223
|
+
}), ge = t.object({
|
|
224
|
+
rowPaths: t.array(v).readonly(),
|
|
225
|
+
columnPaths: t.array(v).readonly(),
|
|
226
|
+
measureIds: t.array(P).readonly()
|
|
227
227
|
}).strict();
|
|
228
|
-
function
|
|
229
|
-
const a = e.rowPaths.map(
|
|
228
|
+
function ye(e, n) {
|
|
229
|
+
const a = e.rowPaths.map(_), r = e.columnPaths.map(_);
|
|
230
230
|
return T(a, n, ["coverage", "rowPaths"]), T(r, n, ["coverage", "columnPaths"]), T(e.measureIds, n, ["coverage", "measureIds"]), { rows: a, columns: r };
|
|
231
231
|
}
|
|
232
|
-
const
|
|
233
|
-
requestId:
|
|
234
|
-
coverage:
|
|
232
|
+
const ht = t.object({
|
|
233
|
+
requestId: b,
|
|
234
|
+
coverage: ge,
|
|
235
235
|
cells: t.array(
|
|
236
|
-
|
|
236
|
+
He.extend({ value: Z }).strict()
|
|
237
237
|
).readonly()
|
|
238
238
|
}).strict().superRefine((e, n) => {
|
|
239
|
-
const { rows: a, columns: r } =
|
|
239
|
+
const { rows: a, columns: r } = ye(e.coverage, n), s = new Set(a), c = new Set(r), o = new Set(e.coverage.measureIds);
|
|
240
240
|
T(
|
|
241
241
|
e.cells.map(
|
|
242
|
-
(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
242
|
+
(m) => JSON.stringify([
|
|
243
|
+
_(m.rowPath),
|
|
244
|
+
_(m.columnPath),
|
|
245
|
+
m.measureId
|
|
246
246
|
])
|
|
247
247
|
),
|
|
248
248
|
n,
|
|
249
249
|
["cells"]
|
|
250
250
|
);
|
|
251
|
-
for (const
|
|
252
|
-
(!s.has(
|
|
253
|
-
}),
|
|
254
|
-
requestId:
|
|
255
|
-
coverage:
|
|
251
|
+
for (const m of e.cells)
|
|
252
|
+
(!s.has(_(m.rowPath)) || !c.has(_(m.columnPath)) || !o.has(m.measureId)) && f(n, ["cells"], "Cell is outside certified coverage.");
|
|
253
|
+
}), D = t.number().int().nonnegative(), ft = t.object({
|
|
254
|
+
requestId: b,
|
|
255
|
+
coverage: ge,
|
|
256
256
|
values: t.array(
|
|
257
|
-
t.tuple([
|
|
257
|
+
t.tuple([D, D, D, Z]).readonly()
|
|
258
258
|
).readonly()
|
|
259
259
|
}).strict().superRefine((e, n) => {
|
|
260
|
-
|
|
260
|
+
ye(e.coverage, n);
|
|
261
261
|
const { rowPaths: a, columnPaths: r, measureIds: s } = e.coverage, c = /* @__PURE__ */ new Set();
|
|
262
|
-
for (const [
|
|
263
|
-
if (
|
|
262
|
+
for (const [o, m, d] of e.values) {
|
|
263
|
+
if (o >= a.length || m >= r.length || d >= s.length) {
|
|
264
264
|
f(n, ["values"], "Cell is outside certified coverage.");
|
|
265
265
|
continue;
|
|
266
266
|
}
|
|
267
|
-
const
|
|
268
|
-
c.has(
|
|
267
|
+
const i = `${o},${m},${d}`;
|
|
268
|
+
c.has(i) && f(n, ["values"], "Duplicate identity."), c.add(i);
|
|
269
269
|
}
|
|
270
|
-
}),
|
|
271
|
-
id:
|
|
270
|
+
}), ae = t.object({
|
|
271
|
+
id: P,
|
|
272
272
|
column: De,
|
|
273
|
-
nativeDataType:
|
|
274
|
-
semanticFormat:
|
|
275
|
-
}).strict(),
|
|
276
|
-
levels: t.array(
|
|
277
|
-
measures: t.array(
|
|
273
|
+
nativeDataType: b,
|
|
274
|
+
semanticFormat: Ue.optional()
|
|
275
|
+
}).strict(), Se = t.object({
|
|
276
|
+
levels: t.array(ae).readonly(),
|
|
277
|
+
measures: t.array(ae).readonly()
|
|
278
278
|
}).strict(), H = t.object({
|
|
279
|
-
code: t.enum(
|
|
280
|
-
message:
|
|
279
|
+
code: t.enum(lt),
|
|
280
|
+
message: b,
|
|
281
281
|
/** Technical cause for dashboard owners; never shown as the primary copy. */
|
|
282
|
-
detail:
|
|
282
|
+
detail: b.optional(),
|
|
283
283
|
details: t.record(t.unknown()).optional(),
|
|
284
|
-
nextStep:
|
|
284
|
+
nextStep: b.optional(),
|
|
285
285
|
status: t.number().int().optional(),
|
|
286
286
|
retryable: t.boolean(),
|
|
287
287
|
scope: t.union([
|
|
288
288
|
t.object({ kind: t.literal("operation") }).strict(),
|
|
289
|
-
t.object({ kind: t.enum(["page", "block"]), requestId:
|
|
289
|
+
t.object({ kind: t.enum(["page", "block"]), requestId: b }).strict()
|
|
290
290
|
])
|
|
291
|
-
}).strict(),
|
|
291
|
+
}).strict(), gt = t.object({
|
|
292
292
|
dialect: t.enum(["postgres", "clickhouse", "duckdb", "snowflake"]),
|
|
293
|
-
aggregates: t.array(
|
|
293
|
+
aggregates: t.array(Qe).readonly()
|
|
294
294
|
}).strict();
|
|
295
|
-
function
|
|
295
|
+
function be(e) {
|
|
296
296
|
return t.object({
|
|
297
|
-
queryIdentity:
|
|
298
|
-
descriptors:
|
|
299
|
-
capabilities:
|
|
300
|
-
pages: t.array(
|
|
297
|
+
queryIdentity: b,
|
|
298
|
+
descriptors: Se,
|
|
299
|
+
capabilities: gt,
|
|
300
|
+
pages: t.array(pt).readonly(),
|
|
301
301
|
blocks: t.array(e).readonly(),
|
|
302
302
|
failures: t.array(H).readonly()
|
|
303
303
|
}).strict().superRefine((n, a) => {
|
|
304
304
|
const r = new Set(
|
|
305
|
-
n.descriptors.levels.map((
|
|
305
|
+
n.descriptors.levels.map((o) => o.id)
|
|
306
306
|
), s = new Set(
|
|
307
|
-
n.descriptors.measures.map((
|
|
308
|
-
), c = n.pages.flatMap((
|
|
309
|
-
|
|
310
|
-
...
|
|
307
|
+
n.descriptors.measures.map((o) => o.id)
|
|
308
|
+
), c = n.pages.flatMap((o) => [
|
|
309
|
+
o.parent,
|
|
310
|
+
...o.members.map((m) => m.path)
|
|
311
311
|
]);
|
|
312
|
-
for (const
|
|
313
|
-
c.push(...
|
|
312
|
+
for (const o of n.blocks)
|
|
313
|
+
c.push(...o.coverage.rowPaths, ...o.coverage.columnPaths), o.coverage.measureIds.some((m) => !s.has(m)) && f(
|
|
314
314
|
a,
|
|
315
|
-
["blocks",
|
|
315
|
+
["blocks", o.requestId],
|
|
316
316
|
"Coverage references an unknown measure descriptor."
|
|
317
317
|
);
|
|
318
|
-
c.some((
|
|
318
|
+
c.some((o) => o.some((m) => !r.has(m.levelId))) && f(
|
|
319
319
|
a,
|
|
320
320
|
["descriptors"],
|
|
321
321
|
"Acquired paths require level descriptors."
|
|
322
322
|
), T(
|
|
323
323
|
[...n.descriptors.levels, ...n.descriptors.measures].map(
|
|
324
|
-
(
|
|
324
|
+
(o) => o.id
|
|
325
325
|
),
|
|
326
326
|
a,
|
|
327
327
|
["descriptors"]
|
|
328
328
|
), T(
|
|
329
|
-
[...n.pages, ...n.blocks].map((
|
|
329
|
+
[...n.pages, ...n.blocks].map((o) => o.requestId),
|
|
330
330
|
a,
|
|
331
331
|
[]
|
|
332
332
|
), T(
|
|
333
333
|
n.failures.map(
|
|
334
|
-
(
|
|
334
|
+
(o) => o.scope.kind === "operation" ? "operation" : o.scope.requestId
|
|
335
335
|
),
|
|
336
336
|
a,
|
|
337
337
|
["failures"]
|
|
338
338
|
);
|
|
339
|
-
for (const
|
|
340
|
-
if (
|
|
339
|
+
for (const o of n.failures)
|
|
340
|
+
if (o.scope.kind === "operation")
|
|
341
341
|
f(
|
|
342
342
|
a,
|
|
343
343
|
["failures"],
|
|
344
344
|
"Operation failure cannot accompany acquired data."
|
|
345
345
|
);
|
|
346
346
|
else {
|
|
347
|
-
const
|
|
347
|
+
const m = o.scope.requestId;
|
|
348
348
|
[...n.pages, ...n.blocks].some(
|
|
349
|
-
(
|
|
349
|
+
(d) => d.requestId === m
|
|
350
350
|
) && f(
|
|
351
351
|
a,
|
|
352
352
|
["failures"],
|
|
@@ -355,12 +355,12 @@ function Se(e) {
|
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
|
-
const
|
|
359
|
-
pt
|
|
360
|
-
), gt = Se(
|
|
358
|
+
const Ae = be(
|
|
361
359
|
ht
|
|
360
|
+
), yt = be(
|
|
361
|
+
ft
|
|
362
362
|
);
|
|
363
|
-
function
|
|
363
|
+
function Ie(e) {
|
|
364
364
|
return t.union([
|
|
365
365
|
t.object({
|
|
366
366
|
status: t.enum(["success", "partial"]),
|
|
@@ -378,63 +378,63 @@ function Ae(e) {
|
|
|
378
378
|
), r.status === "success" != (s.failures.length === 0) && f(a, ["status"], "Status must match failure coverage.");
|
|
379
379
|
});
|
|
380
380
|
}
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
),
|
|
384
|
-
|
|
381
|
+
const fn = Ie(
|
|
382
|
+
Ae
|
|
383
|
+
), gn = Ie(
|
|
384
|
+
yt
|
|
385
385
|
);
|
|
386
|
-
function
|
|
387
|
-
const { rowPaths: n, columnPaths: a, measureIds: r } = e.coverage, s = (
|
|
386
|
+
function St(e) {
|
|
387
|
+
const { rowPaths: n, columnPaths: a, measureIds: r } = e.coverage, s = (d) => new Map(d.map((i, l) => [i, l])), c = s(n.map(_)), o = s(a.map(_)), m = s(r);
|
|
388
388
|
return {
|
|
389
389
|
requestId: e.requestId,
|
|
390
390
|
coverage: e.coverage,
|
|
391
|
-
values: e.cells.map((
|
|
392
|
-
const
|
|
393
|
-
if (
|
|
391
|
+
values: e.cells.map((d) => {
|
|
392
|
+
const i = c.get(_(d.rowPath)), l = o.get(_(d.columnPath)), p = m.get(d.measureId);
|
|
393
|
+
if (i === void 0 || l === void 0 || p === void 0)
|
|
394
394
|
throw new Error("Cell is outside certified coverage.");
|
|
395
|
-
return [
|
|
395
|
+
return [i, l, p, d.value];
|
|
396
396
|
})
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function bt(e) {
|
|
400
400
|
const { rowPaths: n, columnPaths: a, measureIds: r } = e.coverage;
|
|
401
401
|
return {
|
|
402
402
|
requestId: e.requestId,
|
|
403
403
|
coverage: e.coverage,
|
|
404
|
-
cells: e.values.map(([s, c,
|
|
404
|
+
cells: e.values.map(([s, c, o, m]) => ({
|
|
405
405
|
rowPath: n[s],
|
|
406
406
|
columnPath: a[c],
|
|
407
|
-
measureId: r[
|
|
408
|
-
value:
|
|
407
|
+
measureId: r[o],
|
|
408
|
+
value: m
|
|
409
409
|
}))
|
|
410
410
|
};
|
|
411
411
|
}
|
|
412
|
-
function
|
|
413
|
-
return { ...e, blocks: e.blocks.map(yt) };
|
|
414
|
-
}
|
|
415
|
-
function gn(e) {
|
|
412
|
+
function At(e) {
|
|
416
413
|
return { ...e, blocks: e.blocks.map(St) };
|
|
417
414
|
}
|
|
418
415
|
function yn(e) {
|
|
419
|
-
return
|
|
416
|
+
return { ...e, blocks: e.blocks.map(bt) };
|
|
417
|
+
}
|
|
418
|
+
function Sn(e) {
|
|
419
|
+
return e.status === "failed" ? e : { status: e.status, window: At(e.window) };
|
|
420
420
|
}
|
|
421
|
-
const
|
|
421
|
+
const _e = t.object({
|
|
422
422
|
kind: t.literal("matrix"),
|
|
423
|
-
window:
|
|
424
|
-
}).strict(),
|
|
423
|
+
window: Ae
|
|
424
|
+
}).strict(), we = t.enum(["member", "subtotal", "grand_total"]), It = t.discriminatedUnion("kind", [
|
|
425
425
|
t.object({ kind: t.literal("hierarchy"), label: t.string() }).strict(),
|
|
426
|
-
t.object({ kind: t.literal("level"), levelId:
|
|
426
|
+
t.object({ kind: t.literal("level"), levelId: P, label: t.string() }).strict(),
|
|
427
427
|
t.object({
|
|
428
428
|
kind: t.literal("measure"),
|
|
429
|
-
measureId:
|
|
430
|
-
columnPath:
|
|
431
|
-
role:
|
|
429
|
+
measureId: P,
|
|
430
|
+
columnPath: v,
|
|
431
|
+
role: we,
|
|
432
432
|
label: t.string()
|
|
433
433
|
}).strict()
|
|
434
|
-
]),
|
|
435
|
-
columns: t.array(
|
|
436
|
-
descriptors:
|
|
437
|
-
}).strict(),
|
|
434
|
+
]), _t = t.object({
|
|
435
|
+
columns: t.array(It).readonly(),
|
|
436
|
+
descriptors: Se
|
|
437
|
+
}).strict(), re = t.union([
|
|
438
438
|
t.object({
|
|
439
439
|
kind: t.literal("value"),
|
|
440
440
|
value: Z.refine(
|
|
@@ -442,37 +442,37 @@ const Ie = t.object({
|
|
|
442
442
|
)
|
|
443
443
|
}).strict(),
|
|
444
444
|
t.object({ kind: t.enum(["null", "empty"]) }).strict()
|
|
445
|
-
]),
|
|
445
|
+
]), wt = t.discriminatedUnion("kind", [
|
|
446
446
|
t.object({
|
|
447
447
|
kind: t.literal("layout"),
|
|
448
|
-
rowPath:
|
|
449
|
-
role:
|
|
450
|
-
values: t.array(
|
|
448
|
+
rowPath: v,
|
|
449
|
+
role: we,
|
|
450
|
+
values: t.array(re).readonly()
|
|
451
451
|
}).strict(),
|
|
452
452
|
t.object({
|
|
453
453
|
kind: t.literal("flat"),
|
|
454
|
-
rowPath:
|
|
455
|
-
columnPath:
|
|
456
|
-
values: t.array(
|
|
454
|
+
rowPath: v,
|
|
455
|
+
columnPath: v,
|
|
456
|
+
values: t.array(re).readonly()
|
|
457
457
|
}).strict()
|
|
458
|
-
]),
|
|
458
|
+
]), bn = t.discriminatedUnion("kind", [
|
|
459
459
|
t.object({
|
|
460
460
|
kind: t.literal("layout"),
|
|
461
|
-
layout:
|
|
462
|
-
next:
|
|
461
|
+
layout: _t,
|
|
462
|
+
next: b
|
|
463
463
|
}).strict(),
|
|
464
464
|
t.object({
|
|
465
465
|
kind: t.literal("rows"),
|
|
466
|
-
rows: t.array(
|
|
467
|
-
next:
|
|
466
|
+
rows: t.array(wt).readonly(),
|
|
467
|
+
next: b.nullable()
|
|
468
468
|
}).strict()
|
|
469
|
-
]),
|
|
470
|
-
Ue,
|
|
469
|
+
]), kt = t.union([
|
|
471
470
|
qe,
|
|
472
471
|
Me,
|
|
473
472
|
Be,
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
Ge,
|
|
474
|
+
_e
|
|
475
|
+
]), vt = t.object({
|
|
476
476
|
status: t.enum([
|
|
477
477
|
"not_required",
|
|
478
478
|
"resolved",
|
|
@@ -481,22 +481,22 @@ const Ie = t.object({
|
|
|
481
481
|
"fanout_risk",
|
|
482
482
|
"unknown"
|
|
483
483
|
]),
|
|
484
|
-
requiredSources: t.array(
|
|
484
|
+
requiredSources: t.array(U).optional(),
|
|
485
485
|
relationshipsUsed: t.array(t.string()).optional(),
|
|
486
486
|
missingSources: t.array(t.string()).optional(),
|
|
487
487
|
warnings: t.array(t.string()).optional(),
|
|
488
488
|
message: t.string().optional(),
|
|
489
489
|
recommendedNextStep: t.string().optional(),
|
|
490
490
|
joinPlanSummary: t.object({
|
|
491
|
-
baseSource:
|
|
492
|
-
joinedSources: t.array(
|
|
491
|
+
baseSource: U.optional(),
|
|
492
|
+
joinedSources: t.array(U).optional(),
|
|
493
493
|
joinCount: t.number().optional()
|
|
494
494
|
}).passthrough().optional(),
|
|
495
495
|
fanoutRisk: t.object({
|
|
496
496
|
status: t.enum(["none", "warning", "error", "unknown"]),
|
|
497
497
|
message: t.string().optional()
|
|
498
498
|
}).passthrough().optional()
|
|
499
|
-
}).passthrough(),
|
|
499
|
+
}).passthrough(), se = t.enum([
|
|
500
500
|
"ambiguous_fields",
|
|
501
501
|
"empty_result",
|
|
502
502
|
"missing_grounded_fields",
|
|
@@ -506,7 +506,7 @@ const Ie = t.object({
|
|
|
506
506
|
"presentation_incomplete",
|
|
507
507
|
"query_validation_failed",
|
|
508
508
|
"unsafe_join"
|
|
509
|
-
]),
|
|
509
|
+
]), ke = t.object({
|
|
510
510
|
version: t.literal(1),
|
|
511
511
|
status: t.enum(["answered", "partial", "blocked"]),
|
|
512
512
|
summary: t.string(),
|
|
@@ -523,7 +523,7 @@ const Ie = t.object({
|
|
|
523
523
|
t.object({
|
|
524
524
|
slotId: t.string().optional(),
|
|
525
525
|
queryId: t.string().optional(),
|
|
526
|
-
reasonCode:
|
|
526
|
+
reasonCode: se,
|
|
527
527
|
message: t.string(),
|
|
528
528
|
missingFields: t.array(t.string()).optional(),
|
|
529
529
|
availableFields: t.array(t.string()).optional(),
|
|
@@ -536,19 +536,19 @@ const Ie = t.object({
|
|
|
536
536
|
),
|
|
537
537
|
semanticModelRecommendations: t.array(
|
|
538
538
|
t.object({
|
|
539
|
-
reasonCode:
|
|
539
|
+
reasonCode: se,
|
|
540
540
|
message: t.string(),
|
|
541
541
|
recommendedNextStep: t.string().optional()
|
|
542
542
|
}).passthrough()
|
|
543
543
|
).optional()
|
|
544
|
-
}).passthrough(),
|
|
544
|
+
}).passthrough(), ve = t.object({
|
|
545
545
|
scope: t.literal("filtered_query"),
|
|
546
|
-
measures: t.record(
|
|
546
|
+
measures: t.record(ze)
|
|
547
547
|
}).passthrough(), Te = t.object({
|
|
548
548
|
answeredObligations: t.array(t.string()),
|
|
549
549
|
missingObligations: t.array(t.string()),
|
|
550
|
-
warnings: t.array(
|
|
551
|
-
}).passthrough(),
|
|
550
|
+
warnings: t.array(Ve).optional()
|
|
551
|
+
}).passthrough(), Ee = t.object({
|
|
552
552
|
intentId: t.string().optional(),
|
|
553
553
|
queryId: t.string().optional(),
|
|
554
554
|
status: t.enum(["answered", "partial", "failed"]),
|
|
@@ -564,26 +564,26 @@ const Ie = t.object({
|
|
|
564
564
|
intent: t.unknown().optional(),
|
|
565
565
|
compiledQuery: t.unknown().optional(),
|
|
566
566
|
fieldsUsed: t.array($).optional(),
|
|
567
|
-
result:
|
|
568
|
-
validation:
|
|
567
|
+
result: kt.optional(),
|
|
568
|
+
validation: le,
|
|
569
569
|
coverage: Te.optional(),
|
|
570
570
|
missingFields: t.array(t.string()).optional(),
|
|
571
571
|
warnings: t.array(t.string()).optional(),
|
|
572
|
-
relationshipDiagnostics:
|
|
573
|
-
diagnosticFeedback:
|
|
574
|
-
population:
|
|
572
|
+
relationshipDiagnostics: vt.optional(),
|
|
573
|
+
diagnosticFeedback: ke.optional(),
|
|
574
|
+
population: ve.optional(),
|
|
575
575
|
metadata: t.record(t.string(), t.unknown()).optional()
|
|
576
|
-
}).passthrough(), Tt =
|
|
577
|
-
function
|
|
576
|
+
}).passthrough(), Tt = Ee;
|
|
577
|
+
function Et(e) {
|
|
578
578
|
switch (e) {
|
|
579
579
|
case "boolean":
|
|
580
580
|
return t.boolean().optional();
|
|
581
581
|
case "compactExecutionFieldArray":
|
|
582
|
-
return t.array(
|
|
582
|
+
return t.array(Xe).optional();
|
|
583
583
|
case "coverage":
|
|
584
584
|
return Te.optional();
|
|
585
585
|
case "diagnosticFeedback":
|
|
586
|
-
return
|
|
586
|
+
return ke.optional();
|
|
587
587
|
case "executionFieldArray":
|
|
588
588
|
return t.array($).optional();
|
|
589
589
|
case "executionResult":
|
|
@@ -591,11 +591,11 @@ function vt(e) {
|
|
|
591
591
|
case "number":
|
|
592
592
|
return t.number().finite().optional();
|
|
593
593
|
case "population":
|
|
594
|
-
return
|
|
594
|
+
return ve.optional();
|
|
595
595
|
case "record":
|
|
596
|
-
return
|
|
596
|
+
return Ke.optional();
|
|
597
597
|
case "recordArray":
|
|
598
|
-
return
|
|
598
|
+
return We.optional();
|
|
599
599
|
case "responseDetail":
|
|
600
600
|
return t.enum(["compact", "standard", "debug"]).optional();
|
|
601
601
|
case "string":
|
|
@@ -607,54 +607,54 @@ function vt(e) {
|
|
|
607
607
|
case "unknownArray":
|
|
608
608
|
return t.array(t.unknown()).optional();
|
|
609
609
|
case "validationResult":
|
|
610
|
-
return
|
|
610
|
+
return le.optional();
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
|
-
const
|
|
613
|
+
const Rt = Object.fromEntries(
|
|
614
614
|
Object.entries(Y).map(
|
|
615
|
-
([e, n]) => [e,
|
|
615
|
+
([e, n]) => [e, Et(n)]
|
|
616
616
|
)
|
|
617
|
-
),
|
|
617
|
+
), Ct = t.object(Rt).strict(), Nt = new Set(
|
|
618
618
|
Object.keys(Y)
|
|
619
619
|
);
|
|
620
|
-
function
|
|
620
|
+
function An() {
|
|
621
621
|
return Object.keys(
|
|
622
622
|
Y
|
|
623
623
|
);
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
return
|
|
625
|
+
function Ot(e) {
|
|
626
|
+
return Nt.has(e);
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function In(e) {
|
|
629
629
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
630
630
|
throw new Error("Semaphor analyze result must be an object.");
|
|
631
631
|
const a = Object.keys(e).filter(
|
|
632
|
-
(r) => !
|
|
632
|
+
(r) => !Ot(r)
|
|
633
633
|
);
|
|
634
634
|
if (a.length)
|
|
635
635
|
throw new Error(
|
|
636
636
|
`Semaphor analyze result contains unsupported top-level field(s): ${a.join(", ")}.`
|
|
637
637
|
);
|
|
638
|
-
return
|
|
638
|
+
return Ct.parse(e);
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
function
|
|
640
|
+
const Re = 100, L = "selection:";
|
|
641
|
+
function Ce(e) {
|
|
642
642
|
return [
|
|
643
|
-
|
|
644
|
-
|
|
643
|
+
pe(e.source),
|
|
644
|
+
et(e.name),
|
|
645
645
|
e.sourceField ?? ""
|
|
646
646
|
].join("::");
|
|
647
647
|
}
|
|
648
|
-
function
|
|
649
|
-
return `${
|
|
648
|
+
function _n(e) {
|
|
649
|
+
return `${L}${e}`;
|
|
650
650
|
}
|
|
651
|
-
function
|
|
652
|
-
return e.startsWith(
|
|
651
|
+
function xt(e) {
|
|
652
|
+
return e.startsWith(L) && e.length > L.length;
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
return
|
|
654
|
+
function wn(e) {
|
|
655
|
+
return xt(e) ? e.slice(L.length) : void 0;
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function Ne(e) {
|
|
658
658
|
if (!e) return "";
|
|
659
659
|
const n = e.calendar.fiscalCalendar;
|
|
660
660
|
return JSON.stringify([
|
|
@@ -664,37 +664,37 @@ function Ce(e) {
|
|
|
664
664
|
n ? [n.kind, n.yearStartMonth] : null
|
|
665
665
|
]);
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function Oe(e) {
|
|
668
668
|
return e ? JSON.stringify([e.valueKind, e.tz]) : "";
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function Pt(e) {
|
|
671
671
|
return JSON.stringify([
|
|
672
|
-
|
|
672
|
+
Ce(e.field),
|
|
673
673
|
e.operator,
|
|
674
674
|
e.operator === "isNull" ? null : e.value,
|
|
675
|
-
|
|
676
|
-
|
|
675
|
+
Ne(e.temporalBucket),
|
|
676
|
+
Oe(e.rawTemporal)
|
|
677
677
|
]);
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
return JSON.stringify(e.conditions.map(
|
|
679
|
+
function oe(e) {
|
|
680
|
+
return JSON.stringify(e.conditions.map(Pt).sort());
|
|
681
681
|
}
|
|
682
682
|
function z(e) {
|
|
683
683
|
return JSON.stringify([
|
|
684
|
-
|
|
684
|
+
pe(e.field.source),
|
|
685
685
|
e.field.name,
|
|
686
686
|
e.operator,
|
|
687
687
|
e.operator === "isNull" ? null : e.value,
|
|
688
|
-
|
|
689
|
-
|
|
688
|
+
Ne(e.temporalBucket),
|
|
689
|
+
Oe(e.rawTemporal)
|
|
690
690
|
]);
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function ie(e) {
|
|
693
693
|
return JSON.stringify(
|
|
694
694
|
e.conditions.map(z).sort()
|
|
695
695
|
);
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function kn(e) {
|
|
698
698
|
const n = e.map((a) => a.id);
|
|
699
699
|
if (new Set(n).size !== n.length)
|
|
700
700
|
throw new Error("Data App selections require one active selection per id.");
|
|
@@ -710,8 +710,8 @@ function wn(e) {
|
|
|
710
710
|
)
|
|
711
711
|
})).sort(
|
|
712
712
|
(r, s) => q(
|
|
713
|
-
|
|
714
|
-
|
|
713
|
+
ie(r),
|
|
714
|
+
ie(s)
|
|
715
715
|
)
|
|
716
716
|
)
|
|
717
717
|
})).sort((a, r) => q(a.id, r.id));
|
|
@@ -719,29 +719,29 @@ function wn(e) {
|
|
|
719
719
|
function q(e, n) {
|
|
720
720
|
return e < n ? -1 : e > n ? 1 : 0;
|
|
721
721
|
}
|
|
722
|
-
function
|
|
723
|
-
return
|
|
722
|
+
function vn(e, n) {
|
|
723
|
+
return oe(e) === oe(n);
|
|
724
724
|
}
|
|
725
|
-
const
|
|
725
|
+
const jt = "(Blank)";
|
|
726
726
|
function Tn(e) {
|
|
727
|
-
return e.conditions.map((n) => n.label ? n.label : n.operator === "isNull" || n.value === null ?
|
|
727
|
+
return e.conditions.map((n) => n.label ? n.label : n.operator === "isNull" || n.value === null ? jt : String(n.value)).join(" · ");
|
|
728
728
|
}
|
|
729
|
-
const
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
]),
|
|
729
|
+
const Ft = t.union([
|
|
730
|
+
$e,
|
|
731
|
+
Ze
|
|
732
|
+
]), Lt = t.object({
|
|
733
733
|
name: t.string().min(1),
|
|
734
|
-
source:
|
|
734
|
+
source: Ft,
|
|
735
735
|
dataType: t.enum(["string", "number", "boolean", "date", "datetime"]),
|
|
736
736
|
sourceField: t.string().min(1).optional(),
|
|
737
737
|
nativeDataType: t.string().min(1).optional()
|
|
738
|
-
}).strict(),
|
|
739
|
-
field:
|
|
738
|
+
}).strict(), Ut = t.object({
|
|
739
|
+
field: Lt,
|
|
740
740
|
operator: t.enum(["=", "isNull"]),
|
|
741
741
|
value: t.union([t.string(), t.number().finite(), t.null()]),
|
|
742
742
|
label: t.string().optional(),
|
|
743
|
-
temporalBucket:
|
|
744
|
-
rawTemporal:
|
|
743
|
+
temporalBucket: de.optional(),
|
|
744
|
+
rawTemporal: ue.optional()
|
|
745
745
|
}).strict().superRefine((e, n) => {
|
|
746
746
|
e.operator === "isNull" != (e.value === null) && n.addIssue({
|
|
747
747
|
code: t.ZodIssueCode.custom,
|
|
@@ -749,47 +749,47 @@ const jt = t.union([
|
|
|
749
749
|
path: ["value"]
|
|
750
750
|
});
|
|
751
751
|
}), Dt = t.object({
|
|
752
|
-
conditions: t.array(
|
|
752
|
+
conditions: t.array(Ut).min(1)
|
|
753
753
|
}).strict().superRefine((e, n) => {
|
|
754
|
-
const a = e.conditions.map((r) =>
|
|
754
|
+
const a = e.conditions.map((r) => Ce(r.field));
|
|
755
755
|
new Set(a).size !== a.length && n.addIssue({
|
|
756
756
|
code: t.ZodIssueCode.custom,
|
|
757
757
|
message: "A tuple holds one condition per field.",
|
|
758
758
|
path: ["conditions"]
|
|
759
759
|
});
|
|
760
|
-
}),
|
|
760
|
+
}), En = t.object({
|
|
761
761
|
kind: t.literal("selection"),
|
|
762
762
|
sourceCardId: t.string().min(1),
|
|
763
|
-
tuples: t.array(Dt).min(1).max(
|
|
764
|
-
}).strict(),
|
|
765
|
-
field:
|
|
763
|
+
tuples: t.array(Dt).min(1).max(Re)
|
|
764
|
+
}).strict(), qt = t.object({
|
|
765
|
+
field: Ye,
|
|
766
766
|
operator: t.enum(["=", "isNull"]),
|
|
767
767
|
value: t.union([t.string(), t.number().finite(), t.null()]),
|
|
768
|
-
temporalBucket:
|
|
769
|
-
rawTemporal:
|
|
768
|
+
temporalBucket: de.optional(),
|
|
769
|
+
rawTemporal: ue.optional()
|
|
770
770
|
}).strict().superRefine((e, n) => {
|
|
771
771
|
e.operator === "isNull" != (e.value === null) && n.addIssue({
|
|
772
772
|
code: t.ZodIssueCode.custom,
|
|
773
773
|
message: "isNull carries a null value, and only isNull does.",
|
|
774
774
|
path: ["value"]
|
|
775
775
|
});
|
|
776
|
-
}),
|
|
777
|
-
conditions: t.array(
|
|
776
|
+
}), Mt = t.object({
|
|
777
|
+
conditions: t.array(qt).min(1)
|
|
778
778
|
}).strict().superRefine((e, n) => {
|
|
779
779
|
for (let a = 0; a < e.conditions.length; a += 1) {
|
|
780
780
|
const r = e.conditions[a];
|
|
781
781
|
e.conditions.findIndex(
|
|
782
|
-
(c,
|
|
782
|
+
(c, o) => o < a && Je(c.field, r.field)
|
|
783
783
|
) !== -1 && n.addIssue({
|
|
784
784
|
code: t.ZodIssueCode.custom,
|
|
785
785
|
message: "A selection tuple can contain only one condition per field.",
|
|
786
786
|
path: ["conditions", a, "field"]
|
|
787
787
|
});
|
|
788
788
|
}
|
|
789
|
-
}),
|
|
789
|
+
}), Rn = t.object({
|
|
790
790
|
id: t.string().min(1),
|
|
791
|
-
tuples: t.array(
|
|
792
|
-
}).strict(),
|
|
791
|
+
tuples: t.array(Mt).min(1).max(Re)
|
|
792
|
+
}).strict(), xe = {
|
|
793
793
|
COUNT: "count",
|
|
794
794
|
COUNTIF: "count",
|
|
795
795
|
COUNT_IF: "count",
|
|
@@ -853,16 +853,16 @@ const jt = t.union([
|
|
|
853
853
|
COLLECT_SET: "other",
|
|
854
854
|
FIRST: "other",
|
|
855
855
|
LAST: "other"
|
|
856
|
-
},
|
|
857
|
-
function
|
|
856
|
+
}, Bt = /(?:_AGG$|^APPROX_[A-Z0-9_]+$|^COUNT_DISTINCT$|^HLL_(?:COUNT|ESTIMATE)$|^REGR_[A-Z_]+$)/;
|
|
857
|
+
function Gt(e) {
|
|
858
858
|
const n = e.toUpperCase();
|
|
859
|
-
return n in
|
|
859
|
+
return n in xe || Bt.test(n);
|
|
860
860
|
}
|
|
861
|
-
function
|
|
862
|
-
const a =
|
|
861
|
+
function Pe(e, n = !1) {
|
|
862
|
+
const a = xe[e.toUpperCase()] ?? "other";
|
|
863
863
|
return n ? a === "count" || a === "count_distinct" ? "count_distinct" : a === "min" || a === "max" ? a : "repeat_safe_other" : a;
|
|
864
864
|
}
|
|
865
|
-
const
|
|
865
|
+
const zt = /* @__PURE__ */ new Set([
|
|
866
866
|
"NULLIF",
|
|
867
867
|
"COALESCE",
|
|
868
868
|
"IFNULL",
|
|
@@ -877,7 +877,7 @@ const Gt = /* @__PURE__ */ new Set([
|
|
|
877
877
|
"CAST",
|
|
878
878
|
"TRY_CAST",
|
|
879
879
|
"SAFE_CAST"
|
|
880
|
-
]),
|
|
880
|
+
]), Vt = /* @__PURE__ */ new Set(["DECIMAL", "NUMERIC", "INTEGER", "INT", "BIGINT", "FLOAT", "DOUBLE", "REAL", "VARCHAR", "TEXT"]), ce = /[A-Za-z_]/, Wt = /[A-Za-z0-9_]/;
|
|
881
881
|
function V(e, n) {
|
|
882
882
|
const a = e[n];
|
|
883
883
|
let r = n + 1;
|
|
@@ -893,7 +893,7 @@ function V(e, n) {
|
|
|
893
893
|
}
|
|
894
894
|
return r;
|
|
895
895
|
}
|
|
896
|
-
function
|
|
896
|
+
function x(e, n) {
|
|
897
897
|
let a = 0, r = n;
|
|
898
898
|
for (; r < e.length; ) {
|
|
899
899
|
const s = e[r];
|
|
@@ -907,145 +907,148 @@ function P(e, n) {
|
|
|
907
907
|
}
|
|
908
908
|
return e.length;
|
|
909
909
|
}
|
|
910
|
-
function
|
|
910
|
+
function F(e, n) {
|
|
911
911
|
let a = n;
|
|
912
912
|
for (; a < e.length && /\s/.test(e[a]); ) a += 1;
|
|
913
913
|
return a;
|
|
914
914
|
}
|
|
915
915
|
function M(e, n) {
|
|
916
916
|
let a = n + 1;
|
|
917
|
-
for (; a < e.length &&
|
|
917
|
+
for (; a < e.length && Wt.test(e[a]); ) a += 1;
|
|
918
918
|
return a;
|
|
919
919
|
}
|
|
920
|
-
const
|
|
921
|
-
function
|
|
922
|
-
return Array.from(e.matchAll(
|
|
920
|
+
const Kt = /\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
921
|
+
function Xt(e) {
|
|
922
|
+
return Array.from(e.matchAll(Kt), (n) => n[1]);
|
|
923
923
|
}
|
|
924
924
|
function W(e, n = /* @__PURE__ */ new Set()) {
|
|
925
|
-
const a = [], r = [];
|
|
926
|
-
let
|
|
927
|
-
for (;
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
930
|
-
const
|
|
931
|
-
|
|
925
|
+
const a = [], r = [], s = [];
|
|
926
|
+
let c = !1, o = "", m = !0, d = 0;
|
|
927
|
+
for (; d < e.length; ) {
|
|
928
|
+
const i = e[d];
|
|
929
|
+
if (i === "'" || i === '"') {
|
|
930
|
+
const l = V(e, d);
|
|
931
|
+
o += "'s'", i !== "'" && (m = !1), d = l;
|
|
932
932
|
continue;
|
|
933
933
|
}
|
|
934
|
-
if (
|
|
935
|
-
const
|
|
936
|
-
if (
|
|
937
|
-
const
|
|
938
|
-
r.push(
|
|
934
|
+
if (i === "{") {
|
|
935
|
+
const l = e.indexOf("}", d);
|
|
936
|
+
if (l > d) {
|
|
937
|
+
const p = e.slice(d + 1, l);
|
|
938
|
+
r.push(p), n.has(p) || (m = !1), o += `#${p}`, d = l + 1;
|
|
939
939
|
continue;
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
if (
|
|
943
|
-
const
|
|
944
|
-
if (e[
|
|
945
|
-
let g =
|
|
946
|
-
const
|
|
947
|
-
let
|
|
948
|
-
const
|
|
949
|
-
let
|
|
950
|
-
for (let
|
|
951
|
-
e[
|
|
952
|
-
const
|
|
953
|
-
W(
|
|
954
|
-
let
|
|
942
|
+
if (ce.test(i)) {
|
|
943
|
+
const l = M(e, d), p = e.slice(d, l), y = F(e, l);
|
|
944
|
+
if (e[y] === "(" && Gt(p)) {
|
|
945
|
+
let g = x(e, y);
|
|
946
|
+
const j = g - 1;
|
|
947
|
+
let E = g;
|
|
948
|
+
const R = e.slice(y + 1, g - 1);
|
|
949
|
+
let O = R.trim() ? 1 : 0;
|
|
950
|
+
for (let S = y + 1; S < E - 1; S++)
|
|
951
|
+
e[S] === "'" || e[S] === '"' ? S = V(e, S) - 1 : e[S] === "(" ? S = x(e, S) - 1 : e[S] === "," && O++;
|
|
952
|
+
const A = /^\s*DISTINCT\b/i.test(R);
|
|
953
|
+
W(A ? R.replace(/^\s*DISTINCT\b/i, "") : R).calls.length > 0 && (c = !0);
|
|
954
|
+
let k = !1, w = !1;
|
|
955
|
+
const C = [];
|
|
955
956
|
for (; ; ) {
|
|
956
|
-
const
|
|
957
|
-
if (!
|
|
958
|
-
const
|
|
959
|
-
if (
|
|
960
|
-
const
|
|
961
|
-
if (e.slice(
|
|
962
|
-
g =
|
|
957
|
+
const S = F(e, g);
|
|
958
|
+
if (!ce.test(e[S] || "")) break;
|
|
959
|
+
const u = M(e, S), h = e.slice(S, u).toUpperCase(), I = F(e, u);
|
|
960
|
+
if (h === "WITHIN") {
|
|
961
|
+
const N = M(e, I), ee = F(e, N);
|
|
962
|
+
if (e.slice(I, N).toUpperCase() === "GROUP" && e[ee] === "(") {
|
|
963
|
+
g = x(e, ee), E = g;
|
|
963
964
|
continue;
|
|
964
965
|
}
|
|
965
966
|
}
|
|
966
|
-
if ((
|
|
967
|
-
|
|
967
|
+
if ((h === "FILTER" || h === "OVER") && e[I] === "(") {
|
|
968
|
+
k = k || h === "OVER", w = w || h === "FILTER", g = x(e, I), C.push({ kind: h === "OVER" ? "over" : "filter", start: I + 1, end: g - 1 });
|
|
968
969
|
continue;
|
|
969
970
|
}
|
|
970
971
|
break;
|
|
971
972
|
}
|
|
972
973
|
a.push({
|
|
973
|
-
name:
|
|
974
|
-
kind:
|
|
975
|
-
distinct:
|
|
976
|
-
windowed:
|
|
977
|
-
tokens:
|
|
978
|
-
span: { start:
|
|
979
|
-
argumentCount:
|
|
980
|
-
filtered:
|
|
981
|
-
|
|
974
|
+
name: p.toUpperCase(),
|
|
975
|
+
kind: Pe(p, A),
|
|
976
|
+
distinct: A,
|
|
977
|
+
windowed: k,
|
|
978
|
+
tokens: Xt(e.slice(y, g)),
|
|
979
|
+
span: { start: d, end: E, argumentStart: y + 1, argumentEnd: j },
|
|
980
|
+
argumentCount: O,
|
|
981
|
+
filtered: w,
|
|
982
|
+
suffixes: C
|
|
983
|
+
}), o += `@${a.length - 1}`, d = g;
|
|
982
984
|
continue;
|
|
983
985
|
}
|
|
984
|
-
|
|
986
|
+
p.toUpperCase() === "OVER" && e[y] === "(" && s.push({ start: y + 1, end: x(e, y) - 1 }), o += e.slice(d, l), d = l;
|
|
985
987
|
continue;
|
|
986
988
|
}
|
|
987
|
-
/[\s0-9.,()+*/%<>=!|&^-]/.test(
|
|
989
|
+
/[\s0-9.,()+*/%<>=!|&^-]/.test(i) || (m = !1), o += i, d += 1;
|
|
988
990
|
}
|
|
989
991
|
return {
|
|
990
992
|
calls: a,
|
|
991
|
-
nestedAggregate:
|
|
992
|
-
windowed: a.some((
|
|
993
|
+
nestedAggregate: c,
|
|
994
|
+
windowed: a.some((i) => i.windowed),
|
|
993
995
|
tokensOutsideAggregates: r,
|
|
994
|
-
|
|
995
|
-
|
|
996
|
+
windowClauses: s,
|
|
997
|
+
aggregateInputsComplete: m && $t(o, n),
|
|
998
|
+
skeleton: o
|
|
996
999
|
};
|
|
997
1000
|
}
|
|
998
|
-
function
|
|
999
|
-
var
|
|
1001
|
+
function $t(e, n) {
|
|
1002
|
+
var d;
|
|
1000
1003
|
const a = [];
|
|
1001
1004
|
let r = 0;
|
|
1002
1005
|
for (; r < e.length; ) {
|
|
1003
|
-
const
|
|
1004
|
-
if (!
|
|
1005
|
-
if (r +=
|
|
1006
|
-
if (!n.has(
|
|
1006
|
+
const i = e.slice(r), l = (d = /^(\s+|@\d+|#field_\d+|(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?|'s'|[A-Za-z_][A-Za-z0-9_]*|<>|!=|<=|>=|[()+*/%,<>=-])/.exec(i)) == null ? void 0 : d[0];
|
|
1007
|
+
if (!l) return !1;
|
|
1008
|
+
if (r += l.length, l.startsWith("#")) {
|
|
1009
|
+
if (!n.has(l.slice(1))) return !1;
|
|
1007
1010
|
a.push("@input");
|
|
1008
|
-
} else
|
|
1011
|
+
} else l.trim() && a.push(l.toUpperCase());
|
|
1009
1012
|
}
|
|
1010
1013
|
let s = 0;
|
|
1011
|
-
const c = (
|
|
1012
|
-
if (!
|
|
1014
|
+
const c = (i) => a[s] === i && ++s > 0, o = () => {
|
|
1015
|
+
if (!m()) return !1;
|
|
1013
1016
|
for (; ["+", "-", "*", "/", "%", "<", ">", "<=", ">=", "=", "<>", "!=", "AND", "OR", "IS"].includes(a[s]); )
|
|
1014
|
-
if (a[s++] === "IS" && c("NOT"), !
|
|
1017
|
+
if (a[s++] === "IS" && c("NOT"), !m()) return !1;
|
|
1015
1018
|
return !0;
|
|
1016
|
-
},
|
|
1017
|
-
const
|
|
1018
|
-
if (!
|
|
1019
|
-
if (["+", "-", "NOT"].includes(
|
|
1020
|
-
return s++,
|
|
1021
|
-
if (c("(")) return
|
|
1019
|
+
}, m = () => {
|
|
1020
|
+
const i = a[s];
|
|
1021
|
+
if (!i) return !1;
|
|
1022
|
+
if (["+", "-", "NOT"].includes(i))
|
|
1023
|
+
return s++, m();
|
|
1024
|
+
if (c("(")) return o() && c(")");
|
|
1022
1025
|
if (c("CASE")) {
|
|
1023
|
-
if (a[s] !== "WHEN" && !
|
|
1024
|
-
let
|
|
1026
|
+
if (a[s] !== "WHEN" && !o()) return !1;
|
|
1027
|
+
let l = 0;
|
|
1025
1028
|
for (; c("WHEN"); ) {
|
|
1026
|
-
if (!
|
|
1027
|
-
|
|
1029
|
+
if (!o() || !c("THEN") || !o()) return !1;
|
|
1030
|
+
l++;
|
|
1028
1031
|
}
|
|
1029
|
-
return c("ELSE") && !
|
|
1032
|
+
return c("ELSE") && !o() ? !1 : l > 0 && c("END");
|
|
1030
1033
|
}
|
|
1031
|
-
if (
|
|
1034
|
+
if (i.startsWith("@") || i === "'S'" || ["NULL", "TRUE", "FALSE"].includes(i) || /^[0-9.]/.test(i))
|
|
1032
1035
|
return s++, !0;
|
|
1033
|
-
if (!
|
|
1034
|
-
if (["CAST", "TRY_CAST", "SAFE_CAST"].includes(
|
|
1035
|
-
if (!c("AS") || !
|
|
1036
|
+
if (!zt.has(i) || (s++, !c("(") || !o())) return !1;
|
|
1037
|
+
if (["CAST", "TRY_CAST", "SAFE_CAST"].includes(i)) {
|
|
1038
|
+
if (!c("AS") || !Vt.has(a[s++]) || (c("PRECISION"), c("(") && (!/^\d+$/.test(a[s++] || "") || c(",") && !/^\d+$/.test(a[s++] || "") || !c(")"))))
|
|
1036
1039
|
return !1;
|
|
1037
1040
|
} else
|
|
1038
|
-
for (; c(","); ) if (!
|
|
1041
|
+
for (; c(","); ) if (!o()) return !1;
|
|
1039
1042
|
return c(")");
|
|
1040
1043
|
};
|
|
1041
|
-
return
|
|
1044
|
+
return o() && s === a.length;
|
|
1042
1045
|
}
|
|
1043
|
-
function
|
|
1046
|
+
function Cn(e, n) {
|
|
1044
1047
|
if (n.argumentCount !== 1 || n.windowed || n.filtered) return;
|
|
1045
1048
|
const a = e.slice(n.span.argumentStart, n.span.argumentEnd).trim();
|
|
1046
1049
|
return n.distinct ? a.replace(/^DISTINCT\s*/i, "") : a;
|
|
1047
1050
|
}
|
|
1048
|
-
function
|
|
1051
|
+
function Zt(e) {
|
|
1049
1052
|
const n = [];
|
|
1050
1053
|
let a = 0;
|
|
1051
1054
|
for (; a < e.length; ) {
|
|
@@ -1089,70 +1092,70 @@ function $t(e) {
|
|
|
1089
1092
|
}
|
|
1090
1093
|
return n;
|
|
1091
1094
|
}
|
|
1092
|
-
function
|
|
1093
|
-
const n =
|
|
1094
|
-
if (n.some((
|
|
1095
|
+
function Yt(e) {
|
|
1096
|
+
const n = Zt(e), a = n.some((i) => i.type === "op" && i.value === "/");
|
|
1097
|
+
if (n.some((i) => i.type === "other"))
|
|
1095
1098
|
return { kind: "other", hasDivision: a };
|
|
1096
1099
|
let r = 0, s = !0;
|
|
1097
1100
|
const c = () => {
|
|
1098
|
-
let
|
|
1101
|
+
let i = [], l, p = !0;
|
|
1099
1102
|
for (; ; ) {
|
|
1100
1103
|
if (!p) {
|
|
1101
|
-
const
|
|
1102
|
-
if (!(
|
|
1104
|
+
const g = n[r];
|
|
1105
|
+
if (!(g && g.type === "op" && (g.value === "+" || g.value === "-"))) break;
|
|
1103
1106
|
r += 1;
|
|
1104
1107
|
}
|
|
1105
|
-
const
|
|
1106
|
-
if (!
|
|
1107
|
-
|
|
1108
|
+
const y = o();
|
|
1109
|
+
if (!y) return null;
|
|
1110
|
+
l === void 0 ? l = y.degree : l !== y.degree && (s = !1), i = i.concat(y.units), p = !1;
|
|
1108
1111
|
}
|
|
1109
|
-
return { degree:
|
|
1110
|
-
},
|
|
1111
|
-
let
|
|
1112
|
-
if (!
|
|
1112
|
+
return { degree: l ?? 0, units: i };
|
|
1113
|
+
}, o = () => {
|
|
1114
|
+
let i = m();
|
|
1115
|
+
if (!i) return null;
|
|
1113
1116
|
for (; ; ) {
|
|
1114
|
-
const
|
|
1115
|
-
if (!(
|
|
1117
|
+
const l = n[r];
|
|
1118
|
+
if (!(l && l.type === "op" && (l.value === "*" || l.value === "/"))) break;
|
|
1116
1119
|
r += 1;
|
|
1117
|
-
const p =
|
|
1120
|
+
const p = m();
|
|
1118
1121
|
if (!p) return null;
|
|
1119
|
-
|
|
1122
|
+
l.value === "/" && p.degree > 0 && (s = !1), i.degree + p.degree > 1 && (s = !1), i = { degree: i.degree + p.degree, units: i.units.concat(p.units) };
|
|
1120
1123
|
}
|
|
1121
|
-
return
|
|
1122
|
-
},
|
|
1123
|
-
var
|
|
1124
|
-
const
|
|
1125
|
-
if (!
|
|
1126
|
-
if (
|
|
1127
|
-
return r += 1,
|
|
1128
|
-
if (
|
|
1129
|
-
return r += 1, { degree: 1, units: [
|
|
1130
|
-
if (
|
|
1124
|
+
return i;
|
|
1125
|
+
}, m = () => {
|
|
1126
|
+
var l;
|
|
1127
|
+
const i = n[r];
|
|
1128
|
+
if (!i) return null;
|
|
1129
|
+
if (i.type === "op" && i.value === "-")
|
|
1130
|
+
return r += 1, m();
|
|
1131
|
+
if (i.type === "unit")
|
|
1132
|
+
return r += 1, { degree: 1, units: [i.unit] };
|
|
1133
|
+
if (i.type === "number")
|
|
1131
1134
|
return r += 1, { degree: 0, units: [] };
|
|
1132
|
-
if (
|
|
1135
|
+
if (i.type === "open") {
|
|
1133
1136
|
r += 1;
|
|
1134
1137
|
const p = c();
|
|
1135
|
-
return !p || ((
|
|
1138
|
+
return !p || ((l = n[r]) == null ? void 0 : l.type) !== "close" ? null : (r += 1, p);
|
|
1136
1139
|
}
|
|
1137
1140
|
return null;
|
|
1138
|
-
},
|
|
1139
|
-
return !
|
|
1141
|
+
}, d = c();
|
|
1142
|
+
return !d || r !== n.length ? { kind: "other", hasDivision: a } : d.units.length === 1 && d.degree === 1 && s && !a && n.filter((l) => l.type !== "open" && l.type !== "close").length === 1 ? { kind: "single", unit: d.units[0] } : s && d.degree === 1 ? { kind: "linear", units: d.units } : { kind: "other", hasDivision: a };
|
|
1140
1143
|
}
|
|
1141
|
-
const
|
|
1142
|
-
executionInstant: t.string().refine((e) =>
|
|
1144
|
+
const Ht = t.object({ key: t.string().min(1), nativeText: t.string().nullable() }).strict(), Qt = t.object({
|
|
1145
|
+
executionInstant: t.string().refine((e) => tt(e) !== null, {
|
|
1143
1146
|
message: "executionInstant must be an ISO instant"
|
|
1144
1147
|
}),
|
|
1145
|
-
dataAnchors: t.array(
|
|
1148
|
+
dataAnchors: t.array(Ht).default([])
|
|
1146
1149
|
}).strict().refine(
|
|
1147
1150
|
(e) => new Set(e.dataAnchors.map((n) => n.key)).size === e.dataAnchors.length,
|
|
1148
1151
|
{ message: "dataAnchors keys must be unique", path: ["dataAnchors"] }
|
|
1149
1152
|
);
|
|
1150
|
-
function
|
|
1153
|
+
function Nn(e) {
|
|
1151
1154
|
if (e == null) return;
|
|
1152
|
-
const n =
|
|
1155
|
+
const n = Qt.safeParse(e);
|
|
1153
1156
|
return n.success ? n.data : void 0;
|
|
1154
1157
|
}
|
|
1155
|
-
const
|
|
1158
|
+
const je = /* @__PURE__ */ new Set([
|
|
1156
1159
|
"min",
|
|
1157
1160
|
"max",
|
|
1158
1161
|
"count_distinct",
|
|
@@ -1160,9 +1163,9 @@ const Pe = /* @__PURE__ */ new Set([
|
|
|
1160
1163
|
]);
|
|
1161
1164
|
function K(e) {
|
|
1162
1165
|
if (!(!e || !e.trim()))
|
|
1163
|
-
return
|
|
1166
|
+
return Pe(e);
|
|
1164
1167
|
}
|
|
1165
|
-
function
|
|
1168
|
+
function Fe(e) {
|
|
1166
1169
|
switch (e) {
|
|
1167
1170
|
case "count":
|
|
1168
1171
|
case "sum":
|
|
@@ -1180,7 +1183,7 @@ function je(e) {
|
|
|
1180
1183
|
return { kind: "none", reason: "other" };
|
|
1181
1184
|
}
|
|
1182
1185
|
}
|
|
1183
|
-
function
|
|
1186
|
+
function Jt(e) {
|
|
1184
1187
|
var n, a;
|
|
1185
1188
|
return ((n = e.derivedField) == null ? void 0 : n.computeStage) || ((a = e.calculatedFormula) == null ? void 0 : a.computeStage);
|
|
1186
1189
|
}
|
|
@@ -1193,15 +1196,15 @@ const Q = {
|
|
|
1193
1196
|
outputType: "numeric",
|
|
1194
1197
|
identity: "unresolved",
|
|
1195
1198
|
unresolved: !0
|
|
1196
|
-
},
|
|
1199
|
+
}, Le = { ...Q, stage: "row" };
|
|
1197
1200
|
function X(e) {
|
|
1198
1201
|
return {
|
|
1199
1202
|
stage: "row",
|
|
1200
1203
|
outer: e,
|
|
1201
1204
|
calls: [{ kind: e, distinct: e === "count_distinct" }],
|
|
1202
1205
|
windowed: !1,
|
|
1203
|
-
repeatSafe:
|
|
1204
|
-
reaggregation:
|
|
1206
|
+
repeatSafe: je.has(e),
|
|
1207
|
+
reaggregation: Fe(e),
|
|
1205
1208
|
outputType: e === "min" || e === "max" ? "input" : "numeric",
|
|
1206
1209
|
identity: e,
|
|
1207
1210
|
unresolved: !1
|
|
@@ -1212,7 +1215,7 @@ function B(e, n) {
|
|
|
1212
1215
|
const a = (r = n.derivedField) == null ? void 0 : r.aggregationBehavior;
|
|
1213
1216
|
return !a || e.unresolved ? e : a === "additive" ? e.reaggregation.kind === "additive" ? e : { ...e, reaggregation: { kind: "additive" } } : { ...e, reaggregation: { kind: "none", reason: "declared" } };
|
|
1214
1217
|
}
|
|
1215
|
-
function
|
|
1218
|
+
function en(e, n) {
|
|
1216
1219
|
if (!e) return Q;
|
|
1217
1220
|
if (typeof e.expression == "string" && e.expression.trim()) {
|
|
1218
1221
|
const r = J(e, n + 1);
|
|
@@ -1221,189 +1224,189 @@ function Jt(e, n) {
|
|
|
1221
1224
|
const a = K(e.aggregate);
|
|
1222
1225
|
return a ? X(a) : "raw";
|
|
1223
1226
|
}
|
|
1224
|
-
const
|
|
1227
|
+
const tn = 12;
|
|
1225
1228
|
function J(e, n) {
|
|
1226
|
-
var
|
|
1227
|
-
if (n >
|
|
1229
|
+
var S;
|
|
1230
|
+
if (n > tn) return Q;
|
|
1228
1231
|
const a = typeof e.expression == "string" ? e.expression.trim() : "";
|
|
1229
1232
|
if (!a)
|
|
1230
1233
|
return B(
|
|
1231
1234
|
X(K(e.aggregate) ?? "sum"),
|
|
1232
1235
|
e
|
|
1233
1236
|
);
|
|
1234
|
-
const r = W(a), s = ((
|
|
1235
|
-
const
|
|
1236
|
-
return
|
|
1237
|
-
},
|
|
1237
|
+
const r = W(a), s = ((S = e.calculatedFormula) == null ? void 0 : S.inputFields) || [], c = (u) => {
|
|
1238
|
+
const h = /^field_(\d+)$/.exec(u);
|
|
1239
|
+
return h ? s[Number(h[1])] : void 0;
|
|
1240
|
+
}, o = /* @__PURE__ */ new Map();
|
|
1238
1241
|
for (const u of r.tokensOutsideAggregates)
|
|
1239
|
-
|
|
1240
|
-
const
|
|
1241
|
-
(u) => u.tokens.some((
|
|
1242
|
-
const
|
|
1243
|
-
if (!(
|
|
1244
|
-
const
|
|
1245
|
-
return
|
|
1242
|
+
o.has(u) || o.set(u, en(c(u), n));
|
|
1243
|
+
const m = r.calls.some(
|
|
1244
|
+
(u) => u.tokens.some((h) => {
|
|
1245
|
+
const I = c(h);
|
|
1246
|
+
if (!(I != null && I.expression)) return !1;
|
|
1247
|
+
const N = J(I, n + 1);
|
|
1248
|
+
return N !== "row_input" && (N.unresolved || N.stage === "aggregate");
|
|
1246
1249
|
})
|
|
1247
|
-
),
|
|
1250
|
+
), d = Array.from(o.values()).filter(
|
|
1248
1251
|
(u) => u !== "raw"
|
|
1249
|
-
),
|
|
1250
|
-
[...
|
|
1251
|
-
([u,
|
|
1252
|
+
), i = Array.from(o.values()).some((u) => u === "raw"), l = r.calls.length > 0 || d.length > 0 || Jt(e) === "aggregate" || !!e.isPreAggregated, p = new Set(
|
|
1253
|
+
[...o].filter(
|
|
1254
|
+
([u, h]) => h === "raw" ? !l && !!c(u) : !h.unresolved
|
|
1252
1255
|
).map(([u]) => u)
|
|
1253
|
-
),
|
|
1254
|
-
if (!
|
|
1255
|
-
if (!
|
|
1256
|
+
), y = W(a, p).aggregateInputsComplete;
|
|
1257
|
+
if (!l) {
|
|
1258
|
+
if (!y) return Le;
|
|
1256
1259
|
const u = K(e.aggregate);
|
|
1257
1260
|
return u ? B(X(u), e) : "row_input";
|
|
1258
1261
|
}
|
|
1259
|
-
const
|
|
1262
|
+
const g = !y || i || r.nestedAggregate || m || d.some((u) => u.unresolved) || r.calls.length === 0 && d.length === 0, j = [
|
|
1260
1263
|
...r.calls.map((u) => ({ kind: u.kind, distinct: u.distinct })),
|
|
1261
|
-
...
|
|
1262
|
-
],
|
|
1264
|
+
...d.flatMap((u) => u.calls)
|
|
1265
|
+
], E = r.windowed || d.some((u) => u.windowed), R = !g && !E && j.every((u) => je.has(u.kind)), O = (u) => {
|
|
1263
1266
|
if (u.kind === "call") {
|
|
1264
|
-
const
|
|
1265
|
-
return
|
|
1267
|
+
const I = r.calls[u.index];
|
|
1268
|
+
return I ? Fe(I.kind) : { kind: "none", reason: "unresolved" };
|
|
1266
1269
|
}
|
|
1267
|
-
const
|
|
1268
|
-
return
|
|
1269
|
-
},
|
|
1270
|
-
let
|
|
1271
|
-
if (
|
|
1272
|
-
|
|
1273
|
-
else if (
|
|
1274
|
-
|
|
1275
|
-
else if (
|
|
1276
|
-
if (
|
|
1277
|
-
const u = r.calls[
|
|
1278
|
-
|
|
1270
|
+
const h = o.get(u.token);
|
|
1271
|
+
return h && h !== "raw" ? h.reaggregation : { kind: "none", reason: "unresolved" };
|
|
1272
|
+
}, A = Yt(r.skeleton);
|
|
1273
|
+
let k, w, C = "numeric";
|
|
1274
|
+
if (g)
|
|
1275
|
+
k = { kind: "none", reason: "unresolved" }, w = "unresolved";
|
|
1276
|
+
else if (E)
|
|
1277
|
+
k = { kind: "none", reason: "window" }, w = "expression";
|
|
1278
|
+
else if (A.kind === "single")
|
|
1279
|
+
if (k = O(A.unit), A.unit.kind === "call") {
|
|
1280
|
+
const u = r.calls[A.unit.index];
|
|
1281
|
+
w = u.kind, (u.kind === "min" || u.kind === "max") && (C = "input");
|
|
1279
1282
|
} else {
|
|
1280
|
-
const u =
|
|
1281
|
-
|
|
1283
|
+
const u = o.get(A.unit.token);
|
|
1284
|
+
w = u.identity, C = u.outputType;
|
|
1282
1285
|
}
|
|
1283
|
-
else
|
|
1286
|
+
else A.kind === "linear" ? (k = A.units.every((h) => O(h).kind === "additive") ? { kind: "additive" } : { kind: "none", reason: "other" }, w = "linear") : (k = { kind: "none", reason: A.hasDivision ? "ratio" : "other" }, w = A.hasDivision ? "ratio" : "expression");
|
|
1284
1287
|
return B(
|
|
1285
1288
|
{
|
|
1286
1289
|
stage: "aggregate",
|
|
1287
|
-
calls:
|
|
1288
|
-
windowed:
|
|
1289
|
-
repeatSafe:
|
|
1290
|
-
reaggregation:
|
|
1291
|
-
outputType:
|
|
1292
|
-
identity:
|
|
1293
|
-
unresolved:
|
|
1290
|
+
calls: j,
|
|
1291
|
+
windowed: E,
|
|
1292
|
+
repeatSafe: R,
|
|
1293
|
+
reaggregation: k,
|
|
1294
|
+
outputType: C,
|
|
1295
|
+
identity: w,
|
|
1296
|
+
unresolved: g
|
|
1294
1297
|
},
|
|
1295
1298
|
e
|
|
1296
1299
|
);
|
|
1297
1300
|
}
|
|
1298
|
-
function
|
|
1301
|
+
function nn(e) {
|
|
1299
1302
|
const n = J(e, 0);
|
|
1300
|
-
return n === "row_input" ?
|
|
1303
|
+
return n === "row_input" ? Le : n;
|
|
1301
1304
|
}
|
|
1302
|
-
function
|
|
1303
|
-
const n =
|
|
1305
|
+
function On(e) {
|
|
1306
|
+
const n = nt((e == null ? void 0 : e.dataType) || "number");
|
|
1304
1307
|
if (!e) return n;
|
|
1305
|
-
const a =
|
|
1308
|
+
const a = nn(e);
|
|
1306
1309
|
return a.unresolved || a.outputType === "input" ? n : "number";
|
|
1307
1310
|
}
|
|
1308
|
-
const
|
|
1309
|
-
intent:
|
|
1310
|
-
matrixWindowRequest:
|
|
1311
|
-
}).strict(),
|
|
1311
|
+
const an = t.object({
|
|
1312
|
+
intent: at,
|
|
1313
|
+
matrixWindowRequest: fe
|
|
1314
|
+
}).strict(), rn = t.object({
|
|
1312
1315
|
runtimeFilters: G.innerType().shape.filters,
|
|
1313
1316
|
runtimeSorts: G.innerType().shape.sorts.optional()
|
|
1314
1317
|
});
|
|
1315
|
-
function
|
|
1316
|
-
return
|
|
1318
|
+
function xn(e) {
|
|
1319
|
+
return rn.parse(e);
|
|
1317
1320
|
}
|
|
1318
|
-
const
|
|
1321
|
+
const sn = {
|
|
1319
1322
|
// A window executes a governed statement set, not one compiled query.
|
|
1320
1323
|
compiledQuery: t.never().optional(),
|
|
1321
|
-
intent:
|
|
1324
|
+
intent: an.shape.intent,
|
|
1322
1325
|
resultShape: t.literal("matrix"),
|
|
1323
|
-
result:
|
|
1326
|
+
result: _e.optional(),
|
|
1324
1327
|
metadata: t.object({ rowLimitExceeded: t.boolean(), matrixFailure: H.optional() }).passthrough()
|
|
1325
|
-
},
|
|
1328
|
+
}, on = Ee.extend(sn), Pn = on.superRefine((e, n) => {
|
|
1326
1329
|
e.status === "failed" == !!e.result && n.addIssue({ code: "custom", message: "Only answered or partial Matrix execution carries a window." }), e.result && e.status === "partial" != e.result.window.failures.length > 0 && n.addIssue({ code: "custom", message: "Matrix execution status must match acquired window failures." });
|
|
1327
1330
|
});
|
|
1328
1331
|
export {
|
|
1329
|
-
|
|
1332
|
+
mt as $,
|
|
1330
1333
|
Tn as A,
|
|
1331
|
-
|
|
1332
|
-
|
|
1334
|
+
Lt as B,
|
|
1335
|
+
Ut as C,
|
|
1333
1336
|
Dt as D,
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1337
|
+
En as E,
|
|
1338
|
+
qt as F,
|
|
1339
|
+
Mt as G,
|
|
1340
|
+
Rn as H,
|
|
1341
|
+
Qt as I,
|
|
1342
|
+
Nn as J,
|
|
1343
|
+
Gt as K,
|
|
1344
|
+
Pe as L,
|
|
1342
1345
|
W as M,
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1346
|
+
Cn as N,
|
|
1347
|
+
Yt as O,
|
|
1348
|
+
nn as P,
|
|
1349
|
+
On as Q,
|
|
1350
|
+
he as R,
|
|
1348
1351
|
Y as S,
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1352
|
+
ot as T,
|
|
1353
|
+
it as U,
|
|
1354
|
+
dn as V,
|
|
1355
|
+
mn as W,
|
|
1356
|
+
lt as X,
|
|
1357
|
+
pn as Y,
|
|
1358
|
+
dt as Z,
|
|
1359
|
+
ne as _,
|
|
1360
|
+
vt as a,
|
|
1361
|
+
fe as a0,
|
|
1362
|
+
hn as a1,
|
|
1363
|
+
pt as a2,
|
|
1364
|
+
ht as a3,
|
|
1365
|
+
ft as a4,
|
|
1366
|
+
ae as a5,
|
|
1364
1367
|
H as a6,
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1368
|
+
gt as a7,
|
|
1369
|
+
Ae as a8,
|
|
1370
|
+
yt as a9,
|
|
1371
|
+
fn as aa,
|
|
1372
|
+
gn as ab,
|
|
1373
|
+
St as ac,
|
|
1374
|
+
bt as ad,
|
|
1375
|
+
At as ae,
|
|
1376
|
+
yn as af,
|
|
1377
|
+
Sn as ag,
|
|
1378
|
+
It as ah,
|
|
1379
|
+
_t as ai,
|
|
1380
|
+
re as aj,
|
|
1381
|
+
wt as ak,
|
|
1382
|
+
bn as al,
|
|
1383
|
+
rn as am,
|
|
1384
|
+
xn as an,
|
|
1385
|
+
Pn as ao,
|
|
1386
|
+
an as ap,
|
|
1387
|
+
ke as b,
|
|
1388
|
+
ve as c,
|
|
1386
1389
|
Te as d,
|
|
1387
|
-
|
|
1390
|
+
Ee as e,
|
|
1388
1391
|
Tt as f,
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1392
|
+
An as g,
|
|
1393
|
+
Rt as h,
|
|
1394
|
+
Ot as i,
|
|
1395
|
+
Ct as j,
|
|
1396
|
+
Re as k,
|
|
1397
|
+
Ce as l,
|
|
1398
|
+
_e as m,
|
|
1399
|
+
_n as n,
|
|
1400
|
+
xt as o,
|
|
1401
|
+
In as p,
|
|
1402
|
+
wn as q,
|
|
1403
|
+
Oe as r,
|
|
1404
|
+
kt as s,
|
|
1405
|
+
Ne as t,
|
|
1406
|
+
Pt as u,
|
|
1407
|
+
oe as v,
|
|
1405
1408
|
z as w,
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
+
ie as x,
|
|
1410
|
+
kn as y,
|
|
1411
|
+
vn as z
|
|
1409
1412
|
};
|