Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
feat!: update to latest libp2p interfaces (#45)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: uses new single-issue libp2p interface modules
  • Loading branch information
achingbrain authored Jun 15, 2022
1 parent d170498 commit b5eb989
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 23 deletions.
46 changes: 28 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,50 @@
# js-libp2p-record
# @libp2p/record <!-- omit in toc -->

[![](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 <!-- omit in toc -->

- [Install](#install)
- [Description](#description)
- [Usage](#usage)
- [Contribute](#contribute)
- [License](#license)
- [Contribution](#contribution)

## Install

```console
$ npm i @libp2p/record
```

## Description

Implementation of [go-libp2p-record](https://github.com/libp2p/go-libp2p-record) in JavaScript.

## Usage

See https://libp2p.github.io/js-libp2p-record/
See <https://libp2p.github.io/js-libp2p-record/>

## 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) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/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.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/selectors.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/validators.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
2 changes: 1 addition & 1 deletion test/selection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')]

Expand Down
2 changes: 1 addition & 1 deletion test/validator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit b5eb989

Please sign in to comment.