@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.
@@ -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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), 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 (g && (g = 0, op[0] && (_ = 0)), _) try {
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
- var _a, _b;
98
- return __generator(this, function (_c) {
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
- _c.label = 1;
112
+ _d.label = 1;
113
113
  case 1:
114
- _c.trys.push([1, 3, , 4]);
115
- return [4 /*yield*/, axios_1.default.post("https://api.flowmailer.net/".concat(this.account_id, "/messages/submit"), data, {
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 ".concat(this.accessToken),
119
+ Authorization: "Bearer " + this.accessToken,
120
120
  },
121
121
  })];
122
122
  case 2:
123
- resp = _c.sent();
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 = _c.sent();
129
- if (((_b = (_a = ex_2 === null || ex_2 === void 0 ? void 0 : ex_2.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) != "invalid_token") {
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, _c, _i, i, success;
140
- return __generator(this, function (_d) {
141
- switch (_d.label) {
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 = email.to;
145
- _b = [];
146
- for (_c in _a)
147
- _b.push(_c);
144
+ _a = [];
145
+ for (_b in email.to)
146
+ _a.push(_b);
148
147
  _i = 0;
149
- _d.label = 1;
148
+ _c.label = 1;
150
149
  case 1:
151
- if (!(_i < _b.length)) return [3 /*break*/, 8];
152
- _c = _b[_i];
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 = _d.sent();
157
+ success = _c.sent();
161
158
  if (!!success) return [3 /*break*/, 4];
162
159
  return [4 /*yield*/, this.getToken()];
163
160
  case 3:
164
- _d.sent();
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 = _d.sent();
166
+ success = _c.sent();
170
167
  if (!success)
171
168
  failure = true;
172
- _d.label = 7;
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
  */
@@ -1,6 +1,7 @@
1
+ /// <reference types="node" />
1
2
  import { Readable } from "stream";
2
3
  import { Url } from "url";
3
- export type email = {
4
+ export declare type email = {
4
5
  /**
5
6
  * From address used to send the email
6
7
  */
@@ -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;
@@ -1,4 +1,4 @@
1
- export type emailSendgrid = {
1
+ export declare type emailSendgrid = {
2
2
  /**
3
3
  * From address used to send the email
4
4
  */
@@ -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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), 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 (g && (g = 0, op[0] && (_ = 0)), _) try {
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]) {
@@ -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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), 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 (g && (g = 0, op[0] && (_ = 0)), _) try {
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
- "name": "@flink-app/email-plugin",
3
- "version": "0.11.4-next.0",
4
- "description": "Flink plugin that makes it possible to send email",
5
- "author": "johan@frost.se",
6
- "publishConfig": {
7
- "access": "public"
8
- },
9
- "license": "MIT",
10
- "types": "dist/index.d.ts",
11
- "main": "dist/index.js",
12
- "dependencies": {
13
- "@sendgrid/mail": "^7.4.5",
14
- "@types/nodemailer": "^6.4.4",
15
- "axios": "^0.27.2",
16
- "nodemailer": "^6.6.2",
17
- "querystring": "^0.2.1"
18
- },
19
- "devDependencies": {
20
- "@types/node": "^22.10.1",
21
- "ts-node": "^10.9.2",
22
- "typescript": "5.6.2"
23
- },
24
- "gitHead": "6a44df1b6601c86ea3402750b939784d003202c3"
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
  }