Skip to content

Commit 6ae1de0

Browse files
talionwarclaude
andcommitted
fix(analyzer): detect prisma.$transaction, $queryRaw, $executeRaw
Side effects detection now captures prisma client-level operations in addition to model operations. Also updated model detection regex to include $ prefixed methods. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d722191 commit 6ae1de0

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/analyzers/project-analyzer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ function buildApiRouteInfo(file: ParsedFile, framework: Framework): ApiRouteInfo
366366

367367
// Detect models used
368368
const models: string[] = [];
369-
const prismaMatch = file.rawContent.matchAll(/prisma\.(\w+)\./g);
369+
const prismaMatch = file.rawContent.matchAll(/prisma\.(\$?\w+)\./g);
370370
for (const m of prismaMatch) {
371371
models.push(m[1]);
372372
}

src/analyzers/typescript-parser.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ function extractSideEffects(sourceFile: ts.SourceFile): string[] {
304304
if (text.match(/prisma\.\w+\.(findMany|findUnique|create|update|delete|upsert|count|aggregate)/)) {
305305
effects.push(`DB: ${text.split('.').slice(-1)[0]}`);
306306
}
307+
// Detect prisma client-level operations ($transaction, $queryRaw, $executeRaw)
308+
if (text.match(/prisma\.\$(transaction|queryRaw|executeRaw|queryRawUnsafe|executeRawUnsafe)/)) {
309+
effects.push(`DB: ${text.split('.').slice(-1)[0].replace('$', '')}`);
310+
}
307311
}
308312

309313
ts.forEachChild(node, visit);

0 commit comments

Comments
 (0)