@naylence/runtime 0.3.5-test.966 → 0.3.5-test.967

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.
@@ -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.5-test.966
5565
+ // Generated from package.json version: 0.3.5-test.967
5566
5566
  /**
5567
5567
  * The package version, injected at build time.
5568
5568
  * @internal
5569
5569
  */
5570
- const VERSION = '0.3.5-test.966';
5570
+ const VERSION = '0.3.5-test.967';
5571
5571
 
5572
5572
  /**
5573
5573
  * Fame errors module - Fame protocol specific error classes
@@ -21611,6 +21611,26 @@ class InPageConnector extends BaseAsyncConnector {
21611
21611
  }
21612
21612
  return null;
21613
21613
  }
21614
+ static normalizeNodeId(value) {
21615
+ if (typeof value !== 'string') {
21616
+ return null;
21617
+ }
21618
+ const trimmed = value.trim();
21619
+ return trimmed.length > 0 ? trimmed : null;
21620
+ }
21621
+ static normalizeTargetNodeId(value) {
21622
+ if (typeof value !== 'string') {
21623
+ return undefined;
21624
+ }
21625
+ const trimmed = value.trim();
21626
+ if (trimmed.length === 0) {
21627
+ return undefined;
21628
+ }
21629
+ if (trimmed === '*') {
21630
+ return '*';
21631
+ }
21632
+ return trimmed;
21633
+ }
21614
21634
  constructor(config, baseConfig = {}) {
21615
21635
  ensureBrowserEnvironment$2();
21616
21636
  super(baseConfig);
@@ -21626,41 +21646,68 @@ class InPageConnector extends BaseAsyncConnector {
21626
21646
  ? Math.floor(config.inboxCapacity)
21627
21647
  : DEFAULT_INBOX_CAPACITY$6;
21628
21648
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
21649
+ this.inboxCapacity = preferredCapacity;
21629
21650
  this.connectorId = InPageConnector.generateConnectorId();
21651
+ const normalizedLocalNodeId = InPageConnector.normalizeNodeId(config.localNodeId);
21652
+ if (!normalizedLocalNodeId) {
21653
+ throw new Error('InPageConnector requires a non-empty localNodeId');
21654
+ }
21655
+ this.localNodeId = normalizedLocalNodeId;
21656
+ this.targetNodeId = InPageConnector.normalizeTargetNodeId(config.initialTargetNodeId);
21630
21657
  logger$J.debug('inpage_connector_initialized', {
21631
21658
  channel: this.channelName,
21632
21659
  connector_id: this.connectorId,
21660
+ local_node_id: this.localNodeId,
21661
+ target_node_id: this.targetNodeId ?? null,
21662
+ inbox_capacity: preferredCapacity,
21633
21663
  });
21634
21664
  this.onMsg = (event) => {
21665
+ if (!this.listenerRegistered) {
21666
+ logger$J.warning('inpage_message_after_unregister', {
21667
+ channel: this.channelName,
21668
+ connector_id: this.connectorId,
21669
+ timestamp: new Date().toISOString(),
21670
+ });
21671
+ return;
21672
+ }
21635
21673
  const messageEvent = event;
21636
21674
  const message = messageEvent.data;
21637
21675
  logger$J.debug('inpage_raw_event', {
21638
21676
  channel: this.channelName,
21639
21677
  connector_id: this.connectorId,
21640
- message_type: message && typeof message === 'object' ? message.constructor?.name ?? typeof message : typeof message,
21641
- has_sender_id: Boolean(message?.senderId),
21642
- payload_type: message && typeof message === 'object'
21643
- ? message?.payload instanceof Uint8Array
21644
- ? 'Uint8Array'
21645
- : message?.payload instanceof ArrayBuffer
21646
- ? 'ArrayBuffer'
21647
- : typeof message?.payload
21678
+ message_type: message && typeof message === 'object'
21679
+ ? message.constructor?.name ?? typeof message
21648
21680
  : typeof message,
21649
- payload_constructor: message && typeof message === 'object'
21650
- ? message?.payload?.constructor?.name
21651
- : undefined,
21652
- payload_keys: message && typeof message === 'object' && message?.payload && typeof message?.payload === 'object'
21653
- ? Object.keys(message.payload).slice(0, 5)
21654
- : undefined,
21681
+ has_sender_id: Boolean(message?.senderId),
21682
+ has_sender_node_id: Boolean(message?.senderNodeId),
21655
21683
  });
21656
21684
  if (!message || typeof message !== 'object') {
21657
21685
  return;
21658
21686
  }
21659
21687
  const busMessage = message;
21660
- if (typeof busMessage.senderId !== 'string' || busMessage.senderId.length === 0) {
21688
+ const senderId = typeof busMessage.senderId === 'string' && busMessage.senderId.length > 0
21689
+ ? busMessage.senderId
21690
+ : null;
21691
+ const senderNodeId = InPageConnector.normalizeNodeId(busMessage.senderNodeId);
21692
+ if (!senderId || !senderNodeId) {
21693
+ logger$J.debug('inpage_message_rejected', {
21694
+ channel: this.channelName,
21695
+ connector_id: this.connectorId,
21696
+ reason: 'missing_sender_metadata',
21697
+ });
21661
21698
  return;
21662
21699
  }
21663
- if (busMessage.senderId === this.connectorId) {
21700
+ if (senderId === this.connectorId || senderNodeId === this.localNodeId) {
21701
+ logger$J.debug('inpage_message_rejected', {
21702
+ channel: this.channelName,
21703
+ connector_id: this.connectorId,
21704
+ reason: 'self_echo',
21705
+ sender_node_id: senderNodeId,
21706
+ });
21707
+ return;
21708
+ }
21709
+ const incomingTargetNodeId = InPageConnector.normalizeTargetNodeId(busMessage.targetNodeId);
21710
+ if (!this._shouldAcceptMessageFromBus(senderNodeId, incomingTargetNodeId)) {
21664
21711
  return;
21665
21712
  }
21666
21713
  const payload = InPageConnector.coercePayload(busMessage.payload);
@@ -21674,7 +21721,9 @@ class InPageConnector extends BaseAsyncConnector {
21674
21721
  }
21675
21722
  logger$J.debug('inpage_message_received', {
21676
21723
  channel: this.channelName,
21677
- sender_id: busMessage.senderId,
21724
+ sender_id: senderId,
21725
+ sender_node_id: senderNodeId,
21726
+ target_node_id: incomingTargetNodeId ?? null,
21678
21727
  connector_id: this.connectorId,
21679
21728
  payload_length: payload.byteLength,
21680
21729
  });
@@ -21682,15 +21731,27 @@ class InPageConnector extends BaseAsyncConnector {
21682
21731
  if (typeof this.inbox.tryEnqueue === 'function') {
21683
21732
  const accepted = this.inbox.tryEnqueue(payload);
21684
21733
  if (accepted) {
21734
+ this.logInboxSnapshot('inpage_inbox_enqueued', {
21735
+ source: 'listener',
21736
+ enqueue_strategy: 'try',
21737
+ payload_length: payload.byteLength,
21738
+ });
21685
21739
  return;
21686
21740
  }
21687
21741
  }
21688
21742
  this.inbox.enqueue(payload);
21743
+ this.logInboxSnapshot('inpage_inbox_enqueued', {
21744
+ source: 'listener',
21745
+ enqueue_strategy: 'enqueue',
21746
+ payload_length: payload.byteLength,
21747
+ });
21689
21748
  }
21690
21749
  catch (error) {
21691
21750
  if (error instanceof QueueFullError) {
21692
21751
  logger$J.warning('inpage_receive_queue_full', {
21693
21752
  channel: this.channelName,
21753
+ inbox_capacity: this.inboxCapacity,
21754
+ inbox_remaining_capacity: this.inbox.remainingCapacity,
21694
21755
  });
21695
21756
  }
21696
21757
  else {
@@ -21797,15 +21858,25 @@ class InPageConnector extends BaseAsyncConnector {
21797
21858
  if (typeof this.inbox.tryEnqueue === 'function') {
21798
21859
  const accepted = this.inbox.tryEnqueue(item);
21799
21860
  if (accepted) {
21861
+ this.logInboxSnapshot('inpage_push_enqueued', {
21862
+ enqueue_strategy: 'try',
21863
+ item_type: this._describeInboxItem(item),
21864
+ });
21800
21865
  return;
21801
21866
  }
21802
21867
  }
21803
21868
  this.inbox.enqueue(item);
21869
+ this.logInboxSnapshot('inpage_push_enqueued', {
21870
+ enqueue_strategy: 'enqueue',
21871
+ item_type: this._describeInboxItem(item),
21872
+ });
21804
21873
  }
21805
21874
  catch (error) {
21806
21875
  if (error instanceof QueueFullError) {
21807
21876
  logger$J.warning('inpage_push_queue_full', {
21808
21877
  channel: this.channelName,
21878
+ inbox_capacity: this.inboxCapacity,
21879
+ inbox_remaining_capacity: this.inbox.remainingCapacity,
21809
21880
  });
21810
21881
  throw error;
21811
21882
  }
@@ -21818,25 +21889,52 @@ class InPageConnector extends BaseAsyncConnector {
21818
21889
  }
21819
21890
  async _transportSendBytes(data) {
21820
21891
  ensureBrowserEnvironment$2();
21892
+ const targetNodeId = this.targetNodeId ?? '*';
21821
21893
  logger$J.debug('inpage_message_sending', {
21822
21894
  channel: this.channelName,
21823
21895
  sender_id: this.connectorId,
21896
+ sender_node_id: this.localNodeId,
21897
+ target_node_id: targetNodeId,
21824
21898
  });
21825
21899
  const event = new MessageEvent(this.channelName, {
21826
21900
  data: {
21827
21901
  senderId: this.connectorId,
21902
+ senderNodeId: this.localNodeId,
21903
+ targetNodeId,
21828
21904
  payload: data,
21829
21905
  },
21830
21906
  });
21831
21907
  getSharedBus$1().dispatchEvent(event);
21832
21908
  }
21833
21909
  async _transportReceive() {
21834
- return await this.inbox.dequeue();
21910
+ const item = await this.inbox.dequeue();
21911
+ this.logInboxSnapshot('inpage_inbox_dequeued', {
21912
+ item_type: this._describeInboxItem(item),
21913
+ });
21914
+ return item;
21835
21915
  }
21836
21916
  async _transportClose(code, reason) {
21917
+ logger$J.debug('inpage_transport_closing', {
21918
+ channel: this.channelName,
21919
+ connector_id: this.connectorId,
21920
+ code,
21921
+ reason,
21922
+ listener_registered: this.listenerRegistered,
21923
+ timestamp: new Date().toISOString(),
21924
+ });
21837
21925
  if (this.listenerRegistered) {
21926
+ logger$J.debug('inpage_removing_listener', {
21927
+ channel: this.channelName,
21928
+ connector_id: this.connectorId,
21929
+ timestamp: new Date().toISOString(),
21930
+ });
21838
21931
  getSharedBus$1().removeEventListener(this.channelName, this.onMsg);
21839
21932
  this.listenerRegistered = false;
21933
+ logger$J.debug('inpage_listener_removed', {
21934
+ channel: this.channelName,
21935
+ connector_id: this.connectorId,
21936
+ timestamp: new Date().toISOString(),
21937
+ });
21840
21938
  }
21841
21939
  if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
21842
21940
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
@@ -21854,6 +21952,103 @@ class InPageConnector extends BaseAsyncConnector {
21854
21952
  }
21855
21953
  return rawOrEnvelope;
21856
21954
  }
21955
+ _isWildcardTarget() {
21956
+ return this.targetNodeId === '*' || typeof this.targetNodeId === 'undefined';
21957
+ }
21958
+ _shouldAcceptMessageFromBus(senderNodeId, targetNodeId) {
21959
+ if (this._isWildcardTarget()) {
21960
+ if (targetNodeId &&
21961
+ targetNodeId !== '*' &&
21962
+ targetNodeId !== this.localNodeId) {
21963
+ logger$J.debug('inpage_message_rejected', {
21964
+ channel: this.channelName,
21965
+ connector_id: this.connectorId,
21966
+ reason: 'wildcard_target_mismatch',
21967
+ sender_node_id: senderNodeId,
21968
+ target_node_id: targetNodeId,
21969
+ local_node_id: this.localNodeId,
21970
+ });
21971
+ return false;
21972
+ }
21973
+ return true;
21974
+ }
21975
+ const expectedSender = this.targetNodeId;
21976
+ if (expectedSender && expectedSender !== '*' && senderNodeId !== expectedSender) {
21977
+ logger$J.debug('inpage_message_rejected', {
21978
+ channel: this.channelName,
21979
+ connector_id: this.connectorId,
21980
+ reason: 'unexpected_sender',
21981
+ expected_sender_node_id: expectedSender,
21982
+ sender_node_id: senderNodeId,
21983
+ local_node_id: this.localNodeId,
21984
+ });
21985
+ return false;
21986
+ }
21987
+ if (targetNodeId &&
21988
+ targetNodeId !== '*' &&
21989
+ targetNodeId !== this.localNodeId) {
21990
+ logger$J.debug('inpage_message_rejected', {
21991
+ channel: this.channelName,
21992
+ connector_id: this.connectorId,
21993
+ reason: 'unexpected_target',
21994
+ sender_node_id: senderNodeId,
21995
+ target_node_id: targetNodeId,
21996
+ local_node_id: this.localNodeId,
21997
+ });
21998
+ return false;
21999
+ }
22000
+ return true;
22001
+ }
22002
+ _describeInboxItem(item) {
22003
+ if (item instanceof Uint8Array) {
22004
+ return 'bytes';
22005
+ }
22006
+ if (item.envelope) {
22007
+ return 'channel_message';
22008
+ }
22009
+ if (item.frame) {
22010
+ return 'envelope';
22011
+ }
22012
+ return 'unknown';
22013
+ }
22014
+ logInboxSnapshot(event, extra = {}) {
22015
+ logger$J.debug(event, {
22016
+ channel: this.channelName,
22017
+ connector_id: this.connectorId,
22018
+ connector_state: this.state,
22019
+ inbox_capacity: this.inboxCapacity,
22020
+ inbox_remaining_capacity: this.inbox.remainingCapacity,
22021
+ ...extra,
22022
+ });
22023
+ }
22024
+ setTargetNodeId(nodeId) {
22025
+ const normalized = InPageConnector.normalizeNodeId(nodeId);
22026
+ if (!normalized) {
22027
+ throw new Error('InPageConnector target node id must be a non-empty string');
22028
+ }
22029
+ if (normalized === '*') {
22030
+ this.setWildcardTarget();
22031
+ return;
22032
+ }
22033
+ this.targetNodeId = normalized;
22034
+ logger$J.debug('inpage_target_updated', {
22035
+ channel: this.channelName,
22036
+ connector_id: this.connectorId,
22037
+ local_node_id: this.localNodeId,
22038
+ target_node_id: this.targetNodeId,
22039
+ target_mode: 'direct',
22040
+ });
22041
+ }
22042
+ setWildcardTarget() {
22043
+ this.targetNodeId = '*';
22044
+ logger$J.debug('inpage_target_updated', {
22045
+ channel: this.channelName,
22046
+ connector_id: this.connectorId,
22047
+ local_node_id: this.localNodeId,
22048
+ target_node_id: this.targetNodeId,
22049
+ target_mode: 'wildcard',
22050
+ });
22051
+ }
21857
22052
  }
21858
22053
 
21859
22054
  const RPC_REGISTRY = Symbol('naylence.rpc.registry');
@@ -30434,8 +30629,16 @@ class InPageConnectorFactory extends ConnectorFactory {
30434
30629
  }
30435
30630
  const normalized = this._normalizeConfig(config);
30436
30631
  const options = (factoryArgs[0] ?? {});
30632
+ const normalizedLocalNodeFromConfig = this._normalizeNodeId(normalized.localNodeId);
30633
+ const localNodeId = this._normalizeNodeId(options.localNodeId) ?? normalizedLocalNodeFromConfig;
30634
+ if (!localNodeId) {
30635
+ throw new Error('InPageConnectorFactory requires a localNodeId from config or create() options');
30636
+ }
30437
30637
  const channelName = normalized.channelName ?? DEFAULT_CHANNEL$3;
30438
30638
  const inboxCapacity = normalized.inboxCapacity ?? DEFAULT_INBOX_CAPACITY$3;
30639
+ const targetFromOptions = this._normalizeTargetNodeId(options.initialTargetNodeId);
30640
+ const targetFromConfig = this._normalizeTargetNodeId(normalized.initialTargetNodeId);
30641
+ const resolvedTarget = targetFromOptions ?? targetFromConfig ?? '*';
30439
30642
  const baseConfig = {
30440
30643
  drainTimeout: normalized.drainTimeout,
30441
30644
  flowControl: normalized.flowControl,
@@ -30450,6 +30653,8 @@ class InPageConnectorFactory extends ConnectorFactory {
30450
30653
  type: INPAGE_CONNECTOR_TYPE,
30451
30654
  channelName,
30452
30655
  inboxCapacity,
30656
+ localNodeId,
30657
+ initialTargetNodeId: resolvedTarget,
30453
30658
  };
30454
30659
  const connector = new InPageConnector(connectorConfig, baseConfig);
30455
30660
  if (options.authorization) {
@@ -30485,6 +30690,16 @@ class InPageConnectorFactory extends ConnectorFactory {
30485
30690
  capacity > 0) {
30486
30691
  normalized.inboxCapacity = Math.floor(capacity);
30487
30692
  }
30693
+ const localNodeId = candidate.localNodeId ?? candidate['local_node_id'];
30694
+ const normalizedLocalNodeId = this._normalizeNodeId(localNodeId);
30695
+ if (normalizedLocalNodeId) {
30696
+ normalized.localNodeId = normalizedLocalNodeId;
30697
+ }
30698
+ const initialTargetNodeId = candidate.initialTargetNodeId ?? candidate['initial_target_node_id'];
30699
+ const normalizedTarget = this._normalizeTargetNodeId(initialTargetNodeId);
30700
+ if (normalizedTarget) {
30701
+ normalized.initialTargetNodeId = normalizedTarget;
30702
+ }
30488
30703
  if (typeof candidate.flowControl === 'boolean') {
30489
30704
  normalized.flowControl = candidate.flowControl;
30490
30705
  }
@@ -30523,6 +30738,22 @@ class InPageConnectorFactory extends ConnectorFactory {
30523
30738
  normalized.inboxCapacity ?? DEFAULT_INBOX_CAPACITY$3;
30524
30739
  return normalized;
30525
30740
  }
30741
+ _normalizeNodeId(value) {
30742
+ if (typeof value !== 'string') {
30743
+ return null;
30744
+ }
30745
+ const trimmed = value.trim();
30746
+ return trimmed.length > 0 ? trimmed : null;
30747
+ }
30748
+ _normalizeTargetNodeId(value) {
30749
+ if (value === undefined || value === null) {
30750
+ return undefined;
30751
+ }
30752
+ if (value === '*') {
30753
+ return '*';
30754
+ }
30755
+ return this._normalizeNodeId(value) ?? undefined;
30756
+ }
30526
30757
  }
30527
30758
 
30528
30759
  var inpageConnectorFactory = /*#__PURE__*/Object.freeze({
@@ -32417,7 +32648,7 @@ class InPageListener extends TransportListener {
32417
32648
  node: routingNode,
32418
32649
  });
32419
32650
  const selection = defaultGrantSelectionPolicy.selectCallbackGrant(selectionContext);
32420
- connectorConfig = this._grantToConnectorConfig(selection.grant);
32651
+ connectorConfig = this._buildConnectorConfigForSystem(systemId, this._grantToConnectorConfig(selection.grant));
32421
32652
  }
32422
32653
  catch (error) {
32423
32654
  logger$o.debug('inpage_listener_grant_selection_failed', {
@@ -32425,13 +32656,13 @@ class InPageListener extends TransportListener {
32425
32656
  system_id: systemId,
32426
32657
  error: error instanceof Error ? error.message : String(error),
32427
32658
  });
32428
- connectorConfig =
32429
- this._extractInPageConnectorConfig(frame) ??
32430
- {
32431
- type: INPAGE_CONNECTOR_TYPE,
32432
- channelName: this._channelName,
32433
- inboxCapacity: this._inboxCapacity,
32434
- };
32659
+ const fallbackConfig = this._extractInPageConnectorConfig(frame) ??
32660
+ {
32661
+ type: INPAGE_CONNECTOR_TYPE,
32662
+ channelName: this._channelName,
32663
+ inboxCapacity: this._inboxCapacity,
32664
+ };
32665
+ connectorConfig = this._buildConnectorConfigForSystem(systemId, fallbackConfig);
32435
32666
  }
32436
32667
  try {
32437
32668
  const connector = await routingNode.createOriginConnector({
@@ -32550,6 +32781,65 @@ class InPageListener extends TransportListener {
32550
32781
  typeof frame === 'object' &&
32551
32782
  frame.type === 'NodeAttach');
32552
32783
  }
32784
+ _buildConnectorConfigForSystem(systemId, baseConfig) {
32785
+ const localNodeId = this._requireLocalNodeId();
32786
+ const targetSystemId = this._normalizeNodeId(systemId);
32787
+ if (!targetSystemId) {
32788
+ throw new Error('InPageListener requires a valid system id for connector creation');
32789
+ }
32790
+ const candidate = baseConfig ?? null;
32791
+ const channelCandidate = candidate && 'channelName' in candidate
32792
+ ? candidate.channelName
32793
+ : undefined;
32794
+ const inboxCandidate = candidate && 'inboxCapacity' in candidate
32795
+ ? candidate.inboxCapacity
32796
+ : undefined;
32797
+ const targetCandidate = candidate && 'initialTargetNodeId' in candidate
32798
+ ? candidate.initialTargetNodeId
32799
+ : undefined;
32800
+ const channelName = typeof channelCandidate === 'string' && channelCandidate.trim().length > 0
32801
+ ? channelCandidate.trim()
32802
+ : this._channelName;
32803
+ const inboxCapacity = typeof inboxCandidate === 'number' &&
32804
+ Number.isFinite(inboxCandidate) &&
32805
+ inboxCandidate > 0
32806
+ ? Math.floor(inboxCandidate)
32807
+ : this._inboxCapacity;
32808
+ const normalizedTarget = this._normalizeTargetNodeId(targetCandidate);
32809
+ return {
32810
+ type: INPAGE_CONNECTOR_TYPE,
32811
+ channelName,
32812
+ inboxCapacity,
32813
+ localNodeId,
32814
+ initialTargetNodeId: normalizedTarget ?? targetSystemId,
32815
+ };
32816
+ }
32817
+ _requireLocalNodeId() {
32818
+ if (!this._routingNode) {
32819
+ throw new Error('InPageListener requires routing node context');
32820
+ }
32821
+ const normalized = this._normalizeNodeId(this._routingNode.id);
32822
+ if (!normalized) {
32823
+ throw new Error('InPageListener requires routing node with a stable identifier');
32824
+ }
32825
+ return normalized;
32826
+ }
32827
+ _normalizeNodeId(value) {
32828
+ if (typeof value !== 'string') {
32829
+ return null;
32830
+ }
32831
+ const trimmed = value.trim();
32832
+ return trimmed.length > 0 ? trimmed : null;
32833
+ }
32834
+ _normalizeTargetNodeId(value) {
32835
+ if (value === undefined || value === null) {
32836
+ return undefined;
32837
+ }
32838
+ if (value === '*') {
32839
+ return '*';
32840
+ }
32841
+ return this._normalizeNodeId(value) ?? undefined;
32842
+ }
32553
32843
  }
32554
32844
  function getInPageListenerInstance() {
32555
32845
  return _lastInPageListenerInstance;
@@ -9,10 +9,14 @@ export interface InPageConnectorFactoryConfig extends ConnectorConfig, Partial<B
9
9
  type: typeof INPAGE_CONNECTOR_TYPE;
10
10
  channelName?: string;
11
11
  inboxCapacity?: number;
12
+ localNodeId?: string;
13
+ initialTargetNodeId?: string | '*';
12
14
  }
13
15
  export interface CreateInPageConnectorOptions {
14
16
  systemId?: string;
15
17
  authorization?: AuthorizationContext;
18
+ localNodeId?: string;
19
+ initialTargetNodeId?: string | '*';
16
20
  }
17
21
  export declare const FACTORY_META: {
18
22
  readonly base: "ConnectorFactory";
@@ -26,5 +30,7 @@ export declare class InPageConnectorFactory extends ConnectorFactory<InPageConne
26
30
  grantFromConfig(config: InPageConnectorFactoryConfig | Record<string, unknown>, _expressionEvaluationPolicy: ExpressionEvaluationPolicy): InPageConnectionGrant;
27
31
  create(config?: InPageConnectorFactoryConfig | Record<string, unknown> | null, ...factoryArgs: unknown[]): Promise<InPageConnector>;
28
32
  private _normalizeConfig;
33
+ private _normalizeNodeId;
34
+ private _normalizeTargetNodeId;
29
35
  }
30
36
  export default InPageConnectorFactory;
@@ -10,18 +10,25 @@ export interface InPageConnectorConfig extends ConnectorConfig {
10
10
  type: typeof INPAGE_CONNECTOR_TYPE;
11
11
  channelName?: string;
12
12
  inboxCapacity?: number;
13
+ localNodeId: string;
14
+ initialTargetNodeId?: string | '*';
13
15
  }
14
16
  type InPageInboxItem = Uint8Array | FameEnvelope | FameChannelMessage;
15
17
  export declare class InPageConnector extends BaseAsyncConnector {
16
18
  private readonly channelName;
17
19
  private readonly inbox;
20
+ private readonly inboxCapacity;
18
21
  private listenerRegistered;
19
22
  private readonly connectorId;
23
+ private readonly localNodeId;
24
+ private targetNodeId?;
20
25
  private readonly onMsg;
21
26
  private visibilityChangeListenerRegistered;
22
27
  private visibilityChangeHandler?;
23
28
  private static generateConnectorId;
24
29
  private static coercePayload;
30
+ private static normalizeNodeId;
31
+ private static normalizeTargetNodeId;
25
32
  constructor(config: InPageConnectorConfig, baseConfig?: BaseAsyncConnectorConfig);
26
33
  /**
27
34
  * Override start() to check initial visibility state
@@ -32,5 +39,11 @@ export declare class InPageConnector extends BaseAsyncConnector {
32
39
  protected _transportReceive(): Promise<InPageInboxItem>;
33
40
  protected _transportClose(code: number, reason: string): Promise<void>;
34
41
  private _normalizeInboxItem;
42
+ private _isWildcardTarget;
43
+ private _shouldAcceptMessageFromBus;
44
+ private _describeInboxItem;
45
+ private logInboxSnapshot;
46
+ setTargetNodeId(nodeId: string): void;
47
+ setWildcardTarget(): void;
35
48
  }
36
49
  export {};
@@ -37,5 +37,9 @@ export declare class InPageListener extends TransportListener {
37
37
  private _deliverEnvelope;
38
38
  private _buildChannelMessage;
39
39
  private _isNodeAttachFrame;
40
+ private _buildConnectorConfigForSystem;
41
+ private _requireLocalNodeId;
42
+ private _normalizeNodeId;
43
+ private _normalizeTargetNodeId;
40
44
  }
41
45
  export declare function getInPageListenerInstance(): InPageListener | null;
@@ -18,6 +18,8 @@ export type InPageConnectorConfigLike = ConnectorConfig & {
18
18
  type: typeof INPAGE_CONNECTOR_TYPE;
19
19
  channelName?: string;
20
20
  inboxCapacity?: number;
21
+ initialTargetNodeId?: string | '*';
22
+ localNodeId?: string;
21
23
  };
22
24
  export declare function isInPageConnectionGrant(candidate: unknown): candidate is InPageConnectionGrant;
23
25
  export declare function normalizeInPageConnectionGrant(candidate: InPageConnectionGrantLike): InPageConnectionGrant;
@@ -2,4 +2,4 @@
2
2
  * The package version, injected at build time.
3
3
  * @internal
4
4
  */
5
- export declare const VERSION = "0.3.5-test.966";
5
+ export declare const VERSION = "0.3.5-test.967";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naylence/runtime",
3
- "version": "0.3.5-test.966",
3
+ "version": "0.3.5-test.967",
4
4
  "type": "module",
5
5
  "description": "Naylence Runtime - Complete TypeScript runtime",
6
6
  "author": "Naylence Dev <naylencedev@gmail.com>",