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