Comparing version 1.0.6 to 1.0.7
# CHANGELOG | ||
- v1.0.7 - 2020-01-31 | ||
- Added new method `getMailboxLock()` to lock a mailbox for usage | ||
- Added new connection events "mailboxOpen" and "mailboxClose" | ||
- v1.0.6 - 2020-01-30 | ||
@@ -4,0 +9,0 @@ |
@@ -13,2 +13,7 @@ { | ||
"outputSourceFiles": false | ||
}, | ||
"search": { | ||
"apiKey": "082c6635b32d44ed095369a5f1c790fd", | ||
"indexName": "imapflow", | ||
"hitsPerPage": 7 | ||
} | ||
@@ -15,0 +20,0 @@ }, |
@@ -14,4 +14,10 @@ 'use strict'; | ||
response.next(); | ||
let currentMailbox = connection.mailbox; | ||
connection.mailbox = false; | ||
connection.state = connection.states.AUTHENTICATED; | ||
if (currentMailbox) { | ||
connection.emit('mailboxClose', currentMailbox); | ||
} | ||
return true; | ||
@@ -18,0 +24,0 @@ } catch (err) { |
@@ -12,3 +12,3 @@ 'use strict'; | ||
if (!connection.capabilites.has('QUOTA')) { | ||
if (!connection.capabilities.has('QUOTA')) { | ||
return false; | ||
@@ -15,0 +15,0 @@ } |
@@ -117,5 +117,16 @@ 'use strict'; | ||
let currentMailbox = connection.mailbox; | ||
connection.mailbox = false; | ||
if (currentMailbox && currentMailbox.path !== path) { | ||
connection.emit('mailboxClose', currentMailbox); | ||
} | ||
connection.mailbox = map; | ||
connection.state = connection.states.SELECTED; | ||
if (!currentMailbox || currentMailbox.path !== path) { | ||
connection.emit('mailboxOpen', connection.mailbox); | ||
} | ||
response.next(); | ||
@@ -132,4 +143,11 @@ return map; | ||
// reset selected state | ||
let currentMailbox = connection.mailbox; | ||
connection.mailbox = false; | ||
connection.state = connection.states.AUTHENTICATED; | ||
if (currentMailbox) { | ||
connection.emit('mailboxClose', currentMailbox); | ||
} | ||
} | ||
@@ -136,0 +154,0 @@ |
@@ -243,2 +243,5 @@ 'use strict'; | ||
map.modseq = BigInt(getArray(attribute)[0]); | ||
if (!mailbox.highestModseq || mailbox.highestModseq < map.modseq) { | ||
mailbox.highestModseq = map.modseq; | ||
} | ||
break; | ||
@@ -245,0 +248,0 @@ |
@@ -14,5 +14,5 @@ /// <reference types="node" /> | ||
* @param {Boolean} [options.secure=false] Should the connection be established over TLS. | ||
* If *false* then connection is upgraded to TLS using STARTTLS extension before authentication | ||
* If `false` then connection is upgraded to TLS using STARTTLS extension before authentication | ||
* @param {String} [options.servername] Servername for SNI (or when host is set to an IP address) | ||
* @param {Boolean} [options.disableCompression=false] if *true* then client does not try to use COMPRESS=DEFLATE extension | ||
* @param {Boolean} [options.disableCompression=false] if `true` then client does not try to use COMPRESS=DEFLATE extension | ||
* @param {Object} options.auth Authentication options. Authentication is requested automatically during <code>connect()</code> | ||
@@ -22,5 +22,5 @@ * @param {String} options.auth.user Usename | ||
* @param {IdInfoObject} [options.clientInfo] Client identification info | ||
* @param {Boolean} [options.disableAutoIdle=false] if *true* then IDLE is not started automatically. Useful if you only need to perform specific tasks over the connection | ||
* @param {Boolean} [options.disableAutoIdle=false] if `true` then IDLE is not started automatically. Useful if you only need to perform specific tasks over the connection | ||
* @param {Object} options.tls Additional TLS options (see [Node.js TLS connect](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback") for all available options) | ||
* @param {Boolean} [options.tls.rejectUnauthorized=true] if *false* then client accepts self-signed and expired certificates from the server | ||
* @param {Boolean} [options.tls.rejectUnauthorized=true] if `false` then client accepts self-signed and expired certificates from the server | ||
* @param {String} [options.tls.minVersion=TLSv1.2] latest Node.js defaults to *'TLSv1.2'*, for older mail servers you might need to use something else, eg *'TLSv1'* | ||
@@ -72,9 +72,10 @@ * @param {Number} [options.tls.minDHSize=1024] Minimum size of the DH parameter in bits to accept a TLS connection | ||
/** | ||
* Currently selected mailbox or *false* if mailbox is not open | ||
* @type {MailboxObject} | ||
* Currently selected mailbox or `false` if mailbox is not open | ||
* @type {MailboxObject|Boolean} | ||
*/ | ||
mailbox: MailboxObject; | ||
mailbox: MailboxObject | boolean; | ||
/** | ||
* Initiates a connection against IMAP server. Throws if anything goes wrong. This is something you have to call before you can run any IMAP commands | ||
* | ||
* @throws Will throw an error if connection or authentication fails | ||
* @example | ||
@@ -109,3 +110,3 @@ * let client = new ImapFlow({...}); | ||
* @param {String} [path] Optional mailbox path if you want to check quota for specific folder | ||
* @returns {Boolean|QuotaResponse} Quota information or *false* if QUTOA extension is not supported | ||
* @returns {QuotaResponse|Boolean} Quota information or `false` if QUTOA extension is not supported or requested path does not exist | ||
* | ||
@@ -116,3 +117,3 @@ * @example | ||
*/ | ||
getQuota(path?: string): boolean | QuotaResponse; | ||
getQuota(path?: string): QuotaResponse | boolean; | ||
/** | ||
@@ -147,2 +148,3 @@ * Lists available mailboxes as an Array | ||
* @returns {MailboxCreateResponse} Mailbox info | ||
* @throws Will throw an error if mailbox can not be created | ||
* | ||
@@ -161,2 +163,3 @@ * @example | ||
* @returns {MailboxRenameResponse} Mailbox info | ||
* @throws Will throw an error if mailbox does not exist or can not be renamed | ||
* | ||
@@ -174,2 +177,3 @@ * @example | ||
* @returns {MailboxDeleteResponse} Mailbox info | ||
* @throws Will throw an error if mailbox does not exist or can not be deleted | ||
* | ||
@@ -186,3 +190,3 @@ * @example | ||
* @param {string|array} path Path for the mailbox to subscribe to. Unicode is allowed. If value is an array then it is joined using current delimiter symbols. Namespace prefix is added automatically if required. | ||
* @returns {Boolean} *true* if subscription operation succeeded, *false* otherwise | ||
* @returns {Boolean} `true` if subscription operation succeeded, `false` otherwise | ||
* | ||
@@ -197,3 +201,3 @@ * @example | ||
* @param {string|array} path **Path for the mailbox** to unsubscribe from. Unicode is allowed. If value is an array then it is joined using current delimiter symbols. Namespace prefix is added automatically if required. | ||
* @returns {Boolean} *true* if unsubscription operation succeeded, *false* otherwise | ||
* @returns {Boolean} `true` if unsubscription operation succeeded, `false` otherwise | ||
* | ||
@@ -206,7 +210,10 @@ * @example | ||
* Opens a mailbox to access messages. You can perform message operations only against an opened mailbox. | ||
* Using {@link module:imapflow~ImapFlow#getMailboxLock|getMailboxLock()} instead of `mailboxOpen()` is preferred. Both do the same thing | ||
* but next `getMailboxLock()` call is not executed until previous one is released. | ||
* | ||
* @param {string|array} path **Path for the mailbox** to open | ||
* @param {Object} [options] optional options | ||
* @param {Boolean} [options.readOnly=false] If *true* then opens mailbox in read-only mode. You can still try to perform write operations but these would probably fail. | ||
* @param {Boolean} [options.readOnly=false] If `true` then opens mailbox in read-only mode. You can still try to perform write operations but these would probably fail. | ||
* @returns {MailboxObject} Mailbox info | ||
* @throws Will throw an error if mailbox does not exist or can not be opened | ||
* | ||
@@ -236,8 +243,8 @@ * @example | ||
* @param {Object} query defines requested status items | ||
* @param {Boolean} query.messages if *true* request count of messages | ||
* @param {Boolean} query.recent if *true* request count of messages with \\Recent tag | ||
* @param {Boolean} query.uidNext if *true* request predicted next UID | ||
* @param {Boolean} query.uidValidity if *true* request mailbox UIDVALIDITY value | ||
* @param {Boolean} query.unseen if *true* request count of unseen messages | ||
* @param {Boolean} query.highestModseq if *true* request last known modseq value | ||
* @param {Boolean} query.messages if `true` request count of messages | ||
* @param {Boolean} query.recent if `true` request count of messages with \\Recent tag | ||
* @param {Boolean} query.uidNext if `true` request predicted next UID | ||
* @param {Boolean} query.uidValidity if `true` request mailbox `UIDVALIDITY` value | ||
* @param {Boolean} query.unseen if `true` request count of unseen messages | ||
* @param {Boolean} query.highestModseq if `true` request last known modseq value | ||
* @returns {StatusObject} status of the indicated mailbox | ||
@@ -259,3 +266,3 @@ * | ||
/** | ||
* Starts listening for new or deleted messages from the currently opened mailbox. Only required if {@link ImapFlow#disableAutoIdle} is set to *true* | ||
* Starts listening for new or deleted messages from the currently opened mailbox. Only required if {@link ImapFlow#disableAutoIdle} is set to `true` | ||
* otherwise IDLE is started by default on connection inactivity. | ||
@@ -274,6 +281,6 @@ * | ||
* | ||
* @param {SequenceString | SearchObject} range Range to filter the messages | ||
* @param {SequenceString | Number[] | SearchObject} range Range to filter the messages | ||
* @param {string[]} Array of flags to set. Only flags that are permitted to set are used, other flags are ignored | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then uses UID {@link SequenceString} instead of sequence numbers | ||
* @param {Boolean} [options.uid] If `true` then uses UID {@link SequenceString} instead of sequence numbers | ||
* @returns {Boolean} Did the operation succeed or not | ||
@@ -286,3 +293,3 @@ * | ||
*/ | ||
messageFlagsSet(range: SequenceString | SearchObject, Array: string[], options?: { | ||
messageFlagsSet(range: SequenceString | Number[] | SearchObject, Array: string[], options?: { | ||
uid?: boolean; | ||
@@ -293,6 +300,6 @@ }): boolean; | ||
* | ||
* @param {SequenceString | SearchObject} range Range to filter the messages | ||
* @param {SequenceString | Number[] | SearchObject} range Range to filter the messages | ||
* @param {string[]} Array of flags to set. Only flags that are permitted to set are used, other flags are ignored | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then uses UID {@link SequenceString} instead of sequence numbers | ||
* @param {Boolean} [options.uid] If `true` then uses UID {@link SequenceString} instead of sequence numbers | ||
* @returns {Boolean} Did the operation succeed or not | ||
@@ -305,3 +312,3 @@ * | ||
*/ | ||
messageFlagsAdd(range: SequenceString | SearchObject, Array: string[], options?: { | ||
messageFlagsAdd(range: SequenceString | Number[] | SearchObject, Array: string[], options?: { | ||
uid?: boolean; | ||
@@ -312,6 +319,6 @@ }): boolean; | ||
* | ||
* @param {SequenceString | SearchObject} range Range to filter the messages | ||
* @param {SequenceString | Number[] | SearchObject} range Range to filter the messages | ||
* @param {string[]} Array of flags to remove. Only flags that are permitted to set are used, other flags are ignored | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then uses UID {@link SequenceString} instead of sequence numbers | ||
* @param {Boolean} [options.uid] If `true` then uses UID {@link SequenceString} instead of sequence numbers | ||
* @returns {Boolean} Did the operation succeed or not | ||
@@ -324,3 +331,3 @@ * | ||
*/ | ||
messageFlagsRemove(range: SequenceString | SearchObject, Array: string[], options?: { | ||
messageFlagsRemove(range: SequenceString | Number[] | SearchObject, Array: string[], options?: { | ||
uid?: boolean; | ||
@@ -332,5 +339,5 @@ }): boolean; | ||
* | ||
* @param {SequenceString | SearchObject} range Range to filter the messages | ||
* @param {SequenceString | Number[] | SearchObject} range Range to filter the messages | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then uses UID {@link SequenceString} instead of sequence numbers | ||
* @param {Boolean} [options.uid] If `true` then uses UID {@link SequenceString} instead of sequence numbers | ||
* @returns {Boolean} Did the operation succeed or not | ||
@@ -343,3 +350,3 @@ * | ||
*/ | ||
messageDelete(range: SequenceString | SearchObject, options?: { | ||
messageDelete(range: SequenceString | Number[] | SearchObject, options?: { | ||
uid?: boolean; | ||
@@ -363,6 +370,6 @@ }): boolean; | ||
* | ||
* @param {SequenceString | SearchObject} range Range of messages to copy | ||
* @param {SequenceString | Number[] | SearchObject} range Range of messages to copy | ||
* @param {String} destination Mailbox path to copy the messages to | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then uses UID {@link SequenceString} instead of sequence numbers | ||
* @param {Boolean} [options.uid] If `true` then uses UID {@link SequenceString} instead of sequence numbers | ||
* @returns {CopyResponseObject} info about copies messages | ||
@@ -376,3 +383,3 @@ * | ||
*/ | ||
messageCopy(range: SequenceString | SearchObject, destination: string, options?: { | ||
messageCopy(range: SequenceString | Number[] | SearchObject, destination: string, options?: { | ||
uid?: boolean; | ||
@@ -383,6 +390,6 @@ }): CopyResponseObject; | ||
* | ||
* @param {SequenceString | SearchObject} range Range of messages to move | ||
* @param {SequenceString | Number[] | SearchObject} range Range of messages to move | ||
* @param {String} destination Mailbox path to move the messages to | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then uses UID {@link SequenceString} instead of sequence numbers | ||
* @param {Boolean} [options.uid] If `true` then uses UID {@link SequenceString} instead of sequence numbers | ||
* @returns {CopyResponseObject} info about moved messages | ||
@@ -396,3 +403,3 @@ * | ||
*/ | ||
messageMove(range: SequenceString | SearchObject, destination: string, options?: { | ||
messageMove(range: SequenceString | Number[] | SearchObject, destination: string, options?: { | ||
uid?: boolean; | ||
@@ -405,3 +412,3 @@ }): CopyResponseObject; | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then returns UID numbers instead of sequence numbers | ||
* @param {Boolean} [options.uid] If `true` then returns UID numbers instead of sequence numbers | ||
* @returns {number[]} An array of sequence or UID numbers | ||
@@ -420,6 +427,6 @@ * | ||
* | ||
* @param {SequenceString | SearchObject} range Range of messages to fetch | ||
* @param {SequenceString | Number[] | SearchObject} range Range of messages to fetch | ||
* @param {FetchQueryObject} query Fetch query | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then uses UID numbers instead of sequence numbers for range | ||
* @param {Boolean} [options.uid] If `true` then uses UID numbers instead of sequence numbers for range | ||
* @yields {FetchMessageObject} Message data object | ||
@@ -434,3 +441,3 @@ * | ||
*/ | ||
fetch(range: SequenceString | SearchObject, query: FetchQueryObject, options?: { | ||
fetch(range: SequenceString | Number[] | SearchObject, query: FetchQueryObject, options?: { | ||
uid?: boolean; | ||
@@ -444,3 +451,3 @@ }): void; | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then uses UID number instead of sequence number for range | ||
* @param {Boolean} [options.uid] If `true` then uses UID number instead of sequence number for range | ||
* @returns {FetchMessageObject} Message data object | ||
@@ -465,3 +472,3 @@ * | ||
* @param {Object} [options] | ||
* @param {Boolean} [options.uid] If *true* then uses UID number instead of sequence number for range | ||
* @param {Boolean} [options.uid] If `true` then uses UID number instead of sequence number for range | ||
* @returns {DownloadObject} Download data object | ||
@@ -478,2 +485,26 @@ * | ||
}): DownloadObject; | ||
/** | ||
* Opens a mailbox if not already open and returns a lock. Next call to `getMailboxLock()` is queued | ||
* until previous lock is released. This is suggested over {@link module:imapflow~ImapFlow#mailboxOpen|mailboxOpen()} as | ||
* `getMailboxLock()` gives you a weak transaction while `mailboxOpen()` has no guarantees whatsoever that another | ||
* mailbox is opened while you try to call multiple fetch or store commands. | ||
* | ||
* @param {string|array} path **Path for the mailbox** to open | ||
* @param {Object} [options] optional options | ||
* @param {Boolean} [options.readOnly=false] If `true` then opens mailbox in read-only mode. You can still try to perform write operations but these would probably fail. | ||
* @returns {MailboxLockObject} Mailbox lock | ||
* @throws Will throw an error if mailbox does not exist or can not be opened | ||
* | ||
* @example | ||
* let lock = await client.getMailboxLock('INBOX'); | ||
* try { | ||
* // do something in the mailbox | ||
* } finally { | ||
* // use finally{} to make sure lock is released even if exception occurs | ||
* lock.release(); | ||
* } | ||
*/ | ||
getMailboxLock(path: string | any[], options?: { | ||
readOnly?: boolean; | ||
}): MailboxLockObject; | ||
} | ||
@@ -489,8 +520,8 @@ } | ||
* @property {String} [specialUse] one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set | ||
* @property {Boolean} listed *true* if mailbox was found from the output of LIST command | ||
* @property {Boolean} subscribed *true* if mailbox was found from the output of LSUB command | ||
* @property {Boolean} listed `true` if mailbox was found from the output of LIST command | ||
* @property {Boolean} subscribed `true` if mailbox was found from the output of LSUB command | ||
* @property {Set<string>} permanentFlags A Set of flags available to use in this mailbox. If it is not set or includes special flag "\\\*" then any flag can be used. | ||
* @property {String} [mailboxId] unique mailbox ID if server has OBJECTID extension enabled | ||
* @property {String} [mailboxId] unique mailbox ID if server has `OBJECTID` extension enabled | ||
* @property {BigInt} [highestModseq] latest known modseq value if server has CONDSTORE or XYMHIGHESTMODSEQ enabled | ||
* @property {BigInt} uidValidity Mailbox UIDVALIDITY value | ||
* @property {BigInt} uidValidity Mailbox `UIDVALIDITY` value | ||
* @property {Number} uidNext Next predicted UID | ||
@@ -515,2 +546,21 @@ * @property {Number} exists Messages in this folder | ||
/** | ||
* @typedef {Object} MailboxLockObject | ||
* @global | ||
* @property {String} path mailbox path | ||
* @property {Function} release Release current lock | ||
* @example | ||
* let lock = await client.getMailboxLock('INBOX'); | ||
* try { | ||
* // do something in the mailbox | ||
* } finally { | ||
* // use finally{} to make sure lock is released even if exception occurs | ||
* lock.release(); | ||
* } | ||
*/ | ||
declare type MailboxLockObject = { | ||
path: string; | ||
release: (...params: any[]) => any; | ||
}; | ||
/** | ||
* Client and server identification object, where key is one of RFC2971 defined [data fields](https://tools.ietf.org/html/rfc2971#section-3.3) (but not limited to). | ||
@@ -566,4 +616,4 @@ * @typedef {Object} IdInfoObject | ||
* @property {String} specialUse one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set | ||
* @property {Boolean} listed *true* if mailbox was found from the output of LIST command | ||
* @property {Boolean} subscribed *true* if mailbox was found from the output of LSUB command | ||
* @property {Boolean} listed `true` if mailbox was found from the output of LIST command | ||
* @property {Boolean} subscribed `true` if mailbox was found from the output of LSUB command | ||
*/ | ||
@@ -583,3 +633,3 @@ declare type ListResponse = { | ||
* @global | ||
* @property {Boolean} root If *true* then this is root node without any additional properties besides *folders* | ||
* @property {Boolean} root If `true` then this is root node without any additional properties besides *folders* | ||
* @property {String} path mailbox path | ||
@@ -590,5 +640,5 @@ * @property {String} name mailbox name (last part of path after delimiter) | ||
* @property {String} specialUse one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set | ||
* @property {Boolean} listed *true* if mailbox was found from the output of LIST command | ||
* @property {Boolean} subscribed *true* if mailbox was found from the output of LSUB command | ||
* @property {Boolean} disabled If *true* then this mailbox can not be selected in the UI | ||
* @property {Boolean} listed `true` if mailbox was found from the output of LIST command | ||
* @property {Boolean} subscribed `true` if mailbox was found from the output of LSUB command | ||
* @property {Boolean} disabled If `true` then this mailbox can not be selected in the UI | ||
* @property {ListTreeResponse[]} folders An array of subfolders | ||
@@ -613,3 +663,3 @@ */ | ||
* @property {String} path full mailbox path | ||
* @property {String} [mailboxId] unique mailbox ID if server supports OBJECTID extension (currently Yahoo and some others) | ||
* @property {String} [mailboxId] unique mailbox ID if server supports `OBJECTID` extension (currently Yahoo and some others) | ||
*/ | ||
@@ -648,3 +698,3 @@ declare type MailboxCreateResponse = { | ||
* @property {Number} [uidNext] Predicted next UID | ||
* @property {BigInt} [uidValidity] Mailbox UIDVALIDITY value | ||
* @property {BigInt} [uidValidity] Mailbox `UIDVALIDITY` value | ||
* @property {Number} [unseen] Count of unseen messages | ||
@@ -680,11 +730,11 @@ * @property {BigInt} [highestModseq] Last known modseq value (if CONDSTORE extension is enabled) | ||
* @property {SequenceString} [seq] message ordering sequence range | ||
* @property {Boolean} [answered] Messages with (value is *true*) or without (value is *false*) \\Answered flag | ||
* @property {Boolean} [deleted] Messages with (value is *true*) or without (value is *false*) \\Deleted flag | ||
* @property {Boolean} [draft] Messages with (value is *true*) or without (value is *false*) \\Draft flag | ||
* @property {Boolean} [flagged] Messages with (value is *true*) or without (value is *false*) \\Flagged flag | ||
* @property {Boolean} [seen] Messages with (value is *true*) or without (value is *false*) \\Seen flag | ||
* @property {Boolean} [all] If *true* matches all messages | ||
* @property {Boolean} [new] If *true* matches messages that have the \\Recent flag set but not the \\Seen flag | ||
* @property {Boolean} [old] If *true* matches messages that do not have the \\Recent flag set | ||
* @property {Boolean} [recent] If *true* matches messages that have the \\Recent flag set | ||
* @property {Boolean} [answered] Messages with (value is `true`) or without (value is `false`) \\Answered flag | ||
* @property {Boolean} [deleted] Messages with (value is `true`) or without (value is `false`) \\Deleted flag | ||
* @property {Boolean} [draft] Messages with (value is `true`) or without (value is `false`) \\Draft flag | ||
* @property {Boolean} [flagged] Messages with (value is `true`) or without (value is `false`) \\Flagged flag | ||
* @property {Boolean} [seen] Messages with (value is `true`) or without (value is `false`) \\Seen flag | ||
* @property {Boolean} [all] If `true` matches all messages | ||
* @property {Boolean} [new] If `true` matches messages that have the \\Recent flag set but not the \\Seen flag | ||
* @property {Boolean} [old] If `true` matches messages that do not have the \\Recent flag set | ||
* @property {Boolean} [recent] If `true` matches messages that have the \\Recent flag set | ||
* @property {String} [from] Matches From: address field | ||
@@ -700,4 +750,4 @@ * @property {String} [to] Matches To: address field | ||
* @property {BigInt} [modseq] Matches messages with modseq higher than value | ||
* @property {String} [emailId] unique email ID. Only used if server supports OBJECTID or X-GM-EXT-1 extensions | ||
* @property {String} [threadId] unique thread ID. Only used if server supports OBJECTID or X-GM-EXT-1 extensions | ||
* @property {String} [emailId] unique email ID. Only used if server supports `OBJECTID` or `X-GM-EXT-1` extensions | ||
* @property {String} [threadId] unique thread ID. Only used if server supports `OBJECTID` or `X-GM-EXT-1` extensions | ||
* @property {Date|string} [before] Matches messages received before date | ||
@@ -711,3 +761,3 @@ * @property {Date|string} [on] Matches messages received on date (ignores time) | ||
* @property {String} [unKeyword] Matches messages that do not have the custom flag set | ||
* @property {Object.<string, Boolean|String>} [header] Mathces messages with header key set (if value is *true*) or messages where header partially matches (if value is a string) | ||
* @property {Object.<string, Boolean|String>} [header] Mathces messages with header key set (if value is `true`) or messages where header partially matches (if value is a string) | ||
* @property {SearchObject[]} [or] An array of 2 or more {@link SearchObject} objects. At least on of these must match | ||
@@ -756,4 +806,4 @@ */ | ||
* @property {String} path full mailbox path where the message was uploaded to | ||
* @property {BigInt} [uidValidity] mailbox UIDVALIDITY if server has UIDPLUS extension enabled | ||
* @property {Number} [uid] UID of the uploaded message if server has UIDPLUS extension enabled | ||
* @property {BigInt} [uidValidity] mailbox `UIDVALIDITY` if server has `UIDPLUS` extension enabled | ||
* @property {Number} [uid] UID of the uploaded message if server has `UIDPLUS` extension enabled | ||
* @property {Number} [seq] sequence number of the uploaded message if path is currently selected mailbox | ||
@@ -773,4 +823,4 @@ */ | ||
* @property {String} destination path of destination mailbox | ||
* @property {BigInt} [uidValidity] destination mailbox UIDVALIDITY if server has UIDPLUS extension enabled | ||
* @property {Map<number, number>} [uidMap] Map of UID values (if server has UIDPLUS extension enabled) where key is UID in source mailbox and value is the UID for the same message in destination mailbox | ||
* @property {BigInt} [uidValidity] destination mailbox `UIDVALIDITY` if server has `UIDPLUS` extension enabled | ||
* @property {Map<number, number>} [uidMap] Map of UID values (if server has `UIDPLUS` extension enabled) where key is UID in source mailbox and value is the UID for the same message in destination mailbox | ||
*/ | ||
@@ -787,14 +837,14 @@ declare type CopyResponseObject = { | ||
* @global | ||
* @property {Boolean} [uid] if *true* then include UID in the response | ||
* @property {Boolean} [flags] if *true* then include flags Set in the response | ||
* @property {Boolean} [bodyStructure] if *true* then include parsed BODYSTRUCTURE object in the response | ||
* @property {Boolean} [envelope] if *true* then include parsed ENVELOPE object in the response | ||
* @property {Boolean} [internalDate] if *true* then include internal date value in the response | ||
* @property {Boolean} [size] if *true* then include message size in the response | ||
* @property {boolean | Object} [source] if *true* then include full message in the response | ||
* @property {Boolean} [uid] if `true` then include UID in the response | ||
* @property {Boolean} [flags] if `true` then include flags Set in the response | ||
* @property {Boolean} [bodyStructure] if `true` then include parsed BODYSTRUCTURE object in the response | ||
* @property {Boolean} [envelope] if `true` then include parsed ENVELOPE object in the response | ||
* @property {Boolean} [internalDate] if `true` then include internal date value in the response | ||
* @property {Boolean} [size] if `true` then include message size in the response | ||
* @property {boolean | Object} [source] if `true` then include full message in the response | ||
* @property {Number} [source.start] include full message in the response starting from *start* byte | ||
* @property {Number} [source.maxLength] include full message in the response, up to *maxLength* bytes | ||
* @property {String} [threadId] if *true* then include thread ID in the response (only if server supports either OBJECTID or X-GM-EXT-1 extensions) | ||
* @property {Boolean} [labels] if *true* then include GMail labels in the response (only if server supports X-GM-EXT-1 extension) | ||
* @property {boolean | string[]} [headers] if *true* then includes full headers of the message in the response. If the value is an array of header keys then includes only headers listed in the array | ||
* @property {String} [threadId] if `true` then include thread ID in the response (only if server supports either `OBJECTID` or `X-GM-EXT-1` extensions) | ||
* @property {Boolean} [labels] if `true` then include GMail labels in the response (only if server supports `X-GM-EXT-1` extension) | ||
* @property {boolean | string[]} [headers] if `true` then includes full headers of the message in the response. If the value is an array of header keys then includes only headers listed in the array | ||
* @property {string[]} [bodyParts] An array of BODYPART identifiers to include in the response | ||
@@ -899,5 +949,5 @@ */ | ||
* @property {BigInt} [modseq] message Modseq number. Always included if the server supports CONDSTORE extension | ||
* @property {String} [emailId] unique email ID. Always included if server supports OBJECTID or X-GM-EXT-1 extensions | ||
* @property {String} [threadid] unique thread ID. Only present if server supports OBJECTID or X-GM-EXT-1 extension | ||
* @property {Set<string>} [labels] a Set of labels. Only present if server supports X-GM-EXT-1 extension | ||
* @property {String} [emailId] unique email ID. Always included if server supports `OBJECTID` or `X-GM-EXT-1` extensions | ||
* @property {String} [threadid] unique thread ID. Only present if server supports `OBJECTID` or `X-GM-EXT-1` extension | ||
* @property {Set<string>} [labels] a Set of labels. Only present if server supports `X-GM-EXT-1` extension | ||
* @property {Number} [size] message size | ||
@@ -904,0 +954,0 @@ * @property {Set<string>} [flags] a set of message flags |
{ | ||
"name": "imapflow", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "IMAP Client for Node", | ||
@@ -42,3 +42,3 @@ "main": "./lib/imap-flow.js", | ||
"dependencies": { | ||
"@types/node": "13.5.1", | ||
"@types/node": "13.5.3", | ||
"encoding-japanese": "1.0.30", | ||
@@ -45,0 +45,0 @@ "iconv-lite": "0.5.1", |
@@ -40,16 +40,20 @@ # ImapFlow | ||
const main = async () => { | ||
// wait until client connects and authorizes | ||
// Wait until client connects and authorizes | ||
await client.connect(); | ||
// select a mailbox | ||
await client.mailboxOpen('INBOX'); | ||
// Select and lock a mailbox. Throws if mailbox does not exist | ||
let lock = await client.getMailboxLock('INBOX'); | ||
try { | ||
// fetch latest message source | ||
let message = await client.fetchOne('*', { source: true }); | ||
console.log(message.source.toString()); | ||
// fetch latest message source | ||
let message = await client.fetchOne('*', { source: true }); | ||
console.log(message.source.toString()); | ||
// list subjects for all messages | ||
// uid value is always included in FETCH response, envelope strings are in unicode. | ||
for await (let message of client.fetch('1:*', { envelope: true })) { | ||
console.log(`${message.uid}: ${message.envelope.subject}`); | ||
// list subjects for all messages | ||
// uid value is always included in FETCH response, envelope strings are in unicode. | ||
for await (let message of client.fetch('1:*', { envelope: true })) { | ||
console.log(`${message.uid}: ${message.envelope.subject}`); | ||
} | ||
} finally { | ||
// Make sure lock is released, otherwise next `getMailboxLock()` never returns | ||
lock.release(); | ||
} | ||
@@ -66,3 +70,3 @@ | ||
[API reference](https://imapflow.com/ImapFlow.html). | ||
[API reference](https://imapflow.com/module-imapflow-ImapFlow.html). | ||
@@ -69,0 +73,0 @@ ImapFlow has TS typings set for compatible editors. |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
443613
10546
78
+ Added@types/node@13.5.3(transitive)
- Removed@types/node@13.5.1(transitive)
Updated@types/node@13.5.3