@tak-ps/node-tak 11.18.0 → 11.18.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 (94) hide show
  1. package/.github/workflows/release.yml +10 -16
  2. package/CHANGELOG.md +4 -0
  3. package/package.json +3 -3
  4. package/dist/cli.d.ts +0 -2
  5. package/dist/cli.js +0 -183
  6. package/dist/cli.js.map +0 -1
  7. package/dist/index.d.ts +0 -59
  8. package/dist/index.js +0 -204
  9. package/dist/index.js.map +0 -1
  10. package/dist/lib/api/contacts.d.ts +0 -24
  11. package/dist/lib/api/contacts.js +0 -44
  12. package/dist/lib/api/contacts.js.map +0 -1
  13. package/dist/lib/api/credentials.d.ts +0 -21
  14. package/dist/lib/api/credentials.js +0 -83
  15. package/dist/lib/api/credentials.js.map +0 -1
  16. package/dist/lib/api/export.d.ts +0 -21
  17. package/dist/lib/api/export.js +0 -37
  18. package/dist/lib/api/export.js.map +0 -1
  19. package/dist/lib/api/files.d.ts +0 -77
  20. package/dist/lib/api/files.js +0 -170
  21. package/dist/lib/api/files.js.map +0 -1
  22. package/dist/lib/api/groups.d.ts +0 -43
  23. package/dist/lib/api/groups.js +0 -68
  24. package/dist/lib/api/groups.js.map +0 -1
  25. package/dist/lib/api/iconsets.d.ts +0 -27
  26. package/dist/lib/api/iconsets.js +0 -42
  27. package/dist/lib/api/iconsets.js.map +0 -1
  28. package/dist/lib/api/injectors.d.ts +0 -52
  29. package/dist/lib/api/injectors.js +0 -82
  30. package/dist/lib/api/injectors.js.map +0 -1
  31. package/dist/lib/api/locate.d.ts +0 -13
  32. package/dist/lib/api/locate.js +0 -27
  33. package/dist/lib/api/locate.js.map +0 -1
  34. package/dist/lib/api/mission-invite.d.ts +0 -36
  35. package/dist/lib/api/mission-invite.js +0 -55
  36. package/dist/lib/api/mission-invite.js.map +0 -1
  37. package/dist/lib/api/mission-layer.d.ts +0 -137
  38. package/dist/lib/api/mission-layer.js +0 -247
  39. package/dist/lib/api/mission-layer.js.map +0 -1
  40. package/dist/lib/api/mission-log.d.ts +0 -75
  41. package/dist/lib/api/mission-log.js +0 -117
  42. package/dist/lib/api/mission-log.js.map +0 -1
  43. package/dist/lib/api/mission.d.ts +0 -556
  44. package/dist/lib/api/mission.js +0 -708
  45. package/dist/lib/api/mission.js.map +0 -1
  46. package/dist/lib/api/oauth.d.ts +0 -22
  47. package/dist/lib/api/oauth.js +0 -55
  48. package/dist/lib/api/oauth.js.map +0 -1
  49. package/dist/lib/api/package.d.ts +0 -40
  50. package/dist/lib/api/package.js +0 -70
  51. package/dist/lib/api/package.js.map +0 -1
  52. package/dist/lib/api/profile.d.ts +0 -9
  53. package/dist/lib/api/profile.js +0 -16
  54. package/dist/lib/api/profile.js.map +0 -1
  55. package/dist/lib/api/query.d.ts +0 -16
  56. package/dist/lib/api/query.js +0 -60
  57. package/dist/lib/api/query.js.map +0 -1
  58. package/dist/lib/api/repeater.d.ts +0 -47
  59. package/dist/lib/api/repeater.js +0 -62
  60. package/dist/lib/api/repeater.js.map +0 -1
  61. package/dist/lib/api/security.d.ts +0 -110
  62. package/dist/lib/api/security.js +0 -123
  63. package/dist/lib/api/security.js.map +0 -1
  64. package/dist/lib/api/subscriptions.d.ts +0 -103
  65. package/dist/lib/api/subscriptions.js +0 -74
  66. package/dist/lib/api/subscriptions.js.map +0 -1
  67. package/dist/lib/api/types.d.ts +0 -41
  68. package/dist/lib/api/types.js +0 -42
  69. package/dist/lib/api/types.js.map +0 -1
  70. package/dist/lib/api/video.d.ts +0 -139
  71. package/dist/lib/api/video.js +0 -151
  72. package/dist/lib/api/video.js.map +0 -1
  73. package/dist/lib/api.d.ts +0 -60
  74. package/dist/lib/api.js +0 -166
  75. package/dist/lib/api.js.map +0 -1
  76. package/dist/lib/auth.d.ts +0 -34
  77. package/dist/lib/auth.js +0 -97
  78. package/dist/lib/auth.js.map +0 -1
  79. package/dist/lib/commands.d.ts +0 -38
  80. package/dist/lib/commands.js +0 -34
  81. package/dist/lib/commands.js.map +0 -1
  82. package/dist/lib/fetch.d.ts +0 -8
  83. package/dist/lib/fetch.js +0 -26
  84. package/dist/lib/fetch.js.map +0 -1
  85. package/dist/lib/stream.d.ts +0 -2
  86. package/dist/lib/stream.js +0 -9
  87. package/dist/lib/stream.js.map +0 -1
  88. package/dist/test/default.test.d.ts +0 -1
  89. package/dist/test/default.test.js +0 -8
  90. package/dist/test/default.test.js.map +0 -1
  91. package/dist/test/findCoT.test.d.ts +0 -1
  92. package/dist/test/findCoT.test.js +0 -85
  93. package/dist/test/findCoT.test.js.map +0 -1
  94. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -5,31 +5,25 @@ on:
5
5
  tags:
6
6
  - '*'
7
7
 
8
+ permissions:
9
+ id-token: write # Required for OIDC
10
+ contents: read
11
+
8
12
  jobs:
9
13
  build:
10
14
  runs-on: ubuntu-latest
11
15
  steps:
12
- - uses: actions/checkout@v4
13
-
14
- - name: Get tag
15
- id: tag
16
- uses: dawidd6/action-get-tag@v1
16
+ - uses: actions/checkout@v6
17
17
 
18
- - uses: actions/setup-node@v4
18
+ - uses: actions/setup-node@v6
19
19
  with:
20
20
  node-version: 22
21
- registry-url: https://registry.npmjs.org/
21
+
22
+ - name: Update npm
23
+ run: npm install -g npm@latest
22
24
 
23
25
  - name: npm install
24
26
  run: npm install
25
27
 
26
- - name: npm run build
27
- run: npm run build
28
-
29
28
  - name: npm publish
30
- run: npm publish
31
- env:
32
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
33
-
34
- - name: Github Release
35
- uses: softprops/action-gh-release@v2
29
+ run: npm publish --provenance --access public
package/CHANGELOG.md CHANGED
@@ -10,6 +10,10 @@
10
10
 
11
11
  ## Version History
12
12
 
13
+ ### v11.18.1 - 2025-12-15
14
+
15
+ - :rocket: Update Release Process
16
+
13
17
  ### v11.18.0 - 2025-12-04
14
18
 
15
19
  - :rocket: Update Mission type to require description
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/node-tak",
3
3
  "type": "module",
4
- "version": "11.18.0",
4
+ "version": "11.18.1",
5
5
  "description": "Lightweight JavaScript library for communicating with TAK Server",
6
6
  "author": "Nick Ingalls <nick@ingalls.ca>",
7
7
  "main": "dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@inquirer/prompts": "^8.0.1",
46
46
  "@types/minimist": "^1.2.5",
47
- "@types/node": "^24.0.0",
47
+ "@types/node": "^25.0.0",
48
48
  "@types/pem": "^1.14.4",
49
49
  "@types/tape": "^5.6.0",
50
50
  "c8": "^10.1.3",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "repository": {
60
60
  "type": "git",
61
- "url": "git+https://github.com/dfpc-coe/node-tak.git"
61
+ "url": "https://github.com/dfpc-coe/node-tak"
62
62
  },
63
63
  "keywords": [
64
64
  "tak",
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env tsx
2
- export {};
package/dist/cli.js DELETED
@@ -1,183 +0,0 @@
1
- #!/usr/bin/env tsx
2
- import fs from 'node:fs/promises';
3
- import os from 'node:os';
4
- import path from 'node:path';
5
- import minimist from 'minimist';
6
- import { CoTParser } from '@tak-ps/node-cot';
7
- import TAK from './index.js';
8
- import { getPemFromP12 } from 'p12-pem';
9
- import TAKAPI, { CommandList } from './lib/api.js';
10
- import { APIAuthPassword, APIAuthCertificate } from './lib/auth.js';
11
- import Commands from './lib/commands.js';
12
- import { select, confirm, number, input, password, Separator } from '@inquirer/prompts';
13
- const args = minimist(process.argv, {
14
- string: ['profile', 'format', 'auth'],
15
- });
16
- const configPath = path.resolve(os.homedir(), './.tak.json');
17
- let config;
18
- try {
19
- config = JSON.parse(String(await fs.readFile(configPath)));
20
- }
21
- catch (err) {
22
- if (err instanceof Error && err.message.includes('no such file or directory')) {
23
- const answer = await confirm({
24
- message: 'No TAK Config file Detected, create one?'
25
- });
26
- if (!answer) {
27
- throw new Error('No config file and not creating one');
28
- }
29
- config = {
30
- version: 1,
31
- profiles: {}
32
- };
33
- await fs.writeFile(configPath, JSON.stringify(config, null, 4));
34
- }
35
- else {
36
- throw err;
37
- }
38
- }
39
- if (!args.profile && config.profiles && Object.keys(config.profiles).length) {
40
- args.profile = await select({
41
- message: 'Choose a profile',
42
- choices: [
43
- { name: 'New Profile', value: '' },
44
- new Separator(),
45
- ].concat(Object.keys(config.profiles).map((profile) => {
46
- return {
47
- name: profile,
48
- value: profile
49
- };
50
- }))
51
- });
52
- }
53
- if (!args.profile) {
54
- console.error('Create new TAK Server Profile:');
55
- args.profile = await input({ message: 'Enter a name for this profile' });
56
- const host = await input({ message: 'Server hostname', default: 'ops.example.com' });
57
- let marti = 8443;
58
- let webtak = 443;
59
- let stream = 8089;
60
- do {
61
- marti = await number({ message: 'Marti API Port', default: marti });
62
- } while (!marti || isNaN(marti));
63
- do {
64
- webtak = await number({ message: 'WebTAK API Port', default: webtak });
65
- } while (!webtak || isNaN(webtak));
66
- do {
67
- stream = await number({ message: 'Streaming Port', default: stream });
68
- } while (!stream || isNaN(stream));
69
- if (!config.profiles)
70
- config.profiles = {};
71
- config.profiles[args.profile] = {
72
- host,
73
- ports: { webtak, marti, stream }
74
- };
75
- }
76
- if (args.profile && !config.profiles[args.profile]) {
77
- throw new Error(`Profile "${args.profile}" is not defined in config file`);
78
- }
79
- else if (!args.auth && !config.profiles[args.profile].auth) {
80
- const user = await input({ message: 'TAK Username' });
81
- const pass = await password({ message: 'TAK Password' });
82
- const api = await TAKAPI.init(new URL('https://' + config.profiles[args.profile].host + ':' + config.profiles[args.profile].ports.webtak), new APIAuthPassword(user, pass));
83
- const auth = await api.Credentials.generate();
84
- config.profiles[args.profile].auth = {
85
- cert: auth.cert,
86
- key: auth.key,
87
- ca: auth.ca[0]
88
- };
89
- }
90
- let command = args._[2];
91
- if (!command) {
92
- command = await select({
93
- message: 'Choose a Command Group',
94
- choices: [{
95
- name: 'stream',
96
- value: 'stream'
97
- }].concat(Object.keys(CommandList).map((profile) => {
98
- return {
99
- name: profile,
100
- value: profile
101
- };
102
- }))
103
- });
104
- }
105
- await fs.writeFile(configPath, JSON.stringify(config, null, 4));
106
- let auth = config.profiles[args.profile].auth;
107
- if (args.auth) {
108
- const password = process.env.TAK_P12_PASSWORD || await input({ message: 'P12 Container Password' });
109
- const certs = getPemFromP12(args.auth, password);
110
- const cert = certs.pemCertificate
111
- .split('-----BEGIN CERTIFICATE-----')
112
- .join('-----BEGIN CERTIFICATE-----\n')
113
- .split('-----END CERTIFICATE-----')
114
- .join('\n-----END CERTIFICATE-----');
115
- const key = certs.pemKey
116
- .split('-----BEGIN RSA PRIVATE KEY-----')
117
- .join('-----BEGIN RSA PRIVATE KEY-----\n')
118
- .split('-----END RSA PRIVATE KEY-----')
119
- .join('\n-----END RSA PRIVATE KEY-----');
120
- auth = { cert, key };
121
- }
122
- if (!auth)
123
- throw new Error(`No Auth in ${args.profile} profile`);
124
- if (command === 'stream') {
125
- const tak = await TAK.connect(new URL('ssl://' + config.profiles[args.profile].host + ':' + config.profiles[args.profile].ports.stream), auth);
126
- tak.on('cot', (cot) => {
127
- console.log(JSON.stringify(CoTParser.to_geojson(cot)));
128
- });
129
- }
130
- else {
131
- if (!config.profiles[args.profile].auth) {
132
- throw new Error(`No Auth in ${args.profile} profile`);
133
- }
134
- const tak = new TAKAPI(new URL('https://' + config.profiles[args.profile].host + ':' + config.profiles[args.profile].ports.marti), new APIAuthCertificate(auth.cert, auth.key));
135
- const invokeTest = tak[CommandList[command]];
136
- if (!invokeTest || !(invokeTest instanceof Commands)) {
137
- throw new Error(`${command} not found`);
138
- }
139
- const invoke = invokeTest;
140
- let subcommand = args._[3];
141
- const subcommands = (obj) => Object.keys(obj);
142
- if (subcommand === 'help') {
143
- console.log(([
144
- 'Command:',
145
- ` tak ${command} <subcommand>`,
146
- 'SubCommands:',
147
- ].concat(subcommands(invoke.schema).map((subcommand) => {
148
- return ` ${String(subcommand)} - ${invoke.schema[subcommand].description}`;
149
- }))).join('\n'));
150
- process.exit(0);
151
- }
152
- else if (!subcommand) {
153
- subcommand = await select({
154
- message: 'Choose an action',
155
- choices: subcommands(invoke.schema).map((subcommand) => {
156
- return {
157
- name: subcommand,
158
- value: subcommand
159
- };
160
- })
161
- });
162
- }
163
- if (!invoke.schema[subcommand]) {
164
- throw new Error(`Unsupported Subcommand: ${subcommand}`);
165
- }
166
- else if (args.format && !invoke.schema[subcommand].formats.includes(args.format)) {
167
- throw new Error(`tak ${command} ${subcommand} does not support --format ${args.format}. Supported formats are: ${invoke.schema[subcommand].formats.join(",")}`);
168
- }
169
- try {
170
- args._[3] = subcommand;
171
- const res = await invoke.cli(args);
172
- if (typeof res === 'string') {
173
- console.log(res);
174
- }
175
- else {
176
- console.log(JSON.stringify(res, null, 4));
177
- }
178
- }
179
- catch (err) {
180
- console.error(err);
181
- }
182
- }
183
- //# sourceMappingURL=cli.js.map
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACjC,OAAO,EAAE,MAAO,SAAS,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,QAA2B,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExF,MAAM,IAAI,GA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U,EAAE,EAAE;gBACnD,OAAO;oBACH,IAAI,EAAE,UAAU;oBAChB,KAAK,EAAE,UAAU;iBACpB,CAAA;YACL,CAAC,CAAC;SACL,CAAC,CAAC;IACP,CAAC;IAGD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,2BAA2B,UAAU,EAAE,CAAC,CAAC;IAC7D,CAAC;SAAM,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,OAAO,OAAO,IAAI,UAAU,8BAA8B,IAAI,CAAC,MAAM,4BAA4B,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACpK,CAAC;IAED,IAAI,CAAC;QACD,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;QACvB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEnC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;AACL,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,59 +0,0 @@
1
- import EventEmitter from 'node:events';
2
- import type { Static } from '@sinclair/typebox';
3
- import CoT from '@tak-ps/node-cot';
4
- import type { CoTOptions } from '@tak-ps/node-cot';
5
- import type { TLSSocket } from 'node:tls';
6
- import TAKAPI from './lib/api.js';
7
- import { TAKAuth } from './lib/auth.js';
8
- export * from './lib/auth.js';
9
- export declare const REGEX_CONTROL: RegExp;
10
- export declare const REGEX_EVENT: RegExp;
11
- export interface PartialCoT {
12
- event: string;
13
- remainder: string;
14
- }
15
- export type TAKOptions = {
16
- id?: number | string;
17
- type?: string;
18
- cot?: CoTOptions;
19
- };
20
- export default class TAK extends EventEmitter {
21
- id: number | string;
22
- type: string;
23
- url: URL;
24
- auth: Static<typeof TAKAuth>;
25
- open: boolean;
26
- destroyed: boolean;
27
- queue: string[];
28
- writing: boolean;
29
- cotOptions: CoTOptions;
30
- pingInterval?: ReturnType<typeof setTimeout>;
31
- client?: TLSSocket;
32
- version?: string;
33
- /**
34
- * @constructor
35
- *
36
- * @param url - Full URL of Streaming COT Endpoint IE: "https://ops.cotak.gov:8089"
37
- * @param auth - TAK Certificate Pair
38
- * @param opts - Options Object
39
- * @param opts.id - When using multiple connections in a script, allows a unique ID per connection
40
- * @param opts.type - When using multiple connections in a script, allows specifying a script provided connection type
41
- */
42
- constructor(url: URL, auth: Static<typeof TAKAuth>, opts?: TAKOptions);
43
- static connect(url: URL, auth: Static<typeof TAKAuth>, opts?: TAKOptions): Promise<TAK>;
44
- connect_ssl(): Promise<TAK>;
45
- reconnect(): Promise<void>;
46
- destroy(): void;
47
- ping(): Promise<void>;
48
- writer(body: string): Promise<boolean>;
49
- process(): Promise<void>;
50
- /**
51
- * Write a CoT to the TAK Connection
52
- *
53
- * @param {CoT} cot CoT Object
54
- */
55
- write(cots: CoT[]): Promise<void>;
56
- write_xml(body: string): void;
57
- static findCoT(str: string): null | PartialCoT;
58
- }
59
- export { TAKAPI, CoT, };
package/dist/index.js DELETED
@@ -1,204 +0,0 @@
1
- import EventEmitter from 'node:events';
2
- import tls from 'node:tls';
3
- import CoT, { CoTParser } from '@tak-ps/node-cot';
4
- import TAKAPI from './lib/api.js';
5
- export * from './lib/auth.js';
6
- /* eslint-disable no-control-regex */
7
- export const REGEX_CONTROL = /[\u000B-\u001F\u007F-\u009F]/g;
8
- // Match <event .../> or <event> but not <events>
9
- export const REGEX_EVENT = /(<event[ >][\s\S]*?<\/event>)([\s\S]*)/;
10
- export default class TAK extends EventEmitter {
11
- id;
12
- type;
13
- url;
14
- auth;
15
- open;
16
- destroyed;
17
- queue;
18
- writing;
19
- cotOptions;
20
- pingInterval;
21
- client;
22
- version;
23
- /**
24
- * @constructor
25
- *
26
- * @param url - Full URL of Streaming COT Endpoint IE: "https://ops.cotak.gov:8089"
27
- * @param auth - TAK Certificate Pair
28
- * @param opts - Options Object
29
- * @param opts.id - When using multiple connections in a script, allows a unique ID per connection
30
- * @param opts.type - When using multiple connections in a script, allows specifying a script provided connection type
31
- */
32
- constructor(url, auth, opts = {}) {
33
- super();
34
- if (!opts)
35
- opts = {};
36
- this.id = opts.id || crypto.randomUUID();
37
- this.type = opts.type || 'unknown';
38
- this.url = url;
39
- this.auth = auth;
40
- this.writing = false;
41
- this.cotOptions = opts.cot || {};
42
- this.open = false;
43
- this.destroyed = false;
44
- this.queue = [];
45
- }
46
- static async connect(url, auth, opts = {}) {
47
- const tak = new TAK(url, auth, opts);
48
- if (url.protocol === 'ssl:') {
49
- if (!tak.auth.cert)
50
- throw new Error('auth.cert required');
51
- if (!tak.auth.key)
52
- throw new Error('auth.key required');
53
- return await tak.connect_ssl();
54
- }
55
- else {
56
- throw new Error('Unknown TAK Server Protocol');
57
- }
58
- }
59
- connect_ssl() {
60
- return new Promise((resolve) => {
61
- this.destroyed = false;
62
- this.client = tls.connect({
63
- host: this.url.hostname,
64
- port: parseInt(this.url.port),
65
- rejectUnauthorized: this.auth.rejectUnauthorized ?? false,
66
- cert: this.auth.cert,
67
- key: this.auth.key,
68
- passphrase: this.auth.passphrase,
69
- ca: this.auth.ca,
70
- });
71
- this.client.setNoDelay();
72
- this.client.on('connect', () => {
73
- console.error(`ok - ${this.id} @ connect:${this.client ? this.client.authorized : 'NO CLIENT'} - ${this.client ? this.client.authorizationError : 'NO CLIENT'}`);
74
- });
75
- this.client.on('secureConnect', () => {
76
- console.error(`ok - ${this.id} @ secure:${this.client ? this.client.authorized : 'NO CLIENT'} - ${this.client ? this.client.authorizationError : 'NO CLIENT'}`);
77
- this.emit('secureConnect');
78
- this.ping();
79
- });
80
- let buff = '';
81
- this.client.on('data', async (data) => {
82
- // Eventually Parse ProtoBuf
83
- buff = buff + data.toString();
84
- let result = TAK.findCoT(buff);
85
- while (result && result.event) {
86
- try {
87
- const cot = await CoTParser.from_xml(result.event, this.cotOptions);
88
- if (cot.raw.event._attributes.type === 't-x-c-t-r') {
89
- this.open = true;
90
- this.emit('ping');
91
- }
92
- else if (cot.raw.event._attributes.type === 't-x-takp-v'
93
- && cot.raw.event.detail
94
- && cot.raw.event.detail.TakControl
95
- && cot.raw.event.detail.TakControl.TakServerVersionInfo
96
- && cot.raw.event.detail.TakControl.TakServerVersionInfo._attributes) {
97
- this.version = cot.raw.event.detail.TakControl.TakServerVersionInfo._attributes.serverVersion;
98
- }
99
- else {
100
- this.emit('cot', cot);
101
- }
102
- }
103
- catch (e) {
104
- console.error('Error parsing', e, data.toString());
105
- }
106
- buff = result.remainder;
107
- result = TAK.findCoT(buff);
108
- }
109
- }).on('timeout', () => {
110
- this.emit('timeout');
111
- }).on('error', (err) => {
112
- this.emit('error', err);
113
- }).on('end', () => {
114
- this.open = false;
115
- this.emit('end');
116
- });
117
- this.pingInterval = setInterval(() => {
118
- this.ping();
119
- }, 5000);
120
- return resolve(this);
121
- });
122
- }
123
- async reconnect() {
124
- if (this.destroyed) {
125
- await this.connect_ssl();
126
- }
127
- else {
128
- this.destroy();
129
- await this.connect_ssl();
130
- }
131
- }
132
- destroy() {
133
- this.destroyed = true;
134
- if (this.client) {
135
- this.client.destroy();
136
- }
137
- if (this.pingInterval) {
138
- clearInterval(this.pingInterval);
139
- this.pingInterval = undefined;
140
- }
141
- }
142
- async ping() {
143
- this.write([CoT.ping()]);
144
- }
145
- writer(body) {
146
- return new Promise((resolve, reject) => {
147
- if (!this.client)
148
- return reject(new Error('A Connection Client must first be created before it can be written'));
149
- const res = this.client.write(body + '\n', () => {
150
- return resolve(res);
151
- });
152
- });
153
- }
154
- async process() {
155
- this.writing = true;
156
- while (this.queue.length) {
157
- const body = this.queue.shift();
158
- if (!body)
159
- continue;
160
- await this.writer(body);
161
- }
162
- await this.writer('');
163
- if (this.queue.length) {
164
- process.nextTick(() => {
165
- this.process();
166
- });
167
- }
168
- else {
169
- this.writing = false;
170
- }
171
- }
172
- /**
173
- * Write a CoT to the TAK Connection
174
- *
175
- * @param {CoT} cot CoT Object
176
- */
177
- async write(cots) {
178
- for (const cot of cots) {
179
- this.queue.push(await CoTParser.to_xml(cot));
180
- }
181
- if (this.queue.length && !this.writing) {
182
- this.process();
183
- }
184
- }
185
- write_xml(body) {
186
- this.queue.push(body);
187
- if (this.queue.length && !this.writing) {
188
- this.process();
189
- }
190
- }
191
- // https://github.com/vidterra/multitak/blob/main/app/lib/helper.js#L4
192
- static findCoT(str) {
193
- str = str.replace(REGEX_CONTROL, "");
194
- const match = str.match(REGEX_EVENT); // find first CoT
195
- if (!match)
196
- return null;
197
- return {
198
- event: match[1],
199
- remainder: match[2],
200
- };
201
- }
202
- }
203
- export { TAKAPI, CoT, };
204
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AAEvC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,cAAc,eAAe,CAAC;AAE9B,qCAAqC;AACrC,MAAM,CAAC,MAAM,aAAa,GAAG,+BAA+B,CAAC;A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AO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QAErC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB;QACvD,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAExB,OAAO;YACH,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;YACf,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;SACtB,CAAC;IACN,CAAC;CACJ;AAED,OAAO,EACH,MAAM,EACN,GAAG,GACN,CAAA"}
@@ -1,24 +0,0 @@
1
- import { Static } from '@sinclair/typebox';
2
- import type { ParsedArgs } from 'minimist';
3
- import Commands, { CommandOutputFormat } from '../commands.js';
4
- export declare const Contact: import("@sinclair/typebox").TObject<{
5
- filterGroups: import("@sinclair/typebox").TAny;
6
- notes: import("@sinclair/typebox").TString;
7
- callsign: import("@sinclair/typebox").TString;
8
- team: import("@sinclair/typebox").TString;
9
- role: import("@sinclair/typebox").TString;
10
- takv: import("@sinclair/typebox").TString;
11
- uid: import("@sinclair/typebox").TString;
12
- }>;
13
- export default class ContactCommands extends Commands {
14
- schema: {
15
- list: {
16
- description: string;
17
- params: import("@sinclair/typebox").TObject<{}>;
18
- query: import("@sinclair/typebox").TObject<{}>;
19
- formats: CommandOutputFormat[];
20
- };
21
- };
22
- cli(args: ParsedArgs): Promise<object | string>;
23
- list(): Promise<Array<Static<typeof Contact>>>;
24
- }
@@ -1,44 +0,0 @@
1
- import { Type } from '@sinclair/typebox';
2
- import Commands, { CommandOutputFormat } from '../commands.js';
3
- export const Contact = Type.Object({
4
- filterGroups: Type.Any(), // I'm not familiar with this one
5
- notes: Type.String(),
6
- callsign: Type.String(),
7
- team: Type.String(),
8
- role: Type.String(),
9
- takv: Type.String(),
10
- uid: Type.String()
11
- });
12
- export default class ContactCommands extends Commands {
13
- schema = {
14
- list: {
15
- description: 'List Contacts',
16
- params: Type.Object({}),
17
- query: Type.Object({}),
18
- formats: [CommandOutputFormat.JSON]
19
- }
20
- };
21
- async cli(args) {
22
- if (args._[3] === 'list') {
23
- const list = await this.list();
24
- if (args.format === 'json') {
25
- return list;
26
- }
27
- else {
28
- return list.map((contact) => {
29
- return `${contact.callsign || '<No Callsign Set>'} (${contact.notes.trim()})`;
30
- }).join('\n');
31
- }
32
- }
33
- else {
34
- throw new Error('Unsupported Subcommand');
35
- }
36
- }
37
- async list() {
38
- const url = new URL(`/Marti/api/contacts/all`, this.api.url);
39
- return await this.api.fetch(url, {
40
- method: 'GET'
41
- });
42
- }
43
- }
44
- //# sourceMappingURL=contacts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../../lib/api/contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,mBAAmB,CAAC;AAEjD,OAAO,QAAQ,EAAE,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;IAC/B,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,iCAAiC;IAC3D,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE;IACvB,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;IACnB,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,QAAQ;IACjD,MAAM,GAAG;QACL,IAAI,EAAE;YACF,WAAW,EAAE,eAAe;YAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,CAAE,mBAAmB,CAAC,IAAI,CAAE;SACxC;KACJ,CAAA;IAED,KAAK,CAAC,GAAG,CAAC,IAAgB;QACtB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;YACvB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAC/B,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBACzB,OAAO,IAAI,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACJ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;oBACxB,OAAO,GAAG,OAAO,CAAC,QAAQ,IAAI,mBAAmB,KAAK,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC;gBAClF,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI;QACN,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,yBAAyB,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;YAC7B,MAAM,EAAE,KAAK;SAChB,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -1,21 +0,0 @@
1
- import type { ParsedArgs } from 'minimist';
2
- import { Static } from '@sinclair/typebox';
3
- import Commands, { CommandOutputFormat } from '../commands.js';
4
- export declare const CertificateResponse: import("@sinclair/typebox").TObject<{
5
- ca: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
6
- cert: import("@sinclair/typebox").TString;
7
- key: import("@sinclair/typebox").TString;
8
- }>;
9
- export default class CredentialCommands extends Commands {
10
- schema: {
11
- config: {
12
- description: string;
13
- params: import("@sinclair/typebox").TObject<{}>;
14
- query: import("@sinclair/typebox").TObject<{}>;
15
- formats: CommandOutputFormat[];
16
- };
17
- };
18
- cli(args: ParsedArgs): Promise<object | string>;
19
- config(): Promise<string>;
20
- generate(): Promise<Static<typeof CertificateResponse>>;
21
- }