@tak-ps/node-cot 14.58.1 → 14.60.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.
Files changed (79) hide show
  1. package/.oxlintrc.json +100 -0
  2. package/CHANGELOG.md +9 -0
  3. package/README.md +13 -0
  4. package/cli.ts +21 -22
  5. package/dist/cli.js +18 -19
  6. package/dist/cli.js.map +1 -1
  7. package/dist/lib/builders/chat.d.ts +4 -4
  8. package/dist/lib/builders/chat.js +3 -6
  9. package/dist/lib/builders/chat.js.map +1 -1
  10. package/dist/lib/builders/route.js +2 -2
  11. package/dist/lib/cot.js +44 -56
  12. package/dist/lib/cot.js.map +1 -1
  13. package/dist/lib/data-package.d.ts +3 -3
  14. package/dist/lib/data-package.js +68 -81
  15. package/dist/lib/data-package.js.map +1 -1
  16. package/dist/lib/parser/from_geojson.js +27 -30
  17. package/dist/lib/parser/from_geojson.js.map +1 -1
  18. package/dist/lib/parser/normalize_geojson.js +22 -22
  19. package/dist/lib/parser/normalize_geojson.js.map +1 -1
  20. package/dist/lib/parser/to_geojson.js +97 -86
  21. package/dist/lib/parser/to_geojson.js.map +1 -1
  22. package/dist/lib/parser-normalize.d.ts +5 -0
  23. package/dist/lib/parser-normalize.js +25 -8
  24. package/dist/lib/parser-normalize.js.map +1 -1
  25. package/dist/lib/parser.js +96 -81
  26. package/dist/lib/parser.js.map +1 -1
  27. package/dist/lib/sensor.js +11 -5
  28. package/dist/lib/sensor.js.map +1 -1
  29. package/dist/lib/type.js +5 -10
  30. package/dist/lib/type.js.map +1 -1
  31. package/dist/lib/types/cot-types.js +4 -4
  32. package/dist/lib/types/cot-types.js.map +1 -1
  33. package/dist/lib/types/feature.d.ts +782 -752
  34. package/dist/lib/types/feature.js +2 -1
  35. package/dist/lib/types/feature.js.map +1 -1
  36. package/dist/lib/types/types.d.ts +81 -9
  37. package/dist/lib/types/types.js +33 -3
  38. package/dist/lib/types/types.js.map +1 -1
  39. package/dist/lib/utils/2525.js +139 -92
  40. package/dist/lib/utils/2525.js.map +1 -1
  41. package/dist/lib/utils/color.js +1 -1
  42. package/dist/lib/utils/color.js.map +1 -1
  43. package/dist/lib/utils/type.js +5 -10
  44. package/dist/lib/utils/type.js.map +1 -1
  45. package/dist/lib/utils/util.d.ts +5 -0
  46. package/dist/lib/utils/util.js +25 -16
  47. package/dist/lib/utils/util.js.map +1 -1
  48. package/dist/lib/xml/basemap.js +10 -9
  49. package/dist/lib/xml/basemap.js.map +1 -1
  50. package/dist/lib/xml/iconset.js +1 -1
  51. package/dist/lib/xml/iconset.js.map +1 -1
  52. package/dist/lib/xml-document.d.ts +1 -1
  53. package/dist/lib/xml-document.js +6 -3
  54. package/dist/lib/xml-document.js.map +1 -1
  55. package/dist/package.json +7 -7
  56. package/dist/tsconfig.tsbuildinfo +1 -1
  57. package/lib/builders/chat.ts +3 -3
  58. package/lib/builders/route.ts +2 -2
  59. package/lib/cot.ts +42 -47
  60. package/lib/data-package.ts +72 -76
  61. package/lib/parser/from_geojson.ts +28 -29
  62. package/lib/parser/normalize_geojson.ts +22 -26
  63. package/lib/parser/to_geojson.ts +109 -94
  64. package/lib/parser-normalize.ts +30 -9
  65. package/lib/parser.ts +121 -92
  66. package/lib/sensor.ts +12 -5
  67. package/lib/type.ts +5 -5
  68. package/lib/types/cot-types.ts +4 -4
  69. package/lib/types/feature.ts +2 -0
  70. package/lib/types/types.ts +37 -3
  71. package/lib/utils/2525.ts +147 -96
  72. package/lib/utils/color.ts +1 -1
  73. package/lib/utils/type.ts +5 -5
  74. package/lib/utils/util.ts +31 -15
  75. package/lib/xml/basemap.ts +10 -9
  76. package/lib/xml/iconset.ts +1 -1
  77. package/lib/xml-document.ts +7 -4
  78. package/package.json +7 -7
  79. package/eslint.config.js +0 -15
package/lib/utils/2525.ts CHANGED
@@ -33,77 +33,136 @@ export enum StandardIdentity {
33
33
  }
34
34
 
35
35
  export const SID_MAP: Record<string, string> = {
36
- P: "00", // pending
37
- U: "01", // unknown
38
- A: "02", // assumed friend
39
- F: "03", // friend
40
- N: "04", // neutral
41
- S: "05", // suspect
42
- H: "06", // hostile
43
- G: "10", // exercise pending
44
- W: "11", // exercise unknown
45
- M: "12", // exercise assumed friend
46
- D: "13", // exercise friend
47
- L: "14", // exercise neutral
48
- J: "15", // joker
49
- K: "16", // faker
36
+ // pending
37
+ P: "00",
38
+ // unknown
39
+ U: "01",
40
+ // assumed friend
41
+ A: "02",
42
+ // friend
43
+ F: "03",
44
+ // neutral
45
+ N: "04",
46
+ // suspect
47
+ S: "05",
48
+ // hostile
49
+ H: "06",
50
+ // exercise pending
51
+ G: "10",
52
+ // exercise unknown
53
+ W: "11",
54
+ // exercise assumed friend
55
+ M: "12",
56
+ // exercise friend
57
+ D: "13",
58
+ // exercise neutral
59
+ L: "14",
60
+ // joker
61
+ J: "15",
62
+ // faker
63
+ K: "16",
50
64
  };
51
65
 
52
66
  export const STATUS_MAP: Record<string, string> = {
53
- P: "0", // present
54
- A: "1", // anticipated/planned
55
- C: "2", // present fully capable
56
- D: "3", // present damaged
57
- X: "4", // present destroyed
58
- F: "5", // present full to capacity
67
+ // present
68
+ P: "0",
69
+ // anticipated/planned
70
+ A: "1",
71
+ // present fully capable
72
+ C: "2",
73
+ // present damaged
74
+ D: "3",
75
+ // present destroyed
76
+ X: "4",
77
+ // present full to capacity
78
+ F: "5",
59
79
  };
60
80
 
61
81
  export const DIM_MAP: Record<string, string> = {
62
- P: '05', // Space
63
- A: '01', // Air
64
- G: '10', // Ground
65
- S: '30', // SeaSurface
66
- U: '35', // SubSurface
67
- F: '10', // SOF
68
- Z: '10', // Unknown
69
- X: '10' // Unknown
82
+ // Space
83
+ P: '05',
84
+ // Air
85
+ A: '01',
86
+ // Ground
87
+ G: '10',
88
+ // SeaSurface
89
+ S: '30',
90
+ // SubSurface
91
+ U: '35',
92
+ // SOF
93
+ F: '10',
94
+ // Unknown
95
+ Z: '10',
96
+ // Unknown
97
+ X: '10'
70
98
  }
71
99
 
72
100
  export const SID_REVERSE_MAP: Record<string, string> = {
73
- '00': 'p', // pending
74
- '01': 'u', // unknown
75
- '02': 'a', // assumed friend
76
- '03': 'f', // friend
77
- '04': 'n', // neutral
78
- '05': 's', // suspect
79
- '06': 'h', // hostile
80
- '10': 'p', // exercise pending
81
- '11': 'u', // exercise unknown
82
- '12': 'a', // exercise assumed friend
83
- '13': 'f', // exercise friend
84
- '14': 'n', // exercise neutral
85
- '15': 'j', // joker
86
- '16': 'k', // faker
101
+ // pending
102
+ '00': 'p',
103
+ // unknown
104
+ '01': 'u',
105
+ // assumed friend
106
+ '02': 'a',
107
+ // friend
108
+ '03': 'f',
109
+ // neutral
110
+ '04': 'n',
111
+ // suspect
112
+ '05': 's',
113
+ // hostile
114
+ '06': 'h',
115
+ // exercise pending
116
+ '10': 'p',
117
+ // exercise unknown
118
+ '11': 'u',
119
+ // exercise assumed friend
120
+ '12': 'a',
121
+ // exercise friend
122
+ '13': 'f',
123
+ // exercise neutral
124
+ '14': 'n',
125
+ // joker
126
+ '15': 'j',
127
+ // faker
128
+ '16': 'k',
87
129
  };
88
130
 
89
131
  export const SYMBOL_SET_DIM_MAP: Record<string, string> = {
90
- '01': 'A', // Air
91
- '02': 'A', // Air Missile
92
- '05': 'P', // Space
93
- '06': 'P', // Space Missile
94
- '10': 'G', // Land Unit
95
- '11': 'G', // Land Civilian Unit/Organization
96
- '15': 'G', // Land Equipment
97
- '20': 'G', // Land Installation
98
- '27': 'G', // Dismounted Individual
99
- '30': 'S', // Sea Surface
100
- '35': 'U', // Sea Subsurface
101
- '36': 'U', // Mine Warfare
102
- '50': 'P', // Signals Intelligence - Space
103
- '51': 'A', // Signals Intelligence - Air
104
- '52': 'G', // Signals Intelligence - Land
105
- '53': 'S', // Signals Intelligence - Surface
106
- '54': 'U', // Signals Intelligence - Subsurface
132
+ // Air
133
+ '01': 'A',
134
+ // Air Missile
135
+ '02': 'A',
136
+ // Space
137
+ '05': 'P',
138
+ // Space Missile
139
+ '06': 'P',
140
+ // Land Unit
141
+ '10': 'G',
142
+ // Land Civilian Unit/Organization
143
+ '11': 'G',
144
+ // Land Equipment
145
+ '15': 'G',
146
+ // Land Installation
147
+ '20': 'G',
148
+ // Dismounted Individual
149
+ '27': 'G',
150
+ // Sea Surface
151
+ '30': 'S',
152
+ // Sea Subsurface
153
+ '35': 'U',
154
+ // Mine Warfare
155
+ '36': 'U',
156
+ // Signals Intelligence - Space
157
+ '50': 'P',
158
+ // Signals Intelligence - Air
159
+ '51': 'A',
160
+ // Signals Intelligence - Land
161
+ '52': 'G',
162
+ // Signals Intelligence - Surface
163
+ '53': 'S',
164
+ // Signals Intelligence - Subsurface
165
+ '54': 'U',
107
166
  };
108
167
 
109
168
  /**
@@ -120,18 +179,16 @@ export default class Type2525 {
120
179
  * @param cotType - Cursor On Target Type to test
121
180
  */
122
181
  static is2525BConvertable(cotType: string): boolean {
123
- return !!cotType.match(/^a-[PUAFNSHJKOXpuafnshjkox]-[PAGSUFXZ](-\w+)*$/);
182
+ return /^a-[PUAFNSHJKOXpuafnshjkox]-[PAGSUFXZ](-\w+)*$/.test(cotType);
124
183
  }
125
184
 
126
185
  static domain(cotType: string): Domain {
127
186
  const unknownDomain = cotType.split('-')[0];
128
187
 
129
188
  const d = enumFromStringValue<Domain>(Domain, unknownDomain);
130
- if (d) {
131
- return d;
132
- } else {
133
- throw new Error('Domain could not be determined');
134
- }
189
+ if (d === undefined) throw new Error('Domain could not be determined');
190
+
191
+ return d;
135
192
  }
136
193
 
137
194
  static standardIdentity(cotType: string): StandardIdentity {
@@ -142,11 +199,7 @@ export default class Type2525 {
142
199
 
143
200
  const si = enumFromStringValue(StandardIdentity, unknownIdentity);
144
201
 
145
- if (si) {
146
- return si;
147
- } else {
148
- return StandardIdentity.NONE;
149
- }
202
+ return si ?? StandardIdentity.NONE;
150
203
  }
151
204
 
152
205
  /**
@@ -158,21 +211,21 @@ export default class Type2525 {
158
211
  const str_sidc = this.to2525B(cotType);
159
212
 
160
213
  // Handle Short Codes Manually
161
- if (str_sidc.match(/^S[A-Z]{3}-{11}/)) {
214
+ if (/^S[A-Z]{3}-{11}/.test(str_sidc)) {
162
215
  const AFF = str_sidc[1].toUpperCase()
163
216
  const DIM = str_sidc[2].toUpperCase()
164
217
  const STS = str_sidc[3].toUpperCase()
165
218
 
166
219
  return VERSION_2525D + SID_MAP[AFF] + DIM_MAP[DIM] + STATUS_MAP[STS] + '0000000000000';
167
- } else {
168
- const convert = convertLetterSidc2NumberSidc(str_sidc);
220
+ }
169
221
 
170
- if (!convert.sidc) {
171
- throw new Error(`Could not convert 2525B SIDC to 2525D`);
172
- }
222
+ const convert = convertLetterSidc2NumberSidc(str_sidc);
173
223
 
174
- return convert.sidc;
224
+ if (!convert.sidc) {
225
+ throw new Error(`Could not convert 2525B SIDC to 2525D`);
175
226
  }
227
+
228
+ return convert.sidc;
176
229
  }
177
230
 
178
231
  /**
@@ -185,17 +238,17 @@ export default class Type2525 {
185
238
  throw new TypeError("CoT to 2525B can only be applied to well-formed Atom type CoT Events.")
186
239
  }
187
240
 
188
- const m2525bChars = cotType.substring(4).replace(/[^A-Z0-9]+/g, "");
189
- const m2525bBattleDim = m2525bChars.substring(0, 1);
241
+ const m2525bChars = cotType.slice(4).replaceAll(/[^A-Z0-9]+/g, "");
242
+ const m2525bBattleDim = m2525bChars[0];
190
243
 
191
- const cotAffiliation = cotType.substring(2, 3);
244
+ const cotAffiliation = cotType[2];
192
245
  const m2525bAffiliation = (cotAffiliation === "o" || cotAffiliation === "x")
193
246
  ? "U"
194
247
  : cotAffiliation.toUpperCase();
195
248
 
196
- const m2525bFuncId = m2525bChars.length > 1
197
- ? m2525bChars.substring(1).padEnd(6, "-").substring(0, 6)
198
- : "------";
249
+ const m2525bFuncId = m2525bChars.length > 1
250
+ ? m2525bChars.slice(1).padEnd(6, "-").slice(0, 6)
251
+ : "------";
199
252
 
200
253
  return `S${m2525bAffiliation}${m2525bBattleDim}P${m2525bFuncId}-----`;
201
254
  }
@@ -206,7 +259,7 @@ export default class Type2525 {
206
259
  * @param sidc - Numeric SIDC to test
207
260
  */
208
261
  static isNumericSIDCConvertable(sidc: string): boolean {
209
- return !!sidc.match(/^1[0-3]\d{18}$/);
262
+ return /^1[0-3]\d{18}$/.test(sidc);
210
263
  }
211
264
 
212
265
  /**
@@ -220,8 +273,8 @@ export default class Type2525 {
220
273
  throw new Error("Numeric SIDC to CoT can only be applied to well-formed 2525D/2525E SIDCs.");
221
274
  }
222
275
 
223
- const affiliation = SID_REVERSE_MAP[sidc.substring(2, 4)] || 'u';
224
- const dimension = SYMBOL_SET_DIM_MAP[sidc.substring(4, 6)] || 'G';
276
+ const affiliation = SID_REVERSE_MAP[sidc.slice(2, 4)] || 'u';
277
+ const dimension = SYMBOL_SET_DIM_MAP[sidc.slice(4, 6)] || 'G';
225
278
 
226
279
  return `a-${affiliation}-${dimension}`;
227
280
  }
@@ -267,7 +320,7 @@ export default class Type2525 {
267
320
  * @param sidc - SIDC to test
268
321
  */
269
322
  static isTypeConvertable(sidc: string): boolean {
270
- return !!sidc.match(/^S[PUAFNSHGWMDLJK-][PAGSUFXZ-][AP-][A-Z0-9-]{10}[AECGNS-]$/)
323
+ return /^S[PUAFNSHGWMDLJK-][PAGSUFXZ-][AP-][A-Z0-9-]{10}[AECGNS-]$/.test(sidc)
271
324
  }
272
325
 
273
326
  /**
@@ -280,24 +333,22 @@ export default class Type2525 {
280
333
  throw new Error("2525B to CoT can only be applied to well-formed warfighting 2525B SIDCs.");
281
334
  }
282
335
 
283
- const m2525bAffiliation = sidc.substring(1, 2);
336
+ const m2525bAffiliation = sidc[1];
284
337
  const cotAffiliation = ["G", "W", "M", "D", "L"].includes(m2525bAffiliation)
285
338
  ? "f"
286
339
  : m2525bAffiliation === "-"
287
340
  ? "o"
288
341
  : m2525bAffiliation.toLowerCase();
289
342
 
290
- const cotBattleDim = sidc.substring(2, 3);
291
- const cotFuncId = Array.from(sidc.substring(4, 10).replace(/[^A-Z0-9]+/g, ""))
292
- .map((x) => `-${x}`)
293
- .join("");
343
+ const cotBattleDim = sidc[2];
344
+ const cotFuncId = Array.from(sidc.slice(4, 10).replaceAll(/[^A-Z0-9]+/g, ""))
345
+ .map((x) => `-${x}`)
346
+ .join("");
294
347
 
295
348
  return `a-${cotAffiliation}-${cotBattleDim}${cotFuncId}`;
296
349
  }
297
350
  }
298
351
 
299
- function enumFromStringValue<T> (enm: { [s: string]: T}, value: string): T | undefined {
300
- return (Object.values(enm) as unknown as string[]).includes(value)
301
- ? value as unknown as T
302
- : undefined;
352
+ function enumFromStringValue<T extends string> (enm: Record<string, T>, value: string): T | undefined {
353
+ return Object.values(enm).find((v) => v === value);
303
354
  }
@@ -18,7 +18,7 @@ export default class Color {
18
18
 
19
19
  this.r = (color >> 16) & 255;
20
20
  this.g = (color >> 8) & 255;
21
- this.b = (color >> 0) & 255;
21
+ this.b = color & 255;
22
22
  this.a = ((color >> 24) & 255);
23
23
  } else if (Array.isArray(color)) {
24
24
  this.a = color[0];
package/lib/utils/type.ts CHANGED
@@ -18,11 +18,11 @@ export default class TypeValidator {
18
18
  body: unknown,
19
19
  opts?: TypeOpts
20
20
  ): Static<T> {
21
- if (!opts) opts = {};
22
- if (opts.verbose === undefined) opts.verbose = false;
23
- if (opts.default === undefined) opts.default = true;
24
- if (opts.convert === undefined) opts.convert = true;
25
- if (opts.clean === undefined) opts.clean = true;
21
+ opts ??= {};
22
+ opts.verbose ??= false;
23
+ opts.default ??= true;
24
+ opts.convert ??= true;
25
+ opts.clean ??= true;
26
26
 
27
27
  if (opts.default) {
28
28
  Value.Default(type, body)
package/lib/utils/util.ts CHANGED
@@ -10,6 +10,18 @@ import type {
10
10
  * Helper functions for generating CoT data
11
11
  * @class
12
12
  */
13
+ export function jsonClone<T>(value: T): T {
14
+ // oxlint-disable-next-line typescript/no-unsafe-return
15
+ return JSON.parse(JSON.stringify(value));
16
+ }
17
+
18
+ /**
19
+ * Coerce numeric values that may not have passed through schema coercion
20
+ */
21
+ export function toNumber(value: number | string): number {
22
+ return typeof value === 'number' ? value : Number(value);
23
+ }
24
+
13
25
  export default class Util {
14
26
  /**
15
27
  * Return an event._attributes object with as many defaults as possible
@@ -61,9 +73,9 @@ export default class Util {
61
73
  static cot_track_attr(course?: number, speed?: number, slope?: number): Static<typeof TrackAttributes> {
62
74
  const attr: Static<typeof TrackAttributes> = {};
63
75
 
64
- if (course) attr.course = String(course);
65
- if (speed) attr.speed = String(speed);
66
- if (slope) attr.slope = String(slope);
76
+ if (course !== undefined && course !== 0) attr.course = String(course);
77
+ if (speed !== undefined && speed !== 0) attr.speed = String(speed);
78
+ if (slope !== undefined && slope !== 0) attr.slope = String(slope);
67
79
 
68
80
  return attr;
69
81
  }
@@ -117,24 +129,28 @@ export default class Util {
117
129
  } {
118
130
  const now = Date.now();
119
131
 
132
+ const dates = {
133
+ time: (new Date(time === '' ? now : time ?? now)).toISOString(),
134
+ start: (new Date(start === '' ? now : start ?? now)).toISOString()
135
+ };
136
+
120
137
  if (stale === undefined || stale === null) {
121
138
  return {
122
- time: (new Date(time || now)).toISOString(),
123
- start: (new Date(start || now)).toISOString(),
139
+ ...dates,
124
140
  stale: (new Date(new Date(now).getTime() + 20 * 1000)).toISOString()
125
141
  };
126
- } else if (typeof stale === 'number') {
127
- return {
128
- time: (new Date(time || now)).toISOString(),
129
- start: (new Date(start || now)).toISOString(),
130
- stale: (new Date(new Date(now).getTime() + Number(stale))).toISOString()
131
- };
132
- } else {
142
+ }
143
+
144
+ if (typeof stale === 'number') {
133
145
  return {
134
- time: (new Date(time || now)).toISOString(),
135
- start: (new Date(start || now)).toISOString(),
136
- stale: String(stale)
146
+ ...dates,
147
+ stale: (new Date(new Date(now).getTime() + stale)).toISOString()
137
148
  };
138
149
  }
150
+
151
+ return {
152
+ ...dates,
153
+ stale: String(stale)
154
+ };
139
155
  }
140
156
  }
@@ -1,5 +1,6 @@
1
1
  import Err from '@openaddresses/batch-error';
2
2
  import XMLDocument from '../xml-document.js';
3
+ import { toNumber } from '../utils/util.js';
3
4
  import type { Static } from '@sinclair/typebox'
4
5
  import BasemapSchema from '../types/basemap.js';
5
6
  import AJV from 'ajv';
@@ -35,18 +36,18 @@ export class Basemap extends XMLDocument<BasemapType> {
35
36
  backgroundColor: string | undefined;
36
37
  serverParts: string | undefined;
37
38
  } {
38
- if (!this.raw.customMapSource) throw new Err(400, null, 'Unknown Basemap Type');
39
- if (!this.raw.customMapSource.url) throw new Err(400, null, 'Unknown Basemap Type - Missing URL');
39
+ if (this.raw.customMapSource === undefined) throw new Err(400, null, 'Unknown Basemap Type');
40
+ if (this.raw.customMapSource.url === undefined) throw new Err(400, null, 'Unknown Basemap Type - Missing URL');
40
41
 
41
42
  return {
42
- name: this.raw.customMapSource.name ? this.raw.customMapSource.name._text : undefined,
43
+ name: this.raw.customMapSource.name?._text,
43
44
  url: this.raw.customMapSource.url._text,
44
- minZoom: this.raw.customMapSource.minZoom ? Number(this.raw.customMapSource.minZoom._text) : undefined,
45
- maxZoom: this.raw.customMapSource.maxZoom ? Number(this.raw.customMapSource.maxZoom._text) : undefined,
46
- tileType: this.raw.customMapSource.tileType ? this.raw.customMapSource.tileType._text : undefined,
47
- tileUpdate: this.raw.customMapSource.tileUpdate ? this.raw.customMapSource.tileUpdate._text : undefined,
48
- backgroundColor: this.raw.customMapSource.backgroundColor ? this.raw.customMapSource.backgroundColor._text : undefined,
49
- serverParts: this.raw.customMapSource.serverParts ? this.raw.customMapSource.serverParts._text : undefined,
45
+ minZoom: this.raw.customMapSource.minZoom !== undefined ? toNumber(this.raw.customMapSource.minZoom._text) : undefined,
46
+ maxZoom: this.raw.customMapSource.maxZoom !== undefined ? toNumber(this.raw.customMapSource.maxZoom._text) : undefined,
47
+ tileType: this.raw.customMapSource.tileType?._text,
48
+ tileUpdate: this.raw.customMapSource.tileUpdate?._text,
49
+ backgroundColor: this.raw.customMapSource.backgroundColor?._text,
50
+ serverParts: this.raw.customMapSource.serverParts?._text,
50
51
  }
51
52
  }
52
53
  }
@@ -46,7 +46,7 @@ export class Iconset extends XMLDocument<IconsetType> {
46
46
  uid: this.raw.iconset._attributes.uid,
47
47
  version: this.raw.iconset._attributes.version,
48
48
  name: this.raw.iconset._attributes.name,
49
- skip_resize: this.raw.iconset._attributes.skip_resize === undefined ? false : this.raw.iconset._attributes.skip_resize,
49
+ skip_resize: this.raw.iconset._attributes.skip_resize ?? false,
50
50
  default_group: this.raw.iconset._attributes.default_group,
51
51
  default_friendly: this.raw.iconset._attributes.default_friendly,
52
52
  default_hostile: this.raw.iconset._attributes.default_hostile,
@@ -1,6 +1,6 @@
1
1
  import Err from '@openaddresses/batch-error';
2
2
  import type { ValidateFunction } from 'ajv';
3
- import xmljs, { type Element } from '@tak-ps/xml-js';
3
+ import { xml2js, js2xml, type Element } from '@tak-ps/xml-js';
4
4
 
5
5
  /**
6
6
  * Core XML Document support used for XML fortatted DataPackages documents
@@ -13,16 +13,19 @@ export default class XMLDocument<T> {
13
13
  this.raw = raw;
14
14
  }
15
15
 
16
- static check<U>(input: string, check: ValidateFunction<unknown>): U {
17
- const xml = xmljs.xml2js(input, { compact: true })
16
+ // oxlint-disable-next-line typescript/no-unnecessary-type-parameters
17
+ static check<U>(input: string, check: ValidateFunction): U {
18
+ const xml = xml2js(input, { compact: true })
18
19
 
19
20
  check(xml);
20
21
  if (check.errors) throw new Err(400, null, `${check.errors[0].message} (${check.errors[0].instancePath})`);
21
22
 
23
+ // oxlint-disable-next-line typescript/no-unsafe-type-assertion
22
24
  return xml as U;
23
25
  }
24
26
 
25
27
  to_xml(): string {
26
- return xmljs.js2xml(this.raw as Element, { compact: true });
28
+ // oxlint-disable-next-line typescript/no-unsafe-type-assertion
29
+ return js2xml(this.raw as Element, { compact: true });
27
30
  }
28
31
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/node-cot",
3
3
  "type": "module",
4
- "version": "14.58.1",
4
+ "version": "14.60.0",
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": {
@@ -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",
package/eslint.config.js DELETED
@@ -1,15 +0,0 @@
1
- import eslint from '@eslint/js';
2
- import tseslint from 'typescript-eslint';
3
-
4
- export default tseslint.config(
5
- {
6
- ignores: ['dist/**', 'docs/**', 'coverage/**']
7
- },
8
- eslint.configs.recommended,
9
- ...tseslint.configs.recommended,
10
- {
11
- "rules": {
12
- "@typescript-eslint/no-explicit-any": "warn"
13
- }
14
- }
15
- );