@mikro-orm/core 7.0.0-rc.1 → 7.0.0-rc.3

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 (76) hide show
  1. package/EntityManager.d.ts +3 -2
  2. package/EntityManager.js +107 -43
  3. package/MikroORM.js +4 -4
  4. package/cache/FileCacheAdapter.js +1 -3
  5. package/connections/Connection.js +16 -3
  6. package/drivers/DatabaseDriver.js +26 -8
  7. package/drivers/IDatabaseDriver.d.ts +49 -1
  8. package/entity/BaseEntity.d.ts +3 -3
  9. package/entity/Collection.js +43 -17
  10. package/entity/EntityAssigner.js +23 -11
  11. package/entity/EntityFactory.js +36 -13
  12. package/entity/EntityHelper.js +27 -18
  13. package/entity/EntityLoader.d.ts +6 -6
  14. package/entity/EntityLoader.js +55 -22
  15. package/entity/EntityRepository.d.ts +1 -1
  16. package/entity/Reference.d.ts +1 -1
  17. package/entity/Reference.js +37 -8
  18. package/entity/WrappedEntity.d.ts +3 -3
  19. package/entity/WrappedEntity.js +5 -1
  20. package/entity/defineEntity.d.ts +202 -58
  21. package/entity/defineEntity.js +20 -24
  22. package/entity/utils.js +28 -26
  23. package/entity/validators.js +2 -1
  24. package/enums.js +12 -17
  25. package/errors.js +18 -8
  26. package/events/EventManager.js +1 -1
  27. package/exceptions.js +7 -2
  28. package/hydration/ObjectHydrator.js +27 -13
  29. package/index.d.ts +2 -2
  30. package/index.js +1 -1
  31. package/logging/DefaultLogger.js +3 -5
  32. package/logging/colors.js +3 -6
  33. package/metadata/EntitySchema.d.ts +2 -2
  34. package/metadata/EntitySchema.js +12 -2
  35. package/metadata/MetadataDiscovery.js +107 -48
  36. package/metadata/MetadataProvider.js +26 -1
  37. package/metadata/MetadataStorage.js +2 -4
  38. package/metadata/MetadataValidator.js +20 -5
  39. package/metadata/types.d.ts +2 -2
  40. package/naming-strategy/AbstractNamingStrategy.js +5 -2
  41. package/not-supported.js +5 -1
  42. package/package.json +40 -37
  43. package/platforms/Platform.d.ts +4 -1
  44. package/platforms/Platform.js +50 -24
  45. package/serialization/EntitySerializer.d.ts +3 -3
  46. package/serialization/EntitySerializer.js +7 -3
  47. package/serialization/EntityTransformer.js +6 -4
  48. package/serialization/SerializationContext.js +1 -1
  49. package/typings.d.ts +73 -33
  50. package/typings.js +11 -9
  51. package/unit-of-work/ChangeSet.js +4 -4
  52. package/unit-of-work/ChangeSetComputer.js +8 -6
  53. package/unit-of-work/ChangeSetPersister.js +15 -10
  54. package/unit-of-work/CommitOrderCalculator.js +4 -2
  55. package/unit-of-work/UnitOfWork.d.ts +7 -1
  56. package/unit-of-work/UnitOfWork.js +51 -22
  57. package/utils/AbstractMigrator.d.ts +101 -0
  58. package/utils/AbstractMigrator.js +303 -0
  59. package/utils/AbstractSchemaGenerator.js +2 -1
  60. package/utils/AsyncContext.js +1 -1
  61. package/utils/Configuration.d.ts +3 -1
  62. package/utils/Configuration.js +8 -4
  63. package/utils/Cursor.js +4 -2
  64. package/utils/DataloaderUtils.js +15 -12
  65. package/utils/EntityComparator.js +51 -43
  66. package/utils/QueryHelper.js +38 -26
  67. package/utils/RawQueryFragment.js +3 -2
  68. package/utils/TransactionManager.js +2 -1
  69. package/utils/Utils.d.ts +1 -1
  70. package/utils/Utils.js +36 -30
  71. package/utils/env-vars.js +6 -5
  72. package/utils/fs-utils.d.ts +1 -0
  73. package/utils/fs-utils.js +6 -5
  74. package/utils/index.d.ts +0 -2
  75. package/utils/index.js +0 -2
  76. package/utils/upsert-utils.js +6 -3
@@ -29,7 +29,7 @@ export class EntityLoader {
29
29
  throw ValidationError.notDiscoveredEntity(entity, meta, 'populate');
30
30
  }
31
31
  const references = entities.filter(e => !helper(e).isInitialized());
32
- const visited = options.visited ??= new Set();
32
+ const visited = (options.visited ??= new Set());
33
33
  options.where ??= {};
34
34
  options.orderBy ??= {};
35
35
  options.lookup ??= true;
@@ -59,6 +59,7 @@ export class EntityLoader {
59
59
  normalizePopulate(entityName, populate, strategy, lookup = true, exclude) {
60
60
  const meta = this.metadata.find(entityName);
61
61
  let normalized = Utils.asArray(populate).map(field => {
62
+ // oxfmt-ignore
62
63
  return typeof field === 'boolean' || field.field === PopulatePath.ALL ? { all: !!field, field: meta.primaryKeys[0] } : field;
63
64
  });
64
65
  if (normalized.some(p => p.all)) {
@@ -89,6 +90,7 @@ export class EntityLoader {
89
90
  */
90
91
  mergeNestedPopulate(populate) {
91
92
  const tmp = populate.reduce((ret, item) => {
93
+ /* v8 ignore next */
92
94
  if (item.field === PopulatePath.ALL) {
93
95
  return ret;
94
96
  }
@@ -125,7 +127,8 @@ export class EntityLoader {
125
127
  }
126
128
  }
127
129
  if (prop.kind === ReferenceKind.SCALAR && prop.lazy) {
128
- const filtered = entities.filter(e => options.refresh || (prop.ref ? !e[prop.name]?.isInitialized() : e[prop.name] === undefined));
130
+ const filtered = entities.filter(e => options.refresh ||
131
+ (prop.ref ? !e[prop.name]?.isInitialized() : e[prop.name] === undefined));
129
132
  if (options.ignoreLazyScalarProperties || filtered.length === 0) {
130
133
  return entities;
131
134
  }
@@ -137,7 +140,8 @@ export class EntityLoader {
137
140
  }
138
141
  const filtered = this.filterCollections(entities, field, options, ref);
139
142
  const innerOrderBy = Utils.asArray(options.orderBy)
140
- .filter(orderBy => (Array.isArray(orderBy[prop.name]) && orderBy[prop.name].length > 0) || Utils.isObject(orderBy[prop.name]))
143
+ .filter(orderBy => (Array.isArray(orderBy[prop.name]) && orderBy[prop.name].length > 0) ||
144
+ Utils.isObject(orderBy[prop.name]))
141
145
  .flatMap(orderBy => orderBy[prop.name]);
142
146
  const where = await this.extractChildCondition(options, prop);
143
147
  if (prop.kind === ReferenceKind.MANY_TO_MANY && this.driver.getPlatform().usesPivotTable()) {
@@ -163,7 +167,13 @@ export class EntityLoader {
163
167
  const where = this.mergePrimaryCondition(ids, pk, options, meta, this.metadata, this.driver.getPlatform());
164
168
  const { filters, convertCustomTypes, lockMode, strategy, populateWhere, connectionType, logging, fields } = options;
165
169
  await this.em.find(meta.class, where, {
166
- filters, convertCustomTypes, lockMode, strategy, populateWhere, connectionType, logging,
170
+ filters,
171
+ convertCustomTypes,
172
+ lockMode,
173
+ strategy,
174
+ populateWhere,
175
+ connectionType,
176
+ logging,
167
177
  fields: fields,
168
178
  populate: [],
169
179
  });
@@ -260,7 +270,8 @@ export class EntityLoader {
260
270
  entity[field].hydrate(items, true, partial);
261
271
  }
262
272
  }
263
- else { // owning side of M:N without pivot table needs to be reordered
273
+ else {
274
+ // owning side of M:N without pivot table needs to be reordered
264
275
  for (const entity of filtered) {
265
276
  const order = !customOrder ? [...entity[prop.name].getItems(false)] : []; // copy order of references
266
277
  const items = children.filter(child => entity[prop.name].contains(child, false));
@@ -301,7 +312,7 @@ export class EntityLoader {
301
312
  if (!schema && [ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(prop.kind)) {
302
313
  schema = children.find(e => e.__helper.__schema)?.__helper.__schema;
303
314
  }
304
- const ids = Utils.unique(children.map(e => prop.targetKey ? e[prop.targetKey] : e.__helper.getPrimaryKey()));
315
+ const ids = Utils.unique(children.map(e => (prop.targetKey ? e[prop.targetKey] : e.__helper.getPrimaryKey())));
305
316
  let where;
306
317
  if (polymorphicOwnerProp && Array.isArray(fk)) {
307
318
  const conditions = ids.map(id => {
@@ -315,7 +326,8 @@ export class EntityLoader {
315
326
  }
316
327
  if (polymorphicOwnerProp) {
317
328
  const parentMeta = this.metadata.find(entities[0].constructor);
318
- const discriminatorValue = QueryHelper.findDiscriminatorValue(polymorphicOwnerProp.discriminatorMap, parentMeta.class) ?? parentMeta.tableName;
329
+ const discriminatorValue = QueryHelper.findDiscriminatorValue(polymorphicOwnerProp.discriminatorMap, parentMeta.class) ??
330
+ parentMeta.tableName;
319
331
  const discriminatorColumn = polymorphicOwnerProp.fieldNames[0];
320
332
  where = { $and: [where, { [discriminatorColumn]: discriminatorValue }] };
321
333
  }
@@ -331,11 +343,20 @@ export class EntityLoader {
331
343
  }
332
344
  const orderBy = QueryHelper.mergeOrderBy(options.orderBy, prop.orderBy);
333
345
  const items = await this.em.find(meta.class, where, {
334
- filters, convertCustomTypes, lockMode, populateWhere, logging,
346
+ filters,
347
+ convertCustomTypes,
348
+ lockMode,
349
+ populateWhere,
350
+ logging,
335
351
  orderBy,
336
352
  populate: populate.children ?? populate.all ?? [],
337
- exclude: Array.isArray(options.exclude) ? Utils.extractChildElements(options.exclude, prop.name) : options.exclude,
338
- strategy, fields, schema, connectionType,
353
+ exclude: Array.isArray(options.exclude)
354
+ ? Utils.extractChildElements(options.exclude, prop.name)
355
+ : options.exclude,
356
+ strategy,
357
+ fields,
358
+ schema,
359
+ connectionType,
339
360
  // @ts-ignore not a public option, will be propagated to the populate call
340
361
  refresh: refresh && !children.every(item => options.visited.has(item)),
341
362
  // @ts-ignore not a public option, will be propagated to the populate call
@@ -355,6 +376,7 @@ export class EntityLoader {
355
376
  if (!ref) {
356
377
  continue;
357
378
  }
379
+ // oxfmt-ignore
358
380
  const keyValue = '' + (Reference.isReference(ref) ? ref.unwrap()[prop.targetKey] : ref[prop.targetKey]);
359
381
  const loadedItem = itemsByKey.get(keyValue);
360
382
  if (loadedItem) {
@@ -367,7 +389,7 @@ export class EntityLoader {
367
389
  const itemsMap = new Set();
368
390
  const childrenMap = new Set();
369
391
  // Use targetKey value if set, otherwise use serialized PK
370
- const getKey = (e) => prop.targetKey ? '' + e[prop.targetKey] : helper(e).getSerializedPrimaryKey();
392
+ const getKey = (e) => (prop.targetKey ? '' + e[prop.targetKey] : helper(e).getSerializedPrimaryKey());
371
393
  for (const item of items) {
372
394
  /* v8 ignore next */
373
395
  itemsMap.add(getKey(item));
@@ -394,12 +416,16 @@ export class EntityLoader {
394
416
  return { items, partial };
395
417
  }
396
418
  mergePrimaryCondition(ids, pk, options, meta, metadata, platform) {
397
- const cond1 = QueryHelper.processWhere({ where: { [pk]: { $in: ids } }, entityName: meta.class, metadata, platform, convertCustomTypes: !options.convertCustomTypes });
419
+ const cond1 = QueryHelper.processWhere({
420
+ where: { [pk]: { $in: ids } },
421
+ entityName: meta.class,
422
+ metadata,
423
+ platform,
424
+ convertCustomTypes: !options.convertCustomTypes,
425
+ });
398
426
  const where = { ...options.where };
399
427
  Utils.dropUndefinedProperties(where);
400
- return where[pk]
401
- ? { $and: [cond1, where] }
402
- : { ...cond1, ...where };
428
+ return where[pk] ? { $and: [cond1, where] } : { ...cond1, ...where };
403
429
  }
404
430
  async populateField(entityName, entities, populate, options) {
405
431
  const field = populate.field.split(':')[0];
@@ -436,6 +462,7 @@ export class EntityLoader {
436
462
  .filter(orderBy => Utils.isObject(orderBy[prop.name]))
437
463
  .map(orderBy => orderBy[prop.name]);
438
464
  const { refresh, filters, ignoreLazyScalarProperties, populateWhere, connectionType, logging, schema } = options;
465
+ // oxfmt-ignore
439
466
  const exclude = Array.isArray(options.exclude) ? Utils.extractChildElements(options.exclude, prop.name) : options.exclude;
440
467
  const visited = options.visited;
441
468
  for (const entity of entities) {
@@ -451,7 +478,7 @@ export class EntityLoader {
451
478
  }
452
479
  const populateChildren = async (targetMeta, items) => {
453
480
  await this.populate(targetMeta.class, items, populate.children ?? populate.all, {
454
- where: await this.extractChildCondition(options, prop, false),
481
+ where: (await this.extractChildCondition(options, prop, false)),
455
482
  orderBy: innerOrderBy,
456
483
  fields,
457
484
  exclude,
@@ -489,13 +516,14 @@ export class EntityLoader {
489
516
  const refresh = options.refresh;
490
517
  let where = await this.extractChildCondition(options, prop, true);
491
518
  const fields = this.buildFields(options.fields, prop);
519
+ // oxfmt-ignore
492
520
  const exclude = Array.isArray(options.exclude) ? Utils.extractChildElements(options.exclude, prop.name) : options.exclude;
493
521
  const populateFilter = options.populateFilter?.[prop.name];
494
522
  const options2 = { ...options, fields, exclude, populateFilter };
495
523
  ['limit', 'offset', 'first', 'last', 'before', 'after', 'overfetch'].forEach(prop => delete options2[prop]);
496
- options2.populate = (populate?.children ?? []);
524
+ options2.populate = populate?.children ?? [];
497
525
  if (prop.customType) {
498
- ids.forEach((id, idx) => ids[idx] = QueryHelper.processCustomType(prop, id, this.driver.getPlatform()));
526
+ ids.forEach((id, idx) => (ids[idx] = QueryHelper.processCustomType(prop, id, this.driver.getPlatform())));
499
527
  }
500
528
  if (!Utils.isEmpty(prop.where)) {
501
529
  where = { $and: [where, prop.where] };
@@ -532,7 +560,8 @@ export class EntityLoader {
532
560
  if (where[op]) {
533
561
  const child = where[op]
534
562
  .map((cond) => cond[prop.name])
535
- .filter((sub) => sub != null && !(Utils.isPlainObject(sub) && Utils.getObjectQueryKeys(sub).every(key => Utils.isOperator(key, false))))
563
+ .filter((sub) => sub != null &&
564
+ !(Utils.isPlainObject(sub) && Utils.getObjectQueryKeys(sub).every(key => Utils.isOperator(key, false))))
536
565
  .map((cond) => {
537
566
  if (Utils.isPrimaryKey(cond)) {
538
567
  return { [pk]: cond };
@@ -603,7 +632,8 @@ export class EntityLoader {
603
632
  return a;
604
633
  }, []);
605
634
  }
606
- if (prop.kind === ReferenceKind.MANY_TO_MANY) { // inverse side
635
+ if (prop.kind === ReferenceKind.MANY_TO_MANY) {
636
+ // inverse side
607
637
  return filtered;
608
638
  }
609
639
  // MANY_TO_ONE or ONE_TO_ONE
@@ -706,7 +736,10 @@ export class EntityLoader {
706
736
  .forEach(prop => {
707
737
  const field = this.getRelationName(meta, prop);
708
738
  const prefixed = prefix ? `${prefix}.${field}` : field;
709
- const nestedPopulate = populate.filter(p => p.field === prop.name).flatMap(p => p.children).filter(Boolean);
739
+ const nestedPopulate = populate
740
+ .filter(p => p.field === prop.name)
741
+ .flatMap(p => p.children)
742
+ .filter(Boolean);
710
743
  const nested = this.lookupEagerLoadedRelationships(prop.targetMeta.class, nestedPopulate, strategy, prefixed, visited.slice(), exclude);
711
744
  if (nested.length > 0) {
712
745
  ret.push(...nested);
@@ -716,7 +749,7 @@ export class EntityLoader {
716
749
  ret.push({
717
750
  field: prefixed,
718
751
  // enforce select-in strategy for self-referencing relations
719
- strategy: selfReferencing ? LoadStrategy.SELECT_IN : strategy ?? prop.strategy,
752
+ strategy: selfReferencing ? LoadStrategy.SELECT_IN : (strategy ?? prop.strategy),
720
753
  });
721
754
  }
722
755
  });
@@ -150,7 +150,7 @@ export declare class EntityRepository<Entity extends object> {
150
150
  /**
151
151
  * Loads specified relations in batch. This will execute one query for each relation, that will populate it on all the specified entities.
152
152
  */
153
- populate<Ent extends Entity | Entity[], Hint extends string = never, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Fields extends string = '*', Excludes extends string = never>(entities: Ent, populate: AutoPath<Naked, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Naked, Fields, Excludes>): Promise<Ent extends object[] ? MergeLoaded<ArrayElement<Ent>, Naked, Hint, Fields, Excludes>[] : MergeLoaded<Ent, Naked, Hint, Fields, Excludes>>;
153
+ populate<Ent extends Entity | Entity[], Hint extends string = never, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Fields extends string = never, Excludes extends string = never>(entities: Ent, populate: AutoPath<Naked, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Naked, Fields, Excludes>): Promise<Ent extends object[] ? MergeLoaded<ArrayElement<Ent>, Naked, Hint, Fields, Excludes>[] : MergeLoaded<Ent, Naked, Hint, Fields, Excludes>>;
154
154
  /**
155
155
  * Creates new instance of given entity and populates it with given data.
156
156
  * The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
@@ -73,7 +73,7 @@ export interface LoadReferenceOrFailOptions<T extends object, P extends string =
73
73
  /**
74
74
  * shortcut for `wrap(entity).toReference()`
75
75
  */
76
- export declare function ref<I extends unknown | Ref<unknown> | undefined | null, T extends I & {}>(entity: I): Ref<T> & LoadedReference<Loaded<T, AddEager<T>>> | AddOptional<typeof entity>;
76
+ export declare function ref<I extends unknown | Ref<unknown> | undefined | null, T extends I & {}>(entity: I): (Ref<T> & LoadedReference<Loaded<T, AddEager<T>>>) | AddOptional<typeof entity>;
77
77
  /**
78
78
  * shortcut for `Reference.createFromPK(entityType, pk)`
79
79
  */
@@ -93,7 +93,8 @@ export class Reference {
93
93
  await wrapped.__em.populate(this.entity, options.populate, options);
94
94
  }
95
95
  if (!this.isInitialized() || options.refresh) {
96
- if (options.dataloader ?? [DataloaderType.ALL, DataloaderType.REFERENCE].includes(wrapped.__em.config.getDataloaderType())) {
96
+ if (options.dataloader ??
97
+ [DataloaderType.ALL, DataloaderType.REFERENCE].includes(wrapped.__em.config.getDataloaderType())) {
97
98
  const dataLoader = await wrapped.__em.getDataLoader('ref');
98
99
  return dataLoader.load([this, options]);
99
100
  }
@@ -219,16 +220,44 @@ export class ScalarReference {
219
220
  }
220
221
  Object.defineProperties(Reference.prototype, {
221
222
  __reference: { value: true, enumerable: false },
222
- __meta: { get() { return this.entity.__meta; } },
223
- __platform: { get() { return this.entity.__platform; } },
224
- __helper: { get() { return this.entity.__helper; } },
225
- $: { get() { return this.entity; } },
226
- get: { get() { return () => this.entity; } },
223
+ __meta: {
224
+ get() {
225
+ return this.entity.__meta;
226
+ },
227
+ },
228
+ __platform: {
229
+ get() {
230
+ return this.entity.__platform;
231
+ },
232
+ },
233
+ __helper: {
234
+ get() {
235
+ return this.entity.__helper;
236
+ },
237
+ },
238
+ $: {
239
+ get() {
240
+ return this.entity;
241
+ },
242
+ },
243
+ get: {
244
+ get() {
245
+ return () => this.entity;
246
+ },
247
+ },
227
248
  });
228
249
  Object.defineProperties(ScalarReference.prototype, {
229
250
  __scalarReference: { value: true, enumerable: false },
230
- $: { get() { return this.value; } },
231
- get: { get() { return () => this.value; } },
251
+ $: {
252
+ get() {
253
+ return this.value;
254
+ },
255
+ },
256
+ get: {
257
+ get() {
258
+ return () => this.value;
259
+ },
260
+ },
232
261
  });
233
262
  /**
234
263
  * shortcut for `wrap(entity).toReference()`
@@ -1,6 +1,6 @@
1
1
  import type { PopulatePath } from '../enums.js';
2
2
  import type { EntityManager } from '../EntityManager.js';
3
- import type { Dictionary, EntityData, EntityDictionary, EntityMetadata, IHydrator, EntityKey, PopulateOptions, Primary, AutoPath, Ref, AddEager, LoadedReference, EntityDTO, Loaded, FromEntityType, IsSubset, MergeSelected } from '../typings.js';
3
+ import type { Dictionary, EntityData, EntityDictionary, EntityMetadata, IHydrator, EntityKey, PopulateOptions, Primary, AutoPath, Ref, AddEager, LoadedReference, EntityDTO, Loaded, SerializeDTO, FromEntityType, IsSubset, MergeSelected } from '../typings.js';
4
4
  import { Reference } from './Reference.js';
5
5
  import { type AssignOptions } from './EntityAssigner.js';
6
6
  import type { EntityLoaderOptions } from './EntityLoader.js';
@@ -44,12 +44,12 @@ export declare class WrappedEntity<Entity extends object> {
44
44
  setSerializationContext<Hint extends string = never, Fields extends string = '*', Exclude extends string = never>(options: LoadHint<Entity, Hint, Fields, Exclude>): void;
45
45
  toReference(): Ref<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
46
46
  toObject<Ignored extends EntityKey<Entity> = never>(ignoreFields?: Ignored[]): Omit<EntityDTO<Entity>, Ignored>;
47
- serialize<Hint extends string = never, Exclude extends string = never>(options?: SerializeOptions<Entity, Hint, Exclude>): EntityDTO<Loaded<Entity, Hint>>;
47
+ serialize<Hint extends string = never, Exclude extends string = never>(options?: SerializeOptions<Entity, Hint, Exclude>): SerializeDTO<Entity, Hint, Exclude>;
48
48
  toPOJO(): EntityDTO<Entity>;
49
49
  toJSON(...args: any[]): EntityDictionary<Entity>;
50
50
  assign<Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Convert extends boolean = false, Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> = EntityData<Naked, Convert> | Partial<EntityDTO<Naked>>>(data: Data & IsSubset<EntityData<Naked>, Data>, options?: AssignOptions<Convert>): MergeSelected<Entity, Naked, keyof Data & string>;
51
51
  init<Hint extends string = never, Fields extends string = '*', Excludes extends string = never>(options?: FindOneOptions<Entity, Hint, Fields, Excludes>): Promise<Loaded<Entity, Hint, Fields, Excludes> | null>;
52
- populate<Hint extends string = never>(populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Entity>): Promise<Loaded<Entity, Hint>>;
52
+ populate<Hint extends string = never, Fields extends string = never>(populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Entity, Fields>): Promise<Loaded<Entity, Hint>>;
53
53
  hasPrimaryKey(): boolean;
54
54
  getPrimaryKey(convertCustomTypes?: boolean): Primary<Entity> | null;
55
55
  getPrimaryKeys(convertCustomTypes?: boolean): Primary<Entity>[] | null;
@@ -71,7 +71,11 @@ export class WrappedEntity {
71
71
  if (!this.__em) {
72
72
  throw ValidationError.entityNotManaged(this.entity);
73
73
  }
74
- return this.__em.findOne(this.entity.constructor, this.entity, { ...options, refresh: true, schema: this.__schema });
74
+ return this.__em.findOne(this.entity.constructor, this.entity, {
75
+ ...options,
76
+ refresh: true,
77
+ schema: this.__schema,
78
+ });
75
79
  }
76
80
  async populate(populate, options = {}) {
77
81
  if (!this.__em) {