api-tests-coverage 1.0.21 → 1.0.22

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.
Files changed (125) hide show
  1. package/dist/dashboard/dist/assets/_basePickBy-BKGHUeDJ.js +1 -0
  2. package/dist/dashboard/dist/assets/_baseUniq-CtA-DQF7.js +1 -0
  3. package/dist/dashboard/dist/assets/arc-CbXP3Mc9.js +1 -0
  4. package/dist/dashboard/dist/assets/architectureDiagram-VXUJARFQ-n7QxasMM.js +36 -0
  5. package/dist/dashboard/dist/assets/blockDiagram-VD42YOAC-MXnGwKRn.js +122 -0
  6. package/dist/dashboard/dist/assets/c4Diagram-YG6GDRKO-B3yZ5P9k.js +10 -0
  7. package/dist/dashboard/dist/assets/channel-C7QwX7U8.js +1 -0
  8. package/dist/dashboard/dist/assets/chunk-4BX2VUAB-Dw3El5KF.js +1 -0
  9. package/dist/dashboard/dist/assets/chunk-55IACEB6-T8Jf00IL.js +1 -0
  10. package/dist/dashboard/dist/assets/chunk-B4BG7PRW-DAJalKYJ.js +165 -0
  11. package/dist/dashboard/dist/assets/chunk-DI55MBZ5-p7o_KuDF.js +220 -0
  12. package/dist/dashboard/dist/assets/chunk-FMBD7UC4-B0wUAfQR.js +15 -0
  13. package/dist/dashboard/dist/assets/chunk-QN33PNHL-BTFwTEw8.js +1 -0
  14. package/dist/dashboard/dist/assets/chunk-QZHKN3VN-CNXHnjkC.js +1 -0
  15. package/dist/dashboard/dist/assets/chunk-TZMSLE5B-BIVywBYp.js +1 -0
  16. package/dist/dashboard/dist/assets/classDiagram-2ON5EDUG-Dkb-G0UK.js +1 -0
  17. package/dist/dashboard/dist/assets/classDiagram-v2-WZHVMYZB-Dkb-G0UK.js +1 -0
  18. package/dist/dashboard/dist/assets/clone-BSdXhKmH.js +1 -0
  19. package/dist/dashboard/dist/assets/cose-bilkent-S5V4N54A-DuALhY5a.js +1 -0
  20. package/dist/dashboard/dist/assets/cytoscape.esm-CyJtwmzi.js +331 -0
  21. package/dist/dashboard/dist/assets/dagre-6UL2VRFP-w6endfy9.js +4 -0
  22. package/dist/dashboard/dist/assets/diagram-PSM6KHXK-BDnUwPQC.js +24 -0
  23. package/dist/dashboard/dist/assets/diagram-QEK2KX5R-Cbb7ctAo.js +43 -0
  24. package/dist/dashboard/dist/assets/diagram-S2PKOQOG-76ascveh.js +24 -0
  25. package/dist/dashboard/dist/assets/erDiagram-Q2GNP2WA-BQQnVF0J.js +60 -0
  26. package/dist/dashboard/dist/assets/flowDiagram-NV44I4VS-dKukiSxD.js +162 -0
  27. package/dist/dashboard/dist/assets/ganttDiagram-JELNMOA3-BqnazZuZ.js +267 -0
  28. package/dist/dashboard/dist/assets/gitGraphDiagram-V2S2FVAM-BUFcnXCj.js +65 -0
  29. package/dist/dashboard/dist/assets/graph-CGQIvL3r.js +1 -0
  30. package/dist/dashboard/dist/assets/index-CadOHtae.css +1 -0
  31. package/dist/dashboard/dist/assets/index-DwqfA4mc.js +777 -0
  32. package/dist/dashboard/dist/assets/infoDiagram-HS3SLOUP-BdylFPLI.js +2 -0
  33. package/dist/dashboard/dist/assets/journeyDiagram-XKPGCS4Q-BzJTBkhp.js +139 -0
  34. package/dist/dashboard/dist/assets/kanban-definition-3W4ZIXB7-StKomgio.js +89 -0
  35. package/dist/dashboard/dist/assets/katex-O9d3_IXG.js +261 -0
  36. package/dist/dashboard/dist/assets/layout-BnsX73QS.js +1 -0
  37. package/dist/dashboard/dist/assets/mindmap-definition-VGOIOE7T-HqFRhVFX.js +68 -0
  38. package/dist/dashboard/dist/assets/pieDiagram-ADFJNKIX-2I2tFH0C.js +30 -0
  39. package/dist/dashboard/dist/assets/quadrantDiagram-AYHSOK5B-PlELkdBW.js +7 -0
  40. package/dist/dashboard/dist/assets/requirementDiagram-UZGBJVZJ-_9eLQNcZ.js +64 -0
  41. package/dist/dashboard/dist/assets/sankeyDiagram-TZEHDZUN-DHl1Ss7O.js +10 -0
  42. package/dist/dashboard/dist/assets/sequenceDiagram-WL72ISMW-B9p0m3Uf.js +145 -0
  43. package/dist/dashboard/dist/assets/stateDiagram-FKZM4ZOC--rpDODjT.js +1 -0
  44. package/dist/dashboard/dist/assets/stateDiagram-v2-4FDKWEC3-Ca9uGk46.js +1 -0
  45. package/dist/dashboard/dist/assets/timeline-definition-IT6M3QCI-BCHaGBHB.js +61 -0
  46. package/dist/dashboard/dist/assets/treemap-GDKQZRPO-CgiqDY8M.js +162 -0
  47. package/dist/dashboard/dist/assets/xychartDiagram-PRI3JC2R-BMvBBbeV.js +7 -0
  48. package/dist/dashboard/dist/index.html +14 -0
  49. package/dist/dashboard/dist/reports/business-coverage.json +201 -0
  50. package/dist/dashboard/dist/reports/coverage-intelligence.json +728 -0
  51. package/dist/dashboard/dist/reports/coverage-summary.json +995 -0
  52. package/dist/dashboard/dist/reports/endpoint-coverage.json +336 -0
  53. package/dist/dashboard/dist/reports/error-coverage.json +367 -0
  54. package/dist/dashboard/dist/reports/missing-tests-recommendations.json +285 -0
  55. package/dist/dashboard/dist/reports/risk-prioritization.json +312 -0
  56. package/dist/dashboard/dist/reports/security-coverage.json +299 -0
  57. package/dist/dashboard/dist/vite.svg +1 -0
  58. package/dist/src/generation/context-builder.d.ts +6 -0
  59. package/dist/src/generation/context-builder.d.ts.map +1 -0
  60. package/dist/src/generation/context-builder.js +202 -0
  61. package/dist/src/generation/engine.d.ts +40 -0
  62. package/dist/src/generation/engine.d.ts.map +1 -0
  63. package/dist/src/generation/engine.js +378 -0
  64. package/dist/src/generation/file-router.d.ts +7 -0
  65. package/dist/src/generation/file-router.d.ts.map +1 -0
  66. package/dist/src/generation/file-router.js +79 -0
  67. package/dist/src/generation/gap-extractor.d.ts +12 -0
  68. package/dist/src/generation/gap-extractor.d.ts.map +1 -0
  69. package/dist/src/generation/gap-extractor.js +281 -0
  70. package/dist/src/generation/template-renderer.d.ts +10 -0
  71. package/dist/src/generation/template-renderer.d.ts.map +1 -0
  72. package/dist/src/generation/template-renderer.js +526 -0
  73. package/dist/src/generation/types.d.ts +73 -0
  74. package/dist/src/generation/types.d.ts.map +1 -0
  75. package/dist/src/generation/types.js +2 -0
  76. package/dist/src/index.js +154 -0
  77. package/dist/src/pipeline/detectors/expressMiddlewareDetector.d.ts +21 -0
  78. package/dist/src/pipeline/detectors/expressMiddlewareDetector.d.ts.map +1 -0
  79. package/dist/src/pipeline/detectors/expressMiddlewareDetector.js +201 -0
  80. package/dist/src/pipeline/detectors/flaskBlueprintDetector.d.ts +23 -0
  81. package/dist/src/pipeline/detectors/flaskBlueprintDetector.d.ts.map +1 -0
  82. package/dist/src/pipeline/detectors/flaskBlueprintDetector.js +263 -0
  83. package/dist/src/pipeline/detectors/springDddDetector.d.ts +23 -0
  84. package/dist/src/pipeline/detectors/springDddDetector.d.ts.map +1 -0
  85. package/dist/src/pipeline/detectors/springDddDetector.js +237 -0
  86. package/dist/src/pipeline/detectors/types.d.ts +97 -0
  87. package/dist/src/pipeline/detectors/types.d.ts.map +1 -0
  88. package/dist/src/pipeline/detectors/types.js +15 -0
  89. package/dist/src/reporting.d.ts.map +1 -1
  90. package/dist/src/reporting.js +2 -1
  91. package/dist/src/streaming/detectors/eventBridgeDetector.d.ts +5 -0
  92. package/dist/src/streaming/detectors/eventBridgeDetector.d.ts.map +1 -0
  93. package/dist/src/streaming/detectors/eventBridgeDetector.js +82 -0
  94. package/dist/src/streaming/detectors/kafkaDetector.d.ts +5 -0
  95. package/dist/src/streaming/detectors/kafkaDetector.d.ts.map +1 -0
  96. package/dist/src/streaming/detectors/kafkaDetector.js +97 -0
  97. package/dist/src/streaming/detectors/natsDetector.d.ts +5 -0
  98. package/dist/src/streaming/detectors/natsDetector.d.ts.map +1 -0
  99. package/dist/src/streaming/detectors/natsDetector.js +96 -0
  100. package/dist/src/streaming/detectors/pubsubDetector.d.ts +5 -0
  101. package/dist/src/streaming/detectors/pubsubDetector.d.ts.map +1 -0
  102. package/dist/src/streaming/detectors/pubsubDetector.js +82 -0
  103. package/dist/src/streaming/detectors/rabbitmqDetector.d.ts +5 -0
  104. package/dist/src/streaming/detectors/rabbitmqDetector.d.ts.map +1 -0
  105. package/dist/src/streaming/detectors/rabbitmqDetector.js +103 -0
  106. package/dist/src/streaming/detectors/redisPubsubDetector.d.ts +5 -0
  107. package/dist/src/streaming/detectors/redisPubsubDetector.d.ts.map +1 -0
  108. package/dist/src/streaming/detectors/redisPubsubDetector.js +81 -0
  109. package/dist/src/streaming/detectors/snsDetector.d.ts +5 -0
  110. package/dist/src/streaming/detectors/snsDetector.d.ts.map +1 -0
  111. package/dist/src/streaming/detectors/snsDetector.js +81 -0
  112. package/dist/src/streaming/detectors/sqsDetector.d.ts +5 -0
  113. package/dist/src/streaming/detectors/sqsDetector.d.ts.map +1 -0
  114. package/dist/src/streaming/detectors/sqsDetector.js +81 -0
  115. package/dist/src/streaming/eventCoverage.d.ts +46 -0
  116. package/dist/src/streaming/eventCoverage.d.ts.map +1 -0
  117. package/dist/src/streaming/eventCoverage.js +270 -0
  118. package/dist/src/streaming/types.d.ts +34 -0
  119. package/dist/src/streaming/types.d.ts.map +1 -0
  120. package/dist/src/streaming/types.js +2 -0
  121. package/dist/src/summary/markdownRenderer.d.ts.map +1 -1
  122. package/dist/src/summary/markdownRenderer.js +1 -0
  123. package/dist/src/summary/summaryTypes.d.ts.map +1 -1
  124. package/dist/src/summary/summaryTypes.js +1 -0
  125. package/package.json +1 -1
@@ -269,7 +269,8 @@ function checkThresholds(results, thresholds) {
269
269
  const failures = [];
270
270
  for (const result of results) {
271
271
  const threshold = thresholds[result.type];
272
- if (threshold !== undefined && result.coveragePercent < threshold) {
272
+ // Skip threshold check when there are no items to measure (N/A status)
273
+ if (threshold !== undefined && result.totalItems > 0 && result.coveragePercent < threshold) {
273
274
  const gap = (threshold - result.coveragePercent).toFixed(2);
274
275
  failures.push(`${result.type} coverage ${result.coveragePercent}% is below threshold ${threshold}% (gap: ${gap}%)`);
275
276
  }
@@ -0,0 +1,5 @@
1
+ import type { EventNode } from '../types';
2
+ export declare class EventBridgeDetector {
3
+ detect(fileContent: string, filePath: string): EventNode[];
4
+ }
5
+ //# sourceMappingURL=eventBridgeDetector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventBridgeDetector.d.ts","sourceRoot":"","sources":["../../../../src/streaming/detectors/eventBridgeDetector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AAsB3D,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE;CA2D3D"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventBridgeDetector = void 0;
4
+ function resolveTopicString(raw) {
5
+ var _a;
6
+ const trimmed = raw.trim();
7
+ const envMatch = (_a = trimmed.match(/process\.env\.([A-Z_a-z][A-Z_a-z0-9]*)/)) !== null && _a !== void 0 ? _a : trimmed.match(/process\.env\[['"]([A-Z_a-z][A-Z_a-z0-9]*)['"]\]/);
8
+ if (envMatch) {
9
+ return { topic: `UNRESOLVED:env:${envMatch[1]}`, resolution: `UNRESOLVED:env:${envMatch[1]}` };
10
+ }
11
+ if (trimmed.includes('${')) {
12
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
13
+ }
14
+ const literalMatch = trimmed.match(/^['"`]([^'"`]+)['"`]$/);
15
+ if (literalMatch) {
16
+ return { topic: literalMatch[1], resolution: 'resolved' };
17
+ }
18
+ if (trimmed.match(/^[A-Za-z_][A-Za-z_0-9.]*$/)) {
19
+ return { topic: trimmed, resolution: 'cross-file-unresolved' };
20
+ }
21
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
22
+ }
23
+ class EventBridgeDetector {
24
+ detect(fileContent, filePath) {
25
+ const nodes = [];
26
+ try {
27
+ let idx = 0;
28
+ let match;
29
+ // eventBridge.putEvents({ Entries: [{ EventBusName: '...' }] })
30
+ // PutEventsCommand({ Entries: [{...}] }) — look for EventBusName
31
+ const putEventsRegex = /(?:putEvents|PutEventsCommand)\s*\(\s*\{[^}]*EventBusName\s*:\s*([^,}\n]+)/g;
32
+ while ((match = putEventsRegex.exec(fileContent)) !== null) {
33
+ const { topic, resolution } = resolveTopicString(match[1]);
34
+ nodes.push({
35
+ id: `eventbridge-producer-${filePath}-${idx++}`,
36
+ filePath,
37
+ brokerType: 'eventbridge',
38
+ nodeType: 'producer',
39
+ topic,
40
+ resolution,
41
+ hasTest: false,
42
+ testFiles: [],
43
+ });
44
+ }
45
+ // Also detect Source field in putEvents entries
46
+ const sourceRegex = /(?:putEvents|PutEventsCommand)[^;]*?Source\s*:\s*([^,}\n]+)/g;
47
+ while ((match = sourceRegex.exec(fileContent)) !== null) {
48
+ const { topic, resolution } = resolveTopicString(match[1]);
49
+ nodes.push({
50
+ id: `eventbridge-source-${filePath}-${idx++}`,
51
+ filePath,
52
+ brokerType: 'eventbridge',
53
+ nodeType: 'producer',
54
+ topic,
55
+ resolution,
56
+ hasTest: false,
57
+ testFiles: [],
58
+ });
59
+ }
60
+ // @EventBridgeHandler annotation (AWS Lambda handler)
61
+ const handlerRegex = /@EventBridgeHandler\s*\([^)]*source\s*=\s*([^,)]+)/g;
62
+ while ((match = handlerRegex.exec(fileContent)) !== null) {
63
+ const { topic, resolution } = resolveTopicString(match[1]);
64
+ nodes.push({
65
+ id: `eventbridge-handler-${filePath}-${idx++}`,
66
+ filePath,
67
+ brokerType: 'eventbridge',
68
+ nodeType: 'consumer',
69
+ topic,
70
+ resolution,
71
+ hasTest: false,
72
+ testFiles: [],
73
+ });
74
+ }
75
+ }
76
+ catch {
77
+ // never throws
78
+ }
79
+ return nodes;
80
+ }
81
+ }
82
+ exports.EventBridgeDetector = EventBridgeDetector;
@@ -0,0 +1,5 @@
1
+ import type { EventNode } from '../types';
2
+ export declare class KafkaDetector {
3
+ detect(fileContent: string, filePath: string): EventNode[];
4
+ }
5
+ //# sourceMappingURL=kafkaDetector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kafkaDetector.d.ts","sourceRoot":"","sources":["../../../../src/streaming/detectors/kafkaDetector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AAuB3D,qBAAa,aAAa;IACxB,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE;CAwE3D"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KafkaDetector = void 0;
4
+ function resolveTopicString(raw) {
5
+ var _a;
6
+ const trimmed = raw.trim();
7
+ // env var reference: process.env.TOPIC_NAME or process.env['TOPIC_NAME']
8
+ const envMatch = (_a = trimmed.match(/process\.env\.([A-Z_a-z][A-Z_a-z0-9]*)/)) !== null && _a !== void 0 ? _a : trimmed.match(/process\.env\[['"]([A-Z_a-z][A-Z_a-z0-9]*)['"]\]/);
9
+ if (envMatch) {
10
+ return { topic: `UNRESOLVED:env:${envMatch[1]}`, resolution: `UNRESOLVED:env:${envMatch[1]}` };
11
+ }
12
+ // Template literal or other dynamic: contains ${
13
+ if (trimmed.includes('${')) {
14
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
15
+ }
16
+ // Quoted string literal — the topic is known at compile time
17
+ const literalMatch = trimmed.match(/^['"`]([^'"`]+)['"`]$/);
18
+ if (literalMatch) {
19
+ return { topic: literalMatch[1], resolution: 'resolved' };
20
+ }
21
+ // Bare identifier (variable, constant reference) — topic value unknown without cross-file analysis
22
+ return { topic: `UNRESOLVED:dynamic`, resolution: 'cross-file-unresolved' };
23
+ }
24
+ class KafkaDetector {
25
+ detect(fileContent, filePath) {
26
+ var _a, _b, _c, _d;
27
+ const nodes = [];
28
+ try {
29
+ // new Kafka({...}) — just marks file as kafka-aware, not a node itself
30
+ // producer.send({topic: '...'}) or send({topic: '...'})
31
+ const producerSendRegex = /(?:producer\.send|\.send)\s*\(\s*\{[^}]*topic\s*:\s*([^,}\n]+)/g;
32
+ let match;
33
+ let idx = 0;
34
+ while ((match = producerSendRegex.exec(fileContent)) !== null) {
35
+ const { topic, resolution } = resolveTopicString(match[1]);
36
+ nodes.push({
37
+ id: `kafka-producer-${filePath}-${idx++}`,
38
+ filePath,
39
+ brokerType: 'kafka',
40
+ nodeType: 'producer',
41
+ topic,
42
+ resolution,
43
+ hasTest: false,
44
+ testFiles: [],
45
+ });
46
+ }
47
+ // consumer.subscribe({topics: ['...']}) or subscribe({topic: '...'})
48
+ const subscribeRegex = /(?:consumer\.subscribe|\.subscribe)\s*\(\s*\{[^}]*topics?\s*:\s*(?:\[([^\]]*)\]|([^,}\n]+))/g;
49
+ while ((match = subscribeRegex.exec(fileContent)) !== null) {
50
+ const raw = (_b = (_a = match[1]) !== null && _a !== void 0 ? _a : match[2]) !== null && _b !== void 0 ? _b : '';
51
+ // might be array of topics
52
+ const topicItems = match[1]
53
+ ? match[1].split(',').map((t) => t.trim()).filter(Boolean)
54
+ : [raw.trim()];
55
+ for (const topicRaw of topicItems) {
56
+ const { topic, resolution } = resolveTopicString(topicRaw);
57
+ nodes.push({
58
+ id: `kafka-consumer-${filePath}-${idx++}`,
59
+ filePath,
60
+ brokerType: 'kafka',
61
+ nodeType: 'consumer',
62
+ topic,
63
+ resolution,
64
+ hasTest: false,
65
+ testFiles: [],
66
+ });
67
+ }
68
+ }
69
+ // @KafkaListener(topics = "topicName") or @KafkaListener(topics = {"t1","t2"})
70
+ const kafkaListenerRegex = /@KafkaListener\s*\([^)]*topics\s*=\s*(?:\{([^}]*)\}|([^,)"\s]+|"[^"]*"))/g;
71
+ while ((match = kafkaListenerRegex.exec(fileContent)) !== null) {
72
+ const rawTopics = (_d = (_c = match[1]) !== null && _c !== void 0 ? _c : match[2]) !== null && _d !== void 0 ? _d : '';
73
+ const topicItems = match[1]
74
+ ? rawTopics.split(',').map((t) => t.trim()).filter(Boolean)
75
+ : [rawTopics.trim()];
76
+ for (const topicRaw of topicItems) {
77
+ const { topic, resolution } = resolveTopicString(topicRaw);
78
+ nodes.push({
79
+ id: `kafka-listener-${filePath}-${idx++}`,
80
+ filePath,
81
+ brokerType: 'kafka',
82
+ nodeType: 'consumer',
83
+ topic,
84
+ resolution,
85
+ hasTest: false,
86
+ testFiles: [],
87
+ });
88
+ }
89
+ }
90
+ }
91
+ catch {
92
+ // never throws
93
+ }
94
+ return nodes;
95
+ }
96
+ }
97
+ exports.KafkaDetector = KafkaDetector;
@@ -0,0 +1,5 @@
1
+ import type { EventNode } from '../types';
2
+ export declare class NatsDetector {
3
+ detect(fileContent: string, filePath: string): EventNode[];
4
+ }
5
+ //# sourceMappingURL=natsDetector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"natsDetector.d.ts","sourceRoot":"","sources":["../../../../src/streaming/detectors/natsDetector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AAsB3D,qBAAa,YAAY;IACvB,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE;CA0E3D"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NatsDetector = void 0;
4
+ function resolveTopicString(raw) {
5
+ var _a;
6
+ const trimmed = raw.trim();
7
+ const envMatch = (_a = trimmed.match(/process\.env\.([A-Z_a-z][A-Z_a-z0-9]*)/)) !== null && _a !== void 0 ? _a : trimmed.match(/process\.env\[['"]([A-Z_a-z][A-Z_a-z0-9]*)['"]\]/);
8
+ if (envMatch) {
9
+ return { topic: `UNRESOLVED:env:${envMatch[1]}`, resolution: `UNRESOLVED:env:${envMatch[1]}` };
10
+ }
11
+ if (trimmed.includes('${')) {
12
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
13
+ }
14
+ const literalMatch = trimmed.match(/^['"`]([^'"`]+)['"`]$/);
15
+ if (literalMatch) {
16
+ return { topic: literalMatch[1], resolution: 'resolved' };
17
+ }
18
+ if (trimmed.match(/^[A-Za-z_][A-Za-z_0-9.]*$/)) {
19
+ return { topic: trimmed, resolution: 'cross-file-unresolved' };
20
+ }
21
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
22
+ }
23
+ class NatsDetector {
24
+ detect(fileContent, filePath) {
25
+ const nodes = [];
26
+ try {
27
+ let idx = 0;
28
+ let match;
29
+ // nc.publish('subject', ...) or js.publish('subject', ...)
30
+ const publishRegex = /(?:nc|js|nats)\.publish\s*\(\s*([^,)]+)/g;
31
+ while ((match = publishRegex.exec(fileContent)) !== null) {
32
+ const { topic, resolution } = resolveTopicString(match[1]);
33
+ nodes.push({
34
+ id: `nats-producer-${filePath}-${idx++}`,
35
+ filePath,
36
+ brokerType: 'nats',
37
+ nodeType: 'producer',
38
+ topic,
39
+ resolution,
40
+ hasTest: false,
41
+ testFiles: [],
42
+ });
43
+ }
44
+ // nc.subscribe('subject', ...) or js.subscribe('subject', ...)
45
+ const subscribeRegex = /(?:nc|js|nats)\.subscribe\s*\(\s*([^,)]+)/g;
46
+ while ((match = subscribeRegex.exec(fileContent)) !== null) {
47
+ const { topic, resolution } = resolveTopicString(match[1]);
48
+ nodes.push({
49
+ id: `nats-consumer-${filePath}-${idx++}`,
50
+ filePath,
51
+ brokerType: 'nats',
52
+ nodeType: 'consumer',
53
+ topic,
54
+ resolution,
55
+ hasTest: false,
56
+ testFiles: [],
57
+ });
58
+ }
59
+ // @Subscription('subject') annotation (NestJS NATS microservice)
60
+ const subscriptionAnnotationRegex = /@Subscription\s*\(\s*([^)]+)\)/g;
61
+ while ((match = subscriptionAnnotationRegex.exec(fileContent)) !== null) {
62
+ const { topic, resolution } = resolveTopicString(match[1]);
63
+ nodes.push({
64
+ id: `nats-subscription-${filePath}-${idx++}`,
65
+ filePath,
66
+ brokerType: 'nats',
67
+ nodeType: 'consumer',
68
+ topic,
69
+ resolution,
70
+ hasTest: false,
71
+ testFiles: [],
72
+ });
73
+ }
74
+ // @MessagePattern annotation often used with NATS in NestJS
75
+ const messagePatternRegex = /@MessagePattern\s*\(\s*([^)]+)\)/g;
76
+ while ((match = messagePatternRegex.exec(fileContent)) !== null) {
77
+ const { topic, resolution } = resolveTopicString(match[1]);
78
+ nodes.push({
79
+ id: `nats-pattern-${filePath}-${idx++}`,
80
+ filePath,
81
+ brokerType: 'nats',
82
+ nodeType: 'consumer',
83
+ topic,
84
+ resolution,
85
+ hasTest: false,
86
+ testFiles: [],
87
+ });
88
+ }
89
+ }
90
+ catch {
91
+ // never throws
92
+ }
93
+ return nodes;
94
+ }
95
+ }
96
+ exports.NatsDetector = NatsDetector;
@@ -0,0 +1,5 @@
1
+ import type { EventNode } from '../types';
2
+ export declare class PubsubDetector {
3
+ detect(fileContent: string, filePath: string): EventNode[];
4
+ }
5
+ //# sourceMappingURL=pubsubDetector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pubsubDetector.d.ts","sourceRoot":"","sources":["../../../../src/streaming/detectors/pubsubDetector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AAsB3D,qBAAa,cAAc;IACzB,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE;CA2D3D"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PubsubDetector = void 0;
4
+ function resolveTopicString(raw) {
5
+ var _a;
6
+ const trimmed = raw.trim();
7
+ const envMatch = (_a = trimmed.match(/process\.env\.([A-Z_a-z][A-Z_a-z0-9]*)/)) !== null && _a !== void 0 ? _a : trimmed.match(/process\.env\[['"]([A-Z_a-z][A-Z_a-z0-9]*)['"]\]/);
8
+ if (envMatch) {
9
+ return { topic: `UNRESOLVED:env:${envMatch[1]}`, resolution: `UNRESOLVED:env:${envMatch[1]}` };
10
+ }
11
+ if (trimmed.includes('${')) {
12
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
13
+ }
14
+ const literalMatch = trimmed.match(/^['"`]([^'"`]+)['"`]$/);
15
+ if (literalMatch) {
16
+ return { topic: literalMatch[1], resolution: 'resolved' };
17
+ }
18
+ if (trimmed.match(/^[A-Za-z_][A-Za-z_0-9.]*$/)) {
19
+ return { topic: trimmed, resolution: 'cross-file-unresolved' };
20
+ }
21
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
22
+ }
23
+ class PubsubDetector {
24
+ detect(fileContent, filePath) {
25
+ const nodes = [];
26
+ try {
27
+ let idx = 0;
28
+ let match;
29
+ // pubsub.topic('topicName').publish(...)
30
+ const topicPublishRegex = /(?:pubsub|client)\.topic\s*\(\s*([^)]+)\)\s*\.publish/g;
31
+ while ((match = topicPublishRegex.exec(fileContent)) !== null) {
32
+ const { topic, resolution } = resolveTopicString(match[1]);
33
+ nodes.push({
34
+ id: `pubsub-producer-${filePath}-${idx++}`,
35
+ filePath,
36
+ brokerType: 'pubsub',
37
+ nodeType: 'producer',
38
+ topic,
39
+ resolution,
40
+ hasTest: false,
41
+ testFiles: [],
42
+ });
43
+ }
44
+ // const topic = pubsub.topic('topicName')
45
+ const topicRefRegex = /(?:pubsub|client)\.topic\s*\(\s*([^)]+)\)/g;
46
+ while ((match = topicRefRegex.exec(fileContent)) !== null) {
47
+ const { topic, resolution } = resolveTopicString(match[1]);
48
+ // Only add as topic-definition if not already captured as producer
49
+ nodes.push({
50
+ id: `pubsub-topic-${filePath}-${idx++}`,
51
+ filePath,
52
+ brokerType: 'pubsub',
53
+ nodeType: 'topic-definition',
54
+ topic,
55
+ resolution,
56
+ hasTest: false,
57
+ testFiles: [],
58
+ });
59
+ }
60
+ // subscription.on('message', ...) or pubsub.subscription('subName').on(...)
61
+ const subscriptionRegex = /(?:pubsub|client)\.subscription\s*\(\s*([^)]+)\)/g;
62
+ while ((match = subscriptionRegex.exec(fileContent)) !== null) {
63
+ const { topic, resolution } = resolveTopicString(match[1]);
64
+ nodes.push({
65
+ id: `pubsub-consumer-${filePath}-${idx++}`,
66
+ filePath,
67
+ brokerType: 'pubsub',
68
+ nodeType: 'consumer',
69
+ topic,
70
+ resolution,
71
+ hasTest: false,
72
+ testFiles: [],
73
+ });
74
+ }
75
+ }
76
+ catch {
77
+ // never throws
78
+ }
79
+ return nodes;
80
+ }
81
+ }
82
+ exports.PubsubDetector = PubsubDetector;
@@ -0,0 +1,5 @@
1
+ import type { EventNode } from '../types';
2
+ export declare class RabbitmqDetector {
3
+ detect(fileContent: string, filePath: string): EventNode[];
4
+ }
5
+ //# sourceMappingURL=rabbitmqDetector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rabbitmqDetector.d.ts","sourceRoot":"","sources":["../../../../src/streaming/detectors/rabbitmqDetector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AAsB3D,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE;CAgF3D"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RabbitmqDetector = void 0;
4
+ function resolveTopicString(raw) {
5
+ var _a;
6
+ const trimmed = raw.trim();
7
+ const envMatch = (_a = trimmed.match(/process\.env\.([A-Z_a-z][A-Z_a-z0-9]*)/)) !== null && _a !== void 0 ? _a : trimmed.match(/process\.env\[['"]([A-Z_a-z][A-Z_a-z0-9]*)['"]\]/);
8
+ if (envMatch) {
9
+ return { topic: `UNRESOLVED:env:${envMatch[1]}`, resolution: `UNRESOLVED:env:${envMatch[1]}` };
10
+ }
11
+ if (trimmed.includes('${')) {
12
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
13
+ }
14
+ const literalMatch = trimmed.match(/^['"`]([^'"`]+)['"`]$/);
15
+ if (literalMatch) {
16
+ return { topic: literalMatch[1], resolution: 'resolved' };
17
+ }
18
+ if (trimmed.match(/^[A-Za-z_][A-Za-z_0-9.]*$/)) {
19
+ return { topic: trimmed, resolution: 'cross-file-unresolved' };
20
+ }
21
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
22
+ }
23
+ class RabbitmqDetector {
24
+ detect(fileContent, filePath) {
25
+ var _a, _b;
26
+ const nodes = [];
27
+ try {
28
+ let idx = 0;
29
+ // channel.sendToQueue('queueName', ...)
30
+ const sendToQueueRegex = /channel\.sendToQueue\s*\(\s*([^,)]+)/g;
31
+ let match;
32
+ while ((match = sendToQueueRegex.exec(fileContent)) !== null) {
33
+ const { topic, resolution } = resolveTopicString(match[1]);
34
+ nodes.push({
35
+ id: `rabbitmq-producer-${filePath}-${idx++}`,
36
+ filePath,
37
+ brokerType: 'rabbitmq',
38
+ nodeType: 'producer',
39
+ topic,
40
+ resolution,
41
+ hasTest: false,
42
+ testFiles: [],
43
+ });
44
+ }
45
+ // channel.assertQueue('queueName', ...)
46
+ const assertQueueRegex = /channel\.assertQueue\s*\(\s*([^,)]+)/g;
47
+ while ((match = assertQueueRegex.exec(fileContent)) !== null) {
48
+ const { topic, resolution } = resolveTopicString(match[1]);
49
+ nodes.push({
50
+ id: `rabbitmq-queue-def-${filePath}-${idx++}`,
51
+ filePath,
52
+ brokerType: 'rabbitmq',
53
+ nodeType: 'topic-definition',
54
+ topic,
55
+ resolution,
56
+ hasTest: false,
57
+ testFiles: [],
58
+ });
59
+ }
60
+ // channel.consume('queueName', ...) — consumer
61
+ const consumeRegex = /channel\.consume\s*\(\s*([^,)]+)/g;
62
+ while ((match = consumeRegex.exec(fileContent)) !== null) {
63
+ const { topic, resolution } = resolveTopicString(match[1]);
64
+ nodes.push({
65
+ id: `rabbitmq-consumer-${filePath}-${idx++}`,
66
+ filePath,
67
+ brokerType: 'rabbitmq',
68
+ nodeType: 'consumer',
69
+ topic,
70
+ resolution,
71
+ hasTest: false,
72
+ testFiles: [],
73
+ });
74
+ }
75
+ // @RabbitListener(queues = "queueName") or @RabbitMQListener
76
+ const rabbitListenerRegex = /@Rabbit(?:Listener|MQListener)\s*\([^)]*queues?\s*=\s*(?:\{([^}]*)\}|([^,)"]+|"[^"]*"))/g;
77
+ while ((match = rabbitListenerRegex.exec(fileContent)) !== null) {
78
+ const rawTopics = (_b = (_a = match[1]) !== null && _a !== void 0 ? _a : match[2]) !== null && _b !== void 0 ? _b : '';
79
+ const topicItems = match[1]
80
+ ? rawTopics.split(',').map((t) => t.trim()).filter(Boolean)
81
+ : [rawTopics.trim()];
82
+ for (const topicRaw of topicItems) {
83
+ const { topic, resolution } = resolveTopicString(topicRaw);
84
+ nodes.push({
85
+ id: `rabbitmq-listener-${filePath}-${idx++}`,
86
+ filePath,
87
+ brokerType: 'rabbitmq',
88
+ nodeType: 'consumer',
89
+ topic,
90
+ resolution,
91
+ hasTest: false,
92
+ testFiles: [],
93
+ });
94
+ }
95
+ }
96
+ }
97
+ catch {
98
+ // never throws
99
+ }
100
+ return nodes;
101
+ }
102
+ }
103
+ exports.RabbitmqDetector = RabbitmqDetector;
@@ -0,0 +1,5 @@
1
+ import type { EventNode } from '../types';
2
+ export declare class RedisPubsubDetector {
3
+ detect(fileContent: string, filePath: string): EventNode[];
4
+ }
5
+ //# sourceMappingURL=redisPubsubDetector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redisPubsubDetector.d.ts","sourceRoot":"","sources":["../../../../src/streaming/detectors/redisPubsubDetector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AAsB3D,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE;CA0D3D"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RedisPubsubDetector = void 0;
4
+ function resolveTopicString(raw) {
5
+ var _a;
6
+ const trimmed = raw.trim();
7
+ const envMatch = (_a = trimmed.match(/process\.env\.([A-Z_a-z][A-Z_a-z0-9]*)/)) !== null && _a !== void 0 ? _a : trimmed.match(/process\.env\[['"]([A-Z_a-z][A-Z_a-z0-9]*)['"]\]/);
8
+ if (envMatch) {
9
+ return { topic: `UNRESOLVED:env:${envMatch[1]}`, resolution: `UNRESOLVED:env:${envMatch[1]}` };
10
+ }
11
+ if (trimmed.includes('${')) {
12
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
13
+ }
14
+ const literalMatch = trimmed.match(/^['"`]([^'"`]+)['"`]$/);
15
+ if (literalMatch) {
16
+ return { topic: literalMatch[1], resolution: 'resolved' };
17
+ }
18
+ if (trimmed.match(/^[A-Za-z_][A-Za-z_0-9.]*$/)) {
19
+ return { topic: trimmed, resolution: 'cross-file-unresolved' };
20
+ }
21
+ return { topic: 'UNRESOLVED:dynamic', resolution: 'UNRESOLVED:dynamic' };
22
+ }
23
+ class RedisPubsubDetector {
24
+ detect(fileContent, filePath) {
25
+ const nodes = [];
26
+ try {
27
+ let idx = 0;
28
+ let match;
29
+ // redis.publish('channel', message) or publisher.publish('channel', ...)
30
+ const publishRegex = /(?:redis|publisher|pub|client)\.publish\s*\(\s*([^,)]+)/g;
31
+ while ((match = publishRegex.exec(fileContent)) !== null) {
32
+ const { topic, resolution } = resolveTopicString(match[1]);
33
+ nodes.push({
34
+ id: `redis-pubsub-producer-${filePath}-${idx++}`,
35
+ filePath,
36
+ brokerType: 'redis-pubsub',
37
+ nodeType: 'producer',
38
+ topic,
39
+ resolution,
40
+ hasTest: false,
41
+ testFiles: [],
42
+ });
43
+ }
44
+ // redis.subscribe('channel', callback) or subscriber.subscribe('channel', ...)
45
+ const subscribeRegex = /(?:redis|subscriber|sub|client)\.subscribe\s*\(\s*([^,)]+)/g;
46
+ while ((match = subscribeRegex.exec(fileContent)) !== null) {
47
+ const { topic, resolution } = resolveTopicString(match[1]);
48
+ nodes.push({
49
+ id: `redis-pubsub-consumer-${filePath}-${idx++}`,
50
+ filePath,
51
+ brokerType: 'redis-pubsub',
52
+ nodeType: 'consumer',
53
+ topic,
54
+ resolution,
55
+ hasTest: false,
56
+ testFiles: [],
57
+ });
58
+ }
59
+ // redis.psubscribe('pattern*', callback) — pattern subscribe
60
+ const psubscribeRegex = /(?:redis|subscriber|sub|client)\.psubscribe\s*\(\s*([^,)]+)/g;
61
+ while ((match = psubscribeRegex.exec(fileContent)) !== null) {
62
+ const { topic, resolution } = resolveTopicString(match[1]);
63
+ nodes.push({
64
+ id: `redis-pubsub-psubscribe-${filePath}-${idx++}`,
65
+ filePath,
66
+ brokerType: 'redis-pubsub',
67
+ nodeType: 'consumer',
68
+ topic,
69
+ resolution,
70
+ hasTest: false,
71
+ testFiles: [],
72
+ });
73
+ }
74
+ }
75
+ catch {
76
+ // never throws
77
+ }
78
+ return nodes;
79
+ }
80
+ }
81
+ exports.RedisPubsubDetector = RedisPubsubDetector;
@@ -0,0 +1,5 @@
1
+ import type { EventNode } from '../types';
2
+ export declare class SnsDetector {
3
+ detect(fileContent: string, filePath: string): EventNode[];
4
+ }
5
+ //# sourceMappingURL=snsDetector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snsDetector.d.ts","sourceRoot":"","sources":["../../../../src/streaming/detectors/snsDetector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AAsB3D,qBAAa,WAAW;IACtB,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE;CA0D3D"}