mirror of
https://github.com/cline/cline.git
synced 2025-06-03 03:59:07 +00:00
28 lines
745 B
TypeScript
28 lines
745 B
TypeScript
import { FileInfo } from "@shared/proto/file"
|
|
|
|
/**
|
|
* Converts domain search result objects to proto FileInfo objects
|
|
*/
|
|
export function convertSearchResultsToProtoFileInfos(
|
|
results: { path: string; type: "file" | "folder"; label?: string }[],
|
|
): FileInfo[] {
|
|
return results.map((result) => ({
|
|
path: result.path,
|
|
type: result.type,
|
|
label: result.label,
|
|
}))
|
|
}
|
|
|
|
/**
|
|
* Converts proto FileInfo objects to domain search result objects
|
|
*/
|
|
export function convertProtoFileInfosToSearchResults(
|
|
protoResults: FileInfo[],
|
|
): { path: string; type: "file" | "folder"; label?: string }[] {
|
|
return protoResults.map((protoResult) => ({
|
|
path: protoResult.path,
|
|
type: protoResult.type as "file" | "folder",
|
|
label: protoResult.label,
|
|
}))
|
|
}
|