Skip to content

Commit 25173d5

Browse files
authored
fix: update interfaces and deps (#84)
Updates all deps to the latest versions
1 parent 11365b9 commit 25173d5

File tree

6 files changed

+26
-22
lines changed

6 files changed

+26
-22
lines changed

packages/libp2p-daemon-client/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,19 @@
130130
},
131131
"dependencies": {
132132
"@libp2p/daemon-protocol": "^1.0.0",
133-
"@libp2p/interfaces": "^1.3.17",
134-
"@libp2p/logger": "^1.1.2",
135-
"@libp2p/peer-id": "^1.1.8",
136-
"@libp2p/tcp": "^1.0.6",
133+
"@libp2p/interfaces": "^1.3.22",
134+
"@libp2p/logger": "^1.1.4",
135+
"@libp2p/peer-id": "^1.1.10",
136+
"@libp2p/tcp": "^1.0.8",
137137
"@multiformats/multiaddr": "^10.1.8",
138138
"err-code": "^3.0.1",
139139
"it-stream-types": "^1.0.4",
140140
"multiformats": "^9.6.4"
141141
},
142142
"devDependencies": {
143143
"@libp2p/daemon-server": "^1.0.0",
144-
"@libp2p/interface-compliance-tests": "^1.1.20",
145-
"@libp2p/peer-id-factory": "^1.0.8",
144+
"@libp2p/interface-compliance-tests": "^1.1.23",
145+
"@libp2p/peer-id-factory": "^1.0.9",
146146
"aegir": "^37.0.5",
147147
"it-all": "^1.0.6",
148148
"it-pipe": "^2.0.3",

packages/libp2p-daemon-client/test/pubsub.spec.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@ describe('daemon pubsub client', function () {
7272

7373
await client.pubsub.publish(topic, data)
7474

75-
expect(pubsub.dispatchEvent.called).to.be.true()
75+
expect(pubsub.publish.called).to.be.true()
7676

77-
const event = pubsub.dispatchEvent.getCall(0).args[0]
77+
const call = pubsub.publish.getCall(0)
7878

79-
expect(event.type).to.equal(topic)
80-
expect(event.detail).to.equalBytes(data)
79+
expect(call).to.have.nested.property('args[0]', topic)
80+
expect(call).to.have.deep.nested.property('args[1]', data)
8181
})
8282

8383
it('should error if receive an error message', async () => {
8484
const topic = 'test-topic'
8585
const data = uint8ArrayFromString('hello world')
86-
pubsub.dispatchEvent.throws(new Error('Urk!'))
86+
pubsub.publish.throws(new Error('Urk!'))
8787

8888
await expect(client.pubsub.publish(topic, data)).to.eventually.be.rejectedWith(/Urk!/)
8989
})

packages/libp2p-daemon-protocol/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@
149149
"release": "aegir release"
150150
},
151151
"dependencies": {
152-
"protons-runtime": "^1.0.0"
152+
"protons-runtime": "^1.0.3"
153153
},
154154
"devDependencies": {
155-
"aegir": "^37.0.5",
156-
"protons": "^3.0.1"
155+
"aegir": "^37.0.14",
156+
"protons": "^3.0.3"
157157
}
158158
}

packages/libp2p-daemon-server/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@
134134
},
135135
"dependencies": {
136136
"@libp2p/daemon-protocol": "^1.0.0",
137-
"@libp2p/interfaces": "^1.3.17",
138-
"@libp2p/logger": "^1.1.2",
139-
"@libp2p/peer-id": "^1.1.8",
140-
"@libp2p/tcp": "^1.0.6",
137+
"@libp2p/interfaces": "^1.3.22",
138+
"@libp2p/logger": "^1.1.4",
139+
"@libp2p/peer-id": "^1.1.10",
140+
"@libp2p/tcp": "^1.0.8",
141141
"@multiformats/multiaddr": "^10.1.8",
142142
"it-drain": "^1.0.5",
143143
"it-length-prefixed": "^7.0.1",

packages/libp2p-daemon-server/src/pubsub.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { ErrorResponse, OkResponse } from './responses.js'
77
import type { PubSub } from '@libp2p/interfaces/pubsub'
88
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
99
import { pushable } from 'it-pushable'
10-
import { CustomEvent } from '@libp2p/interfaces'
1110
import { logger } from '@libp2p/logger'
1211

1312
const log = logger('libp2p:daemon-server:pubsub')
@@ -42,10 +41,15 @@ export class PubSubOperations {
4241
async * subscribe (topic: string) {
4342
try {
4443
const onMessage = pushable<Uint8Array>()
44+
this.pubsub.subscribe(topic)
4545

46-
await this.pubsub.addEventListener(topic, (evt) => {
46+
await this.pubsub.addEventListener('message', (evt) => {
4747
const msg = evt.detail
4848

49+
if (msg.topic !== topic) {
50+
return
51+
}
52+
4953
onMessage.push(PSMessage.encode({
5054
from: msg.from.toBytes(),
5155
data: msg.data,
@@ -66,7 +70,7 @@ export class PubSubOperations {
6670

6771
async * publish (topic: string, data: Uint8Array) {
6872
try {
69-
this.pubsub.dispatchEvent(new CustomEvent(topic, { detail: data }))
73+
this.pubsub.publish(topic, data)
7074
yield OkResponse()
7175
} catch (err: any) {
7276
log.error(err)

packages/libp2p-daemon/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
},
133133
"dependencies": {
134134
"@libp2p/daemon-server": "^1.0.0",
135-
"@libp2p/interfaces": "^1.3.17",
135+
"@libp2p/interfaces": "^1.3.22",
136136
"@multiformats/multiaddr": "^10.1.8",
137137
"es-main": "^1.0.2",
138138
"yargs": "^17.3.1",

0 commit comments

Comments
 (0)