Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
grpc-base-client
Advanced tools
Readme
npm i @codibre/grpc-base-client
import { Client as gRPCCLient } from '@codibre/grpc-base-client';
interface Health {
Check(props: { service: string }): Promise<any>;
}
const grpcCLient = new gRPCCLient<Health>({
namespace: 'abc.def',
protoFile: 'health-check.proto',
url: 'test.service',
maxConnections: 2,
service: 'Health',
secure: true,
});
await grpcCLient.getInstance().Check({service: 'foo'}); // { status: 'SERVING' }
Is your GRPC servers implements GRPC Reflection Protobol, then you don't need to have a copy of the proto client side and can just get it using it! This package implements a method to create the client using this feature that can be easily used like this:
import { Client as gRPCCLient } from '@codibre/grpc-base-client';
interface Health {
Check(props: { service: string }): Promise<any>;
}
const grpcCLient = gRPCCLient.getByReflection<Health>({
namespace: 'abc.def',
url: 'test.service',
maxConnections: 2,
service: 'Health',
secure: true,
});
await grpcCLient.getInstance().Check({service: 'foo'}); // { status: 'SERVING' }
Notice that you don't inform the protoFile in this call, as it is not needed. Also, this method don't offers a legacy library switch, as it'll only work with the new @grpc/grpc-js library.
If you want to find out how to implement it on your server, it really pretty easy! Just take a look at the official implementation for NodeJs: @grpc/reflection. If you're using NestJs, another option is nestjs-grpc-reflection, although the official one is preatty straight forward to use alongside with nestjs too.
To use getByReflection, you need to install two optional libraries:
Licensed under MIT.
FAQs
This project is a Library base for construct gRPC clients
The npm package grpc-base-client receives a total of 9 weekly downloads. As such, grpc-base-client popularity was classified as not popular.
We found that grpc-base-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.