@mikro-orm/core 7.0.0-dev.32 → 7.0.0-dev.321

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.
Files changed (216) hide show
  1. package/EntityManager.d.ts +71 -63
  2. package/EntityManager.js +365 -283
  3. package/MikroORM.d.ts +44 -35
  4. package/MikroORM.js +109 -142
  5. package/README.md +7 -4
  6. package/cache/FileCacheAdapter.d.ts +1 -2
  7. package/cache/FileCacheAdapter.js +19 -14
  8. package/cache/GeneratedCacheAdapter.d.ts +0 -1
  9. package/cache/GeneratedCacheAdapter.js +0 -2
  10. package/cache/index.d.ts +1 -2
  11. package/cache/index.js +0 -2
  12. package/connections/Connection.d.ts +12 -5
  13. package/connections/Connection.js +37 -15
  14. package/drivers/DatabaseDriver.d.ts +25 -18
  15. package/drivers/DatabaseDriver.js +144 -45
  16. package/drivers/IDatabaseDriver.d.ts +118 -23
  17. package/entity/BaseEntity.d.ts +63 -4
  18. package/entity/BaseEntity.js +0 -3
  19. package/entity/Collection.d.ts +101 -29
  20. package/entity/Collection.js +473 -115
  21. package/entity/EntityAssigner.js +37 -25
  22. package/entity/EntityFactory.d.ts +7 -1
  23. package/entity/EntityFactory.js +116 -64
  24. package/entity/EntityHelper.d.ts +2 -2
  25. package/entity/EntityHelper.js +69 -27
  26. package/entity/EntityLoader.d.ts +11 -10
  27. package/entity/EntityLoader.js +264 -102
  28. package/entity/EntityRepository.d.ts +28 -8
  29. package/entity/EntityRepository.js +8 -2
  30. package/entity/PolymorphicRef.d.ts +12 -0
  31. package/entity/PolymorphicRef.js +18 -0
  32. package/entity/Reference.d.ts +2 -6
  33. package/entity/Reference.js +52 -19
  34. package/entity/WrappedEntity.d.ts +3 -8
  35. package/entity/WrappedEntity.js +6 -7
  36. package/entity/defineEntity.d.ts +525 -311
  37. package/entity/defineEntity.js +134 -290
  38. package/entity/index.d.ts +2 -2
  39. package/entity/index.js +2 -2
  40. package/entity/utils.d.ts +6 -1
  41. package/entity/utils.js +46 -11
  42. package/entity/validators.d.ts +11 -0
  43. package/entity/validators.js +66 -0
  44. package/enums.d.ts +8 -6
  45. package/enums.js +13 -17
  46. package/errors.d.ts +20 -10
  47. package/errors.js +63 -31
  48. package/events/EventManager.d.ts +2 -1
  49. package/events/EventManager.js +24 -13
  50. package/events/index.d.ts +1 -1
  51. package/events/index.js +0 -1
  52. package/exceptions.js +9 -2
  53. package/hydration/Hydrator.js +1 -2
  54. package/hydration/ObjectHydrator.d.ts +4 -4
  55. package/hydration/ObjectHydrator.js +105 -46
  56. package/index.d.ts +2 -2
  57. package/index.js +1 -2
  58. package/logging/DefaultLogger.d.ts +1 -1
  59. package/logging/DefaultLogger.js +3 -4
  60. package/logging/SimpleLogger.d.ts +1 -1
  61. package/logging/colors.d.ts +1 -1
  62. package/logging/colors.js +5 -7
  63. package/logging/index.d.ts +2 -1
  64. package/logging/index.js +1 -1
  65. package/logging/inspect.d.ts +2 -0
  66. package/logging/inspect.js +11 -0
  67. package/metadata/EntitySchema.d.ts +47 -23
  68. package/metadata/EntitySchema.js +103 -34
  69. package/metadata/MetadataDiscovery.d.ts +64 -9
  70. package/metadata/MetadataDiscovery.js +867 -354
  71. package/metadata/MetadataProvider.d.ts +11 -2
  72. package/metadata/MetadataProvider.js +71 -2
  73. package/metadata/MetadataStorage.d.ts +13 -11
  74. package/metadata/MetadataStorage.js +72 -41
  75. package/metadata/MetadataValidator.d.ts +32 -9
  76. package/metadata/MetadataValidator.js +214 -44
  77. package/metadata/discover-entities.d.ts +5 -0
  78. package/metadata/discover-entities.js +40 -0
  79. package/metadata/index.d.ts +1 -1
  80. package/metadata/index.js +0 -1
  81. package/metadata/types.d.ts +577 -0
  82. package/metadata/types.js +1 -0
  83. package/naming-strategy/AbstractNamingStrategy.d.ts +16 -4
  84. package/naming-strategy/AbstractNamingStrategy.js +26 -5
  85. package/naming-strategy/EntityCaseNamingStrategy.d.ts +3 -3
  86. package/naming-strategy/EntityCaseNamingStrategy.js +6 -5
  87. package/naming-strategy/MongoNamingStrategy.d.ts +3 -3
  88. package/naming-strategy/MongoNamingStrategy.js +6 -6
  89. package/naming-strategy/NamingStrategy.d.ts +28 -4
  90. package/naming-strategy/UnderscoreNamingStrategy.d.ts +3 -3
  91. package/naming-strategy/UnderscoreNamingStrategy.js +6 -6
  92. package/naming-strategy/index.d.ts +1 -1
  93. package/naming-strategy/index.js +0 -1
  94. package/not-supported.d.ts +2 -0
  95. package/not-supported.js +8 -0
  96. package/package.json +47 -36
  97. package/platforms/ExceptionConverter.js +1 -1
  98. package/platforms/Platform.d.ts +33 -15
  99. package/platforms/Platform.js +125 -69
  100. package/serialization/EntitySerializer.d.ts +6 -3
  101. package/serialization/EntitySerializer.js +53 -29
  102. package/serialization/EntityTransformer.js +33 -21
  103. package/serialization/SerializationContext.d.ts +6 -6
  104. package/serialization/SerializationContext.js +4 -4
  105. package/types/ArrayType.d.ts +1 -1
  106. package/types/ArrayType.js +2 -3
  107. package/types/BigIntType.js +1 -1
  108. package/types/BlobType.d.ts +0 -1
  109. package/types/BlobType.js +0 -3
  110. package/types/BooleanType.d.ts +1 -0
  111. package/types/BooleanType.js +3 -0
  112. package/types/DecimalType.js +2 -2
  113. package/types/DoubleType.js +1 -1
  114. package/types/EnumArrayType.js +1 -2
  115. package/types/JsonType.d.ts +1 -1
  116. package/types/JsonType.js +7 -2
  117. package/types/TinyIntType.js +1 -1
  118. package/types/Type.d.ts +2 -4
  119. package/types/Type.js +3 -3
  120. package/types/Uint8ArrayType.d.ts +0 -1
  121. package/types/Uint8ArrayType.js +1 -4
  122. package/types/UuidType.d.ts +2 -0
  123. package/types/UuidType.js +14 -2
  124. package/types/index.d.ts +3 -2
  125. package/typings.d.ts +427 -170
  126. package/typings.js +100 -45
  127. package/unit-of-work/ChangeSet.d.ts +4 -6
  128. package/unit-of-work/ChangeSet.js +8 -9
  129. package/unit-of-work/ChangeSetComputer.d.ts +3 -8
  130. package/unit-of-work/ChangeSetComputer.js +49 -26
  131. package/unit-of-work/ChangeSetPersister.d.ts +13 -12
  132. package/unit-of-work/ChangeSetPersister.js +107 -44
  133. package/unit-of-work/CommitOrderCalculator.d.ts +12 -10
  134. package/unit-of-work/CommitOrderCalculator.js +17 -15
  135. package/unit-of-work/IdentityMap.d.ts +12 -0
  136. package/unit-of-work/IdentityMap.js +39 -1
  137. package/unit-of-work/UnitOfWork.d.ts +34 -4
  138. package/unit-of-work/UnitOfWork.js +294 -107
  139. package/utils/AbstractMigrator.d.ts +101 -0
  140. package/utils/AbstractMigrator.js +303 -0
  141. package/utils/AbstractSchemaGenerator.d.ts +5 -5
  142. package/utils/AbstractSchemaGenerator.js +30 -18
  143. package/utils/AsyncContext.d.ts +6 -0
  144. package/utils/AsyncContext.js +42 -0
  145. package/utils/Configuration.d.ts +796 -211
  146. package/utils/Configuration.js +160 -197
  147. package/utils/ConfigurationLoader.d.ts +1 -52
  148. package/utils/ConfigurationLoader.js +1 -330
  149. package/utils/Cursor.d.ts +0 -3
  150. package/utils/Cursor.js +29 -14
  151. package/utils/DataloaderUtils.d.ts +10 -5
  152. package/utils/DataloaderUtils.js +42 -22
  153. package/utils/EntityComparator.d.ts +16 -9
  154. package/utils/EntityComparator.js +202 -96
  155. package/utils/QueryHelper.d.ts +34 -7
  156. package/utils/QueryHelper.js +183 -72
  157. package/utils/RawQueryFragment.d.ts +28 -34
  158. package/utils/RawQueryFragment.js +37 -72
  159. package/utils/RequestContext.js +2 -2
  160. package/utils/TransactionContext.js +2 -2
  161. package/utils/TransactionManager.js +11 -7
  162. package/utils/Utils.d.ts +16 -127
  163. package/utils/Utils.js +106 -401
  164. package/utils/clone.js +13 -23
  165. package/utils/env-vars.d.ts +7 -0
  166. package/utils/env-vars.js +98 -0
  167. package/utils/fs-utils.d.ts +34 -0
  168. package/utils/fs-utils.js +193 -0
  169. package/utils/index.d.ts +1 -3
  170. package/utils/index.js +1 -3
  171. package/utils/upsert-utils.d.ts +9 -4
  172. package/utils/upsert-utils.js +51 -5
  173. package/decorators/Check.d.ts +0 -3
  174. package/decorators/Check.js +0 -13
  175. package/decorators/CreateRequestContext.d.ts +0 -3
  176. package/decorators/CreateRequestContext.js +0 -32
  177. package/decorators/Embeddable.d.ts +0 -8
  178. package/decorators/Embeddable.js +0 -11
  179. package/decorators/Embedded.d.ts +0 -12
  180. package/decorators/Embedded.js +0 -18
  181. package/decorators/Entity.d.ts +0 -33
  182. package/decorators/Entity.js +0 -12
  183. package/decorators/Enum.d.ts +0 -9
  184. package/decorators/Enum.js +0 -16
  185. package/decorators/Filter.d.ts +0 -2
  186. package/decorators/Filter.js +0 -8
  187. package/decorators/Formula.d.ts +0 -4
  188. package/decorators/Formula.js +0 -15
  189. package/decorators/Indexed.d.ts +0 -19
  190. package/decorators/Indexed.js +0 -20
  191. package/decorators/ManyToMany.d.ts +0 -42
  192. package/decorators/ManyToMany.js +0 -14
  193. package/decorators/ManyToOne.d.ts +0 -34
  194. package/decorators/ManyToOne.js +0 -14
  195. package/decorators/OneToMany.d.ts +0 -28
  196. package/decorators/OneToMany.js +0 -17
  197. package/decorators/OneToOne.d.ts +0 -28
  198. package/decorators/OneToOne.js +0 -7
  199. package/decorators/PrimaryKey.d.ts +0 -8
  200. package/decorators/PrimaryKey.js +0 -20
  201. package/decorators/Property.d.ts +0 -250
  202. package/decorators/Property.js +0 -32
  203. package/decorators/Transactional.d.ts +0 -14
  204. package/decorators/Transactional.js +0 -28
  205. package/decorators/hooks.d.ts +0 -16
  206. package/decorators/hooks.js +0 -47
  207. package/decorators/index.d.ts +0 -17
  208. package/decorators/index.js +0 -17
  209. package/entity/ArrayCollection.d.ts +0 -118
  210. package/entity/ArrayCollection.js +0 -407
  211. package/entity/EntityValidator.d.ts +0 -19
  212. package/entity/EntityValidator.js +0 -150
  213. package/metadata/ReflectMetadataProvider.d.ts +0 -8
  214. package/metadata/ReflectMetadataProvider.js +0 -44
  215. package/utils/resolveContextProvider.d.ts +0 -10
  216. package/utils/resolveContextProvider.js +0 -28
@@ -1,11 +1,12 @@
1
- import { inspect } from 'node:util';
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
  */
@@ -30,19 +31,31 @@ export class EntityHelper {
30
31
  EntityHelper.defineProperties(meta, fork);
31
32
  }
32
33
  const prototype = meta.prototype;
33
- if (!prototype.toJSON) { // toJSON can be overridden
34
- prototype.toJSON = function (...args) {
35
- return EntityTransformer.toObject(this, ...args.slice(meta.toJsonParams.length));
36
- };
34
+ if (!prototype.toJSON) {
35
+ // toJSON can be overridden
36
+ Object.defineProperty(prototype, 'toJSON', {
37
+ value: function (...args) {
38
+ // Guard against being called on the prototype itself (e.g. by serializers
39
+ // walking the object graph and calling toJSON on prototype objects)
40
+ if (this === prototype) {
41
+ return {};
42
+ }
43
+ return EntityTransformer.toObject(this, ...args);
44
+ },
45
+ writable: true,
46
+ configurable: true,
47
+ enumerable: false,
48
+ });
37
49
  }
38
50
  }
39
51
  /**
40
- * As a performance optimization, we create entity state methods in a lazy manner. We first add
52
+ * As a performance optimization, we create entity state methods lazily. We first add
41
53
  * the `null` value to the prototype to reserve space in memory. Then we define a setter on the
42
- * prototype, that will be executed exactly once per entity instance. There we redefine given
54
+ * prototype that will be executed exactly once per entity instance. There we redefine the given
43
55
  * property on the entity instance, so shadowing the prototype setter.
44
56
  */
45
57
  static defineBaseProperties(meta, prototype, em) {
58
+ // oxfmt-ignore
46
59
  const helperParams = meta.embeddable || meta.virtual ? [] : [em.getComparator().getPkGetter(meta), em.getComparator().getPkSerializer(meta), em.getComparator().getPkGetterConverted(meta)];
47
60
  Object.defineProperties(prototype, {
48
61
  __entity: { value: !meta.embeddable, configurable: true },
@@ -72,10 +85,9 @@ export class EntityHelper {
72
85
  * than on its prototype. Thanks to this we still have those properties enumerable (e.g. part of `Object.keys(entity)`).
73
86
  */
74
87
  static defineProperties(meta, em) {
75
- Object
76
- .values(meta.properties)
77
- .forEach(prop => {
88
+ Object.values(meta.properties).forEach(prop => {
78
89
  const isCollection = [ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(prop.kind);
90
+ // oxfmt-ignore
79
91
  const isReference = [ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(prop.kind) && (prop.inversedBy || prop.mappedBy) && !prop.mapToPk;
80
92
  if (isReference) {
81
93
  Object.defineProperty(meta.prototype, prop.name, {
@@ -87,7 +99,7 @@ export class EntityHelper {
87
99
  });
88
100
  return;
89
101
  }
90
- if (prop.inherited || prop.primary || prop.persist === false || prop.trackChanges === false || prop.embedded || isCollection) {
102
+ if (prop.inherited || prop.primary || prop.accessor || prop.persist === false || prop.embedded || isCollection) {
91
103
  return;
92
104
  }
93
105
  Object.defineProperty(meta.prototype, prop.name, {
@@ -98,13 +110,11 @@ export class EntityHelper {
98
110
  },
99
111
  set(val) {
100
112
  this.__helper.__data[prop.name] = val;
101
- this.__helper.__touched = !this.__helper.hydrator.isRunning();
102
113
  },
103
114
  enumerable: true,
104
115
  configurable: true,
105
116
  });
106
117
  this.__helper.__data[prop.name] = val;
107
- this.__helper.__touched = !this.__helper.hydrator.isRunning();
108
118
  },
109
119
  configurable: true,
110
120
  });
@@ -112,16 +122,25 @@ export class EntityHelper {
112
122
  }
113
123
  static defineCustomInspect(meta) {
114
124
  // @ts-ignore
115
- meta.prototype[inspect.custom] ??= function (depth = 2) {
116
- const object = { ...this };
125
+ meta.prototype[Symbol.for('nodejs.util.inspect.custom')] ??= function (depth = 2) {
126
+ const object = {};
127
+ const keys = new Set(Utils.keys(this));
128
+ for (const prop of meta.props) {
129
+ if (keys.has(prop.name) || (prop.getter && prop.accessor === prop.name)) {
130
+ object[prop.name] = this[prop.name];
131
+ }
132
+ }
133
+ for (const key of keys) {
134
+ if (!meta.properties[key]) {
135
+ object[key] = this[key];
136
+ }
137
+ }
117
138
  // ensure we dont have internal symbols in the POJO
118
- [OptionalProps, EntityRepositoryType, PrimaryKeyProp, EagerProps, HiddenProps].forEach(sym => delete object[sym]);
119
- meta.props
120
- .filter(prop => object[prop.name] === undefined)
121
- .forEach(prop => delete object[prop.name]);
139
+ [OptionalProps, EntityRepositoryType, PrimaryKeyProp, EagerProps, HiddenProps, EntityName].forEach(sym => delete object[sym]);
140
+ meta.props.filter(prop => object[prop.name] === undefined).forEach(prop => delete object[prop.name]);
122
141
  const ret = inspect(object, { depth });
123
- let name = (this).constructor.name;
124
- const showEM = ['true', 't', '1'].includes(process.env.MIKRO_ORM_LOG_EM_ID?.toString().toLowerCase() ?? '');
142
+ let name = this.constructor.name;
143
+ const showEM = ['true', 't', '1'].includes(getEnv('MIKRO_ORM_LOG_EM_ID')?.toLowerCase() ?? '');
125
144
  if (showEM) {
126
145
  if (helper(this).__em) {
127
146
  name += ` [managed by ${helper(this).__em.id}]`;
@@ -146,6 +165,7 @@ export class EntityHelper {
146
165
  set(val) {
147
166
  const entity = Reference.unwrapReference(val ?? wrapped.__data[prop.name]);
148
167
  const old = Reference.unwrapReference(wrapped.__data[prop.name]);
168
+ // oxfmt-ignore
149
169
  if (old && old !== entity && prop.kind === ReferenceKind.MANY_TO_ONE && prop.inversedBy && old[prop.inversedBy]) {
150
170
  old[prop.inversedBy].removeWithoutPropagation(this);
151
171
  }
@@ -154,9 +174,6 @@ export class EntityHelper {
154
174
  if (val && hydrator.isRunning() && wrapped.__originalEntityData && prop.owner) {
155
175
  wrapped.__originalEntityData[prop.name] = Utils.getPrimaryKeyValues(wrapped.__data[prop.name], prop.targetMeta, true);
156
176
  }
157
- else {
158
- wrapped.__touched = !hydrator.isRunning();
159
- }
160
177
  EntityHelper.propagate(meta, entity, this, prop, Reference.unwrapReference(val), old);
161
178
  },
162
179
  enumerable: true,
@@ -164,14 +181,31 @@ export class EntityHelper {
164
181
  });
165
182
  }
166
183
  static propagate(meta, entity, owner, prop, value, old) {
167
- for (const prop2 of prop.targetMeta.bidirectionalRelations) {
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) {
168
197
  if ((prop2.inversedBy || prop2.mappedBy) !== prop.name) {
169
198
  continue;
170
199
  }
200
+ // oxfmt-ignore
171
201
  if (prop2.targetMeta.abstract ? prop2.targetMeta.root.class !== meta.root.class : prop2.targetMeta.class !== meta.class) {
172
202
  continue;
173
203
  }
174
204
  const inverse = value?.[prop2.name];
205
+ if (prop.ref && owner[prop.name]) {
206
+ // eslint-disable-next-line dot-notation
207
+ owner[prop.name]['property'] = prop;
208
+ }
175
209
  if (Utils.isCollection(inverse) && inverse.isPartial()) {
176
210
  continue;
177
211
  }
@@ -195,13 +229,21 @@ export class EntityHelper {
195
229
  static propagateOneToOne(entity, owner, prop, prop2, value, old) {
196
230
  helper(entity).__pk = helper(entity).getPrimaryKey();
197
231
  // the inverse side will be changed on the `value` too, so we need to clean-up and schedule orphan removal there too
198
- if (!prop.primary && !prop2.mapToPk && value?.[prop2.name] != null && Reference.unwrapReference(value[prop2.name]) !== entity) {
232
+ if (!prop.primary &&
233
+ !prop2.mapToPk &&
234
+ value?.[prop2.name] != null &&
235
+ Reference.unwrapReference(value[prop2.name]) !== entity) {
199
236
  const other = Reference.unwrapReference(value[prop2.name]);
200
237
  delete helper(other).__data[prop.name];
201
238
  if (prop2.orphanRemoval) {
202
239
  helper(other).__em?.getUnitOfWork().scheduleOrphanRemoval(other);
203
240
  }
204
241
  }
242
+ // Skip setting the inverse side to null if it's a primary key - the entity will be removed via orphan removal
243
+ // Setting a primary key to null would corrupt the entity and cause validation errors
244
+ if (value == null && prop.orphanRemoval && prop2.primary) {
245
+ return;
246
+ }
205
247
  if (value == null) {
206
248
  entity[prop2.name] = value;
207
249
  }
@@ -1,26 +1,26 @@
1
- import type { AnyEntity, ConnectionType, Dictionary, EntityProperty, FilterQuery, PopulateOptions } from '../typings.js';
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 { EntityField } from '../drivers/IDatabaseDriver.js';
4
+ import type { FilterOptions } from '../drivers/IDatabaseDriver.js';
5
5
  import type { LoggingOptions } from '../logging/Logger.js';
6
- export type EntityLoaderOptions<Entity, Fields extends string = PopulatePath.ALL, Excludes extends string = never> = {
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?: Dictionary<boolean | Dictionary> | string[] | boolean;
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: string, entities: Entity[], populate: PopulateOptions<Entity>[] | boolean, options: EntityLoaderOptions<Entity, Fields>): Promise<void>;
34
- normalizePopulate<Entity>(entityName: string, populate: (PopulateOptions<Entity> | boolean)[] | PopulateOptions<Entity> | boolean, strategy?: LoadStrategy, lookup?: boolean): PopulateOptions<Entity>[];
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,6 +43,7 @@ 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;