@nsshunt/stsappframework 3.1.31 → 3.1.32
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/gRPC/ststest/protos/auth_sample.js +3 -0
- package/dist/gRPC/ststest/protos/auth_sample.js.map +1 -0
- package/dist/gRPC/ststest/protos/echo.js +3 -0
- package/dist/gRPC/ststest/protos/echo.js.map +1 -0
- package/dist/gRPC/ststest/protos/grpc/examples/echo/Echo.js +4 -0
- package/dist/gRPC/ststest/protos/grpc/examples/echo/Echo.js.map +1 -0
- package/dist/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.js +4 -0
- package/dist/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.js.map +1 -0
- package/dist/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.js +4 -0
- package/dist/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.js.map +1 -0
- package/dist/gRPC/ststest/protos/grpc/testing/Request.js +4 -0
- package/dist/gRPC/ststest/protos/grpc/testing/Request.js.map +1 -0
- package/dist/gRPC/ststest/protos/grpc/testing/Response.js +4 -0
- package/dist/gRPC/ststest/protos/grpc/testing/Response.js.map +1 -0
- package/dist/gRPC/ststest/protos/grpc/testing/TestService.js +4 -0
- package/dist/gRPC/ststest/protos/grpc/testing/TestService.js.map +1 -0
- package/dist/gRPC/ststest/protos/hellostreamingworld/HelloReply.js +4 -0
- package/dist/gRPC/ststest/protos/hellostreamingworld/HelloReply.js.map +1 -0
- package/dist/gRPC/ststest/protos/hellostreamingworld/HelloRequest.js +4 -0
- package/dist/gRPC/ststest/protos/hellostreamingworld/HelloRequest.js.map +1 -0
- package/dist/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.js +4 -0
- package/dist/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.js.map +1 -0
- package/dist/gRPC/ststest/protos/hellostreamingworld.js +3 -0
- package/dist/gRPC/ststest/protos/hellostreamingworld.js.map +1 -0
- package/dist/gRPC/ststest/protos/helloworld/Greeter.js +4 -0
- package/dist/gRPC/ststest/protos/helloworld/Greeter.js.map +1 -0
- package/dist/gRPC/ststest/protos/helloworld/HelloReply.js +4 -0
- package/dist/gRPC/ststest/protos/helloworld/HelloReply.js.map +1 -0
- package/dist/gRPC/ststest/protos/helloworld/HelloRequest.js +4 -0
- package/dist/gRPC/ststest/protos/helloworld/HelloRequest.js.map +1 -0
- package/dist/gRPC/ststest/protos/helloworld.js +3 -0
- package/dist/gRPC/ststest/protos/helloworld.js.map +1 -0
- package/dist/gRPC/ststest/protos/keyvaluestore/KeyValueStore.js +4 -0
- package/dist/gRPC/ststest/protos/keyvaluestore/KeyValueStore.js.map +1 -0
- package/dist/gRPC/ststest/protos/keyvaluestore/Request.js +4 -0
- package/dist/gRPC/ststest/protos/keyvaluestore/Request.js.map +1 -0
- package/dist/gRPC/ststest/protos/keyvaluestore/Response.js +4 -0
- package/dist/gRPC/ststest/protos/keyvaluestore/Response.js.map +1 -0
- package/dist/gRPC/ststest/protos/keyvaluestore.js +3 -0
- package/dist/gRPC/ststest/protos/keyvaluestore.js.map +1 -0
- package/dist/gRPC/ststest/protos/route_guide.js +3 -0
- package/dist/gRPC/ststest/protos/route_guide.js.map +1 -0
- package/dist/gRPC/ststest/protos/routeguide/Feature.js +4 -0
- package/dist/gRPC/ststest/protos/routeguide/Feature.js.map +1 -0
- package/dist/gRPC/ststest/protos/routeguide/Point.js +4 -0
- package/dist/gRPC/ststest/protos/routeguide/Point.js.map +1 -0
- package/dist/gRPC/ststest/protos/routeguide/Rectangle.js +4 -0
- package/dist/gRPC/ststest/protos/routeguide/Rectangle.js.map +1 -0
- package/dist/gRPC/ststest/protos/routeguide/RouteGuide.js +4 -0
- package/dist/gRPC/ststest/protos/routeguide/RouteGuide.js.map +1 -0
- package/dist/gRPC/ststest/protos/routeguide/RouteNote.js +4 -0
- package/dist/gRPC/ststest/protos/routeguide/RouteNote.js.map +1 -0
- package/dist/gRPC/ststest/protos/routeguide/RouteSummary.js +4 -0
- package/dist/gRPC/ststest/protos/routeguide/RouteSummary.js.map +1 -0
- package/dist/gRPC/ststest/src/route_guide_server2.js +205 -0
- package/dist/gRPC/ststest/src/route_guide_server2.js.map +1 -0
- package/package.json +1 -1
- package/src/gRPC/ststest/protos/auth_sample.ts +20 -0
- package/src/gRPC/ststest/protos/echo.ts +22 -0
- package/src/gRPC/ststest/protos/grpc/examples/echo/Echo.ts +55 -0
- package/src/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.ts +10 -0
- package/src/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.ts +10 -0
- package/src/gRPC/ststest/protos/grpc/testing/Request.ts +12 -0
- package/src/gRPC/ststest/protos/grpc/testing/Response.ts +12 -0
- package/src/gRPC/ststest/protos/grpc/testing/TestService.ts +27 -0
- package/src/gRPC/ststest/protos/hellostreamingworld/HelloReply.ts +10 -0
- package/src/gRPC/ststest/protos/hellostreamingworld/HelloRequest.ts +12 -0
- package/src/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.ts +23 -0
- package/src/gRPC/ststest/protos/hellostreamingworld.ts +18 -0
- package/src/gRPC/ststest/protos/helloworld/Greeter.ts +35 -0
- package/src/gRPC/ststest/protos/helloworld/HelloReply.ts +10 -0
- package/src/gRPC/ststest/protos/helloworld/HelloRequest.ts +10 -0
- package/src/gRPC/ststest/protos/helloworld.ts +18 -0
- package/src/gRPC/ststest/protos/keyvaluestore/KeyValueStore.ts +23 -0
- package/src/gRPC/ststest/protos/keyvaluestore/Request.ts +10 -0
- package/src/gRPC/ststest/protos/keyvaluestore/Response.ts +10 -0
- package/src/gRPC/ststest/protos/keyvaluestore.ts +18 -0
- package/src/gRPC/ststest/protos/route_guide.ts +21 -0
- package/src/gRPC/ststest/protos/routeguide/Feature.ts +13 -0
- package/src/gRPC/ststest/protos/routeguide/Point.ts +12 -0
- package/src/gRPC/ststest/protos/routeguide/Rectangle.ts +13 -0
- package/src/gRPC/ststest/protos/routeguide/RouteGuide.ts +58 -0
- package/src/gRPC/ststest/protos/routeguide/RouteNote.ts +13 -0
- package/src/gRPC/ststest/protos/routeguide/RouteSummary.ts +16 -0
- package/src/gRPC/ststest/src/route_guide_server2.ts +211 -0
- package/types/gRPC/ststest/protos/auth_sample.d.ts +19 -0
- package/types/gRPC/ststest/protos/auth_sample.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/echo.d.ts +21 -0
- package/types/gRPC/ststest/protos/echo.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/grpc/examples/echo/Echo.d.ts +43 -0
- package/types/gRPC/ststest/protos/grpc/examples/echo/Echo.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.d.ts +7 -0
- package/types/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.d.ts +7 -0
- package/types/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/grpc/testing/Request.d.ts +9 -0
- package/types/gRPC/ststest/protos/grpc/testing/Request.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/grpc/testing/Response.d.ts +9 -0
- package/types/gRPC/ststest/protos/grpc/testing/Response.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/grpc/testing/TestService.d.ts +21 -0
- package/types/gRPC/ststest/protos/grpc/testing/TestService.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/hellostreamingworld/HelloReply.d.ts +7 -0
- package/types/gRPC/ststest/protos/hellostreamingworld/HelloReply.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/hellostreamingworld/HelloRequest.d.ts +9 -0
- package/types/gRPC/ststest/protos/hellostreamingworld/HelloRequest.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.d.ts +17 -0
- package/types/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/hellostreamingworld.d.ts +17 -0
- package/types/gRPC/ststest/protos/hellostreamingworld.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/helloworld/Greeter.d.ts +27 -0
- package/types/gRPC/ststest/protos/helloworld/Greeter.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/helloworld/HelloReply.d.ts +7 -0
- package/types/gRPC/ststest/protos/helloworld/HelloReply.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/helloworld/HelloRequest.d.ts +7 -0
- package/types/gRPC/ststest/protos/helloworld/HelloRequest.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/helloworld.d.ts +17 -0
- package/types/gRPC/ststest/protos/helloworld.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/keyvaluestore/KeyValueStore.d.ts +17 -0
- package/types/gRPC/ststest/protos/keyvaluestore/KeyValueStore.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/keyvaluestore/Request.d.ts +7 -0
- package/types/gRPC/ststest/protos/keyvaluestore/Request.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/keyvaluestore/Response.d.ts +7 -0
- package/types/gRPC/ststest/protos/keyvaluestore/Response.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/keyvaluestore.d.ts +17 -0
- package/types/gRPC/ststest/protos/keyvaluestore.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/route_guide.d.ts +20 -0
- package/types/gRPC/ststest/protos/route_guide.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/routeguide/Feature.d.ts +10 -0
- package/types/gRPC/ststest/protos/routeguide/Feature.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/routeguide/Point.d.ts +9 -0
- package/types/gRPC/ststest/protos/routeguide/Point.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/routeguide/Rectangle.d.ts +10 -0
- package/types/gRPC/ststest/protos/routeguide/Rectangle.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/routeguide/RouteGuide.d.ts +46 -0
- package/types/gRPC/ststest/protos/routeguide/RouteGuide.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/routeguide/RouteNote.d.ts +10 -0
- package/types/gRPC/ststest/protos/routeguide/RouteNote.d.ts.map +1 -0
- package/types/gRPC/ststest/protos/routeguide/RouteSummary.d.ts +13 -0
- package/types/gRPC/ststest/protos/routeguide/RouteSummary.d.ts.map +1 -0
- package/types/gRPC/ststest/src/route_guide_server2.d.ts +3 -0
- package/types/gRPC/ststest/src/route_guide_server2.d.ts.map +1 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Original file: protos/auth_sample.proto
|
|
2
|
+
|
|
3
|
+
import type * as grpc from '@grpc/grpc-js'
|
|
4
|
+
import type { MethodDefinition } from '@grpc/proto-loader'
|
|
5
|
+
import type { Request as _grpc_testing_Request, Request__Output as _grpc_testing_Request__Output } from '../../grpc/testing/Request';
|
|
6
|
+
import type { Response as _grpc_testing_Response, Response__Output as _grpc_testing_Response__Output } from '../../grpc/testing/Response';
|
|
7
|
+
|
|
8
|
+
export interface TestServiceClient extends grpc.Client {
|
|
9
|
+
UnaryCall(argument: _grpc_testing_Request, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Response__Output>): grpc.ClientUnaryCall;
|
|
10
|
+
UnaryCall(argument: _grpc_testing_Request, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Response__Output>): grpc.ClientUnaryCall;
|
|
11
|
+
UnaryCall(argument: _grpc_testing_Request, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Response__Output>): grpc.ClientUnaryCall;
|
|
12
|
+
UnaryCall(argument: _grpc_testing_Request, callback: grpc.requestCallback<_grpc_testing_Response__Output>): grpc.ClientUnaryCall;
|
|
13
|
+
unaryCall(argument: _grpc_testing_Request, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Response__Output>): grpc.ClientUnaryCall;
|
|
14
|
+
unaryCall(argument: _grpc_testing_Request, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Response__Output>): grpc.ClientUnaryCall;
|
|
15
|
+
unaryCall(argument: _grpc_testing_Request, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Response__Output>): grpc.ClientUnaryCall;
|
|
16
|
+
unaryCall(argument: _grpc_testing_Request, callback: grpc.requestCallback<_grpc_testing_Response__Output>): grpc.ClientUnaryCall;
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface TestServiceHandlers extends grpc.UntypedServiceImplementation {
|
|
21
|
+
UnaryCall: grpc.handleUnaryCall<_grpc_testing_Request__Output, _grpc_testing_Response>;
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface TestServiceDefinition extends grpc.ServiceDefinition {
|
|
26
|
+
UnaryCall: MethodDefinition<_grpc_testing_Request, _grpc_testing_Response, _grpc_testing_Request__Output, _grpc_testing_Response__Output>
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Original file: protos/hellostreamingworld.proto
|
|
2
|
+
|
|
3
|
+
import type * as grpc from '@grpc/grpc-js'
|
|
4
|
+
import type { MethodDefinition } from '@grpc/proto-loader'
|
|
5
|
+
import type { HelloReply as _hellostreamingworld_HelloReply, HelloReply__Output as _hellostreamingworld_HelloReply__Output } from '../hellostreamingworld/HelloReply';
|
|
6
|
+
import type { HelloRequest as _hellostreamingworld_HelloRequest, HelloRequest__Output as _hellostreamingworld_HelloRequest__Output } from '../hellostreamingworld/HelloRequest';
|
|
7
|
+
|
|
8
|
+
export interface MultiGreeterClient extends grpc.Client {
|
|
9
|
+
sayHello(argument: _hellostreamingworld_HelloRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_hellostreamingworld_HelloReply__Output>;
|
|
10
|
+
sayHello(argument: _hellostreamingworld_HelloRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_hellostreamingworld_HelloReply__Output>;
|
|
11
|
+
sayHello(argument: _hellostreamingworld_HelloRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_hellostreamingworld_HelloReply__Output>;
|
|
12
|
+
sayHello(argument: _hellostreamingworld_HelloRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_hellostreamingworld_HelloReply__Output>;
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface MultiGreeterHandlers extends grpc.UntypedServiceImplementation {
|
|
17
|
+
sayHello: grpc.handleServerStreamingCall<_hellostreamingworld_HelloRequest__Output, _hellostreamingworld_HelloReply>;
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface MultiGreeterDefinition extends grpc.ServiceDefinition {
|
|
22
|
+
sayHello: MethodDefinition<_hellostreamingworld_HelloRequest, _hellostreamingworld_HelloReply, _hellostreamingworld_HelloRequest__Output, _hellostreamingworld_HelloReply__Output>
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
+
import type * as grpc from '@grpc/grpc-js';
|
|
3
|
+
import type { MessageTypeDefinition } from '@grpc/proto-loader';
|
|
4
|
+
|
|
5
|
+
import type { MultiGreeterClient as _hellostreamingworld_MultiGreeterClient, MultiGreeterDefinition as _hellostreamingworld_MultiGreeterDefinition } from './hellostreamingworld/MultiGreeter';
|
|
6
|
+
|
|
7
|
+
type SubtypeConstructor<Constructor extends new (...args: any) => any, Subtype> = {
|
|
8
|
+
new(...args: ConstructorParameters<Constructor>): Subtype;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface ProtoGrpcType {
|
|
12
|
+
hellostreamingworld: {
|
|
13
|
+
HelloReply: MessageTypeDefinition
|
|
14
|
+
HelloRequest: MessageTypeDefinition
|
|
15
|
+
MultiGreeter: SubtypeConstructor<typeof grpc.Client, _hellostreamingworld_MultiGreeterClient> & { service: _hellostreamingworld_MultiGreeterDefinition }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Original file: protos/helloworld.proto
|
|
2
|
+
|
|
3
|
+
import type * as grpc from '@grpc/grpc-js'
|
|
4
|
+
import type { MethodDefinition } from '@grpc/proto-loader'
|
|
5
|
+
import type { HelloReply as _helloworld_HelloReply, HelloReply__Output as _helloworld_HelloReply__Output } from '../helloworld/HelloReply';
|
|
6
|
+
import type { HelloRequest as _helloworld_HelloRequest, HelloRequest__Output as _helloworld_HelloRequest__Output } from '../helloworld/HelloRequest';
|
|
7
|
+
|
|
8
|
+
export interface GreeterClient extends grpc.Client {
|
|
9
|
+
SayHello(argument: _helloworld_HelloRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_helloworld_HelloReply__Output>): grpc.ClientUnaryCall;
|
|
10
|
+
SayHello(argument: _helloworld_HelloRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_helloworld_HelloReply__Output>): grpc.ClientUnaryCall;
|
|
11
|
+
SayHello(argument: _helloworld_HelloRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_helloworld_HelloReply__Output>): grpc.ClientUnaryCall;
|
|
12
|
+
SayHello(argument: _helloworld_HelloRequest, callback: grpc.requestCallback<_helloworld_HelloReply__Output>): grpc.ClientUnaryCall;
|
|
13
|
+
sayHello(argument: _helloworld_HelloRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_helloworld_HelloReply__Output>): grpc.ClientUnaryCall;
|
|
14
|
+
sayHello(argument: _helloworld_HelloRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_helloworld_HelloReply__Output>): grpc.ClientUnaryCall;
|
|
15
|
+
sayHello(argument: _helloworld_HelloRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_helloworld_HelloReply__Output>): grpc.ClientUnaryCall;
|
|
16
|
+
sayHello(argument: _helloworld_HelloRequest, callback: grpc.requestCallback<_helloworld_HelloReply__Output>): grpc.ClientUnaryCall;
|
|
17
|
+
|
|
18
|
+
SayHelloStreamReply(argument: _helloworld_HelloRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_helloworld_HelloReply__Output>;
|
|
19
|
+
SayHelloStreamReply(argument: _helloworld_HelloRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_helloworld_HelloReply__Output>;
|
|
20
|
+
sayHelloStreamReply(argument: _helloworld_HelloRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_helloworld_HelloReply__Output>;
|
|
21
|
+
sayHelloStreamReply(argument: _helloworld_HelloRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_helloworld_HelloReply__Output>;
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GreeterHandlers extends grpc.UntypedServiceImplementation {
|
|
26
|
+
SayHello: grpc.handleUnaryCall<_helloworld_HelloRequest__Output, _helloworld_HelloReply>;
|
|
27
|
+
|
|
28
|
+
SayHelloStreamReply: grpc.handleServerStreamingCall<_helloworld_HelloRequest__Output, _helloworld_HelloReply>;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface GreeterDefinition extends grpc.ServiceDefinition {
|
|
33
|
+
SayHello: MethodDefinition<_helloworld_HelloRequest, _helloworld_HelloReply, _helloworld_HelloRequest__Output, _helloworld_HelloReply__Output>
|
|
34
|
+
SayHelloStreamReply: MethodDefinition<_helloworld_HelloRequest, _helloworld_HelloReply, _helloworld_HelloRequest__Output, _helloworld_HelloReply__Output>
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
+
import type * as grpc from '@grpc/grpc-js';
|
|
3
|
+
import type { MessageTypeDefinition } from '@grpc/proto-loader';
|
|
4
|
+
|
|
5
|
+
import type { GreeterClient as _helloworld_GreeterClient, GreeterDefinition as _helloworld_GreeterDefinition } from './helloworld/Greeter';
|
|
6
|
+
|
|
7
|
+
type SubtypeConstructor<Constructor extends new (...args: any) => any, Subtype> = {
|
|
8
|
+
new(...args: ConstructorParameters<Constructor>): Subtype;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface ProtoGrpcType {
|
|
12
|
+
helloworld: {
|
|
13
|
+
Greeter: SubtypeConstructor<typeof grpc.Client, _helloworld_GreeterClient> & { service: _helloworld_GreeterDefinition }
|
|
14
|
+
HelloReply: MessageTypeDefinition
|
|
15
|
+
HelloRequest: MessageTypeDefinition
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Original file: protos/keyvaluestore.proto
|
|
2
|
+
|
|
3
|
+
import type * as grpc from '@grpc/grpc-js'
|
|
4
|
+
import type { MethodDefinition } from '@grpc/proto-loader'
|
|
5
|
+
import type { Request as _keyvaluestore_Request, Request__Output as _keyvaluestore_Request__Output } from '../keyvaluestore/Request';
|
|
6
|
+
import type { Response as _keyvaluestore_Response, Response__Output as _keyvaluestore_Response__Output } from '../keyvaluestore/Response';
|
|
7
|
+
|
|
8
|
+
export interface KeyValueStoreClient extends grpc.Client {
|
|
9
|
+
GetValues(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_keyvaluestore_Request, _keyvaluestore_Response__Output>;
|
|
10
|
+
GetValues(options?: grpc.CallOptions): grpc.ClientDuplexStream<_keyvaluestore_Request, _keyvaluestore_Response__Output>;
|
|
11
|
+
getValues(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_keyvaluestore_Request, _keyvaluestore_Response__Output>;
|
|
12
|
+
getValues(options?: grpc.CallOptions): grpc.ClientDuplexStream<_keyvaluestore_Request, _keyvaluestore_Response__Output>;
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface KeyValueStoreHandlers extends grpc.UntypedServiceImplementation {
|
|
17
|
+
GetValues: grpc.handleBidiStreamingCall<_keyvaluestore_Request__Output, _keyvaluestore_Response>;
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface KeyValueStoreDefinition extends grpc.ServiceDefinition {
|
|
22
|
+
GetValues: MethodDefinition<_keyvaluestore_Request, _keyvaluestore_Response, _keyvaluestore_Request__Output, _keyvaluestore_Response__Output>
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
+
import type * as grpc from '@grpc/grpc-js';
|
|
3
|
+
import type { MessageTypeDefinition } from '@grpc/proto-loader';
|
|
4
|
+
|
|
5
|
+
import type { KeyValueStoreClient as _keyvaluestore_KeyValueStoreClient, KeyValueStoreDefinition as _keyvaluestore_KeyValueStoreDefinition } from './keyvaluestore/KeyValueStore';
|
|
6
|
+
|
|
7
|
+
type SubtypeConstructor<Constructor extends new (...args: any) => any, Subtype> = {
|
|
8
|
+
new(...args: ConstructorParameters<Constructor>): Subtype;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface ProtoGrpcType {
|
|
12
|
+
keyvaluestore: {
|
|
13
|
+
KeyValueStore: SubtypeConstructor<typeof grpc.Client, _keyvaluestore_KeyValueStoreClient> & { service: _keyvaluestore_KeyValueStoreDefinition }
|
|
14
|
+
Request: MessageTypeDefinition
|
|
15
|
+
Response: MessageTypeDefinition
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
+
import type * as grpc from '@grpc/grpc-js';
|
|
3
|
+
import type { MessageTypeDefinition } from '@grpc/proto-loader';
|
|
4
|
+
|
|
5
|
+
import type { RouteGuideClient as _routeguide_RouteGuideClient, RouteGuideDefinition as _routeguide_RouteGuideDefinition } from './routeguide/RouteGuide';
|
|
6
|
+
|
|
7
|
+
type SubtypeConstructor<Constructor extends new (...args: any) => any, Subtype> = {
|
|
8
|
+
new(...args: ConstructorParameters<Constructor>): Subtype;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface ProtoGrpcType {
|
|
12
|
+
routeguide: {
|
|
13
|
+
Feature: MessageTypeDefinition
|
|
14
|
+
Point: MessageTypeDefinition
|
|
15
|
+
Rectangle: MessageTypeDefinition
|
|
16
|
+
RouteGuide: SubtypeConstructor<typeof grpc.Client, _routeguide_RouteGuideClient> & { service: _routeguide_RouteGuideDefinition }
|
|
17
|
+
RouteNote: MessageTypeDefinition
|
|
18
|
+
RouteSummary: MessageTypeDefinition
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Original file: protos/route_guide.proto
|
|
2
|
+
|
|
3
|
+
import type { Point as _routeguide_Point, Point__Output as _routeguide_Point__Output } from '../routeguide/Point';
|
|
4
|
+
|
|
5
|
+
export interface Feature {
|
|
6
|
+
'name'?: (string);
|
|
7
|
+
'location'?: (_routeguide_Point | null);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Feature__Output {
|
|
11
|
+
'name': (string);
|
|
12
|
+
'location': (_routeguide_Point__Output | null);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Original file: protos/route_guide.proto
|
|
2
|
+
|
|
3
|
+
import type { Point as _routeguide_Point, Point__Output as _routeguide_Point__Output } from '../routeguide/Point';
|
|
4
|
+
|
|
5
|
+
export interface Rectangle {
|
|
6
|
+
'lo'?: (_routeguide_Point | null);
|
|
7
|
+
'hi'?: (_routeguide_Point | null);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Rectangle__Output {
|
|
11
|
+
'lo': (_routeguide_Point__Output | null);
|
|
12
|
+
'hi': (_routeguide_Point__Output | null);
|
|
13
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Original file: protos/route_guide.proto
|
|
2
|
+
|
|
3
|
+
import type * as grpc from '@grpc/grpc-js'
|
|
4
|
+
import type { MethodDefinition } from '@grpc/proto-loader'
|
|
5
|
+
import type { Feature as _routeguide_Feature, Feature__Output as _routeguide_Feature__Output } from '../routeguide/Feature';
|
|
6
|
+
import type { Point as _routeguide_Point, Point__Output as _routeguide_Point__Output } from '../routeguide/Point';
|
|
7
|
+
import type { Rectangle as _routeguide_Rectangle, Rectangle__Output as _routeguide_Rectangle__Output } from '../routeguide/Rectangle';
|
|
8
|
+
import type { RouteNote as _routeguide_RouteNote, RouteNote__Output as _routeguide_RouteNote__Output } from '../routeguide/RouteNote';
|
|
9
|
+
import type { RouteSummary as _routeguide_RouteSummary, RouteSummary__Output as _routeguide_RouteSummary__Output } from '../routeguide/RouteSummary';
|
|
10
|
+
|
|
11
|
+
export interface RouteGuideClient extends grpc.Client {
|
|
12
|
+
GetFeature(argument: _routeguide_Point, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_routeguide_Feature__Output>): grpc.ClientUnaryCall;
|
|
13
|
+
GetFeature(argument: _routeguide_Point, metadata: grpc.Metadata, callback: grpc.requestCallback<_routeguide_Feature__Output>): grpc.ClientUnaryCall;
|
|
14
|
+
GetFeature(argument: _routeguide_Point, options: grpc.CallOptions, callback: grpc.requestCallback<_routeguide_Feature__Output>): grpc.ClientUnaryCall;
|
|
15
|
+
GetFeature(argument: _routeguide_Point, callback: grpc.requestCallback<_routeguide_Feature__Output>): grpc.ClientUnaryCall;
|
|
16
|
+
getFeature(argument: _routeguide_Point, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_routeguide_Feature__Output>): grpc.ClientUnaryCall;
|
|
17
|
+
getFeature(argument: _routeguide_Point, metadata: grpc.Metadata, callback: grpc.requestCallback<_routeguide_Feature__Output>): grpc.ClientUnaryCall;
|
|
18
|
+
getFeature(argument: _routeguide_Point, options: grpc.CallOptions, callback: grpc.requestCallback<_routeguide_Feature__Output>): grpc.ClientUnaryCall;
|
|
19
|
+
getFeature(argument: _routeguide_Point, callback: grpc.requestCallback<_routeguide_Feature__Output>): grpc.ClientUnaryCall;
|
|
20
|
+
|
|
21
|
+
ListFeatures(argument: _routeguide_Rectangle, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_routeguide_Feature__Output>;
|
|
22
|
+
ListFeatures(argument: _routeguide_Rectangle, options?: grpc.CallOptions): grpc.ClientReadableStream<_routeguide_Feature__Output>;
|
|
23
|
+
listFeatures(argument: _routeguide_Rectangle, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_routeguide_Feature__Output>;
|
|
24
|
+
listFeatures(argument: _routeguide_Rectangle, options?: grpc.CallOptions): grpc.ClientReadableStream<_routeguide_Feature__Output>;
|
|
25
|
+
|
|
26
|
+
RecordRoute(metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_routeguide_RouteSummary__Output>): grpc.ClientWritableStream<_routeguide_Point>;
|
|
27
|
+
RecordRoute(metadata: grpc.Metadata, callback: grpc.requestCallback<_routeguide_RouteSummary__Output>): grpc.ClientWritableStream<_routeguide_Point>;
|
|
28
|
+
RecordRoute(options: grpc.CallOptions, callback: grpc.requestCallback<_routeguide_RouteSummary__Output>): grpc.ClientWritableStream<_routeguide_Point>;
|
|
29
|
+
RecordRoute(callback: grpc.requestCallback<_routeguide_RouteSummary__Output>): grpc.ClientWritableStream<_routeguide_Point>;
|
|
30
|
+
recordRoute(metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_routeguide_RouteSummary__Output>): grpc.ClientWritableStream<_routeguide_Point>;
|
|
31
|
+
recordRoute(metadata: grpc.Metadata, callback: grpc.requestCallback<_routeguide_RouteSummary__Output>): grpc.ClientWritableStream<_routeguide_Point>;
|
|
32
|
+
recordRoute(options: grpc.CallOptions, callback: grpc.requestCallback<_routeguide_RouteSummary__Output>): grpc.ClientWritableStream<_routeguide_Point>;
|
|
33
|
+
recordRoute(callback: grpc.requestCallback<_routeguide_RouteSummary__Output>): grpc.ClientWritableStream<_routeguide_Point>;
|
|
34
|
+
|
|
35
|
+
RouteChat(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_routeguide_RouteNote, _routeguide_RouteNote__Output>;
|
|
36
|
+
RouteChat(options?: grpc.CallOptions): grpc.ClientDuplexStream<_routeguide_RouteNote, _routeguide_RouteNote__Output>;
|
|
37
|
+
routeChat(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_routeguide_RouteNote, _routeguide_RouteNote__Output>;
|
|
38
|
+
routeChat(options?: grpc.CallOptions): grpc.ClientDuplexStream<_routeguide_RouteNote, _routeguide_RouteNote__Output>;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface RouteGuideHandlers extends grpc.UntypedServiceImplementation {
|
|
43
|
+
GetFeature: grpc.handleUnaryCall<_routeguide_Point__Output, _routeguide_Feature>;
|
|
44
|
+
|
|
45
|
+
ListFeatures: grpc.handleServerStreamingCall<_routeguide_Rectangle__Output, _routeguide_Feature>;
|
|
46
|
+
|
|
47
|
+
RecordRoute: grpc.handleClientStreamingCall<_routeguide_Point__Output, _routeguide_RouteSummary>;
|
|
48
|
+
|
|
49
|
+
RouteChat: grpc.handleBidiStreamingCall<_routeguide_RouteNote__Output, _routeguide_RouteNote>;
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface RouteGuideDefinition extends grpc.ServiceDefinition {
|
|
54
|
+
GetFeature: MethodDefinition<_routeguide_Point, _routeguide_Feature, _routeguide_Point__Output, _routeguide_Feature__Output>
|
|
55
|
+
ListFeatures: MethodDefinition<_routeguide_Rectangle, _routeguide_Feature, _routeguide_Rectangle__Output, _routeguide_Feature__Output>
|
|
56
|
+
RecordRoute: MethodDefinition<_routeguide_Point, _routeguide_RouteSummary, _routeguide_Point__Output, _routeguide_RouteSummary__Output>
|
|
57
|
+
RouteChat: MethodDefinition<_routeguide_RouteNote, _routeguide_RouteNote, _routeguide_RouteNote__Output, _routeguide_RouteNote__Output>
|
|
58
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Original file: protos/route_guide.proto
|
|
2
|
+
|
|
3
|
+
import type { Point as _routeguide_Point, Point__Output as _routeguide_Point__Output } from '../routeguide/Point';
|
|
4
|
+
|
|
5
|
+
export interface RouteNote {
|
|
6
|
+
'location'?: (_routeguide_Point | null);
|
|
7
|
+
'message'?: (string);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface RouteNote__Output {
|
|
11
|
+
'location': (_routeguide_Point__Output | null);
|
|
12
|
+
'message': (string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Original file: protos/route_guide.proto
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export interface RouteSummary {
|
|
5
|
+
'pointCount'?: (number);
|
|
6
|
+
'featureCount'?: (number);
|
|
7
|
+
'distance'?: (number);
|
|
8
|
+
'elapsedTime'?: (number);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface RouteSummary__Output {
|
|
12
|
+
'pointCount': (number);
|
|
13
|
+
'featureCount': (number);
|
|
14
|
+
'distance': (number);
|
|
15
|
+
'elapsedTime': (number);
|
|
16
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
+
|
|
3
|
+
// cd /home/marcusbettens/projects/stsappframework/src/gRPC/ststest
|
|
4
|
+
// npx proto-loader-gen-types --longs=String --enums=String --defaults --oneofs --grpcLib=@grpc/grpc-js --outDir=protos/ protos/*.proto
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
*
|
|
8
|
+
* Copyright 2015 gRPC authors.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const PROTO_PATH_SV = __dirname + './../../../../src/gRPC/ststest/protos/route_guide.proto';
|
|
25
|
+
|
|
26
|
+
import * as grpc from '@grpc/grpc-js';
|
|
27
|
+
import * as protoLoader from '@grpc/proto-loader';
|
|
28
|
+
|
|
29
|
+
//import { IFeature, IPoint, IRectangle, IRouteNote, IRouteSummary } from './commonTypes'
|
|
30
|
+
|
|
31
|
+
import chalk from 'chalk'
|
|
32
|
+
|
|
33
|
+
import fs from 'node:fs'
|
|
34
|
+
|
|
35
|
+
import { ProtoGrpcType } from './../protos/route_guide'
|
|
36
|
+
|
|
37
|
+
import { RouteGuideHandlers } from './../protos/routeguide/RouteGuide'
|
|
38
|
+
import { Point, Point__Output } from '../protos/routeguide/Point';
|
|
39
|
+
import { Feature } from './../protos/routeguide/Feature'
|
|
40
|
+
import { RouteSummary } from './../protos/routeguide/RouteSummary'
|
|
41
|
+
import { RouteNote, RouteNote__Output } from './../protos/routeguide/RouteNote'
|
|
42
|
+
|
|
43
|
+
const packageDefinition = protoLoader.loadSync(
|
|
44
|
+
PROTO_PATH_SV,
|
|
45
|
+
{keepCase: true,
|
|
46
|
+
longs: String,
|
|
47
|
+
enums: String,
|
|
48
|
+
defaults: true,
|
|
49
|
+
oneofs: true
|
|
50
|
+
});
|
|
51
|
+
//const routeguide = grpc.loadPackageDefinition(packageDefinition).routeguide;
|
|
52
|
+
|
|
53
|
+
const routeguide = (grpc.loadPackageDefinition(
|
|
54
|
+
packageDefinition
|
|
55
|
+
) as unknown) as ProtoGrpcType;
|
|
56
|
+
|
|
57
|
+
const exampleServer: RouteGuideHandlers = {
|
|
58
|
+
GetFeature(call, callback) {
|
|
59
|
+
console.log(chalk.grey(`getFeature: call.request: [${JSON.stringify(call.request)}]`));
|
|
60
|
+
const retVal = checkFeature(call.request);
|
|
61
|
+
console.log(chalk.grey(`getFeature: return: [${JSON.stringify(retVal)}]`));
|
|
62
|
+
callback(null, retVal);
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
ListFeatures(call) {
|
|
66
|
+
console.log(chalk.green(`listFeatures: forEach: [${JSON.stringify(call.request)}]`));
|
|
67
|
+
const rectangle = call.request;
|
|
68
|
+
const lo = rectangle.lo;
|
|
69
|
+
const hi = rectangle.hi;
|
|
70
|
+
|
|
71
|
+
const feature_list: Feature[] = [ ];
|
|
72
|
+
for (let i=0; i < 10; i++) {
|
|
73
|
+
feature_list.push({
|
|
74
|
+
location: {
|
|
75
|
+
latitude: (hi as Point__Output).latitude * 2 * (i+1),
|
|
76
|
+
longitude: (lo as Point__Output).longitude * 2 * (i+1)
|
|
77
|
+
},
|
|
78
|
+
name: `the name for index: [${i}]`
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
feature_list.forEach((feature: Feature) => {
|
|
82
|
+
console.log(chalk.green(`listFeatures: forEach: [${JSON.stringify(feature)}]`));
|
|
83
|
+
call.write(feature);
|
|
84
|
+
});
|
|
85
|
+
console.log(chalk.green(`listFeatures: call.end()`));
|
|
86
|
+
call.end();
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
RecordRoute(call, callback) {
|
|
90
|
+
let point_count = 0;
|
|
91
|
+
let feature_count = 0;
|
|
92
|
+
let distance = 0;
|
|
93
|
+
let previous: any = null;
|
|
94
|
+
// Start a timer
|
|
95
|
+
const start_time = process.hrtime();
|
|
96
|
+
call.on('data', function(point: Point__Output) {
|
|
97
|
+
console.log(chalk.magenta(`recordRoute: on data: [${JSON.stringify(point)}]`));
|
|
98
|
+
point_count += 1;
|
|
99
|
+
if (checkFeature(point).name !== '') {
|
|
100
|
+
feature_count += 1;
|
|
101
|
+
}
|
|
102
|
+
/* For each point after the first, add the incremental distance from the
|
|
103
|
+
* previous point to the total distance value */
|
|
104
|
+
if (previous != null) {
|
|
105
|
+
distance += 1;
|
|
106
|
+
}
|
|
107
|
+
previous = point;
|
|
108
|
+
});
|
|
109
|
+
call.on('end', function() {
|
|
110
|
+
const returnData: RouteSummary = {
|
|
111
|
+
pointCount: point_count,
|
|
112
|
+
featureCount: feature_count,
|
|
113
|
+
// Cast the distance to an integer
|
|
114
|
+
distance: distance|0,
|
|
115
|
+
// End the timer
|
|
116
|
+
elapsedTime: process.hrtime(start_time)[0]
|
|
117
|
+
}
|
|
118
|
+
console.log(chalk.magenta(`recordRoute: on end - return data: [${JSON.stringify(returnData)}]`));
|
|
119
|
+
callback(null, returnData);
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
RouteChat(call) {
|
|
124
|
+
call.on('data', function(note: RouteNote__Output) {
|
|
125
|
+
console.log(chalk.cyan(`routeChat: on data: [${JSON.stringify(note)}]`));
|
|
126
|
+
// Send back what we just got
|
|
127
|
+
const sendBack: RouteNote = JSON.parse(JSON.stringify(note));
|
|
128
|
+
sendBack.message = `${note.message} reply message`;
|
|
129
|
+
(sendBack.location as Point).latitude = (note.location as Point__Output).latitude * 2;
|
|
130
|
+
(sendBack.location as Point).longitude = (note.location as Point__Output).longitude * 2;
|
|
131
|
+
console.log(chalk.cyan(`routeChat: sending data: [${JSON.stringify(sendBack)}]`));
|
|
132
|
+
call.write(sendBack);
|
|
133
|
+
});
|
|
134
|
+
call.on('end', function() {
|
|
135
|
+
call.end();
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get a feature object at the given point, or creates one if it does not exist.
|
|
142
|
+
* @param {point} point The point to check
|
|
143
|
+
* @return {feature} The feature object at the point. Note that an empty name
|
|
144
|
+
* indicates no feature
|
|
145
|
+
*/
|
|
146
|
+
function checkFeature(point: Point__Output): Feature {
|
|
147
|
+
const feature: Feature = {
|
|
148
|
+
name: "Some name",
|
|
149
|
+
location: {
|
|
150
|
+
latitude: point.latitude * 2,
|
|
151
|
+
longitude: point.longitude * 2
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return feature;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Get a new server with the handler functions in this file bound to the methods
|
|
159
|
+
* it serves.
|
|
160
|
+
* @return {Server} The new server object
|
|
161
|
+
*/
|
|
162
|
+
function getServer() {
|
|
163
|
+
const server = new grpc.Server();
|
|
164
|
+
server.addService(routeguide.routeguide.RouteGuide.service, exampleServer);
|
|
165
|
+
return server;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// HTTPS_SERVER_KEY_PATH=/etc/letsencrypt/live/stsmda.org/privkey.pem \
|
|
169
|
+
// HTTPS_SERVER_CERT_PATH=/etc/letsencrypt/live/stsmda.org/fullchain.pem \
|
|
170
|
+
|
|
171
|
+
/*
|
|
172
|
+
export interface KeyCertPair {
|
|
173
|
+
private_key: Buffer;
|
|
174
|
+
cert_chain: Buffer;
|
|
175
|
+
}
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
if (require.main === module) {
|
|
179
|
+
// If this is run as a script, start a server on an unused port
|
|
180
|
+
const routeServer = getServer();
|
|
181
|
+
|
|
182
|
+
// Secure server
|
|
183
|
+
|
|
184
|
+
routeServer.bindAsync('0.0.0.0:3029', grpc.ServerCredentials.createSsl(null,
|
|
185
|
+
[
|
|
186
|
+
{
|
|
187
|
+
private_key: fs.readFileSync('/etc/letsencrypt/live/stsmda.org/privkey.pem'),
|
|
188
|
+
cert_chain: fs.readFileSync('/etc/letsencrypt/live/stsmda.org/fullchain.pem')
|
|
189
|
+
}
|
|
190
|
+
]), (error, port) => {
|
|
191
|
+
if (error) {
|
|
192
|
+
console.log(chalk.red(`Error starting gRPC TLS server on port: [${port}], Error: [${error}]`));
|
|
193
|
+
} else {
|
|
194
|
+
console.log(chalk.green(`Started gRPC TLS server on port: [${port}]`));
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Insecure server
|
|
199
|
+
/*
|
|
200
|
+
routeServer.bindAsync('0.0.0.0:3029', grpc.ServerCredentials.createInsecure(),
|
|
201
|
+
(error, port) => {
|
|
202
|
+
if (error) {
|
|
203
|
+
console.log(chalk.red(`Error starting gRPC TLS server on port: [${port}], Error: [${error}]`));
|
|
204
|
+
} else {
|
|
205
|
+
console.log(chalk.green(`Started gRPC TLS server on port: [${port}]`));
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
*/
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
exports.getServer = getServer;
|