@nsshunt/stsappframework 3.1.24 → 3.1.27
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/src/greeter_client.js +67 -0
- package/dist/gRPC/ststest/src/greeter_client.js.map +1 -0
- package/dist/gRPC/ststest/src/greeter_server.js +78 -0
- package/dist/gRPC/ststest/src/greeter_server.js.map +1 -0
- package/package.json +3 -1
- package/src/gRPC/ststest/protos/BUILD +82 -0
- package/src/gRPC/ststest/protos/README.md +8 -0
- package/src/gRPC/ststest/protos/auth_sample.proto +42 -0
- package/src/gRPC/ststest/protos/echo.proto +45 -0
- package/src/gRPC/ststest/protos/hellostreamingworld.proto +39 -0
- package/src/gRPC/ststest/protos/helloworld.proto +40 -0
- package/src/gRPC/ststest/protos/keyvaluestore.proto +33 -0
- package/src/gRPC/ststest/protos/route_guide.proto +111 -0
- package/src/gRPC/ststest/src/greeter_client.ts +52 -0
- package/src/gRPC/ststest/src/greeter_server.ts +62 -0
- package/types/gRPC/ststest/src/greeter_client.d.ts +3 -0
- package/types/gRPC/ststest/src/greeter_client.d.ts.map +1 -0
- package/types/gRPC/ststest/src/greeter_server.d.ts +3 -0
- package/types/gRPC/ststest/src/greeter_server.d.ts.map +1 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
// Examples;
|
|
28
|
+
// https://github.com/grpc/grpc-node/blob/master/examples/routeguide/dynamic_codegen/route_guide_server.js
|
|
29
|
+
/*
|
|
30
|
+
*
|
|
31
|
+
* Copyright 2015 gRPC authors.
|
|
32
|
+
*
|
|
33
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
34
|
+
* you may not use this file except in compliance with the License.
|
|
35
|
+
* You may obtain a copy of the License at
|
|
36
|
+
*
|
|
37
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
38
|
+
*
|
|
39
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
40
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
41
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
42
|
+
* See the License for the specific language governing permissions and
|
|
43
|
+
* limitations under the License.
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
const PROTO_PATH = __dirname + './../protos/helloworld.proto';
|
|
47
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
48
|
+
//var grpc = require('@grpc/grpc-js');
|
|
49
|
+
const protoLoader = __importStar(require("@grpc/proto-loader"));
|
|
50
|
+
//var protoLoader = require('@grpc/proto-loader');
|
|
51
|
+
const packageDefinition = protoLoader.loadSync(PROTO_PATH, { keepCase: true,
|
|
52
|
+
longs: String,
|
|
53
|
+
enums: String,
|
|
54
|
+
defaults: true,
|
|
55
|
+
oneofs: true
|
|
56
|
+
});
|
|
57
|
+
const hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld;
|
|
58
|
+
function main() {
|
|
59
|
+
const target = 'localhost:50051';
|
|
60
|
+
const client = new hello_proto.Greeter(target, grpc.credentials.createInsecure());
|
|
61
|
+
const user = 'world';
|
|
62
|
+
client.sayHello({ name: user }, function (err, response) {
|
|
63
|
+
console.log('Greeting:', response.message);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
main();
|
|
67
|
+
//# sourceMappingURL=greeter_client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greeter_client.js","sourceRoot":"","sources":["../../../../src/gRPC/ststest/src/greeter_client.ts"],"names":[],"mappings":";AAAA,kDAAkD,CAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;AAE9D,YAAY;AACZ,0GAA0G;AAE1G;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,UAAU,GAAG,SAAS,GAAG,8BAA8B,CAAC;AAE9D,oDAAsC;AACtC,sCAAsC;AAEtC,gEAAkD;AAClD,kDAAkD;AAElD,MAAM,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAC1C,UAAU,EACV,EAAC,QAAQ,EAAE,IAAI;IACX,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;CACf,CAAC,CAAC;AACP,MAAM,WAAW,GAAG,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC;AAE7E,SAAS,IAAI;IACT,MAAM,MAAM,GAAG,iBAAiB,CAAC;IACjC,MAAM,MAAM,GAAG,IAAK,WAAmB,CAAC,OAAO,CAAC,MAAM,EAClD,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,OAAO,CAAC;IACrB,MAAM,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,IAAI,EAAC,EAAE,UAAS,GAAQ,EAAE,QAAa;QAC1D,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
// Examples;
|
|
28
|
+
// https://github.com/grpc/grpc-node/blob/master/examples/routeguide/dynamic_codegen/route_guide_server.js
|
|
29
|
+
/*
|
|
30
|
+
*
|
|
31
|
+
* Copyright 2015 gRPC authors.
|
|
32
|
+
*
|
|
33
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
34
|
+
* you may not use this file except in compliance with the License.
|
|
35
|
+
* You may obtain a copy of the License at
|
|
36
|
+
*
|
|
37
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
38
|
+
*
|
|
39
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
40
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
41
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
42
|
+
* See the License for the specific language governing permissions and
|
|
43
|
+
* limitations under the License.
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
const PROTO_PATH = __dirname + './../protos/helloworld.proto';
|
|
47
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
48
|
+
const protoLoader = __importStar(require("@grpc/proto-loader"));
|
|
49
|
+
//var grpc = require('@grpc/grpc-js');
|
|
50
|
+
//var protoLoader = require('@grpc/proto-loader');
|
|
51
|
+
const packageDefinition = protoLoader.loadSync(PROTO_PATH, { keepCase: true,
|
|
52
|
+
longs: String,
|
|
53
|
+
enums: String,
|
|
54
|
+
defaults: true,
|
|
55
|
+
oneofs: true
|
|
56
|
+
});
|
|
57
|
+
const hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld;
|
|
58
|
+
/**
|
|
59
|
+
* Implements the SayHello RPC method.
|
|
60
|
+
*/
|
|
61
|
+
function sayHello(call, callback) {
|
|
62
|
+
callback(null, { message: 'Hello ' + call.request.name });
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Starts an RPC server that receives requests for the Greeter service at the
|
|
66
|
+
* sample server port
|
|
67
|
+
*/
|
|
68
|
+
function main() {
|
|
69
|
+
const server = new grpc.Server();
|
|
70
|
+
server.addService(hello_proto.Greeter.service, {
|
|
71
|
+
sayHello: sayHello
|
|
72
|
+
});
|
|
73
|
+
server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {
|
|
74
|
+
server.start();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
main();
|
|
78
|
+
//# sourceMappingURL=greeter_server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greeter_server.js","sourceRoot":"","sources":["../../../../src/gRPC/ststest/src/greeter_server.ts"],"names":[],"mappings":";AAAA,kDAAkD,CAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;AAE9D,YAAY;AACZ,0GAA0G;AAE1G;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,UAAU,GAAG,SAAS,GAAG,8BAA8B,CAAC;AAE9D,oDAAsC;AACtC,gEAAkD;AAClD,sCAAsC;AACtC,kDAAkD;AAElD,MAAM,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAC1C,UAAU,EACV,EAAC,QAAQ,EAAE,IAAI;IACX,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;CACf,CAAC,CAAC;AACP,MAAM,WAAW,GAAG,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC;AAE7E;;GAEG;AACH,SAAS,QAAQ,CAAC,IAAS,EAAE,QAAa;IACtC,QAAQ,CAAC,IAAI,EAAE,EAAC,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,SAAS,IAAI;IACT,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;IACjC,MAAM,CAAC,UAAU,CAAE,WAAmB,CAAC,OAAO,CAAC,OAAO,EAAE;QACpD,QAAQ,EAAE,QAAQ;KACrB,CAAC,CAAC;IACH,MAAM,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,GAAG,EAAE;QAC5E,MAAM,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nsshunt/stsappframework",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.27",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
"vite": "^5.0.11"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
+
"@grpc/grpc-js": "^1.10.0",
|
|
50
|
+
"@grpc/proto-loader": "^0.7.10",
|
|
49
51
|
"@influxdata/influxdb-client": "^1.33.2",
|
|
50
52
|
"@influxdata/influxdb-client-apis": "^1.33.2",
|
|
51
53
|
"@nsshunt/stsconfig": "^1.25.85",
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Copyright 2020 the gRPC authors.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
load("@rules_proto//proto:defs.bzl", "proto_library")
|
|
16
|
+
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
|
|
17
|
+
load("//bazel:grpc_build_system.bzl", "grpc_proto_library")
|
|
18
|
+
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
|
|
19
|
+
|
|
20
|
+
licenses(["notice"])
|
|
21
|
+
|
|
22
|
+
package(default_visibility = ["//visibility:public"])
|
|
23
|
+
|
|
24
|
+
grpc_proto_library(
|
|
25
|
+
name = "auth_sample",
|
|
26
|
+
srcs = ["auth_sample.proto"],
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
grpc_proto_library(
|
|
30
|
+
name = "hellostreamingworld",
|
|
31
|
+
srcs = ["hellostreamingworld.proto"],
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
# The following three rules demonstrate the usage of the cc_grpc_library rule in
|
|
35
|
+
# in a mode compatible with the native proto_library and cc_proto_library rules.
|
|
36
|
+
proto_library(
|
|
37
|
+
name = "helloworld_proto",
|
|
38
|
+
srcs = ["helloworld.proto"],
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
cc_proto_library(
|
|
42
|
+
name = "helloworld_cc_proto",
|
|
43
|
+
deps = [":helloworld_proto"],
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
cc_grpc_library(
|
|
47
|
+
name = "helloworld_cc_grpc",
|
|
48
|
+
srcs = [":helloworld_proto"],
|
|
49
|
+
grpc_only = True,
|
|
50
|
+
deps = [":helloworld_cc_proto"],
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
grpc_proto_library(
|
|
54
|
+
name = "route_guide",
|
|
55
|
+
srcs = ["route_guide.proto"],
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
proto_library(
|
|
59
|
+
name = "keyvaluestore_proto",
|
|
60
|
+
srcs = ["keyvaluestore.proto"],
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
grpc_proto_library(
|
|
64
|
+
name = "keyvaluestore",
|
|
65
|
+
srcs = ["keyvaluestore.proto"],
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
py_proto_library(
|
|
69
|
+
name = "helloworld_py_pb2",
|
|
70
|
+
deps = [":helloworld_proto"],
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
py_grpc_library(
|
|
74
|
+
name = "helloworld_py_pb2_grpc",
|
|
75
|
+
srcs = [":helloworld_proto"],
|
|
76
|
+
deps = [":helloworld_py_pb2"],
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
proto_library(
|
|
80
|
+
name = "route_guide_proto",
|
|
81
|
+
srcs = [":route_guide.proto"],
|
|
82
|
+
)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright 2015 gRPC authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package grpc.testing;
|
|
18
|
+
|
|
19
|
+
option objc_class_prefix = "AUTH";
|
|
20
|
+
|
|
21
|
+
// Unary request.
|
|
22
|
+
message Request {
|
|
23
|
+
// Whether Response should include username.
|
|
24
|
+
bool fill_username = 4;
|
|
25
|
+
|
|
26
|
+
// Whether Response should include OAuth scope.
|
|
27
|
+
bool fill_oauth_scope = 5;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Unary response, as configured by the request.
|
|
31
|
+
message Response {
|
|
32
|
+
// The user the request came from, for verifying authentication was
|
|
33
|
+
// successful.
|
|
34
|
+
string username = 2;
|
|
35
|
+
// OAuth scope.
|
|
36
|
+
string oauth_scope = 3;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
service TestService {
|
|
40
|
+
// One request followed by one response.
|
|
41
|
+
rpc UnaryCall(Request) returns (Response);
|
|
42
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Copyright 2018 gRPC authors.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
syntax = "proto3";
|
|
20
|
+
|
|
21
|
+
option go_package = "google.golang.org/grpc/examples/features/proto/echo";
|
|
22
|
+
|
|
23
|
+
package grpc.examples.echo;
|
|
24
|
+
|
|
25
|
+
// EchoRequest is the request for echo.
|
|
26
|
+
message EchoRequest {
|
|
27
|
+
string message = 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// EchoResponse is the response for echo.
|
|
31
|
+
message EchoResponse {
|
|
32
|
+
string message = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Echo is the echo service.
|
|
36
|
+
service Echo {
|
|
37
|
+
// UnaryEcho is unary echo.
|
|
38
|
+
rpc UnaryEcho(EchoRequest) returns (EchoResponse) {}
|
|
39
|
+
// ServerStreamingEcho is server side streaming.
|
|
40
|
+
rpc ServerStreamingEcho(EchoRequest) returns (stream EchoResponse) {}
|
|
41
|
+
// ClientStreamingEcho is client side streaming.
|
|
42
|
+
rpc ClientStreamingEcho(stream EchoRequest) returns (EchoResponse) {}
|
|
43
|
+
// BidirectionalStreamingEcho is bidi streaming.
|
|
44
|
+
rpc BidirectionalStreamingEcho(stream EchoRequest) returns (stream EchoResponse) {}
|
|
45
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2015 gRPC authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
option java_package = "ex.grpc";
|
|
18
|
+
option objc_class_prefix = "HSW";
|
|
19
|
+
|
|
20
|
+
package hellostreamingworld;
|
|
21
|
+
|
|
22
|
+
// The greeting service definition.
|
|
23
|
+
service MultiGreeter {
|
|
24
|
+
// Sends multiple greetings
|
|
25
|
+
rpc sayHello (HelloRequest) returns (stream HelloReply) {}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// The request message containing the user's name and how many greetings
|
|
29
|
+
// they want.
|
|
30
|
+
message HelloRequest {
|
|
31
|
+
string name = 1;
|
|
32
|
+
string num_greetings = 2;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// A response message containing a greeting
|
|
36
|
+
message HelloReply {
|
|
37
|
+
string message = 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright 2015 gRPC authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
option java_multiple_files = true;
|
|
18
|
+
option java_package = "io.grpc.examples.helloworld";
|
|
19
|
+
option java_outer_classname = "HelloWorldProto";
|
|
20
|
+
option objc_class_prefix = "HLW";
|
|
21
|
+
|
|
22
|
+
package helloworld;
|
|
23
|
+
|
|
24
|
+
// The greeting service definition.
|
|
25
|
+
service Greeter {
|
|
26
|
+
// Sends a greeting
|
|
27
|
+
rpc SayHello (HelloRequest) returns (HelloReply) {}
|
|
28
|
+
|
|
29
|
+
rpc SayHelloStreamReply (HelloRequest) returns (stream HelloReply) {}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// The request message containing the user's name.
|
|
33
|
+
message HelloRequest {
|
|
34
|
+
string name = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// The response message containing the greetings
|
|
38
|
+
message HelloReply {
|
|
39
|
+
string message = 1;
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright 2018 gRPC authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package keyvaluestore;
|
|
18
|
+
|
|
19
|
+
// A simple key-value storage service
|
|
20
|
+
service KeyValueStore {
|
|
21
|
+
// Provides a value for each key request
|
|
22
|
+
rpc GetValues (stream Request) returns (stream Response) {}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// The request message containing the key
|
|
26
|
+
message Request {
|
|
27
|
+
string key = 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// The response message containing the value associated with the key
|
|
31
|
+
message Response {
|
|
32
|
+
string value = 1;
|
|
33
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Copyright 2015 gRPC authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
option java_multiple_files = true;
|
|
18
|
+
option java_package = "io.grpc.examples.routeguide";
|
|
19
|
+
option java_outer_classname = "RouteGuideProto";
|
|
20
|
+
option objc_class_prefix = "RTG";
|
|
21
|
+
|
|
22
|
+
package routeguide;
|
|
23
|
+
|
|
24
|
+
// Interface exported by the server.
|
|
25
|
+
service RouteGuide {
|
|
26
|
+
// A simple RPC.
|
|
27
|
+
//
|
|
28
|
+
// Obtains the feature at a given position.
|
|
29
|
+
//
|
|
30
|
+
// A feature with an empty name is returned if there's no feature at the given
|
|
31
|
+
// position.
|
|
32
|
+
rpc GetFeature(Point) returns (Feature) {}
|
|
33
|
+
|
|
34
|
+
// A server-to-client streaming RPC.
|
|
35
|
+
//
|
|
36
|
+
// Obtains the Features available within the given Rectangle. Results are
|
|
37
|
+
// streamed rather than returned at once (e.g. in a response message with a
|
|
38
|
+
// repeated field), as the rectangle may cover a large area and contain a
|
|
39
|
+
// huge number of features.
|
|
40
|
+
rpc ListFeatures(Rectangle) returns (stream Feature) {}
|
|
41
|
+
|
|
42
|
+
// A client-to-server streaming RPC.
|
|
43
|
+
//
|
|
44
|
+
// Accepts a stream of Points on a route being traversed, returning a
|
|
45
|
+
// RouteSummary when traversal is completed.
|
|
46
|
+
rpc RecordRoute(stream Point) returns (RouteSummary) {}
|
|
47
|
+
|
|
48
|
+
// A Bidirectional streaming RPC.
|
|
49
|
+
//
|
|
50
|
+
// Accepts a stream of RouteNotes sent while a route is being traversed,
|
|
51
|
+
// while receiving other RouteNotes (e.g. from other users).
|
|
52
|
+
rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Points are represented as latitude-longitude pairs in the E7 representation
|
|
56
|
+
// (degrees multiplied by 10**7 and rounded to the nearest integer).
|
|
57
|
+
// Latitudes should be in the range +/- 90 degrees and longitude should be in
|
|
58
|
+
// the range +/- 180 degrees (inclusive).
|
|
59
|
+
message Point {
|
|
60
|
+
int32 latitude = 1;
|
|
61
|
+
int32 longitude = 2;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// A latitude-longitude rectangle, represented as two diagonally opposite
|
|
65
|
+
// points "lo" and "hi".
|
|
66
|
+
message Rectangle {
|
|
67
|
+
// One corner of the rectangle.
|
|
68
|
+
Point lo = 1;
|
|
69
|
+
|
|
70
|
+
// The other corner of the rectangle.
|
|
71
|
+
Point hi = 2;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// A feature names something at a given point.
|
|
75
|
+
//
|
|
76
|
+
// If a feature could not be named, the name is empty.
|
|
77
|
+
message Feature {
|
|
78
|
+
// The name of the feature.
|
|
79
|
+
string name = 1;
|
|
80
|
+
|
|
81
|
+
// The point where the feature is detected.
|
|
82
|
+
Point location = 2;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// A RouteNote is a message sent while at a given point.
|
|
86
|
+
message RouteNote {
|
|
87
|
+
// The location from which the message is sent.
|
|
88
|
+
Point location = 1;
|
|
89
|
+
|
|
90
|
+
// The message to be sent.
|
|
91
|
+
string message = 2;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// A RouteSummary is received in response to a RecordRoute rpc.
|
|
95
|
+
//
|
|
96
|
+
// It contains the number of individual points received, the number of
|
|
97
|
+
// detected features, and the total distance covered as the cumulative sum of
|
|
98
|
+
// the distance between each point.
|
|
99
|
+
message RouteSummary {
|
|
100
|
+
// The number of points received.
|
|
101
|
+
int32 point_count = 1;
|
|
102
|
+
|
|
103
|
+
// The number of known features passed while traversing the route.
|
|
104
|
+
int32 feature_count = 2;
|
|
105
|
+
|
|
106
|
+
// The distance covered in metres.
|
|
107
|
+
int32 distance = 3;
|
|
108
|
+
|
|
109
|
+
// The duration of the traversal in seconds.
|
|
110
|
+
int32 elapsed_time = 4;
|
|
111
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
+
|
|
3
|
+
// Examples;
|
|
4
|
+
// https://github.com/grpc/grpc-node/blob/master/examples/routeguide/dynamic_codegen/route_guide_server.js
|
|
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 = __dirname + './../protos/helloworld.proto';
|
|
25
|
+
|
|
26
|
+
import * as grpc from '@grpc/grpc-js';
|
|
27
|
+
//var grpc = require('@grpc/grpc-js');
|
|
28
|
+
|
|
29
|
+
import * as protoLoader from '@grpc/proto-loader';
|
|
30
|
+
//var protoLoader = require('@grpc/proto-loader');
|
|
31
|
+
|
|
32
|
+
const packageDefinition = protoLoader.loadSync(
|
|
33
|
+
PROTO_PATH,
|
|
34
|
+
{keepCase: true,
|
|
35
|
+
longs: String,
|
|
36
|
+
enums: String,
|
|
37
|
+
defaults: true,
|
|
38
|
+
oneofs: true
|
|
39
|
+
});
|
|
40
|
+
const hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld;
|
|
41
|
+
|
|
42
|
+
function main() {
|
|
43
|
+
const target = 'localhost:50051';
|
|
44
|
+
const client = new (hello_proto as any).Greeter(target,
|
|
45
|
+
grpc.credentials.createInsecure());
|
|
46
|
+
const user = 'world';
|
|
47
|
+
client.sayHello({name: user}, function(err: any, response: any) {
|
|
48
|
+
console.log('Greeting:', response.message);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
main();
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
+
|
|
3
|
+
// Examples;
|
|
4
|
+
// https://github.com/grpc/grpc-node/blob/master/examples/routeguide/dynamic_codegen/route_guide_server.js
|
|
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 = __dirname + './../protos/helloworld.proto';
|
|
25
|
+
|
|
26
|
+
import * as grpc from '@grpc/grpc-js';
|
|
27
|
+
import * as protoLoader from '@grpc/proto-loader';
|
|
28
|
+
//var grpc = require('@grpc/grpc-js');
|
|
29
|
+
//var protoLoader = require('@grpc/proto-loader');
|
|
30
|
+
|
|
31
|
+
const packageDefinition = protoLoader.loadSync(
|
|
32
|
+
PROTO_PATH,
|
|
33
|
+
{keepCase: true,
|
|
34
|
+
longs: String,
|
|
35
|
+
enums: String,
|
|
36
|
+
defaults: true,
|
|
37
|
+
oneofs: true
|
|
38
|
+
});
|
|
39
|
+
const hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Implements the SayHello RPC method.
|
|
43
|
+
*/
|
|
44
|
+
function sayHello(call: any, callback: any) {
|
|
45
|
+
callback(null, {message: 'Hello ' + call.request.name});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Starts an RPC server that receives requests for the Greeter service at the
|
|
50
|
+
* sample server port
|
|
51
|
+
*/
|
|
52
|
+
function main() {
|
|
53
|
+
const server = new grpc.Server();
|
|
54
|
+
server.addService((hello_proto as any).Greeter.service, {
|
|
55
|
+
sayHello: sayHello
|
|
56
|
+
});
|
|
57
|
+
server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {
|
|
58
|
+
server.start();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
main();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greeter_client.d.ts","sourceRoot":"","sources":["../../../../src/gRPC/ststest/src/greeter_client.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greeter_server.d.ts","sourceRoot":"","sources":["../../../../src/gRPC/ststest/src/greeter_server.ts"],"names":[],"mappings":""}
|