imapflow 1.0.123 → 1.0.125

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.
@@ -50,6 +50,8 @@ module.exports = async (connection, username, accessToken) => {
50
50
  );
51
51
  response.next();
52
52
 
53
+ connection.authCapabilities.set(`AUTH=${command}`, true);
54
+
53
55
  return username;
54
56
  } catch (err) {
55
57
  let errorCode = getStatusCode(err.response);
@@ -16,6 +16,8 @@ module.exports = async (connection, username, password) => {
16
16
  ]);
17
17
  response.next();
18
18
 
19
+ connection.authCapabilities.set('LOGIN', true);
20
+
19
21
  return username;
20
22
  } catch (err) {
21
23
  let errorCode = getStatusCode(err.response);
package/lib/imap-flow.js CHANGED
@@ -217,6 +217,8 @@ class ImapFlow extends EventEmitter {
217
217
  * @type {Map<string, boolean|number>}
218
218
  */
219
219
  this.capabilities = new Map();
220
+ this.authCapabilities = new Map();
221
+
220
222
  this.rawCapabilities = null;
221
223
 
222
224
  this.expectCapabilityUpdate = false; // force CAPABILITY after LOGIN
@@ -973,6 +975,15 @@ class ImapFlow extends EventEmitter {
973
975
  async sectionCapability(section) {
974
976
  this.rawCapabilities = section;
975
977
  this.capabilities = updateCapabilities(section);
978
+
979
+ if (this.capabilities) {
980
+ for (let [capa] of this.capabilities) {
981
+ if (/^AUTH=/i.test(capa) && !this.authCapabilities.has(capa.toUpperCase())) {
982
+ this.authCapabilities.set(capa.toUpperCase(), false);
983
+ }
984
+ }
985
+ }
986
+
976
987
  if (this.expectCapabilityUpdate) {
977
988
  this.expectCapabilityUpdate = false;
978
989
  }
@@ -981,6 +992,15 @@ class ImapFlow extends EventEmitter {
981
992
  async untaggedCapability(untagged) {
982
993
  this.rawCapabilities = untagged.attributes;
983
994
  this.capabilities = updateCapabilities(untagged.attributes);
995
+
996
+ if (this.capabilities) {
997
+ for (let [capa] of this.capabilities) {
998
+ if (/^AUTH=/i.test(capa) && !this.authCapabilities.has(capa.toUpperCase())) {
999
+ this.authCapabilities.set(capa.toUpperCase(), false);
1000
+ }
1001
+ }
1002
+ }
1003
+
984
1004
  if (this.expectCapabilityUpdate) {
985
1005
  this.expectCapabilityUpdate = false;
986
1006
  }
@@ -2179,6 +2199,13 @@ class ImapFlow extends EventEmitter {
2179
2199
  res.next();
2180
2200
  }
2181
2201
  }
2202
+
2203
+ if (!finished) {
2204
+ // FETCH never finished!
2205
+ let error = new Error('FETCH did not finish');
2206
+ error.code = 'ENotFinished';
2207
+ throw error;
2208
+ }
2182
2209
  } catch (err) {
2183
2210
  setImmediate(() => this.close());
2184
2211
  throw err;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "1.0.123",
3
+ "version": "1.0.125",
4
4
  "description": "IMAP Client for Node",
5
5
  "main": "./lib/imap-flow.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  "@babel/eslint-plugin": "7.19.1",
32
32
  "@babel/plugin-syntax-class-properties": "7.12.13",
33
33
  "@babel/preset-env": "7.20.2",
34
- "@types/node": "18.15.5",
34
+ "@types/node": "18.15.10",
35
35
  "braintree-jsdoc-template": "3.3.0",
36
36
  "eslint": "8.36.0",
37
37
  "eslint-config-nodemailer": "1.2.0",