n8n-nodes-imap 1.0.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 (67) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +31 -0
  3. package/dist/credentials/ImapCredentials.credentials.d.ts +15 -0
  4. package/dist/credentials/ImapCredentials.credentials.js +55 -0
  5. package/dist/credentials/ImapCredentials.credentials.js.map +1 -0
  6. package/dist/nodes/Imap/Imap.node.d.ts +14 -0
  7. package/dist/nodes/Imap/Imap.node.js +107 -0
  8. package/dist/nodes/Imap/Imap.node.js.map +1 -0
  9. package/dist/nodes/Imap/node-imap-icon.svg +79 -0
  10. package/dist/nodes/Imap/operations/ResourcesList.d.ts +2 -0
  11. package/dist/nodes/Imap/operations/ResourcesList.js +10 -0
  12. package/dist/nodes/Imap/operations/ResourcesList.js.map +1 -0
  13. package/dist/nodes/Imap/operations/email/OperationsList.d.ts +2 -0
  14. package/dist/nodes/Imap/operations/email/OperationsList.js +16 -0
  15. package/dist/nodes/Imap/operations/email/OperationsList.js.map +1 -0
  16. package/dist/nodes/Imap/operations/email/ResourceName.d.ts +2 -0
  17. package/dist/nodes/Imap/operations/email/ResourceName.js +8 -0
  18. package/dist/nodes/Imap/operations/email/ResourceName.js.map +1 -0
  19. package/dist/nodes/Imap/operations/email/functions/EmailDownloadAttachment.d.ts +2 -0
  20. package/dist/nodes/Imap/operations/email/functions/EmailDownloadAttachment.js +55 -0
  21. package/dist/nodes/Imap/operations/email/functions/EmailDownloadAttachment.js.map +1 -0
  22. package/dist/nodes/Imap/operations/email/functions/EmailGetList.d.ts +2 -0
  23. package/dist/nodes/Imap/operations/email/functions/EmailGetList.js +193 -0
  24. package/dist/nodes/Imap/operations/email/functions/EmailGetList.js.map +1 -0
  25. package/dist/nodes/Imap/operations/email/functions/EmailMove.d.ts +2 -0
  26. package/dist/nodes/Imap/operations/email/functions/EmailMove.js +56 -0
  27. package/dist/nodes/Imap/operations/email/functions/EmailMove.js.map +1 -0
  28. package/dist/nodes/Imap/operations/mailbox/OperationsList.d.ts +2 -0
  29. package/dist/nodes/Imap/operations/mailbox/OperationsList.js +18 -0
  30. package/dist/nodes/Imap/operations/mailbox/OperationsList.js.map +1 -0
  31. package/dist/nodes/Imap/operations/mailbox/ResourceName.d.ts +2 -0
  32. package/dist/nodes/Imap/operations/mailbox/ResourceName.js +8 -0
  33. package/dist/nodes/Imap/operations/mailbox/ResourceName.js.map +1 -0
  34. package/dist/nodes/Imap/operations/mailbox/functions/MailboxCreate.d.ts +2 -0
  35. package/dist/nodes/Imap/operations/mailbox/functions/MailboxCreate.js +60 -0
  36. package/dist/nodes/Imap/operations/mailbox/functions/MailboxCreate.js.map +1 -0
  37. package/dist/nodes/Imap/operations/mailbox/functions/MailboxDelete.d.ts +2 -0
  38. package/dist/nodes/Imap/operations/mailbox/functions/MailboxDelete.js +37 -0
  39. package/dist/nodes/Imap/operations/mailbox/functions/MailboxDelete.js.map +1 -0
  40. package/dist/nodes/Imap/operations/mailbox/functions/MailboxGetList.d.ts +2 -0
  41. package/dist/nodes/Imap/operations/mailbox/functions/MailboxGetList.js +91 -0
  42. package/dist/nodes/Imap/operations/mailbox/functions/MailboxGetList.js.map +1 -0
  43. package/dist/nodes/Imap/operations/mailbox/functions/MailboxGetStatus.d.ts +2 -0
  44. package/dist/nodes/Imap/operations/mailbox/functions/MailboxGetStatus.js +36 -0
  45. package/dist/nodes/Imap/operations/mailbox/functions/MailboxGetStatus.js.map +1 -0
  46. package/dist/nodes/Imap/operations/mailbox/functions/MailboxRename.d.ts +2 -0
  47. package/dist/nodes/Imap/operations/mailbox/functions/MailboxRename.js +40 -0
  48. package/dist/nodes/Imap/operations/mailbox/functions/MailboxRename.js.map +1 -0
  49. package/dist/nodes/Imap/utils/CommonDefinitions.d.ts +12 -0
  50. package/dist/nodes/Imap/utils/CommonDefinitions.js +58 -0
  51. package/dist/nodes/Imap/utils/CommonDefinitions.js.map +1 -0
  52. package/dist/nodes/Imap/utils/EmailSearchParameters.d.ts +4 -0
  53. package/dist/nodes/Imap/utils/EmailSearchParameters.js +211 -0
  54. package/dist/nodes/Imap/utils/EmailSearchParameters.js.map +1 -0
  55. package/dist/nodes/Imap/utils/FindOperation.d.ts +2 -0
  56. package/dist/nodes/Imap/utils/FindOperation.js +21 -0
  57. package/dist/nodes/Imap/utils/FindOperation.js.map +1 -0
  58. package/dist/nodes/Imap/utils/ImapUtils.d.ts +3 -0
  59. package/dist/nodes/Imap/utils/ImapUtils.js +27 -0
  60. package/dist/nodes/Imap/utils/ImapUtils.js.map +1 -0
  61. package/dist/nodes/Imap/utils/SearchFieldParameters.d.ts +4 -0
  62. package/dist/nodes/Imap/utils/SearchFieldParameters.js +71 -0
  63. package/dist/nodes/Imap/utils/SearchFieldParameters.js.map +1 -0
  64. package/dist/package.json +64 -0
  65. package/dist/tsconfig.tsbuildinfo +1 -0
  66. package/index.js +0 -0
  67. package/package.json +64 -0
package/LICENSE.md ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2022 n8n
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # <img src="nodes/Imap/node-imap-icon.svg" height="40"> n8n-nodes-imap
2
+
3
+ This is an n8n community node that adds support for [IMAP](https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol) email servers.
4
+
5
+ [Installation](#installation)
6
+ [Operations](#operations)
7
+ [Credentials](#credentials)
8
+ [Version history](CHANGELOG.md)
9
+
10
+ ## Installation
11
+
12
+ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
13
+
14
+ ## Operations
15
+
16
+ * Mailbox
17
+ * Get list of mailboxes (including status information like number of messages)
18
+ * Get status of a mailbox (number of messages, etc.)
19
+ * Create a mailbox
20
+ * Rename a mailbox
21
+ * ~Delete a mailbox~ (disabled due to danger of accidental data loss and no apparent use case)
22
+ * Email
23
+ * Get list of emails in a mailbox
24
+ * Download attachments from an email
25
+ * Move an email to another mailbox
26
+
27
+ ## Credentials
28
+
29
+ Currently, this node supports only basic authentication (username and password).
30
+ OAuth2 authentication is not supported yet.
31
+
@@ -0,0 +1,15 @@
1
+ import { ICredentialType, INodeProperties } from "n8n-workflow";
2
+ export declare const IMAP_CREDENTIALS_NAME = "imapApi";
3
+ export declare class ImapCredentials implements ICredentialType {
4
+ name: string;
5
+ displayName: string;
6
+ properties: INodeProperties[];
7
+ }
8
+ export interface ImapCredentialsData {
9
+ host: string;
10
+ port: number;
11
+ user: string;
12
+ password: string;
13
+ tls: boolean;
14
+ allowUnauthorizedCerts: boolean;
15
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImapCredentials = exports.IMAP_CREDENTIALS_NAME = void 0;
4
+ exports.IMAP_CREDENTIALS_NAME = "imapApi";
5
+ class ImapCredentials {
6
+ constructor() {
7
+ this.name = exports.IMAP_CREDENTIALS_NAME;
8
+ this.displayName = "IMAP Credentials";
9
+ this.properties = [
10
+ {
11
+ displayName: "Host",
12
+ name: "host",
13
+ type: "string",
14
+ default: "",
15
+ placeholder: "imap.gmail.com",
16
+ },
17
+ {
18
+ displayName: "Port",
19
+ name: "port",
20
+ type: "number",
21
+ default: 993,
22
+ description: "Usually 993 for SSL and 143 for TLS",
23
+ },
24
+ {
25
+ displayName: "User",
26
+ name: "user",
27
+ type: "string",
28
+ default: "",
29
+ placeholder: "Username",
30
+ },
31
+ {
32
+ displayName: "Password",
33
+ name: "password",
34
+ type: "string",
35
+ typeOptions: { password: true },
36
+ default: "",
37
+ },
38
+ {
39
+ displayName: "TLS",
40
+ name: "tls",
41
+ type: "boolean",
42
+ default: true,
43
+ description: "Whether to use SSL/TLS or not",
44
+ },
45
+ {
46
+ displayName: "Allow Self-Signed Certificates",
47
+ name: "allowUnauthorizedCerts",
48
+ type: "boolean",
49
+ default: false,
50
+ },
51
+ ];
52
+ }
53
+ }
54
+ exports.ImapCredentials = ImapCredentials;
55
+ //# sourceMappingURL=ImapCredentials.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImapCredentials.credentials.js","sourceRoot":"","sources":["../../credentials/ImapCredentials.credentials.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAG,SAAS,CAAC;AAE/C,MAAa,eAAe;IAA5B;QACE,SAAI,GAAG,6BAAqB,CAAC;QAC7B,gBAAW,GAAG,kBAAkB,CAAC;QACjC,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,MAAM;gBACnB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,gBAAgB;aAC9B;YACD;gBACE,WAAW,EAAE,MAAM;gBACnB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,GAAG;gBACZ,WAAW,EAAE,qCAAqC;aACnD;YACD;gBACE,WAAW,EAAE,MAAM;gBACnB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,UAAU;aACxB;YACD;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACZ;YACD;gBACE,WAAW,EAAE,KAAK;gBAClB,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,+BAA+B;aAC7C;YACD;gBACE,WAAW,EAAE,gCAAgC;gBAC7C,IAAI,EAAE,wBAAwB;gBAC9B,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK;aACf;SACF,CAAC;IACJ,CAAC;CAAA;AA9CD,0CA8CC"}
@@ -0,0 +1,14 @@
1
+ import { ICredentialTestFunctions, ICredentialsDecrypted, IExecuteFunctions, INodeCredentialTestResult, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ import { loadMailboxList } from './utils/SearchFieldParameters';
3
+ export declare class Imap implements INodeType {
4
+ description: INodeTypeDescription;
5
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
6
+ methods: {
7
+ listSearch: {
8
+ loadMailboxList: typeof loadMailboxList;
9
+ };
10
+ credentialTest: {
11
+ testImapCredentials(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult>;
12
+ };
13
+ };
14
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Imap = void 0;
4
+ const ResourcesList_1 = require("./operations/ResourcesList");
5
+ const CommonDefinitions_1 = require("./utils/CommonDefinitions");
6
+ const ImapCredentials_credentials_1 = require("../../credentials/ImapCredentials.credentials");
7
+ const ImapUtils_1 = require("./utils/ImapUtils");
8
+ const n8n_workflow_1 = require("n8n-workflow");
9
+ const SearchFieldParameters_1 = require("./utils/SearchFieldParameters");
10
+ class Imap {
11
+ constructor() {
12
+ this.description = {
13
+ displayName: 'IMAP',
14
+ name: 'imap',
15
+ icon: 'file:node-imap-icon.svg',
16
+ group: ['transform'],
17
+ version: 1,
18
+ subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
19
+ description: 'Retrieve emails via IMAP',
20
+ defaults: {
21
+ name: 'IMAP',
22
+ },
23
+ inputs: ['main'],
24
+ outputs: ['main'],
25
+ credentials: [
26
+ {
27
+ name: ImapCredentials_credentials_1.IMAP_CREDENTIALS_NAME,
28
+ required: true,
29
+ },
30
+ ],
31
+ properties: [
32
+ {
33
+ displayName: 'Resource',
34
+ name: 'resource',
35
+ type: 'options',
36
+ noDataExpression: true,
37
+ options: ResourcesList_1.allResourceDefinitions.map((resourceDef) => resourceDef.resource),
38
+ default: ResourcesList_1.allResourceDefinitions[0].resource.value,
39
+ },
40
+ ...ResourcesList_1.allResourceDefinitions.map((resourceDef) => (0, CommonDefinitions_1.getAllResourceNodeParameters)(resourceDef)).flat(),
41
+ ],
42
+ };
43
+ this.methods = {
44
+ listSearch: {
45
+ loadMailboxList: SearchFieldParameters_1.loadMailboxList,
46
+ },
47
+ credentialTest: {
48
+ async testImapCredentials(credential) {
49
+ const credentials = credential.data;
50
+ try {
51
+ const client = (0, ImapUtils_1.createImapClient)(credentials);
52
+ await client.connect();
53
+ client.close();
54
+ }
55
+ catch (error) {
56
+ return {
57
+ status: 'Error',
58
+ message: error.message,
59
+ };
60
+ }
61
+ return {
62
+ status: 'OK',
63
+ message: 'Success',
64
+ };
65
+ },
66
+ },
67
+ };
68
+ }
69
+ async execute() {
70
+ var _a;
71
+ const credentials = await this.getCredentials(ImapCredentials_credentials_1.IMAP_CREDENTIALS_NAME);
72
+ const client = (0, ImapUtils_1.createImapClient)(credentials);
73
+ await client.connect();
74
+ const resource = this.getNodeParameter('resource', 0);
75
+ const operation = this.getNodeParameter('operation', 0);
76
+ const handler = (_a = ResourcesList_1.allResourceDefinitions.find((resourceDef) => resourceDef.resource.value === resource)) === null || _a === void 0 ? void 0 : _a.operationDefs.find((operationDef) => operationDef.operation.value === operation);
77
+ if (handler) {
78
+ try {
79
+ const result = await handler.executeImapAction(this, client);
80
+ if (result) {
81
+ return result;
82
+ }
83
+ else {
84
+ this.logger.warn(`Operation "${operation}" for resource "${resource}" returned no data`);
85
+ return [];
86
+ }
87
+ }
88
+ catch (error) {
89
+ this.logger.error(`Operation "${operation}" for resource "${resource}" failed: ${error.message}`);
90
+ this.logger.error(JSON.stringify(error));
91
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {}, {
92
+ message: error.responseText || error.message || 'Unknown error',
93
+ });
94
+ }
95
+ }
96
+ else {
97
+ this.logger.error(`Unknown operation "${operation}" for resource "${resource}"`);
98
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {}, {
99
+ message: `Unknown operation "${operation}" for resource "${resource}"`,
100
+ });
101
+ }
102
+ return [];
103
+ }
104
+ ;
105
+ }
106
+ exports.Imap = Imap;
107
+ //# sourceMappingURL=Imap.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Imap.node.js","sourceRoot":"","sources":["../../../nodes/Imap/Imap.node.ts"],"names":[],"mappings":";;;AACA,8DAAoE;AACpE,iEAAyE;AACzE,+FAA2G;AAC3G,iDAAqD;AACrD,+CAA4C;AAC5C,yEAAgE;AAGhE,MAAa,IAAI;IAAjB;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,MAAM;YACnB,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,yBAAyB;YAC/B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,gEAAgE;YAC1E,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE;gBACR,IAAI,EAAE,MAAM;aACb;YACD,MAAM,EAAE,CAAC,M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IAAI,eAAe;iBAChE,CAAC,CAAC;aACJ;SACF;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,SAAS,mBAAmB,QAAQ,GAAG,CAAC,CAAC;YACjF,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE;gBACzC,OAAO,EAAE,sBAAsB,SAAS,mBAAmB,QAAQ,GAAG;aACvE,CAAC,CAAC;SACJ;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAAA,CAAC;CA8BH;AA1GD,oBA0GC"}
@@ -0,0 +1,79 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ width="587.6"
4
+ height="637.36"
5
+ version="1.1"
6
+ id="svg68"
7
+ sodipodi:docname="node-imap-icon.svg"
8
+ inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
9
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ xmlns:svg="http://www.w3.org/2000/svg">
13
+ <desc property="dc:creator">Vasily Maslyukov</desc>
14
+ <defs
15
+ id="defs72" />
16
+ <sodipodi:namedview
17
+ id="namedview70"
18
+ pagecolor="#ffffff"
19
+ bordercolor="#666666"
20
+ borderopacity="1.0"
21
+ inkscape:pageshadow="2"
22
+ inkscape:pageopacity="0.0"
23
+ inkscape:pagecheckerboard="0"
24
+ showgrid="false"
25
+ inkscape:zoom="0.45042889"
26
+ inkscape:cx="53.28255"
27
+ inkscape:cy="145.41696"
28
+ inkscape:window-width="1800"
29
+ inkscape:window-height="3121"
30
+ inkscape:window-x="1911"
31
+ inkscape:window-y="-9"
32
+ inkscape:window-maximized="1"
33
+ inkscape:current-layer="svg68" />
34
+ <path
35
+ fill="#001539"
36
+ d="M102.1 174c.55-.52 1.13-1 1.72-1.44 7.27-5.41 15.74-8.36 25.43-8.84 46.44-1.3 98.1-.75 146.92-.75a2.7 2.7 0 0 0 2.7-2.72l-.5-49.75a2.45 2.45 0 0 0-2.23-2.42 10.4 10.4 0 0 1-3.55-1c-17.08-8-27.3-21-30.69-39-1.5-8.06-1.15-14.81 1.37-25.16 4.34-17.84 29.13-39.73 52.9-37.8 7.24.66 12.72 1.65 16.45 2.97 21.8 9.55 36.96 30.86 34.12 54.66-.15 3.5-.67 6.9-1.54 10.2-5.3 15.64-13.34 27.35-28.37 33.18-1.95.75-3.9 1.53-5.82 2.36a2.14 2.14 0 0 0-1.28 1.96c-.14 33.28-1.28 52.05 3 52.5 46.52.05 93.85.04 141.98-.02 5.5 0 10.02.44 13.55 1.33a48.7 48.7 0 0 1 15.83 7.33 51.8 51.8 0 0 1 10.8 9.79 32.37 32.37 0 0 1 4.03 6.4c1.02 2.16 2.02 4.3 3 6.43 3.1 7.6 6.7 14.5 6.67 22.23-.23 69.48.03 201.2-.03 203.72-1.36 16.34-4.17 30.08-12.7 41.94a33.22 33.22 0 0 1-6.24 6.46 58.71 58.71 0 0 1-22.59 11.17c-3.7.9-8.4 1.36-14.16 1.35-47.87-.07-94.78-.02-140.73.15a2.5 2.5 0 0 0-2.49 2.49l.11 42.42c0 1.65 1.42 2.98 2.9 3.27.7.14 1.4.36 2.1.66 19.9 10.94 30.44 32.1 29.54 49.86-1.6 31.65-22.5 53.82-54.54 52.36-31.87 1-53.33-35.85-47.63-62.94 2.5-14.15 9.42-25.26 20.8-33.33a40.96 40.96 0 0 1 7.05-4 51.89 51.89 0 0 1 7.6-2.71 2.01 2.01 0 0 0 1.5-1.94l.01-43.57c0-1.8-.9-2.7-2.69-2.7l-146.35-.03c-5.79 0-11.19-1.73-16.76-3.32a28.39 28.39 0 0 1-7.17-3.05c-12.83-7.87-20.93-19.38-24.3-34.55a62.22 62.22 0 0 1-1-5.78c-.25-2-.37-3.94-.37-5.83V214.3c0-2.96 1.15-5.31 1.02-8.2-.02-.4.07-.75.27-1.08a5.6 5.6 0 0 0 .8-2.94c0-.16.03-.33.1-.48 1.01-2.27 2-4.53 2.96-6.78a51.69 51.69 0 0 1 15.44-20.27c.14-.12.3-.2.5-.24a.85.85 0 0 0 .23-.08 2 2 0 0 0 .33-.24zM316.8 57.96c-.26-12.24-10.59-21.96-23.07-21.7-12.49.27-22.4 10.4-22.14 22.64.25 12.24 10.58 21.96 23.06 21.7 12.5-.27 22.4-10.4 22.15-22.64zm-21.9 268.2c4.22-2.66 8.27-5.4 12.15-8.23 51.93-37.3 106.78-77.54 154.57-112.01 2-1.43 4.08-2.57 6.1-3.94.82-.57.94-1.75.24-2.48a7.82 7.82 0 0 0-3.69-2.18 40.37 40.37 0 0 0-9.94-1.11c-53.3-.1-106.58-.13-159.87-.08a1.33 1.33 0 0 0-.76-.23c-56.57-.07-111.65-.18-165.25-.31a11.44 11.44 0 0 0-8.64 3.6c-.89.93-.74 2.43.32 3.15 54.8 38.38 115.24 82.89 166.61 120.33 3.17 2.3 5.9 3.47 8.16 3.5zm-68.7-5.9a.4.4 0 0 0-.02-.63c-37.42-27.68-71.44-53-107.6-78.97a200.5 200.5 0 0 0-5.86-4.01c-.2-.14-.5 0-.5.27l-.26 168.34c0 .47.53.74.91.46 37.72-29.41 76.42-57.14 113.32-85.45zm249.16 84.95c.21.16.51 0 .51-.26l-.28-168.12c0-.26-.3-.42-.5-.26l-113.16 83.15a.32.32 0 0 0 0 .52zm-97.1 43.2c27.97-.04 55.95-.14 83.94-.31 2.26-.01 4-.7 5.24-2.07 2.75-3.06.57-5.44-1.95-7.37-44.63-33.46-89.67-66.15-132.75-98.73a.78.78 0 0 0-.95 0 393.6 393.6 0 0 1-18.78 13.87c-8.35 5.77-17.75 7.29-28.22 4.55a45.83 45.83 0 0 1-10.54-5.48 276.42 276.42 0 0 1-17.56-13.03.9.9 0 0 0-1.09-.03c-3.32 2.36-6.6 4.87-9.86 7.53-5.55 4.54-11.3 8.45-16.85 12.76-35.69 26.98-73.76 55.89-107.48 80.4-1.65 1.2-2.14 2.7-1.46 4.47 1.26 3.3 6.4 3.5 9.5 3.49 61.4-.35 144.33-.36 248.8-.04zm-61.57 130.8a22.45 22.45 0 1 0-44.9 0 22.45 22.45 0 0 0 44.9 0z"
37
+ id="path34" />
38
+ <ellipse
39
+ cx="292.9"
40
+ cy="64.58"
41
+ fill="#1fc5c1"
42
+ rx="22.61"
43
+ ry="22.17"
44
+ transform="rotate(-1.2)"
45
+ id="ellipse36"
46
+ style="fill:#83fdab;fill-opacity:1" />
47
+ <path
48
+ fill="#fff"
49
+ d="M294.46 196.13c.76 49.45.4 79.86.44 130.04-2.27-.03-5-1.2-8.16-3.5a63836.33 63836.33 0 0 0-124.6-90.58 1967.03 1967.03 0 0 0-42-29.75 2.06 2.06 0 0 1-.33-3.14 11.44 11.44 0 0 1 8.64-3.61c53.6.13 108.68.24 165.25.3.28 0 .53.09.76.24z"
50
+ id="path44" />
51
+ <path
52
+ fill="#05b8fa"
53
+ d="M294.46 196.13c53.3-.05 106.58-.03 159.87.08 3.78 0 7.1.38 9.94 1.1a7.82 7.82 0 0 1 3.7 2.19c.7.73.57 1.9-.26 2.48-2 1.37-4.1 2.5-6.09 3.94-51.45 37.37-107.5 77.76-154.57 112a222.28 222.28 0 0 1-12.15 8.25c-.36-45.4-.49-88.43-.44-130.04z"
54
+ id="path46"
55
+ style="fill:#83dcfd;fill-opacity:1" />
56
+ <path
57
+ fill="#ffa522"
58
+ d="M206.1 335.37c-7.76 5.72-15.6 11.9-23.37 17.6q-18.47 13.54-36.19 27.1-5.3 4.06-10.12 7.54c-8.02 5.8-15.49 12.16-23.55 18.1a.57.57 0 0 1-.9-.45l.25-168.34a.32.33 17.2 0 1 .5-.27q3.32 2.2 5.85 4 18.4 13.2 36.96 26.75 8.57 6.25 16.12 11.88 27.48 20.53 54.53 40.35a.4.4 0 0 1 .01.64q-10.03 7.7-20.09 15.1z"
59
+ id="path48" />
60
+ <path
61
+ fill="#ff4f4e"
62
+ d="m475.36 405.2-113.43-84.96a.32.32 0 0 1 0-.52l113.15-83.15a.32.32 0 0 1 .51.26l.28 168.12a.32.32 0 0 1-.5.26z"
63
+ id="path50" />
64
+ <path
65
+ fill="#ff8c19"
66
+ d="M284.8 358.35a43.05 43.05 0 0 0 5.34 3.74 30.08 30.08 0 0 1 5.3 3.85c28.22 26.42 52.4 54.7 81.5 79.54 1.1.93 1.52 1.9 1.31 2.94-104.47-.32-187.4-.3-248.8.04-3.1.02-8.24-.18-9.5-3.5-.68-1.76-.2-3.25 1.46-4.46 44.06-34.45 85.86-61.9 124.33-93.16 3.25-2.66 6.54-5.17 9.86-7.53a.9.9 0 0 1 1.1.03c5.52 4.46 11.37 8.8 17.55 13.03 3.5 2.4 7.01 4.23 10.54 5.48z"
67
+ id="path54" />
68
+ <path
69
+ fill="#ff4f4e"
70
+ d="M378.25 448.42c.21-1.03-.23-2-1.32-2.94-28.75-25.08-54.36-53.73-81.49-79.54a30.08 30.08 0 0 0-5.3-3.85 43.05 43.05 0 0 1-5.35-3.74c10.47 2.74 19.87 1.22 28.22-4.55a389.65 389.65 0 0 0 18.78-13.86.78.78 0 0 1 .95-.01c44.92 34.27 89.55 65.84 132.75 98.73 2.52 1.93 4.7 4.3 1.95 7.37-1.23 1.37-2.98 2.06-5.24 2.07-27.99.17-55.97.27-83.95.32z"
71
+ id="path56" />
72
+ <circle
73
+ cx="294.24"
74
+ cy="579.21"
75
+ r="22.45"
76
+ fill="#1fc5c1"
77
+ id="circle64"
78
+ style="fill:#83ecfd;fill-opacity:1" />
79
+ </svg>
@@ -0,0 +1,2 @@
1
+ import { IResourceDef } from "../utils/CommonDefinitions";
2
+ export declare const allResourceDefinitions: IResourceDef[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allResourceDefinitions = void 0;
4
+ const OperationsList_1 = require("./email/OperationsList");
5
+ const OperationsList_2 = require("./mailbox/OperationsList");
6
+ exports.allResourceDefinitions = [
7
+ OperationsList_2.mailboxResourceDefinitions,
8
+ OperationsList_1.emailResourceDefinitions,
9
+ ];
10
+ //# sourceMappingURL=ResourcesList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourcesList.js","sourceRoot":"","sources":["../../../../nodes/Imap/operations/ResourcesList.ts"],"names":[],"mappings":";;;AAMA,2DAAkE;AAClE,6DAAsE;AAEzD,QAAA,sBAAsB,GAAmB;IACpD,2CAA0B;IAC1B,yCAAwB;CACzB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { IResourceDef } from "../../utils/CommonDefinitions";
2
+ export declare const emailResourceDefinitions: IResourceDef;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emailResourceDefinitions = void 0;
4
+ const ResourceName_1 = require("./ResourceName");
5
+ const EmailDownloadAttachment_1 = require("./functions/EmailDownloadAttachment");
6
+ const EmailGetList_1 = require("./functions/EmailGetList");
7
+ const EmailMove_1 = require("./functions/EmailMove");
8
+ exports.emailResourceDefinitions = {
9
+ resource: ResourceName_1.resourceEmail,
10
+ operationDefs: [
11
+ EmailGetList_1.getEmailsListOperation,
12
+ EmailDownloadAttachment_1.downloadAttachmentOperation,
13
+ EmailMove_1.moveEmailOperation,
14
+ ],
15
+ };
16
+ //# sourceMappingURL=OperationsList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationsList.js","sourceRoot":"","sources":["../../../../../nodes/Imap/operations/email/OperationsList.ts"],"names":[],"mappings":";;;AACA,iDAA+C;AAC/C,iFAAkF;AAClF,2DAAkE;AAClE,qDAA2D;AAE9C,QAAA,wBAAwB,GAAiB;IACpD,QAAQ,EAAE,4BAAa;IACvB,aAAa,EAAE;QACb,qCAAsB;QACtB,qDAA2B;QAC3B,8BAAkB;KACnB;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { INodePropertyOptions } from "n8n-workflow";
2
+ export declare const resourceEmail: INodePropertyOptions;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resourceEmail = void 0;
4
+ exports.resourceEmail = {
5
+ name: 'Email',
6
+ value: 'email',
7
+ };
8
+ //# sourceMappingURL=ResourceName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceName.js","sourceRoot":"","sources":["../../../../../nodes/Imap/operations/email/ResourceName.ts"],"names":[],"mappings":";;;AAEa,QAAA,aAAa,GAAyB;IACjD,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;CACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { IResourceOperationDef } from "../../../utils/CommonDefinitions";
2
+ export declare const downloadAttachmentOperation: IResourceOperationDef;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.downloadAttachmentOperation = void 0;
4
+ const SearchFieldParameters_1 = require("../../../utils/SearchFieldParameters");
5
+ exports.downloadAttachmentOperation = {
6
+ operation: {
7
+ name: 'Download Attachment',
8
+ value: 'downloadAttachment',
9
+ },
10
+ parameters: [
11
+ {
12
+ ...SearchFieldParameters_1.parameterSelectMailbox,
13
+ description: 'Select the mailbox',
14
+ },
15
+ {
16
+ displayName: 'Email UID',
17
+ name: 'emailUid',
18
+ type: 'string',
19
+ default: '',
20
+ description: 'UID of the email to download',
21
+ },
22
+ {
23
+ displayName: 'Attachment Part ID',
24
+ name: 'partId',
25
+ type: 'string',
26
+ default: '',
27
+ required: true,
28
+ description: 'ID of the part to download',
29
+ hint: 'Part ID can be found in the email "attachmentsInfo" property',
30
+ },
31
+ ],
32
+ async executeImapAction(context, client) {
33
+ var _a, _b;
34
+ var returnData = [];
35
+ const mailboxPath = (0, SearchFieldParameters_1.getMailboxPathFromNodeParameter)(context);
36
+ await client.mailboxOpen(mailboxPath, { readOnly: true });
37
+ const emailUid = context.getNodeParameter('emailUid', 0);
38
+ const partId = context.getNodeParameter('partId', 0);
39
+ (_a = context.logger) === null || _a === void 0 ? void 0 : _a.info(`Downloading attachment "${partId}" from email "${emailUid}"`);
40
+ const resp = await client.download(emailUid, partId, {
41
+ uid: true,
42
+ });
43
+ const binaryData = await context.helpers.prepareBinaryData(resp.content, resp.meta.filename, resp.meta.contentType);
44
+ (_b = context.logger) === null || _b === void 0 ? void 0 : _b.info(`Attachment downloaded: ${binaryData.data.length} bytes`);
45
+ returnData.push({
46
+ json: resp.meta,
47
+ binary: {
48
+ attachment: binaryData,
49
+ },
50
+ });
51
+ client.close();
52
+ return [returnData];
53
+ },
54
+ };
55
+ //# sourceMappingURL=EmailDownloadAttachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailDownloadAttachment.js","sourceRoot":"","sources":["../../../../../../nodes/Imap/operations/email/functions/EmailDownloadAttachment.ts"],"names":[],"mappings":";;;AAGA,gFAA+G;AAElG,QAAA,2BAA2B,GAA0B;IAChE,SAAS,EAAE;QACT,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,oBAAoB;KAC5B;IACD,UAAU,EAAE;QACV;YACE,GAAG,8CAAsB;YACzB,WAAW,EAAE,oBAAoB;SAClC;QACD;YACE,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,8BAA8B;SAC5C;QACD;YACE,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,4BAA4B;YACzC,IAAI,EAAE,8DAA8D;SACrE;KACF;IACD,KAAK,CAAC,iBAAiB,CAAC,OAA0B,EAAE,MAAgB;;QAClE,IAAI,UAAU,GAAyB,EAAE,CAAC;QAE1C,MAAM,WAAW,GAAG,IAAA,uDAA+B,EAAC,OAAO,CAAC,CAAC;QAE7D,MAAM,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE,E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