aedes 0.51.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/actions/sticky-pr-comment/action.yml +55 -0
- package/.github/workflows/benchmark-compare-serial.yml +60 -0
- package/.github/workflows/ci.yml +12 -17
- package/.release-it.json +18 -0
- package/.taprc +15 -6
- package/README.md +6 -4
- package/aedes.d.ts +0 -6
- package/aedes.js +270 -242
- package/benchmarks/README.md +33 -0
- package/benchmarks/pingpong.js +94 -25
- package/benchmarks/receiver.js +77 -0
- package/benchmarks/report.js +150 -0
- package/benchmarks/runBenchmarks.js +118 -0
- package/benchmarks/sender.js +86 -0
- package/benchmarks/server.js +19 -18
- package/checkVersion.js +20 -0
- package/docs/Aedes.md +66 -8
- package/docs/Client.md +3 -4
- package/docs/Examples.md +39 -22
- package/docs/MIGRATION.md +50 -0
- package/eslint.config.js +8 -0
- package/example.js +51 -40
- package/examples/clusters/index.js +28 -23
- package/examples/clusters/package.json +10 -6
- package/lib/client.js +405 -306
- package/lib/handlers/connect.js +42 -38
- package/lib/handlers/index.js +9 -11
- package/lib/handlers/ping.js +2 -3
- package/lib/handlers/puback.js +5 -5
- package/lib/handlers/publish.js +29 -14
- package/lib/handlers/pubrec.js +9 -17
- package/lib/handlers/pubrel.js +34 -25
- package/lib/handlers/subscribe.js +47 -43
- package/lib/handlers/unsubscribe.js +16 -19
- package/lib/qos-packet.js +14 -17
- package/lib/utils.js +5 -12
- package/lib/write.js +4 -5
- package/package.json +134 -136
- package/test/auth.js +468 -804
- package/test/basic.js +613 -575
- package/test/bridge.js +44 -40
- package/test/client-pub-sub.js +531 -504
- package/test/close_socket_by_other_party.js +137 -102
- package/test/connect.js +487 -484
- package/test/drain-timeout.js +593 -0
- package/test/drain-toxiproxy.js +620 -0
- package/test/events.js +173 -145
- package/test/helper.js +351 -73
- package/test/keep-alive.js +40 -67
- package/test/meta.js +257 -210
- package/test/not-blocking.js +93 -197
- package/test/qos1.js +464 -554
- package/test/qos2.js +308 -393
- package/test/regr-21.js +39 -21
- package/test/require.cjs +22 -0
- package/test/retain.js +349 -398
- package/test/topics.js +176 -183
- package/test/types/aedes.test-d.ts +4 -8
- package/test/will.js +310 -428
- package/types/instance.d.ts +40 -35
- package/types/packet.d.ts +10 -10
- package/.coveralls.yml +0 -1
- package/benchmarks/bombing.js +0 -34
- package/benchmarks/bombingQoS1.js +0 -36
- package/benchmarks/throughputCounter.js +0 -23
- package/benchmarks/throughputCounterQoS1.js +0 -33
- package/types/.eslintrc.json +0 -47
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: "Sticky PR Comment"
|
|
2
|
+
description: "Posts or updates a pull request comment identified by a tag."
|
|
3
|
+
inputs:
|
|
4
|
+
file:
|
|
5
|
+
description: "Path to the file whose contents are to be posted"
|
|
6
|
+
required: true
|
|
7
|
+
tag:
|
|
8
|
+
description: "Unique tag to identify the comment (e.g. <!-- BENCHMARK_REPORT_COMMENT -->)"
|
|
9
|
+
required: true
|
|
10
|
+
runs:
|
|
11
|
+
using: "composite"
|
|
12
|
+
steps:
|
|
13
|
+
- name: Read file and set as output
|
|
14
|
+
id: file
|
|
15
|
+
shell: bash
|
|
16
|
+
run: |
|
|
17
|
+
echo "body<<EOF" >> $GITHUB_OUTPUT
|
|
18
|
+
cat "${{ inputs.file }}" >> $GITHUB_OUTPUT
|
|
19
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
20
|
+
|
|
21
|
+
- name: Post or update PR comment
|
|
22
|
+
uses: actions/github-script@v7
|
|
23
|
+
with:
|
|
24
|
+
github-token: ${{ github.token }}
|
|
25
|
+
script: |
|
|
26
|
+
const tag = `${{ inputs.tag }}`;
|
|
27
|
+
const body = `${tag}\n${{ steps.file.outputs.body }}`;
|
|
28
|
+
const pr = context.payload.pull_request?.number;
|
|
29
|
+
if (!pr) {
|
|
30
|
+
core.setFailed("No pull request found in context.");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const { data: comments } = await github.rest.issues.listComments({
|
|
34
|
+
owner: context.repo.owner,
|
|
35
|
+
repo: context.repo.repo,
|
|
36
|
+
issue_number: pr,
|
|
37
|
+
});
|
|
38
|
+
const tagged = comments.find(comment =>
|
|
39
|
+
comment.body.includes(tag)
|
|
40
|
+
);
|
|
41
|
+
if (tagged) {
|
|
42
|
+
await github.rest.issues.updateComment({
|
|
43
|
+
owner: context.repo.owner,
|
|
44
|
+
repo: context.repo.repo,
|
|
45
|
+
comment_id: tagged.id,
|
|
46
|
+
body: body,
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
await github.rest.issues.createComment({
|
|
50
|
+
owner: context.repo.owner,
|
|
51
|
+
repo: context.repo.repo,
|
|
52
|
+
issue_number: pr,
|
|
53
|
+
body: body,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: "Benchmark Report"
|
|
2
|
+
|
|
3
|
+
description: "Runs benchmarks and posts or updates a sticky PR comment with the results."
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
pull_request:
|
|
7
|
+
types: [opened, synchronize, reopened]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
benchmark:
|
|
14
|
+
name: Benchmark
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
env:
|
|
17
|
+
nodeVersion: 20
|
|
18
|
+
mainRef: "main"
|
|
19
|
+
steps:
|
|
20
|
+
- name: Set up Node.js
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ env.nodeVersion }}
|
|
24
|
+
|
|
25
|
+
# Run benchmark on main branch
|
|
26
|
+
- name: Checkout main branch
|
|
27
|
+
uses: actions/checkout@v4
|
|
28
|
+
with:
|
|
29
|
+
ref: ${{ env.mainRef }}
|
|
30
|
+
path: main-source
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies (main)
|
|
33
|
+
run: npm install --ignore-scripts
|
|
34
|
+
working-directory: main-source
|
|
35
|
+
|
|
36
|
+
- name: Run benchmark on main
|
|
37
|
+
run: node benchmarks/runBenchmarks.js > ../results.main.csv
|
|
38
|
+
working-directory: main-source
|
|
39
|
+
|
|
40
|
+
# Run benchmark on PR branch
|
|
41
|
+
- name: Checkout PR branch
|
|
42
|
+
uses: actions/checkout@v4
|
|
43
|
+
with:
|
|
44
|
+
path: pr-source
|
|
45
|
+
|
|
46
|
+
- name: Install dependencies (PR)
|
|
47
|
+
run: npm install --ignore-scripts
|
|
48
|
+
working-directory: pr-source
|
|
49
|
+
|
|
50
|
+
- name: Run benchmark on PR branch
|
|
51
|
+
run: node benchmarks/runBenchmarks.js > ../results.branch.csv
|
|
52
|
+
working-directory: pr-source
|
|
53
|
+
|
|
54
|
+
# Generate the report
|
|
55
|
+
- name: Generate report
|
|
56
|
+
shell: bash
|
|
57
|
+
run: |
|
|
58
|
+
cat results.main.csv results.branch.csv | node main-source/benchmarks/report.js >> $GITHUB_STEP_SUMMARY
|
|
59
|
+
|
|
60
|
+
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -31,7 +31,7 @@ jobs:
|
|
|
31
31
|
runs-on: ${{ matrix.os }}
|
|
32
32
|
strategy:
|
|
33
33
|
matrix:
|
|
34
|
-
node-version: [
|
|
34
|
+
node-version: [ 20, 22, 24]
|
|
35
35
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
36
36
|
fail-fast: false
|
|
37
37
|
steps:
|
|
@@ -59,20 +59,15 @@ jobs:
|
|
|
59
59
|
- name: Run tests
|
|
60
60
|
run: |
|
|
61
61
|
npm run test:ci
|
|
62
|
-
|
|
63
|
-
- name:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
parallel: true
|
|
68
|
-
flag-name: run-${{ matrix.node-version }}-${{ matrix.os }}
|
|
69
|
-
|
|
70
|
-
coverage:
|
|
71
|
-
needs: test
|
|
72
|
-
runs-on: ubuntu-latest
|
|
73
|
-
steps:
|
|
74
|
-
- name: Coveralls Finished
|
|
75
|
-
uses: coverallsapp/github-action@master
|
|
62
|
+
|
|
63
|
+
- name: Upload coverage reports to Codecov
|
|
64
|
+
# only let the first job upload coverage info
|
|
65
|
+
if: strategy.job-index == 0
|
|
66
|
+
uses: codecov/codecov-action@v5
|
|
76
67
|
with:
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
directory: coverage
|
|
69
|
+
fail_ci_if_error: true
|
|
70
|
+
flags: unittests
|
|
71
|
+
name: codecov-aedes
|
|
72
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
73
|
+
verbose: true
|
package/.release-it.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/release-it@19/schema/release-it.json",
|
|
3
|
+
"github": {
|
|
4
|
+
"release": true
|
|
5
|
+
},
|
|
6
|
+
"git": {
|
|
7
|
+
"tagName": "v${version}",
|
|
8
|
+
"requireBranch": "main"
|
|
9
|
+
},
|
|
10
|
+
"hooks": {
|
|
11
|
+
"before:init": [
|
|
12
|
+
"npm run test:ci"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"npm": {
|
|
16
|
+
"publish": true
|
|
17
|
+
}
|
|
18
|
+
}
|
package/.taprc
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
coverage: true
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
# vim: set filetype=yaml :
|
|
2
|
+
coverage-report:
|
|
3
|
+
- text
|
|
4
|
+
allow-incomplete-coverage: true
|
|
5
|
+
browser: false
|
|
6
|
+
timeout: 60
|
|
7
|
+
include:
|
|
8
|
+
- "**/@(test?(s)|__test?(s)__)/**/*.@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
|
|
9
|
+
- "**/*.@(test?(s)|spec).@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
|
|
10
|
+
- "**/test?(s).@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
|
|
11
|
+
exclude:
|
|
12
|
+
- "**/@(fixture*(s)|dist)/**"
|
|
13
|
+
snapshot-clean-cwd: true
|
|
14
|
+
color: true
|
|
15
|
+
reporter: tap
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://standardjs.com/)
|
|
6
6
|
[](https://github.com/moscajs/aedes/graphs/commit-activity)
|
|
7
7
|
[](https://github.com/moscajs/aedes/pulls)\
|
|
8
|
-
[](https://codecov.io/gh/moscajs/aedes)
|
|
9
9
|
[](https://snyk.io/test/github/moscajs/aedes)\
|
|
10
10
|

|
|
11
11
|
[](https://www.npmjs.com/aedes)
|
|
@@ -22,6 +22,7 @@ Barebone MQTT server that can run on any stream servers
|
|
|
22
22
|
- [Features](#features)
|
|
23
23
|
- [Examples](#examples)
|
|
24
24
|
- [Clusters](#clusters)
|
|
25
|
+
- [Bridge connections](#bridge-connections)
|
|
25
26
|
- [Extensions](#extensions)
|
|
26
27
|
- [Middleware Plugins](#middleware-plugins)
|
|
27
28
|
- [Persistence](#persistence)
|
|
@@ -37,6 +38,7 @@ Barebone MQTT server that can run on any stream servers
|
|
|
37
38
|
- [Made with Aedes](#made-with-aedes)
|
|
38
39
|
- [Collaborators](#collaborators)
|
|
39
40
|
- [Contribution](#contribution)
|
|
41
|
+
- [Security notice](#security-notice)
|
|
40
42
|
- [Support](#support)
|
|
41
43
|
- [Backers](#backers)
|
|
42
44
|
- [Sponsors](#sponsors)
|
|
@@ -52,12 +54,12 @@ npm install aedes
|
|
|
52
54
|
|
|
53
55
|
## Docker
|
|
54
56
|
|
|
55
|
-
Check Docker docs
|
|
57
|
+
Check the [Docker docs](https://github.com/moscajs/aedes-cli#docker)
|
|
56
58
|
|
|
57
59
|
## API
|
|
58
60
|
|
|
59
|
-
- [Aedes
|
|
60
|
-
- [Client
|
|
61
|
+
- [Aedes class](./docs/Aedes.md)
|
|
62
|
+
- [Client class](./docs/Client.md)
|
|
61
63
|
|
|
62
64
|
## Features
|
|
63
65
|
|
package/aedes.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import Aedes, { AedesOptions } from './types/instance'
|
|
2
|
-
|
|
3
|
-
export declare function createBroker(options?: AedesOptions): Aedes
|
|
4
|
-
|
|
5
1
|
export * from './types/instance'
|
|
6
2
|
export * from './types/packet'
|
|
7
3
|
export * from './types/client'
|
|
8
|
-
|
|
9
|
-
export { default } from './types/instance'
|