From 06380057fa5f3839cc2eb3b8c984e3dd989d7024 Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Tue, 10 Aug 2021 21:00:26 -0700 Subject: [PATCH] feat(cmd-api-server): support grpc web services #1189 TODO: 1. Figure out how to stop the generator from mangling the model property names into capital case (getCreatedat) See: https://github.com/protocolbuffers/protobuf/issues/8608 2. Figure out how to export the OpenAPI model classes and the gRPC model classes at the same time without name conflicts (they have the same names) 3. Implement streaming healthcheck endpiont with gRPC 4. Allow plugins to hook in their own gRPC service implementations. 5. Verify with test case that the secure credentials flavor also works. Fixes #1189 Signed-off-by: Peter Somogyvari --- .cspell.json | 11 +- .eslintignore | 2 + .../package.json | 1 - .../package.json | 1 - package.json | 3 +- packages/cactus-cmd-api-server/package.json | 8 +- .../openapi/.openapi-generator-ignore | 23 ++ .../openapi/.openapi-generator/FILES | 5 + .../openapi/.openapi-generator/VERSION | 1 + .../main/proto/generated/openapi/README.md | 31 ++ .../models/health_check_response.proto | 25 ++ .../openapi/models/memory_usage.proto | 28 ++ .../openapi/models/watch_healthcheck_v1.proto | 18 ++ .../openapi/services/default_service.proto | 28 ++ .../src/main/typescript/api-server.ts | 81 ++++- .../main/typescript/config/config-service.ts | 22 ++ .../models/health_check_response_grpc_pb.js | 1 + .../models/health_check_response_pb.d.ts | 37 +++ .../models/health_check_response_pb.js | 253 +++++++++++++++ .../models/memory_usage_grpc_pb.js | 1 + .../protoc-gen-ts/models/memory_usage_pb.d.ts | 39 +++ .../protoc-gen-ts/models/memory_usage_pb.js | 290 ++++++++++++++++++ .../models/watch_healthcheck_v1_grpc_pb.js | 1 + .../models/watch_healthcheck_v1_pb.d.ts | 24 ++ .../models/watch_healthcheck_v1_pb.js | 141 +++++++++ .../services/default_service_grpc_pb.d.ts | 60 ++++ .../services/default_service_grpc_pb.js | 78 +++++ .../services/default_service_pb.d.ts | 29 ++ .../services/default_service_pb.js | 174 +++++++++++ .../src/main/typescript/public-api.ts | 22 ++ .../grpc/grpc-server-api-server.ts | 41 +++ ...js-proto-loader-client-healthcheck.test.ts | 92 ++++++ ...pc-proto-gen-ts-client-healthcheck.test.ts | 80 +++++ packages/cactus-cmd-api-server/tsconfig.json | 2 +- yarn.lock | 100 ++++-- 35 files changed, 1707 insertions(+), 46 deletions(-) create mode 100644 packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator-ignore create mode 100644 packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/FILES create mode 100644 packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/VERSION create mode 100644 packages/cactus-cmd-api-server/src/main/proto/generated/openapi/README.md create mode 100644 packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/health_check_response.proto create mode 100644 packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/memory_usage.proto create mode 100644 packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/watch_healthcheck_v1.proto create mode 100644 packages/cactus-cmd-api-server/src/main/proto/generated/openapi/services/default_service.proto create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_grpc_pb.js create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_pb.d.ts create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_pb.js create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_grpc_pb.js create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_pb.d.ts create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_pb.js create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_grpc_pb.js create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_pb.d.ts create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_pb.js create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_grpc_pb.d.ts create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_grpc_pb.js create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_pb.d.ts create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_pb.js create mode 100644 packages/cactus-cmd-api-server/src/main/typescript/web-services/grpc/grpc-server-api-server.ts create mode 100644 packages/cactus-cmd-api-server/src/test/typescript/integration/grpc-js-proto-loader-client-healthcheck.test.ts create mode 100644 packages/cactus-cmd-api-server/src/test/typescript/integration/grpc-proto-gen-ts-client-healthcheck.test.ts diff --git a/.cspell.json b/.cspell.json index ebfbb6dcbbc..0622c25a961 100644 --- a/.cspell.json +++ b/.cspell.json @@ -36,6 +36,7 @@ "gopath", "grpc", "grpcs", + "grpcwebtext", "hashicorp", "Healthcheck", "HTLC", @@ -68,10 +69,17 @@ "NODETXPOOLACK", "notok", "Oidc", + "oneofs", "onsi", "OpenAPI", "openethereum", "organisation", + "parameterizable", + "pbjs", + "pbts", + "proto", + "protobuf", + "protoc", "protos", "RUSTC", "Secp", @@ -91,8 +99,7 @@ "uuidv", "vscc", "wasm", - "Xdai", - "parameterizable" + "Xdai" ], "dictionaries": [ "typescript,node,npm,go,rust" diff --git a/.eslintignore b/.eslintignore index cd9187a3096..b1945136b6a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -14,3 +14,5 @@ # **/coverage/** # typings/** + +**/src/main/typescript/generated/proto/** diff --git a/examples/cactus-example-carbon-accounting-frontend/package.json b/examples/cactus-example-carbon-accounting-frontend/package.json index c85d86eae0d..ad5c0d3a01b 100644 --- a/examples/cactus-example-carbon-accounting-frontend/package.json +++ b/examples/cactus-example-carbon-accounting-frontend/package.json @@ -44,7 +44,6 @@ "@angular/compiler-cli": "12.1.1", "@angular/language-service": "12.1.1", "@ionic/angular-toolkit": "2.3.0", - "@types/jasminewd2": "2.0.3", "@types/node": "12.11.1", "codelyzer": "6.0.2", "jasmine-core": "3.6.0", diff --git a/examples/cactus-example-supply-chain-frontend/package.json b/examples/cactus-example-supply-chain-frontend/package.json index 43a14b2b621..1f077526231 100644 --- a/examples/cactus-example-supply-chain-frontend/package.json +++ b/examples/cactus-example-supply-chain-frontend/package.json @@ -45,7 +45,6 @@ "@angular/compiler-cli": "12.1.1", "@angular/language-service": "12.1.1", "@ionic/angular-toolkit": "2.3.0", - "@types/jasminewd2": "2.0.3", "@types/node": "12.11.1", "codelyzer": "6.0.2", "jasmine-core": "3.6.0", diff --git a/package.json b/package.json index 731766fce72..66d34e077cc 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "@commitlint/config-conventional": "8.0.0", "@openapitools/openapi-generator-cli": "2.3.3", "@types/fs-extra": "9.0.11", - "@types/jasminewd2": "2.0.10", "@types/node-fetch": "2.5.4", "@types/tape": "4.13.0", "@types/tape-promise": "4.0.1", @@ -100,6 +99,8 @@ "fs-extra": "10.0.0", "git-cz": "4.7.6", "globby": "10.0.2", + "grpc-tools": "1.11.2", + "grpc_tools_node_protoc_ts": "5.3.1", "husky": "4.2.5", "inquirer": "8.1.1", "json5": "2.2.0", diff --git a/packages/cactus-cmd-api-server/package.json b/packages/cactus-cmd-api-server/package.json index 18de8646b58..e4c0cdb5e1d 100644 --- a/packages/cactus-cmd-api-server/package.json +++ b/packages/cactus-cmd-api-server/package.json @@ -10,10 +10,13 @@ "browser": "dist/cactus-cmd-api-server.web.umd.js", "browserMinified": "dist/cactus-cmd-api-server.web.umd.min.js", "module": "dist/lib/main/typescript/index.js", - "types": "dist/types/main/typescript/index.d.ts", + "types": "dist/lib/main/typescript/index.d.ts", "scripts": { "generate-sdk": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected", "codegen:openapi": "npm run generate-sdk", + "proto:openapi": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g protobuf-schema --additional-properties=packageName=org.hyperledger.cactus.cmd_api_server -o ./src/main/proto/generated/openapi/", + "proto:protoc-gen-ts": "yarn run grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --js_out=import_style=commonjs,binary:./src/main/typescript/generated/proto/protoc-gen-ts/ --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --grpc_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --proto_path ./src/main/proto/generated/openapi/ --proto_path ./src/main/proto/generated/openapi/models/ --proto_path ./src/main/proto/generated/openapi/services/ ./src/main/proto/generated/openapi/models/*.proto ./src/main/proto/generated/openapi/services/*.proto", + "codegen:proto": "run-s proto:openapi proto:protoc-gen-ts", "codegen": "run-p 'codegen:*'", "watch": "npm-watch", "webpack": "npm-run-all webpack:dev webpack:prod", @@ -72,6 +75,8 @@ }, "homepage": "https://github.com/hyperledger/cactus#readme", "dependencies": { + "@grpc/grpc-js": "1.3.6", + "@grpc/proto-loader": "0.6.4", "@hyperledger/cactus-common": "0.7.0", "@hyperledger/cactus-core": "0.7.0", "@hyperledger/cactus-core-api": "0.7.0", @@ -108,6 +113,7 @@ "@types/express": "4.17.8", "@types/express-http-proxy": "1.6.1", "@types/express-jwt": "6.0.1", + "@types/google-protobuf": "3.15.3", "@types/jsonwebtoken": "8.5.1", "@types/multer": "1.4.5", "@types/node-forge": "0.9.3", diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator-ignore b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/FILES b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/FILES new file mode 100644 index 00000000000..9e4946535e6 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/FILES @@ -0,0 +1,5 @@ +README.md +models/health_check_response.proto +models/memory_usage.proto +models/watch_healthcheck_v1.proto +services/default_service.proto diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/VERSION b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/VERSION new file mode 100644 index 00000000000..3bff059174b --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.1.1 \ No newline at end of file diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/README.md b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/README.md new file mode 100644 index 00000000000..e8f8c7b3554 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/README.md @@ -0,0 +1,31 @@ +# gPRC for org.hyperledger.cactus.cmd_api_server + +Interact with a Cactus deployment through HTTP. + +## Overview +These files were generated by the [OpenAPI Generator](https://openapi-generator.tech) project. + +- API version: 0.0.1 +- Package version: +- Build package: org.openapitools.codegen.languages.ProtobufSchemaCodegen + +## Usage + +Below are some usage examples for Go and Ruby. For other languages, please refer to https://grpc.io/docs/quickstart/. + +### Go +``` +# assuming `protoc-gen-go` has been installed with `go get -u github.com/golang/protobuf/protoc-gen-go` +mkdir /var/tmp/go/ +protoc --go_out=/var/tmp/go/ services/* +protoc --go_out=/var/tmp/go/ models/* +``` + +### Ruby +``` +# assuming `grpc_tools_ruby_protoc` has been installed via `gem install grpc-tools` +RUBY_OUTPUT_DIR="/var/tmp/ruby/org.hyperledger.cactus.cmd_api_server" +mkdir $RUBY_OUTPUT_DIR +grpc_tools_ruby_protoc --ruby_out=$RUBY_OUTPUT_DIR --grpc_out=$RUBY_OUTPUT_DIR/lib services/* +grpc_tools_ruby_protoc --ruby_out=$RUBY_OUTPUT_DIR --grpc_out=$RUBY_OUTPUT_DIR/lib models/* +``` diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/health_check_response.proto b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/health_check_response.proto new file mode 100644 index 00000000000..1ead649f08e --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/health_check_response.proto @@ -0,0 +1,25 @@ +/* + Hyperledger Cactus API + + Interact with a Cactus deployment through HTTP. + + The version of the OpenAPI document: 0.0.1 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cactus.cmd_api_server; + +import public "models/memory_usage.proto"; + +message HealthCheckResponse { + + bool success = 256557056; + + string createdAt = 61500732; + + MemoryUsage memoryUsage = 335792418; + +} diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/memory_usage.proto b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/memory_usage.proto new file mode 100644 index 00000000000..e66e4464032 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/memory_usage.proto @@ -0,0 +1,28 @@ +/* + Hyperledger Cactus API + + Interact with a Cactus deployment through HTTP. + + The version of the OpenAPI document: 0.0.1 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cactus.cmd_api_server; + + +message MemoryUsage { + + float rss = 113234; + + float heapTotal = 114487480; + + float heapUsed = 30910521; + + float external = 210148408; + + float arrayBuffers = 116952168; + +} diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/watch_healthcheck_v1.proto b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/watch_healthcheck_v1.proto new file mode 100644 index 00000000000..f0b0fcbbb99 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/watch_healthcheck_v1.proto @@ -0,0 +1,18 @@ +/* + Hyperledger Cactus API + + Interact with a Cactus deployment through HTTP. + + The version of the OpenAPI document: 0.0.1 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cactus.cmd_api_server; + + +message WatchHealthcheckV1 { + +} diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/services/default_service.proto b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/services/default_service.proto new file mode 100644 index 00000000000..6a6396640b3 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/services/default_service.proto @@ -0,0 +1,28 @@ +/* + Hyperledger Cactus API + + Interact with a Cactus deployment through HTTP. + + The version of the OpenAPI document: 0.0.1 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cactus.cmd_api_server; + +import "google/protobuf/empty.proto"; +import public "models/health_check_response.proto"; + +service DefaultService { + rpc GetHealthCheckV1 (google.protobuf.Empty) returns (HealthCheckResponse); + + rpc GetPrometheusMetricsV1 (google.protobuf.Empty) returns (GetPrometheusMetricsV1Response); + +} + +message GetPrometheusMetricsV1Response { + string data = 1; +} + diff --git a/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts b/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts index 31c31b07985..72c840ba553 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts @@ -4,9 +4,11 @@ import tls from "tls"; import { Server, createServer } from "http"; import type { Server as SecureServer } from "https"; import { createServer as createSecureServer } from "https"; +import { RuntimeError } from "run-time-error"; import { gte } from "semver"; import npm from "npm"; import expressHttpProxy from "express-http-proxy"; +import { Server as GrpcServer } from "@grpc/grpc-js"; import type { Application, Request, Response, RequestHandler } from "express"; import express from "express"; import { OpenApiValidator } from "express-openapi-validator"; @@ -41,14 +43,18 @@ import { PrometheusExporter } from "./prometheus-exporter/prometheus-exporter"; import { AuthorizerFactory } from "./authzn/authorizer-factory"; import { WatchHealthcheckV1 } from "./generated/openapi/typescript-axios"; import { WatchHealthcheckV1Endpoint } from "./web-services/watch-healthcheck-v1-endpoint"; +import { DefaultServiceService } from "./generated/proto/protoc-gen-ts/services/default_service_grpc_pb"; +import { GrpcServerApiServer } from "./web-services/grpc/grpc-server-api-server"; + export interface IApiServerConstructorOptions { - pluginRegistry?: PluginRegistry; - httpServerApi?: Server | SecureServer; - wsServerApi?: SocketIoServer; - wsOptions?: SocketIoServerOptions; - httpServerCockpit?: Server | SecureServer; - config: ICactusApiServerOptions; - prometheusExporter?: PrometheusExporter; + readonly pluginRegistry?: PluginRegistry; + readonly httpServerApi?: Server | SecureServer; + readonly wsServerApi?: SocketIoServer; + readonly grpcServer?: GrpcServer; + readonly wsOptions?: SocketIoServerOptions; + readonly httpServerCockpit?: Server | SecureServer; + readonly config: ICactusApiServerOptions; + readonly prometheusExporter?: PrometheusExporter; } export class ApiServer { @@ -69,6 +75,7 @@ export class ApiServer { private readonly httpServerApi: Server | SecureServer; private readonly httpServerCockpit: Server | SecureServer; private readonly wsApi: SocketIoServer; + private readonly grpcServer: GrpcServer; private readonly expressApi: Application; private readonly expressCockpit: Application; public prometheusExporter: PrometheusExporter; @@ -109,6 +116,7 @@ export class ApiServer { this.httpServerCockpit = createServer(); } + this.grpcServer = this.options.grpcServer || new GrpcServer({}); this.wsApi = new SocketIoServer(); this.expressApi = express(); this.expressCockpit = express(); @@ -146,6 +154,7 @@ export class ApiServer { async start(): Promise<{ addressInfoCockpit: AddressInfo; addressInfoApi: AddressInfo; + addressInfoGrpc: AddressInfo; }> { this.checkNodeVersion(); const tlsMaxVersion = this.options.config.tlsDefaultMaxVersion; @@ -156,6 +165,13 @@ export class ApiServer { const { cockpitTlsEnabled, apiTlsEnabled } = this.options.config; const addressInfoCockpit = await this.startCockpitFileServer(); const addressInfoApi = await this.startApiServer(); + const addressInfoGrpc = await this.startGrpcServer(); + + { + const { port, address } = addressInfoGrpc; + const grpcUrl = `${address}:${port}`; + this.log.info(`Cactus gRPC reachable ${grpcUrl}`); + } { const { apiHost: host } = this.options.config; @@ -173,7 +189,7 @@ export class ApiServer { this.log.info(`Cactus Cockpit reachable ${httpUrl}`); } - return { addressInfoCockpit, addressInfoApi }; + return { addressInfoCockpit, addressInfoApi, addressInfoGrpc }; } catch (ex) { const errorMessage = `Failed to start ApiServer: ${ex.stack}`; this.log.error(errorMessage); @@ -353,6 +369,21 @@ export class ApiServer { await Servers.shutdown(this.httpServerCockpit); this.log.info(`Close HTTP server of the cockpit OK`); } + + if (this.grpcServer) { + this.log.info(`Closing gRPC server ...`); + await new Promise((resolve, reject) => { + this.grpcServer.tryShutdown((ex?: Error) => { + if (ex) { + this.log.error("Failed to shut down gRPC server: ", ex); + reject(ex); + } else { + resolve(); + } + }); + }); + this.log.info(`Close gRPC server OK`); + } } async startCockpitFileServer(): Promise { @@ -486,6 +517,40 @@ export class ApiServer { ); } + async startGrpcServer(): Promise { + return new Promise((resolve, reject) => { + // const grpcHost = "0.0.0.0"; // FIXME - make this configurable (config-service.ts) + const grpcHost = "127.0.0.1"; // FIXME - make this configurable (config-service.ts) + const grpcHostAndPort = `${grpcHost}:${this.options.config.grpcPort}`; + this.grpcServer.bindAsync( + grpcHostAndPort, + { + // FIXME - implement _getSettings properly + _getSettings: () => { + return null; + // const settings: SecureServerOptions = {}; + // return settings; + }, + _isSecure: () => this.options.config.grpcTlsEnabled, + }, + (error: Error | null, port: number) => { + if (error) { + reject(new RuntimeError("Start the gRPC server failed: ", error)); + return; + } + this.grpcServer.addService( + DefaultServiceService, + new GrpcServerApiServer(), + ); + this.grpcServer.start(); + // FIXME - ensure family is set correctly to v4 or v6 depending on + // the host address' family (there must be some library to parse it) + resolve({ address: grpcHost, port, family: "// FIXME" }); + }, + ); + }); + } + async startApiServer(): Promise { const { options, expressApi: app, wsApi } = this; const { config } = options; diff --git a/packages/cactus-cmd-api-server/src/main/typescript/config/config-service.ts b/packages/cactus-cmd-api-server/src/main/typescript/config/config-service.ts index ebabfed631c..c78afa0427b 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/config/config-service.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/config/config-service.ts @@ -51,6 +51,8 @@ export interface ICactusApiServerOptions { apiTlsCertPem: string; apiTlsKeyPem: string; apiTlsClientCaPem: string; + grpcPort: number; + grpcTlsEnabled: boolean; plugins: PluginImport[]; keyPairPem: string; keychainSuffixKeyPairPem: string; @@ -348,6 +350,22 @@ export class ConfigService { arg: "api-tls-key-pem", default: null as string | null, }, + grpcPort: { + doc: "The gRPC port to serve web services on.", + format: "port", + env: "GRPC_PORT", + arg: "grpc-port", + default: 5000, + }, + grpcTlsEnabled: { + doc: + "Enable TLS termination on the grpc server. Useful if you do not have/want to " + + "have a reverse proxy or load balancer doing the SSL/TLS termination in your environment.", + format: Boolean, + env: "GRPC_TLS_ENABLED", + arg: "grpc-tls-enabled", + default: true, + }, keyPairPem: { sensitive: true, doc: @@ -436,6 +454,8 @@ export class ConfigService { const apiPort = (schema.apiPort as SchemaObj).default; const apiProtocol = apiTlsEnabled ? "https:" : "http"; const apiBaseUrl = `${apiProtocol}//${apiHost}:${apiPort}`; + const grpcPort = (schema.grpcPort as SchemaObj).default; + const grpcTlsEnabled = (schema.grpcTlsEnabled as SchemaObj).default; const keyPair = JWK.generateSync("EC", "secp256k1", { use: "sig" }, true); const keyPairPem = keyPair.toPEM(true); @@ -535,6 +555,8 @@ export class ConfigService { apiTlsCertPem: pkiServer.certificatePem, apiTlsKeyPem: pkiServer.privateKeyPem, apiTlsClientCaPem: "-", // API mTLS is off so this will not crash the server + grpcPort, + grpcTlsEnabled, cockpitHost, cockpitPort, cockpitWwwRoot: (schema.cockpitWwwRoot as SchemaObj).default, diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_grpc_pb.js b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_grpc_pb.js new file mode 100644 index 00000000000..97b3a2461db --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_pb.d.ts b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_pb.d.ts new file mode 100644 index 00000000000..c8e42af1ae4 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_pb.d.ts @@ -0,0 +1,37 @@ +// package: org.hyperledger.cactus.cmd_api_server +// file: models/health_check_response.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as models_memory_usage_pb from "../models/memory_usage_pb"; + +export class HealthCheckResponse extends jspb.Message { + getSuccess(): boolean; + setSuccess(value: boolean): HealthCheckResponse; + getCreatedat(): string; + setCreatedat(value: string): HealthCheckResponse; + + hasMemoryusage(): boolean; + clearMemoryusage(): void; + getMemoryusage(): models_memory_usage_pb.MemoryUsage | undefined; + setMemoryusage(value?: models_memory_usage_pb.MemoryUsage): HealthCheckResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): HealthCheckResponse.AsObject; + static toObject(includeInstance: boolean, msg: HealthCheckResponse): HealthCheckResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: HealthCheckResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): HealthCheckResponse; + static deserializeBinaryFromReader(message: HealthCheckResponse, reader: jspb.BinaryReader): HealthCheckResponse; +} + +export namespace HealthCheckResponse { + export type AsObject = { + success: boolean, + createdat: string, + memoryusage?: models_memory_usage_pb.MemoryUsage.AsObject, + } +} diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_pb.js b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_pb.js new file mode 100644 index 00000000000..1f88179fd5f --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_pb.js @@ -0,0 +1,253 @@ +// source: models/health_check_response.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var models_memory_usage_pb = require('../models/memory_usage_pb.js'); +goog.object.extend(proto, models_memory_usage_pb); +goog.exportSymbol('proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, null, null); +}; +goog.inherits(proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.displayName = 'proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.toObject = function(opt_includeInstance) { + return proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.toObject = function(includeInstance, msg) { + var f, obj = { + success: jspb.Message.getBooleanFieldWithDefault(msg, 256557056, false), + createdat: jspb.Message.getFieldWithDefault(msg, 61500732, ""), + memoryusage: (f = msg.getMemoryusage()) && models_memory_usage_pb.MemoryUsage.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse} + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse; + return proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse} + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 256557056: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSuccess(value); + break; + case 61500732: + var value = /** @type {string} */ (reader.readString()); + msg.setCreatedat(value); + break; + case 335792418: + var value = new models_memory_usage_pb.MemoryUsage; + reader.readMessage(value,models_memory_usage_pb.MemoryUsage.deserializeBinaryFromReader); + msg.setMemoryusage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSuccess(); + if (f) { + writer.writeBool( + 256557056, + f + ); + } + f = message.getCreatedat(); + if (f.length > 0) { + writer.writeString( + 61500732, + f + ); + } + f = message.getMemoryusage(); + if (f != null) { + writer.writeMessage( + 335792418, + f, + models_memory_usage_pb.MemoryUsage.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bool success = 256557056; + * @return {boolean} + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.getSuccess = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 256557056, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse} returns this + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.setSuccess = function(value) { + return jspb.Message.setProto3BooleanField(this, 256557056, value); +}; + + +/** + * optional string createdAt = 61500732; + * @return {string} + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.getCreatedat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 61500732, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse} returns this + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.setCreatedat = function(value) { + return jspb.Message.setProto3StringField(this, 61500732, value); +}; + + +/** + * optional MemoryUsage memoryUsage = 335792418; + * @return {?proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.getMemoryusage = function() { + return /** @type{?proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} */ ( + jspb.Message.getWrapperField(this, models_memory_usage_pb.MemoryUsage, 335792418)); +}; + + +/** + * @param {?proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage|undefined} value + * @return {!proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse} returns this +*/ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.setMemoryusage = function(value) { + return jspb.Message.setWrapperField(this, 335792418, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse} returns this + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.clearMemoryusage = function() { + return this.setMemoryusage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.org.hyperledger.cactus.cmd_api_server.HealthCheckResponse.prototype.hasMemoryusage = function() { + return jspb.Message.getField(this, 335792418) != null; +}; + + +goog.object.extend(exports, proto.org.hyperledger.cactus.cmd_api_server); diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_grpc_pb.js b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_grpc_pb.js new file mode 100644 index 00000000000..97b3a2461db --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_pb.d.ts b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_pb.d.ts new file mode 100644 index 00000000000..68cb81c5999 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_pb.d.ts @@ -0,0 +1,39 @@ +// package: org.hyperledger.cactus.cmd_api_server +// file: models/memory_usage.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class MemoryUsage extends jspb.Message { + getRss(): number; + setRss(value: number): MemoryUsage; + getHeaptotal(): number; + setHeaptotal(value: number): MemoryUsage; + getHeapused(): number; + setHeapused(value: number): MemoryUsage; + getExternal(): number; + setExternal(value: number): MemoryUsage; + getArraybuffers(): number; + setArraybuffers(value: number): MemoryUsage; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MemoryUsage.AsObject; + static toObject(includeInstance: boolean, msg: MemoryUsage): MemoryUsage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MemoryUsage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MemoryUsage; + static deserializeBinaryFromReader(message: MemoryUsage, reader: jspb.BinaryReader): MemoryUsage; +} + +export namespace MemoryUsage { + export type AsObject = { + rss: number, + heaptotal: number, + heapused: number, + external: number, + arraybuffers: number, + } +} diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_pb.js b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_pb.js new file mode 100644 index 00000000000..81883d96675 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/memory_usage_pb.js @@ -0,0 +1,290 @@ +// source: models/memory_usage.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, null, null); +}; +goog.inherits(proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.displayName = 'proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.toObject = function(opt_includeInstance) { + return proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.toObject = function(includeInstance, msg) { + var f, obj = { + rss: jspb.Message.getFloatingPointFieldWithDefault(msg, 113234, 0.0), + heaptotal: jspb.Message.getFloatingPointFieldWithDefault(msg, 114487480, 0.0), + heapused: jspb.Message.getFloatingPointFieldWithDefault(msg, 30910521, 0.0), + external: jspb.Message.getFloatingPointFieldWithDefault(msg, 210148408, 0.0), + arraybuffers: jspb.Message.getFloatingPointFieldWithDefault(msg, 116952168, 0.0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage; + return proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 113234: + var value = /** @type {number} */ (reader.readFloat()); + msg.setRss(value); + break; + case 114487480: + var value = /** @type {number} */ (reader.readFloat()); + msg.setHeaptotal(value); + break; + case 30910521: + var value = /** @type {number} */ (reader.readFloat()); + msg.setHeapused(value); + break; + case 210148408: + var value = /** @type {number} */ (reader.readFloat()); + msg.setExternal(value); + break; + case 116952168: + var value = /** @type {number} */ (reader.readFloat()); + msg.setArraybuffers(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getRss(); + if (f !== 0.0) { + writer.writeFloat( + 113234, + f + ); + } + f = message.getHeaptotal(); + if (f !== 0.0) { + writer.writeFloat( + 114487480, + f + ); + } + f = message.getHeapused(); + if (f !== 0.0) { + writer.writeFloat( + 30910521, + f + ); + } + f = message.getExternal(); + if (f !== 0.0) { + writer.writeFloat( + 210148408, + f + ); + } + f = message.getArraybuffers(); + if (f !== 0.0) { + writer.writeFloat( + 116952168, + f + ); + } +}; + + +/** + * optional float rss = 113234; + * @return {number} + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.getRss = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 113234, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} returns this + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.setRss = function(value) { + return jspb.Message.setProto3FloatField(this, 113234, value); +}; + + +/** + * optional float heapTotal = 114487480; + * @return {number} + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.getHeaptotal = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 114487480, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} returns this + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.setHeaptotal = function(value) { + return jspb.Message.setProto3FloatField(this, 114487480, value); +}; + + +/** + * optional float heapUsed = 30910521; + * @return {number} + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.getHeapused = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 30910521, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} returns this + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.setHeapused = function(value) { + return jspb.Message.setProto3FloatField(this, 30910521, value); +}; + + +/** + * optional float external = 210148408; + * @return {number} + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.getExternal = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 210148408, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} returns this + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.setExternal = function(value) { + return jspb.Message.setProto3FloatField(this, 210148408, value); +}; + + +/** + * optional float arrayBuffers = 116952168; + * @return {number} + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.getArraybuffers = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 116952168, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage} returns this + */ +proto.org.hyperledger.cactus.cmd_api_server.MemoryUsage.prototype.setArraybuffers = function(value) { + return jspb.Message.setProto3FloatField(this, 116952168, value); +}; + + +goog.object.extend(exports, proto.org.hyperledger.cactus.cmd_api_server); diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_grpc_pb.js b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_grpc_pb.js new file mode 100644 index 00000000000..97b3a2461db --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_pb.d.ts b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_pb.d.ts new file mode 100644 index 00000000000..2fbe407888b --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_pb.d.ts @@ -0,0 +1,24 @@ +// package: org.hyperledger.cactus.cmd_api_server +// file: models/watch_healthcheck_v1.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class WatchHealthcheckV1 extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WatchHealthcheckV1.AsObject; + static toObject(includeInstance: boolean, msg: WatchHealthcheckV1): WatchHealthcheckV1.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: WatchHealthcheckV1, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WatchHealthcheckV1; + static deserializeBinaryFromReader(message: WatchHealthcheckV1, reader: jspb.BinaryReader): WatchHealthcheckV1; +} + +export namespace WatchHealthcheckV1 { + export type AsObject = { + } +} diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_pb.js b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_pb.js new file mode 100644 index 00000000000..881cf066778 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_healthcheck_v1_pb.js @@ -0,0 +1,141 @@ +// source: models/watch_healthcheck_v1.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.displayName = 'proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.prototype.toObject = function(opt_includeInstance) { + return proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1} + */ +proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1; + return proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1} + */ +proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.hyperledger.cactus.cmd_api_server.WatchHealthcheckV1.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + +goog.object.extend(exports, proto.org.hyperledger.cactus.cmd_api_server); diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_grpc_pb.d.ts b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_grpc_pb.d.ts new file mode 100644 index 00000000000..5a7face8552 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_grpc_pb.d.ts @@ -0,0 +1,60 @@ +// package: org.hyperledger.cactus.cmd_api_server +// file: services/default_service.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "@grpc/grpc-js"; +import * as services_default_service_pb from "../services/default_service_pb"; +import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb"; +import * as models_health_check_response_pb from "../models/health_check_response_pb"; + +interface IDefaultServiceService extends grpc.ServiceDefinition { + getHealthCheckV1: IDefaultServiceService_IGetHealthCheckV1; + getPrometheusMetricsV1: IDefaultServiceService_IGetPrometheusMetricsV1; +} + +interface IDefaultServiceService_IGetHealthCheckV1 extends grpc.MethodDefinition { + path: "/org.hyperledger.cactus.cmd_api_server.DefaultService/GetHealthCheckV1"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IDefaultServiceService_IGetPrometheusMetricsV1 extends grpc.MethodDefinition { + path: "/org.hyperledger.cactus.cmd_api_server.DefaultService/GetPrometheusMetricsV1"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const DefaultServiceService: IDefaultServiceService; + +export interface IDefaultServiceServer extends grpc.UntypedServiceImplementation { + getHealthCheckV1: grpc.handleUnaryCall; + getPrometheusMetricsV1: grpc.handleUnaryCall; +} + +export interface IDefaultServiceClient { + getHealthCheckV1(request: google_protobuf_empty_pb.Empty, callback: (error: grpc.ServiceError | null, response: models_health_check_response_pb.HealthCheckResponse) => void): grpc.ClientUnaryCall; + getHealthCheckV1(request: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: models_health_check_response_pb.HealthCheckResponse) => void): grpc.ClientUnaryCall; + getHealthCheckV1(request: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: models_health_check_response_pb.HealthCheckResponse) => void): grpc.ClientUnaryCall; + getPrometheusMetricsV1(request: google_protobuf_empty_pb.Empty, callback: (error: grpc.ServiceError | null, response: services_default_service_pb.GetPrometheusMetricsV1Response) => void): grpc.ClientUnaryCall; + getPrometheusMetricsV1(request: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: services_default_service_pb.GetPrometheusMetricsV1Response) => void): grpc.ClientUnaryCall; + getPrometheusMetricsV1(request: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: services_default_service_pb.GetPrometheusMetricsV1Response) => void): grpc.ClientUnaryCall; +} + +export class DefaultServiceClient extends grpc.Client implements IDefaultServiceClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public getHealthCheckV1(request: google_protobuf_empty_pb.Empty, callback: (error: grpc.ServiceError | null, response: models_health_check_response_pb.HealthCheckResponse) => void): grpc.ClientUnaryCall; + public getHealthCheckV1(request: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: models_health_check_response_pb.HealthCheckResponse) => void): grpc.ClientUnaryCall; + public getHealthCheckV1(request: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: models_health_check_response_pb.HealthCheckResponse) => void): grpc.ClientUnaryCall; + public getPrometheusMetricsV1(request: google_protobuf_empty_pb.Empty, callback: (error: grpc.ServiceError | null, response: services_default_service_pb.GetPrometheusMetricsV1Response) => void): grpc.ClientUnaryCall; + public getPrometheusMetricsV1(request: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: services_default_service_pb.GetPrometheusMetricsV1Response) => void): grpc.ClientUnaryCall; + public getPrometheusMetricsV1(request: google_protobuf_empty_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: services_default_service_pb.GetPrometheusMetricsV1Response) => void): grpc.ClientUnaryCall; +} diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_grpc_pb.js b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_grpc_pb.js new file mode 100644 index 00000000000..2d192e71b81 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_grpc_pb.js @@ -0,0 +1,78 @@ +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// +// Hyperledger Cactus API +// +// Interact with a Cactus deployment through HTTP. +// +// The version of the OpenAPI document: 0.0.1 +// +// Generated by OpenAPI Generator: https://openapi-generator.tech +// +'use strict'; +var grpc = require('@grpc/grpc-js'); +var services_default_service_pb = require('../services/default_service_pb.js'); +var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js'); +var models_health_check_response_pb = require('../models/health_check_response_pb.js'); + +function serialize_google_protobuf_Empty(arg) { + if (!(arg instanceof google_protobuf_empty_pb.Empty)) { + throw new Error('Expected argument of type google.protobuf.Empty'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_google_protobuf_Empty(buffer_arg) { + return google_protobuf_empty_pb.Empty.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_org_hyperledger_cactus_cmd_api_server_GetPrometheusMetricsV1Response(arg) { + if (!(arg instanceof services_default_service_pb.GetPrometheusMetricsV1Response)) { + throw new Error('Expected argument of type org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_org_hyperledger_cactus_cmd_api_server_GetPrometheusMetricsV1Response(buffer_arg) { + return services_default_service_pb.GetPrometheusMetricsV1Response.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_org_hyperledger_cactus_cmd_api_server_HealthCheckResponse(arg) { + if (!(arg instanceof models_health_check_response_pb.HealthCheckResponse)) { + throw new Error('Expected argument of type org.hyperledger.cactus.cmd_api_server.HealthCheckResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_org_hyperledger_cactus_cmd_api_server_HealthCheckResponse(buffer_arg) { + return models_health_check_response_pb.HealthCheckResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +var DefaultServiceService = exports.DefaultServiceService = { + getHealthCheckV1: { + path: '/org.hyperledger.cactus.cmd_api_server.DefaultService/GetHealthCheckV1', + requestStream: false, + responseStream: false, + requestType: google_protobuf_empty_pb.Empty, + responseType: models_health_check_response_pb.HealthCheckResponse, + requestSerialize: serialize_google_protobuf_Empty, + requestDeserialize: deserialize_google_protobuf_Empty, + responseSerialize: serialize_org_hyperledger_cactus_cmd_api_server_HealthCheckResponse, + responseDeserialize: deserialize_org_hyperledger_cactus_cmd_api_server_HealthCheckResponse, + }, + getPrometheusMetricsV1: { + path: '/org.hyperledger.cactus.cmd_api_server.DefaultService/GetPrometheusMetricsV1', + requestStream: false, + responseStream: false, + requestType: google_protobuf_empty_pb.Empty, + responseType: services_default_service_pb.GetPrometheusMetricsV1Response, + requestSerialize: serialize_google_protobuf_Empty, + requestDeserialize: deserialize_google_protobuf_Empty, + responseSerialize: serialize_org_hyperledger_cactus_cmd_api_server_GetPrometheusMetricsV1Response, + responseDeserialize: deserialize_org_hyperledger_cactus_cmd_api_server_GetPrometheusMetricsV1Response, + }, +}; + +exports.DefaultServiceClient = grpc.makeGenericClientConstructor(DefaultServiceService); diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_pb.d.ts b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_pb.d.ts new file mode 100644 index 00000000000..aa229bbb882 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_pb.d.ts @@ -0,0 +1,29 @@ +// package: org.hyperledger.cactus.cmd_api_server +// file: services/default_service.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb"; +import * as models_health_check_response_pb from "../models/health_check_response_pb"; + +export class GetPrometheusMetricsV1Response extends jspb.Message { + getData(): string; + setData(value: string): GetPrometheusMetricsV1Response; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetPrometheusMetricsV1Response.AsObject; + static toObject(includeInstance: boolean, msg: GetPrometheusMetricsV1Response): GetPrometheusMetricsV1Response.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetPrometheusMetricsV1Response, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetPrometheusMetricsV1Response; + static deserializeBinaryFromReader(message: GetPrometheusMetricsV1Response, reader: jspb.BinaryReader): GetPrometheusMetricsV1Response; +} + +export namespace GetPrometheusMetricsV1Response { + export type AsObject = { + data: string, + } +} diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_pb.js b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_pb.js new file mode 100644 index 00000000000..de199813586 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service_pb.js @@ -0,0 +1,174 @@ +// source: services/default_service.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js'); +goog.object.extend(proto, google_protobuf_empty_pb); +var models_health_check_response_pb = require('../models/health_check_response_pb.js'); +goog.object.extend(proto, models_health_check_response_pb); +goog.exportSymbol('proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.displayName = 'proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.prototype.toObject = function(opt_includeInstance) { + return proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.toObject = function(includeInstance, msg) { + var f, obj = { + data: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response} + */ +proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response; + return proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response} + */ +proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getData(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string data = 1; + * @return {string} + */ +proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.prototype.getData = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response} returns this + */ +proto.org.hyperledger.cactus.cmd_api_server.GetPrometheusMetricsV1Response.prototype.setData = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +goog.object.extend(exports, proto.org.hyperledger.cactus.cmd_api_server); diff --git a/packages/cactus-cmd-api-server/src/main/typescript/public-api.ts b/packages/cactus-cmd-api-server/src/main/typescript/public-api.ts index f2fdad000b1..65e7ade0575 100755 --- a/packages/cactus-cmd-api-server/src/main/typescript/public-api.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/public-api.ts @@ -32,3 +32,25 @@ export { } from "./authzn/authorizer-factory"; export { IAuthorizationConfig } from "./authzn/i-authorization-config"; export { AuthorizationProtocol } from "./config/authorization-protocol"; + +// export { HealthCheckResponse as HealthCheckResponsePb } from "./generated/proto/ts-proto/models/health_check_response"; +// export { HealthCheckResponse as HealthCheckResponsePb } from "./generated/proto/grpc-web/models/health_check_response_pb"; +// export { MemoryUsage as MemoryUsagePb } from "./generated/proto/grpc-web/models/memory_usage_pb"; +// export { MemoryUsage as MemoryUsagePb } from "./generated/proto/ts-proto/models/memory_usage"; + +// import * as TsProtoDefaultServiceImport from "./generated/proto/ts-proto/services/default_service"; +// export const TsProtoDefaultService = TsProtoDefaultServiceImport; + +// import * as x from "./generated/proto/grpc-web/services/default_service_pb_service"; +// import * as GrpcWebDefaultServicePbServiceImport from "./generated/proto/grpc-web/services/default_service_grpc_pb"; +// export const GrpcWebDefaultServicePbService = GrpcWebDefaultServicePbServiceImport; + +// const X = require("./generated/proto/grpc-web/services/default_service_grpc_pb"); + +// import * as DefaultServiceGrpcPb_ from "./generated/proto/grpc-web/services/default_service_grpc_pb"; +// export const DefaultServiceGrpcPb = DefaultServiceGrpcPb_; + +// export const Grpc = { +// TsProto: TsProtoDefaultServiceImport, +// GrpcWeb: GrpcWebDefaultServicePbServiceImport, +// }; diff --git a/packages/cactus-cmd-api-server/src/main/typescript/web-services/grpc/grpc-server-api-server.ts b/packages/cactus-cmd-api-server/src/main/typescript/web-services/grpc/grpc-server-api-server.ts new file mode 100644 index 00000000000..7d527d4ed12 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/web-services/grpc/grpc-server-api-server.ts @@ -0,0 +1,41 @@ +import { + ServerUnaryCall, + sendUnaryData, + UntypedHandleCall, +} from "@grpc/grpc-js"; +import { Empty } from "google-protobuf/google/protobuf/empty_pb"; +import { HealthCheckResponse } from "../../generated/proto/protoc-gen-ts/models/health_check_response_pb"; +import { MemoryUsage } from "../../generated/proto/protoc-gen-ts/models/memory_usage_pb"; +import { IDefaultServiceServer } from "../../generated/proto/protoc-gen-ts/services/default_service_grpc_pb"; +import { GetPrometheusMetricsV1Response } from "../../generated/proto/protoc-gen-ts/services/default_service_pb"; + +export class GrpcServerApiServer implements IDefaultServiceServer { + [name: string]: UntypedHandleCall; + + getHealthCheckV1( + call: ServerUnaryCall, + callback: sendUnaryData, + ): void { + const memoryUsage = new MemoryUsage(); + const mu = process.memoryUsage(); + memoryUsage.setHeaptotal(mu.heapTotal); + memoryUsage.setHeapused(mu.heapUsed); + memoryUsage.setRss(mu.rss); + memoryUsage.setExternal(mu.external); + memoryUsage.setArraybuffers(mu.arrayBuffers); + + const healthCheckResponse = new HealthCheckResponse(); + healthCheckResponse.setCreatedat(new Date().toJSON()); + healthCheckResponse.setSuccess(true); + healthCheckResponse.setMemoryusage(memoryUsage); + callback(null, healthCheckResponse); + } + + getPrometheusMetricsV1( + call: ServerUnaryCall, + callback: sendUnaryData, + ): void { + const res = new GetPrometheusMetricsV1Response(); + callback(null, res); + } +} diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/grpc-js-proto-loader-client-healthcheck.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/grpc-js-proto-loader-client-healthcheck.test.ts new file mode 100644 index 00000000000..f5ad3c99a94 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/grpc-js-proto-loader-client-healthcheck.test.ts @@ -0,0 +1,92 @@ +import test, { Test } from "tape-promise/tape"; +import path from "path"; + +import { LogLevelDesc } from "@hyperledger/cactus-common"; + +import { ApiServer, ConfigService } from "../../../main/typescript/public-api"; +import { AuthorizationProtocol } from "../../../main/typescript/public-api"; +import { ServiceClientConstructor } from "@grpc/grpc-js/build/src/make-client"; +import * as grpc from "@grpc/grpc-js"; +import * as protoLoader from "@grpc/proto-loader"; + +const testCase = "API server: runs gRPC web services"; +const logLevel: LogLevelDesc = "TRACE"; + +test(testCase, async (t: Test) => { + const configService = new ConfigService(); + const apiSrvOpts = configService.newExampleConfig(); + apiSrvOpts.authorizationProtocol = AuthorizationProtocol.NONE; + apiSrvOpts.configFile = ""; + apiSrvOpts.logLevel = logLevel; + apiSrvOpts.apiCorsDomainCsv = "*"; + apiSrvOpts.apiPort = 0; + apiSrvOpts.grpcPort = 0; + apiSrvOpts.cockpitPort = 0; + apiSrvOpts.grpcTlsEnabled = false; + apiSrvOpts.apiTlsEnabled = false; + apiSrvOpts.plugins = []; + const config = configService.newExampleConfigConvict(apiSrvOpts); + + const apiServer = new ApiServer({ + config: config.getProperties(), + }); + test.onFinish(async () => await apiServer.shutdown()); + + const startResponse = apiServer.start(); + await t.doesNotReject(startResponse, "start API server OK"); + t.ok(startResponse, "startResponse truthy OK"); + + const addressInfoApi = (await startResponse).addressInfoGrpc; + const { address, port } = addressInfoApi; + const grpcHostAndPort = `${address}:${port}`; + t.ok(grpcHostAndPort, "grpcHostAndPort truthy OK"); + + const PROTO_PATH = path.join( + __dirname, + "../../../main/proto/generated/openapi/services/default_service.proto", + ); + + const PROTO_INCLUDE_DIR = path.join( + __dirname, + "../../../main/proto/generated/openapi/", + ); + + const packageDefinition = await protoLoader.load(PROTO_PATH, { + includeDirs: [PROTO_INCLUDE_DIR], + keepCase: true, + longs: String, + enums: String, + defaults: true, + oneofs: true, + }); + + const grpcPkg = grpc.loadPackageDefinition(packageDefinition); + t.ok(grpcPkg, "grpcPkg truthy OK"); + + const DefaultService: ServiceClientConstructor = (grpcPkg as any).org + .hyperledger.cactus.cmd_api_server.DefaultService; + + t.ok(DefaultService, "DefaultService truthy OK"); + + const client = new DefaultService( + grpcHostAndPort, + grpc.credentials.createInsecure(), + ); + t.ok(client, "proto loaded client truthy OK"); + + const res1 = await new Promise((resolve, reject) => { + client.getHealthCheckV1( + {}, + (err: grpc.ServiceError | null, value?: unknown | undefined) => { + if (err) { + reject(err); + } else { + resolve(value); + } + }, + ); + }); + t.ok(res1, "res1 truthy OK"); + + t.end(); +}); diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/grpc-proto-gen-ts-client-healthcheck.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/grpc-proto-gen-ts-client-healthcheck.test.ts new file mode 100644 index 00000000000..d7747065278 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/grpc-proto-gen-ts-client-healthcheck.test.ts @@ -0,0 +1,80 @@ +import test, { Test } from "tape-promise/tape"; + +import * as grpc from "@grpc/grpc-js"; + +import { LogLevelDesc } from "@hyperledger/cactus-common"; + +import { ApiServer, ConfigService } from "../../../main/typescript/public-api"; +import { AuthorizationProtocol } from "../../../main/typescript/public-api"; +import { DefaultServiceClient } from "../../../main/typescript/generated/proto/protoc-gen-ts/services/default_service_grpc_pb"; +import { HealthCheckResponse } from "../../../main/typescript/generated/proto/protoc-gen-ts/models/health_check_response_pb"; +import { Empty } from "google-protobuf/google/protobuf/empty_pb"; + +const testCase = "API server: runs gRPC TS-proto web services"; +const logLevel: LogLevelDesc = "TRACE"; + +// Skipping this because it hangs due to a bug that is yet to be investigated. +test(testCase, async (t: Test) => { + const configService = new ConfigService(); + const apiSrvOpts = configService.newExampleConfig(); + apiSrvOpts.authorizationProtocol = AuthorizationProtocol.NONE; + apiSrvOpts.configFile = ""; + apiSrvOpts.logLevel = logLevel; + apiSrvOpts.apiCorsDomainCsv = "*"; + apiSrvOpts.apiPort = 0; + apiSrvOpts.grpcPort = 0; + apiSrvOpts.cockpitPort = 0; + apiSrvOpts.grpcTlsEnabled = false; + apiSrvOpts.apiTlsEnabled = false; + apiSrvOpts.plugins = []; + const config = configService.newExampleConfigConvict(apiSrvOpts); + + const apiServer = new ApiServer({ + config: config.getProperties(), + }); + test.onFinish(async () => await apiServer.shutdown()); + + const startResponse = apiServer.start(); + await t.doesNotReject( + startResponse, + "failed to start API server with dynamic plugin imports configured for it...", + ); + t.ok(startResponse, "startResponse truthy OK"); + + const addressInfoGrpc = (await startResponse).addressInfoGrpc; + const { address, port } = addressInfoGrpc; + const grpcHostAndPort = `${address}:${port}`; + + const apiClient = new DefaultServiceClient( + grpcHostAndPort, + grpc.credentials.createInsecure(), + ); + t.ok(apiClient, "apiClient truthy OK"); + + const responsePromise = new Promise( + (resolve, reject) => { + apiClient.getHealthCheckV1( + new Empty(), + (error: grpc.ServiceError | null, response: HealthCheckResponse) => { + if (error) { + reject(error); + } else { + resolve(response); + } + }, + ); + }, + ); + + await t.doesNotReject(responsePromise, "No error in healthcheck OK"); + const res = await responsePromise; + + const resHc = res.toObject(); + + t.ok(resHc, `healthcheck response truthy OK`); + t.ok(resHc.createdat, `resHc.createdAt truthy OK`); + t.ok(resHc.memoryusage, `resHc.memoryUsage truthy OK`); + t.ok(resHc.memoryusage?.rss, `resHc.memoryUsage.rss truthy OK`); + t.ok(resHc.success, `resHc.success truthy OK`); + t.end(); +}); diff --git a/packages/cactus-cmd-api-server/tsconfig.json b/packages/cactus-cmd-api-server/tsconfig.json index 15de52f39d1..fa0088d7d22 100644 --- a/packages/cactus-cmd-api-server/tsconfig.json +++ b/packages/cactus-cmd-api-server/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "composite": true, "outDir": "./dist/lib/", - "declarationDir": "dist/types", + "declarationDir": "dist/lib", "rootDir": "./src", "tsBuildInfoFile": "../../.build-cache/cactus-cmd-api-server.tsbuildinfo" }, diff --git a/yarn.lock b/yarn.lock index 328e064a9b9..89237ac0327 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1913,14 +1913,14 @@ dependencies: google-gax "^2.12.0" -"@grpc/grpc-js@^1.3.4", "@grpc/grpc-js@~1.3.0": +"@grpc/grpc-js@1.3.6", "@grpc/grpc-js@^1.3.4", "@grpc/grpc-js@~1.3.0": version "1.3.6" resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.3.6.tgz#6e2d17610c2c8df0f6ceab0e1968f563df74b173" integrity sha512-v7+LQFbqZKmd/Tvf5/j1Xlbq6jXL/4d+gUtm2TNX4QiEC3ELWADmGr2dGlUyLl6aKTuYfsN72vAsO5zmavYkEg== dependencies: "@types/node" ">=12.12.47" -"@grpc/proto-loader@^0.6.1", "@grpc/proto-loader@^0.6.2": +"@grpc/proto-loader@0.6.4", "@grpc/proto-loader@^0.6.1", "@grpc/proto-loader@^0.6.2": version "0.6.4" resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.6.4.tgz#5438c0d771e92274e77e631babdc14456441cbdc" integrity sha512-7xvDvW/vJEcmLUltCUGOgWRPM8Oofv0eCFSVMuKqaqWJaXSzmB+m9hiyqe34QofAl4WAzIKUZZlinIF9FOHyTQ== @@ -1950,6 +1950,18 @@ resolved "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz" integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== +"@improbable-eng/grpc-web-node-http-transport@0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@improbable-eng/grpc-web-node-http-transport/-/grpc-web-node-http-transport-0.14.0.tgz#3edf05360541b2d7ba799ec0144780a7a9a99383" + integrity sha512-NGZJgY8zTTWM//9oGdJZ+acmCgcgUcqxu3NV3GMFxw35D+3xkdEz599r9O7urg1Vv0+LzXDvfWEg7qg1Ec8x1w== + +"@improbable-eng/grpc-web@0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@improbable-eng/grpc-web/-/grpc-web-0.14.0.tgz#a71c5af471dcef6a2810798f71f93ed8d6ac3817" + integrity sha512-ag1PTMWpBZKGi6GrEcZ4lkU5Qag23Xjo10BmnK9qyx4TMmSVcWmQ3rECirfQzm2uogrM9n1M6xfOpFsJP62ivA== + dependencies: + browser-headers "^0.4.1" + "@ionic-native/core@5.34.0": version "5.34.0" resolved "https://registry.npmjs.org/@ionic-native/core/-/core-5.34.0.tgz" @@ -2703,6 +2715,21 @@ npmlog "^4.1.2" write-file-atomic "^3.0.3" +"@mapbox/node-pre-gyp@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.5.tgz#2a0b32fcb416fb3f2250fd24cb2a81421a4f5950" + integrity sha512-4srsKPXWlIxp5Vbqz5uLfBN+du2fJChBoYn/f2h991WLdk7jUvcSk/McVLSv/X+xQIPI8eGD5GjrnygdyHnhPA== + dependencies: + detect-libc "^1.0.3" + https-proxy-agent "^5.0.0" + make-dir "^3.1.0" + node-fetch "^2.6.1" + nopt "^5.0.0" + npmlog "^4.1.2" + rimraf "^3.0.2" + semver "^7.3.4" + tar "^6.1.0" + "@multiformats/base-x@^4.0.1": version "4.0.1" resolved "https://registry.npmjs.org/@multiformats/base-x/-/base-x-4.0.1.tgz" @@ -3535,30 +3562,16 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/google-protobuf@3.15.3": + version "3.15.3" + resolved "https://registry.yarnpkg.com/@types/google-protobuf/-/google-protobuf-3.15.3.tgz#054fb37aecb34d7dec826e1ce2b40cc27ec3d06a" + integrity sha512-MDpu7lit927cdLtBzTPUFjXGANFUnu5ThPqjygY8XmCyI/oDlIA0jAi4sffGOxYaLK2CCxAuU9wGxsgAQbA6FQ== + "@types/http-cache-semantics@*": version "4.0.1" resolved "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz" integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== -"@types/jasmine@*": - version "3.8.1" - resolved "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.8.1.tgz" - integrity sha512-ioRNoJvv0eXL1c9BZKpnywZWb5YflhaSiF3IOp9deyoh30MOwkB3bNuzi4UW76EFEhcmqpoEpdWhcUAAilomTw== - -"@types/jasminewd2@2.0.10": - version "2.0.10" - resolved "https://registry.npmjs.org/@types/jasminewd2/-/jasminewd2-2.0.10.tgz" - integrity sha512-J7mDz7ovjwjc+Y9rR9rY53hFWKATcIkrr9DwQWmOas4/pnIPJTXawnzjwpHm3RSxz/e3ZVUvQ7cRbd5UQLo10g== - dependencies: - "@types/jasmine" "*" - -"@types/jasminewd2@2.0.3": - version "2.0.3" - resolved "https://registry.npmjs.org/@types/jasminewd2/-/jasminewd2-2.0.3.tgz" - integrity sha512-hYDVmQZT5VA2kigd4H4bv7vl/OhlympwREUemqBdOqtrYTo5Ytm12a5W5/nGgGYdanGVxj0x/VhZ7J3hOg/YKg== - dependencies: - "@types/jasmine" "*" - "@types/joi@14.3.4": version "14.3.4" resolved "https://registry.npmjs.org/@types/joi/-/joi-14.3.4.tgz" @@ -5339,6 +5352,11 @@ brorand@^1.0.1, brorand@^1.1.0: resolved "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= +browser-headers@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/browser-headers/-/browser-headers-0.4.1.tgz#4308a7ad3b240f4203dbb45acedb38dc2d65dd02" + integrity sha512-CA9hsySZVo9371qEHjHZtYxV2cFtVj5Wj/ZHi8ooEsrtm4vOnl9Y9HmyYWk9q+05d7K3rdoAE0j3MVEFVvtQtg== + browser-readablestream-to-it@^1.0.1, browser-readablestream-to-it@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/browser-readablestream-to-it/-/browser-readablestream-to-it-1.0.2.tgz" @@ -8179,7 +8197,7 @@ enquirer@^2.3.0, enquirer@^2.3.4, enquirer@^2.3.5: ent@~2.2.0: version "2.2.0" - resolved "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz" + resolved "https://registry.yarnpkg.com/ent/-/ent-2.2.0.tgz#e964219325a21d05f44466a2f686ed6ce5f5dd1d" integrity sha1-6WQhkyWiHQX0RGai9obtbOX13R0= entities@^1.1.1, entities@~1.1.1: @@ -10151,6 +10169,11 @@ google-p12-pem@^3.0.3: dependencies: node-forge "^0.10.0" +google-protobuf@3.15.8: + version "3.15.8" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.15.8.tgz#5f3948905e4951c867d6bc143f385a80e2a39efe" + integrity sha512-2jtfdqTaSxk0cuBJBtTTWsot4WtR9RVr2rXg7x7OoqiuOKopPrwXpM1G4dXIkLcUNRh3RKzz76C8IOkksZSeOw== + got@9.6.0, got@^9.6.0: version "9.6.0" resolved "https://registry.npmjs.org/got/-/got-9.6.0.tgz" @@ -10237,6 +10260,21 @@ growl@1.10.5: resolved "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz" integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== +grpc-tools@1.11.2: + version "1.11.2" + resolved "https://registry.yarnpkg.com/grpc-tools/-/grpc-tools-1.11.2.tgz#22d802d40012510ccc6591d11f9c94109ac07aab" + integrity sha512-4+EgpnnkJraamY++oyBCw5Hp9huRYfgakjNVKbiE3PgO9Tv5ydVlRo7ZyGJ0C0SEiA7HhbVc1sNNtIyK7FiEtg== + dependencies: + "@mapbox/node-pre-gyp" "^1.0.5" + +grpc_tools_node_protoc_ts@5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/grpc_tools_node_protoc_ts/-/grpc_tools_node_protoc_ts-5.3.1.tgz#6f81ab7c8289c801cba3373aa334c13ca8f29618" + integrity sha512-OX6pWqN4BbjzdDdoJkkLoODO+XQnGC/hSHCDipF+ZtQlz3fLuYon+8rviUTuwE0etUZK9N34O4iucg3O7FFgyw== + dependencies: + google-protobuf "3.15.8" + handlebars "4.7.7" + gtoken@^5.0.4: version "5.3.0" resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-5.3.0.tgz#6536eb2880d9829f0b9d78f756795d4d9064b217" @@ -10258,9 +10296,9 @@ handle-thing@^2.0.0: resolved "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz" integrity sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg== -handlebars@^4.7.6: +handlebars@4.7.7, handlebars@^4.7.6: version "4.7.7" - resolved "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== dependencies: minimist "^1.2.5" @@ -10780,7 +10818,7 @@ ignore-walk@3.0.3: ignore-walk@^3.0.3: version "3.0.4" - resolved "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.4.tgz#c9a09f69b7c7b479a5d74ac1a3c0d4236d2a6335" integrity sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ== dependencies: minimatch "^3.0.4" @@ -13256,7 +13294,7 @@ lodash.set@^4.0.0: lodash.template@^4.5.0: version "4.5.0" - resolved "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz" + resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== dependencies: lodash._reinterpolate "^3.0.0" @@ -14357,7 +14395,7 @@ nconf@^0.11.2: needle@^2.5.2: version "2.8.0" - resolved "https://registry.npmjs.org/needle/-/needle-2.8.0.tgz" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.8.0.tgz#1c8ef9c1a2c29dcc1e83d73809d7bc681c80a048" integrity sha512-ZTq6WYkN/3782H1393me3utVYdq2XyqNUFBsprEE3VMAT0+hP/cItpnITpqsY6ep2yeFE4Tqtqwc74VqUlUYtw== dependencies: debug "^3.2.6" @@ -14654,7 +14692,7 @@ npm-audit-report@^2.1.5: npm-bundled@^1.1.1: version "1.1.2" - resolved "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.2.tgz#944c78789bd739035b70baa2ca5cc32b8d860bc1" integrity sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ== dependencies: npm-normalize-package-bin "^1.0.1" @@ -14873,7 +14911,7 @@ npm@7.19.1: npmlog@^4.0.1, npmlog@^4.1.2, npmlog@~4.1.2: version "4.1.2" - resolved "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== dependencies: are-we-there-yet "~1.1.2" @@ -16586,7 +16624,7 @@ proto-list@~1.2.1: protobufjs@^6.10.0, protobufjs@^6.10.2, protobufjs@^6.11.2: version "6.11.2" - resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.2.tgz#de39fabd4ed32beaa08e9bb1e30d08544c1edf8b" integrity sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw== dependencies: "@protobufjs/aspromise" "^1.1.2" @@ -17474,7 +17512,7 @@ rgba-regex@^1.0.0: rimraf@^2.2.8, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.3: version "2.7.1" - resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== dependencies: glob "^7.1.3"