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.1.0 to 4.1.1

44

build/base.js

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

`
const maxTry = 3;
Object.keys(Service.prototype).forEach((key) => {

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

Service.prototype[key] = promisify(function(this: any, request: any, options: any, callback: any) {
let count = 0;
if (typeof callback !== 'undefined') {

@@ -417,17 +421,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);
}
}]);
}
const start = Date.now();
return (origin as any).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);
});

@@ -474,3 +490,3 @@ }

const start = Date.now();
(origin as any).apply(self, [request, options, function(err: any, response: any) {
origin.apply(self, [request, options, function(err, response) {
if (!logOptions.disable) {

@@ -477,0 +493,0 @@ const duration = (Date.now() - start) / 1000;

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

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

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

`
const maxTry = 3;
Object.keys(Service.prototype).forEach((key) => {

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

Service.prototype[key] = promisify(function(this: any, request: any, options: any, callback: any) {
let count = 0;
if (typeof callback !== 'undefined') {

@@ -496,17 +500,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);
}
}]);
}
const start = Date.now();
return (origin as any).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);
});

@@ -552,3 +568,3 @@ }

const start = Date.now();
(origin as any).apply(self, [request, options, function(err: any, response: any) {
origin.apply(self, [request, options, function(err, response) {
if (!logOptions.disable) {

@@ -555,0 +571,0 @@ const duration = (Date.now() - start) / 1000;

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