mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-05-06 17:30:35 +07:00
node_modules: update (#290)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
29
node_modules/nodemailer/lib/nodemailer.js
generated
vendored
29
node_modules/nodemailer/lib/nodemailer.js
generated
vendored
@@ -20,9 +20,7 @@ const ETHEREAL_CACHE = ['true', 'yes', 'y', '1'].includes((process.env.ETHEREAL_
|
||||
let testAccount = false;
|
||||
|
||||
module.exports.createTransport = function (transporter, defaults) {
|
||||
let urlConfig;
|
||||
let options;
|
||||
let mailer;
|
||||
|
||||
if (
|
||||
// provided transporter is a configuration object, not transporter plugin
|
||||
@@ -30,7 +28,8 @@ module.exports.createTransport = function (transporter, defaults) {
|
||||
// provided transporter looks like a connection url
|
||||
(typeof transporter === 'string' && /^(smtps?|direct):/i.test(transporter))
|
||||
) {
|
||||
if ((urlConfig = typeof transporter === 'string' ? transporter : transporter.url)) {
|
||||
const urlConfig = typeof transporter === 'string' ? transporter : transporter.url;
|
||||
if (urlConfig) {
|
||||
// parse a configuration URL into configuration options
|
||||
options = shared.parseConnectionUrl(urlConfig);
|
||||
} else {
|
||||
@@ -47,7 +46,7 @@ module.exports.createTransport = function (transporter, defaults) {
|
||||
transporter = new JSONTransport(options);
|
||||
} else if (options.SES) {
|
||||
if (options.SES.ses && options.SES.aws) {
|
||||
let error = new Error(
|
||||
const error = new Error(
|
||||
'Using legacy SES configuration, expecting @aws-sdk/client-sesv2, see https://nodemailer.com/transports/ses/'
|
||||
);
|
||||
error.code = errors.ECONFIG;
|
||||
@@ -59,9 +58,7 @@ module.exports.createTransport = function (transporter, defaults) {
|
||||
}
|
||||
}
|
||||
|
||||
mailer = new Mailer(transporter, options, defaults);
|
||||
|
||||
return mailer;
|
||||
return new Mailer(transporter, options, defaults);
|
||||
};
|
||||
|
||||
module.exports.createTestAccount = function (apiUrl, callback) {
|
||||
@@ -85,11 +82,11 @@ module.exports.createTestAccount = function (apiUrl, callback) {
|
||||
|
||||
apiUrl = apiUrl || ETHEREAL_API;
|
||||
|
||||
let chunks = [];
|
||||
const chunks = [];
|
||||
let chunklen = 0;
|
||||
|
||||
let requestHeaders = {};
|
||||
let requestBody = {
|
||||
const requestHeaders = {};
|
||||
const requestBody = {
|
||||
requestor: packageData.name,
|
||||
version: packageData.version
|
||||
};
|
||||
@@ -98,7 +95,7 @@ module.exports.createTestAccount = function (apiUrl, callback) {
|
||||
requestHeaders.Authorization = 'Bearer ' + ETHEREAL_API_KEY;
|
||||
}
|
||||
|
||||
let req = nmfetch(apiUrl + '/user', {
|
||||
const req = nmfetch(apiUrl + '/user', {
|
||||
contentType: 'application/json',
|
||||
method: 'POST',
|
||||
headers: requestHeaders,
|
||||
@@ -116,16 +113,12 @@ module.exports.createTestAccount = function (apiUrl, callback) {
|
||||
req.once('error', err => callback(err));
|
||||
|
||||
req.once('end', () => {
|
||||
let res = Buffer.concat(chunks, chunklen);
|
||||
const res = Buffer.concat(chunks, chunklen);
|
||||
let data;
|
||||
let err;
|
||||
try {
|
||||
data = JSON.parse(res.toString());
|
||||
} catch (E) {
|
||||
err = E;
|
||||
}
|
||||
if (err) {
|
||||
return callback(err);
|
||||
return callback(E);
|
||||
}
|
||||
if (data.status !== 'success' || data.error) {
|
||||
return callback(new Error(data.error || 'Request failed'));
|
||||
@@ -143,7 +136,7 @@ module.exports.getTestMessageUrl = function (info) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let infoProps = new Map();
|
||||
const infoProps = new Map();
|
||||
info.response.replace(/\[([^\]]+)\]$/, (m, props) => {
|
||||
props.replace(/\b([A-Z0-9]+)=([^\s]+)/g, (m, key, value) => {
|
||||
infoProps.set(key, value);
|
||||
|
||||
Reference in New Issue
Block a user