react-semaphor 0.1.584 → 0.1.585
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 +477 -440
- package/dist/assistant-context/index.js +1 -1
- package/dist/briefings/index.js +2 -2
- package/dist/chunks/{assistant-chat-nmycV1Se.js → assistant-chat-BdbLmAnK.js} +7 -7
- package/dist/chunks/{bookmark-impact-CI3gmxi0.js → bookmark-impact-BhT3k379.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-CEcKF6Fw.js} +50 -50
- package/dist/chunks/{comparison-window-caption-BAnsTI8y.js → comparison-window-caption-CoART8BC.js} +530 -633
- package/dist/chunks/{dashboard-inJy_V78.js → dashboard-MPku_x1M.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DXs0XA1O.js → dashboard-briefing-launcher-CkFNlkr1.js} +8 -8
- package/dist/chunks/{dashboard-controls-6Zoo8d8Y.js → dashboard-controls-Clt4ovXS.js} +9 -9
- package/dist/chunks/{dashboard-json-D5eJhVA9.js → dashboard-json-DSmXazIg.js} +1 -1
- package/dist/chunks/{dates-B3_GWc_Y.js → dates-CYZW9owO.js} +6 -6
- package/dist/chunks/{edit-dashboard-visual-DR03SYeW.js → edit-dashboard-visual-Dn2ECRbX.js} +2751 -2686
- package/dist/chunks/filter-line-Cu2u1K36.js +131 -0
- package/dist/chunks/{filter-reach-copy-CZwzrxBp.js → filter-reach-copy-CmJpPa4G.js} +1627 -1371
- package/dist/chunks/{filter-value-text-DtOvqcjn.js → filter-value-text-xefXzZlf.js} +10 -10
- package/dist/chunks/{index-BgT1L0p5.js → index-0WYn6RMz.js} +35 -35
- package/dist/chunks/{matrix-analytical-definition-Cs2v43FM.js → matrix-analytical-definition-QjBgUYhP.js} +382 -544
- 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-BRaeufEi.js} +119 -119
- package/dist/chunks/{resolve-dashboard-input-context-uATCuOP7.js → resolve-dashboard-input-context-Cn9jumxl.js} +304 -299
- package/dist/chunks/{saved-dashboard-context-DSVV9iqW.js → saved-dashboard-context-CfqkUMzR.js} +5 -5
- package/dist/chunks/{semaphor-ready-indicator-B9vvRMnJ.js → semaphor-ready-indicator-D6WjdTGl.js} +19776 -19620
- package/dist/chunks/{shelf-drop-preview-context-BHOnp5Bo.js → shelf-drop-preview-context-Bbbrr9u4.js} +2 -2
- package/dist/chunks/{stored-dashboard-xc5iidHL.js → stored-dashboard-sPkTjxYf.js} +7 -7
- 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-D1RotIEG.js} +3 -3
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +707 -704
- 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/shared/dashboard-authoring/index.d.ts +1 -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/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 +1 -1
- 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 R, l as T, E as be, m as ee, j as Q, q as ye } from "./raw-temporal-value-DH-feMc2.js";
|
|
2
|
+
import { am as C, ao as w, ag as W, ae as p, an as ge, af as G, at as he, ah as pe, a5 as M, I as V, o as ve } from "./validators-CJ8Jh0E8.js";
|
|
3
|
+
import { a as ke } 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 Ie(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 Ne(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 = be[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" ? R(r, "month", a) : T(r, "month", a);
|
|
30
|
+
return { start: R(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(R(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 Ne(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 = Ie(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 et(e) {
|
|
64
|
+
const t = e.source.connectionType ? C(e.source.connectionType) : void 0, n = e.source.dialect ? w(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 Ce(e) {
|
|
100
|
+
if (Ae(e)) return { kind: "malformed" };
|
|
101
|
+
const t = e.entities.filter(ae), n = _e(e), i = Se({
|
|
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 = De({
|
|
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 = Be(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: H(
|
|
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: H(
|
|
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 _e(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 Se(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 ? w(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 ? w(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) : Te(I);
|
|
238
|
+
return P ? {
|
|
239
|
+
capabilities: P,
|
|
388
240
|
connectionType: h,
|
|
389
|
-
capabilityIdentity: h ?
|
|
390
|
-
inferred: !
|
|
391
|
-
signature: A(
|
|
241
|
+
capabilityIdentity: h ? ge(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 Te(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 Ae(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 De(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 = Ee(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 (!qe(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 = H(
|
|
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 Ee(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 qe(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 Be(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 H(
|
|
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 H(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 Fe(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 Y(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 X(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 : he(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 xe(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 ? Fe(s) : re(s)
|
|
602
454
|
), a = u(e.entityId);
|
|
603
455
|
if (a) {
|
|
604
|
-
const
|
|
605
|
-
const c =
|
|
606
|
-
return !!(
|
|
456
|
+
const s = X(a), o = i.filter((l) => {
|
|
457
|
+
const c = _(l);
|
|
458
|
+
return !!(s && X(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 = Y([
|
|
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 [...Y([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 z(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 Pe(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 ? pe({
|
|
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 Le(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 tt(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 = xe(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 = Ce({
|
|
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 = z({
|
|
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 && Pe({
|
|
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 = z({
|
|
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 = z({
|
|
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 : Le(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,19 @@ function pt(e) {
|
|
|
797
649
|
basis: o.basis
|
|
798
650
|
} : { kind: "unqualified" };
|
|
799
651
|
}
|
|
800
|
-
function
|
|
801
|
-
return
|
|
652
|
+
function je(e, t) {
|
|
653
|
+
return ke({ ...e, role: t });
|
|
802
654
|
}
|
|
803
|
-
function
|
|
655
|
+
function nt(e, t) {
|
|
804
656
|
if (t.id) {
|
|
805
657
|
const n = [];
|
|
806
658
|
e.forEach(
|
|
807
|
-
({ fields: a },
|
|
808
|
-
|
|
659
|
+
({ fields: a }, r) => a.forEach((s, o) => {
|
|
660
|
+
s.id === t.id && n.push({ group: r, index: o });
|
|
809
661
|
})
|
|
810
662
|
);
|
|
811
663
|
const i = t.alias ? n.find(
|
|
812
|
-
({ group: a, index:
|
|
664
|
+
({ group: a, index: r }) => je(e[a].fields[r], e[a].role) === t.alias
|
|
813
665
|
) : void 0;
|
|
814
666
|
if (i) return i;
|
|
815
667
|
if (n.length === 1) return n[0];
|
|
@@ -821,25 +673,25 @@ function vt(e, t) {
|
|
|
821
673
|
if (i !== -1) return { group: n, index: i };
|
|
822
674
|
}
|
|
823
675
|
}
|
|
824
|
-
function
|
|
676
|
+
function ce(e, t) {
|
|
825
677
|
const n = e.split(".").map((o) => o.trim()), i = t.split(".").map((o) => o.trim());
|
|
826
678
|
if (n.length === 0 || i.length === 0 || n.some((o) => !o) || i.some((o) => !o))
|
|
827
679
|
return !1;
|
|
828
|
-
const [a,
|
|
829
|
-
return a.every((o,
|
|
680
|
+
const [a, r] = n.length <= i.length ? [n, i] : [i, n], s = r.length - a.length;
|
|
681
|
+
return a.every((o, l) => o === r[l + s]);
|
|
830
682
|
}
|
|
831
|
-
function
|
|
832
|
-
const n = e.split("."), i = t.split("."), a = n.pop(),
|
|
833
|
-
return !!(a && a ===
|
|
683
|
+
function ze(e, t) {
|
|
684
|
+
const n = e.split("."), i = t.split("."), a = n.pop(), r = i.pop();
|
|
685
|
+
return !!(a && a === r && n.length > 0 && i.length > 0 && ce(
|
|
834
686
|
n.join("."),
|
|
835
687
|
i.join(".")
|
|
836
688
|
));
|
|
837
689
|
}
|
|
838
|
-
function
|
|
690
|
+
function Oe(e) {
|
|
839
691
|
const t = e.map((i) => i.trim()).filter(Boolean);
|
|
840
692
|
if (t.every(
|
|
841
693
|
(i, a) => t.slice(a + 1).every(
|
|
842
|
-
(
|
|
694
|
+
(r) => ce(i, r)
|
|
843
695
|
)
|
|
844
696
|
))
|
|
845
697
|
return [...t].sort(
|
|
@@ -849,12 +701,12 @@ function Ze(e) {
|
|
|
849
701
|
function v(e) {
|
|
850
702
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
851
703
|
}
|
|
852
|
-
function
|
|
704
|
+
function Z(e) {
|
|
853
705
|
if (typeof e != "string") return "";
|
|
854
706
|
const t = e.split(".").map((n) => n.trim());
|
|
855
707
|
return t.length > 1 && t.every(Boolean) ? t.join(".") : "";
|
|
856
708
|
}
|
|
857
|
-
function
|
|
709
|
+
function $(e) {
|
|
858
710
|
if (typeof e != "string") return "";
|
|
859
711
|
const t = e.split(".").map((n) => n.trim());
|
|
860
712
|
return t.length > 0 && t.every(Boolean) ? t.join(".") : "";
|
|
@@ -862,92 +714,92 @@ function J(e) {
|
|
|
862
714
|
function g(e) {
|
|
863
715
|
return typeof e == "string" ? e.trim() : "";
|
|
864
716
|
}
|
|
865
|
-
function
|
|
717
|
+
function Re(e, t) {
|
|
866
718
|
return e.every(
|
|
867
719
|
(n, i) => e.slice(i + 1).every((a) => t(n, a))
|
|
868
720
|
);
|
|
869
721
|
}
|
|
870
|
-
function
|
|
871
|
-
const n = g(e.id), i = g(e.name), a = g(t.entityId),
|
|
872
|
-
return !i || !a && !
|
|
722
|
+
function we(e, t) {
|
|
723
|
+
const n = g(e.id), i = g(e.name), a = g(t.entityId), r = g(t.entityName);
|
|
724
|
+
return !i || !a && !r ? !1 : (!a || a === n || a === i) && (!r || r === i);
|
|
873
725
|
}
|
|
874
|
-
function
|
|
726
|
+
function Me(e) {
|
|
875
727
|
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
728
|
(h) => v(h) && h.type === "dataset"
|
|
877
729
|
) : [];
|
|
878
730
|
if (!!!(i || a.length > 0 || (n == null ? void 0 : n.entityType) === "dataset")) return;
|
|
879
731
|
if (!i)
|
|
880
732
|
return { status: "unresolved", reason: "incomplete_source_identity" };
|
|
881
|
-
const
|
|
882
|
-
(h) =>
|
|
883
|
-
entityId:
|
|
733
|
+
const s = g(n == null ? void 0 : n.entityId), o = g(n == null ? void 0 : n.entityName), l = !!(s || o), c = l ? a.filter(
|
|
734
|
+
(h) => we(h, {
|
|
735
|
+
entityId: s,
|
|
884
736
|
entityName: o
|
|
885
737
|
})
|
|
886
738
|
) : a;
|
|
887
739
|
if (c.length > 1)
|
|
888
740
|
return { status: "unresolved", reason: "incomplete_source_identity" };
|
|
889
|
-
if (
|
|
741
|
+
if (l && a.length > 0 && c.length === 0)
|
|
890
742
|
return { status: "unresolved", reason: "divergent_source_identity" };
|
|
891
|
-
const
|
|
743
|
+
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
744
|
if (m && m !== i)
|
|
893
745
|
return { status: "unresolved", reason: "divergent_source_identity" };
|
|
894
|
-
const
|
|
895
|
-
return
|
|
746
|
+
const b = y, I = k || o;
|
|
747
|
+
return I ? {
|
|
896
748
|
status: "resolved",
|
|
897
749
|
source: {
|
|
898
750
|
kind: "semantic",
|
|
899
751
|
domainId: i,
|
|
900
|
-
datasetName:
|
|
901
|
-
...
|
|
752
|
+
datasetName: I,
|
|
753
|
+
...b ? { datasetId: b } : {}
|
|
902
754
|
}
|
|
903
755
|
} : { status: "unresolved", reason: "incomplete_source_identity" };
|
|
904
756
|
}
|
|
905
|
-
function
|
|
757
|
+
function $e(e, t) {
|
|
906
758
|
const n = g(e.connectionId), i = v(e.semanticContext) ? e.semanticContext : void 0, a = g(i == null ? void 0 : i.connectionId);
|
|
907
759
|
if (n && a && n !== a)
|
|
908
760
|
return { status: "unresolved", reason: "divergent_source_identity" };
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
),
|
|
912
|
-
|
|
761
|
+
const r = n || a, s = v(e.fieldMeta) ? e.fieldMeta : void 0, o = t.split(".").slice(0, -1).join("."), l = $(e.qualifiedTableName), c = $(
|
|
762
|
+
s == null ? void 0 : s.qualifiedEntityName
|
|
763
|
+
), d = [
|
|
764
|
+
l,
|
|
913
765
|
c,
|
|
914
766
|
o
|
|
915
|
-
].filter(Boolean), m =
|
|
916
|
-
return !m &&
|
|
767
|
+
].filter(Boolean), m = Oe(d);
|
|
768
|
+
return !m && d.length > 0 ? { status: "unresolved", reason: "divergent_source_identity" } : !r || !m ? { status: "unresolved", reason: "incomplete_source_identity" } : {
|
|
917
769
|
status: "resolved",
|
|
918
|
-
source: { kind: "physical", connectionId:
|
|
770
|
+
source: { kind: "physical", connectionId: r, tableName: m }
|
|
919
771
|
};
|
|
920
772
|
}
|
|
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 =
|
|
773
|
+
function Qe(e, t) {
|
|
774
|
+
const n = v(e.fieldMeta) ? e.fieldMeta : void 0, i = typeof (n == null ? void 0 : n.qualifiedFieldName) == "string" ? n.qualifiedFieldName.trim() : "", a = Z(
|
|
923
775
|
n == null ? void 0 : n.qualifiedFieldName
|
|
924
|
-
),
|
|
776
|
+
), r = typeof e.column == "string" ? e.column.trim() : "", s = Z(r), o = typeof e.qualifiedTableName == "string" ? e.qualifiedTableName.trim() : "", l = $(
|
|
925
777
|
e.qualifiedTableName
|
|
926
778
|
);
|
|
927
|
-
if (i && !a || t && o && !
|
|
779
|
+
if (i && !a || t && o && !l || r.includes(".") && !s)
|
|
928
780
|
return { status: "unresolved", reason: "incomplete_field_identity" };
|
|
929
|
-
const c =
|
|
781
|
+
const c = s.split("."), d = s ? c[c.length - 1] : r, m = t && l && d ? `${l}.${d}` : "", y = [
|
|
930
782
|
a,
|
|
931
|
-
|
|
783
|
+
s,
|
|
932
784
|
m
|
|
933
785
|
].filter(Boolean);
|
|
934
|
-
if (!
|
|
935
|
-
|
|
936
|
-
|
|
786
|
+
if (!Re(
|
|
787
|
+
y,
|
|
788
|
+
ze
|
|
937
789
|
))
|
|
938
790
|
return { status: "unresolved", reason: "divergent_field_identity" };
|
|
939
|
-
const k =
|
|
791
|
+
const k = s || a || m;
|
|
940
792
|
return k ? { status: "resolved", qualifiedFieldName: k } : { status: "unresolved", reason: "incomplete_field_identity" };
|
|
941
793
|
}
|
|
942
|
-
function
|
|
794
|
+
function We(e) {
|
|
943
795
|
if (!v(e))
|
|
944
796
|
return { status: "ineligible", reason: "invalid_input" };
|
|
945
797
|
if (e.kind === "global-date")
|
|
946
798
|
return { status: "eligible", kind: "global_date" };
|
|
947
|
-
const t =
|
|
799
|
+
const t = M(e.dataType);
|
|
948
800
|
if (t !== "date" && t !== "datetime")
|
|
949
801
|
return { status: "ineligible", reason: "non_date_filter" };
|
|
950
|
-
const n = v(e.fieldMeta) ? e.fieldMeta : void 0, i =
|
|
802
|
+
const n = v(e.fieldMeta) ? e.fieldMeta : void 0, i = M(
|
|
951
803
|
n == null ? void 0 : n.dataType
|
|
952
804
|
);
|
|
953
805
|
if ((n == null ? void 0 : n.dataType) !== void 0 && i !== "date" && i !== "datetime")
|
|
@@ -956,102 +808,102 @@ function ot(e) {
|
|
|
956
808
|
return { status: "ineligible", reason: "custom_filter" };
|
|
957
809
|
if (e.targetColumns !== void 0 && (!Array.isArray(e.targetColumns) || e.targetColumns.length > 0))
|
|
958
810
|
return { status: "ineligible", reason: "multi_target_filter" };
|
|
959
|
-
const a =
|
|
960
|
-
if (
|
|
961
|
-
return { status: "ineligible", reason:
|
|
962
|
-
const
|
|
963
|
-
return
|
|
811
|
+
const a = Me(e), r = Qe(e, a === void 0);
|
|
812
|
+
if (r.status === "unresolved")
|
|
813
|
+
return { status: "ineligible", reason: r.reason };
|
|
814
|
+
const s = a || $e(e, r.qualifiedFieldName);
|
|
815
|
+
return s.status === "resolved" ? {
|
|
964
816
|
status: "eligible",
|
|
965
817
|
kind: "field_date",
|
|
966
|
-
qualifiedFieldName:
|
|
967
|
-
source:
|
|
968
|
-
} : { status: "ineligible", reason:
|
|
818
|
+
qualifiedFieldName: r.qualifiedFieldName,
|
|
819
|
+
source: s.source
|
|
820
|
+
} : { status: "ineligible", reason: s.reason };
|
|
969
821
|
}
|
|
970
|
-
function
|
|
822
|
+
function Ke(e) {
|
|
971
823
|
if (!v(e) || e.kind !== "filter" || !v(e.filter))
|
|
972
824
|
return { status: "ineligible", reason: "invalid_input" };
|
|
973
|
-
const t =
|
|
825
|
+
const t = We(
|
|
974
826
|
e.filter
|
|
975
827
|
);
|
|
976
828
|
return t.status === "ineligible" ? t : t.kind === "field_date" && v(e.compatibility) && e.compatibility.source === "cardInlineFilter" ? { status: "ineligible", reason: "card_inline_filter" } : t;
|
|
977
829
|
}
|
|
978
|
-
function
|
|
979
|
-
return
|
|
830
|
+
function it(e) {
|
|
831
|
+
return Ke(e).status === "eligible";
|
|
980
832
|
}
|
|
981
|
-
function
|
|
833
|
+
function at(e) {
|
|
982
834
|
return `compat-filter:${e}`;
|
|
983
835
|
}
|
|
984
|
-
function
|
|
836
|
+
function ot(e) {
|
|
985
837
|
return `compat-control:${e}`;
|
|
986
838
|
}
|
|
987
|
-
function
|
|
839
|
+
function st(e, t) {
|
|
988
840
|
return `compat-inline-filter:${e}:${t}`;
|
|
989
841
|
}
|
|
990
|
-
function
|
|
842
|
+
function rt(e, t) {
|
|
991
843
|
return `compat-card-control:${e}:${t}`;
|
|
992
844
|
}
|
|
993
|
-
function
|
|
845
|
+
function le(e, t) {
|
|
994
846
|
if (e) return e;
|
|
995
|
-
const n = t === void 0 ? "unknown" :
|
|
847
|
+
const n = t === void 0 ? "unknown" : M(t);
|
|
996
848
|
return n === "number" || n === "unknown" ? "SUM" : "COUNT";
|
|
997
849
|
}
|
|
998
|
-
function
|
|
999
|
-
const t = e.aggregate ===
|
|
850
|
+
function Ue(e) {
|
|
851
|
+
const t = e.aggregate === le(e.semanticAggregate, e.dataType);
|
|
1000
852
|
return {
|
|
1001
853
|
effectiveAggregate: e.aggregate,
|
|
1002
854
|
aggregateSource: t ? e.semanticAggregate ? "semantic_model" : "default_sum" : "caller_override"
|
|
1003
855
|
};
|
|
1004
856
|
}
|
|
1005
|
-
function
|
|
857
|
+
function Ge(e, t, n) {
|
|
1006
858
|
const i = e.effectiveAggregate !== void 0 || e.aggregateSource !== void 0;
|
|
1007
859
|
return {
|
|
1008
860
|
aggregate: t,
|
|
1009
861
|
aggregateOrigin: n,
|
|
1010
|
-
...i ?
|
|
862
|
+
...i ? Ue({ aggregate: t, semanticAggregate: e.semanticAggregate, dataType: e.dataType }) : {}
|
|
1011
863
|
};
|
|
1012
864
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return { ...e, ...
|
|
865
|
+
function ct(e, t, n) {
|
|
866
|
+
return { ...e, ...Ge(e, t, n) };
|
|
1015
867
|
}
|
|
1016
|
-
function
|
|
868
|
+
function lt(e) {
|
|
1017
869
|
return e.aggregate ?? e.effectiveAggregate;
|
|
1018
870
|
}
|
|
1019
|
-
function
|
|
871
|
+
function dt(e) {
|
|
1020
872
|
if (!e.aggregate) return !1;
|
|
1021
873
|
if (e.aggregateOrigin === "explicit" || e.aggregateSource === "caller_override") return !0;
|
|
1022
874
|
if (e.aggregateSource) {
|
|
1023
|
-
const t = e.aggregateSource === "default_sum" ?
|
|
875
|
+
const t = e.aggregateSource === "default_sum" ? le(void 0, e.dataType) : e.semanticAggregate ?? e.effectiveAggregate;
|
|
1024
876
|
return t !== void 0 && e.aggregate !== t;
|
|
1025
877
|
}
|
|
1026
878
|
return e.aggregateOrigin !== "default";
|
|
1027
879
|
}
|
|
1028
|
-
const
|
|
1029
|
-
function
|
|
880
|
+
const ut = ["label", "labelOrigin", "derivedLabel"];
|
|
881
|
+
function ft(e) {
|
|
1030
882
|
return { label: e, labelOrigin: "override", derivedLabel: void 0 };
|
|
1031
883
|
}
|
|
1032
|
-
function
|
|
884
|
+
function mt(e, t) {
|
|
1033
885
|
const { derivedLabel: n, ...i } = e;
|
|
1034
886
|
return { ...i, label: t, labelOrigin: "override" };
|
|
1035
887
|
}
|
|
1036
|
-
function
|
|
888
|
+
function bt(e, t) {
|
|
1037
889
|
return e.labelOrigin === "override" ? {} : { label: t, labelOrigin: "semantic" };
|
|
1038
890
|
}
|
|
1039
|
-
function
|
|
891
|
+
function yt(e) {
|
|
1040
892
|
if (e.groupedDate !== void 0) return { target: e.groupedDate, direction: "asc" };
|
|
1041
893
|
if (!(!e.grouped || e.measures.length === 0))
|
|
1042
894
|
return { target: e.primaryMeasure ?? e.measures[0], direction: "desc" };
|
|
1043
895
|
}
|
|
1044
|
-
const
|
|
896
|
+
const gt = /* @__PURE__ */ new Set([
|
|
1045
897
|
"contains",
|
|
1046
898
|
"startsWith",
|
|
1047
899
|
"endsWith",
|
|
1048
900
|
"like",
|
|
1049
901
|
"not like"
|
|
1050
902
|
]);
|
|
1051
|
-
function
|
|
903
|
+
function de(e) {
|
|
1052
904
|
return e.includes("%") || e.includes("_");
|
|
1053
905
|
}
|
|
1054
|
-
function
|
|
906
|
+
function Ve(e, t) {
|
|
1055
907
|
switch (e) {
|
|
1056
908
|
case "contains":
|
|
1057
909
|
return { pattern: `%${t}%`, negate: !1 };
|
|
@@ -1065,68 +917,68 @@ function dt(e, t) {
|
|
|
1065
917
|
return { pattern: t, negate: !0 };
|
|
1066
918
|
}
|
|
1067
919
|
}
|
|
1068
|
-
function
|
|
1069
|
-
return
|
|
920
|
+
function Je(e) {
|
|
921
|
+
return de(e) ? e : `%${e}%`;
|
|
1070
922
|
}
|
|
1071
|
-
function
|
|
1072
|
-
const { pattern: n, negate: i } =
|
|
1073
|
-
if (
|
|
1074
|
-
return { operator: i ? "not_contains" : "contains", value:
|
|
923
|
+
function ht(e, t) {
|
|
924
|
+
const { pattern: n, negate: i } = Ve(e, t), a = n.length > 2 && n.startsWith("%") && n.endsWith("%") ? n.slice(1, -1) : void 0, r = a !== void 0 && !de(a) ? a : n;
|
|
925
|
+
if (Je(r) === n)
|
|
926
|
+
return { operator: i ? "not_contains" : "contains", value: r };
|
|
1075
927
|
}
|
|
1076
|
-
function
|
|
928
|
+
function pt(e) {
|
|
1077
929
|
const { operation: t, values: n, temporalPrecision: i } = e;
|
|
1078
930
|
if (t !== "=" && t !== "!=" || i === "minute")
|
|
1079
931
|
return null;
|
|
1080
932
|
const a = Array.isArray(n) ? n : [n];
|
|
1081
933
|
if (a.length !== 1 || typeof a[0] != "string") return null;
|
|
1082
|
-
const
|
|
1083
|
-
return
|
|
934
|
+
const r = a[0].trim();
|
|
935
|
+
return ye(r) ? { operation: t, day: r } : null;
|
|
1084
936
|
}
|
|
1085
|
-
function
|
|
937
|
+
function ue(e) {
|
|
1086
938
|
const { label: t, ...n } = e;
|
|
1087
939
|
return {
|
|
1088
|
-
dataset:
|
|
940
|
+
dataset: ve(n),
|
|
1089
941
|
...e.kind === "physical" ? { dialect: e.dialect, connectionType: e.connectionType } : {}
|
|
1090
942
|
};
|
|
1091
943
|
}
|
|
1092
|
-
function
|
|
944
|
+
function fe(e) {
|
|
1093
945
|
const { label: t, source: n, ...i } = e;
|
|
1094
|
-
return { ...i, source: n &&
|
|
946
|
+
return { ...i, source: n && ue(n) };
|
|
1095
947
|
}
|
|
1096
|
-
function
|
|
948
|
+
function K(e) {
|
|
1097
949
|
const {
|
|
1098
950
|
label: t,
|
|
1099
951
|
format: n,
|
|
1100
952
|
description: i,
|
|
1101
953
|
tags: a,
|
|
1102
|
-
inputs:
|
|
1103
|
-
...
|
|
954
|
+
inputs: r,
|
|
955
|
+
...s
|
|
1104
956
|
} = e;
|
|
1105
957
|
return {
|
|
1106
|
-
...
|
|
958
|
+
...s,
|
|
1107
959
|
inputs: Object.fromEntries(
|
|
1108
|
-
Object.entries(
|
|
960
|
+
Object.entries(r).map(([o, l]) => [
|
|
1109
961
|
o,
|
|
1110
|
-
{ ...
|
|
962
|
+
{ ...l, field: fe(l.field) }
|
|
1111
963
|
])
|
|
1112
964
|
)
|
|
1113
965
|
};
|
|
1114
966
|
}
|
|
1115
|
-
function
|
|
967
|
+
function O(e) {
|
|
1116
968
|
const { derivedField: t, ...n } = e;
|
|
1117
969
|
return {
|
|
1118
|
-
...
|
|
1119
|
-
derivedField: t &&
|
|
970
|
+
...fe(n),
|
|
971
|
+
derivedField: t && K(t)
|
|
1120
972
|
};
|
|
1121
973
|
}
|
|
1122
|
-
function
|
|
974
|
+
function F(e) {
|
|
1123
975
|
const {
|
|
1124
976
|
label: t,
|
|
1125
977
|
format: n,
|
|
1126
978
|
description: i,
|
|
1127
979
|
semanticTemporalPresentation: a,
|
|
1128
|
-
derivedField:
|
|
1129
|
-
calculatedFormula:
|
|
980
|
+
derivedField: r,
|
|
981
|
+
calculatedFormula: s,
|
|
1130
982
|
...o
|
|
1131
983
|
} = e;
|
|
1132
984
|
return {
|
|
@@ -1134,44 +986,44 @@ function z(e) {
|
|
|
1134
986
|
semanticTemporalPresentation: a && {
|
|
1135
987
|
granularity: a.granularity
|
|
1136
988
|
},
|
|
1137
|
-
derivedField:
|
|
1138
|
-
calculatedFormula:
|
|
1139
|
-
...
|
|
1140
|
-
inputFields:
|
|
989
|
+
derivedField: r && K(r),
|
|
990
|
+
calculatedFormula: s && {
|
|
991
|
+
...s,
|
|
992
|
+
inputFields: s.inputFields.map(F)
|
|
1141
993
|
}
|
|
1142
994
|
};
|
|
1143
995
|
}
|
|
1144
|
-
function
|
|
996
|
+
function me(e) {
|
|
1145
997
|
return {
|
|
1146
998
|
...e,
|
|
1147
999
|
conditions: e.conditions.map(
|
|
1148
1000
|
({ label: t, field: n, ...i }) => ({
|
|
1149
1001
|
...i,
|
|
1150
|
-
field:
|
|
1002
|
+
field: F(n)
|
|
1151
1003
|
})
|
|
1152
1004
|
),
|
|
1153
|
-
groups: e.groups.map(
|
|
1005
|
+
groups: e.groups.map(me)
|
|
1154
1006
|
};
|
|
1155
1007
|
}
|
|
1156
|
-
function
|
|
1008
|
+
function vt(e) {
|
|
1157
1009
|
return {
|
|
1158
1010
|
...e,
|
|
1159
|
-
source:
|
|
1011
|
+
source: ue(e.source),
|
|
1160
1012
|
rows: e.rows.map((t) => ({
|
|
1161
1013
|
...t,
|
|
1162
|
-
field:
|
|
1014
|
+
field: O(t.field)
|
|
1163
1015
|
})),
|
|
1164
1016
|
columns: e.columns.map((t) => ({
|
|
1165
1017
|
...t,
|
|
1166
|
-
field:
|
|
1018
|
+
field: O(t.field)
|
|
1167
1019
|
})),
|
|
1168
1020
|
measures: e.measures.map(
|
|
1169
|
-
(t) => t.kind === "aggregate" ? { ...t, field:
|
|
1021
|
+
(t) => t.kind === "aggregate" ? { ...t, field: O(t.field) } : {
|
|
1170
1022
|
...t,
|
|
1171
|
-
definition:
|
|
1023
|
+
definition: K(t.definition)
|
|
1172
1024
|
}
|
|
1173
1025
|
),
|
|
1174
|
-
filters: e.filters &&
|
|
1026
|
+
filters: e.filters && me(e.filters),
|
|
1175
1027
|
joinPlan: e.joinPlan && {
|
|
1176
1028
|
...e.joinPlan,
|
|
1177
1029
|
// relationshipName participates in governed relationship resolution.
|
|
@@ -1181,73 +1033,59 @@ function Lt(e) {
|
|
|
1181
1033
|
...n,
|
|
1182
1034
|
keys: n.keys.map((i) => ({
|
|
1183
1035
|
...i,
|
|
1184
|
-
source:
|
|
1185
|
-
target:
|
|
1036
|
+
source: F(i.source),
|
|
1037
|
+
target: F(i.target)
|
|
1186
1038
|
}))
|
|
1187
1039
|
}))
|
|
1188
1040
|
}))
|
|
1189
1041
|
},
|
|
1190
1042
|
// Sort scopes are keyed overrides, unlike ordered axes/calculation inputs.
|
|
1191
1043
|
sorts: [...e.sorts].sort((t, n) => {
|
|
1192
|
-
const i =
|
|
1044
|
+
const i = V(t), a = V(n);
|
|
1193
1045
|
return i < a ? -1 : i > a ? 1 : 0;
|
|
1194
1046
|
})
|
|
1195
1047
|
};
|
|
1196
1048
|
}
|
|
1197
1049
|
export {
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
re as
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
ct as m,
|
|
1240
|
-
kt as n,
|
|
1241
|
-
Ct as o,
|
|
1242
|
-
It as p,
|
|
1243
|
-
Nt as q,
|
|
1244
|
-
ht as r,
|
|
1245
|
-
Je as s,
|
|
1246
|
-
St as t,
|
|
1247
|
-
Pe as u,
|
|
1248
|
-
Ce as v,
|
|
1249
|
-
st as w,
|
|
1250
|
-
Tt as x,
|
|
1251
|
-
_t as y,
|
|
1252
|
-
Dt as z
|
|
1050
|
+
ut as A,
|
|
1051
|
+
ft as B,
|
|
1052
|
+
mt as C,
|
|
1053
|
+
yt as D,
|
|
1054
|
+
de as E,
|
|
1055
|
+
Ve as F,
|
|
1056
|
+
Je as G,
|
|
1057
|
+
ht as H,
|
|
1058
|
+
pt as I,
|
|
1059
|
+
ce as J,
|
|
1060
|
+
Oe as K,
|
|
1061
|
+
K as L,
|
|
1062
|
+
ze as M,
|
|
1063
|
+
J as R,
|
|
1064
|
+
gt as S,
|
|
1065
|
+
vt as a,
|
|
1066
|
+
ie as b,
|
|
1067
|
+
Ce as c,
|
|
1068
|
+
re as d,
|
|
1069
|
+
xe as e,
|
|
1070
|
+
tt as f,
|
|
1071
|
+
bt as g,
|
|
1072
|
+
nt as h,
|
|
1073
|
+
ae as i,
|
|
1074
|
+
we as j,
|
|
1075
|
+
We as k,
|
|
1076
|
+
Ke as l,
|
|
1077
|
+
Ge as m,
|
|
1078
|
+
it as n,
|
|
1079
|
+
at as o,
|
|
1080
|
+
ot as p,
|
|
1081
|
+
st as q,
|
|
1082
|
+
et as r,
|
|
1083
|
+
je as s,
|
|
1084
|
+
rt as t,
|
|
1085
|
+
Ie as u,
|
|
1086
|
+
le as v,
|
|
1087
|
+
Ue as w,
|
|
1088
|
+
ct as x,
|
|
1089
|
+
lt as y,
|
|
1090
|
+
dt as z
|
|
1253
1091
|
};
|