UNPKG

node-firebird-driver

Version:
42 lines 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AbstractTransaction = void 0; /** AbstractTransaction implementation. */ class AbstractTransaction { constructor(attachment) { this.attachment = attachment; } /** Commits and release this transaction object. */ async commit() { this.check(); await this.internalCommit(); this.attachment.transactions.delete(this); this.attachment = undefined; } /** Commits and maintains this transaction object for subsequent work. */ async commitRetaining() { this.check(); return await this.internalCommitRetaining(); } /** Rollbacks and release this transaction object. */ async rollback() { this.check(); await this.internalRollback(); this.attachment.transactions.delete(this); this.attachment = undefined; } /** Rollbacks and maintains this transaction object for subsequent work. */ async rollbackRetaining() { this.check(); return await this.internalRollbackRetaining(); } get isValid() { return !!this.attachment; } check() { if (!this.isValid) throw new Error('Transaction is already committed or rolled back.'); } } exports.AbstractTransaction = AbstractTransaction; //# sourceMappingURL=transaction.js.map