Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: update libp2p deps #163

Merged
merged 3 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,28 @@
"dep-check": "aegir dep-check -i rimraf"
},
"dependencies": {
"@libp2p/logger": "^1.1.4",
"@libp2p/interface-dht": "^1.0.1",
"@libp2p/interface-pubsub": "^1.0.4",
"@libp2p/logger": "^2.0.0",
"datastore-core": "^7.0.0",
"debug": "^4.2.0",
"err-code": "^3.0.1",
"interface-datastore": "^6.0.2",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"@chainsafe/libp2p-gossipsub": "^1.0.1",
"@libp2p/interface-compliance-tests": "^2.0.3",
"@libp2p/interfaces": "^2.0.2",
"@libp2p/components": "^2.0.0",
"@libp2p/floodsub": "^3.0.0",
"@libp2p/interface-compliance-tests": "^3.0.2",
"@libp2p/interface-mocks": "^3.0.1",
"@libp2p/interfaces": "^3.0.3",
"@libp2p/peer-id-factory": "^1.0.9",
"@libp2p/record": "^1.0.4",
"@libp2p/record": "^2.0.0",
"@types/detect-node": "^2.0.0",
"aegir": "^37.0.13",
"detect-node": "^2.0.4",
"install": "^0.13.0",
"ipfs-core-types": "^0.10.2",
"ipfs-core-types": "^0.11.1",
"it-pair": "^2.0.2",
"libp2p": "next",
"npm": "^8.10.0",
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { logger } from '@libp2p/logger'
const log = logger('datastore-pubsub:publisher')

/**
* @typedef {import('@libp2p/interfaces/peer-id').PeerId} PeerId
* @typedef {import('@libp2p/interface-peer-id').PeerId} PeerId
* @typedef {import('./types').SubscriptionKeyFn} SubscriptionKeyFn
* @typedef {import('@libp2p/interfaces/pubsub').Message} PubSubMessage
* @typedef {import('@libp2p/interface-pubsub').Message} PubSubMessage
*/

// DatastorePubsub is responsible for providing an api for pubsub to be used as a datastore with
Expand All @@ -19,11 +19,11 @@ export class PubSubDatastore extends BaseDatastore {
/**
* Creates an instance of DatastorePubsub.
*
* @param {import('@libp2p/interfaces/pubsub').PubSub} pubsub - pubsub implementation
* @param {import('@libp2p/interface-pubsub').PubSub} pubsub - pubsub implementation
* @param {import('interface-datastore').Datastore} datastore - datastore instance
* @param {PeerId} peerId - peer-id instance
* @param {import('@libp2p/interfaces/dht').ValidateFn} validator - validator function
* @param {import('@libp2p/interfaces/dht').SelectFn} selector - selector function
* @param {import('@libp2p/interface-dht').ValidateFn} validator - validator function
* @param {import('@libp2p/interface-dht').SelectFn} selector - selector function
* @param {SubscriptionKeyFn} [subscriptionKeyFn] - function to manipulate the key topic received before processing it
* @memberof DatastorePubsub
*/
Expand Down
8 changes: 4 additions & 4 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import { keyToTopic, topicToKey } from '../src/utils.js'
import { stop } from '@libp2p/interfaces/startable'

/**
* @typedef {import('@libp2p/interfaces/pubsub').PubSub} PubSub
* @typedef {import('@libp2p/interface-pubsub').PubSub} PubSub
* @typedef {import('interface-datastore').Datastore} Datastore
* @typedef {import('@libp2p/interfaces/peer-id').PeerId} PeerId
* @typedef {import('@libp2p/interfaces/dht').ValidateFn} Validator
* @typedef {import('@libp2p/interface-peer-id').PeerId} PeerId
* @typedef {import('@libp2p/interface-dht').ValidateFn} Validator
* @typedef {import('../src/types').SubscriptionKeyFn} SubscriptionKeyFn
* @typedef {import('@libp2p/interfaces/components').Components} Components
* @typedef {import('@libp2p/components').Components} Components
*/

// Always returning the expected values
Expand Down
17 changes: 7 additions & 10 deletions test/utils.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import pWaitFor from 'p-wait-for'
import { GossipSub } from '@chainsafe/libp2p-gossipsub'
import { FloodSub, multicodec } from '@libp2p/floodsub'
import { createEd25519PeerId } from '@libp2p/peer-id-factory'
import { connectionPair, mockRegistrar, mockConnectionManager } from '@libp2p/interface-compliance-tests/mocks'
import { Components } from '@libp2p/interfaces/components'
import { connectionPair, mockRegistrar, mockConnectionManager } from '@libp2p/interface-mocks'
import { Components } from '@libp2p/components'
import { MemoryDatastore } from 'datastore-core'

const { multicodec } = GossipSub

/**
* @typedef {import('@libp2p/interfaces/pubsub').PubSub} PubSub
* @typedef {import('@libp2p/interfaces/peer-id').PeerId} PeerId
* @typedef {import('@libp2p/interface-pubsub').PubSub} PubSub
* @typedef {import('@libp2p/interface-peer-id').PeerId} PeerId
*/

/**
Expand All @@ -25,9 +23,8 @@ export const createComponents = async () => {
connectionManager: mockConnectionManager()
})

const pubsub = new GossipSub({
emitSelf: true,
allowPublishToZeroPeers: true
const pubsub = new FloodSub({
emitSelf: true
})
pubsub.init(components)
await pubsub.start()
Expand Down