New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sebastianfoth/winston-nodemailer

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sebastianfoth/winston-nodemailer - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

dist/interfaces/body-template-data.interface.d.ts

2

dist/interfaces/index.d.ts
export { IErrorDetails } from './error-details.interface';
export { IWinstonNodemailerOptions } from './winston-nodemailer-options.interface';
export { ISubjectTemplateData } from './subject-template-data.interface';
export { IBodyTemplateData } from './body-template-data.interface';
import { SendMailOptions } from 'nodemailer';
import { SmtpOptions } from 'nodemailer-smtp-transport';
import * as TransportStream from 'winston-transport';
export interface IWinstonNodemailerOptions extends TransportStream.TransportStreamOptions, SendMailOptions, SmtpOptions {
export interface IWinstonNodemailerOptions extends TransportStream.TransportStreamOptions {
sendMailOptions: SendMailOptions;
smtpOptions: SmtpOptions;
subject: string;
template?: string;
waitUntilSend?: number;
timestamp?: () => string;
}

@@ -11,5 +11,9 @@ import * as Transport from 'winston-transport';

private triggered;
private subject;
private template;
constructor(options: IWinstonNodemailerOptions);
log(info: any, callback: LogCallback): void;
private sendMail;
private returnRenderedSubject;
private returnRenderedBody;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Transport = require("winston-transport");
const mustache = require("mustache");
const nodemailer_1 = require("nodemailer");
const os = require("os");
class WinstonNodemailer extends Transport {

@@ -13,5 +15,6 @@ constructor(options) {

this.waitUntilSend = options.waitUntilSend || 60000;
this.subject = options.subject || ``;
this.template = options.template || ``;
this.timestamp = options.timestamp || (() => (new Date()).toISOString());
this.transporter = nodemailer_1.createTransport(options);
console.log(this.transporter);
}

@@ -59,14 +62,44 @@ log(info, callback) {

console.log('timeout');
this.sendMail(callback);
this.sendMail({
errorDetails: {
timestamp: this.timestamp(),
level,
message,
meta,
error,
},
hostname: os.hostname(),
pid: process.pid,
}, {
errorDetails: this.errorDetailsBuffer,
hostname: os.hostname(),
pid: process.pid,
}, callback);
}, this.waitUntilSend);
}
}
sendMail(callback) {
sendMail(subjectTemplateData, bodyTemplateData, callback) {
console.log(this.errorDetailsBuffer.join(''));
this.transporter
.sendMail(Object.assign({}, this.options, { text: this.errorDetailsBuffer.join('') }), callback);
.sendMail(Object.assign({}, this.options.sendMailOptions, this.options.smtpOptions, { subject: this.returnRenderedSubject(this.subject, subjectTemplateData), text: this.returnRenderedBody(this.template, bodyTemplateData) }), callback);
this.errorDetailsBuffer = [];
delete this.triggered;
}
returnRenderedSubject(subject, templateData) {
return mustache.render(subject, {
level: templateData.errorDetails.level,
timestamp: templateData.errorDetails.timestamp,
message: templateData.errorDetails.message,
pid: templateData.pid,
hostname: templateData.hostname
});
}
returnRenderedBody(subject, templateData) {
return mustache.render(subject, {
errors: templateData.errorDetails,
pid: templateData.pid,
hostname: templateData.hostname
});
}
}
exports.WinstonNodemailer = WinstonNodemailer;

4

package.json
{
"name": "@sebastianfoth/winston-nodemailer",
"version": "0.0.5",
"version": "0.0.6",
"description": "A nodemailer transport for winston 3.x",

@@ -73,2 +73,4 @@ "main": "dist/index.js",

"dependencies": {
"@types/nodemailer": "^4.6.6",
"@types/nodemailer-smtp-transport": "^2.7.4",
"mustache": "^3.0.1",

@@ -75,0 +77,0 @@ "nodemailer": "^5.1.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc