diff --git a/README.md b/README.md index 32c4fd7..62a8c5a 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,27 @@ -# js-libp2p-record +# @libp2p/record -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-libp2p-blue.svg?style=flat-square)](http://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-libp2p-record/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-record?branch=master) -[![Build Status](https://github.com/libp2p/js-libp2p-record/actions/workflows/js-test-and-release.yml/badge.svg?branch=main)](https://github.com/libp2p/js-libp2p-record/actions/workflows/js-test-and-release.yml) -[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-record.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-record) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) -![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square) -![](https://img.shields.io/badge/Node.js-%3E%3D6.0.0-orange.svg?style=flat-square) +[![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-record.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-record) +[![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-record/actions/workflows/js-test-and-release.yml) -> JavaScript implementation of libp2p record. +> libp2p record implementation + +## Table of contents + +- [Install](#install) +- [Description](#description) +- [Usage](#usage) +- [Contribute](#contribute) +- [License](#license) +- [Contribution](#contribution) + +## Install + +```console +$ npm i @libp2p/record +``` ## Description @@ -19,22 +29,22 @@ Implementation of [go-libp2p-record](https://github.com/libp2p/go-libp2p-record) ## Usage -See https://libp2p.github.io/js-libp2p-record/ +See ## Contribute The libp2p implementation in JavaScript is a work in progress. As such, there are a few things you can do right now to help out: - - Go through the modules and **check out existing issues**. This is especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically. - - **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs. +- Go through the modules and **check out existing issues**. This is especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically. +- **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs. ## 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 2db7bfb..a4301ae 100644 --- a/package.json +++ b/package.json @@ -45,12 +45,15 @@ ], "exports": { ".": { + "types": "./src/index.d.ts", "import": "./dist/src/index.js" }, "./selectors": { + "types": "./dist/src/selectors.d.ts", "import": "./dist/src/selectors.js" }, "./validators": { + "types": "./dist/src/validators.d.ts", "import": "./dist/src/validators.js" } }, @@ -159,7 +162,7 @@ "release": "aegir release" }, "dependencies": { - "@libp2p/interfaces": "^2.0.2", + "@libp2p/interface-dht": "^1.0.0", "err-code": "^3.0.1", "multiformats": "^9.4.5", "protons-runtime": "^1.0.2", diff --git a/src/selectors.ts b/src/selectors.ts index 5f824ba..2c492b8 100644 --- a/src/selectors.ts +++ b/src/selectors.ts @@ -1,6 +1,6 @@ import errCode from 'err-code' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import type { Selectors } from '@libp2p/interfaces/dht' +import type { Selectors } from '@libp2p/interface-dht' /** * Select the best record out of the given records diff --git a/src/validators.ts b/src/validators.ts index 6b7c241..643f739 100644 --- a/src/validators.ts +++ b/src/validators.ts @@ -1,7 +1,7 @@ import errCode from 'err-code' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import type { Libp2pRecord } from './index.js' -import type { Validators } from '@libp2p/interfaces/dht' +import type { Validators } from '@libp2p/interface-dht' import { sha256 } from 'multiformats/hashes/sha2' import { equals as uint8ArrayEquals } from 'uint8arrays/equals' diff --git a/test/selection.spec.ts b/test/selection.spec.ts index 1b2fc4d..443be63 100644 --- a/test/selection.spec.ts +++ b/test/selection.spec.ts @@ -4,7 +4,7 @@ import { expect } from 'aegir/chai' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import * as selection from '../src/selectors.js' -import type { Selectors } from '@libp2p/interfaces/dht' +import type { Selectors } from '@libp2p/interface-dht' const records = [new Uint8Array(), uint8ArrayFromString('hello')] diff --git a/test/validator.spec.ts b/test/validator.spec.ts index ca32fe0..3340bb5 100644 --- a/test/validator.spec.ts +++ b/test/validator.spec.ts @@ -7,7 +7,7 @@ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import * as validator from '../src/validators.js' import { Libp2pRecord } from '../src/index.js' import * as fixture from './fixtures/go-key-records.js' -import type { Validators } from '@libp2p/interfaces/dht' +import type { Validators } from '@libp2p/interface-dht' interface Cases { valid: {