@bobfrankston/iflow-direct 0.1.30 → 0.1.31

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.
Files changed (2) hide show
  1. package/imap-native.js +15 -1
  2. package/package.json +1 -1
package/imap-native.js CHANGED
@@ -778,8 +778,22 @@ export class NativeImapClient {
778
778
  // Mark disconnected so ensureConnected() reconnects on the next call —
779
779
  // transport.close() may or may not fire onClose synchronously.
780
780
  this._connected = false;
781
+ // Surface transport-level diagnostics if available — bytes
782
+ // written/read, time since last read, write count, conn id.
783
+ // Tells us whether the connection was silently dead
784
+ // (no reads, no writes acked) or genuinely waiting on a
785
+ // server reply that never came.
786
+ let diag = "";
787
+ try {
788
+ const d = this.transport?.diagnostics;
789
+ if (d) {
790
+ const sinceRead = d.lastReadAt ? Date.now() - d.lastReadAt : -1;
791
+ diag = ` [conn#${d.connId} r=${d.bytesRead}B w=${d.bytesWritten}B writes=${d.writeCount} sinceLastRead=${sinceRead}ms]`;
792
+ }
793
+ }
794
+ catch { /* ignore */ }
781
795
  this.transport.close?.();
782
- reject(new Error(`IMAP inactivity timeout (${this.inactivityTimeout / 1000}s): ${command.split("\r")[0].substring(0, 80)}`));
796
+ reject(new Error(`IMAP inactivity timeout (${this.inactivityTimeout / 1000}s): ${command.split("\r")[0].substring(0, 80)}${diag}`));
783
797
  };
784
798
  this.commandTimer = setTimeout(onTimeout, this.inactivityTimeout);
785
799
  this.pendingCommand = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/iflow-direct",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "Direct IMAP client — transport-agnostic, no Node.js dependencies, browser-ready",
5
5
  "main": "index.js",
6
6
  "types": "index.ts",