@naylence/runtime 0.3.5-test.949 → 0.3.5-test.951
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 +154 -84
- package/dist/browser/index.mjs +154 -84
- package/dist/cjs/naylence/fame/connector/broadcast-channel-connector.browser.js +54 -33
- package/dist/cjs/naylence/fame/connector/broadcast-channel-listener.js +38 -8
- 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 +38 -8
- 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 +154 -84
- package/dist/node/index.mjs +154 -84
- package/dist/node/node.cjs +154 -84
- package/dist/node/node.mjs +154 -84
- 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/browser/index.cjs
CHANGED
|
@@ -98,12 +98,12 @@ installProcessEnvShim();
|
|
|
98
98
|
// --- END ENV SHIM ---
|
|
99
99
|
|
|
100
100
|
// This file is auto-generated during build - do not edit manually
|
|
101
|
-
// Generated from package.json version: 0.3.5-test.
|
|
101
|
+
// Generated from package.json version: 0.3.5-test.951
|
|
102
102
|
/**
|
|
103
103
|
* The package version, injected at build time.
|
|
104
104
|
* @internal
|
|
105
105
|
*/
|
|
106
|
-
const VERSION = '0.3.5-test.
|
|
106
|
+
const VERSION = '0.3.5-test.951';
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -9864,14 +9864,12 @@ function serializeTransportFrame(frame) {
|
|
|
9864
9864
|
return serializable;
|
|
9865
9865
|
}
|
|
9866
9866
|
/**
|
|
9867
|
-
* Unwrap a transport frame
|
|
9867
|
+
* Unwrap a transport frame (pure deserializer - no filtering)
|
|
9868
9868
|
*
|
|
9869
9869
|
* @param raw - Raw data from the bus
|
|
9870
|
-
* @
|
|
9871
|
-
* @param remoteNodeId - Expected remote node ID
|
|
9872
|
-
* @returns Unwrapped payload if frame is valid and addressed to us, null otherwise
|
|
9870
|
+
* @returns Unwrapped frame with payload as Uint8Array, or null if invalid structure
|
|
9873
9871
|
*/
|
|
9874
|
-
function unwrapTransportFrame(raw
|
|
9872
|
+
function unwrapTransportFrame(raw) {
|
|
9875
9873
|
// Validate basic structure
|
|
9876
9874
|
if (!raw || typeof raw !== 'object') {
|
|
9877
9875
|
return null;
|
|
@@ -9885,16 +9883,17 @@ function unwrapTransportFrame(raw, localNodeId, remoteNodeId) {
|
|
|
9885
9883
|
if (typeof frame.src !== 'string' || typeof frame.dst !== 'string') {
|
|
9886
9884
|
return null;
|
|
9887
9885
|
}
|
|
9888
|
-
// Only accept frames addressed to us from the expected remote
|
|
9889
|
-
if (frame.dst !== localNodeId || frame.src !== remoteNodeId) {
|
|
9890
|
-
return null;
|
|
9891
|
-
}
|
|
9892
9886
|
// Extract payload
|
|
9893
9887
|
if (!frame.payload || !Array.isArray(frame.payload)) {
|
|
9894
9888
|
return null;
|
|
9895
9889
|
}
|
|
9896
|
-
// Convert array back to Uint8Array
|
|
9897
|
-
return
|
|
9890
|
+
// Convert array back to Uint8Array and return full frame
|
|
9891
|
+
return {
|
|
9892
|
+
v: frame.v,
|
|
9893
|
+
src: frame.src,
|
|
9894
|
+
dst: frame.dst,
|
|
9895
|
+
payload: Uint8Array.from(frame.payload),
|
|
9896
|
+
};
|
|
9898
9897
|
}
|
|
9899
9898
|
|
|
9900
9899
|
const logger$_ = getLogger('naylence.fame.connector.broadcast_channel_connector');
|
|
@@ -10009,43 +10008,64 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10009
10008
|
return;
|
|
10010
10009
|
}
|
|
10011
10010
|
// Try to unwrap as transport frame
|
|
10012
|
-
const
|
|
10013
|
-
if (
|
|
10014
|
-
//
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10011
|
+
const frame = unwrapTransportFrame(busMessage.payload);
|
|
10012
|
+
if (frame) {
|
|
10013
|
+
// Apply connector's filtering policy: strict dst check, src accepts wildcard
|
|
10014
|
+
const srcMatches = this.remoteNodeId === '*' || frame.src === this.remoteNodeId;
|
|
10015
|
+
const dstMatches = frame.dst === this.localNodeId;
|
|
10016
|
+
if (dstMatches && srcMatches) {
|
|
10017
|
+
// Successfully received and filtered transport frame
|
|
10018
|
+
logger$_.debug('broadcast_channel_transport_frame_received', {
|
|
10019
|
+
channel: this.channelName,
|
|
10020
|
+
sender_id: busMessage.senderId,
|
|
10021
|
+
connector_id: this.connectorId,
|
|
10022
|
+
local_node_id: this.localNodeId,
|
|
10023
|
+
remote_node_id: this.remoteNodeId,
|
|
10024
|
+
frame_src: frame.src,
|
|
10025
|
+
frame_dst: frame.dst,
|
|
10026
|
+
payload_length: frame.payload.byteLength,
|
|
10027
|
+
});
|
|
10028
|
+
const unwrapped = frame.payload;
|
|
10029
|
+
if (this._shouldSkipDuplicateAck(busMessage.senderId, unwrapped)) {
|
|
10030
|
+
return;
|
|
10032
10031
|
}
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
}
|
|
10032
|
+
try {
|
|
10033
|
+
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
10034
|
+
const accepted = this.inbox.tryEnqueue(unwrapped);
|
|
10035
|
+
if (accepted) {
|
|
10036
|
+
return;
|
|
10037
|
+
}
|
|
10038
|
+
}
|
|
10039
|
+
this.inbox.enqueue(unwrapped);
|
|
10040
10040
|
}
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10041
|
+
catch (error) {
|
|
10042
|
+
if (error instanceof QueueFullError) {
|
|
10043
|
+
logger$_.warning('broadcast_channel_receive_queue_full', {
|
|
10044
|
+
channel: this.channelName,
|
|
10045
|
+
});
|
|
10046
|
+
}
|
|
10047
|
+
else {
|
|
10048
|
+
logger$_.error('broadcast_channel_receive_error', {
|
|
10049
|
+
channel: this.channelName,
|
|
10050
|
+
error: error instanceof Error ? error.message : String(error),
|
|
10051
|
+
});
|
|
10052
|
+
}
|
|
10046
10053
|
}
|
|
10054
|
+
return;
|
|
10055
|
+
}
|
|
10056
|
+
else {
|
|
10057
|
+
// Frame filtered out by addressing rules
|
|
10058
|
+
logger$_.debug('broadcast_channel_transport_frame_filtered', {
|
|
10059
|
+
channel: this.channelName,
|
|
10060
|
+
connector_id: this.connectorId,
|
|
10061
|
+
local_node_id: this.localNodeId,
|
|
10062
|
+
remote_node_id: this.remoteNodeId,
|
|
10063
|
+
frame_src: frame.src,
|
|
10064
|
+
frame_dst: frame.dst,
|
|
10065
|
+
reason: !dstMatches ? 'wrong_destination' : 'wrong_source',
|
|
10066
|
+
});
|
|
10067
|
+
return;
|
|
10047
10068
|
}
|
|
10048
|
-
return;
|
|
10049
10069
|
}
|
|
10050
10070
|
// Fall back to legacy format (no transport frame)
|
|
10051
10071
|
const payload = BroadcastChannelConnector.coercePayload(busMessage.payload);
|
|
@@ -20572,40 +20592,61 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20572
20592
|
return;
|
|
20573
20593
|
}
|
|
20574
20594
|
// Try to unwrap as transport frame
|
|
20575
|
-
const
|
|
20576
|
-
if (
|
|
20577
|
-
//
|
|
20578
|
-
|
|
20579
|
-
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
|
|
20585
|
-
|
|
20586
|
-
|
|
20587
|
-
|
|
20588
|
-
|
|
20589
|
-
|
|
20590
|
-
|
|
20595
|
+
const frame = unwrapTransportFrame(busMessage.payload);
|
|
20596
|
+
if (frame) {
|
|
20597
|
+
// Apply connector's filtering policy: strict dst check, src accepts wildcard
|
|
20598
|
+
const srcMatches = this.remoteNodeId === '*' || frame.src === this.remoteNodeId;
|
|
20599
|
+
const dstMatches = frame.dst === this.localNodeId;
|
|
20600
|
+
if (dstMatches && srcMatches) {
|
|
20601
|
+
// Successfully received and filtered transport frame
|
|
20602
|
+
logger$G.debug('inpage_transport_frame_received', {
|
|
20603
|
+
channel: this.channelName,
|
|
20604
|
+
sender_id: busMessage.senderId,
|
|
20605
|
+
connector_id: this.connectorId,
|
|
20606
|
+
local_node_id: this.localNodeId,
|
|
20607
|
+
remote_node_id: this.remoteNodeId,
|
|
20608
|
+
frame_src: frame.src,
|
|
20609
|
+
frame_dst: frame.dst,
|
|
20610
|
+
payload_length: frame.payload.byteLength,
|
|
20611
|
+
});
|
|
20612
|
+
const unwrapped = frame.payload;
|
|
20613
|
+
try {
|
|
20614
|
+
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
20615
|
+
const accepted = this.inbox.tryEnqueue(unwrapped);
|
|
20616
|
+
if (accepted) {
|
|
20617
|
+
return;
|
|
20618
|
+
}
|
|
20591
20619
|
}
|
|
20620
|
+
this.inbox.enqueue(unwrapped);
|
|
20592
20621
|
}
|
|
20593
|
-
|
|
20594
|
-
|
|
20595
|
-
|
|
20596
|
-
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
|
|
20603
|
-
|
|
20604
|
-
|
|
20605
|
-
});
|
|
20622
|
+
catch (error) {
|
|
20623
|
+
if (error instanceof QueueFullError) {
|
|
20624
|
+
logger$G.warning('inpage_receive_queue_full', {
|
|
20625
|
+
channel: this.channelName,
|
|
20626
|
+
});
|
|
20627
|
+
}
|
|
20628
|
+
else {
|
|
20629
|
+
logger$G.error('inpage_receive_error', {
|
|
20630
|
+
channel: this.channelName,
|
|
20631
|
+
error: error instanceof Error ? error.message : String(error),
|
|
20632
|
+
});
|
|
20633
|
+
}
|
|
20606
20634
|
}
|
|
20635
|
+
return;
|
|
20636
|
+
}
|
|
20637
|
+
else {
|
|
20638
|
+
// Frame filtered out by addressing rules
|
|
20639
|
+
logger$G.debug('inpage_transport_frame_filtered', {
|
|
20640
|
+
channel: this.channelName,
|
|
20641
|
+
connector_id: this.connectorId,
|
|
20642
|
+
local_node_id: this.localNodeId,
|
|
20643
|
+
remote_node_id: this.remoteNodeId,
|
|
20644
|
+
frame_src: frame.src,
|
|
20645
|
+
frame_dst: frame.dst,
|
|
20646
|
+
reason: !dstMatches ? 'wrong_destination' : 'wrong_source',
|
|
20647
|
+
});
|
|
20648
|
+
return;
|
|
20607
20649
|
}
|
|
20608
|
-
return;
|
|
20609
20650
|
}
|
|
20610
20651
|
// Fall back to legacy format (no transport frame)
|
|
20611
20652
|
const payload = InPageConnector.coercePayload(busMessage.payload);
|
|
@@ -30140,23 +30181,52 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
30140
30181
|
if (typeof senderId !== 'string' || senderId.length === 0) {
|
|
30141
30182
|
return null;
|
|
30142
30183
|
}
|
|
30143
|
-
|
|
30144
|
-
|
|
30145
|
-
|
|
30146
|
-
|
|
30147
|
-
|
|
30148
|
-
|
|
30184
|
+
// Check if payload is a transport frame object first
|
|
30185
|
+
let envelopePayload = null;
|
|
30186
|
+
if (this._routingNode && record.payload && typeof record.payload === 'object') {
|
|
30187
|
+
// Try to unwrap as transport frame
|
|
30188
|
+
const frame = unwrapTransportFrame(record.payload);
|
|
30189
|
+
if (frame) {
|
|
30190
|
+
// Apply listener's filtering policy: dst must match, src can be anything
|
|
30191
|
+
if (frame.dst === this._routingNode.id) {
|
|
30192
|
+
envelopePayload = frame.payload;
|
|
30193
|
+
logger$o.debug('broadcast_channel_listener_unwrapped_transport_frame', {
|
|
30194
|
+
sender_id: senderId,
|
|
30195
|
+
src: frame.src,
|
|
30196
|
+
dst: frame.dst,
|
|
30197
|
+
});
|
|
30198
|
+
}
|
|
30199
|
+
else {
|
|
30200
|
+
// Frame not addressed to us, ignore it
|
|
30201
|
+
logger$o.debug('broadcast_channel_listener_ignored_frame_wrong_destination', {
|
|
30202
|
+
sender_id: senderId,
|
|
30203
|
+
dst: frame.dst,
|
|
30204
|
+
expected: this._routingNode.id,
|
|
30205
|
+
});
|
|
30206
|
+
return null;
|
|
30207
|
+
}
|
|
30208
|
+
}
|
|
30209
|
+
}
|
|
30210
|
+
// If not a transport frame, try to coerce as legacy format
|
|
30211
|
+
if (!envelopePayload) {
|
|
30212
|
+
envelopePayload = coercePayload(record.payload);
|
|
30213
|
+
if (!envelopePayload) {
|
|
30214
|
+
logger$o.debug('broadcast_channel_listener_ignored_event_without_payload', {
|
|
30215
|
+
sender_id: senderId,
|
|
30216
|
+
});
|
|
30217
|
+
return null;
|
|
30218
|
+
}
|
|
30149
30219
|
}
|
|
30150
30220
|
let envelope;
|
|
30151
30221
|
try {
|
|
30152
|
-
const decoded = new TextDecoder().decode(
|
|
30222
|
+
const decoded = new TextDecoder().decode(envelopePayload);
|
|
30153
30223
|
const parsed = JSON.parse(decoded);
|
|
30154
30224
|
envelope = core.deserializeEnvelope(parsed);
|
|
30155
30225
|
}
|
|
30156
30226
|
catch (error) {
|
|
30157
30227
|
const decoded = (() => {
|
|
30158
30228
|
try {
|
|
30159
|
-
return new TextDecoder().decode(
|
|
30229
|
+
return new TextDecoder().decode(envelopePayload);
|
|
30160
30230
|
}
|
|
30161
30231
|
catch {
|
|
30162
30232
|
return null;
|
package/dist/browser/index.mjs
CHANGED
|
@@ -96,12 +96,12 @@ installProcessEnvShim();
|
|
|
96
96
|
// --- END ENV SHIM ---
|
|
97
97
|
|
|
98
98
|
// This file is auto-generated during build - do not edit manually
|
|
99
|
-
// Generated from package.json version: 0.3.5-test.
|
|
99
|
+
// Generated from package.json version: 0.3.5-test.951
|
|
100
100
|
/**
|
|
101
101
|
* The package version, injected at build time.
|
|
102
102
|
* @internal
|
|
103
103
|
*/
|
|
104
|
-
const VERSION = '0.3.5-test.
|
|
104
|
+
const VERSION = '0.3.5-test.951';
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -9862,14 +9862,12 @@ function serializeTransportFrame(frame) {
|
|
|
9862
9862
|
return serializable;
|
|
9863
9863
|
}
|
|
9864
9864
|
/**
|
|
9865
|
-
* Unwrap a transport frame
|
|
9865
|
+
* Unwrap a transport frame (pure deserializer - no filtering)
|
|
9866
9866
|
*
|
|
9867
9867
|
* @param raw - Raw data from the bus
|
|
9868
|
-
* @
|
|
9869
|
-
* @param remoteNodeId - Expected remote node ID
|
|
9870
|
-
* @returns Unwrapped payload if frame is valid and addressed to us, null otherwise
|
|
9868
|
+
* @returns Unwrapped frame with payload as Uint8Array, or null if invalid structure
|
|
9871
9869
|
*/
|
|
9872
|
-
function unwrapTransportFrame(raw
|
|
9870
|
+
function unwrapTransportFrame(raw) {
|
|
9873
9871
|
// Validate basic structure
|
|
9874
9872
|
if (!raw || typeof raw !== 'object') {
|
|
9875
9873
|
return null;
|
|
@@ -9883,16 +9881,17 @@ function unwrapTransportFrame(raw, localNodeId, remoteNodeId) {
|
|
|
9883
9881
|
if (typeof frame.src !== 'string' || typeof frame.dst !== 'string') {
|
|
9884
9882
|
return null;
|
|
9885
9883
|
}
|
|
9886
|
-
// Only accept frames addressed to us from the expected remote
|
|
9887
|
-
if (frame.dst !== localNodeId || frame.src !== remoteNodeId) {
|
|
9888
|
-
return null;
|
|
9889
|
-
}
|
|
9890
9884
|
// Extract payload
|
|
9891
9885
|
if (!frame.payload || !Array.isArray(frame.payload)) {
|
|
9892
9886
|
return null;
|
|
9893
9887
|
}
|
|
9894
|
-
// Convert array back to Uint8Array
|
|
9895
|
-
return
|
|
9888
|
+
// Convert array back to Uint8Array and return full frame
|
|
9889
|
+
return {
|
|
9890
|
+
v: frame.v,
|
|
9891
|
+
src: frame.src,
|
|
9892
|
+
dst: frame.dst,
|
|
9893
|
+
payload: Uint8Array.from(frame.payload),
|
|
9894
|
+
};
|
|
9896
9895
|
}
|
|
9897
9896
|
|
|
9898
9897
|
const logger$_ = getLogger('naylence.fame.connector.broadcast_channel_connector');
|
|
@@ -10007,43 +10006,64 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
|
|
|
10007
10006
|
return;
|
|
10008
10007
|
}
|
|
10009
10008
|
// Try to unwrap as transport frame
|
|
10010
|
-
const
|
|
10011
|
-
if (
|
|
10012
|
-
//
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10009
|
+
const frame = unwrapTransportFrame(busMessage.payload);
|
|
10010
|
+
if (frame) {
|
|
10011
|
+
// Apply connector's filtering policy: strict dst check, src accepts wildcard
|
|
10012
|
+
const srcMatches = this.remoteNodeId === '*' || frame.src === this.remoteNodeId;
|
|
10013
|
+
const dstMatches = frame.dst === this.localNodeId;
|
|
10014
|
+
if (dstMatches && srcMatches) {
|
|
10015
|
+
// Successfully received and filtered transport frame
|
|
10016
|
+
logger$_.debug('broadcast_channel_transport_frame_received', {
|
|
10017
|
+
channel: this.channelName,
|
|
10018
|
+
sender_id: busMessage.senderId,
|
|
10019
|
+
connector_id: this.connectorId,
|
|
10020
|
+
local_node_id: this.localNodeId,
|
|
10021
|
+
remote_node_id: this.remoteNodeId,
|
|
10022
|
+
frame_src: frame.src,
|
|
10023
|
+
frame_dst: frame.dst,
|
|
10024
|
+
payload_length: frame.payload.byteLength,
|
|
10025
|
+
});
|
|
10026
|
+
const unwrapped = frame.payload;
|
|
10027
|
+
if (this._shouldSkipDuplicateAck(busMessage.senderId, unwrapped)) {
|
|
10028
|
+
return;
|
|
10030
10029
|
}
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
}
|
|
10030
|
+
try {
|
|
10031
|
+
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
10032
|
+
const accepted = this.inbox.tryEnqueue(unwrapped);
|
|
10033
|
+
if (accepted) {
|
|
10034
|
+
return;
|
|
10035
|
+
}
|
|
10036
|
+
}
|
|
10037
|
+
this.inbox.enqueue(unwrapped);
|
|
10038
10038
|
}
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10039
|
+
catch (error) {
|
|
10040
|
+
if (error instanceof QueueFullError) {
|
|
10041
|
+
logger$_.warning('broadcast_channel_receive_queue_full', {
|
|
10042
|
+
channel: this.channelName,
|
|
10043
|
+
});
|
|
10044
|
+
}
|
|
10045
|
+
else {
|
|
10046
|
+
logger$_.error('broadcast_channel_receive_error', {
|
|
10047
|
+
channel: this.channelName,
|
|
10048
|
+
error: error instanceof Error ? error.message : String(error),
|
|
10049
|
+
});
|
|
10050
|
+
}
|
|
10044
10051
|
}
|
|
10052
|
+
return;
|
|
10053
|
+
}
|
|
10054
|
+
else {
|
|
10055
|
+
// Frame filtered out by addressing rules
|
|
10056
|
+
logger$_.debug('broadcast_channel_transport_frame_filtered', {
|
|
10057
|
+
channel: this.channelName,
|
|
10058
|
+
connector_id: this.connectorId,
|
|
10059
|
+
local_node_id: this.localNodeId,
|
|
10060
|
+
remote_node_id: this.remoteNodeId,
|
|
10061
|
+
frame_src: frame.src,
|
|
10062
|
+
frame_dst: frame.dst,
|
|
10063
|
+
reason: !dstMatches ? 'wrong_destination' : 'wrong_source',
|
|
10064
|
+
});
|
|
10065
|
+
return;
|
|
10045
10066
|
}
|
|
10046
|
-
return;
|
|
10047
10067
|
}
|
|
10048
10068
|
// Fall back to legacy format (no transport frame)
|
|
10049
10069
|
const payload = BroadcastChannelConnector.coercePayload(busMessage.payload);
|
|
@@ -20570,40 +20590,61 @@ class InPageConnector extends BaseAsyncConnector {
|
|
|
20570
20590
|
return;
|
|
20571
20591
|
}
|
|
20572
20592
|
// Try to unwrap as transport frame
|
|
20573
|
-
const
|
|
20574
|
-
if (
|
|
20575
|
-
//
|
|
20576
|
-
|
|
20577
|
-
|
|
20578
|
-
|
|
20579
|
-
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
|
|
20585
|
-
|
|
20586
|
-
|
|
20587
|
-
|
|
20588
|
-
|
|
20593
|
+
const frame = unwrapTransportFrame(busMessage.payload);
|
|
20594
|
+
if (frame) {
|
|
20595
|
+
// Apply connector's filtering policy: strict dst check, src accepts wildcard
|
|
20596
|
+
const srcMatches = this.remoteNodeId === '*' || frame.src === this.remoteNodeId;
|
|
20597
|
+
const dstMatches = frame.dst === this.localNodeId;
|
|
20598
|
+
if (dstMatches && srcMatches) {
|
|
20599
|
+
// Successfully received and filtered transport frame
|
|
20600
|
+
logger$G.debug('inpage_transport_frame_received', {
|
|
20601
|
+
channel: this.channelName,
|
|
20602
|
+
sender_id: busMessage.senderId,
|
|
20603
|
+
connector_id: this.connectorId,
|
|
20604
|
+
local_node_id: this.localNodeId,
|
|
20605
|
+
remote_node_id: this.remoteNodeId,
|
|
20606
|
+
frame_src: frame.src,
|
|
20607
|
+
frame_dst: frame.dst,
|
|
20608
|
+
payload_length: frame.payload.byteLength,
|
|
20609
|
+
});
|
|
20610
|
+
const unwrapped = frame.payload;
|
|
20611
|
+
try {
|
|
20612
|
+
if (typeof this.inbox.tryEnqueue === 'function') {
|
|
20613
|
+
const accepted = this.inbox.tryEnqueue(unwrapped);
|
|
20614
|
+
if (accepted) {
|
|
20615
|
+
return;
|
|
20616
|
+
}
|
|
20589
20617
|
}
|
|
20618
|
+
this.inbox.enqueue(unwrapped);
|
|
20590
20619
|
}
|
|
20591
|
-
|
|
20592
|
-
|
|
20593
|
-
|
|
20594
|
-
|
|
20595
|
-
|
|
20596
|
-
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
|
|
20603
|
-
});
|
|
20620
|
+
catch (error) {
|
|
20621
|
+
if (error instanceof QueueFullError) {
|
|
20622
|
+
logger$G.warning('inpage_receive_queue_full', {
|
|
20623
|
+
channel: this.channelName,
|
|
20624
|
+
});
|
|
20625
|
+
}
|
|
20626
|
+
else {
|
|
20627
|
+
logger$G.error('inpage_receive_error', {
|
|
20628
|
+
channel: this.channelName,
|
|
20629
|
+
error: error instanceof Error ? error.message : String(error),
|
|
20630
|
+
});
|
|
20631
|
+
}
|
|
20604
20632
|
}
|
|
20633
|
+
return;
|
|
20634
|
+
}
|
|
20635
|
+
else {
|
|
20636
|
+
// Frame filtered out by addressing rules
|
|
20637
|
+
logger$G.debug('inpage_transport_frame_filtered', {
|
|
20638
|
+
channel: this.channelName,
|
|
20639
|
+
connector_id: this.connectorId,
|
|
20640
|
+
local_node_id: this.localNodeId,
|
|
20641
|
+
remote_node_id: this.remoteNodeId,
|
|
20642
|
+
frame_src: frame.src,
|
|
20643
|
+
frame_dst: frame.dst,
|
|
20644
|
+
reason: !dstMatches ? 'wrong_destination' : 'wrong_source',
|
|
20645
|
+
});
|
|
20646
|
+
return;
|
|
20605
20647
|
}
|
|
20606
|
-
return;
|
|
20607
20648
|
}
|
|
20608
20649
|
// Fall back to legacy format (no transport frame)
|
|
20609
20650
|
const payload = InPageConnector.coercePayload(busMessage.payload);
|
|
@@ -30138,23 +30179,52 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
30138
30179
|
if (typeof senderId !== 'string' || senderId.length === 0) {
|
|
30139
30180
|
return null;
|
|
30140
30181
|
}
|
|
30141
|
-
|
|
30142
|
-
|
|
30143
|
-
|
|
30144
|
-
|
|
30145
|
-
|
|
30146
|
-
|
|
30182
|
+
// Check if payload is a transport frame object first
|
|
30183
|
+
let envelopePayload = null;
|
|
30184
|
+
if (this._routingNode && record.payload && typeof record.payload === 'object') {
|
|
30185
|
+
// Try to unwrap as transport frame
|
|
30186
|
+
const frame = unwrapTransportFrame(record.payload);
|
|
30187
|
+
if (frame) {
|
|
30188
|
+
// Apply listener's filtering policy: dst must match, src can be anything
|
|
30189
|
+
if (frame.dst === this._routingNode.id) {
|
|
30190
|
+
envelopePayload = frame.payload;
|
|
30191
|
+
logger$o.debug('broadcast_channel_listener_unwrapped_transport_frame', {
|
|
30192
|
+
sender_id: senderId,
|
|
30193
|
+
src: frame.src,
|
|
30194
|
+
dst: frame.dst,
|
|
30195
|
+
});
|
|
30196
|
+
}
|
|
30197
|
+
else {
|
|
30198
|
+
// Frame not addressed to us, ignore it
|
|
30199
|
+
logger$o.debug('broadcast_channel_listener_ignored_frame_wrong_destination', {
|
|
30200
|
+
sender_id: senderId,
|
|
30201
|
+
dst: frame.dst,
|
|
30202
|
+
expected: this._routingNode.id,
|
|
30203
|
+
});
|
|
30204
|
+
return null;
|
|
30205
|
+
}
|
|
30206
|
+
}
|
|
30207
|
+
}
|
|
30208
|
+
// If not a transport frame, try to coerce as legacy format
|
|
30209
|
+
if (!envelopePayload) {
|
|
30210
|
+
envelopePayload = coercePayload(record.payload);
|
|
30211
|
+
if (!envelopePayload) {
|
|
30212
|
+
logger$o.debug('broadcast_channel_listener_ignored_event_without_payload', {
|
|
30213
|
+
sender_id: senderId,
|
|
30214
|
+
});
|
|
30215
|
+
return null;
|
|
30216
|
+
}
|
|
30147
30217
|
}
|
|
30148
30218
|
let envelope;
|
|
30149
30219
|
try {
|
|
30150
|
-
const decoded = new TextDecoder().decode(
|
|
30220
|
+
const decoded = new TextDecoder().decode(envelopePayload);
|
|
30151
30221
|
const parsed = JSON.parse(decoded);
|
|
30152
30222
|
envelope = deserializeEnvelope(parsed);
|
|
30153
30223
|
}
|
|
30154
30224
|
catch (error) {
|
|
30155
30225
|
const decoded = (() => {
|
|
30156
30226
|
try {
|
|
30157
|
-
return new TextDecoder().decode(
|
|
30227
|
+
return new TextDecoder().decode(envelopePayload);
|
|
30158
30228
|
}
|
|
30159
30229
|
catch {
|
|
30160
30230
|
return null;
|