@mikro-orm/core 7.1.1-dev.1 → 7.1.1-dev.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.1.1-dev.1",
3
+ "version": "7.1.1-dev.10",
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",
@@ -145,8 +145,19 @@ export class QueryHelper {
145
145
  })));
146
146
  }
147
147
  Object.keys(where).forEach(k => {
148
- const meta2 = metadata.find(meta.properties[k]?.targetMeta?.class) || meta;
148
+ const prop = meta.properties[k];
149
+ const meta2 = metadata.find(prop?.targetMeta?.class) || meta;
149
150
  if (this.inlinePrimaryKeyObjects(where[k], meta2, metadata, k)) {
151
+ // Skip the PK collapse when an owning M:1/1:1 relation's FK column count does not match
152
+ // the target's PK column count (e.g. FK references target PK + an extra unique column).
153
+ // The criteria layer would otherwise emit a malformed predicate such as
154
+ // `(joinCol1, joinCol2) = scalar`. Limited to owning relations — `joinColumns` on the
155
+ // inverse side (1:m) describes the owning entity's FK columns, not the LHS tuple.
156
+ if (prop?.owner &&
157
+ [ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(prop.kind) &&
158
+ prop.joinColumns.length !== meta2.primaryKeys.length) {
159
+ return;
160
+ }
150
161
  where[k] = Utils.getPrimaryKeyValues(where[k], meta2, true);
151
162
  }
152
163
  });
package/utils/Utils.js CHANGED
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
141
141
  /** Collection of general-purpose utility methods used throughout the ORM. */
142
142
  export class Utils {
143
143
  static PK_SEPARATOR = '~~~';
144
- static #ORM_VERSION = '7.1.1-dev.1';
144
+ static #ORM_VERSION = '7.1.1-dev.10';
145
145
  /**
146
146
  * Checks if the argument is instance of `Object`. Returns false for arrays.
147
147
  */