@mikro-orm/core 7.1.13-dev.5 → 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.
@@ -445,7 +445,10 @@ export class EntityLoader {
445
445
  }
446
446
  }
447
447
  }
448
- if ([ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(prop.kind) && items.length !== children.length) {
448
+ // a missing target row means an orphaned reference, unless the query was narrowed by a populate condition
449
+ if ([ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(prop.kind) &&
450
+ items.length !== children.length &&
451
+ Utils.isEmpty(options.where)) {
449
452
  const nullVal = this.#em.config.get('forceUndefined') ? undefined : null;
450
453
  const itemsMap = new Set();
451
454
  const childrenMap = new Set();
@@ -667,7 +670,8 @@ export class EntityLoader {
667
670
  }
668
671
  return cond;
669
672
  });
670
- if (child.length > 0) {
673
+ // partial extraction from `$or` is unsound — the parent may have matched via a dropped branch
674
+ if (child.length > 0 && (op === '$and' || child.length === where[op].length)) {
671
675
  subCond[op] = child;
672
676
  }
673
677
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.1.13-dev.5",
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",
package/utils/Utils.js CHANGED
@@ -153,7 +153,7 @@ export function parseJsonSafe(value) {
153
153
  /** Collection of general-purpose utility methods used throughout the ORM. */
154
154
  export class Utils {
155
155
  static PK_SEPARATOR = '~~~';
156
- static #ORM_VERSION = '7.1.13-dev.5';
156
+ static #ORM_VERSION = '7.1.13-dev.7';
157
157
  /**
158
158
  * Checks if the argument is instance of `Object`. Returns false for arrays.
159
159
  */