/** * A graph data. * * @public */ export interface GraphData { edges: GraphEdge[]; topic_vertices: GraphVertex[]; vertices: GraphVertex[]; } /** * A graph edge. * * @public */ export interface GraphEdge { out_name: string; in: string; out: string; } /** * A graph vertex. * * @public */ export interface GraphVertex { instanceId: string; [key: string]: any; } /** * A graph query. * * @public */ export interface GraphQuery { sort?: { key: string; order: 1 | -1; }; } /** * 将{@link http://192.168.100.162/next/developers/providers/cmdb/instance-graph-api-traverse-graph | 图遍历查询接口}返回的图数据转换为树结构数据。 * * @category Others * * @public * * @example * * ```ts * const data: GraphData = { * topic_vertices: [ * { * instanceId: "1", * name: "A", * }, * { * instanceId: "2", * name: "B", * } * ], * vertices: [ * { * instanceId: "3", * name: "C", * }, * { * instanceId: "4", * name: "D", * } * ], * edges: [ * { * out: "1", * in: "3", * out_name: "children", * }, * { * out: "2", * in: "4", * out_name: "children", * } * ] * } * graphTree(data) * // Returns: * // [ * // {instanceId: "1", name: "A", children: [{instanceId: "3", name: "C"}]}, * // {instanceId: "2", name: "B", children: [{instanceId: "4", name: "D"}]} * // ] * ``` * * @param value - 图数据。 * @param query - 图查询条件及排序等。 * * @returns 树结构数据。 */ export declare function graphTree(value: GraphData, query?: GraphQuery): GraphVertex[]; //# sourceMappingURL=graphTree.d.ts.map