starpc 0.10.1 → 0.10.2
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 +64 -39
- package/dist/srpc/client.js +1 -1
- package/dist/srpc/rpcproto.pb.d.ts +6 -6
- package/dist/srpc/rpcproto.pb.js +75 -38
- package/dist/srpc/server.js +1 -1
- package/e2e/e2e.ts +1 -1
- package/echo/echo.pb.ts +144 -88
- package/package.json +1 -1
- package/srpc/array-list.ts +4 -1
- package/srpc/client.ts +0 -1
- package/srpc/mux.ts +12 -3
- package/srpc/packet.ts +9 -5
- package/srpc/rpcproto.pb.ts +273 -183
- package/srpc/server.ts +3 -2
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,13 +26,19 @@ export const RpcStreamPacket = {
|
|
|
26
26
|
const tag = reader.uint32();
|
|
27
27
|
switch (tag >>> 3) {
|
|
28
28
|
case 1:
|
|
29
|
-
message.body = {
|
|
29
|
+
message.body = {
|
|
30
|
+
$case: 'init',
|
|
31
|
+
init: RpcStreamInit.decode(reader, reader.uint32()),
|
|
32
|
+
};
|
|
30
33
|
break;
|
|
31
34
|
case 2:
|
|
32
|
-
message.body = {
|
|
35
|
+
message.body = {
|
|
36
|
+
$case: 'ack',
|
|
37
|
+
ack: RpcAck.decode(reader, reader.uint32()),
|
|
38
|
+
};
|
|
33
39
|
break;
|
|
34
40
|
case 3:
|
|
35
|
-
message.body = { $case:
|
|
41
|
+
message.body = { $case: 'data', data: reader.bytes() };
|
|
36
42
|
break;
|
|
37
43
|
default:
|
|
38
44
|
reader.skipType(tag & 7);
|
|
@@ -72,43 +78,60 @@ export const RpcStreamPacket = {
|
|
|
72
78
|
fromJSON(object) {
|
|
73
79
|
return {
|
|
74
80
|
body: isSet(object.init)
|
|
75
|
-
? { $case:
|
|
81
|
+
? { $case: 'init', init: RpcStreamInit.fromJSON(object.init) }
|
|
76
82
|
: isSet(object.ack)
|
|
77
|
-
? { $case:
|
|
83
|
+
? { $case: 'ack', ack: RpcAck.fromJSON(object.ack) }
|
|
78
84
|
: isSet(object.data)
|
|
79
|
-
? { $case:
|
|
85
|
+
? { $case: 'data', data: bytesFromBase64(object.data) }
|
|
80
86
|
: undefined,
|
|
81
87
|
};
|
|
82
88
|
},
|
|
83
89
|
toJSON(message) {
|
|
84
90
|
const obj = {};
|
|
85
|
-
message.body?.$case ===
|
|
86
|
-
(obj.init = message.body?.init
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
message.body?.$case === 'init' &&
|
|
92
|
+
(obj.init = message.body?.init
|
|
93
|
+
? RpcStreamInit.toJSON(message.body?.init)
|
|
94
|
+
: undefined);
|
|
95
|
+
message.body?.$case === 'ack' &&
|
|
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);
|
|
90
104
|
return obj;
|
|
91
105
|
},
|
|
92
106
|
fromPartial(object) {
|
|
93
107
|
const message = createBaseRpcStreamPacket();
|
|
94
|
-
if (object.body?.$case ===
|
|
95
|
-
|
|
108
|
+
if (object.body?.$case === 'init' &&
|
|
109
|
+
object.body?.init !== undefined &&
|
|
110
|
+
object.body?.init !== null) {
|
|
111
|
+
message.body = {
|
|
112
|
+
$case: 'init',
|
|
113
|
+
init: RpcStreamInit.fromPartial(object.body.init),
|
|
114
|
+
};
|
|
96
115
|
}
|
|
97
|
-
if (object.body?.$case ===
|
|
98
|
-
|
|
116
|
+
if (object.body?.$case === 'ack' &&
|
|
117
|
+
object.body?.ack !== undefined &&
|
|
118
|
+
object.body?.ack !== null) {
|
|
119
|
+
message.body = { $case: 'ack', ack: RpcAck.fromPartial(object.body.ack) };
|
|
99
120
|
}
|
|
100
|
-
if (object.body?.$case ===
|
|
101
|
-
|
|
121
|
+
if (object.body?.$case === 'data' &&
|
|
122
|
+
object.body?.data !== undefined &&
|
|
123
|
+
object.body?.data !== null) {
|
|
124
|
+
message.body = { $case: 'data', data: object.body.data };
|
|
102
125
|
}
|
|
103
126
|
return message;
|
|
104
127
|
},
|
|
105
128
|
};
|
|
106
129
|
function createBaseRpcStreamInit() {
|
|
107
|
-
return { componentId:
|
|
130
|
+
return { componentId: '' };
|
|
108
131
|
}
|
|
109
132
|
export const RpcStreamInit = {
|
|
110
133
|
encode(message, writer = _m0.Writer.create()) {
|
|
111
|
-
if (message.componentId !==
|
|
134
|
+
if (message.componentId !== '') {
|
|
112
135
|
writer.uint32(10).string(message.componentId);
|
|
113
136
|
}
|
|
114
137
|
return writer;
|
|
@@ -159,7 +182,9 @@ export const RpcStreamInit = {
|
|
|
159
182
|
}
|
|
160
183
|
},
|
|
161
184
|
fromJSON(object) {
|
|
162
|
-
return {
|
|
185
|
+
return {
|
|
186
|
+
componentId: isSet(object.componentId) ? String(object.componentId) : '',
|
|
187
|
+
};
|
|
163
188
|
},
|
|
164
189
|
toJSON(message) {
|
|
165
190
|
const obj = {};
|
|
@@ -168,16 +193,16 @@ export const RpcStreamInit = {
|
|
|
168
193
|
},
|
|
169
194
|
fromPartial(object) {
|
|
170
195
|
const message = createBaseRpcStreamInit();
|
|
171
|
-
message.componentId = object.componentId ??
|
|
196
|
+
message.componentId = object.componentId ?? '';
|
|
172
197
|
return message;
|
|
173
198
|
},
|
|
174
199
|
};
|
|
175
200
|
function createBaseRpcAck() {
|
|
176
|
-
return { error:
|
|
201
|
+
return { error: '' };
|
|
177
202
|
}
|
|
178
203
|
export const RpcAck = {
|
|
179
204
|
encode(message, writer = _m0.Writer.create()) {
|
|
180
|
-
if (message.error !==
|
|
205
|
+
if (message.error !== '') {
|
|
181
206
|
writer.uint32(10).string(message.error);
|
|
182
207
|
}
|
|
183
208
|
return writer;
|
|
@@ -228,7 +253,7 @@ export const RpcAck = {
|
|
|
228
253
|
}
|
|
229
254
|
},
|
|
230
255
|
fromJSON(object) {
|
|
231
|
-
return { error: isSet(object.error) ? String(object.error) :
|
|
256
|
+
return { error: isSet(object.error) ? String(object.error) : '' };
|
|
232
257
|
},
|
|
233
258
|
toJSON(message) {
|
|
234
259
|
const obj = {};
|
|
@@ -237,28 +262,28 @@ export const RpcAck = {
|
|
|
237
262
|
},
|
|
238
263
|
fromPartial(object) {
|
|
239
264
|
const message = createBaseRpcAck();
|
|
240
|
-
message.error = object.error ??
|
|
265
|
+
message.error = object.error ?? '';
|
|
241
266
|
return message;
|
|
242
267
|
},
|
|
243
268
|
};
|
|
244
269
|
var globalThis = (() => {
|
|
245
|
-
if (typeof globalThis !==
|
|
270
|
+
if (typeof globalThis !== 'undefined') {
|
|
246
271
|
return globalThis;
|
|
247
272
|
}
|
|
248
|
-
if (typeof self !==
|
|
273
|
+
if (typeof self !== 'undefined') {
|
|
249
274
|
return self;
|
|
250
275
|
}
|
|
251
|
-
if (typeof window !==
|
|
276
|
+
if (typeof window !== 'undefined') {
|
|
252
277
|
return window;
|
|
253
278
|
}
|
|
254
|
-
if (typeof global !==
|
|
279
|
+
if (typeof global !== 'undefined') {
|
|
255
280
|
return global;
|
|
256
281
|
}
|
|
257
|
-
throw
|
|
282
|
+
throw 'Unable to locate global object';
|
|
258
283
|
})();
|
|
259
284
|
function bytesFromBase64(b64) {
|
|
260
285
|
if (globalThis.Buffer) {
|
|
261
|
-
return Uint8Array.from(globalThis.Buffer.from(b64,
|
|
286
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, 'base64'));
|
|
262
287
|
}
|
|
263
288
|
else {
|
|
264
289
|
const bin = globalThis.atob(b64);
|
|
@@ -271,14 +296,14 @@ function bytesFromBase64(b64) {
|
|
|
271
296
|
}
|
|
272
297
|
function base64FromBytes(arr) {
|
|
273
298
|
if (globalThis.Buffer) {
|
|
274
|
-
return globalThis.Buffer.from(arr).toString(
|
|
299
|
+
return globalThis.Buffer.from(arr).toString('base64');
|
|
275
300
|
}
|
|
276
301
|
else {
|
|
277
302
|
const bin = [];
|
|
278
303
|
arr.forEach((byte) => {
|
|
279
304
|
bin.push(String.fromCharCode(byte));
|
|
280
305
|
});
|
|
281
|
-
return globalThis.btoa(bin.join(
|
|
306
|
+
return globalThis.btoa(bin.join(''));
|
|
282
307
|
}
|
|
283
308
|
}
|
|
284
309
|
if (_m0.util.Long !== Long) {
|
package/dist/srpc/client.js
CHANGED
|
@@ -101,7 +101,7 @@ export class Client {
|
|
|
101
101
|
const openStreamFn = await this.openStreamFn;
|
|
102
102
|
const conn = await openStreamFn();
|
|
103
103
|
const call = new ClientRPC(rpcService, rpcMethod);
|
|
104
|
-
pipe(conn, parseLengthPrefixTransform(), combineUint8ArrayListTransform(), decodePacketSource, call, encodePacketSource, prependLengthPrefixTransform(),
|
|
104
|
+
pipe(conn, parseLengthPrefixTransform(), combineUint8ArrayListTransform(), decodePacketSource, call, encodePacketSource, prependLengthPrefixTransform(), conn);
|
|
105
105
|
await call.writeCallStart(data || undefined);
|
|
106
106
|
return call;
|
|
107
107
|
}
|
|
@@ -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,10 +23,16 @@ export const Packet = {
|
|
|
23
23
|
const tag = reader.uint32();
|
|
24
24
|
switch (tag >>> 3) {
|
|
25
25
|
case 1:
|
|
26
|
-
message.body = {
|
|
26
|
+
message.body = {
|
|
27
|
+
$case: 'callStart',
|
|
28
|
+
callStart: CallStart.decode(reader, reader.uint32()),
|
|
29
|
+
};
|
|
27
30
|
break;
|
|
28
31
|
case 2:
|
|
29
|
-
message.body = {
|
|
32
|
+
message.body = {
|
|
33
|
+
$case: 'callData',
|
|
34
|
+
callData: CallData.decode(reader, reader.uint32()),
|
|
35
|
+
};
|
|
30
36
|
break;
|
|
31
37
|
default:
|
|
32
38
|
reader.skipType(tag & 7);
|
|
@@ -66,40 +72,62 @@ export const Packet = {
|
|
|
66
72
|
fromJSON(object) {
|
|
67
73
|
return {
|
|
68
74
|
body: isSet(object.callStart)
|
|
69
|
-
? {
|
|
75
|
+
? {
|
|
76
|
+
$case: 'callStart',
|
|
77
|
+
callStart: CallStart.fromJSON(object.callStart),
|
|
78
|
+
}
|
|
70
79
|
: isSet(object.callData)
|
|
71
|
-
? { $case:
|
|
80
|
+
? { $case: 'callData', callData: CallData.fromJSON(object.callData) }
|
|
72
81
|
: undefined,
|
|
73
82
|
};
|
|
74
83
|
},
|
|
75
84
|
toJSON(message) {
|
|
76
85
|
const obj = {};
|
|
77
|
-
message.body?.$case ===
|
|
78
|
-
(obj.callStart = message.body?.callStart
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
message.body?.$case === 'callStart' &&
|
|
87
|
+
(obj.callStart = message.body?.callStart
|
|
88
|
+
? CallStart.toJSON(message.body?.callStart)
|
|
89
|
+
: undefined);
|
|
90
|
+
message.body?.$case === 'callData' &&
|
|
91
|
+
(obj.callData = message.body?.callData
|
|
92
|
+
? CallData.toJSON(message.body?.callData)
|
|
93
|
+
: undefined);
|
|
81
94
|
return obj;
|
|
82
95
|
},
|
|
83
96
|
fromPartial(object) {
|
|
84
97
|
const message = createBasePacket();
|
|
85
|
-
if (object.body?.$case ===
|
|
86
|
-
|
|
98
|
+
if (object.body?.$case === 'callStart' &&
|
|
99
|
+
object.body?.callStart !== undefined &&
|
|
100
|
+
object.body?.callStart !== null) {
|
|
101
|
+
message.body = {
|
|
102
|
+
$case: 'callStart',
|
|
103
|
+
callStart: CallStart.fromPartial(object.body.callStart),
|
|
104
|
+
};
|
|
87
105
|
}
|
|
88
|
-
if (object.body?.$case ===
|
|
89
|
-
|
|
106
|
+
if (object.body?.$case === 'callData' &&
|
|
107
|
+
object.body?.callData !== undefined &&
|
|
108
|
+
object.body?.callData !== null) {
|
|
109
|
+
message.body = {
|
|
110
|
+
$case: 'callData',
|
|
111
|
+
callData: CallData.fromPartial(object.body.callData),
|
|
112
|
+
};
|
|
90
113
|
}
|
|
91
114
|
return message;
|
|
92
115
|
},
|
|
93
116
|
};
|
|
94
117
|
function createBaseCallStart() {
|
|
95
|
-
return {
|
|
118
|
+
return {
|
|
119
|
+
rpcService: '',
|
|
120
|
+
rpcMethod: '',
|
|
121
|
+
data: new Uint8Array(),
|
|
122
|
+
dataIsZero: false,
|
|
123
|
+
};
|
|
96
124
|
}
|
|
97
125
|
export const CallStart = {
|
|
98
126
|
encode(message, writer = _m0.Writer.create()) {
|
|
99
|
-
if (message.rpcService !==
|
|
127
|
+
if (message.rpcService !== '') {
|
|
100
128
|
writer.uint32(10).string(message.rpcService);
|
|
101
129
|
}
|
|
102
|
-
if (message.rpcMethod !==
|
|
130
|
+
if (message.rpcMethod !== '') {
|
|
103
131
|
writer.uint32(18).string(message.rpcMethod);
|
|
104
132
|
}
|
|
105
133
|
if (message.data.length !== 0) {
|
|
@@ -166,9 +194,11 @@ export const CallStart = {
|
|
|
166
194
|
},
|
|
167
195
|
fromJSON(object) {
|
|
168
196
|
return {
|
|
169
|
-
rpcService: isSet(object.rpcService) ? String(object.rpcService) :
|
|
170
|
-
rpcMethod: isSet(object.rpcMethod) ? String(object.rpcMethod) :
|
|
171
|
-
data: isSet(object.data)
|
|
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(),
|
|
172
202
|
dataIsZero: isSet(object.dataIsZero) ? Boolean(object.dataIsZero) : false,
|
|
173
203
|
};
|
|
174
204
|
},
|
|
@@ -183,15 +213,20 @@ export const CallStart = {
|
|
|
183
213
|
},
|
|
184
214
|
fromPartial(object) {
|
|
185
215
|
const message = createBaseCallStart();
|
|
186
|
-
message.rpcService = object.rpcService ??
|
|
187
|
-
message.rpcMethod = object.rpcMethod ??
|
|
216
|
+
message.rpcService = object.rpcService ?? '';
|
|
217
|
+
message.rpcMethod = object.rpcMethod ?? '';
|
|
188
218
|
message.data = object.data ?? new Uint8Array();
|
|
189
219
|
message.dataIsZero = object.dataIsZero ?? false;
|
|
190
220
|
return message;
|
|
191
221
|
},
|
|
192
222
|
};
|
|
193
223
|
function createBaseCallData() {
|
|
194
|
-
return {
|
|
224
|
+
return {
|
|
225
|
+
data: new Uint8Array(),
|
|
226
|
+
dataIsZero: false,
|
|
227
|
+
complete: false,
|
|
228
|
+
error: '',
|
|
229
|
+
};
|
|
195
230
|
}
|
|
196
231
|
export const CallData = {
|
|
197
232
|
encode(message, writer = _m0.Writer.create()) {
|
|
@@ -204,7 +239,7 @@ export const CallData = {
|
|
|
204
239
|
if (message.complete === true) {
|
|
205
240
|
writer.uint32(24).bool(message.complete);
|
|
206
241
|
}
|
|
207
|
-
if (message.error !==
|
|
242
|
+
if (message.error !== '') {
|
|
208
243
|
writer.uint32(34).string(message.error);
|
|
209
244
|
}
|
|
210
245
|
return writer;
|
|
@@ -265,10 +300,12 @@ export const CallData = {
|
|
|
265
300
|
},
|
|
266
301
|
fromJSON(object) {
|
|
267
302
|
return {
|
|
268
|
-
data: isSet(object.data)
|
|
303
|
+
data: isSet(object.data)
|
|
304
|
+
? bytesFromBase64(object.data)
|
|
305
|
+
: new Uint8Array(),
|
|
269
306
|
dataIsZero: isSet(object.dataIsZero) ? Boolean(object.dataIsZero) : false,
|
|
270
307
|
complete: isSet(object.complete) ? Boolean(object.complete) : false,
|
|
271
|
-
error: isSet(object.error) ? String(object.error) :
|
|
308
|
+
error: isSet(object.error) ? String(object.error) : '',
|
|
272
309
|
};
|
|
273
310
|
},
|
|
274
311
|
toJSON(message) {
|
|
@@ -285,28 +322,28 @@ export const CallData = {
|
|
|
285
322
|
message.data = object.data ?? new Uint8Array();
|
|
286
323
|
message.dataIsZero = object.dataIsZero ?? false;
|
|
287
324
|
message.complete = object.complete ?? false;
|
|
288
|
-
message.error = object.error ??
|
|
325
|
+
message.error = object.error ?? '';
|
|
289
326
|
return message;
|
|
290
327
|
},
|
|
291
328
|
};
|
|
292
329
|
var globalThis = (() => {
|
|
293
|
-
if (typeof globalThis !==
|
|
330
|
+
if (typeof globalThis !== 'undefined') {
|
|
294
331
|
return globalThis;
|
|
295
332
|
}
|
|
296
|
-
if (typeof self !==
|
|
333
|
+
if (typeof self !== 'undefined') {
|
|
297
334
|
return self;
|
|
298
335
|
}
|
|
299
|
-
if (typeof window !==
|
|
336
|
+
if (typeof window !== 'undefined') {
|
|
300
337
|
return window;
|
|
301
338
|
}
|
|
302
|
-
if (typeof global !==
|
|
339
|
+
if (typeof global !== 'undefined') {
|
|
303
340
|
return global;
|
|
304
341
|
}
|
|
305
|
-
throw
|
|
342
|
+
throw 'Unable to locate global object';
|
|
306
343
|
})();
|
|
307
344
|
function bytesFromBase64(b64) {
|
|
308
345
|
if (globalThis.Buffer) {
|
|
309
|
-
return Uint8Array.from(globalThis.Buffer.from(b64,
|
|
346
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, 'base64'));
|
|
310
347
|
}
|
|
311
348
|
else {
|
|
312
349
|
const bin = globalThis.atob(b64);
|
|
@@ -319,14 +356,14 @@ function bytesFromBase64(b64) {
|
|
|
319
356
|
}
|
|
320
357
|
function base64FromBytes(arr) {
|
|
321
358
|
if (globalThis.Buffer) {
|
|
322
|
-
return globalThis.Buffer.from(arr).toString(
|
|
359
|
+
return globalThis.Buffer.from(arr).toString('base64');
|
|
323
360
|
}
|
|
324
361
|
else {
|
|
325
362
|
const bin = [];
|
|
326
363
|
arr.forEach((byte) => {
|
|
327
364
|
bin.push(String.fromCharCode(byte));
|
|
328
365
|
});
|
|
329
|
-
return globalThis.btoa(bin.join(
|
|
366
|
+
return globalThis.btoa(bin.join(''));
|
|
330
367
|
}
|
|
331
368
|
}
|
|
332
369
|
if (_m0.util.Long !== Long) {
|