@bobfrankston/iflow-direct 0.1.1 → 0.1.3

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/imap-compat.d.ts CHANGED
@@ -37,10 +37,10 @@ export declare class CompatImapClient {
37
37
  fetchMessagesSinceUid(mailbox: string, sinceUid: number, options?: {
38
38
  source?: boolean;
39
39
  }): Promise<any[]>;
40
- /** Fetch messages by date range */
40
+ /** Fetch messages by date range. Optional onChunk callback for incremental processing. */
41
41
  fetchMessageByDate(mailbox: string, start: Date, end?: Date, options?: {
42
42
  source?: boolean;
43
- }): Promise<any[]>;
43
+ }, onChunk?: (msgs: any[]) => void): Promise<any[]>;
44
44
  /** Fetch a single message by UID */
45
45
  fetchMessageByUid(mailbox: string, uid: number, options?: {
46
46
  source?: boolean;
package/imap-compat.js CHANGED
@@ -102,11 +102,12 @@ export class CompatImapClient {
102
102
  await this.native.closeMailbox();
103
103
  return msgs.map(toCompatMessage);
104
104
  }
105
- /** Fetch messages by date range */
106
- async fetchMessageByDate(mailbox, start, end, options) {
105
+ /** Fetch messages by date range. Optional onChunk callback for incremental processing. */
106
+ async fetchMessageByDate(mailbox, start, end, options, onChunk) {
107
107
  await this.ensureConnected();
108
108
  await this.native.select(mailbox);
109
- const msgs = await this.native.fetchByDate(start, end, options);
109
+ const chunkCb = onChunk ? (raw) => onChunk(raw.map(toCompatMessage)) : undefined;
110
+ const msgs = await this.native.fetchByDate(start, end, options, chunkCb);
110
111
  await this.native.closeMailbox();
111
112
  return msgs.map(toCompatMessage);
112
113
  }
package/imap-native.js CHANGED
@@ -537,6 +537,9 @@ export class NativeImapClient {
537
537
  const rest_bytes = encoded.subarray(neededBytes);
538
538
  let literal = new TextDecoder().decode(literal_bytes);
539
539
  this.buffer = new TextDecoder().decode(rest_bytes);
540
+ if (neededBytes !== literal.length) {
541
+ console.log(` [imap] literal: ${neededBytes} bytes → ${literal.length} chars (multi-byte corrected)`);
542
+ }
540
543
  // For non-BODY literals (e.g. display names in ENVELOPE), wrap in quotes
541
544
  // so tokenizeParenList treats them as a single token
542
545
  if (!this.pendingCommand.currentLiteralKey) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/iflow-direct",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Direct IMAP client — transport-agnostic, no Node.js dependencies, browser-ready",
5
5
  "main": "index.js",
6
6
  "types": "index.ts",
File without changes