@mikro-orm/core 6.3.13-dev.12 → 6.3.13-dev.13
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 +1 -1
- package/EntityManager.js +6 -0
- package/drivers/IDatabaseDriver.d.ts +3 -1
- package/package.json +2 -2
package/EntityManager.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
|
|
|
115
115
|
setFlushMode(flushMode?: FlushMode): void;
|
|
116
116
|
protected processWhere<Entity extends object, Hint extends string = never, Fields extends string = '*', Excludes extends string = never>(entityName: string, where: FilterQuery<Entity>, options: FindOptions<Entity, Hint, Fields, Excludes> | FindOneOptions<Entity, Hint, Fields, Excludes>, type: 'read' | 'update' | 'delete'): Promise<FilterQuery<Entity>>;
|
|
117
117
|
protected applyDiscriminatorCondition<Entity extends object>(entityName: string, where: FilterQuery<Entity>): FilterQuery<Entity>;
|
|
118
|
-
protected createPopulateWhere<Entity extends object>(cond: ObjectQuery<Entity>, options: FindOptions<Entity, any, any, any> | FindOneOptions<Entity, any, any, any>): ObjectQuery<Entity>;
|
|
118
|
+
protected createPopulateWhere<Entity extends object>(cond: ObjectQuery<Entity>, options: FindOptions<Entity, any, any, any> | FindOneOptions<Entity, any, any, any> | CountOptions<Entity, any>): ObjectQuery<Entity>;
|
|
119
119
|
protected getJoinedFilters<Entity extends object>(meta: EntityMetadata<Entity>, cond: ObjectQuery<Entity>, options: FindOptions<Entity, any, any, any> | FindOneOptions<Entity, any, any, any>): Promise<ObjectQuery<Entity>>;
|
|
120
120
|
/**
|
|
121
121
|
* When filters are active on M:1 or 1:1 relations, we need to ref join them eagerly as they might affect the FK value.
|
package/EntityManager.js
CHANGED
|
@@ -1230,6 +1230,12 @@ class EntityManager {
|
|
|
1230
1230
|
await em.tryFlush(entityName, options);
|
|
1231
1231
|
where = await em.processWhere(entityName, where, options, 'read');
|
|
1232
1232
|
options.populate = await em.preparePopulate(entityName, options);
|
|
1233
|
+
options = { ...options };
|
|
1234
|
+
// save the original hint value so we know it was infer/all
|
|
1235
|
+
const meta = em.metadata.find(entityName);
|
|
1236
|
+
options._populateWhere = options.populateWhere ?? this.config.get('populateWhere');
|
|
1237
|
+
options.populateWhere = this.createPopulateWhere({ ...where }, options);
|
|
1238
|
+
options.populateFilter = await this.getJoinedFilters(meta, { ...where }, options);
|
|
1233
1239
|
em.validator.validateParams(where);
|
|
1234
1240
|
delete options.orderBy;
|
|
1235
1241
|
const cacheKey = em.cacheKey(entityName, options, 'em.count', where);
|
|
@@ -86,7 +86,7 @@ export interface FindOptions<Entity, Hint extends string = never, Fields extends
|
|
|
86
86
|
* Filter condition for populated relations. This is similar to `populateWhere`, but will produce a `left join`
|
|
87
87
|
* when nesting the condition. This is used for implementation of joined filters.
|
|
88
88
|
*/
|
|
89
|
-
populateFilter?: ObjectQuery<Entity
|
|
89
|
+
populateFilter?: ObjectQuery<Entity>;
|
|
90
90
|
/** Used for ordering of the populate queries. If not specified, the value of `options.orderBy` is used. */
|
|
91
91
|
populateOrderBy?: OrderDefinition<Entity>;
|
|
92
92
|
/** Ordering of the results.Can be an object or array of objects, keys are property names, values are ordering (asc/desc) */
|
|
@@ -182,6 +182,8 @@ export interface CountOptions<T extends object, P extends string = never> {
|
|
|
182
182
|
having?: QBFilterQuery<T>;
|
|
183
183
|
cache?: boolean | number | [string, number];
|
|
184
184
|
populate?: Populate<T, P>;
|
|
185
|
+
populateWhere?: ObjectQuery<T> | PopulateHint | `${PopulateHint}`;
|
|
186
|
+
populateFilter?: ObjectQuery<T>;
|
|
185
187
|
ctx?: Transaction;
|
|
186
188
|
connectionType?: ConnectionType;
|
|
187
189
|
flushMode?: FlushMode | `${FlushMode}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.3.13-dev.
|
|
3
|
+
"version": "6.3.13-dev.13",
|
|
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.2.0",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.3.13-dev.
|
|
67
|
+
"mikro-orm": "6.3.13-dev.13",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|