File tree Expand file tree Collapse file tree 5 files changed +21
-19
lines changed Expand file tree Collapse file tree 5 files changed +21
-19
lines changed Original file line number Diff line number Diff line change 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" : [
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" ,
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change @@ -8,4 +8,4 @@ export default {
88 console . log ( Object . keys ( this . $auth ) ) ;
99 } ,
1010 } ,
11- } ;
11+ } ;
Original file line number Diff line number Diff line change @@ -8,4 +8,4 @@ export default {
88 console . log ( Object . keys ( this . $auth ) ) ;
99 } ,
1010 } ,
11- } ;
11+ } ;
You can’t perform that action at this time.
0 commit comments