react-semaphor 0.1.598 → 0.1.600
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 +336 -333
- 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-C86FsM8D.js → add-to-dashboard-ClhEIFst.js} +1 -1
- package/dist/chunks/{analytics-base-schemas-8wz9vqn_.js → analytics-base-schemas-DevrgqQb.js} +67 -60
- package/dist/chunks/{assistant-chat-DrI442Ld.js → assistant-chat-BULOkG9j.js} +88 -89
- package/dist/chunks/{bookmark-impact-C6uWtNWF.js → bookmark-impact-kdvXke8n.js} +3 -3
- package/dist/chunks/{bookmark-state-BfeKmj5s.js → bookmark-state-h1OLXVjE.js} +153 -153
- package/dist/chunks/{card-filter-builder-CSKCSpNo.js → card-filter-builder-CSCdSQQy.js} +1035 -1063
- package/dist/chunks/{comparison-window-caption-3bum5j00.js → comparison-window-caption-DJDwP9XO.js} +6 -6
- package/dist/chunks/{context-CVXTFljo.js → context-BJoEFgNl.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-C2AuKs10.js → dashboard-briefing-launcher-9YwUclHA.js} +255 -255
- package/dist/chunks/{dashboard-controls-BSbhyIkY.js → dashboard-controls-O6PNXMCp.js} +85 -85
- package/dist/chunks/{dashboard-json-Bd1rxD3y.js → dashboard-json-Bxf91TYq.js} +5 -5
- package/dist/chunks/{dashboard-PYd63LbL.js → dashboard-y9ON19ge.js} +1 -1
- package/dist/chunks/dates-DPTbpNxK.js +164 -0
- package/dist/chunks/{edit-dashboard-visual-D_0ZiWev.js → edit-dashboard-visual-CKwaW8H_.js} +5489 -5435
- package/dist/chunks/{filter-line-BdLyPYjH.js → filter-line-Dkg3yuOX.js} +6 -6
- package/dist/chunks/{filter-reach-copy-Dxn-mTuG.js → filter-reach-copy-ClzNcNhP.js} +1740 -1643
- package/dist/chunks/{filter-value-text-C6g-nDUW.js → filter-value-text-CXyuLW9Q.js} +4 -4
- package/dist/chunks/{index-BHSDE54O.js → index-CRo5--Y6.js} +7 -7
- package/dist/chunks/{layout-grid-CYR-LVpl.js → layout-grid-DSrBSfPM.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-C0IGLTZH.js → matrix-analytical-definition-i9PQY066.js} +443 -394
- package/dist/chunks/{matrix-member-presentation-D5BIYuy5.js → matrix-member-presentation-B_2beBc0.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-RckfqkQm.js → matrix-operation-contract-DdK0J_KU.js} +36 -36
- package/dist/chunks/{metric-comparison-DsE8wdRh.js → metric-comparison-Bhz0V841.js} +2 -2
- package/dist/chunks/{paintbrush-xDDRjIyF.js → paintbrush-1UiU-uTz.js} +1 -1
- package/dist/chunks/{palette-CbOgFCy2.js → palette-DFIFf_-m.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-Cnq55Uno.js → pivot-result-contract-expectations-Dk7WFR_u.js} +8 -8
- package/dist/chunks/{pivot-result-identity-b4-ugQhm.js → pivot-result-identity-CzzrJpEm.js} +1 -1
- package/dist/chunks/{raw-temporal-value-B9W38mi3.js → raw-temporal-value-BLvdaMng.js} +2 -2
- package/dist/chunks/{report-preferences-dialog-DTu3a7ce.js → report-preferences-dialog-DiDsYpng.js} +14 -14
- package/dist/chunks/{report-runtime-context-BvJkcbar.js → report-runtime-context-CEGluufW.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-Bw-DesV2.js → resolve-dashboard-input-context-BAv33KGg.js} +11811 -11331
- package/dist/chunks/{save-BgvAsp6X.js → save-CWQ02kHo.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-BFh0oOnF.js → saved-dashboard-context-CvzYqADe.js} +97 -97
- package/dist/chunks/{selection-filter-compiler-DHYsq3yM.js → selection-filter-compiler-SwrBvyyJ.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-WvgHMnj8.js → semaphor-ready-indicator-1PRI9Yh2.js} +59336 -58569
- package/dist/chunks/{shelf-drop-preview-context-D6HgYFJp.js → shelf-drop-preview-context-BLk5Nc6K.js} +6 -6
- package/dist/chunks/{stored-dashboard-vlG0Knxi.js → stored-dashboard-xhYYKBsO.js} +1200 -1183
- package/dist/chunks/{style-sheet-parts-ClmvtkSC.js → style-sheet-parts-BX7d7-2-.js} +198 -198
- package/dist/chunks/{table-export-sheet-Bv6tVuMu.js → table-export-sheet-BWSVTclx.js} +1 -1
- package/dist/chunks/{token-types-eMdcuB6j.js → token-types-CnlEiAdS.js} +1 -1
- package/dist/chunks/{upload-ClUeK8F0.js → upload-DsqUSS8l.js} +1 -1
- package/dist/chunks/{validators-DwhBEvnh.js → validators-D2Hm57lJ.js} +23 -13
- package/dist/chunks/{variable-draft-CauoSBN0.js → variable-draft-DcKj8T1b.js} +4 -4
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +2497 -2549
- package/dist/format-utils/index.js +14 -14
- package/dist/index.js +48 -48
- 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/surfboard/filter/types.d.ts +13 -1
- package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +0 -2
- package/dist/types/components/visual/data-table/types/data-table.d.ts +14 -21
- package/dist/types/index.js +5 -5
- package/dist/types/lib/dashboard-view-state/card-view-state.d.ts +11 -1
- package/dist/types/lib/dashboard-view-state/drill-path.d.ts +7 -0
- package/dist/types/lib/dashboard-viewer/table-view.d.ts +20 -0
- package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +8 -0
- package/dist/types/lib/matrix-table/matrix-runtime.d.ts +1 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +2 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +3 -1
- package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +64 -0
- package/dist/types/shared/analytics-protocol/catalog-source-address.d.ts +16 -0
- package/dist/types/shared/analytics-protocol/column-filter-id.d.ts +4 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +26 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +12 -1
- package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +4 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +8 -1
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +3 -1
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +29 -1
- package/dist/types/shared/usage-events/attribution.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 +1 -1
- package/dist/chunks/aggregate-measure-field-DtKcEjG5.js +0 -22
- package/dist/chunks/dates-DHMCf-F7.js +0 -115
- package/dist/chunks/list-filter-B67GsjTw.js +0 -15
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
import { G as
|
|
2
|
-
import { ap as C, ar as
|
|
3
|
-
import { a as
|
|
1
|
+
import { G as O, H as A, E as he, I as te, F as K, L as pe } from "./raw-temporal-value-BLvdaMng.js";
|
|
2
|
+
import { ai as w, ap as C, ar as z, aj as U, ah as p, aq as ve, aw as Ne, ak as ke, a7 as Q, e as Ie, K as J, t as Ce } from "./validators-D2Hm57lJ.js";
|
|
3
|
+
import { a as _e } from "./metric-comparison-Bhz0V841.js";
|
|
4
|
+
import { M as Se } from "./matrix-operation-contract-DdK0J_KU.js";
|
|
4
5
|
class Y extends Error {
|
|
5
6
|
constructor(t) {
|
|
6
7
|
super(t), this.name = "RelativeDateUsageError";
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
+
function Ae(e, t, n = {}) {
|
|
10
11
|
const i = n.spansBack ?? 0;
|
|
11
|
-
if (i !== 0) return
|
|
12
|
+
if (i !== 0) return Te(e, t, i);
|
|
12
13
|
const { calendar: a, now: r } = t;
|
|
13
14
|
switch (e.kind) {
|
|
14
15
|
case "periods": {
|
|
15
|
-
const
|
|
16
|
+
const o = ne(e, t);
|
|
16
17
|
return {
|
|
17
|
-
start: K(
|
|
18
|
-
end: e.toDate ?
|
|
18
|
+
start: K(o, e.unit, a, e.from).start,
|
|
19
|
+
end: e.toDate ? o : ie(o, e.unit, a, e.to)
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
case "rolling": {
|
|
22
|
-
const
|
|
23
|
+
const o = e.anchor === "latest_data" ? t.latestData ?? r : r, s = he[e.unit];
|
|
23
24
|
return {
|
|
24
|
-
start:
|
|
25
|
-
end:
|
|
25
|
+
start: s === void 0 ? te(o, -e.n, e.unit, a) : new Date(o.getTime() - e.n * s),
|
|
26
|
+
end: o
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
case "monthDay": {
|
|
29
|
-
const
|
|
30
|
-
return { start:
|
|
30
|
+
const o = e.day === "first" ? O(r, "month", a) : A(r, "month", a);
|
|
31
|
+
return { start: O(o, "day", a), end: A(o, "day", a) };
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
function ne(e, t) {
|
|
35
36
|
const { anchor: n } = e;
|
|
36
|
-
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(O(t.now, n.lastComplete, t.calendar).getTime() - 1);
|
|
37
38
|
}
|
|
38
39
|
function ie(e, t, n, i) {
|
|
39
40
|
return new Date(K(e, t, n, i).endExclusive.getTime() - 1);
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function Te(e, t, n) {
|
|
42
43
|
if (!Number.isInteger(n) || n < 0)
|
|
43
44
|
throw new Y(`spansBack must be a whole number of spans, got ${n}.`);
|
|
44
45
|
if (e.kind !== "periods" || typeof e.anchor != "object")
|
|
45
46
|
throw new Y("spansBack applies only to a window anchored at the end of the last complete period.");
|
|
46
|
-
const { calendar: i } = t, { unit: a } = e, r =
|
|
47
|
-
if (
|
|
48
|
-
return { start:
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
const { calendar: i } = t, { unit: a } = e, r = Ae(e, t), o = -n * (e.to - e.from + 1), s = K(r.start, a, i, o).start;
|
|
48
|
+
if (A(r.end, a, i).getTime() === r.end.getTime())
|
|
49
|
+
return { start: s, end: ie(r.end, a, i, o) };
|
|
50
|
+
const l = te(ne(e, t), o, a, i), c = Math.min(
|
|
51
|
+
A(l, e.anchor.lastComplete, i).getTime(),
|
|
52
|
+
A(l, a, i).getTime()
|
|
52
53
|
);
|
|
53
|
-
return { start:
|
|
54
|
+
return { start: s, end: new Date(c) };
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function G(e) {
|
|
56
57
|
return e.prefixLevels.length === 1 && e.prefixLevels[0] === "table" ? ["table"] : Array.from(
|
|
57
58
|
/* @__PURE__ */ new Set([
|
|
58
59
|
"database",
|
|
@@ -60,20 +61,32 @@ function ae(e) {
|
|
|
60
61
|
])
|
|
61
62
|
);
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
-
const
|
|
64
|
+
function ae(e) {
|
|
65
|
+
const { recorded: t, capabilities: n } = e, i = G(n);
|
|
66
|
+
return !(t.databaseName && !i.includes("database") || t.schemaName && !i.includes("schema")) || !t.tableName ? t : {
|
|
67
|
+
...w({
|
|
68
|
+
qualifiedName: [t.databaseName, t.schemaName, t.tableName].filter(Boolean).join("."),
|
|
69
|
+
capabilities: n
|
|
70
|
+
}),
|
|
71
|
+
...i.includes("database") && t.databaseName ? { databaseName: t.databaseName } : {},
|
|
72
|
+
...i.includes("schema") && t.schemaName ? { schemaName: t.schemaName } : {},
|
|
73
|
+
tableName: t.tableName
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function rt(e) {
|
|
77
|
+
const t = e.source.connectionType ? C(e.source.connectionType) : void 0, n = e.source.dialect ? z(e.source.dialect) : void 0, i = e.source.dialect && e.source.dialect !== "unknown" ? C(e.source.dialect) : void 0;
|
|
65
78
|
if (!e.capabilities && e.source.connectionType && e.source.dialect && e.source.dialect !== "unknown" && (!t || n === "unknown" || t.dialect !== n))
|
|
66
79
|
return { kind: "incompatible_capabilities" };
|
|
67
80
|
const a = e.capabilities || t || i;
|
|
68
81
|
if (!a) return { kind: "incompatible_capabilities" };
|
|
69
|
-
const r =
|
|
82
|
+
const r = G(a), o = {
|
|
70
83
|
...r.includes("database") && e.source.databaseName ? { databaseName: e.source.databaseName } : {},
|
|
71
84
|
...r.includes("schema") && e.source.schemaName ? { schemaName: e.source.schemaName } : {},
|
|
72
85
|
...e.source.tableName ? { tableName: e.source.tableName } : {}
|
|
73
|
-
},
|
|
74
|
-
return
|
|
86
|
+
}, s = r.filter((l) => l === "database" ? !o.databaseName : l === "schema" ? !o.schemaName : !o.tableName);
|
|
87
|
+
return s.length > 0 ? { kind: "missing_coordinates", missing: s } : {
|
|
75
88
|
kind: "resolved",
|
|
76
|
-
coordinates:
|
|
89
|
+
coordinates: o
|
|
77
90
|
};
|
|
78
91
|
}
|
|
79
92
|
function f(e) {
|
|
@@ -82,55 +95,58 @@ function f(e) {
|
|
|
82
95
|
function D(e) {
|
|
83
96
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
84
97
|
}
|
|
85
|
-
function
|
|
98
|
+
function se(e) {
|
|
86
99
|
const t = D(e);
|
|
87
100
|
return !t || !f(t.name) || t.type === "model" ? !1 : t.type === "dataset" ? t.datasetType === "physical" : !0;
|
|
88
101
|
}
|
|
89
|
-
function q(e) {
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
const
|
|
93
|
-
return {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
function q(e, t) {
|
|
103
|
+
const n = D(e);
|
|
104
|
+
if (!n) return {};
|
|
105
|
+
const i = f(n.table) || f(n.name);
|
|
106
|
+
return ae({
|
|
107
|
+
recorded: {
|
|
108
|
+
...f(n.database) ? { databaseName: f(n.database) } : {},
|
|
109
|
+
...f(n.schema) ? { schemaName: f(n.schema) } : {},
|
|
110
|
+
...i ? { tableName: i } : {}
|
|
111
|
+
},
|
|
112
|
+
capabilities: t
|
|
113
|
+
});
|
|
98
114
|
}
|
|
99
|
-
function
|
|
100
|
-
if (
|
|
101
|
-
const t = e.entities.filter(
|
|
115
|
+
function De(e) {
|
|
116
|
+
if (Be(e)) return { kind: "malformed" };
|
|
117
|
+
const t = e.entities.filter(se), n = Ee(e), i = qe({
|
|
102
118
|
entities: t,
|
|
103
119
|
connectionType: e.connectionType,
|
|
104
120
|
dialect: e.dialect,
|
|
105
121
|
capabilities: e.capabilities
|
|
106
122
|
});
|
|
107
123
|
if (!i) return { kind: "incompatible_capabilities" };
|
|
108
|
-
const { capabilities: a } = i, r =
|
|
124
|
+
const { capabilities: a } = i, r = He({
|
|
109
125
|
hints: e.qualifiedHints || [],
|
|
110
126
|
coordinateHint: e.coordinateHint,
|
|
111
127
|
capabilityAuthority: i
|
|
112
128
|
});
|
|
113
129
|
if (r.kind !== "valid")
|
|
114
130
|
return { kind: r.kind };
|
|
115
|
-
const
|
|
116
|
-
(c) =>
|
|
117
|
-
left:
|
|
118
|
-
q(c),
|
|
131
|
+
const o = r.coordinates, s = o ? t.filter(
|
|
132
|
+
(c) => U({
|
|
133
|
+
left: oe(
|
|
134
|
+
q(c, a),
|
|
119
135
|
a
|
|
120
136
|
),
|
|
121
|
-
right:
|
|
137
|
+
right: o,
|
|
122
138
|
capabilities: a
|
|
123
139
|
})
|
|
124
140
|
) : t;
|
|
125
|
-
if (
|
|
141
|
+
if (o && s.length === 0)
|
|
126
142
|
return {
|
|
127
143
|
kind: "not_found",
|
|
128
144
|
basis: "qualified",
|
|
129
|
-
coordinates:
|
|
145
|
+
coordinates: o,
|
|
130
146
|
capabilityAuthority: i
|
|
131
147
|
};
|
|
132
|
-
if (
|
|
133
|
-
const c =
|
|
148
|
+
if (o && s.length === 1) {
|
|
149
|
+
const c = s[0], d = R(
|
|
134
150
|
i,
|
|
135
151
|
c
|
|
136
152
|
);
|
|
@@ -138,35 +154,41 @@ function _e(e) {
|
|
|
138
154
|
kind: "resolved",
|
|
139
155
|
basis: "qualified",
|
|
140
156
|
entity: c,
|
|
141
|
-
coordinates:
|
|
142
|
-
q(
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
coordinates: Re(
|
|
158
|
+
q(
|
|
159
|
+
c,
|
|
160
|
+
d.capabilities
|
|
161
|
+
),
|
|
162
|
+
o,
|
|
163
|
+
d
|
|
145
164
|
),
|
|
146
|
-
capabilityAuthority:
|
|
165
|
+
capabilityAuthority: d
|
|
147
166
|
};
|
|
148
167
|
}
|
|
149
|
-
const
|
|
168
|
+
const l = re([
|
|
150
169
|
...e.bareHints || [],
|
|
151
170
|
...r.bareHints,
|
|
152
|
-
|
|
171
|
+
o == null ? void 0 : o.tableName
|
|
153
172
|
]);
|
|
154
|
-
if (
|
|
155
|
-
const c =
|
|
156
|
-
const m =
|
|
157
|
-
return Array.from(
|
|
173
|
+
if (l.size > 0) {
|
|
174
|
+
const c = s.filter((d) => {
|
|
175
|
+
const m = Pe(d);
|
|
176
|
+
return Array.from(l).some((g) => m.has(g));
|
|
158
177
|
});
|
|
159
178
|
if (c.length === 1) {
|
|
160
|
-
const
|
|
179
|
+
const d = c[0], m = R(
|
|
161
180
|
i,
|
|
162
|
-
|
|
181
|
+
d
|
|
163
182
|
);
|
|
164
183
|
return {
|
|
165
184
|
kind: "resolved",
|
|
166
185
|
basis: "bare",
|
|
167
|
-
entity:
|
|
168
|
-
coordinates:
|
|
169
|
-
q(
|
|
186
|
+
entity: d,
|
|
187
|
+
coordinates: B(
|
|
188
|
+
q(
|
|
189
|
+
d,
|
|
190
|
+
m.capabilities
|
|
191
|
+
),
|
|
170
192
|
m
|
|
171
193
|
),
|
|
172
194
|
capabilityAuthority: m
|
|
@@ -174,7 +196,7 @@ function _e(e) {
|
|
|
174
196
|
}
|
|
175
197
|
return c.length > 1 ? { kind: "ambiguous", basis: "bare" } : { kind: "not_found", basis: "bare", capabilityAuthority: i };
|
|
176
198
|
}
|
|
177
|
-
if (
|
|
199
|
+
if (o)
|
|
178
200
|
return { kind: "ambiguous", basis: "qualified" };
|
|
179
201
|
if (n)
|
|
180
202
|
return {
|
|
@@ -183,7 +205,7 @@ function _e(e) {
|
|
|
183
205
|
capabilityAuthority: i
|
|
184
206
|
};
|
|
185
207
|
if (t.length === 1) {
|
|
186
|
-
const c = t[0],
|
|
208
|
+
const c = t[0], d = R(
|
|
187
209
|
i,
|
|
188
210
|
c
|
|
189
211
|
);
|
|
@@ -191,16 +213,19 @@ function _e(e) {
|
|
|
191
213
|
kind: "resolved",
|
|
192
214
|
basis: "unqualified",
|
|
193
215
|
entity: c,
|
|
194
|
-
coordinates:
|
|
195
|
-
q(
|
|
196
|
-
|
|
216
|
+
coordinates: B(
|
|
217
|
+
q(
|
|
218
|
+
c,
|
|
219
|
+
d.capabilities
|
|
220
|
+
),
|
|
221
|
+
d
|
|
197
222
|
),
|
|
198
|
-
capabilityAuthority:
|
|
223
|
+
capabilityAuthority: d
|
|
199
224
|
};
|
|
200
225
|
}
|
|
201
226
|
return { kind: "unqualified" };
|
|
202
227
|
}
|
|
203
|
-
function
|
|
228
|
+
function Ee(e) {
|
|
204
229
|
const t = (e.qualifiedHints || []).map(f).filter((i) => !!i);
|
|
205
230
|
return Object.values(e.coordinateHint || {}).some(
|
|
206
231
|
(i) => !!f(i)
|
|
@@ -208,63 +233,63 @@ function Se(e) {
|
|
|
208
233
|
(i) => !!f(i)
|
|
209
234
|
) ? "bare" : void 0;
|
|
210
235
|
}
|
|
211
|
-
function
|
|
236
|
+
function T(e) {
|
|
212
237
|
return `${e.dialect}:${e.prefixLevels.join(".")}`;
|
|
213
238
|
}
|
|
214
|
-
function
|
|
239
|
+
function F(e) {
|
|
215
240
|
return {
|
|
216
241
|
dialect: e.dialect,
|
|
217
242
|
prefixLevels: [...e.prefixLevels]
|
|
218
243
|
};
|
|
219
244
|
}
|
|
220
|
-
function
|
|
221
|
-
var
|
|
222
|
-
const t = f(e.connectionType), n = f(e.dialect), i = e.capabilities ?
|
|
223
|
-
if (t && !a || n && n !== "unknown" && r === "unknown" || i && a &&
|
|
245
|
+
function qe(e) {
|
|
246
|
+
var N;
|
|
247
|
+
const t = f(e.connectionType), n = f(e.dialect), i = e.capabilities ? F(e.capabilities) : void 0, a = t ? C(t) : void 0, r = n ? z(n) : void 0, o = n && n !== "unknown" ? C(n) : void 0;
|
|
248
|
+
if (t && !a || n && n !== "unknown" && r === "unknown" || i && a && T(i) !== T(a))
|
|
224
249
|
return;
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
227
|
-
return r && r !== "unknown" &&
|
|
228
|
-
capabilities:
|
|
250
|
+
const s = i || (a ? F(a) : o ? F(o) : void 0);
|
|
251
|
+
if (s)
|
|
252
|
+
return r && r !== "unknown" && s.dialect !== r ? void 0 : {
|
|
253
|
+
capabilities: s,
|
|
229
254
|
...t ? { connectionType: t } : {},
|
|
230
|
-
dialect:
|
|
255
|
+
dialect: s.dialect,
|
|
231
256
|
evidence: "explicit"
|
|
232
257
|
};
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
if (h && !S ||
|
|
258
|
+
const l = e.entities.map((b) => {
|
|
259
|
+
const k = D(b), h = f(k == null ? void 0 : k.connectionType), I = f(k == null ? void 0 : k.dialect), S = h ? C(h) : void 0, E = I ? z(I) : void 0, L = I && I !== "unknown" ? C(I) : void 0;
|
|
260
|
+
if (h && !S || I && I !== "unknown" && E === "unknown" || I && I !== "unknown" && !S && !L || S && E && E !== "unknown" && S.dialect !== E)
|
|
236
261
|
return;
|
|
237
|
-
const
|
|
262
|
+
const X = S || L, P = X ? F(X) : Fe(k);
|
|
238
263
|
return P ? {
|
|
239
264
|
capabilities: P,
|
|
240
265
|
connectionType: h,
|
|
241
|
-
capabilityIdentity: h ?
|
|
242
|
-
inferred: !S && !
|
|
243
|
-
signature:
|
|
266
|
+
capabilityIdentity: h ? ve(h) : void 0,
|
|
267
|
+
inferred: !S && !L,
|
|
268
|
+
signature: T(P)
|
|
244
269
|
} : void 0;
|
|
245
270
|
});
|
|
246
|
-
if (
|
|
247
|
-
const c =
|
|
271
|
+
if (l.some((b) => !b)) return;
|
|
272
|
+
const c = l.filter(
|
|
248
273
|
(b) => !!b
|
|
249
274
|
);
|
|
250
275
|
if (new Set(c.map((b) => b.signature)).size > 1)
|
|
251
276
|
return;
|
|
252
|
-
const
|
|
253
|
-
if (!
|
|
277
|
+
const d = (N = c[0]) == null ? void 0 : N.capabilities;
|
|
278
|
+
if (!d || r && r !== "unknown" && d.dialect !== r)
|
|
254
279
|
return;
|
|
255
280
|
const m = new Set(
|
|
256
281
|
c.map((b) => b.capabilityIdentity).filter((b) => !!b)
|
|
257
|
-
),
|
|
282
|
+
), g = c.every(
|
|
258
283
|
(b) => b.connectionType && b.capabilityIdentity
|
|
259
284
|
);
|
|
260
285
|
return {
|
|
261
|
-
capabilities:
|
|
262
|
-
...
|
|
263
|
-
dialect:
|
|
286
|
+
capabilities: d,
|
|
287
|
+
...g && m.size === 1 ? { connectionType: c[0].connectionType } : {},
|
|
288
|
+
dialect: d.dialect,
|
|
264
289
|
evidence: c.every((b) => b.inferred) ? "coordinates" : "entity"
|
|
265
290
|
};
|
|
266
291
|
}
|
|
267
|
-
function
|
|
292
|
+
function Fe(e) {
|
|
268
293
|
const t = !!f(e == null ? void 0 : e.database), n = !!f(e == null ? void 0 : e.schema);
|
|
269
294
|
if (!(t && n)) {
|
|
270
295
|
if (n)
|
|
@@ -273,13 +298,13 @@ function Ae(e) {
|
|
|
273
298
|
return { dialect: "unknown", prefixLevels: ["database", "table"] };
|
|
274
299
|
}
|
|
275
300
|
}
|
|
276
|
-
function
|
|
301
|
+
function R(e, t) {
|
|
277
302
|
var a;
|
|
278
303
|
if (e.evidence !== "entity") return e;
|
|
279
304
|
const n = f((a = D(t)) == null ? void 0 : a.connectionType), i = n ? C(n) : void 0;
|
|
280
|
-
return i &&
|
|
305
|
+
return i && T(i) === T(e.capabilities) ? { ...e, connectionType: n } : e;
|
|
281
306
|
}
|
|
282
|
-
function
|
|
307
|
+
function Be(e) {
|
|
283
308
|
return (e.qualifiedHints || []).some(
|
|
284
309
|
(n) => {
|
|
285
310
|
const i = f(n);
|
|
@@ -290,58 +315,58 @@ function De(e) {
|
|
|
290
315
|
return !!(i && !p(i));
|
|
291
316
|
});
|
|
292
317
|
}
|
|
293
|
-
function
|
|
318
|
+
function He(e) {
|
|
294
319
|
const { capabilities: t } = e.capabilityAuthority, n = [], i = [];
|
|
295
320
|
for (const m of e.hints) {
|
|
296
|
-
const
|
|
297
|
-
if (!
|
|
298
|
-
if (!
|
|
299
|
-
i.push(
|
|
321
|
+
const g = f(m);
|
|
322
|
+
if (!g) continue;
|
|
323
|
+
if (!g.includes(".")) {
|
|
324
|
+
i.push(g);
|
|
300
325
|
continue;
|
|
301
326
|
}
|
|
302
|
-
const
|
|
303
|
-
if (!
|
|
304
|
-
n.push(
|
|
327
|
+
const N = p(g);
|
|
328
|
+
if (!N) return { kind: "malformed" };
|
|
329
|
+
n.push(N);
|
|
305
330
|
}
|
|
306
|
-
const a =
|
|
331
|
+
const a = xe(e.coordinateHint);
|
|
307
332
|
if (a.kind === "malformed") return a;
|
|
308
333
|
const r = Array.from(new Set(n)).map(
|
|
309
|
-
(m) =>
|
|
334
|
+
(m) => w({
|
|
310
335
|
qualifiedName: m,
|
|
311
336
|
capabilities: t
|
|
312
337
|
})
|
|
313
338
|
);
|
|
314
|
-
if (!
|
|
339
|
+
if (!Le(r, t))
|
|
315
340
|
return { kind: "conflicting" };
|
|
316
|
-
const
|
|
317
|
-
(m,
|
|
318
|
-
)[0],
|
|
319
|
-
qualifiedName:
|
|
341
|
+
const o = [...new Set(n)].sort(
|
|
342
|
+
(m, g) => g.split(".").length - m.split(".").length
|
|
343
|
+
)[0], s = o ? w({
|
|
344
|
+
qualifiedName: o,
|
|
320
345
|
capabilities: t
|
|
321
|
-
}) : void 0,
|
|
346
|
+
}) : void 0, l = oe(
|
|
322
347
|
a.coordinates,
|
|
323
348
|
t
|
|
324
|
-
), c =
|
|
349
|
+
), c = B(
|
|
325
350
|
a.coordinates,
|
|
326
351
|
e.capabilityAuthority
|
|
327
|
-
),
|
|
328
|
-
return
|
|
329
|
-
left:
|
|
330
|
-
right:
|
|
352
|
+
), d = !!(l.tableName && (l.databaseName || l.schemaName));
|
|
353
|
+
return s && d && !U({
|
|
354
|
+
left: s,
|
|
355
|
+
right: l,
|
|
331
356
|
capabilities: t
|
|
332
357
|
}) ? { kind: "conflicting" } : {
|
|
333
358
|
kind: "valid",
|
|
334
|
-
coordinates:
|
|
359
|
+
coordinates: s ? {
|
|
335
360
|
...c,
|
|
336
|
-
...
|
|
337
|
-
} :
|
|
361
|
+
...s
|
|
362
|
+
} : d ? c : void 0,
|
|
338
363
|
bareHints: [
|
|
339
364
|
...i,
|
|
340
|
-
...!
|
|
365
|
+
...!d && l.tableName ? [l.tableName] : []
|
|
341
366
|
]
|
|
342
367
|
};
|
|
343
368
|
}
|
|
344
|
-
function
|
|
369
|
+
function xe(e) {
|
|
345
370
|
const t = {};
|
|
346
371
|
for (const [n, i] of Object.entries(e || {})) {
|
|
347
372
|
const a = f(i);
|
|
@@ -352,17 +377,17 @@ function qe(e) {
|
|
|
352
377
|
}
|
|
353
378
|
return { kind: "valid", coordinates: t };
|
|
354
379
|
}
|
|
355
|
-
function
|
|
380
|
+
function oe(e, t) {
|
|
356
381
|
return {
|
|
357
382
|
...t.prefixLevels.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
358
383
|
...t.prefixLevels.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
359
384
|
...e.tableName ? { tableName: e.tableName } : {}
|
|
360
385
|
};
|
|
361
386
|
}
|
|
362
|
-
function
|
|
387
|
+
function Le(e, t) {
|
|
363
388
|
return e.every(
|
|
364
389
|
(n, i) => e.slice(i + 1).every(
|
|
365
|
-
(a) =>
|
|
390
|
+
(a) => U({
|
|
366
391
|
left: n,
|
|
367
392
|
right: a,
|
|
368
393
|
capabilities: t
|
|
@@ -375,7 +400,7 @@ function re(e) {
|
|
|
375
400
|
e.map(f).map(p).filter((t) => !!t)
|
|
376
401
|
);
|
|
377
402
|
}
|
|
378
|
-
function
|
|
403
|
+
function Pe(e) {
|
|
379
404
|
const t = D(e);
|
|
380
405
|
return t ? re([
|
|
381
406
|
f(t.name),
|
|
@@ -383,8 +408,8 @@ function Fe(e) {
|
|
|
383
408
|
f(t.id)
|
|
384
409
|
]) : /* @__PURE__ */ new Set();
|
|
385
410
|
}
|
|
386
|
-
function
|
|
387
|
-
return
|
|
411
|
+
function Re(e, t, n) {
|
|
412
|
+
return B(
|
|
388
413
|
{
|
|
389
414
|
...e,
|
|
390
415
|
...t
|
|
@@ -392,8 +417,8 @@ function He(e, t, n) {
|
|
|
392
417
|
n
|
|
393
418
|
);
|
|
394
419
|
}
|
|
395
|
-
function
|
|
396
|
-
const n = t.evidence === "coordinates" ? t.capabilities.prefixLevels :
|
|
420
|
+
function B(e, t) {
|
|
421
|
+
const n = t.evidence === "coordinates" ? t.capabilities.prefixLevels : G(t.capabilities);
|
|
397
422
|
return {
|
|
398
423
|
...n.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
399
424
|
...n.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
@@ -406,7 +431,7 @@ function u(e) {
|
|
|
406
431
|
function _(e) {
|
|
407
432
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
408
433
|
}
|
|
409
|
-
function
|
|
434
|
+
function je(e) {
|
|
410
435
|
const t = _(e);
|
|
411
436
|
return !!(t && t.type === "dataset" && u(t.name));
|
|
412
437
|
}
|
|
@@ -423,8 +448,8 @@ function Z(e) {
|
|
|
423
448
|
if (!a) continue;
|
|
424
449
|
const r = a.toLowerCase();
|
|
425
450
|
t.add(r);
|
|
426
|
-
const
|
|
427
|
-
|
|
451
|
+
const o = r.split("."), s = o[o.length - 1];
|
|
452
|
+
s && t.add(s);
|
|
428
453
|
}
|
|
429
454
|
return t;
|
|
430
455
|
}
|
|
@@ -433,38 +458,38 @@ function H(e) {
|
|
|
433
458
|
const t = u(e);
|
|
434
459
|
return t ? (n = p(t)) == null ? void 0 : n.toLowerCase() : void 0;
|
|
435
460
|
}
|
|
436
|
-
function
|
|
461
|
+
function j(e, t) {
|
|
437
462
|
const n = _(t), i = u(n == null ? void 0 : n.domainId) || u(e.semanticDomainId), a = u(n == null ? void 0 : n.name);
|
|
438
463
|
if (!i || !a) return;
|
|
439
|
-
const r = (n == null ? void 0 : n.datasetType) === "physical" ? void 0 :
|
|
464
|
+
const r = (n == null ? void 0 : n.datasetType) === "physical" ? void 0 : Ne(n || {}), o = u(n == null ? void 0 : n.connectionId) || u(e.connectionId);
|
|
440
465
|
return {
|
|
441
466
|
kind: "semantic",
|
|
442
467
|
domainId: i,
|
|
443
468
|
datasetName: a,
|
|
444
469
|
...r ? { datasetId: r } : {},
|
|
445
|
-
...
|
|
470
|
+
...o ? { connectionId: o } : {}
|
|
446
471
|
};
|
|
447
472
|
}
|
|
448
|
-
function
|
|
473
|
+
function Me(e, t = {}) {
|
|
449
474
|
const n = u(e.fieldEntityType);
|
|
450
475
|
if (n && n !== "dataset")
|
|
451
476
|
return { kind: "unqualified" };
|
|
452
477
|
const i = e.entities.filter(
|
|
453
|
-
(
|
|
478
|
+
(o) => t.includePhysicalDatasets ? je(o) : ce(o)
|
|
454
479
|
), a = u(e.entityId);
|
|
455
480
|
if (a) {
|
|
456
|
-
const
|
|
457
|
-
const c = _(
|
|
458
|
-
return !!(
|
|
481
|
+
const o = H(a), s = i.filter((l) => {
|
|
482
|
+
const c = _(l);
|
|
483
|
+
return !!(o && H(c == null ? void 0 : c.id) === o);
|
|
459
484
|
});
|
|
460
|
-
if (
|
|
461
|
-
if (
|
|
462
|
-
const
|
|
463
|
-
return
|
|
485
|
+
if (s.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
486
|
+
if (s.length === 1) {
|
|
487
|
+
const l = j(e, s[0]);
|
|
488
|
+
return l ? {
|
|
464
489
|
kind: "resolved",
|
|
465
490
|
basis: "bare",
|
|
466
|
-
entity:
|
|
467
|
-
source:
|
|
491
|
+
entity: s[0],
|
|
492
|
+
source: l,
|
|
468
493
|
matchedById: !0
|
|
469
494
|
} : { kind: "not_found", basis: "bare" };
|
|
470
495
|
}
|
|
@@ -475,51 +500,51 @@ function xe(e, t = {}) {
|
|
|
475
500
|
...e.bareHints || []
|
|
476
501
|
]);
|
|
477
502
|
if (r.size > 0) {
|
|
478
|
-
const
|
|
479
|
-
const
|
|
480
|
-
return [...Z([
|
|
503
|
+
const o = i.filter((s) => {
|
|
504
|
+
const l = _(s);
|
|
505
|
+
return [...Z([l == null ? void 0 : l.id, l == null ? void 0 : l.name])].some((d) => r.has(d));
|
|
481
506
|
});
|
|
482
|
-
if (
|
|
483
|
-
if (
|
|
484
|
-
const
|
|
485
|
-
return
|
|
507
|
+
if (o.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
508
|
+
if (o.length === 1) {
|
|
509
|
+
const s = j(e, o[0]);
|
|
510
|
+
return s ? {
|
|
486
511
|
kind: "resolved",
|
|
487
512
|
basis: "bare",
|
|
488
|
-
entity:
|
|
489
|
-
source:
|
|
513
|
+
entity: o[0],
|
|
514
|
+
source: s,
|
|
490
515
|
matchedById: !1
|
|
491
516
|
} : { kind: "not_found", basis: "bare" };
|
|
492
517
|
}
|
|
493
518
|
return { kind: "not_found", basis: "bare" };
|
|
494
519
|
}
|
|
495
520
|
if (i.length === 1) {
|
|
496
|
-
const
|
|
497
|
-
return
|
|
521
|
+
const o = j(e, i[0]);
|
|
522
|
+
return o ? {
|
|
498
523
|
kind: "resolved",
|
|
499
524
|
basis: "unqualified",
|
|
500
525
|
entity: i[0],
|
|
501
|
-
source:
|
|
526
|
+
source: o,
|
|
502
527
|
matchedById: !1
|
|
503
528
|
} : { kind: "unqualified" };
|
|
504
529
|
}
|
|
505
530
|
return { kind: "unqualified" };
|
|
506
531
|
}
|
|
507
|
-
function
|
|
508
|
-
const t = e.resolution.kind === "resolved" ? _(e.resolution.entity) : void 0, n = u(e.connectionId) || u(t == null ? void 0 : t.connectionId), { connectionType: i, dialect: a } = e.resolution.capabilityAuthority, r = C(a),
|
|
532
|
+
function M(e) {
|
|
533
|
+
const t = e.resolution.kind === "resolved" ? _(e.resolution.entity) : void 0, n = u(e.connectionId) || u(t == null ? void 0 : t.connectionId), { connectionType: i, dialect: a } = e.resolution.capabilityAuthority, r = C(a), o = !!(r && r.dialect === e.resolution.capabilityAuthority.capabilities.dialect && r.prefixLevels.join(".") === e.resolution.capabilityAuthority.capabilities.prefixLevels.join(
|
|
509
534
|
"."
|
|
510
|
-
)),
|
|
511
|
-
if (!(!n || !(
|
|
535
|
+
)), s = e.resolution.coordinates;
|
|
536
|
+
if (!(!n || !(s != null && s.tableName)))
|
|
512
537
|
return {
|
|
513
538
|
kind: "physical",
|
|
514
539
|
connectionId: n,
|
|
515
540
|
...i ? { connectionType: i } : {},
|
|
516
|
-
...!i &&
|
|
517
|
-
tableName:
|
|
518
|
-
...
|
|
519
|
-
...
|
|
541
|
+
...!i && o ? { dialect: a } : {},
|
|
542
|
+
tableName: s.tableName,
|
|
543
|
+
...s.databaseName ? { databaseName: s.databaseName } : {},
|
|
544
|
+
...s.schemaName ? { schemaName: s.schemaName } : {}
|
|
520
545
|
};
|
|
521
546
|
}
|
|
522
|
-
function
|
|
547
|
+
function $e(e) {
|
|
523
548
|
if (!e.coordinates.tableName) return !1;
|
|
524
549
|
const t = _(e.entity), n = H(t == null ? void 0 : t.id), i = e.qualifiedHints.map(u).filter((l) => !!(l != null && l.includes(".")));
|
|
525
550
|
if (n && i.length > 0 && i.every((l) => H(l) === n))
|
|
@@ -528,80 +553,76 @@ function Pe(e) {
|
|
|
528
553
|
if (!a) return !1;
|
|
529
554
|
const r = p(
|
|
530
555
|
u(t == null ? void 0 : t.database)
|
|
531
|
-
),
|
|
556
|
+
), o = p(
|
|
532
557
|
u(t == null ? void 0 : t.schema)
|
|
533
|
-
), { capabilities:
|
|
534
|
-
|
|
535
|
-
...s ? { schemaName: s } : {},
|
|
536
|
-
tableName: a
|
|
537
|
-
};
|
|
538
|
-
return J({
|
|
558
|
+
), { capabilities: s } = e.capabilityAuthority;
|
|
559
|
+
return ke({
|
|
539
560
|
requested: e.coordinates,
|
|
540
|
-
allowed:
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
capabilities:
|
|
561
|
+
allowed: ae({
|
|
562
|
+
recorded: {
|
|
563
|
+
...r ? { databaseName: r } : {},
|
|
564
|
+
...o ? { schemaName: o } : {},
|
|
565
|
+
tableName: a
|
|
566
|
+
},
|
|
567
|
+
capabilities: s
|
|
547
568
|
}),
|
|
548
|
-
capabilities:
|
|
549
|
-
})
|
|
569
|
+
capabilities: s
|
|
570
|
+
});
|
|
550
571
|
}
|
|
551
|
-
function
|
|
552
|
-
var a, r,
|
|
572
|
+
function Oe(e) {
|
|
573
|
+
var a, r, o;
|
|
553
574
|
if (u(e.connectionType) || u(e.dialect) || e.capabilities || u(e.semanticDomainId) || u(e.fieldEntityType) === "dataset" || u((a = e.fallbackCoordinateHint) == null ? void 0 : a.databaseName) || u((r = e.fallbackCoordinateHint) == null ? void 0 : r.schemaName))
|
|
554
575
|
return;
|
|
555
576
|
const t = [
|
|
556
|
-
u((
|
|
577
|
+
u((o = e.fallbackCoordinateHint) == null ? void 0 : o.tableName),
|
|
557
578
|
...(e.qualifiedHints || []).map(u),
|
|
558
579
|
...(e.bareHints || []).map(u),
|
|
559
580
|
u(e.entityName),
|
|
560
581
|
...u(e.fieldEntityType) === "table" ? [u(e.entityId)] : []
|
|
561
|
-
].filter((
|
|
562
|
-
if (!t.length || t.some((
|
|
582
|
+
].filter((s) => !!s);
|
|
583
|
+
if (!t.length || t.some((s) => s.includes(".")))
|
|
563
584
|
return;
|
|
564
585
|
const n = t.map(p);
|
|
565
|
-
return n.some((
|
|
586
|
+
return n.some((s) => !s) ? void 0 : new Set(n.map((s) => s.toLowerCase())).size === 1 ? n[0] : void 0;
|
|
566
587
|
}
|
|
567
|
-
function
|
|
588
|
+
function ct(e) {
|
|
568
589
|
const t = e.entities.filter(
|
|
569
|
-
|
|
590
|
+
se
|
|
570
591
|
), n = e.entities.filter(
|
|
571
592
|
ce
|
|
572
|
-
), i = t.length > 0 || n.length > 0, a =
|
|
593
|
+
), i = t.length > 0 || n.length > 0, a = Me(e), r = e.qualifiedHints || [], o = r.some(
|
|
573
594
|
(c) => {
|
|
574
|
-
var
|
|
575
|
-
return (
|
|
595
|
+
var d;
|
|
596
|
+
return (d = u(c)) == null ? void 0 : d.includes(".");
|
|
576
597
|
}
|
|
577
|
-
),
|
|
598
|
+
), s = De({
|
|
578
599
|
entities: t,
|
|
579
600
|
connectionType: u(e.connectionType),
|
|
580
601
|
dialect: e.dialect,
|
|
581
602
|
capabilities: e.capabilities,
|
|
582
603
|
qualifiedHints: r,
|
|
583
604
|
bareHints: [e.entityName, e.entityId, ...e.bareHints || []],
|
|
584
|
-
...!
|
|
605
|
+
...!o && e.fallbackCoordinateHint ? { coordinateHint: e.fallbackCoordinateHint } : {}
|
|
585
606
|
});
|
|
586
|
-
if (
|
|
587
|
-
return
|
|
588
|
-
if (
|
|
589
|
-
const c =
|
|
590
|
-
resolution:
|
|
607
|
+
if (s.kind === "malformed" || s.kind === "conflicting" || s.kind === "incompatible_capabilities" && o || s.kind === "ambiguous" && s.basis === "qualified")
|
|
608
|
+
return s;
|
|
609
|
+
if (s.kind === "resolved" && s.basis === "qualified") {
|
|
610
|
+
const c = M({
|
|
611
|
+
resolution: s,
|
|
591
612
|
connectionId: e.connectionId
|
|
592
613
|
});
|
|
593
614
|
return c ? {
|
|
594
615
|
kind: "resolved",
|
|
595
|
-
basis:
|
|
616
|
+
basis: s.basis,
|
|
596
617
|
source: c,
|
|
597
|
-
entity:
|
|
618
|
+
entity: s.entity
|
|
598
619
|
} : { kind: "missing_connection" };
|
|
599
620
|
}
|
|
600
|
-
if (
|
|
601
|
-
if (a.kind === "resolved" && a.matchedById &&
|
|
621
|
+
if (s.kind === "not_found" && s.basis === "qualified" && s.coordinates) {
|
|
622
|
+
if (a.kind === "resolved" && a.matchedById && $e({
|
|
602
623
|
entity: a.entity,
|
|
603
|
-
coordinates:
|
|
604
|
-
capabilityAuthority:
|
|
624
|
+
coordinates: s.coordinates,
|
|
625
|
+
capabilityAuthority: s.capabilityAuthority,
|
|
605
626
|
qualifiedHints: r
|
|
606
627
|
}))
|
|
607
628
|
return {
|
|
@@ -610,78 +631,78 @@ function nt(e) {
|
|
|
610
631
|
source: a.source,
|
|
611
632
|
entity: a.entity
|
|
612
633
|
};
|
|
613
|
-
const c =
|
|
614
|
-
resolution:
|
|
634
|
+
const c = M({
|
|
635
|
+
resolution: s,
|
|
615
636
|
connectionId: e.connectionId
|
|
616
637
|
});
|
|
617
638
|
return c ? i ? { kind: "candidate", basis: "qualified", source: c } : { kind: "resolved", basis: "qualified", source: c } : { kind: "missing_connection" };
|
|
618
639
|
}
|
|
619
640
|
if (a.kind === "resolved")
|
|
620
|
-
return
|
|
641
|
+
return s.kind === "resolved" && s.basis === "bare" && !a.matchedById ? { kind: "ambiguous", basis: "bare" } : {
|
|
621
642
|
kind: "resolved",
|
|
622
643
|
basis: a.basis,
|
|
623
644
|
source: a.source,
|
|
624
645
|
entity: a.entity
|
|
625
646
|
};
|
|
626
647
|
if (a.kind === "ambiguous") return a;
|
|
627
|
-
if (
|
|
628
|
-
const c =
|
|
629
|
-
resolution:
|
|
648
|
+
if (s.kind === "resolved") {
|
|
649
|
+
const c = M({
|
|
650
|
+
resolution: s,
|
|
630
651
|
connectionId: e.connectionId
|
|
631
652
|
});
|
|
632
653
|
return c ? {
|
|
633
654
|
kind: "resolved",
|
|
634
|
-
basis:
|
|
655
|
+
basis: s.basis,
|
|
635
656
|
source: c,
|
|
636
|
-
entity:
|
|
657
|
+
entity: s.entity
|
|
637
658
|
} : { kind: "missing_connection" };
|
|
638
659
|
}
|
|
639
|
-
const
|
|
640
|
-
if (!i && !
|
|
660
|
+
const l = u(e.entityName) || u(e.entityId);
|
|
661
|
+
if (!i && !o && u(e.semanticDomainId) && (!u(e.fieldEntityType) || u(e.fieldEntityType) === "dataset") && l)
|
|
641
662
|
return {
|
|
642
663
|
kind: "resolved",
|
|
643
664
|
basis: "historical",
|
|
644
665
|
source: {
|
|
645
666
|
kind: "semantic",
|
|
646
667
|
domainId: u(e.semanticDomainId),
|
|
647
|
-
datasetName:
|
|
668
|
+
datasetName: l,
|
|
648
669
|
...u(e.connectionId) ? { connectionId: u(e.connectionId) } : {}
|
|
649
670
|
}
|
|
650
671
|
};
|
|
651
|
-
if (
|
|
652
|
-
const c = i ? void 0 :
|
|
653
|
-
return c &&
|
|
672
|
+
if (s.kind === "incompatible_capabilities") {
|
|
673
|
+
const c = i ? void 0 : Oe(e), d = u(e.connectionId);
|
|
674
|
+
return c && d ? {
|
|
654
675
|
kind: "resolved",
|
|
655
676
|
basis: "historical",
|
|
656
|
-
source: { kind: "physical", connectionId:
|
|
657
|
-
} :
|
|
677
|
+
source: { kind: "physical", connectionId: d, tableName: c }
|
|
678
|
+
} : s;
|
|
658
679
|
}
|
|
659
|
-
return
|
|
680
|
+
return s.kind === "ambiguous" ? s : s.kind === "not_found" ? {
|
|
660
681
|
kind: "not_found",
|
|
661
|
-
basis:
|
|
682
|
+
basis: s.basis
|
|
662
683
|
} : { kind: "unqualified" };
|
|
663
684
|
}
|
|
664
685
|
const le = "click-reach:";
|
|
665
|
-
function
|
|
686
|
+
function lt(e, t) {
|
|
666
687
|
const n = t.source.kind === "semantic" ? t.source.datasetName : t.source.tableName;
|
|
667
688
|
return `${le}${e}:${n}.${t.name}`;
|
|
668
689
|
}
|
|
669
|
-
function
|
|
690
|
+
function dt(e) {
|
|
670
691
|
return typeof e == "string" && e.startsWith(le);
|
|
671
692
|
}
|
|
672
|
-
function
|
|
673
|
-
return
|
|
693
|
+
function we(e, t) {
|
|
694
|
+
return _e({ ...e, role: t });
|
|
674
695
|
}
|
|
675
|
-
function
|
|
696
|
+
function ut(e, t) {
|
|
676
697
|
if (t.id) {
|
|
677
698
|
const n = [];
|
|
678
699
|
e.forEach(
|
|
679
|
-
({ fields: a }, r) => a.forEach((
|
|
680
|
-
|
|
700
|
+
({ fields: a }, r) => a.forEach((o, s) => {
|
|
701
|
+
o.id === t.id && n.push({ group: r, index: s });
|
|
681
702
|
})
|
|
682
703
|
);
|
|
683
704
|
const i = t.alias ? n.find(
|
|
684
|
-
({ group: a, index: r }) =>
|
|
705
|
+
({ group: a, index: r }) => we(e[a].fields[r], e[a].role) === t.alias
|
|
685
706
|
) : void 0;
|
|
686
707
|
if (i) return i;
|
|
687
708
|
if (n.length === 1) return n[0];
|
|
@@ -694,20 +715,20 @@ function ot(e, t) {
|
|
|
694
715
|
}
|
|
695
716
|
}
|
|
696
717
|
function de(e, t) {
|
|
697
|
-
const n = e.split(".").map((
|
|
698
|
-
if (n.length === 0 || i.length === 0 || n.some((
|
|
718
|
+
const n = e.split(".").map((s) => s.trim()), i = t.split(".").map((s) => s.trim());
|
|
719
|
+
if (n.length === 0 || i.length === 0 || n.some((s) => !s) || i.some((s) => !s))
|
|
699
720
|
return !1;
|
|
700
|
-
const [a, r] = n.length <= i.length ? [n, i] : [i, n],
|
|
701
|
-
return a.every((
|
|
721
|
+
const [a, r] = n.length <= i.length ? [n, i] : [i, n], o = r.length - a.length;
|
|
722
|
+
return a.every((s, l) => s === r[l + o]);
|
|
702
723
|
}
|
|
703
|
-
function
|
|
724
|
+
function ze(e, t) {
|
|
704
725
|
const n = e.split("."), i = t.split("."), a = n.pop(), r = i.pop();
|
|
705
726
|
return !!(a && a === r && n.length > 0 && i.length > 0 && de(
|
|
706
727
|
n.join("."),
|
|
707
728
|
i.join(".")
|
|
708
729
|
));
|
|
709
730
|
}
|
|
710
|
-
function
|
|
731
|
+
function Qe(e) {
|
|
711
732
|
const t = e.map((i) => i.trim()).filter(Boolean);
|
|
712
733
|
if (t.every(
|
|
713
734
|
(i, a) => t.slice(a + 1).every(
|
|
@@ -731,87 +752,87 @@ function W(e) {
|
|
|
731
752
|
const t = e.split(".").map((n) => n.trim());
|
|
732
753
|
return t.length > 0 && t.every(Boolean) ? t.join(".") : "";
|
|
733
754
|
}
|
|
734
|
-
function
|
|
755
|
+
function y(e) {
|
|
735
756
|
return typeof e == "string" ? e.trim() : "";
|
|
736
757
|
}
|
|
737
|
-
function
|
|
758
|
+
function We(e, t) {
|
|
738
759
|
return e.every(
|
|
739
760
|
(n, i) => e.slice(i + 1).every((a) => t(n, a))
|
|
740
761
|
);
|
|
741
762
|
}
|
|
742
|
-
function
|
|
743
|
-
const n =
|
|
763
|
+
function Ke(e, t) {
|
|
764
|
+
const n = y(e.id), i = y(e.name), a = y(t.entityId), r = y(t.entityName);
|
|
744
765
|
return !i || !a && !r ? !1 : (!a || a === n || a === i) && (!r || r === i);
|
|
745
766
|
}
|
|
746
|
-
function
|
|
747
|
-
const t = v(e.semanticContext) ? e.semanticContext : void 0, n = v(e.fieldMeta) ? e.fieldMeta : void 0, i =
|
|
767
|
+
function Ue(e) {
|
|
768
|
+
const t = v(e.semanticContext) ? e.semanticContext : void 0, n = v(e.fieldMeta) ? e.fieldMeta : void 0, i = y(t == null ? void 0 : t.semanticDomainId), a = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(
|
|
748
769
|
(h) => v(h) && h.type === "dataset"
|
|
749
770
|
) : [];
|
|
750
771
|
if (!!!(i || a.length > 0 || (n == null ? void 0 : n.entityType) === "dataset")) return;
|
|
751
772
|
if (!i)
|
|
752
773
|
return { status: "unresolved", reason: "incomplete_source_identity" };
|
|
753
|
-
const
|
|
754
|
-
(h) =>
|
|
755
|
-
entityId:
|
|
756
|
-
entityName:
|
|
774
|
+
const o = y(n == null ? void 0 : n.entityId), s = y(n == null ? void 0 : n.entityName), l = !!(o || s), c = l ? a.filter(
|
|
775
|
+
(h) => Ke(h, {
|
|
776
|
+
entityId: o,
|
|
777
|
+
entityName: s
|
|
757
778
|
})
|
|
758
779
|
) : a;
|
|
759
780
|
if (c.length > 1)
|
|
760
781
|
return { status: "unresolved", reason: "incomplete_source_identity" };
|
|
761
|
-
if (
|
|
782
|
+
if (l && a.length > 0 && c.length === 0)
|
|
762
783
|
return { status: "unresolved", reason: "divergent_source_identity" };
|
|
763
|
-
const
|
|
784
|
+
const d = c[0], m = y(d == null ? void 0 : d.domainId), g = y(d == null ? void 0 : d.id), N = y(d == null ? void 0 : d.name);
|
|
764
785
|
if (m && m !== i)
|
|
765
786
|
return { status: "unresolved", reason: "divergent_source_identity" };
|
|
766
|
-
const b =
|
|
767
|
-
return
|
|
787
|
+
const b = g, k = N || s;
|
|
788
|
+
return k ? {
|
|
768
789
|
status: "resolved",
|
|
769
790
|
source: {
|
|
770
791
|
kind: "semantic",
|
|
771
792
|
domainId: i,
|
|
772
|
-
datasetName:
|
|
793
|
+
datasetName: k,
|
|
773
794
|
...b ? { datasetId: b } : {}
|
|
774
795
|
}
|
|
775
796
|
} : { status: "unresolved", reason: "incomplete_source_identity" };
|
|
776
797
|
}
|
|
777
|
-
function
|
|
778
|
-
const n =
|
|
798
|
+
function Ge(e, t) {
|
|
799
|
+
const n = y(e.connectionId), i = v(e.semanticContext) ? e.semanticContext : void 0, a = y(i == null ? void 0 : i.connectionId);
|
|
779
800
|
if (n && a && n !== a)
|
|
780
801
|
return { status: "unresolved", reason: "divergent_source_identity" };
|
|
781
|
-
const r = n || a,
|
|
782
|
-
|
|
783
|
-
),
|
|
784
|
-
|
|
802
|
+
const r = n || a, o = v(e.fieldMeta) ? e.fieldMeta : void 0, s = t.split(".").slice(0, -1).join("."), l = W(e.qualifiedTableName), c = W(
|
|
803
|
+
o == null ? void 0 : o.qualifiedEntityName
|
|
804
|
+
), d = [
|
|
805
|
+
l,
|
|
785
806
|
c,
|
|
786
|
-
|
|
787
|
-
].filter(Boolean), m =
|
|
788
|
-
return !m &&
|
|
807
|
+
s
|
|
808
|
+
].filter(Boolean), m = Qe(d);
|
|
809
|
+
return !m && d.length > 0 ? { status: "unresolved", reason: "divergent_source_identity" } : !r || !m ? { status: "unresolved", reason: "incomplete_source_identity" } : {
|
|
789
810
|
status: "resolved",
|
|
790
811
|
source: { kind: "physical", connectionId: r, tableName: m }
|
|
791
812
|
};
|
|
792
813
|
}
|
|
793
|
-
function
|
|
814
|
+
function Ve(e, t) {
|
|
794
815
|
const n = v(e.fieldMeta) ? e.fieldMeta : void 0, i = typeof (n == null ? void 0 : n.qualifiedFieldName) == "string" ? n.qualifiedFieldName.trim() : "", a = ee(
|
|
795
816
|
n == null ? void 0 : n.qualifiedFieldName
|
|
796
|
-
), r = typeof e.column == "string" ? e.column.trim() : "",
|
|
817
|
+
), r = typeof e.column == "string" ? e.column.trim() : "", o = ee(r), s = typeof e.qualifiedTableName == "string" ? e.qualifiedTableName.trim() : "", l = W(
|
|
797
818
|
e.qualifiedTableName
|
|
798
819
|
);
|
|
799
|
-
if (i && !a || t &&
|
|
820
|
+
if (i && !a || t && s && !l || r.includes(".") && !o)
|
|
800
821
|
return { status: "unresolved", reason: "incomplete_field_identity" };
|
|
801
|
-
const c =
|
|
822
|
+
const c = o.split("."), d = o ? c[c.length - 1] : r, m = t && l && d ? `${l}.${d}` : "", g = [
|
|
802
823
|
a,
|
|
803
|
-
|
|
824
|
+
o,
|
|
804
825
|
m
|
|
805
826
|
].filter(Boolean);
|
|
806
|
-
if (!
|
|
807
|
-
|
|
808
|
-
|
|
827
|
+
if (!We(
|
|
828
|
+
g,
|
|
829
|
+
ze
|
|
809
830
|
))
|
|
810
831
|
return { status: "unresolved", reason: "divergent_field_identity" };
|
|
811
|
-
const
|
|
812
|
-
return
|
|
832
|
+
const N = o || a || m;
|
|
833
|
+
return N ? { status: "resolved", qualifiedFieldName: N } : { status: "unresolved", reason: "incomplete_field_identity" };
|
|
813
834
|
}
|
|
814
|
-
function
|
|
835
|
+
function Xe(e) {
|
|
815
836
|
if (!v(e))
|
|
816
837
|
return { status: "ineligible", reason: "invalid_input" };
|
|
817
838
|
if (e.kind === "global-date")
|
|
@@ -828,102 +849,125 @@ function Ke(e) {
|
|
|
828
849
|
return { status: "ineligible", reason: "custom_filter" };
|
|
829
850
|
if (e.targetColumns !== void 0 && (!Array.isArray(e.targetColumns) || e.targetColumns.length > 0))
|
|
830
851
|
return { status: "ineligible", reason: "multi_target_filter" };
|
|
831
|
-
const a =
|
|
852
|
+
const a = Ue(e), r = Ve(e, a === void 0);
|
|
832
853
|
if (r.status === "unresolved")
|
|
833
854
|
return { status: "ineligible", reason: r.reason };
|
|
834
|
-
const
|
|
835
|
-
return
|
|
855
|
+
const o = a || Ge(e, r.qualifiedFieldName);
|
|
856
|
+
return o.status === "resolved" ? {
|
|
836
857
|
status: "eligible",
|
|
837
858
|
kind: "field_date",
|
|
838
859
|
qualifiedFieldName: r.qualifiedFieldName,
|
|
839
|
-
source:
|
|
840
|
-
} : { status: "ineligible", reason:
|
|
860
|
+
source: o.source
|
|
861
|
+
} : { status: "ineligible", reason: o.reason };
|
|
841
862
|
}
|
|
842
|
-
function
|
|
863
|
+
function Je(e) {
|
|
843
864
|
if (!v(e) || e.kind !== "filter" || !v(e.filter))
|
|
844
865
|
return { status: "ineligible", reason: "invalid_input" };
|
|
845
|
-
const t =
|
|
866
|
+
const t = Xe(
|
|
846
867
|
e.filter
|
|
847
868
|
);
|
|
848
869
|
return t.status === "ineligible" ? t : t.kind === "field_date" && v(e.compatibility) && e.compatibility.source === "cardInlineFilter" ? { status: "ineligible", reason: "card_inline_filter" } : t;
|
|
849
870
|
}
|
|
850
|
-
function
|
|
851
|
-
return
|
|
871
|
+
function ft(e) {
|
|
872
|
+
return Je(e).status === "eligible";
|
|
852
873
|
}
|
|
853
|
-
function
|
|
874
|
+
function mt(e) {
|
|
854
875
|
return `compat-filter:${e}`;
|
|
855
876
|
}
|
|
856
|
-
function
|
|
877
|
+
function bt(e) {
|
|
857
878
|
return `compat-control:${e}`;
|
|
858
879
|
}
|
|
859
|
-
function
|
|
880
|
+
function gt(e, t) {
|
|
860
881
|
return `compat-inline-filter:${e}:${t}`;
|
|
861
882
|
}
|
|
862
|
-
function
|
|
883
|
+
function yt(e, t) {
|
|
863
884
|
return `compat-card-control:${e}:${t}`;
|
|
864
885
|
}
|
|
865
|
-
function
|
|
886
|
+
function Ye(e) {
|
|
887
|
+
var i;
|
|
888
|
+
if (!e) return !1;
|
|
889
|
+
if (typeof e.aggregate == "string" || e.isPreAggregated) return !0;
|
|
890
|
+
const t = typeof e.expression == "string" ? e.expression : "";
|
|
891
|
+
if (!t) return !1;
|
|
892
|
+
if (Se(t).calls.length > 0) return !0;
|
|
893
|
+
const n = (i = e.calculatedFormula) == null ? void 0 : i.inputFields;
|
|
894
|
+
return Array.isArray(n) && n.some((a) => {
|
|
895
|
+
const r = String((a == null ? void 0 : a.role) || "").toLowerCase(), o = String((a == null ? void 0 : a.aggregate) || "").trim();
|
|
896
|
+
return r === "metric" && o.length > 0;
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
function ht(e) {
|
|
900
|
+
return !!((e == null ? void 0 : e.role) === "metric" && (Ie(e) || Ye(e)));
|
|
901
|
+
}
|
|
902
|
+
const ue = "col:";
|
|
903
|
+
function pt(e) {
|
|
904
|
+
return `${ue}${e}`;
|
|
905
|
+
}
|
|
906
|
+
function vt(e) {
|
|
907
|
+
return typeof e == "string" && e.startsWith(ue);
|
|
908
|
+
}
|
|
909
|
+
function fe(e, t) {
|
|
866
910
|
if (e) return e;
|
|
867
911
|
const n = t === void 0 ? "unknown" : Q(t);
|
|
868
912
|
return n === "number" || n === "unknown" ? "SUM" : "COUNT";
|
|
869
913
|
}
|
|
870
|
-
function
|
|
871
|
-
const t = e.aggregate ===
|
|
914
|
+
function Ze(e) {
|
|
915
|
+
const t = e.aggregate === fe(e.semanticAggregate, e.dataType);
|
|
872
916
|
return {
|
|
873
917
|
effectiveAggregate: e.aggregate,
|
|
874
918
|
aggregateSource: t ? e.semanticAggregate ? "semantic_model" : "default_sum" : "caller_override"
|
|
875
919
|
};
|
|
876
920
|
}
|
|
877
|
-
function
|
|
921
|
+
function et(e, t, n) {
|
|
878
922
|
const i = e.effectiveAggregate !== void 0 || e.aggregateSource !== void 0;
|
|
879
923
|
return {
|
|
880
924
|
aggregate: t,
|
|
881
925
|
aggregateOrigin: n,
|
|
882
|
-
...i ?
|
|
926
|
+
...i ? Ze({ aggregate: t, semanticAggregate: e.semanticAggregate, dataType: e.dataType }) : {}
|
|
883
927
|
};
|
|
884
928
|
}
|
|
885
|
-
function
|
|
886
|
-
return { ...e, ...
|
|
929
|
+
function Nt(e, t, n) {
|
|
930
|
+
return { ...e, ...et(e, t, n) };
|
|
887
931
|
}
|
|
888
|
-
function
|
|
932
|
+
function kt(e) {
|
|
889
933
|
return e.aggregate ?? e.effectiveAggregate;
|
|
890
934
|
}
|
|
891
|
-
function
|
|
935
|
+
function It(e) {
|
|
892
936
|
if (!e.aggregate) return !1;
|
|
893
937
|
if (e.aggregateOrigin === "explicit" || e.aggregateSource === "caller_override") return !0;
|
|
894
938
|
if (e.aggregateSource) {
|
|
895
|
-
const t = e.aggregateSource === "default_sum" ?
|
|
939
|
+
const t = e.aggregateSource === "default_sum" ? fe(void 0, e.dataType) : e.semanticAggregate ?? e.effectiveAggregate;
|
|
896
940
|
return t !== void 0 && e.aggregate !== t;
|
|
897
941
|
}
|
|
898
942
|
return e.aggregateOrigin !== "default";
|
|
899
943
|
}
|
|
900
|
-
const
|
|
901
|
-
function
|
|
944
|
+
const Ct = ["label", "labelOrigin", "derivedLabel"];
|
|
945
|
+
function _t(e) {
|
|
902
946
|
return { label: e, labelOrigin: "override", derivedLabel: void 0 };
|
|
903
947
|
}
|
|
904
|
-
function
|
|
948
|
+
function St(e, t) {
|
|
905
949
|
const { derivedLabel: n, ...i } = e;
|
|
906
950
|
return { ...i, label: t, labelOrigin: "override" };
|
|
907
951
|
}
|
|
908
|
-
function
|
|
952
|
+
function At(e, t) {
|
|
909
953
|
return e.labelOrigin === "override" ? {} : { label: t, labelOrigin: "semantic" };
|
|
910
954
|
}
|
|
911
|
-
function
|
|
955
|
+
function Tt(e) {
|
|
912
956
|
if (e.groupedDate !== void 0) return { target: e.groupedDate, direction: "asc" };
|
|
913
957
|
if (!(!e.grouped || e.measures.length === 0))
|
|
914
958
|
return { target: e.primaryMeasure ?? e.measures[0], direction: "desc" };
|
|
915
959
|
}
|
|
916
|
-
const
|
|
960
|
+
const Dt = /* @__PURE__ */ new Set([
|
|
917
961
|
"contains",
|
|
918
962
|
"startsWith",
|
|
919
963
|
"endsWith",
|
|
920
964
|
"like",
|
|
921
965
|
"not like"
|
|
922
966
|
]);
|
|
923
|
-
function
|
|
967
|
+
function me(e) {
|
|
924
968
|
return e.includes("%") || e.includes("_");
|
|
925
969
|
}
|
|
926
|
-
function
|
|
970
|
+
function tt(e, t) {
|
|
927
971
|
switch (e) {
|
|
928
972
|
case "contains":
|
|
929
973
|
return { pattern: `%${t}%`, negate: !1 };
|
|
@@ -937,79 +981,79 @@ function Je(e, t) {
|
|
|
937
981
|
return { pattern: t, negate: !0 };
|
|
938
982
|
}
|
|
939
983
|
}
|
|
940
|
-
function
|
|
941
|
-
return
|
|
984
|
+
function nt(e) {
|
|
985
|
+
return me(e) ? e : `%${e}%`;
|
|
942
986
|
}
|
|
943
|
-
function
|
|
944
|
-
const { pattern: n, negate: i } =
|
|
945
|
-
if (
|
|
987
|
+
function Et(e, t) {
|
|
988
|
+
const { pattern: n, negate: i } = tt(e, t), a = n.length > 2 && n.startsWith("%") && n.endsWith("%") ? n.slice(1, -1) : void 0, r = a !== void 0 && !me(a) ? a : n;
|
|
989
|
+
if (nt(r) === n)
|
|
946
990
|
return { operator: i ? "not_contains" : "contains", value: r };
|
|
947
991
|
}
|
|
948
|
-
function
|
|
992
|
+
function qt(e) {
|
|
949
993
|
const { operation: t, values: n, temporalPrecision: i } = e;
|
|
950
994
|
if (t !== "=" && t !== "!=" || i === "minute")
|
|
951
995
|
return null;
|
|
952
996
|
const a = Array.isArray(n) ? n : [n];
|
|
953
997
|
if (a.length !== 1 || typeof a[0] != "string") return null;
|
|
954
998
|
const r = a[0].trim();
|
|
955
|
-
return
|
|
999
|
+
return pe(r) ? { operation: t, day: r } : null;
|
|
956
1000
|
}
|
|
957
|
-
function
|
|
1001
|
+
function be(e) {
|
|
958
1002
|
const { label: t, ...n } = e;
|
|
959
1003
|
return {
|
|
960
|
-
dataset:
|
|
1004
|
+
dataset: Ce(n),
|
|
961
1005
|
...e.kind === "physical" ? { dialect: e.dialect, connectionType: e.connectionType } : {}
|
|
962
1006
|
};
|
|
963
1007
|
}
|
|
964
|
-
function
|
|
1008
|
+
function ge(e) {
|
|
965
1009
|
const { label: t, source: n, ...i } = e;
|
|
966
|
-
return { ...i, source: n &&
|
|
1010
|
+
return { ...i, source: n && be(n) };
|
|
967
1011
|
}
|
|
968
|
-
function
|
|
1012
|
+
function V(e) {
|
|
969
1013
|
const {
|
|
970
1014
|
label: t,
|
|
971
1015
|
format: n,
|
|
972
1016
|
description: i,
|
|
973
1017
|
tags: a,
|
|
974
1018
|
inputs: r,
|
|
975
|
-
...
|
|
1019
|
+
...o
|
|
976
1020
|
} = e;
|
|
977
1021
|
return {
|
|
978
|
-
...
|
|
1022
|
+
...o,
|
|
979
1023
|
inputs: Object.fromEntries(
|
|
980
|
-
Object.entries(r).map(([
|
|
981
|
-
|
|
982
|
-
{ ...
|
|
1024
|
+
Object.entries(r).map(([s, l]) => [
|
|
1025
|
+
s,
|
|
1026
|
+
{ ...l, field: ge(l.field) }
|
|
983
1027
|
])
|
|
984
1028
|
)
|
|
985
1029
|
};
|
|
986
1030
|
}
|
|
987
|
-
function
|
|
1031
|
+
function $(e) {
|
|
988
1032
|
const { derivedField: t, ...n } = e;
|
|
989
1033
|
return {
|
|
990
|
-
...
|
|
991
|
-
derivedField: t &&
|
|
1034
|
+
...ge(n),
|
|
1035
|
+
derivedField: t && V(t)
|
|
992
1036
|
};
|
|
993
1037
|
}
|
|
994
|
-
function
|
|
1038
|
+
function x(e) {
|
|
995
1039
|
const {
|
|
996
1040
|
label: t,
|
|
997
1041
|
format: n,
|
|
998
1042
|
description: i,
|
|
999
1043
|
semanticTemporalPresentation: a,
|
|
1000
1044
|
derivedField: r,
|
|
1001
|
-
calculatedFormula:
|
|
1002
|
-
...
|
|
1045
|
+
calculatedFormula: o,
|
|
1046
|
+
...s
|
|
1003
1047
|
} = e;
|
|
1004
1048
|
return {
|
|
1005
|
-
...
|
|
1049
|
+
...s,
|
|
1006
1050
|
semanticTemporalPresentation: a && {
|
|
1007
1051
|
granularity: a.granularity
|
|
1008
1052
|
},
|
|
1009
|
-
derivedField: r &&
|
|
1010
|
-
calculatedFormula:
|
|
1011
|
-
...
|
|
1012
|
-
inputFields:
|
|
1053
|
+
derivedField: r && V(r),
|
|
1054
|
+
calculatedFormula: o && {
|
|
1055
|
+
...o,
|
|
1056
|
+
inputFields: o.inputFields.map(x)
|
|
1013
1057
|
}
|
|
1014
1058
|
};
|
|
1015
1059
|
}
|
|
@@ -1019,28 +1063,28 @@ function ye(e) {
|
|
|
1019
1063
|
conditions: e.conditions.map(
|
|
1020
1064
|
({ label: t, field: n, ...i }) => ({
|
|
1021
1065
|
...i,
|
|
1022
|
-
field:
|
|
1066
|
+
field: x(n)
|
|
1023
1067
|
})
|
|
1024
1068
|
),
|
|
1025
1069
|
groups: e.groups.map(ye)
|
|
1026
1070
|
};
|
|
1027
1071
|
}
|
|
1028
|
-
function
|
|
1072
|
+
function Ft(e) {
|
|
1029
1073
|
return {
|
|
1030
1074
|
...e,
|
|
1031
|
-
source:
|
|
1075
|
+
source: be(e.source),
|
|
1032
1076
|
rows: e.rows.map((t) => ({
|
|
1033
1077
|
...t,
|
|
1034
|
-
field:
|
|
1078
|
+
field: $(t.field)
|
|
1035
1079
|
})),
|
|
1036
1080
|
columns: e.columns.map((t) => ({
|
|
1037
1081
|
...t,
|
|
1038
|
-
field:
|
|
1082
|
+
field: $(t.field)
|
|
1039
1083
|
})),
|
|
1040
1084
|
measures: e.measures.map(
|
|
1041
|
-
(t) => t.kind === "aggregate" ? { ...t, field:
|
|
1085
|
+
(t) => t.kind === "aggregate" ? { ...t, field: $(t.field) } : {
|
|
1042
1086
|
...t,
|
|
1043
|
-
definition:
|
|
1087
|
+
definition: V(t.definition)
|
|
1044
1088
|
}
|
|
1045
1089
|
),
|
|
1046
1090
|
filters: e.filters && ye(e.filters),
|
|
@@ -1053,61 +1097,66 @@ function Nt(e) {
|
|
|
1053
1097
|
...n,
|
|
1054
1098
|
keys: n.keys.map((i) => ({
|
|
1055
1099
|
...i,
|
|
1056
|
-
source:
|
|
1057
|
-
target:
|
|
1100
|
+
source: x(i.source),
|
|
1101
|
+
target: x(i.target)
|
|
1058
1102
|
}))
|
|
1059
1103
|
}))
|
|
1060
1104
|
}))
|
|
1061
1105
|
},
|
|
1062
1106
|
// Sort scopes are keyed overrides, unlike ordered axes/calculation inputs.
|
|
1063
1107
|
sorts: [...e.sorts].sort((t, n) => {
|
|
1064
|
-
const i =
|
|
1108
|
+
const i = J(t), a = J(n);
|
|
1065
1109
|
return i < a ? -1 : i > a ? 1 : 0;
|
|
1066
1110
|
})
|
|
1067
1111
|
};
|
|
1068
1112
|
}
|
|
1069
1113
|
export {
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1114
|
+
vt as A,
|
|
1115
|
+
Ae as B,
|
|
1116
|
+
fe as C,
|
|
1117
|
+
Ze as D,
|
|
1118
|
+
Nt as E,
|
|
1119
|
+
kt as F,
|
|
1120
|
+
It as G,
|
|
1121
|
+
Ct as H,
|
|
1122
|
+
_t as I,
|
|
1123
|
+
St as J,
|
|
1124
|
+
Tt as K,
|
|
1125
|
+
me as L,
|
|
1126
|
+
tt as M,
|
|
1127
|
+
nt as N,
|
|
1128
|
+
Et as O,
|
|
1129
|
+
qt as P,
|
|
1130
|
+
de as Q,
|
|
1085
1131
|
Y as R,
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1132
|
+
Dt as S,
|
|
1133
|
+
Qe as T,
|
|
1134
|
+
V as U,
|
|
1135
|
+
ze as V,
|
|
1136
|
+
Ft as a,
|
|
1137
|
+
G as b,
|
|
1138
|
+
rt as c,
|
|
1139
|
+
se as d,
|
|
1140
|
+
De as e,
|
|
1141
|
+
ce as f,
|
|
1142
|
+
At as g,
|
|
1143
|
+
Me as h,
|
|
1144
|
+
dt as i,
|
|
1145
|
+
ct as j,
|
|
1146
|
+
lt as k,
|
|
1147
|
+
ut as l,
|
|
1148
|
+
et as m,
|
|
1100
1149
|
Ke as n,
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1150
|
+
Xe as o,
|
|
1151
|
+
Je as p,
|
|
1152
|
+
ft as q,
|
|
1153
|
+
ae as r,
|
|
1154
|
+
we as s,
|
|
1155
|
+
mt as t,
|
|
1156
|
+
bt as u,
|
|
1157
|
+
gt as v,
|
|
1158
|
+
yt as w,
|
|
1159
|
+
Ye as x,
|
|
1160
|
+
ht as y,
|
|
1161
|
+
pt as z
|
|
1113
1162
|
};
|