Socket
Socket
Sign inDemoInstall

grpc-promise2

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

lib/metadata.js

6

lib/request-types/bidi-stream-request.js

@@ -0,1 +1,2 @@

const mergeMetadata = require('../metadata');

@@ -10,2 +11,3 @@ class BidiStreamRequest {

if (options == null) options = {};
this.metadata = options.metadata;
this.queue = {};

@@ -41,3 +43,3 @@ this.correlationId = 0;

sendMessage (content = {}) {
sendMessage (content = {}, metadata = {}) {
return new Promise((resolve, reject) => {

@@ -66,3 +68,3 @@ const id = this._nextId();

content['id'] = id;
this.stream.write(content);
this.stream.write(content, mergeMetadata(this.metadata, metadata));
});

@@ -69,0 +71,0 @@ }

@@ -0,1 +1,2 @@

const mergeMetadata = require('../metadata');

@@ -6,2 +7,3 @@ class ClientStreamRequest {

if (options == null) options = {};
this.metadata = options.metadata;
this.promise = new Promise((resolve, reject) => {

@@ -26,4 +28,4 @@ // Deadline is advisable to be set

sendMessage (content = {}) {
this.stream.write(content);
sendMessage (content = {}, metadata = {}) {
this.stream.write(content, mergeMetadata(this.metadata, metadata));
return this;

@@ -30,0 +32,0 @@ }

@@ -0,1 +1,2 @@

const mergeMetadata = require('../metadata');

@@ -13,3 +14,3 @@ class ServerStreamRequest {

sendMessage (content = {}) {
sendMessage (content = {}, metadata = {}) {
return new Promise((resolve, reject) => {

@@ -22,3 +23,3 @@ // Deadline is advisable to be set

}
this.stream = this.original_function.call(this.client, content, this.metadata, { deadline: deadline });
this.stream = this.original_function.call(this.client, content, mergeMetadata(this.metadata, metadata), { deadline: deadline });
this.stream.on('error', error => {

@@ -25,0 +26,0 @@ reject(error);

@@ -0,1 +1,2 @@

const mergeMetadata = require('../metadata');

@@ -20,3 +21,3 @@ class UnaryRequest {

}
this.original_function.call(this.client, content, Object.assign(this.metadata, metadata), { deadline: deadline },
this.original_function.call(this.client, content, mergeMetadata(this.metadata, metadata), { deadline: deadline },
function (error, response) {

@@ -23,0 +24,0 @@ if (error) {

{
"name": "grpc-promise2",
"version": "2.0.0",
"version": "2.0.1",
"description": "This is a fork of grpc-promise with extended metadata support. GRPC promisify module for all Request/Response types: standard and stream",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc