import { addUniqueId } from './addUniqueId' ; import { extractInitialSequence } from './extractInitialSequence' ; import { FlattenedApiList , DecisionTree , TreeNodeRaw } from './interfaces' ; import { decisionTreeReducer } from './decisionTreeReducer' ; export param { FlattenedApiList } apiList param { Tree } tree requires requires requires returns { DecisionTree } export function build ( apiList , tree ) { const nodesWithUniqueIds = addUniqueId ( tree ) ; const initialOption = extractInitialSequence ( nodesWithUniqueIds ) ; return { ... decisionTreeReducer ( nodesWithUniqueIds , apiList ) , [ initialOption . id ] : { ... initialOption } } ; }