@mikro-orm/core 6.6.4 → 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.
- package/EntityManager.d.ts +3 -2
- package/EntityManager.js +2 -1
- package/entity/Collection.js +1 -0
- package/package.json +2 -2
package/EntityManager.d.ts
CHANGED
|
@@ -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
|
-
|
|
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 [];
|
|
@@ -1676,7 +1677,7 @@ class EntityManager {
|
|
|
1676
1677
|
return !inlineEmbedded && !prop.lazy && !(0, entity_1.helper)(entity).__loadedProperties.has(prop.name);
|
|
1677
1678
|
});
|
|
1678
1679
|
}
|
|
1679
|
-
if (autoRefresh) {
|
|
1680
|
+
if (autoRefresh || options.filters) {
|
|
1680
1681
|
return true;
|
|
1681
1682
|
}
|
|
1682
1683
|
if (Array.isArray(options.populate)) {
|
package/entity/Collection.js
CHANGED
|
@@ -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.
|
|
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.
|
|
67
|
+
"mikro-orm": "6.6.5-dev.1",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|