@flink-app/email-plugin 0.5.0 → 0.6.5

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.
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -95,6 +106,9 @@ var flowMailerClient = /** @class */ (function () {
95
106
  text: email.text,
96
107
  html: email.html,
97
108
  };
109
+ if (email.attachments) {
110
+ data = __assign(__assign({}, data), { attachments: email.attachments.map(function (a) { return (__assign(__assign({}, a), { disposition: "attachment" })); }) });
111
+ }
98
112
  _d.label = 1;
99
113
  case 1:
100
114
  _d.trys.push([1, 3, , 4]);
@@ -21,4 +21,10 @@ export declare type emailFlowmailer = {
21
21
  subject: string;
22
22
  text?: string;
23
23
  html?: string;
24
+ attachments?: fowmailerAttachment[];
25
+ };
26
+ export declare type fowmailerAttachment = {
27
+ content: string;
28
+ contentType: string;
29
+ filename: string;
24
30
  };
@@ -0,0 +1,6 @@
1
+ export interface sendgridClientOptions {
2
+ /**
3
+ * API-key to use when sending email
4
+ */
5
+ apiKey: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface smtpClientOptions {
2
+ host: string;
3
+ port: number;
4
+ secure: boolean;
5
+ auth?: {
6
+ user: string;
7
+ pass: string;
8
+ };
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/email-plugin",
3
- "version": "0.5.0",
3
+ "version": "0.6.5",
4
4
  "description": "Flink plugin that makes it possible to send email",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\"",
@@ -21,10 +21,10 @@
21
21
  "querystring": "^0.2.1"
22
22
  },
23
23
  "devDependencies": {
24
- "@flink-app/flink": "^0.5.0",
24
+ "@flink-app/flink": "^0.6.0",
25
25
  "@types/node": "^15.6.2",
26
26
  "ts-node": "^9.1.1",
27
27
  "typescript": "^4.2.4"
28
28
  },
29
- "gitHead": "3c877c210da19119c074c7482e97a485d2334e80"
29
+ "gitHead": "677244548e84f65f0709312010345e9e309d2e28"
30
30
  }
@@ -16,6 +16,12 @@ type SubmitMessage = {
16
16
  subject: string;
17
17
  text?: string;
18
18
  html?: string;
19
+ attachments? : {
20
+ content : string;
21
+ contentType : string;
22
+ disposition : "attachment",
23
+ filename : string;
24
+ }[]
19
25
  };
20
26
 
21
27
  export class flowMailerClient implements client {
@@ -53,7 +59,7 @@ export class flowMailerClient implements client {
53
59
  } catch (ex) {}
54
60
  }
55
61
  async sendEmail(email: email, to: string): Promise<boolean> {
56
- const data = {
62
+ let data : SubmitMessage = {
57
63
  messageType: "EMAIL",
58
64
  senderAddress: email.from,
59
65
  recipientAddress: to,
@@ -61,6 +67,9 @@ export class flowMailerClient implements client {
61
67
  text: email.text,
62
68
  html: email.html,
63
69
  };
70
+ if(email.attachments) {
71
+ data = { ...data, attachments : email.attachments.map(a=>( {...a, disposition : "attachment"}) )}
72
+ }
64
73
  try {
65
74
  const resp = await axios.post(`https://api.flowmailer.net/${this.account_id}/messages/submit`, data, {
66
75
  headers: {
@@ -95,3 +104,4 @@ export class flowMailerClient implements client {
95
104
  return !failure;
96
105
  }
97
106
  }
107
+
@@ -29,6 +29,14 @@ export type emailFlowmailer = {
29
29
 
30
30
  text? : string
31
31
 
32
- html? : string
32
+ html? : string;
33
+
34
+ attachments? : fowmailerAttachment[]
33
35
 
34
36
  };
37
+
38
+ export type fowmailerAttachment = {
39
+ content : string;
40
+ contentType : string;
41
+ filename : string;
42
+ }