@mikro-orm/core 6.6.5-dev.0 → 6.6.5-dev.1

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.
@@ -4,7 +4,7 @@ import { type Configuration, Cursor } from './utils';
4
4
  import { type AssignOptions, EntityFactory, EntityLoader, type EntityLoaderOptions, type EntityRepository, EntityValidator, Reference } from './entity';
5
5
  import { UnitOfWork } from './unit-of-work';
6
6
  import type { CountOptions, DeleteOptions, FilterOptions, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, GetReferenceOptions, IDatabaseDriver, LockOptions, NativeInsertUpdateOptions, UpdateOptions, UpsertManyOptions, UpsertOptions } from './drivers';
7
- import type { AnyEntity, AnyString, ArrayElement, AutoPath, ConnectionType, Dictionary, EntityData, EntityDictionary, EntityDTO, EntityMetadata, EntityName, FilterDef, FilterQuery, FromEntityType, GetRepository, IHydrator, IsSubset, Loaded, MaybePromise, MergeLoaded, MergeSelected, NoInfer, ObjectQuery, Primary, Ref, RequiredEntityData, UnboxArray } from './typings';
7
+ import type { AnyEntity, AnyString, ArrayElement, AutoPath, ConnectionType, Dictionary, EntityData, EntityDictionary, EntityDTO, EntityMetadata, EntityName, FilterDef, FilterQuery, FromEntityType, GetRepository, IHydrator, IsSubset, Loaded, MaybePromise, MergeLoaded, MergeSelected, NoInfer, ObjectQuery, PopulateOptions, Primary, Ref, RequiredEntityData, UnboxArray } from './typings';
8
8
  import { FlushMode, LockMode, PopulatePath, type TransactionOptions } from './enums';
9
9
  import type { MetadataStorage } from './metadata';
10
10
  import type { Transaction } from './connections';
@@ -506,7 +506,8 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
506
506
  private checkLockRequirements;
507
507
  private lockAndPopulate;
508
508
  private buildFields;
509
- private preparePopulate;
509
+ /** @internal */
510
+ preparePopulate<Entity extends object>(entityName: string, options: Pick<FindOptions<Entity, any, any>, 'populate' | 'strategy' | 'fields' | 'flags' | 'filters'>, validate?: boolean): Promise<PopulateOptions<Entity>[]>;
510
511
  /**
511
512
  * when the entity is found in identity map, we check if it was partially loaded or we are trying to populate
512
513
  * some additional lazy properties, if so, we reload and merge the data from database
package/EntityManager.js CHANGED
@@ -1583,6 +1583,7 @@ class EntityManager {
1583
1583
  return ret;
1584
1584
  }, []);
1585
1585
  }
1586
+ /** @internal */
1586
1587
  async preparePopulate(entityName, options, validate = true) {
1587
1588
  if (options.populate === false) {
1588
1589
  return [];
@@ -85,6 +85,7 @@ class Collection extends ArrayCollection_1.ArrayCollection {
85
85
  opts.orderBy = this.createOrderBy(opts.orderBy);
86
86
  let items;
87
87
  if (this.property.kind === enums_1.ReferenceKind.MANY_TO_MANY && em.getPlatform().usesPivotTable()) {
88
+ options.populate = await em.preparePopulate(this.property.type, options);
88
89
  const cond = await em.applyFilters(this.property.type, where, options.filters ?? {}, 'read');
89
90
  const map = await em.getDriver().loadFromPivotTable(this.property, [(0, wrap_1.helper)(this.owner).__primaryKeys], cond, opts.orderBy, ctx, options);
90
91
  items = map[(0, wrap_1.helper)(this.owner).getSerializedPrimaryKey()].map((item) => em.merge(this.property.type, item, { convertCustomTypes: true }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.6.5-dev.0",
3
+ "version": "6.6.5-dev.1",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.3.3",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.6.5-dev.0",
67
+ "mikro-orm": "6.6.5-dev.1",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }