@mikro-orm/core 7.1.10-dev.0 → 7.1.10-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.1.10-dev.0",
3
+ "version": "7.1.10-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",
@@ -164,7 +164,9 @@ export class EntityComparator {
164
164
  const lines = [];
165
165
  const context = new Map();
166
166
  context.set('isEntityOrRef', (val) => Utils.isEntity(val, true));
167
- context.set('getCompositeKeyValue', (val) => Utils.flatten(Utils.getCompositeKeyValue(val, meta, 'convertToDatabaseValue', this.#platform)));
167
+ context.set('getCompositeKeyValue', (val) =>
168
+ // deep flatten, nested composite PKs produce nested arrays that would be comma-joined by the hash
169
+ Utils.flatten(Utils.getCompositeKeyValue(val, meta, 'convertToDatabaseValue', this.#platform), true));
168
170
  context.set('getPrimaryKeyHash', (val) => Utils.getPrimaryKeyHash(Utils.asArray(val)));
169
171
  if (meta.primaryKeys.length > 1) {
170
172
  lines.push(` const pks = entity.__helper.__pk ? getCompositeKeyValue(entity.__helper.__pk) : [`);
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.10-dev.0';
156
+ static #ORM_VERSION = '7.1.10-dev.2';
157
157
  /**
158
158
  * Checks if the argument is instance of `Object`. Returns false for arrays.
159
159
  */
@@ -402,7 +402,8 @@ export class Utils {
402
402
  static getCompositeKeyHash(data, meta, convertCustomTypes = false, platform, flat = false) {
403
403
  let pks = this.getCompositeKeyValue(data, meta, convertCustomTypes, platform);
404
404
  if (flat) {
405
- pks = Utils.flatten(pks);
405
+ // deep flatten, nested composite PKs produce nested arrays that would be comma-joined by the hash
406
+ pks = Utils.flatten(pks, true);
406
407
  }
407
408
  return Utils.getPrimaryKeyHash(pks);
408
409
  }