Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grpc-helper

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-helper - npm Package Compare versions

Comparing version 0.0.0 to 0.1.0

dist/src/brake.d.ts

81

package.json
{
"name": "grpc-helper",
"version": "0.0.0",
"description": "Please wait",
"main": "index.js",
"version": "0.1.0",
"description": "grpc helper",
"main": "dist/src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "ava",
"coverage": "nyc npm test",
"lint": "tslint --format prose src/**/*.ts test/**/*.ts",
"coverage-ci": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
"build": "tsc",
"clean": "rm -rf dist",
"prebuild": "npm run clean",
"postbuild": "cp src/*.proto dist/src && cp test/*.proto dist/test && cp -r test/fixtures dist/test",
"prepublish": "npm run build"
},
"keywords": [],
"repository": {
"type": "git",
"url": "https://github.com/xizhibei/grpc-helper.git"
},
"author": "Xu Zhipei <xuzhipei@gmail.com>",
"license": "MIT"
"license": "MIT",
"engines": {
"node": ">=4"
},
"files": [
"dist/src"
],
"typings": "dist/src/index.d.ts",
"keywords": [
"grpc",
"helper",
"promise",
"load-balancer",
"typescript"
],
"ava": {
"compileEnhancements": false,
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
},
"nyc": {
"extension": [
".ts"
],
"reporter": [
"lcov",
"text-summary"
],
"include": [
"dist/src"
],
"all": true
},
"dependencies": {
"@grpc/proto-loader": "^0.3.0",
"bluebird": "^3.5.0",
"brakes": "^2.6.0",
"debug": "^3.1.0",
"grpc": "^1.14.1",
"lodash": "^4.17.10",
"prom-client": "^10.2.3"
},
"devDependencies": {
"@types/bluebird-global": "^3.5.3",
"@types/debug": "^0.0.30",
"@types/lodash": "^4.14.91",
"@types/node": "^10.9.3",
"ava": "^0.25.0",
"coveralls": "^3.0.2",
"mock-require": "^3.0.2",
"nyc": "^11.9.0",
"ts-node": "^7.0.1",
"tslint": "^5.8.0",
"typescript": "^3.0.1"
}
}

@@ -1,3 +0,116 @@

# Please wait
# GRPC helper
for latter publish
**WARNING: in beta !!!**
[![Build Status](https://travis-ci.org/xizhibei/grpc-helper.svg?branch=master&style=flat)](https://travis-ci.org/xizhibei/grpc-helper)
[![Coverage Status](https://coveralls.io/repos/github/xizhibei/grpc-helper/badge.svg?branch=master)](https://coveralls.io/github/xizhibei/grpc-helper?branch=master)
[![npm version](https://badge.fury.io/js/grpc-helper.svg?style=flat)](http://badge.fury.io/js/grpc-helper)
[![Dependency Status](https://img.shields.io/david/xizhibei/grpc-helper.svg?style=flat)](https://david-dm.org/xizhibei/grpc-helper)
[![npm](https://img.shields.io/npm/l/grpc-helper.svg)](https://github.com/xizhibei/grpc-helper/blob/master/LICENSE)
### Getting Started
### Installing
```bash
npm i grpc-helper --save
```
or
```bash
yarn add grpc-helper
```
### Features
- Promised unary & client stream call
- Client Load balance
- Service health checking
- Service discovery (static, dns srv)
- Circuit breaker
### Usage
#### DNS Service discovery
```ts
const helper = new GRPCHelper({
packageName: 'helloworld',
serviceName: 'Greeter',
protoPath: path.resolve(__dirname, './hello.proto'),
sdUri: 'dns://_http._tcp.greeter',
});
await helper.waitForReady();
const res = await helper.SayHello({
name: 'foo',
});
```
#### Static Service discovery
```ts
const helper = new GRPCHelper({
packageName: 'helloworld',
serviceName: 'Greeter',
protoPath: path.resolve(__dirname, './hello.proto'),
sdUri: 'static://localhost:50051,localhost:50052,localhost:50053',
});
await helper.waitForReady();
const res = await helper.SayHello({
name: 'foo',
});
```
#### Resolve with full response
```ts
const helper = new GRPCHelper({
packageName: 'helloworld',
serviceName: 'Greeter',
protoPath: path.resolve(__dirname, './hello.proto'),
sdUri: 'static://localhost:50051',
resolveFullResponse: true,
});
await helper.waitForReady();
const { message, peer, status, metadata } = await helper.SayHello({
name: 'foo',
});
```
#### Client stream call
```ts
const stream = new stream.PassThrough({ objectMode: true });
const promise = helper.SayMultiHello(stream);
stream.write({
name: 'foo1',
});
stream.write({
name: 'foo2',
});
stream.write({
name: 'foo3',
});
stream.end();
const result = await promise;
```
### TODO
- [x] Better api
- [x] Doc
- [x] Test code
- [ ] Consul/etcd/zk service discovery
### License
This project is licensed under the MIT License - see the LICENSE file for details
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc