@mikro-orm/core 6.5.9-dev.8 → 6.5.9-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/EntityManager.js CHANGED
@@ -493,8 +493,9 @@ class EntityManager {
493
493
  async refresh(entity, options = {}) {
494
494
  const fork = this.fork({ keepTransactionContext: true });
495
495
  const entityName = entity.constructor.name;
496
+ const wrapped = (0, entity_1.helper)(entity);
496
497
  const reloaded = await fork.findOne(entityName, entity, {
497
- schema: (0, entity_1.helper)(entity).__schema,
498
+ schema: wrapped.__schema,
498
499
  ...options,
499
500
  flushMode: enums_1.FlushMode.COMMIT,
500
501
  });
@@ -508,13 +509,13 @@ class EntityManager {
508
509
  const ref = em.getReference(e.constructor.name, (0, entity_1.helper)(e).getPrimaryKey());
509
510
  const data = (0, entity_1.helper)(e).serialize({ ignoreSerializers: true, includeHidden: true });
510
511
  em.config.getHydrator(this.metadata).hydrate(ref, (0, entity_1.helper)(ref).__meta, data, em.entityFactory, 'full', false, true);
511
- (0, entity_1.helper)(ref).__originalEntityData = this.comparator.prepareEntity(e);
512
+ utils_1.Utils.merge((0, entity_1.helper)(ref).__originalEntityData, this.comparator.prepareEntity(e));
512
513
  found ||= ref === entity;
513
514
  }
514
515
  if (!found) {
515
516
  const data = (0, entity_1.helper)(reloaded).serialize({ ignoreSerializers: true, includeHidden: true });
516
- em.config.getHydrator(this.metadata).hydrate(entity, (0, entity_1.helper)(entity).__meta, data, em.entityFactory, 'full', false, true);
517
- (0, entity_1.helper)(entity).__originalEntityData = this.comparator.prepareEntity(reloaded);
517
+ em.config.getHydrator(this.metadata).hydrate(entity, wrapped.__meta, data, em.entityFactory, 'full', false, true);
518
+ utils_1.Utils.merge(wrapped.__originalEntityData, this.comparator.prepareEntity(reloaded));
518
519
  }
519
520
  return entity;
520
521
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.5.9-dev.8",
3
+ "version": "6.5.9-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
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.3.2",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.5.9-dev.8",
67
+ "mikro-orm": "6.5.9-dev.9",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -20,9 +20,7 @@ class TransactionManager {
20
20
  */
21
21
  async handle(cb, options = {}) {
22
22
  const em = this.em.getContext(false);
23
- // Set NESTED as the default propagation type
24
23
  options.propagation ??= enums_1.TransactionPropagation.NESTED;
25
- // Set the context to the current transaction context if not already set
26
24
  options.ctx ??= em.getTransactionContext();
27
25
  const hasExistingTransaction = !!em.getTransactionContext();
28
26
  return this.executeWithPropagation(options.propagation, em, cb, options, hasExistingTransaction);