(tableName: string, columnName: string)
| 1222 | |
| 1223 | const tableColumnValuesCache = new Map<string, Set<string>>(); |
| 1224 | const getExistingValuesForTableColumn = async (tableName: string, columnName: string) => { |
| 1225 | const cacheKey = `${tableName}|${columnName}`; |
| 1226 | const existingCache = tableColumnValuesCache.get(cacheKey); |
| 1227 | if (existingCache) return existingCache; |
| 1228 | |
| 1229 | const existingValues = new Set<string>(); |
| 1230 | for (const targetPackPath of packPathsForCollisionChecks) { |
| 1231 | if (isCanceled()) { |
| 1232 | report("canceled", "Canceled"); |
| 1233 | return existingValues; |
| 1234 | } |
| 1235 | |
| 1236 | const tableFiles = await getTableFilesForPackAndTable(targetPackPath, tableName); |
| 1237 | for (const tableFile of tableFiles) { |
| 1238 | const columnIndex = getColumnIndexForPackedFile(tableFile, columnName); |
| 1239 | if (columnIndex < 0) continue; |
| 1240 | |
| 1241 | const rows = getRowsForPackedFile(tableFile); |
| 1242 | for (const row of rows) { |
| 1243 | const cell = row[columnIndex]; |
| 1244 | if (!cell) continue; |
| 1245 | existingValues.add(cell.resolvedKeyValue); |
| 1246 | } |
| 1247 | } |
| 1248 | } |
| 1249 | |
| 1250 | tableColumnValuesCache.set(cacheKey, existingValues); |
| 1251 | return existingValues; |
| 1252 | }; |
| 1253 | |
| 1254 | interface SavePackedFileDataWithSchema { |
| 1255 | name: string; |
no test coverage detected