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
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ah as
|
|
3
|
-
import { r as
|
|
4
|
-
import { M as
|
|
5
|
-
class
|
|
1
|
+
import { a0 as Q, a1 as T, U as _e, a2 as se, Z as V, W as re, T as Te, B as De, a5 as Ae } from "./raw-temporal-value-Dg_MTFF7.js";
|
|
2
|
+
import { ah as Z, ao as C, aq as U, ai as X, ag as p, ap as Ee, av as qe, aj as xe, a6 as K, e as Be, J as ee, q as Fe } from "./validators-Baf3VIf5.js";
|
|
3
|
+
import { a as Le, r as Pe } from "./metric-comparison-B0FR-Q8I.js";
|
|
4
|
+
import { M as He } from "./matrix-operation-contract-DPBj69D8.js";
|
|
5
|
+
class te extends Error {
|
|
6
6
|
constructor(t) {
|
|
7
7
|
super(t), this.name = "RelativeDateUsageError";
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
const { calendar:
|
|
10
|
+
function Me(e, t, n = {}) {
|
|
11
|
+
const a = n.spansBack ?? 0;
|
|
12
|
+
if (a !== 0) return Oe(e, t, a);
|
|
13
|
+
const { calendar: i, now: r } = t;
|
|
14
14
|
switch (e.kind) {
|
|
15
15
|
case "periods": {
|
|
16
|
-
const o =
|
|
16
|
+
const o = oe(e, t);
|
|
17
17
|
return {
|
|
18
|
-
start:
|
|
19
|
-
end: e.toDate ? o :
|
|
18
|
+
start: V(o, e.unit, i, e.from).start,
|
|
19
|
+
end: e.toDate ? o : ce(o, e.unit, i, e.to)
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
case "rolling": {
|
|
23
|
-
const o = e.anchor === "latest_data" ? t.latestData ?? r : r, s =
|
|
23
|
+
const o = e.anchor === "latest_data" ? t.latestData ?? r : r, s = _e[e.unit];
|
|
24
24
|
return {
|
|
25
|
-
start: s === void 0 ?
|
|
25
|
+
start: s === void 0 ? se(o, -e.n, e.unit, i) : new Date(o.getTime() - e.n * s),
|
|
26
26
|
end: o
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
case "monthDay": {
|
|
30
|
-
const o = e.day === "first" ?
|
|
31
|
-
return { start:
|
|
30
|
+
const o = e.day === "first" ? Q(r, "month", i) : T(r, "month", i);
|
|
31
|
+
return { start: Q(o, "day", i), end: T(o, "day", i) };
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function oe(e, t) {
|
|
36
36
|
const { anchor: n } = e;
|
|
37
|
-
return n === "latest_data" ? t.latestData ?? t.now : n === "now" ? t.now : new Date(
|
|
37
|
+
return n === "latest_data" ? t.latestData ?? t.now : n === "now" ? t.now : new Date(Q(t.now, n.lastComplete, t.calendar).getTime() - 1);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return new Date(
|
|
39
|
+
function ce(e, t, n, a) {
|
|
40
|
+
return new Date(V(e, t, n, a).endExclusive.getTime() - 1);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Oe(e, t, n) {
|
|
43
43
|
if (!Number.isInteger(n) || n < 0)
|
|
44
|
-
throw new
|
|
44
|
+
throw new te(`spansBack must be a whole number of spans, got ${n}.`);
|
|
45
45
|
if (e.kind !== "periods" || typeof e.anchor != "object")
|
|
46
|
-
throw new
|
|
47
|
-
const { calendar:
|
|
48
|
-
if (
|
|
49
|
-
return { start: s, end:
|
|
50
|
-
const l =
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
throw new te("spansBack applies only to a window anchored at the end of the last complete period.");
|
|
47
|
+
const { calendar: a } = t, { unit: i } = e, r = Me(e, t), o = -n * (e.to - e.from + 1), s = V(r.start, i, a, o).start;
|
|
48
|
+
if (T(r.end, i, a).getTime() === r.end.getTime())
|
|
49
|
+
return { start: s, end: ce(r.end, i, a, o) };
|
|
50
|
+
const l = se(oe(e, t), o, i, a), c = Math.min(
|
|
51
|
+
T(l, e.anchor.lastComplete, a).getTime(),
|
|
52
|
+
T(l, i, a).getTime()
|
|
53
53
|
);
|
|
54
54
|
return { start: s, end: new Date(c) };
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function J(e) {
|
|
57
57
|
return e.prefixLevels.length === 1 && e.prefixLevels[0] === "table" ? ["table"] : Array.from(
|
|
58
58
|
/* @__PURE__ */ new Set([
|
|
59
59
|
"database",
|
|
@@ -61,25 +61,25 @@ function G(e) {
|
|
|
61
61
|
])
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const { recorded: t, capabilities: n } = e,
|
|
66
|
-
return !(t.databaseName && !
|
|
67
|
-
...
|
|
64
|
+
function le(e) {
|
|
65
|
+
const { recorded: t, capabilities: n } = e, a = J(n);
|
|
66
|
+
return !(t.databaseName && !a.includes("database") || t.schemaName && !a.includes("schema")) || !t.tableName ? t : {
|
|
67
|
+
...Z({
|
|
68
68
|
qualifiedName: [t.databaseName, t.schemaName, t.tableName].filter(Boolean).join("."),
|
|
69
69
|
capabilities: n
|
|
70
70
|
}),
|
|
71
|
-
...
|
|
72
|
-
...
|
|
71
|
+
...a.includes("database") && t.databaseName ? { databaseName: t.databaseName } : {},
|
|
72
|
+
...a.includes("schema") && t.schemaName ? { schemaName: t.schemaName } : {},
|
|
73
73
|
tableName: t.tableName
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const t = e.source.connectionType ? C(e.source.connectionType) : void 0, n = e.source.dialect ?
|
|
76
|
+
function kt(e) {
|
|
77
|
+
const t = e.source.connectionType ? C(e.source.connectionType) : void 0, n = e.source.dialect ? U(e.source.dialect) : void 0, a = e.source.dialect && e.source.dialect !== "unknown" ? C(e.source.dialect) : void 0;
|
|
78
78
|
if (!e.capabilities && e.source.connectionType && e.source.dialect && e.source.dialect !== "unknown" && (!t || n === "unknown" || t.dialect !== n))
|
|
79
79
|
return { kind: "incompatible_capabilities" };
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
82
|
-
const r =
|
|
80
|
+
const i = e.capabilities || t || a;
|
|
81
|
+
if (!i) return { kind: "incompatible_capabilities" };
|
|
82
|
+
const r = J(i), o = {
|
|
83
83
|
...r.includes("database") && e.source.databaseName ? { databaseName: e.source.databaseName } : {},
|
|
84
84
|
...r.includes("schema") && e.source.schemaName ? { schemaName: e.source.schemaName } : {},
|
|
85
85
|
...e.source.tableName ? { tableName: e.source.tableName } : {}
|
|
@@ -92,50 +92,50 @@ function rt(e) {
|
|
|
92
92
|
function f(e) {
|
|
93
93
|
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function E(e) {
|
|
96
96
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
const t =
|
|
98
|
+
function de(e) {
|
|
99
|
+
const t = E(e);
|
|
100
100
|
return !t || !f(t.name) || t.type === "model" ? !1 : t.type === "dataset" ? t.datasetType === "physical" : !0;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
const n =
|
|
102
|
+
function x(e, t) {
|
|
103
|
+
const n = E(e);
|
|
104
104
|
if (!n) return {};
|
|
105
|
-
const
|
|
106
|
-
return
|
|
105
|
+
const a = f(n.table) || f(n.name);
|
|
106
|
+
return le({
|
|
107
107
|
recorded: {
|
|
108
108
|
...f(n.database) ? { databaseName: f(n.database) } : {},
|
|
109
109
|
...f(n.schema) ? { schemaName: f(n.schema) } : {},
|
|
110
|
-
...
|
|
110
|
+
...a ? { tableName: a } : {}
|
|
111
111
|
},
|
|
112
112
|
capabilities: t
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
const t = e.entities.filter(
|
|
115
|
+
function Re(e) {
|
|
116
|
+
if (We(e)) return { kind: "malformed" };
|
|
117
|
+
const t = e.entities.filter(de), n = je(e), a = ze({
|
|
118
118
|
entities: t,
|
|
119
119
|
connectionType: e.connectionType,
|
|
120
120
|
dialect: e.dialect,
|
|
121
121
|
capabilities: e.capabilities
|
|
122
122
|
});
|
|
123
|
-
if (!
|
|
124
|
-
const { capabilities:
|
|
123
|
+
if (!a) return { kind: "incompatible_capabilities" };
|
|
124
|
+
const { capabilities: i } = a, r = Qe({
|
|
125
125
|
hints: e.qualifiedHints || [],
|
|
126
126
|
coordinateHint: e.coordinateHint,
|
|
127
|
-
capabilityAuthority:
|
|
127
|
+
capabilityAuthority: a
|
|
128
128
|
});
|
|
129
129
|
if (r.kind !== "valid")
|
|
130
130
|
return { kind: r.kind };
|
|
131
131
|
const o = r.coordinates, s = o ? t.filter(
|
|
132
|
-
(c) =>
|
|
133
|
-
left:
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
(c) => X({
|
|
133
|
+
left: ue(
|
|
134
|
+
x(c, i),
|
|
135
|
+
i
|
|
136
136
|
),
|
|
137
137
|
right: o,
|
|
138
|
-
capabilities:
|
|
138
|
+
capabilities: i
|
|
139
139
|
})
|
|
140
140
|
) : t;
|
|
141
141
|
if (o && s.length === 0)
|
|
@@ -143,19 +143,19 @@ function De(e) {
|
|
|
143
143
|
kind: "not_found",
|
|
144
144
|
basis: "qualified",
|
|
145
145
|
coordinates: o,
|
|
146
|
-
capabilityAuthority:
|
|
146
|
+
capabilityAuthority: a
|
|
147
147
|
};
|
|
148
148
|
if (o && s.length === 1) {
|
|
149
|
-
const c = s[0], d =
|
|
150
|
-
|
|
149
|
+
const c = s[0], d = O(
|
|
150
|
+
a,
|
|
151
151
|
c
|
|
152
152
|
);
|
|
153
153
|
return {
|
|
154
154
|
kind: "resolved",
|
|
155
155
|
basis: "qualified",
|
|
156
156
|
entity: c,
|
|
157
|
-
coordinates:
|
|
158
|
-
|
|
157
|
+
coordinates: Ge(
|
|
158
|
+
x(
|
|
159
159
|
c,
|
|
160
160
|
d.capabilities
|
|
161
161
|
),
|
|
@@ -165,27 +165,27 @@ function De(e) {
|
|
|
165
165
|
capabilityAuthority: d
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
const l =
|
|
168
|
+
const l = fe([
|
|
169
169
|
...e.bareHints || [],
|
|
170
170
|
...r.bareHints,
|
|
171
171
|
o == null ? void 0 : o.tableName
|
|
172
172
|
]);
|
|
173
173
|
if (l.size > 0) {
|
|
174
174
|
const c = s.filter((d) => {
|
|
175
|
-
const m =
|
|
175
|
+
const m = Ke(d);
|
|
176
176
|
return Array.from(l).some((g) => m.has(g));
|
|
177
177
|
});
|
|
178
178
|
if (c.length === 1) {
|
|
179
|
-
const d = c[0], m =
|
|
180
|
-
|
|
179
|
+
const d = c[0], m = O(
|
|
180
|
+
a,
|
|
181
181
|
d
|
|
182
182
|
);
|
|
183
183
|
return {
|
|
184
184
|
kind: "resolved",
|
|
185
185
|
basis: "bare",
|
|
186
186
|
entity: d,
|
|
187
|
-
coordinates:
|
|
188
|
-
|
|
187
|
+
coordinates: F(
|
|
188
|
+
x(
|
|
189
189
|
d,
|
|
190
190
|
m.capabilities
|
|
191
191
|
),
|
|
@@ -194,7 +194,7 @@ function De(e) {
|
|
|
194
194
|
capabilityAuthority: m
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
-
return c.length > 1 ? { kind: "ambiguous", basis: "bare" } : { kind: "not_found", basis: "bare", capabilityAuthority:
|
|
197
|
+
return c.length > 1 ? { kind: "ambiguous", basis: "bare" } : { kind: "not_found", basis: "bare", capabilityAuthority: a };
|
|
198
198
|
}
|
|
199
199
|
if (o)
|
|
200
200
|
return { kind: "ambiguous", basis: "qualified" };
|
|
@@ -202,19 +202,19 @@ function De(e) {
|
|
|
202
202
|
return {
|
|
203
203
|
kind: "not_found",
|
|
204
204
|
basis: n,
|
|
205
|
-
capabilityAuthority:
|
|
205
|
+
capabilityAuthority: a
|
|
206
206
|
};
|
|
207
207
|
if (t.length === 1) {
|
|
208
|
-
const c = t[0], d =
|
|
209
|
-
|
|
208
|
+
const c = t[0], d = O(
|
|
209
|
+
a,
|
|
210
210
|
c
|
|
211
211
|
);
|
|
212
212
|
return {
|
|
213
213
|
kind: "resolved",
|
|
214
214
|
basis: "unqualified",
|
|
215
215
|
entity: c,
|
|
216
|
-
coordinates:
|
|
217
|
-
|
|
216
|
+
coordinates: F(
|
|
217
|
+
x(
|
|
218
218
|
c,
|
|
219
219
|
d.capabilities
|
|
220
220
|
),
|
|
@@ -225,29 +225,29 @@ function De(e) {
|
|
|
225
225
|
}
|
|
226
226
|
return { kind: "unqualified" };
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
const t = (e.qualifiedHints || []).map(f).filter((
|
|
228
|
+
function je(e) {
|
|
229
|
+
const t = (e.qualifiedHints || []).map(f).filter((a) => !!a);
|
|
230
230
|
return Object.values(e.coordinateHint || {}).some(
|
|
231
|
-
(
|
|
232
|
-
) || t.some((
|
|
233
|
-
(
|
|
231
|
+
(a) => !!f(a)
|
|
232
|
+
) || t.some((a) => a.includes(".")) ? "qualified" : [...t, ...e.bareHints || []].some(
|
|
233
|
+
(a) => !!f(a)
|
|
234
234
|
) ? "bare" : void 0;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function D(e) {
|
|
237
237
|
return `${e.dialect}:${e.prefixLevels.join(".")}`;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function B(e) {
|
|
240
240
|
return {
|
|
241
241
|
dialect: e.dialect,
|
|
242
242
|
prefixLevels: [...e.prefixLevels]
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
var
|
|
247
|
-
const t = f(e.connectionType), n = f(e.dialect),
|
|
248
|
-
if (t && !
|
|
245
|
+
function ze(e) {
|
|
246
|
+
var k;
|
|
247
|
+
const t = f(e.connectionType), n = f(e.dialect), a = e.capabilities ? B(e.capabilities) : void 0, i = t ? C(t) : void 0, r = n ? U(n) : void 0, o = n && n !== "unknown" ? C(n) : void 0;
|
|
248
|
+
if (t && !i || n && n !== "unknown" && r === "unknown" || a && i && D(a) !== D(i))
|
|
249
249
|
return;
|
|
250
|
-
const s =
|
|
250
|
+
const s = a || (i ? B(i) : o ? B(o) : void 0);
|
|
251
251
|
if (s)
|
|
252
252
|
return r && r !== "unknown" && s.dialect !== r ? void 0 : {
|
|
253
253
|
capabilities: s,
|
|
@@ -256,16 +256,16 @@ function qe(e) {
|
|
|
256
256
|
evidence: "explicit"
|
|
257
257
|
};
|
|
258
258
|
const l = e.entities.map((b) => {
|
|
259
|
-
const
|
|
260
|
-
if (h && !
|
|
259
|
+
const I = E(b), h = f(I == null ? void 0 : I.connectionType), N = f(I == null ? void 0 : I.dialect), _ = h ? C(h) : void 0, q = N ? U(N) : void 0, H = N && N !== "unknown" ? C(N) : void 0;
|
|
260
|
+
if (h && !_ || N && N !== "unknown" && q === "unknown" || N && N !== "unknown" && !_ && !H || _ && q && q !== "unknown" && _.dialect !== q)
|
|
261
261
|
return;
|
|
262
|
-
const
|
|
263
|
-
return
|
|
264
|
-
capabilities:
|
|
262
|
+
const w = _ || H, M = w ? B(w) : $e(I);
|
|
263
|
+
return M ? {
|
|
264
|
+
capabilities: M,
|
|
265
265
|
connectionType: h,
|
|
266
|
-
capabilityIdentity: h ?
|
|
267
|
-
inferred: !
|
|
268
|
-
signature:
|
|
266
|
+
capabilityIdentity: h ? Ee(h) : void 0,
|
|
267
|
+
inferred: !_ && !H,
|
|
268
|
+
signature: D(M)
|
|
269
269
|
} : void 0;
|
|
270
270
|
});
|
|
271
271
|
if (l.some((b) => !b)) return;
|
|
@@ -274,7 +274,7 @@ function qe(e) {
|
|
|
274
274
|
);
|
|
275
275
|
if (new Set(c.map((b) => b.signature)).size > 1)
|
|
276
276
|
return;
|
|
277
|
-
const d = (
|
|
277
|
+
const d = (k = c[0]) == null ? void 0 : k.capabilities;
|
|
278
278
|
if (!d || r && r !== "unknown" && d.dialect !== r)
|
|
279
279
|
return;
|
|
280
280
|
const m = new Set(
|
|
@@ -289,7 +289,7 @@ function qe(e) {
|
|
|
289
289
|
evidence: c.every((b) => b.inferred) ? "coordinates" : "entity"
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function $e(e) {
|
|
293
293
|
const t = !!f(e == null ? void 0 : e.database), n = !!f(e == null ? void 0 : e.schema);
|
|
294
294
|
if (!(t && n)) {
|
|
295
295
|
if (n)
|
|
@@ -298,59 +298,59 @@ function Fe(e) {
|
|
|
298
298
|
return { dialect: "unknown", prefixLevels: ["database", "table"] };
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
var
|
|
301
|
+
function O(e, t) {
|
|
302
|
+
var i;
|
|
303
303
|
if (e.evidence !== "entity") return e;
|
|
304
|
-
const n = f((
|
|
305
|
-
return
|
|
304
|
+
const n = f((i = E(t)) == null ? void 0 : i.connectionType), a = n ? C(n) : void 0;
|
|
305
|
+
return a && D(a) === D(e.capabilities) ? { ...e, connectionType: n } : e;
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function We(e) {
|
|
308
308
|
return (e.qualifiedHints || []).some(
|
|
309
309
|
(n) => {
|
|
310
|
-
const
|
|
311
|
-
return !!(
|
|
310
|
+
const a = f(n);
|
|
311
|
+
return !!(a && a.includes(".") && !p(a));
|
|
312
312
|
}
|
|
313
313
|
) ? !0 : Object.values(e.coordinateHint || {}).some((n) => {
|
|
314
|
-
const
|
|
315
|
-
return !!(
|
|
314
|
+
const a = f(n);
|
|
315
|
+
return !!(a && !p(a));
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
const { capabilities: t } = e.capabilityAuthority, n = [],
|
|
318
|
+
function Qe(e) {
|
|
319
|
+
const { capabilities: t } = e.capabilityAuthority, n = [], a = [];
|
|
320
320
|
for (const m of e.hints) {
|
|
321
321
|
const g = f(m);
|
|
322
322
|
if (!g) continue;
|
|
323
323
|
if (!g.includes(".")) {
|
|
324
|
-
|
|
324
|
+
a.push(g);
|
|
325
325
|
continue;
|
|
326
326
|
}
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
329
|
-
n.push(
|
|
327
|
+
const k = p(g);
|
|
328
|
+
if (!k) return { kind: "malformed" };
|
|
329
|
+
n.push(k);
|
|
330
330
|
}
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
331
|
+
const i = Ze(e.coordinateHint);
|
|
332
|
+
if (i.kind === "malformed") return i;
|
|
333
333
|
const r = Array.from(new Set(n)).map(
|
|
334
|
-
(m) =>
|
|
334
|
+
(m) => Z({
|
|
335
335
|
qualifiedName: m,
|
|
336
336
|
capabilities: t
|
|
337
337
|
})
|
|
338
338
|
);
|
|
339
|
-
if (!
|
|
339
|
+
if (!Ue(r, t))
|
|
340
340
|
return { kind: "conflicting" };
|
|
341
341
|
const o = [...new Set(n)].sort(
|
|
342
342
|
(m, g) => g.split(".").length - m.split(".").length
|
|
343
|
-
)[0], s = o ?
|
|
343
|
+
)[0], s = o ? Z({
|
|
344
344
|
qualifiedName: o,
|
|
345
345
|
capabilities: t
|
|
346
|
-
}) : void 0, l =
|
|
347
|
-
|
|
346
|
+
}) : void 0, l = ue(
|
|
347
|
+
i.coordinates,
|
|
348
348
|
t
|
|
349
|
-
), c =
|
|
350
|
-
|
|
349
|
+
), c = F(
|
|
350
|
+
i.coordinates,
|
|
351
351
|
e.capabilityAuthority
|
|
352
352
|
), d = !!(l.tableName && (l.databaseName || l.schemaName));
|
|
353
|
-
return s && d && !
|
|
353
|
+
return s && d && !X({
|
|
354
354
|
left: s,
|
|
355
355
|
right: l,
|
|
356
356
|
capabilities: t
|
|
@@ -361,55 +361,55 @@ function He(e) {
|
|
|
361
361
|
...s
|
|
362
362
|
} : d ? c : void 0,
|
|
363
363
|
bareHints: [
|
|
364
|
-
...
|
|
364
|
+
...a,
|
|
365
365
|
...!d && l.tableName ? [l.tableName] : []
|
|
366
366
|
]
|
|
367
367
|
};
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function Ze(e) {
|
|
370
370
|
const t = {};
|
|
371
|
-
for (const [n,
|
|
372
|
-
const
|
|
373
|
-
if (!
|
|
374
|
-
const r = p(
|
|
371
|
+
for (const [n, a] of Object.entries(e || {})) {
|
|
372
|
+
const i = f(a);
|
|
373
|
+
if (!i) continue;
|
|
374
|
+
const r = p(i);
|
|
375
375
|
if (!r) return { kind: "malformed" };
|
|
376
376
|
t[n] = r;
|
|
377
377
|
}
|
|
378
378
|
return { kind: "valid", coordinates: t };
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function ue(e, t) {
|
|
381
381
|
return {
|
|
382
382
|
...t.prefixLevels.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
383
383
|
...t.prefixLevels.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
384
384
|
...e.tableName ? { tableName: e.tableName } : {}
|
|
385
385
|
};
|
|
386
386
|
}
|
|
387
|
-
function
|
|
387
|
+
function Ue(e, t) {
|
|
388
388
|
return e.every(
|
|
389
|
-
(n,
|
|
390
|
-
(
|
|
389
|
+
(n, a) => e.slice(a + 1).every(
|
|
390
|
+
(i) => X({
|
|
391
391
|
left: n,
|
|
392
|
-
right:
|
|
392
|
+
right: i,
|
|
393
393
|
capabilities: t
|
|
394
394
|
})
|
|
395
395
|
)
|
|
396
396
|
);
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function fe(e) {
|
|
399
399
|
return new Set(
|
|
400
400
|
e.map(f).map(p).filter((t) => !!t)
|
|
401
401
|
);
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
const t =
|
|
405
|
-
return t ?
|
|
403
|
+
function Ke(e) {
|
|
404
|
+
const t = E(e);
|
|
405
|
+
return t ? fe([
|
|
406
406
|
f(t.name),
|
|
407
407
|
f(t.table),
|
|
408
408
|
f(t.id)
|
|
409
409
|
]) : /* @__PURE__ */ new Set();
|
|
410
410
|
}
|
|
411
|
-
function
|
|
412
|
-
return
|
|
411
|
+
function Ge(e, t, n) {
|
|
412
|
+
return F(
|
|
413
413
|
{
|
|
414
414
|
...e,
|
|
415
415
|
...t
|
|
@@ -417,8 +417,8 @@ function Re(e, t, n) {
|
|
|
417
417
|
n
|
|
418
418
|
);
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
const n = t.evidence === "coordinates" ? t.capabilities.prefixLevels :
|
|
420
|
+
function F(e, t) {
|
|
421
|
+
const n = t.evidence === "coordinates" ? t.capabilities.prefixLevels : J(t.capabilities);
|
|
422
422
|
return {
|
|
423
423
|
...n.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
424
424
|
...n.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
@@ -428,63 +428,63 @@ function B(e, t) {
|
|
|
428
428
|
function u(e) {
|
|
429
429
|
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function S(e) {
|
|
432
432
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
const t =
|
|
434
|
+
function Ve(e) {
|
|
435
|
+
const t = S(e);
|
|
436
436
|
return !!(t && t.type === "dataset" && u(t.name));
|
|
437
437
|
}
|
|
438
|
-
function
|
|
439
|
-
const t =
|
|
438
|
+
function me(e) {
|
|
439
|
+
const t = S(e);
|
|
440
440
|
return !!(t && t.type === "dataset" && t.datasetType !== "physical" && u(t.name));
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function ne(e) {
|
|
443
443
|
const t = /* @__PURE__ */ new Set();
|
|
444
444
|
for (const n of e) {
|
|
445
|
-
const
|
|
446
|
-
if (!i) continue;
|
|
447
|
-
const a = p(i);
|
|
445
|
+
const a = u(n);
|
|
448
446
|
if (!a) continue;
|
|
449
|
-
const
|
|
447
|
+
const i = p(a);
|
|
448
|
+
if (!i) continue;
|
|
449
|
+
const r = i.toLowerCase();
|
|
450
450
|
t.add(r);
|
|
451
451
|
const o = r.split("."), s = o[o.length - 1];
|
|
452
452
|
s && t.add(s);
|
|
453
453
|
}
|
|
454
454
|
return t;
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function L(e) {
|
|
457
457
|
var n;
|
|
458
458
|
const t = u(e);
|
|
459
459
|
return t ? (n = p(t)) == null ? void 0 : n.toLowerCase() : void 0;
|
|
460
460
|
}
|
|
461
|
-
function
|
|
462
|
-
const n =
|
|
463
|
-
if (!
|
|
464
|
-
const r = (n == null ? void 0 : n.datasetType) === "physical" ? void 0 :
|
|
461
|
+
function R(e, t) {
|
|
462
|
+
const n = S(t), a = u(n == null ? void 0 : n.domainId) || u(e.semanticDomainId), i = u(n == null ? void 0 : n.name);
|
|
463
|
+
if (!a || !i) return;
|
|
464
|
+
const r = (n == null ? void 0 : n.datasetType) === "physical" ? void 0 : qe(n || {}), o = u(n == null ? void 0 : n.connectionId) || u(e.connectionId);
|
|
465
465
|
return {
|
|
466
466
|
kind: "semantic",
|
|
467
|
-
domainId:
|
|
468
|
-
datasetName:
|
|
467
|
+
domainId: a,
|
|
468
|
+
datasetName: i,
|
|
469
469
|
...r ? { datasetId: r } : {},
|
|
470
470
|
...o ? { connectionId: o } : {}
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function Xe(e, t = {}) {
|
|
474
474
|
const n = u(e.fieldEntityType);
|
|
475
475
|
if (n && n !== "dataset")
|
|
476
476
|
return { kind: "unqualified" };
|
|
477
|
-
const
|
|
478
|
-
(o) => t.includePhysicalDatasets ?
|
|
479
|
-
),
|
|
480
|
-
if (
|
|
481
|
-
const o =
|
|
482
|
-
const c =
|
|
483
|
-
return !!(o &&
|
|
477
|
+
const a = e.entities.filter(
|
|
478
|
+
(o) => t.includePhysicalDatasets ? Ve(o) : me(o)
|
|
479
|
+
), i = u(e.entityId);
|
|
480
|
+
if (i) {
|
|
481
|
+
const o = L(i), s = a.filter((l) => {
|
|
482
|
+
const c = S(l);
|
|
483
|
+
return !!(o && L(c == null ? void 0 : c.id) === o);
|
|
484
484
|
});
|
|
485
485
|
if (s.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
486
486
|
if (s.length === 1) {
|
|
487
|
-
const l =
|
|
487
|
+
const l = R(e, s[0]);
|
|
488
488
|
return l ? {
|
|
489
489
|
kind: "resolved",
|
|
490
490
|
basis: "bare",
|
|
@@ -494,19 +494,19 @@ function Me(e, t = {}) {
|
|
|
494
494
|
} : { kind: "not_found", basis: "bare" };
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
const r =
|
|
497
|
+
const r = ne([
|
|
498
498
|
e.entityName,
|
|
499
499
|
...e.qualifiedHints || [],
|
|
500
500
|
...e.bareHints || []
|
|
501
501
|
]);
|
|
502
502
|
if (r.size > 0) {
|
|
503
|
-
const o =
|
|
504
|
-
const l =
|
|
505
|
-
return [...
|
|
503
|
+
const o = a.filter((s) => {
|
|
504
|
+
const l = S(s);
|
|
505
|
+
return [...ne([l == null ? void 0 : l.id, l == null ? void 0 : l.name])].some((d) => r.has(d));
|
|
506
506
|
});
|
|
507
507
|
if (o.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
508
508
|
if (o.length === 1) {
|
|
509
|
-
const s =
|
|
509
|
+
const s = R(e, o[0]);
|
|
510
510
|
return s ? {
|
|
511
511
|
kind: "resolved",
|
|
512
512
|
basis: "bare",
|
|
@@ -517,61 +517,61 @@ function Me(e, t = {}) {
|
|
|
517
517
|
}
|
|
518
518
|
return { kind: "not_found", basis: "bare" };
|
|
519
519
|
}
|
|
520
|
-
if (
|
|
521
|
-
const o =
|
|
520
|
+
if (a.length === 1) {
|
|
521
|
+
const o = R(e, a[0]);
|
|
522
522
|
return o ? {
|
|
523
523
|
kind: "resolved",
|
|
524
524
|
basis: "unqualified",
|
|
525
|
-
entity:
|
|
525
|
+
entity: a[0],
|
|
526
526
|
source: o,
|
|
527
527
|
matchedById: !1
|
|
528
528
|
} : { kind: "unqualified" };
|
|
529
529
|
}
|
|
530
530
|
return { kind: "unqualified" };
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
const t = e.resolution.kind === "resolved" ?
|
|
532
|
+
function j(e) {
|
|
533
|
+
const t = e.resolution.kind === "resolved" ? S(e.resolution.entity) : void 0, n = u(e.connectionId) || u(t == null ? void 0 : t.connectionId), { connectionType: a, dialect: i } = e.resolution.capabilityAuthority, r = C(i), o = !!(r && r.dialect === e.resolution.capabilityAuthority.capabilities.dialect && r.prefixLevels.join(".") === e.resolution.capabilityAuthority.capabilities.prefixLevels.join(
|
|
534
534
|
"."
|
|
535
535
|
)), s = e.resolution.coordinates;
|
|
536
536
|
if (!(!n || !(s != null && s.tableName)))
|
|
537
537
|
return {
|
|
538
538
|
kind: "physical",
|
|
539
539
|
connectionId: n,
|
|
540
|
-
...
|
|
541
|
-
...!
|
|
540
|
+
...a ? { connectionType: a } : {},
|
|
541
|
+
...!a && o ? { dialect: i } : {},
|
|
542
542
|
tableName: s.tableName,
|
|
543
543
|
...s.databaseName ? { databaseName: s.databaseName } : {},
|
|
544
544
|
...s.schemaName ? { schemaName: s.schemaName } : {}
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function Je(e) {
|
|
548
548
|
if (!e.coordinates.tableName) return !1;
|
|
549
|
-
const t =
|
|
550
|
-
if (n &&
|
|
549
|
+
const t = S(e.entity), n = L(t == null ? void 0 : t.id), a = e.qualifiedHints.map(u).filter((l) => !!(l != null && l.includes(".")));
|
|
550
|
+
if (n && a.length > 0 && a.every((l) => L(l) === n))
|
|
551
551
|
return !0;
|
|
552
|
-
const
|
|
553
|
-
if (!
|
|
552
|
+
const i = p(u(t == null ? void 0 : t.table));
|
|
553
|
+
if (!i) return !1;
|
|
554
554
|
const r = p(
|
|
555
555
|
u(t == null ? void 0 : t.database)
|
|
556
556
|
), o = p(
|
|
557
557
|
u(t == null ? void 0 : t.schema)
|
|
558
558
|
), { capabilities: s } = e.capabilityAuthority;
|
|
559
|
-
return
|
|
559
|
+
return xe({
|
|
560
560
|
requested: e.coordinates,
|
|
561
|
-
allowed:
|
|
561
|
+
allowed: le({
|
|
562
562
|
recorded: {
|
|
563
563
|
...r ? { databaseName: r } : {},
|
|
564
564
|
...o ? { schemaName: o } : {},
|
|
565
|
-
tableName:
|
|
565
|
+
tableName: i
|
|
566
566
|
},
|
|
567
567
|
capabilities: s
|
|
568
568
|
}),
|
|
569
569
|
capabilities: s
|
|
570
570
|
});
|
|
571
571
|
}
|
|
572
|
-
function
|
|
573
|
-
var
|
|
574
|
-
if (u(e.connectionType) || u(e.dialect) || e.capabilities || u(e.semanticDomainId) || u(e.fieldEntityType) === "dataset" || u((
|
|
572
|
+
function Ye(e) {
|
|
573
|
+
var i, r, o;
|
|
574
|
+
if (u(e.connectionType) || u(e.dialect) || e.capabilities || u(e.semanticDomainId) || u(e.fieldEntityType) === "dataset" || u((i = e.fallbackCoordinateHint) == null ? void 0 : i.databaseName) || u((r = e.fallbackCoordinateHint) == null ? void 0 : r.schemaName))
|
|
575
575
|
return;
|
|
576
576
|
const t = [
|
|
577
577
|
u((o = e.fallbackCoordinateHint) == null ? void 0 : o.tableName),
|
|
@@ -585,17 +585,17 @@ function Oe(e) {
|
|
|
585
585
|
const n = t.map(p);
|
|
586
586
|
return n.some((s) => !s) ? void 0 : new Set(n.map((s) => s.toLowerCase())).size === 1 ? n[0] : void 0;
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function It(e) {
|
|
589
589
|
const t = e.entities.filter(
|
|
590
|
-
|
|
590
|
+
de
|
|
591
591
|
), n = e.entities.filter(
|
|
592
|
-
|
|
593
|
-
),
|
|
592
|
+
me
|
|
593
|
+
), a = t.length > 0 || n.length > 0, i = Xe(e), r = e.qualifiedHints || [], o = r.some(
|
|
594
594
|
(c) => {
|
|
595
595
|
var d;
|
|
596
596
|
return (d = u(c)) == null ? void 0 : d.includes(".");
|
|
597
597
|
}
|
|
598
|
-
), s =
|
|
598
|
+
), s = Re({
|
|
599
599
|
entities: t,
|
|
600
600
|
connectionType: u(e.connectionType),
|
|
601
601
|
dialect: e.dialect,
|
|
@@ -607,7 +607,7 @@ function ct(e) {
|
|
|
607
607
|
if (s.kind === "malformed" || s.kind === "conflicting" || s.kind === "incompatible_capabilities" && o || s.kind === "ambiguous" && s.basis === "qualified")
|
|
608
608
|
return s;
|
|
609
609
|
if (s.kind === "resolved" && s.basis === "qualified") {
|
|
610
|
-
const c =
|
|
610
|
+
const c = j({
|
|
611
611
|
resolution: s,
|
|
612
612
|
connectionId: e.connectionId
|
|
613
613
|
});
|
|
@@ -619,34 +619,34 @@ function ct(e) {
|
|
|
619
619
|
} : { kind: "missing_connection" };
|
|
620
620
|
}
|
|
621
621
|
if (s.kind === "not_found" && s.basis === "qualified" && s.coordinates) {
|
|
622
|
-
if (
|
|
623
|
-
entity:
|
|
622
|
+
if (i.kind === "resolved" && i.matchedById && Je({
|
|
623
|
+
entity: i.entity,
|
|
624
624
|
coordinates: s.coordinates,
|
|
625
625
|
capabilityAuthority: s.capabilityAuthority,
|
|
626
626
|
qualifiedHints: r
|
|
627
627
|
}))
|
|
628
628
|
return {
|
|
629
629
|
kind: "resolved",
|
|
630
|
-
basis:
|
|
631
|
-
source:
|
|
632
|
-
entity:
|
|
630
|
+
basis: i.basis,
|
|
631
|
+
source: i.source,
|
|
632
|
+
entity: i.entity
|
|
633
633
|
};
|
|
634
|
-
const c =
|
|
634
|
+
const c = j({
|
|
635
635
|
resolution: s,
|
|
636
636
|
connectionId: e.connectionId
|
|
637
637
|
});
|
|
638
|
-
return c ?
|
|
638
|
+
return c ? a ? { kind: "candidate", basis: "qualified", source: c } : { kind: "resolved", basis: "qualified", source: c } : { kind: "missing_connection" };
|
|
639
639
|
}
|
|
640
|
-
if (
|
|
641
|
-
return s.kind === "resolved" && s.basis === "bare" && !
|
|
640
|
+
if (i.kind === "resolved")
|
|
641
|
+
return s.kind === "resolved" && s.basis === "bare" && !i.matchedById ? { kind: "ambiguous", basis: "bare" } : {
|
|
642
642
|
kind: "resolved",
|
|
643
|
-
basis:
|
|
644
|
-
source:
|
|
645
|
-
entity:
|
|
643
|
+
basis: i.basis,
|
|
644
|
+
source: i.source,
|
|
645
|
+
entity: i.entity
|
|
646
646
|
};
|
|
647
|
-
if (
|
|
647
|
+
if (i.kind === "ambiguous") return i;
|
|
648
648
|
if (s.kind === "resolved") {
|
|
649
|
-
const c =
|
|
649
|
+
const c = j({
|
|
650
650
|
resolution: s,
|
|
651
651
|
connectionId: e.connectionId
|
|
652
652
|
});
|
|
@@ -658,7 +658,7 @@ function ct(e) {
|
|
|
658
658
|
} : { kind: "missing_connection" };
|
|
659
659
|
}
|
|
660
660
|
const l = u(e.entityName) || u(e.entityId);
|
|
661
|
-
if (!
|
|
661
|
+
if (!a && !o && u(e.semanticDomainId) && (!u(e.fieldEntityType) || u(e.fieldEntityType) === "dataset") && l)
|
|
662
662
|
return {
|
|
663
663
|
kind: "resolved",
|
|
664
664
|
basis: "historical",
|
|
@@ -670,7 +670,7 @@ function ct(e) {
|
|
|
670
670
|
}
|
|
671
671
|
};
|
|
672
672
|
if (s.kind === "incompatible_capabilities") {
|
|
673
|
-
const c =
|
|
673
|
+
const c = a ? void 0 : Ye(e), d = u(e.connectionId);
|
|
674
674
|
return c && d ? {
|
|
675
675
|
kind: "resolved",
|
|
676
676
|
basis: "historical",
|
|
@@ -682,72 +682,133 @@ function ct(e) {
|
|
|
682
682
|
basis: s.basis
|
|
683
683
|
} : { kind: "unqualified" };
|
|
684
684
|
}
|
|
685
|
-
|
|
686
|
-
|
|
685
|
+
function Nt(e, t) {
|
|
686
|
+
if (!e) return { kind: "range" };
|
|
687
|
+
const n = Le(e);
|
|
688
|
+
if (n.comparesBySpan) return { kind: "anchored", window: e };
|
|
689
|
+
if (n.bounds.start === "instant" && t === "date") return { kind: "range" };
|
|
690
|
+
if (n.subDay) return { kind: "elapsed", window: e };
|
|
691
|
+
switch (e.kind) {
|
|
692
|
+
case "periods":
|
|
693
|
+
return { kind: "calendar", unit: e.unit, n: e.to - e.from + 1, toDate: !!e.toDate, window: e };
|
|
694
|
+
case "rolling":
|
|
695
|
+
return { kind: "calendar", unit: e.unit, n: e.n, toDate: !1, window: e };
|
|
696
|
+
case "monthDay":
|
|
697
|
+
return { kind: "calendar", unit: "day", n: 1, toDate: !1, window: e };
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
function we(e, t) {
|
|
701
|
+
return De(e).toZonedDateTimeISO(t);
|
|
702
|
+
}
|
|
703
|
+
const A = we, be = (e) => e.startOfDay(), ge = (e) => e.toPlainDate().add({ days: 1 }).toZonedDateTime({ timeZone: e.timeZoneId });
|
|
704
|
+
function Ct(e) {
|
|
705
|
+
const t = A(e.start, e.zone), n = A(e.endExclusive, e.zone), a = e.basis;
|
|
706
|
+
return e.column === "timestamp" ? { start: t, endExclusive: n, column: e.column, basis: a } : {
|
|
707
|
+
start: be(t),
|
|
708
|
+
endExclusive: ge(A(new Date(n.epochMilliseconds - 1), e.zone)),
|
|
709
|
+
column: e.column,
|
|
710
|
+
basis: a
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
const ae = (e) => e.day === 1 && e.equals(be(e));
|
|
714
|
+
function ye(e) {
|
|
715
|
+
return ae(e.start) && ae(e.endExclusive);
|
|
716
|
+
}
|
|
717
|
+
function St(e, t) {
|
|
718
|
+
const n = t.getTime();
|
|
719
|
+
if (n <= e.start.epochMilliseconds) return null;
|
|
720
|
+
if (n >= e.endExclusive.epochMilliseconds - 1) return e;
|
|
721
|
+
const a = e.column === "date" ? ge(A(new Date(n - 1), e.start.timeZoneId)) : A(t, e.start.timeZoneId);
|
|
722
|
+
return a.epochMilliseconds < e.endExclusive.epochMilliseconds ? { ...e, endExclusive: a } : e;
|
|
723
|
+
}
|
|
724
|
+
function et(e) {
|
|
725
|
+
return e.start.toPlainDateTime().until(e.endExclusive.toPlainDateTime(), { largestUnit: "days" });
|
|
726
|
+
}
|
|
727
|
+
function z(e) {
|
|
728
|
+
return e.endExclusive.epochMilliseconds - e.start.epochMilliseconds;
|
|
729
|
+
}
|
|
730
|
+
function $(e, t, n) {
|
|
731
|
+
if (t === 0) return e;
|
|
732
|
+
const a = e.toPlainDateTime();
|
|
733
|
+
return (n === "quarter" ? a.add({ months: 3 * t }) : n === "week" ? a.add({ weeks: t }) : a.add({ [`${n}s`]: t })).toZonedDateTime(e.timeZoneId, { disambiguation: re });
|
|
734
|
+
}
|
|
735
|
+
function _t(e, t, n, a) {
|
|
736
|
+
const i = $(e.start, -t, n);
|
|
737
|
+
if (!a.toDate && ye(e)) return { start: i, endExclusive: $(e.endExclusive, -t, n) };
|
|
738
|
+
const r = e.endExclusive.subtract({ milliseconds: 1 });
|
|
739
|
+
return { start: i, endExclusive: $(r, -t, n).add({ milliseconds: 1 }) };
|
|
740
|
+
}
|
|
741
|
+
function Tt(e, t, n) {
|
|
742
|
+
if (ye(t) || z(e) <= z(t)) return e;
|
|
743
|
+
const a = n.elapsed ? e.start.add({ milliseconds: z(t) }) : e.start.toPlainDateTime().add(et(t)).toZonedDateTime(e.start.timeZoneId, { disambiguation: re });
|
|
744
|
+
return Te.ZonedDateTime.compare(e.endExclusive, a) > 0 ? { ...e, endExclusive: a } : e;
|
|
745
|
+
}
|
|
746
|
+
const he = "click-reach:";
|
|
747
|
+
function Dt(e, t) {
|
|
687
748
|
const n = t.source.kind === "semantic" ? t.source.datasetName : t.source.tableName;
|
|
688
|
-
return `${
|
|
749
|
+
return `${he}${e}:${n}.${t.name}`;
|
|
689
750
|
}
|
|
690
|
-
function
|
|
691
|
-
return typeof e == "string" && e.startsWith(
|
|
751
|
+
function At(e) {
|
|
752
|
+
return typeof e == "string" && e.startsWith(he);
|
|
692
753
|
}
|
|
693
|
-
function
|
|
694
|
-
return
|
|
754
|
+
function tt(e, t) {
|
|
755
|
+
return Pe({ ...e, role: t });
|
|
695
756
|
}
|
|
696
|
-
function
|
|
757
|
+
function Et(e, t) {
|
|
697
758
|
if (t.id) {
|
|
698
759
|
const n = [];
|
|
699
760
|
e.forEach(
|
|
700
|
-
({ fields:
|
|
761
|
+
({ fields: i }, r) => i.forEach((o, s) => {
|
|
701
762
|
o.id === t.id && n.push({ group: r, index: s });
|
|
702
763
|
})
|
|
703
764
|
);
|
|
704
|
-
const
|
|
705
|
-
({ group:
|
|
765
|
+
const a = t.alias ? n.find(
|
|
766
|
+
({ group: i, index: r }) => tt(e[i].fields[r], e[i].role) === t.alias
|
|
706
767
|
) : void 0;
|
|
707
|
-
if (
|
|
768
|
+
if (a) return a;
|
|
708
769
|
if (n.length === 1) return n[0];
|
|
709
770
|
}
|
|
710
771
|
for (let n = 0; n < e.length; n += 1) {
|
|
711
|
-
const
|
|
712
|
-
(
|
|
772
|
+
const a = e[n].fields.findIndex(
|
|
773
|
+
(i) => i.name === t.name && i.entityName === t.entityName && (i.alias === t.alias || !t.alias)
|
|
713
774
|
);
|
|
714
|
-
if (
|
|
775
|
+
if (a !== -1) return { group: n, index: a };
|
|
715
776
|
}
|
|
716
777
|
}
|
|
717
|
-
function
|
|
718
|
-
const n = e.split(".").map((s) => s.trim()),
|
|
719
|
-
if (n.length === 0 ||
|
|
778
|
+
function pe(e, t) {
|
|
779
|
+
const n = e.split(".").map((s) => s.trim()), a = t.split(".").map((s) => s.trim());
|
|
780
|
+
if (n.length === 0 || a.length === 0 || n.some((s) => !s) || a.some((s) => !s))
|
|
720
781
|
return !1;
|
|
721
|
-
const [
|
|
722
|
-
return
|
|
782
|
+
const [i, r] = n.length <= a.length ? [n, a] : [a, n], o = r.length - i.length;
|
|
783
|
+
return i.every((s, l) => s === r[l + o]);
|
|
723
784
|
}
|
|
724
|
-
function
|
|
725
|
-
const n = e.split("."),
|
|
726
|
-
return !!(
|
|
785
|
+
function nt(e, t) {
|
|
786
|
+
const n = e.split("."), a = t.split("."), i = n.pop(), r = a.pop();
|
|
787
|
+
return !!(i && i === r && n.length > 0 && a.length > 0 && pe(
|
|
727
788
|
n.join("."),
|
|
728
|
-
|
|
789
|
+
a.join(".")
|
|
729
790
|
));
|
|
730
791
|
}
|
|
731
|
-
function
|
|
732
|
-
const t = e.map((
|
|
792
|
+
function at(e) {
|
|
793
|
+
const t = e.map((a) => a.trim()).filter(Boolean);
|
|
733
794
|
if (t.every(
|
|
734
|
-
(
|
|
735
|
-
(r) =>
|
|
795
|
+
(a, i) => t.slice(i + 1).every(
|
|
796
|
+
(r) => pe(a, r)
|
|
736
797
|
)
|
|
737
798
|
))
|
|
738
799
|
return [...t].sort(
|
|
739
|
-
(
|
|
800
|
+
(a, i) => i.split(".").length - a.split(".").length
|
|
740
801
|
)[0];
|
|
741
802
|
}
|
|
742
803
|
function v(e) {
|
|
743
804
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
744
805
|
}
|
|
745
|
-
function
|
|
806
|
+
function ie(e) {
|
|
746
807
|
if (typeof e != "string") return "";
|
|
747
808
|
const t = e.split(".").map((n) => n.trim());
|
|
748
809
|
return t.length > 1 && t.every(Boolean) ? t.join(".") : "";
|
|
749
810
|
}
|
|
750
|
-
function
|
|
811
|
+
function G(e) {
|
|
751
812
|
if (typeof e != "string") return "";
|
|
752
813
|
const t = e.split(".").map((n) => n.trim());
|
|
753
814
|
return t.length > 0 && t.every(Boolean) ? t.join(".") : "";
|
|
@@ -755,104 +816,104 @@ function W(e) {
|
|
|
755
816
|
function y(e) {
|
|
756
817
|
return typeof e == "string" ? e.trim() : "";
|
|
757
818
|
}
|
|
758
|
-
function
|
|
819
|
+
function it(e, t) {
|
|
759
820
|
return e.every(
|
|
760
|
-
(n,
|
|
821
|
+
(n, a) => e.slice(a + 1).every((i) => t(n, i))
|
|
761
822
|
);
|
|
762
823
|
}
|
|
763
|
-
function
|
|
764
|
-
const n = y(e.id),
|
|
765
|
-
return !
|
|
824
|
+
function st(e, t) {
|
|
825
|
+
const n = y(e.id), a = y(e.name), i = y(t.entityId), r = y(t.entityName);
|
|
826
|
+
return !a || !i && !r ? !1 : (!i || i === n || i === a) && (!r || r === a);
|
|
766
827
|
}
|
|
767
|
-
function
|
|
768
|
-
const t = v(e.semanticContext) ? e.semanticContext : void 0, n = v(e.fieldMeta) ? e.fieldMeta : void 0,
|
|
828
|
+
function rt(e) {
|
|
829
|
+
const t = v(e.semanticContext) ? e.semanticContext : void 0, n = v(e.fieldMeta) ? e.fieldMeta : void 0, a = y(t == null ? void 0 : t.semanticDomainId), i = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(
|
|
769
830
|
(h) => v(h) && h.type === "dataset"
|
|
770
831
|
) : [];
|
|
771
|
-
if (!!!(
|
|
772
|
-
if (!
|
|
832
|
+
if (!!!(a || i.length > 0 || (n == null ? void 0 : n.entityType) === "dataset")) return;
|
|
833
|
+
if (!a)
|
|
773
834
|
return { status: "unresolved", reason: "incomplete_source_identity" };
|
|
774
|
-
const o = y(n == null ? void 0 : n.entityId), s = y(n == null ? void 0 : n.entityName), l = !!(o || s), c = l ?
|
|
775
|
-
(h) =>
|
|
835
|
+
const o = y(n == null ? void 0 : n.entityId), s = y(n == null ? void 0 : n.entityName), l = !!(o || s), c = l ? i.filter(
|
|
836
|
+
(h) => st(h, {
|
|
776
837
|
entityId: o,
|
|
777
838
|
entityName: s
|
|
778
839
|
})
|
|
779
|
-
) :
|
|
840
|
+
) : i;
|
|
780
841
|
if (c.length > 1)
|
|
781
842
|
return { status: "unresolved", reason: "incomplete_source_identity" };
|
|
782
|
-
if (l &&
|
|
843
|
+
if (l && i.length > 0 && c.length === 0)
|
|
783
844
|
return { status: "unresolved", reason: "divergent_source_identity" };
|
|
784
|
-
const d = c[0], m = y(d == null ? void 0 : d.domainId), g = y(d == null ? void 0 : d.id),
|
|
785
|
-
if (m && m !==
|
|
845
|
+
const d = c[0], m = y(d == null ? void 0 : d.domainId), g = y(d == null ? void 0 : d.id), k = y(d == null ? void 0 : d.name);
|
|
846
|
+
if (m && m !== a)
|
|
786
847
|
return { status: "unresolved", reason: "divergent_source_identity" };
|
|
787
|
-
const b = g,
|
|
788
|
-
return
|
|
848
|
+
const b = g, I = k || s;
|
|
849
|
+
return I ? {
|
|
789
850
|
status: "resolved",
|
|
790
851
|
source: {
|
|
791
852
|
kind: "semantic",
|
|
792
|
-
domainId:
|
|
793
|
-
datasetName:
|
|
853
|
+
domainId: a,
|
|
854
|
+
datasetName: I,
|
|
794
855
|
...b ? { datasetId: b } : {}
|
|
795
856
|
}
|
|
796
857
|
} : { status: "unresolved", reason: "incomplete_source_identity" };
|
|
797
858
|
}
|
|
798
|
-
function
|
|
799
|
-
const n = y(e.connectionId),
|
|
800
|
-
if (n &&
|
|
859
|
+
function ot(e, t) {
|
|
860
|
+
const n = y(e.connectionId), a = v(e.semanticContext) ? e.semanticContext : void 0, i = y(a == null ? void 0 : a.connectionId);
|
|
861
|
+
if (n && i && n !== i)
|
|
801
862
|
return { status: "unresolved", reason: "divergent_source_identity" };
|
|
802
|
-
const r = n ||
|
|
863
|
+
const r = n || i, o = v(e.fieldMeta) ? e.fieldMeta : void 0, s = t.split(".").slice(0, -1).join("."), l = G(e.qualifiedTableName), c = G(
|
|
803
864
|
o == null ? void 0 : o.qualifiedEntityName
|
|
804
865
|
), d = [
|
|
805
866
|
l,
|
|
806
867
|
c,
|
|
807
868
|
s
|
|
808
|
-
].filter(Boolean), m =
|
|
869
|
+
].filter(Boolean), m = at(d);
|
|
809
870
|
return !m && d.length > 0 ? { status: "unresolved", reason: "divergent_source_identity" } : !r || !m ? { status: "unresolved", reason: "incomplete_source_identity" } : {
|
|
810
871
|
status: "resolved",
|
|
811
872
|
source: { kind: "physical", connectionId: r, tableName: m }
|
|
812
873
|
};
|
|
813
874
|
}
|
|
814
|
-
function
|
|
815
|
-
const n = v(e.fieldMeta) ? e.fieldMeta : void 0,
|
|
875
|
+
function ct(e, t) {
|
|
876
|
+
const n = v(e.fieldMeta) ? e.fieldMeta : void 0, a = typeof (n == null ? void 0 : n.qualifiedFieldName) == "string" ? n.qualifiedFieldName.trim() : "", i = ie(
|
|
816
877
|
n == null ? void 0 : n.qualifiedFieldName
|
|
817
|
-
), r = typeof e.column == "string" ? e.column.trim() : "", o =
|
|
878
|
+
), r = typeof e.column == "string" ? e.column.trim() : "", o = ie(r), s = typeof e.qualifiedTableName == "string" ? e.qualifiedTableName.trim() : "", l = G(
|
|
818
879
|
e.qualifiedTableName
|
|
819
880
|
);
|
|
820
|
-
if (
|
|
881
|
+
if (a && !i || t && s && !l || r.includes(".") && !o)
|
|
821
882
|
return { status: "unresolved", reason: "incomplete_field_identity" };
|
|
822
883
|
const c = o.split("."), d = o ? c[c.length - 1] : r, m = t && l && d ? `${l}.${d}` : "", g = [
|
|
823
|
-
|
|
884
|
+
i,
|
|
824
885
|
o,
|
|
825
886
|
m
|
|
826
887
|
].filter(Boolean);
|
|
827
|
-
if (!
|
|
888
|
+
if (!it(
|
|
828
889
|
g,
|
|
829
|
-
|
|
890
|
+
nt
|
|
830
891
|
))
|
|
831
892
|
return { status: "unresolved", reason: "divergent_field_identity" };
|
|
832
|
-
const
|
|
833
|
-
return
|
|
893
|
+
const k = o || i || m;
|
|
894
|
+
return k ? { status: "resolved", qualifiedFieldName: k } : { status: "unresolved", reason: "incomplete_field_identity" };
|
|
834
895
|
}
|
|
835
|
-
function
|
|
896
|
+
function lt(e) {
|
|
836
897
|
if (!v(e))
|
|
837
898
|
return { status: "ineligible", reason: "invalid_input" };
|
|
838
899
|
if (e.kind === "global-date")
|
|
839
900
|
return { status: "eligible", kind: "global_date" };
|
|
840
|
-
const t =
|
|
901
|
+
const t = K(e.dataType);
|
|
841
902
|
if (t !== "date" && t !== "datetime")
|
|
842
903
|
return { status: "ineligible", reason: "non_date_filter" };
|
|
843
|
-
const n = v(e.fieldMeta) ? e.fieldMeta : void 0,
|
|
904
|
+
const n = v(e.fieldMeta) ? e.fieldMeta : void 0, a = K(
|
|
844
905
|
n == null ? void 0 : n.dataType
|
|
845
906
|
);
|
|
846
|
-
if ((n == null ? void 0 : n.dataType) !== void 0 &&
|
|
907
|
+
if ((n == null ? void 0 : n.dataType) !== void 0 && a !== "date" && a !== "datetime")
|
|
847
908
|
return { status: "ineligible", reason: "non_date_filter" };
|
|
848
909
|
if (e.customFilterPreferences)
|
|
849
910
|
return { status: "ineligible", reason: "custom_filter" };
|
|
850
911
|
if (e.targetColumns !== void 0 && (!Array.isArray(e.targetColumns) || e.targetColumns.length > 0))
|
|
851
912
|
return { status: "ineligible", reason: "multi_target_filter" };
|
|
852
|
-
const
|
|
913
|
+
const i = rt(e), r = ct(e, i === void 0);
|
|
853
914
|
if (r.status === "unresolved")
|
|
854
915
|
return { status: "ineligible", reason: r.reason };
|
|
855
|
-
const o =
|
|
916
|
+
const o = i || ot(e, r.qualifiedFieldName);
|
|
856
917
|
return o.status === "resolved" ? {
|
|
857
918
|
status: "eligible",
|
|
858
919
|
kind: "field_date",
|
|
@@ -860,114 +921,114 @@ function Je(e) {
|
|
|
860
921
|
source: o.source
|
|
861
922
|
} : { status: "ineligible", reason: o.reason };
|
|
862
923
|
}
|
|
863
|
-
function
|
|
924
|
+
function dt(e) {
|
|
864
925
|
if (!v(e) || e.kind !== "filter" || !v(e.filter))
|
|
865
926
|
return { status: "ineligible", reason: "invalid_input" };
|
|
866
|
-
const t =
|
|
927
|
+
const t = lt(
|
|
867
928
|
e.filter
|
|
868
929
|
);
|
|
869
930
|
return t.status === "ineligible" ? t : t.kind === "field_date" && v(e.compatibility) && e.compatibility.source === "cardInlineFilter" ? { status: "ineligible", reason: "card_inline_filter" } : t;
|
|
870
931
|
}
|
|
871
|
-
function
|
|
872
|
-
return
|
|
932
|
+
function qt(e) {
|
|
933
|
+
return dt(e).status === "eligible";
|
|
873
934
|
}
|
|
874
|
-
function
|
|
935
|
+
function xt(e) {
|
|
875
936
|
return `compat-filter:${e}`;
|
|
876
937
|
}
|
|
877
|
-
function
|
|
938
|
+
function Bt(e) {
|
|
878
939
|
return `compat-control:${e}`;
|
|
879
940
|
}
|
|
880
|
-
function
|
|
941
|
+
function Ft(e, t) {
|
|
881
942
|
return `compat-inline-filter:${e}:${t}`;
|
|
882
943
|
}
|
|
883
|
-
function
|
|
944
|
+
function Lt(e, t) {
|
|
884
945
|
return `compat-card-control:${e}:${t}`;
|
|
885
946
|
}
|
|
886
|
-
function
|
|
887
|
-
var
|
|
947
|
+
function ut(e) {
|
|
948
|
+
var a;
|
|
888
949
|
if (!e) return !1;
|
|
889
950
|
if (typeof e.aggregate == "string" || e.isPreAggregated) return !0;
|
|
890
951
|
const t = typeof e.expression == "string" ? e.expression : "";
|
|
891
952
|
if (!t) return !1;
|
|
892
|
-
if (
|
|
893
|
-
const n = (
|
|
894
|
-
return Array.isArray(n) && n.some((
|
|
895
|
-
const r = String((
|
|
953
|
+
if (He(t).calls.length > 0) return !0;
|
|
954
|
+
const n = (a = e.calculatedFormula) == null ? void 0 : a.inputFields;
|
|
955
|
+
return Array.isArray(n) && n.some((i) => {
|
|
956
|
+
const r = String((i == null ? void 0 : i.role) || "").toLowerCase(), o = String((i == null ? void 0 : i.aggregate) || "").trim();
|
|
896
957
|
return r === "metric" && o.length > 0;
|
|
897
958
|
});
|
|
898
959
|
}
|
|
899
|
-
function
|
|
900
|
-
return !!((e == null ? void 0 : e.role) === "metric" && (
|
|
960
|
+
function Pt(e) {
|
|
961
|
+
return !!((e == null ? void 0 : e.role) === "metric" && (Be(e) || ut(e)));
|
|
901
962
|
}
|
|
902
|
-
const
|
|
903
|
-
function
|
|
904
|
-
return `${
|
|
963
|
+
const ve = "col:";
|
|
964
|
+
function Ht(e) {
|
|
965
|
+
return `${ve}${e}`;
|
|
905
966
|
}
|
|
906
|
-
function
|
|
907
|
-
return typeof e == "string" && e.startsWith(
|
|
967
|
+
function Mt(e) {
|
|
968
|
+
return typeof e == "string" && e.startsWith(ve);
|
|
908
969
|
}
|
|
909
|
-
function
|
|
970
|
+
function ke(e, t) {
|
|
910
971
|
if (e) return e;
|
|
911
|
-
const n = t === void 0 ? "unknown" :
|
|
972
|
+
const n = t === void 0 ? "unknown" : K(t);
|
|
912
973
|
return n === "number" || n === "unknown" ? "SUM" : "COUNT";
|
|
913
974
|
}
|
|
914
|
-
function
|
|
915
|
-
const t = e.aggregate ===
|
|
975
|
+
function ft(e) {
|
|
976
|
+
const t = e.aggregate === ke(e.semanticAggregate, e.dataType);
|
|
916
977
|
return {
|
|
917
978
|
effectiveAggregate: e.aggregate,
|
|
918
979
|
aggregateSource: t ? e.semanticAggregate ? "semantic_model" : "default_sum" : "caller_override"
|
|
919
980
|
};
|
|
920
981
|
}
|
|
921
|
-
function
|
|
922
|
-
const
|
|
982
|
+
function mt(e, t, n) {
|
|
983
|
+
const a = e.effectiveAggregate !== void 0 || e.aggregateSource !== void 0;
|
|
923
984
|
return {
|
|
924
985
|
aggregate: t,
|
|
925
986
|
aggregateOrigin: n,
|
|
926
|
-
...
|
|
987
|
+
...a ? ft({ aggregate: t, semanticAggregate: e.semanticAggregate, dataType: e.dataType }) : {}
|
|
927
988
|
};
|
|
928
989
|
}
|
|
929
|
-
function
|
|
930
|
-
return { ...e, ...
|
|
990
|
+
function Ot(e, t, n) {
|
|
991
|
+
return { ...e, ...mt(e, t, n) };
|
|
931
992
|
}
|
|
932
|
-
function
|
|
993
|
+
function Rt(e) {
|
|
933
994
|
return e.aggregate ?? e.effectiveAggregate;
|
|
934
995
|
}
|
|
935
|
-
function
|
|
996
|
+
function jt(e) {
|
|
936
997
|
if (!e.aggregate) return !1;
|
|
937
998
|
if (e.aggregateOrigin === "explicit" || e.aggregateSource === "caller_override") return !0;
|
|
938
999
|
if (e.aggregateSource) {
|
|
939
|
-
const t = e.aggregateSource === "default_sum" ?
|
|
1000
|
+
const t = e.aggregateSource === "default_sum" ? ke(void 0, e.dataType) : e.semanticAggregate ?? e.effectiveAggregate;
|
|
940
1001
|
return t !== void 0 && e.aggregate !== t;
|
|
941
1002
|
}
|
|
942
1003
|
return e.aggregateOrigin !== "default";
|
|
943
1004
|
}
|
|
944
|
-
const
|
|
945
|
-
function
|
|
1005
|
+
const zt = ["label", "labelOrigin", "derivedLabel"];
|
|
1006
|
+
function $t(e) {
|
|
946
1007
|
return { label: e, labelOrigin: "override", derivedLabel: void 0 };
|
|
947
1008
|
}
|
|
948
|
-
function
|
|
949
|
-
const { derivedLabel: n, ...
|
|
950
|
-
return { ...
|
|
1009
|
+
function Wt(e, t) {
|
|
1010
|
+
const { derivedLabel: n, ...a } = e;
|
|
1011
|
+
return { ...a, label: t, labelOrigin: "override" };
|
|
951
1012
|
}
|
|
952
|
-
function
|
|
1013
|
+
function Qt(e, t) {
|
|
953
1014
|
return e.labelOrigin === "override" ? {} : { label: t, labelOrigin: "semantic" };
|
|
954
1015
|
}
|
|
955
|
-
function
|
|
1016
|
+
function Zt(e) {
|
|
956
1017
|
if (e.groupedDate !== void 0) return { target: e.groupedDate, direction: "asc" };
|
|
957
1018
|
if (!(!e.grouped || e.measures.length === 0))
|
|
958
1019
|
return { target: e.primaryMeasure ?? e.measures[0], direction: "desc" };
|
|
959
1020
|
}
|
|
960
|
-
const
|
|
1021
|
+
const Ut = /* @__PURE__ */ new Set([
|
|
961
1022
|
"contains",
|
|
962
1023
|
"startsWith",
|
|
963
1024
|
"endsWith",
|
|
964
1025
|
"like",
|
|
965
1026
|
"not like"
|
|
966
1027
|
]);
|
|
967
|
-
function
|
|
1028
|
+
function Ie(e) {
|
|
968
1029
|
return e.includes("%") || e.includes("_");
|
|
969
1030
|
}
|
|
970
|
-
function
|
|
1031
|
+
function bt(e, t) {
|
|
971
1032
|
switch (e) {
|
|
972
1033
|
case "contains":
|
|
973
1034
|
return { pattern: `%${t}%`, negate: !1 };
|
|
@@ -981,40 +1042,40 @@ function tt(e, t) {
|
|
|
981
1042
|
return { pattern: t, negate: !0 };
|
|
982
1043
|
}
|
|
983
1044
|
}
|
|
984
|
-
function
|
|
985
|
-
return
|
|
1045
|
+
function gt(e) {
|
|
1046
|
+
return Ie(e) ? e : `%${e}%`;
|
|
986
1047
|
}
|
|
987
|
-
function
|
|
988
|
-
const { pattern: n, negate:
|
|
989
|
-
if (
|
|
990
|
-
return { operator:
|
|
1048
|
+
function Kt(e, t) {
|
|
1049
|
+
const { pattern: n, negate: a } = bt(e, t), i = n.length > 2 && n.startsWith("%") && n.endsWith("%") ? n.slice(1, -1) : void 0, r = i !== void 0 && !Ie(i) ? i : n;
|
|
1050
|
+
if (gt(r) === n)
|
|
1051
|
+
return { operator: a ? "not_contains" : "contains", value: r };
|
|
991
1052
|
}
|
|
992
|
-
function
|
|
993
|
-
const { operation: t, values: n, temporalPrecision:
|
|
994
|
-
if (t !== "=" && t !== "!=" ||
|
|
1053
|
+
function Gt(e) {
|
|
1054
|
+
const { operation: t, values: n, temporalPrecision: a } = e;
|
|
1055
|
+
if (t !== "=" && t !== "!=" || a === "minute")
|
|
995
1056
|
return null;
|
|
996
|
-
const
|
|
997
|
-
if (
|
|
998
|
-
const r =
|
|
999
|
-
return
|
|
1057
|
+
const i = Array.isArray(n) ? n : [n];
|
|
1058
|
+
if (i.length !== 1 || typeof i[0] != "string") return null;
|
|
1059
|
+
const r = i[0].trim();
|
|
1060
|
+
return Ae(r) ? { operation: t, day: r } : null;
|
|
1000
1061
|
}
|
|
1001
|
-
function
|
|
1062
|
+
function Ne(e) {
|
|
1002
1063
|
const { label: t, ...n } = e;
|
|
1003
1064
|
return {
|
|
1004
|
-
dataset:
|
|
1065
|
+
dataset: Fe(n),
|
|
1005
1066
|
...e.kind === "physical" ? { dialect: e.dialect, connectionType: e.connectionType } : {}
|
|
1006
1067
|
};
|
|
1007
1068
|
}
|
|
1008
|
-
function
|
|
1009
|
-
const { label: t, source: n, ...
|
|
1010
|
-
return { ...
|
|
1069
|
+
function Ce(e) {
|
|
1070
|
+
const { label: t, source: n, ...a } = e;
|
|
1071
|
+
return { ...a, source: n && Ne(n) };
|
|
1011
1072
|
}
|
|
1012
|
-
function
|
|
1073
|
+
function Y(e) {
|
|
1013
1074
|
const {
|
|
1014
1075
|
label: t,
|
|
1015
1076
|
format: n,
|
|
1016
|
-
description:
|
|
1017
|
-
tags:
|
|
1077
|
+
description: a,
|
|
1078
|
+
tags: i,
|
|
1018
1079
|
inputs: r,
|
|
1019
1080
|
...o
|
|
1020
1081
|
} = e;
|
|
@@ -1023,71 +1084,71 @@ function V(e) {
|
|
|
1023
1084
|
inputs: Object.fromEntries(
|
|
1024
1085
|
Object.entries(r).map(([s, l]) => [
|
|
1025
1086
|
s,
|
|
1026
|
-
{ ...l, field:
|
|
1087
|
+
{ ...l, field: Ce(l.field) }
|
|
1027
1088
|
])
|
|
1028
1089
|
)
|
|
1029
1090
|
};
|
|
1030
1091
|
}
|
|
1031
|
-
function
|
|
1092
|
+
function W(e) {
|
|
1032
1093
|
const { derivedField: t, ...n } = e;
|
|
1033
1094
|
return {
|
|
1034
|
-
...
|
|
1035
|
-
derivedField: t &&
|
|
1095
|
+
...Ce(n),
|
|
1096
|
+
derivedField: t && Y(t)
|
|
1036
1097
|
};
|
|
1037
1098
|
}
|
|
1038
|
-
function
|
|
1099
|
+
function P(e) {
|
|
1039
1100
|
const {
|
|
1040
1101
|
label: t,
|
|
1041
1102
|
format: n,
|
|
1042
|
-
description:
|
|
1043
|
-
semanticTemporalPresentation:
|
|
1103
|
+
description: a,
|
|
1104
|
+
semanticTemporalPresentation: i,
|
|
1044
1105
|
derivedField: r,
|
|
1045
1106
|
calculatedFormula: o,
|
|
1046
1107
|
...s
|
|
1047
1108
|
} = e;
|
|
1048
1109
|
return {
|
|
1049
1110
|
...s,
|
|
1050
|
-
semanticTemporalPresentation:
|
|
1051
|
-
granularity:
|
|
1111
|
+
semanticTemporalPresentation: i && {
|
|
1112
|
+
granularity: i.granularity
|
|
1052
1113
|
},
|
|
1053
|
-
derivedField: r &&
|
|
1114
|
+
derivedField: r && Y(r),
|
|
1054
1115
|
calculatedFormula: o && {
|
|
1055
1116
|
...o,
|
|
1056
|
-
inputFields: o.inputFields.map(
|
|
1117
|
+
inputFields: o.inputFields.map(P)
|
|
1057
1118
|
}
|
|
1058
1119
|
};
|
|
1059
1120
|
}
|
|
1060
|
-
function
|
|
1121
|
+
function Se(e) {
|
|
1061
1122
|
return {
|
|
1062
1123
|
...e,
|
|
1063
1124
|
conditions: e.conditions.map(
|
|
1064
|
-
({ label: t, field: n, ...
|
|
1065
|
-
...
|
|
1066
|
-
field:
|
|
1125
|
+
({ label: t, field: n, ...a }) => ({
|
|
1126
|
+
...a,
|
|
1127
|
+
field: P(n)
|
|
1067
1128
|
})
|
|
1068
1129
|
),
|
|
1069
|
-
groups: e.groups.map(
|
|
1130
|
+
groups: e.groups.map(Se)
|
|
1070
1131
|
};
|
|
1071
1132
|
}
|
|
1072
|
-
function
|
|
1133
|
+
function Vt(e) {
|
|
1073
1134
|
return {
|
|
1074
1135
|
...e,
|
|
1075
|
-
source:
|
|
1136
|
+
source: Ne(e.source),
|
|
1076
1137
|
rows: e.rows.map((t) => ({
|
|
1077
1138
|
...t,
|
|
1078
|
-
field:
|
|
1139
|
+
field: W(t.field)
|
|
1079
1140
|
})),
|
|
1080
1141
|
columns: e.columns.map((t) => ({
|
|
1081
1142
|
...t,
|
|
1082
|
-
field:
|
|
1143
|
+
field: W(t.field)
|
|
1083
1144
|
})),
|
|
1084
1145
|
measures: e.measures.map(
|
|
1085
|
-
(t) => t.kind === "aggregate" ? { ...t, field:
|
|
1146
|
+
(t) => t.kind === "aggregate" ? { ...t, field: W(t.field) } : {
|
|
1086
1147
|
...t,
|
|
1087
|
-
definition:
|
|
1148
|
+
definition: Y(t.definition)
|
|
1088
1149
|
}
|
|
1089
1150
|
),
|
|
1090
|
-
filters: e.filters &&
|
|
1151
|
+
filters: e.filters && Se(e.filters),
|
|
1091
1152
|
joinPlan: e.joinPlan && {
|
|
1092
1153
|
...e.joinPlan,
|
|
1093
1154
|
// relationshipName participates in governed relationship resolution.
|
|
@@ -1095,68 +1156,78 @@ function Ft(e) {
|
|
|
1095
1156
|
...t,
|
|
1096
1157
|
joinKeyGroups: t.joinKeyGroups.map((n) => ({
|
|
1097
1158
|
...n,
|
|
1098
|
-
keys: n.keys.map((
|
|
1099
|
-
...
|
|
1100
|
-
source:
|
|
1101
|
-
target:
|
|
1159
|
+
keys: n.keys.map((a) => ({
|
|
1160
|
+
...a,
|
|
1161
|
+
source: P(a.source),
|
|
1162
|
+
target: P(a.target)
|
|
1102
1163
|
}))
|
|
1103
1164
|
}))
|
|
1104
1165
|
}))
|
|
1105
1166
|
},
|
|
1106
1167
|
// Sort scopes are keyed overrides, unlike ordered axes/calculation inputs.
|
|
1107
1168
|
sorts: [...e.sorts].sort((t, n) => {
|
|
1108
|
-
const
|
|
1109
|
-
return
|
|
1169
|
+
const a = ee(t), i = ee(n);
|
|
1170
|
+
return a < i ? -1 : a > i ? 1 : 0;
|
|
1110
1171
|
})
|
|
1111
1172
|
};
|
|
1112
1173
|
}
|
|
1113
1174
|
export {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1175
|
+
Gt as $,
|
|
1176
|
+
lt as A,
|
|
1177
|
+
dt as B,
|
|
1178
|
+
qt as C,
|
|
1179
|
+
xt as D,
|
|
1180
|
+
Bt as E,
|
|
1181
|
+
Ft as F,
|
|
1182
|
+
Lt as G,
|
|
1183
|
+
ut as H,
|
|
1184
|
+
Pt as I,
|
|
1185
|
+
Ht as J,
|
|
1186
|
+
Mt as K,
|
|
1187
|
+
Me as L,
|
|
1188
|
+
ke as M,
|
|
1189
|
+
ft as N,
|
|
1190
|
+
Ot as O,
|
|
1191
|
+
Rt as P,
|
|
1192
|
+
jt as Q,
|
|
1193
|
+
te as R,
|
|
1194
|
+
zt as S,
|
|
1195
|
+
$t as T,
|
|
1196
|
+
Wt as U,
|
|
1197
|
+
Zt as V,
|
|
1198
|
+
Ut as W,
|
|
1199
|
+
Ie as X,
|
|
1200
|
+
bt as Y,
|
|
1201
|
+
gt as Z,
|
|
1202
|
+
Kt as _,
|
|
1203
|
+
Vt as a,
|
|
1204
|
+
pe as a0,
|
|
1205
|
+
at as a1,
|
|
1206
|
+
Y as a2,
|
|
1207
|
+
nt as a3,
|
|
1208
|
+
J as b,
|
|
1209
|
+
kt as c,
|
|
1210
|
+
de as d,
|
|
1211
|
+
Re as e,
|
|
1212
|
+
me as f,
|
|
1213
|
+
Qt as g,
|
|
1214
|
+
Xe as h,
|
|
1215
|
+
At as i,
|
|
1216
|
+
It as j,
|
|
1217
|
+
Nt as k,
|
|
1218
|
+
Ct as l,
|
|
1219
|
+
mt as m,
|
|
1220
|
+
ye as n,
|
|
1221
|
+
et as o,
|
|
1222
|
+
z as p,
|
|
1223
|
+
$ as q,
|
|
1224
|
+
le as r,
|
|
1225
|
+
_t as s,
|
|
1226
|
+
Tt as t,
|
|
1227
|
+
Dt as u,
|
|
1228
|
+
tt as v,
|
|
1229
|
+
St as w,
|
|
1230
|
+
Et as x,
|
|
1231
|
+
st as y,
|
|
1232
|
+
we as z
|
|
1162
1233
|
};
|