@mikro-orm/knex 7.0.0-dev.23 → 7.0.0-dev.24
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 +14 -4
- package/typings.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "7.0.0-dev.
|
|
3
|
+
"version": "7.0.0-dev.24",
|
|
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
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"@mikro-orm/core": "^6.5.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@mikro-orm/core": "7.0.0-dev.
|
|
60
|
+
"@mikro-orm/core": "7.0.0-dev.24"
|
|
61
61
|
}
|
|
62
62
|
}
|
package/query/QueryBuilder.js
CHANGED
|
@@ -285,7 +285,7 @@ export class QueryBuilder {
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
if (Utils.hasObjectKeys(join.cond)) {
|
|
288
|
-
/*
|
|
288
|
+
/* v8 ignore next */
|
|
289
289
|
join.cond = { $and: [join.cond, cond] };
|
|
290
290
|
}
|
|
291
291
|
else {
|
|
@@ -1249,17 +1249,27 @@ export class QueryBuilder {
|
|
|
1249
1249
|
return;
|
|
1250
1250
|
}
|
|
1251
1251
|
const joins = Object.values(this._joins);
|
|
1252
|
+
const lookupParentGroup = (j) => {
|
|
1253
|
+
return j.nested ?? (j.parent ? lookupParentGroup(j.parent) : undefined);
|
|
1254
|
+
};
|
|
1252
1255
|
for (const join of joins) {
|
|
1253
1256
|
if (join.type === JoinType.innerJoin) {
|
|
1254
|
-
|
|
1257
|
+
join.parent = joins.find(j => j.alias === join.ownerAlias);
|
|
1255
1258
|
// https://stackoverflow.com/a/56815807/3665878
|
|
1256
|
-
if (
|
|
1257
|
-
const nested = (
|
|
1259
|
+
if (join.parent?.type === JoinType.leftJoin || join.parent?.type === JoinType.nestedLeftJoin) {
|
|
1260
|
+
const nested = ((join.parent).nested ??= new Set());
|
|
1258
1261
|
join.type = join.type === JoinType.innerJoin
|
|
1259
1262
|
? JoinType.nestedInnerJoin
|
|
1260
1263
|
: JoinType.nestedLeftJoin;
|
|
1261
1264
|
nested.add(join);
|
|
1262
1265
|
}
|
|
1266
|
+
else if (join.parent?.type === JoinType.nestedInnerJoin) {
|
|
1267
|
+
const group = lookupParentGroup(join.parent);
|
|
1268
|
+
join.type = join.type === JoinType.innerJoin
|
|
1269
|
+
? JoinType.nestedInnerJoin
|
|
1270
|
+
: JoinType.nestedLeftJoin;
|
|
1271
|
+
group?.add(join);
|
|
1272
|
+
}
|
|
1263
1273
|
}
|
|
1264
1274
|
}
|
|
1265
1275
|
}
|