asyx 0.10.0 → 0.11.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.
Files changed (93) hide show
  1. package/AGENTS.md +42 -0
  2. package/bin/asyx.js +1 -1
  3. package/package.json +6 -3
  4. package/src/commands/account.js +80 -71
  5. package/src/commands/app.js +317 -151
  6. package/src/commands/in-use-messages.js +47 -48
  7. package/src/commands/mqtt-broker.js +36 -49
  8. package/src/commands/mqtt.js +111 -149
  9. package/src/commands/name.js +24 -22
  10. package/src/commands/reject-messages.js +123 -123
  11. package/src/commands/setup.js +107 -131
  12. package/src/commands/sts.js +45 -61
  13. package/src/commands/tunnel.js +853 -931
  14. package/src/commands/validate-target-host.js +36 -59
  15. package/src/lib/aws-iot-config.js +30 -0
  16. package/src/lib/certs.js +15 -18
  17. package/src/lib/csr.js +107 -182
  18. package/src/lib/device.js +26 -37
  19. package/src/lib/ids.js +1 -2
  20. package/src/lib/naming.js +74 -68
  21. package/src/lib/pairing.js +10 -11
  22. package/src/lib/shared-transport.js +5 -9
  23. package/src/main.js +63 -53
  24. package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneClient.js +25 -287
  25. package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneTransport.js +0 -72
  26. package/vendor/tunnel-core/dist/control-plane/session.js +0 -20
  27. package/vendor/tunnel-core/dist/errors.js +0 -19
  28. package/vendor/tunnel-core/dist/flows/account.js +1 -6
  29. package/vendor/tunnel-core/dist/flows/goodbye.js +0 -4
  30. package/vendor/tunnel-core/dist/flows/http.js +24 -112
  31. package/vendor/tunnel-core/dist/flows/identity.js +11 -10
  32. package/vendor/tunnel-core/dist/flows/in-use.js +0 -6
  33. package/vendor/tunnel-core/dist/flows/reopen.js +0 -4
  34. package/vendor/tunnel-core/dist/flows/tcp.js +18 -84
  35. package/vendor/tunnel-core/dist/flows/udp.js +15 -52
  36. package/vendor/tunnel-core/dist/lib/fingerprint.js +38 -42
  37. package/vendor/tunnel-core/dist/lib/jwt-verifier.js +14 -67
  38. package/vendor/tunnel-core/dist/lib/logger.js +1 -9
  39. package/vendor/tunnel-core/dist/lib/refresh-helpers.js +1 -22
  40. package/vendor/tunnel-core/dist/lifecycle.js +1 -8
  41. package/vendor/tunnel-core/dist/mqtt/awaiter-map.js +1 -53
  42. package/vendor/tunnel-core/dist/mqtt/events/handlers.js +10 -64
  43. package/vendor/tunnel-core/dist/mqtt/events/index.js +3 -36
  44. package/vendor/tunnel-core/dist/mqtt/events/schemas.js +0 -1
  45. package/vendor/tunnel-core/dist/mqtt/ingress.js +0 -60
  46. package/vendor/tunnel-core/dist/state/assignment.js +6 -122
  47. package/vendor/tunnel-core/dist/state/instance-registry.js +0 -63
  48. package/vendor/tunnel-core/dist/tcp-v1/framing.js +2 -64
  49. package/vendor/tunnel-core/dist/tunnel/http-tunnel.js +64 -331
  50. package/vendor/tunnel-core/dist/tunnel/httpws-constants.js +5 -14
  51. package/vendor/tunnel-core/dist/tunnel/reconnect.js +10 -50
  52. package/vendor/tunnel-core/dist/tunnel/request-sink.js +0 -16
  53. package/vendor/tunnel-core/dist/tunnel/tcp-tunnel.js +32 -195
  54. package/vendor/tunnel-core/dist/tunnel/udp-tunnel.js +28 -153
  55. package/vendor/tunnel-core/dist/tunnel/ws-control.js +4 -39
  56. package/vendor/tunnel-core/dist/types.js +0 -2
  57. package/vendor/tunnel-core/dist/udp-v1/framing.js +2 -64
  58. package/vendor/tunnel-core/package.json +0 -25
  59. package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneClient.d.ts +0 -273
  60. package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneTransport.d.ts +0 -79
  61. package/vendor/tunnel-core/dist/control-plane/session.d.ts +0 -55
  62. package/vendor/tunnel-core/dist/errors.d.ts +0 -49
  63. package/vendor/tunnel-core/dist/flows/account.d.ts +0 -24
  64. package/vendor/tunnel-core/dist/flows/goodbye.d.ts +0 -10
  65. package/vendor/tunnel-core/dist/flows/http.d.ts +0 -61
  66. package/vendor/tunnel-core/dist/flows/identity.d.ts +0 -23
  67. package/vendor/tunnel-core/dist/flows/in-use.d.ts +0 -27
  68. package/vendor/tunnel-core/dist/flows/reopen.d.ts +0 -9
  69. package/vendor/tunnel-core/dist/flows/tcp.d.ts +0 -85
  70. package/vendor/tunnel-core/dist/flows/udp.d.ts +0 -52
  71. package/vendor/tunnel-core/dist/lib/adapt-logger.d.ts +0 -2
  72. package/vendor/tunnel-core/dist/lib/fingerprint.d.ts +0 -145
  73. package/vendor/tunnel-core/dist/lib/jwt-verifier.d.ts +0 -27
  74. package/vendor/tunnel-core/dist/lib/logger.d.ts +0 -9
  75. package/vendor/tunnel-core/dist/lib/refresh-helpers.d.ts +0 -16
  76. package/vendor/tunnel-core/dist/lifecycle.d.ts +0 -24
  77. package/vendor/tunnel-core/dist/mqtt/awaiter-map.d.ts +0 -56
  78. package/vendor/tunnel-core/dist/mqtt/events/handlers.d.ts +0 -60
  79. package/vendor/tunnel-core/dist/mqtt/events/index.d.ts +0 -1
  80. package/vendor/tunnel-core/dist/mqtt/events/schemas.d.ts +0 -498
  81. package/vendor/tunnel-core/dist/mqtt/ingress.d.ts +0 -63
  82. package/vendor/tunnel-core/dist/state/assignment.d.ts +0 -136
  83. package/vendor/tunnel-core/dist/state/instance-registry.d.ts +0 -88
  84. package/vendor/tunnel-core/dist/tcp-v1/framing.d.ts +0 -43
  85. package/vendor/tunnel-core/dist/tunnel/http-tunnel.d.ts +0 -140
  86. package/vendor/tunnel-core/dist/tunnel/httpws-constants.d.ts +0 -13
  87. package/vendor/tunnel-core/dist/tunnel/reconnect.d.ts +0 -76
  88. package/vendor/tunnel-core/dist/tunnel/request-sink.d.ts +0 -40
  89. package/vendor/tunnel-core/dist/tunnel/tcp-tunnel.d.ts +0 -92
  90. package/vendor/tunnel-core/dist/tunnel/udp-tunnel.d.ts +0 -93
  91. package/vendor/tunnel-core/dist/tunnel/ws-control.d.ts +0 -22
  92. package/vendor/tunnel-core/dist/types.d.ts +0 -24
  93. package/vendor/tunnel-core/dist/udp-v1/framing.d.ts +0 -41
@@ -1,56 +0,0 @@
1
- /**
2
- * AwaiterMap - Manages request/response correlation for MQTT messages
3
- *
4
- * Provides a bounded map of awaiters that can be resolved by incoming messages.
5
- * Each awaiter has a criteria function and timeout, and will be automatically
6
- * cleaned up on resolve, reject, or timeout.
7
- */
8
- export class AwaiterMap {
9
- /**
10
- * Create a criteria function for session ID matching (backward compatibility)
11
- * @param {string} sessionId - Session ID to match
12
- * @param {string} expectedTopic - Expected topic pattern
13
- * @returns {Function} Criteria function
14
- */
15
- static createSessionIdCriteria(sessionId: string, expectedTopic: string): Function;
16
- /**
17
- * Create a criteria function for correlation ID matching (future use)
18
- * @param {string} correlationId - Correlation ID to match
19
- * @param {string} expectedTopic - Expected topic pattern
20
- * @returns {Function} Criteria function
21
- */
22
- static createCorrelationIdCriteria(correlationId: string, expectedTopic: string): Function;
23
- constructor(maxSize?: number, logger?: any);
24
- maxSize: number;
25
- awaiters: Map<any, any>;
26
- nextId: number;
27
- logger: any;
28
- /**
29
- * Register an awaiter that will be resolved when a message matches the criteria
30
- * @param {Function} criteria - Function that returns true if message matches
31
- * @param {number} timeoutMs - Timeout in milliseconds
32
- * @returns {Promise} Promise that resolves with the matching message
33
- */
34
- register(criteria: Function, timeoutMs?: number): Promise<any>;
35
- /**
36
- * Process an incoming message against all registered awaiters
37
- * @param {Object} message - Message object with topic and payload
38
- * @returns {boolean} True if any awaiter was resolved
39
- */
40
- processMessage(message: any): boolean;
41
- /**
42
- * Get current statistics about the awaiter map
43
- * @returns {Object} Statistics object
44
- */
45
- getStats(): any;
46
- /**
47
- * Cancel awaiters that match a test criteria
48
- * @param {Function} testCriteria - Function that returns true if an awaiter should be cancelled
49
- * @returns {number} Number of awaiters cancelled
50
- */
51
- cancelByCriteria(testCriteria: Function): number;
52
- /**
53
- * Clear all awaiters (for cleanup)
54
- */
55
- clear(): void;
56
- }
@@ -1,60 +0,0 @@
1
- /** Story 1.9: how "this tunnel was taken over by a newer one" is reported (the CLI prints and exits 75). */
2
- export function setReplacedReporter(fn: any): void;
3
- /** Register how open rejections are reported to the user (the CLI does; the SDK uses errors). */
4
- export function setOpenRejectReporter(fn: any): void;
5
- export function getHandler(type: any): any;
6
- export function parseAny(raw: any): {
7
- requestId?: string;
8
- type?: "setup_required";
9
- v?: 1;
10
- ts?: number;
11
- data?: {
12
- reason?: string;
13
- };
14
- } | {
15
- requestId?: string;
16
- type?: "open_ack";
17
- v?: 1;
18
- ts?: number;
19
- data?: {
20
- assignment?: {
21
- path?: string;
22
- jwt?: string;
23
- fqdn?: string;
24
- proto?: string;
25
- kid?: string;
26
- alg?: string;
27
- exp?: number;
28
- };
29
- relayId?: string;
30
- leaseMs?: number;
31
- };
32
- } | {
33
- requestId?: string;
34
- type?: "open_ack";
35
- v?: 1;
36
- ts?: number;
37
- data?: {
38
- relayId?: string;
39
- leaseMs?: number;
40
- jwt?: string;
41
- };
42
- } | {
43
- requestId?: string;
44
- type?: "open_reject";
45
- v?: 1;
46
- ts?: number;
47
- data?: {
48
- reason?: string;
49
- };
50
- } | {
51
- requestId?: string;
52
- type?: "error";
53
- v?: 1;
54
- ts?: number;
55
- data?: {
56
- code?: string;
57
- msg?: string;
58
- };
59
- };
60
- export const FATAL_REJECT_CODES: Set<string>;
@@ -1 +0,0 @@
1
- export function dispatch(parsedMessage: any): Promise<any>;
@@ -1,498 +0,0 @@
1
- export const Envelope: z.ZodObject<{
2
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
3
- v: z.ZodLiteral<1>;
4
- requestId: z.ZodString;
5
- ts: z.ZodNumber;
6
- data: z.ZodUnknown;
7
- }, "strip", z.ZodTypeAny, {
8
- requestId?: string;
9
- type?: "setup_required" | "error" | "open_reject" | "open_ack";
10
- v?: 1;
11
- ts?: number;
12
- data?: unknown;
13
- }, {
14
- requestId?: string;
15
- type?: "setup_required" | "error" | "open_reject" | "open_ack";
16
- v?: 1;
17
- ts?: number;
18
- data?: unknown;
19
- }>;
20
- export const SetupRequired: z.ZodObject<z.objectUtil.extendShape<{
21
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
22
- v: z.ZodLiteral<1>;
23
- requestId: z.ZodString;
24
- ts: z.ZodNumber;
25
- data: z.ZodUnknown;
26
- }, {
27
- type: z.ZodLiteral<"setup_required">;
28
- data: z.ZodObject<{
29
- reason: z.ZodOptional<z.ZodString>;
30
- }, "strip", z.ZodTypeAny, {
31
- reason?: string;
32
- }, {
33
- reason?: string;
34
- }>;
35
- }>, "strip", z.ZodTypeAny, {
36
- requestId?: string;
37
- type?: "setup_required";
38
- v?: 1;
39
- ts?: number;
40
- data?: {
41
- reason?: string;
42
- };
43
- }, {
44
- requestId?: string;
45
- type?: "setup_required";
46
- v?: 1;
47
- ts?: number;
48
- data?: {
49
- reason?: string;
50
- };
51
- }>;
52
- export const OpenAck: z.ZodObject<z.objectUtil.extendShape<{
53
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
54
- v: z.ZodLiteral<1>;
55
- requestId: z.ZodString;
56
- ts: z.ZodNumber;
57
- data: z.ZodUnknown;
58
- }, {
59
- type: z.ZodLiteral<"open_ack">;
60
- data: z.ZodObject<{
61
- relayId: z.ZodString;
62
- leaseMs: z.ZodNumber;
63
- assignment: z.ZodObject<{
64
- jwt: z.ZodString;
65
- fqdn: z.ZodString;
66
- proto: z.ZodString;
67
- path: z.ZodString;
68
- kid: z.ZodOptional<z.ZodString>;
69
- alg: z.ZodOptional<z.ZodString>;
70
- exp: z.ZodOptional<z.ZodNumber>;
71
- }, "strip", z.ZodTypeAny, {
72
- path?: string;
73
- jwt?: string;
74
- fqdn?: string;
75
- proto?: string;
76
- kid?: string;
77
- alg?: string;
78
- exp?: number;
79
- }, {
80
- path?: string;
81
- jwt?: string;
82
- fqdn?: string;
83
- proto?: string;
84
- kid?: string;
85
- alg?: string;
86
- exp?: number;
87
- }>;
88
- }, "strip", z.ZodTypeAny, {
89
- assignment?: {
90
- path?: string;
91
- jwt?: string;
92
- fqdn?: string;
93
- proto?: string;
94
- kid?: string;
95
- alg?: string;
96
- exp?: number;
97
- };
98
- relayId?: string;
99
- leaseMs?: number;
100
- }, {
101
- assignment?: {
102
- path?: string;
103
- jwt?: string;
104
- fqdn?: string;
105
- proto?: string;
106
- kid?: string;
107
- alg?: string;
108
- exp?: number;
109
- };
110
- relayId?: string;
111
- leaseMs?: number;
112
- }>;
113
- }>, "strip", z.ZodTypeAny, {
114
- requestId?: string;
115
- type?: "open_ack";
116
- v?: 1;
117
- ts?: number;
118
- data?: {
119
- assignment?: {
120
- path?: string;
121
- jwt?: string;
122
- fqdn?: string;
123
- proto?: string;
124
- kid?: string;
125
- alg?: string;
126
- exp?: number;
127
- };
128
- relayId?: string;
129
- leaseMs?: number;
130
- };
131
- }, {
132
- requestId?: string;
133
- type?: "open_ack";
134
- v?: 1;
135
- ts?: number;
136
- data?: {
137
- assignment?: {
138
- path?: string;
139
- jwt?: string;
140
- fqdn?: string;
141
- proto?: string;
142
- kid?: string;
143
- alg?: string;
144
- exp?: number;
145
- };
146
- relayId?: string;
147
- leaseMs?: number;
148
- };
149
- }>;
150
- export const OpenAckLegacy: z.ZodObject<z.objectUtil.extendShape<{
151
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
152
- v: z.ZodLiteral<1>;
153
- requestId: z.ZodString;
154
- ts: z.ZodNumber;
155
- data: z.ZodUnknown;
156
- }, {
157
- type: z.ZodLiteral<"open_ack">;
158
- data: z.ZodObject<{
159
- relayId: z.ZodString;
160
- jwt: z.ZodString;
161
- leaseMs: z.ZodNumber;
162
- }, "strip", z.ZodTypeAny, {
163
- relayId?: string;
164
- leaseMs?: number;
165
- jwt?: string;
166
- }, {
167
- relayId?: string;
168
- leaseMs?: number;
169
- jwt?: string;
170
- }>;
171
- }>, "strip", z.ZodTypeAny, {
172
- requestId?: string;
173
- type?: "open_ack";
174
- v?: 1;
175
- ts?: number;
176
- data?: {
177
- relayId?: string;
178
- leaseMs?: number;
179
- jwt?: string;
180
- };
181
- }, {
182
- requestId?: string;
183
- type?: "open_ack";
184
- v?: 1;
185
- ts?: number;
186
- data?: {
187
- relayId?: string;
188
- leaseMs?: number;
189
- jwt?: string;
190
- };
191
- }>;
192
- export const OpenReject: z.ZodObject<z.objectUtil.extendShape<{
193
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
194
- v: z.ZodLiteral<1>;
195
- requestId: z.ZodString;
196
- ts: z.ZodNumber;
197
- data: z.ZodUnknown;
198
- }, {
199
- type: z.ZodLiteral<"open_reject">;
200
- data: z.ZodObject<{
201
- reason: z.ZodString;
202
- }, "strip", z.ZodTypeAny, {
203
- reason?: string;
204
- }, {
205
- reason?: string;
206
- }>;
207
- }>, "strip", z.ZodTypeAny, {
208
- requestId?: string;
209
- type?: "open_reject";
210
- v?: 1;
211
- ts?: number;
212
- data?: {
213
- reason?: string;
214
- };
215
- }, {
216
- requestId?: string;
217
- type?: "open_reject";
218
- v?: 1;
219
- ts?: number;
220
- data?: {
221
- reason?: string;
222
- };
223
- }>;
224
- export const ErrorEvt: z.ZodObject<z.objectUtil.extendShape<{
225
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
226
- v: z.ZodLiteral<1>;
227
- requestId: z.ZodString;
228
- ts: z.ZodNumber;
229
- data: z.ZodUnknown;
230
- }, {
231
- type: z.ZodEnum<["error"]>;
232
- data: z.ZodObject<{
233
- code: z.ZodString;
234
- msg: z.ZodOptional<z.ZodString>;
235
- }, "strip", z.ZodTypeAny, {
236
- code?: string;
237
- msg?: string;
238
- }, {
239
- code?: string;
240
- msg?: string;
241
- }>;
242
- }>, "strip", z.ZodTypeAny, {
243
- requestId?: string;
244
- type?: "error";
245
- v?: 1;
246
- ts?: number;
247
- data?: {
248
- code?: string;
249
- msg?: string;
250
- };
251
- }, {
252
- requestId?: string;
253
- type?: "error";
254
- v?: 1;
255
- ts?: number;
256
- data?: {
257
- code?: string;
258
- msg?: string;
259
- };
260
- }>;
261
- export const AnyEvt: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
262
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
263
- v: z.ZodLiteral<1>;
264
- requestId: z.ZodString;
265
- ts: z.ZodNumber;
266
- data: z.ZodUnknown;
267
- }, {
268
- type: z.ZodLiteral<"setup_required">;
269
- data: z.ZodObject<{
270
- reason: z.ZodOptional<z.ZodString>;
271
- }, "strip", z.ZodTypeAny, {
272
- reason?: string;
273
- }, {
274
- reason?: string;
275
- }>;
276
- }>, "strip", z.ZodTypeAny, {
277
- requestId?: string;
278
- type?: "setup_required";
279
- v?: 1;
280
- ts?: number;
281
- data?: {
282
- reason?: string;
283
- };
284
- }, {
285
- requestId?: string;
286
- type?: "setup_required";
287
- v?: 1;
288
- ts?: number;
289
- data?: {
290
- reason?: string;
291
- };
292
- }>, z.ZodObject<z.objectUtil.extendShape<{
293
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
294
- v: z.ZodLiteral<1>;
295
- requestId: z.ZodString;
296
- ts: z.ZodNumber;
297
- data: z.ZodUnknown;
298
- }, {
299
- type: z.ZodLiteral<"open_ack">;
300
- data: z.ZodObject<{
301
- relayId: z.ZodString;
302
- leaseMs: z.ZodNumber;
303
- assignment: z.ZodObject<{
304
- jwt: z.ZodString;
305
- fqdn: z.ZodString;
306
- proto: z.ZodString;
307
- path: z.ZodString;
308
- kid: z.ZodOptional<z.ZodString>;
309
- alg: z.ZodOptional<z.ZodString>;
310
- exp: z.ZodOptional<z.ZodNumber>;
311
- }, "strip", z.ZodTypeAny, {
312
- path?: string;
313
- jwt?: string;
314
- fqdn?: string;
315
- proto?: string;
316
- kid?: string;
317
- alg?: string;
318
- exp?: number;
319
- }, {
320
- path?: string;
321
- jwt?: string;
322
- fqdn?: string;
323
- proto?: string;
324
- kid?: string;
325
- alg?: string;
326
- exp?: number;
327
- }>;
328
- }, "strip", z.ZodTypeAny, {
329
- assignment?: {
330
- path?: string;
331
- jwt?: string;
332
- fqdn?: string;
333
- proto?: string;
334
- kid?: string;
335
- alg?: string;
336
- exp?: number;
337
- };
338
- relayId?: string;
339
- leaseMs?: number;
340
- }, {
341
- assignment?: {
342
- path?: string;
343
- jwt?: string;
344
- fqdn?: string;
345
- proto?: string;
346
- kid?: string;
347
- alg?: string;
348
- exp?: number;
349
- };
350
- relayId?: string;
351
- leaseMs?: number;
352
- }>;
353
- }>, "strip", z.ZodTypeAny, {
354
- requestId?: string;
355
- type?: "open_ack";
356
- v?: 1;
357
- ts?: number;
358
- data?: {
359
- assignment?: {
360
- path?: string;
361
- jwt?: string;
362
- fqdn?: string;
363
- proto?: string;
364
- kid?: string;
365
- alg?: string;
366
- exp?: number;
367
- };
368
- relayId?: string;
369
- leaseMs?: number;
370
- };
371
- }, {
372
- requestId?: string;
373
- type?: "open_ack";
374
- v?: 1;
375
- ts?: number;
376
- data?: {
377
- assignment?: {
378
- path?: string;
379
- jwt?: string;
380
- fqdn?: string;
381
- proto?: string;
382
- kid?: string;
383
- alg?: string;
384
- exp?: number;
385
- };
386
- relayId?: string;
387
- leaseMs?: number;
388
- };
389
- }>, z.ZodObject<z.objectUtil.extendShape<{
390
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
391
- v: z.ZodLiteral<1>;
392
- requestId: z.ZodString;
393
- ts: z.ZodNumber;
394
- data: z.ZodUnknown;
395
- }, {
396
- type: z.ZodLiteral<"open_ack">;
397
- data: z.ZodObject<{
398
- relayId: z.ZodString;
399
- jwt: z.ZodString;
400
- leaseMs: z.ZodNumber;
401
- }, "strip", z.ZodTypeAny, {
402
- relayId?: string;
403
- leaseMs?: number;
404
- jwt?: string;
405
- }, {
406
- relayId?: string;
407
- leaseMs?: number;
408
- jwt?: string;
409
- }>;
410
- }>, "strip", z.ZodTypeAny, {
411
- requestId?: string;
412
- type?: "open_ack";
413
- v?: 1;
414
- ts?: number;
415
- data?: {
416
- relayId?: string;
417
- leaseMs?: number;
418
- jwt?: string;
419
- };
420
- }, {
421
- requestId?: string;
422
- type?: "open_ack";
423
- v?: 1;
424
- ts?: number;
425
- data?: {
426
- relayId?: string;
427
- leaseMs?: number;
428
- jwt?: string;
429
- };
430
- }>, z.ZodObject<z.objectUtil.extendShape<{
431
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
432
- v: z.ZodLiteral<1>;
433
- requestId: z.ZodString;
434
- ts: z.ZodNumber;
435
- data: z.ZodUnknown;
436
- }, {
437
- type: z.ZodLiteral<"open_reject">;
438
- data: z.ZodObject<{
439
- reason: z.ZodString;
440
- }, "strip", z.ZodTypeAny, {
441
- reason?: string;
442
- }, {
443
- reason?: string;
444
- }>;
445
- }>, "strip", z.ZodTypeAny, {
446
- requestId?: string;
447
- type?: "open_reject";
448
- v?: 1;
449
- ts?: number;
450
- data?: {
451
- reason?: string;
452
- };
453
- }, {
454
- requestId?: string;
455
- type?: "open_reject";
456
- v?: 1;
457
- ts?: number;
458
- data?: {
459
- reason?: string;
460
- };
461
- }>, z.ZodObject<z.objectUtil.extendShape<{
462
- type: z.ZodEnum<["setup_required", "open_ack", "open_reject", "error"]>;
463
- v: z.ZodLiteral<1>;
464
- requestId: z.ZodString;
465
- ts: z.ZodNumber;
466
- data: z.ZodUnknown;
467
- }, {
468
- type: z.ZodEnum<["error"]>;
469
- data: z.ZodObject<{
470
- code: z.ZodString;
471
- msg: z.ZodOptional<z.ZodString>;
472
- }, "strip", z.ZodTypeAny, {
473
- code?: string;
474
- msg?: string;
475
- }, {
476
- code?: string;
477
- msg?: string;
478
- }>;
479
- }>, "strip", z.ZodTypeAny, {
480
- requestId?: string;
481
- type?: "error";
482
- v?: 1;
483
- ts?: number;
484
- data?: {
485
- code?: string;
486
- msg?: string;
487
- };
488
- }, {
489
- requestId?: string;
490
- type?: "error";
491
- v?: 1;
492
- ts?: number;
493
- data?: {
494
- code?: string;
495
- msg?: string;
496
- };
497
- }>]>;
498
- import { z } from "zod";
@@ -1,63 +0,0 @@
1
- export class MessageIngress {
2
- constructor(options?: {});
3
- awaiterMap: AwaiterMap;
4
- dispatcher: Function;
5
- observability: any;
6
- onObserve: any;
7
- messageCounter: number;
8
- _observe(line: any): void;
9
- /**
10
- * Set the CP-3F event dispatcher
11
- * @param {Function} dispatcher - The dispatchEvt function
12
- */
13
- setDispatcher(dispatcher: Function): void;
14
- /**
15
- * Register an awaiter for request/response correlation
16
- * @param {Function} criteria - Function that returns true if message matches
17
- * @param {number} timeoutMs - Timeout in milliseconds
18
- * @returns {Promise} Promise that resolves with the matching message
19
- */
20
- registerAwaiter(criteria: Function, timeoutMs?: number): Promise<any>;
21
- /**
22
- * Cancel awaiters that match a test criteria
23
- * @param {Function} testCriteria - Function that returns true if an awaiter should be cancelled
24
- * @returns {number} Number of awaiters cancelled
25
- */
26
- cancelAwaitersByCriteria(testCriteria: Function): number;
27
- /**
28
- * Main ingress handler - processes all incoming MQTT messages
29
- * @param {Object} message - Raw MQTT message from transport
30
- */
31
- handleMessage(message: any): Promise<{
32
- msgId: number;
33
- awaiterResolved: boolean;
34
- parseStatus: string;
35
- sizeBytes: any;
36
- }>;
37
- /**
38
- * Get statistics about the ingress system
39
- * @returns {Object} Statistics object
40
- */
41
- getStats(): any;
42
- /**
43
- * Clear all awaiters (for cleanup)
44
- */
45
- clear(): void;
46
- /**
47
- * Create a session ID awaiter (backward compatibility)
48
- * @param {string} sessionId - Session ID to match
49
- * @param {string} expectedTopic - Expected topic pattern
50
- * @param {number} timeoutMs - Timeout in milliseconds
51
- * @returns {Promise} Promise that resolves with the matching message
52
- */
53
- awaitSessionId(sessionId: string, expectedTopic: string, timeoutMs?: number): Promise<any>;
54
- /**
55
- * Create a correlation ID awaiter (future use)
56
- * @param {string} correlationId - Correlation ID to match
57
- * @param {string} expectedTopic - Expected topic pattern
58
- * @param {number} timeoutMs - Timeout in milliseconds
59
- * @returns {Promise} Promise that resolves with the matching message
60
- */
61
- awaitCorrelationId(correlationId: string, expectedTopic: string, timeoutMs?: number): Promise<any>;
62
- }
63
- import { AwaiterMap } from './awaiter-map.js';