@mikro-orm/core
Version:
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.
18 lines (17 loc) • 553 B
JavaScript
/** Broadcasts transaction lifecycle events (start, commit, rollback) through the EventManager. */
export class TransactionEventBroadcaster {
em;
context;
constructor(em, context) {
this.em = em;
this.context = context;
}
/** Dispatches a transaction lifecycle event to the EventManager. */
async dispatchEvent(event, transaction) {
await this.em.getEventManager().dispatchEvent(event, {
em: this.em,
uow: this.em.getUnitOfWork(false),
transaction,
});
}
}