fix: grpc import paths (#6726)

* fix: grpc import paths

* refactor: extract protobuf include directory logic into a separate function

* rm: comment

* fix: improve filtering of enabled import paths in protobuf configuration

* refactor: streamline import path handling in protobuf configuration
This commit is contained in:
sanish chirayath
2026-01-08 21:16:47 +05:30
committed by GitHub
parent 58a38ac5a1
commit b01b8d7bc4
3 changed files with 38 additions and 27 deletions

View File

@@ -1,6 +1,3 @@
import cloneDeep from 'lodash/cloneDeep';
import { resolvePath } from 'utils/filesystem';
export const sendNetworkRequest = async (item, collection, environment, runtimeVariables) => {
return new Promise((resolve, reject) => {
if (['http-request', 'graphql-request'].includes(item.type)) {
@@ -143,25 +140,10 @@ export const endGrpcStream = async (requestId) => {
};
export const loadGrpcMethodsFromProtoFile = async (filePath, collection = null) => {
return new Promise(async (resolve, reject) => {
return new Promise((resolve, reject) => {
const { ipcRenderer } = window;
// Extract import paths from collection's gRPC config if available
let importPaths = [];
if (collection) {
const config = cloneDeep(collection.brunoConfig);
if (config.protobuf && config.protobuf.importPaths) {
// Use Promise.all to wait for all resolvePath calls to complete
const enabledImportPaths = config.protobuf.importPaths.filter((importPath) => importPath.enabled);
importPaths = await Promise.all(enabledImportPaths.map((importPath) => {
return resolvePath(importPath.path, collection.pathname);
}));
}
}
ipcRenderer.invoke('grpc:load-methods-proto', { filePath, includeDirs: importPaths }).then(resolve).catch(reject);
ipcRenderer.invoke('grpc:load-methods-proto', { filePath, collection }).then(resolve).catch(reject);
});
};