ChainGraph API Documentation / @badaitech/chaingraph-types / buildTree
Function: buildTree()
buildTree<
TNode,TEntity>(nodes,entities,getEntityNodeId):TreeStructure<TNode,TEntity>
Defined in: packages/chaingraph-types/src/hierarchy/tree-builder.ts:20
Builds a tree structure from flat arrays of nodes and entities Generic function that works with any node/entity type
Type Parameters
TNode
TNode extends ITreeNode<Record<string, any>>
TEntity
TEntity
Parameters
nodes
TNode[]
Flat array of tree nodes (folders, groups, categories)
entities
TEntity[]
Flat array of entities (flows, servers, items)
getEntityNodeId
(entity) => string | null
Function to extract parent node ID from entity
Returns
TreeStructure<TNode, TEntity>
Tree structure ready for UI rendering