imapflow 2.6.0 → 2.7.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.7.0](https://github.com/postalsys/imapflow/compare/v2.6.0...v2.7.0) (2026-10-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * expose idlingAtClose so a consumer can tell a session dropped in IDLE ([eb5ac6c](https://github.com/postalsys/imapflow/commit/eb5ac6c5307a735d4f2526c8e8a266e488dbe17f))
9
+
3
10
  ## [2.6.0](https://github.com/postalsys/imapflow/compare/v2.5.9...v2.6.0) (2026-10-21)
4
11
 
5
12
 
package/README.md CHANGED
@@ -135,6 +135,7 @@ Besides `mailbox`, `usable`, `authenticated` and `capabilities`, a client expose
135
135
  - `client.context` - data of the application's own, never read by ImapFlow. It starts as the `context` option (`new ImapFlow({ ..., context: { account: 'a1' } })`) and can be replaced at any time. Its type is `unknown`, cast it to what you store there.
136
136
  - `client.connectedAt` - when the TCP or TLS connection was established, in milliseconds since the epoch, `null` before that.
137
137
  - `client.lastClientWrite` - when the client last wrote to the server (a command, a literal, the `DONE` that ends IDLE), in milliseconds since the epoch, `null` before the first write. Useful for staying ahead of server inactivity timers.
138
+ - `client.idlingAtClose` - whether the connection was in IDLE (or the polling fallback) when it closed. `idling` is already cleared when the `close` event fires, so this tells a server dropping an idle session from one dropping a session mid-command.
138
139
  - `client.mailboxList` - with `verifyOnly` and `includeMailboxes`, the mailboxes listed before the connection logged out; `undefined` otherwise.
139
140
 
140
141
  See the [Quick Start guide](https://imapflow.com/docs/getting-started/quick-start) for more examples, including Gmail, Outlook, and Yahoo configuration.
@@ -151,6 +151,12 @@ export declare class ImapFlow extends EventEmitter {
151
151
  * (RFC 9051 allows 30 minutes), and this is what their timer measures
152
152
  */
153
153
  lastClientWrite: number | null;
154
+ /**
155
+ * Whether the connection was in IDLE (or the polling fallback) when it closed, `false` while it
156
+ * is open. `idling` itself is already cleared by the time the 'close' event fires, so this is
157
+ * what tells a server dropping an idle session from one dropping a session mid-command
158
+ */
159
+ idlingAtClose: boolean;
154
160
  /** Whether log entries are also emitted as 'log' events, see the `emitLogs` option */
155
161
  emitLogs: boolean;
156
162
  /** Hash algorithm for the fallback message id, see `ImapFlowOptions.idHashAlgorithm` */
@@ -302,6 +302,7 @@ class ImapFlow extends node_events_1.EventEmitter {
302
302
  this.context = this.options.context;
303
303
  this.connectedAt = null;
304
304
  this.lastClientWrite = null;
305
+ this.idlingAtClose = false;
305
306
  this.emitLogs = !!this.options.emitLogs;
306
307
  this.lo = 0;
307
308
  this.untaggedHandlers = {};
@@ -2464,6 +2465,8 @@ class ImapFlow extends node_events_1.EventEmitter {
2464
2465
  // poll or IDLE that unwinds after this point sees that it no longer owns the flag and
2465
2466
  // leaves it alone (see claimIdling() in commands/idle.ts).
2466
2467
  this._idleSession = null;
2468
+ // a later close() finds idling already cleared and keeps what the first one saw
2469
+ this.idlingAtClose = this.idlingAtClose || this.idling;
2467
2470
  this.idling = false;
2468
2471
  this.closeConnectSteps();
2469
2472
  if (typeof this.preCheck === 'function') {
@@ -1,3 +1,3 @@
1
1
  export declare const name = "imapflow";
2
- export declare const version = "2.6.0";
2
+ export declare const version = "2.7.0";
3
3
  export declare const homepage = "https://imapflow.com/";
@@ -3,5 +3,5 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.homepage = exports.version = exports.name = void 0;
5
5
  exports.name = "imapflow";
6
- exports.version = "2.6.0";
6
+ exports.version = "2.7.0";
7
7
  exports.homepage = "https://imapflow.com/";
@@ -151,6 +151,12 @@ export declare class ImapFlow extends EventEmitter {
151
151
  * (RFC 9051 allows 30 minutes), and this is what their timer measures
152
152
  */
153
153
  lastClientWrite: number | null;
154
+ /**
155
+ * Whether the connection was in IDLE (or the polling fallback) when it closed, `false` while it
156
+ * is open. `idling` itself is already cleared by the time the 'close' event fires, so this is
157
+ * what tells a server dropping an idle session from one dropping a session mid-command
158
+ */
159
+ idlingAtClose: boolean;
154
160
  /** Whether log entries are also emitted as 'log' events, see the `emitLogs` option */
155
161
  emitLogs: boolean;
156
162
  /** Hash algorithm for the fallback message id, see `ImapFlowOptions.idHashAlgorithm` */
@@ -259,6 +259,7 @@ export class ImapFlow extends EventEmitter {
259
259
  this.context = this.options.context;
260
260
  this.connectedAt = null;
261
261
  this.lastClientWrite = null;
262
+ this.idlingAtClose = false;
262
263
  this.emitLogs = !!this.options.emitLogs;
263
264
  this.lo = 0;
264
265
  this.untaggedHandlers = {};
@@ -2421,6 +2422,8 @@ export class ImapFlow extends EventEmitter {
2421
2422
  // poll or IDLE that unwinds after this point sees that it no longer owns the flag and
2422
2423
  // leaves it alone (see claimIdling() in commands/idle.ts).
2423
2424
  this._idleSession = null;
2425
+ // a later close() finds idling already cleared and keeps what the first one saw
2426
+ this.idlingAtClose = this.idlingAtClose || this.idling;
2424
2427
  this.idling = false;
2425
2428
  this.closeConnectSteps();
2426
2429
  if (typeof this.preCheck === 'function') {
@@ -1,3 +1,3 @@
1
1
  export declare const name = "imapflow";
2
- export declare const version = "2.6.0";
2
+ export declare const version = "2.7.0";
3
3
  export declare const homepage = "https://imapflow.com/";
@@ -1,4 +1,4 @@
1
1
  // Generated by scripts/build.js from package.json. Do not edit by hand.
2
2
  export const name = "imapflow";
3
- export const version = "2.6.0";
3
+ export const version = "2.7.0";
4
4
  export const homepage = "https://imapflow.com/";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "IMAP Client for Node",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/imap-flow.js",