@mikro-orm/core 7.0.5-dev.8 → 7.0.5-dev.9

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.0.5-dev.8",
3
+ "version": "7.0.5-dev.9",
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",
@@ -42,6 +42,9 @@ export class ChangeSetComputer {
42
42
  }
43
43
  if (type === ChangeSetType.UPDATE && !wrapped.__initialized) {
44
44
  const data = this.#comparator.prepareEntity(entity);
45
+ if (meta.root.discriminatorColumn) {
46
+ delete data[meta.root.discriminatorColumn];
47
+ }
45
48
  if (Utils.equals(data, wrapped.__originalEntityData)) {
46
49
  return null;
47
50
  }
@@ -114,6 +117,12 @@ export class ChangeSetComputer {
114
117
  for (const prop of wrapped.__meta.primaryKeys) {
115
118
  delete data[prop];
116
119
  }
120
+ // strip discriminator column for STI entities — it's always hardcoded
121
+ // in the snapshot generator and not present in __originalEntityData,
122
+ // causing false dirty detection on uninitialized reference proxies
123
+ if (wrapped.__meta.root.discriminatorColumn) {
124
+ delete data[wrapped.__meta.root.discriminatorColumn];
125
+ }
117
126
  return data;
118
127
  }
119
128
  if (originalEntityData) {
package/utils/Utils.js CHANGED
@@ -129,7 +129,7 @@ export function parseJsonSafe(value) {
129
129
  /** Collection of general-purpose utility methods used throughout the ORM. */
130
130
  export class Utils {
131
131
  static PK_SEPARATOR = '~~~';
132
- static #ORM_VERSION = '7.0.5-dev.8';
132
+ static #ORM_VERSION = '7.0.5-dev.9';
133
133
  /**
134
134
  * Checks if the argument is instance of `Object`. Returns false for arrays.
135
135
  */