starpc 0.31.13 → 0.32.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,5 +1,5 @@
1
- import type { MessageType } from "@aptre/protobuf-es-lite";
2
- import { Message } from "@aptre/protobuf-es-lite";
1
+ import type { MessageType } from '@aptre/protobuf-es-lite';
2
+ import { Message } from '@aptre/protobuf-es-lite';
3
3
  export declare const protobufPackage = "e2e.mock";
4
4
  /**
5
5
  * MockMsg is the mock message body.
@@ -1,12 +1,13 @@
1
1
  // @generated by protoc-gen-es-lite unknown with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/e2e/mock/mock.proto (package e2e.mock, syntax proto3)
3
3
  /* eslint-disable */
4
- import { createMessageType } from "@aptre/protobuf-es-lite";
5
- export const protobufPackage = "e2e.mock";
4
+ import { createMessageType, ScalarType } from '@aptre/protobuf-es-lite';
5
+ export const protobufPackage = 'e2e.mock';
6
+ // MockMsg contains the message type declaration for MockMsg.
6
7
  export const MockMsg = createMessageType({
7
- typeName: "e2e.mock.MockMsg",
8
+ typeName: 'e2e.mock.MockMsg',
8
9
  fields: [
9
- { no: 1, name: "body", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10
+ { no: 1, name: 'body', kind: 'scalar', T: ScalarType.STRING },
10
11
  ],
11
12
  packedByDefault: true,
12
13
  });
@@ -1,6 +1,6 @@
1
- import { MockMsg } from "./mock.pb.js";
2
- import { Message, MethodKind } from "@aptre/protobuf-es-lite";
3
- import { ProtoRpc } from "starpc";
1
+ import { MockMsg } from './mock.pb.js';
2
+ import { Message, MethodKind } from '@aptre/protobuf-es-lite';
3
+ import { ProtoRpc } from 'starpc';
4
4
  /**
5
5
  * Mock service mocks some RPCs for the e2e tests.
6
6
  *
@@ -1,15 +1,15 @@
1
1
  // @generated by protoc-gen-es-starpc none with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/e2e/mock/mock.proto (package e2e.mock, syntax proto3)
3
3
  /* eslint-disable */
4
- import { MockMsg } from "./mock.pb.js";
5
- import { MethodKind } from "@aptre/protobuf-es-lite";
4
+ import { MockMsg } from './mock.pb.js';
5
+ import { MethodKind } from '@aptre/protobuf-es-lite';
6
6
  /**
7
7
  * Mock service mocks some RPCs for the e2e tests.
8
8
  *
9
9
  * @generated from service e2e.mock.Mock
10
10
  */
11
11
  export const MockDefinition = {
12
- typeName: "e2e.mock.Mock",
12
+ typeName: 'e2e.mock.Mock',
13
13
  methods: {
14
14
  /**
15
15
  * MockRequest runs a mock unary request.
@@ -17,12 +17,12 @@ export const MockDefinition = {
17
17
  * @generated from rpc e2e.mock.Mock.MockRequest
18
18
  */
19
19
  MockRequest: {
20
- name: "MockRequest",
20
+ name: 'MockRequest',
21
21
  I: MockMsg,
22
22
  O: MockMsg,
23
23
  kind: MethodKind.Unary,
24
24
  },
25
- }
25
+ },
26
26
  };
27
27
  export const MockServiceName = MockDefinition.typeName;
28
28
  export class MockClient {
@@ -1,5 +1,5 @@
1
- import type { MessageType } from "@aptre/protobuf-es-lite";
2
- import { Message } from "@aptre/protobuf-es-lite";
1
+ import type { MessageType } from '@aptre/protobuf-es-lite';
2
+ import { Message } from '@aptre/protobuf-es-lite';
3
3
  export declare const protobufPackage = "echo";
4
4
  /**
5
5
  * EchoMsg is the message body for Echo.
@@ -1,12 +1,13 @@
1
1
  // @generated by protoc-gen-es-lite unknown with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/echo/echo.proto (package echo, syntax proto3)
3
3
  /* eslint-disable */
4
- import { createMessageType } from "@aptre/protobuf-es-lite";
5
- export const protobufPackage = "echo";
4
+ import { createMessageType, ScalarType } from '@aptre/protobuf-es-lite';
5
+ export const protobufPackage = 'echo';
6
+ // EchoMsg contains the message type declaration for EchoMsg.
6
7
  export const EchoMsg = createMessageType({
7
- typeName: "echo.EchoMsg",
8
+ typeName: 'echo.EchoMsg',
8
9
  fields: [
9
- { no: 1, name: "body", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10
+ { no: 1, name: 'body', kind: 'scalar', T: ScalarType.STRING },
10
11
  ],
11
12
  packedByDefault: true,
12
13
  });
@@ -1,7 +1,7 @@
1
- import { EchoMsg } from "./echo.pb.js";
2
- import { Message, MethodKind } from "@aptre/protobuf-es-lite";
3
- import { RpcStreamPacket } from "../rpcstream/rpcstream.pb.js";
4
- import { MessageStream, ProtoRpc } from "starpc";
1
+ import { EchoMsg } from './echo.pb.js';
2
+ import { Message, MethodKind } from '@aptre/protobuf-es-lite';
3
+ import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js';
4
+ import { MessageStream, ProtoRpc } from 'starpc';
5
5
  /**
6
6
  * Echoer service returns the given message.
7
7
  *
@@ -1,17 +1,17 @@
1
1
  // @generated by protoc-gen-es-starpc none with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/echo/echo.proto (package echo, syntax proto3)
3
3
  /* eslint-disable */
4
- import { EchoMsg } from "./echo.pb.js";
5
- import { MethodKind } from "@aptre/protobuf-es-lite";
6
- import { RpcStreamPacket } from "../rpcstream/rpcstream.pb.js";
7
- import { buildDecodeMessageTransform, buildEncodeMessageTransform } from "starpc";
4
+ import { EchoMsg } from './echo.pb.js';
5
+ import { MethodKind } from '@aptre/protobuf-es-lite';
6
+ import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js';
7
+ import { buildDecodeMessageTransform, buildEncodeMessageTransform, } from 'starpc';
8
8
  /**
9
9
  * Echoer service returns the given message.
10
10
  *
11
11
  * @generated from service echo.Echoer
12
12
  */
13
13
  export const EchoerDefinition = {
14
- typeName: "echo.Echoer",
14
+ typeName: 'echo.Echoer',
15
15
  methods: {
16
16
  /**
17
17
  * Echo returns the given message.
@@ -19,7 +19,7 @@ export const EchoerDefinition = {
19
19
  * @generated from rpc echo.Echoer.Echo
20
20
  */
21
21
  Echo: {
22
- name: "Echo",
22
+ name: 'Echo',
23
23
  I: EchoMsg,
24
24
  O: EchoMsg,
25
25
  kind: MethodKind.Unary,
@@ -30,7 +30,7 @@ export const EchoerDefinition = {
30
30
  * @generated from rpc echo.Echoer.EchoServerStream
31
31
  */
32
32
  EchoServerStream: {
33
- name: "EchoServerStream",
33
+ name: 'EchoServerStream',
34
34
  I: EchoMsg,
35
35
  O: EchoMsg,
36
36
  kind: MethodKind.ServerStreaming,
@@ -41,7 +41,7 @@ export const EchoerDefinition = {
41
41
  * @generated from rpc echo.Echoer.EchoClientStream
42
42
  */
43
43
  EchoClientStream: {
44
- name: "EchoClientStream",
44
+ name: 'EchoClientStream',
45
45
  I: EchoMsg,
46
46
  O: EchoMsg,
47
47
  kind: MethodKind.ClientStreaming,
@@ -52,7 +52,7 @@ export const EchoerDefinition = {
52
52
  * @generated from rpc echo.Echoer.EchoBidiStream
53
53
  */
54
54
  EchoBidiStream: {
55
- name: "EchoBidiStream",
55
+ name: 'EchoBidiStream',
56
56
  I: EchoMsg,
57
57
  O: EchoMsg,
58
58
  kind: MethodKind.BiDiStreaming,
@@ -63,12 +63,12 @@ export const EchoerDefinition = {
63
63
  * @generated from rpc echo.Echoer.RpcStream
64
64
  */
65
65
  RpcStream: {
66
- name: "RpcStream",
66
+ name: 'RpcStream',
67
67
  I: RpcStreamPacket,
68
68
  O: RpcStreamPacket,
69
69
  kind: MethodKind.BiDiStreaming,
70
70
  },
71
- }
71
+ },
72
72
  };
73
73
  export const EchoerServiceName = EchoerDefinition.typeName;
74
74
  export class EchoerClient {
@@ -1,5 +1,5 @@
1
- import type { MessageType } from "@aptre/protobuf-es-lite";
2
- import { Message } from "@aptre/protobuf-es-lite";
1
+ import type { MessageType } from '@aptre/protobuf-es-lite';
2
+ import { Message } from '@aptre/protobuf-es-lite';
3
3
  export declare const protobufPackage = "rpcstream";
4
4
  /**
5
5
  * RpcStreamInit is the first message in a RPC stream.
@@ -49,7 +49,7 @@ export type RpcStreamPacket = Message<{
49
49
  * @generated from field: rpcstream.RpcStreamInit init = 1;
50
50
  */
51
51
  value: RpcStreamInit;
52
- case: "init";
52
+ case: 'init';
53
53
  } | {
54
54
  /**
55
55
  * Ack is sent in response to Init.
@@ -58,7 +58,7 @@ export type RpcStreamPacket = Message<{
58
58
  * @generated from field: rpcstream.RpcAck ack = 2;
59
59
  */
60
60
  value: RpcAck;
61
- case: "ack";
61
+ case: 'ack';
62
62
  } | {
63
63
  /**
64
64
  * Data is the encapsulated data packet.
@@ -66,7 +66,7 @@ export type RpcStreamPacket = Message<{
66
66
  * @generated from field: bytes data = 3;
67
67
  */
68
68
  value: Uint8Array;
69
- case: "data";
69
+ case: 'data';
70
70
  };
71
71
  }>;
72
72
  export declare const RpcStreamPacket: MessageType<RpcStreamPacket>;
@@ -1,28 +1,37 @@
1
1
  // @generated by protoc-gen-es-lite unknown with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/rpcstream/rpcstream.proto (package rpcstream, syntax proto3)
3
3
  /* eslint-disable */
4
- import { createMessageType } from "@aptre/protobuf-es-lite";
5
- export const protobufPackage = "rpcstream";
4
+ import { createMessageType, ScalarType } from '@aptre/protobuf-es-lite';
5
+ export const protobufPackage = 'rpcstream';
6
+ // RpcStreamInit contains the message type declaration for RpcStreamInit.
6
7
  export const RpcStreamInit = createMessageType({
7
- typeName: "rpcstream.RpcStreamInit",
8
+ typeName: 'rpcstream.RpcStreamInit',
8
9
  fields: [
9
- { no: 1, name: "component_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10
+ { no: 1, name: 'component_id', kind: 'scalar', T: ScalarType.STRING },
10
11
  ],
11
12
  packedByDefault: true,
12
13
  });
14
+ // RpcAck contains the message type declaration for RpcAck.
13
15
  export const RpcAck = createMessageType({
14
- typeName: "rpcstream.RpcAck",
16
+ typeName: 'rpcstream.RpcAck',
15
17
  fields: [
16
- { no: 1, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */ },
18
+ { no: 1, name: 'error', kind: 'scalar', T: ScalarType.STRING },
17
19
  ],
18
20
  packedByDefault: true,
19
21
  });
22
+ // RpcStreamPacket contains the message type declaration for RpcStreamPacket.
20
23
  export const RpcStreamPacket = createMessageType({
21
- typeName: "rpcstream.RpcStreamPacket",
24
+ typeName: 'rpcstream.RpcStreamPacket',
22
25
  fields: [
23
- { no: 1, name: "init", kind: "message", T: () => RpcStreamInit, oneof: "body" },
24
- { no: 2, name: "ack", kind: "message", T: () => RpcAck, oneof: "body" },
25
- { no: 3, name: "data", kind: "scalar", T: 12 /* ScalarType.BYTES */, oneof: "body" },
26
+ {
27
+ no: 1,
28
+ name: 'init',
29
+ kind: 'message',
30
+ T: () => RpcStreamInit,
31
+ oneof: 'body',
32
+ },
33
+ { no: 2, name: 'ack', kind: 'message', T: () => RpcAck, oneof: 'body' },
34
+ { no: 3, name: 'data', kind: 'scalar', T: ScalarType.BYTES, oneof: 'body' },
26
35
  ],
27
36
  packedByDefault: true,
28
37
  });
@@ -1,5 +1,5 @@
1
- import type { MessageType } from "@aptre/protobuf-es-lite";
2
- import { Message } from "@aptre/protobuf-es-lite";
1
+ import type { MessageType } from '@aptre/protobuf-es-lite';
2
+ import { Message } from '@aptre/protobuf-es-lite';
3
3
  export declare const protobufPackage = "srpc";
4
4
  /**
5
5
  * CallStart requests starting a new RPC call.
@@ -90,7 +90,7 @@ export type Packet = Message<{
90
90
  * @generated from field: srpc.CallStart call_start = 1;
91
91
  */
92
92
  value: CallStart;
93
- case: "callStart";
93
+ case: 'callStart';
94
94
  } | {
95
95
  /**
96
96
  * CallData is a message in a streaming RPC sequence.
@@ -98,7 +98,7 @@ export type Packet = Message<{
98
98
  * @generated from field: srpc.CallData call_data = 2;
99
99
  */
100
100
  value: CallData;
101
- case: "callData";
101
+ case: 'callData';
102
102
  } | {
103
103
  /**
104
104
  * CallCancel cancels the call.
@@ -106,7 +106,7 @@ export type Packet = Message<{
106
106
  * @generated from field: bool call_cancel = 3;
107
107
  */
108
108
  value: boolean;
109
- case: "callCancel";
109
+ case: 'callCancel';
110
110
  };
111
111
  }>;
112
112
  export declare const Packet: MessageType<Packet>;
@@ -1,34 +1,55 @@
1
1
  // @generated by protoc-gen-es-lite unknown with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/srpc/rpcproto.proto (package srpc, syntax proto3)
3
3
  /* eslint-disable */
4
- import { createMessageType } from "@aptre/protobuf-es-lite";
5
- export const protobufPackage = "srpc";
4
+ import { createMessageType, ScalarType } from '@aptre/protobuf-es-lite';
5
+ export const protobufPackage = 'srpc';
6
+ // CallStart contains the message type declaration for CallStart.
6
7
  export const CallStart = createMessageType({
7
- typeName: "srpc.CallStart",
8
+ typeName: 'srpc.CallStart',
8
9
  fields: [
9
- { no: 1, name: "rpc_service", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10
- { no: 2, name: "rpc_method", kind: "scalar", T: 9 /* ScalarType.STRING */ },
11
- { no: 3, name: "data", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
12
- { no: 4, name: "data_is_zero", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
10
+ { no: 1, name: 'rpc_service', kind: 'scalar', T: ScalarType.STRING },
11
+ { no: 2, name: 'rpc_method', kind: 'scalar', T: ScalarType.STRING },
12
+ { no: 3, name: 'data', kind: 'scalar', T: ScalarType.BYTES },
13
+ { no: 4, name: 'data_is_zero', kind: 'scalar', T: ScalarType.BOOL },
13
14
  ],
14
15
  packedByDefault: true,
15
16
  });
17
+ // CallData contains the message type declaration for CallData.
16
18
  export const CallData = createMessageType({
17
- typeName: "srpc.CallData",
19
+ typeName: 'srpc.CallData',
18
20
  fields: [
19
- { no: 1, name: "data", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
20
- { no: 2, name: "data_is_zero", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
21
- { no: 3, name: "complete", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
22
- { no: 4, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */ },
21
+ { no: 1, name: 'data', kind: 'scalar', T: ScalarType.BYTES },
22
+ { no: 2, name: 'data_is_zero', kind: 'scalar', T: ScalarType.BOOL },
23
+ { no: 3, name: 'complete', kind: 'scalar', T: ScalarType.BOOL },
24
+ { no: 4, name: 'error', kind: 'scalar', T: ScalarType.STRING },
23
25
  ],
24
26
  packedByDefault: true,
25
27
  });
28
+ // Packet contains the message type declaration for Packet.
26
29
  export const Packet = createMessageType({
27
- typeName: "srpc.Packet",
30
+ typeName: 'srpc.Packet',
28
31
  fields: [
29
- { no: 1, name: "call_start", kind: "message", T: () => CallStart, oneof: "body" },
30
- { no: 2, name: "call_data", kind: "message", T: () => CallData, oneof: "body" },
31
- { no: 3, name: "call_cancel", kind: "scalar", T: 8 /* ScalarType.BOOL */, oneof: "body" },
32
+ {
33
+ no: 1,
34
+ name: 'call_start',
35
+ kind: 'message',
36
+ T: () => CallStart,
37
+ oneof: 'body',
38
+ },
39
+ {
40
+ no: 2,
41
+ name: 'call_data',
42
+ kind: 'message',
43
+ T: () => CallData,
44
+ oneof: 'body',
45
+ },
46
+ {
47
+ no: 3,
48
+ name: 'call_cancel',
49
+ kind: 'scalar',
50
+ T: ScalarType.BOOL,
51
+ oneof: 'body',
52
+ },
32
53
  ],
33
54
  packedByDefault: true,
34
55
  });
@@ -2,10 +2,10 @@
2
2
  // @generated from file github.com/aperturerobotics/starpc/e2e/mock/mock.proto (package e2e.mock, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
- import type { MessageType, PartialFieldInfo } from "@aptre/protobuf-es-lite";
6
- import { createMessageType, Message } from "@aptre/protobuf-es-lite";
5
+ import type { MessageType, PartialFieldInfo } from '@aptre/protobuf-es-lite'
6
+ import { createMessageType, Message, ScalarType } from '@aptre/protobuf-es-lite'
7
7
 
8
- export const protobufPackage = "e2e.mock";
8
+ export const protobufPackage = 'e2e.mock'
9
9
 
10
10
  /**
11
11
  * MockMsg is the mock message body.
@@ -16,17 +16,14 @@ export type MockMsg = Message<{
16
16
  /**
17
17
  * @generated from field: string body = 1;
18
18
  */
19
- body?: string;
20
-
21
- }>;
22
-
23
- export const MockMsg: MessageType<MockMsg> = createMessageType(
24
- {
25
- typeName: "e2e.mock.MockMsg",
26
- fields: [
27
- { no: 1, name: "body", kind: "scalar", T: 9 /* ScalarType.STRING */ },
28
- ] as readonly PartialFieldInfo[],
29
- packedByDefault: true,
30
- },
31
- );
19
+ body?: string
20
+ }>
32
21
 
22
+ // MockMsg contains the message type declaration for MockMsg.
23
+ export const MockMsg: MessageType<MockMsg> = createMessageType({
24
+ typeName: 'e2e.mock.MockMsg',
25
+ fields: [
26
+ { no: 1, name: 'body', kind: 'scalar', T: ScalarType.STRING },
27
+ ] as readonly PartialFieldInfo[],
28
+ packedByDefault: true,
29
+ })
@@ -2,9 +2,9 @@
2
2
  // @generated from file github.com/aperturerobotics/starpc/e2e/mock/mock.proto (package e2e.mock, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
- import { MockMsg } from "./mock.pb.js";
6
- import { Message, MethodKind } from "@aptre/protobuf-es-lite";
7
- import { ProtoRpc } from "starpc";
5
+ import { MockMsg } from './mock.pb.js'
6
+ import { Message, MethodKind } from '@aptre/protobuf-es-lite'
7
+ import { ProtoRpc } from 'starpc'
8
8
 
9
9
  /**
10
10
  * Mock service mocks some RPCs for the e2e tests.
@@ -12,7 +12,7 @@ import { ProtoRpc } from "starpc";
12
12
  * @generated from service e2e.mock.Mock
13
13
  */
14
14
  export const MockDefinition = {
15
- typeName: "e2e.mock.Mock",
15
+ typeName: 'e2e.mock.Mock',
16
16
  methods: {
17
17
  /**
18
18
  * MockRequest runs a mock unary request.
@@ -20,13 +20,13 @@ export const MockDefinition = {
20
20
  * @generated from rpc e2e.mock.Mock.MockRequest
21
21
  */
22
22
  MockRequest: {
23
- name: "MockRequest",
23
+ name: 'MockRequest',
24
24
  I: MockMsg,
25
25
  O: MockMsg,
26
26
  kind: MethodKind.Unary,
27
27
  },
28
- }
29
- } as const;
28
+ },
29
+ } as const
30
30
 
31
31
  /**
32
32
  * Mock service mocks some RPCs for the e2e tests.
@@ -40,10 +40,9 @@ export interface Mock {
40
40
  * @generated from rpc e2e.mock.Mock.MockRequest
41
41
  */
42
42
  MockRequest(
43
- request: Message<MockMsg>, abortSignal?: AbortSignal
44
- ):
45
- Promise<Message<MockMsg>>
46
-
43
+ request: Message<MockMsg>,
44
+ abortSignal?: AbortSignal,
45
+ ): Promise<Message<MockMsg>>
47
46
  }
48
47
 
49
48
  export const MockServiceName = MockDefinition.typeName
@@ -62,9 +61,9 @@ export class MockClient implements Mock {
62
61
  * @generated from rpc e2e.mock.Mock.MockRequest
63
62
  */
64
63
  async MockRequest(
65
- request: Message<MockMsg>, abortSignal?: AbortSignal
66
- ):
67
- Promise<Message<MockMsg>> {
64
+ request: Message<MockMsg>,
65
+ abortSignal?: AbortSignal,
66
+ ): Promise<Message<MockMsg>> {
68
67
  const requestMsg = MockMsg.create(request)
69
68
  const result = await this.rpc.request(
70
69
  this.service,
@@ -74,5 +73,4 @@ Promise<Message<MockMsg>> {
74
73
  )
75
74
  return MockMsg.fromBinary(result)
76
75
  }
77
-
78
76
  }
package/echo/echo.pb.ts CHANGED
@@ -2,10 +2,10 @@
2
2
  // @generated from file github.com/aperturerobotics/starpc/echo/echo.proto (package echo, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
- import type { MessageType, PartialFieldInfo } from "@aptre/protobuf-es-lite";
6
- import { createMessageType, Message } from "@aptre/protobuf-es-lite";
5
+ import type { MessageType, PartialFieldInfo } from '@aptre/protobuf-es-lite'
6
+ import { createMessageType, Message, ScalarType } from '@aptre/protobuf-es-lite'
7
7
 
8
- export const protobufPackage = "echo";
8
+ export const protobufPackage = 'echo'
9
9
 
10
10
  /**
11
11
  * EchoMsg is the message body for Echo.
@@ -16,17 +16,14 @@ export type EchoMsg = Message<{
16
16
  /**
17
17
  * @generated from field: string body = 1;
18
18
  */
19
- body?: string;
20
-
21
- }>;
22
-
23
- export const EchoMsg: MessageType<EchoMsg> = createMessageType(
24
- {
25
- typeName: "echo.EchoMsg",
26
- fields: [
27
- { no: 1, name: "body", kind: "scalar", T: 9 /* ScalarType.STRING */ },
28
- ] as readonly PartialFieldInfo[],
29
- packedByDefault: true,
30
- },
31
- );
19
+ body?: string
20
+ }>
32
21
 
22
+ // EchoMsg contains the message type declaration for EchoMsg.
23
+ export const EchoMsg: MessageType<EchoMsg> = createMessageType({
24
+ typeName: 'echo.EchoMsg',
25
+ fields: [
26
+ { no: 1, name: 'body', kind: 'scalar', T: ScalarType.STRING },
27
+ ] as readonly PartialFieldInfo[],
28
+ packedByDefault: true,
29
+ })
@@ -2,10 +2,15 @@
2
2
  // @generated from file github.com/aperturerobotics/starpc/echo/echo.proto (package echo, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
- import { EchoMsg } from "./echo.pb.js";
6
- import { Message, MethodKind } from "@aptre/protobuf-es-lite";
7
- import { RpcStreamPacket } from "../rpcstream/rpcstream.pb.js";
8
- import { buildDecodeMessageTransform, buildEncodeMessageTransform, MessageStream, ProtoRpc } from "starpc";
5
+ import { EchoMsg } from './echo.pb.js'
6
+ import { Message, MethodKind } from '@aptre/protobuf-es-lite'
7
+ import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js'
8
+ import {
9
+ buildDecodeMessageTransform,
10
+ buildEncodeMessageTransform,
11
+ MessageStream,
12
+ ProtoRpc,
13
+ } from 'starpc'
9
14
 
10
15
  /**
11
16
  * Echoer service returns the given message.
@@ -13,7 +18,7 @@ import { buildDecodeMessageTransform, buildEncodeMessageTransform, MessageStream
13
18
  * @generated from service echo.Echoer
14
19
  */
15
20
  export const EchoerDefinition = {
16
- typeName: "echo.Echoer",
21
+ typeName: 'echo.Echoer',
17
22
  methods: {
18
23
  /**
19
24
  * Echo returns the given message.
@@ -21,7 +26,7 @@ export const EchoerDefinition = {
21
26
  * @generated from rpc echo.Echoer.Echo
22
27
  */
23
28
  Echo: {
24
- name: "Echo",
29
+ name: 'Echo',
25
30
  I: EchoMsg,
26
31
  O: EchoMsg,
27
32
  kind: MethodKind.Unary,
@@ -32,7 +37,7 @@ export const EchoerDefinition = {
32
37
  * @generated from rpc echo.Echoer.EchoServerStream
33
38
  */
34
39
  EchoServerStream: {
35
- name: "EchoServerStream",
40
+ name: 'EchoServerStream',
36
41
  I: EchoMsg,
37
42
  O: EchoMsg,
38
43
  kind: MethodKind.ServerStreaming,
@@ -43,7 +48,7 @@ export const EchoerDefinition = {
43
48
  * @generated from rpc echo.Echoer.EchoClientStream
44
49
  */
45
50
  EchoClientStream: {
46
- name: "EchoClientStream",
51
+ name: 'EchoClientStream',
47
52
  I: EchoMsg,
48
53
  O: EchoMsg,
49
54
  kind: MethodKind.ClientStreaming,
@@ -54,7 +59,7 @@ export const EchoerDefinition = {
54
59
  * @generated from rpc echo.Echoer.EchoBidiStream
55
60
  */
56
61
  EchoBidiStream: {
57
- name: "EchoBidiStream",
62
+ name: 'EchoBidiStream',
58
63
  I: EchoMsg,
59
64
  O: EchoMsg,
60
65
  kind: MethodKind.BiDiStreaming,
@@ -65,13 +70,13 @@ export const EchoerDefinition = {
65
70
  * @generated from rpc echo.Echoer.RpcStream
66
71
  */
67
72
  RpcStream: {
68
- name: "RpcStream",
73
+ name: 'RpcStream',
69
74
  I: RpcStreamPacket,
70
75
  O: RpcStreamPacket,
71
76
  kind: MethodKind.BiDiStreaming,
72
77
  },
73
- }
74
- } as const;
78
+ },
79
+ } as const
75
80
 
76
81
  /**
77
82
  * Echoer service returns the given message.
@@ -85,9 +90,9 @@ export interface Echoer {
85
90
  * @generated from rpc echo.Echoer.Echo
86
91
  */
87
92
  Echo(
88
- request: Message<EchoMsg>, abortSignal?: AbortSignal
89
- ):
90
- Promise<Message<EchoMsg>>
93
+ request: Message<EchoMsg>,
94
+ abortSignal?: AbortSignal,
95
+ ): Promise<Message<EchoMsg>>
91
96
 
92
97
  /**
93
98
  * EchoServerStream is an example of a server -> client one-way stream.
@@ -95,9 +100,9 @@ Promise<Message<EchoMsg>>
95
100
  * @generated from rpc echo.Echoer.EchoServerStream
96
101
  */
97
102
  EchoServerStream(
98
- request: Message<EchoMsg>, abortSignal?: AbortSignal
99
- ):
100
- MessageStream<EchoMsg>
103
+ request: Message<EchoMsg>,
104
+ abortSignal?: AbortSignal,
105
+ ): MessageStream<EchoMsg>
101
106
 
102
107
  /**
103
108
  * EchoClientStream is an example of client->server one-way stream.
@@ -105,9 +110,9 @@ MessageStream<EchoMsg>
105
110
  * @generated from rpc echo.Echoer.EchoClientStream
106
111
  */
107
112
  EchoClientStream(
108
- request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
109
- ):
110
- Promise<Message<EchoMsg>>
113
+ request: MessageStream<EchoMsg>,
114
+ abortSignal?: AbortSignal,
115
+ ): Promise<Message<EchoMsg>>
111
116
 
112
117
  /**
113
118
  * EchoBidiStream is an example of a two-way stream.
@@ -115,9 +120,9 @@ Promise<Message<EchoMsg>>
115
120
  * @generated from rpc echo.Echoer.EchoBidiStream
116
121
  */
117
122
  EchoBidiStream(
118
- request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
119
- ):
120
- MessageStream<EchoMsg>
123
+ request: MessageStream<EchoMsg>,
124
+ abortSignal?: AbortSignal,
125
+ ): MessageStream<EchoMsg>
121
126
 
122
127
  /**
123
128
  * RpcStream opens a nested rpc call stream.
@@ -125,10 +130,9 @@ MessageStream<EchoMsg>
125
130
  * @generated from rpc echo.Echoer.RpcStream
126
131
  */
127
132
  RpcStream(
128
- request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal
129
- ):
130
- MessageStream<RpcStreamPacket>
131
-
133
+ request: MessageStream<RpcStreamPacket>,
134
+ abortSignal?: AbortSignal,
135
+ ): MessageStream<RpcStreamPacket>
132
136
  }
133
137
 
134
138
  export const EchoerServiceName = EchoerDefinition.typeName
@@ -151,9 +155,9 @@ export class EchoerClient implements Echoer {
151
155
  * @generated from rpc echo.Echoer.Echo
152
156
  */
153
157
  async Echo(
154
- request: Message<EchoMsg>, abortSignal?: AbortSignal
155
- ):
156
- Promise<Message<EchoMsg>> {
158
+ request: Message<EchoMsg>,
159
+ abortSignal?: AbortSignal,
160
+ ): Promise<Message<EchoMsg>> {
157
161
  const requestMsg = EchoMsg.create(request)
158
162
  const result = await this.rpc.request(
159
163
  this.service,
@@ -170,9 +174,9 @@ Promise<Message<EchoMsg>> {
170
174
  * @generated from rpc echo.Echoer.EchoServerStream
171
175
  */
172
176
  EchoServerStream(
173
- request: Message<EchoMsg>, abortSignal?: AbortSignal
174
- ):
175
- MessageStream<EchoMsg> {
177
+ request: Message<EchoMsg>,
178
+ abortSignal?: AbortSignal,
179
+ ): MessageStream<EchoMsg> {
176
180
  const requestMsg = EchoMsg.create(request)
177
181
  const result = this.rpc.serverStreamingRequest(
178
182
  this.service,
@@ -189,9 +193,9 @@ MessageStream<EchoMsg> {
189
193
  * @generated from rpc echo.Echoer.EchoClientStream
190
194
  */
191
195
  async EchoClientStream(
192
- request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
193
- ):
194
- Promise<Message<EchoMsg>> {
196
+ request: MessageStream<EchoMsg>,
197
+ abortSignal?: AbortSignal,
198
+ ): Promise<Message<EchoMsg>> {
195
199
  const result = await this.rpc.clientStreamingRequest(
196
200
  this.service,
197
201
  EchoerDefinition.methods.EchoClientStream.name,
@@ -207,9 +211,9 @@ Promise<Message<EchoMsg>> {
207
211
  * @generated from rpc echo.Echoer.EchoBidiStream
208
212
  */
209
213
  EchoBidiStream(
210
- request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
211
- ):
212
- MessageStream<EchoMsg> {
214
+ request: MessageStream<EchoMsg>,
215
+ abortSignal?: AbortSignal,
216
+ ): MessageStream<EchoMsg> {
213
217
  const result = this.rpc.bidirectionalStreamingRequest(
214
218
  this.service,
215
219
  EchoerDefinition.methods.EchoBidiStream.name,
@@ -225,9 +229,9 @@ MessageStream<EchoMsg> {
225
229
  * @generated from rpc echo.Echoer.RpcStream
226
230
  */
227
231
  RpcStream(
228
- request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal
229
- ):
230
- MessageStream<RpcStreamPacket> {
232
+ request: MessageStream<RpcStreamPacket>,
233
+ abortSignal?: AbortSignal,
234
+ ): MessageStream<RpcStreamPacket> {
231
235
  const result = this.rpc.bidirectionalStreamingRequest(
232
236
  this.service,
233
237
  EchoerDefinition.methods.RpcStream.name,
@@ -236,5 +240,4 @@ MessageStream<RpcStreamPacket> {
236
240
  )
237
241
  return buildDecodeMessageTransform(RpcStreamPacket)(result)
238
242
  }
239
-
240
243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.31.13",
3
+ "version": "0.32.0",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -64,24 +64,22 @@
64
64
  "lint": "npm run lint:go && npm run lint:js",
65
65
  "lint:go": "make lint",
66
66
  "lint:js": "ESLINT_USE_FLAT_CONFIG=false eslint -c .eslintrc.cjs --ignore-pattern *.js --ignore-pattern *.d.ts ./",
67
+ "prepare": "go mod vendor && rimraf ./hack/bin",
68
+ "precommit": "lint-staged",
67
69
  "release:version": "npm version patch -m \"release: v%s\" --no-git-tag-version",
70
+ "release:version:minor": "npm version minor -m \"release: v%s\" --no-git-tag-version",
68
71
  "release:commit": "git reset && git add package.json && git commit -s -m \"release: v$npm_package_version\" && git tag v$npm_package_version",
69
72
  "release:publish": "git push && git push --tags && npm run build && npm publish",
70
73
  "release": "npm run release:version && npm run release:commit",
71
- "prepare": "go mod vendor && rimraf ./hack/bin",
72
- "precommit": "lint-staged"
74
+ "release:minor": "npm run release:version:minor && npm run release:commit"
73
75
  },
74
76
  "preferUnplugged": true,
75
77
  "pre-commit": [
76
78
  "precommit"
77
79
  ],
78
80
  "lint-staged": {
79
- "package.json": "prettier --write",
80
- "./{srpc,echo,e2e,integration,rpcstream,cmd}/**/(*.ts|*.tsx|*.html|*.css)": "prettier --write"
81
- },
82
- "prettier": {
83
- "semi": false,
84
- "singleQuote": true
81
+ "package.json": "prettier --config .prettierrc.yaml --write",
82
+ "./{srpc,echo,e2e,integration,rpcstream,cmd}/**/(*.ts|*.tsx|*.html|*.css)": "prettier --config .prettierrc.yaml --write"
85
83
  },
86
84
  "devDependencies": {
87
85
  "@typescript-eslint/eslint-plugin": "^7.8.0",
@@ -94,15 +92,15 @@
94
92
  "pre-commit": "^1.2.2",
95
93
  "prettier": "^3.2.4",
96
94
  "rimraf": "^5.0.1",
97
- "tsx": "^4.7.3",
95
+ "tsx": "^4.8.2",
98
96
  "typescript": "^5.3.2"
99
97
  },
100
98
  "dependencies": {
101
99
  "@aptre/it-ws": "^1.0.0",
102
- "@aptre/protobuf-es-lite": "^0.2.15",
100
+ "@aptre/protobuf-es-lite": "^0.4.1",
103
101
  "@chainsafe/libp2p-yamux": "^6.0.2",
104
- "@libp2p/interface": "^1.3.0",
105
- "@libp2p/logger": "^4.0.11",
102
+ "@libp2p/interface": "^1.3.1",
103
+ "@libp2p/logger": "^4.0.12",
106
104
  "event-iterator": "^2.0.0",
107
105
  "isomorphic-ws": "^5.0.0",
108
106
  "it-first": "^3.0.6",
@@ -2,10 +2,10 @@
2
2
  // @generated from file github.com/aperturerobotics/starpc/srpc/rpcproto.proto (package srpc, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
- import type { MessageType, PartialFieldInfo } from "@aptre/protobuf-es-lite";
6
- import { createMessageType, Message } from "@aptre/protobuf-es-lite";
5
+ import type { MessageType, PartialFieldInfo } from '@aptre/protobuf-es-lite'
6
+ import { createMessageType, Message, ScalarType } from '@aptre/protobuf-es-lite'
7
7
 
8
- export const protobufPackage = "srpc";
8
+ export const protobufPackage = 'srpc'
9
9
 
10
10
  /**
11
11
  * CallStart requests starting a new RPC call.
@@ -19,42 +19,40 @@ export type CallStart = Message<{
19
19
  *
20
20
  * @generated from field: string rpc_service = 1;
21
21
  */
22
- rpcService?: string;
22
+ rpcService?: string
23
23
  /**
24
24
  * RpcMethod is the RPC method to call.
25
25
  * Must be set.
26
26
  *
27
27
  * @generated from field: string rpc_method = 2;
28
28
  */
29
- rpcMethod?: string;
29
+ rpcMethod?: string
30
30
  /**
31
31
  * Data contains the request or the first message in the stream.
32
32
  * Optional if streaming.
33
33
  *
34
34
  * @generated from field: bytes data = 3;
35
35
  */
36
- data?: Uint8Array;
36
+ data?: Uint8Array
37
37
  /**
38
38
  * DataIsZero indicates Data is set with an empty message.
39
39
  *
40
40
  * @generated from field: bool data_is_zero = 4;
41
41
  */
42
- dataIsZero?: boolean;
42
+ dataIsZero?: boolean
43
+ }>
43
44
 
44
- }>;
45
-
46
- export const CallStart: MessageType<CallStart> = createMessageType(
47
- {
48
- typeName: "srpc.CallStart",
49
- fields: [
50
- { no: 1, name: "rpc_service", kind: "scalar", T: 9 /* ScalarType.STRING */ },
51
- { no: 2, name: "rpc_method", kind: "scalar", T: 9 /* ScalarType.STRING */ },
52
- { no: 3, name: "data", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
53
- { no: 4, name: "data_is_zero", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
54
- ] as readonly PartialFieldInfo[],
55
- packedByDefault: true,
56
- },
57
- );
45
+ // CallStart contains the message type declaration for CallStart.
46
+ export const CallStart: MessageType<CallStart> = createMessageType({
47
+ typeName: 'srpc.CallStart',
48
+ fields: [
49
+ { no: 1, name: 'rpc_service', kind: 'scalar', T: ScalarType.STRING },
50
+ { no: 2, name: 'rpc_method', kind: 'scalar', T: ScalarType.STRING },
51
+ { no: 3, name: 'data', kind: 'scalar', T: ScalarType.BYTES },
52
+ { no: 4, name: 'data_is_zero', kind: 'scalar', T: ScalarType.BOOL },
53
+ ] as readonly PartialFieldInfo[],
54
+ packedByDefault: true,
55
+ })
58
56
 
59
57
  /**
60
58
  * CallData contains a message in a streaming RPC sequence.
@@ -67,41 +65,39 @@ export type CallData = Message<{
67
65
  *
68
66
  * @generated from field: bytes data = 1;
69
67
  */
70
- data?: Uint8Array;
68
+ data?: Uint8Array
71
69
  /**
72
70
  * DataIsZero indicates Data is set with an empty message.
73
71
  *
74
72
  * @generated from field: bool data_is_zero = 2;
75
73
  */
76
- dataIsZero?: boolean;
74
+ dataIsZero?: boolean
77
75
  /**
78
76
  * Complete indicates the RPC call is completed.
79
77
  *
80
78
  * @generated from field: bool complete = 3;
81
79
  */
82
- complete?: boolean;
80
+ complete?: boolean
83
81
  /**
84
82
  * Error contains any error that caused the RPC to fail.
85
83
  * If set, implies complete=true.
86
84
  *
87
85
  * @generated from field: string error = 4;
88
86
  */
89
- error?: string;
90
-
91
- }>;
87
+ error?: string
88
+ }>
92
89
 
93
- export const CallData: MessageType<CallData> = createMessageType(
94
- {
95
- typeName: "srpc.CallData",
96
- fields: [
97
- { no: 1, name: "data", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
98
- { no: 2, name: "data_is_zero", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
99
- { no: 3, name: "complete", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
100
- { no: 4, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */ },
101
- ] as readonly PartialFieldInfo[],
102
- packedByDefault: true,
103
- },
104
- );
90
+ // CallData contains the message type declaration for CallData.
91
+ export const CallData: MessageType<CallData> = createMessageType({
92
+ typeName: 'srpc.CallData',
93
+ fields: [
94
+ { no: 1, name: 'data', kind: 'scalar', T: ScalarType.BYTES },
95
+ { no: 2, name: 'data_is_zero', kind: 'scalar', T: ScalarType.BOOL },
96
+ { no: 3, name: 'complete', kind: 'scalar', T: ScalarType.BOOL },
97
+ { no: 4, name: 'error', kind: 'scalar', T: ScalarType.STRING },
98
+ ] as readonly PartialFieldInfo[],
99
+ packedByDefault: true,
100
+ })
105
101
 
106
102
  /**
107
103
  * Packet is a message sent over a srpc packet connection.
@@ -109,52 +105,70 @@ export const CallData: MessageType<CallData> = createMessageType(
109
105
  * @generated from message srpc.Packet
110
106
  */
111
107
  export type Packet = Message<{
112
-
113
108
  /**
114
109
  * Body is the packet body.
115
110
  *
116
111
  * @generated from oneof srpc.Packet.body
117
112
  */
118
- body?: {
119
- value?: undefined,
120
- case: undefined
121
- } | {
122
- /**
123
- * CallStart initiates a new call.
124
- *
125
- * @generated from field: srpc.CallStart call_start = 1;
126
- */
127
- value: CallStart;
128
- case: "callStart";
129
- } | {
130
- /**
131
- * CallData is a message in a streaming RPC sequence.
132
- *
133
- * @generated from field: srpc.CallData call_data = 2;
134
- */
135
- value: CallData;
136
- case: "callData";
137
- } | {
138
- /**
139
- * CallCancel cancels the call.
140
- *
141
- * @generated from field: bool call_cancel = 3;
142
- */
143
- value: boolean;
144
- case: "callCancel";
145
- };
146
-
147
- }>;
148
-
149
- export const Packet: MessageType<Packet> = createMessageType(
150
- {
151
- typeName: "srpc.Packet",
152
- fields: [
153
- { no: 1, name: "call_start", kind: "message", T: () => CallStart, oneof: "body" },
154
- { no: 2, name: "call_data", kind: "message", T: () => CallData, oneof: "body" },
155
- { no: 3, name: "call_cancel", kind: "scalar", T: 8 /* ScalarType.BOOL */, oneof: "body" },
156
- ] as readonly PartialFieldInfo[],
157
- packedByDefault: true,
158
- },
159
- );
113
+ body?:
114
+ | {
115
+ value?: undefined
116
+ case: undefined
117
+ }
118
+ | {
119
+ /**
120
+ * CallStart initiates a new call.
121
+ *
122
+ * @generated from field: srpc.CallStart call_start = 1;
123
+ */
124
+ value: CallStart
125
+ case: 'callStart'
126
+ }
127
+ | {
128
+ /**
129
+ * CallData is a message in a streaming RPC sequence.
130
+ *
131
+ * @generated from field: srpc.CallData call_data = 2;
132
+ */
133
+ value: CallData
134
+ case: 'callData'
135
+ }
136
+ | {
137
+ /**
138
+ * CallCancel cancels the call.
139
+ *
140
+ * @generated from field: bool call_cancel = 3;
141
+ */
142
+ value: boolean
143
+ case: 'callCancel'
144
+ }
145
+ }>
160
146
 
147
+ // Packet contains the message type declaration for Packet.
148
+ export const Packet: MessageType<Packet> = createMessageType({
149
+ typeName: 'srpc.Packet',
150
+ fields: [
151
+ {
152
+ no: 1,
153
+ name: 'call_start',
154
+ kind: 'message',
155
+ T: () => CallStart,
156
+ oneof: 'body',
157
+ },
158
+ {
159
+ no: 2,
160
+ name: 'call_data',
161
+ kind: 'message',
162
+ T: () => CallData,
163
+ oneof: 'body',
164
+ },
165
+ {
166
+ no: 3,
167
+ name: 'call_cancel',
168
+ kind: 'scalar',
169
+ T: ScalarType.BOOL,
170
+ oneof: 'body',
171
+ },
172
+ ] as readonly PartialFieldInfo[],
173
+ packedByDefault: true,
174
+ })