react-semaphor 0.1.494 → 0.1.496
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +233 -218
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/calculated-field-identity-Cq9GwHfE.js +1266 -0
- package/dist/chunks/calculated-field-identity-DTfyvvLC.cjs +1 -0
- package/dist/chunks/{constants-D47EhfJR.js → constants-CC3WKmqC.js} +14 -14
- package/dist/chunks/{constants-BMfm1XgO.cjs → constants-DIuhVR6J.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DQFa0Ti1.js → dashboard-briefing-launcher-Bbz4cwHb.js} +9 -9
- package/dist/chunks/{dashboard-briefing-launcher-nWBKnd0X.cjs → dashboard-briefing-launcher-CM6LTGw5.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-BbPWWVO-.cjs → dashboard-controls-B2nrczJl.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-DWpnRtQI.js → dashboard-controls-BsgADy-S.js} +11 -11
- package/dist/chunks/{dashboard-date-comparison-definition-CKXgDzSB.js → dashboard-date-comparison-definition-Bqti6YAo.js} +1 -1
- package/dist/chunks/{dashboard-date-comparison-definition-DCIUwJnZ.cjs → dashboard-date-comparison-definition-C69F-zaC.cjs} +1 -1
- package/dist/chunks/{dashboard-json-DyTQysQF.js → dashboard-json-CA-BChbt.js} +7 -7
- package/dist/chunks/{dashboard-json-BFJNDHxv.cjs → dashboard-json-CwRRBSSL.cjs} +1 -1
- package/dist/chunks/edit-dashboard-visual-BlS27LDw.cjs +172 -0
- package/dist/chunks/{edit-dashboard-visual-D-gauuNQ.js → edit-dashboard-visual-CEiPgdkX.js} +7903 -7939
- package/dist/chunks/{editor-action-buttons-DMgnHVY1.js → editor-action-buttons-6HBjjcfK.js} +6 -6
- package/dist/chunks/{editor-action-buttons-B7YezrkC.cjs → editor-action-buttons-kk2BNiTe.cjs} +1 -1
- package/dist/chunks/{field-aggregations-J7de9KZm.js → field-aggregations-C8kZqMTD.js} +11 -11
- package/dist/chunks/{field-aggregations-hx8odlTh.cjs → field-aggregations-naKZ7S2Q.cjs} +1 -1
- package/dist/chunks/{index-DXQsuuMQ.cjs → index-BSRwdFTN.cjs} +226 -225
- package/dist/chunks/{index-Df4YBtX5.cjs → index-CCa-A-Yx.cjs} +1 -1
- package/dist/chunks/{index-CPWfCksu.js → index-Cgoz65yM.js} +39519 -38739
- package/dist/chunks/{index-BDtC8et3.js → index-oll4m-qi.js} +11 -11
- package/dist/chunks/{matrix-analytical-definition-DAFStKt2.js → matrix-analytical-definition-B1xhoCak.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-B3p3vF0K.cjs → matrix-analytical-definition-BK5y9XHH.cjs} +1 -1
- package/dist/chunks/{matrix-card-5R39CCdj.js → matrix-card-BEb6hr8i.js} +2 -2
- package/dist/chunks/{matrix-card-DzkJRoM4.cjs → matrix-card-Ii8yYSnw.cjs} +1 -1
- package/dist/chunks/{matrix-control-sources-BWbqiGmN.cjs → matrix-control-sources-CdegRBcA.cjs} +1 -1
- package/dist/chunks/{matrix-control-sources-DxjWV8ry.js → matrix-control-sources-cbYmqWNg.js} +5 -5
- package/dist/chunks/{matrix-definition-Z80mIEfu.cjs → matrix-definition-CSNthxru.cjs} +1 -1
- package/dist/chunks/{matrix-definition-BcJi7qGZ.js → matrix-definition-CZM5-YJX.js} +1 -1
- package/dist/chunks/{matrix-formatter-3QR1mqhn.cjs → matrix-formatter-C19PZAal.cjs} +1 -1
- package/dist/chunks/{matrix-formatter-youWVghC.js → matrix-formatter-CiXzpX6X.js} +27 -27
- package/dist/chunks/matrix-member-presentation-CQHvq18l.cjs +1 -0
- package/dist/chunks/matrix-member-presentation-CabW8mJc.js +105 -0
- package/dist/chunks/{matrix-operation-contract-D5I-t3i7.js → matrix-operation-contract-0Nor-C71.js} +21 -21
- package/dist/chunks/{matrix-operation-contract-BiUMcd6G.cjs → matrix-operation-contract-o9GXbiHw.cjs} +1 -1
- package/dist/chunks/{metric-comparison-vr9j4Z_Z.js → metric-comparison-Br8l0WkK.js} +1 -1
- package/dist/chunks/{metric-comparison-D1VRq5Os.cjs → metric-comparison-DeiOjEm5.cjs} +1 -1
- package/dist/chunks/{operators-C8TxpM4C.js → operators-B3zZoskU.js} +28 -10
- package/dist/chunks/operators-DEfKaU_V.cjs +1 -0
- package/dist/chunks/{pivot-header-presentation-Dcd4IBM5.cjs → pivot-header-presentation-DRv-cSIP.cjs} +1 -1
- package/dist/chunks/{pivot-header-presentation-BslEo_4O.js → pivot-header-presentation-DW-ti5ek.js} +3 -3
- package/dist/chunks/{pivot-result-identity-CmvwpG4K.cjs → pivot-result-identity-DEenUrMj.cjs} +1 -1
- package/dist/chunks/{pivot-result-identity-CMz27nri.js → pivot-result-identity-sZc1RaIz.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-H_pntnd9.cjs → pivot-result-lifecycle-D81qcCcZ.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-BCoOFUiU.js → pivot-result-lifecycle-DJ40gdwk.js} +7 -7
- package/dist/chunks/{raw-temporal-DcHmXurp.cjs → raw-temporal-DDTt2yv5.cjs} +1 -1
- package/dist/chunks/{raw-temporal-YWo1GEmr.js → raw-temporal-DHCZrFe7.js} +15 -15
- package/dist/chunks/{raw-temporal-contract-Bg1mtRGE.cjs → raw-temporal-contract-BcbV56Rc.cjs} +1 -1
- package/dist/chunks/{raw-temporal-contract-DY-Jd4Sc.js → raw-temporal-contract-CkvdtPYA.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-Bt8T3To1.js → report-preferences-dialog-CVRJOCQu.js} +6 -6
- package/dist/chunks/{report-preferences-dialog-oT-C29vV.cjs → report-preferences-dialog-DGEq-iBF.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-nCHl3uHC.js → report-runtime-context-BlDpc-F-.js} +1 -1
- package/dist/chunks/{report-runtime-context-Bb0ejvVq.cjs → report-runtime-context-lSIvyKm2.cjs} +1 -1
- package/dist/chunks/{semantic-format-CMPIcb8l.cjs → semantic-format--_VEin18.cjs} +1 -1
- package/dist/chunks/{semantic-format-UvUAyZS-.js → semantic-format-ew5zviaT.js} +2 -2
- package/dist/chunks/{source-entity-resolution-Dm4in31q.js → source-entity-resolution-79Rihbk3.js} +121 -107
- package/dist/chunks/source-entity-resolution-DPjslVgx.cjs +1 -0
- package/dist/chunks/{switch-DHOv6xHT.js → switch-BmyuyM7e.js} +4736 -4697
- package/dist/chunks/switch-nDjQC2y3.cjs +139 -0
- package/dist/chunks/{temporal-bucket-contract-CPuYzg7A.cjs → temporal-bucket-contract-BYR6tj6F.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-contract-Bx5TJXF3.js → temporal-bucket-contract-C-kKQ_W4.js} +1 -1
- package/dist/chunks/{token-types-5buW2I6f.js → token-types-BIYFAsGq.js} +1 -1
- package/dist/chunks/{token-types-hl08eNuY.cjs → token-types-CkAGFhiW.cjs} +1 -1
- package/dist/chunks/{update-policy-BP_2uCgs.cjs → update-policy-BCtFr2Qh.cjs} +1 -1
- package/dist/chunks/{update-policy-D3I1J2kl.js → update-policy-CP_A1IVD.js} +2 -2
- package/dist/chunks/{validators-BpJDwDnG.js → validators-D-_IT-Xw.js} +1134 -1013
- package/dist/chunks/validators-ux2obZB9.cjs +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +157 -150
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +2 -2
- package/dist/data-app-codegen-node/index.js +33 -36
- package/dist/data-app-sdk/index.cjs +2 -2
- package/dist/data-app-sdk/index.js +232 -230
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +5 -5
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +26 -26
- package/dist/index.cjs +1 -1
- package/dist/index.js +15 -15
- package/dist/report-runtime-context/index.cjs +1 -1
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +265 -1
- package/dist/types/briefings.d.ts +55 -0
- package/dist/types/dashboard-assistant.d.ts +55 -1
- package/dist/types/dashboard-authoring.d.ts +140 -2
- package/dist/types/dashboard.d.ts +57 -0
- package/dist/types/data-app-builder.d.ts +32 -1
- package/dist/types/data-app-codegen-node.d.ts +32 -1
- package/dist/types/data-app-codegen.d.ts +32 -1
- package/dist/types/data-app-sdk-adapters.d.ts +32 -1
- package/dist/types/data-app-sdk-validation.d.ts +55 -1
- package/dist/types/data-app-sdk.d.ts +60 -1
- package/dist/types/format-utils.d.ts +9 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +4 -4
- package/dist/types/main.d.ts +122 -1
- package/dist/types/shared.d.ts +55 -0
- package/dist/types/surfboard.d.ts +57 -0
- package/dist/types/types.d.ts +57 -0
- package/package.json +1 -1
- package/dist/chunks/calculated-field-identity-CSabKrXt.js +0 -1117
- package/dist/chunks/calculated-field-identity-D4VOHjBJ.cjs +0 -1
- package/dist/chunks/edit-dashboard-visual-Dtacp_qY.cjs +0 -172
- package/dist/chunks/matrix-member-presentation-BEWAH5xK.js +0 -24
- package/dist/chunks/matrix-member-presentation-DtLGyv8w.cjs +0 -1
- package/dist/chunks/operators-DrTQsJXv.cjs +0 -1
- package/dist/chunks/source-entity-resolution-DeH38dTU.cjs +0 -1
- package/dist/chunks/switch-CatLIoK-.cjs +0 -139
- package/dist/chunks/validators-4dRtYUI1.cjs +0 -1
package/dist/chunks/{source-entity-resolution-Dm4in31q.js → source-entity-resolution-79Rihbk3.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aT as K } from "./validators-D-_IT-Xw.js";
|
|
2
2
|
function p(e) {
|
|
3
|
-
const i =
|
|
3
|
+
const i = V(e);
|
|
4
4
|
return i.length > 0 ? i.join(".") : void 0;
|
|
5
5
|
}
|
|
6
6
|
function Q(e) {
|
|
@@ -11,26 +11,26 @@ function Q(e) {
|
|
|
11
11
|
const a = {};
|
|
12
12
|
let s = t.length - 1;
|
|
13
13
|
for (let r = e.capabilities.prefixLevels.length - 1; r >= 0 && s >= 0; r -= 1, s -= 1)
|
|
14
|
-
|
|
14
|
+
Y(
|
|
15
15
|
a,
|
|
16
16
|
e.capabilities.prefixLevels[r],
|
|
17
17
|
t[s]
|
|
18
18
|
);
|
|
19
19
|
return a;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function P(e) {
|
|
22
22
|
return !e.left.tableName || !e.right.tableName ? !1 : e.capabilities.prefixLevels.every((i) => {
|
|
23
|
-
const t =
|
|
23
|
+
const t = I(e.left, i), a = I(e.right, i);
|
|
24
24
|
return !t || !a || t === a;
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function pe(e) {
|
|
28
28
|
return e.capabilities.prefixLevels.every((i) => {
|
|
29
|
-
const t =
|
|
30
|
-
return t ?
|
|
29
|
+
const t = I(e.requested, i);
|
|
30
|
+
return t ? I(e.allowed, i) === t : !0;
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function X(e, i = {}) {
|
|
34
34
|
const t = j(e), a = {
|
|
35
35
|
connectionId: i.connectionId,
|
|
36
36
|
connectionType: e,
|
|
@@ -118,7 +118,7 @@ function U(e, i = {}) {
|
|
|
118
118
|
function v(e, i = {}) {
|
|
119
119
|
return M(
|
|
120
120
|
e
|
|
121
|
-
) ?
|
|
121
|
+
) ? X(e, i) : void 0;
|
|
122
122
|
}
|
|
123
123
|
function M(e) {
|
|
124
124
|
const i = j(e);
|
|
@@ -132,7 +132,7 @@ function M(e) {
|
|
|
132
132
|
if (i === "s3" || i === "api" || i === "googlesheets" || i === "fileupload" || i === "s3tables" || i === "bigquery")
|
|
133
133
|
return i;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function z(e) {
|
|
136
136
|
const i = j(e);
|
|
137
137
|
switch (i) {
|
|
138
138
|
case "mysql":
|
|
@@ -153,31 +153,44 @@ function P(e) {
|
|
|
153
153
|
return "unknown";
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function ve(e) {
|
|
157
157
|
return e.capabilities.prefixLevels.every(
|
|
158
|
-
(i) => !!
|
|
158
|
+
(i) => !!I(e.source, i)
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
const i = e.quoteIdentifier ??
|
|
163
|
-
return e.capabilities.prefixLevels.map((t) =>
|
|
161
|
+
function ke(e) {
|
|
162
|
+
const i = e.quoteIdentifier ?? ie;
|
|
163
|
+
return e.capabilities.prefixLevels.map((t) => I(e.source, t)).filter((t) => !!t).map((t) => i(t, e.capabilities.dialect)).join(".");
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function I(e, i) {
|
|
166
166
|
return i === "database" ? e.databaseName : i === "schema" ? e.schemaName : e.tableName;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function Y(e, i, t) {
|
|
169
169
|
i === "database" ? e.databaseName = t : i === "schema" ? e.schemaName = t : e.tableName = t;
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
const Z = [
|
|
172
|
+
['"', '"'],
|
|
173
|
+
["`", "`"],
|
|
174
|
+
["[", "]"]
|
|
175
|
+
];
|
|
176
|
+
function ee(e) {
|
|
177
|
+
const i = e.trim();
|
|
178
|
+
for (const [t, a] of Z)
|
|
179
|
+
if (i.length >= 2 && i.startsWith(t) && i.endsWith(a))
|
|
180
|
+
return i.slice(1, -1).split(a + a).join(a);
|
|
181
|
+
return i;
|
|
182
|
+
}
|
|
183
|
+
function V(e) {
|
|
172
184
|
const i = e == null ? void 0 : e.trim();
|
|
173
185
|
if (!i) return [];
|
|
174
|
-
const t = i.split(".").map(
|
|
175
|
-
const s = a.trim();
|
|
176
|
-
return s.length >= 2 && s.startsWith('"') && s.endsWith('"') ? s.slice(1, -1) : s;
|
|
177
|
-
});
|
|
186
|
+
const t = i.split(".").map(ee);
|
|
178
187
|
return t.some((a) => !a) ? [] : t;
|
|
179
188
|
}
|
|
180
|
-
function
|
|
189
|
+
function ge(e) {
|
|
190
|
+
const i = V(e ?? void 0);
|
|
191
|
+
return i[i.length - 1] || "";
|
|
192
|
+
}
|
|
193
|
+
function ie(e, i) {
|
|
181
194
|
return i === "mysql" || i === "bigquery" || i === "clickhouse" || i === "duckdb" ? `\`${e.replace(/`/g, "``")}\`` : i === "mssql" ? `[${e.replace(/]/g, "]]")}]` : `"${e.replace(/"/g, '""')}"`;
|
|
182
195
|
}
|
|
183
196
|
function j(e) {
|
|
@@ -185,14 +198,14 @@ function j(e) {
|
|
|
185
198
|
return "";
|
|
186
199
|
const i = [];
|
|
187
200
|
for (const t of e.trim().toLowerCase())
|
|
188
|
-
|
|
201
|
+
te(t) && i.push(t);
|
|
189
202
|
return i.join("");
|
|
190
203
|
}
|
|
191
|
-
function
|
|
204
|
+
function te(e) {
|
|
192
205
|
const i = e.charCodeAt(0);
|
|
193
206
|
return i >= 48 && i <= 57 || i >= 97 && i <= 122;
|
|
194
207
|
}
|
|
195
|
-
function
|
|
208
|
+
function O(e) {
|
|
196
209
|
return e.prefixLevels.length === 1 && e.prefixLevels[0] === "table" ? ["table"] : Array.from(
|
|
197
210
|
/* @__PURE__ */ new Set([
|
|
198
211
|
"database",
|
|
@@ -200,13 +213,13 @@ function V(e) {
|
|
|
200
213
|
])
|
|
201
214
|
);
|
|
202
215
|
}
|
|
203
|
-
function
|
|
204
|
-
const i = e.source.connectionType ? v(e.source.connectionType) : void 0, t = e.source.dialect ?
|
|
216
|
+
function Ne(e) {
|
|
217
|
+
const i = e.source.connectionType ? v(e.source.connectionType) : void 0, t = e.source.dialect ? z(e.source.dialect) : void 0, a = e.source.dialect && e.source.dialect !== "unknown" ? v(e.source.dialect) : void 0;
|
|
205
218
|
if (!e.capabilities && e.source.connectionType && e.source.dialect && e.source.dialect !== "unknown" && (!i || t === "unknown" || i.dialect !== t))
|
|
206
219
|
return { kind: "incompatible_capabilities" };
|
|
207
220
|
const s = e.capabilities || i || a;
|
|
208
221
|
if (!s) return { kind: "incompatible_capabilities" };
|
|
209
|
-
const r =
|
|
222
|
+
const r = O(s), o = {
|
|
210
223
|
...r.includes("database") && e.source.databaseName ? { databaseName: e.source.databaseName } : {},
|
|
211
224
|
...r.includes("schema") && e.source.schemaName ? { schemaName: e.source.schemaName } : {},
|
|
212
225
|
...e.source.tableName ? { tableName: e.source.tableName } : {}
|
|
@@ -222,7 +235,7 @@ function f(e) {
|
|
|
222
235
|
function w(e) {
|
|
223
236
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
224
237
|
}
|
|
225
|
-
function
|
|
238
|
+
function W(e) {
|
|
226
239
|
const i = w(e);
|
|
227
240
|
return !i || !f(i.name) || i.type === "model" ? !1 : i.type === "dataset" ? i.datasetType === "physical" : !0;
|
|
228
241
|
}
|
|
@@ -236,16 +249,16 @@ function x(e) {
|
|
|
236
249
|
...t ? { tableName: t } : {}
|
|
237
250
|
};
|
|
238
251
|
}
|
|
239
|
-
function
|
|
240
|
-
if (
|
|
241
|
-
const i = e.entities.filter(
|
|
252
|
+
function ae(e) {
|
|
253
|
+
if (re(e)) return { kind: "malformed" };
|
|
254
|
+
const i = e.entities.filter(W), t = ne(e), a = se({
|
|
242
255
|
entities: i,
|
|
243
256
|
connectionType: e.connectionType,
|
|
244
257
|
dialect: e.dialect,
|
|
245
258
|
capabilities: e.capabilities
|
|
246
259
|
});
|
|
247
260
|
if (!a) return { kind: "incompatible_capabilities" };
|
|
248
|
-
const { capabilities: s } = a, r =
|
|
261
|
+
const { capabilities: s } = a, r = ce({
|
|
249
262
|
hints: e.qualifiedHints || [],
|
|
250
263
|
coordinateHint: e.coordinateHint,
|
|
251
264
|
capabilityAuthority: a
|
|
@@ -253,8 +266,8 @@ function ie(e) {
|
|
|
253
266
|
if (r.kind !== "valid")
|
|
254
267
|
return { kind: r.kind };
|
|
255
268
|
const o = r.coordinates, n = o ? i.filter(
|
|
256
|
-
(c) =>
|
|
257
|
-
left:
|
|
269
|
+
(c) => P({
|
|
270
|
+
left: G(
|
|
258
271
|
x(c),
|
|
259
272
|
s
|
|
260
273
|
),
|
|
@@ -278,7 +291,7 @@ function ie(e) {
|
|
|
278
291
|
kind: "resolved",
|
|
279
292
|
basis: "qualified",
|
|
280
293
|
entity: c,
|
|
281
|
-
coordinates:
|
|
294
|
+
coordinates: fe(
|
|
282
295
|
x(c),
|
|
283
296
|
o,
|
|
284
297
|
u
|
|
@@ -286,14 +299,14 @@ function ie(e) {
|
|
|
286
299
|
capabilityAuthority: u
|
|
287
300
|
};
|
|
288
301
|
}
|
|
289
|
-
const d =
|
|
302
|
+
const d = U([
|
|
290
303
|
...e.bareHints || [],
|
|
291
304
|
...r.bareHints,
|
|
292
305
|
o == null ? void 0 : o.tableName
|
|
293
306
|
]);
|
|
294
307
|
if (d.size > 0) {
|
|
295
308
|
const c = n.filter((u) => {
|
|
296
|
-
const b =
|
|
309
|
+
const b = ue(u);
|
|
297
310
|
return Array.from(d).some((h) => b.has(h));
|
|
298
311
|
});
|
|
299
312
|
if (c.length === 1) {
|
|
@@ -305,7 +318,7 @@ function ie(e) {
|
|
|
305
318
|
kind: "resolved",
|
|
306
319
|
basis: "bare",
|
|
307
320
|
entity: u,
|
|
308
|
-
coordinates:
|
|
321
|
+
coordinates: L(
|
|
309
322
|
x(u),
|
|
310
323
|
b
|
|
311
324
|
),
|
|
@@ -331,7 +344,7 @@ function ie(e) {
|
|
|
331
344
|
kind: "resolved",
|
|
332
345
|
basis: "unqualified",
|
|
333
346
|
entity: c,
|
|
334
|
-
coordinates:
|
|
347
|
+
coordinates: L(
|
|
335
348
|
x(c),
|
|
336
349
|
u
|
|
337
350
|
),
|
|
@@ -340,7 +353,7 @@ function ie(e) {
|
|
|
340
353
|
}
|
|
341
354
|
return { kind: "unqualified" };
|
|
342
355
|
}
|
|
343
|
-
function
|
|
356
|
+
function ne(e) {
|
|
344
357
|
const i = (e.qualifiedHints || []).map(f).filter((a) => !!a);
|
|
345
358
|
return Object.values(e.coordinateHint || {}).some(
|
|
346
359
|
(a) => !!f(a)
|
|
@@ -351,18 +364,18 @@ function te(e) {
|
|
|
351
364
|
function S(e) {
|
|
352
365
|
return `${e.dialect}:${e.prefixLevels.join(".")}`;
|
|
353
366
|
}
|
|
354
|
-
function
|
|
367
|
+
function T(e) {
|
|
355
368
|
return {
|
|
356
369
|
dialect: e.dialect,
|
|
357
370
|
prefixLevels: [...e.prefixLevels]
|
|
358
371
|
};
|
|
359
372
|
}
|
|
360
|
-
function
|
|
373
|
+
function se(e) {
|
|
361
374
|
var q;
|
|
362
|
-
const i = f(e.connectionType), t = f(e.dialect), a = e.capabilities ?
|
|
375
|
+
const i = f(e.connectionType), t = f(e.dialect), a = e.capabilities ? T(e.capabilities) : void 0, s = i ? v(i) : void 0, r = t ? z(t) : void 0, o = t && t !== "unknown" ? v(t) : void 0;
|
|
363
376
|
if (i && !s || t && t !== "unknown" && r === "unknown" || a && s && S(a) !== S(s))
|
|
364
377
|
return;
|
|
365
|
-
const n = a || (s ?
|
|
378
|
+
const n = a || (s ? T(s) : o ? T(o) : void 0);
|
|
366
379
|
if (n)
|
|
367
380
|
return r && r !== "unknown" && n.dialect !== r ? void 0 : {
|
|
368
381
|
capabilities: n,
|
|
@@ -371,10 +384,10 @@ function ae(e) {
|
|
|
371
384
|
evidence: "explicit"
|
|
372
385
|
};
|
|
373
386
|
const d = e.entities.map((m) => {
|
|
374
|
-
const k = w(m), g = f(k == null ? void 0 : k.connectionType), y = f(k == null ? void 0 : k.dialect), N = g ? v(g) : void 0, H = y ?
|
|
387
|
+
const k = w(m), g = f(k == null ? void 0 : k.connectionType), y = f(k == null ? void 0 : k.dialect), N = g ? v(g) : void 0, H = y ? z(y) : void 0, A = y && y !== "unknown" ? v(y) : void 0;
|
|
375
388
|
if (g && !N || y && y !== "unknown" && H === "unknown" || y && y !== "unknown" && !N && !A || N && H && H !== "unknown" && N.dialect !== H)
|
|
376
389
|
return;
|
|
377
|
-
const F = N || A, B = F ?
|
|
390
|
+
const F = N || A, B = F ? T(F) : oe(k);
|
|
378
391
|
return B ? {
|
|
379
392
|
capabilities: B,
|
|
380
393
|
connectionType: g,
|
|
@@ -404,7 +417,7 @@ function ae(e) {
|
|
|
404
417
|
evidence: c.every((m) => m.inferred) ? "coordinates" : "entity"
|
|
405
418
|
};
|
|
406
419
|
}
|
|
407
|
-
function
|
|
420
|
+
function oe(e) {
|
|
408
421
|
const i = !!f(e == null ? void 0 : e.database), t = !!f(e == null ? void 0 : e.schema);
|
|
409
422
|
if (!(i && t)) {
|
|
410
423
|
if (t)
|
|
@@ -419,7 +432,7 @@ function E(e, i) {
|
|
|
419
432
|
const t = f((s = w(i)) == null ? void 0 : s.connectionType), a = t ? v(t) : void 0;
|
|
420
433
|
return a && S(a) === S(e.capabilities) ? { ...e, connectionType: t } : e;
|
|
421
434
|
}
|
|
422
|
-
function
|
|
435
|
+
function re(e) {
|
|
423
436
|
return (e.qualifiedHints || []).some(
|
|
424
437
|
(t) => {
|
|
425
438
|
const a = f(t);
|
|
@@ -430,7 +443,7 @@ function se(e) {
|
|
|
430
443
|
return !!(a && !p(a));
|
|
431
444
|
});
|
|
432
445
|
}
|
|
433
|
-
function
|
|
446
|
+
function ce(e) {
|
|
434
447
|
const { capabilities: i } = e.capabilityAuthority, t = [], a = [];
|
|
435
448
|
for (const b of e.hints) {
|
|
436
449
|
const h = f(b);
|
|
@@ -443,7 +456,7 @@ function oe(e) {
|
|
|
443
456
|
if (!q) return { kind: "malformed" };
|
|
444
457
|
t.push(q);
|
|
445
458
|
}
|
|
446
|
-
const s =
|
|
459
|
+
const s = le(e.coordinateHint);
|
|
447
460
|
if (s.kind === "malformed") return s;
|
|
448
461
|
const r = Array.from(new Set(t)).map(
|
|
449
462
|
(b) => Q({
|
|
@@ -451,21 +464,21 @@ function oe(e) {
|
|
|
451
464
|
capabilities: i
|
|
452
465
|
})
|
|
453
466
|
);
|
|
454
|
-
if (!
|
|
467
|
+
if (!de(r, i))
|
|
455
468
|
return { kind: "conflicting" };
|
|
456
469
|
const o = [...new Set(t)].sort(
|
|
457
470
|
(b, h) => h.split(".").length - b.split(".").length
|
|
458
471
|
)[0], n = o ? Q({
|
|
459
472
|
qualifiedName: o,
|
|
460
473
|
capabilities: i
|
|
461
|
-
}) : void 0, d =
|
|
474
|
+
}) : void 0, d = G(
|
|
462
475
|
s.coordinates,
|
|
463
476
|
i
|
|
464
|
-
), c =
|
|
477
|
+
), c = L(
|
|
465
478
|
s.coordinates,
|
|
466
479
|
e.capabilityAuthority
|
|
467
480
|
), u = !!(d.tableName && (d.databaseName || d.schemaName));
|
|
468
|
-
return n && u && !
|
|
481
|
+
return n && u && !P({
|
|
469
482
|
left: n,
|
|
470
483
|
right: d,
|
|
471
484
|
capabilities: i
|
|
@@ -481,7 +494,7 @@ function oe(e) {
|
|
|
481
494
|
]
|
|
482
495
|
};
|
|
483
496
|
}
|
|
484
|
-
function
|
|
497
|
+
function le(e) {
|
|
485
498
|
const i = {};
|
|
486
499
|
for (const [t, a] of Object.entries(e || {})) {
|
|
487
500
|
const s = f(a);
|
|
@@ -492,17 +505,17 @@ function re(e) {
|
|
|
492
505
|
}
|
|
493
506
|
return { kind: "valid", coordinates: i };
|
|
494
507
|
}
|
|
495
|
-
function
|
|
508
|
+
function G(e, i) {
|
|
496
509
|
return {
|
|
497
510
|
...i.prefixLevels.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
498
511
|
...i.prefixLevels.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
499
512
|
...e.tableName ? { tableName: e.tableName } : {}
|
|
500
513
|
};
|
|
501
514
|
}
|
|
502
|
-
function
|
|
515
|
+
function de(e, i) {
|
|
503
516
|
return e.every(
|
|
504
517
|
(t, a) => e.slice(a + 1).every(
|
|
505
|
-
(s) =>
|
|
518
|
+
(s) => P({
|
|
506
519
|
left: t,
|
|
507
520
|
right: s,
|
|
508
521
|
capabilities: i
|
|
@@ -510,21 +523,21 @@ function ce(e, i) {
|
|
|
510
523
|
)
|
|
511
524
|
);
|
|
512
525
|
}
|
|
513
|
-
function
|
|
526
|
+
function U(e) {
|
|
514
527
|
return new Set(
|
|
515
528
|
e.map(f).map(p).filter((i) => !!i)
|
|
516
529
|
);
|
|
517
530
|
}
|
|
518
|
-
function
|
|
531
|
+
function ue(e) {
|
|
519
532
|
const i = w(e);
|
|
520
|
-
return i ?
|
|
533
|
+
return i ? U([
|
|
521
534
|
f(i.name),
|
|
522
535
|
f(i.table),
|
|
523
536
|
f(i.id)
|
|
524
537
|
]) : /* @__PURE__ */ new Set();
|
|
525
538
|
}
|
|
526
|
-
function
|
|
527
|
-
return
|
|
539
|
+
function fe(e, i, t) {
|
|
540
|
+
return L(
|
|
528
541
|
{
|
|
529
542
|
...e,
|
|
530
543
|
...i
|
|
@@ -532,8 +545,8 @@ function de(e, i, t) {
|
|
|
532
545
|
t
|
|
533
546
|
);
|
|
534
547
|
}
|
|
535
|
-
function
|
|
536
|
-
const t = i.evidence === "coordinates" ? i.capabilities.prefixLevels :
|
|
548
|
+
function L(e, i) {
|
|
549
|
+
const t = i.evidence === "coordinates" ? i.capabilities.prefixLevels : O(i.capabilities);
|
|
537
550
|
return {
|
|
538
551
|
...t.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
539
552
|
...t.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
@@ -543,18 +556,18 @@ function T(e, i) {
|
|
|
543
556
|
function l(e) {
|
|
544
557
|
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
545
558
|
}
|
|
546
|
-
function
|
|
559
|
+
function C(e) {
|
|
547
560
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
548
561
|
}
|
|
549
|
-
function
|
|
550
|
-
const i =
|
|
562
|
+
function me(e) {
|
|
563
|
+
const i = C(e);
|
|
551
564
|
return !!(i && i.type === "dataset" && l(i.name));
|
|
552
565
|
}
|
|
553
566
|
function J(e) {
|
|
554
|
-
const i =
|
|
567
|
+
const i = C(e);
|
|
555
568
|
return !!(i && i.type === "dataset" && i.datasetType !== "physical" && l(i.name));
|
|
556
569
|
}
|
|
557
|
-
function
|
|
570
|
+
function R(e) {
|
|
558
571
|
const i = /* @__PURE__ */ new Set();
|
|
559
572
|
for (const t of e) {
|
|
560
573
|
const a = l(t);
|
|
@@ -568,13 +581,13 @@ function $(e) {
|
|
|
568
581
|
}
|
|
569
582
|
return i;
|
|
570
583
|
}
|
|
571
|
-
function
|
|
584
|
+
function $(e) {
|
|
572
585
|
var t;
|
|
573
586
|
const i = l(e);
|
|
574
587
|
return i ? (t = p(i)) == null ? void 0 : t.toLowerCase() : void 0;
|
|
575
588
|
}
|
|
576
589
|
function D(e, i) {
|
|
577
|
-
const t =
|
|
590
|
+
const t = C(i), a = l(t == null ? void 0 : t.domainId) || l(e.semanticDomainId), s = l(t == null ? void 0 : t.name);
|
|
578
591
|
if (!a || !s) return;
|
|
579
592
|
const r = (t == null ? void 0 : t.datasetType) === "physical" ? void 0 : K(t || {}), o = l(t == null ? void 0 : t.connectionId) || l(e.connectionId);
|
|
580
593
|
return {
|
|
@@ -585,17 +598,17 @@ function D(e, i) {
|
|
|
585
598
|
...o ? { connectionId: o } : {}
|
|
586
599
|
};
|
|
587
600
|
}
|
|
588
|
-
function
|
|
601
|
+
function be(e, i = {}) {
|
|
589
602
|
const t = l(e.fieldEntityType);
|
|
590
603
|
if (t && t !== "dataset")
|
|
591
604
|
return { kind: "unqualified" };
|
|
592
605
|
const a = e.entities.filter(
|
|
593
|
-
(o) => i.includePhysicalDatasets ?
|
|
606
|
+
(o) => i.includePhysicalDatasets ? me(o) : J(o)
|
|
594
607
|
), s = l(e.entityId);
|
|
595
608
|
if (s) {
|
|
596
|
-
const o =
|
|
597
|
-
const c =
|
|
598
|
-
return !!(o &&
|
|
609
|
+
const o = $(s), n = a.filter((d) => {
|
|
610
|
+
const c = C(d);
|
|
611
|
+
return !!(o && $(c == null ? void 0 : c.id) === o);
|
|
599
612
|
});
|
|
600
613
|
if (n.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
601
614
|
if (n.length === 1) {
|
|
@@ -609,15 +622,15 @@ function fe(e, i = {}) {
|
|
|
609
622
|
} : { kind: "not_found", basis: "bare" };
|
|
610
623
|
}
|
|
611
624
|
}
|
|
612
|
-
const r =
|
|
625
|
+
const r = R([
|
|
613
626
|
e.entityName,
|
|
614
627
|
...e.qualifiedHints || [],
|
|
615
628
|
...e.bareHints || []
|
|
616
629
|
]);
|
|
617
630
|
if (r.size > 0) {
|
|
618
631
|
const o = a.filter((n) => {
|
|
619
|
-
const d =
|
|
620
|
-
return [
|
|
632
|
+
const d = C(n);
|
|
633
|
+
return [...R([d == null ? void 0 : d.id, d == null ? void 0 : d.name])].some((u) => r.has(u));
|
|
621
634
|
});
|
|
622
635
|
if (o.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
623
636
|
if (o.length === 1) {
|
|
@@ -644,8 +657,8 @@ function fe(e, i = {}) {
|
|
|
644
657
|
}
|
|
645
658
|
return { kind: "unqualified" };
|
|
646
659
|
}
|
|
647
|
-
function
|
|
648
|
-
const i = e.resolution.kind === "resolved" ?
|
|
660
|
+
function _(e) {
|
|
661
|
+
const i = e.resolution.kind === "resolved" ? C(e.resolution.entity) : void 0, t = l(e.connectionId) || l(i == null ? void 0 : i.connectionId), { connectionType: a, dialect: s } = e.resolution.capabilityAuthority, r = v(s), o = !!(r && r.dialect === e.resolution.capabilityAuthority.capabilities.dialect && r.prefixLevels.join(".") === e.resolution.capabilityAuthority.capabilities.prefixLevels.join(
|
|
649
662
|
"."
|
|
650
663
|
)), n = e.resolution.coordinates;
|
|
651
664
|
if (!(!t || !(n != null && n.tableName)))
|
|
@@ -659,7 +672,7 @@ function z(e) {
|
|
|
659
672
|
...n.schemaName ? { schemaName: n.schemaName } : {}
|
|
660
673
|
};
|
|
661
674
|
}
|
|
662
|
-
function
|
|
675
|
+
function he(e) {
|
|
663
676
|
var s, r, o;
|
|
664
677
|
if (l(e.connectionType) || l(e.dialect) || e.capabilities || l(e.semanticDomainId) || l(e.fieldEntityType) === "dataset" || l((s = e.fallbackCoordinateHint) == null ? void 0 : s.databaseName) || l((r = e.fallbackCoordinateHint) == null ? void 0 : r.schemaName))
|
|
665
678
|
return;
|
|
@@ -675,17 +688,17 @@ function me(e) {
|
|
|
675
688
|
const t = i.map(p);
|
|
676
689
|
return t.some((n) => !n) ? void 0 : new Set(t.map((n) => n.toLowerCase())).size === 1 ? t[0] : void 0;
|
|
677
690
|
}
|
|
678
|
-
function
|
|
691
|
+
function Ie(e) {
|
|
679
692
|
const i = e.entities.filter(
|
|
680
|
-
|
|
693
|
+
W
|
|
681
694
|
), t = e.entities.filter(
|
|
682
695
|
J
|
|
683
|
-
), a = i.length > 0 || t.length > 0, s =
|
|
696
|
+
), a = i.length > 0 || t.length > 0, s = be(e), r = e.qualifiedHints || [], o = r.some(
|
|
684
697
|
(c) => {
|
|
685
698
|
var u;
|
|
686
699
|
return (u = l(c)) == null ? void 0 : u.includes(".");
|
|
687
700
|
}
|
|
688
|
-
), n =
|
|
701
|
+
), n = ae({
|
|
689
702
|
entities: i,
|
|
690
703
|
connectionType: l(e.connectionType),
|
|
691
704
|
dialect: e.dialect,
|
|
@@ -697,7 +710,7 @@ function ke(e) {
|
|
|
697
710
|
if (n.kind === "malformed" || n.kind === "conflicting" || n.kind === "incompatible_capabilities" && o || n.kind === "ambiguous" && n.basis === "qualified")
|
|
698
711
|
return n;
|
|
699
712
|
if (n.kind === "resolved" && n.basis === "qualified") {
|
|
700
|
-
const c =
|
|
713
|
+
const c = _({
|
|
701
714
|
resolution: n,
|
|
702
715
|
connectionId: e.connectionId
|
|
703
716
|
});
|
|
@@ -709,7 +722,7 @@ function ke(e) {
|
|
|
709
722
|
} : { kind: "missing_connection" };
|
|
710
723
|
}
|
|
711
724
|
if (n.kind === "not_found" && n.basis === "qualified" && n.coordinates) {
|
|
712
|
-
const c =
|
|
725
|
+
const c = _({
|
|
713
726
|
resolution: n,
|
|
714
727
|
connectionId: e.connectionId
|
|
715
728
|
});
|
|
@@ -724,7 +737,7 @@ function ke(e) {
|
|
|
724
737
|
};
|
|
725
738
|
if (s.kind === "ambiguous") return s;
|
|
726
739
|
if (n.kind === "resolved") {
|
|
727
|
-
const c =
|
|
740
|
+
const c = _({
|
|
728
741
|
resolution: n,
|
|
729
742
|
connectionId: e.connectionId
|
|
730
743
|
});
|
|
@@ -748,7 +761,7 @@ function ke(e) {
|
|
|
748
761
|
}
|
|
749
762
|
};
|
|
750
763
|
if (n.kind === "incompatible_capabilities") {
|
|
751
|
-
const c = a ? void 0 :
|
|
764
|
+
const c = a ? void 0 : he(e), u = l(e.connectionId);
|
|
752
765
|
return c && u ? {
|
|
753
766
|
kind: "resolved",
|
|
754
767
|
basis: "historical",
|
|
@@ -761,21 +774,22 @@ function ke(e) {
|
|
|
761
774
|
} : { kind: "unqualified" };
|
|
762
775
|
}
|
|
763
776
|
export {
|
|
764
|
-
|
|
777
|
+
pe as a,
|
|
765
778
|
M as b,
|
|
766
779
|
p as c,
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
780
|
+
ve as d,
|
|
781
|
+
ke as e,
|
|
782
|
+
ge as f,
|
|
783
|
+
X as g,
|
|
784
|
+
O as h,
|
|
785
|
+
Ne as i,
|
|
786
|
+
W as j,
|
|
787
|
+
ae as k,
|
|
788
|
+
J as l,
|
|
789
|
+
be as m,
|
|
790
|
+
z as n,
|
|
791
|
+
Ie as o,
|
|
778
792
|
Q as p,
|
|
779
793
|
v as r,
|
|
780
|
-
|
|
794
|
+
P as s
|
|
781
795
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const Z=require("./validators-ux2obZB9.cjs");function y(e){const i=U(e);return i.length>0?i.join("."):void 0}function Q(e){const i=y(e.qualifiedName),t=(i==null?void 0:i.split("."))||[];if(t.length===0)return{};const a={};let s=t.length-1;for(let r=e.capabilities.prefixLevels.length-1;r>=0&&s>=0;r-=1,s-=1)ae(a,e.capabilities.prefixLevels[r],t[s]);return a}function E(e){return!e.left.tableName||!e.right.tableName?!1:e.capabilities.prefixLevels.every(i=>{const t=S(e.left,i),a=S(e.right,i);return!t||!a||t===a})}function ee(e){return e.capabilities.prefixLevels.every(i=>{const t=S(e.requested,i);return t?S(e.allowed,i)===t:!0})}function G(e,i={}){const t=F(e),a={connectionId:i.connectionId,connectionType:e,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return t.includes("postgres")?{...a,prefixLevels:["schema","table"],dialect:"postgres"}:t.includes("mysql")?{...a,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:t.includes("mssql")||t.includes("sqlserver")?{...a,dialect:"mssql",supportsFilterClause:!1}:t.includes("redshift")?{...a,prefixLevels:["schema","table"],dialect:"redshift"}:t.includes("snowflake")?{...a,dialect:"snowflake"}:t.includes("clickhouse")?{connectionId:i.connectionId,connectionType:e,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:t==="s3"||t==="api"?{connectionId:i.connectionId,connectionType:e,path:["table"],labels:{table:t==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:t==="googlesheets"||t==="fileupload"?{connectionId:i.connectionId,connectionType:e,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:t==="s3tables"?{...a,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:t==="bigquery"?{...a,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:a}function v(e,i={}){return j(e)?G(e,i):void 0}function j(e){const i=F(e);if(i.includes("postgres"))return"postgres";if(i.includes("mysql"))return"mysql";if(i.includes("mssql")||i.includes("sqlserver"))return"mssql";if(i.includes("redshift"))return"redshift";if(i.includes("snowflake"))return"snowflake";if(i.includes("clickhouse"))return"clickhouse";if(i==="s3"||i==="api"||i==="googlesheets"||i==="fileupload"||i==="s3tables"||i==="bigquery")return i}function T(e){const i=F(e);switch(i){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return i;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function ie(e){return e.capabilities.prefixLevels.every(i=>!!S(e.source,i))}function te(e){const i=e.quoteIdentifier??re;return e.capabilities.prefixLevels.map(t=>S(e.source,t)).filter(t=>!!t).map(t=>i(t,e.capabilities.dialect)).join(".")}function S(e,i){return i==="database"?e.databaseName:i==="schema"?e.schemaName:e.tableName}function ae(e,i,t){i==="database"?e.databaseName=t:i==="schema"?e.schemaName=t:e.tableName=t}const ne=[['"','"'],["`","`"],["[","]"]];function se(e){const i=e.trim();for(const[t,a]of ne)if(i.length>=2&&i.startsWith(t)&&i.endsWith(a))return i.slice(1,-1).split(a+a).join(a);return i}function U(e){const i=e==null?void 0:e.trim();if(!i)return[];const t=i.split(".").map(se);return t.some(a=>!a)?[]:t}function oe(e){const i=U(e??void 0);return i[i.length-1]||""}function re(e,i){return i==="mysql"||i==="bigquery"||i==="clickhouse"||i==="duckdb"?`\`${e.replace(/`/g,"``")}\``:i==="mssql"?`[${e.replace(/]/g,"]]")}]`:`"${e.replace(/"/g,'""')}"`}function F(e){if(typeof e!="string")return"";const i=[];for(const t of e.trim().toLowerCase())ce(t)&&i.push(t);return i.join("")}function ce(e){const i=e.charCodeAt(0);return i>=48&&i<=57||i>=97&&i<=122}function R(e){return e.prefixLevels.length===1&&e.prefixLevels[0]==="table"?["table"]:Array.from(new Set(["database",...e.prefixLevels]))}function le(e){const i=e.source.connectionType?v(e.source.connectionType):void 0,t=e.source.dialect?T(e.source.dialect):void 0,a=e.source.dialect&&e.source.dialect!=="unknown"?v(e.source.dialect):void 0;if(!e.capabilities&&e.source.connectionType&&e.source.dialect&&e.source.dialect!=="unknown"&&(!i||t==="unknown"||i.dialect!==t))return{kind:"incompatible_capabilities"};const s=e.capabilities||i||a;if(!s)return{kind:"incompatible_capabilities"};const r=R(s),o={...r.includes("database")&&e.source.databaseName?{databaseName:e.source.databaseName}:{},...r.includes("schema")&&e.source.schemaName?{schemaName:e.source.schemaName}:{},...e.source.tableName?{tableName:e.source.tableName}:{}},n=r.filter(d=>d==="database"?!o.databaseName:d==="schema"?!o.schemaName:!o.tableName);return n.length>0?{kind:"missing_coordinates",missing:n}:{kind:"resolved",coordinates:o}}function f(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function w(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function $(e){const i=w(e);return!i||!f(i.name)||i.type==="model"?!1:i.type==="dataset"?i.datasetType==="physical":!0}function L(e){const i=w(e);if(!i)return{};const t=f(i.table)||f(i.name);return{...f(i.database)?{databaseName:f(i.database)}:{},...f(i.schema)?{schemaName:f(i.schema)}:{},...t?{tableName:t}:{}}}function J(e){if(me(e))return{kind:"malformed"};const i=e.entities.filter($),t=de(e),a=ue({entities:i,connectionType:e.connectionType,dialect:e.dialect,capabilities:e.capabilities});if(!a)return{kind:"incompatible_capabilities"};const{capabilities:s}=a,r=be({hints:e.qualifiedHints||[],coordinateHint:e.coordinateHint,capabilityAuthority:a});if(r.kind!=="valid")return{kind:r.kind};const o=r.coordinates,n=o?i.filter(c=>E({left:K(L(c),s),right:o,capabilities:s})):i;if(o&&n.length===0)return{kind:"not_found",basis:"qualified",coordinates:o,capabilityAuthority:a};if(o&&n.length===1){const c=n[0],u=D(a,c);return{kind:"resolved",basis:"qualified",entity:c,coordinates:ve(L(c),o,u),capabilityAuthority:u}}const d=X([...e.bareHints||[],...r.bareHints,o==null?void 0:o.tableName]);if(d.size>0){const c=n.filter(u=>{const b=pe(u);return Array.from(d).some(h=>b.has(h))});if(c.length===1){const u=c[0],b=D(a,u);return{kind:"resolved",basis:"bare",entity:u,coordinates:A(L(u),b),capabilityAuthority:b}}return c.length>1?{kind:"ambiguous",basis:"bare"}:{kind:"not_found",basis:"bare",capabilityAuthority:a}}if(o)return{kind:"ambiguous",basis:"qualified"};if(t)return{kind:"not_found",basis:t,capabilityAuthority:a};if(i.length===1){const c=i[0],u=D(a,c);return{kind:"resolved",basis:"unqualified",entity:c,coordinates:A(L(c),u),capabilityAuthority:u}}return{kind:"unqualified"}}function de(e){const i=(e.qualifiedHints||[]).map(f).filter(a=>!!a);return Object.values(e.coordinateHint||{}).some(a=>!!f(a))||i.some(a=>a.includes("."))?"qualified":[...i,...e.bareHints||[]].some(a=>!!f(a))?"bare":void 0}function q(e){return`${e.dialect}:${e.prefixLevels.join(".")}`}function x(e){return{dialect:e.dialect,prefixLevels:[...e.prefixLevels]}}function ue(e){var I;const i=f(e.connectionType),t=f(e.dialect),a=e.capabilities?x(e.capabilities):void 0,s=i?v(i):void 0,r=t?T(t):void 0,o=t&&t!=="unknown"?v(t):void 0;if(i&&!s||t&&t!=="unknown"&&r==="unknown"||a&&s&&q(a)!==q(s))return;const n=a||(s?x(s):o?x(o):void 0);if(n)return r&&r!=="unknown"&&n.dialect!==r?void 0:{capabilities:n,...i?{connectionType:i}:{},dialect:n.dialect,evidence:"explicit"};const d=e.entities.map(m=>{const k=w(m),g=f(k==null?void 0:k.connectionType),p=f(k==null?void 0:k.dialect),C=g?v(g):void 0,H=p?T(p):void 0,B=p&&p!=="unknown"?v(p):void 0;if(g&&!C||p&&p!=="unknown"&&H==="unknown"||p&&p!=="unknown"&&!C&&!B||C&&H&&H!=="unknown"&&C.dialect!==H)return;const V=C||B,P=V?x(V):fe(k);return P?{capabilities:P,connectionType:g,capabilityIdentity:g?j(g):void 0,inferred:!C&&!B,signature:q(P)}:void 0});if(d.some(m=>!m))return;const c=d.filter(m=>!!m);if(new Set(c.map(m=>m.signature)).size>1)return;const u=(I=c[0])==null?void 0:I.capabilities;if(!u||r&&r!=="unknown"&&u.dialect!==r)return;const b=new Set(c.map(m=>m.capabilityIdentity).filter(m=>!!m)),h=c.every(m=>m.connectionType&&m.capabilityIdentity);return{capabilities:u,...h&&b.size===1?{connectionType:c[0].connectionType}:{},dialect:u.dialect,evidence:c.every(m=>m.inferred)?"coordinates":"entity"}}function fe(e){const i=!!f(e==null?void 0:e.database),t=!!f(e==null?void 0:e.schema);if(!(i&&t)){if(t)return{dialect:"unknown",prefixLevels:["schema","table"]};if(i)return{dialect:"unknown",prefixLevels:["database","table"]}}}function D(e,i){var s;if(e.evidence!=="entity")return e;const t=f((s=w(i))==null?void 0:s.connectionType),a=t?v(t):void 0;return a&&q(a)===q(e.capabilities)?{...e,connectionType:t}:e}function me(e){return(e.qualifiedHints||[]).some(t=>{const a=f(t);return!!(a&&a.includes(".")&&!y(a))})?!0:Object.values(e.coordinateHint||{}).some(t=>{const a=f(t);return!!(a&&!y(a))})}function be(e){const{capabilities:i}=e.capabilityAuthority,t=[],a=[];for(const b of e.hints){const h=f(b);if(!h)continue;if(!h.includes(".")){a.push(h);continue}const I=y(h);if(!I)return{kind:"malformed"};t.push(I)}const s=he(e.coordinateHint);if(s.kind==="malformed")return s;const r=Array.from(new Set(t)).map(b=>Q({qualifiedName:b,capabilities:i}));if(!ye(r,i))return{kind:"conflicting"};const o=[...new Set(t)].sort((b,h)=>h.split(".").length-b.split(".").length)[0],n=o?Q({qualifiedName:o,capabilities:i}):void 0,d=K(s.coordinates,i),c=A(s.coordinates,e.capabilityAuthority),u=!!(d.tableName&&(d.databaseName||d.schemaName));return n&&u&&!E({left:n,right:d,capabilities:i})?{kind:"conflicting"}:{kind:"valid",coordinates:n?{...c,...n}:u?c:void 0,bareHints:[...a,...!u&&d.tableName?[d.tableName]:[]]}}function he(e){const i={};for(const[t,a]of Object.entries(e||{})){const s=f(a);if(!s)continue;const r=y(s);if(!r)return{kind:"malformed"};i[t]=r}return{kind:"valid",coordinates:i}}function K(e,i){return{...i.prefixLevels.includes("database")&&e.databaseName?{databaseName:e.databaseName}:{},...i.prefixLevels.includes("schema")&&e.schemaName?{schemaName:e.schemaName}:{},...e.tableName?{tableName:e.tableName}:{}}}function ye(e,i){return e.every((t,a)=>e.slice(a+1).every(s=>E({left:t,right:s,capabilities:i})))}function X(e){return new Set(e.map(f).map(y).filter(i=>!!i))}function pe(e){const i=w(e);return i?X([f(i.name),f(i.table),f(i.id)]):new Set}function ve(e,i,t){return A({...e,...i},t)}function A(e,i){const t=i.evidence==="coordinates"?i.capabilities.prefixLevels:R(i.capabilities);return{...t.includes("database")&&e.databaseName?{databaseName:e.databaseName}:{},...t.includes("schema")&&e.schemaName?{schemaName:e.schemaName}:{},...e.tableName?{tableName:e.tableName}:{}}}function l(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function N(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function ke(e){const i=N(e);return!!(i&&i.type==="dataset"&&l(i.name))}function M(e){const i=N(e);return!!(i&&i.type==="dataset"&&i.datasetType!=="physical"&&l(i.name))}function O(e){const i=new Set;for(const t of e){const a=l(t);if(!a)continue;const s=y(a);if(!s)continue;const r=s.toLowerCase();i.add(r);const o=r.split("."),n=o[o.length-1];n&&i.add(n)}return i}function W(e){var t;const i=l(e);return i?(t=y(i))==null?void 0:t.toLowerCase():void 0}function z(e,i){const t=N(i),a=l(t==null?void 0:t.domainId)||l(e.semanticDomainId),s=l(t==null?void 0:t.name);if(!a||!s)return;const r=(t==null?void 0:t.datasetType)==="physical"?void 0:Z.getSemaphorDatasetEntityId(t||{}),o=l(t==null?void 0:t.connectionId)||l(e.connectionId);return{kind:"semantic",domainId:a,datasetName:s,...r?{datasetId:r}:{},...o?{connectionId:o}:{}}}function Y(e,i={}){const t=l(e.fieldEntityType);if(t&&t!=="dataset")return{kind:"unqualified"};const a=e.entities.filter(o=>i.includePhysicalDatasets?ke(o):M(o)),s=l(e.entityId);if(s){const o=W(s),n=a.filter(d=>{const c=N(d);return!!(o&&W(c==null?void 0:c.id)===o)});if(n.length>1)return{kind:"ambiguous",basis:"bare"};if(n.length===1){const d=z(e,n[0]);return d?{kind:"resolved",basis:"bare",entity:n[0],source:d,matchedById:!0}:{kind:"not_found",basis:"bare"}}}const r=O([e.entityName,...e.qualifiedHints||[],...e.bareHints||[]]);if(r.size>0){const o=a.filter(n=>{const d=N(n);return[...O([d==null?void 0:d.id,d==null?void 0:d.name])].some(u=>r.has(u))});if(o.length>1)return{kind:"ambiguous",basis:"bare"};if(o.length===1){const n=z(e,o[0]);return n?{kind:"resolved",basis:"bare",entity:o[0],source:n,matchedById:!1}:{kind:"not_found",basis:"bare"}}return{kind:"not_found",basis:"bare"}}if(a.length===1){const o=z(e,a[0]);return o?{kind:"resolved",basis:"unqualified",entity:a[0],source:o,matchedById:!1}:{kind:"unqualified"}}return{kind:"unqualified"}}function _(e){const i=e.resolution.kind==="resolved"?N(e.resolution.entity):void 0,t=l(e.connectionId)||l(i==null?void 0:i.connectionId),{connectionType:a,dialect:s}=e.resolution.capabilityAuthority,r=v(s),o=!!(r&&r.dialect===e.resolution.capabilityAuthority.capabilities.dialect&&r.prefixLevels.join(".")===e.resolution.capabilityAuthority.capabilities.prefixLevels.join(".")),n=e.resolution.coordinates;if(!(!t||!(n!=null&&n.tableName)))return{kind:"physical",connectionId:t,...a?{connectionType:a}:{},...!a&&o?{dialect:s}:{},tableName:n.tableName,...n.databaseName?{databaseName:n.databaseName}:{},...n.schemaName?{schemaName:n.schemaName}:{}}}function ge(e){var s,r,o;if(l(e.connectionType)||l(e.dialect)||e.capabilities||l(e.semanticDomainId)||l(e.fieldEntityType)==="dataset"||l((s=e.fallbackCoordinateHint)==null?void 0:s.databaseName)||l((r=e.fallbackCoordinateHint)==null?void 0:r.schemaName))return;const i=[l((o=e.fallbackCoordinateHint)==null?void 0:o.tableName),...(e.qualifiedHints||[]).map(l),...(e.bareHints||[]).map(l),l(e.entityName),...l(e.fieldEntityType)==="table"?[l(e.entityId)]:[]].filter(n=>!!n);if(!i.length||i.some(n=>n.includes(".")))return;const t=i.map(y);return t.some(n=>!n)?void 0:new Set(t.map(n=>n.toLowerCase())).size===1?t[0]:void 0}function Ce(e){const i=e.entities.filter($),t=e.entities.filter(M),a=i.length>0||t.length>0,s=Y(e),r=e.qualifiedHints||[],o=r.some(c=>{var u;return(u=l(c))==null?void 0:u.includes(".")}),n=J({entities:i,connectionType:l(e.connectionType),dialect:e.dialect,capabilities:e.capabilities,qualifiedHints:r,bareHints:[e.entityName,e.entityId,...e.bareHints||[]],...!o&&e.fallbackCoordinateHint?{coordinateHint:e.fallbackCoordinateHint}:{}});if(n.kind==="malformed"||n.kind==="conflicting"||n.kind==="incompatible_capabilities"&&o||n.kind==="ambiguous"&&n.basis==="qualified")return n;if(n.kind==="resolved"&&n.basis==="qualified"){const c=_({resolution:n,connectionId:e.connectionId});return c?{kind:"resolved",basis:n.basis,source:c,entity:n.entity}:{kind:"missing_connection"}}if(n.kind==="not_found"&&n.basis==="qualified"&&n.coordinates){const c=_({resolution:n,connectionId:e.connectionId});return c?a?{kind:"candidate",basis:"qualified",source:c}:{kind:"resolved",basis:"qualified",source:c}:{kind:"missing_connection"}}if(s.kind==="resolved")return n.kind==="resolved"&&n.basis==="bare"&&!s.matchedById?{kind:"ambiguous",basis:"bare"}:{kind:"resolved",basis:s.basis,source:s.source,entity:s.entity};if(s.kind==="ambiguous")return s;if(n.kind==="resolved"){const c=_({resolution:n,connectionId:e.connectionId});return c?{kind:"resolved",basis:n.basis,source:c,entity:n.entity}:{kind:"missing_connection"}}const d=l(e.entityName)||l(e.entityId);if(!a&&!o&&l(e.semanticDomainId)&&(!l(e.fieldEntityType)||l(e.fieldEntityType)==="dataset")&&d)return{kind:"resolved",basis:"historical",source:{kind:"semantic",domainId:l(e.semanticDomainId),datasetName:d,...l(e.connectionId)?{connectionId:l(e.connectionId)}:{}}};if(n.kind==="incompatible_capabilities"){const c=a?void 0:ge(e),u=l(e.connectionId);return c&&u?{kind:"resolved",basis:"historical",source:{kind:"physical",connectionId:u,tableName:c}}:n}return n.kind==="ambiguous"?n:n.kind==="not_found"?{kind:"not_found",basis:n.basis}:{kind:"unqualified"}}exports.buildSemaphorQualifiedSourcePath=te;exports.canonicalizeSemaphorQualifiedSourcePath=y;exports.getSemaphorCatalogCoordinateLevels=R;exports.getSemaphorConnectionCapabilities=G;exports.isSemaphorPhysicalSourceEntity=$;exports.isSemaphorSemanticSourceEntity=M;exports.normalizeSemaphorDialect=T;exports.parseSemaphorQualifiedSourcePath=Q;exports.persistedIdentifierLeafName=oe;exports.resolveSemaphorConnectionCapabilities=v;exports.resolveSemaphorConnectionCapabilityIdentity=j;exports.resolveSemaphorPhysicalCatalogAddress=le;exports.resolveSemaphorPhysicalSourceEntity=J;exports.resolveSemaphorSemanticDatasetEntity=Y;exports.resolveSemaphorSourceEntity=Ce;exports.semaphorPhysicalSourceCoordinatesAreCompatible=E;exports.semaphorPhysicalSourceCoordinatesCover=ee;exports.semaphorSourceHasRequiredCoordinates=ie;
|