@naylence/runtime 0.3.5-test.950 → 0.3.5-test.952
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 +152 -108
- package/dist/browser/index.mjs +152 -108
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +54 -33
- package/dist/cjs/naylence/fame/connector/broadcast-channel-listener.js +35 -32
- package/dist/cjs/naylence/fame/connector/inpage-connector.js +51 -30
- package/dist/cjs/naylence/fame/connector/transport-frame.js +10 -11
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/connector/broadcast-channel-connector.browser.js +54 -33
- package/dist/esm/naylence/fame/connector/broadcast-channel-listener.js +35 -32
- package/dist/esm/naylence/fame/connector/inpage-connector.js +51 -30
- package/dist/esm/naylence/fame/connector/transport-frame.js +10 -11
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +152 -108
- package/dist/node/index.mjs +152 -108
- package/dist/node/node.cjs +152 -108
- package/dist/node/node.mjs +152 -108
- package/dist/types/naylence/fame/connector/transport-frame.d.ts +3 -5
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/node/node.cjs
CHANGED
|
@@ -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.952
|
|
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.952';
|
|
5487
5487
|
|
|
5488
5488
|
/**
|
|
5489
5489
|
* Fame errors module - Fame protocol specific error classes
|
|
@@ -11517,14 +11517,12 @@ function serializeTransportFrame(frame) {
|
|
|
11517
11517
|
return serializable;
|
|
11518
11518
|
}
|
|
11519
11519
|
/**
|
|
11520
|
-
* Unwrap a transport frame
|
|
11520
|
+
* Unwrap a transport frame (pure deserializer - no filtering)
|
|
11521
11521
|
*
|
|
11522
11522
|
* @param raw - Raw data from the bus
|
|
11523
|
-
* @
|
|
11524
|
-
* @param remoteNodeId - Expected remote node ID
|
|
11525
|
-
* @returns Unwrapped payload if frame is valid and addressed to us, null otherwise
|
|
11523
|
+
* @returns Unwrapped frame with payload as Uint8Array, or null if invalid structure
|
|
11526
11524
|
*/
|
|
11527
|
-
function unwrapTransportFrame(raw
|
|
11525
|
+
function unwrapTransportFrame(raw) {
|
|
11528
11526
|
// Validate basic structure
|
|
11529
11527
|
if (!raw || typeof raw !== 'object') {
|
|
11530
11528
|
return null;
|
|
@@ -11538,16 +11536,17 @@ function unwrapTransportFrame(raw, localNodeId, remoteNodeId) {
|
|
|
11538
11536
|
if (typeof frame.src !== 'string' || typeof frame.dst !== 'string') {
|
|
11539
11537
|
return null;
|
|
11540
11538
|
}
|
|
11541
|
-
// Only accept frames addressed to us from the expected remote
|
|
11542
|
-
if (frame.dst !== localNodeId || frame.src !== remoteNodeId) {
|
|
11543
|
-
return null;
|
|
11544
|
-
}
|
|
11545
11539
|
// Extract payload
|
|
11546
11540
|
if (!frame.payload || !Array.isArray(frame.payload)) {
|
|
11547
11541
|
return null;
|
|
11548
11542
|
}
|
|
11549
|
-
// Convert array back to Uint8Array
|
|
11550
|
-
return
|
|
11543
|
+
// Convert array back to Uint8Array and return full frame
|
|
11544
|
+
return {
|
|
11545
|
+
v: frame.v,
|
|
11546
|
+
src: frame.src,
|
|
11547
|
+
dst: frame.dst,
|
|
11548
|
+
payload: Uint8Array.from(frame.payload),
|
|
11549
|
+
};
|
|
11551
11550
|
}
|
|
11552
11551
|
/**
|
|
11553
11552
|
* Check if raw data looks like a transport frame
|
|
@@ -11678,43 +11677,64 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
11678
11677
|
return;
|
|
11679
11678
|
}
|
|
11680
11679
|
// Try to unwrap as transport frame
|
|
11681
|
-
const
|
|
11682
|
-
if (
|
|
11683
|
-
//
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11680
|
+
const frame = unwrapTransportFrame(busMessage.payload);
|
|
11681
|
+
if (frame) {
|
|
11682
|
+
// Apply connector's filtering policy: strict dst check, src accepts wildcard
|
|
11683
|
+
const srcMatches = this.remoteNodeId === '*' || frame.src === this.remoteNodeId;
|
|
11684
|
+
const dstMatches = frame.dst === this.localNodeId;
|
|
11685
|
+
if (dstMatches && srcMatches) {
|
|
11686
|
+
// Successfully received and filtered transport frame
|
|
11687
|
+
logger$10.debug('broadcast_channel_transport_frame_received', {
|
|
11688
|
+
channel: this.channelName,
|
|
11689
|
+
sender_id: busMessage.senderId,
|
|
11690
|
+
connector_id: this.connectorId,
|
|
11691
|
+
local_node_id: this.localNodeId,
|
|
11692
|
+
remote_node_id: this.remoteNodeId,
|
|
11693
|
+
frame_src: frame.src,
|
|
11694
|
+
frame_dst: frame.dst,
|
|
11695
|
+
payload_length: frame.payload.byteLength,
|
|
11696
|
+
});
|
|
11697
|
+
const unwrapped = frame.payload;
|
|
11698
|
+
if (this._shouldSkipDuplicateAck(busMessage.senderId, unwrapped)) {
|
|
11699
|
+
return;
|
|
11701
11700
|
}
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
}
|
|
11701
|
+
try {
|
|
11702
|
+
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
11703
|
+
const accepted = this.inbox.tryEnqueue(unwrapped);
|
|
11704
|
+
if (accepted) {
|
|
11705
|
+
return;
|
|
11706
|
+
}
|
|
11707
|
+
}
|
|
11708
|
+
this.inbox.enqueue(unwrapped);
|
|
11709
11709
|
}
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11710
|
+
catch (error) {
|
|
11711
|
+
if (error instanceof QueueFullError) {
|
|
11712
|
+
logger$10.warning('broadcast_channel_receive_queue_full', {
|
|
11713
|
+
channel: this.channelName,
|
|
11714
|
+
});
|
|
11715
|
+
}
|
|
11716
|
+
else {
|
|
11717
|
+
logger$10.error('broadcast_channel_receive_error', {
|
|
11718
|
+
channel: this.channelName,
|
|
11719
|
+
error: error instanceof Error ? error.message : String(error),
|
|
11720
|
+
});
|
|
11721
|
+
}
|
|
11715
11722
|
}
|
|
11723
|
+
return;
|
|
11724
|
+
}
|
|
11725
|
+
else {
|
|
11726
|
+
// Frame filtered out by addressing rules
|
|
11727
|
+
logger$10.debug('broadcast_channel_transport_frame_filtered', {
|
|
11728
|
+
channel: this.channelName,
|
|
11729
|
+
connector_id: this.connectorId,
|
|
11730
|
+
local_node_id: this.localNodeId,
|
|
11731
|
+
remote_node_id: this.remoteNodeId,
|
|
11732
|
+
frame_src: frame.src,
|
|
11733
|
+
frame_dst: frame.dst,
|
|
11734
|
+
reason: !dstMatches ? 'wrong_destination' : 'wrong_source',
|
|
11735
|
+
});
|
|
11736
|
+
return;
|
|
11716
11737
|
}
|
|
11717
|
-
return;
|
|
11718
11738
|
}
|
|
11719
11739
|
// Fall back to legacy format (no transport frame)
|
|
11720
11740
|
const payload = BroadcastChannelConnector.coercePayload(busMessage.payload);
|
|
@@ -21682,40 +21702,61 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
21682
21702
|
return;
|
|
21683
21703
|
}
|
|
21684
21704
|
// Try to unwrap as transport frame
|
|
21685
|
-
const
|
|
21686
|
-
if (
|
|
21687
|
-
//
|
|
21688
|
-
|
|
21689
|
-
|
|
21690
|
-
|
|
21691
|
-
|
|
21692
|
-
|
|
21693
|
-
|
|
21694
|
-
|
|
21695
|
-
|
|
21696
|
-
|
|
21697
|
-
|
|
21698
|
-
|
|
21699
|
-
|
|
21700
|
-
|
|
21705
|
+
const frame = unwrapTransportFrame(busMessage.payload);
|
|
21706
|
+
if (frame) {
|
|
21707
|
+
// Apply connector's filtering policy: strict dst check, src accepts wildcard
|
|
21708
|
+
const srcMatches = this.remoteNodeId === '*' || frame.src === this.remoteNodeId;
|
|
21709
|
+
const dstMatches = frame.dst === this.localNodeId;
|
|
21710
|
+
if (dstMatches && srcMatches) {
|
|
21711
|
+
// Successfully received and filtered transport frame
|
|
21712
|
+
logger$J.debug('inpage_transport_frame_received', {
|
|
21713
|
+
channel: this.channelName,
|
|
21714
|
+
sender_id: busMessage.senderId,
|
|
21715
|
+
connector_id: this.connectorId,
|
|
21716
|
+
local_node_id: this.localNodeId,
|
|
21717
|
+
remote_node_id: this.remoteNodeId,
|
|
21718
|
+
frame_src: frame.src,
|
|
21719
|
+
frame_dst: frame.dst,
|
|
21720
|
+
payload_length: frame.payload.byteLength,
|
|
21721
|
+
});
|
|
21722
|
+
const unwrapped = frame.payload;
|
|
21723
|
+
try {
|
|
21724
|
+
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
21725
|
+
const accepted = this.inbox.tryEnqueue(unwrapped);
|
|
21726
|
+
if (accepted) {
|
|
21727
|
+
return;
|
|
21728
|
+
}
|
|
21701
21729
|
}
|
|
21730
|
+
this.inbox.enqueue(unwrapped);
|
|
21702
21731
|
}
|
|
21703
|
-
|
|
21704
|
-
|
|
21705
|
-
|
|
21706
|
-
|
|
21707
|
-
|
|
21708
|
-
|
|
21709
|
-
|
|
21710
|
-
|
|
21711
|
-
|
|
21712
|
-
|
|
21713
|
-
|
|
21714
|
-
|
|
21715
|
-
});
|
|
21732
|
+
catch (error) {
|
|
21733
|
+
if (error instanceof QueueFullError) {
|
|
21734
|
+
logger$J.warning('inpage_receive_queue_full', {
|
|
21735
|
+
channel: this.channelName,
|
|
21736
|
+
});
|
|
21737
|
+
}
|
|
21738
|
+
else {
|
|
21739
|
+
logger$J.error('inpage_receive_error', {
|
|
21740
|
+
channel: this.channelName,
|
|
21741
|
+
error: error instanceof Error ? error.message : String(error),
|
|
21742
|
+
});
|
|
21743
|
+
}
|
|
21716
21744
|
}
|
|
21745
|
+
return;
|
|
21746
|
+
}
|
|
21747
|
+
else {
|
|
21748
|
+
// Frame filtered out by addressing rules
|
|
21749
|
+
logger$J.debug('inpage_transport_frame_filtered', {
|
|
21750
|
+
channel: this.channelName,
|
|
21751
|
+
connector_id: this.connectorId,
|
|
21752
|
+
local_node_id: this.localNodeId,
|
|
21753
|
+
remote_node_id: this.remoteNodeId,
|
|
21754
|
+
frame_src: frame.src,
|
|
21755
|
+
frame_dst: frame.dst,
|
|
21756
|
+
reason: !dstMatches ? 'wrong_destination' : 'wrong_source',
|
|
21757
|
+
});
|
|
21758
|
+
return;
|
|
21717
21759
|
}
|
|
21718
|
-
return;
|
|
21719
21760
|
}
|
|
21720
21761
|
// Fall back to legacy format (no transport frame)
|
|
21721
21762
|
const payload = InPageConnector.coercePayload(busMessage.payload);
|
|
@@ -32897,41 +32938,44 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
32897
32938
|
if (typeof senderId !== 'string' || senderId.length === 0) {
|
|
32898
32939
|
return null;
|
|
32899
32940
|
}
|
|
32900
|
-
|
|
32901
|
-
|
|
32902
|
-
|
|
32903
|
-
|
|
32904
|
-
|
|
32905
|
-
|
|
32906
|
-
|
|
32907
|
-
|
|
32908
|
-
|
|
32909
|
-
|
|
32910
|
-
|
|
32911
|
-
|
|
32912
|
-
|
|
32913
|
-
|
|
32914
|
-
|
|
32915
|
-
|
|
32916
|
-
|
|
32917
|
-
|
|
32918
|
-
|
|
32919
|
-
|
|
32920
|
-
|
|
32921
|
-
|
|
32922
|
-
|
|
32923
|
-
|
|
32924
|
-
|
|
32925
|
-
}
|
|
32926
|
-
}
|
|
32941
|
+
// Check if payload is a transport frame object first
|
|
32942
|
+
let envelopePayload = null;
|
|
32943
|
+
if (this._routingNode && record.payload && typeof record.payload === 'object') {
|
|
32944
|
+
// Try to unwrap as transport frame
|
|
32945
|
+
const frame = unwrapTransportFrame(record.payload);
|
|
32946
|
+
if (frame) {
|
|
32947
|
+
// Apply listener's filtering policy: accept frames addressed to us OR with wildcard destination
|
|
32948
|
+
// Wildcard is needed because downstream nodes don't know the sentinel's ID during initial attach
|
|
32949
|
+
const isAddressedToUs = frame.dst === this._routingNode.id || frame.dst === '*';
|
|
32950
|
+
if (isAddressedToUs) {
|
|
32951
|
+
envelopePayload = frame.payload;
|
|
32952
|
+
logger$n.debug('broadcast_channel_listener_unwrapped_transport_frame', {
|
|
32953
|
+
sender_id: senderId,
|
|
32954
|
+
src: frame.src,
|
|
32955
|
+
dst: frame.dst,
|
|
32956
|
+
});
|
|
32957
|
+
}
|
|
32958
|
+
else {
|
|
32959
|
+
// Frame addressed to a different node, ignore it
|
|
32960
|
+
logger$n.debug('broadcast_channel_listener_ignored_frame_wrong_destination', {
|
|
32961
|
+
sender_id: senderId,
|
|
32962
|
+
dst: frame.dst,
|
|
32963
|
+
expected: this._routingNode.id,
|
|
32964
|
+
});
|
|
32965
|
+
return null;
|
|
32927
32966
|
}
|
|
32928
32967
|
}
|
|
32929
|
-
|
|
32930
|
-
|
|
32968
|
+
}
|
|
32969
|
+
// If not a transport frame, try to coerce as legacy format
|
|
32970
|
+
if (!envelopePayload) {
|
|
32971
|
+
envelopePayload = coercePayload(record.payload);
|
|
32972
|
+
if (!envelopePayload) {
|
|
32973
|
+
logger$n.debug('broadcast_channel_listener_ignored_event_without_payload', {
|
|
32974
|
+
sender_id: senderId,
|
|
32975
|
+
});
|
|
32976
|
+
return null;
|
|
32931
32977
|
}
|
|
32932
32978
|
}
|
|
32933
|
-
// Use unwrapped payload if available, otherwise use raw payload
|
|
32934
|
-
const envelopePayload = unwrapped ?? payload;
|
|
32935
32979
|
let envelope;
|
|
32936
32980
|
try {
|
|
32937
32981
|
const decoded = new TextDecoder().decode(envelopePayload);
|
|
@@ -32941,7 +32985,7 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
32941
32985
|
catch (error) {
|
|
32942
32986
|
const decoded = (() => {
|
|
32943
32987
|
try {
|
|
32944
|
-
return new TextDecoder().decode(
|
|
32988
|
+
return new TextDecoder().decode(envelopePayload);
|
|
32945
32989
|
}
|
|
32946
32990
|
catch {
|
|
32947
32991
|
return null;
|