Skip to content

Commit

Permalink
Release v8.0.0 (#48)
Browse files Browse the repository at this point in the history
* dep(elastic): bump dep version to 8.8
* update @elastic syntax to promise API
  • Loading branch information
msimerson authored Jun 9, 2023
1 parent d1578cb commit d43868a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
sudo sysctl -w vm.max_map_count=262144
- uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.17.0
stack-version: 8.8.0
security-enabled: false
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
15 changes: 15 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
### Unreleased


### [8.0.0] - 2023-06-NN

- dep(elastic): bump dep version to 8.8
-


### [7.0.0] - 2023-06-08

- chore: update ci & packaging
- dep(elastic): bump dep version to 7.17
- bump major version to match ES major version


### [1.1.0] - 2023-06-08

- dep(elastic): dump dep version to 8.8
Expand Down Expand Up @@ -64,3 +77,5 @@
[1.0.7]: https://github.com/haraka/haraka-plugin-elasticsearch/releases/tag/1.0.7
[1.0.8]: https://github.com/haraka/haraka-plugin-elasticsearch/releases/tag/1.0.8
[1.1.0]: https://github.com/haraka/haraka-plugin-elasticsearch/releases/tag/1.1.0
[7.0.0]: https://github.com/haraka/haraka-plugin-elasticsearch/releases/tag/7.0.0
[8.0.0]: https://github.com/haraka/haraka-plugin-elasticsearch/releases/tag/8.0.0
46 changes: 25 additions & 21 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,17 @@ exports.es_connect = function (done) {

plugin.es = new Elasticsearch.Client(plugin.clientArgs);

plugin.es.ping({}, function (error) {
if (error) {
plugin.logerror('cluster is down!');
plugin.logerror(util.inspect(error, {depth: null}));
}
else {
plugin.lognotice('connected');
}
if (done) done(error);
});
plugin.es.ping()
.then(() => {
plugin.lognotice('connected')
})
.catch(error => {
plugin.logerror('cluster is down!')
plugin.logerror(util.inspect(error, {depth: null}))
})
.finally(() => {
if (done) done()
})
}

exports.log_transaction = function (next, connection) {
Expand All @@ -104,12 +105,13 @@ exports.log_transaction = function (next, connection) {
type: 'haraka',
id: connection.transaction.uuid,
body: JSON.stringify(res),
}, (error, response) => {
if (error) {
})
.then((response) => {
// connection.loginfo(plugin, response);
})
.catch(error => {
connection.logerror(plugin, error.message);
}
// connection.loginfo(plugin, response);
});
})

// hook reset_transaction doesn't seem to wait for next(). If I
// wait until after I get a response back from ES, Haraka throws
Expand Down Expand Up @@ -144,13 +146,15 @@ exports.log_connection = function (next, connection) {
type: 'haraka',
id: connection.uuid,
body: JSON.stringify(res),
}, function (error, response) {
if (error) {
})
.then((response) => {
// connection.loginfo(plugin, response);
})
.catch(error => {
connection.logerror(plugin, error.message);
}
// connection.loginfo(plugin, response);
});
next();
})

next()
}

exports.objToArray = function (obj) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haraka-plugin-elasticsearch",
"version": "7.0.0",
"version": "8.0.0",
"description": "Haraka plugin that saves logs to Elasticsearch",
"main": "index.js",
"scripts": {
Expand All @@ -25,7 +25,7 @@
},
"homepage": "https://github.com/haraka/haraka-plugin-elasticsearch#readme",
"dependencies": {
"@elastic/elasticsearch": "^7.17.0",
"@elastic/elasticsearch": "^8.8.0",
"haraka-utils": "*"
},
"devDependencies": {
Expand Down
21 changes: 8 additions & 13 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,7 @@ describe('storesIndexMapTemplate', function () {
plugin.es_connect((err) => {
assert.ifError(err);

if (err) {
done()
return;
}
if (err) { done(); return; }

fs.readFile(filePath, (err2, data) => {
if (err2) {
Expand All @@ -231,20 +228,18 @@ describe('storesIndexMapTemplate', function () {
plugin.es.indices.putTemplate({
name: 'smtp-*',
body: JSON.stringify(indexMap),
},
function (err3, result) {
if (err3) {
})
.then(result => {
console.log(result);
})
.catch(err3 => {
if (err3.status !== 404) {
console.error(err3);
}
// other tests are running, so currently
// stored mapping may conflict
done()
return;
}
console.log(result);
done()
})
})
.finally(done)
})
})
})
Expand Down

0 comments on commit d43868a

Please sign in to comment.