@marlinjai/email-mcp 1.2.7 → 1.2.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/dist/index.js +24 -19
- package/dist/index.js.map +2 -2
- package/dist/setup/wizard.js +24 -19
- package/dist/setup/wizard.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8399,14 +8399,7 @@ var init_adapter3 = __esm({
|
|
|
8399
8399
|
}
|
|
8400
8400
|
try {
|
|
8401
8401
|
const mailboxExists = this.client.mailbox?.exists ?? 0;
|
|
8402
|
-
|
|
8403
|
-
try {
|
|
8404
|
-
const status = await this.client.status(folder, { messages: true });
|
|
8405
|
-
statusCount = status.messages ?? 0;
|
|
8406
|
-
} catch {
|
|
8407
|
-
}
|
|
8408
|
-
const effectiveCount = Math.max(mailboxExists, statusCount);
|
|
8409
|
-
if (effectiveCount === 0) {
|
|
8402
|
+
if (mailboxExists === 0) {
|
|
8410
8403
|
return [];
|
|
8411
8404
|
}
|
|
8412
8405
|
const criteria = this.buildSearchCriteria(query);
|
|
@@ -8419,7 +8412,11 @@ var init_adapter3 = __esm({
|
|
|
8419
8412
|
);
|
|
8420
8413
|
allUids = Array.isArray(searchResult) ? searchResult : [];
|
|
8421
8414
|
} catch {
|
|
8422
|
-
|
|
8415
|
+
try {
|
|
8416
|
+
allUids = await this.collectUidsViaFetch(query);
|
|
8417
|
+
} catch {
|
|
8418
|
+
return [];
|
|
8419
|
+
}
|
|
8423
8420
|
}
|
|
8424
8421
|
const offset = query.offset || 0;
|
|
8425
8422
|
const slicedUids = query.limit ? allUids.slice(offset, offset + query.limit) : allUids.slice(offset);
|
|
@@ -8481,19 +8478,27 @@ var init_adapter3 = __esm({
|
|
|
8481
8478
|
async fetchEmails(uids, folder, returnBody) {
|
|
8482
8479
|
if (!this.client) return [];
|
|
8483
8480
|
const emails = [];
|
|
8484
|
-
|
|
8485
|
-
|
|
8481
|
+
const fetchOpts = returnBody ? { source: true, uid: true, flags: true } : { envelope: true, uid: true, flags: true, bodyStructure: true };
|
|
8482
|
+
const uidRange = uids.join(",");
|
|
8483
|
+
let messages;
|
|
8484
|
+
try {
|
|
8485
|
+
messages = await this.client.fetchAll(uidRange, fetchOpts, { uid: true });
|
|
8486
|
+
} catch {
|
|
8487
|
+
messages = [];
|
|
8488
|
+
for (const uid of uids) {
|
|
8489
|
+
try {
|
|
8490
|
+
const batch = await this.client.fetchAll(String(uid), fetchOpts, { uid: true });
|
|
8491
|
+
messages.push(...batch);
|
|
8492
|
+
} catch {
|
|
8493
|
+
}
|
|
8494
|
+
}
|
|
8495
|
+
}
|
|
8496
|
+
for (const msg of messages) {
|
|
8497
|
+
if (returnBody) {
|
|
8486
8498
|
const parsed = await simpleParser(msg.source);
|
|
8487
8499
|
parsed.flags = msg.flags;
|
|
8488
8500
|
emails.push(mapParsedEmail(parsed, folder, this.accountId, msg.uid));
|
|
8489
|
-
}
|
|
8490
|
-
} else {
|
|
8491
|
-
for await (const msg of this.client.fetch(uids, {
|
|
8492
|
-
envelope: true,
|
|
8493
|
-
uid: true,
|
|
8494
|
-
flags: true,
|
|
8495
|
-
bodyStructure: true
|
|
8496
|
-
})) {
|
|
8501
|
+
} else {
|
|
8497
8502
|
const env = msg.envelope;
|
|
8498
8503
|
emails.push({
|
|
8499
8504
|
id: String(msg.uid),
|