@tak-ps/node-cot 14.0.0 → 14.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/index.d.ts +16 -0
- package/dist/lib/builders/chat.d.ts +18 -0
- package/dist/lib/builders/fileshare.d.ts +6 -0
- package/dist/lib/builders/force-delete.d.ts +4 -0
- package/dist/lib/builders/route.d.ts +4 -0
- package/dist/lib/cot.d.ts +189 -0
- package/dist/lib/data-package.d.ts +248 -0
- package/dist/lib/parser/from_geojson.d.ts +12 -0
- package/dist/lib/parser/normalize_geojson.d.ts +11 -0
- package/dist/lib/parser/normalize_geojson.js +1 -1
- package/dist/lib/parser/normalize_geojson.js.map +1 -1
- package/dist/lib/parser/to_geojson.d.ts +7 -0
- package/dist/lib/parser.d.ts +53 -0
- package/dist/lib/sensor.d.ts +9 -0
- package/dist/lib/type.d.ts +10 -0
- package/dist/lib/types/basemap.d.ts +49 -0
- package/dist/lib/types/cot-types.d.ts +76 -0
- package/dist/lib/types/feature.d.ts +953 -0
- package/dist/lib/types/geojson.d.ts +33 -0
- package/dist/lib/types/iconset.d.ts +48 -0
- package/dist/lib/types/types.d.ts +2161 -0
- package/dist/lib/utils/2525.d.ts +55 -0
- package/dist/lib/utils/color.d.ts +19 -0
- package/dist/lib/utils/type.d.ts +14 -0
- package/dist/lib/utils/util.d.ts +57 -0
- package/dist/lib/xml/basemap.d.ts +23 -0
- package/dist/lib/xml/iconset.d.ts +18 -0
- package/dist/lib/xml-document.d.ts +11 -0
- package/dist/package.json +1 -1
- package/lib/parser/normalize_geojson.ts +1 -1
- package/package.json +1 -1
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare enum Domain {
|
|
2
|
+
ATOM = "a",
|
|
3
|
+
BITS = "b",
|
|
4
|
+
REFERENCE = "r",
|
|
5
|
+
TASK = "t",
|
|
6
|
+
CAPABILITY = "c",
|
|
7
|
+
REPLY = "y"
|
|
8
|
+
}
|
|
9
|
+
export declare enum StandardIdentity {
|
|
10
|
+
PENDING = "p",
|
|
11
|
+
UNKNOWN = "u",
|
|
12
|
+
ASSUMED_FRIEND = "a",
|
|
13
|
+
FRIEND = "f",
|
|
14
|
+
NEUTRAL = "n",
|
|
15
|
+
SUSPECT = "s",
|
|
16
|
+
HOSTILE = "h",
|
|
17
|
+
JOKER = "j",
|
|
18
|
+
FAKER = "k",
|
|
19
|
+
NONE = "o"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @class
|
|
23
|
+
*
|
|
24
|
+
* Convert a COT Atom Type to/from Symbol Identification Code (SIDC)
|
|
25
|
+
* Migrated to TypeScript from the original Kotlin verison
|
|
26
|
+
* @ https://github.com/cyberpython/kotcot under the MIT License
|
|
27
|
+
*/
|
|
28
|
+
export default class Type2525 {
|
|
29
|
+
/**
|
|
30
|
+
* Check a given COT Type to see if it is compatible with conversion to SIDC
|
|
31
|
+
*
|
|
32
|
+
* @param cotType - Cursor On Target Type to test
|
|
33
|
+
*/
|
|
34
|
+
static is2525BConvertable(cotType: string): boolean;
|
|
35
|
+
static domain(cotType: string): Domain;
|
|
36
|
+
static standardIdentity(cotType: string): StandardIdentity;
|
|
37
|
+
/**
|
|
38
|
+
* Given a COT Atom Type, return an SIDC
|
|
39
|
+
*
|
|
40
|
+
* @param cotType - Cursor On Target Type (Note must start with atomic "a")
|
|
41
|
+
*/
|
|
42
|
+
static to2525B(cotType: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Check a given SIDC to see if it is compatible with conversion to CoT Type
|
|
45
|
+
*
|
|
46
|
+
* @param sidc - SIDC to test
|
|
47
|
+
*/
|
|
48
|
+
static isTypeConvertable(sidc: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Given an SIDC, return a CoT Type
|
|
51
|
+
*
|
|
52
|
+
* @param sidc - SIDC to convert
|
|
53
|
+
*/
|
|
54
|
+
static from2525B(sidc: string): string;
|
|
55
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for working with CoT Colours
|
|
3
|
+
*
|
|
4
|
+
* @param {Number|Number[]} color 32bit packged ARGB or [A, R, G, B]
|
|
5
|
+
* @class
|
|
6
|
+
*/
|
|
7
|
+
export default class Color {
|
|
8
|
+
r: number;
|
|
9
|
+
g: number;
|
|
10
|
+
b: number;
|
|
11
|
+
a: number;
|
|
12
|
+
constructor(color: string | number | number[]);
|
|
13
|
+
as_hex(): string;
|
|
14
|
+
as_hexa(): string;
|
|
15
|
+
as_32bit(): number;
|
|
16
|
+
as_opacity(): number;
|
|
17
|
+
as_argb(): number[];
|
|
18
|
+
as_rgb(): number[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Static, TSchema, TUnknown } from '@sinclair/typebox';
|
|
2
|
+
export type TypeOpts = {
|
|
3
|
+
verbose?: boolean;
|
|
4
|
+
default?: boolean;
|
|
5
|
+
convert?: boolean;
|
|
6
|
+
clean?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export default class TypeValidator {
|
|
9
|
+
/**
|
|
10
|
+
* Arbitrary JSON objects occasionally need to get typed as part of an ETL
|
|
11
|
+
* This function provides the ability to strictly type unknown objects at runtime
|
|
12
|
+
*/
|
|
13
|
+
static type<T extends TSchema = TUnknown>(type: T, body: unknown, opts?: TypeOpts): Static<T>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Static } from '@sinclair/typebox';
|
|
2
|
+
import type { EventAttributes, TrackAttributes, Detail, Point } from '../types/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Helper functions for generating CoT data
|
|
5
|
+
* @class
|
|
6
|
+
*/
|
|
7
|
+
export default class Util {
|
|
8
|
+
/**
|
|
9
|
+
* Return an event._attributes object with as many defaults as possible
|
|
10
|
+
*
|
|
11
|
+
* @param type CoT Type
|
|
12
|
+
* @param how CoT how
|
|
13
|
+
* @param time Time of CoT Message - if omitted, current time is used
|
|
14
|
+
* @param start Start Time of CoT - if omitted, current time is used
|
|
15
|
+
* @param stale Expiration of CoT - if null now+20s is used. Alternative an integer representing the ms offset
|
|
16
|
+
*/
|
|
17
|
+
static cot_event_attr(type: string, how: string, time?: Date | string | null, start?: Date | string | null, stale?: Date | string | number | null): Static<typeof EventAttributes>;
|
|
18
|
+
/**
|
|
19
|
+
* Return an event.detail object with as many defaults as possible
|
|
20
|
+
*
|
|
21
|
+
* @param [callsign=UNKNOWN] Display Callsign
|
|
22
|
+
*/
|
|
23
|
+
static cot_event_detail(callsign?: string): Static<typeof Detail>;
|
|
24
|
+
/**
|
|
25
|
+
* Return a track object with as many defaults as possible
|
|
26
|
+
*
|
|
27
|
+
* @param [course] Speed in degrees from north
|
|
28
|
+
* @param [speed=0] Speed in m/s
|
|
29
|
+
*/
|
|
30
|
+
static cot_track_attr(course?: number, speed?: number, slope?: number): Static<typeof TrackAttributes>;
|
|
31
|
+
/**
|
|
32
|
+
* Generate a random UUID
|
|
33
|
+
*/
|
|
34
|
+
static cot_uuid(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Return the current version number this library supports
|
|
37
|
+
*/
|
|
38
|
+
static cot_version(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Generate Null Island CoT point object
|
|
41
|
+
*/
|
|
42
|
+
static cot_point(): Static<typeof Point>;
|
|
43
|
+
/**
|
|
44
|
+
* Generate CoT date objects
|
|
45
|
+
*
|
|
46
|
+
* cot_date() - Time: now, Start: now, Stale: now + 20s
|
|
47
|
+
*
|
|
48
|
+
* @param time Time of CoT Message - if omitted, current time is used
|
|
49
|
+
* @param start Start Time of CoT - if omitted, current time is used
|
|
50
|
+
* @param stale Expiration of CoT - if null now+20s is used. Alternative an integer representing the ms offset
|
|
51
|
+
*/
|
|
52
|
+
static cot_date(time?: Date | string | null, start?: Date | string | null, stale?: Date | string | number | null): {
|
|
53
|
+
time: string;
|
|
54
|
+
start: string;
|
|
55
|
+
stale: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import XMLDocument from '../xml-document.js';
|
|
2
|
+
import type { Static } from '@sinclair/typebox';
|
|
3
|
+
import BasemapSchema from '../types/basemap.js';
|
|
4
|
+
type BasemapType = Static<typeof BasemapSchema>;
|
|
5
|
+
/**
|
|
6
|
+
* Helper class for creating and parsing Basemap XML documents
|
|
7
|
+
*/
|
|
8
|
+
export declare class Basemap extends XMLDocument<BasemapType> {
|
|
9
|
+
/**
|
|
10
|
+
* Return a Basemap from a string XML representation
|
|
11
|
+
*/
|
|
12
|
+
static parse(input: string | Buffer): Basemap;
|
|
13
|
+
to_json(): {
|
|
14
|
+
name: string | undefined;
|
|
15
|
+
url: string;
|
|
16
|
+
minZoom: number | undefined;
|
|
17
|
+
maxZoom: number | undefined;
|
|
18
|
+
tileType: string | undefined;
|
|
19
|
+
tileUpdate: string | undefined;
|
|
20
|
+
backgroundColor: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import XMLDocument from '../xml-document.js';
|
|
2
|
+
import type { Static } from '@sinclair/typebox';
|
|
3
|
+
import IconsetSchema, { IconsetAttributes, IconAttributes } from '../types/iconset.js';
|
|
4
|
+
type IconsetType = Static<typeof IconsetSchema>;
|
|
5
|
+
/**
|
|
6
|
+
* Helper class for creating and parsing Iconset XML documents
|
|
7
|
+
*/
|
|
8
|
+
export declare class Iconset extends XMLDocument<IconsetType> {
|
|
9
|
+
/**
|
|
10
|
+
* Return an Iconset from a string XML representation
|
|
11
|
+
*/
|
|
12
|
+
static parse(input: string | Buffer): Iconset;
|
|
13
|
+
get uid(): string;
|
|
14
|
+
get name(): string;
|
|
15
|
+
icons(): Set<Static<typeof IconAttributes>>;
|
|
16
|
+
to_json(): Static<typeof IconsetAttributes>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ValidateFunction } from 'ajv';
|
|
2
|
+
/**
|
|
3
|
+
* Core XML Document support used for XML fortatted DataPackages documents
|
|
4
|
+
* such as Iconsets or Basemaps
|
|
5
|
+
*/
|
|
6
|
+
export default class XMLDocument<T> {
|
|
7
|
+
raw: T;
|
|
8
|
+
constructor(raw: T);
|
|
9
|
+
static check<U>(input: string, check: ValidateFunction<unknown>): U;
|
|
10
|
+
to_xml(): string;
|
|
11
|
+
}
|
package/dist/package.json
CHANGED
|
@@ -94,7 +94,7 @@ export async function normalize_geojson(
|
|
|
94
94
|
|
|
95
95
|
feature.properties.center = PointOnFeature(feature).geometry.coordinates;
|
|
96
96
|
|
|
97
|
-
feature.properties.archived =
|
|
97
|
+
feature.properties.archived = true;
|
|
98
98
|
|
|
99
99
|
coordEach(feature.geometry, (coord) => {
|
|
100
100
|
return coord.slice(0, 3);
|
package/package.json
CHANGED