node_modules: update (#352)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurlaanddawidd6 authored and GitHub committed 2026-10-22 08:43:32 +02:00
1 parent 4026a70a6b
commit 47af4a10b5
53 files changed
+630 -217

No files matched your search

+11
View File
@@ -110,6 +110,17 @@ declare class SMTPPool extends EventEmitter {
* Returns true if there are free slots in the queue
*/
isIdle(): boolean;
/**
* Counts the messages the pool has not finished with yet: the ones waiting in the queue
* plus the ones a connection is transmitting right now. isIdle() only tells whether the
* pool can take another message, it is already true while a message is still being sent,
* so use this to check that nothing would be lost by closing the pool. A message that is
* re-queued after its connection dropped is counted until its callback runs, also while it waits to be put back on the queue, and
* it is no longer counted by the time its callback runs.
*
* @returns Number of queued and in-flight messages
*/
pendingCount(): number;
/**
* Verifies SMTP configuration
*
+25 -1
View File
@@ -100,6 +100,7 @@ class SMTPPool extends node_events_1.EventEmitter {
this._queue = [];
this._connections = [];
this._connectionCounter = 0;
this._pending = 0;
this.idling = true;
setImmediate(() => {
if (this.idling) {
@@ -132,10 +133,20 @@ class SMTPPool extends node_events_1.EventEmitter {
setImmediate(() => callback(err));
return false;
}
// counted until the callback runs, whichever path runs it: delivered, failed, requeued
// until it gives up, or drained by close()
let counted = true;
this._pending++;
this._queue.push({
mail,
requeueAttempts: 0,
callback
callback: (err, info) => {
if (counted) {
counted = false;
this._pending--;
}
callback(err, info);
}
});
if (this.idling && this._queue.length >= this.options.maxConnections) {
this.idling = false;
@@ -479,6 +490,19 @@ class SMTPPool extends node_events_1.EventEmitter {
isIdle() {
return this.idling;
}
/**
* Counts the messages the pool has not finished with yet: the ones waiting in the queue
* plus the ones a connection is transmitting right now. isIdle() only tells whether the
* pool can take another message, it is already true while a message is still being sent,
* so use this to check that nothing would be lost by closing the pool. A message that is
* re-queued after its connection dropped is counted until its callback runs, also while it waits to be put back on the queue, and
* it is no longer counted by the time its callback runs.
*
* @returns Number of queued and in-flight messages
*/
pendingCount() {
return this._pending;
}
verify(callback) {
let promise;
if (!callback) {
+2 -5
View File
@@ -57,8 +57,7 @@ class PoolResource extends node_events_1.EventEmitter {
switch ((this.options.auth.type || '').toString().toUpperCase()) {
case 'OAUTH2': {
const oauth2 = new index_js_3.default(this.options.auth, this.logger);
oauth2.provisionCallback =
(this.pool.mailer && this.pool.mailer.get('oauth2_provision_cb')) || oauth2.provisionCallback;
oauth2.provisionCallback = (this.pool.mailer && this.pool.mailer.get('oauth2_provision_cb')) || oauth2.provisionCallback;
this.auth = {
type: 'OAUTH2',
user: this.options.auth.user,
@@ -246,9 +245,7 @@ class PoolResource extends node_events_1.EventEmitter {
this.connection.close();
return;
}
if ((err.code === errors.EENVELOPE || err.code === errors.EMESSAGE) &&
err.responseCode !== 421 &&
!this.connection._destroyed) {
if ((err.code === errors.EENVELOPE || err.code === errors.EMESSAGE) && err.responseCode !== 421 && !this.connection._destroyed) {
// The server refused this message, the connection itself is fine. Reset the
// session and keep using it instead of opening a new one
this.connection.reset(resetErr => {