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

@grpc/proto-loader

Package Overview
Dependencies
Maintainers
3
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grpc/proto-loader - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

47

build/src/index.js

@@ -75,3 +75,3 @@ "use strict";

}
function createMethodDefinition(method, serviceName, options) {
function createMethodDefinition(method, serviceName, options, fileDescriptors) {
/* This is only ever called after the corresponding root.resolveAll(), so we

@@ -91,29 +91,16 @@ * can assume that the resolved request and response types are non-null */

originalName: camelCase(method.name),
requestType: createMessageDefinition(requestType),
responseType: createMessageDefinition(responseType)
requestType: createMessageDefinition(requestType, fileDescriptors),
responseType: createMessageDefinition(responseType, fileDescriptors)
};
}
function createServiceDefinition(service, name, options) {
function createServiceDefinition(service, name, options, fileDescriptors) {
var def = {};
for (var _i = 0, _a = service.methodsArray; _i < _a.length; _i++) {
var method = _a[_i];
def[method.name] = createMethodDefinition(method, name, options);
def[method.name] =
createMethodDefinition(method, name, options, fileDescriptors);
}
return def;
}
var fileDescriptorCache = new Map();
function getFileDescriptors(root) {
if (fileDescriptorCache.has(root)) {
return fileDescriptorCache.get(root);
}
else {
var descriptorList = root.toDescriptor('proto3').file;
var bufferList = descriptorList.map(function (value) {
return Buffer.from(descriptor.FileDescriptorProto.encode(value).finish());
});
fileDescriptorCache.set(root, bufferList);
return bufferList;
}
}
function createMessageDefinition(message) {
function createMessageDefinition(message, fileDescriptors) {
var messageDescriptor = message.toDescriptor('proto3');

@@ -123,6 +110,6 @@ return {

type: messageDescriptor.$type.toObject(messageDescriptor, descriptorOptions),
fileDescriptorProtos: getFileDescriptors(message.root)
fileDescriptorProtos: fileDescriptors
};
}
function createEnumDefinition(enumType) {
function createEnumDefinition(enumType, fileDescriptors) {
var enumDescriptor = enumType.toDescriptor('proto3');

@@ -132,3 +119,3 @@ return {

type: enumDescriptor.$type.toObject(enumDescriptor, descriptorOptions),
fileDescriptorProtos: getFileDescriptors(enumType.root)
fileDescriptorProtos: fileDescriptors
};

@@ -143,11 +130,11 @@ }

*/
function createDefinition(obj, name, options) {
function createDefinition(obj, name, options, fileDescriptors) {
if (obj instanceof Protobuf.Service) {
return createServiceDefinition(obj, name, options);
return createServiceDefinition(obj, name, options, fileDescriptors);
}
else if (obj instanceof Protobuf.Type) {
return createMessageDefinition(obj);
return createMessageDefinition(obj, fileDescriptors);
}
else if (obj instanceof Protobuf.Enum) {
return createEnumDefinition(obj);
return createEnumDefinition(obj, fileDescriptors);
}

@@ -161,5 +148,9 @@ else {

root.resolveAll();
var descriptorList = root.toDescriptor('proto3').file;
var bufferList = descriptorList.map(function (value) {
return Buffer.from(descriptor.FileDescriptorProto.encode(value).finish());
});
for (var _i = 0, _a = getAllHandledReflectionObjects(root, ''); _i < _a.length; _i++) {
var _b = _a[_i], name = _b[0], obj = _b[1];
def[name] = createDefinition(obj, name, options);
def[name] = createDefinition(obj, name, options, bufferList);
}

@@ -166,0 +157,0 @@ return def;

{
"name": "@grpc/proto-loader",
"version": "0.5.2",
"version": "0.5.3",
"author": "Google Inc.",

@@ -5,0 +5,0 @@ "contributors": [

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