From 9427029e3b90dce93a3e15675f934eefbd96c035 Mon Sep 17 00:00:00 2001 From: Kevin Qualters Date: Thu, 19 Mar 2020 13:59:40 -0400 Subject: [PATCH] Use common event model for determining if event is v0 or v1 --- .../server/routes/resolver/utils/normalize.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/endpoint/server/routes/resolver/utils/normalize.ts b/x-pack/plugins/endpoint/server/routes/resolver/utils/normalize.ts index 67a532d949e81..6d5ac8efdc1da 100644 --- a/x-pack/plugins/endpoint/server/routes/resolver/utils/normalize.ts +++ b/x-pack/plugins/endpoint/server/routes/resolver/utils/normalize.ts @@ -4,28 +4,25 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ResolverEvent, LegacyEndpointEvent } from '../../../../common/types'; - -function isLegacyData(data: ResolverEvent): data is LegacyEndpointEvent { - return data.agent?.type === 'endgame'; -} +import { ResolverEvent } from '../../../../common/types'; +import { isLegacyEvent } from '../../../../common/models/event'; export function extractEventID(event: ResolverEvent) { - if (isLegacyData(event)) { + if (isLegacyEvent(event)) { return String(event.endgame.serial_event_id); } return event.event.id; } export function extractEntityID(event: ResolverEvent) { - if (isLegacyData(event)) { + if (isLegacyEvent(event)) { return String(event.endgame.unique_pid); } return event.process.entity_id; } export function extractParentEntityID(event: ResolverEvent) { - if (isLegacyData(event)) { + if (isLegacyEvent(event)) { const ppid = event.endgame.unique_ppid; return ppid && String(ppid); // if unique_ppid is undefined return undefined }