mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(Email Trigger (IMAP) Node): Limit new mails fetched (#16926)
Co-authored-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { ImapSimple, ImapSimpleOptions, Message } from '@n8n/imap';
|
||||
import type { ImapSimple, ImapSimpleOptions, Message, SearchCriteria } from '@n8n/imap';
|
||||
import { connect as imapConnect, getParts } from '@n8n/imap';
|
||||
import find from 'lodash/find';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
@@ -343,7 +343,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||
// Returns all the new unseen messages
|
||||
const getNewEmails = async (
|
||||
imapConnection: ImapSimple,
|
||||
searchCriteria: Array<string | string[]>,
|
||||
searchCriteria: SearchCriteria[],
|
||||
): Promise<INodeExecutionData[]> => {
|
||||
const format = this.getNodeParameter('format', 0) as string;
|
||||
|
||||
@@ -508,7 +508,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||
const returnedPromise = this.helpers.createDeferredPromise();
|
||||
|
||||
const establishConnection = async (): Promise<ImapSimple> => {
|
||||
let searchCriteria = ['UNSEEN'] as Array<string | string[]>;
|
||||
let searchCriteria: SearchCriteria[] = ['UNSEEN'];
|
||||
if (options.customEmailConfig !== undefined) {
|
||||
try {
|
||||
searchCriteria = JSON.parse(options.customEmailConfig as string);
|
||||
|
||||
Reference in New Issue
Block a user