From 89e975aece4bbe6f9783349b223d6dac3e1d3c78 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Tue, 28 Jun 2022 11:47:24 +0100 Subject: [PATCH] fix!: update deps (#5) BREAKING CHANGE: uses new peer-id interface --- README.md | 38 +++++++++++++++++++++----------------- package.json | 3 ++- src/list.ts | 2 +- src/map.ts | 2 +- src/set.ts | 2 +- test/set.spec.ts | 2 +- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index e493df8..227cd11 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,32 @@ -# libp2p-peer-connections +# @libp2p/peer-collections -[![test & maybe release](https://github.com/libp2p/js-libp2p-peer-collections/actions/workflows/js-test-and-release.yml/badge.svg)](https://github.com/libp2p/js-libp2p-peer-collections/actions/workflows/js-test-and-release.yml) +[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) +[![IRC](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) +[![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-peer-collections.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-peer-collections) +[![CI](https://img.shields.io/github/workflow/status/libp2p/js-libp2p-interfaces/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/libp2p/js-libp2p-peer-collections/actions/workflows/js-test-and-release.yml) -> store values against peer ids +> Stores values against a peer id -## Table of Contents +## Table of contents +- [Install](#install) - [Description](#description) - [Example](#example) -- [Installation](#installation) - [License](#license) - - [Contribution](#contribution) +- [Contribution](#contribution) + +## Install + +```console +$ npm i @libp2p/peer-collections +``` ## Description - We can't use PeerIds as collection keys because collection keys are compared using same-value-zero equality, so this is just a group of collections that stringifies PeerIds before storing them. +We can't use PeerIds as collection keys because collection keys are compared using same-value-zero equality, so this is just a group of collections that stringifies PeerIds before storing them. - PeerIds cache stringified versions of themselves so this should be a cheap operation. +PeerIds cache stringified versions of themselves so this should be a cheap operation. ## Example @@ -33,19 +43,13 @@ const list = peerList() list.push(peerId) ``` -## Installation - -```console -$ npm i @libp2p/peer-collections -``` - ## License Licensed under either of - * Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0) - * MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT) +- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) +- MIT ([LICENSE-MIT](LICENSE-MIT) / ) -### Contribution +## Contribution Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. diff --git a/package.json b/package.json index feb7cf3..3e35643 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ ], "exports": { ".": { + "types": "./dist/src/index.d.ts", "import": "./dist/src/index.js" } }, @@ -133,7 +134,7 @@ "release": "aegir release" }, "dependencies": { - "@libp2p/interfaces": "^2.0.0", + "@libp2p/interface-peer-id": "^1.0.4", "@libp2p/peer-id": "^1.1.0" }, "devDependencies": { diff --git a/src/list.ts b/src/list.ts index 6c4cfa4..b342c18 100644 --- a/src/list.ts +++ b/src/list.ts @@ -1,4 +1,4 @@ -import type { PeerId } from '@libp2p/interfaces/peer-id' +import type { PeerId } from '@libp2p/interface-peer-id' import { peerIdFromString } from '@libp2p/peer-id' import { mapIterable } from './util.js' diff --git a/src/map.ts b/src/map.ts index b0f9bc6..a914cff 100644 --- a/src/map.ts +++ b/src/map.ts @@ -1,4 +1,4 @@ -import type { PeerId } from '@libp2p/interfaces/peer-id' +import type { PeerId } from '@libp2p/interface-peer-id' import { peerIdFromString } from '@libp2p/peer-id' import { mapIterable } from './util.js' diff --git a/src/set.ts b/src/set.ts index 32fa790..c9748a4 100644 --- a/src/set.ts +++ b/src/set.ts @@ -1,4 +1,4 @@ -import type { PeerId } from '@libp2p/interfaces/peer-id' +import type { PeerId } from '@libp2p/interface-peer-id' import { peerIdFromString } from '@libp2p/peer-id' import { mapIterable } from './util.js' diff --git a/test/set.spec.ts b/test/set.spec.ts index b1efeb0..1c3a5a6 100644 --- a/test/set.spec.ts +++ b/test/set.spec.ts @@ -2,7 +2,7 @@ import { expect } from 'aegir/chai' import { PeerSet } from '../src/index.js' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { peerIdFromBytes } from '@libp2p/peer-id' -import type { PeerId } from '@libp2p/interfaces/peer-id' +import type { PeerId } from '@libp2p/interface-peer-id' describe('peer-set', () => { it('should return a set', async () => {