@tak-ps/node-cot 14.28.1 → 14.29.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.
package/CHANGELOG.md CHANGED
@@ -12,6 +12,10 @@
12
12
 
13
13
  ### Pending Fixed
14
14
 
15
+ ### v14.29.0 - 2025-03-12
16
+
17
+ - :rocket: Add MVP for MissionChat builder
18
+
15
19
  ### v14.28.1 - 2025-03-10
16
20
 
17
21
  - :arrow_up: Update Core Deps
@@ -1,4 +1,24 @@
1
1
  import CoT from '../cot.js';
2
+ export type MissionChatMember = {
3
+ uid: string;
4
+ type?: string;
5
+ };
6
+ export type MissionChatInput = {
7
+ from: MissionChatMember;
8
+ mission: {
9
+ name: string;
10
+ id: string;
11
+ guid?: string;
12
+ };
13
+ senderCallsign: string;
14
+ message: string;
15
+ parent?: string;
16
+ groupOwner?: boolean;
17
+ messageId?: string;
18
+ };
19
+ export declare class MissionChat extends CoT {
20
+ constructor(chat: MissionChatInput);
21
+ }
2
22
  export type DirectChatMember = {
3
23
  uid: string;
4
24
  callsign: string;
@@ -1,6 +1,59 @@
1
1
  import Util from '../utils/util.js';
2
2
  import CoT from '../cot.js';
3
3
  import { v4 as randomUUID } from 'uuid';
4
+ export class MissionChat extends CoT {
5
+ constructor(chat) {
6
+ const messageId = chat.messageId || randomUUID();
7
+ const cot = {
8
+ event: {
9
+ _attributes: Util.cot_event_attr('b-t-f', 'h-g-i-g-o'),
10
+ point: Util.cot_point(),
11
+ detail: {
12
+ __chat: {
13
+ _attributes: {
14
+ parent: chat.parent || 'DataSyncMissionsList',
15
+ groupOwner: chat.groupOwner ? 'true' : 'false',
16
+ messageId,
17
+ chatroom: chat.mission.name,
18
+ id: chat.mission.id,
19
+ senderCallsign: chat.senderCallsign
20
+ },
21
+ chatgrp: {
22
+ _attributes: {
23
+ uid0: chat.from.uid,
24
+ uid1: chat.mission.id,
25
+ id: chat.mission.id
26
+ }
27
+ }
28
+ },
29
+ }
30
+ }
31
+ };
32
+ cot.event._attributes.uid = `GeoChat.${chat.from.uid}.${chat.mission.id}.${messageId}`;
33
+ if (!cot.event.detail)
34
+ cot.event.detail = {};
35
+ cot.event.detail.link = {
36
+ _attributes: {
37
+ uid: chat.from.uid,
38
+ type: chat.from.type || 'a-f-G',
39
+ relation: 'p-p'
40
+ }
41
+ };
42
+ cot.event.detail.remarks = {
43
+ _attributes: {
44
+ source: chat.from.uid,
45
+ to: chat.mission.id,
46
+ time: cot.event._attributes.time
47
+ },
48
+ _text: chat.message
49
+ };
50
+ super(cot);
51
+ const dest = { mission: chat.mission.name };
52
+ if (chat.mission.guid)
53
+ dest['mission-guid'] = chat.mission.guid;
54
+ this.addDest(dest);
55
+ }
56
+ }
4
57
  export class DirectChat extends CoT {
5
58
  constructor(chat) {
6
59
  const cot = {
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../lib/builders/chat.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,kBAAkB,CAAA;AACnC,OAAO,GAAG,MAAM,WAAW,CAAC;AAG5B,OAAO,EAAE,EAAE,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AAoBxC,MAAM,OAAO,UAAW,SAAQ,GAAG;IAC/B,YAAY,IAAqB;QAC7B,MAAM,GAAG,GAA2B;YAChC,KAAK,EAAE;gBACH,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC;gBACtD,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE;gBACvB,MAAM,EAAE;oBACJ,MAAM,EAAE;wBACJ,WAAW,EAAE;4BACT,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,kBAAkB;4BACzC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;4BAC9C,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,UAAU,EAAE;4BACzC,QAAQ,EAAE,IAAI,CAAC,QAAQ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,WAAW,CAAC,IAAI;aACnC;YACD,KAAK,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;QAED,KAAK,CAAC,GAAG,CAAC,CAAA;QAEV,IAAI,CAAC,OAAO,CAAC;YACT,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG;SACnB,CAAC,CAAA;IAEN,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.28.1",
4
+ "version": "14.29.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",
@@ -4,6 +4,86 @@ import type JSONCoT from '../types/types.js';
4
4
  import type { Static } from '@sinclair/typebox';
5
5
  import { v4 as randomUUID } from 'uuid';
6
6
 
7
+ export type MissionChatMember = {
8
+ uid: string;
9
+ type?: string;
10
+ }
11
+
12
+ export type MissionChatInput = {
13
+ from: MissionChatMember;
14
+ mission: {
15
+ name: string;
16
+ id: string;
17
+ guid?: string;
18
+ };
19
+ senderCallsign: string;
20
+
21
+ message: string;
22
+
23
+ parent?: string;
24
+ groupOwner?: boolean;
25
+ messageId?: string;
26
+ }
27
+
28
+ export class MissionChat extends CoT {
29
+ constructor(chat: MissionChatInput) {
30
+ const messageId = chat.messageId || randomUUID();
31
+
32
+ const cot: Static<typeof JSONCoT> = {
33
+ event: {
34
+ _attributes: Util.cot_event_attr('b-t-f', 'h-g-i-g-o'),
35
+ point: Util.cot_point(),
36
+ detail: {
37
+ __chat: {
38
+ _attributes: {
39
+ parent: chat.parent || 'DataSyncMissionsList',
40
+ groupOwner: chat.groupOwner ? 'true' : 'false',
41
+ messageId,
42
+ chatroom: chat.mission.name,
43
+ id: chat.mission.id,
44
+ senderCallsign: chat.senderCallsign
45
+ },
46
+ chatgrp: {
47
+ _attributes: {
48
+ uid0: chat.from.uid,
49
+ uid1: chat.mission.id,
50
+ id: chat.mission.id
51
+ }
52
+ }
53
+ },
54
+ }
55
+ }
56
+ }
57
+
58
+ cot.event._attributes.uid = `GeoChat.${chat.from.uid}.${chat.mission.id}.${messageId}`;
59
+
60
+ if (!cot.event.detail) cot.event.detail = {};
61
+
62
+ cot.event.detail.link = {
63
+ _attributes: {
64
+ uid: chat.from.uid,
65
+ type: chat.from.type || 'a-f-G',
66
+ relation: 'p-p'
67
+ }
68
+ }
69
+
70
+ cot.event.detail.remarks = {
71
+ _attributes: {
72
+ source: chat.from.uid,
73
+ to: chat.mission.id,
74
+ time: cot.event._attributes.time
75
+ },
76
+ _text: chat.message
77
+ }
78
+
79
+ super(cot)
80
+
81
+ const dest: Record<string, string> = { mission: chat.mission.name };
82
+ if (chat.mission.guid) dest['mission-guid'] = chat.mission.guid;
83
+ this.addDest(dest);
84
+ }
85
+ }
86
+
7
87
  export type DirectChatMember = {
8
88
  uid: string;
9
89
  callsign: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/node-cot",
3
3
  "type": "module",
4
- "version": "14.28.1",
4
+ "version": "14.29.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",