@marlinjai/email-mcp 1.2.2 → 1.2.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/dist/index.js +11 -8
- package/dist/index.js.map +2 -2
- package/dist/setup/wizard.js +11 -8
- package/dist/setup/wizard.js.map +2 -2
- package/package.json +1 -1
package/dist/setup/wizard.js
CHANGED
|
@@ -1845,7 +1845,8 @@ var ImapAdapter = class {
|
|
|
1845
1845
|
}
|
|
1846
1846
|
async deleteEmail(emailId, permanent, sourceFolder) {
|
|
1847
1847
|
if (!this.client) throw new Error("Not connected");
|
|
1848
|
-
const folder = sourceFolder
|
|
1848
|
+
const folder = sourceFolder ? await this.resolveFolder(sourceFolder) : "INBOX";
|
|
1849
|
+
const trashFolder = await this.resolveFolder("Trash");
|
|
1849
1850
|
let lock;
|
|
1850
1851
|
try {
|
|
1851
1852
|
lock = await this.client.getMailboxLock(folder);
|
|
@@ -1853,10 +1854,10 @@ var ImapAdapter = class {
|
|
|
1853
1854
|
throw formatImapError(error, `Failed to open folder "${folder}"`);
|
|
1854
1855
|
}
|
|
1855
1856
|
try {
|
|
1856
|
-
if (permanent) {
|
|
1857
|
+
if (permanent || folder === trashFolder) {
|
|
1857
1858
|
await this.client.messageDelete(emailId, { uid: true });
|
|
1858
1859
|
} else {
|
|
1859
|
-
await this.client.messageMove(emailId,
|
|
1860
|
+
await this.client.messageMove(emailId, trashFolder, { uid: true });
|
|
1860
1861
|
}
|
|
1861
1862
|
} finally {
|
|
1862
1863
|
lock.release();
|
|
@@ -1889,7 +1890,9 @@ var ImapAdapter = class {
|
|
|
1889
1890
|
async batchDelete(emailIds, permanent, sourceFolder) {
|
|
1890
1891
|
if (!this.client) throw new Error("Not connected");
|
|
1891
1892
|
const result = { succeeded: [], failed: [] };
|
|
1892
|
-
const folder = sourceFolder
|
|
1893
|
+
const folder = sourceFolder ? await this.resolveFolder(sourceFolder) : "INBOX";
|
|
1894
|
+
const trashFolder = await this.resolveFolder("Trash");
|
|
1895
|
+
const shouldPermanentDelete = permanent || folder === trashFolder;
|
|
1893
1896
|
let lock;
|
|
1894
1897
|
try {
|
|
1895
1898
|
lock = await this.client.getMailboxLock(folder);
|
|
@@ -1898,19 +1901,19 @@ var ImapAdapter = class {
|
|
|
1898
1901
|
}
|
|
1899
1902
|
try {
|
|
1900
1903
|
const uidRange = emailIds.join(",");
|
|
1901
|
-
if (
|
|
1904
|
+
if (shouldPermanentDelete) {
|
|
1902
1905
|
await this.client.messageDelete(uidRange, { uid: true });
|
|
1903
1906
|
} else {
|
|
1904
|
-
await this.client.messageMove(uidRange,
|
|
1907
|
+
await this.client.messageMove(uidRange, trashFolder, { uid: true });
|
|
1905
1908
|
}
|
|
1906
1909
|
result.succeeded = [...emailIds];
|
|
1907
1910
|
} catch (error) {
|
|
1908
1911
|
for (const id of emailIds) {
|
|
1909
1912
|
try {
|
|
1910
|
-
if (
|
|
1913
|
+
if (shouldPermanentDelete) {
|
|
1911
1914
|
await this.client.messageDelete(id, { uid: true });
|
|
1912
1915
|
} else {
|
|
1913
|
-
await this.client.messageMove(id,
|
|
1916
|
+
await this.client.messageMove(id, trashFolder, { uid: true });
|
|
1914
1917
|
}
|
|
1915
1918
|
result.succeeded.push(id);
|
|
1916
1919
|
} catch (e) {
|