Skip to content

Commit

Permalink
deps: bump versions
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Apr 10, 2024
1 parent d65b9d6 commit f41c235
Show file tree
Hide file tree
Showing 12 changed files with 476 additions and 452 deletions.
8 changes: 4 additions & 4 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
engines:
eslint:
enabled: true
channel: "eslint-8"
channel: 'eslint-8'
config:
config: ".eslintrc.yaml"
config: '.eslintrc.yaml'

checks:
return-statements:
Expand All @@ -16,5 +16,5 @@ checks:
threshold: 20

ratings:
paths:
- "**.js"
paths:
- '**.js'
6 changes: 4 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Fixes #

Changes proposed in this pull request:
-
-

-
-

Checklist:

- [ ] docs updated
- [ ] tests updated
- [ ] Changes.md updated
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [ push, pull_request ]
on: [push, pull_request]

env:
CI: true
Expand All @@ -18,6 +18,6 @@ jobs:
uses: haraka/.github/.github/workflows/ubuntu.yml@master

windows:
if: ${{ false }} # needs redis server
if: ${{ false }} # needs redis server
needs: [lint]
uses: haraka/.github/.github/workflows/windows.yml@master
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: CodeQL

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '18 7 * * 4'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ env:
jobs:
publish:
uses: haraka/.github/.github/workflows/publish.yml@master
secrets: inherit
secrets: inherit
2 changes: 2 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
singleQuote: true
semi: false
21 changes: 7 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### [2.2.4] - 2024-04-10

- deps: bump versions
- ci: updated ci.yml
- doc(CHANGES): rename Changes.md -> CHANGELOG.md
- doc(CONTRIBUTORS): added
- populate [files] in package.json. Delete .npmignore.
- dep: eslint-plugin-haraka -> @haraka/eslint-config
- lint: remove duplicate / stale rules from .eslintrc
- prettier

### [2.2.3] - 2023-06-08

- ci: add on pull_request
- dev: expand .gitignore
- packaging: add .npmignore


#### 2.2.2 - 2022-05-28

- feat: add ignores keys with undefined values
- add .release submodule


#### 2.2.1 - 2022-05-27

- chore(ci): depend on shared GHA workflows


#### 2.2.0 - 2022-05-23

- dep(node): require 14+
Expand All @@ -40,50 +39,44 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
- doc(README): deprecate usage of 'plugin'
- doc(README): update badges


#### 2.1.0 - 2021-10-14

- bump redis dep 2.8.0 -> 3.1.2
- bump redis dep 2.8.0 -> 3.1.2
- replace nodeunit with mocha
- add github workflows, drop travis & appveyor CI
- use es6 classes
- es6: use "for item of array" syntax for array iterator


#### 2.0.3 - 2017-08-26

- add redis_publish boolean to disable redis results publishing


#### 2.0.2 - 2017-06-26

- revert #4, until a proper and tested fix is available


#### 2.0.1 - 2017-05-26

- eslint 4 compat


#### 2.0.0 - 2017-05-26

- Disable Redis pub/sub by default


#### 1.0.2 - 2017-02-13

- publish incr operations
- update eslint to inherit eslint-plugin-haraka
- added AppVeyor (windows) testing


#### 1.0.1 - 2017-01-26
#### 1.0.1 - 2017-01-26

- update eslint to inherit eslint-plugin-haraka

* depend on haraka-config
* vs ./config, which doesn't work for npm packaged plugin tests
- vs ./config, which doesn't work for npm packaged plugin tests

#### 1.0.0 - initial release
#### 1.0.0 - initial release

[2.1.0]: https://github.com/haraka/haraka-results/releases/tag/2.1.0
[2.2.0]: https://github.com/haraka/haraka-results/releases/tag/2.2.0
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

# Contributors

This handcrafted artisinal software is brought to you by:

| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-results/commits?author=msimerson">29</a>)| <img height="80" src="https://avatars.githubusercontent.com/u/42121756?v=4"><br><a href="https://github.com/PSSGCSim">PSSGCSim</a> (<a href="https://github.com/haraka/haraka-results/commits?author=PSSGCSim">2</a>)| <img height="80" src="https://avatars.githubusercontent.com/u/203240?v=4"><br><a href="https://github.com/lnedry">lnedry</a> (<a href="https://github.com/haraka/haraka-results/commits?author=lnedry">2</a>)| <img height="80" src="https://avatars.githubusercontent.com/u/662371?v=4"><br><a href="https://github.com/baudehlo">baudehlo</a> (<a href="https://github.com/haraka/haraka-results/commits?author=baudehlo">1</a>)| <img height="80" src="https://avatars.githubusercontent.com/u/550490?v=4"><br><a href="https://github.com/smfreegard">smfreegard</a> (<a href="https://github.com/haraka/haraka-results/commits?author=smfreegard">1</a>)|
| :---: | :---: | :---: | :---: | :---: |
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-results/commits?author=msimerson">29</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/42121756?v=4"><br><a href="https://github.com/PSSGCSim">PSSGCSim</a> (<a href="https://github.com/haraka/haraka-results/commits?author=PSSGCSim">2</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/203240?v=4"><br><a href="https://github.com/lnedry">lnedry</a> (<a href="https://github.com/haraka/haraka-results/commits?author=lnedry">2</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/662371?v=4"><br><a href="https://github.com/baudehlo">baudehlo</a> (<a href="https://github.com/haraka/haraka-results/commits?author=baudehlo">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/550490?v=4"><br><a href="https://github.com/smfreegard">smfreegard</a> (<a href="https://github.com/haraka/haraka-results/commits?author=smfreegard">1</a>) |
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |

<sub>this file is maintained by [.release](https://github.com/msimerson/.release)</sub>
84 changes: 39 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Add, log, retrieve, and share the results of plugin tests.
Results is a structured way of storing results from plugins across a
session, allowing those results to be retrieved later or by other plugins.

Results objects are present on every Haraka connection *and* transaction. When
in a SMTP transaction, results from *both* are applicable to that transaction.
Results objects are present on every Haraka connection _and_ transaction. When
in a SMTP transaction, results from _both_ are applicable to that transaction.

## Usage

Expand Down Expand Up @@ -47,9 +47,9 @@ Store the results in the transaction (vs connection):
Each plugin can have custom settings in results.ini to control results logging.
There are three options available: hide, order, and debug.

* hide - a comma separated list of results to hide from the output
* order - a comman separated list, specifing the order of items in the output
* debug - log debug messages every time results are called
- hide - a comma separated list of results to hide from the output
- order - a comman separated list, specifing the order of items in the output
- debug - log debug messages every time results are called

```ini
; put this in config/results.ini
Expand Down Expand Up @@ -93,46 +93,43 @@ In addition to appending values to the predefined lists, arbitrary results
can be stored in the cache:

```js
results.add(this, {my_result: 'anything I want'})
results.add(this, { my_result: 'anything I want' })
```

When arbirary values are stored, they are listed first in the log output. Their
display can be suppressed with the **hide** option in results.ini.


#### incr

Increment counters. The argument to incr is an object with counter names and
increment values. Examples:

```js
results.incr(this, {unrecognized_commands: 1})
results.incr(this, { unrecognized_commands: 1 })
results.incr(this, {karma: -1})
results.incr(this, {karma: 2})
results.incr(this, { karma: -1 })
results.incr(this, { karma: 2 })
```


#### push

Append items onto arrays. The argument to push is an object with array names and
the new value to be appended to the array. Examples:

```js
results.push(this, {dns_recs: 'name1'})
results.push(this, {dns_recs: 'name2'})
results.push(this, { dns_recs: 'name1' })
results.push(this, { dns_recs: 'name2' })
```

#### collate

```js
const summary = results.collate(this)
const summary = results.collate(this)
```

Formats the contents of the result cache and returns them. This function is
called internally by `add()` after each update.


#### get

Retrieve the stored results as an object. The only argument is the name of the
Expand Down Expand Up @@ -161,49 +158,48 @@ Check result contents for string or pattern matches.
Syntax:

```js
results.has('plugin_name', 'result_name', 'search_term')
results.has('plugin_name', 'result_name', 'search_term')
```

* result\_name: the name of an array or string in the result object
* search\_term: a string or RegExp object

- result_name: the name of an array or string in the result object
- search_term: a string or RegExp object

### More Examples

#### Store Results:

```js
results.add(this, {pass: 'some_test'})
results.add(this, {pass: 'some_test(with reason)'})
results.add(this, { pass: 'some_test' })
results.add(this, { pass: 'some_test(with reason)' })
```

#### Retrieve exact match with **get**:

```js
if (results.get('plugin_name').pass.indexOf('some_test') !== -1) {
// some_test passed (1x)
}
if (results.get('plugin_name').pass.indexOf('some_test') !== -1) {
// some_test passed (1x)
}
```

#### Retrieve a string match with **has**

```js
if (results.has('plugin_name', 'pass', 'some_test')) {
// some_test passed (1x)
}
if (results.has('plugin_name', 'pass', 'some_test')) {
// some_test passed (1x)
}
```

The syntax for using **has** is a little more pleasant.

Both options require one to check for each reason which is unpleasant when
and all we really want to know is if some\_test passed or not.
and all we really want to know is if some_test passed or not.

#### Retrieve a matching pattern:

```js
if (results.has('plugin_name', 'pass', /^some_test/)) {
// some_test passed (2x)
}
if (results.has('plugin_name', 'pass', /^some_test/)) {
// some_test passed (2x)
}
```

### Private Results
Expand All @@ -214,7 +210,7 @@ human_html output, prefix the name of the key with an underscore.
Example:

```js
results.add(this, { _hidden: 'some data' })
results.add(this, { _hidden: 'some data' })
```

## Redis Pub/Sub
Expand All @@ -229,29 +225,27 @@ This is from the karma plugin subscribing on the `connect_init` hook:

```js
exports.register = function (next, server) {
this.inherits('redis')
this.inherits('redis')

register_hook('connect_init', 'redis_subscribe');
register_hook('disconnect', 'redis_unsubscribe');
register_hook('connect_init', 'redis_subscribe')
register_hook('disconnect', 'redis_unsubscribe')
}

exports.redis_subscribe = function (next, connection) {

this.redis_subscribe(connection, function () {
connection.notes.redis.on('pmessage', (pattern, channel, message) => {
// do stuff with messages that look like this
// {"plugin":"karma","result":{"fail":"spamassassin.hits"}}
// {"plugin":"geoip","result":{"country":"CN"}}
})
next()
this.redis_subscribe(connection, function () {
connection.notes.redis.on('pmessage', (pattern, channel, message) => {
// do stuff with messages that look like this
// {"plugin":"karma","result":{"fail":"spamassassin.hits"}}
// {"plugin":"geoip","result":{"country":"CN"}}
})
next()
})
}
exports.redis_unsubscribe = function (next, connection) {
this.redis_unsubscribe(connection)
this.redis_unsubscribe(connection)
}
```


[ci-img]: https://github.com/haraka/haraka-results/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/haraka/haraka-results/actions/workflows/ci.yml
[cov-img]: https://codecov.io/github/haraka/haraka-results/coverage.svg
Expand Down
Loading

0 comments on commit f41c235

Please sign in to comment.