From f55534af903c8a1e6bbdafd262a454ab8e4bf8e4 Mon Sep 17 00:00:00 2001 From: ingalls Date: Wed, 14 Aug 2024 08:34:41 -0600 Subject: [PATCH] Finish up full reversal --- lib/cot.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/cot.ts b/lib/cot.ts index 63f3c04..5b70ada 100644 --- a/lib/cot.ts +++ b/lib/cot.ts @@ -441,24 +441,26 @@ export default class CoT { const detail = this.raw.event.detail; const msg: any = { - ...this.raw.event._attributes, - sendTime: new Date(this.raw.event._attributes.time).getTime(), - startTime: new Date(this.raw.event._attributes.start).getTime(), - staleTime: new Date(this.raw.event._attributes.stale).getTime(), - ...this.raw.event.point._attributes, - detail: { - xmlDetail: '' + cotEvent: { + ...this.raw.event._attributes, + sendTime: new Date(this.raw.event._attributes.time).getTime(), + startTime: new Date(this.raw.event._attributes.start).getTime(), + staleTime: new Date(this.raw.event._attributes.stale).getTime(), + ...this.raw.event.point._attributes, + detail: { + xmlDetail: '' + } } }; for (const key in detail) { if(['contact', 'group', 'precisionlocation', 'status', 'takv', 'track'].includes(key)) { - msg.detail[key] = detail[key]._attributes; + msg.cotEvent.detail[key] = detail[key]._attributes; delete detail[key] } } - msg.detail.xmlDetail = xmljs.js2xml({ + msg.cotEvent.detail.xmlDetail = xmljs.js2xml({ ...detail, metadata: this.metadata }, { compact: true });