@dbx-tools/shared-email 0.9.129 → 0.9.132

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
@@ -1,11 +1,9 @@
1
1
  # @dbx-tools/shared-email
2
2
 
3
- Browser-safe email sending schemas and inferred types.
3
+ Validate browser, route, and agent-tool payloads for `@dbx-tools/email` without
4
+ importing Node-only code.
4
5
 
5
- Use these schemas in UIs, Mastra tools, routes, and tests that exchange email
6
- payloads with [`@dbx-tools/email`](../../node/email).
7
-
8
- ## Validate A Drafted Message
6
+ ## Validate a drafted message
9
7
 
10
8
  ```ts
11
9
  import { email, type EmailMessage } from "@dbx-tools/shared-email";
@@ -19,39 +17,61 @@ const message: EmailMessage = email.emailMessageSchema.parse({
19
17
  ```
20
18
 
21
19
  The message schema covers recipients, subject, body content, and attachments.
22
- Attachments can carry inline content, a local path, a URL, encoding metadata, and
23
- content type hints.
20
+ Attachments carry inline string content, an optional encoding, and an optional
21
+ content type. The schema doesn't accept a local path or URL. Read external
22
+ content in trusted server code, then pass the resulting string through
23
+ `content`.
24
24
 
25
25
  The package also includes send-result and sender-option schemas for routes,
26
26
  approval UIs, and tests.
27
27
 
28
- ## Validate Send Results
28
+ ## Validate send results
29
29
 
30
30
  ```ts
31
- const result = email.emailResultSchema.parse(await sendResponse.json());
31
+ import { email } from "@dbx-tools/shared-email";
32
+
33
+ export function parseEmailResult(value: unknown) {
34
+ return email.emailResultSchema.parse(value);
35
+ }
36
+
37
+ const result = parseEmailResult({
38
+ sent: true,
39
+ recipient: "alice@example.com",
40
+ from: "reports@example.com",
41
+ messageId: "smtp-message-id",
42
+ });
32
43
  ```
33
44
 
34
45
  `emailResultSchema` is the shared shape for SMTP sends and outbox writes. Use it
35
46
  for approval UI state and test assertions.
36
47
 
37
- ## Render Sender Choices
48
+ ## Load sender choices
38
49
 
39
50
  ```ts
51
+ import { email } from "@dbx-tools/shared-email";
52
+
40
53
  const senders = email.emailSendersSchema.parse(
41
- await fetch("/api/email/senders").then((r) => r.json()),
54
+ await fetch("/api/email/senders").then((response) => response.json()),
42
55
  );
43
56
  ```
44
57
 
45
58
  The sender schema describes the concrete `From` choices for the current user,
46
59
  the default sender, and whether the list is restricted by policy.
47
60
 
48
- ## Modules
49
-
50
- - `email` - `emailAttachmentSchema`, `emailMessageSchema`,
51
- `emailResultSchema`, `emailSendersSchema`, and flat inferred types:
52
- `EmailAttachment`, `EmailMessage`, `EmailResult`, and `EmailSenders`.
53
- The schemas intentionally avoid array `.min()` constraints so they can be reused
54
- as model/tool JSON schemas for serving endpoints that reject `minItems`.
61
+ ## Understand schema and transport limits
62
+
63
+ - `emailAttachmentSchema` accepts `filename`, inline `content`, `encoding`, and
64
+ `contentType`. It doesn't read files, fetch URLs, or validate whether an
65
+ encoding matches the content.
66
+ - The schemas don't add array `minItems` constraints because some Model Serving
67
+ endpoints reject that JSON Schema keyword. The Node sending layer still
68
+ requires at least one recipient.
69
+ - The Node sending layer limits a message to 20 attachments, 10 MiB per decoded
70
+ attachment, 20 MiB across attachments, and 200,000 body characters.
71
+ - Outbox mode lists attachment filenames in the rendered preview but doesn't
72
+ write attachment payloads as separate files.
73
+ - Sender policy, SMTP delivery, approval, and outbox persistence belong to
74
+ [@dbx-tools/email](../../node/email/README.md).
55
75
 
56
76
  Passwordless authentication contracts live in
57
- [`@dbx-tools/shared-auth`](../auth).
77
+ [@dbx-tools/shared-auth](../auth/README.md).
package/index.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
 
5
5
  export const PACKAGE_IDENTIFIER = "@dbx-tools/shared-email";
6
- export const PACKAGE_VERSION = "0.9.129";
6
+ export const PACKAGE_VERSION = "0.9.132";
7
7
  export * as email from "./src/email.ts";
8
8
  export { emailAttachmentSchema, emailMessageSchema, emailResultSchema, emailSendersSchema } from "./src/email.ts";
9
9
  export type { EmailAttachment, EmailMessage, EmailResult, EmailSenders } from "./src/email.ts";
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const PACKAGE_IDENTIFIER = "@dbx-tools/shared-email";
2
- export declare const PACKAGE_VERSION = "0.9.129";
2
+ export declare const PACKAGE_VERSION = "0.9.132";
3
3
  export * as email from "./src/email.ts";
4
4
  export { emailAttachmentSchema, emailMessageSchema, emailResultSchema, emailSendersSchema } from "./src/email.ts";
5
5
  export type { EmailAttachment, EmailMessage, EmailResult, EmailSenders } from "./src/email.ts";
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Regenerated from the exporting modules in ./src.
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
  export const PACKAGE_IDENTIFIER = "@dbx-tools/shared-email";
5
- export const PACKAGE_VERSION = "0.9.129";
5
+ export const PACKAGE_VERSION = "0.9.132";
6
6
  export * as email from "./src/email.js";
7
7
  export { emailAttachmentSchema, emailMessageSchema, emailResultSchema, emailSendersSchema } from "./src/email.js";
8
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQ0FBMkM7QUFDM0MsbURBQW1EO0FBQ25ELHdFQUF3RTtBQUV4RSxNQUFNLENBQUMsTUFBTSxrQkFBa0IsR0FBRyx5QkFBeUIsQ0FBQztBQUM1RCxNQUFNLENBQUMsTUFBTSxlQUFlLEdBQUcsU0FBUyxDQUFDO0FBQ3pDLE9BQU8sS0FBSyxLQUFLLE1BQU0sZ0JBQWdCLENBQUM7QUFDeEMsT0FBTyxFQUFFLHFCQUFxQixFQUFFLGtCQUFrQixFQUFFLGlCQUFpQixFQUFFLGtCQUFrQixFQUFFLE1BQU0sZ0JBQWdCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBHRU5FUkFURUQgYnkgcHJvamVuIHdhdGNoIC0g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ENBQUM7QUFDeEMsT0FBTyxFQUFFLHFCQUFxQixFQUFFLGtCQUFrQixFQUFFLGlCQUFpQixFQUFFLGtCQUFrQixFQUFFLE1BQU0sZ0JBQWdCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBHRU5FUkFURUQgYnkgcHJvamVuIHdhdGNoIC0gRE8gTk9UIEVESVQuXG4vLyBSZWdlbmVyYXRlZCBmcm9tIHRoZSBleHBvcnRpbmcgbW9kdWxlcyBpbiAuL3NyYy5cbi8vIEhhbmQgZWRpdHMgYXJlIG92ZXJ3cml0dGVuIG9uIHRoZSBuZXh0IHdhdGNoOyB0aGlzIGZpbGUgaXMgcmVhZC1vbmx5LlxuXG5leHBvcnQgY29uc3QgUEFDS0FHRV9JREVOVElGSUVSID0gXCJAZGJ4LXRvb2xzL3NoYXJlZC1lbWFpbFwiO1xuZXhwb3J0IGNvbnN0IFBBQ0tBR0VfVkVSU0lPTiA9IFwiMC45LjEzMlwiO1xuZXhwb3J0ICogYXMgZW1haWwgZnJvbSBcIi4vc3JjL2VtYWlsLnRzXCI7XG5leHBvcnQgeyBlbWFpbEF0dGFjaG1lbnRTY2hlbWEsIGVtYWlsTWVzc2FnZVNjaGVtYSwgZW1haWxSZXN1bHRTY2hlbWEsIGVtYWlsU2VuZGVyc1NjaGVtYSB9IGZyb20gXCIuL3NyYy9lbWFpbC50c1wiO1xuZXhwb3J0IHR5cGUgeyBFbWFpbEF0dGFjaG1lbnQsIEVtYWlsTWVzc2FnZSwgRW1haWxSZXN1bHQsIEVtYWlsU2VuZGVycyB9IGZyb20gXCIuL3NyYy9lbWFpbC50c1wiO1xuIl19
package/package.json CHANGED
@@ -46,7 +46,7 @@
46
46
  "./package.json": "./package.json"
47
47
  }
48
48
  },
49
- "version": "0.9.129",
49
+ "version": "0.9.132",
50
50
  "types": "./lib/index.d.ts",
51
51
  "dbxToolsConfig": {
52
52
  "tags": [