starpc 0.41.0 → 0.41.1
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/go.mod +2 -2
- package/go.sum +2 -2
- package/package.json +16 -1
- package/srpc/broadcast-channel.ts +5 -3
- package/srpc/channel.ts +5 -3
- package/srpc/conn.ts +3 -3
- package/srpc/message-port.ts +3 -3
package/go.mod
CHANGED
|
@@ -19,10 +19,10 @@ require (
|
|
|
19
19
|
|
|
20
20
|
require (
|
|
21
21
|
github.com/coder/websocket v1.8.14 // latest
|
|
22
|
-
github.com/libp2p/go-libp2p v0.
|
|
22
|
+
github.com/libp2p/go-libp2p v0.46.0 // latest
|
|
23
23
|
github.com/pkg/errors v0.9.1 // latest
|
|
24
24
|
github.com/sirupsen/logrus v1.9.3 // latest
|
|
25
|
-
google.golang.org/protobuf v1.36.
|
|
25
|
+
google.golang.org/protobuf v1.36.11 // latest
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
require github.com/libp2p/go-yamux/v4 v4.0.1
|
package/go.sum
CHANGED
|
@@ -61,8 +61,8 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
|
|
|
61
61
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
62
62
|
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
|
|
63
63
|
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
|
64
|
-
google.golang.org/protobuf v1.36.
|
|
65
|
-
google.golang.org/protobuf v1.36.
|
|
64
|
+
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
|
65
|
+
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
|
66
66
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
67
67
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
68
68
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starpc",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.1",
|
|
4
4
|
"description": "Streaming protobuf RPC service protocol over any two-way channel.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -29,6 +29,21 @@
|
|
|
29
29
|
"types": "./dist/mock/index.d.ts",
|
|
30
30
|
"import": "./dist/mock/index.js",
|
|
31
31
|
"require": "./dist/mock/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./echo": {
|
|
34
|
+
"types": "./dist/echo/index.d.ts",
|
|
35
|
+
"import": "./dist/echo/index.js",
|
|
36
|
+
"require": "./dist/echo/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./rpcstream": {
|
|
39
|
+
"types": "./dist/rpcstream/index.d.ts",
|
|
40
|
+
"import": "./dist/rpcstream/index.js",
|
|
41
|
+
"require": "./dist/rpcstream/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./rpcstream/rpcstream.pb.js": {
|
|
44
|
+
"types": "./dist/rpcstream/rpcstream.pb.d.ts",
|
|
45
|
+
"import": "./dist/rpcstream/rpcstream.pb.js",
|
|
46
|
+
"require": "./dist/rpcstream/rpcstream.pb.js"
|
|
32
47
|
}
|
|
33
48
|
},
|
|
34
49
|
"files": [
|
|
@@ -11,9 +11,11 @@ import { pipe } from 'it-pipe'
|
|
|
11
11
|
// When the sink is closed, the broadcast channel also be closed.
|
|
12
12
|
// Note: there is no way to know when a BroadcastChannel is closed!
|
|
13
13
|
// You will need an additional keep-alive on top of BroadcastChannelDuplex.
|
|
14
|
-
export class BroadcastChannelDuplex<T>
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export class BroadcastChannelDuplex<T> implements Duplex<
|
|
15
|
+
AsyncGenerator<T>,
|
|
16
|
+
Source<T>,
|
|
17
|
+
Promise<void>
|
|
18
|
+
> {
|
|
17
19
|
// read is the read channel
|
|
18
20
|
public readonly read: BroadcastChannel
|
|
19
21
|
// write is the write channel
|
package/srpc/channel.ts
CHANGED
|
@@ -44,9 +44,11 @@ export interface ChannelStreamOpts {
|
|
|
44
44
|
// However: if the remote is removed w/o closing cleanly, the stream will be left open!
|
|
45
45
|
// Enable keepAliveMs and idleTimeoutMs to mitigate this issue with keep-alive messages.
|
|
46
46
|
// NOTE: Browsers will throttle setTimeout in background tabs.
|
|
47
|
-
export class ChannelStream<T = Uint8Array>
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
export class ChannelStream<T = Uint8Array> implements Duplex<
|
|
48
|
+
AsyncGenerator<T>,
|
|
49
|
+
Source<T>,
|
|
50
|
+
Promise<void>
|
|
51
|
+
> {
|
|
50
52
|
// channel is the read/write channel.
|
|
51
53
|
public readonly channel: ChannelPort
|
|
52
54
|
// sink is the sink for incoming messages.
|
package/srpc/conn.ts
CHANGED
|
@@ -47,9 +47,9 @@ export interface StreamHandler {
|
|
|
47
47
|
// Implements the client by opening streams with the remote.
|
|
48
48
|
// Implements the server by handling incoming streams.
|
|
49
49
|
// If the server is unset, rejects any incoming streams.
|
|
50
|
-
export class StreamConn
|
|
51
|
-
|
|
52
|
-
{
|
|
50
|
+
export class StreamConn implements Duplex<
|
|
51
|
+
AsyncGenerator<Uint8Array | Uint8ArrayList>
|
|
52
|
+
> {
|
|
53
53
|
// muxer is the stream muxer.
|
|
54
54
|
private _muxer: StreamMuxer
|
|
55
55
|
// server is the server side, if set.
|
package/srpc/message-port.ts
CHANGED
|
@@ -12,9 +12,9 @@ import { combineUint8ArrayListTransform } from './array-list.js'
|
|
|
12
12
|
// null will be written through the channel to indicate closure when the sink is closed.
|
|
13
13
|
// Note: there is no way to know for sure when a MessagePort is closed!
|
|
14
14
|
// You will need an additional keep-alive on top of MessagePortDuplex.
|
|
15
|
-
export class MessagePortDuplex<
|
|
16
|
-
|
|
17
|
-
{
|
|
15
|
+
export class MessagePortDuplex<
|
|
16
|
+
T extends NonNullable<unknown>,
|
|
17
|
+
> implements Duplex<AsyncGenerator<T>, Source<T>, Promise<void>> {
|
|
18
18
|
// port is the message port
|
|
19
19
|
public readonly port: MessagePort
|
|
20
20
|
// sink is the sink for incoming messages.
|