@flink-app/email-plugin 0.14.1 → 2.0.0-alpha.100
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/CHANGELOG.md +376 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +20 -1
- package/dist/postmarkClient.d.ts +19 -0
- package/dist/postmarkClient.js +91 -0
- package/dist/schemas/client.d.ts +3 -1
- package/dist/schemas/emailPostmark.d.ts +67 -0
- package/dist/schemas/emailPostmark.js +2 -0
- package/dist/schemas/emailSes.d.ts +60 -0
- package/dist/schemas/emailSes.js +2 -0
- package/dist/ses-types.d.ts +94 -0
- package/dist/ses-types.js +2 -0
- package/dist/sesClient.d.ts +48 -0
- package/dist/sesClient.js +388 -0
- package/package.json +10 -4
- package/readme.md +258 -7
- package/spec/sesClient.spec.ts +464 -0
- package/spec/support/jasmine.json +7 -0
- package/src/index.ts +7 -2
- package/src/postmarkClient.ts +53 -0
- package/src/schemas/client.ts +3 -1
- package/src/schemas/emailPostmark.ts +73 -0
- package/src/schemas/emailSes.ts +73 -0
- package/src/ses-types.ts +93 -0
- package/src/sesClient.ts +352 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,386 @@
|
|
|
1
1
|
# @flink-app/email-plugin
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.100
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [6e8166a]
|
|
8
|
+
- @flink-app/flink@2.0.0-alpha.100
|
|
9
|
+
|
|
10
|
+
## 2.0.0-alpha.99
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [ed9cd2c]
|
|
15
|
+
- @flink-app/flink@2.0.0-alpha.99
|
|
16
|
+
|
|
17
|
+
## 2.0.0-alpha.98
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [2f4a132]
|
|
22
|
+
- @flink-app/flink@2.0.0-alpha.98
|
|
23
|
+
|
|
24
|
+
## 2.0.0-alpha.97
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [eed6bc1]
|
|
29
|
+
- @flink-app/flink@2.0.0-alpha.97
|
|
30
|
+
|
|
31
|
+
## 2.0.0-alpha.96
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
- @flink-app/flink@2.0.0-alpha.96
|
|
37
|
+
|
|
38
|
+
## 2.0.0-alpha.95
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- @flink-app/flink@2.0.0-alpha.95
|
|
43
|
+
|
|
44
|
+
## 2.0.0-alpha.94
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- @flink-app/flink@2.0.0-alpha.94
|
|
49
|
+
|
|
50
|
+
## 2.0.0-alpha.93
|
|
51
|
+
|
|
52
|
+
### Minor Changes
|
|
53
|
+
|
|
54
|
+
- 64ae56f: feat(email-plugin): add Postmark provider
|
|
55
|
+
|
|
56
|
+
Add `postmarkClient` alongside the existing SMTP, SendGrid, AWS SES, and Flowmailer clients. Construct it with `{ serverToken, defaultMessageStream? }` and pass it as the `client` option to `emailPlugin`. Supports html/text bodies, cc/bcc, reply-to, attachments, message streams, tags, and metadata.
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- @flink-app/flink@2.0.0-alpha.93
|
|
61
|
+
|
|
62
|
+
## 2.0.0-alpha.92
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [8d23d56]
|
|
67
|
+
- @flink-app/flink@2.0.0-alpha.92
|
|
68
|
+
|
|
69
|
+
## 2.0.0-alpha.91
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- @flink-app/flink@2.0.0-alpha.91
|
|
74
|
+
|
|
75
|
+
## 2.0.0-alpha.90
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [0d84b5f]
|
|
80
|
+
- @flink-app/flink@2.0.0-alpha.90
|
|
81
|
+
|
|
82
|
+
## 2.0.0-alpha.89
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- @flink-app/flink@2.0.0-alpha.89
|
|
87
|
+
|
|
88
|
+
## 2.0.0-alpha.88
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- @flink-app/flink@2.0.0-alpha.88
|
|
93
|
+
|
|
94
|
+
## 2.0.0-alpha.87
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies
|
|
99
|
+
- @flink-app/flink@2.0.0-alpha.87
|
|
100
|
+
|
|
101
|
+
## 2.0.0-alpha.86
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- @flink-app/flink@2.0.0-alpha.86
|
|
106
|
+
|
|
107
|
+
## 2.0.0-alpha.85
|
|
108
|
+
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- @flink-app/flink@2.0.0-alpha.85
|
|
112
|
+
|
|
113
|
+
## 2.0.0-alpha.84
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- @flink-app/flink@2.0.0-alpha.84
|
|
118
|
+
|
|
119
|
+
## 2.0.0-alpha.83
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- Updated dependencies
|
|
124
|
+
- @flink-app/flink@2.0.0-alpha.83
|
|
125
|
+
|
|
126
|
+
## 2.0.0-alpha.82
|
|
127
|
+
|
|
128
|
+
### Patch Changes
|
|
129
|
+
|
|
130
|
+
- @flink-app/flink@2.0.0-alpha.82
|
|
131
|
+
|
|
132
|
+
## 2.0.0-alpha.81
|
|
133
|
+
|
|
134
|
+
### Patch Changes
|
|
135
|
+
|
|
136
|
+
- @flink-app/flink@2.0.0-alpha.81
|
|
137
|
+
|
|
138
|
+
## 2.0.0-alpha.80
|
|
139
|
+
|
|
140
|
+
### Patch Changes
|
|
141
|
+
|
|
142
|
+
- @flink-app/flink@2.0.0-alpha.80
|
|
143
|
+
|
|
144
|
+
## 2.0.0-alpha.79
|
|
145
|
+
|
|
146
|
+
### Patch Changes
|
|
147
|
+
|
|
148
|
+
- @flink-app/flink@2.0.0-alpha.79
|
|
149
|
+
|
|
150
|
+
## 2.0.0-alpha.78
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- @flink-app/flink@2.0.0-alpha.78
|
|
155
|
+
|
|
156
|
+
## 2.0.0-alpha.77
|
|
157
|
+
|
|
158
|
+
### Patch Changes
|
|
159
|
+
|
|
160
|
+
- @flink-app/flink@2.0.0-alpha.77
|
|
161
|
+
|
|
162
|
+
## 2.0.0-alpha.76
|
|
163
|
+
|
|
164
|
+
### Patch Changes
|
|
165
|
+
|
|
166
|
+
- Add resolveTokenTTL callback to jwt-auth-plugin for dynamic token TTL based on role. Fix renames in email-plugin and inbound-email-plugin. Fix tsconfig in generic-auth-plugin.
|
|
167
|
+
- @flink-app/flink@2.0.0-alpha.76
|
|
168
|
+
|
|
169
|
+
## 2.0.0-alpha.75
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- @flink-app/flink@2.0.0-alpha.75
|
|
174
|
+
|
|
175
|
+
## 2.0.0-alpha.74
|
|
176
|
+
|
|
177
|
+
### Patch Changes
|
|
178
|
+
|
|
179
|
+
- Updated dependencies
|
|
180
|
+
- Updated dependencies
|
|
181
|
+
- @flink-app/flink@2.0.0-alpha.74
|
|
182
|
+
|
|
183
|
+
## 2.0.0-alpha.73
|
|
184
|
+
|
|
185
|
+
### Patch Changes
|
|
186
|
+
|
|
187
|
+
- Updated dependencies
|
|
188
|
+
- @flink-app/flink@2.0.0-alpha.73
|
|
189
|
+
|
|
190
|
+
## 2.0.0-alpha.72
|
|
191
|
+
|
|
192
|
+
### Patch Changes
|
|
193
|
+
|
|
194
|
+
- Updated dependencies
|
|
195
|
+
- @flink-app/flink@2.0.0-alpha.72
|
|
196
|
+
|
|
197
|
+
## 2.0.0-alpha.71
|
|
198
|
+
|
|
199
|
+
### Patch Changes
|
|
200
|
+
|
|
201
|
+
- @flink-app/flink@2.0.0-alpha.71
|
|
202
|
+
|
|
203
|
+
## 2.0.0-alpha.70
|
|
204
|
+
|
|
205
|
+
### Patch Changes
|
|
206
|
+
|
|
207
|
+
- @flink-app/flink@2.0.0-alpha.70
|
|
208
|
+
|
|
209
|
+
## 2.0.0-alpha.69
|
|
210
|
+
|
|
211
|
+
### Patch Changes
|
|
212
|
+
|
|
213
|
+
- @flink-app/flink@2.0.0-alpha.69
|
|
214
|
+
|
|
215
|
+
## 2.0.0-alpha.68
|
|
216
|
+
|
|
217
|
+
### Patch Changes
|
|
218
|
+
|
|
219
|
+
- @flink-app/flink@2.0.0-alpha.68
|
|
220
|
+
|
|
221
|
+
## 2.0.0-alpha.67
|
|
222
|
+
|
|
223
|
+
### Patch Changes
|
|
224
|
+
|
|
225
|
+
- Updated dependencies [418cb54]
|
|
226
|
+
- Updated dependencies [70d574c]
|
|
227
|
+
- @flink-app/flink@2.0.0-alpha.67
|
|
228
|
+
|
|
229
|
+
## 2.0.0-alpha.66
|
|
230
|
+
|
|
231
|
+
### Patch Changes
|
|
232
|
+
|
|
233
|
+
- Updated dependencies [5593d26]
|
|
234
|
+
- @flink-app/flink@2.0.0-alpha.66
|
|
235
|
+
|
|
236
|
+
## 2.0.0-alpha.65
|
|
237
|
+
|
|
238
|
+
### Patch Changes
|
|
239
|
+
|
|
240
|
+
- @flink-app/flink@2.0.0-alpha.65
|
|
241
|
+
|
|
242
|
+
## 2.0.0-alpha.64
|
|
243
|
+
|
|
244
|
+
### Patch Changes
|
|
245
|
+
|
|
246
|
+
- Updated dependencies [95b99ee]
|
|
247
|
+
- @flink-app/flink@2.0.0-alpha.64
|
|
248
|
+
|
|
249
|
+
## 2.0.0-alpha.63
|
|
250
|
+
|
|
251
|
+
### Patch Changes
|
|
252
|
+
|
|
253
|
+
- Updated dependencies [810df2c]
|
|
254
|
+
- Updated dependencies [8dd0752]
|
|
255
|
+
- @flink-app/flink@2.0.0-alpha.63
|
|
256
|
+
|
|
257
|
+
## 2.0.0-alpha.62
|
|
258
|
+
|
|
259
|
+
### Patch Changes
|
|
260
|
+
|
|
261
|
+
- Updated dependencies
|
|
262
|
+
- @flink-app/flink@2.0.0-alpha.62
|
|
263
|
+
|
|
264
|
+
## 2.0.0-alpha.61
|
|
265
|
+
|
|
266
|
+
### Patch Changes
|
|
267
|
+
|
|
268
|
+
- @flink-app/flink@2.0.0-alpha.61
|
|
269
|
+
|
|
270
|
+
## 2.0.0-alpha.60
|
|
271
|
+
|
|
272
|
+
### Patch Changes
|
|
273
|
+
|
|
274
|
+
- @flink-app/flink@2.0.0-alpha.60
|
|
275
|
+
|
|
276
|
+
## 2.0.0-alpha.59
|
|
277
|
+
|
|
278
|
+
### Patch Changes
|
|
279
|
+
|
|
280
|
+
- Updated dependencies [dbc2119]
|
|
281
|
+
- @flink-app/flink@2.0.0-alpha.59
|
|
282
|
+
|
|
283
|
+
## 2.0.0-alpha.58
|
|
284
|
+
|
|
285
|
+
### Patch Changes
|
|
286
|
+
|
|
287
|
+
- Updated dependencies
|
|
288
|
+
- @flink-app/flink@2.0.0-alpha.58
|
|
289
|
+
|
|
290
|
+
## 2.0.0-alpha.57
|
|
291
|
+
|
|
292
|
+
### Patch Changes
|
|
293
|
+
|
|
294
|
+
- Updated dependencies [ef7f495]
|
|
295
|
+
- Updated dependencies [2d53aa4]
|
|
296
|
+
- Updated dependencies [b3cc5d1]
|
|
297
|
+
- Updated dependencies [d377fac]
|
|
298
|
+
- Updated dependencies [4ad44c0]
|
|
299
|
+
- Updated dependencies [90f80c7]
|
|
300
|
+
- Updated dependencies [f0887e7]
|
|
301
|
+
- Updated dependencies [68c46d3]
|
|
302
|
+
- Updated dependencies [4ad44c0]
|
|
303
|
+
- Updated dependencies
|
|
304
|
+
- @flink-app/flink@2.0.0-alpha.57
|
|
305
|
+
|
|
306
|
+
## 2.0.0-alpha.56
|
|
307
|
+
|
|
308
|
+
### Patch Changes
|
|
309
|
+
|
|
310
|
+
- Zod 3.x compat
|
|
311
|
+
- Updated dependencies
|
|
312
|
+
- Updated dependencies [0203256]
|
|
313
|
+
- @flink-app/flink@2.0.0-alpha.56
|
|
314
|
+
|
|
315
|
+
## 2.0.0-alpha.55
|
|
316
|
+
|
|
317
|
+
### Patch Changes
|
|
318
|
+
|
|
319
|
+
- Updated dependencies [3267206]
|
|
320
|
+
- Updated dependencies [497b7c2]
|
|
321
|
+
- Updated dependencies [3267206]
|
|
322
|
+
- @flink-app/flink@2.0.0-alpha.55
|
|
323
|
+
|
|
324
|
+
## 2.0.0-alpha.53
|
|
325
|
+
|
|
326
|
+
### Patch Changes
|
|
327
|
+
|
|
328
|
+
- Updated dependencies [669c806]
|
|
329
|
+
- @flink-app/flink@2.0.0-alpha.53
|
|
330
|
+
|
|
331
|
+
## 2.0.0-alpha.52
|
|
332
|
+
|
|
333
|
+
### Patch Changes
|
|
334
|
+
|
|
335
|
+
- Updated dependencies [fe9f8f2]
|
|
336
|
+
- @flink-app/flink@2.0.0-alpha.52
|
|
337
|
+
|
|
338
|
+
## 2.0.0-alpha.51
|
|
339
|
+
|
|
340
|
+
### Patch Changes
|
|
341
|
+
|
|
342
|
+
- fix: add peerDependencies to all plugins and adapters
|
|
343
|
+
|
|
344
|
+
**Breaking Change Prevention:**
|
|
345
|
+
|
|
346
|
+
- Added "@flink-app/flink": ">=2.0.0-alpha.0" as peerDependency to all plugins
|
|
347
|
+
- Fixed oidc-plugin peerDependencies from "workspace:\*" to proper version ranges
|
|
348
|
+
- Fixed oauth-plugin to include @flink-app/flink peerDependency
|
|
349
|
+
|
|
350
|
+
**JWT Auth Plugin Interface Fix:**
|
|
351
|
+
|
|
352
|
+
- Removed redundant createToken declaration from JwtAuthPlugin interface
|
|
353
|
+
- The method is already inherited from FlinkAuthPlugin, this fixes TypeScript type checking issues
|
|
354
|
+
|
|
355
|
+
**Why this matters:**
|
|
356
|
+
|
|
357
|
+
- Ensures only one version of @flink-app/flink exists in node_modules
|
|
358
|
+
- Prevents type conflicts when TypeScript resolves interfaces across packages
|
|
359
|
+
- Follows standard plugin architecture best practices (same pattern as React, Webpack, etc.)
|
|
360
|
+
- Package managers now warn if incompatible versions are installed
|
|
361
|
+
- @flink-app/flink@2.0.0-alpha.51
|
|
362
|
+
|
|
363
|
+
## 2.0.0-alpha.50
|
|
364
|
+
|
|
365
|
+
## 2.0.0-alpha.49
|
|
366
|
+
|
|
367
|
+
### Patch Changes
|
|
368
|
+
|
|
369
|
+
- Typescript include fix
|
|
370
|
+
|
|
371
|
+
## 2.0.0-alpha.48
|
|
372
|
+
|
|
373
|
+
## 1.0.0
|
|
374
|
+
|
|
375
|
+
### Minor Changes
|
|
376
|
+
|
|
377
|
+
- Align minor version, from now all packages in monorepo will have same version
|
|
3
378
|
|
|
4
379
|
## 0.14.1
|
|
5
380
|
|
|
6
381
|
### Patch Changes
|
|
7
382
|
|
|
8
|
-
-
|
|
383
|
+
- fix: restore compatibility between core framework and plugins after 0.14.0 release
|
|
9
384
|
|
|
10
385
|
## 0.13.1
|
|
11
386
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,19 @@ import { client } from "./schemas/client";
|
|
|
3
3
|
export { sendgridClient } from "./sendgridClient";
|
|
4
4
|
export { smtpClient } from "./smtpClient";
|
|
5
5
|
export { flowMailerClient } from "./flowmailerClient";
|
|
6
|
+
export { sesClient } from "./sesClient";
|
|
7
|
+
export { postmarkClient } from "./postmarkClient";
|
|
6
8
|
export type { email } from "./schemas/email";
|
|
9
|
+
export type { emailSes } from "./schemas/emailSes";
|
|
10
|
+
export type { emailPostmark, PostmarkAttachment } from "./schemas/emailPostmark";
|
|
11
|
+
export * from "./ses-types";
|
|
7
12
|
export type emailPluginOptions = {
|
|
8
13
|
/**
|
|
9
14
|
* Path for request
|
|
10
15
|
*/
|
|
11
16
|
client: client;
|
|
12
17
|
};
|
|
13
|
-
export interface
|
|
18
|
+
export interface EmailPluginContext {
|
|
14
19
|
emailPlugin: {
|
|
15
20
|
client: client;
|
|
16
21
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emailPlugin = exports.flowMailerClient = exports.smtpClient = exports.sendgridClient = void 0;
|
|
17
|
+
exports.emailPlugin = exports.postmarkClient = exports.sesClient = exports.flowMailerClient = exports.smtpClient = exports.sendgridClient = void 0;
|
|
4
18
|
var sendgridClient_1 = require("./sendgridClient");
|
|
5
19
|
Object.defineProperty(exports, "sendgridClient", { enumerable: true, get: function () { return sendgridClient_1.sendgridClient; } });
|
|
6
20
|
var smtpClient_1 = require("./smtpClient");
|
|
7
21
|
Object.defineProperty(exports, "smtpClient", { enumerable: true, get: function () { return smtpClient_1.smtpClient; } });
|
|
8
22
|
var flowmailerClient_1 = require("./flowmailerClient");
|
|
9
23
|
Object.defineProperty(exports, "flowMailerClient", { enumerable: true, get: function () { return flowmailerClient_1.flowMailerClient; } });
|
|
24
|
+
var sesClient_1 = require("./sesClient");
|
|
25
|
+
Object.defineProperty(exports, "sesClient", { enumerable: true, get: function () { return sesClient_1.sesClient; } });
|
|
26
|
+
var postmarkClient_1 = require("./postmarkClient");
|
|
27
|
+
Object.defineProperty(exports, "postmarkClient", { enumerable: true, get: function () { return postmarkClient_1.postmarkClient; } });
|
|
28
|
+
__exportStar(require("./ses-types"), exports);
|
|
10
29
|
var emailPlugin = function (options) {
|
|
11
30
|
return {
|
|
12
31
|
id: "emailPlugin",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ServerClient } from "postmark";
|
|
2
|
+
import { emailPostmark as email } from "./schemas/emailPostmark";
|
|
3
|
+
import { client } from "./schemas/client";
|
|
4
|
+
export interface postmarkClientOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Postmark server token
|
|
7
|
+
*/
|
|
8
|
+
serverToken: string;
|
|
9
|
+
/**
|
|
10
|
+
* Default Postmark message stream, defaults to "outbound"
|
|
11
|
+
*/
|
|
12
|
+
defaultMessageStream?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class postmarkClient implements client {
|
|
15
|
+
postmark: ServerClient;
|
|
16
|
+
defaultMessageStream: string;
|
|
17
|
+
constructor(options: postmarkClientOptions);
|
|
18
|
+
send(email: email): Promise<boolean>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
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;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
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
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.postmarkClient = void 0;
|
|
40
|
+
var postmark_1 = require("postmark");
|
|
41
|
+
var postmarkClient = /** @class */ (function () {
|
|
42
|
+
function postmarkClient(options) {
|
|
43
|
+
var _a;
|
|
44
|
+
this.postmark = new postmark_1.ServerClient(options.serverToken);
|
|
45
|
+
this.defaultMessageStream = (_a = options.defaultMessageStream) !== null && _a !== void 0 ? _a : "outbound";
|
|
46
|
+
}
|
|
47
|
+
postmarkClient.prototype.send = function (email) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
+
var ex_1;
|
|
50
|
+
var _a, _b, _c, _d;
|
|
51
|
+
return __generator(this, function (_e) {
|
|
52
|
+
switch (_e.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
_e.trys.push([0, 2, , 3]);
|
|
55
|
+
return [4 /*yield*/, this.postmark.sendEmail({
|
|
56
|
+
From: email.from,
|
|
57
|
+
To: email.to.join(","),
|
|
58
|
+
Cc: (_a = email.cc) === null || _a === void 0 ? void 0 : _a.join(","),
|
|
59
|
+
Bcc: (_b = email.bcc) === null || _b === void 0 ? void 0 : _b.join(","),
|
|
60
|
+
ReplyTo: email.replyTo,
|
|
61
|
+
Subject: email.subject,
|
|
62
|
+
HtmlBody: "html" in email ? email.html : undefined,
|
|
63
|
+
TextBody: "text" in email ? email.text : undefined,
|
|
64
|
+
MessageStream: (_c = email.messageStream) !== null && _c !== void 0 ? _c : this.defaultMessageStream,
|
|
65
|
+
Tag: email.tag,
|
|
66
|
+
Metadata: email.metadata,
|
|
67
|
+
Attachments: (_d = email.attachments) === null || _d === void 0 ? void 0 : _d.map(function (a) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
return ({
|
|
70
|
+
Name: a.filename,
|
|
71
|
+
Content: a.content,
|
|
72
|
+
ContentType: (_a = a.contentType) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
73
|
+
ContentID: (_b = a.contentId) !== null && _b !== void 0 ? _b : "",
|
|
74
|
+
});
|
|
75
|
+
}),
|
|
76
|
+
})];
|
|
77
|
+
case 1:
|
|
78
|
+
_e.sent();
|
|
79
|
+
return [3 /*break*/, 3];
|
|
80
|
+
case 2:
|
|
81
|
+
ex_1 = _e.sent();
|
|
82
|
+
console.log(JSON.stringify(ex_1));
|
|
83
|
+
return [2 /*return*/, false];
|
|
84
|
+
case 3: return [2 /*return*/, true];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
return postmarkClient;
|
|
90
|
+
}());
|
|
91
|
+
exports.postmarkClient = postmarkClient;
|
package/dist/schemas/client.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { email } from "./email";
|
|
2
2
|
import { emailFlowmailer } from "./emailFlowmailer";
|
|
3
|
+
import { emailPostmark } from "./emailPostmark";
|
|
3
4
|
import { emailSendgrid } from "./emailSendgrid";
|
|
5
|
+
import { emailSes } from "./emailSes";
|
|
4
6
|
export interface client {
|
|
5
|
-
send(email: email | emailSendgrid | emailFlowmailer): Promise<boolean>;
|
|
7
|
+
send(email: email | emailSendgrid | emailFlowmailer | emailSes | emailPostmark): Promise<boolean>;
|
|
6
8
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export type emailPostmark = {
|
|
2
|
+
/**
|
|
3
|
+
* From address used to send the email
|
|
4
|
+
*/
|
|
5
|
+
from: string;
|
|
6
|
+
/**
|
|
7
|
+
* Email addresses to send to
|
|
8
|
+
*/
|
|
9
|
+
to: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Reply-to address
|
|
12
|
+
*/
|
|
13
|
+
replyTo?: string;
|
|
14
|
+
/**
|
|
15
|
+
* CC addresses
|
|
16
|
+
*/
|
|
17
|
+
cc?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* BCC addresses
|
|
20
|
+
*/
|
|
21
|
+
bcc?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Subject of email
|
|
24
|
+
*/
|
|
25
|
+
subject: string;
|
|
26
|
+
/**
|
|
27
|
+
* Postmark message stream id, defaults to "outbound"
|
|
28
|
+
*/
|
|
29
|
+
messageStream?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Postmark tag for categorization
|
|
32
|
+
*/
|
|
33
|
+
tag?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Custom metadata sent along with the email
|
|
36
|
+
*/
|
|
37
|
+
metadata?: Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* File attachments
|
|
40
|
+
*/
|
|
41
|
+
attachments?: PostmarkAttachment[];
|
|
42
|
+
} & ({
|
|
43
|
+
text: string;
|
|
44
|
+
} | {
|
|
45
|
+
html: string;
|
|
46
|
+
} | {
|
|
47
|
+
text: string;
|
|
48
|
+
html: string;
|
|
49
|
+
});
|
|
50
|
+
export interface PostmarkAttachment {
|
|
51
|
+
/**
|
|
52
|
+
* Base64 encoded content
|
|
53
|
+
*/
|
|
54
|
+
content: string;
|
|
55
|
+
/**
|
|
56
|
+
* Filename shown to recipient
|
|
57
|
+
*/
|
|
58
|
+
filename: string;
|
|
59
|
+
/**
|
|
60
|
+
* MIME content type (e.g. "application/pdf"). Defaults to "application/octet-stream"
|
|
61
|
+
*/
|
|
62
|
+
contentType?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Content-ID for inline attachments, e.g. "cid:image1"
|
|
65
|
+
*/
|
|
66
|
+
contentId?: string;
|
|
67
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type emailSes = {
|
|
2
|
+
/**
|
|
3
|
+
* From address used to send the email
|
|
4
|
+
*/
|
|
5
|
+
from: string;
|
|
6
|
+
/**
|
|
7
|
+
* Email addresses to send to
|
|
8
|
+
*/
|
|
9
|
+
to: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Reply-to addresses
|
|
12
|
+
*/
|
|
13
|
+
replyTo?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* CC addresses
|
|
16
|
+
*/
|
|
17
|
+
cc?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Email addresses to add as BCC
|
|
20
|
+
*/
|
|
21
|
+
bcc?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Subject of email
|
|
24
|
+
*/
|
|
25
|
+
subject: string;
|
|
26
|
+
/**
|
|
27
|
+
* Plain text body
|
|
28
|
+
*/
|
|
29
|
+
text?: string;
|
|
30
|
+
/**
|
|
31
|
+
* HTML body
|
|
32
|
+
*/
|
|
33
|
+
html?: string;
|
|
34
|
+
/**
|
|
35
|
+
* File attachments
|
|
36
|
+
*/
|
|
37
|
+
attachments?: SesAttachment[];
|
|
38
|
+
/**
|
|
39
|
+
* SES configuration set for tracking (opens, clicks, bounces)
|
|
40
|
+
*/
|
|
41
|
+
configurationSet?: string;
|
|
42
|
+
/**
|
|
43
|
+
* SES tags for event filtering
|
|
44
|
+
*/
|
|
45
|
+
tags?: Record<string, string>;
|
|
46
|
+
};
|
|
47
|
+
export interface SesAttachment {
|
|
48
|
+
/**
|
|
49
|
+
* Filename shown to recipient
|
|
50
|
+
*/
|
|
51
|
+
filename: string;
|
|
52
|
+
/**
|
|
53
|
+
* Raw content as Buffer or base64 string
|
|
54
|
+
*/
|
|
55
|
+
content: Buffer | string;
|
|
56
|
+
/**
|
|
57
|
+
* MIME content type (e.g. "application/pdf"). Defaults to "application/octet-stream"
|
|
58
|
+
*/
|
|
59
|
+
contentType?: string;
|
|
60
|
+
}
|