(
items: PathAndCacheKey[],
resultType: IndexResultType,
)
| 252 | }; |
| 253 | |
| 254 | async function markComplete( |
| 255 | items: PathAndCacheKey[], |
| 256 | resultType: IndexResultType, |
| 257 | ) { |
| 258 | const addRemoveResultType = |
| 259 | mapIndexResultTypeToAddRemoveResultType(resultType); |
| 260 | |
| 261 | const actionItems = itemToAction[addRemoveResultType]; |
| 262 | if (!actionItems) { |
| 263 | console.warn(`No action items found for result type: ${resultType}`); |
| 264 | return; |
| 265 | } |
| 266 | |
| 267 | for (const item of items) { |
| 268 | const { path, cacheKey } = item; |
| 269 | switch (addRemoveResultType) { |
| 270 | case AddRemoveResultType.Compute: |
| 271 | await db.run( |
| 272 | "REPLACE INTO tag_catalog (path, cacheKey, lastUpdated, dir, branch, artifactId) VALUES (?, ?, ?, ?, ?, ?)", |
| 273 | path, |
| 274 | cacheKey, |
| 275 | newLastUpdatedTimestamp, |
| 276 | tag.directory, |
| 277 | tag.branch, |
| 278 | tag.artifactId, |
| 279 | ); |
| 280 | break; |
| 281 | case AddRemoveResultType.Add: |
| 282 | await db.run( |
| 283 | "REPLACE INTO tag_catalog (path, cacheKey, lastUpdated, dir, branch, artifactId) VALUES (?, ?, ?, ?, ?, ?)", |
| 284 | path, |
| 285 | cacheKey, |
| 286 | newLastUpdatedTimestamp, |
| 287 | tag.directory, |
| 288 | tag.branch, |
| 289 | tag.artifactId, |
| 290 | ); |
| 291 | break; |
| 292 | case AddRemoveResultType.Remove: |
| 293 | await db.run( |
| 294 | `DELETE FROM tag_catalog WHERE |
| 295 | cacheKey = ? AND |
| 296 | path = ? AND |
| 297 | dir = ? AND |
| 298 | branch = ? AND |
| 299 | artifactId = ? |
| 300 | `, |
| 301 | cacheKey, |
| 302 | path, |
| 303 | tag.directory, |
| 304 | tag.branch, |
| 305 | tag.artifactId, |
| 306 | ); |
| 307 | break; |
| 308 | case AddRemoveResultType.UpdateLastUpdated: |
| 309 | case AddRemoveResultType.UpdateNewVersion: |
| 310 | await db.run( |
| 311 | `UPDATE tag_catalog SET |
no test coverage detected