@naylence/runtime 0.3.5-test.964 → 0.3.5-test.966
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/dist/browser/index.cjs +3 -177
- package/dist/browser/index.mjs +3 -177
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +0 -173
- package/dist/cjs/naylence/fame/connector/broadcast-channel-listener.js +1 -2
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +0 -173
- package/dist/esm/naylence/fame/connector/broadcast-channel-listener.js +1 -2
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +3 -177
- package/dist/node/index.mjs +3 -177
- package/dist/node/node.cjs +3 -177
- package/dist/node/node.mjs +3 -177
- package/dist/types/naylence/fame/connector/broadcast-channel-connector.browser.d.ts +0 -12
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -469,8 +469,7 @@ class BroadcastChannelListener extends transport_listener_js_1.TransportListener
|
|
|
469
469
|
if (!this._routingNode) {
|
|
470
470
|
throw new Error('BroadcastChannelListener requires routing node context');
|
|
471
471
|
}
|
|
472
|
-
const normalized = this._normalizeNodeId(this._routingNode.
|
|
473
|
-
this._normalizeNodeId(this._routingNode.id);
|
|
472
|
+
const normalized = this._normalizeNodeId(this._routingNode.id);
|
|
474
473
|
if (!normalized) {
|
|
475
474
|
throw new Error('BroadcastChannelListener requires routing node with a stable identifier');
|
|
476
475
|
}
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated during build - do not edit manually
|
|
3
|
-
// Generated from package.json version: 0.3.5-test.
|
|
3
|
+
// Generated from package.json version: 0.3.5-test.966
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.VERSION = void 0;
|
|
6
6
|
/**
|
|
7
7
|
* The package version, injected at build time.
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
exports.VERSION = '0.3.5-test.
|
|
10
|
+
exports.VERSION = '0.3.5-test.966';
|
|
@@ -70,11 +70,6 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
|
70
70
|
ensureBroadcastEnvironment();
|
|
71
71
|
super(baseConfig);
|
|
72
72
|
this.listenerRegistered = false;
|
|
73
|
-
this.seenAckKeys = new Map();
|
|
74
|
-
this.seenAckOrder = [];
|
|
75
|
-
this.ackDedupTtlMs = 30000;
|
|
76
|
-
this.ackDedupMaxEntries = 4096;
|
|
77
|
-
this.textDecoder = new TextDecoder();
|
|
78
73
|
this.visibilityChangeListenerRegistered = false;
|
|
79
74
|
this.channelName =
|
|
80
75
|
typeof config.channelName === 'string' && config.channelName.trim().length > 0
|
|
@@ -166,9 +161,6 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
|
166
161
|
connector_id: this.connectorId,
|
|
167
162
|
payload_length: payload.byteLength,
|
|
168
163
|
});
|
|
169
|
-
if (this._shouldSkipDuplicateAck(senderNodeId, payload)) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
164
|
try {
|
|
173
165
|
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
174
166
|
const accepted = this.inbox.tryEnqueue(payload);
|
|
@@ -272,9 +264,6 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
|
272
264
|
}
|
|
273
265
|
async pushToReceive(rawOrEnvelope) {
|
|
274
266
|
const item = this._normalizeInboxItem(rawOrEnvelope);
|
|
275
|
-
if (this._shouldSkipDuplicateAckFromInboxItem(item)) {
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
267
|
try {
|
|
279
268
|
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
280
269
|
const accepted = this.inbox.tryEnqueue(item);
|
|
@@ -374,8 +363,6 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
|
374
363
|
const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
|
|
375
364
|
const shutdownError = new FameTransportClose(closeReason, closeCode);
|
|
376
365
|
this.inbox.drain(shutdownError);
|
|
377
|
-
this.seenAckKeys.clear();
|
|
378
|
-
this.seenAckOrder.length = 0;
|
|
379
366
|
}
|
|
380
367
|
_normalizeInboxItem(rawOrEnvelope) {
|
|
381
368
|
if (rawOrEnvelope instanceof Uint8Array) {
|
|
@@ -452,125 +439,6 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
|
452
439
|
...extra,
|
|
453
440
|
});
|
|
454
441
|
}
|
|
455
|
-
_shouldSkipDuplicateAck(senderId, payload) {
|
|
456
|
-
const dedupKey = this._extractAckDedupKey(payload);
|
|
457
|
-
if (!dedupKey) {
|
|
458
|
-
return false;
|
|
459
|
-
}
|
|
460
|
-
const normalizedSenderId = typeof senderId === 'string' && senderId.length > 0
|
|
461
|
-
? senderId
|
|
462
|
-
: undefined;
|
|
463
|
-
if (normalizedSenderId && normalizedSenderId !== this.localNodeId) {
|
|
464
|
-
logger.debug('broadcast_channel_duplicate_ack_bypass_non_self', {
|
|
465
|
-
channel: this.channelName,
|
|
466
|
-
connector_id: this.connectorId,
|
|
467
|
-
sender_id: normalizedSenderId,
|
|
468
|
-
dedup_key: dedupKey,
|
|
469
|
-
source: 'listener',
|
|
470
|
-
});
|
|
471
|
-
return false;
|
|
472
|
-
}
|
|
473
|
-
logger.debug('broadcast_channel_duplicate_ack_check', {
|
|
474
|
-
channel: this.channelName,
|
|
475
|
-
connector_id: this.connectorId,
|
|
476
|
-
sender_id: normalizedSenderId ?? null,
|
|
477
|
-
dedup_key: dedupKey,
|
|
478
|
-
source: 'listener',
|
|
479
|
-
cache_entries: this.seenAckKeys.size,
|
|
480
|
-
});
|
|
481
|
-
return this._checkDuplicateAck(dedupKey, normalizedSenderId);
|
|
482
|
-
}
|
|
483
|
-
_shouldSkipDuplicateAckFromInboxItem(item) {
|
|
484
|
-
if (item instanceof Uint8Array) {
|
|
485
|
-
return this._shouldSkipDuplicateAck(undefined, item);
|
|
486
|
-
}
|
|
487
|
-
const envelope = this._extractEnvelopeFromInboxItem(item);
|
|
488
|
-
if (!envelope) {
|
|
489
|
-
return false;
|
|
490
|
-
}
|
|
491
|
-
const frame = envelope.frame;
|
|
492
|
-
if (!frame || frame.type !== 'DeliveryAck') {
|
|
493
|
-
return false;
|
|
494
|
-
}
|
|
495
|
-
const refId = typeof frame.refId === 'string' && frame.refId.length > 0
|
|
496
|
-
? frame.refId
|
|
497
|
-
: null;
|
|
498
|
-
const dedupKey = refId ?? envelope.id ?? null;
|
|
499
|
-
if (!dedupKey) {
|
|
500
|
-
return false;
|
|
501
|
-
}
|
|
502
|
-
const senderId = this._extractSenderIdFromInboxItem(item);
|
|
503
|
-
if (senderId && senderId !== this.localNodeId) {
|
|
504
|
-
logger.debug('broadcast_channel_duplicate_ack_bypass_non_self', {
|
|
505
|
-
channel: this.channelName,
|
|
506
|
-
connector_id: this.connectorId,
|
|
507
|
-
sender_id: senderId,
|
|
508
|
-
dedup_key: dedupKey,
|
|
509
|
-
source: 'inbox_item',
|
|
510
|
-
});
|
|
511
|
-
return false;
|
|
512
|
-
}
|
|
513
|
-
logger.debug('broadcast_channel_duplicate_ack_check', {
|
|
514
|
-
channel: this.channelName,
|
|
515
|
-
connector_id: this.connectorId,
|
|
516
|
-
sender_id: senderId ?? null,
|
|
517
|
-
dedup_key: dedupKey,
|
|
518
|
-
source: 'inbox_item',
|
|
519
|
-
cache_entries: this.seenAckKeys.size,
|
|
520
|
-
});
|
|
521
|
-
return this._checkDuplicateAck(dedupKey, senderId);
|
|
522
|
-
}
|
|
523
|
-
_checkDuplicateAck(dedupKey, senderId) {
|
|
524
|
-
const now = Date.now();
|
|
525
|
-
const lastSeen = this.seenAckKeys.get(dedupKey);
|
|
526
|
-
if (lastSeen && now - lastSeen < this.ackDedupTtlMs) {
|
|
527
|
-
logger.debug('broadcast_channel_duplicate_ack_suppressed', {
|
|
528
|
-
channel: this.channelName,
|
|
529
|
-
connector_id: this.connectorId,
|
|
530
|
-
sender_id: senderId ?? null,
|
|
531
|
-
dedup_key: dedupKey,
|
|
532
|
-
age_ms: now - lastSeen,
|
|
533
|
-
ttl_ms: this.ackDedupTtlMs,
|
|
534
|
-
cache_entries: this.seenAckKeys.size,
|
|
535
|
-
});
|
|
536
|
-
return true;
|
|
537
|
-
}
|
|
538
|
-
this.seenAckKeys.set(dedupKey, now);
|
|
539
|
-
this.seenAckOrder.push(dedupKey);
|
|
540
|
-
logger.debug('broadcast_channel_duplicate_ack_recorded', {
|
|
541
|
-
channel: this.channelName,
|
|
542
|
-
connector_id: this.connectorId,
|
|
543
|
-
sender_id: senderId ?? null,
|
|
544
|
-
dedup_key: dedupKey,
|
|
545
|
-
cache_entries: this.seenAckKeys.size,
|
|
546
|
-
});
|
|
547
|
-
this._trimSeenAcks(now);
|
|
548
|
-
return false;
|
|
549
|
-
}
|
|
550
|
-
_extractEnvelopeFromInboxItem(item) {
|
|
551
|
-
if (!item || typeof item !== 'object') {
|
|
552
|
-
return null;
|
|
553
|
-
}
|
|
554
|
-
if ('envelope' in item) {
|
|
555
|
-
return item.envelope;
|
|
556
|
-
}
|
|
557
|
-
if ('frame' in item) {
|
|
558
|
-
return item;
|
|
559
|
-
}
|
|
560
|
-
return null;
|
|
561
|
-
}
|
|
562
|
-
_extractSenderIdFromInboxItem(item) {
|
|
563
|
-
if (!item || typeof item !== 'object') {
|
|
564
|
-
return undefined;
|
|
565
|
-
}
|
|
566
|
-
if ('context' in item) {
|
|
567
|
-
const context = item.context;
|
|
568
|
-
if (context && typeof context.fromSystemId === 'string') {
|
|
569
|
-
return context.fromSystemId;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
return undefined;
|
|
573
|
-
}
|
|
574
442
|
/**
|
|
575
443
|
* Override start() to check initial visibility state
|
|
576
444
|
*/
|
|
@@ -624,45 +492,4 @@ export class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
|
624
492
|
target_mode: 'wildcard',
|
|
625
493
|
});
|
|
626
494
|
}
|
|
627
|
-
_trimSeenAcks(now) {
|
|
628
|
-
while (this.seenAckOrder.length > 0) {
|
|
629
|
-
const candidate = this.seenAckOrder[0];
|
|
630
|
-
const timestamp = this.seenAckKeys.get(candidate);
|
|
631
|
-
if (timestamp === undefined) {
|
|
632
|
-
this.seenAckOrder.shift();
|
|
633
|
-
continue;
|
|
634
|
-
}
|
|
635
|
-
if (this.seenAckKeys.size > this.ackDedupMaxEntries ||
|
|
636
|
-
now - timestamp > this.ackDedupTtlMs) {
|
|
637
|
-
this.seenAckKeys.delete(candidate);
|
|
638
|
-
this.seenAckOrder.shift();
|
|
639
|
-
continue;
|
|
640
|
-
}
|
|
641
|
-
break;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
_extractAckDedupKey(payload) {
|
|
645
|
-
try {
|
|
646
|
-
const decoded = this.textDecoder.decode(payload);
|
|
647
|
-
const parsed = JSON.parse(decoded);
|
|
648
|
-
const envelopeId = typeof parsed?.id === 'string' ? parsed.id : null;
|
|
649
|
-
const frameType = parsed?.frame?.type;
|
|
650
|
-
if (typeof frameType !== 'string' || frameType !== 'DeliveryAck') {
|
|
651
|
-
return null;
|
|
652
|
-
}
|
|
653
|
-
const refId = parsed.frame?.refId;
|
|
654
|
-
if (typeof refId === 'string' && refId.length > 0) {
|
|
655
|
-
return refId;
|
|
656
|
-
}
|
|
657
|
-
return envelopeId;
|
|
658
|
-
}
|
|
659
|
-
catch (error) {
|
|
660
|
-
logger.debug('broadcast_channel_ack_dedup_parse_failed', {
|
|
661
|
-
channel: this.channelName,
|
|
662
|
-
connector_id: this.connectorId,
|
|
663
|
-
error: error instanceof Error ? error.message : String(error),
|
|
664
|
-
});
|
|
665
|
-
return null;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
495
|
}
|
|
@@ -465,8 +465,7 @@ export class BroadcastChannelListener extends TransportListener {
|
|
|
465
465
|
if (!this._routingNode) {
|
|
466
466
|
throw new Error('BroadcastChannelListener requires routing node context');
|
|
467
467
|
}
|
|
468
|
-
const normalized = this._normalizeNodeId(this._routingNode.
|
|
469
|
-
this._normalizeNodeId(this._routingNode.id);
|
|
468
|
+
const normalized = this._normalizeNodeId(this._routingNode.id);
|
|
470
469
|
if (!normalized) {
|
|
471
470
|
throw new Error('BroadcastChannelListener requires routing node with a stable identifier');
|
|
472
471
|
}
|
package/dist/esm/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated during build - do not edit manually
|
|
2
|
-
// Generated from package.json version: 0.3.5-test.
|
|
2
|
+
// Generated from package.json version: 0.3.5-test.966
|
|
3
3
|
/**
|
|
4
4
|
* The package version, injected at build time.
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export const VERSION = '0.3.5-test.
|
|
7
|
+
export const VERSION = '0.3.5-test.966';
|
package/dist/node/index.cjs
CHANGED
|
@@ -14,12 +14,12 @@ var fastify = require('fastify');
|
|
|
14
14
|
var websocketPlugin = require('@fastify/websocket');
|
|
15
15
|
|
|
16
16
|
// This file is auto-generated during build - do not edit manually
|
|
17
|
-
// Generated from package.json version: 0.3.5-test.
|
|
17
|
+
// Generated from package.json version: 0.3.5-test.966
|
|
18
18
|
/**
|
|
19
19
|
* The package version, injected at build time.
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
|
-
const VERSION = '0.3.5-test.
|
|
22
|
+
const VERSION = '0.3.5-test.966';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -9886,11 +9886,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9886
9886
|
ensureBroadcastEnvironment();
|
|
9887
9887
|
super(baseConfig);
|
|
9888
9888
|
this.listenerRegistered = false;
|
|
9889
|
-
this.seenAckKeys = new Map();
|
|
9890
|
-
this.seenAckOrder = [];
|
|
9891
|
-
this.ackDedupTtlMs = 30000;
|
|
9892
|
-
this.ackDedupMaxEntries = 4096;
|
|
9893
|
-
this.textDecoder = new TextDecoder();
|
|
9894
9889
|
this.visibilityChangeListenerRegistered = false;
|
|
9895
9890
|
this.channelName =
|
|
9896
9891
|
typeof config.channelName === 'string' && config.channelName.trim().length > 0
|
|
@@ -9982,9 +9977,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9982
9977
|
connector_id: this.connectorId,
|
|
9983
9978
|
payload_length: payload.byteLength,
|
|
9984
9979
|
});
|
|
9985
|
-
if (this._shouldSkipDuplicateAck(senderNodeId, payload)) {
|
|
9986
|
-
return;
|
|
9987
|
-
}
|
|
9988
9980
|
try {
|
|
9989
9981
|
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
9990
9982
|
const accepted = this.inbox.tryEnqueue(payload);
|
|
@@ -10088,9 +10080,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10088
10080
|
}
|
|
10089
10081
|
async pushToReceive(rawOrEnvelope) {
|
|
10090
10082
|
const item = this._normalizeInboxItem(rawOrEnvelope);
|
|
10091
|
-
if (this._shouldSkipDuplicateAckFromInboxItem(item)) {
|
|
10092
|
-
return;
|
|
10093
|
-
}
|
|
10094
10083
|
try {
|
|
10095
10084
|
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
10096
10085
|
const accepted = this.inbox.tryEnqueue(item);
|
|
@@ -10190,8 +10179,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10190
10179
|
const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
|
|
10191
10180
|
const shutdownError = new FameTransportClose(closeReason, closeCode);
|
|
10192
10181
|
this.inbox.drain(shutdownError);
|
|
10193
|
-
this.seenAckKeys.clear();
|
|
10194
|
-
this.seenAckOrder.length = 0;
|
|
10195
10182
|
}
|
|
10196
10183
|
_normalizeInboxItem(rawOrEnvelope) {
|
|
10197
10184
|
if (rawOrEnvelope instanceof Uint8Array) {
|
|
@@ -10268,125 +10255,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10268
10255
|
...extra,
|
|
10269
10256
|
});
|
|
10270
10257
|
}
|
|
10271
|
-
_shouldSkipDuplicateAck(senderId, payload) {
|
|
10272
|
-
const dedupKey = this._extractAckDedupKey(payload);
|
|
10273
|
-
if (!dedupKey) {
|
|
10274
|
-
return false;
|
|
10275
|
-
}
|
|
10276
|
-
const normalizedSenderId = typeof senderId === 'string' && senderId.length > 0
|
|
10277
|
-
? senderId
|
|
10278
|
-
: undefined;
|
|
10279
|
-
if (normalizedSenderId && normalizedSenderId !== this.localNodeId) {
|
|
10280
|
-
logger$_.debug('broadcast_channel_duplicate_ack_bypass_non_self', {
|
|
10281
|
-
channel: this.channelName,
|
|
10282
|
-
connector_id: this.connectorId,
|
|
10283
|
-
sender_id: normalizedSenderId,
|
|
10284
|
-
dedup_key: dedupKey,
|
|
10285
|
-
source: 'listener',
|
|
10286
|
-
});
|
|
10287
|
-
return false;
|
|
10288
|
-
}
|
|
10289
|
-
logger$_.debug('broadcast_channel_duplicate_ack_check', {
|
|
10290
|
-
channel: this.channelName,
|
|
10291
|
-
connector_id: this.connectorId,
|
|
10292
|
-
sender_id: normalizedSenderId ?? null,
|
|
10293
|
-
dedup_key: dedupKey,
|
|
10294
|
-
source: 'listener',
|
|
10295
|
-
cache_entries: this.seenAckKeys.size,
|
|
10296
|
-
});
|
|
10297
|
-
return this._checkDuplicateAck(dedupKey, normalizedSenderId);
|
|
10298
|
-
}
|
|
10299
|
-
_shouldSkipDuplicateAckFromInboxItem(item) {
|
|
10300
|
-
if (item instanceof Uint8Array) {
|
|
10301
|
-
return this._shouldSkipDuplicateAck(undefined, item);
|
|
10302
|
-
}
|
|
10303
|
-
const envelope = this._extractEnvelopeFromInboxItem(item);
|
|
10304
|
-
if (!envelope) {
|
|
10305
|
-
return false;
|
|
10306
|
-
}
|
|
10307
|
-
const frame = envelope.frame;
|
|
10308
|
-
if (!frame || frame.type !== 'DeliveryAck') {
|
|
10309
|
-
return false;
|
|
10310
|
-
}
|
|
10311
|
-
const refId = typeof frame.refId === 'string' && frame.refId.length > 0
|
|
10312
|
-
? frame.refId
|
|
10313
|
-
: null;
|
|
10314
|
-
const dedupKey = refId ?? envelope.id ?? null;
|
|
10315
|
-
if (!dedupKey) {
|
|
10316
|
-
return false;
|
|
10317
|
-
}
|
|
10318
|
-
const senderId = this._extractSenderIdFromInboxItem(item);
|
|
10319
|
-
if (senderId && senderId !== this.localNodeId) {
|
|
10320
|
-
logger$_.debug('broadcast_channel_duplicate_ack_bypass_non_self', {
|
|
10321
|
-
channel: this.channelName,
|
|
10322
|
-
connector_id: this.connectorId,
|
|
10323
|
-
sender_id: senderId,
|
|
10324
|
-
dedup_key: dedupKey,
|
|
10325
|
-
source: 'inbox_item',
|
|
10326
|
-
});
|
|
10327
|
-
return false;
|
|
10328
|
-
}
|
|
10329
|
-
logger$_.debug('broadcast_channel_duplicate_ack_check', {
|
|
10330
|
-
channel: this.channelName,
|
|
10331
|
-
connector_id: this.connectorId,
|
|
10332
|
-
sender_id: senderId ?? null,
|
|
10333
|
-
dedup_key: dedupKey,
|
|
10334
|
-
source: 'inbox_item',
|
|
10335
|
-
cache_entries: this.seenAckKeys.size,
|
|
10336
|
-
});
|
|
10337
|
-
return this._checkDuplicateAck(dedupKey, senderId);
|
|
10338
|
-
}
|
|
10339
|
-
_checkDuplicateAck(dedupKey, senderId) {
|
|
10340
|
-
const now = Date.now();
|
|
10341
|
-
const lastSeen = this.seenAckKeys.get(dedupKey);
|
|
10342
|
-
if (lastSeen && now - lastSeen < this.ackDedupTtlMs) {
|
|
10343
|
-
logger$_.debug('broadcast_channel_duplicate_ack_suppressed', {
|
|
10344
|
-
channel: this.channelName,
|
|
10345
|
-
connector_id: this.connectorId,
|
|
10346
|
-
sender_id: senderId ?? null,
|
|
10347
|
-
dedup_key: dedupKey,
|
|
10348
|
-
age_ms: now - lastSeen,
|
|
10349
|
-
ttl_ms: this.ackDedupTtlMs,
|
|
10350
|
-
cache_entries: this.seenAckKeys.size,
|
|
10351
|
-
});
|
|
10352
|
-
return true;
|
|
10353
|
-
}
|
|
10354
|
-
this.seenAckKeys.set(dedupKey, now);
|
|
10355
|
-
this.seenAckOrder.push(dedupKey);
|
|
10356
|
-
logger$_.debug('broadcast_channel_duplicate_ack_recorded', {
|
|
10357
|
-
channel: this.channelName,
|
|
10358
|
-
connector_id: this.connectorId,
|
|
10359
|
-
sender_id: senderId ?? null,
|
|
10360
|
-
dedup_key: dedupKey,
|
|
10361
|
-
cache_entries: this.seenAckKeys.size,
|
|
10362
|
-
});
|
|
10363
|
-
this._trimSeenAcks(now);
|
|
10364
|
-
return false;
|
|
10365
|
-
}
|
|
10366
|
-
_extractEnvelopeFromInboxItem(item) {
|
|
10367
|
-
if (!item || typeof item !== 'object') {
|
|
10368
|
-
return null;
|
|
10369
|
-
}
|
|
10370
|
-
if ('envelope' in item) {
|
|
10371
|
-
return item.envelope;
|
|
10372
|
-
}
|
|
10373
|
-
if ('frame' in item) {
|
|
10374
|
-
return item;
|
|
10375
|
-
}
|
|
10376
|
-
return null;
|
|
10377
|
-
}
|
|
10378
|
-
_extractSenderIdFromInboxItem(item) {
|
|
10379
|
-
if (!item || typeof item !== 'object') {
|
|
10380
|
-
return undefined;
|
|
10381
|
-
}
|
|
10382
|
-
if ('context' in item) {
|
|
10383
|
-
const context = item.context;
|
|
10384
|
-
if (context && typeof context.fromSystemId === 'string') {
|
|
10385
|
-
return context.fromSystemId;
|
|
10386
|
-
}
|
|
10387
|
-
}
|
|
10388
|
-
return undefined;
|
|
10389
|
-
}
|
|
10390
10258
|
/**
|
|
10391
10259
|
* Override start() to check initial visibility state
|
|
10392
10260
|
*/
|
|
@@ -10440,47 +10308,6 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10440
10308
|
target_mode: 'wildcard',
|
|
10441
10309
|
});
|
|
10442
10310
|
}
|
|
10443
|
-
_trimSeenAcks(now) {
|
|
10444
|
-
while (this.seenAckOrder.length > 0) {
|
|
10445
|
-
const candidate = this.seenAckOrder[0];
|
|
10446
|
-
const timestamp = this.seenAckKeys.get(candidate);
|
|
10447
|
-
if (timestamp === undefined) {
|
|
10448
|
-
this.seenAckOrder.shift();
|
|
10449
|
-
continue;
|
|
10450
|
-
}
|
|
10451
|
-
if (this.seenAckKeys.size > this.ackDedupMaxEntries ||
|
|
10452
|
-
now - timestamp > this.ackDedupTtlMs) {
|
|
10453
|
-
this.seenAckKeys.delete(candidate);
|
|
10454
|
-
this.seenAckOrder.shift();
|
|
10455
|
-
continue;
|
|
10456
|
-
}
|
|
10457
|
-
break;
|
|
10458
|
-
}
|
|
10459
|
-
}
|
|
10460
|
-
_extractAckDedupKey(payload) {
|
|
10461
|
-
try {
|
|
10462
|
-
const decoded = this.textDecoder.decode(payload);
|
|
10463
|
-
const parsed = JSON.parse(decoded);
|
|
10464
|
-
const envelopeId = typeof parsed?.id === 'string' ? parsed.id : null;
|
|
10465
|
-
const frameType = parsed?.frame?.type;
|
|
10466
|
-
if (typeof frameType !== 'string' || frameType !== 'DeliveryAck') {
|
|
10467
|
-
return null;
|
|
10468
|
-
}
|
|
10469
|
-
const refId = parsed.frame?.refId;
|
|
10470
|
-
if (typeof refId === 'string' && refId.length > 0) {
|
|
10471
|
-
return refId;
|
|
10472
|
-
}
|
|
10473
|
-
return envelopeId;
|
|
10474
|
-
}
|
|
10475
|
-
catch (error) {
|
|
10476
|
-
logger$_.debug('broadcast_channel_ack_dedup_parse_failed', {
|
|
10477
|
-
channel: this.channelName,
|
|
10478
|
-
connector_id: this.connectorId,
|
|
10479
|
-
error: error instanceof Error ? error.message : String(error),
|
|
10480
|
-
});
|
|
10481
|
-
return null;
|
|
10482
|
-
}
|
|
10483
|
-
}
|
|
10484
10311
|
};
|
|
10485
10312
|
|
|
10486
10313
|
const ERROR_MESSAGE = 'BroadcastChannelConnector is browser-only and requires BroadcastChannel support';
|
|
@@ -36680,8 +36507,7 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
36680
36507
|
if (!this._routingNode) {
|
|
36681
36508
|
throw new Error('BroadcastChannelListener requires routing node context');
|
|
36682
36509
|
}
|
|
36683
|
-
const normalized = this._normalizeNodeId(this._routingNode.
|
|
36684
|
-
this._normalizeNodeId(this._routingNode.id);
|
|
36510
|
+
const normalized = this._normalizeNodeId(this._routingNode.id);
|
|
36685
36511
|
if (!normalized) {
|
|
36686
36512
|
throw new Error('BroadcastChannelListener requires routing node with a stable identifier');
|
|
36687
36513
|
}
|