Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emailjs-imap-client

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emailjs-imap-client - npm Package Compare versions

Comparing version 2.0.6-beta.3 to 2.0.6

4

package.json
{
"name": "emailjs-imap-client",
"version": "2.0.6-beta.3",
"version": "2.0.6",
"homepage": "https://github.com/emailjs/emailjs-imap-client",

@@ -24,3 +24,3 @@ "description": "JavaScript IMAP client",

"emailjs-addressparser": "^1.0.1",
"emailjs-imap-handler": "^1.0.0",
"emailjs-imap-handler": "^2.0.0",
"emailjs-mime-codec": "^1.0.1",

@@ -27,0 +27,0 @@ "emailjs-tcp-socket": "^1.0.1",

@@ -27,2 +27,4 @@ (function(root, factory) {

var ASCII_PLUS = 43;
/**

@@ -469,12 +471,21 @@ * Creates a connection object to an IMAP server. Call `connect` method to inititate

}
const commandLen = this._incomingBuffers.reduce((prev, curr) => prev + curr.length, 0) - 2; // 2 for CRLF
const command = new Array(commandLen);
let k = 0;
const commandLength = this._incomingBuffers.reduce((prev, curr) => prev + curr.length, 0) - 2; // 2 for CRLF
const command = new Uint8Array(commandLength);
let index = 0;
while (this._incomingBuffers.length > 0) {
const b = this._incomingBuffers.shift();
for (let j = 0; j<b.length && k < commandLen; j ++) {
command[k++] = String.fromCharCode(b[j]);
let uint8Array = this._incomingBuffers.shift();
const remainingLength = commandLength - index;
if (uint8Array.length > remainingLength) {
const excessLength = uint8Array.length - remainingLength;
uint8Array = uint8Array.subarray(0, -excessLength);
if (this._incomingBuffers.length > 0) {
this._incomingBuffers = [];
}
}
command.set(uint8Array, index);
index += uint8Array.length;
}
yield command.join(''); // TODO: yield Uint8Array and pass on to emailjs-imap-handler
yield command;
if (LFidx < buf.length-1) {

@@ -516,3 +527,3 @@ buf = new Uint8Array(buf.subarray(LFidx+1));

//
if (/^\+/.test(command)) {
if (command[0] === ASCII_PLUS) {
if (this._currentCommand.data.length) {

@@ -531,3 +542,3 @@ // feed the next chunk of data

try {
response = imapHandler.parser(command.trim());
response = imapHandler.parser(command);
this.logger.debug('S:', () => imapHandler.compiler(response, false, true));

@@ -534,0 +545,0 @@ } catch (e) {

@@ -139,5 +139,5 @@ 'use strict';

expect(iterator.next().value).to.equal('* 1 FETCH (UID 1)');
expect(iterator.next().value).to.equal('* 2 FETCH (UID 2)');
expect(iterator.next().value).to.equal('* 3 FETCH (UID 3)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 1 FETCH (UID 1)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 2 FETCH (UID 2)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 3 FETCH (UID 3)');
expect(iterator.next().value).to.be.undefined;

@@ -150,5 +150,5 @@ });

expect(iterator.next().value).to.equal('* 1 FETCH (UID {1}\r\n1)');
expect(iterator.next().value).to.equal('* 2 FETCH (UID {4}\r\n2345)');
expect(iterator.next().value).to.equal('* 3 FETCH (UID {4}\r\n3789)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 1 FETCH (UID {1}\r\n1)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 2 FETCH (UID {4}\r\n2345)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 3 FETCH (UID {4}\r\n3789)');
expect(iterator.next().value).to.be.undefined;

@@ -161,4 +161,4 @@ });

expect(iterator.next().value).to.equal('* 1 FETCH (UID 1)');
expect(iterator.next().value).to.equal('* 2 FETCH (UID {4}\r\n2345)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 1 FETCH (UID 1)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 2 FETCH (UID {4}\r\n2345)');
expect(iterator.next().value).to.be.undefined;

@@ -171,4 +171,4 @@ });

expect(iterator.next().value).to.equal('* 1 FETCH (UID {1}\r\n1)');
expect(iterator.next().value).to.equal('* 2 FETCH (UID 4)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 1 FETCH (UID {1}\r\n1)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 2 FETCH (UID 4)');
expect(iterator.next().value).to.be.undefined;

@@ -180,3 +180,3 @@ });

var iterator = client._iterateIncomingBuffer();
expect(iterator.next().value).to.equal('* SEARCH {1}\r\n1 {1}\r\n2');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* SEARCH {1}\r\n1 {1}\r\n2');
});

@@ -187,3 +187,3 @@

var iterator = client._iterateIncomingBuffer();
expect(iterator.next().value).to.equal('* 1 FETCH (UID 20 BODY[HEADER.FIELDS (REFERENCES LIST-ID)] {2}\r\n\r\n)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 1 FETCH (UID 20 BODY[HEADER.FIELDS (REFERENCES LIST-ID)] {2}\r\n\r\n)');
});

@@ -194,3 +194,3 @@

var iterator = client._iterateIncomingBuffer();
expect(iterator.next().value).to.equal('* 1 FETCH (UID 1 ENVELOPE ("string with {parenthesis}") BODY[HEADER.FIELDS (REFERENCES LIST-ID)] {2}\r\n\r\n)');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 1 FETCH (UID 1 ENVELOPE ("string with {parenthesis}") BODY[HEADER.FIELDS (REFERENCES LIST-ID)] {2}\r\n\r\n)');
});

@@ -205,4 +205,4 @@

var iterator2 = client._iterateIncomingBuffer();
expect(iterator2.next().value).to.equal('* 1 FETCH (UID 1)');
expect(iterator2.next().value).to.equal('* 2 FETCH (UID 2)');
expect(String.fromCharCode.apply(null, iterator2.next().value)).to.equal('* 1 FETCH (UID 1)');
expect(String.fromCharCode.apply(null, iterator2.next().value)).to.equal('* 2 FETCH (UID 2)');
expect(iterator2.next().value).to.be.undefined;

@@ -218,3 +218,3 @@ });

var iterator2 = client._iterateIncomingBuffer();
expect(iterator2.next().value).to.equal('* 1 FETCH (UID {2}\r\n12)');
expect(String.fromCharCode.apply(null, iterator2.next().value)).to.equal('* 1 FETCH (UID {2}\r\n12)');
expect(iterator2.next().value).to.be.undefined;

@@ -230,3 +230,3 @@ });

var iterator2 = client._iterateIncomingBuffer();
expect(iterator2.next().value).to.equal('* 1 FETCH (UID {10}\r\n0123456789)');
expect(String.fromCharCode.apply(null, iterator2.next().value)).to.equal('* 1 FETCH (UID {10}\r\n0123456789)');
expect(iterator2.next().value).to.be.undefined;

@@ -242,3 +242,3 @@ });

var iterator2 = client._iterateIncomingBuffer();
expect(iterator2.next().value).to.equal('* 1 FETCH (UID {10}\r\n1234567890)');
expect(String.fromCharCode.apply(null, iterator2.next().value)).to.equal('* 1 FETCH (UID {10}\r\n1234567890)');
expect(iterator2.next().value).to.be.undefined;

@@ -253,3 +253,3 @@ });

var iterator2 = client._iterateIncomingBuffer();
expect(iterator2.next().value).to.equal('* 1 FETCH (UID 1 BODY[HEADER.FIELDS (REFERENCES LIST-ID)] {2}\r\nXX)');
expect(String.fromCharCode.apply(null, iterator2.next().value)).to.equal('* 1 FETCH (UID 1 BODY[HEADER.FIELDS (REFERENCES LIST-ID)] {2}\r\nXX)');
});

@@ -268,3 +268,3 @@

var iterator3 = client._iterateIncomingBuffer();
expect(iterator3.next().value).to.equal('* 1 FETCH (UID {1}\r\n1)');
expect(String.fromCharCode.apply(null, iterator3.next().value)).to.equal('* 1 FETCH (UID {1}\r\n1)');
expect(iterator3.next().value).to.be.undefined;

@@ -280,3 +280,3 @@ });

var iterator2 = client._iterateIncomingBuffer();
expect(iterator2.next().value).to.equal('* SEARCH 1 2 3 4');
expect(String.fromCharCode.apply(null, iterator2.next().value)).to.equal('* SEARCH 1 2 3 4');
expect(iterator2.next().value).to.be.undefined;

@@ -288,3 +288,3 @@ });

var iterator = client._iterateIncomingBuffer();
expect(iterator.next().value).to.equal('* 1 FETCH (UID 1 ENVELOPE ("string with {parenthesis}"))');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 1 FETCH (UID 1 ENVELOPE ("string with {parenthesis}"))');
});

@@ -295,3 +295,3 @@

var iterator = client._iterateIncomingBuffer();
expect(iterator.next().value).to.equal('* 1 FETCH (UID 1 ENVELOPE ("string with number in parenthesis {123}"))');
expect(String.fromCharCode.apply(null, iterator.next().value)).to.equal ('* 1 FETCH (UID 1 ENVELOPE ("string with number in parenthesis {123}"))');
});

@@ -309,3 +309,3 @@

function* gen() { yield 'OK Hello world!'; }
function* gen() { yield mimefuncs.toTypedArray('OK Hello world!'); }

@@ -328,3 +328,3 @@ client._parseIncomingCommands(gen());

function* gen() { yield '* 1 EXISTS'; }
function* gen() { yield mimefuncs.toTypedArray('* 1 EXISTS'); }

@@ -344,3 +344,3 @@ client._parseIncomingCommands(gen());

function* gen() { yield '+ Please continue'; }
function* gen() { yield mimefuncs.toTypedArray('+ Please continue'); }
client._currentCommand = {

@@ -358,3 +358,3 @@ data: ['literal data']

function* gen() { yield '+ FOOBAR'; }
function* gen() { yield mimefuncs.toTypedArray('+ FOOBAR'); }
client._currentCommand = {

@@ -361,0 +361,0 @@ data: [],

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc