@mikro-orm/sql 7.1.13-dev.6 → 7.1.13-dev.7
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.d.ts +4 -4
- package/query/QueryBuilder.js +6 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.1.13-dev.
|
|
3
|
+
"version": "7.1.13-dev.7",
|
|
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
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@mikro-orm/core": "^7.1.12"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.1.13-dev.
|
|
56
|
+
"@mikro-orm/core": "7.1.13-dev.7"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|
package/query/QueryBuilder.d.ts
CHANGED
|
@@ -995,10 +995,10 @@ export declare class QueryBuilder<Entity extends object = AnyEntity, RootAlias e
|
|
|
995
995
|
private processPopulateWhere;
|
|
996
996
|
private mergeOnConditions;
|
|
997
997
|
/**
|
|
998
|
-
* `$or` branches can be moved to a
|
|
999
|
-
*
|
|
1000
|
-
*
|
|
1001
|
-
* `
|
|
998
|
+
* `$or` branches can be moved to a join's `on` clause only when they all target that same join
|
|
999
|
+
* and stay flat — a partial `$or` in the `on` clause would drop rows matching a sibling branch,
|
|
1000
|
+
* and nested operators cannot be preserved inside a distributed disjunction, as `mergeOnConditions`
|
|
1001
|
+
* would flatten them into `and` conjuncts.
|
|
1002
1002
|
*/
|
|
1003
1003
|
private canDistributeOrBranches;
|
|
1004
1004
|
/**
|
package/query/QueryBuilder.js
CHANGED
|
@@ -2038,7 +2038,7 @@ export class QueryBuilder {
|
|
|
2038
2038
|
for (const k of Object.keys(cond)) {
|
|
2039
2039
|
if (Utils.isOperator(k)) {
|
|
2040
2040
|
if (Array.isArray(cond[k])) {
|
|
2041
|
-
// a partial `$or` on a
|
|
2041
|
+
// a partial `$or` on a join drops rows matching a sibling branch, but entity filters have no other sink, so they must pass
|
|
2042
2042
|
if (k === '$or' && !filter && !this.canDistributeOrBranches(cond[k], joins)) {
|
|
2043
2043
|
continue;
|
|
2044
2044
|
}
|
|
@@ -2076,10 +2076,10 @@ export class QueryBuilder {
|
|
|
2076
2076
|
}
|
|
2077
2077
|
}
|
|
2078
2078
|
/**
|
|
2079
|
-
* `$or` branches can be moved to a
|
|
2080
|
-
*
|
|
2081
|
-
*
|
|
2082
|
-
* `
|
|
2079
|
+
* `$or` branches can be moved to a join's `on` clause only when they all target that same join
|
|
2080
|
+
* and stay flat — a partial `$or` in the `on` clause would drop rows matching a sibling branch,
|
|
2081
|
+
* and nested operators cannot be preserved inside a distributed disjunction, as `mergeOnConditions`
|
|
2082
|
+
* would flatten them into `and` conjuncts.
|
|
2083
2083
|
*/
|
|
2084
2084
|
canDistributeOrBranches(branches, joins) {
|
|
2085
2085
|
const aliases = new Set();
|
|
@@ -2095,12 +2095,8 @@ export class QueryBuilder {
|
|
|
2095
2095
|
};
|
|
2096
2096
|
branches.forEach(collectAliases);
|
|
2097
2097
|
const targeted = joins.filter(j => aliases.has(j.alias));
|
|
2098
|
-
// nested operators cannot be preserved inside a distributed disjunction, `mergeOnConditions` would flatten them into `and` conjuncts
|
|
2099
2098
|
const flat = branches.every(branch => Object.keys(branch).every(k => !Utils.isOperator(k)));
|
|
2100
|
-
|
|
2101
|
-
return true;
|
|
2102
|
-
}
|
|
2103
|
-
return !targeted.some(j => [ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(j.prop.kind));
|
|
2099
|
+
return aliases.size === 1 && targeted.length === 1 && flat;
|
|
2104
2100
|
}
|
|
2105
2101
|
/**
|
|
2106
2102
|
* When adding an inner join on a left joined relation, we need to nest them,
|