Skip to content

Commit

Permalink
Finish up full reversal
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Aug 14, 2024
1 parent 5fb2ccf commit f55534a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/cot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,24 +441,26 @@ export default class CoT {
const detail = this.raw.event.detail;

const msg: any = {

Check warning on line 443 in lib/cot.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type

Check warning on line 443 in lib/cot.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
...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 });
Expand Down

0 comments on commit f55534a

Please sign in to comment.