@n8n/imap 0.8.19 → 0.9.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.
Files changed (44) hide show
  1. package/LICENSE.md +88 -0
  2. package/LICENSE_EE.md +27 -0
  3. package/dist/ImapSimple.d.ts +16 -0
  4. package/dist/ImapSimple.js +120 -0
  5. package/dist/ImapSimple.js.map +1 -0
  6. package/dist/PartData.d.ts +24 -0
  7. package/dist/PartData.js +109 -0
  8. package/dist/PartData.js.map +1 -0
  9. package/dist/build.tsbuildinfo +1 -0
  10. package/dist/errors.d.ts +12 -0
  11. package/dist/errors.js +30 -0
  12. package/dist/errors.js.map +1 -0
  13. package/dist/helpers/getMessage.d.ts +3 -0
  14. package/dist/helpers/getMessage.js +37 -0
  15. package/dist/helpers/getMessage.js.map +1 -0
  16. package/dist/index.d.ts +7 -0
  17. package/dist/index.js +85 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/types.d.ts +30 -0
  20. package/dist/types.js +3 -0
  21. package/dist/types.js.map +1 -0
  22. package/package.json +42 -18
  23. package/LICENSE +0 -19
  24. package/README.md +0 -754
  25. package/deps/encoding/encoding-indexes.js +0 -73
  26. package/deps/encoding/encoding.js +0 -2340
  27. package/deps/test/utf7-imap.js +0 -48
  28. package/deps/test/utf7-rfc2152.js +0 -78
  29. package/deps/utf7.js +0 -104
  30. package/index.d.ts +0 -396
  31. package/lib/Connection.js +0 -2131
  32. package/lib/Parser.js +0 -1026
  33. package/test/test-connection-fetch-dup.js +0 -92
  34. package/test/test-connection-fetch-frag.js +0 -92
  35. package/test/test-connection-fetch-spillover.js +0 -176
  36. package/test/test-connection-fetch-stringbody.js +0 -104
  37. package/test/test-connection-idle-normal.js +0 -144
  38. package/test/test-connection-idle-order.js +0 -138
  39. package/test/test-parse-bodystructure.js +0 -83
  40. package/test/test-parse-envelope-addrs.js +0 -117
  41. package/test/test-parse-expr.js +0 -92
  42. package/test/test-parse-header.js +0 -109
  43. package/test/test-parser.js +0 -543
  44. package/test/test.js +0 -4
package/LICENSE.md ADDED
@@ -0,0 +1,88 @@
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
+ - Source code files that contain ".ee." in their filename or ".ee" in their dirname are NOT licensed under
7
+ the Sustainable Use License.
8
+ To use source code files that contain ".ee." in their filename or ".ee" in their dirname you must hold a
9
+ valid n8n Enterprise License specifically allowing you access to such source code files and as defined
10
+ in "LICENSE_EE.md".
11
+ - All third party components incorporated into the n8n Software are licensed under the original license
12
+ provided by the owner of the applicable component.
13
+ - Content outside of the above mentioned files or restrictions is available under the "Sustainable Use
14
+ License" as defined below.
15
+
16
+ ## Sustainable Use License
17
+
18
+ Version 1.0
19
+
20
+ ### Acceptance
21
+
22
+ By using the software, you agree to all of the terms and conditions below.
23
+
24
+ ### Copyright License
25
+
26
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license
27
+ to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject
28
+ to the limitations below.
29
+
30
+ ### Limitations
31
+
32
+ You may use or modify the software only for your own internal business purposes or for non-commercial or
33
+ personal use. You may distribute the software or provide it to others only if you do so free of charge for
34
+ non-commercial purposes. You may not alter, remove, or obscure any licensing, copyright, or other notices of
35
+ the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
36
+
37
+ ### Patents
38
+
39
+ The licensor grants you a license, under any patent claims the licensor can license, or becomes able to
40
+ license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case
41
+ subject to the limitations and conditions in this license. This license does not cover any patent claims that
42
+ you cause to be infringed by modifications or additions to the software. If you or your company make any
43
+ written claim that the software infringes or contributes to infringement of any patent, your patent license
44
+ for the software granted under these terms ends immediately. If your company makes such a claim, your patent
45
+ license ends immediately for work on behalf of your company.
46
+
47
+ ### Notices
48
+
49
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these
50
+ terms. If you modify the software, you must include in any modified copies of the software a prominent notice
51
+ stating that you have modified the software.
52
+
53
+ ### No Other Rights
54
+
55
+ These terms do not imply any licenses other than those expressly granted in these terms.
56
+
57
+ ### Termination
58
+
59
+ If you use the software in violation of these terms, such use is not licensed, and your license will
60
+ automatically terminate. If the licensor provides you with a notice of your violation, and you cease all
61
+ violation of this license no later than 30 days after you receive that notice, your license will be reinstated
62
+ retroactively. However, if you violate these terms after such reinstatement, any additional violation of these
63
+ terms will cause your license to terminate automatically and permanently.
64
+
65
+ ### No Liability
66
+
67
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will
68
+ not be liable to you for any damages arising out of these terms or the use or nature of the software, under
69
+ any kind of legal claim.
70
+
71
+ ### Definitions
72
+
73
+ The “licensor” is the entity offering these terms.
74
+
75
+ The “software” is the software the licensor makes available under these terms, including any portion of it.
76
+
77
+ “You” refers to the individual or entity agreeing to these terms.
78
+
79
+ “Your company” is any legal entity, sole proprietorship, or other kind of organization that you work for, plus
80
+ all organizations that have control over, are under the control of, or are under common control with that
81
+ organization. Control means ownership of substantially all the assets of an entity, or the power to direct its
82
+ management and policies by vote, contract, or otherwise. Control can be direct or indirect.
83
+
84
+ “Your license” is the license granted to you for the software under these terms.
85
+
86
+ “Use” means anything you do with the software requiring your license.
87
+
88
+ “Trademark” means trademarks, service marks, and similar rights.
package/LICENSE_EE.md ADDED
@@ -0,0 +1,27 @@
1
+ # The n8n Enterprise License (the “Enterprise License”)
2
+
3
+ Copyright (c) 2022-present n8n GmbH.
4
+
5
+ With regard to the n8n Software:
6
+
7
+ This software and associated documentation files (the "Software") may only be used in production, if
8
+ you (and any entity that you represent) hold a valid n8n Enterprise license corresponding to your
9
+ usage. Subject to the foregoing sentence, you are free to modify this Software and publish patches
10
+ to the Software. You agree that n8n and/or its licensors (as applicable) retain all right, title and
11
+ interest in and to all such modifications and/or patches, and all such modifications and/or patches
12
+ may only be used, copied, modified, displayed, distributed, or otherwise exploited with a valid n8n
13
+ Enterprise license for the corresponding usage. Notwithstanding the foregoing, you may copy and
14
+ modify the Software for development and testing purposes, without requiring a subscription. You
15
+ agree that n8n and/or its licensors (as applicable) retain all right, title and interest in and to
16
+ all such modifications. You are not granted any other rights beyond what is expressly stated herein.
17
+ Subject to the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense, and/or
18
+ sell the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
21
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
23
+ OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ For all third party components incorporated into the n8n Software, those components are licensed
27
+ under the original license provided by the owner of the applicable component.
@@ -0,0 +1,16 @@
1
+ import { EventEmitter } from 'events';
2
+ import type Imap from 'imap';
3
+ import { PartData } from './PartData';
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<PartData>;
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,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImapSimple = void 0;
4
+ const events_1 = require("events");
5
+ const getMessage_1 = require("./helpers/getMessage");
6
+ const PartData_1 = require("./PartData");
7
+ const IMAP_EVENTS = ['alert', 'mail', 'expunge', 'uidvalidity', 'update', 'close', 'end'];
8
+ class ImapSimple extends events_1.EventEmitter {
9
+ constructor(imap) {
10
+ super();
11
+ this.imap = imap;
12
+ this.ending = false;
13
+ IMAP_EVENTS.forEach((event) => {
14
+ this.imap.on(event, this.emit.bind(this, event));
15
+ });
16
+ this.imap.on('error', (e) => {
17
+ if (e && this.ending && e.code?.toUpperCase() === 'ECONNRESET') {
18
+ return;
19
+ }
20
+ this.emit('error', e);
21
+ });
22
+ }
23
+ end() {
24
+ this.ending = true;
25
+ this.imap.once('close', () => {
26
+ this.ending = false;
27
+ });
28
+ this.imap.end();
29
+ }
30
+ async search(searchCriteria, fetchOptions) {
31
+ return await new Promise((resolve, reject) => {
32
+ this.imap.search(searchCriteria, (e, uids) => {
33
+ if (e) {
34
+ reject(e);
35
+ return;
36
+ }
37
+ if (uids.length === 0) {
38
+ resolve([]);
39
+ return;
40
+ }
41
+ const fetch = this.imap.fetch(uids, fetchOptions);
42
+ let messagesRetrieved = 0;
43
+ const messages = [];
44
+ const fetchOnMessage = async (message, seqNo) => {
45
+ const msg = await (0, getMessage_1.getMessage)(message);
46
+ msg.seqNo = seqNo;
47
+ messages[seqNo] = msg;
48
+ messagesRetrieved++;
49
+ if (messagesRetrieved === uids.length) {
50
+ resolve(messages.filter((m) => !!m));
51
+ }
52
+ };
53
+ const fetchOnError = (error) => {
54
+ fetch.removeListener('message', fetchOnMessage);
55
+ fetch.removeListener('end', fetchOnEnd);
56
+ reject(error);
57
+ };
58
+ const fetchOnEnd = () => {
59
+ fetch.removeListener('message', fetchOnMessage);
60
+ fetch.removeListener('error', fetchOnError);
61
+ };
62
+ fetch.on('message', fetchOnMessage);
63
+ fetch.once('error', fetchOnError);
64
+ fetch.once('end', fetchOnEnd);
65
+ });
66
+ });
67
+ }
68
+ async getPartData(message, part) {
69
+ return await new Promise((resolve, reject) => {
70
+ const fetch = this.imap.fetch(message.attributes.uid, {
71
+ bodies: [part.partID],
72
+ struct: true,
73
+ });
74
+ const fetchOnMessage = async (msg) => {
75
+ const result = await (0, getMessage_1.getMessage)(msg);
76
+ if (result.parts.length !== 1) {
77
+ reject(new Error('Got ' + result.parts.length + ' parts, should get 1'));
78
+ return;
79
+ }
80
+ const data = result.parts[0].body;
81
+ const encoding = part.encoding.toUpperCase();
82
+ resolve(PartData_1.PartData.fromData(data, encoding));
83
+ };
84
+ const fetchOnError = (error) => {
85
+ fetch.removeListener('message', fetchOnMessage);
86
+ fetch.removeListener('end', fetchOnEnd);
87
+ reject(error);
88
+ };
89
+ const fetchOnEnd = () => {
90
+ fetch.removeListener('message', fetchOnMessage);
91
+ fetch.removeListener('error', fetchOnError);
92
+ };
93
+ fetch.once('message', fetchOnMessage);
94
+ fetch.once('error', fetchOnError);
95
+ fetch.once('end', fetchOnEnd);
96
+ });
97
+ }
98
+ async addFlags(uid, flags) {
99
+ return await new Promise((resolve, reject) => {
100
+ this.imap.addFlags(uid, flags, (e) => (e ? reject(e) : resolve()));
101
+ });
102
+ }
103
+ async getBoxes() {
104
+ return await new Promise((resolve, reject) => {
105
+ this.imap.getBoxes((e, boxes) => (e ? reject(e) : resolve(boxes)));
106
+ });
107
+ }
108
+ async openBox(boxName) {
109
+ return await new Promise((resolve, reject) => {
110
+ this.imap.openBox(boxName, (e, result) => (e ? reject(e) : resolve(result)));
111
+ });
112
+ }
113
+ async closeBox(autoExpunge = true) {
114
+ return await new Promise((resolve, reject) => {
115
+ this.imap.closeBox(autoExpunge, (e) => (e ? reject(e) : resolve()));
116
+ });
117
+ }
118
+ }
119
+ exports.ImapSimple = ImapSimple;
120
+ //# sourceMappingURL=ImapSimple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImapSimple.js","sourceRoot":"","sources":["../src/ImapSimple.ts"],"names":[],"mappings":";;;AACA,mCAAsC;AAItC,qDAAkD;AAClD,yCAAsC;AAGtC,MAAM,WAAW,GAAG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D,KAAK,CAAC,OAAO,CAEZ,OAAe;QAEf,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC5C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;IACJ,CAAC;IAGD,KAAK,CAAC,QAAQ,CAEb,WAAW,GAAG,IAAI;QAElB,OAAO,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAClD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAzLD,gCAyLC"}
@@ -0,0 +1,24 @@
1
+ export declare abstract class PartData {
2
+ readonly buffer: Buffer;
3
+ constructor(buffer: Buffer);
4
+ toString(): string;
5
+ static fromData(data: string, encoding: string, charset?: string): PartData;
6
+ }
7
+ export declare class Base64PartData extends PartData {
8
+ constructor(data: string);
9
+ }
10
+ export declare class QuotedPrintablePartData extends PartData {
11
+ constructor(data: string, charset?: string);
12
+ }
13
+ export declare class SevenBitPartData extends PartData {
14
+ constructor(data: string);
15
+ toString(): string;
16
+ }
17
+ export declare class BinaryPartData extends PartData {
18
+ readonly charset: string;
19
+ constructor(data: string, charset?: string);
20
+ toString(): string;
21
+ }
22
+ export declare class UuencodedPartData extends PartData {
23
+ constructor(data: string);
24
+ }
@@ -0,0 +1,109 @@
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.UuencodedPartData = exports.BinaryPartData = exports.SevenBitPartData = exports.QuotedPrintablePartData = exports.Base64PartData = exports.PartData = void 0;
37
+ const iconvlite = __importStar(require("iconv-lite"));
38
+ const qp = __importStar(require("quoted-printable"));
39
+ const utf8 = __importStar(require("utf8"));
40
+ const uuencode = __importStar(require("uuencode"));
41
+ class PartData {
42
+ constructor(buffer) {
43
+ this.buffer = buffer;
44
+ }
45
+ toString() {
46
+ return this.buffer.toString();
47
+ }
48
+ static fromData(data, encoding, charset) {
49
+ if (encoding === 'BASE64') {
50
+ return new Base64PartData(data);
51
+ }
52
+ if (encoding === 'QUOTED-PRINTABLE') {
53
+ return new QuotedPrintablePartData(data, charset);
54
+ }
55
+ if (encoding === '7BIT') {
56
+ return new SevenBitPartData(data);
57
+ }
58
+ if (encoding === '8BIT' || encoding === 'BINARY') {
59
+ return new BinaryPartData(data, charset);
60
+ }
61
+ if (encoding === 'UUENCODE') {
62
+ return new UuencodedPartData(data);
63
+ }
64
+ throw new Error('Unknown encoding ' + encoding);
65
+ }
66
+ }
67
+ exports.PartData = PartData;
68
+ class Base64PartData extends PartData {
69
+ constructor(data) {
70
+ super(Buffer.from(data, 'base64'));
71
+ }
72
+ }
73
+ exports.Base64PartData = Base64PartData;
74
+ class QuotedPrintablePartData extends PartData {
75
+ constructor(data, charset) {
76
+ const decoded = charset?.toUpperCase() === 'UTF-8' ? utf8.decode(qp.decode(data)) : qp.decode(data);
77
+ super(Buffer.from(decoded));
78
+ }
79
+ }
80
+ exports.QuotedPrintablePartData = QuotedPrintablePartData;
81
+ class SevenBitPartData extends PartData {
82
+ constructor(data) {
83
+ super(Buffer.from(data));
84
+ }
85
+ toString() {
86
+ return this.buffer.toString('ascii');
87
+ }
88
+ }
89
+ exports.SevenBitPartData = SevenBitPartData;
90
+ class BinaryPartData extends PartData {
91
+ constructor(data, charset = 'utf-8') {
92
+ super(Buffer.from(data));
93
+ this.charset = charset;
94
+ }
95
+ toString() {
96
+ return iconvlite.decode(this.buffer, this.charset);
97
+ }
98
+ }
99
+ exports.BinaryPartData = BinaryPartData;
100
+ class UuencodedPartData extends PartData {
101
+ constructor(data) {
102
+ const parts = data.split('\n');
103
+ const merged = parts.splice(1, parts.length - 4).join('');
104
+ const decoded = uuencode.decode(merged);
105
+ super(decoded);
106
+ }
107
+ }
108
+ exports.UuencodedPartData = UuencodedPartData;
109
+ //# sourceMappingURL=PartData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PartData.js","sourceRoot":"","sources":["../src/PartData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwC;A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ript@5.7.2/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.7.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","../src/types.ts","../src/helpers/getMessage.ts","../../../../node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/index.d.ts","../../../../node_modules/.pnpm/@types+quoted-printable@1.0.2/node_modules/@types/quoted-printable/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_patch_hash=083a73709a54db57b092d986b43d27ddda3cb8008f9510e98bc9e6da0e1cbb62/node_modules/@types/uuencode/index.d.ts","../src/PartData.ts","../src/ImapSimple.ts","../src/errors.ts","../src/index.ts"],"fileIdsList":[[71,97,101,108],[55,101],[58,101],[59,64,92,101],[60,71,72,79,89,100,101],[60,61,71,79,101],[62,101],[63,64,72,80,101],[64,89,97,101],[65,67,71,79,101],[66,101],[67,68,101],[71,101],[69,71,101],[71,72,73,89,100,101],[71,72,73,86,89,92,101],[101,105],[101],[67,71,74,79,89,100,101],[71,72,74,75,79,89,97,100,101],[74,76,89,97,100,101],[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,101,102,103,104,105,106,107],[71,77,101],[78,100,101],[67,71,79,89,101],[80,101],[81,101],[58,82,101],[83,99,101,105],[84,101],[85,101],[71,86,87,101],[86,88,101,103],[59,71,89,90,91,92,101],[59,89,91,101],[89,90,101],[92,101],[93,101],[71,95,96,101],[95,96,101],[64,79,89,97,101],[98,101],[79,99,101],[59,74,85,100,101],[64,101],[89,101,102],[101,103],[101,104],[59,64,71,73,82,89,100,101,103,105],[89,101,106],[101,108],[71,101,109,110,111,116],[101,112,113,114,115],[101,109,110],[101,109,110,117,118],[101,109]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"f1e2a172204962276504466a6393426d2ca9c54894b1ad0a6c9dad867a65f876","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"406a5a771d97867cba07e7fbd3cd1fb2dd1004558b973733205737e9dd7ed929","affectsGlobalScope":true,"impliedFormat":1},{"version":"ba8691cf6bea9d53e6bf6cbc22af964a9633a21793981a1be3dce65e7a714d8b","impliedFormat":1},{"version":"a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a","impliedFormat":1},{"version":"bce910d9164785c9f0d4dcea4be359f5f92130c7c7833dea6138ab1db310a1f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"7d2e3fea24c712c99c03ad8f556abedbfe105f87f1be10b95dbd409d24bc05a3","impliedFormat":1},{"version":"c7a976828c7acb8ada184935195aef0f389c4e37d87daa52eb4f2f3df3edcdea","affectsGlobalScope":true,"impliedFormat":1},{"version":"3719525a8f6ab731e3dfd585d9f87df55ec7d50d461df84f74eb4d68bb165244","impliedFormat":1},{"version":"5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713","impliedFormat":1},{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true,"impliedFormat":1},{"version":"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","impliedFormat":1},{"version":"b787b5b54349a24f07d089b612a9fb8ff024dbbe991ff52ea2b188a6b1230644","impliedFormat":1},{"version":"bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","impliedFormat":1},{"version":"1cdcfc1f624d6c08aa12c73935f6e13f095919cd99edf95752951796eb225729","impliedFormat":1},{"version":"4eaff3d8e10676fd7913d8c108890e71c688e1e7d52f6d1d55c39514f493dc47","impliedFormat":1},{"version":"14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","impliedFormat":1},{"version":"5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea","impliedFormat":1},{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true,"impliedFormat":1},{"version":"00dee7cdca8b8420c47ea4a31a34b8e8294013ebc4f463fd941e867e7bf05029","affectsGlobalScope":true,"impliedFormat":1},{"version":"7abd2623cdd8148233c0c6b9da0289e124f1718bc58dcb8da4262432e9ce0f0a","impliedFormat":1},{"version":"f4a3088770ba56a4c72e9907bc9798706ab1575097cd024503f57966df2d3d3a","impliedFormat":1},{"version":"7f138842074d0a40681775af008c8452093b68c383c94de31759e853c6d06b5c","impliedFormat":1},{"version":"a3d541d303ee505053f5dcbf9fafb65cac3d5631037501cd616195863a6c5740","impliedFormat":1},{"version":"8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","impliedFormat":1},{"version":"2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58","impliedFormat":1},{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true,"impliedFormat":1},{"version":"bcebb922784739bdb34c18ee51095d25a92b560c78ccd2eaacd6bd00f7443d83","impliedFormat":1},{"version":"7ee6ed878c4528215c82b664fe0cfe80e8b4da6c0d4cc80869367868774db8b1","impliedFormat":1},{"version":"b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30","impliedFormat":1},{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true,"impliedFormat":1},{"version":"0715e4cd28ad471b2a93f3e552ff51a3ae423417a01a10aa1d3bc7c6b95059d6","affectsGlobalScope":true,"impliedFormat":1},{"version":"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","impliedFormat":1},{"version":"210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","impliedFormat":1},{"version":"36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","impliedFormat":1},{"version":"0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","impliedFormat":1},{"version":"25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","impliedFormat":1},{"version":"4f3fdeba4e28e21aa719c081b8dc8f91d47e12e773389b9d35679c08151c9d37","impliedFormat":1},{"version":"1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","impliedFormat":1},{"version":"69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","impliedFormat":1},{"version":"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","impliedFormat":1},{"version":"23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","impliedFormat":1},{"version":"5629c03c44d1e07698c31d04318c9950d78940461269c0f692a42091cedea142","impliedFormat":1},{"version":"3c4ba1dd9b12ffa284b565063108f2f031d150ea15b8fafbdc17f5d2a07251f3","affectsGlobalScope":true,"impliedFormat":1},{"version":"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","impliedFormat":1},{"version":"1422cd9e705adcc09088fda85a900c2b70e3ad36ea85846f68bd1a884cdf4e2b","impliedFormat":1},{"version":"3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","impliedFormat":1},{"version":"5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2","impliedFormat":1},{"version":"c6b124041039647ff446e19ea0e90a7a83256593d64f23c66b4fda6e0c5b968e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a9fc1469744055a3435f203123246b96c094e7ff8c4e1c3863829d9b705b7a34","affectsGlobalScope":true,"impliedFormat":1},{"version":"868831cab82b65dfe1d68180e898af1f2101e89ba9b754d1db6fb8cc2fac1921","impliedFormat":1},{"version":"0fe8985a28f82c450a04a6edf1279d7181c0893f37da7d2a27f8efd4fd5edb03","impliedFormat":1},{"version":"e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa","impliedFormat":1},{"version":"52120bb7e4583612225bdf08e7c12559548170f11e660d33a33623bae9bbdbba","affectsGlobalScope":true,"impliedFormat":1},{"version":"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e","impliedFormat":1},{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6dd3dba8e665ac43d279e0fdf5219edda0eed69b5e9a5061f46cd6a65c4f7a1","impliedFormat":1},{"version":"52e0d4a8762141a86861c8175312030724ff444f7ae548c61e7263f774160fc3","impliedFormat":1},{"version":"6ce4e2aba197a5cd6fcd6e710e1827b5daeeba19388334615abd69026bfa3194","signature":"edc009b8da0b4f21086e5a665072b6ca2ddeefaf342596863cfbbdd285a1229d"},{"version":"dd94e97cdbb6241a2b70533341e1da83bfb80d56f70e2aab4b10aeedfc201ccc","signature":"d3470035d665d3be9ac5441942bac95ba52ca1b9f3eab4559fcd6dd616827354"},{"version":"85d3aa95b0086752d2f7784d2bdaeb38f99c3cf6c35bee861702beb68556cb9e","impliedFormat":1},{"version":"9c0ea4ed2c2cd25374c31d9bbbe8aefa5171da25ee6e7d388b6ae9c3481bda3f","impliedFormat":1},{"version":"67dde413b255aee29f821a7a98218f5936539c38526d77dfede51f12f2c3aa52","impliedFormat":1},{"version":"df7cad075a5e421ae12ea4674692b295346744ba1fff73850056c904f321083c","impliedFormat":1},{"version":"cb3514c987995ea0522c1c8182dee0fc947cecd1f459fc9c6322375aecc86e25","signature":"389ada30404735d61de19071551243ecffbcea2d0011cb37425999dee904cee0"},{"version":"477e57ce9ca613e7754bd16b2f1627e02cb976f2c3f44a9d1c5132bdc41c1dda","signature":"7beb36ccd089f703655d747912b5dec2777c51161ca8cfd45de78397667eaef6"},{"version":"61e7f1bd24f78842bb050f00db1f52283488794f1442a98e104089ae0ff7ad04","signature":"3cc448750f6b14e1bb8be179e843b345b1eb7812d4942b7c6f25c3ed9f9b7020"},{"version":"dbd6f149ee201984927968742c0318ff036388395723d60fc43560ce83da436c","signature":"ac756991c52b52aa00cbb21174b4551c18abf820ad0f944a33d4e9e92d701c7b"}],"root":[54,110,111,[116,119]],"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":8,"tsBuildInfoFile":"./build.tsbuildinfo","useUnknownInCatchVariables":true},"referencedMap":[[109,1],[55,2],[56,2],[58,3],[59,4],[60,5],[61,6],[62,7],[63,8],[64,9],[65,10],[66,11],[67,12],[68,12],[70,13],[69,14],[71,13],[72,15],[73,16],[57,17],[107,18],[74,19],[75,20],[76,21],[108,22],[77,23],[78,24],[79,25],[80,26],[81,27],[82,28],[83,29],[84,30],[85,31],[86,32],[87,32],[88,33],[89,34],[91,35],[90,36],[92,37],[93,38],[94,18],[95,39],[96,40],[97,41],[98,42],[99,43],[100,44],[101,45],[102,46],[103,47],[104,48],[105,49],[106,50],[113,18],[114,18],[115,51],[112,18],[52,18],[53,18],[9,18],[11,18],[10,18],[2,18],[12,18],[13,18],[14,18],[15,18],[16,18],[17,18],[18,18],[19,18],[3,18],[20,18],[21,18],[4,18],[22,18],[26,18],[23,18],[24,18],[25,18],[27,18],[28,18],[29,18],[5,18],[30,18],[31,18],[32,18],[33,18],[6,18],[37,18],[34,18],[35,18],[36,18],[38,18],[7,18],[39,18],[44,18],[45,18],[40,18],[41,18],[42,18],[43,18],[8,18],[49,18],[46,18],[47,18],[48,18],[50,18],[1,18],[51,18],[54,18],[117,52],[116,53],[118,18],[111,54],[119,55],[110,56]],"latestChangedDtsFile":"./index.d.ts","version":"5.7.2"}
@@ -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,3 @@
1
+ import { type ImapMessage } from 'imap';
2
+ import type { Message } from '../types';
3
+ export declare function getMessage(message: ImapMessage): Promise<Message>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMessage = getMessage;
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
+ //# sourceMappingURL=getMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMessage.js","sourceRoot":"","sources":["../../src/helpers/getMessage.ts"],"names":[],"mappings":";;AAYA,gCAyCC;AArDD,+BAKc;AAOP,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"}
@@ -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';