@tak-ps/node-cot 14.59.0 → 14.60.1

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.
Files changed (77) hide show
  1. package/.github/workflows/doc.yml +5 -0
  2. package/.oxlintrc.json +100 -0
  3. package/CHANGELOG.md +9 -0
  4. package/README.md +17 -0
  5. package/cli.ts +21 -22
  6. package/dist/cli.js +18 -19
  7. package/dist/cli.js.map +1 -1
  8. package/dist/lib/builders/chat.d.ts +4 -4
  9. package/dist/lib/builders/chat.js +3 -6
  10. package/dist/lib/builders/chat.js.map +1 -1
  11. package/dist/lib/builders/route.js +2 -2
  12. package/dist/lib/cot.js +44 -56
  13. package/dist/lib/cot.js.map +1 -1
  14. package/dist/lib/data-package.d.ts +3 -3
  15. package/dist/lib/data-package.js +68 -81
  16. package/dist/lib/data-package.js.map +1 -1
  17. package/dist/lib/parser/from_geojson.js +24 -30
  18. package/dist/lib/parser/from_geojson.js.map +1 -1
  19. package/dist/lib/parser/normalize_geojson.js +22 -22
  20. package/dist/lib/parser/normalize_geojson.js.map +1 -1
  21. package/dist/lib/parser/to_geojson.js +94 -86
  22. package/dist/lib/parser/to_geojson.js.map +1 -1
  23. package/dist/lib/parser-normalize.d.ts +5 -0
  24. package/dist/lib/parser-normalize.js +25 -8
  25. package/dist/lib/parser-normalize.js.map +1 -1
  26. package/dist/lib/parser.js +96 -81
  27. package/dist/lib/parser.js.map +1 -1
  28. package/dist/lib/sensor.js +11 -5
  29. package/dist/lib/sensor.js.map +1 -1
  30. package/dist/lib/type.js +5 -10
  31. package/dist/lib/type.js.map +1 -1
  32. package/dist/lib/types/cot-types.js +4 -4
  33. package/dist/lib/types/cot-types.js.map +1 -1
  34. package/dist/lib/types/feature.d.ts +755 -755
  35. package/dist/lib/types/types.d.ts +55 -9
  36. package/dist/lib/types/types.js +18 -3
  37. package/dist/lib/types/types.js.map +1 -1
  38. package/dist/lib/utils/2525.js +139 -92
  39. package/dist/lib/utils/2525.js.map +1 -1
  40. package/dist/lib/utils/color.js +1 -1
  41. package/dist/lib/utils/color.js.map +1 -1
  42. package/dist/lib/utils/type.js +5 -10
  43. package/dist/lib/utils/type.js.map +1 -1
  44. package/dist/lib/utils/util.d.ts +5 -0
  45. package/dist/lib/utils/util.js +25 -16
  46. package/dist/lib/utils/util.js.map +1 -1
  47. package/dist/lib/xml/basemap.js +10 -9
  48. package/dist/lib/xml/basemap.js.map +1 -1
  49. package/dist/lib/xml/iconset.js +1 -1
  50. package/dist/lib/xml/iconset.js.map +1 -1
  51. package/dist/lib/xml-document.d.ts +1 -1
  52. package/dist/lib/xml-document.js +6 -3
  53. package/dist/lib/xml-document.js.map +1 -1
  54. package/dist/package.json +8 -8
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/lib/builders/chat.ts +3 -3
  57. package/lib/builders/route.ts +2 -2
  58. package/lib/cot.ts +42 -47
  59. package/lib/data-package.ts +72 -76
  60. package/lib/parser/from_geojson.ts +24 -29
  61. package/lib/parser/normalize_geojson.ts +22 -26
  62. package/lib/parser/to_geojson.ts +105 -94
  63. package/lib/parser-normalize.ts +30 -9
  64. package/lib/parser.ts +121 -92
  65. package/lib/sensor.ts +12 -5
  66. package/lib/type.ts +5 -5
  67. package/lib/types/cot-types.ts +4 -4
  68. package/lib/types/types.ts +20 -3
  69. package/lib/utils/2525.ts +147 -96
  70. package/lib/utils/color.ts +1 -1
  71. package/lib/utils/type.ts +5 -5
  72. package/lib/utils/util.ts +31 -15
  73. package/lib/xml/basemap.ts +10 -9
  74. package/lib/xml/iconset.ts +1 -1
  75. package/lib/xml-document.ts +7 -4
  76. package/package.json +8 -8
  77. package/eslint.config.js +0 -15
@@ -1,5 +1,5 @@
1
1
  import Err from '@openaddresses/batch-error';
2
- import xmljs, {} from '@tak-ps/xml-js';
2
+ import { xml2js, js2xml } from '@tak-ps/xml-js';
3
3
  /**
4
4
  * Core XML Document support used for XML fortatted DataPackages documents
5
5
  * such as Iconsets or Basemaps
@@ -9,15 +9,18 @@ export default class XMLDocument {
9
9
  constructor(raw) {
10
10
  this.raw = raw;
11
11
  }
12
+ // oxlint-disable-next-line typescript/no-unnecessary-type-parameters
12
13
  static check(input, check) {
13
- const xml = xmljs.xml2js(input, { compact: true });
14
+ const xml = xml2js(input, { compact: true });
14
15
  check(xml);
15
16
  if (check.errors)
16
17
  throw new Err(400, null, `${check.errors[0].message} (${check.errors[0].instancePath})`);
18
+ // oxlint-disable-next-line typescript/no-unsafe-type-assertion
17
19
  return xml;
18
20
  }
19
21
  to_xml() {
20
- return xmljs.js2xml(this.raw, { compact: true });
22
+ // oxlint-disable-next-line typescript/no-unsafe-type-assertion
23
+ return js2xml(this.raw, { compact: true });
21
24
  }
22
25
  }
23
26
  //# sourceMappingURL=xml-document.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"xml-document.js","sourceRoot":"","sources":["../../lib/xml-document.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAE7C,OAAO,KAAK,EAAE,EAAgB,MAAM,gBAAgB,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC5B,GAAG,CAAI;IAEP,YAAY,GAAM;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,KAAK,CAAI,KAAa,EAAE,KAAgC;QAC3D,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QAElD,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,KAAK,CAAC,MAAM;YAAE,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC;QAE3G,OAAO,GAAQ,CAAC;IACpB,CAAC;IAED,MAAM;QACF,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAc,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;CACJ"}
1
+ {"version":3,"file":"xml-document.js","sourceRoot":"","sources":["../../lib/xml-document.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgB,MAAM,gBAAgB,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC5B,GAAG,CAAI;IAEP,YAAY,GAAM;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,qEAAqE;IACrE,MAAM,CAAC,KAAK,CAAI,KAAa,EAAE,KAAuB;QAClD,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QAE5C,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,KAAK,CAAC,MAAM;YAAE,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC;QAE3G,+DAA+D;QAC/D,OAAO,GAAQ,CAAC;IACpB,CAAC;IAED,MAAM;QACF,+DAA+D;QAC/D,OAAO,MAAM,CAAC,IAAI,CAAC,GAAc,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;CACJ"}
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/node-cot",
3
3
  "type": "module",
4
- "version": "14.59.0",
4
+ "version": "14.60.1",
5
5
  "description": "Lightweight JavaScript library for parsing and manipulating TAK messages",
6
6
  "author": "Nick Ingalls <nick@ingalls.ca>",
7
7
  "types": "index.ts",
@@ -21,9 +21,9 @@
21
21
  },
22
22
  "scripts": {
23
23
  "test": "c8 --reporter=lcov --reporter html tsx --test test/*.ts",
24
- "lint": "eslint *.ts lib/ test/",
24
+ "lint": "oxlint --type-aware --deny-warnings --report-unused-disable-directives",
25
25
  "doc": "typedoc index.ts",
26
- "build": "tsc --build && cp package.json dist/ && cp ./lib/types/*.xml ./dist/lib/types/ && mkdir -p ./dist/lib/proto/ && cp lib/proto/* ./dist/lib/proto/",
26
+ "build": "node node_modules/typescript7/bin/tsc --build && cp package.json dist/ && cp ./lib/types/*.xml ./dist/lib/types/ && mkdir -p ./dist/lib/proto/ && cp lib/proto/* ./dist/lib/proto/",
27
27
  "pretest": "npm run lint"
28
28
  },
29
29
  "engines": {
@@ -45,7 +45,7 @@
45
45
  "ajv": "^8.12.0",
46
46
  "color": "^5.0.0",
47
47
  "geomagnetism": "^0.2.0",
48
- "json-diff-ts": "^4.0.1",
48
+ "json-diff-ts": "^5.0.0",
49
49
  "mil-std-2525": "^0.2.8",
50
50
  "milstandard-e": "^0.2.14",
51
51
  "milsymbol": "^3.0.2",
@@ -53,14 +53,14 @@
53
53
  "protobufjs": "^8.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@eslint/js": "^10.0.1",
57
56
  "@types/node": "^26.0.0",
58
57
  "c8": "^12.0.0",
59
- "eslint": "^10.0.0",
58
+ "oxlint": "^1.94.0",
59
+ "oxlint-tsgolint": "^7.0.2007",
60
60
  "tsx": "^4.20.3",
61
61
  "typedoc": "^0.28.0",
62
- "typescript": "^6.0.0",
63
- "typescript-eslint": "^8.0.0"
62
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
63
+ "typescript7": "npm:typescript@^7.0.2"
64
64
  },
65
65
  "repository": {
66
66
  "type": "git",
@@ -1 +1 @@
1
- {"root":["../index.ts","../cli.ts","../test/2525.test.ts","../test/basemaps.test.ts","../test/basic.test.ts","../test/chat.test.ts","../test/cli.test.ts","../test/cot-address.test.ts","../test/cot-emergency.test.ts","../test/cot-fileshare.test.ts","../test/cot-image.test.ts","../test/cot-itak.test.ts","../test/cot-link-entity.test.ts","../test/cot-mma.test.ts","../test/cot-range-and-bearing.test.ts","../test/cot-routes.test.ts","../test/cot-shapes.test.ts","../test/cot-spotted.test.ts","../test/cot-types.test.ts","../test/cot-uas-tool.test.ts","../test/cot-user-draw.test.ts","../test/cot-video.test.ts","../test/cot_is.test.ts","../test/creator.test.ts","../test/dest.test.ts","../test/diff.test.ts","../test/flow-tags.test.ts","../test/force-delete.ts","../test/from_geojson.test.ts","../test/from_xml_document.test.ts","../test/iconset.test.ts","../test/milicon.test.ts","../test/milsym.test.ts","../test/newlines.test.ts","../test/normalize_geojson.test.ts","../test/package.test.ts","../test/proto-precisionlocation.test.ts","../test/reversal-geojson.test.ts","../test/reversal-proto.test.ts","../test/stream.ts","../test/taskings-mission.test.ts","../test/util.test.ts","../test/validation.test.ts","../lib/cot.ts","../lib/data-package.ts","../lib/parser-normalize.ts","../lib/parser.ts","../lib/sensor.ts","../lib/type.ts","../lib/xml-document.ts","../lib/xml/basemap.ts","../lib/xml/iconset.ts"],"version":"6.0.3"}
1
+ {"version":"7.0.2","root":["../index.ts","../cli.ts","../test/2525.test.ts","../test/basemaps.test.ts","../test/basic.test.ts","../test/chat.test.ts","../test/cli.test.ts","../test/cot-address.test.ts","../test/cot-emergency.test.ts","../test/cot-fileshare.test.ts","../test/cot-height.test.ts","../test/cot-image.test.ts","../test/cot-itak.test.ts","../test/cot-link-entity.test.ts","../test/cot-mma.test.ts","../test/cot-range-and-bearing.test.ts","../test/cot-routes.test.ts","../test/cot-shapes.test.ts","../test/cot-spotted.test.ts","../test/cot-types.test.ts","../test/cot-uas-tool.test.ts","../test/cot-user-draw.test.ts","../test/cot-video.test.ts","../test/cot_is.test.ts","../test/creator.test.ts","../test/dest.test.ts","../test/diff.test.ts","../test/flow-tags.test.ts","../test/force-delete.ts","../test/from_geojson.test.ts","../test/from_xml_document.test.ts","../test/iconset.test.ts","../test/milicon.test.ts","../test/milsym.test.ts","../test/newlines.test.ts","../test/normalize_geojson.test.ts","../test/package.test.ts","../test/proto-precisionlocation.test.ts","../test/reversal-geojson.test.ts","../test/reversal-proto.test.ts","../test/stream.ts","../test/taskings-mission.test.ts","../test/util.test.ts","../test/validation.test.ts","../lib/cot.ts","../lib/data-package.ts","../lib/parser-normalize.ts","../lib/parser.ts","../lib/sensor.ts","../lib/type.ts","../lib/xml-document.ts","../lib/xml/basemap.ts","../lib/xml/iconset.ts"],"packageJsons":["../node_modules/@archiver/archiver/package.json","../node_modules/@archiver/tar-stream/package.json","../node_modules/@archiver/zip-stream/package.json","../node_modules/@openaddresses/batch-error/package.json","../node_modules/@orbat-mapper/convert-symbology/package.json","../node_modules/@sinclair/typebox/package.json","../node_modules/@sinclair/typebox/value/package.json","../node_modules/@tak-ps/xml-js/dist/package.json","../node_modules/@tak-ps/xml-js/package.json","../node_modules/@turf/destination/package.json","../node_modules/@turf/ellipse/package.json","../node_modules/@turf/helpers/package.json","../node_modules/@turf/meta/package.json","../node_modules/@turf/point-on-feature/package.json","../node_modules/@turf/sector/package.json","../node_modules/@turf/truncate/package.json","../node_modules/@types/body-parser/package.json","../node_modules/@types/connect/package.json","../node_modules/@types/express-serve-static-core/package.json","../node_modules/@types/express/package.json","../node_modules/@types/geojson/package.json","../node_modules/@types/http-errors/package.json","../node_modules/@types/node/package.json","../node_modules/@types/qs/package.json","../node_modules/@types/range-parser/package.json","../node_modules/@types/send/package.json","../node_modules/@types/serve-static/package.json","../node_modules/ajv/package.json","../node_modules/color-convert/package.json","../node_modules/color/package.json","../node_modules/fast-uri/package.json","../node_modules/json-diff-ts/package.json","../node_modules/node-stream-zip/package.json","../node_modules/protobufjs/package.json","../node_modules/undici-types/package.json","../package.json"],"missingPackageJsons":["../node_modules/@archiver/archiver/dist/package.json","../node_modules/@archiver/tar-stream/dist/package.json","../node_modules/@archiver/zip-stream/dist/package.json","../node_modules/@orbat-mapper/convert-symbology/dist/package.json","../node_modules/@sinclair/typebox/build/esm/errors/package.json","../node_modules/@sinclair/typebox/build/esm/package.json","../node_modules/@sinclair/typebox/build/esm/type/any/package.json","../node_modules/@sinclair/typebox/build/esm/type/argument/package.json","../node_modules/@sinclair/typebox/build/esm/type/array/package.json","../node_modules/@sinclair/typebox/build/esm/type/async-iterator/package.json","../node_modules/@sinclair/typebox/build/esm/type/awaited/package.json","../node_modules/@sinclair/typebox/build/esm/type/bigint/package.json","../node_modules/@sinclair/typebox/build/esm/type/boolean/package.json","../node_modules/@sinclair/typebox/build/esm/type/clone/package.json","../node_modules/@sinclair/typebox/build/esm/type/composite/package.json","../node_modules/@sinclair/typebox/build/esm/type/computed/package.json","../node_modules/@sinclair/typebox/build/esm/type/const/package.json","../node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/package.json","../node_modules/@sinclair/typebox/build/esm/type/constructor/package.json","../node_modules/@sinclair/typebox/build/esm/type/create/package.json","../node_modules/@sinclair/typebox/build/esm/type/date/package.json","../node_modules/@sinclair/typebox/build/esm/type/enum/package.json","../node_modules/@sinclair/typebox/build/esm/type/error/package.json","../node_modules/@sinclair/typebox/build/esm/type/exclude/package.json","../node_modules/@sinclair/typebox/build/esm/type/extends/package.json","../node_modules/@sinclair/typebox/build/esm/type/extract/package.json","../node_modules/@sinclair/typebox/build/esm/type/function/package.json","../node_modules/@sinclair/typebox/build/esm/type/guard/package.json","../node_modules/@sinclair/typebox/build/esm/type/helpers/package.json","../node_modules/@sinclair/typebox/build/esm/type/indexed/package.json","../node_modules/@sinclair/typebox/build/esm/type/instance-type/package.json","../node_modules/@sinclair/typebox/build/esm/type/instantiate/package.json","../node_modules/@sinclair/typebox/build/esm/type/integer/package.json","../node_modules/@sinclair/typebox/build/esm/type/intersect/package.json","../node_modules/@sinclair/typebox/build/esm/type/intrinsic/package.json","../node_modules/@sinclair/typebox/build/esm/type/iterator/package.json","../node_modules/@sinclair/typebox/build/esm/type/keyof/package.json","../node_modules/@sinclair/typebox/build/esm/type/literal/package.json","../node_modules/@sinclair/typebox/build/esm/type/mapped/package.json","../node_modules/@sinclair/typebox/build/esm/type/module/package.json","../node_modules/@sinclair/typebox/build/esm/type/never/package.json","../node_modules/@sinclair/typebox/build/esm/type/not/package.json","../node_modules/@sinclair/typebox/build/esm/type/null/package.json","../node_modules/@sinclair/typebox/build/esm/type/number/package.json","../node_modules/@sinclair/typebox/build/esm/type/object/package.json","../node_modules/@sinclair/typebox/build/esm/type/omit/package.json","../node_modules/@sinclair/typebox/build/esm/type/optional/package.json","../node_modules/@sinclair/typebox/build/esm/type/package.json","../node_modules/@sinclair/typebox/build/esm/type/parameters/package.json","../node_modules/@sinclair/typebox/build/esm/type/partial/package.json","../node_modules/@sinclair/typebox/build/esm/type/patterns/package.json","../node_modules/@sinclair/typebox/build/esm/type/pick/package.json","../node_modules/@sinclair/typebox/build/esm/type/promise/package.json","../node_modules/@sinclair/typebox/build/esm/type/readonly-optional/package.json","../node_modules/@sinclair/typebox/build/esm/type/readonly/package.json","../node_modules/@sinclair/typebox/build/esm/type/record/package.json","../node_modules/@sinclair/typebox/build/esm/type/recursive/package.json","../node_modules/@sinclair/typebox/build/esm/type/ref/package.json","../node_modules/@sinclair/typebox/build/esm/type/regexp/package.json","../node_modules/@sinclair/typebox/build/esm/type/registry/package.json","../node_modules/@sinclair/typebox/build/esm/type/required/package.json","../node_modules/@sinclair/typebox/build/esm/type/rest/package.json","../node_modules/@sinclair/typebox/build/esm/type/return-type/package.json","../node_modules/@sinclair/typebox/build/esm/type/schema/package.json","../node_modules/@sinclair/typebox/build/esm/type/sets/package.json","../node_modules/@sinclair/typebox/build/esm/type/static/package.json","../node_modules/@sinclair/typebox/build/esm/type/string/package.json","../node_modules/@sinclair/typebox/build/esm/type/symbol/package.json","../node_modules/@sinclair/typebox/build/esm/type/symbols/package.json","../node_modules/@sinclair/typebox/build/esm/type/template-literal/package.json","../node_modules/@sinclair/typebox/build/esm/type/transform/package.json","../node_modules/@sinclair/typebox/build/esm/type/tuple/package.json","../node_modules/@sinclair/typebox/build/esm/type/type/package.json","../node_modules/@sinclair/typebox/build/esm/type/uint8array/package.json","../node_modules/@sinclair/typebox/build/esm/type/undefined/package.json","../node_modules/@sinclair/typebox/build/esm/type/union/package.json","../node_modules/@sinclair/typebox/build/esm/type/unknown/package.json","../node_modules/@sinclair/typebox/build/esm/type/unsafe/package.json","../node_modules/@sinclair/typebox/build/esm/type/void/package.json","../node_modules/@sinclair/typebox/build/esm/value/assert/package.json","../node_modules/@sinclair/typebox/build/esm/value/cast/package.json","../node_modules/@sinclair/typebox/build/esm/value/check/package.json","../node_modules/@sinclair/typebox/build/esm/value/clean/package.json","../node_modules/@sinclair/typebox/build/esm/value/clone/package.json","../node_modules/@sinclair/typebox/build/esm/value/convert/package.json","../node_modules/@sinclair/typebox/build/esm/value/create/package.json","../node_modules/@sinclair/typebox/build/esm/value/decode/package.json","../node_modules/@sinclair/typebox/build/esm/value/default/package.json","../node_modules/@sinclair/typebox/build/esm/value/delta/package.json","../node_modules/@sinclair/typebox/build/esm/value/encode/package.json","../node_modules/@sinclair/typebox/build/esm/value/equal/package.json","../node_modules/@sinclair/typebox/build/esm/value/guard/package.json","../node_modules/@sinclair/typebox/build/esm/value/hash/package.json","../node_modules/@sinclair/typebox/build/esm/value/mutate/package.json","../node_modules/@sinclair/typebox/build/esm/value/package.json","../node_modules/@sinclair/typebox/build/esm/value/parse/package.json","../node_modules/@sinclair/typebox/build/esm/value/pointer/package.json","../node_modules/@sinclair/typebox/build/esm/value/transform/package.json","../node_modules/@sinclair/typebox/build/esm/value/value/package.json","../node_modules/@sinclair/typebox/build/package.json","../node_modules/@tak-ps/xml-js/dist/lib/package.json","../node_modules/@turf/destination/dist/esm/package.json","../node_modules/@turf/destination/dist/package.json","../node_modules/@turf/ellipse/dist/esm/package.json","../node_modules/@turf/ellipse/dist/package.json","../node_modules/@turf/helpers/dist/esm/package.json","../node_modules/@turf/helpers/dist/package.json","../node_modules/@turf/meta/dist/esm/package.json","../node_modules/@turf/meta/dist/package.json","../node_modules/@turf/point-on-feature/dist/esm/package.json","../node_modules/@turf/point-on-feature/dist/package.json","../node_modules/@turf/sector/dist/esm/package.json","../node_modules/@turf/sector/dist/package.json","../node_modules/@turf/truncate/dist/esm/package.json","../node_modules/@turf/truncate/dist/package.json","../node_modules/@types/assert/package.json","../node_modules/@types/assert/strict/package.json","../node_modules/@types/async_hooks/package.json","../node_modules/@types/buffer/package.json","../node_modules/@types/child_process/package.json","../node_modules/@types/cluster/package.json","../node_modules/@types/console/package.json","../node_modules/@types/constants/package.json","../node_modules/@types/crypto/package.json","../node_modules/@types/dgram/package.json","../node_modules/@types/diagnostics_channel/package.json","../node_modules/@types/dns/package.json","../node_modules/@types/dns/promises/package.json","../node_modules/@types/domain/package.json","../node_modules/@types/events/package.json","../node_modules/@types/fs/package.json","../node_modules/@types/fs/promises/package.json","../node_modules/@types/http/package.json","../node_modules/@types/http2/package.json","../node_modules/@types/https/package.json","../node_modules/@types/inspector/package.json","../node_modules/@types/inspector/promises/package.json","../node_modules/@types/module/package.json","../node_modules/@types/net/package.json","../node_modules/@types/node/assert/package.json","../node_modules/@types/node/dns/package.json","../node_modules/@types/node/fs/package.json","../node_modules/@types/node/inspector/package.json","../node_modules/@types/node/path/package.json","../node_modules/@types/node/readline/package.json","../node_modules/@types/node/stream/package.json","../node_modules/@types/node/test/package.json","../node_modules/@types/node/timers/package.json","../node_modules/@types/node/util/package.json","../node_modules/@types/node/web-globals/package.json","../node_modules/@types/node/zlib/package.json","../node_modules/@types/os/package.json","../node_modules/@types/path/package.json","../node_modules/@types/path/posix/package.json","../node_modules/@types/path/win32/package.json","../node_modules/@types/perf_hooks/package.json","../node_modules/@types/process/package.json","../node_modules/@types/punycode/package.json","../node_modules/@types/querystring/package.json","../node_modules/@types/readline/package.json","../node_modules/@types/readline/promises/package.json","../node_modules/@types/repl/package.json","../node_modules/@types/stream/consumers/package.json","../node_modules/@types/stream/iter/package.json","../node_modules/@types/stream/package.json","../node_modules/@types/stream/promises/package.json","../node_modules/@types/stream/web/package.json","../node_modules/@types/string_decoder/package.json","../node_modules/@types/timers/package.json","../node_modules/@types/timers/promises/package.json","../node_modules/@types/tls/package.json","../node_modules/@types/trace_events/package.json","../node_modules/@types/tty/package.json","../node_modules/@types/url/package.json","../node_modules/@types/util/package.json","../node_modules/@types/util/types/package.json","../node_modules/@types/v8/package.json","../node_modules/@types/vm/package.json","../node_modules/@types/wasi/package.json","../node_modules/@types/worker_threads/package.json","../node_modules/@types/zlib/package.json","../node_modules/ajv/dist/compile/codegen/package.json","../node_modules/ajv/dist/compile/package.json","../node_modules/ajv/dist/compile/validate/package.json","../node_modules/ajv/dist/package.json","../node_modules/ajv/dist/runtime/package.json","../node_modules/ajv/dist/types/package.json","../node_modules/ajv/dist/vocabularies/applicator/package.json","../node_modules/ajv/dist/vocabularies/discriminator/package.json","../node_modules/ajv/dist/vocabularies/format/package.json","../node_modules/ajv/dist/vocabularies/package.json","../node_modules/ajv/dist/vocabularies/unevaluated/package.json","../node_modules/ajv/dist/vocabularies/validation/package.json","../node_modules/assert/package.json","../node_modules/assert/strict/package.json","../node_modules/async_hooks/package.json","../node_modules/body-parser/package.json","../node_modules/buffer/package.json","../node_modules/child_process/package.json","../node_modules/cluster/package.json","../node_modules/connect/package.json","../node_modules/console/package.json","../node_modules/constants/package.json","../node_modules/crypto/package.json","../node_modules/dgram/package.json","../node_modules/diagnostics_channel/package.json","../node_modules/dns/package.json","../node_modules/dns/promises/package.json","../node_modules/domain/package.json","../node_modules/events/package.json","../node_modules/express-serve-static-core/package.json","../node_modules/express/package.json","../node_modules/fast-uri/types/package.json","../node_modules/fs/package.json","../node_modules/fs/promises/package.json","../node_modules/geojson/package.json","../node_modules/http-errors/package.json","../node_modules/http/package.json","../node_modules/http2/package.json","../node_modules/https/package.json","../node_modules/inspector/package.json","../node_modules/inspector/promises/package.json","../node_modules/json-diff-ts/dist/package.json","../node_modules/module/package.json","../node_modules/net/package.json","../node_modules/os/package.json","../node_modules/path/package.json","../node_modules/path/posix/package.json","../node_modules/path/win32/package.json","../node_modules/perf_hooks/package.json","../node_modules/process/package.json","../node_modules/punycode/package.json","../node_modules/qs/package.json","../node_modules/querystring/package.json","../node_modules/range-parser/package.json","../node_modules/readline/package.json","../node_modules/readline/promises/package.json","../node_modules/repl/package.json","../node_modules/send/package.json","../node_modules/serve-static/package.json","../node_modules/stream/consumers/package.json","../node_modules/stream/iter/package.json","../node_modules/stream/package.json","../node_modules/stream/promises/package.json","../node_modules/stream/web/package.json","../node_modules/string_decoder/package.json","../node_modules/timers/package.json","../node_modules/timers/promises/package.json","../node_modules/tls/package.json","../node_modules/trace_events/package.json","../node_modules/tty/package.json","../node_modules/url/package.json","../node_modules/util/package.json","../node_modules/util/types/package.json","../node_modules/v8/package.json","../node_modules/vm/package.json","../node_modules/wasi/package.json","../node_modules/worker_threads/package.json","../node_modules/zlib/package.json"]}
@@ -56,7 +56,7 @@ export class MissionChat extends CoT {
56
56
 
57
57
  cot.event._attributes.uid = `GeoChat.${chat.from.uid}.${chat.mission.id}.${messageId}`;
58
58
 
59
- if (!cot.event.detail) cot.event.detail = {};
59
+ cot.event.detail ??= {};
60
60
 
61
61
  cot.event.detail.link = {
62
62
  _attributes: {
@@ -146,7 +146,7 @@ export class DirectChatReceipt extends CoT {
146
146
  // ATAK looks the original message up by the receipt's Event UID on receive
147
147
  cot.event._attributes.uid = receipt.messageId;
148
148
 
149
- if (!cot.event.detail) cot.event.detail = {};
149
+ cot.event.detail ??= {};
150
150
 
151
151
  cot.event.detail.link = {
152
152
  _attributes: {
@@ -207,7 +207,7 @@ export class DirectChat extends CoT {
207
207
 
208
208
  cot.event._attributes.uid = `GeoChat.${chat.from.uid}.${chat.to.uid}.${crypto.randomUUID()}`;
209
209
 
210
- if (!cot.event.detail) cot.event.detail = {};
210
+ cot.event.detail ??= {};
211
211
 
212
212
  cot.event.detail.link = {
213
213
  _attributes: {
@@ -12,7 +12,7 @@ export class Route extends CoT {
12
12
 
13
13
  super(cot.raw)
14
14
  } else {
15
- const cot: Static<typeof JSONCoT> = {
15
+ const raw: Static<typeof JSONCoT> = {
16
16
  event: {
17
17
  _attributes: Util.cot_event_attr('b-m-r', 'h-e'),
18
18
  point: Util.cot_point(),
@@ -21,7 +21,7 @@ export class Route extends CoT {
21
21
  }
22
22
  };
23
23
 
24
- super(cot)
24
+ super(raw)
25
25
  }
26
26
  }
27
27
  }
package/lib/cot.ts CHANGED
@@ -15,7 +15,7 @@ import type {
15
15
  VideoConnectionEntryAttributes,
16
16
  } from './types/types.js'
17
17
  import Sensor from './sensor.js';
18
- import Util from './utils/util.js';
18
+ import Util, { toNumber } from './utils/util.js';
19
19
  import util2525 from './utils/2525.js'
20
20
  import JSONCoT, { Detail } from './types/types.js'
21
21
 
@@ -64,7 +64,7 @@ export default class CoT {
64
64
  this.raw.event._attributes.uid = Util.cot_uuid();
65
65
  }
66
66
 
67
- if (!this.raw.event.detail) this.raw.event.detail = {};
67
+ this.raw.event.detail ??= {};
68
68
 
69
69
  if (this.raw.event.detail.archive && Object.keys(this.raw.event.detail.archive).length === 0) {
70
70
  this.raw.event.detail.archive = { _attributes: {} };
@@ -83,21 +83,20 @@ export default class CoT {
83
83
  opts.milsym?.augment
84
84
  && !this.raw.event.detail.__milsym
85
85
  && !this.raw.event.detail.__milicon
86
+ && util2525.is2525BConvertable(this.raw.event._attributes.type)
86
87
  ) {
87
- if (util2525.is2525BConvertable(this.raw.event._attributes.type)) {
88
- try {
89
- this.raw.event.detail.__milicon = {
90
- _attributes: {
91
- id: util2525.to2525D(this.raw.event._attributes.type)
92
- }
88
+ try {
89
+ this.raw.event.detail.__milicon = {
90
+ _attributes: {
91
+ id: util2525.to2525D(this.raw.event._attributes.type)
93
92
  }
94
- } catch (err) {
95
- console.warn(`Failed to augment CoT (${this.raw.event._attributes.type}) with 2525D MilIcon ID`, err);
96
93
  }
94
+ } catch (err) {
95
+ console.warn(`Failed to augment CoT (${this.raw.event._attributes.type}) with 2525D MilIcon ID`, err);
97
96
  }
98
97
  }
99
98
 
100
- if (process.env.DEBUG_COTS) console.log(JSON.stringify(this.raw))
99
+ if (typeof process !== 'undefined' && process.env.DEBUG_COTS) console.log(JSON.stringify(this.raw))
101
100
  }
102
101
 
103
102
  /**
@@ -150,18 +149,16 @@ export default class CoT {
150
149
  detail.contact._attributes.callsign = callsign;
151
150
  }
152
151
 
153
- if (detail.contact && detail.contact._attributes && typeof detail.contact._attributes.callsign === 'string') {
154
- return detail.contact._attributes.callsign;
155
- } else {
156
- return 'UNKNOWN'
157
- }
152
+ const current: unknown = detail.contact?._attributes?.callsign;
153
+
154
+ return typeof current === 'string' ? current : 'UNKNOWN';
158
155
  }
159
156
 
160
157
  /**
161
158
  * Return Detail Object of CoT or create one if it doesn't yet exist and pass a reference
162
159
  */
163
160
  detail(): Static<typeof Detail> {
164
- if (!this.raw.event.detail) this.raw.event.detail = {};
161
+ this.raw.event.detail ??= {};
165
162
  return this.raw.event.detail;
166
163
  }
167
164
 
@@ -173,7 +170,7 @@ export default class CoT {
173
170
 
174
171
  const detail = this.detail();
175
172
 
176
- if (!detail.marti) detail.marti = {};
173
+ detail.marti ??= {};
177
174
 
178
175
  let destArr: Array<Static<typeof MartiDest>> = [];
179
176
  if (detail.marti.dest && !Array.isArray(detail.marti.dest)) {
@@ -242,8 +239,8 @@ export default class CoT {
242
239
  }
243
240
 
244
241
  return [
245
- Number(this.raw.event.point._attributes.lon),
246
- Number(this.raw.event.point._attributes.lat)
242
+ toNumber(this.raw.event.point._attributes.lon),
243
+ toNumber(this.raw.event.point._attributes.lat)
247
244
  ];
248
245
  }
249
246
 
@@ -256,7 +253,7 @@ export default class CoT {
256
253
  }
257
254
  }
258
255
 
259
- if (!detail.sensor || !detail.sensor._attributes) {
256
+ if (!detail.sensor?._attributes) {
260
257
  return null;
261
258
  }
262
259
 
@@ -277,9 +274,11 @@ export default class CoT {
277
274
  const detail = this.detail();
278
275
 
279
276
  if (creator) {
277
+ const hasTime = creator.time instanceof Date || Boolean(creator.time);
278
+
280
279
  this.addLink({
281
280
  uid: creator.uid,
282
- production_time: creator.time ? new Date(creator.time).toISOString() : new Date().toISOString(),
281
+ production_time: hasTime && creator.time !== undefined ? new Date(creator.time).toISOString() : new Date().toISOString(),
283
282
  type: creator.type,
284
283
  parent_callsign: creator.callsign,
285
284
  relation: 'p-p'
@@ -288,16 +287,12 @@ export default class CoT {
288
287
  detail.creator = {
289
288
  _attributes: {
290
289
  ...creator,
291
- time: creator.time ? new Date(creator.time).toISOString() : new Date().toISOString(),
290
+ time: hasTime && creator.time !== undefined ? new Date(creator.time).toISOString() : new Date().toISOString(),
292
291
  }
293
292
  };
294
293
  }
295
294
 
296
- if (detail.creator) {
297
- return detail.creator._attributes;
298
- } else {
299
- return;
300
- }
295
+ return detail.creator?._attributes;
301
296
  }
302
297
 
303
298
  addLink(link: Static<typeof LinkAttributes>): CoT {
@@ -327,7 +322,7 @@ export default class CoT {
327
322
  * @return {boolean}
328
323
  */
329
324
  is_tasking(): boolean {
330
- return !!this.raw.event._attributes.type.match(/^t-/)
325
+ return this.raw.event._attributes.type.startsWith('t-')
331
326
  }
332
327
 
333
328
  /**
@@ -360,7 +355,7 @@ export default class CoT {
360
355
  * @return {boolean}
361
356
  */
362
357
  is_friend(): boolean {
363
- return !!this.raw.event._attributes.type.match(/^a-f-/)
358
+ return this.raw.event._attributes.type.startsWith('a-f-')
364
359
  }
365
360
 
366
361
  /**
@@ -369,7 +364,7 @@ export default class CoT {
369
364
  * @return {boolean}
370
365
  */
371
366
  is_hostile(): boolean {
372
- return !!this.raw.event._attributes.type.match(/^a-h-/)
367
+ return this.raw.event._attributes.type.startsWith('a-h-')
373
368
  }
374
369
 
375
370
  /**
@@ -378,7 +373,7 @@ export default class CoT {
378
373
  * @return {boolean}
379
374
  */
380
375
  is_unknown(): boolean {
381
- return !!this.raw.event._attributes.type.match(/^a-u-/)
376
+ return this.raw.event._attributes.type.startsWith('a-u-')
382
377
  }
383
378
 
384
379
  /**
@@ -387,7 +382,7 @@ export default class CoT {
387
382
  * @return {boolean}
388
383
  */
389
384
  is_pending(): boolean {
390
- return !!this.raw.event._attributes.type.match(/^a-p-/)
385
+ return this.raw.event._attributes.type.startsWith('a-p-')
391
386
  }
392
387
 
393
388
  /**
@@ -396,7 +391,7 @@ export default class CoT {
396
391
  * @return {boolean}
397
392
  */
398
393
  is_assumed(): boolean {
399
- return !!this.raw.event._attributes.type.match(/^a-a-/)
394
+ return this.raw.event._attributes.type.startsWith('a-a-')
400
395
  }
401
396
 
402
397
  /**
@@ -405,7 +400,7 @@ export default class CoT {
405
400
  * @return {boolean}
406
401
  */
407
402
  is_neutral(): boolean {
408
- return !!this.raw.event._attributes.type.match(/^a-n-/)
403
+ return this.raw.event._attributes.type.startsWith('a-n-')
409
404
  }
410
405
 
411
406
  /**
@@ -414,7 +409,7 @@ export default class CoT {
414
409
  * @return {boolean}
415
410
  */
416
411
  is_suspect(): boolean {
417
- return !!this.raw.event._attributes.type.match(/^a-s-/)
412
+ return this.raw.event._attributes.type.startsWith('a-s-')
418
413
  }
419
414
 
420
415
  /**
@@ -423,7 +418,7 @@ export default class CoT {
423
418
  * @return {boolean}
424
419
  */
425
420
  is_joker(): boolean {
426
- return !!this.raw.event._attributes.type.match(/^a-j-/)
421
+ return this.raw.event._attributes.type.startsWith('a-j-')
427
422
  }
428
423
 
429
424
  /**
@@ -432,7 +427,7 @@ export default class CoT {
432
427
  * @return {boolean}
433
428
  */
434
429
  is_faker(): boolean {
435
- return !!this.raw.event._attributes.type.match(/^a-k-/)
430
+ return this.raw.event._attributes.type.startsWith('a-k-')
436
431
  }
437
432
 
438
433
  /**
@@ -441,7 +436,7 @@ export default class CoT {
441
436
  * @return {boolean}
442
437
  */
443
438
  is_atom(): boolean {
444
- return !!this.raw.event._attributes.type.match(/^a-/)
439
+ return this.raw.event._attributes.type.startsWith('a-')
445
440
  }
446
441
 
447
442
  /**
@@ -450,7 +445,7 @@ export default class CoT {
450
445
  * @return {boolean}
451
446
  */
452
447
  is_airborne(): boolean {
453
- return !!this.raw.event._attributes.type.match(/^a-.-A/)
448
+ return /^a-.-A/.test(this.raw.event._attributes.type)
454
449
  }
455
450
 
456
451
  /**
@@ -459,7 +454,7 @@ export default class CoT {
459
454
  * @return {boolean}
460
455
  */
461
456
  is_ground(): boolean {
462
- return !!this.raw.event._attributes.type.match(/^a-.-G/)
457
+ return /^a-.-G/.test(this.raw.event._attributes.type)
463
458
  }
464
459
 
465
460
  /**
@@ -468,7 +463,7 @@ export default class CoT {
468
463
  * @return {boolean}
469
464
  */
470
465
  is_installation(): boolean {
471
- return !!this.raw.event._attributes.type.match(/^a-.-G-I/)
466
+ return /^a-.-G-I/.test(this.raw.event._attributes.type)
472
467
  }
473
468
 
474
469
  /**
@@ -477,7 +472,7 @@ export default class CoT {
477
472
  * @return {boolean}
478
473
  */
479
474
  is_vehicle(): boolean {
480
- return !!this.raw.event._attributes.type.match(/^a-.-G-E-V/)
475
+ return /^a-.-G-E-V/.test(this.raw.event._attributes.type)
481
476
  }
482
477
 
483
478
  /**
@@ -486,7 +481,7 @@ export default class CoT {
486
481
  * @return {boolean}
487
482
  */
488
483
  is_equipment(): boolean {
489
- return !!this.raw.event._attributes.type.match(/^a-.-G-E/)
484
+ return /^a-.-G-E/.test(this.raw.event._attributes.type)
490
485
  }
491
486
 
492
487
  /**
@@ -495,7 +490,7 @@ export default class CoT {
495
490
  * @return {boolean}
496
491
  */
497
492
  is_surface(): boolean {
498
- return !!this.raw.event._attributes.type.match(/^a-.-S/)
493
+ return /^a-.-S/.test(this.raw.event._attributes.type)
499
494
  }
500
495
 
501
496
  /**
@@ -504,7 +499,7 @@ export default class CoT {
504
499
  * @return {boolean}
505
500
  */
506
501
  is_subsurface(): boolean {
507
- return !!this.raw.event._attributes.type.match(/^a-.-U/)
502
+ return /^a-.-U/.test(this.raw.event._attributes.type)
508
503
  }
509
504
 
510
505
  /**
@@ -513,7 +508,7 @@ export default class CoT {
513
508
  * @return {boolean}
514
509
  */
515
510
  is_uav(): boolean {
516
- return !!this.raw.event._attributes.type.match(/^a-f-A-M-F-Q-r/)
511
+ return this.raw.event._attributes.type.startsWith('a-f-A-M-F-Q-r')
517
512
  }
518
513
 
519
514
  /**