- Before:
domain-types.tsimportedLowHighfromneo4j-types.ts, andneo4j-types.tsimported domain types - After: Domain types use
numberinstead ofLowHigh. Conversion happens at DB boundary indataAdapter.ts - Files Changed:
lib/papers/model/domain-types.ts- Now usesnumberforitemIDandgraphLevellib/neo4j/neo4j-types.ts- Imports domain types (one-way dependency)
- Moved:
RawNodeandRawRelationshipfrommodel/GraphDataModel.tstolib/neo4j/neo4j-types.ts - Files Changed:
lib/neo4j/neo4j-types.ts- Now contains all Neo4j driver typesmodel/GraphDataModel.ts- Removed duplicate definitionslib/papers/model/dataAdapter.ts- Updated to import fromneo4j-types.ts
- Clarified Purpose:
lib/papers/model/GraphDataModel.ts- DTO types for API responses (used bydataAdapter.ts)model/GraphDataModel.ts- D3 visualization types (used by components)
- Updated: Both files now use
numberinstead ofLowHighin their type definitions - Files Changed:
lib/papers/model/GraphDataModel.ts- UpdatedPaperNodeTypePropsto usenumbermodel/GraphDataModel.ts- UpdatedPaperNodeType.propsto usenumber
- Updated all
.lowaccesses to use direct number values:model/store/richDataStore.tslib/state/selectionUtils.tslib/state/selectionReducer.tscomponents/filter/filterUtils.tscomponents/filter/FilterPanel.tsxcomponents/graphs/hierarchy/utils/NodeRenderHelper.tscomponents/graphs/hierarchy/HierarchyRenders.ts
- Conversion Logic: All LowHigh → number conversions happen in
dataAdapter.tsat the DB boundary
Pure Neo4j driver structures:
LowHigh- Neo4j integer representationRawNode- Raw Neo4j node structureRawRelationship- Raw Neo4j relationship structureField- Neo4j field wrapper (uses domain types)DBRecord- Raw Neo4j record structure
Business entities (database-agnostic):
PaperFieldProps- Paper entity properties (usesnumber, notLowHigh)CollectionFieldProps- Collection entity properties (usesnumber, notLowHigh)
API response structures:
PaperNodeType- Paper node for API responsesTopicNodeType- Topic node for API responsesEdgeType- Edge for API responsesGraphData- Complete graph data structure returned from API
D3.js visualization structures:
PaperNodeType- Paper node with x, y coordinates for visualizationBranchNodeByD3- D3 hierarchy node structureEdge- Graph edge with D3 referencesTreeNode- Tree structure for hierarchyGraphData- Graph data for visualizationEdgeKind,NodeKind- Enums for graph types
All LowHigh → number conversions happen at the DB boundary in:
lib/papers/model/dataAdapter.ts- Converts raw Neo4j records to domain/API typeslib/papers/model/HierarchyPositioning.ts- Converts raw Neo4j structures for hierarchy
- No Circular Dependencies: Domain types are independent of DB types
- Clear Separation: DB, Domain, Graph, and DTO types are clearly separated
- Type Safety: Conversions are explicit at boundaries
- Maintainability: Each layer has clear responsibilities