UNPKG

2.36 kBTypeScriptView Raw
1/**
2 * This source code is from https://github.com/jriecken/dependency-graph
3 * Just added "any" types here, wrapper everything into exported class.
4 * We cant use a package itself because we want to package "everything-in-it" for the frontend users of TypeORM.
5 */
6export declare class DepGraph {
7 nodes: any;
8 outgoingEdges: any;
9 incomingEdges: any;
10 /**
11 * Add a node to the dependency graph. If a node already exists, this method will do nothing.
12 */
13 addNode(node: any, data?: any): void;
14 /**
15 * Remove a node from the dependency graph. If a node does not exist, this method will do nothing.
16 */
17 removeNode(node: any): void;
18 /**
19 * Check if a node exists in the graph
20 */
21 hasNode(node: any): any;
22 /**
23 * Get the data associated with a node name
24 */
25 getNodeData(node: any): any;
26 /**
27 * Set the associated data for a given node name. If the node does not exist, this method will throw an error
28 */
29 setNodeData(node: any, data: any): void;
30 /**
31 * Add a dependency between two nodes. If either of the nodes does not exist,
32 * an Error will be thrown.
33 */
34 addDependency(from: any, to: any): boolean;
35 /**
36 * Remove a dependency between two nodes.
37 */
38 removeDependency(from: any, to: any): void;
39 /**
40 * Get an array containing the nodes that the specified node depends on (transitively).
41 *
42 * Throws an Error if the graph has a cycle, or the specified node does not exist.
43 *
44 * If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned
45 * in the array.
46 */
47 dependenciesOf(node: any, leavesOnly: any): any[];
48 /**
49 * get an array containing the nodes that depend on the specified node (transitively).
50 *
51 * Throws an Error if the graph has a cycle, or the specified node does not exist.
52 *
53 * If `leavesOnly` is true, only nodes that do not have any dependants will be returned in the array.
54 */
55 dependantsOf(node: any, leavesOnly: any): any[];
56 /**
57 * Construct the overall processing order for the dependency graph.
58 *
59 * Throws an Error if the graph has a cycle.
60 *
61 * If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned.
62 */
63 overallOrder(leavesOnly?: any): any[];
64}