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

feat: add types and update all deps #214

Merged
merged 2 commits into from
Feb 8, 2021
Merged

feat: add types and update all deps #214

merged 2 commits into from
Feb 8, 2021

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Feb 3, 2021

Adds types to source code, tests can be done later.

Updates all deps.

Depends on:

Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this @achingbrain! 🎉 Also a lot of bugs caught

Left mostly small recommendations, as well as comments for future thoughts.

src/content-routing/index.js Outdated Show resolved Hide resolved
multiaddrs: (peerData.addresses || []).map((address) => address.multiaddr)
provs
.forEach(id => {
const peerData = dht.peerStore.get(id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const peerData = dht.peerStore.get(id)
const peer = dht.peerStore.get(id)

We initially were going with the peerData naming for peerStore records, but we decided after the DHT refactor to just call peer and make it consistent here later on.

.forEach(id => {
const peerData = dht.peerStore.get(id)

if (peerData) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (peerData) {
if (peer) {


if (peerData) {
out.push({
id: peerData.id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id: peerData.id,
id: peer.id,

if (peerData) {
out.push({
id: peerData.id,
multiaddrs: peerData.addresses
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
multiaddrs: peerData.addresses
multiaddrs: peer.addresses

if (!peerData) {
throw errcode(new Error('No peer data found in peer store'), 'ERR_NOT_FOUND')
}

return {
id: peerData.id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id: peerData.id,
id: peer.id,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other occurrences in this file, I will not flag all of them

if (!peerData) {
throw errcode(new Error('No peer data found in peer store'), 'ERR_NOT_FOUND')
}

return {
id: peerData.id,
multiaddrs: peerData.addresses.map((address) => address.multiaddr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
multiaddrs: peerData.addresses.map((address) => address.multiaddr)
multiaddrs: peer.addresses.map((address) => address.multiaddr)

src/peer-routing/index.js Outdated Show resolved Hide resolved
src/providers.js Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
src/peer-routing/index.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
Adds types to source code, tests can be done later.

Updates all deps.
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor left stuff

package.json Show resolved Hide resolved
* @param {Uint8Array} key
* @param {Object} [options]
* @param {boolean} [options.shallow] shallow query (default: false)
* @returns {AsyncIterable<{ id: PeerId, multiaddrs: Multiaddr[] }>}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@achingbrain can we have this back?

src/index.js Outdated Show resolved Hide resolved
Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vasco-santos vasco-santos merged commit 7195282 into master Feb 8, 2021
@vasco-santos vasco-santos deleted the feat/add-types branch February 8, 2021 12:26
@vasco-santos vasco-santos mentioned this pull request Feb 9, 2021
7 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants