starpc 0.10.6 → 0.10.8
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/README.md +19 -8
- package/dist/echo/echo.pb.d.ts +5 -5
- package/dist/echo/echo.pb.js +20 -20
- package/dist/rpcstream/rpcstream.pb.d.ts +7 -7
- package/dist/rpcstream/rpcstream.pb.js +39 -64
- package/dist/srpc/rpcproto.pb.d.ts +6 -6
- package/dist/srpc/rpcproto.pb.js +38 -75
- package/e2e/e2e_test.go +0 -7
- package/echo/echo.pb.ts +88 -144
- package/go.mod +9 -10
- package/go.sum +19 -21
- package/package.json +1 -1
- package/srpc/handler.go +11 -4
- package/srpc/mux.go +40 -4
- package/srpc/muxed-conn.go +7 -2
- package/srpc/rpcproto.pb.ts +183 -273
- package/srpc/rwc-conn.go +229 -0
- package/srpc/server-rpc.go +6 -6
- package/srpc/server.go +8 -8
package/README.md
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
# Stream RPC
|
|
2
2
|
|
|
3
|
+
[![GoDoc Widget]][GoDoc] [![Go Report Card Widget]][Go Report Card]
|
|
4
|
+
|
|
5
|
+
> Protobuf 3 RPC services over any stream multiplexer.
|
|
6
|
+
|
|
7
|
+
[GoDoc]: https://godoc.org/github.com/aperturerobotics/starpc
|
|
8
|
+
[GoDoc Widget]: https://godoc.org/github.com/aperturerobotics/starpc?status.svg
|
|
9
|
+
[Go Report Card Widget]: https://goreportcard.com/badge/github.com/aperturerobotics/starpc
|
|
10
|
+
[Go Report Card]: https://goreportcard.com/report/github.com/aperturerobotics/starpc
|
|
11
|
+
|
|
12
|
+
## Introduction
|
|
13
|
+
|
|
3
14
|
**starpc** implements [Proto3 services] (server & client) in both TypeScript and Go.
|
|
4
15
|
|
|
5
16
|
[Proto3 services]: https://developers.google.com/protocol-buffers/docs/proto3#services
|
|
6
17
|
|
|
7
18
|
Supports **client-to-server streaming** RPCs in the web browser, currently not
|
|
8
|
-
supported by any of the
|
|
19
|
+
supported by any of the other RPC libraries.
|
|
9
20
|
|
|
10
21
|
The [rpcproto](./srpc/rpcproto.proto) file describes the protocol.
|
|
11
22
|
|
|
@@ -17,7 +28,7 @@ Can use any Stream multiplexer: defaults to [libp2p-mplex] over a WebSocket.
|
|
|
17
28
|
|
|
18
29
|
[rpcstream]: ./rpcstream
|
|
19
30
|
|
|
20
|
-
|
|
31
|
+
## Usage
|
|
21
32
|
|
|
22
33
|
Start with the [protobuf-project] template repository on the "starpc" branch.
|
|
23
34
|
|
|
@@ -26,13 +37,13 @@ Start with the [protobuf-project] template repository on the "starpc" branch.
|
|
|
26
37
|
Use "git add" to add your new .proto files, then `yarn gen` to generate the
|
|
27
38
|
TypeScript and Go code.
|
|
28
39
|
|
|
29
|
-
|
|
40
|
+
## Examples
|
|
30
41
|
|
|
31
42
|
The demo/boilerplate project implements the Echo example below.
|
|
32
43
|
|
|
33
44
|
This repository uses protowrap, see the [Makefile](./Makefile).
|
|
34
45
|
|
|
35
|
-
|
|
46
|
+
### Protobuf
|
|
36
47
|
|
|
37
48
|
The following examples use the [echo](./echo/echo.proto) protobuf sample.
|
|
38
49
|
|
|
@@ -58,7 +69,7 @@ message EchoMsg {
|
|
|
58
69
|
}
|
|
59
70
|
```
|
|
60
71
|
|
|
61
|
-
|
|
72
|
+
### Go
|
|
62
73
|
|
|
63
74
|
This example demonstrates both the server and client:
|
|
64
75
|
|
|
@@ -94,7 +105,7 @@ if out.GetBody() != bodyTxt {
|
|
|
94
105
|
|
|
95
106
|
[e2e test]: ./e2e/e2e_test.go
|
|
96
107
|
|
|
97
|
-
|
|
108
|
+
### TypeScript
|
|
98
109
|
|
|
99
110
|
See the ts-proto README to generate the TypeScript for your protobufs.
|
|
100
111
|
|
|
@@ -155,7 +166,7 @@ for await (const msg of serverStream) {
|
|
|
155
166
|
}
|
|
156
167
|
```
|
|
157
168
|
|
|
158
|
-
|
|
169
|
+
### WebSocket
|
|
159
170
|
|
|
160
171
|
One way to integrate Go and TypeScript is over a WebSocket:
|
|
161
172
|
|
|
@@ -186,7 +197,7 @@ Uses [vtprotobuf] to generate Protobuf marshal / unmarshal code.
|
|
|
186
197
|
|
|
187
198
|
[vtprotobuf]: https://github.com/planetscale/vtprotobuf
|
|
188
199
|
|
|
189
|
-
|
|
200
|
+
## Support
|
|
190
201
|
|
|
191
202
|
Starpc is built & supported by Aperture Robotics, LLC.
|
|
192
203
|
|
package/dist/echo/echo.pb.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Long from
|
|
2
|
-
import _m0 from
|
|
3
|
-
import { RpcStreamPacket } from
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal.js";
|
|
3
|
+
import { RpcStreamPacket } from "../rpcstream/rpcstream.pb.js";
|
|
4
4
|
export declare const protobufPackage = "echo";
|
|
5
5
|
/** EchoMsg is the message body for Echo. */
|
|
6
6
|
export interface EchoMsg {
|
|
@@ -322,9 +322,9 @@ declare type Builtin = Date | Function | Uint8Array | string | number | boolean
|
|
|
322
322
|
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
323
323
|
$case: string;
|
|
324
324
|
} ? {
|
|
325
|
-
[K in keyof Omit<T,
|
|
325
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
326
326
|
} & {
|
|
327
|
-
$case: T[
|
|
327
|
+
$case: T["$case"];
|
|
328
328
|
} : T extends {} ? {
|
|
329
329
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
330
330
|
} : Partial<T>;
|
package/dist/echo/echo.pb.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import Long from
|
|
3
|
-
import _m0 from
|
|
4
|
-
import { RpcStreamPacket } from
|
|
5
|
-
export const protobufPackage =
|
|
2
|
+
import Long from "long";
|
|
3
|
+
import _m0 from "protobufjs/minimal.js";
|
|
4
|
+
import { RpcStreamPacket } from "../rpcstream/rpcstream.pb.js";
|
|
5
|
+
export const protobufPackage = "echo";
|
|
6
6
|
function createBaseEchoMsg() {
|
|
7
|
-
return { body:
|
|
7
|
+
return { body: "" };
|
|
8
8
|
}
|
|
9
9
|
export const EchoMsg = {
|
|
10
10
|
encode(message, writer = _m0.Writer.create()) {
|
|
11
|
-
if (message.body !==
|
|
11
|
+
if (message.body !== "") {
|
|
12
12
|
writer.uint32(10).string(message.body);
|
|
13
13
|
}
|
|
14
14
|
return writer;
|
|
@@ -59,7 +59,7 @@ export const EchoMsg = {
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
fromJSON(object) {
|
|
62
|
-
return { body: isSet(object.body) ? String(object.body) :
|
|
62
|
+
return { body: isSet(object.body) ? String(object.body) : "" };
|
|
63
63
|
},
|
|
64
64
|
toJSON(message) {
|
|
65
65
|
const obj = {};
|
|
@@ -68,7 +68,7 @@ export const EchoMsg = {
|
|
|
68
68
|
},
|
|
69
69
|
fromPartial(object) {
|
|
70
70
|
const message = createBaseEchoMsg();
|
|
71
|
-
message.body = object.body ??
|
|
71
|
+
message.body = object.body ?? "";
|
|
72
72
|
return message;
|
|
73
73
|
},
|
|
74
74
|
};
|
|
@@ -83,37 +83,37 @@ export class EchoerClientImpl {
|
|
|
83
83
|
}
|
|
84
84
|
Echo(request) {
|
|
85
85
|
const data = EchoMsg.encode(request).finish();
|
|
86
|
-
const promise = this.rpc.request(
|
|
86
|
+
const promise = this.rpc.request("echo.Echoer", "Echo", data);
|
|
87
87
|
return promise.then((data) => EchoMsg.decode(new _m0.Reader(data)));
|
|
88
88
|
}
|
|
89
89
|
EchoServerStream(request) {
|
|
90
90
|
const data = EchoMsg.encode(request).finish();
|
|
91
|
-
const result = this.rpc.serverStreamingRequest(
|
|
91
|
+
const result = this.rpc.serverStreamingRequest("echo.Echoer", "EchoServerStream", data);
|
|
92
92
|
return EchoMsg.decodeTransform(result);
|
|
93
93
|
}
|
|
94
94
|
EchoClientStream(request) {
|
|
95
95
|
const data = EchoMsg.encodeTransform(request);
|
|
96
|
-
const promise = this.rpc.clientStreamingRequest(
|
|
96
|
+
const promise = this.rpc.clientStreamingRequest("echo.Echoer", "EchoClientStream", data);
|
|
97
97
|
return promise.then((data) => EchoMsg.decode(new _m0.Reader(data)));
|
|
98
98
|
}
|
|
99
99
|
EchoBidiStream(request) {
|
|
100
100
|
const data = EchoMsg.encodeTransform(request);
|
|
101
|
-
const result = this.rpc.bidirectionalStreamingRequest(
|
|
101
|
+
const result = this.rpc.bidirectionalStreamingRequest("echo.Echoer", "EchoBidiStream", data);
|
|
102
102
|
return EchoMsg.decodeTransform(result);
|
|
103
103
|
}
|
|
104
104
|
RpcStream(request) {
|
|
105
105
|
const data = RpcStreamPacket.encodeTransform(request);
|
|
106
|
-
const result = this.rpc.bidirectionalStreamingRequest(
|
|
106
|
+
const result = this.rpc.bidirectionalStreamingRequest("echo.Echoer", "RpcStream", data);
|
|
107
107
|
return RpcStreamPacket.decodeTransform(result);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
export const EchoerDefinition = {
|
|
111
|
-
name:
|
|
112
|
-
fullName:
|
|
111
|
+
name: "Echoer",
|
|
112
|
+
fullName: "echo.Echoer",
|
|
113
113
|
methods: {
|
|
114
114
|
/** Echo returns the given message. */
|
|
115
115
|
echo: {
|
|
116
|
-
name:
|
|
116
|
+
name: "Echo",
|
|
117
117
|
requestType: EchoMsg,
|
|
118
118
|
requestStream: false,
|
|
119
119
|
responseType: EchoMsg,
|
|
@@ -122,7 +122,7 @@ export const EchoerDefinition = {
|
|
|
122
122
|
},
|
|
123
123
|
/** EchoServerStream is an example of a server -> client one-way stream. */
|
|
124
124
|
echoServerStream: {
|
|
125
|
-
name:
|
|
125
|
+
name: "EchoServerStream",
|
|
126
126
|
requestType: EchoMsg,
|
|
127
127
|
requestStream: false,
|
|
128
128
|
responseType: EchoMsg,
|
|
@@ -131,7 +131,7 @@ export const EchoerDefinition = {
|
|
|
131
131
|
},
|
|
132
132
|
/** EchoClientStream is an example of client->server one-way stream. */
|
|
133
133
|
echoClientStream: {
|
|
134
|
-
name:
|
|
134
|
+
name: "EchoClientStream",
|
|
135
135
|
requestType: EchoMsg,
|
|
136
136
|
requestStream: true,
|
|
137
137
|
responseType: EchoMsg,
|
|
@@ -140,7 +140,7 @@ export const EchoerDefinition = {
|
|
|
140
140
|
},
|
|
141
141
|
/** EchoBidiStream is an example of a two-way stream. */
|
|
142
142
|
echoBidiStream: {
|
|
143
|
-
name:
|
|
143
|
+
name: "EchoBidiStream",
|
|
144
144
|
requestType: EchoMsg,
|
|
145
145
|
requestStream: true,
|
|
146
146
|
responseType: EchoMsg,
|
|
@@ -149,7 +149,7 @@ export const EchoerDefinition = {
|
|
|
149
149
|
},
|
|
150
150
|
/** RpcStream opens a nested rpc call stream. */
|
|
151
151
|
rpcStream: {
|
|
152
|
-
name:
|
|
152
|
+
name: "RpcStream",
|
|
153
153
|
requestType: RpcStreamPacket,
|
|
154
154
|
requestStream: true,
|
|
155
155
|
responseType: RpcStreamPacket,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import Long from
|
|
2
|
-
import _m0 from
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal.js";
|
|
3
3
|
export declare const protobufPackage = "rpcstream";
|
|
4
4
|
/** RpcStreamPacket is a packet encapsulating data for a RPC stream. */
|
|
5
5
|
export interface RpcStreamPacket {
|
|
6
6
|
body?: {
|
|
7
|
-
$case:
|
|
7
|
+
$case: "init";
|
|
8
8
|
init: RpcStreamInit;
|
|
9
9
|
} | {
|
|
10
|
-
$case:
|
|
10
|
+
$case: "ack";
|
|
11
11
|
ack: RpcAck;
|
|
12
12
|
} | {
|
|
13
|
-
$case:
|
|
13
|
+
$case: "data";
|
|
14
14
|
data: Uint8Array;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
@@ -116,9 +116,9 @@ declare type Builtin = Date | Function | Uint8Array | string | number | boolean
|
|
|
116
116
|
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
117
117
|
$case: string;
|
|
118
118
|
} ? {
|
|
119
|
-
[K in keyof Omit<T,
|
|
119
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
120
120
|
} & {
|
|
121
|
-
$case: T[
|
|
121
|
+
$case: T["$case"];
|
|
122
122
|
} : T extends {} ? {
|
|
123
123
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
124
124
|
} : Partial<T>;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import Long from
|
|
3
|
-
import _m0 from
|
|
4
|
-
export const protobufPackage =
|
|
2
|
+
import Long from "long";
|
|
3
|
+
import _m0 from "protobufjs/minimal.js";
|
|
4
|
+
export const protobufPackage = "rpcstream";
|
|
5
5
|
function createBaseRpcStreamPacket() {
|
|
6
6
|
return { body: undefined };
|
|
7
7
|
}
|
|
8
8
|
export const RpcStreamPacket = {
|
|
9
9
|
encode(message, writer = _m0.Writer.create()) {
|
|
10
|
-
if (message.body?.$case ===
|
|
10
|
+
if (message.body?.$case === "init") {
|
|
11
11
|
RpcStreamInit.encode(message.body.init, writer.uint32(10).fork()).ldelim();
|
|
12
12
|
}
|
|
13
|
-
if (message.body?.$case ===
|
|
13
|
+
if (message.body?.$case === "ack") {
|
|
14
14
|
RpcAck.encode(message.body.ack, writer.uint32(18).fork()).ldelim();
|
|
15
15
|
}
|
|
16
|
-
if (message.body?.$case ===
|
|
16
|
+
if (message.body?.$case === "data") {
|
|
17
17
|
writer.uint32(26).bytes(message.body.data);
|
|
18
18
|
}
|
|
19
19
|
return writer;
|
|
@@ -26,19 +26,13 @@ export const RpcStreamPacket = {
|
|
|
26
26
|
const tag = reader.uint32();
|
|
27
27
|
switch (tag >>> 3) {
|
|
28
28
|
case 1:
|
|
29
|
-
message.body = {
|
|
30
|
-
$case: 'init',
|
|
31
|
-
init: RpcStreamInit.decode(reader, reader.uint32()),
|
|
32
|
-
};
|
|
29
|
+
message.body = { $case: "init", init: RpcStreamInit.decode(reader, reader.uint32()) };
|
|
33
30
|
break;
|
|
34
31
|
case 2:
|
|
35
|
-
message.body = {
|
|
36
|
-
$case: 'ack',
|
|
37
|
-
ack: RpcAck.decode(reader, reader.uint32()),
|
|
38
|
-
};
|
|
32
|
+
message.body = { $case: "ack", ack: RpcAck.decode(reader, reader.uint32()) };
|
|
39
33
|
break;
|
|
40
34
|
case 3:
|
|
41
|
-
message.body = { $case:
|
|
35
|
+
message.body = { $case: "data", data: reader.bytes() };
|
|
42
36
|
break;
|
|
43
37
|
default:
|
|
44
38
|
reader.skipType(tag & 7);
|
|
@@ -78,60 +72,43 @@ export const RpcStreamPacket = {
|
|
|
78
72
|
fromJSON(object) {
|
|
79
73
|
return {
|
|
80
74
|
body: isSet(object.init)
|
|
81
|
-
? { $case:
|
|
75
|
+
? { $case: "init", init: RpcStreamInit.fromJSON(object.init) }
|
|
82
76
|
: isSet(object.ack)
|
|
83
|
-
? { $case:
|
|
77
|
+
? { $case: "ack", ack: RpcAck.fromJSON(object.ack) }
|
|
84
78
|
: isSet(object.data)
|
|
85
|
-
? { $case:
|
|
79
|
+
? { $case: "data", data: bytesFromBase64(object.data) }
|
|
86
80
|
: undefined,
|
|
87
81
|
};
|
|
88
82
|
},
|
|
89
83
|
toJSON(message) {
|
|
90
84
|
const obj = {};
|
|
91
|
-
message.body?.$case ===
|
|
92
|
-
(obj.init = message.body?.init
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
(obj.ack = message.body?.ack
|
|
97
|
-
? RpcAck.toJSON(message.body?.ack)
|
|
98
|
-
: undefined);
|
|
99
|
-
message.body?.$case === 'data' &&
|
|
100
|
-
(obj.data =
|
|
101
|
-
message.body?.data !== undefined
|
|
102
|
-
? base64FromBytes(message.body?.data)
|
|
103
|
-
: undefined);
|
|
85
|
+
message.body?.$case === "init" &&
|
|
86
|
+
(obj.init = message.body?.init ? RpcStreamInit.toJSON(message.body?.init) : undefined);
|
|
87
|
+
message.body?.$case === "ack" && (obj.ack = message.body?.ack ? RpcAck.toJSON(message.body?.ack) : undefined);
|
|
88
|
+
message.body?.$case === "data" &&
|
|
89
|
+
(obj.data = message.body?.data !== undefined ? base64FromBytes(message.body?.data) : undefined);
|
|
104
90
|
return obj;
|
|
105
91
|
},
|
|
106
92
|
fromPartial(object) {
|
|
107
93
|
const message = createBaseRpcStreamPacket();
|
|
108
|
-
if (object.body?.$case ===
|
|
109
|
-
|
|
110
|
-
object.body?.init !== null) {
|
|
111
|
-
message.body = {
|
|
112
|
-
$case: 'init',
|
|
113
|
-
init: RpcStreamInit.fromPartial(object.body.init),
|
|
114
|
-
};
|
|
94
|
+
if (object.body?.$case === "init" && object.body?.init !== undefined && object.body?.init !== null) {
|
|
95
|
+
message.body = { $case: "init", init: RpcStreamInit.fromPartial(object.body.init) };
|
|
115
96
|
}
|
|
116
|
-
if (object.body?.$case ===
|
|
117
|
-
|
|
118
|
-
object.body?.ack !== null) {
|
|
119
|
-
message.body = { $case: 'ack', ack: RpcAck.fromPartial(object.body.ack) };
|
|
97
|
+
if (object.body?.$case === "ack" && object.body?.ack !== undefined && object.body?.ack !== null) {
|
|
98
|
+
message.body = { $case: "ack", ack: RpcAck.fromPartial(object.body.ack) };
|
|
120
99
|
}
|
|
121
|
-
if (object.body?.$case ===
|
|
122
|
-
|
|
123
|
-
object.body?.data !== null) {
|
|
124
|
-
message.body = { $case: 'data', data: object.body.data };
|
|
100
|
+
if (object.body?.$case === "data" && object.body?.data !== undefined && object.body?.data !== null) {
|
|
101
|
+
message.body = { $case: "data", data: object.body.data };
|
|
125
102
|
}
|
|
126
103
|
return message;
|
|
127
104
|
},
|
|
128
105
|
};
|
|
129
106
|
function createBaseRpcStreamInit() {
|
|
130
|
-
return { componentId:
|
|
107
|
+
return { componentId: "" };
|
|
131
108
|
}
|
|
132
109
|
export const RpcStreamInit = {
|
|
133
110
|
encode(message, writer = _m0.Writer.create()) {
|
|
134
|
-
if (message.componentId !==
|
|
111
|
+
if (message.componentId !== "") {
|
|
135
112
|
writer.uint32(10).string(message.componentId);
|
|
136
113
|
}
|
|
137
114
|
return writer;
|
|
@@ -182,9 +159,7 @@ export const RpcStreamInit = {
|
|
|
182
159
|
}
|
|
183
160
|
},
|
|
184
161
|
fromJSON(object) {
|
|
185
|
-
return {
|
|
186
|
-
componentId: isSet(object.componentId) ? String(object.componentId) : '',
|
|
187
|
-
};
|
|
162
|
+
return { componentId: isSet(object.componentId) ? String(object.componentId) : "" };
|
|
188
163
|
},
|
|
189
164
|
toJSON(message) {
|
|
190
165
|
const obj = {};
|
|
@@ -193,16 +168,16 @@ export const RpcStreamInit = {
|
|
|
193
168
|
},
|
|
194
169
|
fromPartial(object) {
|
|
195
170
|
const message = createBaseRpcStreamInit();
|
|
196
|
-
message.componentId = object.componentId ??
|
|
171
|
+
message.componentId = object.componentId ?? "";
|
|
197
172
|
return message;
|
|
198
173
|
},
|
|
199
174
|
};
|
|
200
175
|
function createBaseRpcAck() {
|
|
201
|
-
return { error:
|
|
176
|
+
return { error: "" };
|
|
202
177
|
}
|
|
203
178
|
export const RpcAck = {
|
|
204
179
|
encode(message, writer = _m0.Writer.create()) {
|
|
205
|
-
if (message.error !==
|
|
180
|
+
if (message.error !== "") {
|
|
206
181
|
writer.uint32(10).string(message.error);
|
|
207
182
|
}
|
|
208
183
|
return writer;
|
|
@@ -253,7 +228,7 @@ export const RpcAck = {
|
|
|
253
228
|
}
|
|
254
229
|
},
|
|
255
230
|
fromJSON(object) {
|
|
256
|
-
return { error: isSet(object.error) ? String(object.error) :
|
|
231
|
+
return { error: isSet(object.error) ? String(object.error) : "" };
|
|
257
232
|
},
|
|
258
233
|
toJSON(message) {
|
|
259
234
|
const obj = {};
|
|
@@ -262,28 +237,28 @@ export const RpcAck = {
|
|
|
262
237
|
},
|
|
263
238
|
fromPartial(object) {
|
|
264
239
|
const message = createBaseRpcAck();
|
|
265
|
-
message.error = object.error ??
|
|
240
|
+
message.error = object.error ?? "";
|
|
266
241
|
return message;
|
|
267
242
|
},
|
|
268
243
|
};
|
|
269
244
|
var globalThis = (() => {
|
|
270
|
-
if (typeof globalThis !==
|
|
245
|
+
if (typeof globalThis !== "undefined") {
|
|
271
246
|
return globalThis;
|
|
272
247
|
}
|
|
273
|
-
if (typeof self !==
|
|
248
|
+
if (typeof self !== "undefined") {
|
|
274
249
|
return self;
|
|
275
250
|
}
|
|
276
|
-
if (typeof window !==
|
|
251
|
+
if (typeof window !== "undefined") {
|
|
277
252
|
return window;
|
|
278
253
|
}
|
|
279
|
-
if (typeof global !==
|
|
254
|
+
if (typeof global !== "undefined") {
|
|
280
255
|
return global;
|
|
281
256
|
}
|
|
282
|
-
throw
|
|
257
|
+
throw "Unable to locate global object";
|
|
283
258
|
})();
|
|
284
259
|
function bytesFromBase64(b64) {
|
|
285
260
|
if (globalThis.Buffer) {
|
|
286
|
-
return Uint8Array.from(globalThis.Buffer.from(b64,
|
|
261
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
287
262
|
}
|
|
288
263
|
else {
|
|
289
264
|
const bin = globalThis.atob(b64);
|
|
@@ -296,14 +271,14 @@ function bytesFromBase64(b64) {
|
|
|
296
271
|
}
|
|
297
272
|
function base64FromBytes(arr) {
|
|
298
273
|
if (globalThis.Buffer) {
|
|
299
|
-
return globalThis.Buffer.from(arr).toString(
|
|
274
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
300
275
|
}
|
|
301
276
|
else {
|
|
302
277
|
const bin = [];
|
|
303
278
|
arr.forEach((byte) => {
|
|
304
279
|
bin.push(String.fromCharCode(byte));
|
|
305
280
|
});
|
|
306
|
-
return globalThis.btoa(bin.join(
|
|
281
|
+
return globalThis.btoa(bin.join(""));
|
|
307
282
|
}
|
|
308
283
|
}
|
|
309
284
|
if (_m0.util.Long !== Long) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Long from
|
|
2
|
-
import _m0 from
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal.js";
|
|
3
3
|
export declare const protobufPackage = "srpc";
|
|
4
4
|
/** Packet is a message sent over a srpc packet connection. */
|
|
5
5
|
export interface Packet {
|
|
6
6
|
body?: {
|
|
7
|
-
$case:
|
|
7
|
+
$case: "callStart";
|
|
8
8
|
callStart: CallStart;
|
|
9
9
|
} | {
|
|
10
|
-
$case:
|
|
10
|
+
$case: "callData";
|
|
11
11
|
callData: CallData;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
@@ -162,9 +162,9 @@ declare type Builtin = Date | Function | Uint8Array | string | number | boolean
|
|
|
162
162
|
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
163
163
|
$case: string;
|
|
164
164
|
} ? {
|
|
165
|
-
[K in keyof Omit<T,
|
|
165
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
166
166
|
} & {
|
|
167
|
-
$case: T[
|
|
167
|
+
$case: T["$case"];
|
|
168
168
|
} : T extends {} ? {
|
|
169
169
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
170
170
|
} : Partial<T>;
|