aedes-persistence
Advanced tools
+100
-31
@@ -246,9 +246,18 @@ const { Readable } = require('stream') | ||
| topic: 'hello', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }, { | ||
| topic: 'matteo', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }, { | ||
| topic: 'noqos', | ||
| qos: 0 | ||
| qos: 0, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }] | ||
@@ -272,6 +281,12 @@ | ||
| topic: 'hello', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }, { | ||
| topic: 'matteo', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }] | ||
@@ -289,3 +304,6 @@ | ||
| topic: 'matteo', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }]) | ||
@@ -302,9 +320,18 @@ instance.destroy(t.end.bind(t)) | ||
| topic: 'hello', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }, { | ||
| topic: 'hello/#', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }, { | ||
| topic: 'matteo', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }] | ||
@@ -319,7 +346,13 @@ | ||
| topic: 'hello/#', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }, { | ||
| clientId: client.id, | ||
| topic: 'hello', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }]) | ||
@@ -404,9 +437,18 @@ instance.destroy(t.end.bind(t)) | ||
| topic: 'hello', | ||
| qos: 0 | ||
| qos: 0, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }, { | ||
| topic: 'hello/#', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }, { | ||
| topic: 'matteo', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }] | ||
@@ -424,3 +466,6 @@ | ||
| topic: 'hello/#', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }]) | ||
@@ -497,6 +542,12 @@ instance.destroy(t.end.bind(t)) | ||
| topic: 'hello', | ||
| qos: 0 | ||
| qos: 0, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }, { | ||
| topic: 'hello', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }] | ||
@@ -512,3 +563,6 @@ | ||
| topic: 'hello', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }]) | ||
@@ -521,3 +575,6 @@ | ||
| topic: 'hello', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }]) | ||
@@ -540,4 +597,4 @@ | ||
| const topic = 'hello' | ||
| const sub = { topic } | ||
| const subByTopic = { clientId: client.id, topic } | ||
| const sub = { topic, rh: 0, rap: true, nl: false } | ||
| const subByTopic = { clientId: client.id, topic, rh: 0, rap: true, nl: false } | ||
@@ -587,7 +644,7 @@ function check (qos, cb) { | ||
| const subs = [ | ||
| { topic, qos: 0 }, | ||
| { topic, qos: 1 }, | ||
| { topic, qos: 2 }, | ||
| { topic, qos: 1 }, | ||
| { topic, qos: 0 } | ||
| { topic, qos: 0, rh: 0, rap: true, nl: false }, | ||
| { topic, qos: 1, rh: 0, rap: true, nl: false }, | ||
| { topic, qos: 2, rh: 0, rap: true, nl: false }, | ||
| { topic, qos: 1, rh: 0, rap: true, nl: false }, | ||
| { topic, qos: 0, rh: 0, rap: true, nl: false } | ||
| ] | ||
@@ -599,3 +656,3 @@ instance.addSubscriptions(client, subs, (err, reClient) => { | ||
| t.error(err, 'no error') | ||
| t.deepEqual(subsForClient, [{ topic, qos: 0 }]) | ||
| t.deepEqual(subsForClient, [{ topic, qos: 0, rh: 0, rap: true, nl: false }]) | ||
| instance.subscriptionsByTopic(topic, (err, subsForTopic) => { | ||
@@ -745,3 +802,6 @@ t.error(err, 'no error') | ||
| topic, | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }] | ||
@@ -771,3 +831,6 @@ | ||
| topic, | ||
| qos: 0 | ||
| qos: 0, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }] | ||
@@ -795,7 +858,13 @@ | ||
| topic: 'hello1', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }] | ||
| const subs2 = [{ | ||
| topic: 'hello2', | ||
| qos: 1 | ||
| qos: 1, | ||
| rh: 0, | ||
| rap: true, | ||
| nl: false | ||
| }] | ||
@@ -802,0 +871,0 @@ let calls = 2 |
+2
-2
| { | ||
| "name": "aedes-persistence", | ||
| "version": "9.0.3", | ||
| "version": "9.1.0", | ||
| "description": "The spec for an Aedes persistence, with abstract tests and a fast in-memory implementation.", | ||
@@ -78,4 +78,4 @@ "main": "persistence.js", | ||
| "aedes-packet": "^2.3.1", | ||
| "qlobber": "^6.0.0" | ||
| "qlobber": "^7.0.0" | ||
| } | ||
| } |
+15
-14
@@ -59,3 +59,3 @@ const { Readable } = require('stream') | ||
| this.#retained = new Map() | ||
| // Map ( clientId -> Map( topic -> qos )) | ||
| // Map ( clientId -> Map( topic -> { qos, rh, rap, nl } )) | ||
| this.#subscriptions = new Map() | ||
@@ -104,4 +104,3 @@ // Map ( clientId > [ packet ] } | ||
| for (const sub of subs) { | ||
| const qos = stored.get(sub.topic) | ||
| const hasQoSGreaterThanZero = (qos !== undefined) && (qos > 0) | ||
| const storedSub = stored.get(sub.topic) | ||
| if (sub.qos > 0) { | ||
@@ -111,5 +110,8 @@ trie.add(sub.topic, { | ||
| topic: sub.topic, | ||
| qos: sub.qos | ||
| qos: sub.qos, | ||
| rh: sub.rh, | ||
| rap: sub.rap, | ||
| nl: sub.nl | ||
| }) | ||
| } else if (hasQoSGreaterThanZero) { | ||
| } else if (storedSub?.qos > 0) { | ||
| trie.remove(sub.topic, { | ||
@@ -120,3 +122,3 @@ clientId: client.id, | ||
| } | ||
| stored.set(sub.topic, sub.qos) | ||
| stored.set(sub.topic, { qos: sub.qos, rh: sub.rh, rap: sub.rap, nl: sub.nl }) | ||
| } | ||
@@ -133,5 +135,5 @@ | ||
| for (const topic of subs) { | ||
| const qos = stored.get(topic) | ||
| if (qos !== undefined) { | ||
| if (qos > 0) { | ||
| const storedSub = stored.get(topic) | ||
| if (storedSub !== undefined) { | ||
| if (storedSub.qos > 0) { | ||
| trie.remove(topic, { clientId: client.id, topic }) | ||
@@ -157,4 +159,4 @@ } | ||
| subs = [] | ||
| for (const topicAndQos of stored) { | ||
| subs.push({ topic: topicAndQos[0], qos: topicAndQos[1] }) | ||
| for (const [topic, storedSub] of stored) { | ||
| subs.push({ topic, ...storedSub }) | ||
| } | ||
@@ -178,5 +180,4 @@ } | ||
| if (stored) { | ||
| for (const topicAndQos of stored) { | ||
| if (topicAndQos[1] > 0) { | ||
| const topic = topicAndQos[0] | ||
| for (const [topic, storedSub] of stored) { | ||
| if (storedSub.qos > 0) { | ||
| trie.remove(topic, { clientId: client.id, topic }) | ||
@@ -183,0 +184,0 @@ } |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
78629
1.87%2102
3.44%+ Added
- Removed
Updated