@rivi-software/workers-mail 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -155,6 +155,10 @@ The package's own tests run in Node with Vitest: SES is answered by a spy on the
155
155
  - Attachments are base64 strings: Email Service's local simulator in `wrangler dev` cannot take an `ArrayBuffer`, and SES wants base64.
156
156
  - Through the binding, recipients' display names are dropped.
157
157
 
158
+ ## Development
159
+
160
+ The tests in `tests/` cover both transports and the fallback between them against a stand-in SES and binding, the addresses and headers each transport takes, the telemetry opt-out (`mail.test.ts`) and the address parser (`address.test.ts`). None of them sends mail. In this directory, run `pnpm run test`, `pnpm run check` and `pnpm run build`.
161
+
158
162
  ## License
159
163
 
160
164
  [MIT](LICENSE)
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export type MailAddress = string | {
3
3
  email: string;
4
4
  name?: string | null;
5
5
  };
6
+ /** A file sent with the message: an attachment, or an inline image the HTML names as `cid:<contentId>`. */
6
7
  export type MailAttachment = {
7
8
  filename: string;
8
9
  /** The MIME type. */
@@ -16,6 +17,7 @@ export type MailAttachment = {
16
17
  disposition: "inline";
17
18
  contentId: string;
18
19
  });
20
+ /** A message for `sendMail`, `sendWithSes` or `sendWithBinding`; `text`, `html` or both. */
19
21
  export type Mail = {
20
22
  from: MailAddress;
21
23
  to: MailAddress | readonly MailAddress[];
@@ -31,7 +33,9 @@ export type Mail = {
31
33
  /** SES message tags, handed back on every event about the message; the binding has none and drops them. */
32
34
  tags?: Record<string, string>;
33
35
  };
36
+ /** Which transport sent a message: Amazon SES, or Cloudflare Email Service's binding. */
34
37
  export type MailTransport = "ses" | "email-service";
38
+ /** What `sendMail` answers once a message went out. */
35
39
  export type SentMail = {
36
40
  transport: MailTransport;
37
41
  /** The provider's id for the message: SES's `MessageId`, or the binding's `messageId`. */
@@ -50,6 +54,7 @@ export type MailEnv = {
50
54
  SES_ACCESS_KEY_ID?: string;
51
55
  SES_SECRET_ACCESS_KEY?: string;
52
56
  };
57
+ /** SES's region and an IAM user's access key, as `sesConfig` reads them from the Worker's env. */
53
58
  export type SesConfig = {
54
59
  region: string;
55
60
  accessKeyId: string;
package/package.json CHANGED
@@ -1,7 +1,17 @@
1
1
  {
2
2
  "name": "@rivi-software/workers-mail",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Mail from Cloudflare Workers: Amazon SES once the Worker holds its key, Cloudflare Email Service's send_email binding until then and whenever SES refuses a message",
5
+ "keywords": [
6
+ "cloudflare",
7
+ "cloudflare-workers",
8
+ "email",
9
+ "transactional-email",
10
+ "amazon-ses",
11
+ "ses",
12
+ "cloudflare-email-service",
13
+ "send-email"
14
+ ],
5
15
  "license": "MIT",
6
16
  "type": "module",
7
17
  "exports": {