@mikro-orm/sql 7.1.10-dev.1 → 7.1.10-dev.3

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.
@@ -1675,14 +1675,15 @@ export class AbstractSqlDriver extends DatabaseDriver {
1675
1675
  // (including virtual ones, as the owner FK of a polymorphic pivot is only mapped via non-persisted relations)
1676
1676
  const pivotRelations = meta.pivotTable && !meta.compositePK ? meta.relations.filter(p => p.kind === ReferenceKind.MANY_TO_ONE) : [];
1677
1677
  for (const item of rawResults) {
1678
- let pk = Utils.getCompositeKeyHash(item, meta);
1678
+ // flat hash, so nested composite PK values keep their own separators and cannot collide
1679
+ let pk = Utils.getCompositeKeyHash(item, meta, false, undefined, true);
1679
1680
  if (pivotRelations.length > 0) {
1680
1681
  pk = Utils.getPrimaryKeyHash([
1681
1682
  pk,
1682
1683
  ...pivotRelations.flatMap(p => {
1683
1684
  const value = item[p.name];
1684
1685
  // composite FKs are mapped to an array of values, which `extractPK` does not accept
1685
- return (Array.isArray(value) ? value : Utils.extractPK(value, p.targetMeta));
1686
+ return (Array.isArray(value) ? Utils.flatten(value, true) : Utils.extractPK(value, p.targetMeta));
1686
1687
  }),
1687
1688
  ]);
1688
1689
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.1.10-dev.1",
3
+ "version": "7.1.10-dev.3",
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.9"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.1.10-dev.1"
56
+ "@mikro-orm/core": "7.1.10-dev.3"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"
@@ -1104,7 +1104,9 @@ export class QueryBuilder {
1104
1104
  }
1105
1105
  if (stack.length > 0) {
1106
1106
  const merged = this.driver.mergeJoinedResult(stack, this.mainAlias.meta, joinedProps);
1107
- yield this.mapResult(merged[0], options.mapResults);
1107
+ for (const row of merged) {
1108
+ yield this.mapResult(row, options.mapResults);
1109
+ }
1108
1110
  }
1109
1111
  }
1110
1112
  /**