1 | import { Subject } from "./Subject";
|
2 | import { EntityMetadata } from "../metadata/EntityMetadata";
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export declare class SubjectTopoligicalSorter {
|
8 | |
9 |
|
10 |
|
11 | subjects: Subject[];
|
12 | |
13 |
|
14 |
|
15 | metadatas: EntityMetadata[];
|
16 | constructor(subjects: Subject[]);
|
17 | /**
|
18 | * Sorts (orders) subjects in their topological order.
|
19 | */
|
20 | sort(direction: "insert" | "delete"): Subject[];
|
21 | /**
|
22 | * Removes already sorted subjects from this.subjects list of subjects.
|
23 | */
|
24 | protected removeAlreadySorted(subjects: Subject[]): void;
|
25 | /**
|
26 | * Extracts all unique metadatas from the given subjects.
|
27 | */
|
28 | protected getUniqueMetadatas(subjects: Subject[]): EntityMetadata[];
|
29 | /**
|
30 | * Gets dependency tree for all entity metadatas with non-nullable relations.
|
31 | * We need to execute insertions first for entities which non-nullable relations.
|
32 | */
|
33 | protected getNonNullableDependencies(): string[][];
|
34 | /**
|
35 | * Gets dependency tree for all entity metadatas with non-nullable relations.
|
36 | * We need to execute insertions first for entities which non-nullable relations.
|
37 | */
|
38 | protected getDependencies(): string[][];
|
39 | /**
|
40 | * Sorts given graph using topological sorting algorithm.
|
41 | *
|
42 | * Algorithm is kindly taken from https://github.com/marcelklehr/toposort repository.
|
43 | */
|
44 | protected toposort(edges: any[][]): any[];
|
45 | }
|