Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/imap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/imap",
"version": "0.0.5",
"version": "0.0.6",
"description": "Pipedream IMAP Components",
"main": "imap.app.mjs",
"keywords": [
Expand All @@ -13,7 +13,7 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.2.0",
"@pipedream/platform": "^3.1.0",
"imap": "^0.8.19",
"mailparser": "^3.5.0",
"stream": "^0.0.2",
Expand Down
20 changes: 11 additions & 9 deletions components/imap/sources/new-email/new-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "imap-new-email",
name: "New Email",
description: "Emit new event for each new email in a mailbox",
version: "0.0.5",
version: "0.0.6",
type: "source",
dedupe: "unique",
props: {
Expand Down Expand Up @@ -50,7 +50,7 @@ export default {
},
hasNewMessages(box) {
const lastUid = this._getLastUid(box.name);
return !lastUid || box.uidnext > lastUid + 1;
return box.messages.total && (!lastUid || box.uidnext > lastUid + 1);
},
generateMeta(message) {
const date = message.attributes?.date ?? new Date();
Expand All @@ -76,13 +76,15 @@ export default {
const connection = await this.imap.getConnection();
try {
const box = await this.imap.openMailbox(connection, mailbox);
const startSeqno = box.messages.total > 25
? box.messages.total - 24
: 1;
const messageStream = this.imap.fetchMessages(connection, {
startSeqno,
});
await this.processMessageStream(messageStream);
if (box.messages.total) {
const startSeqno = box.messages.total > 25
? box.messages.total - 24
: 1;
const messageStream = this.imap.fetchMessages(connection, {
startSeqno,
});
await this.processMessageStream(messageStream);
}
} finally {
await this.imap.closeConnection(connection);
}
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading