react-semaphor 0.1.558 → 0.1.560
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.js +368 -358
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +9 -9
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/analytics-base-schemas-CHLxsPfX.js +630 -0
- package/dist/chunks/{assistant-chat-BCWoP6Rf.js → assistant-chat-Bu2fFm_I.js} +206 -207
- package/dist/chunks/{bookmark-state-PjQpxbG7.js → bookmark-state-BFY9oNmr.js} +3 -3
- package/dist/chunks/{braces-D5Ucy7q1.js → braces-Da41xfUd.js} +1 -1
- package/dist/chunks/{comparison-window-caption-Dc7BaCMz.js → comparison-window-caption-4FNkMrzE.js} +213 -213
- package/dist/chunks/{context-DVy4HOU0.js → context-BgPDzLHZ.js} +1 -1
- package/dist/chunks/{custom-visual-inputs-B-DLRGrV.js → custom-visual-inputs-Dz-enUNR.js} +1 -1
- package/dist/chunks/{dashboard-wK6Bai4V.js → dashboard-_MeBuy67.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Coqghdn6.js → dashboard-briefing-launcher-CEi4Pr_v.js} +1152 -1166
- package/dist/chunks/{dashboard-controls-BYWSM2RM.js → dashboard-controls-Bi7fyG-4.js} +98 -98
- package/dist/chunks/{dashboard-json-pPTB5gj0.js → dashboard-json-B1mU_OMa.js} +5 -5
- package/dist/chunks/{document-dashboard-inputs-PY_7Xm55.js → document-dashboard-inputs-CkWfDB8c.js} +64 -64
- package/dist/chunks/{edit-dashboard-visual-BODxuUeq.js → edit-dashboard-visual-0CJN31Y3.js} +8274 -8514
- package/dist/chunks/filter-reach-copy-BF4w4kI2.js +3738 -0
- package/dist/chunks/{filter-value-text-CUBpotVN.js → filter-value-text-CRC-K_l_.js} +3 -3
- package/dist/chunks/{global-date-filter-utils-BsFqnnbA.js → global-date-filter-utils-D8365uPH.js} +4088 -3416
- package/dist/chunks/{index-DP_wQl0v.js → index-DtHidOPV.js} +579 -604
- package/dist/chunks/{layout-grid-CkoXmv0L.js → layout-grid-BvsH4RY2.js} +1 -1
- package/dist/chunks/{list-filter-B4i25kuc.js → list-filter-Dg0otx5E.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-4GTUDheD.js → matrix-analytical-definition-CM18W8w6.js} +41 -41
- package/dist/chunks/{matrix-card-fS_4O7zA.js → matrix-card-HPskLaPy.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-Dj7HaAHC.js → matrix-member-presentation-Bbrfrke4.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-CpgLZ7E5.js → matrix-operation-contract-WPv4R-H_.js} +130 -130
- package/dist/chunks/{metric-comparison-C8LY7GG5.js → metric-comparison-ljMKYZKa.js} +2 -2
- package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-Ccn1zaxl.js} +1 -1
- package/dist/chunks/{palette-stlpjVk4.js → palette-Bsh376zO.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-DMk-mKhG.js → pivot-result-contract-expectations-Bl5suy4-.js} +602 -696
- package/dist/chunks/{pivot-result-identity-CrQ54Xbj.js → pivot-result-identity-vS9TSh4f.js} +1 -1
- package/dist/chunks/{raw-temporal-presentation-BI2z2LlB.js → raw-temporal-presentation-BHm7s-hz.js} +230 -274
- package/dist/chunks/{report-preferences-dialog-Dc-YyVwf.js → report-preferences-dialog-BV8L0SeS.js} +55 -55
- package/dist/chunks/{report-runtime-context-CohdtiMg.js → report-runtime-context-BZQh9ywy.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-BZYI1hB0.js → resolve-dashboard-input-context-CAMiWvyR.js} +2021 -2239
- package/dist/chunks/{save-C1dgxgAu.js → save-B5EAsgQF.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CIBoMq46.js → saved-dashboard-context-n2Wn11cV.js} +57 -57
- package/dist/chunks/{selection-reducer-_d6aKJnj.js → selection-reducer-D0YnaAD9.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-ERTLU7B4.js → semaphor-ready-indicator-XLBLOJ2V.js} +38446 -39176
- package/dist/chunks/{shelf-drop-preview-context-fEnx6iL_.js → shelf-drop-preview-context-DHMa54a-.js} +570 -570
- package/dist/chunks/source-entity-resolution-dUG5VWRm.js +607 -0
- package/dist/chunks/{switch-BqUan2mN.js → switch-ByxH4M7t.js} +3 -3
- package/dist/chunks/{table-export-sheet-CTCTA_bd.js → table-export-sheet-C_GdeTYU.js} +1 -1
- package/dist/chunks/{table-settings-DF1gdVQR.js → table-settings-Imz0FgWi.js} +8 -8
- package/dist/chunks/{temporal-input-presentation-DoSniQj1.js → temporal-input-presentation-uvNK_tM0.js} +1109 -820
- package/dist/chunks/{token-types-DFyLflLY.js → token-types-CQtXUVMy.js} +1 -1
- package/dist/chunks/{upload-DcoyjkRV.js → upload-wbR-NVzq.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-xhb9YFg-.js → use-create-flow-overlay-state-CEBaLOKC.js} +6 -6
- package/dist/chunks/validators-CXTneCA4.js +3453 -0
- package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-B1n_WjW3.js} +1 -1
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +2207 -1496
- package/dist/data-app-sdk/index.js +20 -20
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +6 -6
- package/dist/format-utils/index.js +181 -176
- package/dist/index.js +22 -22
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/editor/editor-aside/utils.d.ts +1 -1
- package/dist/types/components/visual/data-table/types/data-table.d.ts +5 -20
- package/dist/types/index.js +6 -6
- package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
- package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
- package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
- package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
- package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
- package/dist/types/lib/stores/editor-store.d.ts +39 -9
- package/dist/types/lib/stores/table-actions.d.ts +9 -3
- package/dist/types/lib/table-formatting/index.d.ts +0 -2
- package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
- package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
- package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
- package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
- package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
- package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
- package/dist/types/lib/types/common-types.d.ts +40 -47
- package/dist/types/lib/types/explorer-types.d.ts +13 -44
- package/dist/types/lib/utils/card-config-utils.d.ts +9 -1
- package/dist/types/lib/utils/card-definition.d.ts +9 -187
- package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +159 -513
- package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
- package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
- package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
- package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
- package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
- package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
- package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
- package/dist/types/shared/analytics-protocol/source-capabilities.d.ts +21 -0
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
- package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
- package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +24 -24
- package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +4 -2
- package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
- package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
- package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +5 -1
- package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
- package/dist/types/shared/format-utils/index.d.ts +2 -0
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
- package/dist/types/shared/format-utils/raw-temporal.d.ts +15 -1
- package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
- package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
- package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
- package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
- package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
- package/package.json +1 -1
- package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
- package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
- package/dist/chunks/filter-reach-copy-BvJH9JO-.js +0 -3411
- package/dist/chunks/source-entity-resolution-DXW1HpKf.js +0 -816
- package/dist/chunks/validators-hmfNNQz8.js +0 -3595
- package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
- package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
|
@@ -1,816 +0,0 @@
|
|
|
1
|
-
import { al as K } from "./validators-hmfNNQz8.js";
|
|
2
|
-
function h(e) {
|
|
3
|
-
const i = V(e);
|
|
4
|
-
return i.length > 0 ? i.join(".") : void 0;
|
|
5
|
-
}
|
|
6
|
-
function Q(e) {
|
|
7
|
-
const i = h(
|
|
8
|
-
e.qualifiedName
|
|
9
|
-
), t = (i == null ? void 0 : i.split(".")) || [];
|
|
10
|
-
if (t.length === 0) return {};
|
|
11
|
-
const a = {};
|
|
12
|
-
let s = t.length - 1;
|
|
13
|
-
for (let r = e.capabilities.prefixLevels.length - 1; r >= 0 && s >= 0; r -= 1, s -= 1)
|
|
14
|
-
Z(
|
|
15
|
-
a,
|
|
16
|
-
e.capabilities.prefixLevels[r],
|
|
17
|
-
t[s]
|
|
18
|
-
);
|
|
19
|
-
return a;
|
|
20
|
-
}
|
|
21
|
-
function P(e) {
|
|
22
|
-
return !e.left.tableName || !e.right.tableName ? !1 : e.capabilities.prefixLevels.every((i) => {
|
|
23
|
-
const t = C(e.left, i), a = C(e.right, i);
|
|
24
|
-
return !t || !a || t === a;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function X(e) {
|
|
28
|
-
return e.capabilities.prefixLevels.every((i) => {
|
|
29
|
-
const t = C(e.requested, i);
|
|
30
|
-
return t ? C(e.allowed, i) === t : !0;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function Y(e, i = {}) {
|
|
34
|
-
const t = j(e), a = {
|
|
35
|
-
connectionId: i.connectionId,
|
|
36
|
-
connectionType: e,
|
|
37
|
-
path: ["database", "schema", "table"],
|
|
38
|
-
labels: {
|
|
39
|
-
database: "Database",
|
|
40
|
-
schema: "Schema",
|
|
41
|
-
table: "Table"
|
|
42
|
-
},
|
|
43
|
-
prefixLevels: ["database", "schema", "table"],
|
|
44
|
-
dialect: "postgres",
|
|
45
|
-
supportsFilterClause: !0
|
|
46
|
-
};
|
|
47
|
-
return t.includes("postgres") ? {
|
|
48
|
-
...a,
|
|
49
|
-
prefixLevels: ["schema", "table"],
|
|
50
|
-
dialect: "postgres"
|
|
51
|
-
} : t.includes("mysql") ? {
|
|
52
|
-
...a,
|
|
53
|
-
prefixLevels: ["database", "table"],
|
|
54
|
-
dialect: "mysql",
|
|
55
|
-
supportsFilterClause: !1
|
|
56
|
-
} : t.includes("mssql") || t.includes("sqlserver") ? {
|
|
57
|
-
...a,
|
|
58
|
-
dialect: "mssql",
|
|
59
|
-
supportsFilterClause: !1
|
|
60
|
-
} : t.includes("redshift") ? {
|
|
61
|
-
...a,
|
|
62
|
-
prefixLevels: ["schema", "table"],
|
|
63
|
-
dialect: "redshift"
|
|
64
|
-
} : t.includes("snowflake") ? {
|
|
65
|
-
...a,
|
|
66
|
-
dialect: "snowflake"
|
|
67
|
-
} : t.includes("clickhouse") ? {
|
|
68
|
-
connectionId: i.connectionId,
|
|
69
|
-
connectionType: e,
|
|
70
|
-
path: ["database", "table"],
|
|
71
|
-
labels: {
|
|
72
|
-
database: "Database",
|
|
73
|
-
table: "Table"
|
|
74
|
-
},
|
|
75
|
-
prefixLevels: ["database", "table"],
|
|
76
|
-
dialect: "clickhouse",
|
|
77
|
-
supportsFilterClause: !1
|
|
78
|
-
} : t === "s3" || t === "api" ? {
|
|
79
|
-
connectionId: i.connectionId,
|
|
80
|
-
connectionType: e,
|
|
81
|
-
path: ["table"],
|
|
82
|
-
labels: {
|
|
83
|
-
table: t === "api" ? "API Table" : "File Table"
|
|
84
|
-
},
|
|
85
|
-
prefixLevels: ["table"],
|
|
86
|
-
dialect: "duckdb",
|
|
87
|
-
supportsFilterClause: !0
|
|
88
|
-
} : t === "googlesheets" || t === "fileupload" ? {
|
|
89
|
-
connectionId: i.connectionId,
|
|
90
|
-
connectionType: e,
|
|
91
|
-
path: ["table"],
|
|
92
|
-
labels: {
|
|
93
|
-
table: "Table"
|
|
94
|
-
},
|
|
95
|
-
prefixLevels: ["table"],
|
|
96
|
-
dialect: "postgres",
|
|
97
|
-
supportsFilterClause: !0
|
|
98
|
-
} : t === "bigquery" ? {
|
|
99
|
-
...a,
|
|
100
|
-
labels: {
|
|
101
|
-
database: "Project",
|
|
102
|
-
schema: "Dataset",
|
|
103
|
-
table: "Table"
|
|
104
|
-
},
|
|
105
|
-
prefixLevels: ["schema", "table"],
|
|
106
|
-
dialect: "bigquery",
|
|
107
|
-
supportsFilterClause: !1
|
|
108
|
-
} : a;
|
|
109
|
-
}
|
|
110
|
-
function v(e, i = {}) {
|
|
111
|
-
return M(
|
|
112
|
-
e
|
|
113
|
-
) ? Y(e, i) : void 0;
|
|
114
|
-
}
|
|
115
|
-
function M(e) {
|
|
116
|
-
const i = j(e);
|
|
117
|
-
if (i.includes("postgres")) return "postgres";
|
|
118
|
-
if (i.includes("mysql")) return "mysql";
|
|
119
|
-
if (i.includes("mssql") || i.includes("sqlserver"))
|
|
120
|
-
return "mssql";
|
|
121
|
-
if (i.includes("redshift")) return "redshift";
|
|
122
|
-
if (i.includes("snowflake")) return "snowflake";
|
|
123
|
-
if (i.includes("clickhouse")) return "clickhouse";
|
|
124
|
-
if (i === "s3" || i === "api" || i === "googlesheets" || i === "fileupload" || i === "bigquery")
|
|
125
|
-
return i;
|
|
126
|
-
}
|
|
127
|
-
function z(e) {
|
|
128
|
-
const i = j(e);
|
|
129
|
-
switch (i) {
|
|
130
|
-
case "mysql":
|
|
131
|
-
case "bigquery":
|
|
132
|
-
case "redshift":
|
|
133
|
-
case "snowflake":
|
|
134
|
-
case "clickhouse":
|
|
135
|
-
case "duckdb":
|
|
136
|
-
case "sqlite":
|
|
137
|
-
return i;
|
|
138
|
-
case "mssql":
|
|
139
|
-
case "sqlserver":
|
|
140
|
-
return "mssql";
|
|
141
|
-
case "postgres":
|
|
142
|
-
case "postgresql":
|
|
143
|
-
return "postgres";
|
|
144
|
-
default:
|
|
145
|
-
return "unknown";
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function ke(e) {
|
|
149
|
-
return e.capabilities.prefixLevels.every(
|
|
150
|
-
(i) => !!C(e.source, i)
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
function ge(e) {
|
|
154
|
-
const i = e.quoteIdentifier ?? te;
|
|
155
|
-
return e.capabilities.prefixLevels.map((t) => C(e.source, t)).filter((t) => !!t).map((t) => i(t, e.capabilities.dialect)).join(".");
|
|
156
|
-
}
|
|
157
|
-
function C(e, i) {
|
|
158
|
-
return i === "database" ? e.databaseName : i === "schema" ? e.schemaName : e.tableName;
|
|
159
|
-
}
|
|
160
|
-
function Z(e, i, t) {
|
|
161
|
-
i === "database" ? e.databaseName = t : i === "schema" ? e.schemaName = t : e.tableName = t;
|
|
162
|
-
}
|
|
163
|
-
const ee = [
|
|
164
|
-
['"', '"'],
|
|
165
|
-
["`", "`"],
|
|
166
|
-
["[", "]"]
|
|
167
|
-
];
|
|
168
|
-
function ie(e) {
|
|
169
|
-
const i = e.trim();
|
|
170
|
-
for (const [t, a] of ee)
|
|
171
|
-
if (i.length >= 2 && i.startsWith(t) && i.endsWith(a))
|
|
172
|
-
return i.slice(1, -1).split(a + a).join(a);
|
|
173
|
-
return i;
|
|
174
|
-
}
|
|
175
|
-
function V(e) {
|
|
176
|
-
const i = e == null ? void 0 : e.trim();
|
|
177
|
-
if (!i) return [];
|
|
178
|
-
const t = i.split(".").map(ie);
|
|
179
|
-
return t.some((a) => !a) ? [] : t;
|
|
180
|
-
}
|
|
181
|
-
function Ne(e) {
|
|
182
|
-
const i = V(e ?? void 0);
|
|
183
|
-
return i[i.length - 1] || "";
|
|
184
|
-
}
|
|
185
|
-
function te(e, i) {
|
|
186
|
-
return i === "mysql" || i === "bigquery" || i === "clickhouse" || i === "duckdb" ? `\`${e.replace(/`/g, "``")}\`` : i === "mssql" ? `[${e.replace(/]/g, "]]")}]` : `"${e.replace(/"/g, '""')}"`;
|
|
187
|
-
}
|
|
188
|
-
function j(e) {
|
|
189
|
-
if (typeof e != "string")
|
|
190
|
-
return "";
|
|
191
|
-
const i = [];
|
|
192
|
-
for (const t of e.trim().toLowerCase())
|
|
193
|
-
ae(t) && i.push(t);
|
|
194
|
-
return i.join("");
|
|
195
|
-
}
|
|
196
|
-
function ae(e) {
|
|
197
|
-
const i = e.charCodeAt(0);
|
|
198
|
-
return i >= 48 && i <= 57 || i >= 97 && i <= 122;
|
|
199
|
-
}
|
|
200
|
-
function O(e) {
|
|
201
|
-
return e.prefixLevels.length === 1 && e.prefixLevels[0] === "table" ? ["table"] : Array.from(
|
|
202
|
-
/* @__PURE__ */ new Set([
|
|
203
|
-
"database",
|
|
204
|
-
...e.prefixLevels
|
|
205
|
-
])
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
function Ie(e) {
|
|
209
|
-
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;
|
|
210
|
-
if (!e.capabilities && e.source.connectionType && e.source.dialect && e.source.dialect !== "unknown" && (!i || t === "unknown" || i.dialect !== t))
|
|
211
|
-
return { kind: "incompatible_capabilities" };
|
|
212
|
-
const s = e.capabilities || i || a;
|
|
213
|
-
if (!s) return { kind: "incompatible_capabilities" };
|
|
214
|
-
const r = O(s), o = {
|
|
215
|
-
...r.includes("database") && e.source.databaseName ? { databaseName: e.source.databaseName } : {},
|
|
216
|
-
...r.includes("schema") && e.source.schemaName ? { schemaName: e.source.schemaName } : {},
|
|
217
|
-
...e.source.tableName ? { tableName: e.source.tableName } : {}
|
|
218
|
-
}, n = r.filter((d) => d === "database" ? !o.databaseName : d === "schema" ? !o.schemaName : !o.tableName);
|
|
219
|
-
return n.length > 0 ? { kind: "missing_coordinates", missing: n } : {
|
|
220
|
-
kind: "resolved",
|
|
221
|
-
coordinates: o
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
function f(e) {
|
|
225
|
-
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
226
|
-
}
|
|
227
|
-
function w(e) {
|
|
228
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
229
|
-
}
|
|
230
|
-
function W(e) {
|
|
231
|
-
const i = w(e);
|
|
232
|
-
return !i || !f(i.name) || i.type === "model" ? !1 : i.type === "dataset" ? i.datasetType === "physical" : !0;
|
|
233
|
-
}
|
|
234
|
-
function x(e) {
|
|
235
|
-
const i = w(e);
|
|
236
|
-
if (!i) return {};
|
|
237
|
-
const t = f(i.table) || f(i.name);
|
|
238
|
-
return {
|
|
239
|
-
...f(i.database) ? { databaseName: f(i.database) } : {},
|
|
240
|
-
...f(i.schema) ? { schemaName: f(i.schema) } : {},
|
|
241
|
-
...t ? { tableName: t } : {}
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
function ne(e) {
|
|
245
|
-
if (ce(e)) return { kind: "malformed" };
|
|
246
|
-
const i = e.entities.filter(W), t = se(e), a = oe({
|
|
247
|
-
entities: i,
|
|
248
|
-
connectionType: e.connectionType,
|
|
249
|
-
dialect: e.dialect,
|
|
250
|
-
capabilities: e.capabilities
|
|
251
|
-
});
|
|
252
|
-
if (!a) return { kind: "incompatible_capabilities" };
|
|
253
|
-
const { capabilities: s } = a, r = le({
|
|
254
|
-
hints: e.qualifiedHints || [],
|
|
255
|
-
coordinateHint: e.coordinateHint,
|
|
256
|
-
capabilityAuthority: a
|
|
257
|
-
});
|
|
258
|
-
if (r.kind !== "valid")
|
|
259
|
-
return { kind: r.kind };
|
|
260
|
-
const o = r.coordinates, n = o ? i.filter(
|
|
261
|
-
(c) => P({
|
|
262
|
-
left: G(
|
|
263
|
-
x(c),
|
|
264
|
-
s
|
|
265
|
-
),
|
|
266
|
-
right: o,
|
|
267
|
-
capabilities: s
|
|
268
|
-
})
|
|
269
|
-
) : i;
|
|
270
|
-
if (o && n.length === 0)
|
|
271
|
-
return {
|
|
272
|
-
kind: "not_found",
|
|
273
|
-
basis: "qualified",
|
|
274
|
-
coordinates: o,
|
|
275
|
-
capabilityAuthority: a
|
|
276
|
-
};
|
|
277
|
-
if (o && n.length === 1) {
|
|
278
|
-
const c = n[0], u = E(
|
|
279
|
-
a,
|
|
280
|
-
c
|
|
281
|
-
);
|
|
282
|
-
return {
|
|
283
|
-
kind: "resolved",
|
|
284
|
-
basis: "qualified",
|
|
285
|
-
entity: c,
|
|
286
|
-
coordinates: me(
|
|
287
|
-
x(c),
|
|
288
|
-
o,
|
|
289
|
-
u
|
|
290
|
-
),
|
|
291
|
-
capabilityAuthority: u
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
const d = U([
|
|
295
|
-
...e.bareHints || [],
|
|
296
|
-
...r.bareHints,
|
|
297
|
-
o == null ? void 0 : o.tableName
|
|
298
|
-
]);
|
|
299
|
-
if (d.size > 0) {
|
|
300
|
-
const c = n.filter((u) => {
|
|
301
|
-
const b = fe(u);
|
|
302
|
-
return Array.from(d).some((y) => b.has(y));
|
|
303
|
-
});
|
|
304
|
-
if (c.length === 1) {
|
|
305
|
-
const u = c[0], b = E(
|
|
306
|
-
a,
|
|
307
|
-
u
|
|
308
|
-
);
|
|
309
|
-
return {
|
|
310
|
-
kind: "resolved",
|
|
311
|
-
basis: "bare",
|
|
312
|
-
entity: u,
|
|
313
|
-
coordinates: T(
|
|
314
|
-
x(u),
|
|
315
|
-
b
|
|
316
|
-
),
|
|
317
|
-
capabilityAuthority: b
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
return c.length > 1 ? { kind: "ambiguous", basis: "bare" } : { kind: "not_found", basis: "bare", capabilityAuthority: a };
|
|
321
|
-
}
|
|
322
|
-
if (o)
|
|
323
|
-
return { kind: "ambiguous", basis: "qualified" };
|
|
324
|
-
if (t)
|
|
325
|
-
return {
|
|
326
|
-
kind: "not_found",
|
|
327
|
-
basis: t,
|
|
328
|
-
capabilityAuthority: a
|
|
329
|
-
};
|
|
330
|
-
if (i.length === 1) {
|
|
331
|
-
const c = i[0], u = E(
|
|
332
|
-
a,
|
|
333
|
-
c
|
|
334
|
-
);
|
|
335
|
-
return {
|
|
336
|
-
kind: "resolved",
|
|
337
|
-
basis: "unqualified",
|
|
338
|
-
entity: c,
|
|
339
|
-
coordinates: T(
|
|
340
|
-
x(c),
|
|
341
|
-
u
|
|
342
|
-
),
|
|
343
|
-
capabilityAuthority: u
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
return { kind: "unqualified" };
|
|
347
|
-
}
|
|
348
|
-
function se(e) {
|
|
349
|
-
const i = (e.qualifiedHints || []).map(f).filter((a) => !!a);
|
|
350
|
-
return Object.values(e.coordinateHint || {}).some(
|
|
351
|
-
(a) => !!f(a)
|
|
352
|
-
) || i.some((a) => a.includes(".")) ? "qualified" : [...i, ...e.bareHints || []].some(
|
|
353
|
-
(a) => !!f(a)
|
|
354
|
-
) ? "bare" : void 0;
|
|
355
|
-
}
|
|
356
|
-
function S(e) {
|
|
357
|
-
return `${e.dialect}:${e.prefixLevels.join(".")}`;
|
|
358
|
-
}
|
|
359
|
-
function L(e) {
|
|
360
|
-
return {
|
|
361
|
-
dialect: e.dialect,
|
|
362
|
-
prefixLevels: [...e.prefixLevels]
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
function oe(e) {
|
|
366
|
-
var q;
|
|
367
|
-
const i = f(e.connectionType), t = f(e.dialect), a = e.capabilities ? L(e.capabilities) : void 0, s = i ? v(i) : void 0, r = t ? z(t) : void 0, o = t && t !== "unknown" ? v(t) : void 0;
|
|
368
|
-
if (i && !s || t && t !== "unknown" && r === "unknown" || a && s && S(a) !== S(s))
|
|
369
|
-
return;
|
|
370
|
-
const n = a || (s ? L(s) : o ? L(o) : void 0);
|
|
371
|
-
if (n)
|
|
372
|
-
return r && r !== "unknown" && n.dialect !== r ? void 0 : {
|
|
373
|
-
capabilities: n,
|
|
374
|
-
...i ? { connectionType: i } : {},
|
|
375
|
-
dialect: n.dialect,
|
|
376
|
-
evidence: "explicit"
|
|
377
|
-
};
|
|
378
|
-
const d = e.entities.map((m) => {
|
|
379
|
-
const k = w(m), N = f(k == null ? void 0 : k.connectionType), p = f(k == null ? void 0 : k.dialect), I = N ? v(N) : void 0, H = p ? z(p) : void 0, A = p && p !== "unknown" ? v(p) : void 0;
|
|
380
|
-
if (N && !I || p && p !== "unknown" && H === "unknown" || p && p !== "unknown" && !I && !A || I && H && H !== "unknown" && I.dialect !== H)
|
|
381
|
-
return;
|
|
382
|
-
const F = I || A, B = F ? L(F) : re(k);
|
|
383
|
-
return B ? {
|
|
384
|
-
capabilities: B,
|
|
385
|
-
connectionType: N,
|
|
386
|
-
capabilityIdentity: N ? M(N) : void 0,
|
|
387
|
-
inferred: !I && !A,
|
|
388
|
-
signature: S(B)
|
|
389
|
-
} : void 0;
|
|
390
|
-
});
|
|
391
|
-
if (d.some((m) => !m)) return;
|
|
392
|
-
const c = d.filter(
|
|
393
|
-
(m) => !!m
|
|
394
|
-
);
|
|
395
|
-
if (new Set(c.map((m) => m.signature)).size > 1)
|
|
396
|
-
return;
|
|
397
|
-
const u = (q = c[0]) == null ? void 0 : q.capabilities;
|
|
398
|
-
if (!u || r && r !== "unknown" && u.dialect !== r)
|
|
399
|
-
return;
|
|
400
|
-
const b = new Set(
|
|
401
|
-
c.map((m) => m.capabilityIdentity).filter((m) => !!m)
|
|
402
|
-
), y = c.every(
|
|
403
|
-
(m) => m.connectionType && m.capabilityIdentity
|
|
404
|
-
);
|
|
405
|
-
return {
|
|
406
|
-
capabilities: u,
|
|
407
|
-
...y && b.size === 1 ? { connectionType: c[0].connectionType } : {},
|
|
408
|
-
dialect: u.dialect,
|
|
409
|
-
evidence: c.every((m) => m.inferred) ? "coordinates" : "entity"
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
function re(e) {
|
|
413
|
-
const i = !!f(e == null ? void 0 : e.database), t = !!f(e == null ? void 0 : e.schema);
|
|
414
|
-
if (!(i && t)) {
|
|
415
|
-
if (t)
|
|
416
|
-
return { dialect: "unknown", prefixLevels: ["schema", "table"] };
|
|
417
|
-
if (i)
|
|
418
|
-
return { dialect: "unknown", prefixLevels: ["database", "table"] };
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
function E(e, i) {
|
|
422
|
-
var s;
|
|
423
|
-
if (e.evidence !== "entity") return e;
|
|
424
|
-
const t = f((s = w(i)) == null ? void 0 : s.connectionType), a = t ? v(t) : void 0;
|
|
425
|
-
return a && S(a) === S(e.capabilities) ? { ...e, connectionType: t } : e;
|
|
426
|
-
}
|
|
427
|
-
function ce(e) {
|
|
428
|
-
return (e.qualifiedHints || []).some(
|
|
429
|
-
(t) => {
|
|
430
|
-
const a = f(t);
|
|
431
|
-
return !!(a && a.includes(".") && !h(a));
|
|
432
|
-
}
|
|
433
|
-
) ? !0 : Object.values(e.coordinateHint || {}).some((t) => {
|
|
434
|
-
const a = f(t);
|
|
435
|
-
return !!(a && !h(a));
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
function le(e) {
|
|
439
|
-
const { capabilities: i } = e.capabilityAuthority, t = [], a = [];
|
|
440
|
-
for (const b of e.hints) {
|
|
441
|
-
const y = f(b);
|
|
442
|
-
if (!y) continue;
|
|
443
|
-
if (!y.includes(".")) {
|
|
444
|
-
a.push(y);
|
|
445
|
-
continue;
|
|
446
|
-
}
|
|
447
|
-
const q = h(y);
|
|
448
|
-
if (!q) return { kind: "malformed" };
|
|
449
|
-
t.push(q);
|
|
450
|
-
}
|
|
451
|
-
const s = de(e.coordinateHint);
|
|
452
|
-
if (s.kind === "malformed") return s;
|
|
453
|
-
const r = Array.from(new Set(t)).map(
|
|
454
|
-
(b) => Q({
|
|
455
|
-
qualifiedName: b,
|
|
456
|
-
capabilities: i
|
|
457
|
-
})
|
|
458
|
-
);
|
|
459
|
-
if (!ue(r, i))
|
|
460
|
-
return { kind: "conflicting" };
|
|
461
|
-
const o = [...new Set(t)].sort(
|
|
462
|
-
(b, y) => y.split(".").length - b.split(".").length
|
|
463
|
-
)[0], n = o ? Q({
|
|
464
|
-
qualifiedName: o,
|
|
465
|
-
capabilities: i
|
|
466
|
-
}) : void 0, d = G(
|
|
467
|
-
s.coordinates,
|
|
468
|
-
i
|
|
469
|
-
), c = T(
|
|
470
|
-
s.coordinates,
|
|
471
|
-
e.capabilityAuthority
|
|
472
|
-
), u = !!(d.tableName && (d.databaseName || d.schemaName));
|
|
473
|
-
return n && u && !P({
|
|
474
|
-
left: n,
|
|
475
|
-
right: d,
|
|
476
|
-
capabilities: i
|
|
477
|
-
}) ? { kind: "conflicting" } : {
|
|
478
|
-
kind: "valid",
|
|
479
|
-
coordinates: n ? {
|
|
480
|
-
...c,
|
|
481
|
-
...n
|
|
482
|
-
} : u ? c : void 0,
|
|
483
|
-
bareHints: [
|
|
484
|
-
...a,
|
|
485
|
-
...!u && d.tableName ? [d.tableName] : []
|
|
486
|
-
]
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
function de(e) {
|
|
490
|
-
const i = {};
|
|
491
|
-
for (const [t, a] of Object.entries(e || {})) {
|
|
492
|
-
const s = f(a);
|
|
493
|
-
if (!s) continue;
|
|
494
|
-
const r = h(s);
|
|
495
|
-
if (!r) return { kind: "malformed" };
|
|
496
|
-
i[t] = r;
|
|
497
|
-
}
|
|
498
|
-
return { kind: "valid", coordinates: i };
|
|
499
|
-
}
|
|
500
|
-
function G(e, i) {
|
|
501
|
-
return {
|
|
502
|
-
...i.prefixLevels.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
503
|
-
...i.prefixLevels.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
504
|
-
...e.tableName ? { tableName: e.tableName } : {}
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
function ue(e, i) {
|
|
508
|
-
return e.every(
|
|
509
|
-
(t, a) => e.slice(a + 1).every(
|
|
510
|
-
(s) => P({
|
|
511
|
-
left: t,
|
|
512
|
-
right: s,
|
|
513
|
-
capabilities: i
|
|
514
|
-
})
|
|
515
|
-
)
|
|
516
|
-
);
|
|
517
|
-
}
|
|
518
|
-
function U(e) {
|
|
519
|
-
return new Set(
|
|
520
|
-
e.map(f).map(h).filter((i) => !!i)
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
function fe(e) {
|
|
524
|
-
const i = w(e);
|
|
525
|
-
return i ? U([
|
|
526
|
-
f(i.name),
|
|
527
|
-
f(i.table),
|
|
528
|
-
f(i.id)
|
|
529
|
-
]) : /* @__PURE__ */ new Set();
|
|
530
|
-
}
|
|
531
|
-
function me(e, i, t) {
|
|
532
|
-
return T(
|
|
533
|
-
{
|
|
534
|
-
...e,
|
|
535
|
-
...i
|
|
536
|
-
},
|
|
537
|
-
t
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
function T(e, i) {
|
|
541
|
-
const t = i.evidence === "coordinates" ? i.capabilities.prefixLevels : O(i.capabilities);
|
|
542
|
-
return {
|
|
543
|
-
...t.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
544
|
-
...t.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
545
|
-
...e.tableName ? { tableName: e.tableName } : {}
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
function l(e) {
|
|
549
|
-
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
550
|
-
}
|
|
551
|
-
function g(e) {
|
|
552
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
553
|
-
}
|
|
554
|
-
function be(e) {
|
|
555
|
-
const i = g(e);
|
|
556
|
-
return !!(i && i.type === "dataset" && l(i.name));
|
|
557
|
-
}
|
|
558
|
-
function J(e) {
|
|
559
|
-
const i = g(e);
|
|
560
|
-
return !!(i && i.type === "dataset" && i.datasetType !== "physical" && l(i.name));
|
|
561
|
-
}
|
|
562
|
-
function R(e) {
|
|
563
|
-
const i = /* @__PURE__ */ new Set();
|
|
564
|
-
for (const t of e) {
|
|
565
|
-
const a = l(t);
|
|
566
|
-
if (!a) continue;
|
|
567
|
-
const s = h(a);
|
|
568
|
-
if (!s) continue;
|
|
569
|
-
const r = s.toLowerCase();
|
|
570
|
-
i.add(r);
|
|
571
|
-
const o = r.split("."), n = o[o.length - 1];
|
|
572
|
-
n && i.add(n);
|
|
573
|
-
}
|
|
574
|
-
return i;
|
|
575
|
-
}
|
|
576
|
-
function $(e) {
|
|
577
|
-
var t;
|
|
578
|
-
const i = l(e);
|
|
579
|
-
return i ? (t = h(i)) == null ? void 0 : t.toLowerCase() : void 0;
|
|
580
|
-
}
|
|
581
|
-
function D(e, i) {
|
|
582
|
-
const t = g(i), a = l(t == null ? void 0 : t.domainId) || l(e.semanticDomainId), s = l(t == null ? void 0 : t.name);
|
|
583
|
-
if (!a || !s) return;
|
|
584
|
-
const r = (t == null ? void 0 : t.datasetType) === "physical" ? void 0 : K(t || {}), o = l(t == null ? void 0 : t.connectionId) || l(e.connectionId);
|
|
585
|
-
return {
|
|
586
|
-
kind: "semantic",
|
|
587
|
-
domainId: a,
|
|
588
|
-
datasetName: s,
|
|
589
|
-
...r ? { datasetId: r } : {},
|
|
590
|
-
...o ? { connectionId: o } : {}
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
function he(e, i = {}) {
|
|
594
|
-
const t = l(e.fieldEntityType);
|
|
595
|
-
if (t && t !== "dataset")
|
|
596
|
-
return { kind: "unqualified" };
|
|
597
|
-
const a = e.entities.filter(
|
|
598
|
-
(o) => i.includePhysicalDatasets ? be(o) : J(o)
|
|
599
|
-
), s = l(e.entityId);
|
|
600
|
-
if (s) {
|
|
601
|
-
const o = $(s), n = a.filter((d) => {
|
|
602
|
-
const c = g(d);
|
|
603
|
-
return !!(o && $(c == null ? void 0 : c.id) === o);
|
|
604
|
-
});
|
|
605
|
-
if (n.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
606
|
-
if (n.length === 1) {
|
|
607
|
-
const d = D(e, n[0]);
|
|
608
|
-
return d ? {
|
|
609
|
-
kind: "resolved",
|
|
610
|
-
basis: "bare",
|
|
611
|
-
entity: n[0],
|
|
612
|
-
source: d,
|
|
613
|
-
matchedById: !0
|
|
614
|
-
} : { kind: "not_found", basis: "bare" };
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
const r = R([
|
|
618
|
-
e.entityName,
|
|
619
|
-
...e.qualifiedHints || [],
|
|
620
|
-
...e.bareHints || []
|
|
621
|
-
]);
|
|
622
|
-
if (r.size > 0) {
|
|
623
|
-
const o = a.filter((n) => {
|
|
624
|
-
const d = g(n);
|
|
625
|
-
return [...R([d == null ? void 0 : d.id, d == null ? void 0 : d.name])].some((u) => r.has(u));
|
|
626
|
-
});
|
|
627
|
-
if (o.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
628
|
-
if (o.length === 1) {
|
|
629
|
-
const n = D(e, o[0]);
|
|
630
|
-
return n ? {
|
|
631
|
-
kind: "resolved",
|
|
632
|
-
basis: "bare",
|
|
633
|
-
entity: o[0],
|
|
634
|
-
source: n,
|
|
635
|
-
matchedById: !1
|
|
636
|
-
} : { kind: "not_found", basis: "bare" };
|
|
637
|
-
}
|
|
638
|
-
return { kind: "not_found", basis: "bare" };
|
|
639
|
-
}
|
|
640
|
-
if (a.length === 1) {
|
|
641
|
-
const o = D(e, a[0]);
|
|
642
|
-
return o ? {
|
|
643
|
-
kind: "resolved",
|
|
644
|
-
basis: "unqualified",
|
|
645
|
-
entity: a[0],
|
|
646
|
-
source: o,
|
|
647
|
-
matchedById: !1
|
|
648
|
-
} : { kind: "unqualified" };
|
|
649
|
-
}
|
|
650
|
-
return { kind: "unqualified" };
|
|
651
|
-
}
|
|
652
|
-
function _(e) {
|
|
653
|
-
const i = e.resolution.kind === "resolved" ? g(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(
|
|
654
|
-
"."
|
|
655
|
-
)), n = e.resolution.coordinates;
|
|
656
|
-
if (!(!t || !(n != null && n.tableName)))
|
|
657
|
-
return {
|
|
658
|
-
kind: "physical",
|
|
659
|
-
connectionId: t,
|
|
660
|
-
...a ? { connectionType: a } : {},
|
|
661
|
-
...!a && o ? { dialect: s } : {},
|
|
662
|
-
tableName: n.tableName,
|
|
663
|
-
...n.databaseName ? { databaseName: n.databaseName } : {},
|
|
664
|
-
...n.schemaName ? { schemaName: n.schemaName } : {}
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
function ye(e) {
|
|
668
|
-
const i = g(e.entity), t = h(l(i == null ? void 0 : i.table));
|
|
669
|
-
if (!t) return !1;
|
|
670
|
-
const a = h(
|
|
671
|
-
l(i == null ? void 0 : i.database)
|
|
672
|
-
), s = h(
|
|
673
|
-
l(i == null ? void 0 : i.schema)
|
|
674
|
-
);
|
|
675
|
-
return e.coordinates.tableName ? X({
|
|
676
|
-
requested: e.coordinates,
|
|
677
|
-
allowed: {
|
|
678
|
-
...a ? { databaseName: a } : {},
|
|
679
|
-
...s ? { schemaName: s } : {},
|
|
680
|
-
tableName: t
|
|
681
|
-
},
|
|
682
|
-
capabilities: e.capabilityAuthority.capabilities
|
|
683
|
-
}) : !1;
|
|
684
|
-
}
|
|
685
|
-
function pe(e) {
|
|
686
|
-
var s, r, o;
|
|
687
|
-
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))
|
|
688
|
-
return;
|
|
689
|
-
const i = [
|
|
690
|
-
l((o = e.fallbackCoordinateHint) == null ? void 0 : o.tableName),
|
|
691
|
-
...(e.qualifiedHints || []).map(l),
|
|
692
|
-
...(e.bareHints || []).map(l),
|
|
693
|
-
l(e.entityName),
|
|
694
|
-
...l(e.fieldEntityType) === "table" ? [l(e.entityId)] : []
|
|
695
|
-
].filter((n) => !!n);
|
|
696
|
-
if (!i.length || i.some((n) => n.includes(".")))
|
|
697
|
-
return;
|
|
698
|
-
const t = i.map(h);
|
|
699
|
-
return t.some((n) => !n) ? void 0 : new Set(t.map((n) => n.toLowerCase())).size === 1 ? t[0] : void 0;
|
|
700
|
-
}
|
|
701
|
-
function Ce(e) {
|
|
702
|
-
const i = e.entities.filter(
|
|
703
|
-
W
|
|
704
|
-
), t = e.entities.filter(
|
|
705
|
-
J
|
|
706
|
-
), a = i.length > 0 || t.length > 0, s = he(e), r = e.qualifiedHints || [], o = r.some(
|
|
707
|
-
(c) => {
|
|
708
|
-
var u;
|
|
709
|
-
return (u = l(c)) == null ? void 0 : u.includes(".");
|
|
710
|
-
}
|
|
711
|
-
), n = ne({
|
|
712
|
-
entities: i,
|
|
713
|
-
connectionType: l(e.connectionType),
|
|
714
|
-
dialect: e.dialect,
|
|
715
|
-
capabilities: e.capabilities,
|
|
716
|
-
qualifiedHints: r,
|
|
717
|
-
bareHints: [e.entityName, e.entityId, ...e.bareHints || []],
|
|
718
|
-
...!o && e.fallbackCoordinateHint ? { coordinateHint: e.fallbackCoordinateHint } : {}
|
|
719
|
-
});
|
|
720
|
-
if (n.kind === "malformed" || n.kind === "conflicting" || n.kind === "incompatible_capabilities" && o || n.kind === "ambiguous" && n.basis === "qualified")
|
|
721
|
-
return n;
|
|
722
|
-
if (n.kind === "resolved" && n.basis === "qualified") {
|
|
723
|
-
const c = _({
|
|
724
|
-
resolution: n,
|
|
725
|
-
connectionId: e.connectionId
|
|
726
|
-
});
|
|
727
|
-
return c ? {
|
|
728
|
-
kind: "resolved",
|
|
729
|
-
basis: n.basis,
|
|
730
|
-
source: c,
|
|
731
|
-
entity: n.entity
|
|
732
|
-
} : { kind: "missing_connection" };
|
|
733
|
-
}
|
|
734
|
-
if (n.kind === "not_found" && n.basis === "qualified" && n.coordinates) {
|
|
735
|
-
if (s.kind === "resolved" && s.matchedById && ye({
|
|
736
|
-
entity: s.entity,
|
|
737
|
-
coordinates: n.coordinates,
|
|
738
|
-
capabilityAuthority: n.capabilityAuthority
|
|
739
|
-
}))
|
|
740
|
-
return {
|
|
741
|
-
kind: "resolved",
|
|
742
|
-
basis: s.basis,
|
|
743
|
-
source: s.source,
|
|
744
|
-
entity: s.entity
|
|
745
|
-
};
|
|
746
|
-
const c = _({
|
|
747
|
-
resolution: n,
|
|
748
|
-
connectionId: e.connectionId
|
|
749
|
-
});
|
|
750
|
-
return c ? a ? { kind: "candidate", basis: "qualified", source: c } : { kind: "resolved", basis: "qualified", source: c } : { kind: "missing_connection" };
|
|
751
|
-
}
|
|
752
|
-
if (s.kind === "resolved")
|
|
753
|
-
return n.kind === "resolved" && n.basis === "bare" && !s.matchedById ? { kind: "ambiguous", basis: "bare" } : {
|
|
754
|
-
kind: "resolved",
|
|
755
|
-
basis: s.basis,
|
|
756
|
-
source: s.source,
|
|
757
|
-
entity: s.entity
|
|
758
|
-
};
|
|
759
|
-
if (s.kind === "ambiguous") return s;
|
|
760
|
-
if (n.kind === "resolved") {
|
|
761
|
-
const c = _({
|
|
762
|
-
resolution: n,
|
|
763
|
-
connectionId: e.connectionId
|
|
764
|
-
});
|
|
765
|
-
return c ? {
|
|
766
|
-
kind: "resolved",
|
|
767
|
-
basis: n.basis,
|
|
768
|
-
source: c,
|
|
769
|
-
entity: n.entity
|
|
770
|
-
} : { kind: "missing_connection" };
|
|
771
|
-
}
|
|
772
|
-
const d = l(e.entityName) || l(e.entityId);
|
|
773
|
-
if (!a && !o && l(e.semanticDomainId) && (!l(e.fieldEntityType) || l(e.fieldEntityType) === "dataset") && d)
|
|
774
|
-
return {
|
|
775
|
-
kind: "resolved",
|
|
776
|
-
basis: "historical",
|
|
777
|
-
source: {
|
|
778
|
-
kind: "semantic",
|
|
779
|
-
domainId: l(e.semanticDomainId),
|
|
780
|
-
datasetName: d,
|
|
781
|
-
...l(e.connectionId) ? { connectionId: l(e.connectionId) } : {}
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
if (n.kind === "incompatible_capabilities") {
|
|
785
|
-
const c = a ? void 0 : pe(e), u = l(e.connectionId);
|
|
786
|
-
return c && u ? {
|
|
787
|
-
kind: "resolved",
|
|
788
|
-
basis: "historical",
|
|
789
|
-
source: { kind: "physical", connectionId: u, tableName: c }
|
|
790
|
-
} : n;
|
|
791
|
-
}
|
|
792
|
-
return n.kind === "ambiguous" ? n : n.kind === "not_found" ? {
|
|
793
|
-
kind: "not_found",
|
|
794
|
-
basis: n.basis
|
|
795
|
-
} : { kind: "unqualified" };
|
|
796
|
-
}
|
|
797
|
-
export {
|
|
798
|
-
X as a,
|
|
799
|
-
M as b,
|
|
800
|
-
h as c,
|
|
801
|
-
ke as d,
|
|
802
|
-
ge as e,
|
|
803
|
-
Ne as f,
|
|
804
|
-
Y as g,
|
|
805
|
-
O as h,
|
|
806
|
-
Ie as i,
|
|
807
|
-
W as j,
|
|
808
|
-
ne as k,
|
|
809
|
-
J as l,
|
|
810
|
-
he as m,
|
|
811
|
-
z as n,
|
|
812
|
-
Ce as o,
|
|
813
|
-
Q as p,
|
|
814
|
-
v as r,
|
|
815
|
-
P as s
|
|
816
|
-
};
|