nodemailer 10.0.0 → 10.0.2
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/CHANGELOG.md +16 -0
- package/dist/cjs/addressparser/index.d.ts +1 -3
- package/dist/cjs/base64/index.d.ts +2 -6
- package/dist/cjs/base64/index.js +2 -0
- package/dist/cjs/dkim/index.d.ts +4 -4
- package/dist/cjs/dkim/message-parser.d.ts +1 -3
- package/dist/cjs/dkim/message-parser.js +2 -0
- package/dist/cjs/dkim/relaxed-body.d.ts +3 -22
- package/dist/cjs/dkim/relaxed-body.js +5 -0
- package/dist/cjs/dkim/sign.d.ts +5 -5
- package/dist/cjs/errors.d.ts +8 -8
- package/dist/cjs/fetch/cookies.d.ts +8 -8
- package/dist/cjs/fetch/index.d.ts +15 -15
- package/dist/cjs/json-transport/index.d.ts +2 -2
- package/dist/cjs/mail-composer/index.d.ts +49 -104
- package/dist/cjs/mail-composer/index.js +6 -0
- package/dist/cjs/mailer/index.d.ts +21 -28
- package/dist/cjs/mailer/index.js +19 -5
- package/dist/cjs/mailer/mail-message.d.ts +8 -12
- package/dist/cjs/mailer/mail-message.js +2 -0
- package/dist/cjs/mime-funcs/index.d.ts +1 -1
- package/dist/cjs/mime-node/index.d.ts +37 -191
- package/dist/cjs/mime-node/index.js +45 -7
- package/dist/cjs/mime-node/last-newline.d.ts +1 -3
- package/dist/cjs/mime-node/last-newline.js +2 -0
- package/dist/cjs/mime-node/le-unix.d.ts +1 -5
- package/dist/cjs/mime-node/le-unix.js +1 -0
- package/dist/cjs/mime-node/le-windows.d.ts +1 -5
- package/dist/cjs/mime-node/le-windows.js +1 -0
- package/dist/cjs/nodemailer.d.ts +2 -2
- package/dist/cjs/package-info.d.ts +1 -1
- package/dist/cjs/package-info.js +1 -1
- package/dist/cjs/qp/index.d.ts +2 -5
- package/dist/cjs/qp/index.js +2 -0
- package/dist/cjs/sendmail-transport/index.d.ts +4 -6
- package/dist/cjs/ses-transport/index.d.ts +2 -2
- package/dist/cjs/shared/index.d.ts +31 -37
- package/dist/cjs/shared/index.js +19 -7
- package/dist/cjs/smtp-connection/data-stream.d.ts +1 -9
- package/dist/cjs/smtp-connection/data-stream.js +2 -0
- package/dist/cjs/smtp-connection/http-proxy-client.d.ts +1 -1
- package/dist/cjs/smtp-connection/index.d.ts +62 -403
- package/dist/cjs/smtp-connection/index.js +37 -1
- package/dist/cjs/smtp-pool/index.d.ts +8 -46
- package/dist/cjs/smtp-pool/index.js +9 -0
- package/dist/cjs/smtp-pool/pool-resource.d.ts +2 -4
- package/dist/cjs/smtp-transport/index.d.ts +16 -16
- package/dist/cjs/stream-transport/index.d.ts +3 -3
- package/dist/cjs/well-known/index.d.ts +9 -9
- package/dist/cjs/xoauth2/index.d.ts +18 -18
- package/dist/esm/addressparser/index.d.ts +1 -3
- package/dist/esm/base64/index.d.ts +2 -6
- package/dist/esm/base64/index.js +2 -0
- package/dist/esm/dkim/index.d.ts +4 -4
- package/dist/esm/dkim/message-parser.d.ts +1 -3
- package/dist/esm/dkim/message-parser.js +2 -0
- package/dist/esm/dkim/relaxed-body.d.ts +3 -22
- package/dist/esm/dkim/relaxed-body.js +5 -0
- package/dist/esm/dkim/sign.d.ts +5 -5
- package/dist/esm/errors.d.ts +8 -8
- package/dist/esm/fetch/cookies.d.ts +8 -8
- package/dist/esm/fetch/index.d.ts +15 -15
- package/dist/esm/json-transport/index.d.ts +2 -2
- package/dist/esm/mail-composer/index.d.ts +49 -104
- package/dist/esm/mail-composer/index.js +6 -0
- package/dist/esm/mailer/index.d.ts +21 -28
- package/dist/esm/mailer/index.js +19 -5
- package/dist/esm/mailer/mail-message.d.ts +8 -12
- package/dist/esm/mailer/mail-message.js +2 -0
- package/dist/esm/mime-funcs/index.d.ts +1 -1
- package/dist/esm/mime-node/index.d.ts +37 -191
- package/dist/esm/mime-node/index.js +45 -7
- package/dist/esm/mime-node/last-newline.d.ts +1 -3
- package/dist/esm/mime-node/last-newline.js +2 -0
- package/dist/esm/mime-node/le-unix.d.ts +1 -5
- package/dist/esm/mime-node/le-unix.js +1 -0
- package/dist/esm/mime-node/le-windows.d.ts +1 -5
- package/dist/esm/mime-node/le-windows.js +1 -0
- package/dist/esm/nodemailer.d.ts +2 -2
- package/dist/esm/package-info.d.ts +1 -1
- package/dist/esm/package-info.js +1 -1
- package/dist/esm/qp/index.d.ts +2 -5
- package/dist/esm/qp/index.js +2 -0
- package/dist/esm/sendmail-transport/index.d.ts +4 -6
- package/dist/esm/ses-transport/index.d.ts +2 -2
- package/dist/esm/shared/index.d.ts +31 -37
- package/dist/esm/shared/index.js +19 -7
- package/dist/esm/smtp-connection/data-stream.d.ts +1 -9
- package/dist/esm/smtp-connection/data-stream.js +2 -0
- package/dist/esm/smtp-connection/http-proxy-client.d.ts +1 -1
- package/dist/esm/smtp-connection/index.d.ts +62 -403
- package/dist/esm/smtp-connection/index.js +37 -1
- package/dist/esm/smtp-pool/index.d.ts +8 -46
- package/dist/esm/smtp-pool/index.js +9 -0
- package/dist/esm/smtp-pool/pool-resource.d.ts +2 -4
- package/dist/esm/smtp-transport/index.d.ts +16 -16
- package/dist/esm/stream-transport/index.d.ts +3 -3
- package/dist/esm/well-known/index.d.ts +9 -9
- package/dist/esm/xoauth2/index.d.ts +18 -18
- package/package.json +1 -1
|
@@ -916,6 +916,7 @@ class MimeNode {
|
|
|
916
916
|
*
|
|
917
917
|
* @param flag Either 'disableFileAccess' or 'disableUrlAccess'
|
|
918
918
|
* @return true if this node or an ancestor closed that access
|
|
919
|
+
* @internal
|
|
919
920
|
*/
|
|
920
921
|
_accessDisabled(flag) {
|
|
921
922
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
@@ -933,6 +934,7 @@ class MimeNode {
|
|
|
933
934
|
*
|
|
934
935
|
* @param content Node content
|
|
935
936
|
* @returns Stream object
|
|
937
|
+
* @internal
|
|
936
938
|
*/
|
|
937
939
|
_getStream(content) {
|
|
938
940
|
let contentStream;
|
|
@@ -999,19 +1001,41 @@ class MimeNode {
|
|
|
999
1001
|
*
|
|
1000
1002
|
* @param addresses Addresses to be parsed
|
|
1001
1003
|
* @return An array of address objects
|
|
1004
|
+
* @internal
|
|
1002
1005
|
*/
|
|
1003
1006
|
_parseAddresses(addresses) {
|
|
1004
|
-
// Collected into one list as we go. concat.apply spreads the entries into arguments
|
|
1005
|
-
// and throws a RangeError once a recipient array is long enough to pass the
|
|
1006
|
-
// argument limit, which a large Bcc list reaches on its own.
|
|
1007
1007
|
const flattened = [];
|
|
1008
|
-
|
|
1008
|
+
// Nested arrays are flattened iteratively. concat.apply throws once a recipient list
|
|
1009
|
+
// is long enough to pass the argument limit, and an array handed to addressparser is
|
|
1010
|
+
// stringified, which recurses once per nesting level and exhausts the call stack on
|
|
1011
|
+
// a deep enough value. Every array is walked once, which also ends a self-referential
|
|
1012
|
+
// input
|
|
1013
|
+
const seen = new WeakSet();
|
|
1014
|
+
const stack = [];
|
|
1015
|
+
const enter = (list) => {
|
|
1016
|
+
if (!seen.has(list)) {
|
|
1017
|
+
seen.add(list);
|
|
1018
|
+
stack.push({ list, pos: 0 });
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
enter(Array.isArray(addresses) ? addresses : [addresses]);
|
|
1022
|
+
while (stack.length) {
|
|
1023
|
+
const frame = stack[stack.length - 1];
|
|
1024
|
+
if (frame.pos >= frame.list.length) {
|
|
1025
|
+
stack.pop();
|
|
1026
|
+
continue;
|
|
1027
|
+
}
|
|
1028
|
+
const address = frame.list[frame.pos++];
|
|
1029
|
+
if (Array.isArray(address)) {
|
|
1030
|
+
enter(address);
|
|
1031
|
+
continue;
|
|
1032
|
+
}
|
|
1009
1033
|
if (address && address.address) {
|
|
1010
1034
|
const normalized = this._normalizeAddress(address.address);
|
|
1011
1035
|
if (normalized === address.address && typeof address.name === 'string') {
|
|
1012
1036
|
// there is nothing to rewrite, so there is nothing to keep off the original
|
|
1013
1037
|
flattened.push(address);
|
|
1014
|
-
|
|
1038
|
+
continue;
|
|
1015
1039
|
}
|
|
1016
1040
|
// rewriting would land on the object the caller passed in and might
|
|
1017
1041
|
// still hold a reference to, so rewrite a copy of it instead. An own
|
|
@@ -1021,13 +1045,13 @@ class MimeNode {
|
|
|
1021
1045
|
copy.address = normalized;
|
|
1022
1046
|
copy.name = address.name || '';
|
|
1023
1047
|
flattened.push(copy);
|
|
1024
|
-
|
|
1048
|
+
continue;
|
|
1025
1049
|
}
|
|
1026
1050
|
const parsed = this._normalizeParsedAddresses(addressparser(address));
|
|
1027
1051
|
for (let i = 0; i < parsed.length; i++) {
|
|
1028
1052
|
flattened.push(parsed[i]);
|
|
1029
1053
|
}
|
|
1030
|
-
}
|
|
1054
|
+
}
|
|
1031
1055
|
return flattened;
|
|
1032
1056
|
}
|
|
1033
1057
|
/**
|
|
@@ -1040,6 +1064,7 @@ class MimeNode {
|
|
|
1040
1064
|
*
|
|
1041
1065
|
* @param parsed An array of address objects, as returned by addressparser
|
|
1042
1066
|
* @return The same array, with every address normalized
|
|
1067
|
+
* @internal
|
|
1043
1068
|
*/
|
|
1044
1069
|
_normalizeParsedAddresses(parsed) {
|
|
1045
1070
|
// addressparser builds these objects, so no caller holds a reference to rewrite around
|
|
@@ -1062,6 +1087,7 @@ class MimeNode {
|
|
|
1062
1087
|
*
|
|
1063
1088
|
* @param addresses Addresses to be parsed
|
|
1064
1089
|
* @return An array of address objects
|
|
1090
|
+
* @internal
|
|
1065
1091
|
*/
|
|
1066
1092
|
_parseEnvelopeAddresses(addresses) {
|
|
1067
1093
|
return this._parseAddresses(addresses).map(entry => {
|
|
@@ -1076,6 +1102,7 @@ class MimeNode {
|
|
|
1076
1102
|
*
|
|
1077
1103
|
* @param key Key to be normalized
|
|
1078
1104
|
* @return key in Camel-Case form
|
|
1105
|
+
* @internal
|
|
1079
1106
|
*/
|
|
1080
1107
|
_normalizeHeaderKey(key) {
|
|
1081
1108
|
key = (key || '')
|
|
@@ -1098,6 +1125,7 @@ class MimeNode {
|
|
|
1098
1125
|
* Doesn't return anything, modifies object argument instead.
|
|
1099
1126
|
*
|
|
1100
1127
|
* @param structured Parsed header value for 'Content-Type' key
|
|
1128
|
+
* @internal
|
|
1101
1129
|
*/
|
|
1102
1130
|
_handleContentType(structured) {
|
|
1103
1131
|
this.contentType = structured.value.trim().toLowerCase();
|
|
@@ -1114,6 +1142,7 @@ class MimeNode {
|
|
|
1114
1142
|
* Generates a multipart boundary value
|
|
1115
1143
|
*
|
|
1116
1144
|
* @return boundary value
|
|
1145
|
+
* @internal
|
|
1117
1146
|
*/
|
|
1118
1147
|
_generateBoundary() {
|
|
1119
1148
|
return this.rootNode.boundaryPrefix + '-' + this.rootNode.baseBoundary + '-Part_' + this._nodeId;
|
|
@@ -1123,6 +1152,7 @@ class MimeNode {
|
|
|
1123
1152
|
*
|
|
1124
1153
|
* @param key Header key
|
|
1125
1154
|
* @param value Header value
|
|
1155
|
+
* @internal
|
|
1126
1156
|
*/
|
|
1127
1157
|
_encodeHeaderValue(key, value) {
|
|
1128
1158
|
key = this._normalizeHeaderKey(key);
|
|
@@ -1195,6 +1225,7 @@ class MimeNode {
|
|
|
1195
1225
|
* @param addresses An array of address objects
|
|
1196
1226
|
* @param [uniqueList] An array to be populated with addresses
|
|
1197
1227
|
* @return address string
|
|
1228
|
+
* @internal
|
|
1198
1229
|
*/
|
|
1199
1230
|
_convertAddresses(addresses, uniqueList, seenAddresses) {
|
|
1200
1231
|
const values = [];
|
|
@@ -1239,6 +1270,7 @@ class MimeNode {
|
|
|
1239
1270
|
*
|
|
1240
1271
|
* @param address An array of address objects
|
|
1241
1272
|
* @return address string
|
|
1273
|
+
* @internal
|
|
1242
1274
|
*/
|
|
1243
1275
|
_normalizeAddress(address) {
|
|
1244
1276
|
address = (address || '')
|
|
@@ -1285,6 +1317,7 @@ class MimeNode {
|
|
|
1285
1317
|
*
|
|
1286
1318
|
* @param user Local part of an address
|
|
1287
1319
|
* @return Local part as a dot-atom or as a quoted-string
|
|
1320
|
+
* @internal
|
|
1288
1321
|
*/
|
|
1289
1322
|
_normalizeLocalPart(user) {
|
|
1290
1323
|
if (DOT_ATOM.test(user) || QUOTED_STRING.test(user)) {
|
|
@@ -1297,6 +1330,7 @@ class MimeNode {
|
|
|
1297
1330
|
*
|
|
1298
1331
|
* @param name Name part of an address
|
|
1299
1332
|
* @returns Mime word encoded string if needed
|
|
1333
|
+
* @internal
|
|
1300
1334
|
*/
|
|
1301
1335
|
_encodeAddressName(name) {
|
|
1302
1336
|
if (!/^[\w ]*$/.test(name)) {
|
|
@@ -1316,6 +1350,7 @@ class MimeNode {
|
|
|
1316
1350
|
*
|
|
1317
1351
|
* @param value Header value to encode
|
|
1318
1352
|
* @returns Mime word encoded string if needed
|
|
1353
|
+
* @internal
|
|
1319
1354
|
*/
|
|
1320
1355
|
_encodeHeaderText(value) {
|
|
1321
1356
|
return /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/.test(value)
|
|
@@ -1328,6 +1363,7 @@ class MimeNode {
|
|
|
1328
1363
|
*
|
|
1329
1364
|
* @param name Name part of an address
|
|
1330
1365
|
* @returns Mime word encoded string if needed
|
|
1366
|
+
* @internal
|
|
1331
1367
|
*/
|
|
1332
1368
|
_encodeWords(value) {
|
|
1333
1369
|
// set encodeAll parameter to true even though it is against the recommendation of RFC2047,
|
|
@@ -1340,6 +1376,7 @@ class MimeNode {
|
|
|
1340
1376
|
*
|
|
1341
1377
|
* @param value Value to check for
|
|
1342
1378
|
* @return either 'Q' or 'B'
|
|
1379
|
+
* @internal
|
|
1343
1380
|
*/
|
|
1344
1381
|
_getTextEncoding(value) {
|
|
1345
1382
|
value = (value || '').toString();
|
|
@@ -1367,6 +1404,7 @@ class MimeNode {
|
|
|
1367
1404
|
* Generates a message id
|
|
1368
1405
|
*
|
|
1369
1406
|
* @return Random Message-ID value
|
|
1407
|
+
* @internal
|
|
1370
1408
|
*/
|
|
1371
1409
|
_generateMessageId() {
|
|
1372
1410
|
return ('<' +
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Transform
|
|
1
|
+
import { Transform } from 'node:stream';
|
|
2
2
|
export default class LastNewline extends Transform {
|
|
3
3
|
lastByte: number | false;
|
|
4
4
|
constructor();
|
|
5
|
-
_transform(chunk: Buffer, encoding: BufferEncoding, done: TransformCallback): void;
|
|
6
|
-
_flush(done: TransformCallback): void;
|
|
7
5
|
}
|
|
@@ -4,6 +4,7 @@ export default class LastNewline extends Transform {
|
|
|
4
4
|
super();
|
|
5
5
|
this.lastByte = false;
|
|
6
6
|
}
|
|
7
|
+
/** @internal */
|
|
7
8
|
_transform(chunk, encoding, done) {
|
|
8
9
|
if (chunk.length) {
|
|
9
10
|
this.lastByte = chunk[chunk.length - 1];
|
|
@@ -11,6 +12,7 @@ export default class LastNewline extends Transform {
|
|
|
11
12
|
this.push(chunk);
|
|
12
13
|
done();
|
|
13
14
|
}
|
|
15
|
+
/** @internal */
|
|
14
16
|
_flush(done) {
|
|
15
17
|
if (this.lastByte === 0x0a) {
|
|
16
18
|
return done();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transform, type
|
|
1
|
+
import { Transform, type TransformOptions } from 'node:stream';
|
|
2
2
|
/**
|
|
3
3
|
* Ensures that only <LF> is used for linebreaks
|
|
4
4
|
*
|
|
@@ -6,8 +6,4 @@ import { Transform, type TransformCallback, type TransformOptions } from 'node:s
|
|
|
6
6
|
*/
|
|
7
7
|
export default class LeUnix extends Transform {
|
|
8
8
|
constructor(options?: TransformOptions);
|
|
9
|
-
/**
|
|
10
|
-
* Escapes dots
|
|
11
|
-
*/
|
|
12
|
-
_transform(chunk: Buffer, encoding: BufferEncoding, done: TransformCallback): void;
|
|
13
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transform, type
|
|
1
|
+
import { Transform, type TransformOptions } from 'node:stream';
|
|
2
2
|
/**
|
|
3
3
|
* Ensures that only <CR><LF> sequences are used for linebreaks
|
|
4
4
|
*
|
|
@@ -7,8 +7,4 @@ import { Transform, type TransformCallback, type TransformOptions } from 'node:s
|
|
|
7
7
|
export default class LeWindows extends Transform {
|
|
8
8
|
lastByte: number | false;
|
|
9
9
|
constructor(options?: TransformOptions);
|
|
10
|
-
/**
|
|
11
|
-
* Escapes dots
|
|
12
|
-
*/
|
|
13
|
-
_transform(chunk: Buffer, encoding: BufferEncoding, done: TransformCallback): void;
|
|
14
10
|
}
|
package/dist/esm/nodemailer.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface TestAccount {
|
|
|
25
25
|
pop3: TestAccountService;
|
|
26
26
|
web: string;
|
|
27
27
|
/** true if the account can also receive external mail */
|
|
28
|
-
mxEnabled?: boolean;
|
|
28
|
+
mxEnabled?: boolean | undefined;
|
|
29
29
|
[key: string]: unknown;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
@@ -77,7 +77,7 @@ export declare function createTestAccount(apiUrl?: string | false | null): Promi
|
|
|
77
77
|
* @returns URL of the message in the Ethereal web interface, or false if the response does not carry one
|
|
78
78
|
*/
|
|
79
79
|
export declare function getTestMessageUrl(info?: {
|
|
80
|
-
response?: string | Buffer | null;
|
|
80
|
+
response?: string | Buffer | null | undefined;
|
|
81
81
|
} | false | null): string | false;
|
|
82
82
|
declare const nodemailer: {
|
|
83
83
|
createTransport: typeof createTransport;
|
package/dist/esm/package-info.js
CHANGED
package/dist/esm/qp/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transform
|
|
1
|
+
import { Transform } from 'node:stream';
|
|
2
2
|
export declare function encode(buffer: Buffer | string): string;
|
|
3
3
|
/**
|
|
4
4
|
* Adds soft line breaks to a Quoted-Printable string
|
|
@@ -13,7 +13,7 @@ export declare function wrap(str: string, lineLength?: number): string;
|
|
|
13
13
|
*/
|
|
14
14
|
export interface QPEncoderOptions {
|
|
15
15
|
/** Maximum length for lines, set to false to disable wrapping */
|
|
16
|
-
lineLength?: number | false;
|
|
16
|
+
lineLength?: number | false | undefined;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Creates a transform stream for encoding data to Quoted-Printable encoding
|
|
@@ -26,8 +26,5 @@ export declare class Encoder extends Transform {
|
|
|
26
26
|
options: QPEncoderOptions;
|
|
27
27
|
inputBytes: number;
|
|
28
28
|
outputBytes: number;
|
|
29
|
-
_curLine: string;
|
|
30
29
|
constructor(options?: QPEncoderOptions);
|
|
31
|
-
_transform(chunk: Buffer | string, encoding: BufferEncoding | 'buffer', done: TransformCallback): void;
|
|
32
|
-
_flush(done: TransformCallback): void;
|
|
33
30
|
}
|
package/dist/esm/qp/index.js
CHANGED
|
@@ -152,6 +152,7 @@ export class Encoder extends Transform {
|
|
|
152
152
|
this.inputBytes = 0;
|
|
153
153
|
this.outputBytes = 0;
|
|
154
154
|
}
|
|
155
|
+
/** @internal */
|
|
155
156
|
_transform(chunk, encoding, done) {
|
|
156
157
|
let qp;
|
|
157
158
|
if (encoding !== 'buffer') {
|
|
@@ -180,6 +181,7 @@ export class Encoder extends Transform {
|
|
|
180
181
|
}
|
|
181
182
|
done();
|
|
182
183
|
}
|
|
184
|
+
/** @internal */
|
|
183
185
|
_flush(done) {
|
|
184
186
|
if (this._curLine) {
|
|
185
187
|
this.outputBytes += this._curLine.length;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
1
|
import type { Logger } from '../shared/index.js';
|
|
3
2
|
import type { MimeNodeEnvelope } from '../mime-node/index.js';
|
|
4
3
|
import type MailMessage from '../mailer/mail-message.js';
|
|
@@ -8,13 +7,13 @@ import type { default as Mail, SentMessageInfo, SendMailOptions, TransportOption
|
|
|
8
7
|
*/
|
|
9
8
|
export interface SendmailTransportOptions extends TransportOptions {
|
|
10
9
|
/** Selects this transport in createTransport, the binary itself is set with `path` */
|
|
11
|
-
sendmail?: boolean | string;
|
|
10
|
+
sendmail?: boolean | string | undefined;
|
|
12
11
|
/** Path to the sendmail binary, defaults to 'sendmail' */
|
|
13
|
-
path?: string;
|
|
12
|
+
path?: string | undefined;
|
|
14
13
|
/** Either 'windows' or 'unix', the line ending of the message piped to sendmail */
|
|
15
|
-
newline?: string;
|
|
14
|
+
newline?: string | undefined;
|
|
16
15
|
/** Arguments for the sendmail binary, replaces the default '-f <sender>' */
|
|
17
|
-
args?: string[];
|
|
16
|
+
args?: string[] | undefined;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* The value the Sendmail transport hands to the send callback
|
|
@@ -41,7 +40,6 @@ export interface SendmailSentMessageInfo extends SentMessageInfo {
|
|
|
41
40
|
*/
|
|
42
41
|
declare class SendmailTransport {
|
|
43
42
|
mailer: Mail<SendmailSentMessageInfo>;
|
|
44
|
-
_spawn: typeof spawn;
|
|
45
43
|
options: SendmailTransportOptions;
|
|
46
44
|
name: string;
|
|
47
45
|
version: string;
|
|
@@ -12,9 +12,9 @@ export interface SESTransportOptions extends TransportOptions {
|
|
|
12
12
|
/** SESv2Client instance. Its config.region provider is resolved for the domain of the returned Message-ID */
|
|
13
13
|
sesClient: {
|
|
14
14
|
config?: {
|
|
15
|
-
region?: () => Promise<string
|
|
15
|
+
region?: (() => Promise<string>) | undefined;
|
|
16
16
|
[key: string]: any;
|
|
17
|
-
};
|
|
17
|
+
} | undefined;
|
|
18
18
|
send(command: unknown): Promise<any>;
|
|
19
19
|
};
|
|
20
20
|
/** SendEmailCommand class, constructed with the SendEmailCommandInput of every message */
|
|
@@ -9,39 +9,36 @@ export { isProtoKey, copyOwnKeys };
|
|
|
9
9
|
*/
|
|
10
10
|
export interface ResolveHostnameOptions {
|
|
11
11
|
/** Hostname or IP address to resolve */
|
|
12
|
-
host?: string;
|
|
12
|
+
host?: string | undefined;
|
|
13
13
|
/** Server name for TLS, used as the host when no host is set */
|
|
14
|
-
servername?: string;
|
|
14
|
+
servername?: string | undefined;
|
|
15
15
|
/** Count loopback interfaces when checking which address families are usable */
|
|
16
|
-
allowInternalNetworkInterfaces?: boolean;
|
|
16
|
+
allowInternalNetworkInterfaces?: boolean | undefined;
|
|
17
17
|
/** How long a resolved value stays cached, in milliseconds (default 5 minutes) */
|
|
18
|
-
dnsTtl?: number;
|
|
18
|
+
dnsTtl?: number | undefined;
|
|
19
19
|
/** Query timeout in milliseconds, passed to dns.Resolver */
|
|
20
|
-
timeout?: number;
|
|
20
|
+
timeout?: number | undefined;
|
|
21
21
|
/** Number of query attempts, passed to dns.Resolver */
|
|
22
|
-
tries?: number;
|
|
22
|
+
tries?: number | undefined;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Resolved value handed to the resolveHostname callback
|
|
26
26
|
*/
|
|
27
27
|
export interface ResolvedHostname {
|
|
28
28
|
/** Server name to use for TLS, false when an IP literal was given without one */
|
|
29
|
-
servername?: string | false;
|
|
29
|
+
servername?: string | false | undefined;
|
|
30
30
|
/** Address to connect to, picked at random from the resolved addresses */
|
|
31
|
-
host?: string | null;
|
|
32
|
-
/** All resolved addresses, for connection fallback support */
|
|
33
|
-
_addresses?: string[];
|
|
31
|
+
host?: string | null | undefined;
|
|
34
32
|
/** Whether the value came from the DNS cache */
|
|
35
|
-
cached?: boolean;
|
|
33
|
+
cached?: boolean | undefined;
|
|
36
34
|
/** The resolver error when a cached value was used because of it */
|
|
37
|
-
error?: Error;
|
|
35
|
+
error?: Error | undefined;
|
|
38
36
|
}
|
|
39
37
|
/**
|
|
40
38
|
* Resolved addresses as stored in the DNS cache
|
|
41
39
|
*/
|
|
42
40
|
export interface DnsCacheValue {
|
|
43
41
|
addresses: string[];
|
|
44
|
-
servername: string | false;
|
|
45
42
|
}
|
|
46
43
|
/**
|
|
47
44
|
* A DNS cache entry
|
|
@@ -49,26 +46,26 @@ export interface DnsCacheValue {
|
|
|
49
46
|
export interface DnsCacheEntry {
|
|
50
47
|
value: DnsCacheValue;
|
|
51
48
|
/** Expiration time as a timestamp, entries without one never expire */
|
|
52
|
-
expires?: number;
|
|
49
|
+
expires?: number | undefined;
|
|
53
50
|
}
|
|
54
51
|
/**
|
|
55
52
|
* Configuration object parsed from a connection url. Query parameters become
|
|
56
53
|
* top level keys, `tls.*` parameters go into `tls`
|
|
57
54
|
*/
|
|
58
55
|
export interface ConnectionUrlOptions {
|
|
59
|
-
secure?: boolean;
|
|
60
|
-
direct?: boolean;
|
|
61
|
-
port?: number;
|
|
62
|
-
host?: string;
|
|
56
|
+
secure?: boolean | undefined;
|
|
57
|
+
direct?: boolean | undefined;
|
|
58
|
+
port?: number | undefined;
|
|
59
|
+
host?: string | undefined;
|
|
63
60
|
/** Well-known service name from the ?service= query parameter */
|
|
64
|
-
service?: string;
|
|
61
|
+
service?: string | undefined;
|
|
65
62
|
auth?: {
|
|
66
63
|
user: string;
|
|
67
64
|
pass: string;
|
|
68
|
-
};
|
|
65
|
+
} | undefined;
|
|
69
66
|
tls?: {
|
|
70
67
|
[key: string]: unknown;
|
|
71
|
-
};
|
|
68
|
+
} | undefined;
|
|
72
69
|
[key: string]: unknown;
|
|
73
70
|
}
|
|
74
71
|
/**
|
|
@@ -77,12 +74,12 @@ export interface ConnectionUrlOptions {
|
|
|
77
74
|
*/
|
|
78
75
|
export interface LogEntry {
|
|
79
76
|
/** 'server' or 'client' for SMTP transaction lines */
|
|
80
|
-
tnx?: string;
|
|
77
|
+
tnx?: string | undefined;
|
|
81
78
|
/** Session id */
|
|
82
|
-
sid?: string;
|
|
79
|
+
sid?: string | undefined;
|
|
83
80
|
/** Connection id */
|
|
84
|
-
cid?: string | number;
|
|
85
|
-
level?: string;
|
|
81
|
+
cid?: string | number | undefined;
|
|
82
|
+
level?: string | undefined;
|
|
86
83
|
[key: string]: any;
|
|
87
84
|
}
|
|
88
85
|
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
@@ -105,7 +102,7 @@ export interface ExternalLogger {
|
|
|
105
102
|
*/
|
|
106
103
|
export interface GetLoggerOptions {
|
|
107
104
|
/** A bunyan compatible logger, true for the default console logger, false or unset for no logging */
|
|
108
|
-
logger?: ExternalLogger | boolean;
|
|
105
|
+
logger?: ExternalLogger | boolean | undefined;
|
|
109
106
|
}
|
|
110
107
|
/**
|
|
111
108
|
* The bunyan compatible logger interface returned by getLogger
|
|
@@ -137,9 +134,9 @@ export interface ParsedDataURI {
|
|
|
137
134
|
*/
|
|
138
135
|
export interface ResolveContentOptions {
|
|
139
136
|
/** Reject content that points to a file path */
|
|
140
|
-
disableFileAccess?: boolean;
|
|
137
|
+
disableFileAccess?: boolean | undefined;
|
|
141
138
|
/** Reject content that points to a URL */
|
|
142
|
-
disableUrlAccess?: boolean;
|
|
139
|
+
disableUrlAccess?: boolean | undefined;
|
|
143
140
|
}
|
|
144
141
|
/**
|
|
145
142
|
* An object value resolveContent understands. A plain string or Buffer value is returned as
|
|
@@ -148,23 +145,21 @@ export interface ResolveContentOptions {
|
|
|
148
145
|
*/
|
|
149
146
|
export interface ContentDescriptor {
|
|
150
147
|
/** The content itself, a string, a Buffer or a readable stream */
|
|
151
|
-
content?: string | Buffer | Readable;
|
|
148
|
+
content?: string | Buffer | Readable | undefined;
|
|
152
149
|
/** Encoding of a string `content`, it is decoded into a Buffer unless it is utf8 or ascii */
|
|
153
|
-
encoding?: string;
|
|
150
|
+
encoding?: string | undefined;
|
|
154
151
|
/** File path, http(s) URL or data URI to read the content from */
|
|
155
|
-
path?: string;
|
|
152
|
+
path?: string | undefined;
|
|
156
153
|
/** URL to fetch the content from */
|
|
157
|
-
href?: string;
|
|
154
|
+
href?: string | undefined;
|
|
158
155
|
/** Request headers for a URL fetch */
|
|
159
|
-
httpHeaders?: OutgoingHttpHeaders;
|
|
156
|
+
httpHeaders?: OutgoingHttpHeaders | undefined;
|
|
160
157
|
/** TLS settings for a URL fetch, see nmfetch */
|
|
161
158
|
tls?: {
|
|
162
159
|
[key: string]: any;
|
|
163
|
-
};
|
|
160
|
+
} | undefined;
|
|
164
161
|
}
|
|
165
162
|
export type ResolveContentCallback = (err: Error | null, value?: any) => void;
|
|
166
|
-
export declare const _lastCacheCleanup: () => number;
|
|
167
|
-
export declare const _resetCacheCleanup: () => void;
|
|
168
163
|
export declare let networkInterfaces: NodeJS.Dict<os.NetworkInterfaceInfo[]> | undefined;
|
|
169
164
|
export declare const dnsCache: Map<string, DnsCacheEntry>;
|
|
170
165
|
export declare const resolveHostname: (options: ResolveHostnameOptions | undefined, callback: (err: Error | null, result?: ResolvedHostname) => void) => void;
|
|
@@ -175,7 +170,6 @@ export declare const resolveHostname: (options: ResolveHostnameOptions | undefin
|
|
|
175
170
|
* @return Configuration object
|
|
176
171
|
*/
|
|
177
172
|
export declare const parseConnectionUrl: (str?: string | null) => ConnectionUrlOptions;
|
|
178
|
-
export declare const _logFunc: (logger: ExternalLogger, level: string, defaults: LogEntry | undefined, data: LogEntry | undefined, message?: string, ...args: any[]) => void;
|
|
179
173
|
/**
|
|
180
174
|
* Returns a bunyan-compatible logger interface. Uses either provided logger or
|
|
181
175
|
* creates a default console logger
|
package/dist/esm/shared/index.js
CHANGED
|
@@ -14,7 +14,9 @@ const DNS_TTL = 5 * 60 * 1000;
|
|
|
14
14
|
const CACHE_CLEANUP_INTERVAL = 30 * 1000; // Minimum 30 seconds between cleanups
|
|
15
15
|
const MAX_CACHE_SIZE = 1000; // Maximum number of entries in cache
|
|
16
16
|
let lastCacheCleanup = 0;
|
|
17
|
+
/** @internal */
|
|
17
18
|
export const _lastCacheCleanup = () => lastCacheCleanup;
|
|
19
|
+
/** @internal */
|
|
18
20
|
export const _resetCacheCleanup = () => {
|
|
19
21
|
lastCacheCleanup = 0;
|
|
20
22
|
};
|
|
@@ -66,7 +68,6 @@ const formatDNSValue = (value, extra) => {
|
|
|
66
68
|
// Select a random address from available addresses, or null if none
|
|
67
69
|
const host = addresses.length > 0 ? addresses[Math.floor(Math.random() * addresses.length)] : null;
|
|
68
70
|
return Object.assign({
|
|
69
|
-
servername: value.servername,
|
|
70
71
|
host,
|
|
71
72
|
// Include all addresses for connection fallback support
|
|
72
73
|
_addresses: addresses
|
|
@@ -80,14 +81,19 @@ export const resolveHostname = (options, callback) => {
|
|
|
80
81
|
if (!options.host || net.isIP(options.host)) {
|
|
81
82
|
// nothing to do here
|
|
82
83
|
const value = {
|
|
83
|
-
addresses: [options.host]
|
|
84
|
-
servername: options.servername || false
|
|
84
|
+
addresses: [options.host]
|
|
85
85
|
};
|
|
86
86
|
return callback(null, formatDNSValue(value, {
|
|
87
|
+
servername: options.servername || false,
|
|
87
88
|
cached: false
|
|
88
89
|
}));
|
|
89
90
|
}
|
|
90
91
|
const host = options.host;
|
|
92
|
+
// The TLS server name belongs to the connection asking, not to the host it resolves. The
|
|
93
|
+
// cache is shared by every transport of the process and keyed by host alone, so a server
|
|
94
|
+
// name stored in it would be the one of whichever transport resolved the host first, and a
|
|
95
|
+
// later transport with its own tls.servername would present and verify that name instead
|
|
96
|
+
const servername = options.servername || host;
|
|
91
97
|
let cached;
|
|
92
98
|
if (dnsCache.has(options.host)) {
|
|
93
99
|
cached = dnsCache.get(options.host);
|
|
@@ -110,6 +116,7 @@ export const resolveHostname = (options, callback) => {
|
|
|
110
116
|
}
|
|
111
117
|
if (!cached.expires || cached.expires >= now) {
|
|
112
118
|
return callback(null, formatDNSValue(cached.value, {
|
|
119
|
+
servername,
|
|
113
120
|
cached: true
|
|
114
121
|
}));
|
|
115
122
|
}
|
|
@@ -137,14 +144,14 @@ export const resolveHostname = (options, callback) => {
|
|
|
137
144
|
const allAddresses = ipv4Addresses.concat(ipv6Addresses);
|
|
138
145
|
if (allAddresses.length) {
|
|
139
146
|
const value = {
|
|
140
|
-
addresses: allAddresses
|
|
141
|
-
servername: options.servername || host
|
|
147
|
+
addresses: allAddresses
|
|
142
148
|
};
|
|
143
149
|
dnsCache.set(host, {
|
|
144
150
|
value,
|
|
145
151
|
expires: Date.now() + (options.dnsTtl || DNS_TTL)
|
|
146
152
|
});
|
|
147
153
|
return callback(null, formatDNSValue(value, {
|
|
154
|
+
servername,
|
|
148
155
|
cached: false
|
|
149
156
|
}));
|
|
150
157
|
}
|
|
@@ -157,6 +164,7 @@ export const resolveHostname = (options, callback) => {
|
|
|
157
164
|
expires: Date.now() + (options.dnsTtl || DNS_TTL)
|
|
158
165
|
});
|
|
159
166
|
return callback(null, formatDNSValue(cached.value, {
|
|
167
|
+
servername,
|
|
160
168
|
cached: true,
|
|
161
169
|
error: ipv4Error
|
|
162
170
|
}));
|
|
@@ -171,6 +179,7 @@ export const resolveHostname = (options, callback) => {
|
|
|
171
179
|
expires: Date.now() + (options.dnsTtl || DNS_TTL)
|
|
172
180
|
});
|
|
173
181
|
return callback(null, formatDNSValue(cached.value, {
|
|
182
|
+
servername,
|
|
174
183
|
cached: true,
|
|
175
184
|
error: err
|
|
176
185
|
}));
|
|
@@ -188,18 +197,19 @@ export const resolveHostname = (options, callback) => {
|
|
|
188
197
|
if (!supportedAddresses.length && cached) {
|
|
189
198
|
// nothing was found, fallback to cached value
|
|
190
199
|
return callback(null, formatDNSValue(cached.value, {
|
|
200
|
+
servername,
|
|
191
201
|
cached: true
|
|
192
202
|
}));
|
|
193
203
|
}
|
|
194
204
|
const value = {
|
|
195
|
-
addresses: supportedAddresses.length ? supportedAddresses : [host]
|
|
196
|
-
servername: options.servername || host
|
|
205
|
+
addresses: supportedAddresses.length ? supportedAddresses : [host]
|
|
197
206
|
};
|
|
198
207
|
dnsCache.set(host, {
|
|
199
208
|
value,
|
|
200
209
|
expires: Date.now() + (options.dnsTtl || DNS_TTL)
|
|
201
210
|
});
|
|
202
211
|
return callback(null, formatDNSValue(value, {
|
|
212
|
+
servername,
|
|
203
213
|
cached: false
|
|
204
214
|
}));
|
|
205
215
|
});
|
|
@@ -211,6 +221,7 @@ export const resolveHostname = (options, callback) => {
|
|
|
211
221
|
expires: Date.now() + (options.dnsTtl || DNS_TTL)
|
|
212
222
|
});
|
|
213
223
|
return callback(null, formatDNSValue(cached.value, {
|
|
224
|
+
servername,
|
|
214
225
|
cached: true,
|
|
215
226
|
error: lookupErr
|
|
216
227
|
}));
|
|
@@ -288,6 +299,7 @@ export const parseConnectionUrl = (str) => {
|
|
|
288
299
|
});
|
|
289
300
|
return options;
|
|
290
301
|
};
|
|
302
|
+
/** @internal */
|
|
291
303
|
export const _logFunc = (logger, level, defaults, data, message, ...args) => {
|
|
292
304
|
const entry = Object.assign({}, defaults || {}, data || {});
|
|
293
305
|
delete entry.level;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transform, type
|
|
1
|
+
import { Transform, type TransformOptions } from 'node:stream';
|
|
2
2
|
/**
|
|
3
3
|
* Escapes dots in the beginning of lines. Ends the stream with <CR><LF>.<CR><LF>
|
|
4
4
|
* Also makes sure that only <CR><LF> sequences are used for linebreaks
|
|
@@ -11,12 +11,4 @@ export default class DataStream extends Transform {
|
|
|
11
11
|
outByteCount: number;
|
|
12
12
|
lastByte: number | false;
|
|
13
13
|
constructor(options?: TransformOptions);
|
|
14
|
-
/**
|
|
15
|
-
* Escapes dots
|
|
16
|
-
*/
|
|
17
|
-
_transform(chunk: Buffer | string, encoding: BufferEncoding, done: TransformCallback): void;
|
|
18
|
-
/**
|
|
19
|
-
* Finalizes the stream with a dot on a single line
|
|
20
|
-
*/
|
|
21
|
-
_flush(done: TransformCallback): void;
|
|
22
14
|
}
|