@n8n/imap 0.2.0
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/LICENSE.md +85 -0
- package/dist/ImapSimple.d.ts +16 -0
- package/dist/ImapSimple.js +176 -0
- package/dist/ImapSimple.js.map +1 -0
- package/dist/build.tsbuildinfo +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.js +30 -0
- package/dist/errors.js.map +1 -0
- package/dist/helpers/getMessage.d.ts +3 -0
- package/dist/helpers/getMessage.js +38 -0
- package/dist/helpers/getMessage.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +87 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +30 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +34 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# License
|
|
2
|
+
|
|
3
|
+
Portions of this software are licensed as follows:
|
|
4
|
+
|
|
5
|
+
- Content of branches other than the main branch (i.e. "master") are not licensed.
|
|
6
|
+
- All source code files that contain ".ee." in their filename are licensed under the
|
|
7
|
+
"n8n Enterprise License" defined in "LICENSE_EE.md".
|
|
8
|
+
- All third party components incorporated into the n8n Software are licensed under the original license
|
|
9
|
+
provided by the owner of the applicable component.
|
|
10
|
+
- Content outside of the above mentioned files or restrictions is available under the "Sustainable Use
|
|
11
|
+
License" as defined below.
|
|
12
|
+
|
|
13
|
+
## Sustainable Use License
|
|
14
|
+
|
|
15
|
+
Version 1.0
|
|
16
|
+
|
|
17
|
+
### Acceptance
|
|
18
|
+
|
|
19
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
20
|
+
|
|
21
|
+
### Copyright License
|
|
22
|
+
|
|
23
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license
|
|
24
|
+
to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject
|
|
25
|
+
to the limitations below.
|
|
26
|
+
|
|
27
|
+
### Limitations
|
|
28
|
+
|
|
29
|
+
You may use or modify the software only for your own internal business purposes or for non-commercial or
|
|
30
|
+
personal use. You may distribute the software or provide it to others only if you do so free of charge for
|
|
31
|
+
non-commercial purposes. You may not alter, remove, or obscure any licensing, copyright, or other notices of
|
|
32
|
+
the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
33
|
+
|
|
34
|
+
### Patents
|
|
35
|
+
|
|
36
|
+
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to
|
|
37
|
+
license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case
|
|
38
|
+
subject to the limitations and conditions in this license. This license does not cover any patent claims that
|
|
39
|
+
you cause to be infringed by modifications or additions to the software. If you or your company make any
|
|
40
|
+
written claim that the software infringes or contributes to infringement of any patent, your patent license
|
|
41
|
+
for the software granted under these terms ends immediately. If your company makes such a claim, your patent
|
|
42
|
+
license ends immediately for work on behalf of your company.
|
|
43
|
+
|
|
44
|
+
### Notices
|
|
45
|
+
|
|
46
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these
|
|
47
|
+
terms. If you modify the software, you must include in any modified copies of the software a prominent notice
|
|
48
|
+
stating that you have modified the software.
|
|
49
|
+
|
|
50
|
+
### No Other Rights
|
|
51
|
+
|
|
52
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
53
|
+
|
|
54
|
+
### Termination
|
|
55
|
+
|
|
56
|
+
If you use the software in violation of these terms, such use is not licensed, and your license will
|
|
57
|
+
automatically terminate. If the licensor provides you with a notice of your violation, and you cease all
|
|
58
|
+
violation of this license no later than 30 days after you receive that notice, your license will be reinstated
|
|
59
|
+
retroactively. However, if you violate these terms after such reinstatement, any additional violation of these
|
|
60
|
+
terms will cause your license to terminate automatically and permanently.
|
|
61
|
+
|
|
62
|
+
### No Liability
|
|
63
|
+
|
|
64
|
+
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will
|
|
65
|
+
not be liable to you for any damages arising out of these terms or the use or nature of the software, under
|
|
66
|
+
any kind of legal claim.
|
|
67
|
+
|
|
68
|
+
### Definitions
|
|
69
|
+
|
|
70
|
+
The “licensor” is the entity offering these terms.
|
|
71
|
+
|
|
72
|
+
The “software” is the software the licensor makes available under these terms, including any portion of it.
|
|
73
|
+
|
|
74
|
+
“You” refers to the individual or entity agreeing to these terms.
|
|
75
|
+
|
|
76
|
+
“Your company” is any legal entity, sole proprietorship, or other kind of organization that you work for, plus
|
|
77
|
+
all organizations that have control over, are under the control of, or are under common control with that
|
|
78
|
+
organization. Control means ownership of substantially all the assets of an entity, or the power to direct its
|
|
79
|
+
management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
80
|
+
|
|
81
|
+
“Your license” is the license granted to you for the software under these terms.
|
|
82
|
+
|
|
83
|
+
“Use” means anything you do with the software requiring your license.
|
|
84
|
+
|
|
85
|
+
“Trademark” means trademarks, service marks, and similar rights.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import type Imap from 'imap';
|
|
4
|
+
import type { Message, MessagePart } from './types';
|
|
5
|
+
export declare class ImapSimple extends EventEmitter {
|
|
6
|
+
private readonly imap;
|
|
7
|
+
private ending;
|
|
8
|
+
constructor(imap: Imap);
|
|
9
|
+
end(): void;
|
|
10
|
+
search(searchCriteria: any[], fetchOptions: Imap.FetchOptions): Promise<Message[]>;
|
|
11
|
+
getPartData(message: Message, part: MessagePart): Promise<string>;
|
|
12
|
+
addFlags(uid: number[], flags: string | string[]): Promise<void>;
|
|
13
|
+
getBoxes(): Promise<Imap.MailBoxes>;
|
|
14
|
+
openBox(boxName: string): Promise<Imap.Box>;
|
|
15
|
+
closeBox(autoExpunge?: boolean): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ImapSimple = void 0;
|
|
27
|
+
const events_1 = require("events");
|
|
28
|
+
const qp = __importStar(require("quoted-printable"));
|
|
29
|
+
const iconvlite = __importStar(require("iconv-lite"));
|
|
30
|
+
const utf8 = __importStar(require("utf8"));
|
|
31
|
+
const uuencode = __importStar(require("uuencode"));
|
|
32
|
+
const getMessage_1 = require("./helpers/getMessage");
|
|
33
|
+
const IMAP_EVENTS = ['alert', 'mail', 'expunge', 'uidvalidity', 'update', 'close', 'end'];
|
|
34
|
+
class ImapSimple extends events_1.EventEmitter {
|
|
35
|
+
constructor(imap) {
|
|
36
|
+
super();
|
|
37
|
+
this.imap = imap;
|
|
38
|
+
this.ending = false;
|
|
39
|
+
IMAP_EVENTS.forEach((event) => {
|
|
40
|
+
this.imap.on(event, this.emit.bind(this, event));
|
|
41
|
+
});
|
|
42
|
+
this.imap.on('error', (e) => {
|
|
43
|
+
var _a;
|
|
44
|
+
if (e && this.ending && ((_a = e.code) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'ECONNRESET') {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.emit('error', e);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
end() {
|
|
51
|
+
this.ending = true;
|
|
52
|
+
this.imap.once('close', () => {
|
|
53
|
+
this.ending = false;
|
|
54
|
+
});
|
|
55
|
+
this.imap.end();
|
|
56
|
+
}
|
|
57
|
+
async search(searchCriteria, fetchOptions) {
|
|
58
|
+
return await new Promise((resolve, reject) => {
|
|
59
|
+
this.imap.search(searchCriteria, (e, uids) => {
|
|
60
|
+
if (e) {
|
|
61
|
+
reject(e);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (uids.length === 0) {
|
|
65
|
+
resolve([]);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const fetch = this.imap.fetch(uids, fetchOptions);
|
|
69
|
+
let messagesRetrieved = 0;
|
|
70
|
+
const messages = [];
|
|
71
|
+
const fetchOnMessage = async (message, seqNo) => {
|
|
72
|
+
const msg = await (0, getMessage_1.getMessage)(message);
|
|
73
|
+
msg.seqNo = seqNo;
|
|
74
|
+
messages[seqNo] = msg;
|
|
75
|
+
messagesRetrieved++;
|
|
76
|
+
if (messagesRetrieved === uids.length) {
|
|
77
|
+
resolve(messages.filter((m) => !!m));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const fetchOnError = (error) => {
|
|
81
|
+
fetch.removeListener('message', fetchOnMessage);
|
|
82
|
+
fetch.removeListener('end', fetchOnEnd);
|
|
83
|
+
reject(error);
|
|
84
|
+
};
|
|
85
|
+
const fetchOnEnd = () => {
|
|
86
|
+
fetch.removeListener('message', fetchOnMessage);
|
|
87
|
+
fetch.removeListener('error', fetchOnError);
|
|
88
|
+
};
|
|
89
|
+
fetch.on('message', fetchOnMessage);
|
|
90
|
+
fetch.once('error', fetchOnError);
|
|
91
|
+
fetch.once('end', fetchOnEnd);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async getPartData(message, part) {
|
|
96
|
+
return await new Promise((resolve, reject) => {
|
|
97
|
+
const fetch = this.imap.fetch(message.attributes.uid, {
|
|
98
|
+
bodies: [part.partID],
|
|
99
|
+
struct: true,
|
|
100
|
+
});
|
|
101
|
+
const fetchOnMessage = async (msg) => {
|
|
102
|
+
var _a, _b, _c, _d;
|
|
103
|
+
const result = await (0, getMessage_1.getMessage)(msg);
|
|
104
|
+
if (result.parts.length !== 1) {
|
|
105
|
+
reject(new Error('Got ' + result.parts.length + ' parts, should get 1'));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const data = result.parts[0].body;
|
|
109
|
+
const encoding = part.encoding.toUpperCase();
|
|
110
|
+
if (encoding === 'BASE64') {
|
|
111
|
+
resolve(Buffer.from(data, 'base64').toString());
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (encoding === 'QUOTED-PRINTABLE') {
|
|
115
|
+
if (((_b = (_a = part.params) === null || _a === void 0 ? void 0 : _a.charset) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'UTF-8') {
|
|
116
|
+
resolve(Buffer.from(utf8.decode(qp.decode(data))).toString());
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
resolve(Buffer.from(qp.decode(data)).toString());
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (encoding === '7BIT') {
|
|
124
|
+
resolve(Buffer.from(data).toString('ascii'));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (encoding === '8BIT' || encoding === 'BINARY') {
|
|
128
|
+
const charset = (_d = (_c = part.params) === null || _c === void 0 ? void 0 : _c.charset) !== null && _d !== void 0 ? _d : 'utf-8';
|
|
129
|
+
resolve(iconvlite.decode(Buffer.from(data), charset));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (encoding === 'UUENCODE') {
|
|
133
|
+
const parts = data.toString().split('\n');
|
|
134
|
+
const merged = parts.splice(1, parts.length - 4).join('');
|
|
135
|
+
resolve(uuencode.decode(merged));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
reject(new Error('Unknown encoding ' + part.encoding));
|
|
139
|
+
};
|
|
140
|
+
const fetchOnError = (error) => {
|
|
141
|
+
fetch.removeListener('message', fetchOnMessage);
|
|
142
|
+
fetch.removeListener('end', fetchOnEnd);
|
|
143
|
+
reject(error);
|
|
144
|
+
};
|
|
145
|
+
const fetchOnEnd = () => {
|
|
146
|
+
fetch.removeListener('message', fetchOnMessage);
|
|
147
|
+
fetch.removeListener('error', fetchOnError);
|
|
148
|
+
};
|
|
149
|
+
fetch.once('message', fetchOnMessage);
|
|
150
|
+
fetch.once('error', fetchOnError);
|
|
151
|
+
fetch.once('end', fetchOnEnd);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async addFlags(uid, flags) {
|
|
155
|
+
return await new Promise((resolve, reject) => {
|
|
156
|
+
this.imap.addFlags(uid, flags, (e) => (e ? reject(e) : resolve()));
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
async getBoxes() {
|
|
160
|
+
return await new Promise((resolve, reject) => {
|
|
161
|
+
this.imap.getBoxes((e, boxes) => (e ? reject(e) : resolve(boxes)));
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
async openBox(boxName) {
|
|
165
|
+
return await new Promise((resolve, reject) => {
|
|
166
|
+
this.imap.openBox(boxName, (e, result) => (e ? reject(e) : resolve(result)));
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
async closeBox(autoExpunge = true) {
|
|
170
|
+
return await new Promise((resolve, reject) => {
|
|
171
|
+
this.imap.closeBox(autoExpunge, (e) => (e ? reject(e) : resolve()));
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.ImapSimple = ImapSimple;
|
|
176
|
+
//# sourceMappingURL=ImapSimple.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImapSimple.js","sourceRoot":"","sources":["../src/ImapSimple.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mCAAsC;AAGtC,qDAAuC;AACvC,sDAAwC;AACxC,2CAA6B;AAC7B,mDAAqC;AAErC,qDAAkD;AAGlD,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAEnG,MAAa,UAAW,SAAQ,qBAAY;IAI3C,YAA6B,IAAU;QACtC,KAAK,EAAE,CAAC;QADoB,SAAI,GAAJ,IAAI,CAAM;QAF/B,WAAM,GAAG,KAAK,CAAC;QAMtB,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAGH,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAA4B,EAAE,EAAE;;YAEtD,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAA,MAAA,CAAC,CAAC,IAAI,0CAAE,WAAW,EAAE,MAAK,YAAY,EAAE,CAAC;gBAChE,OAAO;YACR,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACJ,CAAC;IAGD,GAAG;QAKF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAKnB,IAAI,CAAC,IAAI,CAAC,IAAI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AAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AA5ND,gCA4NC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/jest-expect-message/types/index.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/assert.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/globals.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/buffer.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/child_process.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/cluster.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/console.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/constants.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/crypto.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/dgram.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/diagnostics_channel.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/dns.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/domain.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/dom-events.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/events.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/fs.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/http.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/http2.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/https.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/inspector.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/module.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/net.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/os.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/path.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/process.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/punycode.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/querystring.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/readline.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/readline/promises.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/repl.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/stream.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/stream/consumers.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/stream/web.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/test.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/timers.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/tls.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/trace_events.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/tty.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/url.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/util.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/v8.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/vm.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/wasi.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/zlib.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/globals.global.d.ts","../../../../node_modules/.pnpm/@types+node@18.16.16/node_modules/@types/node/index.d.ts","../../../../node_modules/.pnpm/@types+imap@0.8.40/node_modules/@types/imap/index.d.ts","../../../../node_modules/.pnpm/@types+quoted-printable@1.0.2/node_modules/@types/quoted-printable/index.d.ts","../../../../node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/index.d.ts","../../../../node_modules/.pnpm/@types+utf8@3.0.3/node_modules/@types/utf8/index.d.ts","../../../../node_modules/.pnpm/@types+uuencode@0.0.3/node_modules/@types/uuencode/index.d.ts","../src/types.ts","../src/helpers/getMessage.ts","../src/ImapSimple.ts","../src/errors.ts","../src/index.ts"],"fileInfos":[{"version":"824cb491a40f7e8fdeb56f1df5edf91b23f3e3ee6b4cde84d4a99be32338faee","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4",{"version":"138fb588d26538783b78d1e3b2c2cc12d55840b97bf5e08bca7f7a174fbe2f17","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"b20fe0eca9a4e405f1a5ae24a2b3290b37cf7f21eba6cbe4fc3fab979237d4f3","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"49ed889be54031e1044af0ad2c603d627b8bda8b50c1a68435fe85583901d072","affectsGlobalScope":true},{"version":"e93d098658ce4f0c8a0779e6cab91d0259efb88a318137f686ad76f8410ca270","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"8073890e29d2f46fdbc19b8d6d2eb9ea58db9a2052f8640af20baff9afbc8640","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"13f6e6380c78e15e140243dc4be2fa546c287c6d61f4729bc2dd7cf449605471","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"406a5a771d97867cba07e7fbd3cd1fb2dd1004558b973733205737e9dd7ed929","affectsGlobalScope":true},"ba8691cf6bea9d53e6bf6cbc22af964a9633a21793981a1be3dce65e7a714d8b","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"bce910d9164785c9f0d4dcea4be359f5f92130c7c7833dea6138ab1db310a1f9","affectsGlobalScope":true},"7d2e3fea24c712c99c03ad8f556abedbfe105f87f1be10b95dbd409d24bc05a3",{"version":"c7a976828c7acb8ada184935195aef0f389c4e37d87daa52eb4f2f3df3edcdea","affectsGlobalScope":true},"3719525a8f6ab731e3dfd585d9f87df55ec7d50d461df84f74eb4d68bb165244","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","b787b5b54349a24f07d089b612a9fb8ff024dbbe991ff52ea2b188a6b1230644","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","1cdcfc1f624d6c08aa12c73935f6e13f095919cd99edf95752951796eb225729","4eaff3d8e10676fd7913d8c108890e71c688e1e7d52f6d1d55c39514f493dc47","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"00dee7cdca8b8420c47ea4a31a34b8e8294013ebc4f463fd941e867e7bf05029","affectsGlobalScope":true},"7abd2623cdd8148233c0c6b9da0289e124f1718bc58dcb8da4262432e9ce0f0a","f4a3088770ba56a4c72e9907bc9798706ab1575097cd024503f57966df2d3d3a","7f138842074d0a40681775af008c8452093b68c383c94de31759e853c6d06b5c","a3d541d303ee505053f5dcbf9fafb65cac3d5631037501cd616195863a6c5740","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"bcebb922784739bdb34c18ee51095d25a92b560c78ccd2eaacd6bd00f7443d83","7ee6ed878c4528215c82b664fe0cfe80e8b4da6c0d4cc80869367868774db8b1","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"0715e4cd28ad471b2a93f3e552ff51a3ae423417a01a10aa1d3bc7c6b95059d6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","4f3fdeba4e28e21aa719c081b8dc8f91d47e12e773389b9d35679c08151c9d37","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","5629c03c44d1e07698c31d04318c9950d78940461269c0f692a42091cedea142",{"version":"3c4ba1dd9b12ffa284b565063108f2f031d150ea15b8fafbdc17f5d2a07251f3","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","1422cd9e705adcc09088fda85a900c2b70e3ad36ea85846f68bd1a884cdf4e2b","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"c6b124041039647ff446e19ea0e90a7a83256593d64f23c66b4fda6e0c5b968e","affectsGlobalScope":true},{"version":"a9fc1469744055a3435f203123246b96c094e7ff8c4e1c3863829d9b705b7a34","affectsGlobalScope":true},"868831cab82b65dfe1d68180e898af1f2101e89ba9b754d1db6fb8cc2fac1921","0fe8985a28f82c450a04a6edf1279d7181c0893f37da7d2a27f8efd4fd5edb03","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"52120bb7e4583612225bdf08e7c12559548170f11e660d33a33623bae9bbdbba","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"a6dd3dba8e665ac43d279e0fdf5219edda0eed69b5e9a5061f46cd6a65c4f7a1","52e0d4a8762141a86861c8175312030724ff444f7ae548c61e7263f774160fc3","9c0ea4ed2c2cd25374c31d9bbbe8aefa5171da25ee6e7d388b6ae9c3481bda3f","85d3aa95b0086752d2f7784d2bdaeb38f99c3cf6c35bee861702beb68556cb9e","67dde413b255aee29f821a7a98218f5936539c38526d77dfede51f12f2c3aa52","1a99fadcda9f73bb589abb9b2d900be2ceb6a10be6260c8462a8a6b9cd70f9af",{"version":"6ce4e2aba197a5cd6fcd6e710e1827b5daeeba19388334615abd69026bfa3194","signature":"edc009b8da0b4f21086e5a665072b6ca2ddeefaf342596863cfbbdd285a1229d"},{"version":"baec7d38d9a576b1f2440b533f9d6e6974636becf756904d08b9a34a5c7526e7","signature":"d3470035d665d3be9ac5441942bac95ba52ca1b9f3eab4559fcd6dd616827354"},{"version":"6921d77b149cf77983e4ddb64042507958b123d02ca19ad6b47c20aa251fec8d","signature":"035c6507667532b71027b7d39ff26d70095bf4983bb1154a2b753c4d9807c796"},{"version":"61e7f1bd24f78842bb050f00db1f52283488794f1442a98e104089ae0ff7ad04","signature":"3cc448750f6b14e1bb8be179e843b345b1eb7812d4942b7c6f25c3ed9f9b7020"},{"version":"2d664a8b34ad403c6468100ed82556f7f8f5af6968c21a368e059b2c1cec71f3","signature":"ac756991c52b52aa00cbb21174b4551c18abf820ad0f944a33d4e9e92d701c7b"}],"root":[47,[107,111]],"options":{"composite":true,"declaration":true,"esModuleInterop":true,"module":1,"noImplicitAny":true,"noImplicitReturns":true,"noUnusedLocals":false,"noUnusedParameters":false,"outDir":"./","preserveConstEnums":true,"removeComments":true,"rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"target":6,"tsBuildInfoFile":"./build.tsbuildinfo","useUnknownInCatchVariables":true},"fileIdsList":[[64,90,94,101],[48,94],[51,94],[52,57,85,94],[53,64,65,72,82,93,94],[53,54,64,72,94],[55,94],[56,57,65,73,94],[57,82,90,94],[58,60,64,72,94],[59,94],[60,61,94],[64,94],[62,64,94],[64,65,66,82,93,94],[64,65,66,79,82,85,94],[94,98],[94],[60,64,67,72,82,93,94],[64,65,67,68,72,82,90,93,94],[67,69,82,90,93,94],[48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100],[64,70,94],[71,93,94],[60,64,72,82,94],[73,94],[74,94],[51,75,94],[76,92,94,98],[77,94],[78,94],[64,79,80,94],[79,81,94,96],[52,64,82,83,84,85,94],[52,82,84,94],[82,83,94],[85,94],[86,94],[64,88,89,94],[88,89,94],[57,72,82,90,94],[91,94],[72,92,94],[52,67,78,93,94],[57,94],[82,94,95],[94,96],[94,97],[52,57,64,66,75,82,93,94,96,98],[82,94,99],[94,101],[64,94,102,103,104,105,106,107,108],[94,102,107],[94,102,107,109,110],[94,102],[64,102,107],[102,107],[107,109,110],[102]],"referencedMap":[[102,1],[48,2],[49,2],[51,3],[52,4],[53,5],[54,6],[55,7],[56,8],[57,9],[58,10],[59,11],[60,12],[61,12],[63,13],[62,14],[64,13],[65,15],[66,16],[50,17],[100,18],[67,19],[68,20],[69,21],[101,22],[70,23],[71,24],[72,25],[73,26],[74,27],[75,28],[76,29],[77,30],[78,31],[79,32],[80,32],[81,33],[82,34],[84,35],[83,36],[85,37],[86,38],[87,18],[88,39],[89,40],[90,41],[91,42],[92,43],[93,44],[94,45],[95,46],[96,47],[97,48],[98,49],[99,50],[103,18],[105,18],[106,51],[104,18],[45,18],[46,18],[9,18],[8,18],[2,18],[10,18],[11,18],[12,18],[13,18],[14,18],[15,18],[16,18],[17,18],[3,18],[18,18],[4,18],[19,18],[23,18],[20,18],[21,18],[22,18],[24,18],[25,18],[26,18],[5,18],[27,18],[28,18],[29,18],[30,18],[6,18],[34,18],[31,18],[32,18],[33,18],[35,18],[7,18],[36,18],[41,18],[42,18],[37,18],[38,18],[39,18],[40,18],[43,18],[1,18],[44,18],[47,18],[109,52],[110,18],[108,53],[111,54],[107,55]],"exportedModulesMap":[[102,1],[48,2],[49,2],[51,3],[52,4],[53,5],[54,6],[55,7],[56,8],[57,9],[58,10],[59,11],[60,12],[61,12],[63,13],[62,14],[64,13],[65,15],[66,16],[50,17],[100,18],[67,19],[68,20],[69,21],[101,22],[70,23],[71,24],[72,25],[73,26],[74,27],[75,28],[76,29],[77,30],[78,31],[79,32],[80,32],[81,33],[82,34],[84,35],[83,36],[85,37],[86,38],[87,18],[88,39],[89,40],[90,41],[91,42],[92,43],[93,44],[94,45],[95,46],[96,47],[97,48],[98,49],[99,50],[103,18],[105,18],[106,51],[104,18],[45,18],[46,18],[9,18],[8,18],[2,18],[10,18],[11,18],[12,18],[13,18],[14,18],[15,18],[16,18],[17,18],[3,18],[18,18],[4,18],[19,18],[23,18],[20,18],[21,18],[22,18],[24,18],[25,18],[26,18],[5,18],[27,18],[28,18],[29,18],[30,18],[6,18],[34,18],[31,18],[32,18],[33,18],[35,18],[7,18],[36,18],[41,18],[42,18],[37,18],[38,18],[39,18],[40,18],[43,18],[1,18],[44,18],[47,18],[109,56],[108,57],[111,58],[107,59]],"semanticDiagnosticsPerFile":[102,48,49,51,52,53,54,55,56,57,58,59,60,61,63,62,64,65,66,50,100,67,68,69,101,70,71,72,73,74,75,76,77,78,79,80,81,82,84,83,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,103,105,106,104,45,46,9,8,2,10,11,12,13,14,15,16,17,3,18,4,19,23,20,21,22,24,25,26,5,27,28,29,30,6,34,31,32,33,35,7,36,41,42,37,38,39,40,43,1,44,47,109,110,108,111,107],"latestChangedDtsFile":"./index.d.ts"},"version":"5.4.2"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare abstract class ImapError extends Error {
|
|
2
|
+
}
|
|
3
|
+
export declare class ConnectionTimeoutError extends ImapError {
|
|
4
|
+
readonly timeout?: number | undefined;
|
|
5
|
+
constructor(timeout?: number | undefined);
|
|
6
|
+
}
|
|
7
|
+
export declare class ConnectionClosedError extends ImapError {
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
10
|
+
export declare class ConnectionEndedError extends ImapError {
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConnectionEndedError = exports.ConnectionClosedError = exports.ConnectionTimeoutError = exports.ImapError = void 0;
|
|
4
|
+
class ImapError extends Error {
|
|
5
|
+
}
|
|
6
|
+
exports.ImapError = ImapError;
|
|
7
|
+
class ConnectionTimeoutError extends ImapError {
|
|
8
|
+
constructor(timeout) {
|
|
9
|
+
let message = 'connection timed out';
|
|
10
|
+
if (timeout) {
|
|
11
|
+
message += `. timeout = ${timeout} ms`;
|
|
12
|
+
}
|
|
13
|
+
super(message);
|
|
14
|
+
this.timeout = timeout;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ConnectionTimeoutError = ConnectionTimeoutError;
|
|
18
|
+
class ConnectionClosedError extends ImapError {
|
|
19
|
+
constructor() {
|
|
20
|
+
super('Connection closed unexpectedly');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ConnectionClosedError = ConnectionClosedError;
|
|
24
|
+
class ConnectionEndedError extends ImapError {
|
|
25
|
+
constructor() {
|
|
26
|
+
super('Connection ended unexpectedly');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ConnectionEndedError = ConnectionEndedError;
|
|
30
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAsB,SAAU,SAAQ,KAAK;CAAG;AAAhD,8BAAgD;AAGhD,MAAa,sBAAuB,SAAQ,SAAS;IACpD,YAEU,OAAgB;QAEzB,IAAI,OAAO,GAAG,sBAAsB,CAAC;QACrC,IAAI,OAAO,EAAE,CAAC;YACb,OAAO,IAAI,eAAe,OAAO,KAAK,CAAC;QACxC,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,CAAC;QANN,YAAO,GAAP,OAAO,CAAS;IAO1B,CAAC;CACD;AAXD,wDAWC;AAED,MAAa,qBAAsB,SAAQ,SAAS;IACnD;QACC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACzC,CAAC;CACD;AAJD,sDAIC;AAED,MAAa,oBAAqB,SAAQ,SAAS;IAClD;QACC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACxC,CAAC;CACD;AAJD,oDAIC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMessage = void 0;
|
|
4
|
+
const imap_1 = require("imap");
|
|
5
|
+
async function getMessage(message) {
|
|
6
|
+
return await new Promise((resolve) => {
|
|
7
|
+
let attributes;
|
|
8
|
+
const parts = [];
|
|
9
|
+
const messageOnBody = (stream, info) => {
|
|
10
|
+
let body = '';
|
|
11
|
+
const streamOnData = (chunk) => {
|
|
12
|
+
body += chunk.toString('utf8');
|
|
13
|
+
};
|
|
14
|
+
stream.on('data', streamOnData);
|
|
15
|
+
stream.once('end', () => {
|
|
16
|
+
stream.removeListener('data', streamOnData);
|
|
17
|
+
parts.push({
|
|
18
|
+
which: info.which,
|
|
19
|
+
size: info.size,
|
|
20
|
+
body: /^HEADER/g.test(info.which) ? (0, imap_1.parseHeader)(body) : body,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const messageOnAttributes = (attrs) => {
|
|
25
|
+
attributes = attrs;
|
|
26
|
+
};
|
|
27
|
+
const messageOnEnd = () => {
|
|
28
|
+
message.removeListener('body', messageOnBody);
|
|
29
|
+
message.removeListener('attributes', messageOnAttributes);
|
|
30
|
+
resolve({ attributes, parts });
|
|
31
|
+
};
|
|
32
|
+
message.on('body', messageOnBody);
|
|
33
|
+
message.once('attributes', messageOnAttributes);
|
|
34
|
+
message.once('end', messageOnEnd);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.getMessage = getMessage;
|
|
38
|
+
//# sourceMappingURL=getMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMessage.js","sourceRoot":"","sources":["../../src/helpers/getMessage.ts"],"names":[],"mappings":";;;AAAA,+BAKc;AAMP,KAAK,UAAU,UAAU,CAE/B,OAAoB;IAEpB,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACpC,IAAI,UAAiC,CAAC;QACtC,MAAM,KAAK,GAAsB,EAAE,CAAC;QAEpC,MAAM,aAAa,GAAG,CAAC,MAA6B,EAAE,IAAyB,EAAE,EAAE;YAClF,IAAI,IAAI,GAAW,EAAE,CAAC;YAEtB,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE;gBACtC,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAChC,CAAC,CAAC;YAEF,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;gBACvB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;gBAE5C,KAAK,CAAC,IAAI,CAAC;oBACV,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;iBAC5D,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,MAAM,mBAAmB,GAAG,CAAC,KAA4B,EAAE,EAAE;YAC5D,UAAU,GAAG,KAAK,CAAC;QACpB,CAAC,CAAC;QAEF,MAAM,YAAY,GAAG,GAAG,EAAE;YACzB,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YAC9C,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;YAC1D,OAAO,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,CAAC,CAAC;QAEF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACJ,CAAC;AAzCD,gCAyCC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ImapSimple } from './ImapSimple';
|
|
2
|
+
import type { ImapSimpleOptions, MessagePart } from './types';
|
|
3
|
+
export declare function connect(options: ImapSimpleOptions): Promise<ImapSimple>;
|
|
4
|
+
export declare function getParts(struct: any, parts?: MessagePart[]): MessagePart[];
|
|
5
|
+
export * from './ImapSimple';
|
|
6
|
+
export * from './errors';
|
|
7
|
+
export * from './types';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.getParts = exports.connect = void 0;
|
|
21
|
+
const imap_1 = __importDefault(require("imap"));
|
|
22
|
+
const ImapSimple_1 = require("./ImapSimple");
|
|
23
|
+
const errors_1 = require("./errors");
|
|
24
|
+
async function connect(options) {
|
|
25
|
+
var _a;
|
|
26
|
+
const authTimeout = (_a = options.imap.authTimeout) !== null && _a !== void 0 ? _a : 2000;
|
|
27
|
+
options.imap.authTimeout = authTimeout;
|
|
28
|
+
const imap = new imap_1.default(options.imap);
|
|
29
|
+
return await new Promise((resolve, reject) => {
|
|
30
|
+
const cleanUp = () => {
|
|
31
|
+
imap.removeListener('ready', imapOnReady);
|
|
32
|
+
imap.removeListener('error', imapOnError);
|
|
33
|
+
imap.removeListener('close', imapOnClose);
|
|
34
|
+
imap.removeListener('end', imapOnEnd);
|
|
35
|
+
};
|
|
36
|
+
const imapOnReady = () => {
|
|
37
|
+
cleanUp();
|
|
38
|
+
resolve(new ImapSimple_1.ImapSimple(imap));
|
|
39
|
+
};
|
|
40
|
+
const imapOnError = (e) => {
|
|
41
|
+
if (e.source === 'timeout-auth') {
|
|
42
|
+
e = new errors_1.ConnectionTimeoutError(authTimeout);
|
|
43
|
+
}
|
|
44
|
+
cleanUp();
|
|
45
|
+
reject(e);
|
|
46
|
+
};
|
|
47
|
+
const imapOnEnd = () => {
|
|
48
|
+
cleanUp();
|
|
49
|
+
reject(new errors_1.ConnectionEndedError());
|
|
50
|
+
};
|
|
51
|
+
const imapOnClose = () => {
|
|
52
|
+
cleanUp();
|
|
53
|
+
reject(new errors_1.ConnectionClosedError());
|
|
54
|
+
};
|
|
55
|
+
imap.once('ready', imapOnReady);
|
|
56
|
+
imap.once('error', imapOnError);
|
|
57
|
+
imap.once('close', imapOnClose);
|
|
58
|
+
imap.once('end', imapOnEnd);
|
|
59
|
+
if (options.onMail) {
|
|
60
|
+
imap.on('mail', options.onMail);
|
|
61
|
+
}
|
|
62
|
+
if (options.onExpunge) {
|
|
63
|
+
imap.on('expunge', options.onExpunge);
|
|
64
|
+
}
|
|
65
|
+
if (options.onUpdate) {
|
|
66
|
+
imap.on('update', options.onUpdate);
|
|
67
|
+
}
|
|
68
|
+
imap.connect();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
exports.connect = connect;
|
|
72
|
+
function getParts(struct, parts = []) {
|
|
73
|
+
for (let i = 0; i < struct.length; i++) {
|
|
74
|
+
if (Array.isArray(struct[i])) {
|
|
75
|
+
getParts(struct[i], parts);
|
|
76
|
+
}
|
|
77
|
+
else if (struct[i].partID) {
|
|
78
|
+
parts.push(struct[i]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return parts;
|
|
82
|
+
}
|
|
83
|
+
exports.getParts = getParts;
|
|
84
|
+
__exportStar(require("./ImapSimple"), exports);
|
|
85
|
+
__exportStar(require("./errors"), exports);
|
|
86
|
+
__exportStar(require("./types"), exports);
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,gDAAwB;AACxB,6CAA0C;AAC1C,qCAA+F;AAMxF,KAAK,UAAU,OAAO,CAAC,OAA0B;;IACvD,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,WAAW,mCAAI,IAAI,CAAC;IACrD,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAEvC,MAAM,IAAI,GAAG,IAAI,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC,OAAO,MAAM,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxD,MAAM,OAAO,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC1C,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,MAAM,WAAW,GAAG,GAAG,EAAE;YACxB,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,IAAI,uBAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,CAAC,CAAC;QAEF,MAAM,WAAW,GAAG,CAAC,CAA8B,EAAE,EAAE;YACtD,IAAI,CAAC,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;gBACjC,CAAC,GAAG,IAAI,+BAAsB,CAAC,WAAW,CAAC,CAAC;YAC7C,CAAC;YAED,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,CAAC,CAAC,CAAC;QACX,CAAC,CAAC;QAEF,MAAM,SAAS,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AAK,CAAC,CAAC;QAC5B,CAAC;aAAM,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC7B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAgB,CAAC,CAAC;QACtC,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAfD,4BAeC;AAED,+CAA6B;AAC7B,2CAAyB;AACzB,0CAAwB"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Config, ImapMessageBodyInfo, ImapMessageAttributes } from 'imap';
|
|
2
|
+
export interface ImapSimpleOptions {
|
|
3
|
+
imap: Config;
|
|
4
|
+
onMail?: ((numNewMail: number) => void) | undefined;
|
|
5
|
+
onExpunge?: ((seqNo: number) => void) | undefined;
|
|
6
|
+
onUpdate?: ((seqNo: number, info: {
|
|
7
|
+
num: number | undefined;
|
|
8
|
+
text: unknown;
|
|
9
|
+
}) => void) | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface MessagePart {
|
|
12
|
+
partID: string;
|
|
13
|
+
encoding: 'BASE64' | 'QUOTED-PRINTABLE' | '7BIT' | '8BIT' | 'BINARY' | 'UUENCODE';
|
|
14
|
+
type: 'TEXT';
|
|
15
|
+
subtype: string;
|
|
16
|
+
params?: {
|
|
17
|
+
charset?: string;
|
|
18
|
+
};
|
|
19
|
+
disposition?: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface MessageBodyPart extends ImapMessageBodyInfo {
|
|
24
|
+
body: string | object;
|
|
25
|
+
}
|
|
26
|
+
export interface Message {
|
|
27
|
+
attributes: ImapMessageAttributes;
|
|
28
|
+
parts: MessageBodyPart[];
|
|
29
|
+
seqNo?: number;
|
|
30
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@n8n/imap",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "src/index.ts",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*"
|
|
9
|
+
],
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"iconv-lite": "0.6.3",
|
|
12
|
+
"imap": "0.8.19",
|
|
13
|
+
"quoted-printable": "1.0.1",
|
|
14
|
+
"utf8": "3.0.0",
|
|
15
|
+
"uuencode": "0.0.4"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/imap": "^0.8.40",
|
|
19
|
+
"@types/quoted-printable": "^1.0.2",
|
|
20
|
+
"@types/utf8": "^3.0.3",
|
|
21
|
+
"@types/uuencode": "^0.0.3"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"clean": "rimraf dist .turbo",
|
|
25
|
+
"dev": "pnpm watch",
|
|
26
|
+
"typecheck": "tsc",
|
|
27
|
+
"build": "tsc -p tsconfig.build.json",
|
|
28
|
+
"format": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
29
|
+
"lint": "eslint . --quiet",
|
|
30
|
+
"lintfix": "eslint . --fix",
|
|
31
|
+
"watch": "tsc -p tsconfig.build.json --watch",
|
|
32
|
+
"test": "echo \"Error: no test created yet\""
|
|
33
|
+
}
|
|
34
|
+
}
|