node-red-contrib-aedes 0.7.0 → 0.8.2

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.
@@ -9,7 +9,7 @@ jobs:
9
9
 
10
10
  strategy:
11
11
  matrix:
12
- node-version: [12.x, 14.x, 16.x]
12
+ node-version: [14.x, 16.x, 18.x]
13
13
 
14
14
  steps:
15
15
  - uses: actions/checkout@v2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # node-red-contrib-aedes Changelog
2
2
 
3
+ ## Jun 03, 2022, Version 0.8.2
4
+ ### Notable changes
5
+ - Fix Scorecard Warnings
6
+
7
+ ## May 29, 2022, Version 0.8.1
8
+ ### Notable changes
9
+ - Fix issue with incomplete credentials
10
+
11
+ ## May 22, 2022, Version 0.8
12
+ ### Notable changes
13
+ - Update aedes to version 0.47
14
+
15
+ ## Feb 18, 2022, Version 0.7
16
+ ### Notable changes
17
+ - Fix Close Time Out Issue
3
18
  ## Oct 17, 2021, Version 0.6
4
19
  ### Notable changes
5
20
  - Add output node for publish events
package/README.md CHANGED
@@ -6,8 +6,10 @@ You can use the MQTT protocol in Node-RED without an external MQTT broker like M
6
6
  ![Node.js CI](https://github.com/martin-doyle/node-red-contrib-aedes/workflows/Node.js%20CI/badge.svg)
7
7
  [![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/standard/semistandard)
8
8
  [![Codacy Badge](https://api.codacy.com/project/badge/Grade/898bf62b040a4d999b150487e9cc837b)](https://www.codacy.com/manual/martin-doyle/node-red-contrib-aedes?utm_source=github.com&utm_medium=referral&utm_content=martin-doyle/node-red-contrib-aedes&utm_campaign=Badge_Grade)
9
+ <!--
9
10
  [![Dependency Status](https://david-dm.org/martin-doyle/node-red-contrib-aedes.svg)](https://david-dm.org/martin-doyle/node-red-contrib-aedes)
10
11
  [![devDependency Status](https://david-dm.org/martin-doyle/node-red-contrib-aedes/dev-status.svg)](https://david-dm.org/martin-doyle/node-red-contrib-aedes#info=devDependencies)
12
+ -->
11
13
  [![Open Source Love](https://badges.frapsoft.com/os/mit/mit.svg?v=102)](https://github.com/ellerbrock/open-source-badge/)
12
14
  [![NPM version](https://img.shields.io/npm/v/node-red-contrib-aedes.svg?style=flat)](https://www.npmjs.com/node-red-contrib-aedes)
13
15
 
package/aedes.js CHANGED
@@ -169,7 +169,7 @@ module.exports = function (RED) {
169
169
 
170
170
  if (this.credentials && this.username && this.password) {
171
171
  const authenticate = function (client, username, password, callback) {
172
- const authorized = (username === node.username && password.toString() === node.password);
172
+ const authorized = (username === node.username && password && password.toString() === node.password);
173
173
  if (authorized) {
174
174
  client.user = username;
175
175
  }
@@ -0,0 +1 @@
1
+ [{"id":"2968a4fcf75e9496","type":"tab","label":"Aedes","disabled":false,"info":"","env":[]},{"id":"71f56412e0a1bd0b","type":"debug","z":"2968a4fcf75e9496","name":"Aedes Events","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":480,"y":300,"wires":[]},{"id":"94a8707a2c4a4308","type":"aedes broker","z":"2968a4fcf75e9496","name":"Aedes MQTT Broker","mqtt_port":"1884","mqtt_ws_bind":"port","mqtt_ws_port":"","mqtt_ws_path":"","cert":"","key":"","certname":"","keyname":"","dburl":"","usetls":false,"x":270,"y":320,"wires":[["71f56412e0a1bd0b"],["30bcabc71382bd19"]]},{"id":"30bcabc71382bd19","type":"debug","z":"2968a4fcf75e9496","name":"Aedes Publish Events","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":500,"y":340,"wires":[]},{"id":"a92eb1e50a7e0fb2","type":"inject","z":"2968a4fcf75e9496","name":"MQTT Message","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"test","payload":"Test","payloadType":"str","x":280,"y":180,"wires":[["4195ccca2060a2c5"]]},{"id":"4195ccca2060a2c5","type":"mqtt out","z":"2968a4fcf75e9496","name":"MQTT Publisher","topic":"test","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"47a469b15c9c5f27","x":480,"y":180,"wires":[]},{"id":"5ce36754784a00e0","type":"mqtt in","z":"2968a4fcf75e9496","name":"MQTT Subscriber","topic":"test","qos":"0","datatype":"auto","broker":"47a469b15c9c5f27","nl":false,"rap":true,"rh":0,"inputs":0,"x":280,"y":240,"wires":[["ed51b3734a88ef79"]]},{"id":"ed51b3734a88ef79","type":"debug","z":"2968a4fcf75e9496","name":"MQTT Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":480,"y":240,"wires":[]},{"id":"47a469b15c9c5f27","type":"mqtt-broker","name":"","broker":"localhost","port":"1884","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
package/package.json CHANGED
@@ -1,24 +1,28 @@
1
1
  {
2
2
  "name": "node-red-contrib-aedes",
3
- "version": "0.7.0",
3
+ "version": "0.8.2",
4
4
  "description": "Node Red MQTT broker node based on aedes.js",
5
5
  "dependencies": {
6
- "aedes": "^0.46.3",
7
- "aedes-persistence-mongodb": "^8.2.0",
6
+ "aedes": "^0.47.0",
7
+ "aedes-persistence-mongodb": "^9.0.0",
8
8
  "websocket-stream": "^5.5.2"
9
9
  },
10
10
  "devDependencies": {
11
- "mqtt": "^4.2.6",
11
+ "mqtt": "^4.3.7",
12
12
  "node-red-node-test-helper": "^0.2.7"
13
13
  },
14
14
  "scripts": {
15
15
  "test": "semistandard --verbose | snazzy && mocha test/**/*.js --exit"
16
16
  },
17
17
  "node-red": {
18
+ "version": ">=2.0.0",
18
19
  "nodes": {
19
20
  "aedes-mqtt-broker": "aedes.js"
20
21
  }
21
22
  },
23
+ "engines": {
24
+ "node": ">=12.0.0"
25
+ },
22
26
  "repository": {
23
27
  "type": "git",
24
28
  "url": "git+https://github.com/martin-doyle/node-red-contrib-aedes.git"
@@ -5,6 +5,9 @@ const aedesNode = require('../aedes.js');
5
5
  const mqttNode = require('../node_modules/node-red/node_modules/@node-red/nodes/core/network/10-mqtt.js');
6
6
  const mqtt = require('mqtt/mqtt.js');
7
7
 
8
+ const credentialsOK = { n1: { username: 'test', password: 'test' }, b1: { user: 'test', password: 'test' } };
9
+ const credentialsMissing = { n1: { username: 'test', password: 'test' }, b1: { user: 'test' } };
10
+
8
11
  helper.init(require.resolve('node-red'));
9
12
 
10
13
  describe('Aedes Broker TCP tests', function () {
@@ -70,8 +73,87 @@ describe('Aedes Broker TCP tests', function () {
70
73
  msg.should.have.property('topic', 'clientReady');
71
74
  done();
72
75
  });
73
- }
74
- );
76
+ });
77
+ });
78
+
79
+ it('should not connect an mqtt client with missing authentication', function (done) {
80
+ this.timeout(10000); // have to wait for the inject with delay of 10 seconds
81
+ const flow = [
82
+ {
83
+ id: 'n1',
84
+ type: 'aedes broker',
85
+ mqtt_port: '1883',
86
+ name: 'Aedes 1883',
87
+ wires: [
88
+ ['n2'], []
89
+ ]
90
+ },
91
+ {
92
+ id: 'n2',
93
+ type: 'helper'
94
+ }, {
95
+ id: 'n3',
96
+ type: 'mqtt in',
97
+ name: 'Aedes1 1883',
98
+ topic: 'test1883',
99
+ broker: 'b1'
100
+ }, {
101
+ id: 'b1',
102
+ type: 'mqtt-broker',
103
+ name: 'Broker',
104
+ broker: 'localhost',
105
+ port: '1883'
106
+ }
107
+ ];
108
+
109
+ helper.load([aedesNode, mqttNode], flow, credentialsMissing,
110
+ function () {
111
+ const n2 = helper.getNode('n2');
112
+ n2.on('input', function (msg) {
113
+ msg.should.have.property('topic', 'clientError');
114
+ done();
115
+ });
116
+ });
117
+ });
118
+
119
+ it('should connect an mqtt client with authentication', function (done) {
120
+ this.timeout(10000); // have to wait for the inject with delay of 10 seconds
121
+ const flow = [
122
+ {
123
+ id: 'n1',
124
+ type: 'aedes broker',
125
+ mqtt_port: '1883',
126
+ name: 'Aedes 1883',
127
+ wires: [
128
+ ['n2'], []
129
+ ]
130
+ },
131
+ {
132
+ id: 'n2',
133
+ type: 'helper'
134
+ }, {
135
+ id: 'n3',
136
+ type: 'mqtt in',
137
+ name: 'Aedes1 1883',
138
+ topic: 'test1883',
139
+ broker: 'b1'
140
+ }, {
141
+ id: 'b1',
142
+ type: 'mqtt-broker',
143
+ name: 'Broker',
144
+ broker: 'localhost',
145
+ port: '1883'
146
+ }
147
+ ];
148
+
149
+ helper.load([aedesNode, mqttNode], flow, credentialsOK,
150
+ function () {
151
+ const n2 = helper.getNode('n2');
152
+ n2.on('input', function (msg) {
153
+ msg.should.have.property('topic', 'clientReady');
154
+ done();
155
+ });
156
+ });
75
157
  });
76
158
 
77
159
  it('a subscriber should receive a message from a publisher', function (done) {