@steve31415/baselib 3.5.0 → 3.6.0

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/email.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  import { type Logger } from './log-core.js';
2
2
  export declare const RESEND_API_URL = "https://api.resend.com/emails";
3
+ /** An attachment in Resend's raw-API shape. `content` is standard Base64. */
4
+ export interface EmailAttachment {
5
+ filename: string;
6
+ content: string;
7
+ contentType?: string;
8
+ }
3
9
  /** An email to send. At least one of `text` / `html` must be present. */
4
10
  export interface EmailMessage {
5
11
  /** RFC 5322 from address, e.g. `Watchdog <watchdog@snewman.net>`. */
@@ -8,6 +14,7 @@ export interface EmailMessage {
8
14
  subject: string;
9
15
  text?: string;
10
16
  html?: string;
17
+ attachments?: EmailAttachment[];
11
18
  }
12
19
  export interface SendEmailResult {
13
20
  ok: boolean;
package/dist/email.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // Transactional email through Resend — the fleet's one email path for
2
2
  // system-generated mail (Steve's ruling 2026-09-03, migration decision log):
3
- // named senders on the verified snewman.net domain (`Watchdog
4
- // <watchdog@snewman.net>`, `Lurch <steve@snewman.net>`, …), key from Secret
5
- // Manager `shared--resend-api-key`. Gmail via Mirror2's token broker stays
6
- // only for mail that is genuinely Steve-to-Steve (Digest2).
3
+ // app-specific senders on the verified snewman.net domain (`Watchdog
4
+ // <watchdog@snewman.net>`, `Lurch <lurch@snewman.net>`, …), key from Secret
5
+ // Manager `shared--resend-api-key`. Gmail is reserved for messages initiated
6
+ // directly by the user (for example, Radar's Reply action).
7
7
  //
8
8
  // Ported from the old-world package @steve31415/resend-mailer 1.0.0
9
9
  // (plasticine-apps/resend-mailer@5148649) minus its D1 outbox: the new-world
@@ -29,6 +29,7 @@ export async function sendEmail(msg, deps) {
29
29
  subject: truncate(msg.subject, 200),
30
30
  textLength: msg.text?.length ?? 0,
31
31
  htmlLength: msg.html?.length ?? 0,
32
+ attachmentCount: msg.attachments?.length ?? 0,
32
33
  ...deps.context,
33
34
  };
34
35
  const preview = { text: truncate(msg.text ?? '', 500), html: truncate(msg.html ?? '', 500) };
@@ -53,6 +54,15 @@ export async function sendEmail(msg, deps) {
53
54
  subject: msg.subject,
54
55
  ...(msg.text !== undefined ? { text: msg.text } : {}),
55
56
  ...(msg.html !== undefined ? { html: msg.html } : {}),
57
+ ...(msg.attachments?.length
58
+ ? {
59
+ attachments: msg.attachments.map((attachment) => ({
60
+ filename: attachment.filename,
61
+ content: attachment.content,
62
+ ...(attachment.contentType ? { content_type: attachment.contentType } : {}),
63
+ })),
64
+ }
65
+ : {}),
56
66
  }),
57
67
  });
58
68
  const elapsedMs = Date.now() - start;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steve31415/baselib",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "Plasticine new-world shared platform library: logging, auth, service-to-service auth, db, HTTP, sync, app updates",
5
5
  "type": "module",
6
6
  "license": "MIT",