@mikro-orm/core 7.0.17-dev.8 → 7.0.17

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.
@@ -161,13 +161,15 @@ export class EntityFactory {
161
161
  return diff2[key] === undefined;
162
162
  })
163
163
  .forEach(key => delete diff2[key]);
164
- // but always add collection properties, formulas, generated columns, and version properties if they
165
- // are part of the `data`, as these are excluded from `comparableProps` and won't appear in the diff
164
+ // but always add collection properties, formulas, generated columns, version properties, and the
165
+ // user-declared STI discriminator if they are part of the `data`, as these are excluded from
166
+ // `comparableProps` and won't appear in the diff
166
167
  Utils.keys(data)
167
168
  .filter(key => meta.properties[key]?.formula ||
168
169
  meta.properties[key]?.version ||
169
170
  (meta.properties[key]?.generated && !meta.properties[key]?.primary) ||
170
- [ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(meta.properties[key]?.kind))
171
+ [ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(meta.properties[key]?.kind) ||
172
+ (key === meta.root.discriminatorColumn && meta.properties[key]?.userDefined !== false))
171
173
  .forEach(key => (diff2[key] = data[key]));
172
174
  // rehydrated with the new values, skip those changed by user
173
175
  // use full hydration if the entity is already initialized, even if the caller used `initialized: false`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.0.17-dev.8",
3
+ "version": "7.0.17",
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",
@@ -198,7 +198,7 @@ export class EntitySerializer {
198
198
  return this.serialize(child, childOptions);
199
199
  }
200
200
  const pk = this.processCustomType(wrapped.getPrimaryKey(), prop, wrapped.__platform, options.convertCustomTypes);
201
- if (options.forceObject || wrapped.__config.get('serialization').forceObject) {
201
+ if (options.forceObject ?? wrapped.__config.get('serialization').forceObject) {
202
202
  return Utils.primaryKeyToObject(meta, pk, visible);
203
203
  }
204
204
  if (Utils.isPlainObject(pk)) {
@@ -222,7 +222,7 @@ export class EntitySerializer {
222
222
  return this.serialize(item, this.extractChildOptions(options, prop.name));
223
223
  }
224
224
  const pk = this.processCustomType(wrapped.getPrimaryKey(), prop, wrapped.__platform, options.convertCustomTypes);
225
- if (options.forceObject || wrapped.__config.get('serialization').forceObject) {
225
+ if (options.forceObject ?? wrapped.__config.get('serialization').forceObject) {
226
226
  return Utils.primaryKeyToObject(wrapped.__meta, pk);
227
227
  }
228
228
  return pk;
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.0.17-dev.8';
144
+ static #ORM_VERSION = '7.0.17';
145
145
  /**
146
146
  * Checks if the argument is instance of `Object`. Returns false for arrays.
147
147
  */