@mikro-orm/core 7.2.2-dev.15 → 7.2.2-dev.16

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.
@@ -580,6 +580,11 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
580
580
  * Checks whether this EntityManager is currently operating inside a database transaction.
581
581
  */
582
582
  isInTransaction(): boolean;
583
+ /**
584
+ * Checks whether transactions are disabled for this EntityManager.
585
+ * @internal
586
+ */
587
+ isTransactionDisabled(): boolean;
583
588
  /**
584
589
  * Gets the transaction context (driver dependent object used to make sure queries are executed on same connection).
585
590
  */
package/EntityManager.js CHANGED
@@ -1985,6 +1985,13 @@ export class EntityManager {
1985
1985
  isInTransaction() {
1986
1986
  return !!this.getContext(false).#transactionContext;
1987
1987
  }
1988
+ /**
1989
+ * Checks whether transactions are disabled for this EntityManager.
1990
+ * @internal
1991
+ */
1992
+ isTransactionDisabled() {
1993
+ return !!this.getContext(false).#disableTransactions;
1994
+ }
1988
1995
  /**
1989
1996
  * Gets the transaction context (driver dependent object used to make sure queries are executed on same connection).
1990
1997
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.2.2-dev.15",
3
+ "version": "7.2.2-dev.16",
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",
@@ -467,7 +467,10 @@ export class UnitOfWork {
467
467
  }
468
468
  const groups = this.getChangeSetGroups();
469
469
  const platform = this.#em.getPlatform();
470
- const runInTransaction = !this.#em.isInTransaction() && platform.supportsTransactions() && this.#em.config.get('implicitTransactions');
470
+ const runInTransaction = !this.#em.isInTransaction() &&
471
+ !this.#em.isTransactionDisabled() &&
472
+ platform.supportsTransactions() &&
473
+ this.#em.config.get('implicitTransactions');
471
474
  if (runInTransaction) {
472
475
  const loggerContext = Utils.merge({ id: this.#em._id }, this.#em.getLoggerContext({ disableContextResolution: true }));
473
476
  await this.#em.getConnection('write').transactional(trx => this.persistToDatabase(groups, trx), {
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.2.2-dev.15';
156
+ static #ORM_VERSION = '7.2.2-dev.16';
157
157
  /** Default session variable name backing an RLS filter argument (`current_setting('mikro.<filter>.<arg>')`). */
158
158
  static getRlsSettingName(filterName, argName) {
159
159
  return `mikro.${filterName}.${argName}`;