starpc 0.39.2 → 0.39.3
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/dist/srpc/conn.d.ts +2 -1
- package/dist/srpc/conn.js +2 -2
- package/package.json +1 -2
- package/srpc/conn.ts +5 -2
package/dist/srpc/conn.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { YamuxMuxerInit } from '@chainsafe/libp2p-yamux';
|
|
2
|
-
import type { Direction, Stream, StreamMuxer, StreamMuxerFactory } from '@libp2p/interface';
|
|
2
|
+
import type { ComponentLogger, Direction, Stream, StreamMuxer, StreamMuxerFactory } from '@libp2p/interface';
|
|
3
3
|
import type { Duplex } from 'it-stream-types';
|
|
4
4
|
import { Uint8ArrayList } from 'uint8arraylist';
|
|
5
5
|
import { type OpenStreamFunc, type PacketStream } from './stream.js';
|
|
6
6
|
import { Client } from './client.js';
|
|
7
7
|
export interface StreamConnParams {
|
|
8
|
+
logger?: ComponentLogger;
|
|
8
9
|
muxerFactory?: StreamMuxerFactory;
|
|
9
10
|
direction?: Direction;
|
|
10
11
|
yamuxParams?: YamuxMuxerInit;
|
package/dist/srpc/conn.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { yamux } from '@chainsafe/libp2p-yamux';
|
|
2
|
-
import { defaultLogger } from '@libp2p/logger';
|
|
3
2
|
import { streamToPacketStream, } from './stream.js';
|
|
4
3
|
import { Client } from './client.js';
|
|
4
|
+
import { createDisabledComponentLogger } from './log.js';
|
|
5
5
|
// StreamConn implements a generic connection with a two-way stream.
|
|
6
6
|
// The stream is not expected to manage packet boundaries.
|
|
7
7
|
// Packets will be sent with uint32le length prefixes.
|
|
@@ -21,7 +21,7 @@ export class StreamConn {
|
|
|
21
21
|
}
|
|
22
22
|
const muxerFactory = connParams?.muxerFactory ??
|
|
23
23
|
yamux({ enableKeepAlive: false, ...connParams?.yamuxParams })({
|
|
24
|
-
logger:
|
|
24
|
+
logger: connParams?.logger ?? createDisabledComponentLogger(),
|
|
25
25
|
});
|
|
26
26
|
this._muxer = muxerFactory.createStreamMuxer({
|
|
27
27
|
onIncomingStream: this.handleIncomingStream.bind(this),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starpc",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.3",
|
|
4
4
|
"description": "Streaming protobuf RPC service protocol over any two-way channel.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
"@aptre/protobuf-es-lite": "^0.5.0",
|
|
100
100
|
"@chainsafe/libp2p-yamux": "^7.0.1",
|
|
101
101
|
"@libp2p/interface": "^2.6.1",
|
|
102
|
-
"@libp2p/logger": "^5.1.11",
|
|
103
102
|
"event-iterator": "^2.0.0",
|
|
104
103
|
"isomorphic-ws": "^5.0.0",
|
|
105
104
|
"it-first": "^3.0.6",
|
package/srpc/conn.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { YamuxMuxerInit, yamux } from '@chainsafe/libp2p-yamux'
|
|
2
2
|
import type {
|
|
3
|
+
ComponentLogger,
|
|
3
4
|
Direction,
|
|
4
5
|
Stream,
|
|
5
6
|
StreamMuxer,
|
|
@@ -7,7 +8,6 @@ import type {
|
|
|
7
8
|
} from '@libp2p/interface'
|
|
8
9
|
import type { Duplex } from 'it-stream-types'
|
|
9
10
|
import { Uint8ArrayList } from 'uint8arraylist'
|
|
10
|
-
import { defaultLogger } from '@libp2p/logger'
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
streamToPacketStream,
|
|
@@ -15,9 +15,12 @@ import {
|
|
|
15
15
|
type PacketStream,
|
|
16
16
|
} from './stream.js'
|
|
17
17
|
import { Client } from './client.js'
|
|
18
|
+
import { createDisabledComponentLogger } from './log.js'
|
|
18
19
|
|
|
19
20
|
// ConnParams are parameters that can be passed to the StreamConn constructor.
|
|
20
21
|
export interface StreamConnParams {
|
|
22
|
+
// logger is the logger to use, defaults to disabled logger.
|
|
23
|
+
logger?: ComponentLogger
|
|
21
24
|
// muxerFactory overrides using the default yamux factory.
|
|
22
25
|
muxerFactory?: StreamMuxerFactory
|
|
23
26
|
// direction is the muxer connection direction.
|
|
@@ -59,7 +62,7 @@ export class StreamConn
|
|
|
59
62
|
const muxerFactory =
|
|
60
63
|
connParams?.muxerFactory ??
|
|
61
64
|
yamux({ enableKeepAlive: false, ...connParams?.yamuxParams })({
|
|
62
|
-
logger:
|
|
65
|
+
logger: connParams?.logger ?? createDisabledComponentLogger(),
|
|
63
66
|
})
|
|
64
67
|
this._muxer = muxerFactory.createStreamMuxer({
|
|
65
68
|
onIncomingStream: this.handleIncomingStream.bind(this),
|