1 | import { ColumnMetadata } from "./ColumnMetadata";
|
2 | import { RelationMetadata } from "./RelationMetadata";
|
3 | import { EntityMetadata } from "./EntityMetadata";
|
4 | import { EmbeddedMetadataArgs } from "../metadata-args/EmbeddedMetadataArgs";
|
5 | import { RelationIdMetadata } from "./RelationIdMetadata";
|
6 | import { RelationCountMetadata } from "./RelationCountMetadata";
|
7 | import { Connection } from "../connection/Connection";
|
8 | import { EntityListenerMetadata } from "./EntityListenerMetadata";
|
9 | import { IndexMetadata } from "./IndexMetadata";
|
10 | import { UniqueMetadata } from "./UniqueMetadata";
|
11 | /**
|
12 | * Contains all information about entity's embedded property.
|
13 | */
|
14 | export declare class EmbeddedMetadata {
|
15 | /**
|
16 | * Entity metadata where this embedded is.
|
17 | */
|
18 | entityMetadata: EntityMetadata;
|
19 | /**
|
20 | * Parent embedded in the case if this embedded inside other embedded.
|
21 | */
|
22 | parentEmbeddedMetadata?: EmbeddedMetadata;
|
23 | /**
|
24 | * Embedded target type.
|
25 | */
|
26 | type: Function;
|
27 | /**
|
28 | * Property name on which this embedded is attached.
|
29 | */
|
30 | propertyName: string;
|
31 | /**
|
32 | * Gets full path to this embedded property (including embedded property name).
|
33 | * Full path is relevant when embedded is used inside other embeds (one or multiple nested).
|
34 | * For example it will return "counters.subcounters".
|
35 | */
|
36 | propertyPath: string;
|
37 | /**
|
38 | * Columns inside this embed.
|
39 | */
|
40 | columns: ColumnMetadata[];
|
41 | /**
|
42 | * Relations inside this embed.
|
43 | */
|
44 | relations: RelationMetadata[];
|
45 | /**
|
46 | * Entity listeners inside this embed.
|
47 | */
|
48 | listeners: EntityListenerMetadata[];
|
49 | /**
|
50 | * Indices applied to the embed columns.
|
51 | */
|
52 | indices: IndexMetadata[];
|
53 | /**
|
54 | * Uniques applied to the embed columns.
|
55 | */
|
56 | uniques: UniqueMetadata[];
|
57 | /**
|
58 | * Relation ids inside this embed.
|
59 | */
|
60 | relationIds: RelationIdMetadata[];
|
61 | /**
|
62 | * Relation counts inside this embed.
|
63 | */
|
64 | relationCounts: RelationCountMetadata[];
|
65 | /**
|
66 | * Nested embeddable in this embeddable (which has current embedded as parent embedded).
|
67 | */
|
68 | embeddeds: EmbeddedMetadata[];
|
69 | /**
|
70 | * Indicates if this embedded is in array mode.
|
71 | *
|
72 | * This option works only in mongodb.
|
73 | */
|
74 | isArray: boolean;
|
75 | /**
|
76 | * Prefix of the embedded, used instead of propertyName.
|
77 | * If set to empty string or false, then prefix is not set at all.
|
78 | */
|
79 | customPrefix: string | boolean | undefined;
|
80 | /**
|
81 | * Gets the prefix of the columns.
|
82 | * By default its a property name of the class where this prefix is.
|
83 | * But if custom prefix is set then it takes its value as a prefix.
|
84 | * However if custom prefix is set to empty string or false, then prefix to column is not applied at all.
|
85 | */
|
86 | prefix: string;
|
87 | /**
|
88 | * Returns array of property names of current embed and all its parent embeds.
|
89 | *
|
90 | * example: post[data][information][counters].id where "data", "information" and "counters" are embeds
|
91 | * we need to get value of "id" column from the post real entity object.
|
92 | * this method will return ["data", "information", "counters"]
|
93 | */
|
94 | parentPropertyNames: string[];
|
95 | /**
|
96 | * Returns array of prefixes of current embed and all its parent embeds.
|
97 | */
|
98 | parentPrefixes: string[];
|
99 | /**
|
100 | * Returns embed metadatas from all levels of the parent tree.
|
101 | *
|
102 | * example: post[data][information][counters].id where "data", "information" and "counters" are embeds
|
103 | * this method will return [embed metadata of data, embed metadata of information, embed metadata of counters]
|
104 | */
|
105 | embeddedMetadataTree: EmbeddedMetadata[];
|
106 | /**
|
107 | * Embed metadatas from all levels of the parent tree.
|
108 | *
|
109 | * example: post[data][information][counters].id where "data", "information" and "counters" are embeds
|
110 | * this method will return [embed metadata of data, embed metadata of information, embed metadata of counters]
|
111 | */
|
112 | columnsFromTree: ColumnMetadata[];
|
113 | /**
|
114 | * Relations of this embed and all relations from its child embeds.
|
115 | */
|
116 | relationsFromTree: RelationMetadata[];
|
117 | /**
|
118 | * Relations of this embed and all relations from its child embeds.
|
119 | */
|
120 | listenersFromTree: EntityListenerMetadata[];
|
121 | /**
|
122 | * Indices of this embed and all indices from its child embeds.
|
123 | */
|
124 | indicesFromTree: IndexMetadata[];
|
125 | /**
|
126 | * Uniques of this embed and all uniques from its child embeds.
|
127 | */
|
128 | uniquesFromTree: UniqueMetadata[];
|
129 | /**
|
130 | * Relation ids of this embed and all relation ids from its child embeds.
|
131 | */
|
132 | relationIdsFromTree: RelationIdMetadata[];
|
133 | /**
|
134 | * Relation counts of this embed and all relation counts from its child embeds.
|
135 | */
|
136 | relationCountsFromTree: RelationCountMetadata[];
|
137 | constructor(options: {
|
138 | entityMetadata: EntityMetadata;
|
139 | args: EmbeddedMetadataArgs;
|
140 | });
|
141 | /**
|
142 | * Creates a new embedded object.
|
143 | */
|
144 | create(): any;
|
145 | build(connection: Connection): this;
|
146 | protected buildPartialPrefix(): string[];
|
147 | protected buildPrefix(connection: Connection): string;
|
148 | protected buildParentPropertyNames(): string[];
|
149 | protected buildParentPrefixes(): string[];
|
150 | protected buildEmbeddedMetadataTree(): EmbeddedMetadata[];
|
151 | protected buildColumnsFromTree(): ColumnMetadata[];
|
152 | protected buildRelationsFromTree(): RelationMetadata[];
|
153 | protected buildListenersFromTree(): EntityListenerMetadata[];
|
154 | protected buildIndicesFromTree(): IndexMetadata[];
|
155 | protected buildUniquesFromTree(): UniqueMetadata[];
|
156 | protected buildRelationIdsFromTree(): RelationIdMetadata[];
|
157 | protected buildRelationCountsFromTree(): RelationCountMetadata[];
|
158 | }
|