New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grpc-code-gen

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-code-gen - npm Package Compare versions

Comparing version 4.0.2 to 4.1.0

41

build/base.js

@@ -449,2 +449,4 @@ "use strict";

`
const maxTry = 3;
Object.keys(${service.name}.prototype).forEach((key) => {

@@ -455,2 +457,4 @@ if (!/^\\$/.test(key)) {

${service.name}.prototype[key] = promisify(function(request, options, callback) {
let count = 0;
if (typeof callback !== 'undefined') {

@@ -463,16 +467,29 @@ options = Object.assign({}, callOptions, options) || {};

if (typeof options.timeout === 'number') {
options.deadline = Date.now() + options.timeout;
function doCall(self: any) {
if (typeof options.timeout === 'number') {
options.deadline = Date.now() + options.timeout;
}
const start = Date.now();
(origin as any).apply(self, [request, options, function(err: any, response: any) {
if (!logOptions.disable) {
const duration = (Date.now() - start) / 1000;
console.info('grpc invoke:', methodId, 'duration:', duration + 's', 'request:', JSON.stringify(request));
if (err) {
console.error('grpc invoke:', methodId, 'duration:', duration + 's', 'request:', JSON.stringify(request), 'err:', err);
}
}
if (count < maxTry && /^Internal HTTP2 error/.test(err.details || err.message || err.data)) {
count++;
setTimeout(() => {
doCall(self);
}, 25);
} else {
callback(err, response);
}
}]);
}
return origin.apply(this, [request, options, function(err: any, response: any) {
if (!logOptions.disable) {
const duration = (Date.now() - start) / 1000;
console.info('grpc invoke:', methodId, 'duration:', duration + 's', 'request:', JSON.stringify(request));
if (err) {
console.error('grpc invoke:', methodId, 'duration:', duration + 's', 'request:', JSON.stringify(request), 'err:', err);
}
}
callback(err, response);
}]);
doCall.call(this);
});

@@ -479,0 +496,0 @@ }

{
"name": "grpc-code-gen",
"version": "4.0.2",
"version": "4.1.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": "https://github.com/yunkeCN/grpc-code-gen.git",

@@ -527,2 +527,4 @@ import * as fs from 'fs-extra';

`
const maxTry = 3;
Object.keys(${service.name}.prototype).forEach((key) => {

@@ -533,2 +535,4 @@ if (!/^\\$/.test(key)) {

${service.name}.prototype[key] = promisify(function(request, options, callback) {
let count = 0;
if (typeof callback !== 'undefined') {

@@ -541,16 +545,29 @@ options = Object.assign({}, callOptions, options) || {};

if (typeof options.timeout === 'number') {
options.deadline = Date.now() + options.timeout;
function doCall(self: any) {
if (typeof options.timeout === 'number') {
options.deadline = Date.now() + options.timeout;
}
const start = Date.now();
(origin as any).apply(self, [request, options, function(err: any, response: any) {
if (!logOptions.disable) {
const duration = (Date.now() - start) / 1000;
console.info('grpc invoke:', methodId, 'duration:', duration + 's', 'request:', JSON.stringify(request));
if (err) {
console.error('grpc invoke:', methodId, 'duration:', duration + 's', 'request:', JSON.stringify(request), 'err:', err);
}
}
if (count < maxTry && /^Internal HTTP2 error/.test(err.details || err.message || err.data)) {
count++;
setTimeout(() => {
doCall(self);
}, 25);
} else {
callback(err, response);
}
}]);
}
return origin.apply(this, [request, options, function(err: any, response: any) {
if (!logOptions.disable) {
const duration = (Date.now() - start) / 1000;
console.info('grpc invoke:', methodId, 'duration:', duration + 's', 'request:', JSON.stringify(request));
if (err) {
console.error('grpc invoke:', methodId, 'duration:', duration + 's', 'request:', JSON.stringify(request), 'err:', err);
}
}
callback(err, response);
}]);
doCall.call(this);
});

@@ -557,0 +574,0 @@ }

Sorry, the diff of this file is not supported yet

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