@pratik7368patil/anchor-core 0.1.27 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1882,9 +1882,9 @@ function clearGraphQLFetchCheckpoint(db, repo, scope) {
1882
1882
  ).run((/* @__PURE__ */ new Date()).toISOString(), repo);
1883
1883
  }
1884
1884
  function deleteExistingPrData(db, prId) {
1885
- const unitRows = db.prepare("SELECT id FROM wisdom_units WHERE pr_id = ?").all(prId);
1886
- const deleteFts = db.prepare("DELETE FROM wisdom_units_fts WHERE unitId = ?");
1887
- for (const row of unitRows) deleteFts.run(row.id);
1885
+ db.prepare(
1886
+ "DELETE FROM wisdom_units_fts WHERE unitId IN (SELECT id FROM wisdom_units WHERE pr_id = ?)"
1887
+ ).run(prId);
1888
1888
  db.prepare("DELETE FROM regression_events WHERE pr_id = ?").run(prId);
1889
1889
  db.prepare("DELETE FROM wisdom_units WHERE pr_id = ?").run(prId);
1890
1890
  db.prepare("DELETE FROM pr_comments WHERE pr_id = ?").run(prId);
@@ -2075,16 +2075,17 @@ function replaceCodeIndex(db, repo, codeFiles, codeChunks, skippedFiles, cwd, ar
2075
2075
  });
2076
2076
  options.onProgress?.({ stage: "writing_code_index", repo, phase: "Writing code index" });
2077
2077
  const transaction = db.transaction(() => {
2078
- const existingChunks = db.prepare("SELECT id FROM code_chunks WHERE repo_id = ?").all(repoId);
2078
+ const existingChunkCount = db.prepare("SELECT COUNT(*) AS count FROM code_chunks WHERE repo_id = ?").get(repoId).count;
2079
2079
  const existingPatternCount = db.prepare("SELECT COUNT(*) AS count FROM architecture_patterns WHERE repo_id = ?").get(repoId).count;
2080
2080
  options.onProgress?.({
2081
2081
  stage: "deleting_existing_code_index",
2082
2082
  repo,
2083
- chunks: existingChunks.length,
2083
+ chunks: existingChunkCount,
2084
2084
  patterns: existingPatternCount
2085
2085
  });
2086
- const deleteFts = db.prepare("DELETE FROM code_chunks_fts WHERE chunkId = ?");
2087
- for (const row of existingChunks) deleteFts.run(row.id);
2086
+ db.prepare(
2087
+ "DELETE FROM code_chunks_fts WHERE chunkId IN (SELECT id FROM code_chunks WHERE repo_id = ?)"
2088
+ ).run(repoId);
2088
2089
  db.prepare("DELETE FROM code_chunks WHERE repo_id = ?").run(repoId);
2089
2090
  db.prepare("DELETE FROM code_files WHERE repo_id = ?").run(repoId);
2090
2091
  db.prepare("DELETE FROM test_links WHERE repo_id = ? AND reason != 'PR co-change'").run(repoId);
@@ -2222,9 +2223,9 @@ function replaceCodeIndex(db, repo, codeFiles, codeChunks, skippedFiles, cwd, ar
2222
2223
  };
2223
2224
  }
2224
2225
  function deleteExistingArchitectureData(db, repoId) {
2225
- const patternRows = db.prepare("SELECT id FROM architecture_patterns WHERE repo_id = ?").all(repoId);
2226
- const deleteFts = db.prepare("DELETE FROM architecture_patterns_fts WHERE patternId = ?");
2227
- for (const row of patternRows) deleteFts.run(row.id);
2226
+ db.prepare(
2227
+ "DELETE FROM architecture_patterns_fts WHERE patternId IN (SELECT id FROM architecture_patterns WHERE repo_id = ?)"
2228
+ ).run(repoId);
2228
2229
  db.prepare("DELETE FROM architecture_patterns WHERE repo_id = ?").run(repoId);
2229
2230
  db.prepare("DELETE FROM architecture_components WHERE repo_id = ?").run(repoId);
2230
2231
  db.prepare("DELETE FROM code_imports WHERE repo_id = ?").run(repoId);