fix: refactored code

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
omkarht
2025-07-29 16:59:02 +05:30
parent 1988dfc956
commit 5dd748148f
3 changed files with 4 additions and 5 deletions

View File

@@ -41,7 +41,6 @@ export class ArchitectureDB implements DiagramDB {
private groups: Record<string, ArchitectureGroup> = {};
private edges: ArchitectureEdge[] = [];
private registeredIds: Record<string, 'node' | 'group'> = {};
// private config: Required<ArchitectureDiagramConfig> = DEFAULT_ARCHITECTURE_CONFIG;
private dataStructures?: ArchitectureState['dataStructures'];
private elements: Record<string, D3Element> = {};
@@ -184,7 +183,7 @@ export class ArchitectureDB implements DiagramDB {
`The left-hand id [${lhsId}] does not yet exist. Please create the service/group before declaring an edge to it.`
);
}
if (this.nodes[rhsId] === undefined && this.groups[lhsId] === undefined) {
if (this.nodes[rhsId] === undefined && this.groups[rhsId] === undefined) {
throw new Error(
`The right-hand id [${rhsId}] does not yet exist. Please create the service/group before declaring an edge to it.`
);

View File

@@ -10,7 +10,7 @@ const populateDb = (ast: Architecture, db: ArchitectureDB) => {
ast.groups.map((group) => db.addGroup(group));
ast.services.map((service) => db.addService({ ...service, type: 'service' }));
ast.junctions.map((service) => db.addJunction({ ...service, type: 'junction' }));
// @ts-ignore ToDo our parser guarantees the type is L/R/T/B and not string. How to change to union type?
// @ts-ignore TODO our parser guarantees the type is L/R/T/B and not string. How to change to union type?
ast.edges.map((edge) => db.addEdge(edge));
};

View File

@@ -191,7 +191,7 @@ function getAlignments(
prev[dir] ??= [];
prev[dir] = [...prev[dir], ...aNodeIds, ...bNodeIds]; // add the node ids of both groups to the axis array in prev
} else if (aGroupId === 'default' || bGroupId === 'default') {
// If either of the groups are in the default space (not in a group), use the same behaviour as above
// If either of the groups are in the default space (not in a group), use the same behavior as above
prev[dir] ??= [];
prev[dir] = [...prev[dir], ...aNodeIds, ...bNodeIds];
} else {