@libp2p/webtransport 3.1.10 → 4.0.0-06e6d235f
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 +1 -5
- package/dist/index.min.js +10 -10
- package/dist/src/index.d.ts +2 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +28 -21
- package/dist/src/index.js.map +1 -1
- package/dist/src/stream.d.ts +2 -2
- package/dist/src/stream.d.ts.map +1 -1
- package/dist/src/stream.js +4 -4
- package/dist/src/stream.js.map +1 -1
- package/dist/src/utils/parse-multiaddr.d.ts +1 -1
- package/dist/src/utils/parse-multiaddr.d.ts.map +1 -1
- package/dist/src/utils/parse-multiaddr.js +1 -1
- package/dist/src/utils/parse-multiaddr.js.map +1 -1
- package/package.json +15 -27
- package/src/index.ts +44 -27
- package/src/stream.ts +5 -7
- package/src/utils/parse-multiaddr.ts +2 -2
- package/dist/typedoc-urls.json +0 -10
package/src/stream.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { logger } from '@libp2p/logger'
|
|
2
1
|
import { Uint8ArrayList } from 'uint8arraylist'
|
|
3
|
-
import type { AbortOptions } from '@libp2p/interface'
|
|
4
|
-
import type { Direction, Stream } from '@libp2p/interface/connection'
|
|
2
|
+
import type { AbortOptions, ComponentLogger, Direction, Stream } from '@libp2p/interface'
|
|
5
3
|
import type { Source } from 'it-stream-types'
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export async function webtransportBiDiStreamToStream (bidiStream: WebTransportBidirectionalStream, streamId: string, direction: Direction, activeStreams: Stream[], onStreamEnd: undefined | ((s: Stream) => void)): Promise<Stream> {
|
|
5
|
+
export async function webtransportBiDiStreamToStream (bidiStream: WebTransportBidirectionalStream, streamId: string, direction: Direction, activeStreams: Stream[], onStreamEnd: undefined | ((s: Stream) => void), logger: ComponentLogger): Promise<Stream> {
|
|
6
|
+
const log = logger.forComponent(`libp2p:webtransport:stream:${direction}:${streamId}`)
|
|
10
7
|
const writer = bidiStream.writable.getWriter()
|
|
11
8
|
const reader = bidiStream.readable.getReader()
|
|
12
9
|
await writer.ready
|
|
@@ -179,7 +176,8 @@ export async function webtransportBiDiStreamToStream (bidiStream: WebTransportBi
|
|
|
179
176
|
|
|
180
177
|
await stream.closeWrite()
|
|
181
178
|
}
|
|
182
|
-
}
|
|
179
|
+
},
|
|
180
|
+
log
|
|
183
181
|
}
|
|
184
182
|
|
|
185
183
|
return stream
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CodeError } from '@libp2p/interface
|
|
1
|
+
import { CodeError } from '@libp2p/interface'
|
|
2
2
|
import { peerIdFromString } from '@libp2p/peer-id'
|
|
3
3
|
import { type Multiaddr, protocols } from '@multiformats/multiaddr'
|
|
4
4
|
import { WebTransport } from '@multiformats/multiaddr-matcher'
|
|
5
5
|
import { bases, digest } from 'multiformats/basics'
|
|
6
|
-
import type { PeerId } from '@libp2p/interface
|
|
6
|
+
import type { PeerId } from '@libp2p/interface'
|
|
7
7
|
import type { MultihashDigest } from 'multiformats/hashes/interface'
|
|
8
8
|
|
|
9
9
|
// @ts-expect-error - Not easy to combine these types.
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"WebTransportComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webtransport.WebTransportComponents.html",
|
|
3
|
-
".:WebTransportComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webtransport.WebTransportComponents.html",
|
|
4
|
-
"WebTransportInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webtransport.WebTransportInit.html",
|
|
5
|
-
".:WebTransportInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webtransport.WebTransportInit.html",
|
|
6
|
-
"WebTransportMetrics": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webtransport.WebTransportMetrics.html",
|
|
7
|
-
".:WebTransportMetrics": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webtransport.WebTransportMetrics.html",
|
|
8
|
-
"webTransport": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webtransport.webTransport.html",
|
|
9
|
-
".:webTransport": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webtransport.webTransport.html"
|
|
10
|
-
}
|