@mikro-orm/sql 7.1.15-dev.0 → 7.1.15-dev.2
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 +2 -0
- package/query/QueryBuilder.js +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.1.15-dev.
|
|
3
|
+
"version": "7.1.15-dev.2",
|
|
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.14"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.1.15-dev.
|
|
56
|
+
"@mikro-orm/core": "7.1.15-dev.2"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|
package/query/QueryBuilder.d.ts
CHANGED
|
@@ -782,6 +782,8 @@ export declare class QueryBuilder<Entity extends object = AnyEntity, RootAlias e
|
|
|
782
782
|
* @internal
|
|
783
783
|
*/
|
|
784
784
|
getJoinForPath(path: string, options?: ICriteriaNodeProcessOptions): JoinOptions | undefined;
|
|
785
|
+
/** Branch-insensitive path matching still must not cross branches — segments with different explicit branch markers (e.g. `Mobile[0]` vs `Mobile[1]`) belong to sibling joins. */
|
|
786
|
+
private branchesConflict;
|
|
785
787
|
/**
|
|
786
788
|
* @internal
|
|
787
789
|
*/
|
package/query/QueryBuilder.js
CHANGED
|
@@ -990,12 +990,13 @@ export class QueryBuilder {
|
|
|
990
990
|
}
|
|
991
991
|
if (!join && options?.ignoreBranching) {
|
|
992
992
|
join = joins.find(j => {
|
|
993
|
-
return j.path?.replace(/\[\d+]/g, '') === path.replace(/\[\d+]/g, '');
|
|
993
|
+
return j.path?.replace(/\[\d+]/g, '') === path.replace(/\[\d+]/g, '') && !this.branchesConflict(j.path, path);
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
996
|
if (!join && options?.matchPopulateJoins && options?.ignoreBranching) {
|
|
997
997
|
join = joins.find(j => {
|
|
998
|
-
return j.path?.replace(/\[\d+]|\[populate]/g, '') === path.replace(/\[\d+]|\[populate]/g, '')
|
|
998
|
+
return (j.path?.replace(/\[\d+]|\[populate]/g, '') === path.replace(/\[\d+]|\[populate]/g, '') &&
|
|
999
|
+
!this.branchesConflict(j.path, path));
|
|
999
1000
|
});
|
|
1000
1001
|
}
|
|
1001
1002
|
if (!join && options?.matchPopulateJoins) {
|
|
@@ -1005,6 +1006,12 @@ export class QueryBuilder {
|
|
|
1005
1006
|
}
|
|
1006
1007
|
return join;
|
|
1007
1008
|
}
|
|
1009
|
+
/** Branch-insensitive path matching still must not cross branches — segments with different explicit branch markers (e.g. `Mobile[0]` vs `Mobile[1]`) belong to sibling joins. */
|
|
1010
|
+
branchesConflict(path1, path2) {
|
|
1011
|
+
const markers = (path) => path.split('.').map(segment => /\[(\d+)]/.exec(segment)?.[1]);
|
|
1012
|
+
const markers2 = markers(path2);
|
|
1013
|
+
return markers(path1).some((m, idx) => m != null && markers2[idx] != null && m !== markers2[idx]);
|
|
1014
|
+
}
|
|
1008
1015
|
/**
|
|
1009
1016
|
* @internal
|
|
1010
1017
|
*/
|