grpc-health-check
Advanced tools
Comparing version 1.8.0 to 2.0.0
{ | ||
"name": "grpc-health-check", | ||
"version": "1.8.0", | ||
"version": "2.0.0", | ||
"author": "Google Inc.", | ||
@@ -17,7 +17,11 @@ "description": "Health check client and service for use with gRPC-node", | ||
], | ||
"scripts": { | ||
"compile": "tsc -p .", | ||
"prepare": "npm run generate-types && npm run compile", | ||
"generate-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ -O src/generated health/v1/health.proto", | ||
"generate-test-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ -O test/generated --grpcLib=@grpc/grpc-js health/v1/health.proto" | ||
}, | ||
"dependencies": { | ||
"google-protobuf": "^3.4.0", | ||
"grpc": "^1.6.0", | ||
"lodash.clone": "^4.5.0", | ||
"lodash.get": "^4.4.2" | ||
"@grpc/proto-loader": "^0.7.10", | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -27,7 +31,12 @@ "files": [ | ||
"README.md", | ||
"health.js", | ||
"v1" | ||
"src", | ||
"build", | ||
"proto" | ||
], | ||
"main": "health.js", | ||
"license": "Apache-2.0" | ||
"main": "build/src/health.js", | ||
"types": "build/src/health.d.ts", | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
"@grpc/grpc-js": "file:../grpc-js" | ||
} | ||
} |
@@ -7,8 +7,4 @@ # grpc-health-check | ||
This package exports both a client and server that adhere to the [gRPC Health Checking Protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md). | ||
This package provides an implementation of the [gRPC Health Checking Protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md) service, as described in [gRFC L106](https://github.com/grpc/proposal/blob/master/L106-node-heath-check-library.md). | ||
By using this package, clients and servers can rely on common proto and service definitions. This means: | ||
- Clients can use the generated stubs to health check _any_ server that adheres to the protocol. | ||
- Servers do not reimplement common logic for publishing health statuses. | ||
## Installation | ||
@@ -26,22 +22,24 @@ | ||
Any gRPC-node server can use `grpc-health-check` to adhere to the gRPC Health Checking Protocol. | ||
Any gRPC-node server can use `grpc-health-check` to adhere to the gRPC Health Checking Protocol. | ||
The following shows how this package can be added to a pre-existing gRPC server. | ||
```javascript 1.8 | ||
```typescript | ||
// Import package | ||
let health = require('grpc-health-check'); | ||
import { HealthImplementation, ServingStatusMap } from 'grpc-health-check'; | ||
// Define service status map. Key is the service name, value is the corresponding status. | ||
// By convention, the empty string "" key represents that status of the entire server. | ||
// By convention, the empty string '' key represents that status of the entire server. | ||
const statusMap = { | ||
"ServiceFoo": proto.grpc.health.v1.HealthCheckResponse.ServingStatus.SERVING, | ||
"ServiceBar": proto.grpc.health.v1.HealthCheckResponse.ServingStatus.NOT_SERVING, | ||
"": proto.grpc.health.v1.HealthCheckResponse.ServingStatus.NOT_SERVING, | ||
'ServiceFoo': 'SERVING', | ||
'ServiceBar': 'NOT_SERVING', | ||
'': 'NOT_SERVING', | ||
}; | ||
// Construct the service implementation | ||
let healthImpl = new health.Implementation(statusMap); | ||
const healthImpl = new HealthImplementation(statusMap); | ||
// Add the service and implementation to your pre-existing gRPC-node server | ||
server.addService(health.service, healthImpl); | ||
healthImpl.addToServer(server); | ||
// When ServiceBar comes up | ||
healthImpl.setStatus('serviceBar', 'SERVING'); | ||
``` | ||
@@ -53,4 +51,8 @@ | ||
Any gRPC-node client can use `grpc-health-check` to run health checks against other servers that follow the protocol. | ||
Any gRPC-node client can use the `service` object exported by `grpc-health-check` to generate clients that can make health check requests. | ||
### Command Line Usage | ||
The absolute path to `health.proto` can be obtained on the command line with `node -p 'require("grpc-health-check").protoPath'`. | ||
## Contributing | ||
@@ -57,0 +59,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
103140
2
44
931
63
1
+ Added@grpc/proto-loader@^0.7.10
+ Addedtypescript@^5.2.2
+ Added@grpc/proto-loader@0.7.13(transitive)
+ Added@protobufjs/aspromise@1.1.2(transitive)
+ Added@protobufjs/base64@1.1.2(transitive)
+ Added@protobufjs/codegen@2.0.4(transitive)
+ Added@protobufjs/eventemitter@1.1.0(transitive)
+ Added@protobufjs/fetch@1.1.0(transitive)
+ Added@protobufjs/float@1.0.2(transitive)
+ Added@protobufjs/inquire@1.1.0(transitive)
+ Added@protobufjs/path@1.1.2(transitive)
+ Added@protobufjs/pool@1.1.0(transitive)
+ Added@protobufjs/utf8@1.1.0(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcliui@8.0.1(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedlong@5.2.3(transitive)
+ Addedprotobufjs@7.4.0(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedtypescript@5.6.2(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyargs@17.7.2(transitive)
+ Addedyargs-parser@21.1.1(transitive)
- Removedgoogle-protobuf@^3.4.0
- Removedgrpc@^1.6.0
- Removedlodash.clone@^4.5.0
- Removedlodash.get@^4.4.2
- Removed@mapbox/node-pre-gyp@1.0.11(transitive)
- Removed@types/bytebuffer@5.0.49(transitive)
- Removed@types/long@3.0.32(transitive)
- Removedabbrev@1.1.1(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedaproba@2.0.0(transitive)
- Removedare-we-there-yet@2.0.0(transitive)
- Removedascli@1.0.1(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbytebuffer@5.0.1(transitive)
- Removedcamelcase@2.1.1(transitive)
- Removedchownr@2.0.0(transitive)
- Removedcliui@3.2.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removedcolour@0.7.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddelegates@1.0.0(transitive)
- Removeddetect-libc@2.0.3(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedgauge@3.0.2(transitive)
- Removedglob@7.2.3(transitive)
- Removedgoogle-protobuf@3.21.4(transitive)
- Removedgrpc@1.24.11(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedinvert-kv@1.0.0(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedlcid@1.0.0(transitive)
- Removedlodash.clone@4.5.0(transitive)
- Removedlodash.get@4.4.2(transitive)
- Removedlong@3.2.0(transitive)
- Removedmake-dir@3.1.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedms@2.1.3(transitive)
- Removednan@2.20.0(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removednopt@5.0.0(transitive)
- Removednpmlog@5.0.1(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedoptjs@3.2.2(transitive)
- Removedos-locale@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprotobufjs@5.0.3(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsemver@6.3.17.6.3(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedtar@6.2.1(transitive)
- Removedtr46@0.0.3(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedwindow-size@0.1.4(transitive)
- Removedwrap-ansi@2.1.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedy18n@3.2.2(transitive)
- Removedyallist@4.0.0(transitive)
- Removedyargs@3.32.0(transitive)