Gathering detailed insights and metrics for aedes-cached-persistence
Gathering detailed insights and metrics for aedes-cached-persistence
Gathering detailed insights and metrics for aedes-cached-persistence
Gathering detailed insights and metrics for aedes-cached-persistence
npm install aedes-cached-persistence
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
5 Stars
109 Commits
12 Forks
8 Watching
1 Branches
8 Contributors
Updated on 18 Sept 2024
JavaScript (76.47%)
TypeScript (23.53%)
Cumulative downloads
Total Downloads
Last day
56.2%
859
Compared to previous day
Last week
81.9%
5,644
Compared to previous week
Last month
29.5%
16,107
Compared to previous month
Last year
-11.1%
135,718
Compared to previous year
Abstract class to write an Aedes persistence with in-process caching of subscriptions. It implements the API defined by aedes-persistence.
To install aedes-cached-persistence, simply use npm:
1npm install aedes-cached-persistence --save
CachedPersistence()
instance.subscriptionsByTopic()
instance.cleanSubscriptions()
instance.destroy()
In order to reuse aedes-cached-persistence, you need to:
1const CachedPersistence = require('aedes-cached-persistence') 2 3// if you need http://npm.im/aedes-packet, it is available 4// from this module as well 5// const { Packet } = CachedPersistence 6 7class MyPersistence extends CachedPersistence { 8 constructor(opts) { 9 super(opts) 10 } 11 addSubscriptions(client, subs, cb) { 12 // ..persistence specific implementation.. 13 // call super._addedSubscriptions when you are done 14 super._addedSubscriptions(client, subs.map(mapSub), cb) 15 } 16 removeSubscriptions(client, subs, cb) { 17 // ..persistence specific implementation.. 18 // call super._removedSubscriptions when you are done 19 super._removedSubscriptions(client, subs.map(mapSub), cb) 20 } 21} 22 23function mapSub (sub) { 24 return { topic: sub.topic } 25}
A persistence needs to pass all tests defined in ./abstract.js. You can import and use that test suite in the following manner:
1var test = require('tape').test 2var myperst = require('./') 3var abs = require('aedes-cached-persistence/abstract') 4 5abs({ 6 test: test, 7 persistence: myperst 8})
If you require some async stuff before returning, a callback is also supported:
1var test = require('tape').test 2var myperst = require('./') 3var abs = require('aedes-persistence/abstract') 4var clean = require('./clean') // invented module 5 6abs({ 7 test: test, 8 buildEmitter: require('mymqemitter'), // optional 9 persistence: function build (cb) { 10 clean(function (err) { 11 cb(err, myperst()) 12 }) 13 } 14})
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 14/20 approved changesets -- score normalized to 7
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More