@libp2p/interface-peer-store
Advanced tools
Comparing version 2.0.3 to 2.0.4-1c6702c8
@@ -104,2 +104,23 @@ import type { PeerId } from '@libp2p/interface-peer-id'; | ||
} | ||
/** | ||
* A predicate by which to filter lists of peers | ||
*/ | ||
export interface PeerQueryFilter { | ||
(peer: Peer): boolean; | ||
} | ||
/** | ||
* A predicate by which to sort lists of peers | ||
*/ | ||
export interface PeerQueryOrder { | ||
(a: Peer, b: Peer): -1 | 0 | 1; | ||
} | ||
/** | ||
* A query for getting lists of peers | ||
*/ | ||
export interface PeerQuery { | ||
filters?: PeerQueryFilter[]; | ||
orders?: PeerQueryOrder[]; | ||
limit?: number; | ||
offset?: number; | ||
} | ||
export interface PeerStore { | ||
@@ -121,3 +142,3 @@ /** | ||
*/ | ||
forEach: (fn: (peer: Peer) => void) => Promise<void>; | ||
forEach: (fn: (peer: Peer) => void, query?: PeerQuery) => Promise<void>; | ||
/** | ||
@@ -134,3 +155,3 @@ * Returns all peers in the peer store. | ||
*/ | ||
all: () => Promise<Peer[]>; | ||
all: (query?: PeerQuery) => Promise<Peer[]>; | ||
/** | ||
@@ -137,0 +158,0 @@ * Delete all data stored for the passed peer |
{ | ||
"name": "@libp2p/interface-peer-store", | ||
"version": "2.0.3", | ||
"version": "2.0.4-1c6702c8", | ||
"description": "Peer Store interface for libp2p", | ||
"license": "Apache-2.0 OR MIT", | ||
"homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/interface-peer-store#readme", | ||
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-peer-store#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/libp2p/js-libp2p-interfaces.git" | ||
"url": "git+https://github.com/libp2p/js-libp2p.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/libp2p/js-libp2p-interfaces/issues" | ||
"url": "https://github.com/libp2p/js-libp2p/issues" | ||
}, | ||
@@ -18,6 +18,2 @@ "keywords": [ | ||
], | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"type": "module", | ||
@@ -156,3 +152,3 @@ "types": "./dist/src/index.d.ts", | ||
"dependencies": { | ||
"@libp2p/interface-peer-id": "^2.0.0", | ||
"@libp2p/interface-peer-id": "2.0.2-1c6702c8", | ||
"@multiformats/multiaddr": "^12.0.0" | ||
@@ -159,0 +155,0 @@ }, |
@@ -5,4 +5,4 @@ # @libp2p/interface-peer-store <!-- 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-interfaces.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-interfaces) | ||
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-interfaces/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p-interfaces/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) | ||
@@ -40,3 +40,3 @@ > Peer Store interface for libp2p | ||
- <https://libp2p.github.io/js-libp2p-interfaces/modules/_libp2p_interface_peer_store.html> | ||
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_interface_peer_store.html> | ||
@@ -43,0 +43,0 @@ ## License |
@@ -123,2 +123,22 @@ import type { PeerId } from '@libp2p/interface-peer-id' | ||
/** | ||
* A predicate by which to filter lists of peers | ||
*/ | ||
export interface PeerQueryFilter { (peer: Peer): boolean } | ||
/** | ||
* A predicate by which to sort lists of peers | ||
*/ | ||
export interface PeerQueryOrder { (a: Peer, b: Peer): -1 | 0 | 1 } | ||
/** | ||
* A query for getting lists of peers | ||
*/ | ||
export interface PeerQuery { | ||
filters?: PeerQueryFilter[] | ||
orders?: PeerQueryOrder[] | ||
limit?: number | ||
offset?: number | ||
} | ||
export interface PeerStore { | ||
@@ -140,3 +160,3 @@ /** | ||
*/ | ||
forEach: (fn: (peer: Peer) => void) => Promise<void> | ||
forEach: (fn: (peer: Peer) => void, query?: PeerQuery) => Promise<void> | ||
@@ -154,3 +174,3 @@ /** | ||
*/ | ||
all: () => Promise<Peer[]> | ||
all: (query?: PeerQuery) => Promise<Peer[]> | ||
@@ -157,0 +177,0 @@ /** |
Sorry, the diff of this file is not supported yet
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
21253
496
14
2
+ Added@libp2p/interface-peer-id@2.0.2-1c6702c8(transitive)
- Removed@libp2p/interface-peer-id@2.0.2(transitive)