@aws-blocks/bb-email-client 0.1.2 → 0.1.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/DESIGN.md +47 -0
- package/README.md +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +12 -3
- package/src/version.ts +1 -1
package/DESIGN.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Email — Design
|
|
2
|
+
|
|
3
|
+
Design document for the Email Building Block. For usage, examples, best practices, and scaling guidance, see [README.md](./README.md).
|
|
4
|
+
|
|
5
|
+
**Package:** `@aws-blocks/bb-email-client`
|
|
6
|
+
**Type:** Primitive (new infrastructure)
|
|
7
|
+
**AWS Service:** Amazon SES
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Email sending for transactional emails — welcome emails, password resets, order confirmations, notifications. For real-time messaging, use `Realtime`. For async job notifications, use `AsyncJob`.
|
|
12
|
+
|
|
13
|
+
## Infrastructure (CDK)
|
|
14
|
+
|
|
15
|
+
Creates the following resources:
|
|
16
|
+
|
|
17
|
+
- **SES Configuration Set:** For delivery tracking and event publishing
|
|
18
|
+
- **Name:** Derived from `scope.fullId`
|
|
19
|
+
- **SES Email Identity:** Verifies the `fromAddress` (email-level verification)
|
|
20
|
+
- Domain-level verification is preferred for production but requires DNS access
|
|
21
|
+
- **IAM Permissions:** `ses:SendEmail` and `ses:SendBulkEmail` granted to the parent scope's handler automatically
|
|
22
|
+
|
|
23
|
+
No SNS topics for bounce/complaint handling, no SES templates, no dedicated IP pools.
|
|
24
|
+
|
|
25
|
+
## Mock Implementation
|
|
26
|
+
|
|
27
|
+
- Emails are logged to the console with sender, recipients, subject, and a body preview:
|
|
28
|
+
```
|
|
29
|
+
[Email:notifications]
|
|
30
|
+
Recipient: user@example.com
|
|
31
|
+
Subject: Welcome!
|
|
32
|
+
Body: Thanks for signing up.
|
|
33
|
+
```
|
|
34
|
+
- Emails are also written to `.bb-data/{scope.fullId}/emails.json` as a JSON array for programmatic inspection. Each entry includes `to`, `subject`, `body`, `html` (if provided), `from`, `messageId`, and `timestamp` (ISO 8601).
|
|
35
|
+
- `sendBatch()` appends all messages to the same file in a single write.
|
|
36
|
+
- Mock validates email address format (basic RFC 5322 check) and throws `InvalidInputException` for malformed addresses.
|
|
37
|
+
|
|
38
|
+
### Mock vs AWS Behavior Differences
|
|
39
|
+
|
|
40
|
+
| Behavior Difference | Impact | Mitigation |
|
|
41
|
+
|------------|--------|------------|
|
|
42
|
+
| No actual email delivery | Emails are never sent; delivery issues only surface in AWS | No mitigation — mock is for development flow, not delivery testing. Sandbox testing covers real delivery |
|
|
43
|
+
| No bounce/complaint handling | Bounces and complaints only occur with real email delivery | No mitigation — these are inherently production concerns |
|
|
44
|
+
| No sending rate limits | Code that would be throttled in SES sandbox succeeds locally | No mitigation — the mock does not simulate SES rate limits. Recommend sandbox testing for throughput-sensitive flows |
|
|
45
|
+
| No domain verification | `DomainNotVerifiedException` never thrown locally | No mitigation — verification is an infrastructure concern handled by CDK. Sandbox testing covers it |
|
|
46
|
+
| Per-message recipient limit (50) | A message exceeding 50 recipients (To + CC + BCC) would be rejected by SES | `send()` throws `InvalidInputException`; within `sendBatch()` the offending message is marked `failed` in the per-entry results (matching SES per-entry behavior) |
|
|
47
|
+
| No 40 MB message size limit | Oversized messages succeed locally | Mock validates total message size and throws `EmailSendFailedException` when it exceeds 40 MB |
|
package/README.md
CHANGED
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-blocks/bb-email-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/aws-devtools-labs/aws-blocks.git",
|
|
7
|
+
"directory": "packages/bb-email-client"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/aws-devtools-labs/aws-blocks/tree/main/packages/bb-email-client#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/aws-devtools-labs/aws-blocks/issues"
|
|
12
|
+
},
|
|
4
13
|
"author": "Amazon Web Services",
|
|
5
14
|
"license": "Apache-2.0",
|
|
6
15
|
"type": "module",
|
|
@@ -29,8 +38,8 @@
|
|
|
29
38
|
"test": "node --test --test-concurrency=1 dist/*.test.js"
|
|
30
39
|
},
|
|
31
40
|
"dependencies": {
|
|
32
|
-
"@aws-blocks/core": "^0.
|
|
33
|
-
"@aws-blocks/bb-logger": "^0.1.
|
|
41
|
+
"@aws-blocks/core": "^0.2.0",
|
|
42
|
+
"@aws-blocks/bb-logger": "^0.1.4",
|
|
34
43
|
"@aws-sdk/client-sesv2": "^3.0.0"
|
|
35
44
|
},
|
|
36
45
|
"devDependencies": {
|
package/src/version.ts
CHANGED