react-semaphor 0.1.568 → 0.1.569
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/README.md +0 -7
- package/dist/analytics-protocol/index.js +434 -454
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +10 -12
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/{_commonjsHelpers-DimLPMtv.js → _commonjsHelpers-Bid1ZNYj.js} +271 -222
- package/dist/chunks/{assistant-chat-BN5I8KuN.js → assistant-chat-Dzf2Mbph.js} +107 -109
- package/dist/chunks/{bookmark-impact-CJ-65omV.js → bookmark-impact-Czg6FGt5.js} +2 -2
- package/dist/chunks/{bookmark-state-Du3s13_V.js → bookmark-state-CflS88gq.js} +251 -250
- package/dist/chunks/{card-filter-builder-BBuB99GZ.js → card-filter-builder-BS982X7x.js} +986 -985
- package/dist/chunks/{code-editor-DJNOsgJH.js → code-editor-BsxHzm9u.js} +43 -45
- package/dist/chunks/{comparison-window-caption-CMLb3mut.js → comparison-window-caption-lLTgzOkM.js} +252 -253
- package/dist/chunks/{dashboard-YnWZC4dK.js → dashboard-BiYSbxZv.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-BF89TU2h.js → dashboard-briefing-launcher-Bdj7luOr.js} +158 -159
- package/dist/chunks/{dashboard-controls-atHc1EjP.js → dashboard-controls-TViDsnb8.js} +17 -19
- package/dist/chunks/dashboard-json-Dg9dQd9U.js +66 -0
- package/dist/chunks/{dates-CKO05ino.js → dates-BsPrWZIP.js} +8 -8
- package/dist/chunks/{edit-dashboard-visual-DdmTfn-J.js → edit-dashboard-visual-C6hoIeEJ.js} +20 -21
- package/dist/chunks/{filter-reach-copy-jZGzK_IH.js → filter-reach-copy-hcQ4os0u.js} +695 -699
- package/dist/chunks/filter-value-text-CVxEEDVl.js +146 -0
- package/dist/chunks/{index-CPNZW0mu.js → index-G4q89J6O.js} +74 -76
- package/dist/chunks/{layout-grid-0hIlqEtk.js → layout-grid-BIcoFfdS.js} +1 -1
- package/dist/chunks/{list-filter-DkgoCeBm.js → list-filter-C6tYkHyv.js} +1 -1
- package/dist/chunks/matrix-analytical-definition-dkS8szLM.js +1253 -0
- package/dist/chunks/matrix-member-presentation-DRa-9e6Q.js +169 -0
- package/dist/chunks/{matrix-operation-contract-Eb6elidS.js → matrix-operation-contract-DCVinw1o.js} +122 -122
- package/dist/chunks/{metric-comparison-ChXUFaZu.js → metric-comparison-n9NsIa-2.js} +175 -128
- package/dist/chunks/{palette-4vf2BEEg.js → palette-NjHOE_6B.js} +1 -1
- package/dist/chunks/pivot-result-contract-expectations-DkmueDTW.js +55 -0
- package/dist/chunks/{pivot-result-identity-BlbLrqaC.js → pivot-result-identity-B89X5xjb.js} +1 -1
- package/dist/chunks/raw-temporal-value-DdT0s47W.js +159 -0
- package/dist/chunks/{report-preferences-dialog-Mbd-I0wV.js → report-preferences-dialog-Xc8_GFju.js} +26 -28
- package/dist/chunks/{report-runtime-context-DnA_PiKo.js → report-runtime-context-BhPzLTbS.js} +1 -1
- package/dist/chunks/{resolve-dashboard-input-context-Du0fjN3h.js → resolve-dashboard-input-context-KqvcLcTM.js} +4784 -4764
- package/dist/chunks/{save-D6pHmSSP.js → save-C6VmEJTA.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-y8N6RvjS.js → saved-dashboard-context-BeXXyoD4.js} +6 -6
- package/dist/chunks/{semaphor-ready-indicator-BSEdUq40.js → semaphor-ready-indicator-BNkaANsG.js} +28395 -28384
- package/dist/chunks/{shelf-drop-preview-context-D7QqPl36.js → shelf-drop-preview-context-C_issPBA.js} +18 -20
- package/dist/chunks/{stored-dashboard-d3xQYxBD.js → stored-dashboard-B6_StAty.js} +263 -265
- package/dist/chunks/{table-export-sheet--DUKWk6o.js → table-export-sheet-BWP2joD1.js} +1 -1
- package/dist/chunks/{temporal-input-presentation--2r9BLr0.js → temporal-input-presentation-scSWQXAB.js} +4 -4
- package/dist/chunks/{token-types-C8JymO8s.js → token-types-iKMplaBL.js} +1 -1
- package/dist/chunks/{upload-Cf3wXZT8.js → upload-BRW4Mwrd.js} +1 -1
- package/dist/chunks/validators-B8fpdinG.js +3651 -0
- package/dist/chunks/{variable-draft-DOX03R4A.js → variable-draft-BQ3OMjvy.js} +4 -4
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1527 -1517
- package/dist/format-utils/index.js +230 -231
- package/dist/index.js +236 -237
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/surfboard/filter/types.d.ts +5 -4
- package/dist/types/components/ui-custom/date-range-presets.d.ts +1 -17
- package/dist/types/index.js +9 -9
- package/dist/types/lib/hooks/use-date-filter.d.ts +3 -3
- package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
- package/dist/types/lib/types/explorer-types.d.ts +2 -2
- package/dist/types/lib/types/index.d.ts +1 -1
- package/dist/types/lib/utils/card-definition.d.ts +7 -7
- package/dist/types/shared/analytics-protocol/agent-time-window.d.ts +84 -0
- package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +2 -2
- package/dist/types/shared/analytics-protocol/contracts.d.ts +8 -17
- package/dist/types/shared/analytics-protocol/fixtures.d.ts +3 -2
- package/dist/types/shared/analytics-protocol/index.d.ts +2 -4
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +4 -4
- package/dist/types/shared/analytics-protocol/relative-date/describe.d.ts +18 -0
- package/dist/types/shared/analytics-protocol/relative-date/index.d.ts +7 -0
- package/dist/types/shared/analytics-protocol/relative-date/limits.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/relative-date/presets.d.ts +11 -0
- package/dist/types/shared/analytics-protocol/relative-date/resolve.d.ts +49 -0
- package/dist/types/shared/analytics-protocol/relative-date/schemas.d.ts +76 -0
- package/dist/types/shared/analytics-protocol/relative-date/traits.d.ts +51 -0
- package/dist/types/shared/analytics-protocol/relative-date/window.d.ts +111 -0
- package/dist/types/shared/analytics-protocol/selection-contract.d.ts +1 -1
- package/dist/types/shared/assistant-protocol/context.d.ts +12 -12
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +0 -2
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +155 -1753
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +8 -4
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +74 -74
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +20 -20
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +10 -2
- package/dist/types/shared/format-utils/filter-detail.d.ts +2 -8
- package/dist/types/shared/format-utils/filter-line.d.ts +2 -2
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +3 -3
- package/dist/types/shared/temporal/index.d.ts +0 -2
- package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +2 -2
- package/package.json +2 -24
- package/DATA_APP_SDK.md +0 -339
- package/dist/chunks/dashboard-json-Cxp3inxd.js +0 -68
- package/dist/chunks/filter-value-text-7zhmth1S.js +0 -163
- package/dist/chunks/index-CuHybtft.js +0 -51
- package/dist/chunks/matrix-analytical-definition-C9xB_T84.js +0 -717
- package/dist/chunks/matrix-card-BSUeSXpD.js +0 -42
- package/dist/chunks/matrix-member-presentation-DZNgQpUq.js +0 -105
- package/dist/chunks/operators-B3zZoskU.js +0 -66
- package/dist/chunks/pivot-result-contract-expectations-Ddh1rNz5.js +0 -56
- package/dist/chunks/raw-temporal-value-Bqz8wc7L.js +0 -242
- package/dist/chunks/selection-reducer-OaJ-N5uN.js +0 -46
- package/dist/chunks/source-entity-resolution-DF6GulDn.js +0 -607
- package/dist/chunks/validators-wtjw0aw6.js +0 -3332
- package/dist/data-app-sdk/index.js +0 -1412
- package/dist/data-app-sdk-adapters/index.js +0 -361
- package/dist/data-app-sdk-validation/index.js +0 -1031
- package/dist/types/data-app-sdk/adapters.d.ts +0 -35
- package/dist/types/data-app-sdk/builders.d.ts +0 -62
- package/dist/types/data-app-sdk/contracts.d.ts +0 -419
- package/dist/types/data-app-sdk/executor.d.ts +0 -5
- package/dist/types/data-app-sdk/field-catalog-validation.d.ts +0 -29
- package/dist/types/data-app-sdk/hooks.d.ts +0 -11
- package/dist/types/data-app-sdk/index.d.ts +0 -9
- package/dist/types/data-app-sdk/provider.d.ts +0 -8
- package/dist/types/data-app-sdk/relationship-aware-field-policy.d.ts +0 -21
- package/dist/types/data-app-sdk/selection.d.ts +0 -2
- package/dist/types/data-app-sdk/validation.d.ts +0 -58
- package/dist/types/data-app-sdk-adapters.d.ts +0 -2
- package/dist/types/data-app-sdk-validation.d.ts +0 -2
- package/dist/types/data-app-sdk.d.ts +0 -2
- package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +0 -68
- package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +0 -20
- package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +0 -314
- package/dist/types/shared/analytics-protocol/time-window.d.ts +0 -52
- package/dist/types/shared/temporal/relative-date.d.ts +0 -21
- package/dist/types/shared/temporal/time-window-periods.d.ts +0 -21
- package/src/data-app-sdk/README.md +0 -402
|
@@ -1,607 +0,0 @@
|
|
|
1
|
-
import { w as p, x as _, y as z, z as y, A as G, B as Q, E as J, F as K } from "./validators-wtjw0aw6.js";
|
|
2
|
-
function R(e) {
|
|
3
|
-
return e.prefixLevels.length === 1 && e.prefixLevels[0] === "table" ? ["table"] : Array.from(
|
|
4
|
-
/* @__PURE__ */ new Set([
|
|
5
|
-
"database",
|
|
6
|
-
...e.prefixLevels
|
|
7
|
-
])
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
function le(e) {
|
|
11
|
-
const i = e.source.connectionType ? p(e.source.connectionType) : void 0, n = e.source.dialect ? _(e.source.dialect) : void 0, a = e.source.dialect && e.source.dialect !== "unknown" ? p(e.source.dialect) : void 0;
|
|
12
|
-
if (!e.capabilities && e.source.connectionType && e.source.dialect && e.source.dialect !== "unknown" && (!i || n === "unknown" || i.dialect !== n))
|
|
13
|
-
return { kind: "incompatible_capabilities" };
|
|
14
|
-
const o = e.capabilities || i || a;
|
|
15
|
-
if (!o) return { kind: "incompatible_capabilities" };
|
|
16
|
-
const c = R(o), s = {
|
|
17
|
-
...c.includes("database") && e.source.databaseName ? { databaseName: e.source.databaseName } : {},
|
|
18
|
-
...c.includes("schema") && e.source.schemaName ? { schemaName: e.source.schemaName } : {},
|
|
19
|
-
...e.source.tableName ? { tableName: e.source.tableName } : {}
|
|
20
|
-
}, t = c.filter((l) => l === "database" ? !s.databaseName : l === "schema" ? !s.schemaName : !s.tableName);
|
|
21
|
-
return t.length > 0 ? { kind: "missing_coordinates", missing: t } : {
|
|
22
|
-
kind: "resolved",
|
|
23
|
-
coordinates: s
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function u(e) {
|
|
27
|
-
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
28
|
-
}
|
|
29
|
-
function H(e) {
|
|
30
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
31
|
-
}
|
|
32
|
-
function M(e) {
|
|
33
|
-
const i = H(e);
|
|
34
|
-
return !i || !u(i.name) || i.type === "model" ? !1 : i.type === "dataset" ? i.datasetType === "physical" : !0;
|
|
35
|
-
}
|
|
36
|
-
function w(e) {
|
|
37
|
-
const i = H(e);
|
|
38
|
-
if (!i) return {};
|
|
39
|
-
const n = u(i.table) || u(i.name);
|
|
40
|
-
return {
|
|
41
|
-
...u(i.database) ? { databaseName: u(i.database) } : {},
|
|
42
|
-
...u(i.schema) ? { schemaName: u(i.schema) } : {},
|
|
43
|
-
...n ? { tableName: n } : {}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function U(e) {
|
|
47
|
-
if (Z(e)) return { kind: "malformed" };
|
|
48
|
-
const i = e.entities.filter(M), n = W(e), a = X({
|
|
49
|
-
entities: i,
|
|
50
|
-
connectionType: e.connectionType,
|
|
51
|
-
dialect: e.dialect,
|
|
52
|
-
capabilities: e.capabilities
|
|
53
|
-
});
|
|
54
|
-
if (!a) return { kind: "incompatible_capabilities" };
|
|
55
|
-
const { capabilities: o } = a, c = ee({
|
|
56
|
-
hints: e.qualifiedHints || [],
|
|
57
|
-
coordinateHint: e.coordinateHint,
|
|
58
|
-
capabilityAuthority: a
|
|
59
|
-
});
|
|
60
|
-
if (c.kind !== "valid")
|
|
61
|
-
return { kind: c.kind };
|
|
62
|
-
const s = c.coordinates, t = s ? i.filter(
|
|
63
|
-
(r) => z({
|
|
64
|
-
left: $(
|
|
65
|
-
w(r),
|
|
66
|
-
o
|
|
67
|
-
),
|
|
68
|
-
right: s,
|
|
69
|
-
capabilities: o
|
|
70
|
-
})
|
|
71
|
-
) : i;
|
|
72
|
-
if (s && t.length === 0)
|
|
73
|
-
return {
|
|
74
|
-
kind: "not_found",
|
|
75
|
-
basis: "qualified",
|
|
76
|
-
coordinates: s,
|
|
77
|
-
capabilityAuthority: a
|
|
78
|
-
};
|
|
79
|
-
if (s && t.length === 1) {
|
|
80
|
-
const r = t[0], f = E(
|
|
81
|
-
a,
|
|
82
|
-
r
|
|
83
|
-
);
|
|
84
|
-
return {
|
|
85
|
-
kind: "resolved",
|
|
86
|
-
basis: "qualified",
|
|
87
|
-
entity: r,
|
|
88
|
-
coordinates: ae(
|
|
89
|
-
w(r),
|
|
90
|
-
s,
|
|
91
|
-
f
|
|
92
|
-
),
|
|
93
|
-
capabilityAuthority: f
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
const l = O([
|
|
97
|
-
...e.bareHints || [],
|
|
98
|
-
...c.bareHints,
|
|
99
|
-
s == null ? void 0 : s.tableName
|
|
100
|
-
]);
|
|
101
|
-
if (l.size > 0) {
|
|
102
|
-
const r = t.filter((f) => {
|
|
103
|
-
const b = ne(f);
|
|
104
|
-
return Array.from(l).some((h) => b.has(h));
|
|
105
|
-
});
|
|
106
|
-
if (r.length === 1) {
|
|
107
|
-
const f = r[0], b = E(
|
|
108
|
-
a,
|
|
109
|
-
f
|
|
110
|
-
);
|
|
111
|
-
return {
|
|
112
|
-
kind: "resolved",
|
|
113
|
-
basis: "bare",
|
|
114
|
-
entity: f,
|
|
115
|
-
coordinates: A(
|
|
116
|
-
w(f),
|
|
117
|
-
b
|
|
118
|
-
),
|
|
119
|
-
capabilityAuthority: b
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
return r.length > 1 ? { kind: "ambiguous", basis: "bare" } : { kind: "not_found", basis: "bare", capabilityAuthority: a };
|
|
123
|
-
}
|
|
124
|
-
if (s)
|
|
125
|
-
return { kind: "ambiguous", basis: "qualified" };
|
|
126
|
-
if (n)
|
|
127
|
-
return {
|
|
128
|
-
kind: "not_found",
|
|
129
|
-
basis: n,
|
|
130
|
-
capabilityAuthority: a
|
|
131
|
-
};
|
|
132
|
-
if (i.length === 1) {
|
|
133
|
-
const r = i[0], f = E(
|
|
134
|
-
a,
|
|
135
|
-
r
|
|
136
|
-
);
|
|
137
|
-
return {
|
|
138
|
-
kind: "resolved",
|
|
139
|
-
basis: "unqualified",
|
|
140
|
-
entity: r,
|
|
141
|
-
coordinates: A(
|
|
142
|
-
w(r),
|
|
143
|
-
f
|
|
144
|
-
),
|
|
145
|
-
capabilityAuthority: f
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
return { kind: "unqualified" };
|
|
149
|
-
}
|
|
150
|
-
function W(e) {
|
|
151
|
-
const i = (e.qualifiedHints || []).map(u).filter((a) => !!a);
|
|
152
|
-
return Object.values(e.coordinateHint || {}).some(
|
|
153
|
-
(a) => !!u(a)
|
|
154
|
-
) || i.some((a) => a.includes(".")) ? "qualified" : [...i, ...e.bareHints || []].some(
|
|
155
|
-
(a) => !!u(a)
|
|
156
|
-
) ? "bare" : void 0;
|
|
157
|
-
}
|
|
158
|
-
function S(e) {
|
|
159
|
-
return `${e.dialect}:${e.prefixLevels.join(".")}`;
|
|
160
|
-
}
|
|
161
|
-
function q(e) {
|
|
162
|
-
return {
|
|
163
|
-
dialect: e.dialect,
|
|
164
|
-
prefixLevels: [...e.prefixLevels]
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function X(e) {
|
|
168
|
-
var I;
|
|
169
|
-
const i = u(e.connectionType), n = u(e.dialect), a = e.capabilities ? q(e.capabilities) : void 0, o = i ? p(i) : void 0, c = n ? _(n) : void 0, s = n && n !== "unknown" ? p(n) : void 0;
|
|
170
|
-
if (i && !o || n && n !== "unknown" && c === "unknown" || a && o && S(a) !== S(o))
|
|
171
|
-
return;
|
|
172
|
-
const t = a || (o ? q(o) : s ? q(s) : void 0);
|
|
173
|
-
if (t)
|
|
174
|
-
return c && c !== "unknown" && t.dialect !== c ? void 0 : {
|
|
175
|
-
capabilities: t,
|
|
176
|
-
...i ? { connectionType: i } : {},
|
|
177
|
-
dialect: t.dialect,
|
|
178
|
-
evidence: "explicit"
|
|
179
|
-
};
|
|
180
|
-
const l = e.entities.map((m) => {
|
|
181
|
-
const k = H(m), g = u(k == null ? void 0 : k.connectionType), v = u(k == null ? void 0 : k.dialect), C = g ? p(g) : void 0, T = v ? _(v) : void 0, B = v && v !== "unknown" ? p(v) : void 0;
|
|
182
|
-
if (g && !C || v && v !== "unknown" && T === "unknown" || v && v !== "unknown" && !C && !B || C && T && T !== "unknown" && C.dialect !== T)
|
|
183
|
-
return;
|
|
184
|
-
const P = C || B, x = P ? q(P) : Y(k);
|
|
185
|
-
return x ? {
|
|
186
|
-
capabilities: x,
|
|
187
|
-
connectionType: g,
|
|
188
|
-
capabilityIdentity: g ? G(g) : void 0,
|
|
189
|
-
inferred: !C && !B,
|
|
190
|
-
signature: S(x)
|
|
191
|
-
} : void 0;
|
|
192
|
-
});
|
|
193
|
-
if (l.some((m) => !m)) return;
|
|
194
|
-
const r = l.filter(
|
|
195
|
-
(m) => !!m
|
|
196
|
-
);
|
|
197
|
-
if (new Set(r.map((m) => m.signature)).size > 1)
|
|
198
|
-
return;
|
|
199
|
-
const f = (I = r[0]) == null ? void 0 : I.capabilities;
|
|
200
|
-
if (!f || c && c !== "unknown" && f.dialect !== c)
|
|
201
|
-
return;
|
|
202
|
-
const b = new Set(
|
|
203
|
-
r.map((m) => m.capabilityIdentity).filter((m) => !!m)
|
|
204
|
-
), h = r.every(
|
|
205
|
-
(m) => m.connectionType && m.capabilityIdentity
|
|
206
|
-
);
|
|
207
|
-
return {
|
|
208
|
-
capabilities: f,
|
|
209
|
-
...h && b.size === 1 ? { connectionType: r[0].connectionType } : {},
|
|
210
|
-
dialect: f.dialect,
|
|
211
|
-
evidence: r.every((m) => m.inferred) ? "coordinates" : "entity"
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function Y(e) {
|
|
215
|
-
const i = !!u(e == null ? void 0 : e.database), n = !!u(e == null ? void 0 : e.schema);
|
|
216
|
-
if (!(i && n)) {
|
|
217
|
-
if (n)
|
|
218
|
-
return { dialect: "unknown", prefixLevels: ["schema", "table"] };
|
|
219
|
-
if (i)
|
|
220
|
-
return { dialect: "unknown", prefixLevels: ["database", "table"] };
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
function E(e, i) {
|
|
224
|
-
var o;
|
|
225
|
-
if (e.evidence !== "entity") return e;
|
|
226
|
-
const n = u((o = H(i)) == null ? void 0 : o.connectionType), a = n ? p(n) : void 0;
|
|
227
|
-
return a && S(a) === S(e.capabilities) ? { ...e, connectionType: n } : e;
|
|
228
|
-
}
|
|
229
|
-
function Z(e) {
|
|
230
|
-
return (e.qualifiedHints || []).some(
|
|
231
|
-
(n) => {
|
|
232
|
-
const a = u(n);
|
|
233
|
-
return !!(a && a.includes(".") && !y(a));
|
|
234
|
-
}
|
|
235
|
-
) ? !0 : Object.values(e.coordinateHint || {}).some((n) => {
|
|
236
|
-
const a = u(n);
|
|
237
|
-
return !!(a && !y(a));
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
function ee(e) {
|
|
241
|
-
const { capabilities: i } = e.capabilityAuthority, n = [], a = [];
|
|
242
|
-
for (const b of e.hints) {
|
|
243
|
-
const h = u(b);
|
|
244
|
-
if (!h) continue;
|
|
245
|
-
if (!h.includes(".")) {
|
|
246
|
-
a.push(h);
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
const I = y(h);
|
|
250
|
-
if (!I) return { kind: "malformed" };
|
|
251
|
-
n.push(I);
|
|
252
|
-
}
|
|
253
|
-
const o = ie(e.coordinateHint);
|
|
254
|
-
if (o.kind === "malformed") return o;
|
|
255
|
-
const c = Array.from(new Set(n)).map(
|
|
256
|
-
(b) => Q({
|
|
257
|
-
qualifiedName: b,
|
|
258
|
-
capabilities: i
|
|
259
|
-
})
|
|
260
|
-
);
|
|
261
|
-
if (!te(c, i))
|
|
262
|
-
return { kind: "conflicting" };
|
|
263
|
-
const s = [...new Set(n)].sort(
|
|
264
|
-
(b, h) => h.split(".").length - b.split(".").length
|
|
265
|
-
)[0], t = s ? Q({
|
|
266
|
-
qualifiedName: s,
|
|
267
|
-
capabilities: i
|
|
268
|
-
}) : void 0, l = $(
|
|
269
|
-
o.coordinates,
|
|
270
|
-
i
|
|
271
|
-
), r = A(
|
|
272
|
-
o.coordinates,
|
|
273
|
-
e.capabilityAuthority
|
|
274
|
-
), f = !!(l.tableName && (l.databaseName || l.schemaName));
|
|
275
|
-
return t && f && !z({
|
|
276
|
-
left: t,
|
|
277
|
-
right: l,
|
|
278
|
-
capabilities: i
|
|
279
|
-
}) ? { kind: "conflicting" } : {
|
|
280
|
-
kind: "valid",
|
|
281
|
-
coordinates: t ? {
|
|
282
|
-
...r,
|
|
283
|
-
...t
|
|
284
|
-
} : f ? r : void 0,
|
|
285
|
-
bareHints: [
|
|
286
|
-
...a,
|
|
287
|
-
...!f && l.tableName ? [l.tableName] : []
|
|
288
|
-
]
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
function ie(e) {
|
|
292
|
-
const i = {};
|
|
293
|
-
for (const [n, a] of Object.entries(e || {})) {
|
|
294
|
-
const o = u(a);
|
|
295
|
-
if (!o) continue;
|
|
296
|
-
const c = y(o);
|
|
297
|
-
if (!c) return { kind: "malformed" };
|
|
298
|
-
i[n] = c;
|
|
299
|
-
}
|
|
300
|
-
return { kind: "valid", coordinates: i };
|
|
301
|
-
}
|
|
302
|
-
function $(e, i) {
|
|
303
|
-
return {
|
|
304
|
-
...i.prefixLevels.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
305
|
-
...i.prefixLevels.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
306
|
-
...e.tableName ? { tableName: e.tableName } : {}
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
function te(e, i) {
|
|
310
|
-
return e.every(
|
|
311
|
-
(n, a) => e.slice(a + 1).every(
|
|
312
|
-
(o) => z({
|
|
313
|
-
left: n,
|
|
314
|
-
right: o,
|
|
315
|
-
capabilities: i
|
|
316
|
-
})
|
|
317
|
-
)
|
|
318
|
-
);
|
|
319
|
-
}
|
|
320
|
-
function O(e) {
|
|
321
|
-
return new Set(
|
|
322
|
-
e.map(u).map(y).filter((i) => !!i)
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
function ne(e) {
|
|
326
|
-
const i = H(e);
|
|
327
|
-
return i ? O([
|
|
328
|
-
u(i.name),
|
|
329
|
-
u(i.table),
|
|
330
|
-
u(i.id)
|
|
331
|
-
]) : /* @__PURE__ */ new Set();
|
|
332
|
-
}
|
|
333
|
-
function ae(e, i, n) {
|
|
334
|
-
return A(
|
|
335
|
-
{
|
|
336
|
-
...e,
|
|
337
|
-
...i
|
|
338
|
-
},
|
|
339
|
-
n
|
|
340
|
-
);
|
|
341
|
-
}
|
|
342
|
-
function A(e, i) {
|
|
343
|
-
const n = i.evidence === "coordinates" ? i.capabilities.prefixLevels : R(i.capabilities);
|
|
344
|
-
return {
|
|
345
|
-
...n.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
346
|
-
...n.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
347
|
-
...e.tableName ? { tableName: e.tableName } : {}
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
function d(e) {
|
|
351
|
-
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
352
|
-
}
|
|
353
|
-
function N(e) {
|
|
354
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
355
|
-
}
|
|
356
|
-
function oe(e) {
|
|
357
|
-
const i = N(e);
|
|
358
|
-
return !!(i && i.type === "dataset" && d(i.name));
|
|
359
|
-
}
|
|
360
|
-
function V(e) {
|
|
361
|
-
const i = N(e);
|
|
362
|
-
return !!(i && i.type === "dataset" && i.datasetType !== "physical" && d(i.name));
|
|
363
|
-
}
|
|
364
|
-
function j(e) {
|
|
365
|
-
const i = /* @__PURE__ */ new Set();
|
|
366
|
-
for (const n of e) {
|
|
367
|
-
const a = d(n);
|
|
368
|
-
if (!a) continue;
|
|
369
|
-
const o = y(a);
|
|
370
|
-
if (!o) continue;
|
|
371
|
-
const c = o.toLowerCase();
|
|
372
|
-
i.add(c);
|
|
373
|
-
const s = c.split("."), t = s[s.length - 1];
|
|
374
|
-
t && i.add(t);
|
|
375
|
-
}
|
|
376
|
-
return i;
|
|
377
|
-
}
|
|
378
|
-
function F(e) {
|
|
379
|
-
var n;
|
|
380
|
-
const i = d(e);
|
|
381
|
-
return i ? (n = y(i)) == null ? void 0 : n.toLowerCase() : void 0;
|
|
382
|
-
}
|
|
383
|
-
function D(e, i) {
|
|
384
|
-
const n = N(i), a = d(n == null ? void 0 : n.domainId) || d(e.semanticDomainId), o = d(n == null ? void 0 : n.name);
|
|
385
|
-
if (!a || !o) return;
|
|
386
|
-
const c = (n == null ? void 0 : n.datasetType) === "physical" ? void 0 : J(n || {}), s = d(n == null ? void 0 : n.connectionId) || d(e.connectionId);
|
|
387
|
-
return {
|
|
388
|
-
kind: "semantic",
|
|
389
|
-
domainId: a,
|
|
390
|
-
datasetName: o,
|
|
391
|
-
...c ? { datasetId: c } : {},
|
|
392
|
-
...s ? { connectionId: s } : {}
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
function se(e, i = {}) {
|
|
396
|
-
const n = d(e.fieldEntityType);
|
|
397
|
-
if (n && n !== "dataset")
|
|
398
|
-
return { kind: "unqualified" };
|
|
399
|
-
const a = e.entities.filter(
|
|
400
|
-
(s) => i.includePhysicalDatasets ? oe(s) : V(s)
|
|
401
|
-
), o = d(e.entityId);
|
|
402
|
-
if (o) {
|
|
403
|
-
const s = F(o), t = a.filter((l) => {
|
|
404
|
-
const r = N(l);
|
|
405
|
-
return !!(s && F(r == null ? void 0 : r.id) === s);
|
|
406
|
-
});
|
|
407
|
-
if (t.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
408
|
-
if (t.length === 1) {
|
|
409
|
-
const l = D(e, t[0]);
|
|
410
|
-
return l ? {
|
|
411
|
-
kind: "resolved",
|
|
412
|
-
basis: "bare",
|
|
413
|
-
entity: t[0],
|
|
414
|
-
source: l,
|
|
415
|
-
matchedById: !0
|
|
416
|
-
} : { kind: "not_found", basis: "bare" };
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
const c = j([
|
|
420
|
-
e.entityName,
|
|
421
|
-
...e.qualifiedHints || [],
|
|
422
|
-
...e.bareHints || []
|
|
423
|
-
]);
|
|
424
|
-
if (c.size > 0) {
|
|
425
|
-
const s = a.filter((t) => {
|
|
426
|
-
const l = N(t);
|
|
427
|
-
return [...j([l == null ? void 0 : l.id, l == null ? void 0 : l.name])].some((f) => c.has(f));
|
|
428
|
-
});
|
|
429
|
-
if (s.length > 1) return { kind: "ambiguous", basis: "bare" };
|
|
430
|
-
if (s.length === 1) {
|
|
431
|
-
const t = D(e, s[0]);
|
|
432
|
-
return t ? {
|
|
433
|
-
kind: "resolved",
|
|
434
|
-
basis: "bare",
|
|
435
|
-
entity: s[0],
|
|
436
|
-
source: t,
|
|
437
|
-
matchedById: !1
|
|
438
|
-
} : { kind: "not_found", basis: "bare" };
|
|
439
|
-
}
|
|
440
|
-
return { kind: "not_found", basis: "bare" };
|
|
441
|
-
}
|
|
442
|
-
if (a.length === 1) {
|
|
443
|
-
const s = D(e, a[0]);
|
|
444
|
-
return s ? {
|
|
445
|
-
kind: "resolved",
|
|
446
|
-
basis: "unqualified",
|
|
447
|
-
entity: a[0],
|
|
448
|
-
source: s,
|
|
449
|
-
matchedById: !1
|
|
450
|
-
} : { kind: "unqualified" };
|
|
451
|
-
}
|
|
452
|
-
return { kind: "unqualified" };
|
|
453
|
-
}
|
|
454
|
-
function L(e) {
|
|
455
|
-
const i = e.resolution.kind === "resolved" ? N(e.resolution.entity) : void 0, n = d(e.connectionId) || d(i == null ? void 0 : i.connectionId), { connectionType: a, dialect: o } = e.resolution.capabilityAuthority, c = p(o), s = !!(c && c.dialect === e.resolution.capabilityAuthority.capabilities.dialect && c.prefixLevels.join(".") === e.resolution.capabilityAuthority.capabilities.prefixLevels.join(
|
|
456
|
-
"."
|
|
457
|
-
)), t = e.resolution.coordinates;
|
|
458
|
-
if (!(!n || !(t != null && t.tableName)))
|
|
459
|
-
return {
|
|
460
|
-
kind: "physical",
|
|
461
|
-
connectionId: n,
|
|
462
|
-
...a ? { connectionType: a } : {},
|
|
463
|
-
...!a && s ? { dialect: o } : {},
|
|
464
|
-
tableName: t.tableName,
|
|
465
|
-
...t.databaseName ? { databaseName: t.databaseName } : {},
|
|
466
|
-
...t.schemaName ? { schemaName: t.schemaName } : {}
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
function re(e) {
|
|
470
|
-
const i = N(e.entity), n = y(d(i == null ? void 0 : i.table));
|
|
471
|
-
if (!n) return !1;
|
|
472
|
-
const a = y(
|
|
473
|
-
d(i == null ? void 0 : i.database)
|
|
474
|
-
), o = y(
|
|
475
|
-
d(i == null ? void 0 : i.schema)
|
|
476
|
-
);
|
|
477
|
-
return e.coordinates.tableName ? K({
|
|
478
|
-
requested: e.coordinates,
|
|
479
|
-
allowed: {
|
|
480
|
-
...a ? { databaseName: a } : {},
|
|
481
|
-
...o ? { schemaName: o } : {},
|
|
482
|
-
tableName: n
|
|
483
|
-
},
|
|
484
|
-
capabilities: e.capabilityAuthority.capabilities
|
|
485
|
-
}) : !1;
|
|
486
|
-
}
|
|
487
|
-
function ce(e) {
|
|
488
|
-
var o, c, s;
|
|
489
|
-
if (d(e.connectionType) || d(e.dialect) || e.capabilities || d(e.semanticDomainId) || d(e.fieldEntityType) === "dataset" || d((o = e.fallbackCoordinateHint) == null ? void 0 : o.databaseName) || d((c = e.fallbackCoordinateHint) == null ? void 0 : c.schemaName))
|
|
490
|
-
return;
|
|
491
|
-
const i = [
|
|
492
|
-
d((s = e.fallbackCoordinateHint) == null ? void 0 : s.tableName),
|
|
493
|
-
...(e.qualifiedHints || []).map(d),
|
|
494
|
-
...(e.bareHints || []).map(d),
|
|
495
|
-
d(e.entityName),
|
|
496
|
-
...d(e.fieldEntityType) === "table" ? [d(e.entityId)] : []
|
|
497
|
-
].filter((t) => !!t);
|
|
498
|
-
if (!i.length || i.some((t) => t.includes(".")))
|
|
499
|
-
return;
|
|
500
|
-
const n = i.map(y);
|
|
501
|
-
return n.some((t) => !t) ? void 0 : new Set(n.map((t) => t.toLowerCase())).size === 1 ? n[0] : void 0;
|
|
502
|
-
}
|
|
503
|
-
function fe(e) {
|
|
504
|
-
const i = e.entities.filter(
|
|
505
|
-
M
|
|
506
|
-
), n = e.entities.filter(
|
|
507
|
-
V
|
|
508
|
-
), a = i.length > 0 || n.length > 0, o = se(e), c = e.qualifiedHints || [], s = c.some(
|
|
509
|
-
(r) => {
|
|
510
|
-
var f;
|
|
511
|
-
return (f = d(r)) == null ? void 0 : f.includes(".");
|
|
512
|
-
}
|
|
513
|
-
), t = U({
|
|
514
|
-
entities: i,
|
|
515
|
-
connectionType: d(e.connectionType),
|
|
516
|
-
dialect: e.dialect,
|
|
517
|
-
capabilities: e.capabilities,
|
|
518
|
-
qualifiedHints: c,
|
|
519
|
-
bareHints: [e.entityName, e.entityId, ...e.bareHints || []],
|
|
520
|
-
...!s && e.fallbackCoordinateHint ? { coordinateHint: e.fallbackCoordinateHint } : {}
|
|
521
|
-
});
|
|
522
|
-
if (t.kind === "malformed" || t.kind === "conflicting" || t.kind === "incompatible_capabilities" && s || t.kind === "ambiguous" && t.basis === "qualified")
|
|
523
|
-
return t;
|
|
524
|
-
if (t.kind === "resolved" && t.basis === "qualified") {
|
|
525
|
-
const r = L({
|
|
526
|
-
resolution: t,
|
|
527
|
-
connectionId: e.connectionId
|
|
528
|
-
});
|
|
529
|
-
return r ? {
|
|
530
|
-
kind: "resolved",
|
|
531
|
-
basis: t.basis,
|
|
532
|
-
source: r,
|
|
533
|
-
entity: t.entity
|
|
534
|
-
} : { kind: "missing_connection" };
|
|
535
|
-
}
|
|
536
|
-
if (t.kind === "not_found" && t.basis === "qualified" && t.coordinates) {
|
|
537
|
-
if (o.kind === "resolved" && o.matchedById && re({
|
|
538
|
-
entity: o.entity,
|
|
539
|
-
coordinates: t.coordinates,
|
|
540
|
-
capabilityAuthority: t.capabilityAuthority
|
|
541
|
-
}))
|
|
542
|
-
return {
|
|
543
|
-
kind: "resolved",
|
|
544
|
-
basis: o.basis,
|
|
545
|
-
source: o.source,
|
|
546
|
-
entity: o.entity
|
|
547
|
-
};
|
|
548
|
-
const r = L({
|
|
549
|
-
resolution: t,
|
|
550
|
-
connectionId: e.connectionId
|
|
551
|
-
});
|
|
552
|
-
return r ? a ? { kind: "candidate", basis: "qualified", source: r } : { kind: "resolved", basis: "qualified", source: r } : { kind: "missing_connection" };
|
|
553
|
-
}
|
|
554
|
-
if (o.kind === "resolved")
|
|
555
|
-
return t.kind === "resolved" && t.basis === "bare" && !o.matchedById ? { kind: "ambiguous", basis: "bare" } : {
|
|
556
|
-
kind: "resolved",
|
|
557
|
-
basis: o.basis,
|
|
558
|
-
source: o.source,
|
|
559
|
-
entity: o.entity
|
|
560
|
-
};
|
|
561
|
-
if (o.kind === "ambiguous") return o;
|
|
562
|
-
if (t.kind === "resolved") {
|
|
563
|
-
const r = L({
|
|
564
|
-
resolution: t,
|
|
565
|
-
connectionId: e.connectionId
|
|
566
|
-
});
|
|
567
|
-
return r ? {
|
|
568
|
-
kind: "resolved",
|
|
569
|
-
basis: t.basis,
|
|
570
|
-
source: r,
|
|
571
|
-
entity: t.entity
|
|
572
|
-
} : { kind: "missing_connection" };
|
|
573
|
-
}
|
|
574
|
-
const l = d(e.entityName) || d(e.entityId);
|
|
575
|
-
if (!a && !s && d(e.semanticDomainId) && (!d(e.fieldEntityType) || d(e.fieldEntityType) === "dataset") && l)
|
|
576
|
-
return {
|
|
577
|
-
kind: "resolved",
|
|
578
|
-
basis: "historical",
|
|
579
|
-
source: {
|
|
580
|
-
kind: "semantic",
|
|
581
|
-
domainId: d(e.semanticDomainId),
|
|
582
|
-
datasetName: l,
|
|
583
|
-
...d(e.connectionId) ? { connectionId: d(e.connectionId) } : {}
|
|
584
|
-
}
|
|
585
|
-
};
|
|
586
|
-
if (t.kind === "incompatible_capabilities") {
|
|
587
|
-
const r = a ? void 0 : ce(e), f = d(e.connectionId);
|
|
588
|
-
return r && f ? {
|
|
589
|
-
kind: "resolved",
|
|
590
|
-
basis: "historical",
|
|
591
|
-
source: { kind: "physical", connectionId: f, tableName: r }
|
|
592
|
-
} : t;
|
|
593
|
-
}
|
|
594
|
-
return t.kind === "ambiguous" ? t : t.kind === "not_found" ? {
|
|
595
|
-
kind: "not_found",
|
|
596
|
-
basis: t.basis
|
|
597
|
-
} : { kind: "unqualified" };
|
|
598
|
-
}
|
|
599
|
-
export {
|
|
600
|
-
le as a,
|
|
601
|
-
U as b,
|
|
602
|
-
V as c,
|
|
603
|
-
se as d,
|
|
604
|
-
R as g,
|
|
605
|
-
M as i,
|
|
606
|
-
fe as r
|
|
607
|
-
};
|