@naylence/runtime 0.3.5-test.936 → 0.3.5-test.937
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 +38 -16
- package/dist/browser/index.mjs +38 -16
- package/dist/cjs/naylence/fame/connector/base-async-connector.js +6 -6
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +30 -8
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/connector/base-async-connector.js +6 -6
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +30 -8
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +38 -16
- package/dist/node/index.mjs +38 -16
- package/dist/node/node.cjs +38 -16
- package/dist/node/node.mjs +38 -16
- package/dist/types/naylence/fame/connector/broadcast-channel-connector.browser.d.ts +5 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
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.937
|
|
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.937';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -9584,7 +9584,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9584
9584
|
});
|
|
9585
9585
|
return;
|
|
9586
9586
|
}
|
|
9587
|
-
logger$$.
|
|
9587
|
+
logger$$.debug('connector_shutdown_starting', {
|
|
9588
9588
|
connector_id: this._connectorFlowId,
|
|
9589
9589
|
connector_type: this.constructor.name,
|
|
9590
9590
|
code,
|
|
@@ -9614,19 +9614,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9614
9614
|
this._sendPromiseResolve = undefined;
|
|
9615
9615
|
}
|
|
9616
9616
|
// Close transport
|
|
9617
|
-
logger$$.
|
|
9617
|
+
logger$$.debug('connector_closing_transport', {
|
|
9618
9618
|
connector_id: this._connectorFlowId,
|
|
9619
9619
|
connector_type: this.constructor.name,
|
|
9620
9620
|
timestamp: new Date().toISOString(),
|
|
9621
9621
|
});
|
|
9622
9622
|
await this._transportClose(code, reason);
|
|
9623
|
-
logger$$.
|
|
9623
|
+
logger$$.debug('connector_transport_closed', {
|
|
9624
9624
|
connector_id: this._connectorFlowId,
|
|
9625
9625
|
connector_type: this.constructor.name,
|
|
9626
9626
|
timestamp: new Date().toISOString(),
|
|
9627
9627
|
});
|
|
9628
9628
|
// Shutdown spawned tasks
|
|
9629
|
-
logger$$.
|
|
9629
|
+
logger$$.debug('connector_shutting_down_tasks', {
|
|
9630
9630
|
connector_id: this._connectorFlowId,
|
|
9631
9631
|
connector_type: this.constructor.name,
|
|
9632
9632
|
grace_period_ms: effectiveGracePeriod * 1000,
|
|
@@ -9638,7 +9638,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9638
9638
|
gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
|
|
9639
9639
|
joinTimeout: this._shutdownJoinTimeout,
|
|
9640
9640
|
});
|
|
9641
|
-
logger$$.
|
|
9641
|
+
logger$$.debug('connector_tasks_shutdown_complete', {
|
|
9642
9642
|
connector_id: this._connectorFlowId,
|
|
9643
9643
|
connector_type: this.constructor.name,
|
|
9644
9644
|
timestamp: new Date().toISOString(),
|
|
@@ -9658,7 +9658,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9658
9658
|
if (this._closeResolver) {
|
|
9659
9659
|
this._closeResolver();
|
|
9660
9660
|
}
|
|
9661
|
-
logger$$.
|
|
9661
|
+
logger$$.debug('connector_shutdown_complete', {
|
|
9662
9662
|
connector_id: this._connectorFlowId,
|
|
9663
9663
|
connector_type: this.constructor.name,
|
|
9664
9664
|
final_state: this._state,
|
|
@@ -9799,7 +9799,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9799
9799
|
this.inbox = new BoundedAsyncQueue(preferredCapacity);
|
|
9800
9800
|
this.connectorId = BroadcastChannelConnector.generateConnectorId();
|
|
9801
9801
|
this.channel = new BroadcastChannel(this.channelName);
|
|
9802
|
-
logger$_.
|
|
9802
|
+
logger$_.debug('broadcast_channel_connector_created', {
|
|
9803
9803
|
channel: this.channelName,
|
|
9804
9804
|
connector_id: this.connectorId,
|
|
9805
9805
|
inbox_capacity: preferredCapacity,
|
|
@@ -9880,7 +9880,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9880
9880
|
// Setup visibility change monitoring
|
|
9881
9881
|
this.visibilityChangeHandler = () => {
|
|
9882
9882
|
const isHidden = document.hidden;
|
|
9883
|
-
logger$_.
|
|
9883
|
+
logger$_.debug('broadcast_channel_visibility_changed', {
|
|
9884
9884
|
channel: this.channelName,
|
|
9885
9885
|
connector_id: this.connectorId,
|
|
9886
9886
|
visibility: isHidden ? 'hidden' : 'visible',
|
|
@@ -9910,7 +9910,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9910
9910
|
document.addEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
9911
9911
|
this.visibilityChangeListenerRegistered = true;
|
|
9912
9912
|
// Log initial state
|
|
9913
|
-
logger$_.
|
|
9913
|
+
logger$_.debug('broadcast_channel_initial_visibility', {
|
|
9914
9914
|
channel: this.channelName,
|
|
9915
9915
|
connector_id: this.connectorId,
|
|
9916
9916
|
visibility: document.hidden ? 'hidden' : 'visible',
|
|
@@ -9960,7 +9960,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9960
9960
|
return await this.inbox.dequeue();
|
|
9961
9961
|
}
|
|
9962
9962
|
async _transportClose(code, reason) {
|
|
9963
|
-
logger$_.
|
|
9963
|
+
logger$_.debug('broadcast_channel_transport_closing', {
|
|
9964
9964
|
channel: this.channelName,
|
|
9965
9965
|
connector_id: this.connectorId,
|
|
9966
9966
|
code,
|
|
@@ -9969,14 +9969,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9969
9969
|
timestamp: new Date().toISOString(),
|
|
9970
9970
|
});
|
|
9971
9971
|
if (this.listenerRegistered) {
|
|
9972
|
-
logger$_.
|
|
9972
|
+
logger$_.debug('broadcast_channel_removing_listener', {
|
|
9973
9973
|
channel: this.channelName,
|
|
9974
9974
|
connector_id: this.connectorId,
|
|
9975
9975
|
timestamp: new Date().toISOString(),
|
|
9976
9976
|
});
|
|
9977
9977
|
this.channel.removeEventListener('message', this.onMsg);
|
|
9978
9978
|
this.listenerRegistered = false;
|
|
9979
|
-
logger$_.
|
|
9979
|
+
logger$_.debug('broadcast_channel_listener_removed', {
|
|
9980
9980
|
channel: this.channelName,
|
|
9981
9981
|
connector_id: this.connectorId,
|
|
9982
9982
|
timestamp: new Date().toISOString(),
|
|
@@ -9987,13 +9987,13 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9987
9987
|
this.visibilityChangeListenerRegistered = false;
|
|
9988
9988
|
this.visibilityChangeHandler = undefined;
|
|
9989
9989
|
}
|
|
9990
|
-
logger$_.
|
|
9990
|
+
logger$_.debug('broadcast_channel_closing', {
|
|
9991
9991
|
channel: this.channelName,
|
|
9992
9992
|
connector_id: this.connectorId,
|
|
9993
9993
|
timestamp: new Date().toISOString(),
|
|
9994
9994
|
});
|
|
9995
9995
|
this.channel.close();
|
|
9996
|
-
logger$_.
|
|
9996
|
+
logger$_.debug('broadcast_channel_closed', {
|
|
9997
9997
|
channel: this.channelName,
|
|
9998
9998
|
connector_id: this.connectorId,
|
|
9999
9999
|
timestamp: new Date().toISOString(),
|
|
@@ -10084,6 +10084,28 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10084
10084
|
}
|
|
10085
10085
|
return undefined;
|
|
10086
10086
|
}
|
|
10087
|
+
/**
|
|
10088
|
+
* Override start() to check initial visibility state
|
|
10089
|
+
*/
|
|
10090
|
+
async start(inboundHandler) {
|
|
10091
|
+
await super.start(inboundHandler);
|
|
10092
|
+
// After transitioning to STARTED, check if tab is already hidden
|
|
10093
|
+
if (typeof document !== 'undefined' && document.hidden) {
|
|
10094
|
+
logger$_.debug('broadcast_channel_start_in_hidden_tab', {
|
|
10095
|
+
channel: this.channelName,
|
|
10096
|
+
connector_id: this.connectorId,
|
|
10097
|
+
timestamp: new Date().toISOString(),
|
|
10098
|
+
});
|
|
10099
|
+
// Immediately pause if tab is hidden at start time
|
|
10100
|
+
await this.pause().catch((err) => {
|
|
10101
|
+
logger$_.warning('broadcast_channel_initial_pause_failed', {
|
|
10102
|
+
channel: this.channelName,
|
|
10103
|
+
connector_id: this.connectorId,
|
|
10104
|
+
error: err instanceof Error ? err.message : String(err),
|
|
10105
|
+
});
|
|
10106
|
+
});
|
|
10107
|
+
}
|
|
10108
|
+
}
|
|
10087
10109
|
_trimSeenAcks(now) {
|
|
10088
10110
|
while (this.seenAckOrder.length > 0) {
|
|
10089
10111
|
const candidate = this.seenAckOrder[0];
|
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.5-test.
|
|
16
|
+
// Generated from package.json version: 0.3.5-test.937
|
|
17
17
|
/**
|
|
18
18
|
* The package version, injected at build time.
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
|
-
const VERSION = '0.3.5-test.
|
|
21
|
+
const VERSION = '0.3.5-test.937';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -9583,7 +9583,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9583
9583
|
});
|
|
9584
9584
|
return;
|
|
9585
9585
|
}
|
|
9586
|
-
logger$$.
|
|
9586
|
+
logger$$.debug('connector_shutdown_starting', {
|
|
9587
9587
|
connector_id: this._connectorFlowId,
|
|
9588
9588
|
connector_type: this.constructor.name,
|
|
9589
9589
|
code,
|
|
@@ -9613,19 +9613,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9613
9613
|
this._sendPromiseResolve = undefined;
|
|
9614
9614
|
}
|
|
9615
9615
|
// Close transport
|
|
9616
|
-
logger$$.
|
|
9616
|
+
logger$$.debug('connector_closing_transport', {
|
|
9617
9617
|
connector_id: this._connectorFlowId,
|
|
9618
9618
|
connector_type: this.constructor.name,
|
|
9619
9619
|
timestamp: new Date().toISOString(),
|
|
9620
9620
|
});
|
|
9621
9621
|
await this._transportClose(code, reason);
|
|
9622
|
-
logger$$.
|
|
9622
|
+
logger$$.debug('connector_transport_closed', {
|
|
9623
9623
|
connector_id: this._connectorFlowId,
|
|
9624
9624
|
connector_type: this.constructor.name,
|
|
9625
9625
|
timestamp: new Date().toISOString(),
|
|
9626
9626
|
});
|
|
9627
9627
|
// Shutdown spawned tasks
|
|
9628
|
-
logger$$.
|
|
9628
|
+
logger$$.debug('connector_shutting_down_tasks', {
|
|
9629
9629
|
connector_id: this._connectorFlowId,
|
|
9630
9630
|
connector_type: this.constructor.name,
|
|
9631
9631
|
grace_period_ms: effectiveGracePeriod * 1000,
|
|
@@ -9637,7 +9637,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9637
9637
|
gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
|
|
9638
9638
|
joinTimeout: this._shutdownJoinTimeout,
|
|
9639
9639
|
});
|
|
9640
|
-
logger$$.
|
|
9640
|
+
logger$$.debug('connector_tasks_shutdown_complete', {
|
|
9641
9641
|
connector_id: this._connectorFlowId,
|
|
9642
9642
|
connector_type: this.constructor.name,
|
|
9643
9643
|
timestamp: new Date().toISOString(),
|
|
@@ -9657,7 +9657,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
9657
9657
|
if (this._closeResolver) {
|
|
9658
9658
|
this._closeResolver();
|
|
9659
9659
|
}
|
|
9660
|
-
logger$$.
|
|
9660
|
+
logger$$.debug('connector_shutdown_complete', {
|
|
9661
9661
|
connector_id: this._connectorFlowId,
|
|
9662
9662
|
connector_type: this.constructor.name,
|
|
9663
9663
|
final_state: this._state,
|
|
@@ -9798,7 +9798,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9798
9798
|
this.inbox = new BoundedAsyncQueue(preferredCapacity);
|
|
9799
9799
|
this.connectorId = BroadcastChannelConnector.generateConnectorId();
|
|
9800
9800
|
this.channel = new BroadcastChannel(this.channelName);
|
|
9801
|
-
logger$_.
|
|
9801
|
+
logger$_.debug('broadcast_channel_connector_created', {
|
|
9802
9802
|
channel: this.channelName,
|
|
9803
9803
|
connector_id: this.connectorId,
|
|
9804
9804
|
inbox_capacity: preferredCapacity,
|
|
@@ -9879,7 +9879,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9879
9879
|
// Setup visibility change monitoring
|
|
9880
9880
|
this.visibilityChangeHandler = () => {
|
|
9881
9881
|
const isHidden = document.hidden;
|
|
9882
|
-
logger$_.
|
|
9882
|
+
logger$_.debug('broadcast_channel_visibility_changed', {
|
|
9883
9883
|
channel: this.channelName,
|
|
9884
9884
|
connector_id: this.connectorId,
|
|
9885
9885
|
visibility: isHidden ? 'hidden' : 'visible',
|
|
@@ -9909,7 +9909,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9909
9909
|
document.addEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
9910
9910
|
this.visibilityChangeListenerRegistered = true;
|
|
9911
9911
|
// Log initial state
|
|
9912
|
-
logger$_.
|
|
9912
|
+
logger$_.debug('broadcast_channel_initial_visibility', {
|
|
9913
9913
|
channel: this.channelName,
|
|
9914
9914
|
connector_id: this.connectorId,
|
|
9915
9915
|
visibility: document.hidden ? 'hidden' : 'visible',
|
|
@@ -9959,7 +9959,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9959
9959
|
return await this.inbox.dequeue();
|
|
9960
9960
|
}
|
|
9961
9961
|
async _transportClose(code, reason) {
|
|
9962
|
-
logger$_.
|
|
9962
|
+
logger$_.debug('broadcast_channel_transport_closing', {
|
|
9963
9963
|
channel: this.channelName,
|
|
9964
9964
|
connector_id: this.connectorId,
|
|
9965
9965
|
code,
|
|
@@ -9968,14 +9968,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9968
9968
|
timestamp: new Date().toISOString(),
|
|
9969
9969
|
});
|
|
9970
9970
|
if (this.listenerRegistered) {
|
|
9971
|
-
logger$_.
|
|
9971
|
+
logger$_.debug('broadcast_channel_removing_listener', {
|
|
9972
9972
|
channel: this.channelName,
|
|
9973
9973
|
connector_id: this.connectorId,
|
|
9974
9974
|
timestamp: new Date().toISOString(),
|
|
9975
9975
|
});
|
|
9976
9976
|
this.channel.removeEventListener('message', this.onMsg);
|
|
9977
9977
|
this.listenerRegistered = false;
|
|
9978
|
-
logger$_.
|
|
9978
|
+
logger$_.debug('broadcast_channel_listener_removed', {
|
|
9979
9979
|
channel: this.channelName,
|
|
9980
9980
|
connector_id: this.connectorId,
|
|
9981
9981
|
timestamp: new Date().toISOString(),
|
|
@@ -9986,13 +9986,13 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
9986
9986
|
this.visibilityChangeListenerRegistered = false;
|
|
9987
9987
|
this.visibilityChangeHandler = undefined;
|
|
9988
9988
|
}
|
|
9989
|
-
logger$_.
|
|
9989
|
+
logger$_.debug('broadcast_channel_closing', {
|
|
9990
9990
|
channel: this.channelName,
|
|
9991
9991
|
connector_id: this.connectorId,
|
|
9992
9992
|
timestamp: new Date().toISOString(),
|
|
9993
9993
|
});
|
|
9994
9994
|
this.channel.close();
|
|
9995
|
-
logger$_.
|
|
9995
|
+
logger$_.debug('broadcast_channel_closed', {
|
|
9996
9996
|
channel: this.channelName,
|
|
9997
9997
|
connector_id: this.connectorId,
|
|
9998
9998
|
timestamp: new Date().toISOString(),
|
|
@@ -10083,6 +10083,28 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10083
10083
|
}
|
|
10084
10084
|
return undefined;
|
|
10085
10085
|
}
|
|
10086
|
+
/**
|
|
10087
|
+
* Override start() to check initial visibility state
|
|
10088
|
+
*/
|
|
10089
|
+
async start(inboundHandler) {
|
|
10090
|
+
await super.start(inboundHandler);
|
|
10091
|
+
// After transitioning to STARTED, check if tab is already hidden
|
|
10092
|
+
if (typeof document !== 'undefined' && document.hidden) {
|
|
10093
|
+
logger$_.debug('broadcast_channel_start_in_hidden_tab', {
|
|
10094
|
+
channel: this.channelName,
|
|
10095
|
+
connector_id: this.connectorId,
|
|
10096
|
+
timestamp: new Date().toISOString(),
|
|
10097
|
+
});
|
|
10098
|
+
// Immediately pause if tab is hidden at start time
|
|
10099
|
+
await this.pause().catch((err) => {
|
|
10100
|
+
logger$_.warning('broadcast_channel_initial_pause_failed', {
|
|
10101
|
+
channel: this.channelName,
|
|
10102
|
+
connector_id: this.connectorId,
|
|
10103
|
+
error: err instanceof Error ? err.message : String(err),
|
|
10104
|
+
});
|
|
10105
|
+
});
|
|
10106
|
+
}
|
|
10107
|
+
}
|
|
10086
10108
|
_trimSeenAcks(now) {
|
|
10087
10109
|
while (this.seenAckOrder.length > 0) {
|
|
10088
10110
|
const candidate = this.seenAckOrder[0];
|
package/dist/node/node.cjs
CHANGED
|
@@ -2514,7 +2514,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2514
2514
|
});
|
|
2515
2515
|
return;
|
|
2516
2516
|
}
|
|
2517
|
-
logger$1f.
|
|
2517
|
+
logger$1f.debug('connector_shutdown_starting', {
|
|
2518
2518
|
connector_id: this._connectorFlowId,
|
|
2519
2519
|
connector_type: this.constructor.name,
|
|
2520
2520
|
code,
|
|
@@ -2544,19 +2544,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2544
2544
|
this._sendPromiseResolve = undefined;
|
|
2545
2545
|
}
|
|
2546
2546
|
// Close transport
|
|
2547
|
-
logger$1f.
|
|
2547
|
+
logger$1f.debug('connector_closing_transport', {
|
|
2548
2548
|
connector_id: this._connectorFlowId,
|
|
2549
2549
|
connector_type: this.constructor.name,
|
|
2550
2550
|
timestamp: new Date().toISOString(),
|
|
2551
2551
|
});
|
|
2552
2552
|
await this._transportClose(code, reason);
|
|
2553
|
-
logger$1f.
|
|
2553
|
+
logger$1f.debug('connector_transport_closed', {
|
|
2554
2554
|
connector_id: this._connectorFlowId,
|
|
2555
2555
|
connector_type: this.constructor.name,
|
|
2556
2556
|
timestamp: new Date().toISOString(),
|
|
2557
2557
|
});
|
|
2558
2558
|
// Shutdown spawned tasks
|
|
2559
|
-
logger$1f.
|
|
2559
|
+
logger$1f.debug('connector_shutting_down_tasks', {
|
|
2560
2560
|
connector_id: this._connectorFlowId,
|
|
2561
2561
|
connector_type: this.constructor.name,
|
|
2562
2562
|
grace_period_ms: effectiveGracePeriod * 1000,
|
|
@@ -2568,7 +2568,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2568
2568
|
gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
|
|
2569
2569
|
joinTimeout: this._shutdownJoinTimeout,
|
|
2570
2570
|
});
|
|
2571
|
-
logger$1f.
|
|
2571
|
+
logger$1f.debug('connector_tasks_shutdown_complete', {
|
|
2572
2572
|
connector_id: this._connectorFlowId,
|
|
2573
2573
|
connector_type: this.constructor.name,
|
|
2574
2574
|
timestamp: new Date().toISOString(),
|
|
@@ -2588,7 +2588,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2588
2588
|
if (this._closeResolver) {
|
|
2589
2589
|
this._closeResolver();
|
|
2590
2590
|
}
|
|
2591
|
-
logger$1f.
|
|
2591
|
+
logger$1f.debug('connector_shutdown_complete', {
|
|
2592
2592
|
connector_id: this._connectorFlowId,
|
|
2593
2593
|
connector_type: this.constructor.name,
|
|
2594
2594
|
final_state: this._state,
|
|
@@ -5478,12 +5478,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
|
|
|
5478
5478
|
}
|
|
5479
5479
|
|
|
5480
5480
|
// This file is auto-generated during build - do not edit manually
|
|
5481
|
-
// Generated from package.json version: 0.3.5-test.
|
|
5481
|
+
// Generated from package.json version: 0.3.5-test.937
|
|
5482
5482
|
/**
|
|
5483
5483
|
* The package version, injected at build time.
|
|
5484
5484
|
* @internal
|
|
5485
5485
|
*/
|
|
5486
|
-
const VERSION = '0.3.5-test.
|
|
5486
|
+
const VERSION = '0.3.5-test.937';
|
|
5487
5487
|
|
|
5488
5488
|
/**
|
|
5489
5489
|
* Fame errors module - Fame protocol specific error classes
|
|
@@ -11536,7 +11536,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11536
11536
|
this.inbox = new BoundedAsyncQueue(preferredCapacity);
|
|
11537
11537
|
this.connectorId = BroadcastChannelConnector.generateConnectorId();
|
|
11538
11538
|
this.channel = new BroadcastChannel(this.channelName);
|
|
11539
|
-
logger$10.
|
|
11539
|
+
logger$10.debug('broadcast_channel_connector_created', {
|
|
11540
11540
|
channel: this.channelName,
|
|
11541
11541
|
connector_id: this.connectorId,
|
|
11542
11542
|
inbox_capacity: preferredCapacity,
|
|
@@ -11617,7 +11617,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11617
11617
|
// Setup visibility change monitoring
|
|
11618
11618
|
this.visibilityChangeHandler = () => {
|
|
11619
11619
|
const isHidden = document.hidden;
|
|
11620
|
-
logger$10.
|
|
11620
|
+
logger$10.debug('broadcast_channel_visibility_changed', {
|
|
11621
11621
|
channel: this.channelName,
|
|
11622
11622
|
connector_id: this.connectorId,
|
|
11623
11623
|
visibility: isHidden ? 'hidden' : 'visible',
|
|
@@ -11647,7 +11647,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11647
11647
|
document.addEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
11648
11648
|
this.visibilityChangeListenerRegistered = true;
|
|
11649
11649
|
// Log initial state
|
|
11650
|
-
logger$10.
|
|
11650
|
+
logger$10.debug('broadcast_channel_initial_visibility', {
|
|
11651
11651
|
channel: this.channelName,
|
|
11652
11652
|
connector_id: this.connectorId,
|
|
11653
11653
|
visibility: document.hidden ? 'hidden' : 'visible',
|
|
@@ -11697,7 +11697,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11697
11697
|
return await this.inbox.dequeue();
|
|
11698
11698
|
}
|
|
11699
11699
|
async _transportClose(code, reason) {
|
|
11700
|
-
logger$10.
|
|
11700
|
+
logger$10.debug('broadcast_channel_transport_closing', {
|
|
11701
11701
|
channel: this.channelName,
|
|
11702
11702
|
connector_id: this.connectorId,
|
|
11703
11703
|
code,
|
|
@@ -11706,14 +11706,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11706
11706
|
timestamp: new Date().toISOString(),
|
|
11707
11707
|
});
|
|
11708
11708
|
if (this.listenerRegistered) {
|
|
11709
|
-
logger$10.
|
|
11709
|
+
logger$10.debug('broadcast_channel_removing_listener', {
|
|
11710
11710
|
channel: this.channelName,
|
|
11711
11711
|
connector_id: this.connectorId,
|
|
11712
11712
|
timestamp: new Date().toISOString(),
|
|
11713
11713
|
});
|
|
11714
11714
|
this.channel.removeEventListener('message', this.onMsg);
|
|
11715
11715
|
this.listenerRegistered = false;
|
|
11716
|
-
logger$10.
|
|
11716
|
+
logger$10.debug('broadcast_channel_listener_removed', {
|
|
11717
11717
|
channel: this.channelName,
|
|
11718
11718
|
connector_id: this.connectorId,
|
|
11719
11719
|
timestamp: new Date().toISOString(),
|
|
@@ -11724,13 +11724,13 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11724
11724
|
this.visibilityChangeListenerRegistered = false;
|
|
11725
11725
|
this.visibilityChangeHandler = undefined;
|
|
11726
11726
|
}
|
|
11727
|
-
logger$10.
|
|
11727
|
+
logger$10.debug('broadcast_channel_closing', {
|
|
11728
11728
|
channel: this.channelName,
|
|
11729
11729
|
connector_id: this.connectorId,
|
|
11730
11730
|
timestamp: new Date().toISOString(),
|
|
11731
11731
|
});
|
|
11732
11732
|
this.channel.close();
|
|
11733
|
-
logger$10.
|
|
11733
|
+
logger$10.debug('broadcast_channel_closed', {
|
|
11734
11734
|
channel: this.channelName,
|
|
11735
11735
|
connector_id: this.connectorId,
|
|
11736
11736
|
timestamp: new Date().toISOString(),
|
|
@@ -11821,6 +11821,28 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11821
11821
|
}
|
|
11822
11822
|
return undefined;
|
|
11823
11823
|
}
|
|
11824
|
+
/**
|
|
11825
|
+
* Override start() to check initial visibility state
|
|
11826
|
+
*/
|
|
11827
|
+
async start(inboundHandler) {
|
|
11828
|
+
await super.start(inboundHandler);
|
|
11829
|
+
// After transitioning to STARTED, check if tab is already hidden
|
|
11830
|
+
if (typeof document !== 'undefined' && document.hidden) {
|
|
11831
|
+
logger$10.debug('broadcast_channel_start_in_hidden_tab', {
|
|
11832
|
+
channel: this.channelName,
|
|
11833
|
+
connector_id: this.connectorId,
|
|
11834
|
+
timestamp: new Date().toISOString(),
|
|
11835
|
+
});
|
|
11836
|
+
// Immediately pause if tab is hidden at start time
|
|
11837
|
+
await this.pause().catch((err) => {
|
|
11838
|
+
logger$10.warning('broadcast_channel_initial_pause_failed', {
|
|
11839
|
+
channel: this.channelName,
|
|
11840
|
+
connector_id: this.connectorId,
|
|
11841
|
+
error: err instanceof Error ? err.message : String(err),
|
|
11842
|
+
});
|
|
11843
|
+
});
|
|
11844
|
+
}
|
|
11845
|
+
}
|
|
11824
11846
|
_trimSeenAcks(now) {
|
|
11825
11847
|
while (this.seenAckOrder.length > 0) {
|
|
11826
11848
|
const candidate = this.seenAckOrder[0];
|
package/dist/node/node.mjs
CHANGED
|
@@ -2513,7 +2513,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2513
2513
|
});
|
|
2514
2514
|
return;
|
|
2515
2515
|
}
|
|
2516
|
-
logger$1f.
|
|
2516
|
+
logger$1f.debug('connector_shutdown_starting', {
|
|
2517
2517
|
connector_id: this._connectorFlowId,
|
|
2518
2518
|
connector_type: this.constructor.name,
|
|
2519
2519
|
code,
|
|
@@ -2543,19 +2543,19 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2543
2543
|
this._sendPromiseResolve = undefined;
|
|
2544
2544
|
}
|
|
2545
2545
|
// Close transport
|
|
2546
|
-
logger$1f.
|
|
2546
|
+
logger$1f.debug('connector_closing_transport', {
|
|
2547
2547
|
connector_id: this._connectorFlowId,
|
|
2548
2548
|
connector_type: this.constructor.name,
|
|
2549
2549
|
timestamp: new Date().toISOString(),
|
|
2550
2550
|
});
|
|
2551
2551
|
await this._transportClose(code, reason);
|
|
2552
|
-
logger$1f.
|
|
2552
|
+
logger$1f.debug('connector_transport_closed', {
|
|
2553
2553
|
connector_id: this._connectorFlowId,
|
|
2554
2554
|
connector_type: this.constructor.name,
|
|
2555
2555
|
timestamp: new Date().toISOString(),
|
|
2556
2556
|
});
|
|
2557
2557
|
// Shutdown spawned tasks
|
|
2558
|
-
logger$1f.
|
|
2558
|
+
logger$1f.debug('connector_shutting_down_tasks', {
|
|
2559
2559
|
connector_id: this._connectorFlowId,
|
|
2560
2560
|
connector_type: this.constructor.name,
|
|
2561
2561
|
grace_period_ms: effectiveGracePeriod * 1000,
|
|
@@ -2567,7 +2567,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2567
2567
|
gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
|
|
2568
2568
|
joinTimeout: this._shutdownJoinTimeout,
|
|
2569
2569
|
});
|
|
2570
|
-
logger$1f.
|
|
2570
|
+
logger$1f.debug('connector_tasks_shutdown_complete', {
|
|
2571
2571
|
connector_id: this._connectorFlowId,
|
|
2572
2572
|
connector_type: this.constructor.name,
|
|
2573
2573
|
timestamp: new Date().toISOString(),
|
|
@@ -2587,7 +2587,7 @@ class BaseAsyncConnector extends TaskSpawner {
|
|
|
2587
2587
|
if (this._closeResolver) {
|
|
2588
2588
|
this._closeResolver();
|
|
2589
2589
|
}
|
|
2590
|
-
logger$1f.
|
|
2590
|
+
logger$1f.debug('connector_shutdown_complete', {
|
|
2591
2591
|
connector_id: this._connectorFlowId,
|
|
2592
2592
|
connector_type: this.constructor.name,
|
|
2593
2593
|
final_state: this._state,
|
|
@@ -5477,12 +5477,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
|
|
|
5477
5477
|
}
|
|
5478
5478
|
|
|
5479
5479
|
// This file is auto-generated during build - do not edit manually
|
|
5480
|
-
// Generated from package.json version: 0.3.5-test.
|
|
5480
|
+
// Generated from package.json version: 0.3.5-test.937
|
|
5481
5481
|
/**
|
|
5482
5482
|
* The package version, injected at build time.
|
|
5483
5483
|
* @internal
|
|
5484
5484
|
*/
|
|
5485
|
-
const VERSION = '0.3.5-test.
|
|
5485
|
+
const VERSION = '0.3.5-test.937';
|
|
5486
5486
|
|
|
5487
5487
|
/**
|
|
5488
5488
|
* Fame errors module - Fame protocol specific error classes
|
|
@@ -11535,7 +11535,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11535
11535
|
this.inbox = new BoundedAsyncQueue(preferredCapacity);
|
|
11536
11536
|
this.connectorId = BroadcastChannelConnector.generateConnectorId();
|
|
11537
11537
|
this.channel = new BroadcastChannel(this.channelName);
|
|
11538
|
-
logger$10.
|
|
11538
|
+
logger$10.debug('broadcast_channel_connector_created', {
|
|
11539
11539
|
channel: this.channelName,
|
|
11540
11540
|
connector_id: this.connectorId,
|
|
11541
11541
|
inbox_capacity: preferredCapacity,
|
|
@@ -11616,7 +11616,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11616
11616
|
// Setup visibility change monitoring
|
|
11617
11617
|
this.visibilityChangeHandler = () => {
|
|
11618
11618
|
const isHidden = document.hidden;
|
|
11619
|
-
logger$10.
|
|
11619
|
+
logger$10.debug('broadcast_channel_visibility_changed', {
|
|
11620
11620
|
channel: this.channelName,
|
|
11621
11621
|
connector_id: this.connectorId,
|
|
11622
11622
|
visibility: isHidden ? 'hidden' : 'visible',
|
|
@@ -11646,7 +11646,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11646
11646
|
document.addEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
11647
11647
|
this.visibilityChangeListenerRegistered = true;
|
|
11648
11648
|
// Log initial state
|
|
11649
|
-
logger$10.
|
|
11649
|
+
logger$10.debug('broadcast_channel_initial_visibility', {
|
|
11650
11650
|
channel: this.channelName,
|
|
11651
11651
|
connector_id: this.connectorId,
|
|
11652
11652
|
visibility: document.hidden ? 'hidden' : 'visible',
|
|
@@ -11696,7 +11696,7 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11696
11696
|
return await this.inbox.dequeue();
|
|
11697
11697
|
}
|
|
11698
11698
|
async _transportClose(code, reason) {
|
|
11699
|
-
logger$10.
|
|
11699
|
+
logger$10.debug('broadcast_channel_transport_closing', {
|
|
11700
11700
|
channel: this.channelName,
|
|
11701
11701
|
connector_id: this.connectorId,
|
|
11702
11702
|
code,
|
|
@@ -11705,14 +11705,14 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11705
11705
|
timestamp: new Date().toISOString(),
|
|
11706
11706
|
});
|
|
11707
11707
|
if (this.listenerRegistered) {
|
|
11708
|
-
logger$10.
|
|
11708
|
+
logger$10.debug('broadcast_channel_removing_listener', {
|
|
11709
11709
|
channel: this.channelName,
|
|
11710
11710
|
connector_id: this.connectorId,
|
|
11711
11711
|
timestamp: new Date().toISOString(),
|
|
11712
11712
|
});
|
|
11713
11713
|
this.channel.removeEventListener('message', this.onMsg);
|
|
11714
11714
|
this.listenerRegistered = false;
|
|
11715
|
-
logger$10.
|
|
11715
|
+
logger$10.debug('broadcast_channel_listener_removed', {
|
|
11716
11716
|
channel: this.channelName,
|
|
11717
11717
|
connector_id: this.connectorId,
|
|
11718
11718
|
timestamp: new Date().toISOString(),
|
|
@@ -11723,13 +11723,13 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11723
11723
|
this.visibilityChangeListenerRegistered = false;
|
|
11724
11724
|
this.visibilityChangeHandler = undefined;
|
|
11725
11725
|
}
|
|
11726
|
-
logger$10.
|
|
11726
|
+
logger$10.debug('broadcast_channel_closing', {
|
|
11727
11727
|
channel: this.channelName,
|
|
11728
11728
|
connector_id: this.connectorId,
|
|
11729
11729
|
timestamp: new Date().toISOString(),
|
|
11730
11730
|
});
|
|
11731
11731
|
this.channel.close();
|
|
11732
|
-
logger$10.
|
|
11732
|
+
logger$10.debug('broadcast_channel_closed', {
|
|
11733
11733
|
channel: this.channelName,
|
|
11734
11734
|
connector_id: this.connectorId,
|
|
11735
11735
|
timestamp: new Date().toISOString(),
|
|
@@ -11820,6 +11820,28 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11820
11820
|
}
|
|
11821
11821
|
return undefined;
|
|
11822
11822
|
}
|
|
11823
|
+
/**
|
|
11824
|
+
* Override start() to check initial visibility state
|
|
11825
|
+
*/
|
|
11826
|
+
async start(inboundHandler) {
|
|
11827
|
+
await super.start(inboundHandler);
|
|
11828
|
+
// After transitioning to STARTED, check if tab is already hidden
|
|
11829
|
+
if (typeof document !== 'undefined' && document.hidden) {
|
|
11830
|
+
logger$10.debug('broadcast_channel_start_in_hidden_tab', {
|
|
11831
|
+
channel: this.channelName,
|
|
11832
|
+
connector_id: this.connectorId,
|
|
11833
|
+
timestamp: new Date().toISOString(),
|
|
11834
|
+
});
|
|
11835
|
+
// Immediately pause if tab is hidden at start time
|
|
11836
|
+
await this.pause().catch((err) => {
|
|
11837
|
+
logger$10.warning('broadcast_channel_initial_pause_failed', {
|
|
11838
|
+
channel: this.channelName,
|
|
11839
|
+
connector_id: this.connectorId,
|
|
11840
|
+
error: err instanceof Error ? err.message : String(err),
|
|
11841
|
+
});
|
|
11842
|
+
});
|
|
11843
|
+
}
|
|
11844
|
+
}
|
|
11823
11845
|
_trimSeenAcks(now) {
|
|
11824
11846
|
while (this.seenAckOrder.length > 0) {
|
|
11825
11847
|
const candidate = this.seenAckOrder[0];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseAsyncConnector, type BaseAsyncConnectorConfig } from './base-async-connector.js';
|
|
2
2
|
import type { ConnectorConfig } from './connector-config.js';
|
|
3
|
-
import type { FameEnvelope, FameChannelMessage } from '@naylence/core';
|
|
3
|
+
import type { FameEnvelope, FameChannelMessage, FameEnvelopeHandler } from '@naylence/core';
|
|
4
4
|
export declare const BROADCAST_CHANNEL_CONNECTOR_TYPE: "broadcast-channel-connector";
|
|
5
5
|
export interface BroadcastChannelConnectorConfig extends ConnectorConfig {
|
|
6
6
|
type: typeof BROADCAST_CHANNEL_CONNECTOR_TYPE;
|
|
@@ -35,6 +35,10 @@ export declare class BroadcastChannelConnector extends BaseAsyncConnector {
|
|
|
35
35
|
private _checkDuplicateAck;
|
|
36
36
|
private _extractEnvelopeFromInboxItem;
|
|
37
37
|
private _extractSenderIdFromInboxItem;
|
|
38
|
+
/**
|
|
39
|
+
* Override start() to check initial visibility state
|
|
40
|
+
*/
|
|
41
|
+
start(inboundHandler: FameEnvelopeHandler): Promise<void>;
|
|
38
42
|
private _trimSeenAcks;
|
|
39
43
|
private _extractAckDedupKey;
|
|
40
44
|
}
|
package/dist/types/version.d.ts
CHANGED