Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const loadProto = async function(filename) {
const root = await prepareRoot();
// Loading file
let parsedObj = await ProtoBuf.load(filename, root);
let def = grpc.loadObject(parsedObj);
return {
root: root,
services: listServices('', def)
};
};
function GetGrpcClientConstructor(): GrpcClientConstructor {
let reflectionObject = protobuf.Root.fromJSON(jsonModule as protobuf.INamespace);
let rpcs = grpc.loadObject(reflectionObject, { enumsAsStrings: false, protobufjsVersion: 6 });
return rpcs.AzureFunctionsRpcMessages["FunctionRpc"];
}
beforeEach(() => {
lookupTree = buildTree();
server = new Server(lookupTree, (msg: IGBServerMessage) => {
recvQueue.push(msg);
}, require('grpc'));
recvQueue.length = 0;
let serviceTree = require('grpc').loadObject(lookupTree).build();
encodedData = serviceTree.mock.HelloRequest.encode({'name': 'hello'}).toBase64();
encodedResponseData = serviceTree.mock.HelloReply.encode({message: 'hello'}).toBase64();
});
var grpcLoad = function(filename, format, options) {
const ProtoBuf = require('protobufjs');
var builder = ProtoBuf.loadProtoFile(filename);
if (!builder) {
throw new Error('Could not load file "' + filename + '"');
}
return grpc.loadObject(builder.ns, {});
}
const parseProto = async function(proto) {
const root = await prepareRoot();
let parserResult = ProtoBuf.parse(proto, root);
let def = grpc.loadObject(parserResult.root);
return {
root: root,
services: listServices('', def)
};
};
static load(filename) {
const builder = protobuf.loadProtoFile(filename);
return grpc.loadObject(builder, {protobufjsVersion: 5});
}