imapflow 1.0.167 → 1.0.169

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.169](https://github.com/postalsys/imapflow/compare/v1.0.168...v1.0.169) (2024-11-08)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **fetc:** Treat 'Some of the requested messages no longer exist' as a success, not a failure ([565f988](https://github.com/postalsys/imapflow/commit/565f988178fc4a4d3989fe027451980f3ee0d412))
9
+
10
+ ## [1.0.168](https://github.com/postalsys/imapflow/compare/v1.0.167...v1.0.168) (2024-11-07)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **imap:** Fixed issue with a single + response ([51be3a9](https://github.com/postalsys/imapflow/commit/51be3a98205cc900eba6d3cf1962bc42a8de942d))
16
+
3
17
  ## [1.0.167](https://github.com/postalsys/imapflow/compare/v1.0.166...v1.0.167) (2024-11-07)
4
18
 
5
19
 
@@ -28,6 +28,7 @@ module.exports = async (command, options) => {
28
28
  response.tag = await parser.getTag();
29
29
 
30
30
  await parser.getSpace();
31
+
31
32
  response.command = await parser.getCommand();
32
33
 
33
34
  if (nullBytesRemoved) {
@@ -119,6 +119,11 @@ class ParserInstance {
119
119
 
120
120
  async getSpace() {
121
121
  if (!this.remainder.length) {
122
+ if (this.tag === '+' && this.pos === 1) {
123
+ // special case, empty + response
124
+ return;
125
+ }
126
+
122
127
  let error = new Error(`Unexpected end of input at position ${this.pos} [E4]`);
123
128
  error.code = 'ParserError4';
124
129
  error.parserContext = { input: this.input, pos: this.pos };
package/lib/imap-flow.js CHANGED
@@ -571,9 +571,29 @@ class ImapFlow extends EventEmitter {
571
571
  let err = new Error('Command failed');
572
572
  err.response = parsed;
573
573
  err.responseStatus = parsed.command.toUpperCase();
574
+
575
+ try {
576
+ err.executedCommand =
577
+ parsed.tag +
578
+ (
579
+ await compiler(request, {
580
+ isLogging: true
581
+ })
582
+ ).toString();
583
+ } catch (err) {
584
+ // ignore
585
+ }
586
+
574
587
  if (txt) {
575
588
  err.responseText = txt;
576
589
 
590
+ if (err.responseStatus === 'NO' && txt.includes('Some of the requested messages no longer exist')) {
591
+ // Treat as successful response
592
+ this.log.warn({ msg: 'Partial Gmail response', cid: this.id, err });
593
+ await new Promise(resolve => request.resolve({ response: parsed, next: resolve }));
594
+ break;
595
+ }
596
+
577
597
  let throttleDelay = false;
578
598
 
579
599
  // MS365 throttling
@@ -596,7 +616,7 @@ class ImapFlow extends EventEmitter {
596
616
  delayResponse = 5 * 60 * 1000;
597
617
  }
598
618
 
599
- this.log.warn({ msg: 'Throttling detected', err, cid: this.id, throttleDelay, delayResponse });
619
+ this.log.warn({ msg: 'Throttling detected', cid: this.id, throttleDelay, delayResponse, err });
600
620
  await new Promise(r => setTimeout(r, delayResponse));
601
621
  }
602
622
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "1.0.167",
3
+ "version": "1.0.169",
4
4
  "description": "IMAP Client for Node",
5
5
  "main": "./lib/imap-flow.js",
6
6
  "scripts": {