Huge News!Announcing our $40M Series B led by Abstract Ventures.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 3.3.3 to 3.4.0

temp.js

21

build/base.js

@@ -281,2 +281,6 @@ "use strict";

}
let callOptions = {};
if (fs.existsSync(configFilePath)) {
callOptions = require(configFilePath).callOptions || {};
}
if (serviceCode) {

@@ -366,3 +370,7 @@ const grpcObjPath = getAbsPath(`grpcObj.${moduleSuffix}`, baseDir);

const responseType = `types.${getTsType(method.responseType, packageName, config).tsType}`;
return ` ${method.name}(request: ${requestType}): Promise<${responseType}>;`;
return ` ${method.name}(
request: ${requestType},
options?: { deadline?: Date | number; flags?: number; host?: string; },
callback?: (err: Error, response: ${responseType}),
): Promise<${responseType}>;`;
});

@@ -388,3 +396,12 @@ if (typescript) {

if (!/^\\$/.test(key)) {
Service.prototype[key] = promisify(Service.prototype[key]);
Service.prototype[key] = promisify(function(request, options, callback){
if (typeof callback !== 'undefined') {
options = Object.assign(${JSON.stringify(callOptions)}, options);
} else {
callback = options;
options = ${JSON.stringify(callOptions)};
}
Service.prototype[key](request, options, callback);
});
}

@@ -391,0 +408,0 @@ });`,

2

package.json
{
"name": "grpc-code-gen",
"version": "3.3.3",
"version": "3.4.0",
"license": "MIT",

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

@@ -346,2 +346,7 @@ import * as fs from 'fs-extra';

let callOptions = {};
if (fs.existsSync(configFilePath)) {
callOptions = require(configFilePath).callOptions || {};
}
if (serviceCode) {

@@ -438,6 +443,9 @@ const grpcObjPath = getAbsPath(`grpcObj.${moduleSuffix}`, baseDir);

const responseType = `types.${getTsType(method.responseType, packageName, config).tsType}`;
return ` ${method.name}(request: ${requestType}): Promise<${responseType}>;`
return ` ${method.name}(
request: ${requestType},
options?: { deadline?: Date | number; flags?: number; host?: string; },
callback?: (err: Error, response: ${responseType}),
): Promise<${responseType}>;`
});
if (typescript) {

@@ -462,3 +470,12 @@ const typeName = 'I' + service.name;

if (!/^\\$/.test(key)) {
Service.prototype[key] = promisify(Service.prototype[key]);
Service.prototype[key] = promisify(function(request, options, callback){
if (typeof callback !== 'undefined') {
options = Object.assign(${JSON.stringify(callOptions)}, options);
} else {
callback = options;
options = ${JSON.stringify(callOptions)};
}
Service.prototype[key](request, options, callback);
});
}

@@ -465,0 +482,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