@naylence/runtime 0.3.5-test.933 → 0.3.5-test.934

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.
@@ -2116,6 +2116,10 @@ class BaseAsyncConnector extends TaskSpawner {
2116
2116
  * Stop the connector gracefully
2117
2117
  */
2118
2118
  async stop() {
2119
+ logger$1f.debug('stopping_connector', {
2120
+ current_state: this._state,
2121
+ connector_id: this._connectorFlowId,
2122
+ });
2119
2123
  if (!core.ConnectorStateUtils.canStop(this._state)) {
2120
2124
  logger$1f.debug('connector_stop_already_stopped', {
2121
2125
  current_state: this._state,
@@ -2128,6 +2132,10 @@ class BaseAsyncConnector extends TaskSpawner {
2128
2132
  if (this._lastError) {
2129
2133
  throw this._lastError;
2130
2134
  }
2135
+ logger$1f.debug('connector_stopped', {
2136
+ current_state: this._state,
2137
+ connector_id: this._connectorFlowId,
2138
+ });
2131
2139
  }
2132
2140
  /**
2133
2141
  * Close the connector with optional code and reason
@@ -2458,8 +2466,21 @@ class BaseAsyncConnector extends TaskSpawner {
2458
2466
  */
2459
2467
  async _shutdown(code, reason, gracePeriod, exc) {
2460
2468
  if (this._closed) {
2469
+ logger$1f.debug('shutdown_already_closed', {
2470
+ connector_id: this._connectorFlowId,
2471
+ current_state: this._state,
2472
+ });
2461
2473
  return;
2462
2474
  }
2475
+ logger$1f.info('connector_shutdown_starting', {
2476
+ connector_id: this._connectorFlowId,
2477
+ connector_type: this.constructor.name,
2478
+ code,
2479
+ reason,
2480
+ current_state: this._state,
2481
+ has_error: !!exc,
2482
+ timestamp: new Date().toISOString(),
2483
+ });
2463
2484
  this._closed = true;
2464
2485
  this._closeCode = code;
2465
2486
  this._closeReason = reason;
@@ -2481,16 +2502,39 @@ class BaseAsyncConnector extends TaskSpawner {
2481
2502
  this._sendPromiseResolve = undefined;
2482
2503
  }
2483
2504
  // Close transport
2505
+ logger$1f.info('connector_closing_transport', {
2506
+ connector_id: this._connectorFlowId,
2507
+ connector_type: this.constructor.name,
2508
+ timestamp: new Date().toISOString(),
2509
+ });
2484
2510
  await this._transportClose(code, reason);
2511
+ logger$1f.info('connector_transport_closed', {
2512
+ connector_id: this._connectorFlowId,
2513
+ connector_type: this.constructor.name,
2514
+ timestamp: new Date().toISOString(),
2515
+ });
2485
2516
  // Shutdown spawned tasks
2517
+ logger$1f.info('connector_shutting_down_tasks', {
2518
+ connector_id: this._connectorFlowId,
2519
+ connector_type: this.constructor.name,
2520
+ grace_period_ms: effectiveGracePeriod * 1000,
2521
+ join_timeout_ms: this._shutdownJoinTimeout,
2522
+ timestamp: new Date().toISOString(),
2523
+ });
2486
2524
  try {
2487
2525
  await this.shutdownTasks({
2488
2526
  gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
2489
2527
  joinTimeout: this._shutdownJoinTimeout,
2490
2528
  });
2529
+ logger$1f.info('connector_tasks_shutdown_complete', {
2530
+ connector_id: this._connectorFlowId,
2531
+ connector_type: this.constructor.name,
2532
+ timestamp: new Date().toISOString(),
2533
+ });
2491
2534
  }
2492
2535
  catch (error) {
2493
2536
  logger$1f.warning('task_shutdown_error', {
2537
+ connector_id: this._connectorFlowId,
2494
2538
  error: error instanceof Error ? error.message : String(error),
2495
2539
  });
2496
2540
  }
@@ -2502,6 +2546,12 @@ class BaseAsyncConnector extends TaskSpawner {
2502
2546
  if (this._closeResolver) {
2503
2547
  this._closeResolver();
2504
2548
  }
2549
+ logger$1f.info('connector_shutdown_complete', {
2550
+ connector_id: this._connectorFlowId,
2551
+ connector_type: this.constructor.name,
2552
+ final_state: this._state,
2553
+ timestamp: new Date().toISOString(),
2554
+ });
2505
2555
  }
2506
2556
  /**
2507
2557
  * Close the underlying transport
@@ -5386,12 +5436,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5386
5436
  }
5387
5437
 
5388
5438
  // This file is auto-generated during build - do not edit manually
5389
- // Generated from package.json version: 0.3.5-test.933
5439
+ // Generated from package.json version: 0.3.5-test.934
5390
5440
  /**
5391
5441
  * The package version, injected at build time.
5392
5442
  * @internal
5393
5443
  */
5394
- const VERSION = '0.3.5-test.933';
5444
+ const VERSION = '0.3.5-test.934';
5395
5445
 
5396
5446
  /**
5397
5447
  * Fame errors module - Fame protocol specific error classes
@@ -11444,12 +11494,22 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11444
11494
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
11445
11495
  this.connectorId = BroadcastChannelConnector.generateConnectorId();
11446
11496
  this.channel = new BroadcastChannel(this.channelName);
11447
- logger$10.debug('broadcast_channel_connector_initialized', {
11497
+ logger$10.info('broadcast_channel_connector_created', {
11448
11498
  channel: this.channelName,
11449
11499
  connector_id: this.connectorId,
11450
11500
  inbox_capacity: preferredCapacity,
11501
+ timestamp: new Date().toISOString(),
11451
11502
  });
11452
11503
  this.onMsg = (event) => {
11504
+ // Guard: Don't process if listener was unregistered
11505
+ if (!this.listenerRegistered) {
11506
+ logger$10.warning('broadcast_channel_message_after_unregister', {
11507
+ channel: this.channelName,
11508
+ connector_id: this.connectorId,
11509
+ timestamp: new Date().toISOString(),
11510
+ });
11511
+ return;
11512
+ }
11453
11513
  const message = event.data;
11454
11514
  logger$10.debug('broadcast_channel_raw_event', {
11455
11515
  channel: this.channelName,
@@ -11576,16 +11636,44 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11576
11636
  return await this.inbox.dequeue();
11577
11637
  }
11578
11638
  async _transportClose(code, reason) {
11639
+ logger$10.info('broadcast_channel_transport_closing', {
11640
+ channel: this.channelName,
11641
+ connector_id: this.connectorId,
11642
+ code,
11643
+ reason,
11644
+ listener_registered: this.listenerRegistered,
11645
+ timestamp: new Date().toISOString(),
11646
+ });
11579
11647
  if (this.listenerRegistered) {
11648
+ logger$10.info('broadcast_channel_removing_listener', {
11649
+ channel: this.channelName,
11650
+ connector_id: this.connectorId,
11651
+ timestamp: new Date().toISOString(),
11652
+ });
11580
11653
  this.channel.removeEventListener('message', this.onMsg);
11581
11654
  this.listenerRegistered = false;
11655
+ logger$10.info('broadcast_channel_listener_removed', {
11656
+ channel: this.channelName,
11657
+ connector_id: this.connectorId,
11658
+ timestamp: new Date().toISOString(),
11659
+ });
11582
11660
  }
11583
11661
  if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
11584
11662
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
11585
11663
  this.visibilityChangeListenerRegistered = false;
11586
11664
  this.visibilityChangeHandler = undefined;
11587
11665
  }
11666
+ logger$10.info('broadcast_channel_closing', {
11667
+ channel: this.channelName,
11668
+ connector_id: this.connectorId,
11669
+ timestamp: new Date().toISOString(),
11670
+ });
11588
11671
  this.channel.close();
11672
+ logger$10.info('broadcast_channel_closed', {
11673
+ channel: this.channelName,
11674
+ connector_id: this.connectorId,
11675
+ timestamp: new Date().toISOString(),
11676
+ });
11589
11677
  const closeCode = typeof code === 'number' ? code : 1000;
11590
11678
  const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
11591
11679
  const shutdownError = new FameTransportClose(closeReason, closeCode);
@@ -12188,7 +12276,22 @@ class UpstreamSessionManager extends TaskSpawner {
12188
12276
  this.currentStopSubtasks = null;
12189
12277
  await Promise.allSettled(tasks.map((task) => task.promise));
12190
12278
  if (this.connector) {
12191
- await this.connector.stop().catch(() => undefined);
12279
+ logger$$.info('upstream_stopping_old_connector', {
12280
+ connect_epoch: this.connectEpoch,
12281
+ target_system_id: this.targetSystemId,
12282
+ timestamp: new Date().toISOString(),
12283
+ });
12284
+ await this.connector.stop().catch((err) => {
12285
+ logger$$.warning('upstream_connector_stop_error', {
12286
+ connect_epoch: this.connectEpoch,
12287
+ error: err instanceof Error ? err.message : String(err),
12288
+ });
12289
+ });
12290
+ logger$$.info('upstream_old_connector_stopped', {
12291
+ connect_epoch: this.connectEpoch,
12292
+ target_system_id: this.targetSystemId,
12293
+ timestamp: new Date().toISOString(),
12294
+ });
12192
12295
  this.connector = null;
12193
12296
  }
12194
12297
  }
@@ -2115,6 +2115,10 @@ class BaseAsyncConnector extends TaskSpawner {
2115
2115
  * Stop the connector gracefully
2116
2116
  */
2117
2117
  async stop() {
2118
+ logger$1f.debug('stopping_connector', {
2119
+ current_state: this._state,
2120
+ connector_id: this._connectorFlowId,
2121
+ });
2118
2122
  if (!ConnectorStateUtils.canStop(this._state)) {
2119
2123
  logger$1f.debug('connector_stop_already_stopped', {
2120
2124
  current_state: this._state,
@@ -2127,6 +2131,10 @@ class BaseAsyncConnector extends TaskSpawner {
2127
2131
  if (this._lastError) {
2128
2132
  throw this._lastError;
2129
2133
  }
2134
+ logger$1f.debug('connector_stopped', {
2135
+ current_state: this._state,
2136
+ connector_id: this._connectorFlowId,
2137
+ });
2130
2138
  }
2131
2139
  /**
2132
2140
  * Close the connector with optional code and reason
@@ -2457,8 +2465,21 @@ class BaseAsyncConnector extends TaskSpawner {
2457
2465
  */
2458
2466
  async _shutdown(code, reason, gracePeriod, exc) {
2459
2467
  if (this._closed) {
2468
+ logger$1f.debug('shutdown_already_closed', {
2469
+ connector_id: this._connectorFlowId,
2470
+ current_state: this._state,
2471
+ });
2460
2472
  return;
2461
2473
  }
2474
+ logger$1f.info('connector_shutdown_starting', {
2475
+ connector_id: this._connectorFlowId,
2476
+ connector_type: this.constructor.name,
2477
+ code,
2478
+ reason,
2479
+ current_state: this._state,
2480
+ has_error: !!exc,
2481
+ timestamp: new Date().toISOString(),
2482
+ });
2462
2483
  this._closed = true;
2463
2484
  this._closeCode = code;
2464
2485
  this._closeReason = reason;
@@ -2480,16 +2501,39 @@ class BaseAsyncConnector extends TaskSpawner {
2480
2501
  this._sendPromiseResolve = undefined;
2481
2502
  }
2482
2503
  // Close transport
2504
+ logger$1f.info('connector_closing_transport', {
2505
+ connector_id: this._connectorFlowId,
2506
+ connector_type: this.constructor.name,
2507
+ timestamp: new Date().toISOString(),
2508
+ });
2483
2509
  await this._transportClose(code, reason);
2510
+ logger$1f.info('connector_transport_closed', {
2511
+ connector_id: this._connectorFlowId,
2512
+ connector_type: this.constructor.name,
2513
+ timestamp: new Date().toISOString(),
2514
+ });
2484
2515
  // Shutdown spawned tasks
2516
+ logger$1f.info('connector_shutting_down_tasks', {
2517
+ connector_id: this._connectorFlowId,
2518
+ connector_type: this.constructor.name,
2519
+ grace_period_ms: effectiveGracePeriod * 1000,
2520
+ join_timeout_ms: this._shutdownJoinTimeout,
2521
+ timestamp: new Date().toISOString(),
2522
+ });
2485
2523
  try {
2486
2524
  await this.shutdownTasks({
2487
2525
  gracePeriod: effectiveGracePeriod * 1000, // Convert to milliseconds
2488
2526
  joinTimeout: this._shutdownJoinTimeout,
2489
2527
  });
2528
+ logger$1f.info('connector_tasks_shutdown_complete', {
2529
+ connector_id: this._connectorFlowId,
2530
+ connector_type: this.constructor.name,
2531
+ timestamp: new Date().toISOString(),
2532
+ });
2490
2533
  }
2491
2534
  catch (error) {
2492
2535
  logger$1f.warning('task_shutdown_error', {
2536
+ connector_id: this._connectorFlowId,
2493
2537
  error: error instanceof Error ? error.message : String(error),
2494
2538
  });
2495
2539
  }
@@ -2501,6 +2545,12 @@ class BaseAsyncConnector extends TaskSpawner {
2501
2545
  if (this._closeResolver) {
2502
2546
  this._closeResolver();
2503
2547
  }
2548
+ logger$1f.info('connector_shutdown_complete', {
2549
+ connector_id: this._connectorFlowId,
2550
+ connector_type: this.constructor.name,
2551
+ final_state: this._state,
2552
+ timestamp: new Date().toISOString(),
2553
+ });
2504
2554
  }
2505
2555
  /**
2506
2556
  * Close the underlying transport
@@ -5385,12 +5435,12 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5385
5435
  }
5386
5436
 
5387
5437
  // This file is auto-generated during build - do not edit manually
5388
- // Generated from package.json version: 0.3.5-test.933
5438
+ // Generated from package.json version: 0.3.5-test.934
5389
5439
  /**
5390
5440
  * The package version, injected at build time.
5391
5441
  * @internal
5392
5442
  */
5393
- const VERSION = '0.3.5-test.933';
5443
+ const VERSION = '0.3.5-test.934';
5394
5444
 
5395
5445
  /**
5396
5446
  * Fame errors module - Fame protocol specific error classes
@@ -11443,12 +11493,22 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11443
11493
  this.inbox = new BoundedAsyncQueue(preferredCapacity);
11444
11494
  this.connectorId = BroadcastChannelConnector.generateConnectorId();
11445
11495
  this.channel = new BroadcastChannel(this.channelName);
11446
- logger$10.debug('broadcast_channel_connector_initialized', {
11496
+ logger$10.info('broadcast_channel_connector_created', {
11447
11497
  channel: this.channelName,
11448
11498
  connector_id: this.connectorId,
11449
11499
  inbox_capacity: preferredCapacity,
11500
+ timestamp: new Date().toISOString(),
11450
11501
  });
11451
11502
  this.onMsg = (event) => {
11503
+ // Guard: Don't process if listener was unregistered
11504
+ if (!this.listenerRegistered) {
11505
+ logger$10.warning('broadcast_channel_message_after_unregister', {
11506
+ channel: this.channelName,
11507
+ connector_id: this.connectorId,
11508
+ timestamp: new Date().toISOString(),
11509
+ });
11510
+ return;
11511
+ }
11452
11512
  const message = event.data;
11453
11513
  logger$10.debug('broadcast_channel_raw_event', {
11454
11514
  channel: this.channelName,
@@ -11575,16 +11635,44 @@ let BroadcastChannelConnector$2 = class BroadcastChannelConnector extends BaseAs
11575
11635
  return await this.inbox.dequeue();
11576
11636
  }
11577
11637
  async _transportClose(code, reason) {
11638
+ logger$10.info('broadcast_channel_transport_closing', {
11639
+ channel: this.channelName,
11640
+ connector_id: this.connectorId,
11641
+ code,
11642
+ reason,
11643
+ listener_registered: this.listenerRegistered,
11644
+ timestamp: new Date().toISOString(),
11645
+ });
11578
11646
  if (this.listenerRegistered) {
11647
+ logger$10.info('broadcast_channel_removing_listener', {
11648
+ channel: this.channelName,
11649
+ connector_id: this.connectorId,
11650
+ timestamp: new Date().toISOString(),
11651
+ });
11579
11652
  this.channel.removeEventListener('message', this.onMsg);
11580
11653
  this.listenerRegistered = false;
11654
+ logger$10.info('broadcast_channel_listener_removed', {
11655
+ channel: this.channelName,
11656
+ connector_id: this.connectorId,
11657
+ timestamp: new Date().toISOString(),
11658
+ });
11581
11659
  }
11582
11660
  if (this.visibilityChangeListenerRegistered && this.visibilityChangeHandler && typeof document !== 'undefined') {
11583
11661
  document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
11584
11662
  this.visibilityChangeListenerRegistered = false;
11585
11663
  this.visibilityChangeHandler = undefined;
11586
11664
  }
11665
+ logger$10.info('broadcast_channel_closing', {
11666
+ channel: this.channelName,
11667
+ connector_id: this.connectorId,
11668
+ timestamp: new Date().toISOString(),
11669
+ });
11587
11670
  this.channel.close();
11671
+ logger$10.info('broadcast_channel_closed', {
11672
+ channel: this.channelName,
11673
+ connector_id: this.connectorId,
11674
+ timestamp: new Date().toISOString(),
11675
+ });
11588
11676
  const closeCode = typeof code === 'number' ? code : 1000;
11589
11677
  const closeReason = typeof reason === 'string' && reason.length > 0 ? reason : 'closed';
11590
11678
  const shutdownError = new FameTransportClose(closeReason, closeCode);
@@ -12187,7 +12275,22 @@ class UpstreamSessionManager extends TaskSpawner {
12187
12275
  this.currentStopSubtasks = null;
12188
12276
  await Promise.allSettled(tasks.map((task) => task.promise));
12189
12277
  if (this.connector) {
12190
- await this.connector.stop().catch(() => undefined);
12278
+ logger$$.info('upstream_stopping_old_connector', {
12279
+ connect_epoch: this.connectEpoch,
12280
+ target_system_id: this.targetSystemId,
12281
+ timestamp: new Date().toISOString(),
12282
+ });
12283
+ await this.connector.stop().catch((err) => {
12284
+ logger$$.warning('upstream_connector_stop_error', {
12285
+ connect_epoch: this.connectEpoch,
12286
+ error: err instanceof Error ? err.message : String(err),
12287
+ });
12288
+ });
12289
+ logger$$.info('upstream_old_connector_stopped', {
12290
+ connect_epoch: this.connectEpoch,
12291
+ target_system_id: this.targetSystemId,
12292
+ timestamp: new Date().toISOString(),
12293
+ });
12191
12294
  this.connector = null;
12192
12295
  }
12193
12296
  }
@@ -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.933";
5
+ export declare const VERSION = "0.3.5-test.934";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naylence/runtime",
3
- "version": "0.3.5-test.933",
3
+ "version": "0.3.5-test.934",
4
4
  "type": "module",
5
5
  "description": "Naylence Runtime - Complete TypeScript runtime",
6
6
  "author": "Naylence Dev <naylencedev@gmail.com>",