Skip to content

Commit 480a514

Browse files
authored
IMAP - new-email source bug fix (#18616)
* bug fix * pnpm-lock.yaml
1 parent 2f231bc commit 480a514

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

components/imap/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/imap",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "Pipedream IMAP Components",
55
"main": "imap.app.mjs",
66
"keywords": [
@@ -13,7 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.2.0",
16+
"@pipedream/platform": "^3.1.0",
1717
"imap": "^0.8.19",
1818
"mailparser": "^3.5.0",
1919
"stream": "^0.0.2",

components/imap/sources/new-email/new-email.mjs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
key: "imap-new-email",
1010
name: "New Email",
1111
description: "Emit new event for each new email in a mailbox",
12-
version: "0.0.5",
12+
version: "0.0.6",
1313
type: "source",
1414
dedupe: "unique",
1515
props: {
@@ -50,7 +50,7 @@ export default {
5050
},
5151
hasNewMessages(box) {
5252
const lastUid = this._getLastUid(box.name);
53-
return !lastUid || box.uidnext > lastUid + 1;
53+
return box.messages.total && (!lastUid || box.uidnext > lastUid + 1);
5454
},
5555
generateMeta(message) {
5656
const date = message.attributes?.date ?? new Date();
@@ -76,13 +76,15 @@ export default {
7676
const connection = await this.imap.getConnection();
7777
try {
7878
const box = await this.imap.openMailbox(connection, mailbox);
79-
const startSeqno = box.messages.total > 25
80-
? box.messages.total - 24
81-
: 1;
82-
const messageStream = this.imap.fetchMessages(connection, {
83-
startSeqno,
84-
});
85-
await this.processMessageStream(messageStream);
79+
if (box.messages.total) {
80+
const startSeqno = box.messages.total > 25
81+
? box.messages.total - 24
82+
: 1;
83+
const messageStream = this.imap.fetchMessages(connection, {
84+
startSeqno,
85+
});
86+
await this.processMessageStream(messageStream);
87+
}
8688
} finally {
8789
await this.imap.closeConnection(connection);
8890
}

components/kudosity/kudosity.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/stackby/stackby.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)