@tak-ps/node-cot 10.5.0 → 10.6.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.
@@ -231,15 +231,27 @@ export class DataPackage {
231
231
 
232
232
  for (const attach of attaches) {
233
233
  if (!cot.raw.event.detail.attachment_list) {
234
- cot.raw.event.detail.attachment_list = [];
234
+ cot.raw.event.detail.attachment_list = {
235
+ _attributes: {
236
+ hashes: []
237
+ }
238
+ };
239
+ } else {
240
+ cot.raw.event.detail.attachment_list._attributes.hashes = JSON.parse(
241
+ cot.raw.event.detail.attachment_list._attributes.hashes
242
+ );
235
243
  }
236
244
 
237
245
  // Until told otherwise the FileHash appears to always be the directory name
238
246
  const hash = path.parse(attach._attributes.zipEntry).dir;
239
247
 
240
- if (!cot.raw.event.detail.attachment_list.includes(hash)) {
241
- cot.raw.event.detail.attachment_list.push(hash)
248
+ if (!cot.raw.event.detail.attachment_list._attributes.hashes.includes(hash)) {
249
+ cot.raw.event.detail.attachment_list._attributes.hashes.push(hash)
242
250
  }
251
+
252
+ cot.raw.event.detail.attachment_list._attributes.hashes = JSON.stringify(
253
+ cot.raw.event.detail.attachment_list._attributes.hashes
254
+ );
243
255
  }
244
256
  }
245
257
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/node-cot",
3
3
  "type": "module",
4
- "version": "10.5.0",
4
+ "version": "10.6.1",
5
5
  "description": "Lightweight JavaScript library for parsing and manipulating TAK messages",
6
6
  "author": "Nick Ingalls <nick@ingalls.ca>",
7
7
  "main": "dist/index.js",
@@ -10,7 +10,7 @@
10
10
  "test": "ts-node-test test/",
11
11
  "lint": "eslint *.ts lib/ test/",
12
12
  "doc": "typedoc index.ts",
13
- "build": "tsc --build && cp package.json dist/ && mkdir -p ./dist/lib/proto/ && cp lib/proto/* ./dist/lib/proto/",
13
+ "build": "tsc --build && cp package.json dist/ && cp ./lib/*.xml ./dist/lib/ && mkdir -p ./dist/lib/proto/ && cp lib/proto/* ./dist/lib/proto/",
14
14
  "pretest": "npm run lint"
15
15
  },
16
16
  "dependencies": {
@@ -0,0 +1,8 @@
1
+ import { CoTTypes } from '../index.js'
2
+ import test from 'tape';
3
+
4
+ test(`CoTTypes Parsing`, async (t) => {
5
+ await CoTTypes.CoTTypes.load();
6
+
7
+ t.end();
8
+ });
@@ -231,7 +231,10 @@ test(`DataPackage CoT Parsing: AttachmentInManifest.zip`, async (t) => {
231
231
 
232
232
  t.equal(cots.length, 1);
233
233
 
234
- t.deepEquals(cots[0].raw.event.detail.attachment_list, [ '6988443373b26e519cfd1096665b8eaa' ]);
234
+ t.deepEquals(
235
+ cots[0].raw.event.detail.attachment_list,
236
+ { _attributes: { hashes: '["6988443373b26e519cfd1096665b8eaa"]' } }
237
+ )
235
238
 
236
239
  const attachments = await pkg.attachments();
237
240