feat: aggregate external events and improve security

- Fetch events from external ingestion service in API routes
- Decouple idempotency check from registration in Security utility
- Refine CSV storage logic to verify file content for headers
- Replace Python SDK with comprehensive, feature-rich implementation
This commit is contained in:
Team Dark Devil committed 2026-11-18 03:20:00 +06:00
1 parent 043123dc21
commit 34519c07df
13 files changed
+2099 -451

No files matched your search

+12
View File
@@ -289,6 +289,18 @@ app.post('/internal/flush', async (_req, res) => {
}
});
// Internal endpoint to expose Port 4000 buffered events before CSV flush
app.get('/internal/recent', (req, res) => {
const clientId = req.query.clientId ? String(req.query.clientId) : '';
const limit = Math.min(200, Math.max(1, Number(req.query.limit) || 50));
const filtered =
clientId && clientId !== 'all'
? bufferQueue.filter((evt) => evt.clientId === clientId)
: bufferQueue;
const recent = filtered.slice(-limit).reverse();
res.json({ events: recent, count: recent.length });
});
setupSocketHandlers(io, bufferQueue, writer, {
getRuntimeConfig: () => runtimeConfig,
verifyClientInDb,