mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-11-22 05:25:29 +07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27bf7a883d | ||
|
|
a9703ed892 | ||
|
|
b6b2177ec4 | ||
|
|
0d58990203 | ||
|
|
f8b8145a29 | ||
|
|
b6d53adeaf | ||
|
|
67d71b1eee |
No files matched your search
+6
-6
@@ -94,9 +94,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "10.2.0",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.2.0.tgz",
|
||||
"integrity": "sha512-/XyGw6kX2stMdKGUJdAQmYAeY1FscWfdRydfd2NtK3A3KDfUUXCqZzExSNAt2xhh90X2qLCR+o2Gd48YPJcJwA==",
|
||||
"version": "10.3.1",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.3.1.tgz",
|
||||
"integrity": "sha512-uF0AFsJC07Y1vdW7p580DKAnh7rAO+4UPSSB3mDCPNDufoiaOebV6JmrzpxB14OjEEEiBsNdYoM2Y+fN8M7BBA==",
|
||||
"license": "MIT-0",
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
@@ -128,9 +128,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "6.29.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.0.tgz",
|
||||
"integrity": "sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg==",
|
||||
"version": "6.29.1",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz",
|
||||
"integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.17"
|
||||
|
||||
+26
@@ -1,5 +1,31 @@
|
||||
# CHANGELOG
|
||||
|
||||
## [10.3.1](https://github.com/nodemailer/nodemailer/compare/v10.3.0...v10.3.1) (2026-10-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* apply the otp option in MailComposer too ([1d4087f](https://github.com/nodemailer/nodemailer/commit/1d4087f358d124267bddd5eb5e11a4e22fccd3d0))
|
||||
|
||||
## [10.3.0](https://github.com/nodemailer/nodemailer/compare/v10.2.1...v10.3.0) (2026-10-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add the otp option for the OTP-Token header ([7789e15](https://github.com/nodemailer/nodemailer/commit/7789e1501e4f555e9754a15664aa30f1415902b9))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* encode a Content-ID header as a message id ([#1904](https://github.com/nodemailer/nodemailer/issues/1904)) ([47f2b25](https://github.com/nodemailer/nodemailer/commit/47f2b252fccc8ec6a1a5700e12c1087ae3633e17))
|
||||
|
||||
## [10.2.1](https://github.com/nodemailer/nodemailer/compare/v10.2.0...v10.2.1) (2026-10-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* drop the comments of a Content-Type or Content-Disposition value with the stripComments option ([b3052b7](https://github.com/nodemailer/nodemailer/commit/b3052b7fe2e49b51dd66d6c7814a072e885f1ac8))
|
||||
|
||||
## [10.2.0](https://github.com/nodemailer/nodemailer/compare/v10.1.7...v10.2.0) (2026-10-21)
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ function sign(headers, hashAlgo, bodyHash, options) {
|
||||
'Content-Description:Resent-Date:Resent-From:Resent-Sender:' +
|
||||
'Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:' +
|
||||
'List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:' +
|
||||
'List-Owner:List-Archive';
|
||||
'List-Owner:List-Archive:OTP-Token';
|
||||
const fieldNames = options.headerFieldNames || defaultFieldNames;
|
||||
const canonicalizedHeaderData = relaxedHeaders(headers, fieldNames, options.skipFields);
|
||||
const dkimHeader = generateDKIMHeader(options.domainName, options.keySelector, canonicalizedHeaderData.fieldNames, hashAlgo, bodyHash);
|
||||
|
||||
+2
@@ -21,6 +21,7 @@ export declare const ERROR_CODES: {
|
||||
readonly EPROTOCOL: "Invalid SMTP server response";
|
||||
readonly EENVELOPE: "Invalid mail envelope (sender or recipients)";
|
||||
readonly EMESSAGE: "Message delivery error";
|
||||
readonly EOTP: "Invalid one-time passcode data (otp option)";
|
||||
readonly ESTREAM: "Stream processing error";
|
||||
readonly EAUTH: "Authentication failed";
|
||||
readonly ENOAUTH: "Authentication credentials not provided";
|
||||
@@ -48,6 +49,7 @@ export declare const EREQUIRETLS = "EREQUIRETLS";
|
||||
export declare const EPROTOCOL = "EPROTOCOL";
|
||||
export declare const EENVELOPE = "EENVELOPE";
|
||||
export declare const EMESSAGE = "EMESSAGE";
|
||||
export declare const EOTP = "EOTP";
|
||||
export declare const ESTREAM = "ESTREAM";
|
||||
export declare const EAUTH = "EAUTH";
|
||||
export declare const ENOAUTH = "ENOAUTH";
|
||||
|
||||
+3
-1
@@ -10,7 +10,7 @@
|
||||
* err.code = errors.ECONNECTION;
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ERR_ACCESS_DENIED = exports.isPermanentResponseCode = exports.isTransientError = exports.EFETCH = exports.EURLACCESS = exports.EFILEACCESS = exports.EPROXY = exports.ECONFIG = exports.ESES = exports.ESENDMAIL = exports.EMAXRECIPIENTS = exports.EMAXLIMIT = exports.EOAUTH2 = exports.ENOAUTH = exports.EAUTH = exports.ESTREAM = exports.EMESSAGE = exports.EENVELOPE = exports.EPROTOCOL = exports.EREQUIRETLS = exports.ETLS = exports.EDNS = exports.ESOCKET = exports.ETIMEDOUT = exports.ECONNECTION = exports.ERROR_CODES = void 0;
|
||||
exports.ERR_ACCESS_DENIED = exports.isPermanentResponseCode = exports.isTransientError = exports.EFETCH = exports.EURLACCESS = exports.EFILEACCESS = exports.EPROXY = exports.ECONFIG = exports.ESES = exports.ESENDMAIL = exports.EMAXRECIPIENTS = exports.EMAXLIMIT = exports.EOAUTH2 = exports.ENOAUTH = exports.EAUTH = exports.ESTREAM = exports.EOTP = exports.EMESSAGE = exports.EENVELOPE = exports.EPROTOCOL = exports.EREQUIRETLS = exports.ETLS = exports.EDNS = exports.ESOCKET = exports.ETIMEDOUT = exports.ECONNECTION = exports.ERROR_CODES = void 0;
|
||||
/**
|
||||
* Error code descriptions for documentation and debugging
|
||||
*/
|
||||
@@ -27,6 +27,7 @@ exports.ERROR_CODES = {
|
||||
EPROTOCOL: 'Invalid SMTP server response',
|
||||
EENVELOPE: 'Invalid mail envelope (sender or recipients)',
|
||||
EMESSAGE: 'Message delivery error',
|
||||
EOTP: 'Invalid one-time passcode data (otp option)',
|
||||
ESTREAM: 'Stream processing error',
|
||||
// Authentication errors
|
||||
EAUTH: 'Authentication failed',
|
||||
@@ -55,6 +56,7 @@ exports.EREQUIRETLS = 'EREQUIRETLS';
|
||||
exports.EPROTOCOL = 'EPROTOCOL';
|
||||
exports.EENVELOPE = 'EENVELOPE';
|
||||
exports.EMESSAGE = 'EMESSAGE';
|
||||
exports.EOTP = 'EOTP';
|
||||
exports.ESTREAM = 'ESTREAM';
|
||||
exports.EAUTH = 'EAUTH';
|
||||
exports.ENOAUTH = 'ENOAUTH';
|
||||
|
||||
+12
@@ -72,6 +72,16 @@ export type MailComposerListHeaderEntry = string | {
|
||||
export interface MailComposerListHeaders {
|
||||
[key: string]: MailComposerListHeaderEntry | (MailComposerListHeaderEntry | MailComposerListHeaderEntry[])[];
|
||||
}
|
||||
/**
|
||||
* The otp value: a one-time passcode and the origin it is bound to, sent as the OTP-Token
|
||||
* header (draft-goto-otp-token)
|
||||
*/
|
||||
export interface MailComposerOtp {
|
||||
/** The passcode, printable ascii */
|
||||
code: string;
|
||||
/** Origin the code is bound to, https or a loopback http origin. A full url is reduced to its origin */
|
||||
origin: string;
|
||||
}
|
||||
/**
|
||||
* Encoding for the non-ascii header values: quoted-printable ('Q', the default) or base64
|
||||
* ('B'). Only the first letter is read, so the short forms work as well
|
||||
@@ -114,6 +124,8 @@ export interface MailComposerOptions {
|
||||
headers?: MimeNodeHeaders | undefined;
|
||||
/** List-* headers, read by the mailer */
|
||||
list?: MailComposerListHeaders | undefined;
|
||||
/** One-time passcode for the OTP-Token header. An invalid value makes compile() throw an EOTP error */
|
||||
otp?: MailComposerOtp | undefined;
|
||||
/** SMTP envelope to use instead of the one generated from the headers */
|
||||
envelope?: MimeNodeEnvelopeInput | undefined;
|
||||
/** Content-Transfer-Encoding to force for the text/* nodes that do not set their own */
|
||||
|
||||
+53
@@ -39,6 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_js_1 = __importDefault(require("../mime-node/index.js"));
|
||||
const mimeFuncs = __importStar(require("../mime-funcs/index.js"));
|
||||
const errors = __importStar(require("../errors.js"));
|
||||
const index_js_2 = require("../shared/index.js");
|
||||
/**
|
||||
* Creates the object for composing a MimeNode instance out from the mail options
|
||||
@@ -133,6 +134,10 @@ class MailComposer {
|
||||
if (this.mail.headers) {
|
||||
this.message.addHeader(this.mail.headers);
|
||||
}
|
||||
// after the custom headers, so it replaces an OTP-Token from them, the field may appear only once
|
||||
if (this.mail.otp) {
|
||||
this.message.setHeader('OTP-Token', formatOtpToken(this.mail.otp));
|
||||
}
|
||||
// Add headers to the root node, always overrides custom headers
|
||||
['from', 'sender', 'to', 'cc', 'bcc', 'reply-to', 'in-reply-to', 'references', 'subject', 'message-id', 'date'].forEach(header => {
|
||||
const key = header.replace(/-(\w)/g, (o, c) => c.toUpperCase());
|
||||
@@ -641,6 +646,54 @@ class MailComposer {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the value of the OTP-Token header for the otp option. The header is defined by
|
||||
* draft-goto-otp-token-01, an Internet-Draft that expires on 25 March 2027. By then check
|
||||
* for a newer revision of the draft or a published RFC, the header name and its
|
||||
* parameters are still open questions in the draft.
|
||||
*/
|
||||
function formatOtpToken(otp) {
|
||||
// a structured field String can only hold printable ascii. The code is a secret the recipient
|
||||
// compares against the one in the message body, so it is rejected rather than cleaned up
|
||||
if (typeof otp.code !== 'string' || !/^[\x20-\x7e]+$/.test(otp.code)) {
|
||||
throw otpError('The otp code must be a non-empty string of printable ASCII characters');
|
||||
}
|
||||
// a structured field String escapes the same two characters as a quoted-string
|
||||
return mimeFuncs.quoteString(otp.code) + '; origin=' + mimeFuncs.quoteString(getOtpOrigin(otp.origin));
|
||||
}
|
||||
/**
|
||||
* Returns the canonical ascii serialization of the origin the code is bound to. The draft
|
||||
* requires a potentially trustworthy origin, so only https is accepted, plus http on a
|
||||
* loopback host for local development
|
||||
*/
|
||||
function getOtpOrigin(origin) {
|
||||
let url;
|
||||
try {
|
||||
url = new URL(String(origin));
|
||||
}
|
||||
catch {
|
||||
// handled below
|
||||
}
|
||||
// the WHATWG parser lets characters such as a quote or a brace into a host, which the
|
||||
// origin grammar the draft requires (RFC 6454) does not allow, so a receiver would discard
|
||||
// the header. Only a DNS name, an IPv4 address or a bracketed IPv6 address is accepted.
|
||||
// Userinfo is refused as well, an origin never has it and it turns a value built as
|
||||
// 'https://example.com' + input into the origin of whatever host follows an "@"
|
||||
if (!url || url.username || url.password || !/^([a-z0-9_-]+\.)*[a-z0-9_-]+$|^\[[0-9a-f:.]+\]$/.test(url.hostname)) {
|
||||
throw otpError('The otp origin must be an absolute https URL');
|
||||
}
|
||||
const isLoopback = /^(localhost|.+\.localhost|127(\.\d+){3}|\[::1\])$/.test(url.hostname);
|
||||
if (url.protocol !== 'https:' && !(url.protocol === 'http:' && isLoopback)) {
|
||||
throw otpError('The otp origin must be an https URL, or an http URL on a loopback host');
|
||||
}
|
||||
// the URL parser already lowercases the host, converts it to punycode and drops the default port
|
||||
return url.origin;
|
||||
}
|
||||
function otpError(message) {
|
||||
const err = new Error(message);
|
||||
err.code = errors.EOTP;
|
||||
return err;
|
||||
}
|
||||
exports.default = MailComposer;
|
||||
module.exports = exports.default;
|
||||
Object.defineProperty(module.exports, 'default', { value: exports.default, enumerable: false, writable: true, configurable: true });
|
||||
+3
-2
@@ -4,7 +4,7 @@ import DKIM, { type DKIMOptions } from '../dkim/index.js';
|
||||
import MailMessage, { type MailDefaults, type SendMailOptions } from './mail-message.js';
|
||||
import net from 'node:net';
|
||||
import type { ConnectionOptions } from 'node:tls';
|
||||
import type { MailComposerAlternative, MailComposerAttachment, MailComposerIcalEvent, MailComposerListHeaderEntry, MailComposerListHeaders, MailComposerTextEncoding } from '../mail-composer/index.js';
|
||||
import type { MailComposerAlternative, MailComposerAttachment, MailComposerIcalEvent, MailComposerListHeaderEntry, MailComposerListHeaders, MailComposerOtp, MailComposerTextEncoding } from '../mail-composer/index.js';
|
||||
import type { Callback, NodemailerError, ResultCallback } from '../errors.js';
|
||||
import type { ParsedUrl } from '../shared/url.js';
|
||||
import type { MimeNodeAddress, MimeNodeEnvelope, MimeNodeEnvelopeInput, MimeNodeHeaders, MimeNodeOptions } from '../mime-node/index.js';
|
||||
@@ -227,11 +227,12 @@ declare namespace Mail {
|
||||
type Headers = MimeNodeHeaders;
|
||||
type ListHeader = MailComposerListHeaderEntry;
|
||||
type ListHeaders = MailComposerListHeaders;
|
||||
type Otp = MailComposerOtp;
|
||||
type Envelope = MimeNodeEnvelopeInput;
|
||||
type Connection = SocketOptions;
|
||||
type TextEncoding = MailComposerTextEncoding;
|
||||
type PluginFunction<T = SentMessageInfo> = MailPluginFunction<T>;
|
||||
}
|
||||
/** The same aliases as module level exports, for `import * as Mail` and `import Mail = require()` */
|
||||
export type { SendMailOptions as Options, MimeNodeAddress as Address, MailComposerAttachment as Attachment, MailComposerAlternative as AttachmentLike, MailComposerAlternative as AmpAttachment, MailComposerIcalEvent as IcalAttachment, MimeNodeHeaders as Headers, MailComposerListHeaderEntry as ListHeader, MailComposerListHeaders as ListHeaders, MimeNodeEnvelopeInput as Envelope, SocketOptions as Connection, MailComposerTextEncoding as TextEncoding };
|
||||
export type { SendMailOptions as Options, MimeNodeAddress as Address, MailComposerAttachment as Attachment, MailComposerAlternative as AttachmentLike, MailComposerAlternative as AmpAttachment, MailComposerIcalEvent as IcalAttachment, MimeNodeHeaders as Headers, MailComposerListHeaderEntry as ListHeader, MailComposerListHeaders as ListHeaders, MailComposerOtp as Otp, MimeNodeEnvelopeInput as Envelope, SocketOptions as Connection, MailComposerTextEncoding as TextEncoding };
|
||||
export default Mail;
|
||||
+18
-1
@@ -107,6 +107,22 @@ export declare function buildHeaderValue(structured: StructuredHeaderValue): str
|
||||
* @return A list of encoded keys and headers
|
||||
*/
|
||||
export declare function buildHeaderParam(key: string, data: string | Buffer, maxLength?: number): EncodedHeaderParam[];
|
||||
/**
|
||||
* Options of parseHeaderValue()
|
||||
*/
|
||||
export interface ParseHeaderValueOptions {
|
||||
/**
|
||||
* Drop the RFC 822 comments outside quoted strings, which the MIME headers allow and
|
||||
* which are not part of the value: 'boundary=b (comment)' names the boundary 'b'. A
|
||||
* parenthesis right behind the '=' of a parameter or behind a token character of its
|
||||
* value continues the token, as it does for Python and postal-mime, so 'Invoice(1).pdf'
|
||||
* keeps its name and 'boundary=(c)b' names the boundary '(c)b'. A comment that never
|
||||
* closes runs to the end of the value, unless a parameter follows it, in which case it is
|
||||
* content and the parameter survives. Comments are kept by default for the sake of the
|
||||
* callers of this exported function, not because keeping them is ever the better reading
|
||||
*/
|
||||
stripComments?: boolean | undefined;
|
||||
}
|
||||
/**
|
||||
* Parses a header value with key=value arguments into a structured
|
||||
* object.
|
||||
@@ -120,9 +136,10 @@ export declare function buildHeaderParam(key: string, data: string | Buffer, max
|
||||
* }
|
||||
*
|
||||
* @param str Header value
|
||||
* @param options Options, see ParseHeaderValueOptions
|
||||
* @return Header value as a parsed structure
|
||||
*/
|
||||
export declare function parseHeaderValue(str: string): ParsedHeaderValue;
|
||||
export declare function parseHeaderValue(str: string, options?: ParseHeaderValueOptions): ParsedHeaderValue;
|
||||
/**
|
||||
* Returns file extension for a content type string. If no suitable extensions
|
||||
* are found, 'bin' is used as the default extension
|
||||
|
||||
+43
-1
@@ -414,6 +414,26 @@ function buildHeaderParam(key, data, maxLength) {
|
||||
* goes in. Whitespace used to come off it only because the value was trimmed first.
|
||||
*/
|
||||
const TOKEN = /^[^\x00-\x20\x7f()<>@,;:\\"/[\]?=]+$/;
|
||||
/**
|
||||
* Offset of the ')' that closes the RFC 822 comment opening at `start`, or -1 when the
|
||||
* comment never closes. Comments nest, and a backslash escapes the character after it
|
||||
*/
|
||||
function _findCommentEnd(str, start) {
|
||||
let depth = 0;
|
||||
for (let i = start, len = str.length; i < len; i++) {
|
||||
const c = str.charAt(i);
|
||||
if (c === '\\') {
|
||||
i++;
|
||||
}
|
||||
else if (c === '(') {
|
||||
depth++;
|
||||
}
|
||||
else if (c === ')' && --depth === 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
* Whether a string can be a header parameter name.
|
||||
*
|
||||
@@ -440,13 +460,16 @@ function _isParamName(name) {
|
||||
* }
|
||||
*
|
||||
* @param str Header value
|
||||
* @param options Options, see ParseHeaderValueOptions
|
||||
* @return Header value as a parsed structure
|
||||
*/
|
||||
function parseHeaderValue(str) {
|
||||
function parseHeaderValue(str, options) {
|
||||
const response = {
|
||||
value: '',
|
||||
params: {}
|
||||
};
|
||||
// Cleared again by an unclosed '(', see the loop
|
||||
let stripComments = !!options?.stripComments;
|
||||
// A duplicated parameter resolves to its first occurrence, the way a duplicated header
|
||||
// does. Letting the last one win disagrees with the receivers that take the first, and
|
||||
// the two readings of 'boundary="b"; boundary="c"' name different delimiters. The
|
||||
@@ -508,6 +531,25 @@ function parseHeaderValue(str) {
|
||||
};
|
||||
for (let i = 0, len = str.length; i < len; i++) {
|
||||
chr = str.charAt(i);
|
||||
// With stripComments, an RFC 822 comment stands anywhere outside a quoted string but
|
||||
// right behind a token it would continue, see ParseHeaderValueOptions. In the value
|
||||
// of a parameter, no pending whitespace means the last significant character was the
|
||||
// '=' or a character of the token
|
||||
if (stripComments && chr === '(' && !quote && !quoteClosed && !(stage === 'value' && key !== false && !pendingSpace)) {
|
||||
let end = _findCommentEnd(str, i);
|
||||
if (end < 0 && str.indexOf(';', i) < 0) {
|
||||
// a comment that never closes runs to the end of the value, unless a
|
||||
// parameter follows it, which is content then and survives
|
||||
end = len - 1;
|
||||
}
|
||||
if (end >= 0) {
|
||||
i = end;
|
||||
continue;
|
||||
}
|
||||
// looking for a closing ')' again would scan a run of unclosed '(' to its end
|
||||
// once for each of them
|
||||
stripComments = false;
|
||||
}
|
||||
if (stage === 'key') {
|
||||
if (chr === '=') {
|
||||
key = takeValue().trim();
|
||||
|
||||
+15
-4
@@ -654,15 +654,18 @@ class MimeNode {
|
||||
return;
|
||||
}
|
||||
switch (header.key) {
|
||||
// The comments of a MIME header are not part of its value and are dropped, so a
|
||||
// caller supplied 'boundary=b (comment)' is the boundary b it names, and the
|
||||
// header goes out without the comment
|
||||
case 'Content-Disposition':
|
||||
structured = mimeFuncs.parseHeaderValue(value);
|
||||
structured = mimeFuncs.parseHeaderValue(value, { stripComments: true });
|
||||
if (this.filename) {
|
||||
structured.params.filename = this.filename;
|
||||
}
|
||||
value = mimeFuncs.buildHeaderValue(structured);
|
||||
break;
|
||||
case 'Content-Type':
|
||||
structured = mimeFuncs.parseHeaderValue(value);
|
||||
structured = mimeFuncs.parseHeaderValue(value, { stripComments: true });
|
||||
// the type token decides multipart and charset below, so clean it before
|
||||
// those run and not just on the way out, otherwise a control char makes
|
||||
// the checks miss and the header ends up claiming a type it is not set up for
|
||||
@@ -1299,7 +1302,7 @@ class MimeNode {
|
||||
.replace(/[\s\x00-\x20\x7f:]/g, '')
|
||||
.toLowerCase()
|
||||
// use uppercase words, except MIME
|
||||
.replace(/^X-SMTPAPI$|^(MIME|DKIM|ARC|BIMI)\b|^[a-z]|-(SPF|FBL|ID|MD5)$|-[a-z]/gi, c => c.toUpperCase())
|
||||
.replace(/^X-SMTPAPI$|^(MIME|DKIM|ARC|BIMI)\b|^OTP(?=-Token$)|^[a-z]|-(SPF|FBL|ID|MD5)$|-[a-z]/gi, c => c.toUpperCase())
|
||||
// special case
|
||||
.replace(/^Content-Features$/i, 'Content-features');
|
||||
return key;
|
||||
@@ -1371,7 +1374,7 @@ class MimeNode {
|
||||
// values enclosed in <>
|
||||
case 'Message-ID':
|
||||
case 'In-Reply-To':
|
||||
case 'Content-Id':
|
||||
case 'Content-ID':
|
||||
// a msg-id is structured, so an encoded word inside the angle brackets would
|
||||
// be read as literal text. drop the characters that can not appear in a header
|
||||
// at all, but leave HT alone, it separates the ids of a multi id value
|
||||
@@ -1386,6 +1389,14 @@ class MimeNode {
|
||||
value = value + '>';
|
||||
}
|
||||
return value;
|
||||
// a structured field (RFC 9651) that can not be mime encoded, an encoded word would
|
||||
// turn its quoted strings into text that no structured field parser reads. Only
|
||||
// the characters that can not appear in a header at all are removed
|
||||
case 'OTP-Token':
|
||||
return (value || '')
|
||||
.toString()
|
||||
.replace(/\r?\n|\r/g, ' ')
|
||||
.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, '');
|
||||
// space separated list of values enclosed in <>
|
||||
case 'References': {
|
||||
const ids = [];
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ export type { Mail, MailDefaults, SentMessageInfo, Transport, TransportOptions }
|
||||
export type { SendMailOptions, Transporter } from './mailer/index.js';
|
||||
export type { NodemailerError, ErrorCode } from './errors.js';
|
||||
export type { MailMessage, MailMessageData, PluginFunction, VerifyCallback } from './mailer/index.js';
|
||||
export type { MailComposerOptions, MailComposerAttachment as Attachment, MailComposerAlternative as AttachmentLike, MailComposerIcalEvent as IcalAttachment, MailComposerListHeaders as ListHeaders } from './mail-composer/index.js';
|
||||
export type { MailComposerOptions, MailComposerAttachment as Attachment, MailComposerAlternative as AttachmentLike, MailComposerIcalEvent as IcalAttachment, MailComposerListHeaders as ListHeaders, MailComposerOtp as Otp } from './mail-composer/index.js';
|
||||
export type { MimeNodeAddress as Address, MimeNodeHeaders as Headers } from './mime-node/index.js';
|
||||
export type { SMTPConnectionOptions, SMTPConnectionAuth, SMTPEnvelope, SMTPEnvelopeDsn } from './smtp-connection/index.js';
|
||||
export type { DKIMOptions } from './dkim/index.js';
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
export declare const name = "nodemailer";
|
||||
export declare const version = "10.2.0";
|
||||
export declare const version = "10.3.1";
|
||||
export declare const homepage = "https://nodemailer.com/";
|
||||
+1
-1
@@ -3,5 +3,5 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.homepage = exports.version = exports.name = void 0;
|
||||
exports.name = 'nodemailer';
|
||||
exports.version = '10.2.0';
|
||||
exports.version = '10.3.1';
|
||||
exports.homepage = 'https://nodemailer.com/';
|
||||
+7
@@ -208,6 +208,13 @@ exports.services = {
|
||||
"host": "smtp.europe.secureserver.net",
|
||||
"port": 25
|
||||
},
|
||||
"Groundmail": {
|
||||
"description": "Groundmail",
|
||||
"host": "smtp.groundmail.dev",
|
||||
"port": 587,
|
||||
"secure": false,
|
||||
"requireTLS": true
|
||||
},
|
||||
"hot.ee": {
|
||||
"description": "Hot.ee (Estonian email provider)",
|
||||
"host": "mail.hot.ee"
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ function sign(headers, hashAlgo, bodyHash, options) {
|
||||
'Content-Description:Resent-Date:Resent-From:Resent-Sender:' +
|
||||
'Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:' +
|
||||
'List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:' +
|
||||
'List-Owner:List-Archive';
|
||||
'List-Owner:List-Archive:OTP-Token';
|
||||
const fieldNames = options.headerFieldNames || defaultFieldNames;
|
||||
const canonicalizedHeaderData = relaxedHeaders(headers, fieldNames, options.skipFields);
|
||||
const dkimHeader = generateDKIMHeader(options.domainName, options.keySelector, canonicalizedHeaderData.fieldNames, hashAlgo, bodyHash);
|
||||
|
||||
+2
@@ -21,6 +21,7 @@ export declare const ERROR_CODES: {
|
||||
readonly EPROTOCOL: "Invalid SMTP server response";
|
||||
readonly EENVELOPE: "Invalid mail envelope (sender or recipients)";
|
||||
readonly EMESSAGE: "Message delivery error";
|
||||
readonly EOTP: "Invalid one-time passcode data (otp option)";
|
||||
readonly ESTREAM: "Stream processing error";
|
||||
readonly EAUTH: "Authentication failed";
|
||||
readonly ENOAUTH: "Authentication credentials not provided";
|
||||
@@ -48,6 +49,7 @@ export declare const EREQUIRETLS = "EREQUIRETLS";
|
||||
export declare const EPROTOCOL = "EPROTOCOL";
|
||||
export declare const EENVELOPE = "EENVELOPE";
|
||||
export declare const EMESSAGE = "EMESSAGE";
|
||||
export declare const EOTP = "EOTP";
|
||||
export declare const ESTREAM = "ESTREAM";
|
||||
export declare const EAUTH = "EAUTH";
|
||||
export declare const ENOAUTH = "ENOAUTH";
|
||||
|
||||
+2
@@ -24,6 +24,7 @@ export const ERROR_CODES = {
|
||||
EPROTOCOL: 'Invalid SMTP server response',
|
||||
EENVELOPE: 'Invalid mail envelope (sender or recipients)',
|
||||
EMESSAGE: 'Message delivery error',
|
||||
EOTP: 'Invalid one-time passcode data (otp option)',
|
||||
ESTREAM: 'Stream processing error',
|
||||
// Authentication errors
|
||||
EAUTH: 'Authentication failed',
|
||||
@@ -52,6 +53,7 @@ export const EREQUIRETLS = 'EREQUIRETLS';
|
||||
export const EPROTOCOL = 'EPROTOCOL';
|
||||
export const EENVELOPE = 'EENVELOPE';
|
||||
export const EMESSAGE = 'EMESSAGE';
|
||||
export const EOTP = 'EOTP';
|
||||
export const ESTREAM = 'ESTREAM';
|
||||
export const EAUTH = 'EAUTH';
|
||||
export const ENOAUTH = 'ENOAUTH';
|
||||
|
||||
+12
@@ -72,6 +72,16 @@ export type MailComposerListHeaderEntry = string | {
|
||||
export interface MailComposerListHeaders {
|
||||
[key: string]: MailComposerListHeaderEntry | (MailComposerListHeaderEntry | MailComposerListHeaderEntry[])[];
|
||||
}
|
||||
/**
|
||||
* The otp value: a one-time passcode and the origin it is bound to, sent as the OTP-Token
|
||||
* header (draft-goto-otp-token)
|
||||
*/
|
||||
export interface MailComposerOtp {
|
||||
/** The passcode, printable ascii */
|
||||
code: string;
|
||||
/** Origin the code is bound to, https or a loopback http origin. A full url is reduced to its origin */
|
||||
origin: string;
|
||||
}
|
||||
/**
|
||||
* Encoding for the non-ascii header values: quoted-printable ('Q', the default) or base64
|
||||
* ('B'). Only the first letter is read, so the short forms work as well
|
||||
@@ -114,6 +124,8 @@ export interface MailComposerOptions {
|
||||
headers?: MimeNodeHeaders | undefined;
|
||||
/** List-* headers, read by the mailer */
|
||||
list?: MailComposerListHeaders | undefined;
|
||||
/** One-time passcode for the OTP-Token header. An invalid value makes compile() throw an EOTP error */
|
||||
otp?: MailComposerOtp | undefined;
|
||||
/** SMTP envelope to use instead of the one generated from the headers */
|
||||
envelope?: MimeNodeEnvelopeInput | undefined;
|
||||
/** Content-Transfer-Encoding to force for the text/* nodes that do not set their own */
|
||||
|
||||
+53
@@ -1,6 +1,7 @@
|
||||
/* eslint no-undefined: 0 */
|
||||
import MimeNode from '../mime-node/index.js';
|
||||
import * as mimeFuncs from '../mime-funcs/index.js';
|
||||
import * as errors from '../errors.js';
|
||||
import { parseDataURI, copyOwnKeys } from '../shared/index.js';
|
||||
/**
|
||||
* Creates the object for composing a MimeNode instance out from the mail options
|
||||
@@ -95,6 +96,10 @@ class MailComposer {
|
||||
if (this.mail.headers) {
|
||||
this.message.addHeader(this.mail.headers);
|
||||
}
|
||||
// after the custom headers, so it replaces an OTP-Token from them, the field may appear only once
|
||||
if (this.mail.otp) {
|
||||
this.message.setHeader('OTP-Token', formatOtpToken(this.mail.otp));
|
||||
}
|
||||
// Add headers to the root node, always overrides custom headers
|
||||
['from', 'sender', 'to', 'cc', 'bcc', 'reply-to', 'in-reply-to', 'references', 'subject', 'message-id', 'date'].forEach(header => {
|
||||
const key = header.replace(/-(\w)/g, (o, c) => c.toUpperCase());
|
||||
@@ -603,4 +608,52 @@ class MailComposer {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the value of the OTP-Token header for the otp option. The header is defined by
|
||||
* draft-goto-otp-token-01, an Internet-Draft that expires on 25 March 2027. By then check
|
||||
* for a newer revision of the draft or a published RFC, the header name and its
|
||||
* parameters are still open questions in the draft.
|
||||
*/
|
||||
function formatOtpToken(otp) {
|
||||
// a structured field String can only hold printable ascii. The code is a secret the recipient
|
||||
// compares against the one in the message body, so it is rejected rather than cleaned up
|
||||
if (typeof otp.code !== 'string' || !/^[\x20-\x7e]+$/.test(otp.code)) {
|
||||
throw otpError('The otp code must be a non-empty string of printable ASCII characters');
|
||||
}
|
||||
// a structured field String escapes the same two characters as a quoted-string
|
||||
return mimeFuncs.quoteString(otp.code) + '; origin=' + mimeFuncs.quoteString(getOtpOrigin(otp.origin));
|
||||
}
|
||||
/**
|
||||
* Returns the canonical ascii serialization of the origin the code is bound to. The draft
|
||||
* requires a potentially trustworthy origin, so only https is accepted, plus http on a
|
||||
* loopback host for local development
|
||||
*/
|
||||
function getOtpOrigin(origin) {
|
||||
let url;
|
||||
try {
|
||||
url = new URL(String(origin));
|
||||
}
|
||||
catch {
|
||||
// handled below
|
||||
}
|
||||
// the WHATWG parser lets characters such as a quote or a brace into a host, which the
|
||||
// origin grammar the draft requires (RFC 6454) does not allow, so a receiver would discard
|
||||
// the header. Only a DNS name, an IPv4 address or a bracketed IPv6 address is accepted.
|
||||
// Userinfo is refused as well, an origin never has it and it turns a value built as
|
||||
// 'https://example.com' + input into the origin of whatever host follows an "@"
|
||||
if (!url || url.username || url.password || !/^([a-z0-9_-]+\.)*[a-z0-9_-]+$|^\[[0-9a-f:.]+\]$/.test(url.hostname)) {
|
||||
throw otpError('The otp origin must be an absolute https URL');
|
||||
}
|
||||
const isLoopback = /^(localhost|.+\.localhost|127(\.\d+){3}|\[::1\])$/.test(url.hostname);
|
||||
if (url.protocol !== 'https:' && !(url.protocol === 'http:' && isLoopback)) {
|
||||
throw otpError('The otp origin must be an https URL, or an http URL on a loopback host');
|
||||
}
|
||||
// the URL parser already lowercases the host, converts it to punycode and drops the default port
|
||||
return url.origin;
|
||||
}
|
||||
function otpError(message) {
|
||||
const err = new Error(message);
|
||||
err.code = errors.EOTP;
|
||||
return err;
|
||||
}
|
||||
export default MailComposer;
|
||||
+3
-2
@@ -4,7 +4,7 @@ import DKIM, { type DKIMOptions } from '../dkim/index.js';
|
||||
import MailMessage, { type MailDefaults, type SendMailOptions } from './mail-message.js';
|
||||
import net from 'node:net';
|
||||
import type { ConnectionOptions } from 'node:tls';
|
||||
import type { MailComposerAlternative, MailComposerAttachment, MailComposerIcalEvent, MailComposerListHeaderEntry, MailComposerListHeaders, MailComposerTextEncoding } from '../mail-composer/index.js';
|
||||
import type { MailComposerAlternative, MailComposerAttachment, MailComposerIcalEvent, MailComposerListHeaderEntry, MailComposerListHeaders, MailComposerOtp, MailComposerTextEncoding } from '../mail-composer/index.js';
|
||||
import type { Callback, NodemailerError, ResultCallback } from '../errors.js';
|
||||
import type { ParsedUrl } from '../shared/url.js';
|
||||
import type { MimeNodeAddress, MimeNodeEnvelope, MimeNodeEnvelopeInput, MimeNodeHeaders, MimeNodeOptions } from '../mime-node/index.js';
|
||||
@@ -227,11 +227,12 @@ declare namespace Mail {
|
||||
type Headers = MimeNodeHeaders;
|
||||
type ListHeader = MailComposerListHeaderEntry;
|
||||
type ListHeaders = MailComposerListHeaders;
|
||||
type Otp = MailComposerOtp;
|
||||
type Envelope = MimeNodeEnvelopeInput;
|
||||
type Connection = SocketOptions;
|
||||
type TextEncoding = MailComposerTextEncoding;
|
||||
type PluginFunction<T = SentMessageInfo> = MailPluginFunction<T>;
|
||||
}
|
||||
/** The same aliases as module level exports, for `import * as Mail` and `import Mail = require()` */
|
||||
export type { SendMailOptions as Options, MimeNodeAddress as Address, MailComposerAttachment as Attachment, MailComposerAlternative as AttachmentLike, MailComposerAlternative as AmpAttachment, MailComposerIcalEvent as IcalAttachment, MimeNodeHeaders as Headers, MailComposerListHeaderEntry as ListHeader, MailComposerListHeaders as ListHeaders, MimeNodeEnvelopeInput as Envelope, SocketOptions as Connection, MailComposerTextEncoding as TextEncoding };
|
||||
export type { SendMailOptions as Options, MimeNodeAddress as Address, MailComposerAttachment as Attachment, MailComposerAlternative as AttachmentLike, MailComposerAlternative as AmpAttachment, MailComposerIcalEvent as IcalAttachment, MimeNodeHeaders as Headers, MailComposerListHeaderEntry as ListHeader, MailComposerListHeaders as ListHeaders, MailComposerOtp as Otp, MimeNodeEnvelopeInput as Envelope, SocketOptions as Connection, MailComposerTextEncoding as TextEncoding };
|
||||
export default Mail;
|
||||
+18
-1
@@ -107,6 +107,22 @@ export declare function buildHeaderValue(structured: StructuredHeaderValue): str
|
||||
* @return A list of encoded keys and headers
|
||||
*/
|
||||
export declare function buildHeaderParam(key: string, data: string | Buffer, maxLength?: number): EncodedHeaderParam[];
|
||||
/**
|
||||
* Options of parseHeaderValue()
|
||||
*/
|
||||
export interface ParseHeaderValueOptions {
|
||||
/**
|
||||
* Drop the RFC 822 comments outside quoted strings, which the MIME headers allow and
|
||||
* which are not part of the value: 'boundary=b (comment)' names the boundary 'b'. A
|
||||
* parenthesis right behind the '=' of a parameter or behind a token character of its
|
||||
* value continues the token, as it does for Python and postal-mime, so 'Invoice(1).pdf'
|
||||
* keeps its name and 'boundary=(c)b' names the boundary '(c)b'. A comment that never
|
||||
* closes runs to the end of the value, unless a parameter follows it, in which case it is
|
||||
* content and the parameter survives. Comments are kept by default for the sake of the
|
||||
* callers of this exported function, not because keeping them is ever the better reading
|
||||
*/
|
||||
stripComments?: boolean | undefined;
|
||||
}
|
||||
/**
|
||||
* Parses a header value with key=value arguments into a structured
|
||||
* object.
|
||||
@@ -120,9 +136,10 @@ export declare function buildHeaderParam(key: string, data: string | Buffer, max
|
||||
* }
|
||||
*
|
||||
* @param str Header value
|
||||
* @param options Options, see ParseHeaderValueOptions
|
||||
* @return Header value as a parsed structure
|
||||
*/
|
||||
export declare function parseHeaderValue(str: string): ParsedHeaderValue;
|
||||
export declare function parseHeaderValue(str: string, options?: ParseHeaderValueOptions): ParsedHeaderValue;
|
||||
/**
|
||||
* Returns file extension for a content type string. If no suitable extensions
|
||||
* are found, 'bin' is used as the default extension
|
||||
|
||||
+43
-1
@@ -365,6 +365,26 @@ export function buildHeaderParam(key, data, maxLength) {
|
||||
* goes in. Whitespace used to come off it only because the value was trimmed first.
|
||||
*/
|
||||
const TOKEN = /^[^\x00-\x20\x7f()<>@,;:\\"/[\]?=]+$/;
|
||||
/**
|
||||
* Offset of the ')' that closes the RFC 822 comment opening at `start`, or -1 when the
|
||||
* comment never closes. Comments nest, and a backslash escapes the character after it
|
||||
*/
|
||||
function _findCommentEnd(str, start) {
|
||||
let depth = 0;
|
||||
for (let i = start, len = str.length; i < len; i++) {
|
||||
const c = str.charAt(i);
|
||||
if (c === '\\') {
|
||||
i++;
|
||||
}
|
||||
else if (c === '(') {
|
||||
depth++;
|
||||
}
|
||||
else if (c === ')' && --depth === 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
* Whether a string can be a header parameter name.
|
||||
*
|
||||
@@ -391,13 +411,16 @@ function _isParamName(name) {
|
||||
* }
|
||||
*
|
||||
* @param str Header value
|
||||
* @param options Options, see ParseHeaderValueOptions
|
||||
* @return Header value as a parsed structure
|
||||
*/
|
||||
export function parseHeaderValue(str) {
|
||||
export function parseHeaderValue(str, options) {
|
||||
const response = {
|
||||
value: '',
|
||||
params: {}
|
||||
};
|
||||
// Cleared again by an unclosed '(', see the loop
|
||||
let stripComments = !!options?.stripComments;
|
||||
// A duplicated parameter resolves to its first occurrence, the way a duplicated header
|
||||
// does. Letting the last one win disagrees with the receivers that take the first, and
|
||||
// the two readings of 'boundary="b"; boundary="c"' name different delimiters. The
|
||||
@@ -459,6 +482,25 @@ export function parseHeaderValue(str) {
|
||||
};
|
||||
for (let i = 0, len = str.length; i < len; i++) {
|
||||
chr = str.charAt(i);
|
||||
// With stripComments, an RFC 822 comment stands anywhere outside a quoted string but
|
||||
// right behind a token it would continue, see ParseHeaderValueOptions. In the value
|
||||
// of a parameter, no pending whitespace means the last significant character was the
|
||||
// '=' or a character of the token
|
||||
if (stripComments && chr === '(' && !quote && !quoteClosed && !(stage === 'value' && key !== false && !pendingSpace)) {
|
||||
let end = _findCommentEnd(str, i);
|
||||
if (end < 0 && str.indexOf(';', i) < 0) {
|
||||
// a comment that never closes runs to the end of the value, unless a
|
||||
// parameter follows it, which is content then and survives
|
||||
end = len - 1;
|
||||
}
|
||||
if (end >= 0) {
|
||||
i = end;
|
||||
continue;
|
||||
}
|
||||
// looking for a closing ')' again would scan a run of unclosed '(' to its end
|
||||
// once for each of them
|
||||
stripComments = false;
|
||||
}
|
||||
if (stage === 'key') {
|
||||
if (chr === '=') {
|
||||
key = takeValue().trim();
|
||||
|
||||
+15
-4
@@ -616,15 +616,18 @@ class MimeNode {
|
||||
return;
|
||||
}
|
||||
switch (header.key) {
|
||||
// The comments of a MIME header are not part of its value and are dropped, so a
|
||||
// caller supplied 'boundary=b (comment)' is the boundary b it names, and the
|
||||
// header goes out without the comment
|
||||
case 'Content-Disposition':
|
||||
structured = mimeFuncs.parseHeaderValue(value);
|
||||
structured = mimeFuncs.parseHeaderValue(value, { stripComments: true });
|
||||
if (this.filename) {
|
||||
structured.params.filename = this.filename;
|
||||
}
|
||||
value = mimeFuncs.buildHeaderValue(structured);
|
||||
break;
|
||||
case 'Content-Type':
|
||||
structured = mimeFuncs.parseHeaderValue(value);
|
||||
structured = mimeFuncs.parseHeaderValue(value, { stripComments: true });
|
||||
// the type token decides multipart and charset below, so clean it before
|
||||
// those run and not just on the way out, otherwise a control char makes
|
||||
// the checks miss and the header ends up claiming a type it is not set up for
|
||||
@@ -1261,7 +1264,7 @@ class MimeNode {
|
||||
.replace(/[\s\x00-\x20\x7f:]/g, '')
|
||||
.toLowerCase()
|
||||
// use uppercase words, except MIME
|
||||
.replace(/^X-SMTPAPI$|^(MIME|DKIM|ARC|BIMI)\b|^[a-z]|-(SPF|FBL|ID|MD5)$|-[a-z]/gi, c => c.toUpperCase())
|
||||
.replace(/^X-SMTPAPI$|^(MIME|DKIM|ARC|BIMI)\b|^OTP(?=-Token$)|^[a-z]|-(SPF|FBL|ID|MD5)$|-[a-z]/gi, c => c.toUpperCase())
|
||||
// special case
|
||||
.replace(/^Content-Features$/i, 'Content-features');
|
||||
return key;
|
||||
@@ -1333,7 +1336,7 @@ class MimeNode {
|
||||
// values enclosed in <>
|
||||
case 'Message-ID':
|
||||
case 'In-Reply-To':
|
||||
case 'Content-Id':
|
||||
case 'Content-ID':
|
||||
// a msg-id is structured, so an encoded word inside the angle brackets would
|
||||
// be read as literal text. drop the characters that can not appear in a header
|
||||
// at all, but leave HT alone, it separates the ids of a multi id value
|
||||
@@ -1348,6 +1351,14 @@ class MimeNode {
|
||||
value = value + '>';
|
||||
}
|
||||
return value;
|
||||
// a structured field (RFC 9651) that can not be mime encoded, an encoded word would
|
||||
// turn its quoted strings into text that no structured field parser reads. Only
|
||||
// the characters that can not appear in a header at all are removed
|
||||
case 'OTP-Token':
|
||||
return (value || '')
|
||||
.toString()
|
||||
.replace(/\r?\n|\r/g, ' ')
|
||||
.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, '');
|
||||
// space separated list of values enclosed in <>
|
||||
case 'References': {
|
||||
const ids = [];
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ export type { Mail, MailDefaults, SentMessageInfo, Transport, TransportOptions }
|
||||
export type { SendMailOptions, Transporter } from './mailer/index.js';
|
||||
export type { NodemailerError, ErrorCode } from './errors.js';
|
||||
export type { MailMessage, MailMessageData, PluginFunction, VerifyCallback } from './mailer/index.js';
|
||||
export type { MailComposerOptions, MailComposerAttachment as Attachment, MailComposerAlternative as AttachmentLike, MailComposerIcalEvent as IcalAttachment, MailComposerListHeaders as ListHeaders } from './mail-composer/index.js';
|
||||
export type { MailComposerOptions, MailComposerAttachment as Attachment, MailComposerAlternative as AttachmentLike, MailComposerIcalEvent as IcalAttachment, MailComposerListHeaders as ListHeaders, MailComposerOtp as Otp } from './mail-composer/index.js';
|
||||
export type { MimeNodeAddress as Address, MimeNodeHeaders as Headers } from './mime-node/index.js';
|
||||
export type { SMTPConnectionOptions, SMTPConnectionAuth, SMTPEnvelope, SMTPEnvelopeDsn } from './smtp-connection/index.js';
|
||||
export type { DKIMOptions } from './dkim/index.js';
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
export declare const name = "nodemailer";
|
||||
export declare const version = "10.2.0";
|
||||
export declare const version = "10.3.1";
|
||||
export declare const homepage = "https://nodemailer.com/";
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Generated by scripts/build.js from package.json. Do not edit by hand.
|
||||
export const name = 'nodemailer';
|
||||
export const version = '10.2.0';
|
||||
export const version = '10.3.1';
|
||||
export const homepage = 'https://nodemailer.com/';
|
||||
+7
@@ -205,6 +205,13 @@ export const services = {
|
||||
"host": "smtp.europe.secureserver.net",
|
||||
"port": 25
|
||||
},
|
||||
"Groundmail": {
|
||||
"description": "Groundmail",
|
||||
"host": "smtp.groundmail.dev",
|
||||
"port": 587,
|
||||
"secure": false,
|
||||
"requireTLS": true
|
||||
},
|
||||
"hot.ee": {
|
||||
"description": "Hot.ee (Estonian email provider)",
|
||||
"host": "mail.hot.ee"
|
||||
|
||||
+8
@@ -180,6 +180,14 @@
|
||||
"port": 25
|
||||
},
|
||||
|
||||
"Groundmail": {
|
||||
"description": "Groundmail",
|
||||
"host": "smtp.groundmail.dev",
|
||||
"port": 587,
|
||||
"secure": false,
|
||||
"requireTLS": true
|
||||
},
|
||||
|
||||
"hot.ee": {
|
||||
"description": "Hot.ee (Estonian email provider)",
|
||||
"host": "mail.hot.ee"
|
||||
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nodemailer",
|
||||
"version": "10.2.0",
|
||||
"version": "10.3.1",
|
||||
"description": "Easy as cake e-mail sending from your Node.js applications",
|
||||
"type": "module",
|
||||
"main": "./dist/cjs/nodemailer.js",
|
||||
@@ -153,24 +153,24 @@
|
||||
},
|
||||
"homepage": "https://nodemailer.com/",
|
||||
"devDependencies": {
|
||||
"@aws-sdk/client-sesv2": "3.1151.0",
|
||||
"@aws-sdk/client-sesv2": "3.1159.0",
|
||||
"@types/node": "20.19.43",
|
||||
"bunyan": "1.8.15",
|
||||
"c8": "12.0.0",
|
||||
"eslint": "10.13.0",
|
||||
"eslint-config-prettier": "10.1.8",
|
||||
"globals": "17.13.0",
|
||||
"libbase64": "1.3.2",
|
||||
"libmime": "5.4.7",
|
||||
"libqp": "2.1.2",
|
||||
"mailauth": "7.3.0",
|
||||
"libbase64": "1.4.1",
|
||||
"libmime": "5.6.3",
|
||||
"libqp": "3.0.1",
|
||||
"mailauth": "8.0.4",
|
||||
"prettier": "3.9.10",
|
||||
"proxy": "1.0.2",
|
||||
"proxy-test-server": "1.0.0",
|
||||
"smtp-server": "3.19.21",
|
||||
"smtp-server": "3.21.2",
|
||||
"tsx": "4.23.15",
|
||||
"typescript": "6.0.3",
|
||||
"typescript-eslint": "8.71.2"
|
||||
"typescript-eslint": "8.72.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
|
||||
+2
@@ -29,6 +29,8 @@ Returns: `Client`
|
||||
* **webSocket** `WebSocketOptions` (optional) - WebSocket-specific configuration options.
|
||||
* **maxFragments** `number` (optional) - Default: `131072` - Maximum number of fragments in a message. Set to 0 to disable the limit.
|
||||
* **maxPayloadSize** `number` (optional) - Default: `134217728` (128 MB) - Maximum allowed payload size in bytes for WebSocket messages. Applied to uncompressed messages, compressed frame payloads, and decompressed (permessage-deflate) messages. Set to 0 to disable the limit.
|
||||
* **eventSource** `EventSourceOptions` (optional) - EventSource-specific configuration options.
|
||||
* **maxEventSize** `number` (optional) - The maximum total bytes of data and metadata field values retained for a pending EventSource event. Each unfinished line is separately limited to this value plus seven syntax bytes. The number of `data:` lines per event and input chunks buffered for an unfinished line are each limited to `min(131072, max(1024, floor(maxEventSize / 128)))` to bound object overhead. Set to `0` to disable these limits. Default: `buffer.kStringMaxLength`.
|
||||
* **pipelining** `number | null` (optional) - Default: `1` - The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Carefully consider your workload and environment before enabling concurrent requests as pipelining may reduce performance if used incorrectly. Pipelining is sensitive to network stack settings as well as head of line blocking caused by e.g. long running requests. Set to `0` to disable keep-alive connections.
|
||||
* **connect** `ConnectOptions | Function | null` (optional) - Default: `null`.
|
||||
* **strictContentLength** `Boolean` (optional) - Default: `true` - Whether to treat request content length mismatches as errors. If true, an error is thrown when the request content-length header doesn't match the length of the request body.
|
||||
|
||||
+6
-2
@@ -23,7 +23,7 @@ function defaultFactory (origin, opts) {
|
||||
}
|
||||
|
||||
class Agent extends DispatcherBase {
|
||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, tls, ...options } = {}) {
|
||||
if (typeof factory !== 'function') {
|
||||
throw new InvalidArgumentError('factory must be a function.')
|
||||
}
|
||||
@@ -42,11 +42,15 @@ class Agent extends DispatcherBase {
|
||||
connect = { ...connect }
|
||||
}
|
||||
|
||||
if (tls && typeof tls !== 'function') {
|
||||
tls = { ...tls }
|
||||
}
|
||||
|
||||
this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent)
|
||||
? options.interceptors.Agent
|
||||
: [createRedirectInterceptor({ maxRedirections })]
|
||||
|
||||
this[kOptions] = { ...util.deepClone(options), connect }
|
||||
this[kOptions] = { ...util.deepClone(options), connect, tls }
|
||||
this[kOptions].interceptors = options.interceptors
|
||||
? { ...options.interceptors }
|
||||
: undefined
|
||||
|
||||
-2
@@ -727,8 +727,6 @@ async function connectH1 (client, socket) {
|
||||
socket[kParser] = new Parser(client, socket, llhttpInstance)
|
||||
|
||||
addListener(socket, 'error', function (err) {
|
||||
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
||||
|
||||
const parser = this[kParser]
|
||||
|
||||
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
||||
|
||||
-4
@@ -136,8 +136,6 @@ async function connectH2 (client, socket) {
|
||||
socket[kHTTP2Session] = session
|
||||
|
||||
util.addListener(socket, 'error', function (err) {
|
||||
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
||||
|
||||
this[kError] = err
|
||||
|
||||
this[kClient][kOnError](err)
|
||||
@@ -211,8 +209,6 @@ function resumeH2 (client) {
|
||||
}
|
||||
|
||||
function onHttp2SessionError (err) {
|
||||
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
||||
|
||||
this[kSocket][kError] = err
|
||||
this[kClient][kOnError](err)
|
||||
}
|
||||
|
||||
+3
-2
@@ -107,9 +107,10 @@ class Client extends DispatcherBase {
|
||||
// h2
|
||||
maxConcurrentStreams,
|
||||
allowH2,
|
||||
webSocket
|
||||
webSocket,
|
||||
eventSource
|
||||
} = {}) {
|
||||
super({ webSocket })
|
||||
super({ webSocket, eventSource })
|
||||
|
||||
if (keepAlive !== undefined) {
|
||||
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
|
||||
|
||||
+9
@@ -1,5 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const buffer = require('node:buffer')
|
||||
const Dispatcher = require('./dispatcher')
|
||||
const {
|
||||
ClientDestroyedError,
|
||||
@@ -12,6 +13,7 @@ const kOnDestroyed = Symbol('onDestroyed')
|
||||
const kOnClosed = Symbol('onClosed')
|
||||
const kInterceptedDispatch = Symbol('Intercepted Dispatch')
|
||||
const kWebSocketOptions = Symbol('webSocketOptions')
|
||||
const kEventSourceOptions = Symbol('eventSourceOptions')
|
||||
|
||||
class DispatcherBase extends Dispatcher {
|
||||
constructor (opts) {
|
||||
@@ -22,6 +24,7 @@ class DispatcherBase extends Dispatcher {
|
||||
this[kClosed] = false
|
||||
this[kOnClosed] = []
|
||||
this[kWebSocketOptions] = opts?.webSocket ?? {}
|
||||
this[kEventSourceOptions] = opts?.eventSource ?? {}
|
||||
}
|
||||
|
||||
get webSocketOptions () {
|
||||
@@ -31,6 +34,12 @@ class DispatcherBase extends Dispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
get eventSourceOptions () {
|
||||
return {
|
||||
maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
|
||||
}
|
||||
}
|
||||
|
||||
get destroyed () {
|
||||
return this[kDestroyed]
|
||||
}
|
||||
|
||||
+91
-10
@@ -1,4 +1,5 @@
|
||||
'use strict'
|
||||
const buffer = require('node:buffer')
|
||||
const { Transform } = require('node:stream')
|
||||
const { isASCIINumber, isValidLastEventId } = require('./util')
|
||||
|
||||
@@ -23,11 +24,19 @@ const COLON = 0x3A
|
||||
*/
|
||||
const SPACE = 0x20
|
||||
|
||||
const defaultMaxEventSize = buffer.kStringMaxLength
|
||||
|
||||
const DATA = Buffer.from('data')
|
||||
const EVENT = Buffer.from('event')
|
||||
const ID = Buffer.from('id')
|
||||
const RETRY = Buffer.from('retry')
|
||||
|
||||
// Each data field creates a string node, and each unconsumed input chunk keeps
|
||||
// a Buffer wrapper. The absolute ceiling protects the large default byte limit.
|
||||
const minParserItems = 1024
|
||||
const maxParserItems = 131072
|
||||
const bytesPerParserItem = 128
|
||||
|
||||
function isASCIINumberBytes (buffer, start) {
|
||||
if (start >= buffer.length) {
|
||||
return false
|
||||
@@ -66,6 +75,12 @@ function isFieldName (line, length, field) {
|
||||
return true
|
||||
}
|
||||
|
||||
function createMaxEventSizeExceededError () {
|
||||
const error = new Error('EventSource message size exceeded')
|
||||
error.aborted = false
|
||||
return error
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} EventSourceStreamEvent
|
||||
* @type {object}
|
||||
@@ -114,6 +129,13 @@ class EventSourceStream extends Transform {
|
||||
pos = 0
|
||||
lineChunkIndex = 0
|
||||
linePos = 0
|
||||
lineLength = 0
|
||||
eventSize = 0
|
||||
eventFieldSizes = { data: 0, event: 0, id: 0, retry: 0 }
|
||||
dataLineCount = 0
|
||||
maxEventSize
|
||||
maxDataLines
|
||||
maxBufferedChunks
|
||||
|
||||
event = {
|
||||
data: undefined,
|
||||
@@ -124,6 +146,7 @@ class EventSourceStream extends Transform {
|
||||
|
||||
/**
|
||||
* @param {object} options
|
||||
* @param {number} [options.maxEventSize]
|
||||
* @param {eventSourceSettings} options.eventSourceSettings
|
||||
* @param {Function} [options.push]
|
||||
*/
|
||||
@@ -135,6 +158,12 @@ class EventSourceStream extends Transform {
|
||||
super(options)
|
||||
|
||||
this.state = options.eventSourceSettings || {}
|
||||
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize
|
||||
const parserItemLimit = this.maxEventSize > 0
|
||||
? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem)))
|
||||
: 0
|
||||
this.maxDataLines = parserItemLimit
|
||||
this.maxBufferedChunks = parserItemLimit
|
||||
if (options.push) {
|
||||
this.push = options.push
|
||||
}
|
||||
@@ -152,6 +181,14 @@ class EventSourceStream extends Transform {
|
||||
return
|
||||
}
|
||||
|
||||
// A leading line ending can immediately release the currently buffered
|
||||
// line, even when it uses the final allowed chunk slot.
|
||||
if (this.maxEventSize > 0 &&
|
||||
this.chunks.length >= this.maxBufferedChunks &&
|
||||
chunk[0] !== LF && chunk[0] !== CR) {
|
||||
callback(createMaxEventSizeExceededError())
|
||||
return
|
||||
}
|
||||
this.chunks.push(chunk)
|
||||
|
||||
// Strip leading byte-order-mark if we opened the stream and started
|
||||
@@ -230,7 +267,12 @@ class EventSourceStream extends Transform {
|
||||
|
||||
// In any case, we can process the line as we reached an
|
||||
// end-of-line character
|
||||
this.parseLine(this.readLine(), this.event)
|
||||
try {
|
||||
this.parseLine(this.readLine(), this.event)
|
||||
} catch (error) {
|
||||
callback(error)
|
||||
return
|
||||
}
|
||||
this.consumeCurrentByte()
|
||||
// A line was processed and this could be the end of the event. We need
|
||||
// to check if the next line is empty to determine if the event is
|
||||
@@ -239,15 +281,28 @@ class EventSourceStream extends Transform {
|
||||
continue
|
||||
}
|
||||
|
||||
// readLine() is only called after CR or LF. Reject an unfinished line
|
||||
// before it can retain an unbounded number of decoded chunks. The seven
|
||||
// extra bytes allow the longest field prefix ("event: " or "retry: ").
|
||||
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
|
||||
callback(createMaxEventSizeExceededError())
|
||||
return
|
||||
}
|
||||
this.advanceCursor()
|
||||
}
|
||||
|
||||
callback()
|
||||
}
|
||||
|
||||
_destroy (error, callback) {
|
||||
this.chunks.length = 0
|
||||
this.clearEvent()
|
||||
super._destroy(error, callback)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Buffer} line
|
||||
* @param {EventStreamEvent} event
|
||||
* @param {EventSourceStreamEvent} event
|
||||
*/
|
||||
parseLine (line, event) {
|
||||
// If the line is empty (a blank line)
|
||||
@@ -281,6 +336,13 @@ class EventSourceStream extends Transform {
|
||||
}
|
||||
|
||||
if (isFieldName(line, fieldLength, DATA)) {
|
||||
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
|
||||
throw createMaxEventSizeExceededError()
|
||||
}
|
||||
const valueBytes = line.length - valueStart
|
||||
const dataSize = this.eventFieldSizes.data + (event.data === undefined ? 0 : 1) + valueBytes
|
||||
this.setEventFieldSize('data', dataSize)
|
||||
|
||||
const value = line.toString('utf8', valueStart)
|
||||
|
||||
if (event.data === undefined) {
|
||||
@@ -288,11 +350,13 @@ class EventSourceStream extends Transform {
|
||||
} else {
|
||||
event.data += `\n${value}`
|
||||
}
|
||||
this.dataLineCount++
|
||||
return
|
||||
}
|
||||
|
||||
if (isFieldName(line, fieldLength, RETRY)) {
|
||||
if (isASCIINumberBytes(line, valueStart)) {
|
||||
this.setEventFieldSize('retry', line.length - valueStart)
|
||||
event.retry = line.toString('utf8', valueStart)
|
||||
}
|
||||
return
|
||||
@@ -300,20 +364,29 @@ class EventSourceStream extends Transform {
|
||||
|
||||
if (isFieldName(line, fieldLength, ID)) {
|
||||
if (isValidLastEventIdBytes(line, valueStart)) {
|
||||
this.setEventFieldSize('id', line.length - valueStart)
|
||||
event.id = line.toString('utf8', valueStart)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (isFieldName(line, fieldLength, EVENT)) {
|
||||
const value = line.toString('utf8', valueStart)
|
||||
|
||||
if (value.length > 0) {
|
||||
event.event = value
|
||||
if (valueStart < line.length) {
|
||||
this.setEventFieldSize('event', line.length - valueStart)
|
||||
event.event = line.toString('utf8', valueStart)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setEventFieldSize (field, size) {
|
||||
const eventSize = this.eventSize - this.eventFieldSizes[field] + size
|
||||
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) {
|
||||
throw createMaxEventSizeExceededError()
|
||||
}
|
||||
this.eventSize = eventSize
|
||||
this.eventFieldSizes[field] = size
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {EventSourceStreamEvent} event
|
||||
*/
|
||||
@@ -344,6 +417,12 @@ class EventSourceStream extends Transform {
|
||||
this.event.event = undefined
|
||||
this.event.id = undefined
|
||||
this.event.retry = undefined
|
||||
this.eventSize = 0
|
||||
this.dataLineCount = 0
|
||||
this.eventFieldSizes.data = 0
|
||||
this.eventFieldSizes.event = 0
|
||||
this.eventFieldSizes.id = 0
|
||||
this.eventFieldSizes.retry = 0
|
||||
}
|
||||
|
||||
hasPendingEvent () {
|
||||
@@ -379,14 +458,16 @@ class EventSourceStream extends Transform {
|
||||
syncLineStartToCursor () {
|
||||
this.lineChunkIndex = this.chunkIndex
|
||||
this.linePos = this.pos
|
||||
this.lineLength = 0
|
||||
this.dropConsumedChunks()
|
||||
}
|
||||
|
||||
dropConsumedChunks () {
|
||||
while (this.lineChunkIndex > 0) {
|
||||
this.chunks.shift()
|
||||
this.lineChunkIndex--
|
||||
this.chunkIndex--
|
||||
if (this.lineChunkIndex > 0) {
|
||||
const consumed = this.lineChunkIndex
|
||||
this.chunks.splice(0, consumed)
|
||||
this.lineChunkIndex = 0
|
||||
this.chunkIndex -= consumed
|
||||
}
|
||||
|
||||
if (this.chunkIndex === this.chunks.length) {
|
||||
|
||||
+4
-1
@@ -11,6 +11,7 @@ const { isNetworkError } = require('../fetch/response')
|
||||
const { delay } = require('./util')
|
||||
const { kEnumerableProperty } = require('../../core/util')
|
||||
const { environmentSettingsObject } = require('../fetch/util')
|
||||
const { getGlobalDispatcher } = require('../../global')
|
||||
|
||||
let experimentalWarned = false
|
||||
|
||||
@@ -292,6 +293,7 @@ class EventSource extends EventTarget {
|
||||
|
||||
const eventSourceStream = new EventSourceStream({
|
||||
eventSourceSettings: this.#state,
|
||||
maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
|
||||
push: (event) => {
|
||||
this.dispatchEvent(createFastMessageEvent(
|
||||
event.type,
|
||||
@@ -470,7 +472,8 @@ webidl.converters.EventSourceInitDict = webidl.dictionaryConverter([
|
||||
},
|
||||
{
|
||||
key: 'dispatcher', // undici only
|
||||
converter: webidl.converters.any
|
||||
converter: webidl.converters.any,
|
||||
defaultValue: () => getGlobalDispatcher()
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
+7
-9
@@ -1950,8 +1950,10 @@ async function httpNetworkFetch (
|
||||
// 19. Run these steps in parallel:
|
||||
|
||||
// 1. Run these steps, but abort when fetchParams is canceled:
|
||||
fetchParams.controller.onAborted = onAborted
|
||||
fetchParams.controller.on('terminated', onAborted)
|
||||
if (!fetchParams.controller.resume) {
|
||||
fetchParams.controller.on('terminated', onAborted)
|
||||
}
|
||||
|
||||
fetchParams.controller.resume = async () => {
|
||||
// 1. While true
|
||||
while (true) {
|
||||
@@ -2120,8 +2122,6 @@ async function httpNetworkFetch (
|
||||
}
|
||||
location = headersList.get('location', true)
|
||||
|
||||
this.body = new Readable({ read: resume })
|
||||
|
||||
const decoders = []
|
||||
|
||||
const willFollow = location && request.redirect === 'follow' &&
|
||||
@@ -2139,7 +2139,7 @@ async function httpNetworkFetch (
|
||||
// CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
|
||||
const maxContentEncodings = 5
|
||||
if (codings.length > maxContentEncodings) {
|
||||
reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
|
||||
this.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -2172,6 +2172,8 @@ async function httpNetworkFetch (
|
||||
}
|
||||
}
|
||||
|
||||
this.body = new Readable({ read: resume })
|
||||
|
||||
const onError = this.onError.bind(this)
|
||||
|
||||
resolve({
|
||||
@@ -2218,10 +2220,6 @@ async function httpNetworkFetch (
|
||||
fetchParams.controller.off('terminated', this.abort)
|
||||
}
|
||||
|
||||
if (fetchParams.controller.onAborted) {
|
||||
fetchParams.controller.off('terminated', fetchParams.controller.onAborted)
|
||||
}
|
||||
|
||||
fetchParams.controller.ended = true
|
||||
|
||||
this.body.push(null)
|
||||
|
||||
+14
@@ -249,6 +249,20 @@ class ByteParser extends Writable {
|
||||
if (isControlFrame(this.#info.opcode)) {
|
||||
this.#loop = this.parseControlFrame(body)
|
||||
this.#state = parserStates.INFO
|
||||
|
||||
// If the automatic PONG/CLOSE reply filled the socket's write buffer,
|
||||
// stop parsing and resume on drain so a PING flood cannot grow the
|
||||
// outbound queue without bound.
|
||||
const socket = this.ws[kResponse].socket
|
||||
if (this.#loop && socket.writableNeedDrain) {
|
||||
this.#loop = false
|
||||
socket.once('drain', () => {
|
||||
if (this.destroyed) return
|
||||
this.#loop = true
|
||||
this.run(callback)
|
||||
})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (!this.#info.compressed) {
|
||||
if (!this.writeFragments(body)) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "undici",
|
||||
"version": "6.29.0",
|
||||
"version": "6.29.1",
|
||||
"description": "An HTTP/1.1 client, written from scratch for Node.js",
|
||||
"homepage": "https://undici.nodejs.org",
|
||||
"bugs": {
|
||||
|
||||
+14
@@ -80,6 +80,8 @@ export declare namespace Client {
|
||||
maxResponseSize?: number;
|
||||
/** WebSocket-specific options */
|
||||
webSocket?: Client.WebSocketOptions;
|
||||
/** EventSource-specific options */
|
||||
eventSource?: Client.EventSourceOptions;
|
||||
/** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
|
||||
autoSelectFamily?: boolean;
|
||||
/** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
|
||||
@@ -120,6 +122,18 @@ export declare namespace Client {
|
||||
*/
|
||||
maxPayloadSize?: number;
|
||||
}
|
||||
export interface EventSourceOptions {
|
||||
/**
|
||||
* Maximum total bytes of data and metadata field values retained for a
|
||||
* pending EventSource event. Each unfinished line is separately bounded
|
||||
* to this value plus seven syntax bytes. The number of data lines per
|
||||
* event and buffered input chunks are each limited to
|
||||
* min(131072, max(1024, floor(maxEventSize / 128))).
|
||||
* Set to 0 to disable these limits.
|
||||
* @default buffer.kStringMaxLength
|
||||
*/
|
||||
maxEventSize?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export default Client;
|
||||
Generated
+6
-6
@@ -103,9 +103,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "10.2.0",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.2.0.tgz",
|
||||
"integrity": "sha512-/XyGw6kX2stMdKGUJdAQmYAeY1FscWfdRydfd2NtK3A3KDfUUXCqZzExSNAt2xhh90X2qLCR+o2Gd48YPJcJwA==",
|
||||
"version": "10.3.1",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.3.1.tgz",
|
||||
"integrity": "sha512-uF0AFsJC07Y1vdW7p580DKAnh7rAO+4UPSSB3mDCPNDufoiaOebV6JmrzpxB14OjEEEiBsNdYoM2Y+fN8M7BBA==",
|
||||
"license": "MIT-0",
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
@@ -137,9 +137,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "6.29.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.0.tgz",
|
||||
"integrity": "sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg==",
|
||||
"version": "6.29.1",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz",
|
||||
"integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.17"
|
||||
|
||||
Reference in new issue
Block a user