Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smtp-server-as-promised

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smtp-server-as-promised - npm Package Compare versions

Comparing version 5.2.1 to 5.2.2

lib/smtp-server-as-promised.js.map

6

CHANGELOG.md
# Changelog
## v5.2.2 2019-06-04
- Minor tweaks in README.
- Added source map to the package.
- Uses dirty-chai for tests.
## v5.2.1 2019-05-10

@@ -4,0 +10,0 @@

2

index.js

@@ -1,1 +0,1 @@

module.exports = require('./lib/smtp-server-as-promised')
module.exports = require("./lib/smtp-server-as-promised")
/// <reference types="node" />
import net from 'net';
export { Logger, LoggerLevel } from 'nodemailer/lib/shared';
import tls from 'tls';
import { SMTPServer, SMTPServerAddress, SMTPServerAuthentication, SMTPServerAuthenticationResponse, SMTPServerDataStream, SMTPServerOptions, SMTPServerSession } from 'smtp-server';
export * from 'smtp-server';
import net from "net";
export { Logger, LoggerLevel } from "nodemailer/lib/shared";
import tls from "tls";
import { SMTPServer, SMTPServerAddress, SMTPServerAuthentication, SMTPServerAuthenticationResponse, SMTPServerDataStream, SMTPServerOptions, SMTPServerSession } from "smtp-server";
export * from "smtp-server";
export interface SMTPServerAsPromisedServerAddress {

@@ -8,0 +8,0 @@ address: string;

@@ -40,3 +40,3 @@ "use strict";

if (is_stream_ended_1.default(stream)) {
return callback(new Error('SMTP data stream is already ended'));
return callback(new Error("SMTP data stream is already ended"));
}

@@ -53,3 +53,3 @@ return this.onData(stream, session)

this.server = new smtp_server_1.SMTPServer(Object.assign({}, options, newOptions));
this.server.on('error', (err) => this.onError(err));
this.server.on("error", (err) => this.onError(err));
}

@@ -60,3 +60,3 @@ listen(options = {}) {

const listeningHandler = () => {
netServer.removeListener('error', errorHandler);
netServer.removeListener("error", errorHandler);
const address = netServer.address();

@@ -66,7 +66,7 @@ resolve(address);

const errorHandler = (err) => {
netServer.removeListener('listening', listeningHandler);
netServer.removeListener("listening", listeningHandler);
reject(err);
};
netServer.once('listening', listeningHandler);
netServer.once('error', errorHandler);
netServer.once("listening", listeningHandler);
netServer.once("error", errorHandler);
this.server.listen(options);

@@ -80,3 +80,3 @@ });

if (this.errorHandler) {
this.server.removeListener('error', this.errorHandler);
this.server.removeListener("error", this.errorHandler);
this.errorHandler = undefined;

@@ -144,1 +144,2 @@ }

exports.default = SMTPServerAsPromised;
//# sourceMappingURL=smtp-server-as-promised.js.map
{
"name": "smtp-server-as-promised",
"version": "5.2.1",
"version": "5.2.2",
"description": "Promisify smtp-server module",

@@ -27,3 +27,3 @@ "main": "lib/smtp-server-as-promised.js",

"is-stream-ended": "^0.1.4",
"null-writable": "^1.0.1",
"null-writable": "^1.0.2",
"smtp-server": "^3.5.0",

@@ -35,5 +35,6 @@ "stream.finished": "^1.2.0",

"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.6",
"@types/node": "^12.0.0",
"@types/nodemailer": "^4.6.8",
"@types/dirty-chai": "^2.0.0",
"@types/mocha": "^5.2.7",
"@types/node": "^12.0.4",
"@types/nodemailer": "^6.2.0",
"@types/semver": "^6.0.0",

@@ -43,41 +44,37 @@ "@types/smtp-server": "^3.5.1",

"coveralls": "^3.0.3",
"cross-env": "^5.2.0",
"dirty-chai": "^2.0.1",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.2.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-node": "^9.0.1",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.1.1",
"markdownlint-cli": "^0.15.0",
"markdownlint-cli": "^0.16.0",
"mocha": "^6.1.4",
"nyc": "^14.1.1",
"prettier": "^1.17.0",
"promise-readable": "^4.2.0",
"promise-socket": "^4.0.0",
"semver": "^6.0.0",
"prettier": "^1.17.1",
"promise-readable": "^4.2.1",
"promise-socket": "^4.0.1",
"semver": "^6.1.1",
"shx": "^0.3.2",
"ts-node": "^8.1.0",
"tslint": "^5.16.0",
"ts-node": "^8.2.0",
"tslint": "^5.17.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
},
"scripts": {
"build": "npm run compile",
"compile": "tsc --pretty",
"clean": "shx rm -rf lib",
"compile": "tsc --pretty --project .",
"clean": "npm run clean:compile && npm run clean:coverage",
"clean:compile": "shx rm -rf lib",
"clean:coverage": "shx rm -rf coverage .nyc_output",
"lint": "npm run compile && tsc --pretty -p examples && tsc --pretty -p test && eslint . && tslint -t stylish -p . && tslint -t stylish -p examples && tslint -t stylish -p test && prettier --ignore-path .gitignore --list-different '**/*.{js,json,md,ts,yml}' && markdownlint \"*.md\"",
"postpublish": "git tag v$npm_package_version -a -m \"Release v$npm_package_version\" && git push --tags",
"prepack": "npm run build",
"pretest": "npm run build && tsc --pretty -p examples && tsc --pretty -p test && eslint . && tslint -t stylish -p . && tslint -t stylish -p examples && tslint -t stylish -p test && prettier --ignore-path .gitignore --list-different '**/*.js' '**/*.json' '**/*.md' '**/*.ts' '**/*.yml' && markdownlint \"*.md\"",
"prepack": "npm run compile",
"prepublishOnly": "npm run test",
"pretest": "npm run lint",
"test": "npm run test:spec",
"test:spec": "npm run ts-mocha -- \"test/*.ts\"",
"test:coverage": "nyc --reporter json npm run test:spec && nyc report",
"ts-mocha": "mocha --use_strict --throw-deprecation --require source-map-support/register --require ts-node/register --timeout 90000"
},
"nyc": {
"extension": [
".ts"
],
"exclude": [
".*.js",
"**/*.d.ts"
]
"test:coverage": "npm run clean:coverage && cross-env NYC=\"nyc --no-clean --reporter=lcov\" npm run test:spec && nyc report --reporter=text-summary --color",
"ts-mocha": "$NYC mocha --use_strict --throw-deprecation --require source-map-support/register --require ts-node/register --timeout 90000"
}
}

@@ -32,18 +32,2 @@ # smtp-server-as-promised

Transpiling this module with own settings in `tsconfig.json`:
```json
{
"compilerOptions": {
"baseUrl": ".",
"esModuleInterop": true,
"paths": {
"smtp-server-as-promised": ["node_modules/smtp-server-as-promised/src/smtp-server-as-promised"]
},
"strict": true
},
"include": ["*.ts", "node_modules/smtp-server-as-promised/src/*.ts"]
}
```
## Usage

@@ -54,3 +38,3 @@

```js
const {SMTPServerAsPromised} = require('smtp-server-as-promised')
const {SMTPServerAsPromised} = require("smtp-server-as-promised")

@@ -63,3 +47,5 @@ class MySMTPServer extends SMTPServerAsPromised {}

```ts
import SMTPServerAsPromised from 'smtp-server-as-promised'
import SMTPServerAsPromised from "smtp-server-as-promised"
// or
import {SMTPServerAsPromised} from "smtp-server-as-promised"

@@ -81,3 +67,3 @@ class MySMTPServer extends SMTPServerAsPromised {}

const server = new MySMTPServer({
disabledCommands: ['AUTH'],
disabledCommands: ["AUTH"],
})

@@ -114,6 +100,6 @@ ```

async onAuth(auth, session) {
if (auth.method === 'PLAIN' && auth.username === 'username' && auth.password === 'password') {
if (auth.method === "PLAIN" && auth.username === "username" && auth.password === "password") {
return {user: auth.username}
} else {
throw new Error('Invalid username or password')
throw new Error("Invalid username or password")
}

@@ -138,4 +124,4 @@ }

console.log(`[${session.id}] onMailFrom ${from.address}`)
if (from.address.split('@')[1] === 'spammer.com') {
throw new Error('we do not like spam!')
if (from.address.split("@")[1] === "spammer.com") {
throw new Error("we do not like spam!")
}

@@ -158,4 +144,4 @@ }

console.log(`[${session.id}] onRcptTo ${to.address}`)
if (from.address.split('@')[1] === 'spammer.com') {
throw new Error('we do not like spam!')
if (from.address.split("@")[1] === "spammer.com") {
throw new Error("we do not like spam!")
}

@@ -178,3 +164,3 @@ }

console.log(`[${session.id}] onData started`)
if (stream.sizeExceeded) throw new Error('Message too big')
if (stream.sizeExceeded) throw new Error("Message too big")
stream.pipe(process.stdout)

@@ -206,3 +192,3 @@ }

async onError(error) {
console.log('Server error:', error)
console.log("Server error:", error)
}

@@ -209,0 +195,0 @@ }

/// <reference types="node" />
/// <reference types="nodemailer" />
import isStreamEnded from 'is-stream-ended'
import net from 'net'
export {Logger, LoggerLevel} from 'nodemailer/lib/shared'
import NullWritable from 'null-writable'
import finished from 'stream.finished'
import tls from 'tls'
import isStreamEnded from "is-stream-ended"
import net from "net"
export {Logger, LoggerLevel} from "nodemailer/lib/shared"
import NullWritable from "null-writable"
import finished from "stream.finished"
import tls from "tls"

@@ -19,5 +19,5 @@ import {

SMTPServerSession,
} from 'smtp-server'
} from "smtp-server"
export * from 'smtp-server'
export * from "smtp-server"

@@ -97,3 +97,3 @@ export interface SMTPServerAsPromisedServerAddress {

if (isStreamEnded(stream)) {
return callback(new Error('SMTP data stream is already ended'))
return callback(new Error("SMTP data stream is already ended"))
}

@@ -114,3 +114,3 @@

this.server.on('error', (err: Error) => this.onError(err))
this.server.on("error", (err: Error) => this.onError(err))
}

@@ -123,3 +123,3 @@

const listeningHandler = () => {
netServer.removeListener('error', errorHandler)
netServer.removeListener("error", errorHandler)
const address = netServer.address() as SMTPServerAsPromisedServerAddress

@@ -130,8 +130,8 @@ resolve(address)

const errorHandler = (err: Error) => {
netServer.removeListener('listening', listeningHandler)
netServer.removeListener("listening", listeningHandler)
reject(err)
}
netServer.once('listening', listeningHandler)
netServer.once('error', errorHandler)
netServer.once("listening", listeningHandler)
netServer.once("error", errorHandler)

@@ -147,3 +147,3 @@ this.server.listen(options)

if (this.errorHandler) {
this.server.removeListener('error', this.errorHandler)
this.server.removeListener("error", this.errorHandler)
this.errorHandler = undefined

@@ -150,0 +150,0 @@ }

@@ -13,4 +13,5 @@ {

"outDir": "./lib",
"sourceMap": true,
"strict": true,
"target": "es6",
"strict": true,
"typeRoots": ["node_modules/@types"]

@@ -17,0 +18,0 @@ },

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