@holistics/anfra-sdk 0.13.5 → 0.14.0

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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/app.d.ts +4 -3
  3. package/dist/app.js +17 -7
  4. package/dist/{bootstrap-BbsNvZ8s.d.ts → bootstrap-MhTSkiA1.d.ts} +96 -3
  5. package/dist/build.d.ts +2 -0
  6. package/dist/chunk-7IHICYVH.js +10 -0
  7. package/dist/chunk-CYZQ7ZTJ.js +237 -0
  8. package/dist/chunk-DITKCHFQ.js +166 -0
  9. package/dist/chunk-F6MRA7J4.js +65 -0
  10. package/dist/chunk-GBXK7F2V.js +431 -0
  11. package/dist/chunk-GOUDXWG4.js +750 -0
  12. package/dist/chunk-GV7SVWEK.js +84 -0
  13. package/dist/chunk-H52PO7MP.js +105 -0
  14. package/dist/chunk-HI3ZAXJK.js +8 -0
  15. package/dist/{chunk-KI5CAVAR.js → chunk-HZEECB6R.js} +477 -25
  16. package/dist/chunk-K633QHGO.js +51 -0
  17. package/dist/chunk-KFD6CHLI.js +38 -0
  18. package/dist/{chunk-OJ5WIKWE.js → chunk-NOFPRSSI.js} +1 -1
  19. package/dist/{chunk-ADWBOQW2.js → chunk-S6XLP6U4.js} +31 -1
  20. package/dist/{chunk-TQ7S5DRE.js → chunk-WI5VJ2Z6.js} +1 -1
  21. package/dist/common.d.ts +1 -1
  22. package/dist/common.js +14 -4
  23. package/dist/data-UCCW2VWH.js +233 -0
  24. package/dist/declaration-GVDOGQY6.js +218 -0
  25. package/dist/host.d.ts +42 -4
  26. package/dist/host.js +412 -9
  27. package/dist/menu-CdGVKc4_.d.ts +151 -0
  28. package/dist/overview-3DNXEQNY.js +358 -0
  29. package/dist/plugin-BmIDirTx.d.ts +303 -0
  30. package/dist/plugins.d.ts +6 -8
  31. package/dist/plugins.js +98 -69
  32. package/dist/queries-2OHKMTPC.js +661 -0
  33. package/dist/structure-WRDUXHD4.js +256 -0
  34. package/dist/tab-HMQOITVM.js +932 -0
  35. package/dist/testing.js +4 -4
  36. package/package.json +1 -1
  37. package/dist/bridge-WC7GliCH.d.ts +0 -73
  38. package/dist/chunk-33B2D4U5.js +0 -6
  39. package/dist/plugin-056-SKwd.d.ts +0 -132
  40. /package/dist/{chunk-52LXBYQM.js → chunk-UUKXJSE4.js} +0 -0
@@ -0,0 +1,65 @@
1
+ // src/common/bridge.ts
2
+ var PROVISION_ELEMENT_ID = "anfra-provision";
3
+
4
+ // src/common/theme.ts
5
+ var THEME_TOKENS = [
6
+ "color-bg",
7
+ "color-fg",
8
+ "color-muted",
9
+ "color-border",
10
+ "color-accent",
11
+ "color-danger",
12
+ "radius",
13
+ "font",
14
+ "font-mono"
15
+ ];
16
+ var FONT = 'system-ui, -apple-system, "Segoe UI", sans-serif';
17
+ var FONT_MONO = "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
18
+ var DEFAULT_TOKENS = {
19
+ light: {
20
+ "color-bg": "#ffffff",
21
+ "color-fg": "#18181b",
22
+ "color-muted": "#71717a",
23
+ "color-border": "#e4e4e7",
24
+ "color-accent": "#5b3df5",
25
+ "color-danger": "#c4261d",
26
+ radius: "8px",
27
+ font: FONT,
28
+ "font-mono": FONT_MONO
29
+ },
30
+ dark: {
31
+ "color-bg": "#1c1c20",
32
+ "color-fg": "#ececef",
33
+ "color-muted": "#9a9aa5",
34
+ "color-border": "#2f2f36",
35
+ "color-accent": "#a594ff",
36
+ "color-danger": "#f97066",
37
+ radius: "8px",
38
+ font: FONT,
39
+ "font-mono": FONT_MONO
40
+ }
41
+ };
42
+ var UNSAFE_VALUE = /[;{}<>]|url\(|expression\(|@import|\\/i;
43
+ function resolveTheme(input) {
44
+ const given = typeof input === "object" && input !== null ? input : {};
45
+ const scheme = given.scheme === "dark" ? "dark" : "light";
46
+ const tokens = { ...DEFAULT_TOKENS[scheme] };
47
+ const set = typeof given.tokens === "object" && given.tokens !== null ? given.tokens : {};
48
+ for (const name of THEME_TOKENS) {
49
+ const value = set[name];
50
+ if (typeof value === "string" && value.trim() !== "" && value.length <= 200 && !UNSAFE_VALUE.test(value)) tokens[name] = value.trim();
51
+ }
52
+ return Object.freeze({ scheme, tokens: Object.freeze(tokens) });
53
+ }
54
+ function applyTheme(style, theme) {
55
+ for (const name of THEME_TOKENS) style.setProperty(`--anfra-${name}`, theme.tokens[name]);
56
+ style.setProperty("color-scheme", theme.scheme);
57
+ }
58
+
59
+ export {
60
+ PROVISION_ELEMENT_ID,
61
+ THEME_TOKENS,
62
+ DEFAULT_TOKENS,
63
+ resolveTheme,
64
+ applyTheme
65
+ };
@@ -0,0 +1,431 @@
1
+ import {
2
+ controlMappings,
3
+ crossFilters
4
+ } from "./chunk-K633QHGO.js";
5
+ import {
6
+ formatCondition
7
+ } from "./chunk-H52PO7MP.js";
8
+
9
+ // src/plugins/lineage/model.ts
10
+ var LINEAGE_KINDS = ["control", "block", "query", "metric", "dimension", "dataset", "model", "table"];
11
+ function targetKey(target) {
12
+ return `${target.parent}\0${target.child}`;
13
+ }
14
+ function targetOf(column, dataset) {
15
+ if (column.adhoc) return void 0;
16
+ return { parent: column.modelId ?? dataset, child: column.fieldName };
17
+ }
18
+ function lineageTargets(apps) {
19
+ const targets = /* @__PURE__ */ new Map();
20
+ for (const app of apps) {
21
+ for (const [name, query] of Object.entries(app.queries)) {
22
+ const dataset = app.declaration.queries[name]?.dataset;
23
+ if (!dataset) continue;
24
+ for (const column of query.columns) {
25
+ const target = targetOf(column, dataset);
26
+ if (target) targets.set(targetKey(target), target);
27
+ }
28
+ }
29
+ }
30
+ return [...targets.values()].sort((a, b) => targetKey(a).localeCompare(targetKey(b)));
31
+ }
32
+ function blocksOf(nodes, out = /* @__PURE__ */ new Map()) {
33
+ for (const node of nodes) {
34
+ if (node.kind === "block" && node.id) {
35
+ const block = out.get(node.id) ?? { node, queries: /* @__PURE__ */ new Set() };
36
+ const walk = (n) => {
37
+ if (n.kind === "query" && n.name !== void 0) block.queries.add(`${n.app ?? 0}/${n.name}`);
38
+ n.children.forEach(walk);
39
+ };
40
+ node.children.forEach(walk);
41
+ out.set(node.id, block);
42
+ }
43
+ blocksOf(node.children, out);
44
+ }
45
+ return out;
46
+ }
47
+ function entityNodesOf(nodes, kind, out = /* @__PURE__ */ new Map()) {
48
+ for (const node of nodes) {
49
+ if (node.kind === kind && node.name !== void 0) {
50
+ const key = `${node.app ?? 0}/${node.name}`;
51
+ if (!out.has(key)) out.set(key, node);
52
+ }
53
+ entityNodesOf(node.children, kind, out);
54
+ }
55
+ return out;
56
+ }
57
+ function entitiesOf(diagram) {
58
+ const out = /* @__PURE__ */ new Map();
59
+ for (const card of diagram.cards) {
60
+ const entity = { id: card.id, type: card.type, label: card.label, props: card.props ?? {}, links: card.links ?? [] };
61
+ out.set(card.id, entity);
62
+ for (const section of card.sections ?? []) {
63
+ for (const node of section.nodes) {
64
+ out.set(node.id, { id: node.id, type: node.type, label: node.label, props: node.props ?? {}, links: node.links ?? [], container: entity });
65
+ }
66
+ }
67
+ }
68
+ return out;
69
+ }
70
+ var text = (value) => typeof value === "string" && value ? value : void 0;
71
+ function modelFieldsOf(lineage, target) {
72
+ const diagram = lineage?.diagram;
73
+ if (!diagram) return [];
74
+ const entities = entitiesOf(diagram);
75
+ const fqn = `${target.parent}.${target.child}`;
76
+ const start = [...entities.values()].find((e) => e.container && text(e.props.fqn) === fqn);
77
+ const out = /* @__PURE__ */ new Map();
78
+ const seen = /* @__PURE__ */ new Set();
79
+ const visit = (id) => {
80
+ if (seen.has(id)) return;
81
+ seen.add(id);
82
+ const entity = entities.get(id);
83
+ if (!entity) return;
84
+ const model = entity.container?.type === "aml.model" ? entity.container : void 0;
85
+ const modelName = model && (text(model.props.fqn) ?? text(model.props.name));
86
+ const field = text(entity.props.name) ?? entity.label;
87
+ if (modelName) out.set(`${modelName}.${field}`, { model: modelName, field, card: model });
88
+ for (const link of entity.links) if (link.type === "refers") visit(link.to);
89
+ };
90
+ if (start) visit(start.id);
91
+ return [...out.values()];
92
+ }
93
+ function buildLineageGraph(apps, structure, traced, datasetLabels = {}) {
94
+ const nodes = /* @__PURE__ */ new Map();
95
+ const edges = /* @__PURE__ */ new Map();
96
+ const chips = /* @__PURE__ */ new Map();
97
+ const node = (n) => {
98
+ const existing = nodes.get(n.id);
99
+ if (existing) return existing;
100
+ nodes.set(n.id, n);
101
+ return n;
102
+ };
103
+ const edge = (source, target, fields, extra = {}) => {
104
+ const id = extra.id ?? `${source}->${target}`;
105
+ const existing = edges.get(id) ?? { id, source, target, fields: [] };
106
+ edges.set(id, { ...existing, ...extra, id, fields: [.../* @__PURE__ */ new Set([...existing.fields, ...fields])] });
107
+ };
108
+ const modelNode = (name, card) => {
109
+ const fqn = text(card?.props.fqn) ?? name;
110
+ const id = `model:${fqn}`;
111
+ const model = node({
112
+ id,
113
+ kind: "model",
114
+ label: card?.label ?? fqn,
115
+ name: text(card?.props.name) ?? fqn,
116
+ description: text(card?.props.description)
117
+ });
118
+ const table = text(card?.props.table_name);
119
+ const dataSource = text(card?.props.data_source_name);
120
+ if (table) {
121
+ const tableId = `table:${dataSource ?? ""}/${table}`;
122
+ node({ id: tableId, kind: "table", label: table, name: dataSource });
123
+ edge(id, tableId, []);
124
+ }
125
+ return model;
126
+ };
127
+ const queryNodes = entityNodesOf(structure?.nodes ?? [], "query");
128
+ const controlNodes = entityNodesOf(structure?.nodes ?? [], "control");
129
+ const queryFields = /* @__PURE__ */ new Map();
130
+ const appName = (app, index) => apps.length > 1 ? app.title ?? `app ${index + 1}` : void 0;
131
+ apps.forEach((app, appIndex) => {
132
+ for (const [name, query] of Object.entries(app.queries)) {
133
+ const dataset = app.declaration.queries[name]?.dataset;
134
+ const queryKey = `${appIndex}/${name}`;
135
+ const queryId = `query:${queryKey}`;
136
+ node({ id: queryId, kind: "query", label: name, name: appName(app, appIndex), structureKey: queryNodes.get(queryKey)?.key });
137
+ const fields = /* @__PURE__ */ new Set();
138
+ queryFields.set(queryId, fields);
139
+ if (!dataset) continue;
140
+ const datasetId = `dataset:${dataset}`;
141
+ for (const column of query.columns) {
142
+ const target = targetOf(column, dataset);
143
+ if (!target) continue;
144
+ const kind = column.isMeasure ? "metric" : "dimension";
145
+ const fieldId = `${kind}:${target.parent}.${target.child}`;
146
+ const lineage = traced?.get(targetKey(target));
147
+ node({
148
+ id: fieldId,
149
+ kind,
150
+ label: column.label ?? column.fieldName,
151
+ // A model's field aggregated in the query says how: `customers.id · count_distinct`.
152
+ name: column.modelId ? `${column.modelId}.${column.fieldName}${column.isMeasure && column.aggregation ? ` \xB7 ${column.aggregation}` : ""}` : column.fieldName,
153
+ error: lineage?.error
154
+ });
155
+ fields.add(fieldId);
156
+ edge(queryId, fieldId, [fieldId]);
157
+ node({ id: datasetId, kind: "dataset", label: datasetLabels[dataset] ?? dataset, name: dataset });
158
+ edge(fieldId, datasetId, [fieldId]);
159
+ const reads = modelFieldsOf(lineage, target);
160
+ if (reads.length === 0 && column.modelId) reads.push({ model: column.modelId, field: column.fieldName });
161
+ for (const read of reads) {
162
+ const model = modelNode(read.model, read.card);
163
+ edge(datasetId, model.id, [fieldId]);
164
+ const set = chips.get(model.id) ?? /* @__PURE__ */ new Set();
165
+ set.add(read.field);
166
+ chips.set(model.id, set);
167
+ }
168
+ }
169
+ }
170
+ });
171
+ apps.forEach((app, appIndex) => {
172
+ for (const mapping of controlMappings(app)) {
173
+ const queryId = `query:${appIndex}/${mapping.to.name}`;
174
+ if (!nodes.has(queryId)) continue;
175
+ const name = mapping.from.name;
176
+ const controlId = `control:${appIndex}/${name}`;
177
+ const control = app.controls[name];
178
+ const isSet = (control?.appliedCondition?.values?.length ?? 0) > 0;
179
+ const value = isSet ? formatCondition(control?.appliedCondition) : "not set";
180
+ const typed = control?.condition?.values?.length ? formatCondition(control.condition) : "not set";
181
+ node({
182
+ id: controlId,
183
+ kind: "control",
184
+ label: name,
185
+ name: appName(app, appIndex),
186
+ structureKey: controlNodes.get(`${appIndex}/${name}`)?.key,
187
+ isSet,
188
+ value,
189
+ pending: control?.isDirty && typed !== value ? typed : void 0
190
+ });
191
+ const fields = queryFields.get(queryId);
192
+ edge(controlId, queryId, fields?.size ? fields : [queryId], { kind: "control", active: isSet });
193
+ }
194
+ });
195
+ apps.forEach((app, appIndex) => {
196
+ for (const cross of crossFilters(app)) {
197
+ const source = `query:${appIndex}/${cross.from.name}`;
198
+ const target = `query:${appIndex}/${cross.to.name}`;
199
+ if (!nodes.has(source) || !nodes.has(target)) continue;
200
+ const fields = queryFields.get(target);
201
+ edge(source, target, fields?.size ? fields : [target], {
202
+ id: `crossFilter:${appIndex}/${cross.id}`,
203
+ kind: "crossFilter",
204
+ active: app.appliedSelection?.source === cross.from.name
205
+ });
206
+ }
207
+ });
208
+ const blocks = blocksOf(structure?.nodes ?? []);
209
+ for (const [usageKey, usage] of Object.entries(structure?.usage ?? {})) {
210
+ if (!usageKey.startsWith("query:")) continue;
211
+ for (const id of usage.blocks) blocks.get(id)?.queries.add(usageKey.slice("query:".length));
212
+ }
213
+ for (const [id, { node: structureNode, queries }] of blocks) {
214
+ const drawn = [...queries].filter((q) => nodes.has(`query:${q}`));
215
+ if (drawn.length === 0) continue;
216
+ const blockId = `block:${id}`;
217
+ node({ id: blockId, kind: "block", label: structureNode.label ?? id, name: id, structureKey: structureNode.key });
218
+ for (const q of drawn) {
219
+ const queryId = `query:${q}`;
220
+ const fields = queryFields.get(queryId);
221
+ edge(blockId, queryId, fields?.size ? fields : [queryId]);
222
+ }
223
+ }
224
+ for (const e of edges.values()) {
225
+ if (!e.target.startsWith("table:")) continue;
226
+ const into = [...edges.values()].filter((x) => x.target === e.source).flatMap((x) => x.fields);
227
+ e.fields = [...new Set(into)];
228
+ }
229
+ for (const [id, set] of chips) {
230
+ const model = nodes.get(id);
231
+ if (model) model.chips = [...set].sort();
232
+ }
233
+ return { nodes: [...nodes.values()], edges: [...edges.values()] };
234
+ }
235
+ function showsCrossFilters(view) {
236
+ return view.crossFilters && !view.hidden.has("query");
237
+ }
238
+ function filterGraph(graph, view) {
239
+ const { hidden } = view;
240
+ const dropCross = !showsCrossFilters(view);
241
+ if (hidden.size === 0 && !dropCross) return graph;
242
+ let nodes = graph.nodes;
243
+ let edges = dropCross ? graph.edges.filter((e) => e.kind !== "crossFilter") : graph.edges;
244
+ for (const removed of graph.nodes.filter((n) => hidden.has(n.kind))) {
245
+ const into = edges.filter((e) => e.target === removed.id);
246
+ const out = edges.filter((e) => e.source === removed.id);
247
+ const kept = new Map(edges.filter((e) => e.source !== removed.id && e.target !== removed.id).map((e) => [e.id, e]));
248
+ const put = (e) => {
249
+ const existing = kept.get(e.id);
250
+ if (!existing) {
251
+ kept.set(e.id, e);
252
+ } else if (existing.kind === e.kind) {
253
+ kept.set(e.id, {
254
+ ...existing,
255
+ fields: [.../* @__PURE__ */ new Set([...existing.fields, ...e.fields])],
256
+ ...e.kind ? { active: Boolean(existing.active || e.active) } : {}
257
+ });
258
+ } else if (e.kind) {
259
+ put({ ...e, id: `${e.source}->${e.target}:${e.kind}` });
260
+ } else {
261
+ kept.set(e.id, e);
262
+ put({ ...existing, id: `${existing.source}->${existing.target}:${existing.kind}` });
263
+ }
264
+ };
265
+ for (const a of into) {
266
+ for (const b of out) {
267
+ const fields = a.fields.length === 0 ? b.fields : b.fields.length === 0 ? a.fields : a.fields.filter((f) => b.fields.includes(f));
268
+ if (fields.length === 0 && a.fields.length && b.fields.length) continue;
269
+ const from = a.kind ? a : b;
270
+ put({
271
+ id: `${a.source}->${b.target}`,
272
+ source: a.source,
273
+ target: b.target,
274
+ fields,
275
+ ...from.kind ? { kind: from.kind, active: from.active } : {}
276
+ });
277
+ }
278
+ }
279
+ nodes = nodes.filter((n) => n.id !== removed.id);
280
+ edges = [...kept.values()];
281
+ }
282
+ return { nodes, edges };
283
+ }
284
+ function pathOf(graph, id) {
285
+ const filtersOut = (e) => e.source === id && e.kind === "crossFilter";
286
+ const incident = graph.edges.filter((e) => (e.source === id || e.target === id) && !filtersOut(e));
287
+ const carried = new Set(incident.flatMap((e) => e.fields));
288
+ const node = graph.nodes.find((n) => n.id === id);
289
+ if (node?.kind === "metric" || node?.kind === "dimension") carried.add(id);
290
+ const follows = (e) => filtersOut(e) || e.fields.length === 0 || e.fields.some((f) => carried.has(f));
291
+ const edges = /* @__PURE__ */ new Set();
292
+ const filtered = /* @__PURE__ */ new Set();
293
+ const walk = (from, down, seen) => {
294
+ for (const e of graph.edges) {
295
+ if ((down ? e.source : e.target) !== from || !follows(e)) continue;
296
+ edges.add(e.id);
297
+ const next = down ? e.target : e.source;
298
+ if (down && e.kind === "crossFilter") {
299
+ filtered.add(next);
300
+ continue;
301
+ }
302
+ if (seen.has(next)) continue;
303
+ seen.add(next);
304
+ walk(next, down, seen);
305
+ }
306
+ return seen;
307
+ };
308
+ const nodes = /* @__PURE__ */ new Set([...walk(id, true, /* @__PURE__ */ new Set([id])), ...walk(id, false, /* @__PURE__ */ new Set([id])), ...filtered]);
309
+ return { nodes, edges };
310
+ }
311
+ function focusGraph(graph, id) {
312
+ if (!graph.nodes.some((n) => n.id === id)) return graph;
313
+ const path = pathOf(graph, id);
314
+ return {
315
+ nodes: graph.nodes.filter((n) => path.nodes.has(n.id)),
316
+ edges: graph.edges.filter((e) => path.edges.has(e.id))
317
+ };
318
+ }
319
+ var LINEAGE_PRESETS = [
320
+ { id: "default", label: "Default", hidden: [], crossFilters: false },
321
+ { id: "everything", label: "Everything", hidden: [], crossFilters: true },
322
+ { id: "interaction", label: "Interaction mapping", hidden: ["metric", "dimension", "dataset", "model", "table"], crossFilters: true },
323
+ { id: "query", label: "Query lineage", hidden: ["control"], crossFilters: false }
324
+ ];
325
+ function matchPreset(view) {
326
+ return LINEAGE_PRESETS.find((p) => p.crossFilters === view.crossFilters && p.hidden.length === view.hidden.size && p.hidden.every((k) => view.hidden.has(k)));
327
+ }
328
+ function hiddenCount(view, counts, crossFilterCount) {
329
+ const kinds = LINEAGE_KINDS.filter((k) => counts[k] && view.hidden.has(k)).length;
330
+ return kinds + (crossFilterCount > 0 && !showsCrossFilters(view) ? 1 : 0);
331
+ }
332
+ function orderForLayout(graph) {
333
+ const links = graph.edges.filter((e) => e.kind === "crossFilter");
334
+ if (links.length === 0) return graph.nodes;
335
+ const next = /* @__PURE__ */ new Map();
336
+ for (const { source, target } of links) {
337
+ next.set(source, [...next.get(source) ?? [], target]);
338
+ next.set(target, [...next.get(target) ?? [], source]);
339
+ }
340
+ const queries = graph.nodes.filter((n) => n.kind === "query");
341
+ const placed = /* @__PURE__ */ new Set();
342
+ const ordered = [];
343
+ const visit = (n) => {
344
+ if (placed.has(n.id)) return;
345
+ placed.add(n.id);
346
+ ordered.push(n);
347
+ for (const id of next.get(n.id) ?? []) {
348
+ const linked = queries.find((q) => q.id === id);
349
+ if (linked) visit(linked);
350
+ }
351
+ };
352
+ queries.forEach(visit);
353
+ return graph.nodes.map((n) => n.kind === "query" ? ordered.shift() : n);
354
+ }
355
+
356
+ // src/plugins/lineage/state.ts
357
+ var states = /* @__PURE__ */ new WeakMap();
358
+ function stateOf(mount) {
359
+ let state = states.get(mount);
360
+ if (!state) {
361
+ state = createState();
362
+ states.set(mount, state);
363
+ }
364
+ return state;
365
+ }
366
+ function dropState(mount) {
367
+ states.delete(mount);
368
+ }
369
+ var traceKey = (targets) => targets.map(targetKey).sort().join("|");
370
+ function createState() {
371
+ const listeners = /* @__PURE__ */ new Set();
372
+ const changed = () => listeners.forEach((listener) => {
373
+ try {
374
+ listener();
375
+ } catch {
376
+ }
377
+ });
378
+ let trace;
379
+ const state = {
380
+ get trace() {
381
+ return trace;
382
+ },
383
+ view: { hidden: /* @__PURE__ */ new Set(), crossFilters: false },
384
+ traceFor(targets, run, retry) {
385
+ const key = traceKey(targets);
386
+ if (trace?.key === key && (trace.status !== "failed" || !retry)) return;
387
+ if (targets.length === 0) {
388
+ trace = { key, status: "ready", traced: /* @__PURE__ */ new Map() };
389
+ return;
390
+ }
391
+ trace = { key, status: "loading", traced: /* @__PURE__ */ new Map() };
392
+ run([...targets]).then(
393
+ (result) => {
394
+ if (trace?.key !== key) return;
395
+ trace = { key, status: "ready", traced: new Map(result.results.map((r) => [targetKey(r.target), r])) };
396
+ changed();
397
+ },
398
+ (error) => {
399
+ if (trace?.key !== key) return;
400
+ trace = { key, status: "failed", traced: /* @__PURE__ */ new Map(), error: error instanceof Error ? error.message : String(error) };
401
+ changed();
402
+ }
403
+ );
404
+ },
405
+ changed,
406
+ subscribe(listener) {
407
+ listeners.add(listener);
408
+ return () => {
409
+ listeners.delete(listener);
410
+ };
411
+ }
412
+ };
413
+ return state;
414
+ }
415
+
416
+ export {
417
+ LINEAGE_KINDS,
418
+ lineageTargets,
419
+ buildLineageGraph,
420
+ showsCrossFilters,
421
+ filterGraph,
422
+ pathOf,
423
+ focusGraph,
424
+ LINEAGE_PRESETS,
425
+ matchPreset,
426
+ hiddenCount,
427
+ orderForLayout,
428
+ stateOf,
429
+ dropState,
430
+ traceKey
431
+ };