starpc 0.31.6 → 0.31.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/Makefile +4 -4
- package/cmd/protoc-gen-es-starpc/typescript.ts +17 -16
- package/dist/cmd/protoc-gen-es-starpc/typescript.js +15 -14
- package/dist/e2e/mock/mock_pb.d.ts +5 -12
- package/dist/e2e/mock/mock_pb.js +9 -33
- package/dist/e2e/mock/mock_srpc.pb.d.ts +5 -5
- package/dist/e2e/mock/mock_srpc.pb.js +2 -2
- package/dist/echo/echo_pb.d.ts +5 -12
- package/dist/echo/echo_pb.js +9 -33
- package/dist/echo/echo_srpc.pb.d.ts +17 -17
- package/dist/echo/echo_srpc.pb.js +4 -4
- package/dist/echo/server.d.ts +3 -3
- package/dist/rpcstream/rpcstream.d.ts +3 -3
- package/dist/rpcstream/rpcstream_pb.d.ts +36 -57
- package/dist/rpcstream/rpcstream_pb.js +28 -106
- package/dist/srpc/client-rpc.d.ts +1 -1
- package/dist/srpc/client-rpc.js +1 -1
- package/dist/srpc/common-rpc.d.ts +4 -5
- package/dist/srpc/definition.d.ts +2 -1
- package/dist/srpc/invoker.d.ts +3 -2
- package/dist/srpc/invoker.js +1 -1
- package/dist/srpc/message.d.ts +4 -4
- package/dist/srpc/message.js +3 -3
- package/dist/srpc/pushable.d.ts +2 -2
- package/dist/srpc/pushable.js +1 -1
- package/dist/srpc/rpcproto_pb.d.ts +55 -76
- package/dist/srpc/rpcproto_pb.js +30 -150
- package/e2e/mock/mock_pb.ts +18 -50
- package/e2e/mock/mock_srpc.pb.ts +7 -7
- package/echo/client-test.ts +2 -2
- package/echo/echo_pb.ts +18 -50
- package/echo/echo_srpc.pb.ts +13 -13
- package/echo/server.ts +3 -3
- package/go.mod +1 -1
- package/go.sum +2 -0
- package/package.json +22 -7
- package/srpc/client-rpc.ts +4 -4
- package/srpc/common-rpc.ts +9 -9
- package/srpc/definition.ts +2 -1
- package/srpc/invoker.ts +7 -12
- package/srpc/message.ts +9 -11
- package/srpc/pushable.ts +4 -6
- package/srpc/rpcproto_pb.ts +91 -188
|
@@ -1,15 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Message, MessageType } from '@aptre/protobuf-es-lite';
|
|
2
|
+
export declare const protobufPackage = "rpcstream";
|
|
3
|
+
/**
|
|
4
|
+
* RpcStreamInit is the first message in a RPC stream.
|
|
5
|
+
*
|
|
6
|
+
* @generated from message rpcstream.RpcStreamInit
|
|
7
|
+
*/
|
|
8
|
+
export interface RpcStreamInit extends Message<RpcStreamInit> {
|
|
9
|
+
/**
|
|
10
|
+
* ComponentId is the identifier of the component making the request.
|
|
11
|
+
*
|
|
12
|
+
* @generated from field: string component_id = 1;
|
|
13
|
+
*/
|
|
14
|
+
componentId?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const RpcStreamInit: MessageType<RpcStreamInit>;
|
|
17
|
+
/**
|
|
18
|
+
* RpcAck is the ack message in a RPC stream.
|
|
19
|
+
*
|
|
20
|
+
* @generated from message rpcstream.RpcAck
|
|
21
|
+
*/
|
|
22
|
+
export interface RpcAck extends Message<RpcAck> {
|
|
23
|
+
/**
|
|
24
|
+
* Error indicates there was some error setting up the stream.
|
|
25
|
+
*
|
|
26
|
+
* @generated from field: string error = 1;
|
|
27
|
+
*/
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const RpcAck: MessageType<RpcAck>;
|
|
3
31
|
/**
|
|
4
32
|
* RpcStreamPacket is a packet encapsulating data for a RPC stream.
|
|
5
33
|
*
|
|
6
34
|
* @generated from message rpcstream.RpcStreamPacket
|
|
7
35
|
*/
|
|
8
|
-
export
|
|
36
|
+
export interface RpcStreamPacket extends Message<RpcStreamPacket> {
|
|
9
37
|
/**
|
|
10
38
|
* @generated from oneof rpcstream.RpcStreamPacket.body
|
|
11
39
|
*/
|
|
12
|
-
body
|
|
40
|
+
body?: {
|
|
41
|
+
value?: undefined;
|
|
42
|
+
case: undefined;
|
|
43
|
+
} | {
|
|
13
44
|
/**
|
|
14
45
|
* Init is the first packet in the stream.
|
|
15
46
|
* Sent by the initiator.
|
|
@@ -35,58 +66,6 @@ export declare class RpcStreamPacket extends Message<RpcStreamPacket> {
|
|
|
35
66
|
*/
|
|
36
67
|
value: Uint8Array;
|
|
37
68
|
case: 'data';
|
|
38
|
-
} | {
|
|
39
|
-
case: undefined;
|
|
40
|
-
value?: undefined;
|
|
41
69
|
};
|
|
42
|
-
constructor(data?: PartialMessage<RpcStreamPacket>);
|
|
43
|
-
static readonly runtime: typeof proto3;
|
|
44
|
-
static readonly typeName = "rpcstream.RpcStreamPacket";
|
|
45
|
-
static readonly fields: FieldList;
|
|
46
|
-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RpcStreamPacket;
|
|
47
|
-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RpcStreamPacket;
|
|
48
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RpcStreamPacket;
|
|
49
|
-
static equals(a: RpcStreamPacket | PlainMessage<RpcStreamPacket> | undefined, b: RpcStreamPacket | PlainMessage<RpcStreamPacket> | undefined): boolean;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* RpcStreamInit is the first message in a RPC stream.
|
|
53
|
-
*
|
|
54
|
-
* @generated from message rpcstream.RpcStreamInit
|
|
55
|
-
*/
|
|
56
|
-
export declare class RpcStreamInit extends Message<RpcStreamInit> {
|
|
57
|
-
/**
|
|
58
|
-
* ComponentId is the identifier of the component making the request.
|
|
59
|
-
*
|
|
60
|
-
* @generated from field: string component_id = 1;
|
|
61
|
-
*/
|
|
62
|
-
componentId: string;
|
|
63
|
-
constructor(data?: PartialMessage<RpcStreamInit>);
|
|
64
|
-
static readonly runtime: typeof proto3;
|
|
65
|
-
static readonly typeName = "rpcstream.RpcStreamInit";
|
|
66
|
-
static readonly fields: FieldList;
|
|
67
|
-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RpcStreamInit;
|
|
68
|
-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RpcStreamInit;
|
|
69
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RpcStreamInit;
|
|
70
|
-
static equals(a: RpcStreamInit | PlainMessage<RpcStreamInit> | undefined, b: RpcStreamInit | PlainMessage<RpcStreamInit> | undefined): boolean;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* RpcAck is the ack message in a RPC stream.
|
|
74
|
-
*
|
|
75
|
-
* @generated from message rpcstream.RpcAck
|
|
76
|
-
*/
|
|
77
|
-
export declare class RpcAck extends Message<RpcAck> {
|
|
78
|
-
/**
|
|
79
|
-
* Error indicates there was some error setting up the stream.
|
|
80
|
-
*
|
|
81
|
-
* @generated from field: string error = 1;
|
|
82
|
-
*/
|
|
83
|
-
error: string;
|
|
84
|
-
constructor(data?: PartialMessage<RpcAck>);
|
|
85
|
-
static readonly runtime: typeof proto3;
|
|
86
|
-
static readonly typeName = "rpcstream.RpcAck";
|
|
87
|
-
static readonly fields: FieldList;
|
|
88
|
-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RpcAck;
|
|
89
|
-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RpcAck;
|
|
90
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RpcAck;
|
|
91
|
-
static equals(a: RpcAck | PlainMessage<RpcAck> | undefined, b: RpcAck | PlainMessage<RpcAck> | undefined): boolean;
|
|
92
70
|
}
|
|
71
|
+
export declare const RpcStreamPacket: MessageType<RpcStreamPacket>;
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
// @generated by protoc-gen-es
|
|
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 {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
import { createMessageType, } from '@aptre/protobuf-es-lite';
|
|
5
|
+
export const protobufPackage = 'rpcstream';
|
|
6
|
+
export const RpcStreamInit = createMessageType({
|
|
7
|
+
typeName: 'rpcstream.RpcStreamInit',
|
|
8
|
+
fields: [
|
|
9
|
+
{
|
|
10
|
+
no: 1,
|
|
11
|
+
name: 'component_id',
|
|
12
|
+
kind: 'scalar',
|
|
13
|
+
T: 9 /* ScalarType.STRING */,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
packedByDefault: true,
|
|
17
|
+
});
|
|
18
|
+
export const RpcAck = createMessageType({
|
|
19
|
+
typeName: 'rpcstream.RpcAck',
|
|
20
|
+
fields: [
|
|
21
|
+
{ no: 1, name: 'error', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
|
|
22
|
+
],
|
|
23
|
+
packedByDefault: true,
|
|
24
|
+
});
|
|
25
|
+
export const RpcStreamPacket = createMessageType({
|
|
26
|
+
typeName: 'rpcstream.RpcStreamPacket',
|
|
27
|
+
fields: [
|
|
22
28
|
{ no: 1, name: 'init', kind: 'message', T: RpcStreamInit, oneof: 'body' },
|
|
23
29
|
{ no: 2, name: 'ack', kind: 'message', T: RpcAck, oneof: 'body' },
|
|
24
30
|
{
|
|
@@ -28,90 +34,6 @@ export class RpcStreamPacket extends Message {
|
|
|
28
34
|
T: 12 /* ScalarType.BYTES */,
|
|
29
35
|
oneof: 'body',
|
|
30
36
|
},
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
static fromJson(jsonValue, options) {
|
|
36
|
-
return new RpcStreamPacket().fromJson(jsonValue, options);
|
|
37
|
-
}
|
|
38
|
-
static fromJsonString(jsonString, options) {
|
|
39
|
-
return new RpcStreamPacket().fromJsonString(jsonString, options);
|
|
40
|
-
}
|
|
41
|
-
static equals(a, b) {
|
|
42
|
-
return proto3.util.equals(RpcStreamPacket, a, b);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* RpcStreamInit is the first message in a RPC stream.
|
|
47
|
-
*
|
|
48
|
-
* @generated from message rpcstream.RpcStreamInit
|
|
49
|
-
*/
|
|
50
|
-
export class RpcStreamInit extends Message {
|
|
51
|
-
/**
|
|
52
|
-
* ComponentId is the identifier of the component making the request.
|
|
53
|
-
*
|
|
54
|
-
* @generated from field: string component_id = 1;
|
|
55
|
-
*/
|
|
56
|
-
componentId = '';
|
|
57
|
-
constructor(data) {
|
|
58
|
-
super();
|
|
59
|
-
proto3.util.initPartial(data, this);
|
|
60
|
-
}
|
|
61
|
-
static runtime = proto3;
|
|
62
|
-
static typeName = 'rpcstream.RpcStreamInit';
|
|
63
|
-
static fields = proto3.util.newFieldList(() => [
|
|
64
|
-
{
|
|
65
|
-
no: 1,
|
|
66
|
-
name: 'component_id',
|
|
67
|
-
kind: 'scalar',
|
|
68
|
-
T: 9 /* ScalarType.STRING */,
|
|
69
|
-
},
|
|
70
|
-
]);
|
|
71
|
-
static fromBinary(bytes, options) {
|
|
72
|
-
return new RpcStreamInit().fromBinary(bytes, options);
|
|
73
|
-
}
|
|
74
|
-
static fromJson(jsonValue, options) {
|
|
75
|
-
return new RpcStreamInit().fromJson(jsonValue, options);
|
|
76
|
-
}
|
|
77
|
-
static fromJsonString(jsonString, options) {
|
|
78
|
-
return new RpcStreamInit().fromJsonString(jsonString, options);
|
|
79
|
-
}
|
|
80
|
-
static equals(a, b) {
|
|
81
|
-
return proto3.util.equals(RpcStreamInit, a, b);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* RpcAck is the ack message in a RPC stream.
|
|
86
|
-
*
|
|
87
|
-
* @generated from message rpcstream.RpcAck
|
|
88
|
-
*/
|
|
89
|
-
export class RpcAck extends Message {
|
|
90
|
-
/**
|
|
91
|
-
* Error indicates there was some error setting up the stream.
|
|
92
|
-
*
|
|
93
|
-
* @generated from field: string error = 1;
|
|
94
|
-
*/
|
|
95
|
-
error = '';
|
|
96
|
-
constructor(data) {
|
|
97
|
-
super();
|
|
98
|
-
proto3.util.initPartial(data, this);
|
|
99
|
-
}
|
|
100
|
-
static runtime = proto3;
|
|
101
|
-
static typeName = 'rpcstream.RpcAck';
|
|
102
|
-
static fields = proto3.util.newFieldList(() => [
|
|
103
|
-
{ no: 1, name: 'error', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
|
|
104
|
-
]);
|
|
105
|
-
static fromBinary(bytes, options) {
|
|
106
|
-
return new RpcAck().fromBinary(bytes, options);
|
|
107
|
-
}
|
|
108
|
-
static fromJson(jsonValue, options) {
|
|
109
|
-
return new RpcAck().fromJson(jsonValue, options);
|
|
110
|
-
}
|
|
111
|
-
static fromJsonString(jsonString, options) {
|
|
112
|
-
return new RpcAck().fromJsonString(jsonString, options);
|
|
113
|
-
}
|
|
114
|
-
static equals(a, b) {
|
|
115
|
-
return proto3.util.equals(RpcAck, a, b);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
37
|
+
],
|
|
38
|
+
packedByDefault: true,
|
|
39
|
+
});
|
|
@@ -3,5 +3,5 @@ import { CommonRPC } from './common-rpc.js';
|
|
|
3
3
|
export declare class ClientRPC extends CommonRPC {
|
|
4
4
|
constructor(service: string, method: string);
|
|
5
5
|
writeCallStart(data?: Uint8Array): Promise<void>;
|
|
6
|
-
handleCallStart(packet:
|
|
6
|
+
handleCallStart(packet: CallStart): Promise<void>;
|
|
7
7
|
}
|
package/dist/srpc/client-rpc.js
CHANGED
|
@@ -28,6 +28,6 @@ export class ClientRPC extends CommonRPC {
|
|
|
28
28
|
// handleCallStart handles a CallStart packet.
|
|
29
29
|
async handleCallStart(packet) {
|
|
30
30
|
// we do not implement server -> client RPCs.
|
|
31
|
-
throw new Error(`unexpected server to client rpc: ${packet.rpcService}/${packet.rpcMethod}`);
|
|
31
|
+
throw new Error(`unexpected server to client rpc: ${packet.rpcService || '<empty>'}/${packet.rpcMethod || '<empty>'}`);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Sink, Source } from 'it-stream-types';
|
|
2
|
-
import { PartialMessage } from '@bufbuild/protobuf';
|
|
3
2
|
import type { CallData, CallStart } from './rpcproto_pb.js';
|
|
4
3
|
import { Packet } from './rpcproto_pb.js';
|
|
5
4
|
export declare class CommonRPC {
|
|
6
|
-
readonly sink: Sink<Source<
|
|
7
|
-
readonly source: AsyncIterable<
|
|
5
|
+
readonly sink: Sink<Source<Packet>>;
|
|
6
|
+
readonly source: AsyncIterable<Packet>;
|
|
8
7
|
readonly rpcDataSource: AsyncIterable<Uint8Array>;
|
|
9
8
|
private readonly _source;
|
|
10
9
|
private readonly _rpcDataSource;
|
|
@@ -16,9 +15,9 @@ export declare class CommonRPC {
|
|
|
16
15
|
writeCallData(data?: Uint8Array, complete?: boolean, error?: string): Promise<void>;
|
|
17
16
|
writeCallCancel(): Promise<void>;
|
|
18
17
|
writeCallDataFromSource(dataSource: AsyncIterable<Uint8Array>): Promise<void>;
|
|
19
|
-
protected writePacket(packet:
|
|
18
|
+
protected writePacket(packet: Packet): Promise<void>;
|
|
20
19
|
handleMessage(message: Uint8Array): Promise<void>;
|
|
21
|
-
handlePacket(packet:
|
|
20
|
+
handlePacket(packet: Packet): Promise<void>;
|
|
22
21
|
handleCallStart(packet: Partial<CallStart>): Promise<void>;
|
|
23
22
|
protected pushRpcData(data: Uint8Array | undefined, dataIsZero: boolean | undefined): void;
|
|
24
23
|
handleCallData(packet: Partial<CallData>): Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MethodIdempotency, MethodKind } from '@bufbuild/protobuf';
|
|
2
|
+
import { MessageType } from '@aptre/protobuf-es-lite';
|
|
2
3
|
export type ServiceMethodDefinitions = {
|
|
3
4
|
[id: string]: MethodDefinition<MessageType, MessageType, MethodKind, MethodIdempotency | undefined>;
|
|
4
5
|
};
|
package/dist/srpc/invoker.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { MethodDefinition } from './definition.js';
|
|
2
2
|
import { InvokeFn } from './handler.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import type { MessageType, Message } from '@aptre/protobuf-es-lite';
|
|
4
|
+
import { MethodIdempotency, MethodKind } from '@bufbuild/protobuf';
|
|
5
|
+
export type MethodProto<R extends Message<R>, O extends Message<O>> = ((request: R) => Promise<O>) | ((request: R) => AsyncIterable<O>) | ((request: AsyncIterable<Message<R>>) => Promise<O>) | ((request: AsyncIterable<Message<R>>) => AsyncIterable<O>);
|
|
5
6
|
export declare function createInvokeFn<R extends Message<R>, O extends Message<O>>(methodInfo: MethodDefinition<MessageType<R>, MessageType<O>, MethodKind, MethodIdempotency | undefined>, methodProto: MethodProto<R, O>): InvokeFn;
|
package/dist/srpc/invoker.js
CHANGED
|
@@ -2,7 +2,7 @@ import { pushable } from 'it-pushable';
|
|
|
2
2
|
import { pipe } from 'it-pipe';
|
|
3
3
|
import { buildDecodeMessageTransform, buildEncodeMessageTransform, } from './message.js';
|
|
4
4
|
import { writeToPushable } from './pushable.js';
|
|
5
|
-
import { MethodKind
|
|
5
|
+
import { MethodKind } from '@bufbuild/protobuf';
|
|
6
6
|
// createInvokeFn builds an InvokeFn from a method definition and a function prototype.
|
|
7
7
|
export function createInvokeFn(methodInfo, methodProto) {
|
|
8
8
|
const requestDecode = buildDecodeMessageTransform(methodInfo.I);
|
package/dist/srpc/message.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { MessageType, Message } from '@aptre/protobuf-es-lite';
|
|
1
2
|
import type { Source } from 'it-stream-types';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export declare function memoProto<T extends Message<T>>(def: MessageType<T>): (msg: PartialMessage<T>) => Uint8Array;
|
|
3
|
+
export type MessageStream<T extends Message<T>> = AsyncIterable<Message<T>>;
|
|
4
|
+
export declare function memoProto<T extends Message<T>>(def: MessageType<T>): (msg: Message<T>) => Uint8Array;
|
|
5
5
|
export declare function memoProtoDecode<T extends Message<T>>(def: MessageType<T>): (msg: Uint8Array) => T;
|
|
6
6
|
export type DecodeMessageTransform<T> = (source: Source<Uint8Array | Uint8Array[]>) => AsyncIterable<T>;
|
|
7
7
|
export declare function buildDecodeMessageTransform<T extends Message<T>>(def: MessageType<T>, memoize?: boolean): DecodeMessageTransform<T>;
|
|
8
|
-
export type EncodeMessageTransform<T extends Message<T>> = (source: Source<
|
|
8
|
+
export type EncodeMessageTransform<T extends Message<T>> = (source: Source<Message<T> | Array<Message<T>>>) => AsyncIterable<Uint8Array>;
|
|
9
9
|
export declare function buildEncodeMessageTransform<T extends Message<T>>(def: MessageType<T>): EncodeMessageTransform<T>;
|
package/dist/srpc/message.js
CHANGED
|
@@ -2,7 +2,7 @@ import memoize from 'memoize-one';
|
|
|
2
2
|
// memoProto returns a function that encodes the message and caches the result.
|
|
3
3
|
export function memoProto(def) {
|
|
4
4
|
return memoize((msg) => {
|
|
5
|
-
return
|
|
5
|
+
return def.toBinary(def.create(msg));
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
8
|
// memoProtoDecode returns a function that decodes the message and caches the result.
|
|
@@ -37,11 +37,11 @@ export function buildEncodeMessageTransform(def) {
|
|
|
37
37
|
for await (const pkt of source) {
|
|
38
38
|
if (Array.isArray(pkt)) {
|
|
39
39
|
for (const p of pkt) {
|
|
40
|
-
yield
|
|
40
|
+
yield def.toBinary(def.create(p));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
yield
|
|
44
|
+
yield def.toBinary(def.create(pkt));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
};
|
package/dist/srpc/pushable.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Message } from '@aptre/protobuf-es-lite';
|
|
1
2
|
import { Pushable } from 'it-pushable';
|
|
2
3
|
import { Sink, Source } from 'it-stream-types';
|
|
3
|
-
|
|
4
|
-
export declare function messagePushable<T extends Message<T>>(): Pushable<PartialMessage<T>>;
|
|
4
|
+
export declare function messagePushable<T extends Message<T>>(): Pushable<T>;
|
|
5
5
|
export declare function writeToPushable<T>(dataSource: AsyncIterable<T>, out: Pushable<T>): Promise<void>;
|
|
6
6
|
export declare function buildPushableSink<T>(target: Pushable<T>): Sink<Source<T>, Promise<void>>;
|
package/dist/srpc/pushable.js
CHANGED
|
@@ -1,132 +1,111 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Packet is a message sent over a srpc packet connection.
|
|
5
|
-
*
|
|
6
|
-
* @generated from message srpc.Packet
|
|
7
|
-
*/
|
|
8
|
-
export declare class Packet extends Message<Packet> {
|
|
9
|
-
/**
|
|
10
|
-
* Body is the packet body.
|
|
11
|
-
*
|
|
12
|
-
* @generated from oneof srpc.Packet.body
|
|
13
|
-
*/
|
|
14
|
-
body: {
|
|
15
|
-
/**
|
|
16
|
-
* CallStart initiates a new call.
|
|
17
|
-
*
|
|
18
|
-
* @generated from field: srpc.CallStart call_start = 1;
|
|
19
|
-
*/
|
|
20
|
-
value: CallStart;
|
|
21
|
-
case: 'callStart';
|
|
22
|
-
} | {
|
|
23
|
-
/**
|
|
24
|
-
* CallData is a message in a streaming RPC sequence.
|
|
25
|
-
*
|
|
26
|
-
* @generated from field: srpc.CallData call_data = 2;
|
|
27
|
-
*/
|
|
28
|
-
value: CallData;
|
|
29
|
-
case: 'callData';
|
|
30
|
-
} | {
|
|
31
|
-
/**
|
|
32
|
-
* CallCancel cancels the call.
|
|
33
|
-
*
|
|
34
|
-
* @generated from field: bool call_cancel = 3;
|
|
35
|
-
*/
|
|
36
|
-
value: boolean;
|
|
37
|
-
case: 'callCancel';
|
|
38
|
-
} | {
|
|
39
|
-
case: undefined;
|
|
40
|
-
value?: undefined;
|
|
41
|
-
};
|
|
42
|
-
constructor(data?: PartialMessage<Packet>);
|
|
43
|
-
static readonly runtime: typeof proto3;
|
|
44
|
-
static readonly typeName = "srpc.Packet";
|
|
45
|
-
static readonly fields: FieldList;
|
|
46
|
-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Packet;
|
|
47
|
-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Packet;
|
|
48
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Packet;
|
|
49
|
-
static equals(a: Packet | PlainMessage<Packet> | undefined, b: Packet | PlainMessage<Packet> | undefined): boolean;
|
|
50
|
-
}
|
|
1
|
+
import { Message, MessageType } from '@aptre/protobuf-es-lite';
|
|
2
|
+
export declare const protobufPackage = "srpc";
|
|
51
3
|
/**
|
|
52
4
|
* CallStart requests starting a new RPC call.
|
|
53
5
|
*
|
|
54
6
|
* @generated from message srpc.CallStart
|
|
55
7
|
*/
|
|
56
|
-
export
|
|
8
|
+
export interface CallStart extends Message<CallStart> {
|
|
57
9
|
/**
|
|
58
10
|
* RpcService is the service to contact.
|
|
59
11
|
* Must be set.
|
|
60
12
|
*
|
|
61
13
|
* @generated from field: string rpc_service = 1;
|
|
62
14
|
*/
|
|
63
|
-
rpcService
|
|
15
|
+
rpcService?: string;
|
|
64
16
|
/**
|
|
65
17
|
* RpcMethod is the RPC method to call.
|
|
66
18
|
* Must be set.
|
|
67
19
|
*
|
|
68
20
|
* @generated from field: string rpc_method = 2;
|
|
69
21
|
*/
|
|
70
|
-
rpcMethod
|
|
22
|
+
rpcMethod?: string;
|
|
71
23
|
/**
|
|
72
24
|
* Data contains the request or the first message in the stream.
|
|
73
25
|
* Optional if streaming.
|
|
74
26
|
*
|
|
75
27
|
* @generated from field: bytes data = 3;
|
|
76
28
|
*/
|
|
77
|
-
data
|
|
29
|
+
data?: Uint8Array;
|
|
78
30
|
/**
|
|
79
31
|
* DataIsZero indicates Data is set with an empty message.
|
|
80
32
|
*
|
|
81
33
|
* @generated from field: bool data_is_zero = 4;
|
|
82
34
|
*/
|
|
83
|
-
dataIsZero
|
|
84
|
-
constructor(data?: PartialMessage<CallStart>);
|
|
85
|
-
static readonly runtime: typeof proto3;
|
|
86
|
-
static readonly typeName = "srpc.CallStart";
|
|
87
|
-
static readonly fields: FieldList;
|
|
88
|
-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CallStart;
|
|
89
|
-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CallStart;
|
|
90
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CallStart;
|
|
91
|
-
static equals(a: CallStart | PlainMessage<CallStart> | undefined, b: CallStart | PlainMessage<CallStart> | undefined): boolean;
|
|
35
|
+
dataIsZero?: boolean;
|
|
92
36
|
}
|
|
37
|
+
export declare const CallStart: MessageType<CallStart>;
|
|
93
38
|
/**
|
|
94
39
|
* CallData contains a message in a streaming RPC sequence.
|
|
95
40
|
*
|
|
96
41
|
* @generated from message srpc.CallData
|
|
97
42
|
*/
|
|
98
|
-
export
|
|
43
|
+
export interface CallData extends Message<CallData> {
|
|
99
44
|
/**
|
|
100
45
|
* Data contains the packet in the sequence.
|
|
101
46
|
*
|
|
102
47
|
* @generated from field: bytes data = 1;
|
|
103
48
|
*/
|
|
104
|
-
data
|
|
49
|
+
data?: Uint8Array;
|
|
105
50
|
/**
|
|
106
51
|
* DataIsZero indicates Data is set with an empty message.
|
|
107
52
|
*
|
|
108
53
|
* @generated from field: bool data_is_zero = 2;
|
|
109
54
|
*/
|
|
110
|
-
dataIsZero
|
|
55
|
+
dataIsZero?: boolean;
|
|
111
56
|
/**
|
|
112
57
|
* Complete indicates the RPC call is completed.
|
|
113
58
|
*
|
|
114
59
|
* @generated from field: bool complete = 3;
|
|
115
60
|
*/
|
|
116
|
-
complete
|
|
61
|
+
complete?: boolean;
|
|
117
62
|
/**
|
|
118
63
|
* Error contains any error that caused the RPC to fail.
|
|
119
64
|
* If set, implies complete=true.
|
|
120
65
|
*
|
|
121
66
|
* @generated from field: string error = 4;
|
|
122
67
|
*/
|
|
123
|
-
error
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
68
|
+
error?: string;
|
|
69
|
+
}
|
|
70
|
+
export declare const CallData: MessageType<CallData>;
|
|
71
|
+
/**
|
|
72
|
+
* Packet is a message sent over a srpc packet connection.
|
|
73
|
+
*
|
|
74
|
+
* @generated from message srpc.Packet
|
|
75
|
+
*/
|
|
76
|
+
export interface Packet extends Message<Packet> {
|
|
77
|
+
/**
|
|
78
|
+
* Body is the packet body.
|
|
79
|
+
*
|
|
80
|
+
* @generated from oneof srpc.Packet.body
|
|
81
|
+
*/
|
|
82
|
+
body?: {
|
|
83
|
+
value?: undefined;
|
|
84
|
+
case: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
/**
|
|
87
|
+
* CallStart initiates a new call.
|
|
88
|
+
*
|
|
89
|
+
* @generated from field: srpc.CallStart call_start = 1;
|
|
90
|
+
*/
|
|
91
|
+
value: CallStart;
|
|
92
|
+
case: 'callStart';
|
|
93
|
+
} | {
|
|
94
|
+
/**
|
|
95
|
+
* CallData is a message in a streaming RPC sequence.
|
|
96
|
+
*
|
|
97
|
+
* @generated from field: srpc.CallData call_data = 2;
|
|
98
|
+
*/
|
|
99
|
+
value: CallData;
|
|
100
|
+
case: 'callData';
|
|
101
|
+
} | {
|
|
102
|
+
/**
|
|
103
|
+
* CallCancel cancels the call.
|
|
104
|
+
*
|
|
105
|
+
* @generated from field: bool call_cancel = 3;
|
|
106
|
+
*/
|
|
107
|
+
value: boolean;
|
|
108
|
+
case: 'callCancel';
|
|
109
|
+
};
|
|
132
110
|
}
|
|
111
|
+
export declare const Packet: MessageType<Packet>;
|