Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.2.1 #5

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release
Submodule .release updated 7 files
+13 −6 CHANGELOG.md
+1 −1 LICENSE
+17 −9 README.md
+3 −0 finish.sh
+7 −6 npm/prepend-scope.cjs
+6 −8 start.sh
+13 −4 submit.sh
7 changes: 7 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
### Unreleased


### [1.2.1] - 2024-04-03

- es6: use optional chaining (?.), for safety
- es6: use default function params


### [1.2.0] - 2022-06-24

- merged in ChunkEmitter, only used here
Expand All @@ -21,3 +27,4 @@

[1.1.0]: https://github.com/haraka/message-stream/releases/tag/1.1.0
[1.2.0]: https://github.com/haraka/message-stream/releases/tag/1.2.0
[1.2.1]: https://github.com/haraka/message-stream/releases/tag/1.2.1
24 changes: 12 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class MessageStream extends Stream {
this.total_buffered = 0;
this._queue = [];
this.max_data_inflight = 0;
this.buffer_max = (!isNaN(cfg.main.spool_after) ? Number(cfg.main.spool_after) : -1);
this.buffer_max = (!isNaN(cfg?.main?.spool_after) ? Number(cfg.main.spool_after) : -1);
this.spooling = false;
this.fd = null;
this.open_pending = false;
this.spool_dir = cfg.main.spool_dir || '/tmp';
this.spool_dir = cfg?.main?.spool_dir || '/tmp';
this.filename = `${this.spool_dir}/${id}.eml`;
this.write_pending = false;

Expand Down Expand Up @@ -70,7 +70,7 @@ class MessageStream extends Stream {
if (this.state === STATE.HEADERS) {
// Look for end of headers line
if (line.length === 2 && line[0] === 0x0d && line[1] === 0x0a) {
this.idx.headers = { start: 0, end: this.bytes_read-line.length };
this.idx.headers = { start: 0, end: this.bytes_read - line.length };
this.state = STATE.BODY;
this.idx.body = { start: this.bytes_read };
}
Expand All @@ -90,7 +90,7 @@ class MessageStream extends Stream {
else {
// Start of boundary?
if (!this.idx[boundary]) {
this.idx[boundary] = { start: this.bytes_read-line.length };
this.idx[boundary] = { start: this.bytes_read - line.length };
}
}
}
Expand Down Expand Up @@ -313,19 +313,19 @@ class MessageStream extends Stream {
});
}

pipe (destination, options) {
pipe (destination, options = {}) {
const self = this;
if (this.in_pipe) {
throw new Error('Cannot pipe while currently piping');
}
Stream.prototype.pipe.call(this, destination, options);
// Options
this.line_endings = ((options && options.line_endings) ? options.line_endings : "\r\n");
this.dot_stuffing = ((options && options.dot_stuffing) ? options.dot_stuffing : false);
this.ending_dot = ((options && options.ending_dot) ? options.ending_dot : false);
this.clamd_style = (!!((options && options.clamd_style)));
this.buffer_size = ((options && options.buffer_size) ? options.buffer_size : 1024 * 64);
this.start = ((options && parseInt(options.start)) ? parseInt(options.start) : 0);
this.line_endings = options?.line_endings ?? '\r\n';
this.dot_stuffing = options?.dot_stuffing ?? false;
this.ending_dot = options?.ending_dot ?? false;
this.clamd_style = !!options?.clamd_style;
this.buffer_size = options?.buffer_size ?? 1024 * 64;
this.start = (parseInt(options?.start) ? parseInt(options.start) : 0);
// Reset
this.in_pipe = true;
this.readable = true;
Expand Down Expand Up @@ -512,4 +512,4 @@ class ChunkEmitter extends EventEmitter {
}
}

module.exports.ChunkEmitter = ChunkEmitter
module.exports.ChunkEmitter = ChunkEmitter
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "haraka-message-stream",
"version": "1.2.0",
"version": "1.2.1",
"description": "Haraka email message stream",
"main": "index.js",
"scripts": {
"lint": "npx eslint *.js test",
"lintfix": "npx eslint --fix *.js test",
"lint": "npx eslint@^8 *.js test",
"lintfix": "npx eslint@^8 --fix *.js test",
"versions": "npx dependency-version-checker check",
"test": "npx mocha"
"test": "npx mocha@^10"
},
"repository": {
"type": "git",
Expand All @@ -25,10 +25,8 @@
},
"homepage": "https://github.com/haraka/message-stream#readme",
"devDependencies": {
"eslint": ">=8",
"eslint-plugin-haraka": "*",
"haraka-test-fixtures": "*",
"mocha": ">=9"
"eslint-plugin-haraka": "^1.0.15",
"haraka-test-fixtures": "^1.3.3"
},
"dependencies": {}
}
Loading