starpc 0.32.9 → 0.32.11
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/cmd/protoc-gen-es-starpc/typescript.ts +9 -9
- package/dist/cmd/protoc-gen-es-starpc/typescript.js +9 -9
- package/dist/e2e/mock/mock.pb.d.ts +2 -2
- package/dist/e2e/mock/mock.pb.js +4 -4
- package/dist/e2e/mock/mock_srpc.pb.d.ts +7 -7
- package/dist/e2e/mock/mock_srpc.pb.js +5 -5
- package/dist/echo/echo.pb.d.ts +2 -2
- package/dist/echo/echo.pb.js +4 -4
- package/dist/echo/echo_srpc.pb.d.ts +35 -27
- package/dist/rpcstream/rpcstream.pb.d.ts +5 -5
- package/dist/rpcstream/rpcstream.pb.js +16 -10
- package/dist/srpc/rpcproto.pb.d.ts +5 -5
- package/dist/srpc/rpcproto.pb.js +34 -16
- package/e2e/mock/mock.pb.go +1 -1
- package/e2e/mock/mock.pb.ts +11 -13
- package/e2e/mock/mock_srpc.pb.go +1 -1
- package/e2e/mock/mock_srpc.pb.ts +11 -16
- package/echo/echo.pb.go +1 -1
- package/echo/echo.pb.ts +11 -13
- package/echo/echo_srpc.pb.go +1 -1
- package/echo/echo_srpc.pb.ts +9 -21
- package/go.mod +2 -2
- package/go.sum +2 -2
- package/package.json +3 -3
- package/srpc/rpcproto.pb.go +1 -1
- package/srpc/rpcproto.pb.ts +90 -73
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from '@aptre/protobuf-es-lite/protoplugin/ecmascript'
|
|
27
27
|
|
|
28
28
|
const MessageStream = createImportSymbol('MessageStream', 'starpc')
|
|
29
|
-
const Message = createImportSymbol('Message', '@aptre/protobuf-es-lite')
|
|
29
|
+
// const Message = createImportSymbol('Message', '@aptre/protobuf-es-lite')
|
|
30
30
|
|
|
31
31
|
export function generateTs(schema: Schema) {
|
|
32
32
|
for (const protoFile of schema.files) {
|
|
@@ -88,9 +88,9 @@ function generateService(
|
|
|
88
88
|
f.print(f.jsDoc(method, " "));
|
|
89
89
|
f.print(" ", method.name, "(");
|
|
90
90
|
if (method.methodKind === MethodKind.Unary) {
|
|
91
|
-
f.print("request: ",
|
|
91
|
+
f.print("request: ", method.input, ", abortSignal?: AbortSignal");
|
|
92
92
|
} else if (method.methodKind === MethodKind.ServerStreaming) {
|
|
93
|
-
f.print("request: ",
|
|
93
|
+
f.print("request: ", method.input, ", abortSignal?: AbortSignal");
|
|
94
94
|
} else if (method.methodKind === MethodKind.ClientStreaming) {
|
|
95
95
|
f.print("request: ", MessageStream, "<", method.input, ">, abortSignal?: AbortSignal");
|
|
96
96
|
} else if (method.methodKind === MethodKind.BiDiStreaming) {
|
|
@@ -98,11 +98,11 @@ function generateService(
|
|
|
98
98
|
}
|
|
99
99
|
f.print("): ");
|
|
100
100
|
if (method.methodKind === MethodKind.Unary) {
|
|
101
|
-
f.print("Promise<",
|
|
101
|
+
f.print("Promise<", method.output, ">");
|
|
102
102
|
} else if (method.methodKind === MethodKind.ServerStreaming) {
|
|
103
103
|
f.print(MessageStream, "<", method.output, ">");
|
|
104
104
|
} else if (method.methodKind === MethodKind.ClientStreaming) {
|
|
105
|
-
f.print("Promise<",
|
|
105
|
+
f.print("Promise<", method.output, ">");
|
|
106
106
|
} else if (method.methodKind === MethodKind.BiDiStreaming) {
|
|
107
107
|
f.print(MessageStream, "<", method.output, ">");
|
|
108
108
|
}
|
|
@@ -137,9 +137,9 @@ function generateService(
|
|
|
137
137
|
f.print(f.jsDoc(method, " "));
|
|
138
138
|
f.print(" ", method.methodKind === MethodKind.Unary || method.methodKind === MethodKind.ClientStreaming ? "async " : "", method.name, "(");
|
|
139
139
|
if (method.methodKind === MethodKind.Unary) {
|
|
140
|
-
f.print("request: ",
|
|
140
|
+
f.print("request: ", method.input, ", abortSignal?: AbortSignal");
|
|
141
141
|
} else if (method.methodKind === MethodKind.ServerStreaming) {
|
|
142
|
-
f.print("request: ",
|
|
142
|
+
f.print("request: ", method.input, ", abortSignal?: AbortSignal");
|
|
143
143
|
} else if (method.methodKind === MethodKind.ClientStreaming) {
|
|
144
144
|
f.print("request: ", MessageStream, "<", method.input, ">, abortSignal?: AbortSignal");
|
|
145
145
|
} else if (method.methodKind === MethodKind.BiDiStreaming) {
|
|
@@ -147,7 +147,7 @@ function generateService(
|
|
|
147
147
|
}
|
|
148
148
|
f.print("): ");
|
|
149
149
|
if (method.methodKind === MethodKind.Unary) {
|
|
150
|
-
f.print("Promise<",
|
|
150
|
+
f.print("Promise<", method.output, "> {");
|
|
151
151
|
f.print(" const requestMsg = ", method.input, ".create(request)");
|
|
152
152
|
f.print(" const result = await this.rpc.request(");
|
|
153
153
|
f.print(" this.service,");
|
|
@@ -169,7 +169,7 @@ function generateService(
|
|
|
169
169
|
f.print(" return ", buildDecodeMessageTransformSymbol, "(", method.output, ")(result)");
|
|
170
170
|
f.print(" }");
|
|
171
171
|
} else if (method.methodKind === MethodKind.ClientStreaming) {
|
|
172
|
-
f.print("Promise<",
|
|
172
|
+
f.print("Promise<", method.output, "> {");
|
|
173
173
|
f.print(" const result = await this.rpc.clientStreamingRequest(");
|
|
174
174
|
f.print(" this.service,");
|
|
175
175
|
f.print(" ", localName(service), "Definition.methods.", method.name, ".name,");
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { MethodIdempotency, MethodKind, localName, } from '@aptre/protobuf-es-lite';
|
|
16
16
|
import { createImportSymbol, } from '@aptre/protobuf-es-lite/protoplugin/ecmascript';
|
|
17
17
|
const MessageStream = createImportSymbol('MessageStream', 'starpc');
|
|
18
|
-
const Message = createImportSymbol('Message', '@aptre/protobuf-es-lite')
|
|
18
|
+
// const Message = createImportSymbol('Message', '@aptre/protobuf-es-lite')
|
|
19
19
|
export function generateTs(schema) {
|
|
20
20
|
for (const protoFile of schema.files) {
|
|
21
21
|
const file = schema.generateFile(protoFile.name + '_srpc.pb.ts');
|
|
@@ -56,10 +56,10 @@ function generateService(schema, f, service) {
|
|
|
56
56
|
f.print(f.jsDoc(method, " "));
|
|
57
57
|
f.print(" ", method.name, "(");
|
|
58
58
|
if (method.methodKind === MethodKind.Unary) {
|
|
59
|
-
f.print("request: ",
|
|
59
|
+
f.print("request: ", method.input, ", abortSignal?: AbortSignal");
|
|
60
60
|
}
|
|
61
61
|
else if (method.methodKind === MethodKind.ServerStreaming) {
|
|
62
|
-
f.print("request: ",
|
|
62
|
+
f.print("request: ", method.input, ", abortSignal?: AbortSignal");
|
|
63
63
|
}
|
|
64
64
|
else if (method.methodKind === MethodKind.ClientStreaming) {
|
|
65
65
|
f.print("request: ", MessageStream, "<", method.input, ">, abortSignal?: AbortSignal");
|
|
@@ -69,13 +69,13 @@ function generateService(schema, f, service) {
|
|
|
69
69
|
}
|
|
70
70
|
f.print("): ");
|
|
71
71
|
if (method.methodKind === MethodKind.Unary) {
|
|
72
|
-
f.print("Promise<",
|
|
72
|
+
f.print("Promise<", method.output, ">");
|
|
73
73
|
}
|
|
74
74
|
else if (method.methodKind === MethodKind.ServerStreaming) {
|
|
75
75
|
f.print(MessageStream, "<", method.output, ">");
|
|
76
76
|
}
|
|
77
77
|
else if (method.methodKind === MethodKind.ClientStreaming) {
|
|
78
|
-
f.print("Promise<",
|
|
78
|
+
f.print("Promise<", method.output, ">");
|
|
79
79
|
}
|
|
80
80
|
else if (method.methodKind === MethodKind.BiDiStreaming) {
|
|
81
81
|
f.print(MessageStream, "<", method.output, ">");
|
|
@@ -108,10 +108,10 @@ function generateService(schema, f, service) {
|
|
|
108
108
|
f.print(f.jsDoc(method, " "));
|
|
109
109
|
f.print(" ", method.methodKind === MethodKind.Unary || method.methodKind === MethodKind.ClientStreaming ? "async " : "", method.name, "(");
|
|
110
110
|
if (method.methodKind === MethodKind.Unary) {
|
|
111
|
-
f.print("request: ",
|
|
111
|
+
f.print("request: ", method.input, ", abortSignal?: AbortSignal");
|
|
112
112
|
}
|
|
113
113
|
else if (method.methodKind === MethodKind.ServerStreaming) {
|
|
114
|
-
f.print("request: ",
|
|
114
|
+
f.print("request: ", method.input, ", abortSignal?: AbortSignal");
|
|
115
115
|
}
|
|
116
116
|
else if (method.methodKind === MethodKind.ClientStreaming) {
|
|
117
117
|
f.print("request: ", MessageStream, "<", method.input, ">, abortSignal?: AbortSignal");
|
|
@@ -121,7 +121,7 @@ function generateService(schema, f, service) {
|
|
|
121
121
|
}
|
|
122
122
|
f.print("): ");
|
|
123
123
|
if (method.methodKind === MethodKind.Unary) {
|
|
124
|
-
f.print("Promise<",
|
|
124
|
+
f.print("Promise<", method.output, "> {");
|
|
125
125
|
f.print(" const requestMsg = ", method.input, ".create(request)");
|
|
126
126
|
f.print(" const result = await this.rpc.request(");
|
|
127
127
|
f.print(" this.service,");
|
|
@@ -145,7 +145,7 @@ function generateService(schema, f, service) {
|
|
|
145
145
|
f.print(" }");
|
|
146
146
|
}
|
|
147
147
|
else if (method.methodKind === MethodKind.ClientStreaming) {
|
|
148
|
-
f.print("Promise<",
|
|
148
|
+
f.print("Promise<", method.output, "> {");
|
|
149
149
|
f.print(" const result = await this.rpc.clientStreamingRequest(");
|
|
150
150
|
f.print(" this.service,");
|
|
151
151
|
f.print(" ", localName(service), "Definition.methods.", method.name, ".name,");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MessageType } from
|
|
2
|
-
import { Message } from
|
|
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.
|
package/dist/e2e/mock/mock.pb.js
CHANGED
|
@@ -1,13 +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, ScalarType } from
|
|
5
|
-
export const protobufPackage =
|
|
4
|
+
import { createMessageType, ScalarType } from '@aptre/protobuf-es-lite';
|
|
5
|
+
export const protobufPackage = 'e2e.mock';
|
|
6
6
|
// MockMsg contains the message type declaration for MockMsg.
|
|
7
7
|
export const MockMsg = createMessageType({
|
|
8
|
-
typeName:
|
|
8
|
+
typeName: 'e2e.mock.MockMsg',
|
|
9
9
|
fields: [
|
|
10
|
-
{ no: 1, name:
|
|
10
|
+
{ no: 1, name: 'body', kind: 'scalar', T: ScalarType.STRING },
|
|
11
11
|
],
|
|
12
12
|
packedByDefault: true,
|
|
13
13
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MockMsg } from
|
|
2
|
-
import {
|
|
3
|
-
import { ProtoRpc } from
|
|
1
|
+
import { MockMsg } from './mock.pb.js';
|
|
2
|
+
import { 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
|
*
|
|
@@ -16,10 +16,10 @@ export declare const MockDefinition: {
|
|
|
16
16
|
*/
|
|
17
17
|
readonly MockRequest: {
|
|
18
18
|
readonly name: "MockRequest";
|
|
19
|
-
readonly I: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
19
|
+
readonly I: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
20
20
|
body?: string | undefined;
|
|
21
21
|
}>>;
|
|
22
|
-
readonly O: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
22
|
+
readonly O: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
23
23
|
body?: string | undefined;
|
|
24
24
|
}>>;
|
|
25
25
|
readonly kind: MethodKind.Unary;
|
|
@@ -37,7 +37,7 @@ export interface Mock {
|
|
|
37
37
|
*
|
|
38
38
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
39
39
|
*/
|
|
40
|
-
MockRequest(request:
|
|
40
|
+
MockRequest(request: MockMsg, abortSignal?: AbortSignal): Promise<MockMsg>;
|
|
41
41
|
}
|
|
42
42
|
export declare const MockServiceName: "e2e.mock.Mock";
|
|
43
43
|
export declare class MockClient implements Mock {
|
|
@@ -51,5 +51,5 @@ export declare class MockClient implements Mock {
|
|
|
51
51
|
*
|
|
52
52
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
53
53
|
*/
|
|
54
|
-
MockRequest(request:
|
|
54
|
+
MockRequest(request: MockMsg, abortSignal?: AbortSignal): Promise<MockMsg>;
|
|
55
55
|
}
|
|
@@ -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
|
|
5
|
-
import { MethodKind } from
|
|
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:
|
|
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:
|
|
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 {
|
package/dist/echo/echo.pb.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MessageType } from
|
|
2
|
-
import { Message } from
|
|
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.
|
package/dist/echo/echo.pb.js
CHANGED
|
@@ -1,13 +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, ScalarType } from
|
|
5
|
-
export const protobufPackage =
|
|
4
|
+
import { createMessageType, ScalarType } from '@aptre/protobuf-es-lite';
|
|
5
|
+
export const protobufPackage = 'echo';
|
|
6
6
|
// EchoMsg contains the message type declaration for EchoMsg.
|
|
7
7
|
export const EchoMsg = createMessageType({
|
|
8
|
-
typeName:
|
|
8
|
+
typeName: 'echo.EchoMsg',
|
|
9
9
|
fields: [
|
|
10
|
-
{ no: 1, name:
|
|
10
|
+
{ no: 1, name: 'body', kind: 'scalar', T: ScalarType.STRING },
|
|
11
11
|
],
|
|
12
12
|
packedByDefault: true,
|
|
13
13
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EchoMsg } from './echo.pb.js';
|
|
2
|
-
import { Empty,
|
|
2
|
+
import { Empty, MethodKind } from '@aptre/protobuf-es-lite';
|
|
3
3
|
import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js';
|
|
4
4
|
import { MessageStream, ProtoRpc } from 'starpc';
|
|
5
5
|
/**
|
|
@@ -17,10 +17,10 @@ export declare const EchoerDefinition: {
|
|
|
17
17
|
*/
|
|
18
18
|
readonly Echo: {
|
|
19
19
|
readonly name: "Echo";
|
|
20
|
-
readonly I: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
20
|
+
readonly I: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
21
21
|
body?: string | undefined;
|
|
22
22
|
}>>;
|
|
23
|
-
readonly O: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
23
|
+
readonly O: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
24
24
|
body?: string | undefined;
|
|
25
25
|
}>>;
|
|
26
26
|
readonly kind: MethodKind.Unary;
|
|
@@ -32,10 +32,10 @@ export declare const EchoerDefinition: {
|
|
|
32
32
|
*/
|
|
33
33
|
readonly EchoServerStream: {
|
|
34
34
|
readonly name: "EchoServerStream";
|
|
35
|
-
readonly I: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
35
|
+
readonly I: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
36
36
|
body?: string | undefined;
|
|
37
37
|
}>>;
|
|
38
|
-
readonly O: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
38
|
+
readonly O: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
39
39
|
body?: string | undefined;
|
|
40
40
|
}>>;
|
|
41
41
|
readonly kind: MethodKind.ServerStreaming;
|
|
@@ -47,10 +47,10 @@ export declare const EchoerDefinition: {
|
|
|
47
47
|
*/
|
|
48
48
|
readonly EchoClientStream: {
|
|
49
49
|
readonly name: "EchoClientStream";
|
|
50
|
-
readonly I: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
50
|
+
readonly I: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
51
51
|
body?: string | undefined;
|
|
52
52
|
}>>;
|
|
53
|
-
readonly O: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
53
|
+
readonly O: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
54
54
|
body?: string | undefined;
|
|
55
55
|
}>>;
|
|
56
56
|
readonly kind: MethodKind.ClientStreaming;
|
|
@@ -62,10 +62,10 @@ export declare const EchoerDefinition: {
|
|
|
62
62
|
*/
|
|
63
63
|
readonly EchoBidiStream: {
|
|
64
64
|
readonly name: "EchoBidiStream";
|
|
65
|
-
readonly I: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
65
|
+
readonly I: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
66
66
|
body?: string | undefined;
|
|
67
67
|
}>>;
|
|
68
|
-
readonly O: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
68
|
+
readonly O: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
69
69
|
body?: string | undefined;
|
|
70
70
|
}>>;
|
|
71
71
|
readonly kind: MethodKind.BiDiStreaming;
|
|
@@ -77,17 +77,21 @@ export declare const EchoerDefinition: {
|
|
|
77
77
|
*/
|
|
78
78
|
readonly RpcStream: {
|
|
79
79
|
readonly name: "RpcStream";
|
|
80
|
-
readonly I: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
80
|
+
readonly I: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
81
81
|
body?: {
|
|
82
82
|
value?: undefined;
|
|
83
|
-
case: undefined;
|
|
83
|
+
case: undefined; /**
|
|
84
|
+
* DoNothing does nothing.
|
|
85
|
+
*
|
|
86
|
+
* @generated from rpc echo.Echoer.DoNothing
|
|
87
|
+
*/
|
|
84
88
|
} | {
|
|
85
|
-
value: Message<{
|
|
89
|
+
value: import("@aptre/protobuf-es-lite").Message<{
|
|
86
90
|
componentId?: string | undefined;
|
|
87
91
|
}>;
|
|
88
92
|
case: "init";
|
|
89
93
|
} | {
|
|
90
|
-
value: Message<{
|
|
94
|
+
value: import("@aptre/protobuf-es-lite").Message<{
|
|
91
95
|
error?: string | undefined;
|
|
92
96
|
}>;
|
|
93
97
|
case: "ack";
|
|
@@ -96,17 +100,21 @@ export declare const EchoerDefinition: {
|
|
|
96
100
|
case: "data";
|
|
97
101
|
} | undefined;
|
|
98
102
|
}>>;
|
|
99
|
-
readonly O: import("@aptre/protobuf-es-lite").MessageType<Message<{
|
|
103
|
+
readonly O: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{
|
|
100
104
|
body?: {
|
|
101
105
|
value?: undefined;
|
|
102
|
-
case: undefined;
|
|
106
|
+
case: undefined; /**
|
|
107
|
+
* DoNothing does nothing.
|
|
108
|
+
*
|
|
109
|
+
* @generated from rpc echo.Echoer.DoNothing
|
|
110
|
+
*/
|
|
103
111
|
} | {
|
|
104
|
-
value: Message<{
|
|
112
|
+
value: import("@aptre/protobuf-es-lite").Message<{
|
|
105
113
|
componentId?: string | undefined;
|
|
106
114
|
}>;
|
|
107
115
|
case: "init";
|
|
108
116
|
} | {
|
|
109
|
-
value: Message<{
|
|
117
|
+
value: import("@aptre/protobuf-es-lite").Message<{
|
|
110
118
|
error?: string | undefined;
|
|
111
119
|
}>;
|
|
112
120
|
case: "ack";
|
|
@@ -124,8 +132,8 @@ export declare const EchoerDefinition: {
|
|
|
124
132
|
*/
|
|
125
133
|
readonly DoNothing: {
|
|
126
134
|
readonly name: "DoNothing";
|
|
127
|
-
readonly I: import("@aptre/protobuf-es-lite").MessageType<Message<{}>>;
|
|
128
|
-
readonly O: import("@aptre/protobuf-es-lite").MessageType<Message<{}>>;
|
|
135
|
+
readonly I: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{}>>;
|
|
136
|
+
readonly O: import("@aptre/protobuf-es-lite").MessageType<import("@aptre/protobuf-es-lite").Message<{}>>;
|
|
129
137
|
readonly kind: MethodKind.Unary;
|
|
130
138
|
};
|
|
131
139
|
};
|
|
@@ -141,19 +149,19 @@ export interface Echoer {
|
|
|
141
149
|
*
|
|
142
150
|
* @generated from rpc echo.Echoer.Echo
|
|
143
151
|
*/
|
|
144
|
-
Echo(request:
|
|
152
|
+
Echo(request: EchoMsg, abortSignal?: AbortSignal): Promise<EchoMsg>;
|
|
145
153
|
/**
|
|
146
154
|
* EchoServerStream is an example of a server -> client one-way stream.
|
|
147
155
|
*
|
|
148
156
|
* @generated from rpc echo.Echoer.EchoServerStream
|
|
149
157
|
*/
|
|
150
|
-
EchoServerStream(request:
|
|
158
|
+
EchoServerStream(request: EchoMsg, abortSignal?: AbortSignal): MessageStream<EchoMsg>;
|
|
151
159
|
/**
|
|
152
160
|
* EchoClientStream is an example of client->server one-way stream.
|
|
153
161
|
*
|
|
154
162
|
* @generated from rpc echo.Echoer.EchoClientStream
|
|
155
163
|
*/
|
|
156
|
-
EchoClientStream(request: MessageStream<EchoMsg>, abortSignal?: AbortSignal): Promise<
|
|
164
|
+
EchoClientStream(request: MessageStream<EchoMsg>, abortSignal?: AbortSignal): Promise<EchoMsg>;
|
|
157
165
|
/**
|
|
158
166
|
* EchoBidiStream is an example of a two-way stream.
|
|
159
167
|
*
|
|
@@ -171,7 +179,7 @@ export interface Echoer {
|
|
|
171
179
|
*
|
|
172
180
|
* @generated from rpc echo.Echoer.DoNothing
|
|
173
181
|
*/
|
|
174
|
-
DoNothing(request:
|
|
182
|
+
DoNothing(request: Empty, abortSignal?: AbortSignal): Promise<Empty>;
|
|
175
183
|
}
|
|
176
184
|
export declare const EchoerServiceName: "echo.Echoer";
|
|
177
185
|
export declare class EchoerClient implements Echoer {
|
|
@@ -185,19 +193,19 @@ export declare class EchoerClient implements Echoer {
|
|
|
185
193
|
*
|
|
186
194
|
* @generated from rpc echo.Echoer.Echo
|
|
187
195
|
*/
|
|
188
|
-
Echo(request:
|
|
196
|
+
Echo(request: EchoMsg, abortSignal?: AbortSignal): Promise<EchoMsg>;
|
|
189
197
|
/**
|
|
190
198
|
* EchoServerStream is an example of a server -> client one-way stream.
|
|
191
199
|
*
|
|
192
200
|
* @generated from rpc echo.Echoer.EchoServerStream
|
|
193
201
|
*/
|
|
194
|
-
EchoServerStream(request:
|
|
202
|
+
EchoServerStream(request: EchoMsg, abortSignal?: AbortSignal): MessageStream<EchoMsg>;
|
|
195
203
|
/**
|
|
196
204
|
* EchoClientStream is an example of client->server one-way stream.
|
|
197
205
|
*
|
|
198
206
|
* @generated from rpc echo.Echoer.EchoClientStream
|
|
199
207
|
*/
|
|
200
|
-
EchoClientStream(request: MessageStream<EchoMsg>, abortSignal?: AbortSignal): Promise<
|
|
208
|
+
EchoClientStream(request: MessageStream<EchoMsg>, abortSignal?: AbortSignal): Promise<EchoMsg>;
|
|
201
209
|
/**
|
|
202
210
|
* EchoBidiStream is an example of a two-way stream.
|
|
203
211
|
*
|
|
@@ -215,5 +223,5 @@ export declare class EchoerClient implements Echoer {
|
|
|
215
223
|
*
|
|
216
224
|
* @generated from rpc echo.Echoer.DoNothing
|
|
217
225
|
*/
|
|
218
|
-
DoNothing(request:
|
|
226
|
+
DoNothing(request: Empty, abortSignal?: AbortSignal): Promise<Empty>;
|
|
219
227
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MessageType } from
|
|
2
|
-
import { Message } from
|
|
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:
|
|
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:
|
|
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:
|
|
69
|
+
case: 'data';
|
|
70
70
|
};
|
|
71
71
|
}>;
|
|
72
72
|
export declare const RpcStreamPacket: MessageType<RpcStreamPacket>;
|
|
@@ -1,31 +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, ScalarType } from
|
|
5
|
-
export const protobufPackage =
|
|
4
|
+
import { createMessageType, ScalarType } from '@aptre/protobuf-es-lite';
|
|
5
|
+
export const protobufPackage = 'rpcstream';
|
|
6
6
|
// RpcStreamInit contains the message type declaration for RpcStreamInit.
|
|
7
7
|
export const RpcStreamInit = createMessageType({
|
|
8
|
-
typeName:
|
|
8
|
+
typeName: 'rpcstream.RpcStreamInit',
|
|
9
9
|
fields: [
|
|
10
|
-
{ no: 1, name:
|
|
10
|
+
{ no: 1, name: 'component_id', kind: 'scalar', T: ScalarType.STRING },
|
|
11
11
|
],
|
|
12
12
|
packedByDefault: true,
|
|
13
13
|
});
|
|
14
14
|
// RpcAck contains the message type declaration for RpcAck.
|
|
15
15
|
export const RpcAck = createMessageType({
|
|
16
|
-
typeName:
|
|
16
|
+
typeName: 'rpcstream.RpcAck',
|
|
17
17
|
fields: [
|
|
18
|
-
{ no: 1, name:
|
|
18
|
+
{ no: 1, name: 'error', kind: 'scalar', T: ScalarType.STRING },
|
|
19
19
|
],
|
|
20
20
|
packedByDefault: true,
|
|
21
21
|
});
|
|
22
22
|
// RpcStreamPacket contains the message type declaration for RpcStreamPacket.
|
|
23
23
|
export const RpcStreamPacket = createMessageType({
|
|
24
|
-
typeName:
|
|
24
|
+
typeName: 'rpcstream.RpcStreamPacket',
|
|
25
25
|
fields: [
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
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' },
|
|
29
35
|
],
|
|
30
36
|
packedByDefault: true,
|
|
31
37
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MessageType } from
|
|
2
|
-
import { Message } from
|
|
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:
|
|
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:
|
|
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:
|
|
109
|
+
case: 'callCancel';
|
|
110
110
|
};
|
|
111
111
|
}>;
|
|
112
112
|
export declare const Packet: MessageType<Packet>;
|
package/dist/srpc/rpcproto.pb.js
CHANGED
|
@@ -1,37 +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, ScalarType } from
|
|
5
|
-
export const protobufPackage =
|
|
4
|
+
import { createMessageType, ScalarType } from '@aptre/protobuf-es-lite';
|
|
5
|
+
export const protobufPackage = 'srpc';
|
|
6
6
|
// CallStart contains the message type declaration for CallStart.
|
|
7
7
|
export const CallStart = createMessageType({
|
|
8
|
-
typeName:
|
|
8
|
+
typeName: 'srpc.CallStart',
|
|
9
9
|
fields: [
|
|
10
|
-
{ no: 1, name:
|
|
11
|
-
{ no: 2, name:
|
|
12
|
-
{ no: 3, name:
|
|
13
|
-
{ no: 4, name:
|
|
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 },
|
|
14
14
|
],
|
|
15
15
|
packedByDefault: true,
|
|
16
16
|
});
|
|
17
17
|
// CallData contains the message type declaration for CallData.
|
|
18
18
|
export const CallData = createMessageType({
|
|
19
|
-
typeName:
|
|
19
|
+
typeName: 'srpc.CallData',
|
|
20
20
|
fields: [
|
|
21
|
-
{ no: 1, name:
|
|
22
|
-
{ no: 2, name:
|
|
23
|
-
{ no: 3, name:
|
|
24
|
-
{ no: 4, name:
|
|
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 },
|
|
25
25
|
],
|
|
26
26
|
packedByDefault: true,
|
|
27
27
|
});
|
|
28
28
|
// Packet contains the message type declaration for Packet.
|
|
29
29
|
export const Packet = createMessageType({
|
|
30
|
-
typeName:
|
|
30
|
+
typeName: 'srpc.Packet',
|
|
31
31
|
fields: [
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
},
|
|
35
53
|
],
|
|
36
54
|
packedByDefault: true,
|
|
37
55
|
});
|
package/e2e/mock/mock.pb.go
CHANGED
package/e2e/mock/mock.pb.ts
CHANGED
|
@@ -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
|
|
6
|
-
import { createMessageType, Message, ScalarType } from
|
|
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 =
|
|
8
|
+
export const protobufPackage = 'e2e.mock'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* MockMsg is the mock message body.
|
|
@@ -16,16 +16,14 @@ export type MockMsg = Message<{
|
|
|
16
16
|
/**
|
|
17
17
|
* @generated from field: string body = 1;
|
|
18
18
|
*/
|
|
19
|
-
body?: string
|
|
20
|
-
|
|
21
|
-
}>;
|
|
19
|
+
body?: string
|
|
20
|
+
}>
|
|
22
21
|
|
|
23
22
|
// MockMsg contains the message type declaration for MockMsg.
|
|
24
23
|
export const MockMsg: MessageType<MockMsg> = createMessageType({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
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
|
+
})
|
package/e2e/mock/mock_srpc.pb.go
CHANGED
package/e2e/mock/mock_srpc.pb.ts
CHANGED
|
@@ -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
|
|
6
|
-
import {
|
|
7
|
-
import { ProtoRpc } from
|
|
5
|
+
import { MockMsg } from './mock.pb.js'
|
|
6
|
+
import { 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:
|
|
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:
|
|
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.
|
|
@@ -39,11 +39,7 @@ export interface Mock {
|
|
|
39
39
|
*
|
|
40
40
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
41
41
|
*/
|
|
42
|
-
MockRequest(
|
|
43
|
-
request: Message<MockMsg>, abortSignal?: AbortSignal
|
|
44
|
-
):
|
|
45
|
-
Promise<Message<MockMsg>>
|
|
46
|
-
|
|
42
|
+
MockRequest(request: MockMsg, abortSignal?: AbortSignal): Promise<MockMsg>
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
export const MockServiceName = MockDefinition.typeName
|
|
@@ -62,9 +58,9 @@ export class MockClient implements Mock {
|
|
|
62
58
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
63
59
|
*/
|
|
64
60
|
async MockRequest(
|
|
65
|
-
request:
|
|
66
|
-
|
|
67
|
-
Promise<
|
|
61
|
+
request: MockMsg,
|
|
62
|
+
abortSignal?: AbortSignal,
|
|
63
|
+
): Promise<MockMsg> {
|
|
68
64
|
const requestMsg = MockMsg.create(request)
|
|
69
65
|
const result = await this.rpc.request(
|
|
70
66
|
this.service,
|
|
@@ -74,5 +70,4 @@ Promise<Message<MockMsg>> {
|
|
|
74
70
|
)
|
|
75
71
|
return MockMsg.fromBinary(result)
|
|
76
72
|
}
|
|
77
|
-
|
|
78
73
|
}
|
package/echo/echo.pb.go
CHANGED
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
|
|
6
|
-
import { createMessageType, Message, ScalarType } from
|
|
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 =
|
|
8
|
+
export const protobufPackage = 'echo'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* EchoMsg is the message body for Echo.
|
|
@@ -16,16 +16,14 @@ export type EchoMsg = Message<{
|
|
|
16
16
|
/**
|
|
17
17
|
* @generated from field: string body = 1;
|
|
18
18
|
*/
|
|
19
|
-
body?: string
|
|
20
|
-
|
|
21
|
-
}>;
|
|
19
|
+
body?: string
|
|
20
|
+
}>
|
|
22
21
|
|
|
23
22
|
// EchoMsg contains the message type declaration for EchoMsg.
|
|
24
23
|
export const EchoMsg: MessageType<EchoMsg> = createMessageType({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
24
|
+
typeName: 'echo.EchoMsg',
|
|
25
|
+
fields: [
|
|
26
|
+
{ no: 1, name: 'body', kind: 'scalar', T: ScalarType.STRING },
|
|
27
|
+
] as readonly PartialFieldInfo[],
|
|
28
|
+
packedByDefault: true,
|
|
29
|
+
})
|
package/echo/echo_srpc.pb.go
CHANGED
package/echo/echo_srpc.pb.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
5
|
import { EchoMsg } from './echo.pb.js'
|
|
6
|
-
import { Empty,
|
|
6
|
+
import { Empty, MethodKind } from '@aptre/protobuf-es-lite'
|
|
7
7
|
import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js'
|
|
8
8
|
import {
|
|
9
9
|
buildDecodeMessageTransform,
|
|
@@ -100,10 +100,7 @@ export interface Echoer {
|
|
|
100
100
|
*
|
|
101
101
|
* @generated from rpc echo.Echoer.Echo
|
|
102
102
|
*/
|
|
103
|
-
Echo(
|
|
104
|
-
request: Message<EchoMsg>,
|
|
105
|
-
abortSignal?: AbortSignal,
|
|
106
|
-
): Promise<Message<EchoMsg>>
|
|
103
|
+
Echo(request: EchoMsg, abortSignal?: AbortSignal): Promise<EchoMsg>
|
|
107
104
|
|
|
108
105
|
/**
|
|
109
106
|
* EchoServerStream is an example of a server -> client one-way stream.
|
|
@@ -111,7 +108,7 @@ export interface Echoer {
|
|
|
111
108
|
* @generated from rpc echo.Echoer.EchoServerStream
|
|
112
109
|
*/
|
|
113
110
|
EchoServerStream(
|
|
114
|
-
request:
|
|
111
|
+
request: EchoMsg,
|
|
115
112
|
abortSignal?: AbortSignal,
|
|
116
113
|
): MessageStream<EchoMsg>
|
|
117
114
|
|
|
@@ -123,7 +120,7 @@ export interface Echoer {
|
|
|
123
120
|
EchoClientStream(
|
|
124
121
|
request: MessageStream<EchoMsg>,
|
|
125
122
|
abortSignal?: AbortSignal,
|
|
126
|
-
): Promise<
|
|
123
|
+
): Promise<EchoMsg>
|
|
127
124
|
|
|
128
125
|
/**
|
|
129
126
|
* EchoBidiStream is an example of a two-way stream.
|
|
@@ -150,10 +147,7 @@ export interface Echoer {
|
|
|
150
147
|
*
|
|
151
148
|
* @generated from rpc echo.Echoer.DoNothing
|
|
152
149
|
*/
|
|
153
|
-
DoNothing(
|
|
154
|
-
request: Message<Empty>,
|
|
155
|
-
abortSignal?: AbortSignal,
|
|
156
|
-
): Promise<Message<Empty>>
|
|
150
|
+
DoNothing(request: Empty, abortSignal?: AbortSignal): Promise<Empty>
|
|
157
151
|
}
|
|
158
152
|
|
|
159
153
|
export const EchoerServiceName = EchoerDefinition.typeName
|
|
@@ -176,10 +170,7 @@ export class EchoerClient implements Echoer {
|
|
|
176
170
|
*
|
|
177
171
|
* @generated from rpc echo.Echoer.Echo
|
|
178
172
|
*/
|
|
179
|
-
async Echo(
|
|
180
|
-
request: Message<EchoMsg>,
|
|
181
|
-
abortSignal?: AbortSignal,
|
|
182
|
-
): Promise<Message<EchoMsg>> {
|
|
173
|
+
async Echo(request: EchoMsg, abortSignal?: AbortSignal): Promise<EchoMsg> {
|
|
183
174
|
const requestMsg = EchoMsg.create(request)
|
|
184
175
|
const result = await this.rpc.request(
|
|
185
176
|
this.service,
|
|
@@ -196,7 +187,7 @@ export class EchoerClient implements Echoer {
|
|
|
196
187
|
* @generated from rpc echo.Echoer.EchoServerStream
|
|
197
188
|
*/
|
|
198
189
|
EchoServerStream(
|
|
199
|
-
request:
|
|
190
|
+
request: EchoMsg,
|
|
200
191
|
abortSignal?: AbortSignal,
|
|
201
192
|
): MessageStream<EchoMsg> {
|
|
202
193
|
const requestMsg = EchoMsg.create(request)
|
|
@@ -217,7 +208,7 @@ export class EchoerClient implements Echoer {
|
|
|
217
208
|
async EchoClientStream(
|
|
218
209
|
request: MessageStream<EchoMsg>,
|
|
219
210
|
abortSignal?: AbortSignal,
|
|
220
|
-
): Promise<
|
|
211
|
+
): Promise<EchoMsg> {
|
|
221
212
|
const result = await this.rpc.clientStreamingRequest(
|
|
222
213
|
this.service,
|
|
223
214
|
EchoerDefinition.methods.EchoClientStream.name,
|
|
@@ -268,10 +259,7 @@ export class EchoerClient implements Echoer {
|
|
|
268
259
|
*
|
|
269
260
|
* @generated from rpc echo.Echoer.DoNothing
|
|
270
261
|
*/
|
|
271
|
-
async DoNothing(
|
|
272
|
-
request: Message<Empty>,
|
|
273
|
-
abortSignal?: AbortSignal,
|
|
274
|
-
): Promise<Message<Empty>> {
|
|
262
|
+
async DoNothing(request: Empty, abortSignal?: AbortSignal): Promise<Empty> {
|
|
275
263
|
const requestMsg = Empty.create(request)
|
|
276
264
|
const result = await this.rpc.request(
|
|
277
265
|
this.service,
|
package/go.mod
CHANGED
|
@@ -13,11 +13,11 @@ replace nhooyr.io/websocket => github.com/paralin/nhooyr-websocket v1.8.12-0.202
|
|
|
13
13
|
|
|
14
14
|
require (
|
|
15
15
|
github.com/aperturerobotics/protobuf-go-lite v0.6.5 // latest
|
|
16
|
-
github.com/aperturerobotics/util v1.23.
|
|
16
|
+
github.com/aperturerobotics/util v1.23.4 // latest
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
require (
|
|
20
|
-
github.com/libp2p/go-libp2p v0.
|
|
20
|
+
github.com/libp2p/go-libp2p v0.35.0 // latest
|
|
21
21
|
github.com/libp2p/go-yamux/v4 v4.0.2-0.20240322071716-53ef5820bd48 // master
|
|
22
22
|
github.com/pkg/errors v0.9.1 // latest
|
|
23
23
|
github.com/sirupsen/logrus v1.9.3 // latest
|
package/go.sum
CHANGED
|
@@ -4,8 +4,8 @@ github.com/aperturerobotics/json-iterator-lite v1.0.0 h1:cihbrYWoK/S2RYXhJLpDZd+
|
|
|
4
4
|
github.com/aperturerobotics/json-iterator-lite v1.0.0/go.mod h1:snaApCEDtrHHP6UWSLKiYNOZU9A5NyzccKenx9oZEzg=
|
|
5
5
|
github.com/aperturerobotics/protobuf-go-lite v0.6.5 h1:AuPPcZ7ZaJe9ZYYC4gF7/5/Xbn9Mt9uXyV3+ADWy+Ys=
|
|
6
6
|
github.com/aperturerobotics/protobuf-go-lite v0.6.5/go.mod h1:YTbfnUj3feSULhs8VgepAHFnF3wUc0CPj4jd2axy21I=
|
|
7
|
-
github.com/aperturerobotics/util v1.23.
|
|
8
|
-
github.com/aperturerobotics/util v1.23.
|
|
7
|
+
github.com/aperturerobotics/util v1.23.4 h1:IXkVoN3Cc+5U5Rhd5hC00VGgL1PainhpaTyz5IPkc8I=
|
|
8
|
+
github.com/aperturerobotics/util v1.23.4/go.mod h1:y/BGl05icfllBf7l51IMJ6UOjpsDscAPt3ynhDZrwZ4=
|
|
9
9
|
github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI=
|
|
10
10
|
github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
|
|
11
11
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starpc",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.11",
|
|
4
4
|
"description": "Streaming protobuf RPC service protocol over any two-way channel.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"build": "npm run clean && tsc --project tsconfig.build.json --outDir ./dist/",
|
|
47
47
|
"check": "npm run typecheck",
|
|
48
48
|
"typecheck": "tsc --noEmit",
|
|
49
|
-
"deps": "depcheck --ignores 'bufferutil,utf-8-validate,rimraf,starpc,@aptre/protobuf-es-lite,tsx'",
|
|
49
|
+
"deps": "depcheck --ignores 'bufferutil,pre-commit,utf-8-validate,rimraf,starpc,@aptre/protobuf-es-lite,tsx'",
|
|
50
50
|
"codegen": "npm run gen",
|
|
51
51
|
"ci": "npm run build && npm run lint:js && npm run lint:go",
|
|
52
52
|
"format": "npm run format:go && npm run format:js && npm run format:config",
|
|
@@ -111,6 +111,6 @@
|
|
|
111
111
|
"ws": "^8.17.0"
|
|
112
112
|
},
|
|
113
113
|
"resolutions": {
|
|
114
|
-
"@aptre/protobuf-es-lite": "0.4.
|
|
114
|
+
"@aptre/protobuf-es-lite": "0.4.4"
|
|
115
115
|
}
|
|
116
116
|
}
|
package/srpc/rpcproto.pb.go
CHANGED
package/srpc/rpcproto.pb.ts
CHANGED
|
@@ -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
|
|
6
|
-
import { createMessageType, Message, ScalarType } from
|
|
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 =
|
|
8
|
+
export const protobufPackage = 'srpc'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* CallStart requests starting a new RPC call.
|
|
@@ -19,41 +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
|
|
43
|
-
|
|
44
|
-
}>;
|
|
42
|
+
dataIsZero?: boolean
|
|
43
|
+
}>
|
|
45
44
|
|
|
46
45
|
// CallStart contains the message type declaration for CallStart.
|
|
47
46
|
export const CallStart: MessageType<CallStart> = createMessageType({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
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
|
+
})
|
|
57
56
|
|
|
58
57
|
/**
|
|
59
58
|
* CallData contains a message in a streaming RPC sequence.
|
|
@@ -66,40 +65,39 @@ export type CallData = Message<{
|
|
|
66
65
|
*
|
|
67
66
|
* @generated from field: bytes data = 1;
|
|
68
67
|
*/
|
|
69
|
-
data?: Uint8Array
|
|
68
|
+
data?: Uint8Array
|
|
70
69
|
/**
|
|
71
70
|
* DataIsZero indicates Data is set with an empty message.
|
|
72
71
|
*
|
|
73
72
|
* @generated from field: bool data_is_zero = 2;
|
|
74
73
|
*/
|
|
75
|
-
dataIsZero?: boolean
|
|
74
|
+
dataIsZero?: boolean
|
|
76
75
|
/**
|
|
77
76
|
* Complete indicates the RPC call is completed.
|
|
78
77
|
*
|
|
79
78
|
* @generated from field: bool complete = 3;
|
|
80
79
|
*/
|
|
81
|
-
complete?: boolean
|
|
80
|
+
complete?: boolean
|
|
82
81
|
/**
|
|
83
82
|
* Error contains any error that caused the RPC to fail.
|
|
84
83
|
* If set, implies complete=true.
|
|
85
84
|
*
|
|
86
85
|
* @generated from field: string error = 4;
|
|
87
86
|
*/
|
|
88
|
-
error?: string
|
|
89
|
-
|
|
90
|
-
}>;
|
|
87
|
+
error?: string
|
|
88
|
+
}>
|
|
91
89
|
|
|
92
90
|
// CallData contains the message type declaration for CallData.
|
|
93
91
|
export const CallData: MessageType<CallData> = createMessageType({
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
})
|
|
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
|
+
})
|
|
103
101
|
|
|
104
102
|
/**
|
|
105
103
|
* Packet is a message sent over a srpc packet connection.
|
|
@@ -107,51 +105,70 @@ export const CallData: MessageType<CallData> = createMessageType({
|
|
|
107
105
|
* @generated from message srpc.Packet
|
|
108
106
|
*/
|
|
109
107
|
export type Packet = Message<{
|
|
110
|
-
|
|
111
108
|
/**
|
|
112
109
|
* Body is the packet body.
|
|
113
110
|
*
|
|
114
111
|
* @generated from oneof srpc.Packet.body
|
|
115
112
|
*/
|
|
116
|
-
body?:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
+
}>
|
|
146
146
|
|
|
147
147
|
// Packet contains the message type declaration for Packet.
|
|
148
148
|
export const Packet: MessageType<Packet> = createMessageType({
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
+
})
|