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