@bobfrankston/iflow-direct 0.1.6 → 0.1.8
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/gmail.d.ts +2 -0
- package/gmail.js +3 -0
- package/imap-compat.js +35 -14
- package/imap-native.d.ts +2 -1
- package/imap-native.js +4 -2
- package/package.json +1 -1
- package/types.d.ts +1 -0
package/gmail.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface GmailOAuthConfig {
|
|
|
9
9
|
tokenProvider: TokenProvider;
|
|
10
10
|
verbose?: boolean;
|
|
11
11
|
rejectUnauthorized?: boolean;
|
|
12
|
+
inactivityTimeout?: number;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Check if email address is Gmail
|
|
@@ -35,5 +36,6 @@ export declare function createAutoImapConfig(config: {
|
|
|
35
36
|
tokenProvider?: TokenProvider;
|
|
36
37
|
verbose?: boolean;
|
|
37
38
|
rejectUnauthorized?: boolean;
|
|
39
|
+
inactivityTimeout?: number;
|
|
38
40
|
}): ImapClientConfig;
|
|
39
41
|
//# sourceMappingURL=gmail.d.ts.map
|
package/gmail.js
CHANGED
|
@@ -33,6 +33,7 @@ export function createGmailConfig(config) {
|
|
|
33
33
|
tokenProvider: config.tokenProvider,
|
|
34
34
|
verbose: config.verbose,
|
|
35
35
|
rejectUnauthorized: config.rejectUnauthorized,
|
|
36
|
+
inactivityTimeout: config.inactivityTimeout,
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
@@ -50,6 +51,7 @@ export function createAutoImapConfig(config) {
|
|
|
50
51
|
tokenProvider: config.tokenProvider,
|
|
51
52
|
verbose: config.verbose,
|
|
52
53
|
rejectUnauthorized: config.rejectUnauthorized,
|
|
54
|
+
inactivityTimeout: config.inactivityTimeout,
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
else {
|
|
@@ -60,6 +62,7 @@ export function createAutoImapConfig(config) {
|
|
|
60
62
|
password: config.password,
|
|
61
63
|
verbose: config.verbose,
|
|
62
64
|
rejectUnauthorized: config.rejectUnauthorized,
|
|
65
|
+
inactivityTimeout: config.inactivityTimeout,
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
68
|
}
|
package/imap-compat.js
CHANGED
|
@@ -73,24 +73,45 @@ export class CompatImapClient {
|
|
|
73
73
|
}
|
|
74
74
|
/** Detect special folders from folder list */
|
|
75
75
|
getSpecialFolders(folders) {
|
|
76
|
+
// Match IMAP special-use flags (RFC 6154) first, then fall back to exact
|
|
77
|
+
// LEAF NAME match. Do NOT use substring matches on the full path —
|
|
78
|
+
// "Drafts.Older" used to get tagged as the Drafts folder because of a
|
|
79
|
+
// lower.includes("draft") test, which made it impossible to rename or
|
|
80
|
+
// delete the subfolder.
|
|
76
81
|
const result = {};
|
|
82
|
+
const leafName = (f) => {
|
|
83
|
+
const delim = f.delimiter || ".";
|
|
84
|
+
return (f.path.split(delim).pop() || f.path).toLowerCase();
|
|
85
|
+
};
|
|
77
86
|
for (const f of folders) {
|
|
78
|
-
const
|
|
87
|
+
const name = leafName(f);
|
|
79
88
|
const flags = f.flags.map(fl => fl.toLowerCase());
|
|
80
|
-
if (flags.includes("\\inbox") ||
|
|
81
|
-
result.inbox
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
else if (flags.includes("\\
|
|
85
|
-
result.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
else if (flags.includes("\\
|
|
89
|
-
result.
|
|
90
|
-
|
|
89
|
+
if (flags.includes("\\inbox") || name === "inbox") {
|
|
90
|
+
if (!result.inbox)
|
|
91
|
+
result.inbox = f.path;
|
|
92
|
+
}
|
|
93
|
+
else if (flags.includes("\\sent") || name === "sent" || name === "sent items" || name === "sent mail") {
|
|
94
|
+
if (!result.sent)
|
|
95
|
+
result.sent = f.path;
|
|
96
|
+
}
|
|
97
|
+
else if (flags.includes("\\trash") || name === "trash" || name === "deleted items" || name === "deleted") {
|
|
98
|
+
if (!result.trash)
|
|
99
|
+
result.trash = f.path;
|
|
100
|
+
}
|
|
101
|
+
else if (flags.includes("\\drafts") || name === "drafts" || name === "draft") {
|
|
102
|
+
if (!result.drafts)
|
|
103
|
+
result.drafts = f.path;
|
|
104
|
+
}
|
|
105
|
+
else if (flags.includes("\\junk") || flags.includes("\\spam") || name === "spam" || name === "junk" || name === "junk email" || name === "junk e-mail") {
|
|
106
|
+
if (!result.junk)
|
|
107
|
+
result.junk = f.path;
|
|
108
|
+
if (!result.spam)
|
|
109
|
+
result.spam = f.path;
|
|
110
|
+
}
|
|
111
|
+
else if (flags.includes("\\archive") || name === "archive" || name === "archives") {
|
|
112
|
+
if (!result.archive)
|
|
113
|
+
result.archive = f.path;
|
|
91
114
|
}
|
|
92
|
-
else if (flags.includes("\\archive") || lower === "archive")
|
|
93
|
-
result.archive = f.path;
|
|
94
115
|
}
|
|
95
116
|
return result;
|
|
96
117
|
}
|
package/imap-native.d.ts
CHANGED
|
@@ -118,7 +118,8 @@ export declare class NativeImapClient {
|
|
|
118
118
|
/** Inactivity timeout — how long to wait with NO data before declaring the connection dead.
|
|
119
119
|
* This is NOT a wall-clock timeout. Timer resets every time data arrives from the server.
|
|
120
120
|
* A large FETCH returning data continuously will never timeout.
|
|
121
|
-
* 60s accommodates Gmail which is slow on SEARCH for large folders.
|
|
121
|
+
* 60s accommodates Gmail which is slow on SEARCH for large folders.
|
|
122
|
+
* Overridable via ImapClientConfig.inactivityTimeout — slow Dovecot servers need 180s+. */
|
|
122
123
|
private inactivityTimeout;
|
|
123
124
|
/** Fetch chunk sizes — start small for quick first paint, ramp up for throughput */
|
|
124
125
|
private static INITIAL_CHUNK_SIZE;
|
package/imap-native.js
CHANGED
|
@@ -28,6 +28,7 @@ export class NativeImapClient {
|
|
|
28
28
|
this.transportFactory = transportFactory;
|
|
29
29
|
this.transport = transportFactory();
|
|
30
30
|
this.verbose = config.verbose || false;
|
|
31
|
+
this.inactivityTimeout = config.inactivityTimeout ?? 60000;
|
|
31
32
|
}
|
|
32
33
|
get connected() { return this._connected; }
|
|
33
34
|
// ── Connection ──
|
|
@@ -457,8 +458,9 @@ export class NativeImapClient {
|
|
|
457
458
|
/** Inactivity timeout — how long to wait with NO data before declaring the connection dead.
|
|
458
459
|
* This is NOT a wall-clock timeout. Timer resets every time data arrives from the server.
|
|
459
460
|
* A large FETCH returning data continuously will never timeout.
|
|
460
|
-
* 60s accommodates Gmail which is slow on SEARCH for large folders.
|
|
461
|
-
|
|
461
|
+
* 60s accommodates Gmail which is slow on SEARCH for large folders.
|
|
462
|
+
* Overridable via ImapClientConfig.inactivityTimeout — slow Dovecot servers need 180s+. */
|
|
463
|
+
inactivityTimeout;
|
|
462
464
|
/** Fetch chunk sizes — start small for quick first paint, ramp up for throughput */
|
|
463
465
|
static INITIAL_CHUNK_SIZE = 25;
|
|
464
466
|
static MAX_CHUNK_SIZE = 500;
|
package/package.json
CHANGED