TypeScript type definitions for the Graph Entity ecosystem. Provides core interfaces and types for graph nodes, edges, and graph management, designed for use with the @luolapeikko/graph-entity package or similar graph-based systems.
npm install @luolapeikko/graph-entity-types
or with pnpm:
pnpm add @luolapeikko/graph-entity-types
This package contains reusable TypeScript types and interfaces for building strongly-typed graph data structures and event-driven graph managers.
IGraphBaseEntityNode – Base interface for a graph nodeIGraphEventEntityNode – Node interface with event supportGraphNodeEventMapping – Node event mapping typeGraphEdge – Type for graph edgesGraphManagerEventMapping – Event mapping for graph managersGraphStructure – Recursive type for graph structureGraphEdgeStructure – Recursive type for edge structureIGraphManager – Interface for a graph managerimport type { IGraphBaseEntityNode, GraphEdge } from '@luolapeikko/graph-entity-types';
// Define a node type
type MyNode = IGraphBaseEntityNode<1, { label: string }>;
const nodeA: MyNode = {
nodeType: 1,
nodeId: 'cf9cda0d-b479-4e07-b2bd-695c161d71db',
getNodeProps: () => ({ label: 'Node A' }),
};
const nodeB: MyNode = {
nodeType: 1,
nodeId: 'b4794e07-b2bd-695c-161d71dbcf9cda0d',
getNodeProps: () => ({ label: 'Node B' }),
};
const edge: GraphEdge<MyNode> = { source: nodeA, target: nodeB };
See more features on Package documentation