@naylence/runtime 0.3.6-test.104 → 0.3.6-test.108
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 +20 -65
- package/dist/browser/index.mjs +20 -65
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector-factory.js +4 -0
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +1 -0
- package/dist/cjs/naylence/fame/connector/broadcast-channel-listener.js +9 -1
- package/dist/cjs/naylence/fame/delivery/default-delivery-tracker.js +4 -62
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector-factory.js +4 -0
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +1 -0
- package/dist/esm/naylence/fame/connector/broadcast-channel-listener.js +9 -1
- package/dist/esm/naylence/fame/delivery/default-delivery-tracker.js +4 -62
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +20 -65
- package/dist/node/index.mjs +20 -65
- package/dist/node/node.cjs +20 -65
- package/dist/node/node.mjs +20 -65
- package/dist/types/naylence/fame/connector/broadcast-channel-connector-factory.d.ts +1 -0
- package/dist/types/naylence/fame/delivery/default-delivery-tracker.d.ts +0 -6
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
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.6-test.
|
|
2
|
+
// Generated from package.json version: 0.3.6-test.108
|
|
3
3
|
/**
|
|
4
4
|
* The package version, injected at build time.
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export const VERSION = '0.3.6-test.
|
|
7
|
+
export const VERSION = '0.3.6-test.108';
|
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.6-test.
|
|
17
|
+
// Generated from package.json version: 0.3.6-test.108
|
|
18
18
|
/**
|
|
19
19
|
* The package version, injected at build time.
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
|
-
const VERSION = '0.3.6-test.
|
|
22
|
+
const VERSION = '0.3.6-test.108';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -7091,9 +7091,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7091
7091
|
this.ackDoneSince = new Map();
|
|
7092
7092
|
this.replyDoneSince = new Map();
|
|
7093
7093
|
this.pendingAckDispatches = new Set();
|
|
7094
|
-
this.recentlyHandled = new Map();
|
|
7095
|
-
this.recentlyHandledOrder = [];
|
|
7096
|
-
this.recentlyHandledTtlMs = 60000;
|
|
7097
7094
|
this.isPreparingToStop = false;
|
|
7098
7095
|
this.shutdownRequestedAtMs = null;
|
|
7099
7096
|
this.shutdownRetryGraceMs = 1000;
|
|
@@ -7315,22 +7312,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7315
7312
|
}
|
|
7316
7313
|
}
|
|
7317
7314
|
else {
|
|
7318
|
-
const wasRecentlyHandled = await this.lock.runExclusive(async () => this.wasRecentlyHandled(envelope.id));
|
|
7319
|
-
if (wasRecentlyHandled) {
|
|
7320
|
-
logger$12.debug('tracker_duplicate_envelope_recently_handled', {
|
|
7321
|
-
envp_id: envelope.id,
|
|
7322
|
-
});
|
|
7323
|
-
return new TrackedEnvelope({
|
|
7324
|
-
timeoutAtMs: 0,
|
|
7325
|
-
overallTimeoutAtMs: 0,
|
|
7326
|
-
expectedResponseType: envelope.rtype ?? core.FameResponseType.NONE,
|
|
7327
|
-
createdAtMs: Date.now(),
|
|
7328
|
-
status: EnvelopeStatus.HANDLED,
|
|
7329
|
-
mailboxType: MailboxType.INBOX,
|
|
7330
|
-
originalEnvelope: envelope,
|
|
7331
|
-
serviceName: inboxName,
|
|
7332
|
-
});
|
|
7333
|
-
}
|
|
7334
7315
|
tracked = new TrackedEnvelope({
|
|
7335
7316
|
timeoutAtMs: 0,
|
|
7336
7317
|
overallTimeoutAtMs: 0,
|
|
@@ -7352,12 +7333,8 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7352
7333
|
async onEnvelopeHandled(envelope) {
|
|
7353
7334
|
const inbox = this.ensureInbox();
|
|
7354
7335
|
envelope.status = EnvelopeStatus.HANDLED;
|
|
7336
|
+
// Delete the envelope from inbox to prevent growth
|
|
7355
7337
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
7356
|
-
await this.lock.runExclusive(async () => {
|
|
7357
|
-
this.markRecentlyHandled(envelope.originalEnvelope.id);
|
|
7358
|
-
});
|
|
7359
|
-
// Preserve handled envelope to prevent duplicate redelivery during shutdown drains.
|
|
7360
|
-
// await inbox.set(envelope.originalEnvelope.id, envelope);
|
|
7361
7338
|
}
|
|
7362
7339
|
async onEnvelopeHandleFailed(inboxName, envelope, context, error, isFinalFailure = false) {
|
|
7363
7340
|
const inbox = this.ensureInbox();
|
|
@@ -7572,9 +7549,9 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7572
7549
|
});
|
|
7573
7550
|
await this.markDoneSince(this.replyFutures, trackedEnvelope.originalEnvelope.id, this.replyDoneSince);
|
|
7574
7551
|
await this.markDoneSince(this.ackFutures, trackedEnvelope.originalEnvelope.id, this.ackDoneSince);
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7552
|
+
// Note: ACK is already sent in onCorrelatedMessage (lines 655-657)
|
|
7553
|
+
// when the reply envelope is first delivered. No need to send it again here.
|
|
7554
|
+
// Removing this duplicate sendAck call fixes the duplicate DeliveryAck bug.
|
|
7578
7555
|
for (const handler of this.eventHandlers) {
|
|
7579
7556
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
7580
7557
|
}
|
|
@@ -7724,8 +7701,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7724
7701
|
}
|
|
7725
7702
|
this.streamDone.clear();
|
|
7726
7703
|
this.correlationToEnvelope.clear();
|
|
7727
|
-
this.recentlyHandled.clear();
|
|
7728
|
-
this.recentlyHandledOrder.length = 0;
|
|
7729
7704
|
return values;
|
|
7730
7705
|
});
|
|
7731
7706
|
for (const timer of timers) {
|
|
@@ -8307,39 +8282,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8307
8282
|
this.pendingAckDispatches.delete(ackDispatch);
|
|
8308
8283
|
}
|
|
8309
8284
|
}
|
|
8310
|
-
markRecentlyHandled(envelopeId) {
|
|
8311
|
-
const now = Date.now();
|
|
8312
|
-
this.recentlyHandled.set(envelopeId, now);
|
|
8313
|
-
this.recentlyHandledOrder.push(envelopeId);
|
|
8314
|
-
this.trimRecentlyHandled(now);
|
|
8315
|
-
}
|
|
8316
|
-
wasRecentlyHandled(envelopeId) {
|
|
8317
|
-
const now = Date.now();
|
|
8318
|
-
const timestamp = this.recentlyHandled.get(envelopeId);
|
|
8319
|
-
if (timestamp === undefined) {
|
|
8320
|
-
return false;
|
|
8321
|
-
}
|
|
8322
|
-
if (now - timestamp > this.recentlyHandledTtlMs) {
|
|
8323
|
-
this.recentlyHandled.delete(envelopeId);
|
|
8324
|
-
return false;
|
|
8325
|
-
}
|
|
8326
|
-
return true;
|
|
8327
|
-
}
|
|
8328
|
-
trimRecentlyHandled(now) {
|
|
8329
|
-
while (this.recentlyHandledOrder.length > 0) {
|
|
8330
|
-
const candidate = this.recentlyHandledOrder[0];
|
|
8331
|
-
const timestamp = this.recentlyHandled.get(candidate);
|
|
8332
|
-
if (timestamp === undefined) {
|
|
8333
|
-
this.recentlyHandledOrder.shift();
|
|
8334
|
-
continue;
|
|
8335
|
-
}
|
|
8336
|
-
if (now - timestamp <= this.recentlyHandledTtlMs) {
|
|
8337
|
-
break;
|
|
8338
|
-
}
|
|
8339
|
-
this.recentlyHandled.delete(candidate);
|
|
8340
|
-
this.recentlyHandledOrder.shift();
|
|
8341
|
-
}
|
|
8342
|
-
}
|
|
8343
8285
|
getShutdownRetryDeferDelay(nowMs) {
|
|
8344
8286
|
if (!this.isPreparingToStop || this.shutdownRequestedAtMs === null) {
|
|
8345
8287
|
return null;
|
|
@@ -9912,6 +9854,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9912
9854
|
local_node_id: this.localNodeId,
|
|
9913
9855
|
target_node_id: this.targetNodeId ?? null,
|
|
9914
9856
|
inbox_capacity: preferredCapacity,
|
|
9857
|
+
passive: config.passive ?? false,
|
|
9915
9858
|
timestamp: new Date().toISOString(),
|
|
9916
9859
|
});
|
|
9917
9860
|
this.onMsg = (event) => {
|
|
@@ -28947,6 +28890,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
28947
28890
|
inboxCapacity,
|
|
28948
28891
|
localNodeId,
|
|
28949
28892
|
initialTargetNodeId: resolvedTarget,
|
|
28893
|
+
passive: normalized.passive,
|
|
28950
28894
|
};
|
|
28951
28895
|
const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
|
|
28952
28896
|
if (options.authorization) {
|
|
@@ -28985,6 +28929,9 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
28985
28929
|
if (normalizedLocalNodeId) {
|
|
28986
28930
|
normalized.localNodeId = normalizedLocalNodeId;
|
|
28987
28931
|
}
|
|
28932
|
+
if (typeof candidate.passive === 'boolean') {
|
|
28933
|
+
normalized.passive = candidate.passive;
|
|
28934
|
+
}
|
|
28988
28935
|
if (typeof candidate.flowControl === 'boolean') {
|
|
28989
28936
|
normalized.flowControl = candidate.flowControl;
|
|
28990
28937
|
}
|
|
@@ -36779,11 +36726,19 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
36779
36726
|
? Math.floor(initialWindowCandidate)
|
|
36780
36727
|
: undefined;
|
|
36781
36728
|
const initialTargetNodeId = this._normalizeNodeId(targetCandidate) ?? targetSystemId;
|
|
36729
|
+
const passive = typeof passiveCandidate === 'boolean' ? passiveCandidate : true;
|
|
36730
|
+
logger$a.debug('broadcast_channel_listener_building_connector_config', {
|
|
36731
|
+
system_id: systemId,
|
|
36732
|
+
channel_name: channelName,
|
|
36733
|
+
passive,
|
|
36734
|
+
has_base_config: !!baseConfig,
|
|
36735
|
+
passive_candidate: passiveCandidate,
|
|
36736
|
+
});
|
|
36782
36737
|
return {
|
|
36783
36738
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
|
|
36784
36739
|
channelName,
|
|
36785
36740
|
inboxCapacity,
|
|
36786
|
-
passive
|
|
36741
|
+
passive,
|
|
36787
36742
|
initialWindow,
|
|
36788
36743
|
localNodeId,
|
|
36789
36744
|
initialTargetNodeId,
|
package/dist/node/index.mjs
CHANGED
|
@@ -13,12 +13,12 @@ import fastify from 'fastify';
|
|
|
13
13
|
import websocketPlugin from '@fastify/websocket';
|
|
14
14
|
|
|
15
15
|
// This file is auto-generated during build - do not edit manually
|
|
16
|
-
// Generated from package.json version: 0.3.6-test.
|
|
16
|
+
// Generated from package.json version: 0.3.6-test.108
|
|
17
17
|
/**
|
|
18
18
|
* The package version, injected at build time.
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
|
-
const VERSION = '0.3.6-test.
|
|
21
|
+
const VERSION = '0.3.6-test.108';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -7090,9 +7090,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7090
7090
|
this.ackDoneSince = new Map();
|
|
7091
7091
|
this.replyDoneSince = new Map();
|
|
7092
7092
|
this.pendingAckDispatches = new Set();
|
|
7093
|
-
this.recentlyHandled = new Map();
|
|
7094
|
-
this.recentlyHandledOrder = [];
|
|
7095
|
-
this.recentlyHandledTtlMs = 60000;
|
|
7096
7093
|
this.isPreparingToStop = false;
|
|
7097
7094
|
this.shutdownRequestedAtMs = null;
|
|
7098
7095
|
this.shutdownRetryGraceMs = 1000;
|
|
@@ -7314,22 +7311,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7314
7311
|
}
|
|
7315
7312
|
}
|
|
7316
7313
|
else {
|
|
7317
|
-
const wasRecentlyHandled = await this.lock.runExclusive(async () => this.wasRecentlyHandled(envelope.id));
|
|
7318
|
-
if (wasRecentlyHandled) {
|
|
7319
|
-
logger$12.debug('tracker_duplicate_envelope_recently_handled', {
|
|
7320
|
-
envp_id: envelope.id,
|
|
7321
|
-
});
|
|
7322
|
-
return new TrackedEnvelope({
|
|
7323
|
-
timeoutAtMs: 0,
|
|
7324
|
-
overallTimeoutAtMs: 0,
|
|
7325
|
-
expectedResponseType: envelope.rtype ?? FameResponseType.NONE,
|
|
7326
|
-
createdAtMs: Date.now(),
|
|
7327
|
-
status: EnvelopeStatus.HANDLED,
|
|
7328
|
-
mailboxType: MailboxType.INBOX,
|
|
7329
|
-
originalEnvelope: envelope,
|
|
7330
|
-
serviceName: inboxName,
|
|
7331
|
-
});
|
|
7332
|
-
}
|
|
7333
7314
|
tracked = new TrackedEnvelope({
|
|
7334
7315
|
timeoutAtMs: 0,
|
|
7335
7316
|
overallTimeoutAtMs: 0,
|
|
@@ -7351,12 +7332,8 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7351
7332
|
async onEnvelopeHandled(envelope) {
|
|
7352
7333
|
const inbox = this.ensureInbox();
|
|
7353
7334
|
envelope.status = EnvelopeStatus.HANDLED;
|
|
7335
|
+
// Delete the envelope from inbox to prevent growth
|
|
7354
7336
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
7355
|
-
await this.lock.runExclusive(async () => {
|
|
7356
|
-
this.markRecentlyHandled(envelope.originalEnvelope.id);
|
|
7357
|
-
});
|
|
7358
|
-
// Preserve handled envelope to prevent duplicate redelivery during shutdown drains.
|
|
7359
|
-
// await inbox.set(envelope.originalEnvelope.id, envelope);
|
|
7360
7337
|
}
|
|
7361
7338
|
async onEnvelopeHandleFailed(inboxName, envelope, context, error, isFinalFailure = false) {
|
|
7362
7339
|
const inbox = this.ensureInbox();
|
|
@@ -7571,9 +7548,9 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7571
7548
|
});
|
|
7572
7549
|
await this.markDoneSince(this.replyFutures, trackedEnvelope.originalEnvelope.id, this.replyDoneSince);
|
|
7573
7550
|
await this.markDoneSince(this.ackFutures, trackedEnvelope.originalEnvelope.id, this.ackDoneSince);
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7551
|
+
// Note: ACK is already sent in onCorrelatedMessage (lines 655-657)
|
|
7552
|
+
// when the reply envelope is first delivered. No need to send it again here.
|
|
7553
|
+
// Removing this duplicate sendAck call fixes the duplicate DeliveryAck bug.
|
|
7577
7554
|
for (const handler of this.eventHandlers) {
|
|
7578
7555
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
7579
7556
|
}
|
|
@@ -7723,8 +7700,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
7723
7700
|
}
|
|
7724
7701
|
this.streamDone.clear();
|
|
7725
7702
|
this.correlationToEnvelope.clear();
|
|
7726
|
-
this.recentlyHandled.clear();
|
|
7727
|
-
this.recentlyHandledOrder.length = 0;
|
|
7728
7703
|
return values;
|
|
7729
7704
|
});
|
|
7730
7705
|
for (const timer of timers) {
|
|
@@ -8306,39 +8281,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
8306
8281
|
this.pendingAckDispatches.delete(ackDispatch);
|
|
8307
8282
|
}
|
|
8308
8283
|
}
|
|
8309
|
-
markRecentlyHandled(envelopeId) {
|
|
8310
|
-
const now = Date.now();
|
|
8311
|
-
this.recentlyHandled.set(envelopeId, now);
|
|
8312
|
-
this.recentlyHandledOrder.push(envelopeId);
|
|
8313
|
-
this.trimRecentlyHandled(now);
|
|
8314
|
-
}
|
|
8315
|
-
wasRecentlyHandled(envelopeId) {
|
|
8316
|
-
const now = Date.now();
|
|
8317
|
-
const timestamp = this.recentlyHandled.get(envelopeId);
|
|
8318
|
-
if (timestamp === undefined) {
|
|
8319
|
-
return false;
|
|
8320
|
-
}
|
|
8321
|
-
if (now - timestamp > this.recentlyHandledTtlMs) {
|
|
8322
|
-
this.recentlyHandled.delete(envelopeId);
|
|
8323
|
-
return false;
|
|
8324
|
-
}
|
|
8325
|
-
return true;
|
|
8326
|
-
}
|
|
8327
|
-
trimRecentlyHandled(now) {
|
|
8328
|
-
while (this.recentlyHandledOrder.length > 0) {
|
|
8329
|
-
const candidate = this.recentlyHandledOrder[0];
|
|
8330
|
-
const timestamp = this.recentlyHandled.get(candidate);
|
|
8331
|
-
if (timestamp === undefined) {
|
|
8332
|
-
this.recentlyHandledOrder.shift();
|
|
8333
|
-
continue;
|
|
8334
|
-
}
|
|
8335
|
-
if (now - timestamp <= this.recentlyHandledTtlMs) {
|
|
8336
|
-
break;
|
|
8337
|
-
}
|
|
8338
|
-
this.recentlyHandled.delete(candidate);
|
|
8339
|
-
this.recentlyHandledOrder.shift();
|
|
8340
|
-
}
|
|
8341
|
-
}
|
|
8342
8284
|
getShutdownRetryDeferDelay(nowMs) {
|
|
8343
8285
|
if (!this.isPreparingToStop || this.shutdownRequestedAtMs === null) {
|
|
8344
8286
|
return null;
|
|
@@ -9911,6 +9853,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9911
9853
|
local_node_id: this.localNodeId,
|
|
9912
9854
|
target_node_id: this.targetNodeId ?? null,
|
|
9913
9855
|
inbox_capacity: preferredCapacity,
|
|
9856
|
+
passive: config.passive ?? false,
|
|
9914
9857
|
timestamp: new Date().toISOString(),
|
|
9915
9858
|
});
|
|
9916
9859
|
this.onMsg = (event) => {
|
|
@@ -28946,6 +28889,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
28946
28889
|
inboxCapacity,
|
|
28947
28890
|
localNodeId,
|
|
28948
28891
|
initialTargetNodeId: resolvedTarget,
|
|
28892
|
+
passive: normalized.passive,
|
|
28949
28893
|
};
|
|
28950
28894
|
const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
|
|
28951
28895
|
if (options.authorization) {
|
|
@@ -28984,6 +28928,9 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
28984
28928
|
if (normalizedLocalNodeId) {
|
|
28985
28929
|
normalized.localNodeId = normalizedLocalNodeId;
|
|
28986
28930
|
}
|
|
28931
|
+
if (typeof candidate.passive === 'boolean') {
|
|
28932
|
+
normalized.passive = candidate.passive;
|
|
28933
|
+
}
|
|
28987
28934
|
if (typeof candidate.flowControl === 'boolean') {
|
|
28988
28935
|
normalized.flowControl = candidate.flowControl;
|
|
28989
28936
|
}
|
|
@@ -36778,11 +36725,19 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
36778
36725
|
? Math.floor(initialWindowCandidate)
|
|
36779
36726
|
: undefined;
|
|
36780
36727
|
const initialTargetNodeId = this._normalizeNodeId(targetCandidate) ?? targetSystemId;
|
|
36728
|
+
const passive = typeof passiveCandidate === 'boolean' ? passiveCandidate : true;
|
|
36729
|
+
logger$a.debug('broadcast_channel_listener_building_connector_config', {
|
|
36730
|
+
system_id: systemId,
|
|
36731
|
+
channel_name: channelName,
|
|
36732
|
+
passive,
|
|
36733
|
+
has_base_config: !!baseConfig,
|
|
36734
|
+
passive_candidate: passiveCandidate,
|
|
36735
|
+
});
|
|
36781
36736
|
return {
|
|
36782
36737
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE,
|
|
36783
36738
|
channelName,
|
|
36784
36739
|
inboxCapacity,
|
|
36785
|
-
passive
|
|
36740
|
+
passive,
|
|
36786
36741
|
initialWindow,
|
|
36787
36742
|
localNodeId,
|
|
36788
36743
|
initialTargetNodeId,
|
package/dist/node/node.cjs
CHANGED
|
@@ -5563,12 +5563,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
|
|
|
5563
5563
|
}
|
|
5564
5564
|
|
|
5565
5565
|
// This file is auto-generated during build - do not edit manually
|
|
5566
|
-
// Generated from package.json version: 0.3.6-test.
|
|
5566
|
+
// Generated from package.json version: 0.3.6-test.108
|
|
5567
5567
|
/**
|
|
5568
5568
|
* The package version, injected at build time.
|
|
5569
5569
|
* @internal
|
|
5570
5570
|
*/
|
|
5571
|
-
const VERSION = '0.3.6-test.
|
|
5571
|
+
const VERSION = '0.3.6-test.108';
|
|
5572
5572
|
|
|
5573
5573
|
/**
|
|
5574
5574
|
* Fame errors module - Fame protocol specific error classes
|
|
@@ -9727,9 +9727,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
9727
9727
|
this.ackDoneSince = new Map();
|
|
9728
9728
|
this.replyDoneSince = new Map();
|
|
9729
9729
|
this.pendingAckDispatches = new Set();
|
|
9730
|
-
this.recentlyHandled = new Map();
|
|
9731
|
-
this.recentlyHandledOrder = [];
|
|
9732
|
-
this.recentlyHandledTtlMs = 60000;
|
|
9733
9730
|
this.isPreparingToStop = false;
|
|
9734
9731
|
this.shutdownRequestedAtMs = null;
|
|
9735
9732
|
this.shutdownRetryGraceMs = 1000;
|
|
@@ -9965,22 +9962,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
9965
9962
|
}
|
|
9966
9963
|
}
|
|
9967
9964
|
else {
|
|
9968
|
-
const wasRecentlyHandled = await this.lock.runExclusive(async () => this.wasRecentlyHandled(envelope.id));
|
|
9969
|
-
if (wasRecentlyHandled) {
|
|
9970
|
-
logger$12.debug('tracker_duplicate_envelope_recently_handled', {
|
|
9971
|
-
envp_id: envelope.id,
|
|
9972
|
-
});
|
|
9973
|
-
return new TrackedEnvelope({
|
|
9974
|
-
timeoutAtMs: 0,
|
|
9975
|
-
overallTimeoutAtMs: 0,
|
|
9976
|
-
expectedResponseType: envelope.rtype ?? core.FameResponseType.NONE,
|
|
9977
|
-
createdAtMs: Date.now(),
|
|
9978
|
-
status: EnvelopeStatus.HANDLED,
|
|
9979
|
-
mailboxType: MailboxType.INBOX,
|
|
9980
|
-
originalEnvelope: envelope,
|
|
9981
|
-
serviceName: inboxName,
|
|
9982
|
-
});
|
|
9983
|
-
}
|
|
9984
9965
|
tracked = new TrackedEnvelope({
|
|
9985
9966
|
timeoutAtMs: 0,
|
|
9986
9967
|
overallTimeoutAtMs: 0,
|
|
@@ -10002,12 +9983,8 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10002
9983
|
async onEnvelopeHandled(envelope) {
|
|
10003
9984
|
const inbox = this.ensureInbox();
|
|
10004
9985
|
envelope.status = EnvelopeStatus.HANDLED;
|
|
9986
|
+
// Delete the envelope from inbox to prevent growth
|
|
10005
9987
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
10006
|
-
await this.lock.runExclusive(async () => {
|
|
10007
|
-
this.markRecentlyHandled(envelope.originalEnvelope.id);
|
|
10008
|
-
});
|
|
10009
|
-
// Preserve handled envelope to prevent duplicate redelivery during shutdown drains.
|
|
10010
|
-
// await inbox.set(envelope.originalEnvelope.id, envelope);
|
|
10011
9988
|
}
|
|
10012
9989
|
async onEnvelopeHandleFailed(inboxName, envelope, context, error, isFinalFailure = false) {
|
|
10013
9990
|
void context;
|
|
@@ -10226,9 +10203,9 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10226
10203
|
});
|
|
10227
10204
|
await this.markDoneSince(this.replyFutures, trackedEnvelope.originalEnvelope.id, this.replyDoneSince);
|
|
10228
10205
|
await this.markDoneSince(this.ackFutures, trackedEnvelope.originalEnvelope.id, this.ackDoneSince);
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10206
|
+
// Note: ACK is already sent in onCorrelatedMessage (lines 655-657)
|
|
10207
|
+
// when the reply envelope is first delivered. No need to send it again here.
|
|
10208
|
+
// Removing this duplicate sendAck call fixes the duplicate DeliveryAck bug.
|
|
10232
10209
|
for (const handler of this.eventHandlers) {
|
|
10233
10210
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
10234
10211
|
}
|
|
@@ -10378,8 +10355,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10378
10355
|
}
|
|
10379
10356
|
this.streamDone.clear();
|
|
10380
10357
|
this.correlationToEnvelope.clear();
|
|
10381
|
-
this.recentlyHandled.clear();
|
|
10382
|
-
this.recentlyHandledOrder.length = 0;
|
|
10383
10358
|
return values;
|
|
10384
10359
|
});
|
|
10385
10360
|
for (const timer of timers) {
|
|
@@ -10961,39 +10936,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10961
10936
|
this.pendingAckDispatches.delete(ackDispatch);
|
|
10962
10937
|
}
|
|
10963
10938
|
}
|
|
10964
|
-
markRecentlyHandled(envelopeId) {
|
|
10965
|
-
const now = Date.now();
|
|
10966
|
-
this.recentlyHandled.set(envelopeId, now);
|
|
10967
|
-
this.recentlyHandledOrder.push(envelopeId);
|
|
10968
|
-
this.trimRecentlyHandled(now);
|
|
10969
|
-
}
|
|
10970
|
-
wasRecentlyHandled(envelopeId) {
|
|
10971
|
-
const now = Date.now();
|
|
10972
|
-
const timestamp = this.recentlyHandled.get(envelopeId);
|
|
10973
|
-
if (timestamp === undefined) {
|
|
10974
|
-
return false;
|
|
10975
|
-
}
|
|
10976
|
-
if (now - timestamp > this.recentlyHandledTtlMs) {
|
|
10977
|
-
this.recentlyHandled.delete(envelopeId);
|
|
10978
|
-
return false;
|
|
10979
|
-
}
|
|
10980
|
-
return true;
|
|
10981
|
-
}
|
|
10982
|
-
trimRecentlyHandled(now) {
|
|
10983
|
-
while (this.recentlyHandledOrder.length > 0) {
|
|
10984
|
-
const candidate = this.recentlyHandledOrder[0];
|
|
10985
|
-
const timestamp = this.recentlyHandled.get(candidate);
|
|
10986
|
-
if (timestamp === undefined) {
|
|
10987
|
-
this.recentlyHandledOrder.shift();
|
|
10988
|
-
continue;
|
|
10989
|
-
}
|
|
10990
|
-
if (now - timestamp <= this.recentlyHandledTtlMs) {
|
|
10991
|
-
break;
|
|
10992
|
-
}
|
|
10993
|
-
this.recentlyHandled.delete(candidate);
|
|
10994
|
-
this.recentlyHandledOrder.shift();
|
|
10995
|
-
}
|
|
10996
|
-
}
|
|
10997
10939
|
getShutdownRetryDeferDelay(nowMs) {
|
|
10998
10940
|
if (!this.isPreparingToStop || this.shutdownRequestedAtMs === null) {
|
|
10999
10941
|
return null;
|
|
@@ -11649,6 +11591,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11649
11591
|
local_node_id: this.localNodeId,
|
|
11650
11592
|
target_node_id: this.targetNodeId ?? null,
|
|
11651
11593
|
inbox_capacity: preferredCapacity,
|
|
11594
|
+
passive: config.passive ?? false,
|
|
11652
11595
|
timestamp: new Date().toISOString(),
|
|
11653
11596
|
});
|
|
11654
11597
|
this.onMsg = (event) => {
|
|
@@ -30916,6 +30859,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
30916
30859
|
inboxCapacity,
|
|
30917
30860
|
localNodeId,
|
|
30918
30861
|
initialTargetNodeId: resolvedTarget,
|
|
30862
|
+
passive: normalized.passive,
|
|
30919
30863
|
};
|
|
30920
30864
|
const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
|
|
30921
30865
|
if (options.authorization) {
|
|
@@ -30954,6 +30898,9 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
30954
30898
|
if (normalizedLocalNodeId) {
|
|
30955
30899
|
normalized.localNodeId = normalizedLocalNodeId;
|
|
30956
30900
|
}
|
|
30901
|
+
if (typeof candidate.passive === 'boolean') {
|
|
30902
|
+
normalized.passive = candidate.passive;
|
|
30903
|
+
}
|
|
30957
30904
|
if (typeof candidate.flowControl === 'boolean') {
|
|
30958
30905
|
normalized.flowControl = candidate.flowControl;
|
|
30959
30906
|
}
|
|
@@ -33351,11 +33298,19 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
33351
33298
|
? Math.floor(initialWindowCandidate)
|
|
33352
33299
|
: undefined;
|
|
33353
33300
|
const initialTargetNodeId = this._normalizeNodeId(targetCandidate) ?? targetSystemId;
|
|
33301
|
+
const passive = typeof passiveCandidate === 'boolean' ? passiveCandidate : true;
|
|
33302
|
+
logger$n.debug('broadcast_channel_listener_building_connector_config', {
|
|
33303
|
+
system_id: systemId,
|
|
33304
|
+
channel_name: channelName,
|
|
33305
|
+
passive,
|
|
33306
|
+
has_base_config: !!baseConfig,
|
|
33307
|
+
passive_candidate: passiveCandidate,
|
|
33308
|
+
});
|
|
33354
33309
|
return {
|
|
33355
33310
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
|
|
33356
33311
|
channelName,
|
|
33357
33312
|
inboxCapacity,
|
|
33358
|
-
passive
|
|
33313
|
+
passive,
|
|
33359
33314
|
initialWindow,
|
|
33360
33315
|
localNodeId,
|
|
33361
33316
|
initialTargetNodeId,
|
package/dist/node/node.mjs
CHANGED
|
@@ -5562,12 +5562,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
|
|
|
5562
5562
|
}
|
|
5563
5563
|
|
|
5564
5564
|
// This file is auto-generated during build - do not edit manually
|
|
5565
|
-
// Generated from package.json version: 0.3.6-test.
|
|
5565
|
+
// Generated from package.json version: 0.3.6-test.108
|
|
5566
5566
|
/**
|
|
5567
5567
|
* The package version, injected at build time.
|
|
5568
5568
|
* @internal
|
|
5569
5569
|
*/
|
|
5570
|
-
const VERSION = '0.3.6-test.
|
|
5570
|
+
const VERSION = '0.3.6-test.108';
|
|
5571
5571
|
|
|
5572
5572
|
/**
|
|
5573
5573
|
* Fame errors module - Fame protocol specific error classes
|
|
@@ -9726,9 +9726,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
9726
9726
|
this.ackDoneSince = new Map();
|
|
9727
9727
|
this.replyDoneSince = new Map();
|
|
9728
9728
|
this.pendingAckDispatches = new Set();
|
|
9729
|
-
this.recentlyHandled = new Map();
|
|
9730
|
-
this.recentlyHandledOrder = [];
|
|
9731
|
-
this.recentlyHandledTtlMs = 60000;
|
|
9732
9729
|
this.isPreparingToStop = false;
|
|
9733
9730
|
this.shutdownRequestedAtMs = null;
|
|
9734
9731
|
this.shutdownRetryGraceMs = 1000;
|
|
@@ -9964,22 +9961,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
9964
9961
|
}
|
|
9965
9962
|
}
|
|
9966
9963
|
else {
|
|
9967
|
-
const wasRecentlyHandled = await this.lock.runExclusive(async () => this.wasRecentlyHandled(envelope.id));
|
|
9968
|
-
if (wasRecentlyHandled) {
|
|
9969
|
-
logger$12.debug('tracker_duplicate_envelope_recently_handled', {
|
|
9970
|
-
envp_id: envelope.id,
|
|
9971
|
-
});
|
|
9972
|
-
return new TrackedEnvelope({
|
|
9973
|
-
timeoutAtMs: 0,
|
|
9974
|
-
overallTimeoutAtMs: 0,
|
|
9975
|
-
expectedResponseType: envelope.rtype ?? FameResponseType.NONE,
|
|
9976
|
-
createdAtMs: Date.now(),
|
|
9977
|
-
status: EnvelopeStatus.HANDLED,
|
|
9978
|
-
mailboxType: MailboxType.INBOX,
|
|
9979
|
-
originalEnvelope: envelope,
|
|
9980
|
-
serviceName: inboxName,
|
|
9981
|
-
});
|
|
9982
|
-
}
|
|
9983
9964
|
tracked = new TrackedEnvelope({
|
|
9984
9965
|
timeoutAtMs: 0,
|
|
9985
9966
|
overallTimeoutAtMs: 0,
|
|
@@ -10001,12 +9982,8 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10001
9982
|
async onEnvelopeHandled(envelope) {
|
|
10002
9983
|
const inbox = this.ensureInbox();
|
|
10003
9984
|
envelope.status = EnvelopeStatus.HANDLED;
|
|
9985
|
+
// Delete the envelope from inbox to prevent growth
|
|
10004
9986
|
await inbox.delete(envelope.originalEnvelope.id);
|
|
10005
|
-
await this.lock.runExclusive(async () => {
|
|
10006
|
-
this.markRecentlyHandled(envelope.originalEnvelope.id);
|
|
10007
|
-
});
|
|
10008
|
-
// Preserve handled envelope to prevent duplicate redelivery during shutdown drains.
|
|
10009
|
-
// await inbox.set(envelope.originalEnvelope.id, envelope);
|
|
10010
9987
|
}
|
|
10011
9988
|
async onEnvelopeHandleFailed(inboxName, envelope, context, error, isFinalFailure = false) {
|
|
10012
9989
|
void context;
|
|
@@ -10225,9 +10202,9 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10225
10202
|
});
|
|
10226
10203
|
await this.markDoneSince(this.replyFutures, trackedEnvelope.originalEnvelope.id, this.replyDoneSince);
|
|
10227
10204
|
await this.markDoneSince(this.ackFutures, trackedEnvelope.originalEnvelope.id, this.ackDoneSince);
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10205
|
+
// Note: ACK is already sent in onCorrelatedMessage (lines 655-657)
|
|
10206
|
+
// when the reply envelope is first delivered. No need to send it again here.
|
|
10207
|
+
// Removing this duplicate sendAck call fixes the duplicate DeliveryAck bug.
|
|
10231
10208
|
for (const handler of this.eventHandlers) {
|
|
10232
10209
|
await handler.onEnvelopeReplied?.(trackedEnvelope, envelope);
|
|
10233
10210
|
}
|
|
@@ -10377,8 +10354,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10377
10354
|
}
|
|
10378
10355
|
this.streamDone.clear();
|
|
10379
10356
|
this.correlationToEnvelope.clear();
|
|
10380
|
-
this.recentlyHandled.clear();
|
|
10381
|
-
this.recentlyHandledOrder.length = 0;
|
|
10382
10357
|
return values;
|
|
10383
10358
|
});
|
|
10384
10359
|
for (const timer of timers) {
|
|
@@ -10960,39 +10935,6 @@ class DefaultDeliveryTracker extends TaskSpawner {
|
|
|
10960
10935
|
this.pendingAckDispatches.delete(ackDispatch);
|
|
10961
10936
|
}
|
|
10962
10937
|
}
|
|
10963
|
-
markRecentlyHandled(envelopeId) {
|
|
10964
|
-
const now = Date.now();
|
|
10965
|
-
this.recentlyHandled.set(envelopeId, now);
|
|
10966
|
-
this.recentlyHandledOrder.push(envelopeId);
|
|
10967
|
-
this.trimRecentlyHandled(now);
|
|
10968
|
-
}
|
|
10969
|
-
wasRecentlyHandled(envelopeId) {
|
|
10970
|
-
const now = Date.now();
|
|
10971
|
-
const timestamp = this.recentlyHandled.get(envelopeId);
|
|
10972
|
-
if (timestamp === undefined) {
|
|
10973
|
-
return false;
|
|
10974
|
-
}
|
|
10975
|
-
if (now - timestamp > this.recentlyHandledTtlMs) {
|
|
10976
|
-
this.recentlyHandled.delete(envelopeId);
|
|
10977
|
-
return false;
|
|
10978
|
-
}
|
|
10979
|
-
return true;
|
|
10980
|
-
}
|
|
10981
|
-
trimRecentlyHandled(now) {
|
|
10982
|
-
while (this.recentlyHandledOrder.length > 0) {
|
|
10983
|
-
const candidate = this.recentlyHandledOrder[0];
|
|
10984
|
-
const timestamp = this.recentlyHandled.get(candidate);
|
|
10985
|
-
if (timestamp === undefined) {
|
|
10986
|
-
this.recentlyHandledOrder.shift();
|
|
10987
|
-
continue;
|
|
10988
|
-
}
|
|
10989
|
-
if (now - timestamp <= this.recentlyHandledTtlMs) {
|
|
10990
|
-
break;
|
|
10991
|
-
}
|
|
10992
|
-
this.recentlyHandled.delete(candidate);
|
|
10993
|
-
this.recentlyHandledOrder.shift();
|
|
10994
|
-
}
|
|
10995
|
-
}
|
|
10996
10938
|
getShutdownRetryDeferDelay(nowMs) {
|
|
10997
10939
|
if (!this.isPreparingToStop || this.shutdownRequestedAtMs === null) {
|
|
10998
10940
|
return null;
|
|
@@ -11648,6 +11590,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11648
11590
|
local_node_id: this.localNodeId,
|
|
11649
11591
|
target_node_id: this.targetNodeId ?? null,
|
|
11650
11592
|
inbox_capacity: preferredCapacity,
|
|
11593
|
+
passive: config.passive ?? false,
|
|
11651
11594
|
timestamp: new Date().toISOString(),
|
|
11652
11595
|
});
|
|
11653
11596
|
this.onMsg = (event) => {
|
|
@@ -30915,6 +30858,7 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
30915
30858
|
inboxCapacity,
|
|
30916
30859
|
localNodeId,
|
|
30917
30860
|
initialTargetNodeId: resolvedTarget,
|
|
30861
|
+
passive: normalized.passive,
|
|
30918
30862
|
};
|
|
30919
30863
|
const connector = new BroadcastChannelConnector(connectorConfig, baseConfig);
|
|
30920
30864
|
if (options.authorization) {
|
|
@@ -30953,6 +30897,9 @@ class BroadcastChannelConnectorFactory extends ConnectorFactory {
|
|
|
30953
30897
|
if (normalizedLocalNodeId) {
|
|
30954
30898
|
normalized.localNodeId = normalizedLocalNodeId;
|
|
30955
30899
|
}
|
|
30900
|
+
if (typeof candidate.passive === 'boolean') {
|
|
30901
|
+
normalized.passive = candidate.passive;
|
|
30902
|
+
}
|
|
30956
30903
|
if (typeof candidate.flowControl === 'boolean') {
|
|
30957
30904
|
normalized.flowControl = candidate.flowControl;
|
|
30958
30905
|
}
|
|
@@ -33350,11 +33297,19 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
33350
33297
|
? Math.floor(initialWindowCandidate)
|
|
33351
33298
|
: undefined;
|
|
33352
33299
|
const initialTargetNodeId = this._normalizeNodeId(targetCandidate) ?? targetSystemId;
|
|
33300
|
+
const passive = typeof passiveCandidate === 'boolean' ? passiveCandidate : true;
|
|
33301
|
+
logger$n.debug('broadcast_channel_listener_building_connector_config', {
|
|
33302
|
+
system_id: systemId,
|
|
33303
|
+
channel_name: channelName,
|
|
33304
|
+
passive,
|
|
33305
|
+
has_base_config: !!baseConfig,
|
|
33306
|
+
passive_candidate: passiveCandidate,
|
|
33307
|
+
});
|
|
33353
33308
|
return {
|
|
33354
33309
|
type: BROADCAST_CHANNEL_CONNECTOR_TYPE$1,
|
|
33355
33310
|
channelName,
|
|
33356
33311
|
inboxCapacity,
|
|
33357
|
-
passive
|
|
33312
|
+
passive,
|
|
33358
33313
|
initialWindow,
|
|
33359
33314
|
localNodeId,
|
|
33360
33315
|
initialTargetNodeId,
|