@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.
- package/CHANGELOG.md +8 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cot-types.js +94 -0
- package/dist/lib/cot-types.js.map +1 -0
- package/dist/lib/cot-types.xml +2829 -0
- package/dist/lib/data-package.js +11 -3
- package/dist/lib/data-package.js.map +1 -1
- package/dist/package.json +2 -2
- package/dist/test/cot-types.test.js +7 -0
- package/dist/test/cot-types.test.js.map +1 -0
- package/dist/test/data-package.test.js +1 -1
- package/dist/test/data-package.test.js.map +1 -1
- package/index.ts +1 -0
- package/lib/cot-types.ts +115 -0
- package/lib/cot-types.xml +2829 -0
- package/lib/data-package.ts +15 -3
- package/package.json +2 -2
- package/test/cot-types.test.ts +8 -0
- package/test/data-package.test.ts +4 -1
package/lib/data-package.ts
CHANGED
|
@@ -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.
|
|
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": {
|
|
@@ -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(
|
|
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
|
|