imapflow 1.0.109 → 1.0.110

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ - 1.0.110 - 2022-10-10
4
+
5
+ - Allow unicode atoms by default
6
+
3
7
  - 1.0.109 - 2022-09-29
4
8
 
5
9
  - New method `downloadMany`
@@ -271,7 +271,8 @@ class TokenParser {
271
271
  // Any ATOM supported char starts a new Atom sequence, otherwise throw an error
272
272
  // Allow \ as the first char for atom to support system flags
273
273
  // Allow % to support LIST '' %
274
- if (imapFormalSyntax['ATOM-CHAR']().indexOf(chr) < 0 && chr !== '\\' && chr !== '%') {
274
+ // Allow 8bit characters (presumably unicode)
275
+ if (imapFormalSyntax['ATOM-CHAR']().indexOf(chr) < 0 && chr !== '\\' && chr !== '%' && chr.charCodeAt(0) < 0x80) {
275
276
  throw new Error(`Unexpected char at position ${this.pos + i} [E10: ${JSON.stringify(chr)}]`);
276
277
  }
277
278
 
@@ -336,6 +337,7 @@ class TokenParser {
336
337
  // if the char is not ATOM compatible, throw. Allow \* as an exception
337
338
  if (
338
339
  imapFormalSyntax['ATOM-CHAR']().indexOf(chr) < 0 &&
340
+ chr.charCodeAt(0) < 0x80 && // allow 8bit (presumably unicode) bytes
339
341
  chr !== ']' &&
340
342
  !(chr === '*' && this.currentNode.value === '\\') &&
341
343
  (!this.parent || !this.parent.command || !['NO', 'BAD', 'OK'].includes(this.parent.command))
package/lib/imap-flow.js CHANGED
@@ -2163,6 +2163,7 @@ class ImapFlow extends EventEmitter {
2163
2163
  * @typedef {Object} DownloadObject
2164
2164
  * @global
2165
2165
  * @property {Object} meta content metadata
2166
+ * @property {number} meta.expectedSize The fetch response size
2166
2167
  * @property {String} meta.contentType Content-Type of the streamed file. If part was not set then this value is "message/rfc822"
2167
2168
  * @property {String} [meta.charset] Charset of the body part. Text parts are automaticaly converted to UTF-8, attachments are kept as is
2168
2169
  * @property {String} [meta.disposition] Content-Disposition of the streamed file
package/lib/types.d.ts CHANGED
@@ -941,6 +941,7 @@ declare type FetchMessageObject = {
941
941
 
942
942
  /**
943
943
  * @property meta - content metadata
944
+ * @property meta.expectedSize - The fetch response size
944
945
  * @property meta.contentType - Content-Type of the streamed file. If part was not set then this value is "message/rfc822"
945
946
  * @property [meta.charset] - Charset of the body part. Text parts are automaticaly converted to UTF-8, attachments are kept as is
946
947
  * @property [meta.disposition] - Content-Disposition of the streamed file
@@ -949,6 +950,7 @@ declare type FetchMessageObject = {
949
950
  */
950
951
  declare type DownloadObject = {
951
952
  meta: {
953
+ expectedSize: number;
952
954
  contentType: string;
953
955
  charset?: string;
954
956
  disposition?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "1.0.109",
3
+ "version": "1.0.110",
4
4
  "description": "IMAP Client for Node",
5
5
  "main": "./lib/imap-flow.js",
6
6
  "scripts": {
@@ -31,9 +31,9 @@
31
31
  "@babel/eslint-plugin": "7.19.1",
32
32
  "@babel/plugin-syntax-class-properties": "7.12.13",
33
33
  "@babel/preset-env": "7.19.3",
34
- "@types/node": "18.7.23",
34
+ "@types/node": "18.8.3",
35
35
  "braintree-jsdoc-template": "3.3.0",
36
- "eslint": "8.24.0",
36
+ "eslint": "8.25.0",
37
37
  "eslint-config-nodemailer": "1.2.0",
38
38
  "eslint-config-prettier": "8.5.0",
39
39
  "grunt": "1.5.3",
@@ -53,6 +53,6 @@
53
53
  "mailsplit": "5.3.2",
54
54
  "nodemailer": "6.8.0",
55
55
  "pino": "8.6.1",
56
- "socks": "2.7.0"
56
+ "socks": "2.7.1"
57
57
  }
58
58
  }
@@ -941,3 +941,32 @@ module.exports['IMAP Parser, single quote in atom'] = test =>
941
941
  { type: 'ATOM', value: "'a" }
942
942
  ])
943
943
  );
944
+
945
+ module.exports['IMAP Parser, unicode status 1'] = test =>
946
+ asyncWrapper(test, async test =>
947
+ test.deepEqual((await parser('* STATUS Segregator/Społeczności (MESSAGES 0 UIDNEXT 1 UIDVALIDITY 1)')).attributes, [
948
+ { type: 'ATOM', value: 'Segregator/Społeczności' },
949
+ [
950
+ { type: 'ATOM', value: 'MESSAGES' },
951
+ { type: 'ATOM', value: '0' },
952
+ { type: 'ATOM', value: 'UIDNEXT' },
953
+ { type: 'ATOM', value: '1' },
954
+ { type: 'ATOM', value: 'UIDVALIDITY' },
955
+ { type: 'ATOM', value: '1' }
956
+ ]
957
+ ])
958
+ );
959
+ module.exports['IMAP Parser, unicode status 12'] = test =>
960
+ asyncWrapper(test, async test =>
961
+ test.deepEqual((await parser('* STATUS Šegregator/Społeczności (MESSAGES 0 UIDNEXT 1 UIDVALIDITY 1)')).attributes, [
962
+ { type: 'ATOM', value: 'Šegregator/Społeczności' },
963
+ [
964
+ { type: 'ATOM', value: 'MESSAGES' },
965
+ { type: 'ATOM', value: '0' },
966
+ { type: 'ATOM', value: 'UIDNEXT' },
967
+ { type: 'ATOM', value: '1' },
968
+ { type: 'ATOM', value: 'UIDVALIDITY' },
969
+ { type: 'ATOM', value: '1' }
970
+ ]
971
+ ])
972
+ );