Skip to content

Commit

Permalink
Release v1.1.0 (#23)
Browse files Browse the repository at this point in the history
- add/update DSNs from RFCs 3886, 4468, 4954
- doc(README): improve formatting, add RFCs to Reference
- doc(CONTRIBUTORS): added
  • Loading branch information
msimerson committed May 7, 2024
1 parent 2fa3d84 commit 1446f44
Show file tree
Hide file tree
Showing 14 changed files with 325 additions and 294 deletions.
14 changes: 3 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@
"env": {
"node": true,
"es6": true,
"mocha": true
"mocha": true,
"es2022": true
},
"plugins": [
"haraka"
],
"extends": [ "eslint:recommended", "plugin:haraka/recommended" ],
"root": true,
"rules": {
"indent": [2, 4, {"SwitchCase": 1}],
"console": 0,
"no-console": 0
}
"extends": ["@haraka"]
}
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "weekly"
interval: 'weekly'
allow:
- dependency-type: production
35 changes: 10 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: CI

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

env:
CI: true

jobs:

lint:
uses: haraka/.github/.github/workflows/lint.yml@master

Expand All @@ -15,27 +14,13 @@ jobs:
secrets: inherit

test:
needs: [ lint, get-lts ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
needs: [lint]
uses: haraka/.github/.github/workflows/ubuntu.yml@master

windows:
needs: [lint]
uses: haraka/.github/.github/workflows/windows.yml@master

get-lts:
runs-on: ubuntu-latest
steps:
- id: get
uses: msimerson/node-lts-versions@v1
outputs:
active: ${{ steps.get.outputs.active }}
lts: ${{ steps.get.outputs.lts }}
macos:
needs: [lint]
uses: haraka/.github/.github/workflows/macos.yml@master
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ master ]
branches: [master]
pull_request:
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 @@ -11,4 +11,4 @@ env:
jobs:
publish:
uses: haraka/.github/.github/workflows/publish.yml@master
secrets: inherit
secrets: inherit
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
index.js
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
2 changes: 1 addition & 1 deletion .release
19 changes: 14 additions & 5 deletions Changes.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
# Changelog

The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

### [1.1.0] - 2024-05-07

- add/update DSNs from RFCs 3886, 4468, 4954
- doc(README): improve formatting, add RFCs to Reference
- doc(CONTRIBUTORS): added
- dep: eslint-plugin-haraka -> @haraka/eslint-config
- chore(ci): updated to latest shared GHA configs

### 1.0.5 - 2024-04-04

- dev: only install mocha/eslint with npx, on demand
- pack: declare files to publish (shrink package) #21
- test: remove useless use of done
- ci: add on.pull_request


### 1.0.4 - 2022-06-05

- ci: update with shared GHA workflows
- ci: add node 18 testing
- ci: replace travis & appveyor with github actions


### 1.0.3 - 2020-01-17

- Use es6 classes on full - static members instead of old style `exports.stuff`
Expand All @@ -25,14 +34,14 @@
- Fix execution rights on run_tests #2
- Replaced concatenated strings with template literals #1


### 1.0.2 - 2017-09-11

- es6: use arrow functions


### 1.0.1 - 2017-09-04

- initial release


[1.0.4]: https://github.com/haraka/haraka-dsn/releases/tag/v1.0.4
[1.0.5]: https://github.com/haraka/haraka-dsn/releases/tag/v1.0.5
[1.1.0]: https://github.com/haraka/haraka-dsn/releases/tag/v1.1.0
8 changes: 8 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +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-dsn/commits?author=msimerson">26</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-dsn/commits?author=PSSGCSim">2</a>) |
| :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |

<sub>this file is maintained by [.release](https://github.com/msimerson/.release)</sub>
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,41 @@ Plugins return constants to Haraka to specify how to respond to clients for a pa

These constants include DENY, DENYSOFT and DENYDISCONNECT which automatically output an appropriate SMTP status code (e.g. 450 temporary failures for DENYSOFT or 550 permanent failures for DENY or DENYDISCONNECT) in the SMTP response sent back to the client along with an optional message text that you return as arguments to the next() function.

The [DSN](https://github.com/haraka/haraka-dsn) allows a plugin to return RFC 3463 compliant extended status codes and allows plugins to override the SMTP status code returned by Haraka.

The DSN module exposes a callable function for each status condition defined in RFC 3463.

Please refer to [RFC 3463](http://tools.ietf.org/html/rfc3463) for further information and background.
The [DSN](https://github.com/haraka/haraka-dsn) allows a plugin to return RFC compliant extended status codes and allows plugins to override the SMTP status code returned by Haraka.

The DSN module exposes a callable function for each status condition defined in the RFCs. See the References section below for further information and background.

### Using the DSN module in your plugin

Load the DSN module by adding the following line to the top of your plugin:

const DSN = require('haraka-dsn');
```js
const DSN = require('haraka-dsn')
```

Then instead of:

return next(DENY, 'No such user');
```js
next(DENY, 'No such user')
```

You can call the DSN module and return that in place of optional message argument of next():

return next(DENY, DSN.no_such_user());
```js
next(DENY, DSN.no_such_user())
```

This will cause Haraka to return the following back to the client:

550 5.1.1 No such user
`550 5.1.1 No such user`

The DSN functions are used like this:

DSN.<function name>([message], [code]);
```js
DSN.<function name>([message], [code]);
```

The function name is required and maps to the list of defined status codes in RFC 3463. All of the available functions are detailed in the table below.
The function name is required and maps to the list of defined status codes in RFC 3463. All of the available functions are detailed in the table below.

[message] is optional and should contain the message that you would like to be returned to the client, this value can be a string or an array which can contain multiple elements which will cause a multi-line reply to be sent to the client. If a message is not supplied, then the default message for the DSN function is used.

Expand Down Expand Up @@ -408,8 +413,16 @@ The function name is required and maps to the list of defined status codes in RF
</tr>
</table>

### References

- [RFC 1893](https://www.rfc-editor.org/rfc/rfc1893)
- [RFC 3463](http://tools.ietf.org/html/rfc3463)
- [RFC 3886](https://www.rfc-editor.org/rfc/rfc3886#section-3.3.4)
- [RFC 4468](https://www.rfc-editor.org/rfc/rfc4468#section-5)
- [RFC 4954](https://www.rfc-editor.org/rfc/rfc4954#section-6)

<!-- leave these buried at the bottom of the document -->

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

0 comments on commit 1446f44

Please sign in to comment.