emailjs-imap-client
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -12,6 +12,4 @@ 'use strict'; | ||
function createDefaultLogger() { | ||
var _this = this; | ||
var tag = ++SESSIONCOUNTER; | ||
function createDefaultLogger(username, hostname) { | ||
var session = ++SESSIONCOUNTER; | ||
var log = function log(level, messages) { | ||
@@ -21,3 +19,4 @@ messages = messages.map(function (msg) { | ||
}); | ||
var logMessage = '[' + new Date().toISOString() + '][' + tag + '][' + _this.options.auth.user + '][' + _this.client.host + '] ' + messages.join(' '); | ||
var date = new Date().toISOString(); | ||
var logMessage = '[' + date + '][' + session + '][' + username + '][' + hostname + '] ' + messages.join(' '); | ||
if (level === _common.LOG_LEVEL_DEBUG) { | ||
@@ -49,2 +48,2 @@ console.log('[DEBUG]' + logMessage); | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9sb2dnZXIuanMiXSwibmFtZXMiOlsiY3JlYXRlRGVmYXVsdExvZ2dlciIsIlNFU1NJT05DT1VOVEVSIiwidGFnIiwibG9nIiwibGV2ZWwiLCJtZXNzYWdlcyIsIm1hcCIsIm1zZyIsImxvZ01lc3NhZ2UiLCJEYXRlIiwidG9JU09TdHJpbmciLCJvcHRpb25zIiwiYXV0aCIsInVzZXIiLCJjbGllbnQiLCJob3N0Iiwiam9pbiIsImNvbnNvbGUiLCJpbmZvIiwid2FybiIsImVycm9yIiwiZGVidWciLCJtc2dzIl0sIm1hcHBpbmdzIjoiOzs7OztrQkFTd0JBLG1COztBQVR4Qjs7QUFPQSxJQUFJQyxpQkFBaUIsQ0FBckI7O0FBRWUsU0FBU0QsbUJBQVQsR0FBZ0M7QUFBQTs7QUFDN0MsTUFBTUUsTUFBTSxFQUFFRCxjQUFkO0FBQ0EsTUFBSUUsTUFBTSxTQUFOQSxHQUFNLENBQUNDLEtBQUQsRUFBUUMsUUFBUixFQUFxQjtBQUM3QkEsZUFBV0EsU0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iB7XG4gICAgZGVidWc6IG1zZ3MgPT4gbG9nKExPR19MRVZFTF9ERUJVRywgbXNncyksXG4gICAgaW5mbzogbXNncyA9PiBsb2coTE9HX0xFVkVMX0lORk8sIG1zZ3MpLFxuICAgIHdhcm46IG1zZ3MgPT4gbG9nKExPR19MRVZFTF9XQVJOLCBtc2dzKSxcbiAgICBlcnJvcjogbXNncyA9PiBsb2coTE9HX0xFVkVMX0VSUk9SLCBtc2dzKVxuICB9XG59XG4iXX0= |
{ | ||
"name": "emailjs-imap-client", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"homepage": "https://github.com/emailjs/emailjs-imap-client", | ||
@@ -5,0 +5,0 @@ "description": "JavaScript IMAP client", |
@@ -5,3 +5,6 @@ /* eslint-disable no-unused-expressions */ | ||
import { parser } from 'emailjs-imap-handler' | ||
import { toTypedArray } from './common' | ||
import { | ||
toTypedArray, | ||
LOG_LEVEL_NONE | ||
} from './common' | ||
@@ -12,4 +15,5 @@ describe('browserbox unit tests', () => { | ||
beforeEach(() => { | ||
br = new ImapClient() | ||
br.logLevel = br.LOG_LEVEL_NONE | ||
const auth = { user: 'baldrian', pass: 'sleeper.de' } | ||
br = new ImapClient('somehost', 1234, { auth }) | ||
br.logLevel = LOG_LEVEL_NONE | ||
br.client.socket = { | ||
@@ -72,3 +76,3 @@ send: () => { }, | ||
it('should fail to login', () => { | ||
it('should fail to login', (done) => { | ||
br.client.connect.returns(Promise.resolve()) | ||
@@ -81,3 +85,3 @@ br.updateCapability.returns(Promise.resolve()) | ||
setTimeout(() => br.client.onready(), 0) | ||
return br.connect().catch((err) => { | ||
br.connect().catch((err) => { | ||
expect(err).to.exist | ||
@@ -93,10 +97,12 @@ | ||
expect(br.compressConnection.called).to.be.false | ||
done() | ||
}) | ||
}) | ||
it('should timeout', () => { | ||
it('should timeout', (done) => { | ||
br.client.connect.returns(Promise.resolve()) | ||
br.timeoutConnection = 1 | ||
return br.connect().catch((err) => { | ||
br.connect().catch((err) => { | ||
expect(err).to.exist | ||
@@ -112,2 +118,4 @@ | ||
expect(br.compressConnection.called).to.be.false | ||
done() | ||
}) | ||
@@ -114,0 +122,0 @@ }) |
@@ -66,2 +66,3 @@ import { map, pipe, union, zip, fromPairs, propOr, pathOr, flatten } from 'ramda' | ||
this._host = host | ||
this._clientId = propOr(DEFAULT_CLIENT_ID, 'id', options) | ||
@@ -927,3 +928,4 @@ this._state = false // Current state | ||
createLogger (logger = createDefaultLogger()) { | ||
createLogger (creator = createDefaultLogger) { | ||
const logger = creator(this._auth.user || '', this._host) | ||
this.logger = this.client.logger = { | ||
@@ -930,0 +932,0 @@ debug: (...msgs) => { if (LOG_LEVEL_DEBUG >= this.logLevel) { logger.debug(msgs) } }, |
@@ -10,8 +10,8 @@ import { | ||
export default function createDefaultLogger () { | ||
const tag = ++SESSIONCOUNTER | ||
export default function createDefaultLogger (username, hostname) { | ||
const session = ++SESSIONCOUNTER | ||
let log = (level, messages) => { | ||
messages = messages.map(msg => typeof msg === 'function' ? msg() : msg) | ||
let logMessage = '[' + new Date().toISOString() + '][' + tag + '][' + | ||
this.options.auth.user + '][' + this.client.host + '] ' + messages.join(' ') | ||
const date = new Date().toISOString() | ||
let logMessage = `[${date}][${session}][${username}][${hostname}] ${messages.join(' ')}` | ||
if (level === LOG_LEVEL_DEBUG) { | ||
@@ -18,0 +18,0 @@ console.log('[DEBUG]' + logMessage) |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
734763
11769
0