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