@tak-ps/node-cot 12.0.0 → 12.1.0

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.
@@ -0,0 +1,467 @@
1
+ import test from 'tape';
2
+ import CoT from '../index.js';
3
+
4
+ test('Decode Range & Bearing', (t) => {
5
+ const cot = new CoT({
6
+ "event": {
7
+ "_attributes": {
8
+ "version": "2.0",
9
+ "uid": "6da80127-44d4-4bf0-89bd-ecd326afaef1",
10
+ "type": "b-m-r",
11
+ "how": "h-g-i-g-o",
12
+ "time": "2024-09-09T21:53:57Z",
13
+ "start": "2024-09-09T07:28:38Z",
14
+ "stale": "2024-09-09T07:28:38Z"
15
+ },
16
+ "point": {
17
+ "_attributes": {
18
+ "lat": "0.0",
19
+ "lon": "0.0",
20
+ "hae": "9999999.0",
21
+ "ce": "9999999.0",
22
+ "le": "9999999.0"
23
+ }
24
+ },
25
+ "detail": {
26
+ "contact": {
27
+ "_attributes": {
28
+ "callsign": "Walking Alt Route 5"
29
+ }
30
+ },
31
+ "precisionlocation": {
32
+ "_attributes": {
33
+ "geopointsrc": "???",
34
+ "altsrc": "???"
35
+ }
36
+ },
37
+ "link": [
38
+ {
39
+ "_attributes": {
40
+ "uid": "d12c21b6-aabc-4c59-86aa-fac826d14585",
41
+ "callsign": "Walking Alt Route 5 SP",
42
+ "type": "b-m-p-w",
43
+ "point": "38.5144413169673,-108.547391197293"
44
+ }
45
+ },
46
+ {
47
+ "_attributes": {
48
+ "uid": "89a483a4-571b-497c-8763-cfaba6cbb858",
49
+ "callsign": "",
50
+ "type": "b-m-p-c",
51
+ "point": "38.5149532310605,-108.546923921927"
52
+ }
53
+ },
54
+ {
55
+ "_attributes": {
56
+ "uid": "02068dff-ebdc-44b2-a99c-f9991e7c7759",
57
+ "callsign": "",
58
+ "type": "b-m-p-c",
59
+ "point": "38.5150249333408,-108.546926767992"
60
+ }
61
+ },
62
+ {
63
+ "_attributes": {
64
+ "uid": "8c921804-779a-404f-8ef0-428325bc60fc",
65
+ "callsign": "",
66
+ "type": "b-m-p-c",
67
+ "point": "38.5151394174434,-108.546895974379"
68
+ }
69
+ },
70
+ {
71
+ "_attributes": {
72
+ "uid": "60b13bf0-8c57-4786-b694-81201629e1c5",
73
+ "callsign": "",
74
+ "type": "b-m-p-c",
75
+ "point": "38.5151803514502,-108.546844612187"
76
+ }
77
+ },
78
+ {
79
+ "_attributes": {
80
+ "uid": "fd2b6974-a3f0-4892-b140-98a2a87d2013",
81
+ "callsign": "",
82
+ "type": "b-m-p-c",
83
+ "point": "38.5152636957219,-108.546651915511"
84
+ }
85
+ },
86
+ {
87
+ "_attributes": {
88
+ "uid": "cb25f65e-1578-4fd7-8a0c-3476aba257c8",
89
+ "callsign": "",
90
+ "type": "b-m-p-c",
91
+ "point": "38.515552834564,-108.546310782148"
92
+ }
93
+ },
94
+ {
95
+ "_attributes": {
96
+ "uid": "18b9688d-1569-4c81-898f-28e70ad606bf",
97
+ "callsign": "",
98
+ "type": "b-m-p-c",
99
+ "point": "38.5157638654036,-108.546167031945"
100
+ }
101
+ },
102
+ {
103
+ "_attributes": {
104
+ "uid": "113acbcd-e3f8-46c1-b7c2-770b906a788d",
105
+ "callsign": "",
106
+ "type": "b-m-p-c",
107
+ "point": "38.5158532626694,-108.54609208104"
108
+ }
109
+ },
110
+ {
111
+ "_attributes": {
112
+ "uid": "52a1510b-dcd4-4f70-94e1-b8134ca29a3a",
113
+ "callsign": "",
114
+ "type": "b-m-p-c",
115
+ "point": "38.515905780664,-108.546076056876"
116
+ }
117
+ },
118
+ {
119
+ "_attributes": {
120
+ "uid": "86a51fa0-172d-4fda-98ea-ee942ad0eb3b",
121
+ "callsign": "",
122
+ "type": "b-m-p-c",
123
+ "point": "38.5160187860381,-108.54597316944"
124
+ }
125
+ },
126
+ {
127
+ "_attributes": {
128
+ "uid": "70159eb3-76ff-46b3-9b2b-1deaa2b2d184",
129
+ "callsign": "",
130
+ "type": "b-m-p-c",
131
+ "point": "38.5160564186505,-108.545938100192"
132
+ }
133
+ },
134
+ {
135
+ "_attributes": {
136
+ "uid": "f5ccd2e8-e8f7-4d50-8ad2-3942c4533a02",
137
+ "callsign": "",
138
+ "type": "b-m-p-c",
139
+ "point": "38.5160748431091,-108.545892411714"
140
+ }
141
+ },
142
+ {
143
+ "_attributes": {
144
+ "uid": "d516ce2b-7df2-4c03-b173-ec7ccdbb8478",
145
+ "callsign": "",
146
+ "type": "b-m-p-c",
147
+ "point": "38.5163298746682,-108.545661962771"
148
+ }
149
+ },
150
+ {
151
+ "_attributes": {
152
+ "uid": "429be532-07ba-48c8-b513-ef7bac76d028",
153
+ "callsign": "",
154
+ "type": "b-m-p-c",
155
+ "point": "38.5164957921584,-108.545458235843"
156
+ }
157
+ },
158
+ {
159
+ "_attributes": {
160
+ "uid": "e34b7f29-612b-419b-9724-f4ad5da53e2d",
161
+ "callsign": "",
162
+ "type": "b-m-p-c",
163
+ "point": "38.5166222378823,-108.545275877858"
164
+ }
165
+ },
166
+ {
167
+ "_attributes": {
168
+ "uid": "9726f118-c51d-4e21-83c7-badb0c65e60c",
169
+ "callsign": "",
170
+ "type": "b-m-p-c",
171
+ "point": "38.5167698285131,-108.544850396656"
172
+ }
173
+ },
174
+ {
175
+ "_attributes": {
176
+ "uid": "5c3f4891-a0b2-4143-9c0f-37d3d428e892",
177
+ "callsign": "",
178
+ "type": "b-m-p-c",
179
+ "point": "38.5168808127812,-108.54462357225"
180
+ }
181
+ },
182
+ {
183
+ "_attributes": {
184
+ "uid": "7113e124-f7d4-4848-b7d9-d5bb38df336f",
185
+ "callsign": "",
186
+ "type": "b-m-p-c",
187
+ "point": "38.5170064645084,-108.544504597929"
188
+ }
189
+ },
190
+ {
191
+ "_attributes": {
192
+ "uid": "4725ba21-6fcc-455e-aecb-7882046226a5",
193
+ "callsign": "",
194
+ "type": "b-m-p-c",
195
+ "point": "38.5171414968795,-108.544303302554"
196
+ }
197
+ },
198
+ {
199
+ "_attributes": {
200
+ "uid": "26934743-a721-4768-ba2d-0e97a254bd45",
201
+ "callsign": "",
202
+ "type": "b-m-p-c",
203
+ "point": "38.5172291006172,-108.544236333091"
204
+ }
205
+ },
206
+ {
207
+ "_attributes": {
208
+ "uid": "74d82143-89dd-49ea-8053-31d5f0f8ed1e",
209
+ "callsign": "",
210
+ "type": "b-m-p-c",
211
+ "point": "38.5173173331109,-108.544165746257"
212
+ }
213
+ },
214
+ {
215
+ "_attributes": {
216
+ "uid": "4ae15ac5-5839-4cc3-b712-67e9838d0014",
217
+ "callsign": "",
218
+ "type": "b-m-p-c",
219
+ "point": "38.5174202795084,-108.543976946151"
220
+ }
221
+ },
222
+ {
223
+ "_attributes": {
224
+ "uid": "aa7ba4d0-b691-4f18-a3ed-d1a187fff88f",
225
+ "callsign": "",
226
+ "type": "b-m-p-c",
227
+ "point": "38.5175036227552,-108.543831758696"
228
+ }
229
+ },
230
+ {
231
+ "_attributes": {
232
+ "uid": "c506c4e3-9915-4131-88b3-048b948d08f2",
233
+ "callsign": "",
234
+ "type": "b-m-p-c",
235
+ "point": "38.517613542356,-108.543661143095"
236
+ }
237
+ },
238
+ {
239
+ "_attributes": {
240
+ "uid": "01e7a819-668c-4274-9d90-ac055c4da54a",
241
+ "callsign": "",
242
+ "type": "b-m-p-c",
243
+ "point": "38.5178962265508,-108.543325809711"
244
+ }
245
+ },
246
+ {
247
+ "_attributes": {
248
+ "uid": "eae6be64-4e3d-4291-b4ea-d8f713ea2205",
249
+ "callsign": "",
250
+ "type": "b-m-p-c",
251
+ "point": "38.5179179531849,-108.542564835311"
252
+ }
253
+ },
254
+ {
255
+ "_attributes": {
256
+ "uid": "a121deed-8249-4a49-8e56-46a6d9eda53f",
257
+ "callsign": "",
258
+ "type": "b-m-p-c",
259
+ "point": "38.5179294427309,-108.542459293982"
260
+ }
261
+ },
262
+ {
263
+ "_attributes": {
264
+ "uid": "14666337-5cd0-4b1a-955e-cdc4b78fb612",
265
+ "callsign": "",
266
+ "type": "b-m-p-c",
267
+ "point": "38.5179693454348,-108.542373804005"
268
+ }
269
+ },
270
+ {
271
+ "_attributes": {
272
+ "uid": "b4d50ece-d5e9-410b-9938-87da3e6e13d5",
273
+ "callsign": "",
274
+ "point": "38.518518678155,-108.538496613518"
275
+ }
276
+ },
277
+ {
278
+ "_attributes": {
279
+ "uid": "14bbf100-e5cf-423e-9757-edede63f8aeb",
280
+ "callsign": "",
281
+ "type": "b-m-p-c",
282
+ "point": "38.5184750672752,-108.538285083453"
283
+ }
284
+ },
285
+ {
286
+ "_attributes": {
287
+ "uid": "220654a4-be29-4537-93f2-d9dd3a0f8c29",
288
+ "callsign": "",
289
+ "type": "b-m-p-c",
290
+ "point": "38.5184905316775,-108.538071195872"
291
+ }
292
+ },
293
+ {
294
+ "_attributes": {
295
+ "uid": "de932406-0ce6-49d7-8867-18e85395a88a",
296
+ "callsign": "",
297
+ "type": "b-m-p-c",
298
+ "point": "38.5185637113729,-108.537919778987"
299
+ }
300
+ },
301
+ {
302
+ "_attributes": {
303
+ "uid": "52dbaa28-736c-4409-8b1e-ae73e6655688",
304
+ "callsign": "",
305
+ "type": "b-m-p-c",
306
+ "point": "38.5185823219668,-108.537699998988"
307
+ }
308
+ },
309
+ {
310
+ "_attributes": {
311
+ "uid": "44f53570-4ef1-4076-a7e3-f203912c2675",
312
+ "callsign": "",
313
+ "type": "b-m-p-c",
314
+ "point": "38.5186577706628,-108.537545754848"
315
+ }
316
+ },
317
+ {
318
+ "_attributes": {
319
+ "uid": "91c705e6-6052-4cc2-9cd1-0bdd32fb9620",
320
+ "callsign": "",
321
+ "type": "b-m-p-c",
322
+ "point": "38.5187507810887,-108.537197876139"
323
+ }
324
+ },
325
+ {
326
+ "_attributes": {
327
+ "uid": "9c51a2e0-651f-487e-955f-c4723f57c676",
328
+ "callsign": "",
329
+ "type": "b-m-p-c",
330
+ "point": "38.5187772046473,-108.536844373659"
331
+ }
332
+ },
333
+ {
334
+ "_attributes": {
335
+ "uid": "a08ac55e-1e4d-4d3b-8ed9-654c0d0f17a7",
336
+ "callsign": "",
337
+ "type": "b-m-p-c",
338
+ "point": "38.5188887411569,-108.536563687344"
339
+ }
340
+ },
341
+ {
342
+ "_attributes": {
343
+ "uid": "d263cabb-0127-4b1a-b6ec-49ba7955613e",
344
+ "callsign": "",
345
+ "type": "b-m-p-c",
346
+ "point": "38.5189069741421,-108.536444249515"
347
+ }
348
+ },
349
+ {
350
+ "_attributes": {
351
+ "uid": "433be0f6-8e94-4c07-9c2f-12c2ccdbf585",
352
+ "callsign": "",
353
+ "type": "b-m-p-c",
354
+ "point": "38.5189739966264,-108.53616651121"
355
+ }
356
+ },
357
+ {
358
+ "_attributes": {
359
+ "uid": "31978e14-7b66-40ce-8157-6fe281dcb48e",
360
+ "callsign": "",
361
+ "type": "b-m-p-c",
362
+ "point": "38.5189829024848,-108.536065360801"
363
+ }
364
+ },
365
+ {
366
+ "_attributes": {
367
+ "uid": "bb28b040-c5ee-487c-a76b-6f8cedb27354",
368
+ "callsign": "TGT",
369
+ "type": "b-m-p-w",
370
+ "point": "38.5190139289798,-108.535962334931"
371
+ }
372
+ }
373
+ ],
374
+ "link_attr": {
375
+ "_attributes": {
376
+ "color": "-256",
377
+ "method": "Walking",
378
+ "prefix": "CP",
379
+ "direction": "Infil",
380
+ "routetype": "Primary",
381
+ "order": "Ascending Check Points"
382
+ }
383
+ },
384
+ "_flow-tags_": {
385
+ "_attributes": {
386
+ "TAK-Server-e87a0e02420b44a08f6032bcf1877745": "2024-09-09T21:53:57Z"
387
+ }
388
+ }
389
+ }
390
+ }
391
+ })
392
+
393
+ if (!cot.raw.event.detail) {
394
+ t.fail('No Detail Section')
395
+ } else {
396
+ t.ok(cot.raw.event.detail['_flow-tags_']);
397
+ delete cot.raw.event.detail['_flow-tags_'];
398
+
399
+ t.deepEquals({
400
+ id: '6da80127-44d4-4bf0-89bd-ecd326afaef1',
401
+ type: 'Feature',
402
+ properties: {
403
+ callsign: 'Walking Alt Route 5',
404
+ center: [ 0, 0, 9999999 ],
405
+ type: 'b-m-r',
406
+ how: 'h-g-i-g-o',
407
+ precisionlocation: {
408
+ "geopointsrc": "???",
409
+ "altsrc": "???"
410
+ },
411
+ time: '2024-09-09T21:53:57Z',
412
+ start: '2024-09-09T07:28:38Z',
413
+ stale: '2024-09-09T07:28:38Z',
414
+ metadata: {}
415
+ },
416
+ geometry: {
417
+ type: 'LineString',
418
+ coordinates: [
419
+ [ -108.547391197293, 38.5144413169673 ],
420
+ [ -108.546923921927, 38.5149532310605 ],
421
+ [ -108.546926767992, 38.5150249333408 ],
422
+ [ -108.546895974379, 38.5151394174434 ],
423
+ [ -108.546844612187, 38.5151803514502 ],
424
+ [ -108.546651915511, 38.5152636957219 ],
425
+ [ -108.546310782148, 38.515552834564 ],
426
+ [ -108.546167031945, 38.5157638654036 ],
427
+ [ -108.54609208104, 38.5158532626694 ],
428
+ [ -108.546076056876, 38.515905780664 ],
429
+ [ -108.54597316944, 38.5160187860381 ],
430
+ [ -108.545938100192, 38.5160564186505 ],
431
+ [ -108.545892411714, 38.5160748431091 ],
432
+ [ -108.545661962771, 38.5163298746682 ],
433
+ [ -108.545458235843, 38.5164957921584 ],
434
+ [ -108.545275877858, 38.5166222378823 ],
435
+ [ -108.544850396656, 38.5167698285131 ],
436
+ [ -108.54462357225, 38.5168808127812 ],
437
+ [ -108.544504597929, 38.5170064645084 ],
438
+ [ -108.544303302554, 38.5171414968795 ],
439
+ [ -108.544236333091, 38.5172291006172 ],
440
+ [ -108.544165746257, 38.5173173331109 ],
441
+ [ -108.543976946151, 38.5174202795084 ],
442
+ [ -108.543831758696, 38.5175036227552 ],
443
+ [ -108.543661143095, 38.517613542356 ],
444
+ [ -108.543325809711, 38.5178962265508 ],
445
+ [ -108.542564835311, 38.5179179531849 ],
446
+ [ -108.542459293982, 38.5179294427309 ],
447
+ [ -108.542373804005, 38.5179693454348 ],
448
+ [ -108.538496613518, 38.518518678155 ],
449
+ [ -108.538285083453, 38.5184750672752 ],
450
+ [ -108.538071195872, 38.5184905316775 ],
451
+ [ -108.537919778987, 38.5185637113729 ],
452
+ [ -108.537699998988, 38.5185823219668 ],
453
+ [ -108.537545754848, 38.5186577706628 ],
454
+ [ -108.537197876139, 38.5187507810887 ],
455
+ [ -108.536844373659, 38.5187772046473 ],
456
+ [ -108.536563687344, 38.5188887411569 ],
457
+ [ -108.536444249515, 38.5189069741421 ],
458
+ [ -108.53616651121, 38.5189739966264 ],
459
+ [ -108.536065360801, 38.5189829024848 ],
460
+ [ -108.535962334931, 38.5190139289798 ]
461
+ ]
462
+ }
463
+ }, cot.to_geojson());
464
+ }
465
+
466
+ t.end();
467
+ });
package/tsconfig.json CHANGED
@@ -9,6 +9,7 @@
9
9
  "esModuleInterop": true,
10
10
  "target": "es2022",
11
11
  "lib": ["es2022", "dom"],
12
+ "skipLibCheck": true,
12
13
  "noImplicitAny": true,
13
14
  "moduleResolution": "node",
14
15
  "resolveJsonModule": true,