@mikro-orm/knex 6.5.1 → 6.5.2-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/package.json +2 -2
- package/query/QueryBuilder.js +13 -3
- package/typings.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.5.1",
|
|
3
|
+
"version": "6.5.2-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",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.5.1"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "
|
|
69
|
+
"@mikro-orm/core": "6.5.2-dev.1",
|
|
70
70
|
"better-sqlite3": "*",
|
|
71
71
|
"libsql": "*",
|
|
72
72
|
"mariadb": "*"
|
package/query/QueryBuilder.js
CHANGED
|
@@ -1294,17 +1294,27 @@ class QueryBuilder {
|
|
|
1294
1294
|
return;
|
|
1295
1295
|
}
|
|
1296
1296
|
const joins = Object.values(this._joins);
|
|
1297
|
+
const lookupParentGroup = (j) => {
|
|
1298
|
+
return j.nested ?? (j.parent ? lookupParentGroup(j.parent) : undefined);
|
|
1299
|
+
};
|
|
1297
1300
|
for (const join of joins) {
|
|
1298
1301
|
if (join.type === enums_1.JoinType.innerJoin) {
|
|
1299
|
-
|
|
1302
|
+
join.parent = joins.find(j => j.alias === join.ownerAlias);
|
|
1300
1303
|
// https://stackoverflow.com/a/56815807/3665878
|
|
1301
|
-
if (
|
|
1302
|
-
const nested = (
|
|
1304
|
+
if (join.parent?.type === enums_1.JoinType.leftJoin || join.parent?.type === enums_1.JoinType.nestedLeftJoin) {
|
|
1305
|
+
const nested = ((join.parent).nested ??= new Set());
|
|
1303
1306
|
join.type = join.type === enums_1.JoinType.innerJoin
|
|
1304
1307
|
? enums_1.JoinType.nestedInnerJoin
|
|
1305
1308
|
: enums_1.JoinType.nestedLeftJoin;
|
|
1306
1309
|
nested.add(join);
|
|
1307
1310
|
}
|
|
1311
|
+
else if (join.parent?.type === enums_1.JoinType.nestedInnerJoin) {
|
|
1312
|
+
const group = lookupParentGroup(join.parent);
|
|
1313
|
+
join.type = join.type === enums_1.JoinType.innerJoin
|
|
1314
|
+
? enums_1.JoinType.nestedInnerJoin
|
|
1315
|
+
: enums_1.JoinType.nestedLeftJoin;
|
|
1316
|
+
group?.add(join);
|
|
1317
|
+
}
|
|
1308
1318
|
}
|
|
1309
1319
|
}
|
|
1310
1320
|
}
|