starpc 0.10.6 → 0.10.7
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/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/rpcproto.pb.ts +183 -273
- package/srpc/server-rpc.go +6 -6
- package/srpc/server.go +8 -8
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>;
|
package/dist/srpc/rpcproto.pb.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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 = "srpc";
|
|
5
5
|
function createBasePacket() {
|
|
6
6
|
return { body: undefined };
|
|
7
7
|
}
|
|
8
8
|
export const Packet = {
|
|
9
9
|
encode(message, writer = _m0.Writer.create()) {
|
|
10
|
-
if (message.body?.$case ===
|
|
10
|
+
if (message.body?.$case === "callStart") {
|
|
11
11
|
CallStart.encode(message.body.callStart, writer.uint32(10).fork()).ldelim();
|
|
12
12
|
}
|
|
13
|
-
if (message.body?.$case ===
|
|
13
|
+
if (message.body?.$case === "callData") {
|
|
14
14
|
CallData.encode(message.body.callData, writer.uint32(18).fork()).ldelim();
|
|
15
15
|
}
|
|
16
16
|
return writer;
|
|
@@ -23,16 +23,10 @@ export const Packet = {
|
|
|
23
23
|
const tag = reader.uint32();
|
|
24
24
|
switch (tag >>> 3) {
|
|
25
25
|
case 1:
|
|
26
|
-
message.body = {
|
|
27
|
-
$case: 'callStart',
|
|
28
|
-
callStart: CallStart.decode(reader, reader.uint32()),
|
|
29
|
-
};
|
|
26
|
+
message.body = { $case: "callStart", callStart: CallStart.decode(reader, reader.uint32()) };
|
|
30
27
|
break;
|
|
31
28
|
case 2:
|
|
32
|
-
message.body = {
|
|
33
|
-
$case: 'callData',
|
|
34
|
-
callData: CallData.decode(reader, reader.uint32()),
|
|
35
|
-
};
|
|
29
|
+
message.body = { $case: "callData", callData: CallData.decode(reader, reader.uint32()) };
|
|
36
30
|
break;
|
|
37
31
|
default:
|
|
38
32
|
reader.skipType(tag & 7);
|
|
@@ -72,62 +66,40 @@ export const Packet = {
|
|
|
72
66
|
fromJSON(object) {
|
|
73
67
|
return {
|
|
74
68
|
body: isSet(object.callStart)
|
|
75
|
-
? {
|
|
76
|
-
$case: 'callStart',
|
|
77
|
-
callStart: CallStart.fromJSON(object.callStart),
|
|
78
|
-
}
|
|
69
|
+
? { $case: "callStart", callStart: CallStart.fromJSON(object.callStart) }
|
|
79
70
|
: isSet(object.callData)
|
|
80
|
-
? { $case:
|
|
71
|
+
? { $case: "callData", callData: CallData.fromJSON(object.callData) }
|
|
81
72
|
: undefined,
|
|
82
73
|
};
|
|
83
74
|
},
|
|
84
75
|
toJSON(message) {
|
|
85
76
|
const obj = {};
|
|
86
|
-
message.body?.$case ===
|
|
87
|
-
(obj.callStart = message.body?.callStart
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
message.body?.$case === 'callData' &&
|
|
91
|
-
(obj.callData = message.body?.callData
|
|
92
|
-
? CallData.toJSON(message.body?.callData)
|
|
93
|
-
: undefined);
|
|
77
|
+
message.body?.$case === "callStart" &&
|
|
78
|
+
(obj.callStart = message.body?.callStart ? CallStart.toJSON(message.body?.callStart) : undefined);
|
|
79
|
+
message.body?.$case === "callData" &&
|
|
80
|
+
(obj.callData = message.body?.callData ? CallData.toJSON(message.body?.callData) : undefined);
|
|
94
81
|
return obj;
|
|
95
82
|
},
|
|
96
83
|
fromPartial(object) {
|
|
97
84
|
const message = createBasePacket();
|
|
98
|
-
if (object.body?.$case ===
|
|
99
|
-
|
|
100
|
-
object.body?.callStart !== null) {
|
|
101
|
-
message.body = {
|
|
102
|
-
$case: 'callStart',
|
|
103
|
-
callStart: CallStart.fromPartial(object.body.callStart),
|
|
104
|
-
};
|
|
85
|
+
if (object.body?.$case === "callStart" && object.body?.callStart !== undefined && object.body?.callStart !== null) {
|
|
86
|
+
message.body = { $case: "callStart", callStart: CallStart.fromPartial(object.body.callStart) };
|
|
105
87
|
}
|
|
106
|
-
if (object.body?.$case ===
|
|
107
|
-
|
|
108
|
-
object.body?.callData !== null) {
|
|
109
|
-
message.body = {
|
|
110
|
-
$case: 'callData',
|
|
111
|
-
callData: CallData.fromPartial(object.body.callData),
|
|
112
|
-
};
|
|
88
|
+
if (object.body?.$case === "callData" && object.body?.callData !== undefined && object.body?.callData !== null) {
|
|
89
|
+
message.body = { $case: "callData", callData: CallData.fromPartial(object.body.callData) };
|
|
113
90
|
}
|
|
114
91
|
return message;
|
|
115
92
|
},
|
|
116
93
|
};
|
|
117
94
|
function createBaseCallStart() {
|
|
118
|
-
return {
|
|
119
|
-
rpcService: '',
|
|
120
|
-
rpcMethod: '',
|
|
121
|
-
data: new Uint8Array(),
|
|
122
|
-
dataIsZero: false,
|
|
123
|
-
};
|
|
95
|
+
return { rpcService: "", rpcMethod: "", data: new Uint8Array(), dataIsZero: false };
|
|
124
96
|
}
|
|
125
97
|
export const CallStart = {
|
|
126
98
|
encode(message, writer = _m0.Writer.create()) {
|
|
127
|
-
if (message.rpcService !==
|
|
99
|
+
if (message.rpcService !== "") {
|
|
128
100
|
writer.uint32(10).string(message.rpcService);
|
|
129
101
|
}
|
|
130
|
-
if (message.rpcMethod !==
|
|
102
|
+
if (message.rpcMethod !== "") {
|
|
131
103
|
writer.uint32(18).string(message.rpcMethod);
|
|
132
104
|
}
|
|
133
105
|
if (message.data.length !== 0) {
|
|
@@ -194,11 +166,9 @@ export const CallStart = {
|
|
|
194
166
|
},
|
|
195
167
|
fromJSON(object) {
|
|
196
168
|
return {
|
|
197
|
-
rpcService: isSet(object.rpcService) ? String(object.rpcService) :
|
|
198
|
-
rpcMethod: isSet(object.rpcMethod) ? String(object.rpcMethod) :
|
|
199
|
-
data: isSet(object.data)
|
|
200
|
-
? bytesFromBase64(object.data)
|
|
201
|
-
: new Uint8Array(),
|
|
169
|
+
rpcService: isSet(object.rpcService) ? String(object.rpcService) : "",
|
|
170
|
+
rpcMethod: isSet(object.rpcMethod) ? String(object.rpcMethod) : "",
|
|
171
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(),
|
|
202
172
|
dataIsZero: isSet(object.dataIsZero) ? Boolean(object.dataIsZero) : false,
|
|
203
173
|
};
|
|
204
174
|
},
|
|
@@ -213,20 +183,15 @@ export const CallStart = {
|
|
|
213
183
|
},
|
|
214
184
|
fromPartial(object) {
|
|
215
185
|
const message = createBaseCallStart();
|
|
216
|
-
message.rpcService = object.rpcService ??
|
|
217
|
-
message.rpcMethod = object.rpcMethod ??
|
|
186
|
+
message.rpcService = object.rpcService ?? "";
|
|
187
|
+
message.rpcMethod = object.rpcMethod ?? "";
|
|
218
188
|
message.data = object.data ?? new Uint8Array();
|
|
219
189
|
message.dataIsZero = object.dataIsZero ?? false;
|
|
220
190
|
return message;
|
|
221
191
|
},
|
|
222
192
|
};
|
|
223
193
|
function createBaseCallData() {
|
|
224
|
-
return {
|
|
225
|
-
data: new Uint8Array(),
|
|
226
|
-
dataIsZero: false,
|
|
227
|
-
complete: false,
|
|
228
|
-
error: '',
|
|
229
|
-
};
|
|
194
|
+
return { data: new Uint8Array(), dataIsZero: false, complete: false, error: "" };
|
|
230
195
|
}
|
|
231
196
|
export const CallData = {
|
|
232
197
|
encode(message, writer = _m0.Writer.create()) {
|
|
@@ -239,7 +204,7 @@ export const CallData = {
|
|
|
239
204
|
if (message.complete === true) {
|
|
240
205
|
writer.uint32(24).bool(message.complete);
|
|
241
206
|
}
|
|
242
|
-
if (message.error !==
|
|
207
|
+
if (message.error !== "") {
|
|
243
208
|
writer.uint32(34).string(message.error);
|
|
244
209
|
}
|
|
245
210
|
return writer;
|
|
@@ -300,12 +265,10 @@ export const CallData = {
|
|
|
300
265
|
},
|
|
301
266
|
fromJSON(object) {
|
|
302
267
|
return {
|
|
303
|
-
data: isSet(object.data)
|
|
304
|
-
? bytesFromBase64(object.data)
|
|
305
|
-
: new Uint8Array(),
|
|
268
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(),
|
|
306
269
|
dataIsZero: isSet(object.dataIsZero) ? Boolean(object.dataIsZero) : false,
|
|
307
270
|
complete: isSet(object.complete) ? Boolean(object.complete) : false,
|
|
308
|
-
error: isSet(object.error) ? String(object.error) :
|
|
271
|
+
error: isSet(object.error) ? String(object.error) : "",
|
|
309
272
|
};
|
|
310
273
|
},
|
|
311
274
|
toJSON(message) {
|
|
@@ -322,28 +285,28 @@ export const CallData = {
|
|
|
322
285
|
message.data = object.data ?? new Uint8Array();
|
|
323
286
|
message.dataIsZero = object.dataIsZero ?? false;
|
|
324
287
|
message.complete = object.complete ?? false;
|
|
325
|
-
message.error = object.error ??
|
|
288
|
+
message.error = object.error ?? "";
|
|
326
289
|
return message;
|
|
327
290
|
},
|
|
328
291
|
};
|
|
329
292
|
var globalThis = (() => {
|
|
330
|
-
if (typeof globalThis !==
|
|
293
|
+
if (typeof globalThis !== "undefined") {
|
|
331
294
|
return globalThis;
|
|
332
295
|
}
|
|
333
|
-
if (typeof self !==
|
|
296
|
+
if (typeof self !== "undefined") {
|
|
334
297
|
return self;
|
|
335
298
|
}
|
|
336
|
-
if (typeof window !==
|
|
299
|
+
if (typeof window !== "undefined") {
|
|
337
300
|
return window;
|
|
338
301
|
}
|
|
339
|
-
if (typeof global !==
|
|
302
|
+
if (typeof global !== "undefined") {
|
|
340
303
|
return global;
|
|
341
304
|
}
|
|
342
|
-
throw
|
|
305
|
+
throw "Unable to locate global object";
|
|
343
306
|
})();
|
|
344
307
|
function bytesFromBase64(b64) {
|
|
345
308
|
if (globalThis.Buffer) {
|
|
346
|
-
return Uint8Array.from(globalThis.Buffer.from(b64,
|
|
309
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
347
310
|
}
|
|
348
311
|
else {
|
|
349
312
|
const bin = globalThis.atob(b64);
|
|
@@ -356,14 +319,14 @@ function bytesFromBase64(b64) {
|
|
|
356
319
|
}
|
|
357
320
|
function base64FromBytes(arr) {
|
|
358
321
|
if (globalThis.Buffer) {
|
|
359
|
-
return globalThis.Buffer.from(arr).toString(
|
|
322
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
360
323
|
}
|
|
361
324
|
else {
|
|
362
325
|
const bin = [];
|
|
363
326
|
arr.forEach((byte) => {
|
|
364
327
|
bin.push(String.fromCharCode(byte));
|
|
365
328
|
});
|
|
366
|
-
return globalThis.btoa(bin.join(
|
|
329
|
+
return globalThis.btoa(bin.join(""));
|
|
367
330
|
}
|
|
368
331
|
}
|
|
369
332
|
if (_m0.util.Long !== Long) {
|