export class AsyncSerialQueue { #tail: Promise = Promise.resolve(); run(operation: () => Promise): Promise { const result = this.#tail.then(operation, operation); this.#tail = result.then(() => undefined, () => undefined); return result; } }