@bobfrankston/iflow 1.0.48 → 1.0.50

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.
@@ -49,6 +49,10 @@ export declare class CompatImapClient {
49
49
  getMessagesCount(mailbox: string): Promise<number>;
50
50
  /** Get all UIDs in a mailbox */
51
51
  getUids(mailbox: string): Promise<number[]>;
52
+ /** Fetch messages by UID range string (e.g. "100,200,300" or "100:200") */
53
+ fetchMessages(mailbox: string, uidRange: string, options?: {
54
+ source?: boolean;
55
+ }): Promise<any[]>;
52
56
  /** Search messages in a mailbox */
53
57
  searchMessages(mailbox: string, criteria: any): Promise<number[]>;
54
58
  /** Delete a message by UID */
@@ -131,6 +131,14 @@ export class CompatImapClient {
131
131
  await this.native.closeMailbox();
132
132
  return uids;
133
133
  }
134
+ /** Fetch messages by UID range string (e.g. "100,200,300" or "100:200") */
135
+ async fetchMessages(mailbox, uidRange, options) {
136
+ await this.ensureConnected();
137
+ await this.native.select(mailbox);
138
+ const msgs = await this.native.fetchMessages(uidRange, options);
139
+ await this.native.closeMailbox();
140
+ return msgs.map(toCompatMessage);
141
+ }
134
142
  /** Search messages in a mailbox */
135
143
  async searchMessages(mailbox, criteria) {
136
144
  await this.ensureConnected();
@@ -485,8 +485,13 @@ export class NativeImapClient {
485
485
  // Check for literal {size}\r\n — reading exact byte count of literal data
486
486
  if (this.pendingCommand?.literalBytes != null) {
487
487
  if (this.buffer.length >= this.pendingCommand.literalBytes) {
488
- const literal = this.buffer.substring(0, this.pendingCommand.literalBytes);
488
+ let literal = this.buffer.substring(0, this.pendingCommand.literalBytes);
489
489
  this.buffer = this.buffer.substring(this.pendingCommand.literalBytes);
490
+ // For non-BODY literals (e.g. display names in ENVELOPE), wrap in quotes
491
+ // so tokenizeParenList treats them as a single token
492
+ if (!this.pendingCommand.currentLiteralKey) {
493
+ literal = `"${literal.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\r?\n/g, "")}"`;
494
+ }
490
495
  this.pendingCommand.literalBuffer = (this.pendingCommand.literalBuffer || "") + literal;
491
496
  this.pendingCommand.literalBytes = undefined;
492
497
  // Store the literal data by its BODY key for parseFetchResponses
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/iflow",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "IMAP client wrapper library",
5
5
  "main": "index.js",
6
6
  "types": "index.ts",