|
| 1 | +import React from 'react' |
| 2 | + |
| 3 | +import { |
| 4 | + type AdjacencyListColumnKey, |
| 5 | + type AdjacencyListKey, |
| 6 | + type PortId, |
| 7 | +} from '../utils' |
| 8 | + |
| 9 | +export type LineageColumn = { |
| 10 | + source?: string | null |
| 11 | + expression?: string | null |
| 12 | + models: Record<string, string[]> |
| 13 | +} |
| 14 | + |
| 15 | +export type ColumnLevelModelConnections = Record< |
| 16 | + AdjacencyListKey, |
| 17 | + AdjacencyListKey[] |
| 18 | +> |
| 19 | +export type ColumnLevelDetails = Omit<LineageColumn, 'models'> & { |
| 20 | + models: ColumnLevelModelConnections |
| 21 | +} |
| 22 | +export type ColumnLevelConnections = Record< |
| 23 | + AdjacencyListColumnKey, |
| 24 | + ColumnLevelDetails |
| 25 | +> |
| 26 | +export type ColumnLevelLineageAdjacencyList = Record< |
| 27 | + AdjacencyListKey, |
| 28 | + ColumnLevelConnections |
| 29 | +> |
| 30 | + |
| 31 | +export type ColumnLevelLineageContextValue = { |
| 32 | + adjacencyListColumnLevel: ColumnLevelLineageAdjacencyList |
| 33 | + selectedColumns: Set<PortId> |
| 34 | + columnLevelLineage: Map<PortId, ColumnLevelLineageAdjacencyList> |
| 35 | + setColumnLevelLineage: React.Dispatch< |
| 36 | + React.SetStateAction<Map<PortId, ColumnLevelLineageAdjacencyList>> |
| 37 | + > |
| 38 | + showColumns: boolean |
| 39 | + setShowColumns: React.Dispatch<React.SetStateAction<boolean>> |
| 40 | + fetchingColumns: Set<PortId> |
| 41 | + setFetchingColumns: React.Dispatch<React.SetStateAction<Set<PortId>>> |
| 42 | +} |
| 43 | + |
| 44 | +export const initial = { |
| 45 | + adjacencyListColumnLevel: {}, |
| 46 | + selectedColumns: new Set<PortId>(), |
| 47 | + columnLevelLineage: new Map<PortId, ColumnLevelLineageAdjacencyList>(), |
| 48 | + setColumnLevelLineage: () => {}, |
| 49 | + showColumns: false, |
| 50 | + setShowColumns: () => {}, |
| 51 | + fetchingColumns: new Set<PortId>(), |
| 52 | + setFetchingColumns: () => {}, |
| 53 | +} |
| 54 | + |
| 55 | +export type ColumnLevelLineageContextHook = () => ColumnLevelLineageContextValue |
0 commit comments