@bobfrankston/iflow 1.0.50 → 1.0.51
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/imaplib/imap-compat.d.ts +2 -0
- package/imaplib/imap-compat.js +8 -0
- package/imaplib/imap-native.d.ts +2 -0
- package/imaplib/imap-native.js +16 -26
- package/package.json +1 -1
package/imaplib/imap-compat.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export declare class CompatImapClient {
|
|
|
55
55
|
}): Promise<any[]>;
|
|
56
56
|
/** Search messages in a mailbox */
|
|
57
57
|
searchMessages(mailbox: string, criteria: any): Promise<number[]>;
|
|
58
|
+
/** Search by header value — returns matching UIDs */
|
|
59
|
+
searchByHeader(mailbox: string, headerName: string, headerValue: string): Promise<number[]>;
|
|
58
60
|
/** Delete a message by UID */
|
|
59
61
|
deleteMessageByUid(mailbox: string, uid: number): Promise<void>;
|
|
60
62
|
/** Move a message between mailboxes (same server) */
|
package/imaplib/imap-compat.js
CHANGED
|
@@ -162,6 +162,14 @@ export class CompatImapClient {
|
|
|
162
162
|
await this.native.closeMailbox();
|
|
163
163
|
return uids;
|
|
164
164
|
}
|
|
165
|
+
/** Search by header value — returns matching UIDs */
|
|
166
|
+
async searchByHeader(mailbox, headerName, headerValue) {
|
|
167
|
+
await this.ensureConnected();
|
|
168
|
+
await this.native.select(mailbox);
|
|
169
|
+
const uids = await this.native.search(`HEADER ${headerName} "${headerValue}"`);
|
|
170
|
+
await this.native.closeMailbox();
|
|
171
|
+
return uids;
|
|
172
|
+
}
|
|
165
173
|
/** Delete a message by UID */
|
|
166
174
|
async deleteMessageByUid(mailbox, uid) {
|
|
167
175
|
await this.ensureConnected();
|
package/imaplib/imap-native.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ export declare class NativeImapClient {
|
|
|
58
58
|
private selectedMailbox;
|
|
59
59
|
private mailboxInfo;
|
|
60
60
|
private greetingResolve;
|
|
61
|
+
/** Callback for waitForContinuation — set when waiting for "+" response */
|
|
62
|
+
private continuationResolve;
|
|
61
63
|
constructor(config: ImapClientConfig, transportFactory: TransportFactory);
|
|
62
64
|
get connected(): boolean;
|
|
63
65
|
connect(): Promise<void>;
|
package/imaplib/imap-native.js
CHANGED
|
@@ -21,6 +21,8 @@ export class NativeImapClient {
|
|
|
21
21
|
selectedMailbox = null;
|
|
22
22
|
mailboxInfo = { exists: 0, recent: 0, uidNext: 0, uidValidity: 0, flags: [], permanentFlags: [] };
|
|
23
23
|
greetingResolve = null;
|
|
24
|
+
/** Callback for waitForContinuation — set when waiting for "+" response */
|
|
25
|
+
continuationResolve = null;
|
|
24
26
|
constructor(config, transportFactory) {
|
|
25
27
|
this.config = config;
|
|
26
28
|
this.transportFactory = transportFactory;
|
|
@@ -445,30 +447,15 @@ export class NativeImapClient {
|
|
|
445
447
|
}
|
|
446
448
|
waitForContinuation(tag) {
|
|
447
449
|
return new Promise((resolve) => {
|
|
448
|
-
const timeout = setTimeout(() =>
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
clearTimeout(timeout);
|
|
457
|
-
resolve(resp);
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
// Not continuation — process and keep waiting
|
|
461
|
-
this.buffer = this.buffer.substring(lineEnd + 2);
|
|
462
|
-
this.handleUntaggedResponse(resp);
|
|
463
|
-
}
|
|
464
|
-
if (this.transport.connected)
|
|
465
|
-
setTimeout(check, 5);
|
|
466
|
-
else {
|
|
467
|
-
clearTimeout(timeout);
|
|
468
|
-
resolve(null);
|
|
469
|
-
}
|
|
450
|
+
const timeout = setTimeout(() => {
|
|
451
|
+
this.continuationResolve = null;
|
|
452
|
+
resolve(null);
|
|
453
|
+
}, 30000);
|
|
454
|
+
this.continuationResolve = (resp) => {
|
|
455
|
+
clearTimeout(timeout);
|
|
456
|
+
this.continuationResolve = null;
|
|
457
|
+
resolve(resp);
|
|
470
458
|
};
|
|
471
|
-
check();
|
|
472
459
|
});
|
|
473
460
|
}
|
|
474
461
|
waitForTagged(tag) {
|
|
@@ -583,9 +570,12 @@ export class NativeImapClient {
|
|
|
583
570
|
}
|
|
584
571
|
// Continuation response
|
|
585
572
|
if (resp.tag === "+") {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
573
|
+
if (this.continuationResolve) {
|
|
574
|
+
// APPEND or other command waiting for continuation
|
|
575
|
+
this.continuationResolve(resp);
|
|
576
|
+
}
|
|
577
|
+
else if (!this.idleTag && this.pendingCommand) {
|
|
578
|
+
// Unexpected continuation (e.g. AUTHENTICATE challenge) — cancel
|
|
589
579
|
this.transport.write("\r\n").catch(() => { });
|
|
590
580
|
}
|
|
591
581
|
continue;
|