refactor(dynamic): add broker loopback stubs for Kafka, SQS, Pub/Sub, RabbitMQ, and NATS, enhance stub initialization and event recording logic across supported languages, and expand test coverage

This commit is contained in:
elipeter 2026-05-26 09:35:52 -05:00
parent 170d2028d0
commit c57cd233fc
8 changed files with 346 additions and 2 deletions

View file

@ -920,6 +920,17 @@ if (typeof _handler !== 'function') {{
}}
const _broker = new NyxSqsLoopback();
function _nyxRecordBrokerPublish(envName, destination, body) {{
const path = process.env[envName] || '';
if (!path) return;
try {{
require('fs').appendFileSync(
path,
String(destination).replace(/\t/g, ' ') + '\t' + String(body) + '\n',
'utf8'
);
}} catch (_) {{}}
}}
_broker.subscribe({queue:?}, async (envelope) => {{
try {{
// Sink-reachability sentinel — runner's `vuln_fired && sink_hit`
@ -933,6 +944,7 @@ _broker.subscribe({queue:?}, async (envelope) => {{
(async () => {{
process.stdout.write({publish_marker:?} + ' ' + {queue:?} + '\n');
_nyxRecordBrokerPublish('NYX_SQS_LOG', {queue:?}, payload);
_broker.publish({queue:?}, payload);
}})();
"#,