@libp2p/daemon-protocol 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -9
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +233 -344
- package/dist/src/index.js.map +1 -1
- package/dist/src/stream-handler.d.ts +2 -2
- package/dist/src/stream-handler.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.proto +40 -7
- package/src/index.ts +240 -340
- package/src/stream-handler.ts +3 -3
package/src/stream-handler.ts
CHANGED
|
@@ -30,7 +30,7 @@ export class StreamHandler {
|
|
|
30
30
|
/**
|
|
31
31
|
* Read and decode message
|
|
32
32
|
*/
|
|
33
|
-
async read () {
|
|
33
|
+
async read (): Promise<Uint8Array | undefined> {
|
|
34
34
|
// @ts-expect-error decoder is really a generator
|
|
35
35
|
const msg = await this.decoder.next()
|
|
36
36
|
if (msg.value != null) {
|
|
@@ -52,7 +52,7 @@ export class StreamHandler {
|
|
|
52
52
|
/**
|
|
53
53
|
* Return the handshake rest stream and invalidate handler
|
|
54
54
|
*/
|
|
55
|
-
rest () {
|
|
55
|
+
rest (): Duplex<Uint8ArrayList, Uint8Array> {
|
|
56
56
|
this.shake.rest()
|
|
57
57
|
return this.shake.stream
|
|
58
58
|
}
|
|
@@ -60,7 +60,7 @@ export class StreamHandler {
|
|
|
60
60
|
/**
|
|
61
61
|
* Close the stream
|
|
62
62
|
*/
|
|
63
|
-
async close () {
|
|
63
|
+
async close (): Promise<void> {
|
|
64
64
|
log('closing the stream')
|
|
65
65
|
await this.rest().sink([])
|
|
66
66
|
}
|