@mikro-orm/core 7.2.9-dev.2 → 7.2.9-dev.4

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.
@@ -501,6 +501,11 @@ export class EntityLoader {
501
501
  for (const entity of entities) {
502
502
  const ref = entity[prop.name];
503
503
  if (ref == null) {
504
+ // an inverse 1:1 with no matching row is resolved as empty, mark it so it is not queried again
505
+ if (isInverseOneToOne && !partial && childrenMap.has(getKey(entity))) {
506
+ entity[prop.name] = nullVal;
507
+ helper(entity).__loadedProperties.add(prop.name);
508
+ }
504
509
  continue;
505
510
  }
506
511
  const refKey = getKey(ref);
@@ -883,7 +888,11 @@ export class EntityLoader {
883
888
  if (value === null) {
884
889
  return false;
885
890
  }
886
- if (value === undefined || !Utils.isEntity(value, true)) {
891
+ // with `forceUndefined`, an empty relation that was already loaded is `undefined` instead of `null`
892
+ if (value === undefined) {
893
+ return !helper(e).__loadedProperties.has(prop.name);
894
+ }
895
+ if (!Utils.isEntity(value, true)) {
887
896
  return true;
888
897
  }
889
898
  const target = Reference.unwrapReference(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.2.9-dev.2",
3
+ "version": "7.2.9-dev.4",
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.2.9-dev.2';
156
+ static #ORM_VERSION = '7.2.9-dev.4';
157
157
  /** Default session variable name backing an RLS filter argument (`current_setting('mikro.<filter>.<arg>')`). */
158
158
  static getRlsSettingName(filterName, argName) {
159
159
  return `mikro.${filterName}.${argName}`;