starpc 0.4.8 → 0.4.9

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.
@@ -2,7 +2,7 @@ import type { Duplex, Sink } from 'it-stream-types';
2
2
  import { ConnParams } from './conn.js';
3
3
  import { Server } from './server.js';
4
4
  import { DuplexConn } from './conn-duplex.js';
5
- export declare class BroadcastChannelIterable<T> implements Duplex<T> {
5
+ export declare class BroadcastChannelDuplex<T> implements Duplex<T> {
6
6
  readonly readChannel: BroadcastChannel;
7
7
  readonly writeChannel: BroadcastChannel;
8
8
  sink: Sink<T>;
@@ -12,7 +12,7 @@ export declare class BroadcastChannelIterable<T> implements Duplex<T> {
12
12
  private _createSink;
13
13
  private _createSource;
14
14
  }
15
- export declare function newBroadcastChannelIterable<T>(readName: string, writeName: string): BroadcastChannelIterable<T>;
15
+ export declare function newBroadcastChannelDuplex<T>(readName: string, writeName: string): BroadcastChannelDuplex<T>;
16
16
  export declare class BroadcastChannelConn extends DuplexConn {
17
17
  private broadcastChannel;
18
18
  constructor(readChannel: BroadcastChannel, writeChannel: BroadcastChannel, server?: Server, connParams?: ConnParams);
@@ -1,7 +1,7 @@
1
1
  import { EventIterator } from 'event-iterator';
2
2
  import { DuplexConn } from './conn-duplex.js';
3
- // BroadcastChannelIterable is a AsyncIterable wrapper for BroadcastChannel.
4
- export class BroadcastChannelIterable {
3
+ // BroadcastChannelDuplex is a AsyncIterable wrapper for BroadcastChannel.
4
+ export class BroadcastChannelDuplex {
5
5
  constructor(readChannel, writeChannel) {
6
6
  this.readChannel = readChannel;
7
7
  this.writeChannel = writeChannel;
@@ -36,16 +36,16 @@ export class BroadcastChannelIterable {
36
36
  });
37
37
  }
38
38
  }
39
- // newBroadcastChannelIterable constructs a BroadcastChannelIterable with a channel name.
40
- export function newBroadcastChannelIterable(readName, writeName) {
41
- return new BroadcastChannelIterable(new BroadcastChannel(readName), new BroadcastChannel(writeName));
39
+ // newBroadcastChannelDuplex constructs a BroadcastChannelDuplex with a channel name.
40
+ export function newBroadcastChannelDuplex(readName, writeName) {
41
+ return new BroadcastChannelDuplex(new BroadcastChannel(readName), new BroadcastChannel(writeName));
42
42
  }
43
43
  // BroadcastChannelConn implements a connection with a BroadcastChannel.
44
44
  //
45
45
  // expects Uint8Array objects over the BroadcastChannel.
46
46
  export class BroadcastChannelConn extends DuplexConn {
47
47
  constructor(readChannel, writeChannel, server, connParams) {
48
- const broadcastChannel = new BroadcastChannelIterable(readChannel, writeChannel);
48
+ const broadcastChannel = new BroadcastChannelDuplex(readChannel, writeChannel);
49
49
  super(broadcastChannel, server, connParams);
50
50
  this.broadcastChannel = broadcastChannel;
51
51
  }
@@ -5,6 +5,6 @@ export { Conn, ConnParams } from './conn.js';
5
5
  export { Handler, InvokeFn, createHandler, createInvokeFn } from './handler.js';
6
6
  export { Packet, CallStart, CallData } from './rpcproto.pb.js';
7
7
  export { Mux, createMux } from './mux.js';
8
- export { BroadcastChannelIterable, newBroadcastChannelIterable, BroadcastChannelConn, } from './broadcast-channel.js';
8
+ export { BroadcastChannelDuplex, newBroadcastChannelDuplex, BroadcastChannelConn, } from './broadcast-channel.js';
9
9
  export { MessagePortIterable, newMessagePortIterable, MessagePortConn, } from './message-port.js';
10
10
  export { ObservableSource } from './observable-source.js';
@@ -4,6 +4,6 @@ export { Conn } from './conn.js';
4
4
  export { createHandler, createInvokeFn } from './handler.js';
5
5
  export { Packet, CallStart, CallData } from './rpcproto.pb.js';
6
6
  export { createMux } from './mux.js';
7
- export { BroadcastChannelIterable, newBroadcastChannelIterable, BroadcastChannelConn, } from './broadcast-channel.js';
7
+ export { BroadcastChannelDuplex, newBroadcastChannelDuplex, BroadcastChannelConn, } from './broadcast-channel.js';
8
8
  export { MessagePortIterable, newMessagePortIterable, MessagePortConn, } from './message-port.js';
9
9
  export { ObservableSource } from './observable-source.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -5,8 +5,8 @@ import { ConnParams } from './conn.js'
5
5
  import { Server } from './server.js'
6
6
  import { DuplexConn } from './conn-duplex.js'
7
7
 
8
- // BroadcastChannelIterable is a AsyncIterable wrapper for BroadcastChannel.
9
- export class BroadcastChannelIterable<T> implements Duplex<T> {
8
+ // BroadcastChannelDuplex is a AsyncIterable wrapper for BroadcastChannel.
9
+ export class BroadcastChannelDuplex<T> implements Duplex<T> {
10
10
  // readChannel is the incoming broadcast channel
11
11
  public readonly readChannel: BroadcastChannel
12
12
  // writeChannel is the outgoing broadcast channel
@@ -55,12 +55,12 @@ export class BroadcastChannelIterable<T> implements Duplex<T> {
55
55
  }
56
56
  }
57
57
 
58
- // newBroadcastChannelIterable constructs a BroadcastChannelIterable with a channel name.
59
- export function newBroadcastChannelIterable<T>(
58
+ // newBroadcastChannelDuplex constructs a BroadcastChannelDuplex with a channel name.
59
+ export function newBroadcastChannelDuplex<T>(
60
60
  readName: string,
61
61
  writeName: string
62
- ): BroadcastChannelIterable<T> {
63
- return new BroadcastChannelIterable<T>(
62
+ ): BroadcastChannelDuplex<T> {
63
+ return new BroadcastChannelDuplex<T>(
64
64
  new BroadcastChannel(readName),
65
65
  new BroadcastChannel(writeName)
66
66
  )
@@ -71,7 +71,7 @@ export function newBroadcastChannelIterable<T>(
71
71
  // expects Uint8Array objects over the BroadcastChannel.
72
72
  export class BroadcastChannelConn extends DuplexConn {
73
73
  // broadcastChannel is the broadcast channel iterable
74
- private broadcastChannel: BroadcastChannelIterable<Uint8Array>
74
+ private broadcastChannel: BroadcastChannelDuplex<Uint8Array>
75
75
 
76
76
  constructor(
77
77
  readChannel: BroadcastChannel,
@@ -79,7 +79,7 @@ export class BroadcastChannelConn extends DuplexConn {
79
79
  server?: Server,
80
80
  connParams?: ConnParams
81
81
  ) {
82
- const broadcastChannel = new BroadcastChannelIterable<Uint8Array>(
82
+ const broadcastChannel = new BroadcastChannelDuplex<Uint8Array>(
83
83
  readChannel,
84
84
  writeChannel
85
85
  )
package/srpc/index.ts CHANGED
@@ -6,8 +6,8 @@ export { Handler, InvokeFn, createHandler, createInvokeFn } from './handler.js'
6
6
  export { Packet, CallStart, CallData } from './rpcproto.pb.js'
7
7
  export { Mux, createMux } from './mux.js'
8
8
  export {
9
- BroadcastChannelIterable,
10
- newBroadcastChannelIterable,
9
+ BroadcastChannelDuplex,
10
+ newBroadcastChannelDuplex,
11
11
  BroadcastChannelConn,
12
12
  } from './broadcast-channel.js'
13
13
  export {