@mikro-orm/sql
Advanced tools
+11
-13
@@ -113,3 +113,11 @@ import { CompiledQuery, Kysely } from 'kysely'; | ||
| catch (error) { | ||
| await this.rollback(trx, options.eventBroadcaster, options.loggerContext); | ||
| // A failing rollback must not mask why the transaction failed in the first place — the | ||
| // `'kill session'` abort strategy tears the connection down, so the rollback that follows can | ||
| // only ever report the dead connection. | ||
| try { | ||
| await this.rollback(trx, options.eventBroadcaster, options.loggerContext); | ||
| } | ||
| catch (rollbackError) { | ||
| this.logger.warn('query', `Failed to roll back transaction: ${rollbackError.message}`); | ||
| } | ||
| throw error; | ||
@@ -142,15 +150,5 @@ } | ||
| const trx = await trxBuilder.execute(); | ||
| if (options.ctx) { | ||
| const ctx = options.ctx; | ||
| ctx.index ??= 0; | ||
| const savepointName = `trx${ctx.index + 1}`; | ||
| Reflect.defineProperty(trx, 'index', { value: ctx.index + 1 }); | ||
| Reflect.defineProperty(trx, 'savepointName', { value: savepointName }); | ||
| this.logQuery(this.platform.getSavepointSQL(savepointName), options.loggerContext); | ||
| for (const query of this.platform.getBeginTransactionSQL(options)) { | ||
| this.logQuery(query, options.loggerContext); | ||
| } | ||
| else { | ||
| for (const query of this.platform.getBeginTransactionSQL(options)) { | ||
| this.logQuery(query, options.loggerContext); | ||
| } | ||
| } | ||
| await options.eventBroadcaster?.dispatchEvent(EventType.afterTransactionStart, trx); | ||
@@ -157,0 +155,0 @@ return trx; |
+2
-2
| { | ||
| "name": "@mikro-orm/sql", | ||
| "version": "7.1.9-dev.15", | ||
| "version": "7.1.9-dev.16", | ||
| "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.", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
| "peerDependencies": { | ||
| "@mikro-orm/core": "7.1.9-dev.15" | ||
| "@mikro-orm/core": "7.1.9-dev.16" | ||
| }, | ||
@@ -59,0 +59,0 @@ "engines": { |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1059605
022122
-0.01%