@libp2p/tracked-map
Advanced tools
Comparing version 3.0.2 to 3.0.3-3dfc236e
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PTrackedMap = factory()}(typeof self !== 'undefined' ? self : this, function () { | ||
"use strict";var Libp2PTrackedMap=(()=>{var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},m=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of o(e))!u.call(r,n)&&n!==t&&i(r,n,{get:()=>e[n],enumerable:!(s=p(e,n))||s.enumerable});return r};var d=r=>m(i({},"__esModule",{value:!0}),r);var h={};a(h,{trackedMap:()=>l});var c=class extends Map{constructor(e){super();let{name:t,metrics:s}=e;this.metric=s.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){let t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function l(r){let{name:e,metrics:t}=r,s;return t!=null?s=new c({name:e,metrics:t}):s=new Map,s}return d(h);})(); | ||
"use strict";var Libp2PTrackedMap=(()=>{var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},m=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of o(e))!u.call(r,n)&&n!==t&&i(r,n,{get:()=>e[n],enumerable:!(s=p(e,n))||s.enumerable});return r};var d=r=>m(i({},"__esModule",{value:!0}),r);var h={};a(h,{trackedMap:()=>l});var c=class extends Map{metric;constructor(e){super();let{name:t,metrics:s}=e;this.metric=s.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){let t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function l(r){let{name:e,metrics:t}=r,s;return t!=null?s=new c({name:e,metrics:t}):s=new Map,s}return d(h);})(); | ||
return Libp2PTrackedMap})); |
class TrackedMap extends Map { | ||
metric; | ||
constructor(init) { | ||
@@ -3,0 +4,0 @@ super(); |
111
package.json
{ | ||
"name": "@libp2p/tracked-map", | ||
"version": "3.0.2", | ||
"version": "3.0.3-3dfc236e", | ||
"description": "Allows tracking of statistics while libp2p is running", | ||
"license": "Apache-2.0 OR MIT", | ||
"homepage": "https://github.com/libp2p/js-libp2p-tracked-map#readme", | ||
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/tracked-map#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/libp2p/js-libp2p-tracked-map.git" | ||
"url": "git+https://github.com/libp2p/js-libp2p.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/libp2p/js-libp2p-tracked-map/issues" | ||
"url": "https://github.com/libp2p/js-libp2p/issues" | ||
}, | ||
@@ -17,6 +17,2 @@ "keywords": [ | ||
], | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"type": "module", | ||
@@ -42,87 +38,2 @@ "types": "./dist/src/index.d.ts", | ||
}, | ||
"release": { | ||
"branches": [ | ||
"master" | ||
], | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"preset": "conventionalcommits", | ||
"releaseRules": [ | ||
{ | ||
"breaking": true, | ||
"release": "major" | ||
}, | ||
{ | ||
"revert": true, | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "feat", | ||
"release": "minor" | ||
}, | ||
{ | ||
"type": "fix", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "docs", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "test", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "deps", | ||
"release": "patch" | ||
}, | ||
{ | ||
"scope": "no-release", | ||
"release": false | ||
} | ||
] | ||
} | ||
], | ||
[ | ||
"@semantic-release/release-notes-generator", | ||
{ | ||
"preset": "conventionalcommits", | ||
"presetConfig": { | ||
"types": [ | ||
{ | ||
"type": "feat", | ||
"section": "Features" | ||
}, | ||
{ | ||
"type": "fix", | ||
"section": "Bug Fixes" | ||
}, | ||
{ | ||
"type": "chore", | ||
"section": "Trivial Changes" | ||
}, | ||
{ | ||
"type": "docs", | ||
"section": "Documentation" | ||
}, | ||
{ | ||
"type": "deps", | ||
"section": "Dependencies" | ||
}, | ||
{ | ||
"type": "test", | ||
"section": "Tests" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
"@semantic-release/github", | ||
"@semantic-release/git" | ||
] | ||
}, | ||
"scripts": { | ||
@@ -139,14 +50,16 @@ "clean": "aegir clean", | ||
"test:node": "aegir test -t node --cov", | ||
"test:electron-main": "aegir test -t electron-main", | ||
"release": "aegir release", | ||
"docs": "aegir docs" | ||
"test:electron-main": "aegir test -t electron-main" | ||
}, | ||
"dependencies": { | ||
"@libp2p/interface-metrics": "^4.0.0" | ||
"@libp2p/interface-metrics": "4.0.8-3dfc236e" | ||
}, | ||
"devDependencies": { | ||
"aegir": "^37.0.7", | ||
"sinon": "^15.0.1", | ||
"@types/sinon": "^10.0.15", | ||
"aegir": "^39.0.10", | ||
"sinon": "^15.1.0", | ||
"sinon-ts": "^1.0.0" | ||
}, | ||
"typedoc": { | ||
"entryPoint": "./src/index.ts" | ||
} | ||
} |
@@ -5,4 +5,4 @@ # @libp2p/tracked-map <!-- omit in toc --> | ||
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) | ||
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-tracked-map.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-tracked-map) | ||
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-tracked-map/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p-tracked-map/actions/workflows/js-test-and-release.yml?query=branch%3Amaster) | ||
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) | ||
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) | ||
@@ -53,3 +53,3 @@ > Allows tracking of statistics while libp2p is running | ||
- <https://libp2p.github.io/js-libp2p-tracked-map> | ||
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_tracked_map.html> | ||
@@ -56,0 +56,0 @@ ## License |
@@ -20,3 +20,3 @@ import type { Metric, Metrics } from '@libp2p/interface-metrics' | ||
set (key: K, value: V) { | ||
set (key: K, value: V): this { | ||
super.set(key, value) | ||
@@ -27,3 +27,3 @@ this.updateComponentMetric() | ||
delete (key: K) { | ||
delete (key: K): boolean { | ||
const deleted = super.delete(key) | ||
@@ -34,3 +34,3 @@ this.updateComponentMetric() | ||
clear () { | ||
clear (): void { | ||
super.clear() | ||
@@ -40,3 +40,3 @@ this.updateComponentMetric() | ||
private updateComponentMetric () { | ||
private updateComponentMetric (): void { | ||
this.metric.update(this.size) | ||
@@ -43,0 +43,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9171
4
9
110
2
+ Added@libp2p/interface-connection@5.1.1-3dfc236e(transitive)
+ Added@libp2p/interface-metrics@4.0.8-3dfc236e(transitive)
+ Added@libp2p/interface-peer-id@2.0.2-3dfc236e(transitive)
+ Added@libp2p/interfaces@3.3.2-3dfc236e(transitive)
- Removed@libp2p/interface-connection@5.1.1(transitive)
- Removed@libp2p/interface-metrics@4.0.8(transitive)
- Removed@libp2p/interface-peer-id@2.0.2(transitive)
- Removed@libp2p/interfaces@3.3.2(transitive)