n8n-nodes-imap-ai
Version:
Simplified IMAP node for n8n with AI-agent support. Clean and modular email and mailbox management for automation workflows.
32 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ListMailboxesOperation = void 0;
const n8n_workflow_1 = require("n8n-workflow");
class ListMailboxesOperation {
async execute(executeFunctions, client, itemIndex) {
try {
const mailboxes = await client.list();
return mailboxes.map((mailbox) => {
var _a, _b;
return ({
json: {
name: mailbox.name,
path: mailbox.path,
delimiter: mailbox.delimiter,
flags: mailbox.flags,
subscribed: mailbox.subscribed,
hasChildren: ((_a = mailbox.flags) === null || _a === void 0 ? void 0 : _a.has('\\HasChildren')) || false,
noSelect: ((_b = mailbox.flags) === null || _b === void 0 ? void 0 : _b.has('\\Noselect')) || false,
},
});
});
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(executeFunctions.getNode(), {
message: `Failed to list mailboxes: ${error.message}`,
});
}
}
}
exports.ListMailboxesOperation = ListMailboxesOperation;
//# sourceMappingURL=listMailboxes.js.map