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

grpc-ts-middleware

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-ts-middleware - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

index.d.ts

@@ -50,3 +50,3 @@ import * as grpc from 'grpc';

* @param preCallHandler An array of functions to be invoked prior to the execution of the gRPC call
* @param postCallHandler An array of functions to be invoked after the actual service handler, but before returning the result
* @param postCallHandler An array of functions to be invoked after the gRPC call has been executed, but before returning the result
*/

@@ -53,0 +53,0 @@ constructor(server: grpc.Server, preMiddleware?: PreMiddleware, postMiddleware?: PostMiddleware);

{
"name": "grpc-ts-middleware",
"version": "1.0.0",
"version": "1.0.1",
"description": "gRPC pre-call and post-call middleware",

@@ -32,3 +32,3 @@ "main": "src/index.js",

"@types/node": "~10.12.18",
"@types/protobufjs": "^6.0.0",
"@types/protobufjs": "~6.0.0",
"prettier": "~1.15.3",

@@ -35,0 +35,0 @@ "protobufjs": "~6.8.8",

# gRPC Middleware
A library that allows easy implementation of gRPC middleware, for both pre-call, and post-call.
[![Current Version](https://img.shields.io/npm/v/grpc-ts-middleware.svg)](https://www.npmjs.com/package/grpc-ts-middleware)
A library that assists with the implementation of gRPC pre-, and post-call middleware.
### Installation

@@ -24,4 +26,2 @@

const serviceName = 'echo.EchoManager';
function doEcho(call: grpc.ServerUnaryCall<EchoRequest>, callback: grpc.sendUnaryData<EchoReply>) {

@@ -39,16 +39,19 @@ const reply = new EchoReply();

const grpcMiddleware = new GrpcMiddleware(
// An instance of the gRPC server
server,
// An array of functions to be invoked prior to the execution of the gRPC call
[
(call: GrpcCall) => AppLogger.logger.debug('Pre-call handler 1', call),
(call: GrpcCall) => AppLogger.logger.debug('Pre-call handler 2', call)
(call: GrpcCall) => console.log('Pre-call handler 1', call),
(call: GrpcCall) => console.log('Pre-call handler 2', call)
],
// An array of functions to be invoked after the gRPC call has been executed, but before returning the result
[
(error: grpc.ServiceError | null, call: GrpcCall) =>
AppLogger.logger.debug('Post-call handler 1', call, error),
console.log('Post-call handler 1', call, error),
(error: grpc.ServiceError | null, call: GrpcCall) =>
AppLogger.logger.debug('Post-call handler 2', call, error)
console.log('Post-call handler 2', call, error)
]
);
// Add gRPC services that you want the middleware to monitor
grpcMiddleware.addService(EchoManagerService, { echo: this.doEcho });
grpcMiddleware.addService(EchoManagerService, { echo: doEcho });
// Enable propagation of Jaeger tracing headers

@@ -55,0 +58,0 @@ grpcMiddleware.enableTracing();

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