Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
codeGenRequest.getFileToGenerateList().forEach(fileName => {
// react NativeModules grpc bridge types
let tsTypes = TsNativeModuleTypes.gen(fileNameToDescriptor[fileName]);
if (tsTypes !== '') {
let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
let svtTsdFile = new CodeGeneratorResponse.File();
svtTsdFile.setName(`${svcFileName}_types.ts`);
svtTsdFile.setContent(tsTypes);
codeGenResponse.addFile(svtTsdFile);
}
// swift services
let fileDescriptorOutput = SwiftGen.gen(fileNameToDescriptor[fileName]);
if (fileDescriptorOutput !== '') {
swiftFileContents.push(fileDescriptorOutput);
}
// swift objective-c headers
let fileHeaderBridge = SwiftGenHeaderBridge.gen(fileNameToDescriptor[fileName]);
if (fileHeaderBridge !== '') {
rnBridgeContents.push(fileHeaderBridge);
}
codeGenRequest.getFileToGenerateList().forEach(fileName => {
// message part
let msgFileName = Utility.filePathFromProtoWithoutExt(fileName);
let msgTsdFile = new CodeGeneratorResponse.File();
msgTsdFile.setName(msgFileName + ".d.ts");
const msgModel = ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
msgTsdFile.setContent(TplEngine.render('msg_tsd', msgModel));
codeGenResponse.addFile(msgTsdFile);
// service part
let fileDescriptorModel = ProtoSvcTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
if (fileDescriptorModel != null) {
let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
let svtTsdFile = new CodeGeneratorResponse.File();
svtTsdFile.setName(svcFileName + ".d.ts");
svtTsdFile.setContent(TplEngine.render('svc_tsd', fileDescriptorModel));
codeGenResponse.addFile(svtTsdFile);
}
});
codeGenRequest.getFileToGenerateList().forEach(fileName => {
// message part
let msgFileName = Utility.filePathFromProtoWithoutExt(fileName);
let msgTsdFile = new CodeGeneratorResponse.File();
msgTsdFile.setName(msgFileName + ".d.ts");
msgTsdFile.setContent(ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap));
codeGenResponse.addFile(msgTsdFile);
// service part
let fileDescriptorOutput = ProtoSvcTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
if (fileDescriptorOutput != '') {
let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
let svtTsdFile = new CodeGeneratorResponse.File();
svtTsdFile.setName(svcFileName + ".d.ts");
svtTsdFile.setContent(fileDescriptorOutput);
codeGenResponse.addFile(svtTsdFile);
}
});
codeGenRequest.getFileToGenerateList().forEach(fileName => {
// message part
let msgFileName = Utility.filePathFromProtoWithoutExt(fileName);
let msgTsdFile = new CodeGeneratorResponse.File();
msgTsdFile.setName(msgFileName + ".d.ts");
msgTsdFile.setContent(ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap));
codeGenResponse.addFile(msgTsdFile);
// service part
let fileDescriptorOutput = ProtoSvcTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
if (fileDescriptorOutput != '') {
let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
let svtTsdFile = new CodeGeneratorResponse.File();
svtTsdFile.setName(svcFileName + ".d.ts");
svtTsdFile.setContent(fileDescriptorOutput);
codeGenResponse.addFile(svtTsdFile);
}
});
codeGenRequest.getFileToGenerateList().forEach(fileName => {
// message part
let msgFileName = Utility.filePathFromProtoWithoutExt(fileName);
let msgTsdFile = new CodeGeneratorResponse.File();
msgTsdFile.setName(msgFileName + ".d.ts");
const msgModel = ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
msgTsdFile.setContent(TplEngine.render('msg_tsd', msgModel));
codeGenResponse.addFile(msgTsdFile);
// service part
let fileDescriptorModel = ProtoSvcTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
if (fileDescriptorModel != null) {
let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
let svtTsdFile = new CodeGeneratorResponse.File();
svtTsdFile.setName(svcFileName + ".d.ts");
svtTsdFile.setContent(TplEngine.render('svc_tsd', fileDescriptorModel));
codeGenResponse.addFile(svtTsdFile);
}
});
function addFile(rsp: CodeGeneratorResponse, fileName: string, fileContent: string) {
const file = new CodeGeneratorResponse.File();
file.setName(fileName);
file.setContent(fileContent);
rsp.addFile(file);
}
request.getFileToGenerateList().forEach(fileName => {
const outputFileName = Utility.filePathFromProtoWithoutExtension(fileName);
const outputFile = new CodeGeneratorResponse.File();
outputFile.setName(outputFileName + '.d.ts');
outputFile.setContent(FileDescriptorMSG.print(fileNameToDescriptor[fileName], entryMap));
response.addFile(outputFile);
if (generateServices) {
const fileDescriptorOutput = FileDescriptorGRPC.print(fileNameToDescriptor[fileName], entryMap);
if (fileDescriptorOutput !== '') {
const thisServiceFileName = Utility.svcFilePathFromProtoWithoutExtension(fileName);
const thisServiceFile = new CodeGeneratorResponse.File();
thisServiceFile.setName(thisServiceFileName + '.d.ts');
thisServiceFile.setContent(fileDescriptorOutput);
response.addFile(thisServiceFile);
}
}
});
codeGenRequest.getFileToGenerateList().forEach(fileName => {
const outputFileName = replaceProtoSuffix(fileName);
const thisFile = new CodeGeneratorResponse.File();
thisFile.setName(outputFileName + ".d.ts");
thisFile.setContent(printFileDescriptorTSD(fileNameToDescriptor[fileName], exportMap));
codeGenResponse.addFile(thisFile);
if (generateGrpcWebServices) {
generateGrpcWebService(outputFileName, fileNameToDescriptor[fileName], exportMap)
.forEach(file => codeGenResponse.addFile(file));
} else if (generateGrpcNodeServices) {
const file = generateGrpcNodeService(outputFileName, fileNameToDescriptor[fileName], exportMap);
codeGenResponse.addFile(file);
}
});
codeGenRequest.getFileToGenerateList().forEach(fileName => {
const fileDescriptorOutput = printFileDescriptorJSServices(fileNameToDescriptor[fileName], exportMap);
if (fileDescriptorOutput != "") {
const outputFileName = filePathFromProtoWithoutExtension(fileName);
const thisFile = new CodeGeneratorResponse.File();
thisFile.setName(outputFileName + "_service.js");
thisFile.setContent(fileDescriptorOutput);
codeGenResponse.addFile(thisFile)
}
});