secufusion-mcp 2.1.6 → 2.2.0

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.
@@ -7,14 +7,21 @@ export function parseEventTopics(filePath, fileContent, repository) {
7
7
  const topicsConsumed = [];
8
8
  const topicsProduced = [];
9
9
  const violations = [];
10
- const listenerRegex = /@KafkaListener\s*\(\s*topics\s*=\s*["']([^"']+)["']/g;
10
+ // Accepts either a quoted literal ("my-topic") or a bare/qualified constant
11
+ // reference (TOPIC, KafkaTopicConfig.EVENTS_TOPIC) — real Spring code almost
12
+ // always uses the latter, so requiring quotes here missed nearly every consumer.
13
+ const listenerRegex = /@KafkaListener\s*\(\s*topics\s*=\s*(?:["']([^"']+)["']|([A-Za-z_][\w.]*))/g;
11
14
  let match;
12
15
  while ((match = listenerRegex.exec(fileContent)) !== null) {
13
- topicsConsumed.push(match[1]);
16
+ topicsConsumed.push(match[1] || match[2]);
14
17
  }
15
- const producerRegex = /KafkaTemplate.*\.send\(\s*["']([^"']+)["']/g;
18
+ // Matches any *KafkaTemplate-suffixed field (kafkaTemplate, deviceDeletedKafkaTemplate, ...)
19
+ // — not just the literal capitalized type name, which never appears at the call site —
20
+ // and the first .send(...) argument whether it's a quoted literal or a constant reference,
21
+ // allowing the call to wrap onto following lines as it does in practice.
22
+ const producerRegex = /([A-Za-z_]*[Kk]afkaTemplate)\s*\.\s*send\s*\(\s*(?:["']([^"']+)["']|([A-Za-z_][\w.]*))/g;
16
23
  while ((match = producerRegex.exec(fileContent)) !== null) {
17
- topicsProduced.push(match[1]);
24
+ topicsProduced.push(match[2] || match[3]);
18
25
  }
19
26
  if (topicsConsumed.length === 0 && topicsProduced.length === 0) {
20
27
  return events;