MCPcopy Create free account
hub / github.com/Shazbot/WH3-Mod-Manager / getTableFilesForPackAndTables

Function getTableFilesForPackAndTables

src/nodeExecutor.ts:150–171  ·  view source on GitHub ↗
(
  packPath: string,
  tableNames: string[],
  executionContext?: FlowExecutionContext,
)

Source from the content-addressed store, hash-verified

148};
149
150const getTableFilesForPackAndTables = async (
151 packPath: string,
152 tableNames: string[],
153 executionContext?: FlowExecutionContext,
154): Promise<{ pack: Pack; matchingTablesByName: Map<string, PackedFile[]> }> => {
155 const pack = await readPackCached(packPath, { tablesToRead: tableNames }, executionContext);
156 getPacksTableData([pack], tableNames);
157 cacheTableFilesForPack(pack, tableNames, executionContext);
158
159 const matchingTablesByName = new Map<string, PackedFile[]>();
160 for (const tableName of tableNames) {
161 const cacheKey = `${pack.path}|${tableName}`;
162 const cachedTables = executionContext?.tableFilesByPackAndTable.get(cacheKey);
163 matchingTablesByName.set(
164 tableName,
165 cachedTables ??
166 pack.packedFiles.filter((packedFile) => packedFile.name === tableName || packedFile.name.startsWith(`${tableName}\\`)),
167 );
168 }
169
170 return { pack, matchingTablesByName };
171};
172
173const cloneNewPackedFile = (packedFile: NewPackedFile): NewPackedFile => ({
174 name: packedFile.name,

Calls 4

getPacksTableDataFunction · 0.90
readPackCachedFunction · 0.85
cacheTableFilesForPackFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected