import{promiseMapLimit as a}from"../../utils/async/promise-map-limit.js";import{BatchQueue as n}from"../../utils/queue.js";class o{#t;#r;#e;constructor(t){this.#e=t,this.#r=new n({batchSize:1,batchProcessor:async r=>{await a(r,1,async e=>e.execute())}})}get tx(){return this.#t}async transaction(t,r){return this.#r.addItem({execute:async()=>{try{return await this.#e.transaction(async e=>(this.#t=e,t()),{behavior:r})}finally{this.#t=void 0}}})}}export{o as TransactionsManager};
