🤖 Merge PR #65592 [imap-simple] expose imap field type by @tennox

* [imap-simple] expose imap field type

imap-simple allows to access the underlying `node-imap` instance, but the types were not including it.

* [imap-simple] add test & remove illegal whitespace

* whitespace fix index.d.ts

---------

Co-authored-by: Manu [tennox] <tennox+git@txlab.io>
This commit is contained in:
Manuel
2023-06-13 23:07:01 +01:00
committed by GitHub
parent 6dd9877533
commit 65fd569224
2 changed files with 4 additions and 0 deletions

View File

@@ -117,6 +117,7 @@ imaps.connect(config).then(connection => {
imaps.connect(config).then(function (connection) {
connection.openBox('INBOX').then(function () {
console.log("Connection state:", connection.imap.state);
const searchCriteria = ['ALL'];
const fetchOptions = { bodies: ['TEXT'], struct: true };
return connection.search(searchCriteria, fetchOptions);

View File

@@ -40,6 +40,9 @@ export interface Message {
export class ImapSimple extends EventEmitter {
constructor(imap: Imap);
/** Access underlying `node-imap` instance */
imap: Imap; // https://github.com/chadxz/imap-simple/blob/master/lib/imapSimple.js#L22
/** Open a mailbox, calling the provided callback with signature (err, boxName), or resolves the returned promise with boxName. */
openBox(boxName: string, callback: (err: Error, boxName: string) => void): void;
openBox(boxName: string): Promise<string>;