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 4.0.0 to 4.1.0

4

CHANGELOG.md
# Changelog
## v4.1.0 2018-09-10
* New method `destroy`.
## v4.0.0 2018-09-09

@@ -4,0 +8,0 @@

4

lib/smtp-server-as-promised.d.ts

@@ -24,3 +24,4 @@ /// <reference types="node" />

server: SMTPServer;
protected onError?: (error: Error) => Promise<void>;
protected closed?: boolean;
protected errorHandler?: (error: Error) => Promise<void>;
constructor(options?: SMTPServerAsPromisedOptions);

@@ -30,3 +31,4 @@ listen(options?: net.ListenOptions): Promise<SMTPServerAsPromisedServerAddress>;

updateSecureContext(options: tls.TlsOptions): void;
destroy(): Promise<void>;
}
export default SMTPServerAsPromised;

@@ -10,2 +10,3 @@ "use strict";

constructor(options = {}) {
this.closed = false;
const smtpSeverOptions = Object.assign({}, options);

@@ -54,4 +55,4 @@ if (options.onConnect) {

if (options.onError) {
this.onError = options.onError;
this.server.on('error', this.onError);
this.errorHandler = options.onError;
this.server.on('error', this.errorHandler);
}

@@ -79,9 +80,13 @@ }

this.server.close((err) => {
this.closed = true;
if (this.errorHandler) {
this.server.removeListener('error', this.errorHandler);
this.errorHandler = undefined;
}
if (err) {
return reject(err);
}
if (this.onError) {
this.server.removeListener('error', this.onError);
else {
resolve();
}
resolve();
});

@@ -93,4 +98,12 @@ });

}
destroy() {
if (!this.closed) {
return this.close();
}
else {
return Promise.resolve();
}
}
}
exports.SMTPServerAsPromised = SMTPServerAsPromised;
exports.default = SMTPServerAsPromised;
{
"name": "smtp-server-as-promised",
"version": "4.0.0",
"version": "4.1.0",
"description": "Promisify smtp-server module",

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

"promise-socket": "^3.1.1",
"rimraf": "^2.6.2",
"semver": "^5.5.1",

@@ -62,3 +63,3 @@ "ts-node": "^7.0.1",

"clean": "rimraf lib",
"postpublish": "git tag v$npm_package_version -a -m \"Release $npm_package_version\" && git push --tags",
"postpublish": "git tag v$npm_package_version -a -m \"Release v$npm_package_version\" && git push --tags",
"prepublishOnly": "npm run build",

@@ -65,0 +66,0 @@ "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 && markdownlint \"*.md\"",

@@ -225,2 +225,10 @@ # smtp-server-as-promised

### destroy
```js
await connection.destroy()
```
Manually free resources taken by server.
## License

@@ -227,0 +235,0 @@

@@ -32,3 +32,4 @@ /// <reference types="node" />

protected onError?: (error: Error) => Promise<void>
protected closed?: boolean = false
protected errorHandler?: (error: Error) => Promise<void>

@@ -82,4 +83,4 @@ constructor (options: SMTPServerAsPromisedOptions = {}) {

if (options.onError) {
this.onError = options.onError
this.server.on('error', this.onError)
this.errorHandler = options.onError
this.server.on('error', this.errorHandler)
}

@@ -113,9 +114,12 @@ }

this.server.close((err?: Error | null) => {
this.closed = true
if (this.errorHandler) {
this.server.removeListener('error', this.errorHandler)
this.errorHandler = undefined
}
if (err) {
return reject(err)
} else {
resolve()
}
if (this.onError) {
this.server.removeListener('error', this.onError)
}
resolve()
})

@@ -128,4 +132,12 @@ })

}
destroy (): Promise<void> {
if (!this.closed) {
return this.close()
} else {
return Promise.resolve()
}
}
}
export default SMTPServerAsPromised
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