starpc 0.4.5 → 0.4.8
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/echo/index.d.ts +2 -2
- package/dist/echo/index.js +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/rpcstream/index.d.ts +2 -1
- package/dist/rpcstream/index.js +2 -1
- package/dist/rpcstream/rpcstream.js +2 -2
- package/dist/srpc/index.d.ts +1 -0
- package/dist/srpc/index.js +1 -0
- package/e2e/e2e_test.go +11 -6
- package/echo/index.ts +7 -2
- package/package.json +10 -12
- package/patches/{ts-poet+4.13.0.patch → ts-poet+4.14.0.patch} +1 -1
- package/srpc/index.ts +1 -0
package/dist/echo/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { EchoMsg, Echoer, EchoerClientImpl, EchoerDefinition, } from './echo.pb.js';
|
|
2
|
+
export { EchoerServer } from './server.js';
|
|
3
3
|
export { runClientTest } from './client-test.js';
|
package/dist/echo/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { EchoMsg, EchoerClientImpl, EchoerDefinition, } from './echo.pb.js';
|
|
2
|
+
export { EchoerServer } from './server.js';
|
|
3
3
|
export { runClientTest } from './client-test.js';
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { RpcStream, RpcStreamCaller, RpcStreamGetter, handleRpcStream, buildRpcStreamOpenStream, } from './rpcstream.js';
|
|
2
|
+
export { RpcStreamPacket, RpcStreamInit } from './rpcstream.pb.js';
|
package/dist/rpcstream/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { RpcStream, handleRpcStream, buildRpcStreamOpenStream, } from './rpcstream.js';
|
|
2
|
+
export { RpcStreamPacket, RpcStreamInit } from './rpcstream.pb.js';
|
|
@@ -11,7 +11,7 @@ export function buildRpcStreamOpenStream(componentId, caller) {
|
|
|
11
11
|
body: {
|
|
12
12
|
$case: 'init',
|
|
13
13
|
init: { componentId },
|
|
14
|
-
}
|
|
14
|
+
},
|
|
15
15
|
});
|
|
16
16
|
// build & return the stream
|
|
17
17
|
return new RpcStream(packetSink, packetSource);
|
|
@@ -67,7 +67,7 @@ export class RpcStream {
|
|
|
67
67
|
try {
|
|
68
68
|
for await (const msg of source) {
|
|
69
69
|
this._packetSink.push({
|
|
70
|
-
body: { $case: 'data', data: msg }
|
|
70
|
+
body: { $case: 'data', data: msg },
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
this._packetSink.end();
|
package/dist/srpc/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { Client } from './client.js';
|
|
|
3
3
|
export { Server } from './server.js';
|
|
4
4
|
export { Conn, ConnParams } from './conn.js';
|
|
5
5
|
export { Handler, InvokeFn, createHandler, createInvokeFn } from './handler.js';
|
|
6
|
+
export { Packet, CallStart, CallData } from './rpcproto.pb.js';
|
|
6
7
|
export { Mux, createMux } from './mux.js';
|
|
7
8
|
export { BroadcastChannelIterable, newBroadcastChannelIterable, BroadcastChannelConn, } from './broadcast-channel.js';
|
|
8
9
|
export { MessagePortIterable, newMessagePortIterable, MessagePortConn, } from './message-port.js';
|
package/dist/srpc/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { Client } from './client.js';
|
|
|
2
2
|
export { Server } from './server.js';
|
|
3
3
|
export { Conn } from './conn.js';
|
|
4
4
|
export { createHandler, createInvokeFn } from './handler.js';
|
|
5
|
+
export { Packet, CallStart, CallData } from './rpcproto.pb.js';
|
|
5
6
|
export { createMux } from './mux.js';
|
|
6
7
|
export { BroadcastChannelIterable, newBroadcastChannelIterable, BroadcastChannelConn, } from './broadcast-channel.js';
|
|
7
8
|
export { MessagePortIterable, newMessagePortIterable, MessagePortConn, } from './message-port.js';
|
package/e2e/e2e_test.go
CHANGED
|
@@ -5,6 +5,7 @@ import (
|
|
|
5
5
|
"io"
|
|
6
6
|
"net"
|
|
7
7
|
"testing"
|
|
8
|
+
"time"
|
|
8
9
|
|
|
9
10
|
"github.com/aperturerobotics/starpc/echo"
|
|
10
11
|
"github.com/aperturerobotics/starpc/srpc"
|
|
@@ -30,17 +31,21 @@ func RunE2E(t *testing.T, cb func(client echo.SRPCEchoerClient) error) {
|
|
|
30
31
|
// construct the client
|
|
31
32
|
clientPipe, serverPipe := net.Pipe()
|
|
32
33
|
|
|
34
|
+
clientMp, err := mp.NewMultiplex(clientPipe, false, nil)
|
|
35
|
+
if err != nil {
|
|
36
|
+
t.Fatal(err.Error())
|
|
37
|
+
}
|
|
38
|
+
client := srpc.NewClientWithMuxedConn(mplex.NewMuxedConn(clientMp))
|
|
39
|
+
|
|
33
40
|
ctx := context.Background()
|
|
41
|
+
serverMp, _ := mp.NewMultiplex(serverPipe, true, nil)
|
|
34
42
|
go func() {
|
|
35
|
-
serverMp, _ := mp.NewMultiplex(serverPipe, false, nil)
|
|
36
43
|
_ = server.AcceptMuxedConn(ctx, mplex.NewMuxedConn(serverMp))
|
|
37
44
|
}()
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
client := srpc.NewClientWithMuxedConn(mplex.NewMuxedConn(clientMp))
|
|
46
|
+
// TODO: requires a moment for the listener to start: not sure why.
|
|
47
|
+
// the packets /should/ be buffered in the pipe.
|
|
48
|
+
<-time.After(time.Millisecond * 100)
|
|
44
49
|
|
|
45
50
|
// construct the client rpc interface
|
|
46
51
|
clientEcho := echo.NewSRPCEchoerClient(client)
|
package/echo/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starpc",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Streaming protobuf RPC service protocol over any two-way channel.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -20,9 +20,7 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"!**/*.tsbuildinfo",
|
|
22
22
|
"Makefile",
|
|
23
|
-
"dist
|
|
24
|
-
"dist/srpc",
|
|
25
|
-
"dist/rpcstream",
|
|
23
|
+
"dist",
|
|
26
24
|
"e2e",
|
|
27
25
|
"echo",
|
|
28
26
|
"go.mod",
|
|
@@ -58,23 +56,23 @@
|
|
|
58
56
|
"singleQuote": true
|
|
59
57
|
},
|
|
60
58
|
"devDependencies": {
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
62
|
-
"@typescript-eslint/parser": "^5.
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
|
60
|
+
"@typescript-eslint/parser": "^5.30.0",
|
|
63
61
|
"depcheck": "^1.4.3",
|
|
64
|
-
"esbuild": "^0.14.
|
|
62
|
+
"esbuild": "^0.14.47",
|
|
65
63
|
"eslint": "^8.18.0",
|
|
66
64
|
"eslint-config-prettier": "^8.5.0",
|
|
67
65
|
"prettier": "^2.7.1",
|
|
68
66
|
"rimraf": "^3.0.2",
|
|
69
|
-
"ts-proto": "^1.115.
|
|
67
|
+
"ts-proto": "^1.115.5",
|
|
70
68
|
"typescript": "^4.7.4"
|
|
71
69
|
},
|
|
72
70
|
"dependencies": {
|
|
73
|
-
"@libp2p/interface-connection": "^2.
|
|
74
|
-
"@libp2p/interface-stream-muxer": "^
|
|
75
|
-
"@libp2p/mplex": "^
|
|
71
|
+
"@libp2p/interface-connection": "^2.1.1",
|
|
72
|
+
"@libp2p/interface-stream-muxer": "^2.0.1",
|
|
73
|
+
"@libp2p/mplex": "^4.0.0",
|
|
76
74
|
"event-iterator": "^2.0.0",
|
|
77
|
-
"isomorphic-ws": "^
|
|
75
|
+
"isomorphic-ws": "^5.0.0",
|
|
78
76
|
"it-length-prefixed": "^7.0.1",
|
|
79
77
|
"it-pipe": "^2.0.3",
|
|
80
78
|
"it-pushable": "^3.0.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
diff --git a/node_modules/ts-poet/build/Import.js b/node_modules/ts-poet/build/Import.js
|
|
2
|
-
index
|
|
2
|
+
index fe1f6d2..280df8f 100644
|
|
3
3
|
--- a/node_modules/ts-poet/build/Import.js
|
|
4
4
|
+++ b/node_modules/ts-poet/build/Import.js
|
|
5
5
|
@@ -293,6 +293,14 @@ function emitImports(imports, ourModulePath, importMappings) {
|
package/srpc/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { Client } from './client.js'
|
|
|
3
3
|
export { Server } from './server.js'
|
|
4
4
|
export { Conn, ConnParams } from './conn.js'
|
|
5
5
|
export { Handler, InvokeFn, createHandler, createInvokeFn } from './handler.js'
|
|
6
|
+
export { Packet, CallStart, CallData } from './rpcproto.pb.js'
|
|
6
7
|
export { Mux, createMux } from './mux.js'
|
|
7
8
|
export {
|
|
8
9
|
BroadcastChannelIterable,
|