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