import { StructureNodeDef } from "../parser/definition/types/StructureNodeDef"; import { convertChildNodesPropsToChildNodes } from "./convertChildNodesPropsToChildNodes"; import { convertConnectionsToChildConnections } from "./convertConnectionsToChildConnections"; import { RootNode } from "./types/RootNode"; import { getRootNodeName } from "./utils/getRootNodeName"; export function convertMainDefToLegacyRoot(mainDef?: StructureNodeDef<{}, {}, any>): RootNode { if (mainDef) { return { id: getRootNodeName(), name: getRootNodeName(), description: "Hosts the application.", childNodes: convertChildNodesPropsToChildNodes(mainDef.childNodesProps), childConnections: convertConnectionsToChildConnections(mainDef.connections) } } return { id: getRootNodeName(), name: getRootNodeName(), description: "Hosts the application.", childConnections: [], childNodes: {} } }