@mikro-orm/knex 6.2.6-dev.12 → 6.2.6-dev.14
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/package.json +2 -2
- package/query/QueryBuilder.js +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.2.6-dev.
|
|
3
|
+
"version": "6.2.6-dev.14",
|
|
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",
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.2.5"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.2.6-dev.
|
|
69
|
+
"@mikro-orm/core": "6.2.6-dev.14"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/query/QueryBuilder.js
CHANGED
|
@@ -1278,7 +1278,19 @@ class QueryBuilder {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
1280
|
addPath(this._populate);
|
|
1281
|
-
|
|
1281
|
+
const joins = Object.entries(this._joins);
|
|
1282
|
+
const rootAlias = this.alias;
|
|
1283
|
+
function addParentAlias(alias) {
|
|
1284
|
+
const join = joins.find(j => j[1].alias === alias);
|
|
1285
|
+
if (join && join[1].ownerAlias !== rootAlias) {
|
|
1286
|
+
orderByAliases.push(join[1].ownerAlias);
|
|
1287
|
+
addParentAlias(join[1].ownerAlias);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
for (const orderByAlias of orderByAliases) {
|
|
1291
|
+
addParentAlias(orderByAlias);
|
|
1292
|
+
}
|
|
1293
|
+
for (const [key, join] of joins) {
|
|
1282
1294
|
const path = join.path?.replace(/\[populate]|\[pivot]|:ref/g, '').replace(new RegExp(`^${meta.className}.`), '');
|
|
1283
1295
|
if (!populate.has(path ?? '') && !orderByAliases.includes(join.alias)) {
|
|
1284
1296
|
delete this._joins[key];
|