Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: modernize dependencies #56

Merged
merged 3 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: ['lts/-1', 'lts/*', 'node']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# aedes-cached-persistence
![](https://github.com/moscajs/aedes-cached-persistence/workflows/ci.yml/badge.svg)
[![Dependencies Status](https://david-dm.org/moscajs/aedes-cached-persistence/status.svg)](https://david-dm.org/moscajs/aedes-cached-persistence)
[![devDependencies Status](https://david-dm.org/moscajs/aedes-cached-persistence/dev-status.svg)](https://david-dm.org/moscajs/aedes-cached-persistence?type=dev)
<br/>
[![Known Vulnerabilities](https://snyk.io/test/github/moscajs/aedes-cached-persistence/badge.svg)](https://snyk.io/test/github/moscajs/aedes-cached-persistence)
[![Coverage Status](https://coveralls.io/repos/moscajs/aedes-cached-persistence/badge.svg?branch=master&service=github)](https://coveralls.io/github/moscajs/aedes-cached-persistence?branch=master)
Expand Down
2 changes: 0 additions & 2 deletions abstract.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict'

const parent = require('aedes-persistence/abstract')

module.exports = parent
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('neostandard')({})
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const QlobberSub = require('qlobber/aedes/qlobber-sub')
const { Packet } = require('aedes-persistence')
const MultiStream = require('multistream')
const parallel = require('fastparallel')
const { EventEmitter } = require('events')
const { EventEmitter } = require('node:events')
const QlobberOpts = {
wildcard_one: '+',
wildcard_some: '#',
Expand Down Expand Up @@ -154,8 +154,8 @@ class CachedPersistence extends EventEmitter {
cleanSubscriptions (client, cb) {
this.subscriptionsByClient(client, (err, subs, client) => {
if (err || !subs) { return cb(err, client) }
subs = subs.map(subToTopic)
this.removeSubscriptions(client, subs, cb)
const newSubs = subs.map(subToTopic)
this.removeSubscriptions(client, newSubs, cb)
})
}

Expand Down Expand Up @@ -208,7 +208,7 @@ function subToTopic (sub) {
}

function getKey (clientId, isSub, topic) {
return clientId + '-' + (isSub ? 'sub_' : 'unsub_') + (topic || '')
return `${clientId}-${isSub ? 'sub_' : 'unsub_'}${topic || ''}`
}

module.exports = CachedPersistence
Expand Down
144 changes: 69 additions & 75 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,77 +1,71 @@
{
"name": "aedes-cached-persistence",
"version": "9.0.0",
"description": "Abstract class to write an Aedes persistence with in-process caching of subscriptions",
"main": "index.js",
"types": "types/index.d.ts",
"scripts": {
"lint": "npm run lint:standard",
"lint:standard": "standard --verbose | snazzy",
"unit": "tape test.js | faucet",
"test": "npm run lint && npm run unit && tsd",
"test:types": "tsd",
"coverage": "nyc --reporter=lcov tape test.js",
"test:ci": "npm run lint && npm run coverage",
"license-checker": "license-checker --production --onlyAllow='MIT;ISC;BSD-3-Clause;BSD-2-Clause'",
"release": "read -p 'GITHUB_TOKEN: ' GITHUB_TOKEN && export GITHUB_TOKEN=$GITHUB_TOKEN && release-it --disable-metrics"
},
"release-it": {
"github": {
"release": true
},
"git": {
"tagName": "v${version}"
},
"hooks": {
"before:init": [
"npm run test"
]
},
"npm": {
"publish": true
}
},
"pre-commit": [
"test"
],
"engines": {
"node": ">=14"
},
"repository": {
"type": "git",
"url": "git+https://github.com/moscajs/aedes-cached-persistence.git"
},
"keywords": [
"aedes",
"persistence",
"cache",
"in-memory"
],
"author": "Matteo Collina <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/moscajs/aedes-cached-persistence/issues"
},
"homepage": "https://github.com/moscajs/aedes-cached-persistence#readme",
"devDependencies": {
"aedes": "^0.46.3",
"concat-stream": "^2.0.0",
"faucet": "0.0.1",
"license-checker": "^25.0.1",
"mqemitter": "^4.5.0",
"nyc": "^15.1.0",
"pump": "^3.0.0",
"release-it": "^15.0.0",
"snazzy": "^9.0.0",
"standard": "^17.0.0",
"tape": "^5.2.1",
"through2": "^4.0.2",
"tsd": "^0.20.0"
},
"dependencies": {
"aedes-persistence": "^9.1.2",
"fastparallel": "^2.4.1",
"multistream": "^4.1.0",
"qlobber": "^7.0.0"
}
"name": "aedes-cached-persistence",
"version": "9.0.0",
"description": "Abstract class to write an Aedes persistence with in-process caching of subscriptions",
"main": "index.js",
"types": "types/index.d.ts",
"scripts": {
"lint": "eslint",
"lint:fix": "eslint --fix",
"unit": "node --test test.js",
"test": "npm run lint && npm run unit && tsd",
"test:typescript": "tsd",
"coverage": "nyc --reporter=lcov node --test test.js",
"test:ci": "npm run lint && npm run coverage && npm run test:typescript",
"license-checker": "license-checker --production --onlyAllow='MIT;ISC;BSD-3-Clause;BSD-2-Clause'",
"release": "read -p 'GITHUB_TOKEN: ' GITHUB_TOKEN && export GITHUB_TOKEN=$GITHUB_TOKEN && release-it --disable-metrics"
},
"release-it": {
"github": {
"release": true
},
"git": {
"tagName": "v${version}"
},
"hooks": {
"before:init": [
"npm run test"
]
},
"npm": {
"publish": true
}
},
"pre-commit": [
"test"
],
"engines": {
"node": ">=20"
},
"repository": {
"type": "git",
"url": "git+https://github.com/moscajs/aedes-cached-persistence.git"
},
"keywords": [
"aedes",
"persistence",
"cache",
"in-memory"
],
"author": "Matteo Collina <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/moscajs/aedes-cached-persistence/issues"
},
"homepage": "https://github.com/moscajs/aedes-cached-persistence#readme",
"devDependencies": {
"aedes": "^0.51.3",
"eslint": "^9.21.0",
"license-checker": "^25.0.1",
"neostandard": "^0.12.1",
"nyc": "^17.1.0",
"release-it": "^18.1.2",
"tsd": "^0.31.2"
},
"dependencies": {
"aedes-persistence": "^10.0.0",
"fastparallel": "^2.4.1",
"multistream": "^4.1.0",
"qlobber": "^8.0.1"
}
}
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const test = require('tape').test
const test = require('node:test')
const CachedPersistence = require('./')
const Memory = require('aedes-persistence')
const abs = require('./abstract')
Expand All @@ -16,9 +16,9 @@ class MyPersistence extends CachedPersistence {
'createRetainedStream',
'outgoingStream', 'subscriptionsByClient',
'getWill', 'streamWill', 'getClientList', 'destroy']
methods.forEach((key) => {
for (const key of methods) {
this[key] = this.backend[key].bind(this.backend)
})
}
// putWill is a special because it needs this.broker.id
this.putWill = (client, packet, cb) => {
this.backend.broker = this.broker
Expand Down
4 changes: 2 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type {
CallbackError,
Packet,
} from 'aedes-persistence';
import type { EventEmitter } from 'events';
import type { Readable } from 'stream';
import type { EventEmitter } from 'node:events';
import type { Readable } from 'node:stream';

export type { Packet } from 'aedes-persistence';

Expand Down
2 changes: 1 addition & 1 deletion types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
CallbackError,
} from 'aedes-persistence';
import { expectType } from 'tsd';
import aedesCachedPersistence, { AedesCachedPersistence, Packet } from '.';
import aedesCachedPersistence, { type AedesCachedPersistence, type Packet } from '.';

expectType<AedesCachedPersistence>(aedesCachedPersistence());

Expand Down