@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/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.952
|
|
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.952';
|
|
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,41 +30181,44 @@ 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
|
-
|
|
30149
|
-
|
|
30150
|
-
|
|
30151
|
-
|
|
30152
|
-
|
|
30153
|
-
|
|
30154
|
-
|
|
30155
|
-
|
|
30156
|
-
|
|
30157
|
-
|
|
30158
|
-
|
|
30159
|
-
|
|
30160
|
-
|
|
30161
|
-
|
|
30162
|
-
|
|
30163
|
-
|
|
30164
|
-
|
|
30165
|
-
|
|
30166
|
-
|
|
30167
|
-
|
|
30168
|
-
}
|
|
30169
|
-
}
|
|
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: accept frames addressed to us OR with wildcard destination
|
|
30191
|
+
// Wildcard is needed because downstream nodes don't know the sentinel's ID during initial attach
|
|
30192
|
+
const isAddressedToUs = frame.dst === this._routingNode.id || frame.dst === '*';
|
|
30193
|
+
if (isAddressedToUs) {
|
|
30194
|
+
envelopePayload = frame.payload;
|
|
30195
|
+
logger$o.debug('broadcast_channel_listener_unwrapped_transport_frame', {
|
|
30196
|
+
sender_id: senderId,
|
|
30197
|
+
src: frame.src,
|
|
30198
|
+
dst: frame.dst,
|
|
30199
|
+
});
|
|
30200
|
+
}
|
|
30201
|
+
else {
|
|
30202
|
+
// Frame addressed to a different node, ignore it
|
|
30203
|
+
logger$o.debug('broadcast_channel_listener_ignored_frame_wrong_destination', {
|
|
30204
|
+
sender_id: senderId,
|
|
30205
|
+
dst: frame.dst,
|
|
30206
|
+
expected: this._routingNode.id,
|
|
30207
|
+
});
|
|
30208
|
+
return null;
|
|
30170
30209
|
}
|
|
30171
30210
|
}
|
|
30172
|
-
|
|
30173
|
-
|
|
30211
|
+
}
|
|
30212
|
+
// If not a transport frame, try to coerce as legacy format
|
|
30213
|
+
if (!envelopePayload) {
|
|
30214
|
+
envelopePayload = coercePayload(record.payload);
|
|
30215
|
+
if (!envelopePayload) {
|
|
30216
|
+
logger$o.debug('broadcast_channel_listener_ignored_event_without_payload', {
|
|
30217
|
+
sender_id: senderId,
|
|
30218
|
+
});
|
|
30219
|
+
return null;
|
|
30174
30220
|
}
|
|
30175
30221
|
}
|
|
30176
|
-
// Use unwrapped payload if available, otherwise use raw payload
|
|
30177
|
-
const envelopePayload = unwrapped ?? payload;
|
|
30178
30222
|
let envelope;
|
|
30179
30223
|
try {
|
|
30180
30224
|
const decoded = new TextDecoder().decode(envelopePayload);
|
|
@@ -30184,7 +30228,7 @@ class BroadcastChannelListener extends TransportListener {
|
|
|
30184
30228
|
catch (error) {
|
|
30185
30229
|
const decoded = (() => {
|
|
30186
30230
|
try {
|
|
30187
|
-
return new TextDecoder().decode(
|
|
30231
|
+
return new TextDecoder().decode(envelopePayload);
|
|
30188
30232
|
}
|
|
30189
30233
|
catch {
|
|
30190
30234
|
return null;
|