@mikro-orm/core 7.0.0-dev.3 → 7.0.0-dev.300
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/EntityManager.d.ts +114 -63
- package/EntityManager.js +385 -310
- package/MikroORM.d.ts +44 -35
- package/MikroORM.js +109 -143
- package/README.md +3 -2
- package/cache/FileCacheAdapter.d.ts +1 -1
- package/cache/FileCacheAdapter.js +17 -8
- package/cache/GeneratedCacheAdapter.d.ts +0 -1
- package/cache/GeneratedCacheAdapter.js +0 -2
- package/cache/index.d.ts +0 -1
- package/cache/index.js +0 -1
- package/connections/Connection.d.ts +16 -7
- package/connections/Connection.js +23 -14
- package/drivers/DatabaseDriver.d.ts +25 -16
- package/drivers/DatabaseDriver.js +119 -36
- package/drivers/IDatabaseDriver.d.ts +125 -23
- package/entity/BaseEntity.d.ts +63 -4
- package/entity/BaseEntity.js +0 -3
- package/entity/Collection.d.ts +102 -31
- package/entity/Collection.js +446 -108
- package/entity/EntityAssigner.d.ts +1 -1
- package/entity/EntityAssigner.js +26 -18
- package/entity/EntityFactory.d.ts +13 -1
- package/entity/EntityFactory.js +106 -60
- package/entity/EntityHelper.d.ts +2 -2
- package/entity/EntityHelper.js +65 -20
- package/entity/EntityLoader.d.ts +13 -11
- package/entity/EntityLoader.js +257 -107
- package/entity/EntityRepository.d.ts +28 -8
- package/entity/EntityRepository.js +8 -2
- package/entity/PolymorphicRef.d.ts +12 -0
- package/entity/PolymorphicRef.js +18 -0
- package/entity/Reference.d.ts +9 -12
- package/entity/Reference.js +34 -9
- package/entity/WrappedEntity.d.ts +3 -8
- package/entity/WrappedEntity.js +3 -8
- package/entity/defineEntity.d.ts +753 -0
- package/entity/defineEntity.js +537 -0
- package/entity/index.d.ts +4 -2
- package/entity/index.js +4 -2
- package/entity/utils.d.ts +13 -1
- package/entity/utils.js +49 -4
- package/entity/validators.d.ts +11 -0
- package/entity/validators.js +65 -0
- package/enums.d.ts +23 -8
- package/enums.js +15 -1
- package/errors.d.ts +25 -9
- package/errors.js +67 -21
- package/events/EventManager.d.ts +2 -1
- package/events/EventManager.js +19 -11
- package/events/EventSubscriber.d.ts +3 -1
- package/hydration/Hydrator.js +1 -2
- package/hydration/ObjectHydrator.d.ts +4 -4
- package/hydration/ObjectHydrator.js +89 -36
- package/index.d.ts +2 -2
- package/index.js +1 -2
- package/logging/DefaultLogger.d.ts +1 -1
- package/logging/DefaultLogger.js +1 -0
- package/logging/SimpleLogger.d.ts +1 -1
- package/logging/colors.d.ts +1 -1
- package/logging/colors.js +7 -6
- package/logging/index.d.ts +1 -0
- package/logging/index.js +1 -0
- package/logging/inspect.d.ts +2 -0
- package/logging/inspect.js +11 -0
- package/metadata/EntitySchema.d.ts +53 -27
- package/metadata/EntitySchema.js +125 -52
- package/metadata/MetadataDiscovery.d.ts +64 -10
- package/metadata/MetadataDiscovery.js +823 -344
- package/metadata/MetadataProvider.d.ts +11 -2
- package/metadata/MetadataProvider.js +66 -2
- package/metadata/MetadataStorage.d.ts +13 -11
- package/metadata/MetadataStorage.js +71 -38
- package/metadata/MetadataValidator.d.ts +32 -9
- package/metadata/MetadataValidator.js +198 -42
- package/metadata/discover-entities.d.ts +5 -0
- package/metadata/discover-entities.js +40 -0
- package/metadata/index.d.ts +1 -1
- package/metadata/index.js +1 -1
- package/metadata/types.d.ts +577 -0
- package/metadata/types.js +1 -0
- package/naming-strategy/AbstractNamingStrategy.d.ts +16 -4
- package/naming-strategy/AbstractNamingStrategy.js +20 -2
- package/naming-strategy/EntityCaseNamingStrategy.d.ts +3 -3
- package/naming-strategy/EntityCaseNamingStrategy.js +6 -5
- package/naming-strategy/MongoNamingStrategy.d.ts +3 -3
- package/naming-strategy/MongoNamingStrategy.js +6 -6
- package/naming-strategy/NamingStrategy.d.ts +28 -4
- package/naming-strategy/UnderscoreNamingStrategy.d.ts +3 -3
- package/naming-strategy/UnderscoreNamingStrategy.js +6 -6
- package/not-supported.d.ts +2 -0
- package/not-supported.js +4 -0
- package/package.json +22 -11
- package/platforms/ExceptionConverter.js +1 -1
- package/platforms/Platform.d.ts +14 -16
- package/platforms/Platform.js +24 -44
- package/serialization/EntitySerializer.d.ts +8 -3
- package/serialization/EntitySerializer.js +47 -27
- package/serialization/EntityTransformer.js +33 -21
- package/serialization/SerializationContext.d.ts +6 -6
- package/serialization/SerializationContext.js +16 -13
- package/types/ArrayType.d.ts +1 -1
- package/types/ArrayType.js +2 -3
- package/types/BigIntType.d.ts +9 -6
- package/types/BigIntType.js +4 -1
- package/types/BlobType.d.ts +0 -1
- package/types/BlobType.js +0 -3
- package/types/BooleanType.d.ts +2 -1
- package/types/BooleanType.js +3 -0
- package/types/DecimalType.d.ts +6 -4
- package/types/DecimalType.js +3 -3
- package/types/DoubleType.js +2 -2
- package/types/EnumArrayType.js +1 -2
- package/types/JsonType.d.ts +1 -1
- package/types/JsonType.js +7 -2
- package/types/TinyIntType.js +1 -1
- package/types/Type.d.ts +2 -4
- package/types/Type.js +3 -3
- package/types/Uint8ArrayType.d.ts +0 -1
- package/types/Uint8ArrayType.js +1 -4
- package/types/index.d.ts +1 -1
- package/typings.d.ts +469 -175
- package/typings.js +120 -45
- package/unit-of-work/ChangeSet.d.ts +4 -6
- package/unit-of-work/ChangeSet.js +4 -5
- package/unit-of-work/ChangeSetComputer.d.ts +3 -8
- package/unit-of-work/ChangeSetComputer.js +44 -21
- package/unit-of-work/ChangeSetPersister.d.ts +15 -12
- package/unit-of-work/ChangeSetPersister.js +113 -45
- package/unit-of-work/CommitOrderCalculator.d.ts +12 -10
- package/unit-of-work/CommitOrderCalculator.js +13 -13
- package/unit-of-work/IdentityMap.d.ts +12 -0
- package/unit-of-work/IdentityMap.js +39 -1
- package/unit-of-work/UnitOfWork.d.ts +28 -3
- package/unit-of-work/UnitOfWork.js +315 -110
- package/utils/AbstractMigrator.d.ts +101 -0
- package/utils/AbstractMigrator.js +305 -0
- package/utils/AbstractSchemaGenerator.d.ts +5 -5
- package/utils/AbstractSchemaGenerator.js +32 -18
- package/utils/AsyncContext.d.ts +6 -0
- package/utils/AsyncContext.js +42 -0
- package/utils/Configuration.d.ts +801 -207
- package/utils/Configuration.js +150 -191
- package/utils/ConfigurationLoader.d.ts +1 -54
- package/utils/ConfigurationLoader.js +1 -352
- package/utils/Cursor.d.ts +3 -6
- package/utils/Cursor.js +27 -11
- package/utils/DataloaderUtils.d.ts +15 -5
- package/utils/DataloaderUtils.js +65 -17
- package/utils/EntityComparator.d.ts +21 -10
- package/utils/EntityComparator.js +243 -106
- package/utils/QueryHelper.d.ts +24 -6
- package/utils/QueryHelper.js +122 -26
- package/utils/RawQueryFragment.d.ts +60 -32
- package/utils/RawQueryFragment.js +69 -66
- package/utils/RequestContext.js +2 -2
- package/utils/TransactionContext.js +2 -2
- package/utils/TransactionManager.d.ts +65 -0
- package/utils/TransactionManager.js +223 -0
- package/utils/Utils.d.ts +15 -122
- package/utils/Utils.js +108 -376
- package/utils/clone.js +8 -23
- package/utils/env-vars.d.ts +7 -0
- package/utils/env-vars.js +97 -0
- package/utils/fs-utils.d.ts +34 -0
- package/utils/fs-utils.js +196 -0
- package/utils/index.d.ts +2 -3
- package/utils/index.js +2 -3
- package/utils/upsert-utils.d.ts +9 -4
- package/utils/upsert-utils.js +55 -4
- package/decorators/Check.d.ts +0 -3
- package/decorators/Check.js +0 -13
- package/decorators/CreateRequestContext.d.ts +0 -3
- package/decorators/CreateRequestContext.js +0 -32
- package/decorators/Embeddable.d.ts +0 -8
- package/decorators/Embeddable.js +0 -11
- package/decorators/Embedded.d.ts +0 -18
- package/decorators/Embedded.js +0 -18
- package/decorators/Entity.d.ts +0 -18
- package/decorators/Entity.js +0 -13
- package/decorators/Enum.d.ts +0 -9
- package/decorators/Enum.js +0 -16
- package/decorators/Filter.d.ts +0 -2
- package/decorators/Filter.js +0 -8
- package/decorators/Formula.d.ts +0 -5
- package/decorators/Formula.js +0 -15
- package/decorators/Indexed.d.ts +0 -17
- package/decorators/Indexed.js +0 -20
- package/decorators/ManyToMany.d.ts +0 -40
- package/decorators/ManyToMany.js +0 -14
- package/decorators/ManyToOne.d.ts +0 -30
- package/decorators/ManyToOne.js +0 -14
- package/decorators/OneToMany.d.ts +0 -28
- package/decorators/OneToMany.js +0 -17
- package/decorators/OneToOne.d.ts +0 -24
- package/decorators/OneToOne.js +0 -7
- package/decorators/PrimaryKey.d.ts +0 -9
- package/decorators/PrimaryKey.js +0 -20
- package/decorators/Property.d.ts +0 -250
- package/decorators/Property.js +0 -32
- package/decorators/Transactional.d.ts +0 -13
- package/decorators/Transactional.js +0 -28
- package/decorators/hooks.d.ts +0 -16
- package/decorators/hooks.js +0 -47
- package/decorators/index.d.ts +0 -17
- package/decorators/index.js +0 -17
- package/entity/ArrayCollection.d.ts +0 -116
- package/entity/ArrayCollection.js +0 -395
- package/entity/EntityValidator.d.ts +0 -19
- package/entity/EntityValidator.js +0 -150
- package/metadata/ReflectMetadataProvider.d.ts +0 -8
- package/metadata/ReflectMetadataProvider.js +0 -44
- package/utils/resolveContextProvider.d.ts +0 -10
- package/utils/resolveContextProvider.js +0 -28
package/entity/EntityHelper.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EagerProps, EntityRepositoryType, HiddenProps, OptionalProps, PrimaryKeyProp, } from '../typings.js';
|
|
1
|
+
import { EagerProps, EntityName, EntityRepositoryType, HiddenProps, OptionalProps, PrimaryKeyProp, } from '../typings.js';
|
|
3
2
|
import { EntityTransformer } from '../serialization/EntityTransformer.js';
|
|
4
3
|
import { Reference } from './Reference.js';
|
|
5
4
|
import { Utils } from '../utils/Utils.js';
|
|
6
5
|
import { WrappedEntity } from './WrappedEntity.js';
|
|
7
6
|
import { ReferenceKind } from '../enums.js';
|
|
8
7
|
import { helper } from './wrap.js';
|
|
8
|
+
import { inspect } from '../logging/inspect.js';
|
|
9
|
+
import { getEnv } from '../utils/env-vars.js';
|
|
9
10
|
/**
|
|
10
11
|
* @internal
|
|
11
12
|
*/
|
|
@@ -31,15 +32,25 @@ export class EntityHelper {
|
|
|
31
32
|
}
|
|
32
33
|
const prototype = meta.prototype;
|
|
33
34
|
if (!prototype.toJSON) { // toJSON can be overridden
|
|
34
|
-
prototype
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
Object.defineProperty(prototype, 'toJSON', {
|
|
36
|
+
value: function (...args) {
|
|
37
|
+
// Guard against being called on the prototype itself (e.g. by serializers
|
|
38
|
+
// walking the object graph and calling toJSON on prototype objects)
|
|
39
|
+
if (this === prototype) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
return EntityTransformer.toObject(this, ...args);
|
|
43
|
+
},
|
|
44
|
+
writable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
enumerable: false,
|
|
47
|
+
});
|
|
37
48
|
}
|
|
38
49
|
}
|
|
39
50
|
/**
|
|
40
|
-
* As a performance optimization, we create entity state methods
|
|
51
|
+
* As a performance optimization, we create entity state methods lazily. We first add
|
|
41
52
|
* the `null` value to the prototype to reserve space in memory. Then we define a setter on the
|
|
42
|
-
* prototype
|
|
53
|
+
* prototype that will be executed exactly once per entity instance. There we redefine the given
|
|
43
54
|
* property on the entity instance, so shadowing the prototype setter.
|
|
44
55
|
*/
|
|
45
56
|
static defineBaseProperties(meta, prototype, em) {
|
|
@@ -87,7 +98,7 @@ export class EntityHelper {
|
|
|
87
98
|
});
|
|
88
99
|
return;
|
|
89
100
|
}
|
|
90
|
-
if (prop.inherited || prop.primary || prop.
|
|
101
|
+
if (prop.inherited || prop.primary || prop.accessor || prop.persist === false || prop.embedded || isCollection) {
|
|
91
102
|
return;
|
|
92
103
|
}
|
|
93
104
|
Object.defineProperty(meta.prototype, prop.name, {
|
|
@@ -98,13 +109,11 @@ export class EntityHelper {
|
|
|
98
109
|
},
|
|
99
110
|
set(val) {
|
|
100
111
|
this.__helper.__data[prop.name] = val;
|
|
101
|
-
this.__helper.__touched = !this.__helper.hydrator.isRunning();
|
|
102
112
|
},
|
|
103
113
|
enumerable: true,
|
|
104
114
|
configurable: true,
|
|
105
115
|
});
|
|
106
116
|
this.__helper.__data[prop.name] = val;
|
|
107
|
-
this.__helper.__touched = !this.__helper.hydrator.isRunning();
|
|
108
117
|
},
|
|
109
118
|
configurable: true,
|
|
110
119
|
});
|
|
@@ -112,16 +121,27 @@ export class EntityHelper {
|
|
|
112
121
|
}
|
|
113
122
|
static defineCustomInspect(meta) {
|
|
114
123
|
// @ts-ignore
|
|
115
|
-
meta.prototype[inspect.custom] ??= function (depth = 2) {
|
|
116
|
-
const object = {
|
|
124
|
+
meta.prototype[Symbol.for('nodejs.util.inspect.custom')] ??= function (depth = 2) {
|
|
125
|
+
const object = {};
|
|
126
|
+
const keys = new Set(Utils.keys(this));
|
|
127
|
+
for (const prop of meta.props) {
|
|
128
|
+
if (keys.has(prop.name) || (prop.getter && prop.accessor === prop.name)) {
|
|
129
|
+
object[prop.name] = this[prop.name];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
for (const key of keys) {
|
|
133
|
+
if (!meta.properties[key]) {
|
|
134
|
+
object[key] = this[key];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
117
137
|
// ensure we dont have internal symbols in the POJO
|
|
118
|
-
[OptionalProps, EntityRepositoryType, PrimaryKeyProp, EagerProps, HiddenProps].forEach(sym => delete object[sym]);
|
|
138
|
+
[OptionalProps, EntityRepositoryType, PrimaryKeyProp, EagerProps, HiddenProps, EntityName].forEach(sym => delete object[sym]);
|
|
119
139
|
meta.props
|
|
120
140
|
.filter(prop => object[prop.name] === undefined)
|
|
121
141
|
.forEach(prop => delete object[prop.name]);
|
|
122
142
|
const ret = inspect(object, { depth });
|
|
123
|
-
let name =
|
|
124
|
-
const showEM = ['true', 't', '1'].includes(
|
|
143
|
+
let name = this.constructor.name;
|
|
144
|
+
const showEM = ['true', 't', '1'].includes(getEnv('MIKRO_ORM_LOG_EM_ID')?.toLowerCase() ?? '');
|
|
125
145
|
if (showEM) {
|
|
126
146
|
if (helper(this).__em) {
|
|
127
147
|
name += ` [managed by ${helper(this).__em.id}]`;
|
|
@@ -146,13 +166,13 @@ export class EntityHelper {
|
|
|
146
166
|
set(val) {
|
|
147
167
|
const entity = Reference.unwrapReference(val ?? wrapped.__data[prop.name]);
|
|
148
168
|
const old = Reference.unwrapReference(wrapped.__data[prop.name]);
|
|
169
|
+
if (old && old !== entity && prop.kind === ReferenceKind.MANY_TO_ONE && prop.inversedBy && old[prop.inversedBy]) {
|
|
170
|
+
old[prop.inversedBy].removeWithoutPropagation(this);
|
|
171
|
+
}
|
|
149
172
|
wrapped.__data[prop.name] = Reference.wrapReference(val, prop);
|
|
150
173
|
// when propagation from inside hydration, we set the FK to the entity data immediately
|
|
151
174
|
if (val && hydrator.isRunning() && wrapped.__originalEntityData && prop.owner) {
|
|
152
|
-
wrapped.__originalEntityData[prop.name] = Utils.getPrimaryKeyValues(wrapped.__data[prop.name], prop.targetMeta
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
wrapped.__touched = !hydrator.isRunning();
|
|
175
|
+
wrapped.__originalEntityData[prop.name] = Utils.getPrimaryKeyValues(wrapped.__data[prop.name], prop.targetMeta, true);
|
|
156
176
|
}
|
|
157
177
|
EntityHelper.propagate(meta, entity, this, prop, Reference.unwrapReference(val), old);
|
|
158
178
|
},
|
|
@@ -161,7 +181,19 @@ export class EntityHelper {
|
|
|
161
181
|
});
|
|
162
182
|
}
|
|
163
183
|
static propagate(meta, entity, owner, prop, value, old) {
|
|
164
|
-
|
|
184
|
+
// For polymorphic relations, get bidirectional relations from the actual entity's metadata
|
|
185
|
+
let bidirectionalRelations;
|
|
186
|
+
if (prop.polymorphic && prop.polymorphTargets?.length) {
|
|
187
|
+
// For polymorphic relations, we need to get the bidirectional relations from the actual value's metadata
|
|
188
|
+
if (!value) {
|
|
189
|
+
return; // No value means no propagation needed
|
|
190
|
+
}
|
|
191
|
+
bidirectionalRelations = helper(value).__meta.bidirectionalRelations;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
bidirectionalRelations = prop.targetMeta.bidirectionalRelations;
|
|
195
|
+
}
|
|
196
|
+
for (const prop2 of bidirectionalRelations) {
|
|
165
197
|
if ((prop2.inversedBy || prop2.mappedBy) !== prop.name) {
|
|
166
198
|
continue;
|
|
167
199
|
}
|
|
@@ -169,6 +201,13 @@ export class EntityHelper {
|
|
|
169
201
|
continue;
|
|
170
202
|
}
|
|
171
203
|
const inverse = value?.[prop2.name];
|
|
204
|
+
if (prop.ref && owner[prop.name]) {
|
|
205
|
+
// eslint-disable-next-line dot-notation
|
|
206
|
+
owner[prop.name]['property'] = prop;
|
|
207
|
+
}
|
|
208
|
+
if (Utils.isCollection(inverse) && inverse.isPartial()) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
172
211
|
if (prop.kind === ReferenceKind.MANY_TO_ONE && Utils.isCollection(inverse) && inverse.isInitialized()) {
|
|
173
212
|
inverse.addWithoutPropagation(owner);
|
|
174
213
|
helper(owner).__em?.getUnitOfWork().cancelOrphanRemoval(owner);
|
|
@@ -196,6 +235,11 @@ export class EntityHelper {
|
|
|
196
235
|
helper(other).__em?.getUnitOfWork().scheduleOrphanRemoval(other);
|
|
197
236
|
}
|
|
198
237
|
}
|
|
238
|
+
// Skip setting the inverse side to null if it's a primary key - the entity will be removed via orphan removal
|
|
239
|
+
// Setting a primary key to null would corrupt the entity and cause validation errors
|
|
240
|
+
if (value == null && prop.orphanRemoval && prop2.primary) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
199
243
|
if (value == null) {
|
|
200
244
|
entity[prop2.name] = value;
|
|
201
245
|
}
|
|
@@ -207,6 +251,7 @@ export class EntityHelper {
|
|
|
207
251
|
}
|
|
208
252
|
if (old?.[prop2.name] != null) {
|
|
209
253
|
delete helper(old).__data[prop2.name];
|
|
254
|
+
old[prop2.name] = null;
|
|
210
255
|
}
|
|
211
256
|
}
|
|
212
257
|
static ensurePropagation(entity) {
|
package/entity/EntityLoader.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import type { ConnectionType,
|
|
1
|
+
import type { AnyEntity, AutoPath, ConnectionType, EntityName, EntityProperty, FilterQuery, PopulateOptions } from '../typings.js';
|
|
2
2
|
import type { EntityManager } from '../EntityManager.js';
|
|
3
3
|
import { LoadStrategy, type LockMode, type PopulateHint, PopulatePath, type QueryOrderMap } from '../enums.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { FilterOptions } from '../drivers/IDatabaseDriver.js';
|
|
5
5
|
import type { LoggingOptions } from '../logging/Logger.js';
|
|
6
|
-
export
|
|
6
|
+
export interface EntityLoaderOptions<Entity, Fields extends string = PopulatePath.ALL, Excludes extends string = never> {
|
|
7
|
+
fields?: readonly AutoPath<Entity, Fields, `${PopulatePath.ALL}`>[];
|
|
8
|
+
exclude?: readonly AutoPath<Entity, Excludes>[];
|
|
7
9
|
where?: FilterQuery<Entity>;
|
|
8
10
|
populateWhere?: PopulateHint | `${PopulateHint}`;
|
|
9
|
-
fields?: readonly EntityField<Entity, Fields>[];
|
|
10
|
-
exclude?: readonly EntityField<Entity, Excludes>[];
|
|
11
11
|
orderBy?: QueryOrderMap<Entity> | QueryOrderMap<Entity>[];
|
|
12
12
|
refresh?: boolean;
|
|
13
13
|
validate?: boolean;
|
|
14
14
|
lookup?: boolean;
|
|
15
15
|
convertCustomTypes?: boolean;
|
|
16
16
|
ignoreLazyScalarProperties?: boolean;
|
|
17
|
-
filters?:
|
|
18
|
-
strategy?: LoadStrategy
|
|
17
|
+
filters?: FilterOptions;
|
|
18
|
+
strategy?: LoadStrategy | `${LoadStrategy}`;
|
|
19
19
|
lockMode?: Exclude<LockMode, LockMode.OPTIMISTIC>;
|
|
20
20
|
schema?: string;
|
|
21
21
|
connectionType?: ConnectionType;
|
|
22
22
|
logging?: LoggingOptions;
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
export declare class EntityLoader {
|
|
25
25
|
private readonly em;
|
|
26
26
|
private readonly metadata;
|
|
@@ -30,8 +30,8 @@ export declare class EntityLoader {
|
|
|
30
30
|
* Loads specified relations in batch.
|
|
31
31
|
* This will execute one query for each relation, that will populate it on all the specified entities.
|
|
32
32
|
*/
|
|
33
|
-
populate<Entity extends object, Fields extends string = PopulatePath.ALL>(entityName:
|
|
34
|
-
normalizePopulate<Entity>(entityName:
|
|
33
|
+
populate<Entity extends object, Fields extends string = PopulatePath.ALL>(entityName: EntityName<Entity>, entities: Entity[], populate: PopulateOptions<Entity>[] | boolean, options: EntityLoaderOptions<Entity, Fields>): Promise<void>;
|
|
34
|
+
normalizePopulate<Entity>(entityName: EntityName<Entity>, populate: (PopulateOptions<Entity> | boolean)[] | PopulateOptions<Entity> | boolean, strategy?: LoadStrategy, lookup?: boolean, exclude?: string[]): PopulateOptions<Entity>[];
|
|
35
35
|
private setSerializationContext;
|
|
36
36
|
/**
|
|
37
37
|
* Merge multiple populates for the same entity with different children. Also skips `*` fields, those can come from
|
|
@@ -43,13 +43,15 @@ export declare class EntityLoader {
|
|
|
43
43
|
*/
|
|
44
44
|
private populateMany;
|
|
45
45
|
private populateScalar;
|
|
46
|
+
private populatePolymorphic;
|
|
46
47
|
private initializeCollections;
|
|
47
48
|
private initializeOneToMany;
|
|
48
49
|
private initializeManyToMany;
|
|
49
50
|
private findChildren;
|
|
50
51
|
private mergePrimaryCondition;
|
|
51
52
|
private populateField;
|
|
52
|
-
|
|
53
|
+
/** @internal */
|
|
54
|
+
findChildrenFromPivotTable<Entity extends object>(filtered: Entity[], prop: EntityProperty<Entity>, options: Required<EntityLoaderOptions<Entity>>, orderBy?: QueryOrderMap<Entity>[], populate?: PopulateOptions<Entity>, pivotJoin?: boolean): Promise<AnyEntity[][]>;
|
|
53
55
|
private extractChildCondition;
|
|
54
56
|
private buildFields;
|
|
55
57
|
private getChildReferences;
|