@mavogel/awscdk-rootmail 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +10 -10
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@aws-sdk/checksums/package.json +3 -3
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +23 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/models/CloudWatchLogsServiceException.js +1 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/models/errors.js +21 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/CloudWatchLogsServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/errors.d.ts +21 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/CloudWatchLogsServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/errors.d.ts +21 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +4 -4
- package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +71 -1
- package/node_modules/@aws-sdk/client-route-53/dist-es/models/Route53ServiceException.js +1 -0
- package/node_modules/@aws-sdk/client-route-53/dist-es/models/errors.js +69 -0
- package/node_modules/@aws-sdk/client-route-53/dist-types/models/Route53ServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-route-53/dist-types/models/errors.d.ts +69 -0
- package/node_modules/@aws-sdk/client-route-53/dist-types/ts3.4/models/Route53ServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-route-53/dist-types/ts3.4/models/errors.d.ts +69 -0
- package/node_modules/@aws-sdk/client-route-53/package.json +4 -4
- package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +23 -1
- package/node_modules/@aws-sdk/client-s3/dist-es/models/S3ServiceException.js +1 -0
- package/node_modules/@aws-sdk/client-s3/dist-es/models/errors.js +21 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/models/S3ServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/models/errors.d.ts +21 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/S3ServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/errors.d.ts +21 -0
- package/node_modules/@aws-sdk/client-s3/package.json +8 -8
- package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +36 -1
- package/node_modules/@aws-sdk/client-ses/dist-es/models/SESServiceException.js +1 -0
- package/node_modules/@aws-sdk/client-ses/dist-es/models/errors.js +34 -0
- package/node_modules/@aws-sdk/client-ses/dist-types/models/SESServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-ses/dist-types/models/errors.d.ts +34 -0
- package/node_modules/@aws-sdk/client-ses/dist-types/ts3.4/models/SESServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-ses/dist-types/ts3.4/models/errors.d.ts +34 -0
- package/node_modules/@aws-sdk/client-ses/package.json +4 -4
- package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +142 -1
- package/node_modules/@aws-sdk/client-ssm/dist-es/models/SSMServiceException.js +1 -0
- package/node_modules/@aws-sdk/client-ssm/dist-es/models/errors.js +140 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/SSMServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/errors.d.ts +140 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/SSMServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/errors.d.ts +140 -0
- package/node_modules/@aws-sdk/client-ssm/package.json +4 -4
- package/node_modules/@aws-sdk/core/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +4 -4
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +11 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +6 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +6 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +13 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +9 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/models/CognitoIdentityServiceException.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/models/errors.js +9 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/SigninServiceException.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/errors.js +4 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/models/SSOServiceException.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/models/errors.js +4 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/models/SSOOIDCServiceException.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/models/errors.js +11 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/models/STSServiceException.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/models/errors.js +7 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/models/CognitoIdentityServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/models/errors.d.ts +9 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/SigninServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/errors.d.ts +4 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/models/SSOServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/models/errors.d.ts +4 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/models/SSOOIDCServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/models/errors.d.ts +11 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/models/STSServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/models/errors.d.ts +7 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/models/CognitoIdentityServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/models/errors.d.ts +9 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/models/SigninServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/models/errors.d.ts +4 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/models/SSOServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/models/errors.d.ts +4 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/models/SSOOIDCServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/models/errors.d.ts +11 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/models/STSServiceException.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/models/errors.d.ts +7 -0
- package/node_modules/@aws-sdk/nested-clients/package.json +4 -4
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +4 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +33 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +2 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +2 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js +33 -11
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/cache/EndpointCache.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +3 -0
- package/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +4 -1
- package/node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js +4 -1
- package/node_modules/@smithy/signature-v4/package.json +3 -3
- package/node_modules/mailparser/.release-please-manifest.json +1 -1
- package/node_modules/mailparser/CHANGELOG.md +7 -0
- package/node_modules/mailparser/package.json +2 -2
- package/node_modules/nodemailer/CHANGELOG.md +27 -0
- package/node_modules/nodemailer/dist/cjs/base64/index.d.ts +3 -0
- package/node_modules/nodemailer/dist/cjs/base64/index.js +80 -41
- package/node_modules/nodemailer/dist/cjs/dkim/index.js +43 -29
- package/node_modules/nodemailer/dist/cjs/dkim/message-parser.js +2 -2
- package/node_modules/nodemailer/dist/cjs/errors.d.ts +17 -0
- package/node_modules/nodemailer/dist/cjs/errors.js +12 -1
- package/node_modules/nodemailer/dist/cjs/fetch/index.js +23 -3
- package/node_modules/nodemailer/dist/cjs/mailer/index.js +23 -7
- package/node_modules/nodemailer/dist/cjs/mailer/mail-message.d.ts +5 -0
- package/node_modules/nodemailer/dist/cjs/mailer/mail-message.js +20 -0
- package/node_modules/nodemailer/dist/cjs/mime-node/index.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/mime-node/index.js +165 -105
- package/node_modules/nodemailer/dist/cjs/nodemailer.js +12 -9
- package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
- package/node_modules/nodemailer/dist/cjs/qp/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/cjs/qp/index.js +103 -33
- package/node_modules/nodemailer/dist/cjs/sendmail-transport/index.js +54 -14
- package/node_modules/nodemailer/dist/cjs/shared/index.d.ts +32 -1
- package/node_modules/nodemailer/dist/cjs/shared/index.js +212 -115
- package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.d.ts +3 -1
- package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.js +88 -68
- package/node_modules/nodemailer/dist/cjs/smtp-connection/index.d.ts +7 -1
- package/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +348 -136
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.d.ts +3 -0
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.js +7 -1
- package/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.js +106 -17
- package/node_modules/nodemailer/dist/cjs/smtp-transport/index.js +8 -2
- package/node_modules/nodemailer/dist/esm/base64/index.d.ts +3 -0
- package/node_modules/nodemailer/dist/esm/base64/index.js +80 -41
- package/node_modules/nodemailer/dist/esm/dkim/index.js +43 -29
- package/node_modules/nodemailer/dist/esm/dkim/message-parser.js +2 -2
- package/node_modules/nodemailer/dist/esm/errors.d.ts +17 -0
- package/node_modules/nodemailer/dist/esm/errors.js +10 -0
- package/node_modules/nodemailer/dist/esm/fetch/index.js +23 -3
- package/node_modules/nodemailer/dist/esm/mailer/index.js +23 -7
- package/node_modules/nodemailer/dist/esm/mailer/mail-message.d.ts +5 -0
- package/node_modules/nodemailer/dist/esm/mailer/mail-message.js +20 -0
- package/node_modules/nodemailer/dist/esm/mime-node/index.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/mime-node/index.js +166 -106
- package/node_modules/nodemailer/dist/esm/nodemailer.js +12 -9
- package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
- package/node_modules/nodemailer/dist/esm/qp/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/esm/qp/index.js +103 -33
- package/node_modules/nodemailer/dist/esm/sendmail-transport/index.js +54 -14
- package/node_modules/nodemailer/dist/esm/shared/index.d.ts +32 -1
- package/node_modules/nodemailer/dist/esm/shared/index.js +207 -115
- package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.d.ts +3 -1
- package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.js +88 -68
- package/node_modules/nodemailer/dist/esm/smtp-connection/index.d.ts +7 -1
- package/node_modules/nodemailer/dist/esm/smtp-connection/index.js +348 -136
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.d.ts +3 -0
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.js +7 -1
- package/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.js +106 -17
- package/node_modules/nodemailer/dist/esm/smtp-transport/index.js +8 -2
- package/node_modules/nodemailer/package.json +1 -1
- package/node_modules/uuid/package.json +17 -17
- package/package.json +9 -9
|
@@ -19,6 +19,8 @@ export interface SMTPPoolOptions extends SMTPTransportOptions {
|
|
|
19
19
|
rateDelta?: number | undefined;
|
|
20
20
|
/** How many times a message is requeued when its connection closes while sending, defaults to 5, a negative value means unlimited */
|
|
21
21
|
maxRequeues?: number | undefined;
|
|
22
|
+
/** Time in milliseconds a connection may stay idle before it is closed, defaults to 4 minutes, 0 keeps it open until the server closes it */
|
|
23
|
+
idleTimeout?: number | undefined;
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* The pool options once the constructor has applied the defaults
|
|
@@ -27,6 +29,7 @@ export type SMTPPoolResolvedOptions = SMTPPoolOptions & {
|
|
|
27
29
|
maxConnections: number;
|
|
28
30
|
maxMessages: number;
|
|
29
31
|
maxRequeues: number;
|
|
32
|
+
idleTimeout: number;
|
|
30
33
|
};
|
|
31
34
|
/**
|
|
32
35
|
* Result of a message sent through the pool, same as for the SMTP transport
|
|
@@ -42,6 +42,9 @@ class SMTPPool extends EventEmitter {
|
|
|
42
42
|
this.options.maxMessages = this.options.maxMessages || 100;
|
|
43
43
|
// a default bound, a server that closes every connection before the greeting would otherwise be retried forever
|
|
44
44
|
this.options.maxRequeues = typeof this.options.maxRequeues === 'number' ? this.options.maxRequeues : 5;
|
|
45
|
+
// below the 5 minutes RFC 5321 asks servers to wait at least, the connection is closed by us
|
|
46
|
+
// and not by the server in the middle of handing it a message
|
|
47
|
+
this.options.idleTimeout = typeof this.options.idleTimeout === 'number' ? this.options.idleTimeout : 4 * 60 * 1000;
|
|
45
48
|
this.logger = shared.getLogger(this.options, {
|
|
46
49
|
component: this.options.component || 'smtp-pool'
|
|
47
50
|
});
|
|
@@ -448,7 +451,9 @@ class SMTPPool extends EventEmitter {
|
|
|
448
451
|
// the error paths hand over the error alone
|
|
449
452
|
const done = callback;
|
|
450
453
|
const auth = new PoolResource(this).auth;
|
|
451
|
-
|
|
454
|
+
// the proxy handshake, if any, counts against connectionTimeout as well
|
|
455
|
+
const connectStartedAt = Date.now();
|
|
456
|
+
this.getSocket(Object.assign({}, this.options, { connectStartedAt }), (err, socketOptions) => {
|
|
452
457
|
if (err) {
|
|
453
458
|
return done(err);
|
|
454
459
|
}
|
|
@@ -465,6 +470,7 @@ class SMTPPool extends EventEmitter {
|
|
|
465
470
|
options = Object.assign(shared.assign(false, options), socketOptions);
|
|
466
471
|
}
|
|
467
472
|
const connection = new SMTPConnection(options);
|
|
473
|
+
connection._connectStartedAt = connectStartedAt;
|
|
468
474
|
let returned = false;
|
|
469
475
|
connection.once('error', err => {
|
|
470
476
|
if (returned) {
|
|
@@ -52,6 +52,8 @@ export default class PoolResource extends EventEmitter {
|
|
|
52
52
|
this.messages = 0;
|
|
53
53
|
this.available = true;
|
|
54
54
|
this._failed = false;
|
|
55
|
+
this._sending = false;
|
|
56
|
+
this._idleTimer = false;
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
57
59
|
* Emits 'error' for the first failure only. A dead resource can report the same failure more
|
|
@@ -71,7 +73,9 @@ export default class PoolResource extends EventEmitter {
|
|
|
71
73
|
* @param callback Callback function to run once the connection is established or failed
|
|
72
74
|
*/
|
|
73
75
|
connect(callback) {
|
|
74
|
-
|
|
76
|
+
// the proxy handshake, if any, counts against connectionTimeout as well
|
|
77
|
+
const connectStartedAt = Date.now();
|
|
78
|
+
this.pool.getSocket(Object.assign({}, this.options, { connectStartedAt }), (err, socketOptions) => {
|
|
75
79
|
if (err) {
|
|
76
80
|
// nothing was connected, so no 'close' event is coming that would free the
|
|
77
81
|
// slot this resource holds in the pool, report the failure the way a failed
|
|
@@ -93,7 +97,21 @@ export default class PoolResource extends EventEmitter {
|
|
|
93
97
|
options = Object.assign(assign(false, options), socketOptions);
|
|
94
98
|
}
|
|
95
99
|
this.connection = new SMTPConnection(options);
|
|
96
|
-
this.connection.
|
|
100
|
+
this.connection._connectStartedAt = connectStartedAt;
|
|
101
|
+
this.connection.on('error', (err) => {
|
|
102
|
+
if (this._sending) {
|
|
103
|
+
// the send callback gets the same error and decides what it means for the message
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (this._connected && errors.isTransientError(err)) {
|
|
107
|
+
// the server ended a connection that had nothing in flight, usually after it
|
|
108
|
+
// was idle for a while. The 'end' that follows closes this resource
|
|
109
|
+
this.logger.info({
|
|
110
|
+
tnx: 'pool',
|
|
111
|
+
cid: this.id
|
|
112
|
+
}, 'Connection #%s was closed by the server: %s', this.id, err.message);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
97
115
|
this._fail(err);
|
|
98
116
|
if (returned) {
|
|
99
117
|
return;
|
|
@@ -171,9 +189,39 @@ export default class PoolResource extends EventEmitter {
|
|
|
171
189
|
if (mail.data.requireTLSExtensionEnabled) {
|
|
172
190
|
envelope.requireTLSExtensionEnabled = mail.data.requireTLSExtensionEnabled;
|
|
173
191
|
}
|
|
174
|
-
this.
|
|
192
|
+
this._sending = true;
|
|
193
|
+
// a connection that sent messages before may have been dropped by the server in between
|
|
194
|
+
const reused = this.messages > 0;
|
|
195
|
+
const messageStream = mail.message.createReadStream();
|
|
196
|
+
this.connection.send(envelope, messageStream, (err, info) => {
|
|
197
|
+
this._sending = false;
|
|
175
198
|
this.messages++;
|
|
176
199
|
if (err) {
|
|
200
|
+
if (reused && messageStream.readableDidRead === false && errors.isTransientError(err)) {
|
|
201
|
+
// Not a byte of the message was sent, so it can go out over another
|
|
202
|
+
// connection. The pool requeues the message when this resource closes
|
|
203
|
+
this.logger.info({
|
|
204
|
+
tnx: 'pool',
|
|
205
|
+
cid: this.id,
|
|
206
|
+
messageId
|
|
207
|
+
}, 'Connection #%s was closed by the server before message %s was sent: %s', this.id, messageId, err.message);
|
|
208
|
+
this.connection.close();
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if ((err.code === errors.EENVELOPE || err.code === errors.EMESSAGE) &&
|
|
212
|
+
err.responseCode !== 421 &&
|
|
213
|
+
!this.connection._destroyed) {
|
|
214
|
+
// The server refused this message, the connection itself is fine. Reset the
|
|
215
|
+
// session and keep using it instead of opening a new one
|
|
216
|
+
this.connection.reset(resetErr => {
|
|
217
|
+
if (resetErr) {
|
|
218
|
+
this.connection.close();
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
this._release();
|
|
222
|
+
});
|
|
223
|
+
return callback(err);
|
|
224
|
+
}
|
|
177
225
|
this.connection.close();
|
|
178
226
|
this._fail(err);
|
|
179
227
|
return callback(err);
|
|
@@ -183,28 +231,69 @@ export default class PoolResource extends EventEmitter {
|
|
|
183
231
|
to: envelope.to
|
|
184
232
|
};
|
|
185
233
|
info.messageId = messageId;
|
|
186
|
-
setImmediate(() =>
|
|
187
|
-
if (this.messages >= this.options.maxMessages) {
|
|
188
|
-
const err = new Error('Resource exhausted');
|
|
189
|
-
err.code = errors.EMAXLIMIT;
|
|
190
|
-
this.connection.close();
|
|
191
|
-
this._fail(err);
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
this.pool._checkRateLimit(() => {
|
|
195
|
-
this.available = true;
|
|
196
|
-
this.emit('available');
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
});
|
|
234
|
+
setImmediate(() => this._release());
|
|
200
235
|
callback(null, info);
|
|
201
236
|
});
|
|
202
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Makes the connection available for the next message, or closes it once it has sent
|
|
240
|
+
* maxMessages messages
|
|
241
|
+
*
|
|
242
|
+
* @internal
|
|
243
|
+
*/
|
|
244
|
+
_release() {
|
|
245
|
+
if (this.messages >= this.options.maxMessages) {
|
|
246
|
+
const err = new Error('Resource exhausted');
|
|
247
|
+
err.code = errors.EMAXLIMIT;
|
|
248
|
+
this.connection.close();
|
|
249
|
+
this._fail(err);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
this.pool._checkRateLimit(() => {
|
|
253
|
+
this.available = true;
|
|
254
|
+
this._startIdleTimer();
|
|
255
|
+
this.emit('available');
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/** @internal */
|
|
259
|
+
_startIdleTimer() {
|
|
260
|
+
if (!this.options.idleTimeout || this.options.idleTimeout < 0) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
// one timer per connection, restarted every time the connection becomes available. A
|
|
264
|
+
// connection that is busy when it fires is simply not closed
|
|
265
|
+
if (this._idleTimer && typeof this._idleTimer.refresh === 'function') {
|
|
266
|
+
this._idleTimer.refresh();
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
clearTimeout(this._idleTimer);
|
|
270
|
+
this._idleTimer = setTimeout(() => {
|
|
271
|
+
if (!this.available) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
this.logger.debug({
|
|
275
|
+
tnx: 'pool',
|
|
276
|
+
cid: this.id
|
|
277
|
+
}, 'Closing connection #%s after it was idle for %sms', this.id, this.options.idleTimeout);
|
|
278
|
+
// not handed another message while it says goodbye
|
|
279
|
+
this.available = false;
|
|
280
|
+
this.connection.quit();
|
|
281
|
+
}, this.options.idleTimeout);
|
|
282
|
+
if (typeof this._idleTimer.unref === 'function') {
|
|
283
|
+
this._idleTimer.unref();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/** @internal */
|
|
287
|
+
_stopIdleTimer() {
|
|
288
|
+
clearTimeout(this._idleTimer);
|
|
289
|
+
this._idleTimer = false;
|
|
290
|
+
}
|
|
203
291
|
/**
|
|
204
292
|
* Closes the connection
|
|
205
293
|
*/
|
|
206
294
|
close() {
|
|
207
295
|
this._connected = false;
|
|
296
|
+
this._stopIdleTimer();
|
|
208
297
|
if (this.auth && this.auth.oauth2) {
|
|
209
298
|
this.auth.oauth2.removeAllListeners();
|
|
210
299
|
}
|
|
@@ -104,7 +104,9 @@ class SMTPTransport extends EventEmitter {
|
|
|
104
104
|
* @param callback Callback function
|
|
105
105
|
*/
|
|
106
106
|
send(mail, callback) {
|
|
107
|
-
|
|
107
|
+
// the proxy handshake, if any, counts against connectionTimeout as well
|
|
108
|
+
const connectStartedAt = Date.now();
|
|
109
|
+
this.getSocket(Object.assign({}, this.options, { connectStartedAt }), (err, socketOptions) => {
|
|
108
110
|
if (err) {
|
|
109
111
|
return callback(err);
|
|
110
112
|
}
|
|
@@ -123,6 +125,7 @@ class SMTPTransport extends EventEmitter {
|
|
|
123
125
|
options = Object.assign(shared.assign(false, options), socketOptions);
|
|
124
126
|
}
|
|
125
127
|
const connection = new SMTPConnection(options);
|
|
128
|
+
connection._connectStartedAt = connectStartedAt;
|
|
126
129
|
let perCallAuth;
|
|
127
130
|
const cleanupPerCallAuth = () => {
|
|
128
131
|
if (perCallAuth && perCallAuth !== this.auth && perCallAuth.oauth2) {
|
|
@@ -228,7 +231,9 @@ class SMTPTransport extends EventEmitter {
|
|
|
228
231
|
}
|
|
229
232
|
// the error paths hand over the error alone
|
|
230
233
|
const done = callback;
|
|
231
|
-
|
|
234
|
+
// the proxy handshake, if any, counts against connectionTimeout as well
|
|
235
|
+
const connectStartedAt = Date.now();
|
|
236
|
+
this.getSocket(Object.assign({}, this.options, { connectStartedAt }), (err, socketOptions) => {
|
|
232
237
|
if (err) {
|
|
233
238
|
return done(err);
|
|
234
239
|
}
|
|
@@ -245,6 +250,7 @@ class SMTPTransport extends EventEmitter {
|
|
|
245
250
|
options = Object.assign(shared.assign(false, options), socketOptions);
|
|
246
251
|
}
|
|
247
252
|
const connection = new SMTPConnection(options);
|
|
253
|
+
connection._connectStartedAt = connectStartedAt;
|
|
248
254
|
let returned = false;
|
|
249
255
|
let perCallAuth;
|
|
250
256
|
const cleanupPerCallAuth = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uuid",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.3",
|
|
4
4
|
"description": "RFC9562 UUIDs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"funding": [
|
|
@@ -40,20 +40,20 @@
|
|
|
40
40
|
"!**/test"
|
|
41
41
|
],
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@biomejs/biome": "2.
|
|
44
|
-
"@commitlint/cli": "
|
|
45
|
-
"@commitlint/config-conventional": "
|
|
46
|
-
"bundlewatch": "0.4.
|
|
47
|
-
"commander": "
|
|
48
|
-
"globals": "17.
|
|
49
|
-
"jest": "30.
|
|
50
|
-
"lefthook": "1.
|
|
51
|
-
"lint-staged": "
|
|
43
|
+
"@biomejs/biome": "2.5.13",
|
|
44
|
+
"@commitlint/cli": "21.2.2",
|
|
45
|
+
"@commitlint/config-conventional": "21.2.2",
|
|
46
|
+
"bundlewatch": "0.4.2",
|
|
47
|
+
"commander": "15.0.0",
|
|
48
|
+
"globals": "17.12.0",
|
|
49
|
+
"jest": "30.5.1",
|
|
50
|
+
"lefthook": "2.1.12",
|
|
51
|
+
"lint-staged": "17.5.1",
|
|
52
52
|
"neostandard": "0.13.0",
|
|
53
|
-
"npm-run-all2": "
|
|
54
|
-
"prettier": "3.
|
|
55
|
-
"publint": "0.3.
|
|
56
|
-
"release-please": "17.
|
|
53
|
+
"npm-run-all2": "9.0.3",
|
|
54
|
+
"prettier": "3.9.6",
|
|
55
|
+
"publint": "0.3.24",
|
|
56
|
+
"release-please": "17.11.2",
|
|
57
57
|
"runmd": "2.1.1",
|
|
58
58
|
"standard-version": "9.5.0",
|
|
59
59
|
"typescript": "5.4.3"
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"lint": "npm run biome:check",
|
|
85
85
|
"md": "runmd --watch --output=README.md README_js.md",
|
|
86
86
|
"prepack": "npm run build -- --no-pack",
|
|
87
|
-
"prepare": "lefthook install",
|
|
87
|
+
"prepare": "if [ -d .git ]; then npx lefthook install; fi",
|
|
88
88
|
"prepublishOnly": "npm run build",
|
|
89
89
|
"pretest:benchmark": "npm run build",
|
|
90
90
|
"pretest:browser": "./scripts/iodd && npm run build && npm-run-all --parallel examples:browser:**",
|
|
91
91
|
"pretest:node": "npm run build",
|
|
92
|
-
"pretest": "npm run build",
|
|
92
|
+
"pretest": "if [ -d .git ]; then npm run build; fi",
|
|
93
93
|
"release": "standard-version --no-verify",
|
|
94
94
|
"test:benchmark": "cd examples/benchmark && npm test",
|
|
95
95
|
"test:browser": "wdio run ./wdio.conf.js",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"postchangelog": "biome format --write CHANGELOG.md"
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
|
-
"packageManager": "npm@
|
|
114
|
+
"packageManager": "npm@12.0.2"
|
|
115
115
|
}
|
package/package.json
CHANGED
|
@@ -78,16 +78,16 @@
|
|
|
78
78
|
"constructs": "^10.5.1"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
82
|
-
"@aws-sdk/client-route-53": "^3.
|
|
83
|
-
"@aws-sdk/client-s3": "^3.
|
|
84
|
-
"@aws-sdk/client-ses": "^3.
|
|
85
|
-
"@aws-sdk/client-ssm": "^3.
|
|
86
|
-
"@mavogel/mvc-projen": "^0.0.
|
|
81
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.1149.0",
|
|
82
|
+
"@aws-sdk/client-route-53": "^3.1149.0",
|
|
83
|
+
"@aws-sdk/client-s3": "^3.1149.0",
|
|
84
|
+
"@aws-sdk/client-ses": "^3.1149.0",
|
|
85
|
+
"@aws-sdk/client-ssm": "^3.1149.0",
|
|
86
|
+
"@mavogel/mvc-projen": "^0.0.54",
|
|
87
87
|
"cdk-nag": "^3.0.1",
|
|
88
88
|
"constructs": "^10.5.1",
|
|
89
|
-
"mailparser": "^3.9.
|
|
90
|
-
"uuid": "^14.0.
|
|
89
|
+
"mailparser": "^3.9.38",
|
|
90
|
+
"uuid": "^14.0.3"
|
|
91
91
|
},
|
|
92
92
|
"bundledDependencies": [
|
|
93
93
|
"@aws-sdk/client-cloudwatch-logs",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"publishConfig": {
|
|
122
122
|
"access": "public"
|
|
123
123
|
},
|
|
124
|
-
"version": "0.1.
|
|
124
|
+
"version": "0.1.16",
|
|
125
125
|
"jest": {
|
|
126
126
|
"coverageProvider": "v8",
|
|
127
127
|
"transformIgnorePatterns": [
|