@tak-ps/node-tak 11.27.0 → 12.0.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 +2 -2
- package/dist/index.d.ts +96 -8
- package/dist/index.js +157 -44
- package/dist/index.js.map +1 -1
- package/dist/lib/utils/queue.d.ts +13 -0
- package/dist/lib/utils/queue.js +47 -0
- package/dist/lib/utils/queue.js.map +1 -0
- package/dist/test/pipeline.test.d.ts +1 -0
- package/dist/test/pipeline.test.js +223 -0
- package/dist/test/pipeline.test.js.map +1 -0
- package/dist/test/queue.test.d.ts +1 -0
- package/dist/test/queue.test.js +46 -0
- package/dist/test/queue.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +278 -93
- package/lib/utils/queue.ts +53 -0
- package/package.json +1 -1
- package/test/pipeline.test.ts +269 -0
- package/test/queue.test.ts +49 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
## Version History
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### v12.0.0 - 2025-02-11
|
|
14
14
|
|
|
15
|
-
- :
|
|
15
|
+
- :tada: Significantly improve memory performance of client when writing large amounts of data
|
|
16
16
|
|
|
17
17
|
### v11.26.2 - 2025-02-05
|
|
18
18
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import EventEmitter from 'node:events';
|
|
2
1
|
import type { Static } from '@sinclair/typebox';
|
|
3
|
-
import CoT from '@tak-ps/node-cot';
|
|
4
2
|
import type { CoTOptions } from '@tak-ps/node-cot';
|
|
3
|
+
import CoT from '@tak-ps/node-cot';
|
|
4
|
+
import EventEmitter from 'node:events';
|
|
5
5
|
import type { TLSSocket } from 'node:tls';
|
|
6
6
|
import TAKAPI from './lib/api.js';
|
|
7
7
|
import { TAKAuth } from './lib/auth.js';
|
|
8
|
+
import { Queue } from './lib/utils/queue.js';
|
|
8
9
|
export * from './lib/auth.js';
|
|
9
10
|
export declare const REGEX_CONTROL: RegExp;
|
|
10
11
|
export declare const REGEX_EVENT: RegExp;
|
|
@@ -12,10 +13,65 @@ export interface PartialCoT {
|
|
|
12
13
|
event: string;
|
|
13
14
|
remainder: string;
|
|
14
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Configuration options for a TAK connection.
|
|
18
|
+
*
|
|
19
|
+
* Performance-related options control the write pipeline:
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* write(cots) process()
|
|
23
|
+
* ─────────── ─────────
|
|
24
|
+
* for each CoT: while queue has items:
|
|
25
|
+
* serialize to XML ──push()──► Ring pop socketBatchSize items
|
|
26
|
+
* (returns false ◄──────── Buffer join into one string
|
|
27
|
+
* when full) (capacity = socket.write(batch)
|
|
28
|
+
* writeQueueSize) stop if backpressure
|
|
29
|
+
* when full:
|
|
30
|
+
* setImmediate() yield triggered by:
|
|
31
|
+
* (lets process() drain) - write() calling process()
|
|
32
|
+
* - socket 'drain' event
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example High-throughput bulk ingestion
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const tak = await TAK.connect(url, auth, {
|
|
38
|
+
* writeQueueSize: 50_000, // large buffer absorbs bursts
|
|
39
|
+
* socketBatchSize: 128, // 128 strings per socket.write()
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example Low-latency real-time streams
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const tak = await TAK.connect(url, auth, {
|
|
46
|
+
* writeQueueSize: 400, // small buffer keeps memory minimal
|
|
47
|
+
* socketBatchSize: 10, // flush to socket every 10 items
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
15
51
|
export type TAKOptions = {
|
|
52
|
+
/** Unique connection identifier. Appears in log messages for debugging.
|
|
53
|
+
* Useful when running multiple TAK connections in a single process.
|
|
54
|
+
* @default crypto.randomUUID() */
|
|
16
55
|
id?: number | string;
|
|
56
|
+
/** Connection type label. Informational only — helps distinguish
|
|
57
|
+
* connections in logs when multiple are active.
|
|
58
|
+
* @default 'unknown' */
|
|
17
59
|
type?: string;
|
|
60
|
+
/** Options passed through to `@tak-ps/node-cot` for CoT parsing
|
|
61
|
+
* (e.g., on incoming `'cot'` events). Does not affect the write pipeline. */
|
|
18
62
|
cot?: CoTOptions;
|
|
63
|
+
/** Capacity of the ring buffer that sits between `write()` and `process()`.
|
|
64
|
+
* When the queue is full, `write()` yields via `setImmediate()` until
|
|
65
|
+
* `process()` drains space. Larger values allow more XML strings to be
|
|
66
|
+
* buffered, increasing throughput at the cost of higher peak memory.
|
|
67
|
+
* @default 10_000 */
|
|
68
|
+
writeQueueSize?: number;
|
|
69
|
+
/** How many pre-serialized XML strings are popped from the ring buffer
|
|
70
|
+
* and joined into a single `socket.write()` call in `process()`. Higher
|
|
71
|
+
* values reduce syscall overhead and improve TLS frame packing, but
|
|
72
|
+
* increase per-write latency and the size of each socket write.
|
|
73
|
+
* @default 64 */
|
|
74
|
+
socketBatchSize?: number;
|
|
19
75
|
};
|
|
20
76
|
export default class TAK extends EventEmitter {
|
|
21
77
|
id: number | string;
|
|
@@ -24,12 +80,14 @@ export default class TAK extends EventEmitter {
|
|
|
24
80
|
auth: Static<typeof TAKAuth>;
|
|
25
81
|
open: boolean;
|
|
26
82
|
destroyed: boolean;
|
|
27
|
-
queue: string[];
|
|
28
83
|
writing: boolean;
|
|
84
|
+
writeQueueSize: number;
|
|
85
|
+
socketBatchSize: number;
|
|
29
86
|
cotOptions: CoTOptions;
|
|
30
87
|
pingInterval?: ReturnType<typeof setTimeout>;
|
|
31
88
|
client?: TLSSocket;
|
|
32
89
|
version?: string;
|
|
90
|
+
queue: Queue<string>;
|
|
33
91
|
/**
|
|
34
92
|
* @param url - Full URL of Streaming COT Endpoint IE: "https://ops.cotak.gov:8089"
|
|
35
93
|
* @param auth - TAK Certificate Pair
|
|
@@ -43,17 +101,47 @@ export default class TAK extends EventEmitter {
|
|
|
43
101
|
reconnect(): Promise<void>;
|
|
44
102
|
destroy(): void;
|
|
45
103
|
ping(): Promise<void>;
|
|
46
|
-
writer(body: string): Promise<boolean>;
|
|
47
|
-
process(): Promise<void>;
|
|
48
104
|
/**
|
|
49
|
-
*
|
|
105
|
+
* Drain the queue to the socket.
|
|
106
|
+
*
|
|
107
|
+
* Pops pre-serialized XML strings from the ring buffer, batches them
|
|
108
|
+
* (up to `socketBatchSize` per call), and writes to the socket. Runs
|
|
109
|
+
* synchronously in a single event loop tick until the socket signals
|
|
110
|
+
* backpressure or the queue is empty.
|
|
111
|
+
*
|
|
112
|
+
* Called when the socket signals readiness:
|
|
113
|
+
* - `'drain'` event (socket buffer cleared, ready for more)
|
|
114
|
+
* - After `write()` enqueues new items
|
|
115
|
+
*
|
|
116
|
+
* Emits `'_flushed'` when the queue drains to zero, waking any
|
|
117
|
+
* pending `flush()` calls.
|
|
118
|
+
*/
|
|
119
|
+
process(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Write CoTs to the TAK connection.
|
|
50
122
|
*
|
|
51
|
-
*
|
|
123
|
+
* Serializes each CoT to XML upfront and stores the string in a bounded
|
|
124
|
+
* ring buffer. Fully caller-safe: CoT objects can be mutated or GC'd
|
|
125
|
+
* immediately after this returns.
|
|
126
|
+
* Resolves when all items are queued (not when sent over the wire).
|
|
127
|
+
* Use flush() to wait for delivery.
|
|
128
|
+
*
|
|
129
|
+
* @param cots Array of CoT objects to send
|
|
52
130
|
*/
|
|
53
131
|
write(cots: CoT[]): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Wait until all queued CoTs have been flushed to the socket.
|
|
134
|
+
*
|
|
135
|
+
* write() is a fast "enqueue" — it returns once items are in the queue,
|
|
136
|
+
* NOT once they've been sent over the wire.
|
|
137
|
+
*
|
|
138
|
+
* Resolves immediately if nothing is queued.
|
|
139
|
+
* Rejects if the connection is destroyed before flush completes.
|
|
140
|
+
*/
|
|
141
|
+
flush(): Promise<void>;
|
|
54
142
|
write_xml(body: string): void;
|
|
55
143
|
static findCoT(str: string): null | PartialCoT;
|
|
56
144
|
}
|
|
57
145
|
export * from './lib/api.js';
|
|
58
146
|
export { CommandOutputFormat } from './lib/commands.js';
|
|
59
|
-
export {
|
|
147
|
+
export { CoT, TAKAPI };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import CoT, { CoTParser } from '@tak-ps/node-cot';
|
|
1
2
|
import EventEmitter from 'node:events';
|
|
2
3
|
import tls from 'node:tls';
|
|
3
|
-
import CoT, { CoTParser } from '@tak-ps/node-cot';
|
|
4
4
|
import TAKAPI from './lib/api.js';
|
|
5
|
+
import { Queue } from './lib/utils/queue.js';
|
|
5
6
|
export * from './lib/auth.js';
|
|
6
7
|
/* eslint-disable no-control-regex */
|
|
7
8
|
export const REGEX_CONTROL = /[\u000B-\u001F\u007F-\u009F]/g;
|
|
8
9
|
// Match <event .../> or <event> but not <events>
|
|
9
10
|
export const REGEX_EVENT = /(<event[ >][\s\S]*?<\/event>)([\s\S]*)/;
|
|
11
|
+
const DEFAULT_WRITE_QUEUE_SIZE = 10_000;
|
|
12
|
+
const DEFAULT_SOCKET_BATCH_SIZE = 64;
|
|
10
13
|
export default class TAK extends EventEmitter {
|
|
11
14
|
id;
|
|
12
15
|
type;
|
|
@@ -14,12 +17,18 @@ export default class TAK extends EventEmitter {
|
|
|
14
17
|
auth;
|
|
15
18
|
open;
|
|
16
19
|
destroyed;
|
|
17
|
-
queue;
|
|
18
20
|
writing;
|
|
21
|
+
writeQueueSize;
|
|
22
|
+
socketBatchSize;
|
|
19
23
|
cotOptions;
|
|
20
24
|
pingInterval;
|
|
21
25
|
client;
|
|
22
26
|
version;
|
|
27
|
+
// Hybrid pipeline:
|
|
28
|
+
// write() serializes CoTs upfront into a bounded ring buffer of XML strings.
|
|
29
|
+
// process() drains the ring buffer to the socket, driven by drain events.
|
|
30
|
+
// Fully caller-safe: CoT objects can be mutated/GC'd after write() returns.
|
|
31
|
+
queue;
|
|
23
32
|
/**
|
|
24
33
|
* @param url - Full URL of Streaming COT Endpoint IE: "https://ops.cotak.gov:8089"
|
|
25
34
|
* @param auth - TAK Certificate Pair
|
|
@@ -36,10 +45,13 @@ export default class TAK extends EventEmitter {
|
|
|
36
45
|
this.url = url;
|
|
37
46
|
this.auth = auth;
|
|
38
47
|
this.writing = false;
|
|
48
|
+
this.writeQueueSize = opts.writeQueueSize || DEFAULT_WRITE_QUEUE_SIZE;
|
|
49
|
+
this.socketBatchSize =
|
|
50
|
+
opts.socketBatchSize || DEFAULT_SOCKET_BATCH_SIZE;
|
|
39
51
|
this.cotOptions = opts.cot || {};
|
|
40
52
|
this.open = false;
|
|
41
53
|
this.destroyed = false;
|
|
42
|
-
this.queue =
|
|
54
|
+
this.queue = new Queue(this.writeQueueSize);
|
|
43
55
|
}
|
|
44
56
|
static async connect(url, auth, opts = {}) {
|
|
45
57
|
const tak = new TAK(url, auth, opts);
|
|
@@ -76,23 +88,28 @@ export default class TAK extends EventEmitter {
|
|
|
76
88
|
this.ping();
|
|
77
89
|
});
|
|
78
90
|
let buff = '';
|
|
79
|
-
this.client
|
|
91
|
+
this.client
|
|
92
|
+
.on('data', async (data) => {
|
|
80
93
|
// Eventually Parse ProtoBuf
|
|
81
94
|
buff = buff + data.toString();
|
|
82
95
|
let result = TAK.findCoT(buff);
|
|
83
96
|
while (result && result.event) {
|
|
84
97
|
try {
|
|
85
|
-
const cot =
|
|
98
|
+
const cot = CoTParser.from_xml(result.event, this.cotOptions);
|
|
86
99
|
if (cot.raw.event._attributes.type === 't-x-c-t-r') {
|
|
87
100
|
this.open = true;
|
|
88
101
|
this.emit('ping');
|
|
89
102
|
}
|
|
90
|
-
else if (cot.raw.event._attributes.type ===
|
|
91
|
-
&&
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
103
|
+
else if (cot.raw.event._attributes.type ===
|
|
104
|
+
't-x-takp-v' &&
|
|
105
|
+
cot.raw.event.detail &&
|
|
106
|
+
cot.raw.event.detail.TakControl &&
|
|
107
|
+
cot.raw.event.detail.TakControl
|
|
108
|
+
.TakServerVersionInfo &&
|
|
109
|
+
cot.raw.event.detail.TakControl
|
|
110
|
+
.TakServerVersionInfo._attributes) {
|
|
111
|
+
this.version =
|
|
112
|
+
cot.raw.event.detail.TakControl.TakServerVersionInfo._attributes.serverVersion;
|
|
96
113
|
}
|
|
97
114
|
else {
|
|
98
115
|
this.emit('cot', cot);
|
|
@@ -104,13 +121,28 @@ export default class TAK extends EventEmitter {
|
|
|
104
121
|
buff = result.remainder;
|
|
105
122
|
result = TAK.findCoT(buff);
|
|
106
123
|
}
|
|
107
|
-
})
|
|
124
|
+
})
|
|
125
|
+
.on('timeout', () => {
|
|
108
126
|
this.emit('timeout');
|
|
109
|
-
})
|
|
127
|
+
})
|
|
128
|
+
.on('error', (err) => {
|
|
129
|
+
console.error(`[socket] error:`, err.message);
|
|
110
130
|
this.emit('error', err);
|
|
111
|
-
})
|
|
131
|
+
})
|
|
132
|
+
.on('end', () => {
|
|
112
133
|
this.open = false;
|
|
113
134
|
this.emit('end');
|
|
135
|
+
if (!this.destroyed) {
|
|
136
|
+
this.destroy();
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
.on('close', () => {
|
|
140
|
+
if (!this.destroyed) {
|
|
141
|
+
this.destroy();
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
.on('drain', () => {
|
|
145
|
+
this.process();
|
|
114
146
|
});
|
|
115
147
|
this.pingInterval = setInterval(() => {
|
|
116
148
|
this.ping();
|
|
@@ -136,59 +168,140 @@ export default class TAK extends EventEmitter {
|
|
|
136
168
|
clearInterval(this.pingInterval);
|
|
137
169
|
this.pingInterval = undefined;
|
|
138
170
|
}
|
|
171
|
+
// Unblock any flush() waiters
|
|
172
|
+
this.emit('_flushed');
|
|
139
173
|
}
|
|
140
174
|
async ping() {
|
|
141
175
|
this.write([CoT.ping()]);
|
|
142
176
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Drain the queue to the socket.
|
|
179
|
+
*
|
|
180
|
+
* Pops pre-serialized XML strings from the ring buffer, batches them
|
|
181
|
+
* (up to `socketBatchSize` per call), and writes to the socket. Runs
|
|
182
|
+
* synchronously in a single event loop tick until the socket signals
|
|
183
|
+
* backpressure or the queue is empty.
|
|
184
|
+
*
|
|
185
|
+
* Called when the socket signals readiness:
|
|
186
|
+
* - `'drain'` event (socket buffer cleared, ready for more)
|
|
187
|
+
* - After `write()` enqueues new items
|
|
188
|
+
*
|
|
189
|
+
* Emits `'_flushed'` when the queue drains to zero, waking any
|
|
190
|
+
* pending `flush()` calls.
|
|
191
|
+
*/
|
|
192
|
+
process() {
|
|
193
|
+
if (this.writing)
|
|
194
|
+
return;
|
|
195
|
+
if (!this.client || this.destroyed)
|
|
196
|
+
return;
|
|
153
197
|
this.writing = true;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
198
|
+
try {
|
|
199
|
+
while (this.queue.length > 0) {
|
|
200
|
+
if (this.destroyed || !this.client)
|
|
201
|
+
break;
|
|
202
|
+
if (this.client.writableNeedDrain)
|
|
203
|
+
break;
|
|
204
|
+
const batchCount = Math.min(this.socketBatchSize, this.queue.length);
|
|
205
|
+
const parts = new Array(batchCount);
|
|
206
|
+
for (let i = 0; i < batchCount; i++) {
|
|
207
|
+
const xml = this.queue.pop();
|
|
208
|
+
if (!xml)
|
|
209
|
+
break;
|
|
210
|
+
parts[i] = xml;
|
|
211
|
+
}
|
|
212
|
+
const ok = this.client.write(parts.join('\n') + '\n');
|
|
213
|
+
if (!ok)
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
159
216
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.process();
|
|
164
|
-
});
|
|
217
|
+
catch (err) {
|
|
218
|
+
this.destroy();
|
|
219
|
+
this.emit('error', err);
|
|
165
220
|
}
|
|
166
|
-
|
|
221
|
+
finally {
|
|
167
222
|
this.writing = false;
|
|
223
|
+
// Safety net: if a drain event fired while writing=true (and was
|
|
224
|
+
// therefore ignored), re-check. If the socket has capacity, reschedule
|
|
225
|
+
// on the next event loop turn so I/O callbacks can run first.
|
|
226
|
+
if (this.queue.length > 0 &&
|
|
227
|
+
!this.destroyed &&
|
|
228
|
+
this.client &&
|
|
229
|
+
!this.client.writableNeedDrain) {
|
|
230
|
+
setImmediate(() => this.process());
|
|
231
|
+
}
|
|
232
|
+
if (this.queue.length === 0) {
|
|
233
|
+
this.emit('_flushed');
|
|
234
|
+
}
|
|
168
235
|
}
|
|
169
236
|
}
|
|
170
237
|
/**
|
|
171
|
-
* Write
|
|
238
|
+
* Write CoTs to the TAK connection.
|
|
239
|
+
*
|
|
240
|
+
* Serializes each CoT to XML upfront and stores the string in a bounded
|
|
241
|
+
* ring buffer. Fully caller-safe: CoT objects can be mutated or GC'd
|
|
242
|
+
* immediately after this returns.
|
|
243
|
+
* Resolves when all items are queued (not when sent over the wire).
|
|
244
|
+
* Use flush() to wait for delivery.
|
|
172
245
|
*
|
|
173
|
-
* @param
|
|
246
|
+
* @param cots Array of CoT objects to send
|
|
174
247
|
*/
|
|
175
248
|
async write(cots) {
|
|
176
|
-
for (
|
|
177
|
-
this.
|
|
178
|
-
|
|
179
|
-
|
|
249
|
+
for (let i = 0; i < cots.length;) {
|
|
250
|
+
if (this.destroyed)
|
|
251
|
+
return;
|
|
252
|
+
// Serialize upfront and push XML strings into the ring buffer
|
|
253
|
+
while (i < cots.length &&
|
|
254
|
+
this.queue.push(CoTParser.to_xml(cots[i]))) {
|
|
255
|
+
i++;
|
|
256
|
+
}
|
|
257
|
+
// Kick process to start draining
|
|
180
258
|
this.process();
|
|
259
|
+
// Queue full — yield to let process() drain via I/O callbacks,
|
|
260
|
+
// then retry on the next event loop turn.
|
|
261
|
+
if (i < cots.length) {
|
|
262
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
263
|
+
}
|
|
181
264
|
}
|
|
182
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Wait until all queued CoTs have been flushed to the socket.
|
|
268
|
+
*
|
|
269
|
+
* write() is a fast "enqueue" — it returns once items are in the queue,
|
|
270
|
+
* NOT once they've been sent over the wire.
|
|
271
|
+
*
|
|
272
|
+
* Resolves immediately if nothing is queued.
|
|
273
|
+
* Rejects if the connection is destroyed before flush completes.
|
|
274
|
+
*/
|
|
275
|
+
async flush() {
|
|
276
|
+
if (this.queue.length === 0 && !this.writing)
|
|
277
|
+
return;
|
|
278
|
+
return new Promise((resolve, reject) => {
|
|
279
|
+
const check = () => {
|
|
280
|
+
if (this.destroyed) {
|
|
281
|
+
cleanup();
|
|
282
|
+
reject(new Error('connection destroyed before flush completed'));
|
|
283
|
+
}
|
|
284
|
+
else if (this.queue.length === 0 && !this.writing) {
|
|
285
|
+
cleanup();
|
|
286
|
+
resolve();
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
const cleanup = () => {
|
|
290
|
+
this.removeListener('_flushed', check);
|
|
291
|
+
};
|
|
292
|
+
this.on('_flushed', check);
|
|
293
|
+
check();
|
|
294
|
+
});
|
|
295
|
+
}
|
|
183
296
|
write_xml(body) {
|
|
184
297
|
this.queue.push(body);
|
|
185
|
-
if (this.queue.length && !this.writing) {
|
|
298
|
+
if (this.queue.length > 0 && !this.writing) {
|
|
186
299
|
this.process();
|
|
187
300
|
}
|
|
188
301
|
}
|
|
189
302
|
// https://github.com/vidterra/multitak/blob/main/app/lib/helper.js#L4
|
|
190
303
|
static findCoT(str) {
|
|
191
|
-
str = str.replace(REGEX_CONTROL,
|
|
304
|
+
str = str.replace(REGEX_CONTROL, '');
|
|
192
305
|
const match = str.match(REGEX_EVENT); // find first CoT
|
|
193
306
|
if (!match)
|
|
194
307
|
return null;
|
|
@@ -200,5 +313,5 @@ export default class TAK extends EventEmitter {
|
|
|
200
313
|
}
|
|
201
314
|
export * from './lib/api.js';
|
|
202
315
|
export { CommandOutputFormat } from './lib/commands.js';
|
|
203
|
-
export {
|
|
316
|
+
export { CoT, TAKAPI };
|
|
204
317
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,YAAY,MAAM,aAAa,CAAC;AAEvC,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,cAAc,eAAe,CAAC;AAE9B,qCAAqC;AACrC,MAAM,CAAC,MAAM,aAAa,GAAG,+BAA+B,CAAC;AAE7D,iDAAiD;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,wCAAwC,CAAC;AAwEpE,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAErC,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,YAAY;IACzC,EAAE,CAAkB;IACpB,IAAI,CAAS;IACb,GAAG,CAAM;IACT,IAAI,CAAyB;IAC7B,IAAI,CAAU;IACd,SAAS,CAAU;IACnB,OAAO,CAAU;IACjB,cAAc,CAAS;IACvB,eAAe,CAAS;IAExB,UAAU,CAAa;IAEvB,YAAY,CAAiC;IAC7C,MAAM,CAAa;IACnB,OAAO,CAAU;IAEjB,mBAAmB;IACnB,+EAA+E;IAC/E,4EAA4E;IAC5E,8EAA8E;IAC9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AO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class Queue<T> {
|
|
2
|
+
private buffer;
|
|
3
|
+
private capacity;
|
|
4
|
+
private head;
|
|
5
|
+
private tail;
|
|
6
|
+
private _length;
|
|
7
|
+
constructor(capacity?: number);
|
|
8
|
+
push(item: T): boolean;
|
|
9
|
+
peek(): T | undefined;
|
|
10
|
+
pop(): T | undefined;
|
|
11
|
+
get length(): number;
|
|
12
|
+
get isFull(): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// A fixed-size Ring Buffer (Circular Queue) for zero-allocation operations.
|
|
2
|
+
export class Queue {
|
|
3
|
+
buffer;
|
|
4
|
+
capacity;
|
|
5
|
+
head;
|
|
6
|
+
tail;
|
|
7
|
+
_length;
|
|
8
|
+
constructor(capacity = 10000) {
|
|
9
|
+
this.capacity = capacity;
|
|
10
|
+
this.buffer = new Array(capacity);
|
|
11
|
+
this.head = 0;
|
|
12
|
+
this.tail = 0;
|
|
13
|
+
this._length = 0;
|
|
14
|
+
}
|
|
15
|
+
// Add item to the queue. Returns false if full.
|
|
16
|
+
push(item) {
|
|
17
|
+
if (this._length >= this.capacity) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
this.buffer[this.tail] = item;
|
|
21
|
+
this.tail = (this.tail + 1) % this.capacity;
|
|
22
|
+
this._length++;
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
// Peek at the next item
|
|
26
|
+
peek() {
|
|
27
|
+
if (this._length === 0)
|
|
28
|
+
return undefined;
|
|
29
|
+
return this.buffer[this.head];
|
|
30
|
+
}
|
|
31
|
+
pop() {
|
|
32
|
+
if (this._length === 0)
|
|
33
|
+
return undefined;
|
|
34
|
+
const item = this.buffer[this.head];
|
|
35
|
+
this.buffer[this.head] = undefined; // Clear reference for GC
|
|
36
|
+
this.head = (this.head + 1) % this.capacity;
|
|
37
|
+
this._length--;
|
|
38
|
+
return item;
|
|
39
|
+
}
|
|
40
|
+
get length() {
|
|
41
|
+
return this._length;
|
|
42
|
+
}
|
|
43
|
+
get isFull() {
|
|
44
|
+
return this._length === this.capacity;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../lib/utils/queue.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,OAAO,KAAK;IACN,MAAM,CAAoB;IAC1B,QAAQ,CAAS;IACjB,IAAI,CAAS;IACb,IAAI,CAAS;IACb,OAAO,CAAS;IAExB,YAAY,WAAmB,KAAK;QAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,gDAAgD;IAChD,IAAI,CAAC,IAAO;QACR,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,wBAAwB;IACxB,IAAI;QACA,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC;YAAE,OAAO,SAAS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