@flink-app/email-plugin 0.11.4-next.0 → 0.11.4
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/dist/flowmailerClient.js +26 -29
- package/dist/index.d.ts +1 -1
- package/dist/schemas/email.d.ts +2 -1
- package/dist/schemas/emailFlowmailer.d.ts +2 -2
- package/dist/schemas/emailSendgrid.d.ts +1 -1
- package/dist/sendgridClient.js +3 -3
- package/dist/smtpClient.js +3 -3
- package/package.json +28 -23
package/dist/flowmailerClient.js
CHANGED
|
@@ -20,12 +20,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g
|
|
24
|
-
return g
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (
|
|
28
|
+
while (_) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -92,11 +92,11 @@ var flowMailerClient = /** @class */ (function () {
|
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
94
|
flowMailerClient.prototype.sendEmail = function (email, to) {
|
|
95
|
+
var _a, _b, _c;
|
|
95
96
|
return __awaiter(this, void 0, void 0, function () {
|
|
96
97
|
var data, resp, ex_2;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
switch (_c.label) {
|
|
98
|
+
return __generator(this, function (_d) {
|
|
99
|
+
switch (_d.label) {
|
|
100
100
|
case 0:
|
|
101
101
|
data = {
|
|
102
102
|
messageType: "EMAIL",
|
|
@@ -109,24 +109,24 @@ var flowMailerClient = /** @class */ (function () {
|
|
|
109
109
|
if (email.attachments) {
|
|
110
110
|
data = __assign(__assign({}, data), { attachments: email.attachments.map(function (a) { return (__assign(__assign({}, a), { disposition: "attachment" })); }) });
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
_d.label = 1;
|
|
113
113
|
case 1:
|
|
114
|
-
|
|
115
|
-
return [4 /*yield*/, axios_1.default.post("https://api.flowmailer.net/"
|
|
114
|
+
_d.trys.push([1, 3, , 4]);
|
|
115
|
+
return [4 /*yield*/, axios_1.default.post("https://api.flowmailer.net/" + this.account_id + "/messages/submit", data, {
|
|
116
116
|
headers: {
|
|
117
117
|
Accept: "application/vnd.flowmailer.v1.12+json",
|
|
118
118
|
"Content-Type": "application/vnd.flowmailer.v1.12+json;charset=UTF-8",
|
|
119
|
-
Authorization: "Bearer "
|
|
119
|
+
Authorization: "Bearer " + this.accessToken,
|
|
120
120
|
},
|
|
121
121
|
})];
|
|
122
122
|
case 2:
|
|
123
|
-
resp =
|
|
123
|
+
resp = _d.sent();
|
|
124
124
|
if (resp.status == 201)
|
|
125
125
|
return [2 /*return*/, true];
|
|
126
126
|
return [3 /*break*/, 4];
|
|
127
127
|
case 3:
|
|
128
|
-
ex_2 =
|
|
129
|
-
if (((_b = (_a = ex_2 === null ||
|
|
128
|
+
ex_2 = _d.sent();
|
|
129
|
+
if (((_c = (_b = (_a = ex_2) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) != "invalid_token") {
|
|
130
130
|
}
|
|
131
131
|
return [3 /*break*/, 4];
|
|
132
132
|
case 4: return [2 /*return*/, false];
|
|
@@ -136,40 +136,37 @@ var flowMailerClient = /** @class */ (function () {
|
|
|
136
136
|
};
|
|
137
137
|
flowMailerClient.prototype.send = function (email) {
|
|
138
138
|
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
-
var failure, _a, _b,
|
|
140
|
-
return __generator(this, function (
|
|
141
|
-
switch (
|
|
139
|
+
var failure, _a, _b, _i, i, success;
|
|
140
|
+
return __generator(this, function (_c) {
|
|
141
|
+
switch (_c.label) {
|
|
142
142
|
case 0:
|
|
143
143
|
failure = false;
|
|
144
|
-
_a =
|
|
145
|
-
_b
|
|
146
|
-
|
|
147
|
-
_b.push(_c);
|
|
144
|
+
_a = [];
|
|
145
|
+
for (_b in email.to)
|
|
146
|
+
_a.push(_b);
|
|
148
147
|
_i = 0;
|
|
149
|
-
|
|
148
|
+
_c.label = 1;
|
|
150
149
|
case 1:
|
|
151
|
-
if (!(_i <
|
|
152
|
-
|
|
153
|
-
if (!(_c in _a)) return [3 /*break*/, 7];
|
|
154
|
-
i = _c;
|
|
150
|
+
if (!(_i < _a.length)) return [3 /*break*/, 8];
|
|
151
|
+
i = _a[_i];
|
|
155
152
|
if (!this.client_secrect) {
|
|
156
153
|
this.getToken();
|
|
157
154
|
}
|
|
158
155
|
return [4 /*yield*/, this.sendEmail(email, email.to[i])];
|
|
159
156
|
case 2:
|
|
160
|
-
success =
|
|
157
|
+
success = _c.sent();
|
|
161
158
|
if (!!success) return [3 /*break*/, 4];
|
|
162
159
|
return [4 /*yield*/, this.getToken()];
|
|
163
160
|
case 3:
|
|
164
|
-
|
|
161
|
+
_c.sent();
|
|
165
162
|
return [3 /*break*/, 5];
|
|
166
163
|
case 4: return [3 /*break*/, 7];
|
|
167
164
|
case 5: return [4 /*yield*/, this.sendEmail(email, email.to[i])];
|
|
168
165
|
case 6:
|
|
169
|
-
success =
|
|
166
|
+
success = _c.sent();
|
|
170
167
|
if (!success)
|
|
171
168
|
failure = true;
|
|
172
|
-
|
|
169
|
+
_c.label = 7;
|
|
173
170
|
case 7:
|
|
174
171
|
_i++;
|
|
175
172
|
return [3 /*break*/, 1];
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { sendgridClient } from "./sendgridClient";
|
|
|
4
4
|
export { smtpClient } from "./smtpClient";
|
|
5
5
|
export { flowMailerClient } from "./flowmailerClient";
|
|
6
6
|
export type { email } from "./schemas/email";
|
|
7
|
-
export type emailPluginOptions = {
|
|
7
|
+
export declare type emailPluginOptions = {
|
|
8
8
|
/**
|
|
9
9
|
* Path for request
|
|
10
10
|
*/
|
package/dist/schemas/email.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type emailFlowmailer = {
|
|
1
|
+
export declare type emailFlowmailer = {
|
|
2
2
|
/**
|
|
3
3
|
* From address used to send the email
|
|
4
4
|
*/
|
|
@@ -23,7 +23,7 @@ export type emailFlowmailer = {
|
|
|
23
23
|
html?: string;
|
|
24
24
|
attachments?: fowmailerAttachment[];
|
|
25
25
|
};
|
|
26
|
-
export type fowmailerAttachment = {
|
|
26
|
+
export declare type fowmailerAttachment = {
|
|
27
27
|
content: string;
|
|
28
28
|
contentType: string;
|
|
29
29
|
filename: string;
|
package/dist/sendgridClient.js
CHANGED
|
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g
|
|
13
|
-
return g
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (
|
|
17
|
+
while (_) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
package/dist/smtpClient.js
CHANGED
|
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g
|
|
13
|
-
return g
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (
|
|
17
|
+
while (_) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
package/package.json
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
2
|
+
"name": "@flink-app/email-plugin",
|
|
3
|
+
"version": "0.11.4",
|
|
4
|
+
"description": "Flink plugin that makes it possible to send email",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\"",
|
|
7
|
+
"prepublish": "tsc"
|
|
8
|
+
},
|
|
9
|
+
"author": "johan@frost.se",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"types": "dist/index.d.ts",
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@sendgrid/mail": "^7.4.5",
|
|
18
|
+
"@types/nodemailer": "^6.4.4",
|
|
19
|
+
"axios": "^0.27.2",
|
|
20
|
+
"nodemailer": "^6.6.2",
|
|
21
|
+
"querystring": "^0.2.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@flink-app/flink": "^0.11.4",
|
|
25
|
+
"@types/node": "^15.6.2",
|
|
26
|
+
"ts-node": "^9.1.1",
|
|
27
|
+
"typescript": "^4.2.4"
|
|
28
|
+
},
|
|
29
|
+
"gitHead": "5f36b236f3059fbd77cb01b363d60e3061bdf714"
|
|
25
30
|
}
|