@tak-ps/node-cot
Version:
Lightweight JavaScript library for parsing and manipulating TAK messages
54 lines (53 loc) • 1.89 kB
TypeScript
import type { Static } from '@sinclair/typebox';
import type { Feature } from './types/feature.js';
import type { GeoJSONFeature } from './types/geojson.js';
import { InputFeature } from './types/feature.js';
import CoT from './cot.js';
import type { CoTOptions } from './cot.js';
/**
* Convert to and from an XML CoT message
* @class
*
* @param cot A string/buffer containing the XML representation or the xml-js object tree
*
* @prop raw Raw XML-JS representation of CoT
*/
export declare class CoTParser {
static validate(cot: CoT, opts?: {
flow: boolean;
}): CoT;
/**
* Detect difference between CoT messages
* Note: This diffs based on GeoJSON Representation of message
* So if unknown properties are present they will be excluded from the diff
*/
static isDiff(aCoT: CoT, bCoT: CoT, opts?: {
diffMetadata: boolean;
diffStaleStartTime: boolean;
diffDest: boolean;
diffFlow: boolean;
}): Promise<boolean>;
static from_xml(raw: Buffer | string, opts?: CoTOptions): CoT;
static to_xml(cot: CoT): string;
/**
* Return an ATAK Compliant Protobuf
*/
static to_proto(cot: CoT, version?: number): Promise<Uint8Array>;
/**
* Return a GeoJSON Feature from an XML CoT message
*/
static to_geojson(cot: CoT): Promise<Static<typeof Feature>>;
/**
* Parse an ATAK compliant Protobuf to a JS Object
*/
static from_proto(raw: Uint8Array, version?: number, opts?: CoTOptions): Promise<CoT>;
static normalize_geojson(feature: Static<typeof GeoJSONFeature>): Promise<Static<typeof Feature>>;
/**
* Return an CoT Message given a GeoJSON Feature
*
* @param {Object} feature GeoJSON Point Feature
*
* @return {CoT}
*/
static from_geojson(feature: Static<typeof InputFeature>, opts?: CoTOptions): Promise<CoT>;
}