starpc 0.21.6 → 0.22.0

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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="ws" />
2
2
  import { Direction } from '@libp2p/interface/connection';
3
- import type WebSocket from 'isomorphic-ws';
3
+ import type WebSocket from '@aptre/it-ws/web-socket';
4
4
  import { Conn } from './conn.js';
5
5
  import { Server } from './server.js';
6
6
  export declare class WebSocketConn extends Conn {
@@ -1,5 +1,5 @@
1
- import { duplex } from 'it-ws';
2
1
  import { pipe } from 'it-pipe';
2
+ import duplex from '@aptre/it-ws/duplex';
3
3
  import { Conn } from './conn.js';
4
4
  // WebSocketConn implements a connection with a WebSocket and optional Server.
5
5
  export class WebSocketConn extends Conn {
@@ -102,6 +102,9 @@ type srpcEchoer_EchoClientStreamClient struct {
102
102
  }
103
103
 
104
104
  func (x *srpcEchoer_EchoClientStreamClient) Send(m *EchoMsg) error {
105
+ if m == nil {
106
+ return nil
107
+ }
105
108
  return x.MsgSend(m)
106
109
  }
107
110
 
@@ -144,6 +147,9 @@ type srpcEchoer_EchoBidiStreamClient struct {
144
147
  }
145
148
 
146
149
  func (x *srpcEchoer_EchoBidiStreamClient) Send(m *EchoMsg) error {
150
+ if m == nil {
151
+ return nil
152
+ }
147
153
  return x.MsgSend(m)
148
154
  }
149
155
 
@@ -180,6 +186,9 @@ type srpcEchoer_RpcStreamClient struct {
180
186
  }
181
187
 
182
188
  func (x *srpcEchoer_RpcStreamClient) Send(m *rpcstream.RpcStreamPacket) error {
189
+ if m == nil {
190
+ return nil
191
+ }
183
192
  return x.MsgSend(m)
184
193
  }
185
194
 
@@ -346,8 +355,10 @@ func (x *srpcEchoer_EchoServerStreamStream) Send(m *EchoMsg) error {
346
355
  }
347
356
 
348
357
  func (x *srpcEchoer_EchoServerStreamStream) SendAndClose(m *EchoMsg) error {
349
- if err := x.MsgSend(m); err != nil {
350
- return err
358
+ if m != nil {
359
+ if err := x.MsgSend(m); err != nil {
360
+ return err
361
+ }
351
362
  }
352
363
  return x.CloseSend()
353
364
  }
@@ -389,8 +400,10 @@ func (x *srpcEchoer_EchoBidiStreamStream) Send(m *EchoMsg) error {
389
400
  }
390
401
 
391
402
  func (x *srpcEchoer_EchoBidiStreamStream) SendAndClose(m *EchoMsg) error {
392
- if err := x.MsgSend(m); err != nil {
393
- return err
403
+ if m != nil {
404
+ if err := x.MsgSend(m); err != nil {
405
+ return err
406
+ }
394
407
  }
395
408
  return x.CloseSend()
396
409
  }
@@ -423,8 +436,10 @@ func (x *srpcEchoer_RpcStreamStream) Send(m *rpcstream.RpcStreamPacket) error {
423
436
  }
424
437
 
425
438
  func (x *srpcEchoer_RpcStreamStream) SendAndClose(m *rpcstream.RpcStreamPacket) error {
426
- if err := x.MsgSend(m); err != nil {
427
- return err
439
+ if m != nil {
440
+ if err := x.MsgSend(m); err != nil {
441
+ return err
442
+ }
428
443
  }
429
444
  return x.CloseSend()
430
445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.21.6",
3
+ "version": "0.22.0",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -33,7 +33,8 @@
33
33
  "url": "git+ssh://git@github.com/aperturerobotics/starpc.git"
34
34
  },
35
35
  "scripts": {
36
- "build": "rimraf ./dist && tsc --project tsconfig.build.json --outDir ./dist/",
36
+ "clean": "rimraf ./dist",
37
+ "build": "npm run clean && tsc --project tsconfig.build.json --outDir ./dist/",
37
38
  "check": "npm run typecheck",
38
39
  "typecheck": "tsc --noEmit",
39
40
  "deps": "depcheck --ignores 'bufferutil,utf-8-validate,ts-proto,rimraf,@aperturerobotics/ts-common'",
@@ -76,6 +77,7 @@
76
77
  "utf-8-validate": "^6.0.3"
77
78
  },
78
79
  "dependencies": {
80
+ "@aptre/it-ws": "^1.0.0",
79
81
  "@chainsafe/libp2p-yamux": "^5.0.0",
80
82
  "@libp2p/interface": "^0.1.2",
81
83
  "event-iterator": "^2.0.0",
@@ -86,7 +88,6 @@
86
88
  "it-pipe": "^3.0.1",
87
89
  "it-pushable": "^3.2.3",
88
90
  "it-stream-types": "^2.0.1",
89
- "it-ws": "^6.1.1",
90
91
  "long": "^5.2.3",
91
92
  "memoize-one": "^6.0.0",
92
93
  "patch-package": "^8.0.0",
package/srpc/websocket.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { duplex } from 'it-ws'
2
1
  import { pipe } from 'it-pipe'
3
2
  import { Direction } from '@libp2p/interface/connection'
4
- import type WebSocket from 'isomorphic-ws'
3
+
4
+ import duplex from '@aptre/it-ws/duplex'
5
+ import type WebSocket from '@aptre/it-ws/web-socket'
5
6
 
6
7
  import { Conn } from './conn.js'
7
8
  import { Server } from './server.js'