starpc 0.10.2 → 0.10.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.
@@ -12,7 +12,8 @@ export declare class Server implements StreamHandler {
12
12
  get rpcStreamHandler(): RpcStreamHandler;
13
13
  startRpc(): ServerRPC;
14
14
  handleStream(stream: Stream): ServerRPC;
15
- handleDuplex(stream: Duplex<Uint8ArrayList, Uint8ArrayList | Uint8Array>): ServerRPC;
15
+ handleDuplex(stream: Duplex<Uint8ArrayList | Uint8Array, Uint8ArrayList | Uint8Array>): ServerRPC;
16
+ handleUint8ArrayDuplex(stream: Duplex<Uint8Array>): ServerRPC;
16
17
  handlePacketDuplex(stream: Duplex<Uint8Array>): ServerRPC;
17
18
  handlePacketStream(stream: Duplex<Packet>): ServerRPC;
18
19
  }
@@ -26,6 +26,11 @@ export class Server {
26
26
  pipe(stream, parseLengthPrefixTransform(), combineUint8ArrayListTransform(), decodePacketSource, rpc, encodePacketSource, prependLengthPrefixTransform(), stream);
27
27
  return rpc;
28
28
  }
29
+ handleUint8ArrayDuplex(stream) {
30
+ const rpc = this.startRpc();
31
+ pipe(stream, parseLengthPrefixTransform(), combineUint8ArrayListTransform(), decodePacketSource, rpc, encodePacketSource, prependLengthPrefixTransform(), combineUint8ArrayListTransform(), stream);
32
+ return rpc;
33
+ }
29
34
  // handlePacketDuplex handles an incoming Uint8Array duplex.
30
35
  // skips the packet length prefix transform.
31
36
  handlePacketDuplex(stream) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
package/srpc/server.ts CHANGED
@@ -43,7 +43,7 @@ export class Server implements StreamHandler {
43
43
 
44
44
  // handleDuplex handles an incoming message duplex.
45
45
  public handleDuplex(
46
- stream: Duplex<Uint8ArrayList, Uint8ArrayList | Uint8Array>
46
+ stream: Duplex<Uint8ArrayList | Uint8Array, Uint8ArrayList | Uint8Array>
47
47
  ): ServerRPC {
48
48
  const rpc = this.startRpc()
49
49
  pipe(
@@ -59,6 +59,24 @@ export class Server implements StreamHandler {
59
59
  return rpc
60
60
  }
61
61
 
62
+ public handleUint8ArrayDuplex(
63
+ stream: Duplex<Uint8Array>
64
+ ): ServerRPC {
65
+ const rpc = this.startRpc()
66
+ pipe(
67
+ stream,
68
+ parseLengthPrefixTransform(),
69
+ combineUint8ArrayListTransform(),
70
+ decodePacketSource,
71
+ rpc,
72
+ encodePacketSource,
73
+ prependLengthPrefixTransform(),
74
+ combineUint8ArrayListTransform(),
75
+ stream
76
+ )
77
+ return rpc
78
+ }
79
+
62
80
  // handlePacketDuplex handles an incoming Uint8Array duplex.
63
81
  // skips the packet length prefix transform.
64
82
  public handlePacketDuplex(stream: Duplex<Uint8Array>): ServerRPC {