Installations
npm install aedes-cached-persistence
Developer
moscajs
Developer Guide
Module System
CommonJS
Min. Node Version
>=14
Typescript Support
Yes
Node Version
16.3.0
NPM Version
7.15.1
Statistics
5 Stars
109 Commits
12 Forks
8 Watching
1 Branches
8 Contributors
Updated on 18 Sept 2024
Languages
JavaScript (76.47%)
TypeScript (23.53%)
Total Downloads
Cumulative downloads
Total Downloads
546,997
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
aedes-cached-persistence
Abstract class to write an Aedes persistence with in-process caching of subscriptions. It implements the API defined by aedes-persistence.
Install
To install aedes-cached-persistence, simply use npm:
1npm install aedes-cached-persistence --save
Provided methods
CachedPersistence()
instance.subscriptionsByTopic()
instance.cleanSubscriptions()
instance.destroy()
Implement another persistence
Inheritance
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}
Tests
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})
License
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
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
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
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/moscajs/aedes-cached-persistence/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/moscajs/aedes-cached-persistence/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/moscajs/aedes-cached-persistence/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/moscajs/aedes-cached-persistence/ci.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:26
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 25 are checked with a SAST tool
Score
4.1
/10
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