@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 +39 -19
- package/index.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# @dbx-tools/shared-email
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Validate browser, route, and agent-tool payloads for `@dbx-tools/email` without
|
|
4
|
+
importing Node-only code.
|
|
4
5
|
|
|
5
|
-
|
|
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
|
|
23
|
-
content type
|
|
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
|
|
28
|
+
## Validate send results
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
|
-
|
|
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
|
-
##
|
|
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((
|
|
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
|
-
##
|
|
49
|
-
|
|
50
|
-
- `
|
|
51
|
-
`
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
[
|
|
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.
|
|
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.
|
|
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.
|
|
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,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290I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