imapflow 1.0.92 → 1.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/lib/commands/append.js +2 -2
- package/lib/commands/copy.js +2 -2
- package/lib/commands/fetch.js +1 -1
- package/lib/commands/move.js +2 -2
- package/lib/imap-flow.js +3 -0
- package/lib/tools.js +1 -0
- package/lib/types.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
- 1.0.95 - 2022-05-03
|
|
4
|
+
|
|
5
|
+
- Do not use FETCH BINARY, unless `binary` option is `true`
|
|
6
|
+
|
|
7
|
+
- 1.0.94 - 2022-05-03
|
|
8
|
+
|
|
9
|
+
- Fixed source download
|
|
10
|
+
|
|
11
|
+
- 1.0.93 - 2022-05-03
|
|
12
|
+
|
|
13
|
+
- Fixed missing unicode encoding for APPEND, COPY, MOVE
|
|
14
|
+
|
|
3
15
|
- 1.0.92 - 2022-05-03
|
|
4
16
|
|
|
5
17
|
- Added support for IMAP BINARY extension (rfc3516)
|
package/lib/commands/append.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { getStatusCode, formatFlag, canUseFlag, formatDateTime, normalizePath, comparePaths, getErrorText } = require('../tools.js');
|
|
3
|
+
const { getStatusCode, formatFlag, canUseFlag, formatDateTime, normalizePath, encodePath, comparePaths, getErrorText } = require('../tools.js');
|
|
4
4
|
|
|
5
5
|
// Appends a message to a mailbox
|
|
6
6
|
module.exports = async (connection, destination, content, flags, idate) => {
|
|
@@ -26,7 +26,7 @@ module.exports = async (connection, destination, content, flags, idate) => {
|
|
|
26
26
|
.map(flag => flag && formatFlag(flag.toString()))
|
|
27
27
|
.filter(flag => flag && canUseFlag(connection.mailbox, flag));
|
|
28
28
|
|
|
29
|
-
let attributes = [{ type: 'ATOM', value: destination }];
|
|
29
|
+
let attributes = [{ type: 'ATOM', value: encodePath(connection, destination) }];
|
|
30
30
|
|
|
31
31
|
idate = idate ? formatDateTime(idate) : false;
|
|
32
32
|
|
package/lib/commands/copy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { getStatusCode, normalizePath, expandRange, getErrorText } = require('../tools.js');
|
|
3
|
+
const { getStatusCode, normalizePath, encodePath, expandRange, getErrorText } = require('../tools.js');
|
|
4
4
|
|
|
5
5
|
// Copies messages from current mailbox to some other mailbox
|
|
6
6
|
module.exports = async (connection, range, destination, options) => {
|
|
@@ -14,7 +14,7 @@ module.exports = async (connection, range, destination, options) => {
|
|
|
14
14
|
|
|
15
15
|
let attributes = [
|
|
16
16
|
{ type: 'SEQUENCE', value: range },
|
|
17
|
-
{ type: 'ATOM', value: destination }
|
|
17
|
+
{ type: 'ATOM', value: encodePath(connection, destination) }
|
|
18
18
|
];
|
|
19
19
|
|
|
20
20
|
let response;
|
package/lib/commands/fetch.js
CHANGED
|
@@ -18,7 +18,7 @@ module.exports = async (connection, range, query, options) => {
|
|
|
18
18
|
list: []
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const commandKey = connection.capabilities.has('BINARY') && !connection.disableBinary ? 'BINARY' : 'BODY';
|
|
21
|
+
const commandKey = connection.capabilities.has('BINARY') && options.binary && !connection.disableBinary ? 'BINARY' : 'BODY';
|
|
22
22
|
|
|
23
23
|
let response;
|
|
24
24
|
try {
|
package/lib/commands/move.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { getStatusCode, normalizePath, expandRange, getErrorText } = require('../tools.js');
|
|
3
|
+
const { getStatusCode, normalizePath, encodePath, expandRange, getErrorText } = require('../tools.js');
|
|
4
4
|
|
|
5
5
|
// Moves messages from current mailbox to some other mailbox
|
|
6
6
|
module.exports = async (connection, range, destination, options) => {
|
|
@@ -14,7 +14,7 @@ module.exports = async (connection, range, destination, options) => {
|
|
|
14
14
|
|
|
15
15
|
let attributes = [
|
|
16
16
|
{ type: 'SEQUENCE', value: range },
|
|
17
|
-
{ type: 'ATOM', value: destination }
|
|
17
|
+
{ type: 'ATOM', value: encodePath(connection, destination) }
|
|
18
18
|
];
|
|
19
19
|
|
|
20
20
|
let map = { path: connection.mailbox.path, destination };
|
package/lib/imap-flow.js
CHANGED
|
@@ -2014,6 +2014,7 @@ class ImapFlow extends EventEmitter {
|
|
|
2014
2014
|
* @param {Object} [options]
|
|
2015
2015
|
* @param {Boolean} [options.uid] If `true` then uses UID numbers instead of sequence numbers for `range`
|
|
2016
2016
|
* @param {BigInt} [options.changedSince] If set then only messages with a higher modseq value are returned. Ignored if server does not support `CONDSTORE` extension.
|
|
2017
|
+
* @param {Boolean} [options.binary=false] If `true` then requests a binary response if the server supports this
|
|
2017
2018
|
* @yields {Promise<FetchMessageObject>} Message data object
|
|
2018
2019
|
*
|
|
2019
2020
|
* @example
|
|
@@ -2065,6 +2066,7 @@ class ImapFlow extends EventEmitter {
|
|
|
2065
2066
|
|
|
2066
2067
|
this.run('FETCH', range, query, {
|
|
2067
2068
|
uid: !!options.uid,
|
|
2069
|
+
binary: options.binary,
|
|
2068
2070
|
changedSince: options.changedSince,
|
|
2069
2071
|
onUntaggedFetch: (untagged, next) => {
|
|
2070
2072
|
rowQueue.push({
|
|
@@ -2108,6 +2110,7 @@ class ImapFlow extends EventEmitter {
|
|
|
2108
2110
|
* @param {FetchQueryObject} query Fetch query
|
|
2109
2111
|
* @param {Object} [options]
|
|
2110
2112
|
* @param {Boolean} [options.uid] If `true` then uses UID number instead of sequence number for `seq`
|
|
2113
|
+
* @param {Boolean} [options.binary=false] If `true` then requests a binary response if the server supports this
|
|
2111
2114
|
* @returns {Promise<FetchMessageObject>} Message data object
|
|
2112
2115
|
*
|
|
2113
2116
|
* @example
|
package/lib/tools.js
CHANGED
package/lib/types.d.ts
CHANGED
|
@@ -414,10 +414,12 @@ declare module "imapflow" {
|
|
|
414
414
|
* @param query - Fetch query
|
|
415
415
|
* @param [options.uid] - If `true` then uses UID numbers instead of sequence numbers for `range`
|
|
416
416
|
* @param [options.changedSince] - If set then only messages with a higher modseq value are returned. Ignored if server does not support `CONDSTORE` extension.
|
|
417
|
+
* @param [options.binary = false] - If `true` then requests a binary response if the server supports this
|
|
417
418
|
*/
|
|
418
419
|
fetch(range: SequenceString | Number[] | SearchObject, query: FetchQueryObject, options?: {
|
|
419
420
|
uid?: boolean;
|
|
420
421
|
changedSince?: bigint;
|
|
422
|
+
binary?: boolean;
|
|
421
423
|
}): void;
|
|
422
424
|
/**
|
|
423
425
|
* Fetch a single message from currently opened mailbox
|
|
@@ -429,10 +431,12 @@ declare module "imapflow" {
|
|
|
429
431
|
* @param seq - Single UID or sequence number of the message to fetch for
|
|
430
432
|
* @param query - Fetch query
|
|
431
433
|
* @param [options.uid] - If `true` then uses UID number instead of sequence number for `seq`
|
|
434
|
+
* @param [options.binary = false] - If `true` then requests a binary response if the server supports this
|
|
432
435
|
* @returns Message data object
|
|
433
436
|
*/
|
|
434
437
|
fetchOne(seq: SequenceString, query: FetchQueryObject, options?: {
|
|
435
438
|
uid?: boolean;
|
|
439
|
+
binary?: boolean;
|
|
436
440
|
}): Promise<FetchMessageObject>;
|
|
437
441
|
/**
|
|
438
442
|
* Download either full rfc822 formated message or a specific bodystructure part as a Stream.
|