Skip to content

Edge

reference
1 min readUpdated

Kind: Interface

Source: packages/core/inspector/interfaces/edge.interface.ts

Part of: Core

Edge represents a directed relationship between two entities in the inspector graph. It identifies the connection, its source and target node IDs, and metadata describing whether the relationship is module-to-module or class-to-class.

Properties

PropertyType
idstring
sourcestring
targetstring
metadata`ModuleToModuleEdgeMetadata

Diagram

mermaid
graph LR
  Source["Source entity<br/>(source)"] --> Edge["Edge<br/>id + metadata"] --> Target["Target entity<br/>(target)"]
  Edge --- Metadata["ModuleToModuleEdgeMetadata<br/>or ClassToClassEdgeMetadata"]

Usage

ts
import type { Edge } from '@core/inspector/interfaces/edge.interface';

const moduleDependency: Edge = {
  id: 'app-module->users-module',
  source: 'app-module',
  target: 'users-module',
  metadata: {
    type: 'module-to-module',
    // Additional ModuleToModuleEdgeMetadata fields
  },
};

// Use the edge when constructing an inspector dependency graph.
graph.edges.push(moduleDependency);

AI Coding Instructions

  • Use stable, unique id values so graph edges can be reliably indexed, updated, and rendered.
  • Ensure source and target reference valid node IDs already present in the inspector graph.
  • Provide metadata that matches the relationship type: ModuleToModuleEdgeMetadata for module dependencies and ClassToClassEdgeMetadata for class relationships.
  • Treat edges as directed: source -> target may not represent the same relationship as target -> source.
  • Keep edge metadata aligned with the graph consumer’s expected discriminators and rendering logic.

Relationships

  • IMPORTS → InjectionToken

Was this page helpful?

Download as PDF
Edge — NestJS head-to-head