@mikro-orm/core 6.6.18-dev.4 → 6.6.18-dev.6

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.
@@ -479,6 +479,11 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
479
479
  * Checks whether this EntityManager is currently operating inside a database transaction.
480
480
  */
481
481
  isInTransaction(): boolean;
482
+ /**
483
+ * Checks whether transactions are disabled for this EntityManager.
484
+ * @internal
485
+ */
486
+ isTransactionDisabled(): boolean;
482
487
  /**
483
488
  * Gets the transaction context (driver dependent object used to make sure queries are executed on same connection).
484
489
  */
package/EntityManager.js CHANGED
@@ -1505,6 +1505,13 @@ class EntityManager {
1505
1505
  isInTransaction() {
1506
1506
  return !!this.getContext(false).transactionContext;
1507
1507
  }
1508
+ /**
1509
+ * Checks whether transactions are disabled for this EntityManager.
1510
+ * @internal
1511
+ */
1512
+ isTransactionDisabled() {
1513
+ return !!this.getContext(false).disableTransactions;
1514
+ }
1508
1515
  /**
1509
1516
  * Gets the transaction context (driver dependent object used to make sure queries are executed on same connection).
1510
1517
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.6.18-dev.4",
3
+ "version": "6.6.18-dev.6",
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.3",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.6.18-dev.4",
67
+ "mikro-orm": "6.6.18-dev.6",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -340,7 +340,7 @@ class UnitOfWork {
340
340
  }
341
341
  const groups = this.getChangeSetGroups();
342
342
  const platform = this.em.getPlatform();
343
- const runInTransaction = !this.em.isInTransaction() && platform.supportsTransactions() && this.em.config.get('implicitTransactions');
343
+ const runInTransaction = !this.em.isInTransaction() && !this.em.isTransactionDisabled() && platform.supportsTransactions() && this.em.config.get('implicitTransactions');
344
344
  if (runInTransaction) {
345
345
  const loggerContext = Utils_1.Utils.merge({ id: this.em._id }, this.em.getLoggerContext({ disableContextResolution: true }));
346
346
  await this.em.getConnection('write').transactional(trx => this.persistToDatabase(groups, trx), {