UNPKG

rhombus-node-mcp

Version:
48 lines (47 loc) 1.71 kB
import { postApi } from "../network/network.js"; function mapAuditEvents(events) { return events.map(evt => ({ uuid: evt.uuid ?? undefined, action: evt.action ?? undefined, displayText: evt.displayText ?? undefined, principalName: evt.principalName ?? undefined, principalUuid: evt.principalUuid ?? undefined, targetName: evt.targetName ?? undefined, targetUuid: evt.targetUuid ?? undefined, timestamp: evt.timestamp ?? undefined, failure: evt.failure ?? undefined, sourceIp: evt.sourceIp ?? undefined, sourceCity: evt.sourceCity ?? undefined, sourceCountry: evt.sourceCountry ?? undefined, })); } export async function getAuditFeedForPrincipal(principalUuid, maxResults, requestModifiers, sessionId) { const res = await postApi({ route: "/report/getAuditFeedForPrincipal", body: { principalUuid, maxResults: maxResults ?? 50, }, modifiers: requestModifiers, sessionId, }); if (res.error) { throw new Error(res.errorMsg ?? "Failed to get audit feed for principal"); } return mapAuditEvents(res.auditEvents ?? []); } export async function getAuditFeedForTarget(targetUuid, maxResults, requestModifiers, sessionId) { const res = await postApi({ route: "/report/getAuditFeedForTarget", body: { targetUuid, maxResults: maxResults ?? 50, }, modifiers: requestModifiers, sessionId, }); if (res.error) { throw new Error(res.errorMsg ?? "Failed to get audit feed for target"); } return mapAuditEvents(res.auditEvents ?? []); }