@framers/agentos-ext-channel-email 0.2.0 → 0.3.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/README.md +25 -1
- package/dist/EmailChannelAdapter.d.ts +4 -1
- package/dist/EmailChannelAdapter.d.ts.map +1 -1
- package/dist/EmailChannelAdapter.js +8 -4
- package/dist/EmailChannelAdapter.js.map +1 -1
- package/dist/EmailService.d.ts +28 -0
- package/dist/EmailService.d.ts.map +1 -1
- package/dist/EmailService.js +40 -6
- package/dist/EmailService.js.map +1 -1
- package/dist/ResendTransport.d.ts +12 -7
- package/dist/ResendTransport.d.ts.map +1 -1
- package/dist/ResendTransport.js +18 -11
- package/dist/ResendTransport.js.map +1 -1
- package/dist/agentAttachments.d.ts +25 -9
- package/dist/agentAttachments.d.ts.map +1 -1
- package/dist/agentAttachments.js +72 -18
- package/dist/agentAttachments.js.map +1 -1
- package/dist/messageHeaders.d.ts +31 -0
- package/dist/messageHeaders.d.ts.map +1 -0
- package/dist/messageHeaders.js +90 -0
- package/dist/messageHeaders.js.map +1 -0
- package/dist/messageText.d.ts +24 -0
- package/dist/messageText.d.ts.map +1 -0
- package/dist/messageText.js +38 -0
- package/dist/messageText.js.map +1 -0
- package/dist/tools/reply.d.ts +5 -0
- package/dist/tools/reply.d.ts.map +1 -1
- package/dist/tools/reply.js +5 -0
- package/dist/tools/reply.js.map +1 -1
- package/dist/tools/send.d.ts +5 -1
- package/dist/tools/send.d.ts.map +1 -1
- package/dist/tools/send.js +7 -3
- package/dist/tools/send.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -63,11 +63,31 @@ The pack's factory sends through Resend when it has a Resend key and no SMTP hos
|
|
|
63
63
|
|
|
64
64
|
`from` sets the From header of both transports, and a display name is allowed (`Example <hello@example.com>`). With SMTP it falls back to the SMTP user; with Resend it is required, and `initialize()` throws without it. Replies are sent from it too. The pack's factory reads it from the option `from`, then from `EMAIL_FROM`.
|
|
65
65
|
|
|
66
|
+
## Header fields
|
|
67
|
+
|
|
68
|
+
`sendEmail` adds the fields in `headers` to the message, by name. A one-click unsubscribe ([RFC 8058](https://www.rfc-editor.org/rfc/rfc8058)) is a pair of them:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
await email.sendEmail({
|
|
72
|
+
to: 'reader@example.com',
|
|
73
|
+
subject: 'Your weekly summary',
|
|
74
|
+
body: 'Plain words.',
|
|
75
|
+
headers: {
|
|
76
|
+
'List-Unsubscribe': '<https://example.com/unsubscribe?t=opaque-token>',
|
|
77
|
+
'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Through Resend the fields go in the request's `headers` ([custom headers](https://resend.com/docs/dashboard/emails/custom-headers)); through SMTP nodemailer writes each into the message. `headers` is a plain object of names and values. A name is printable US-ASCII with no space or colon, the field name of RFC 5322, and a value is a string with no line break or other control character than the tab, so no field can end and start another. Each value is read once, and the fields are sent as read.
|
|
83
|
+
|
|
84
|
+
`headers` adds fields and never replaces the service's own: `From`, `To`, `Cc`, `Bcc`, `Reply-To`, `Subject`, `Date`, `Message-ID`, `MIME-Version` and every `Content-` field are refused, in any case. The recipients, the reply-to and the subject have their own options, and the From comes from the configuration's `from`. A name given twice in different cases is refused too. A refusal throws an `Error` before either transport is used, naming the field, or its place in the object when its name is at fault, and none of its value. The `emailSend` tool and the channel adapter add no header fields.
|
|
85
|
+
|
|
66
86
|
## Errors and retries
|
|
67
87
|
|
|
68
88
|
A refusal from Resend throws `EmailApiError`, with `status` (the HTTP status), `type` (Resend's error name, such as `validation_error`, or `unknown` when the answer's body is not JSON, names no error, or names one that is not 1 to 64 letters, digits, `_`, `.`, `:` or `-`) and `retryAfterSeconds` (the answer's `retry-after`, or `null`). Its message names the status and the type and never carries Resend's message, which can quote an address.
|
|
69
89
|
|
|
70
|
-
`fetch`'s own errors pass through as it throws them: a `TypeError` when the connection fails, and a `TimeoutError` when `timeoutMs` passes before an answer comes. A deadline that passes while an answer's body is being read throws no `TimeoutError`: a refusal then throws `EmailApiError` with `type` `unknown`, and an accepted send resolves with an empty `messageId`. The key is trimmed at each send. A key, an `idempotencyKey` or a `userAgent` that holds a character an HTTP header cannot carry (a line break or another control character other than a tab, or a character above U+00FF) throws an `Error` before any request, and its message names which one and none of its value.
|
|
90
|
+
`fetch`'s own errors pass through as it throws them: a `TypeError` when the connection fails, and a `TimeoutError` when `timeoutMs` passes before an answer comes. A deadline that passes while an answer's body is being read throws no `TimeoutError`: a refusal then throws `EmailApiError` with `type` `unknown`, and an accepted send resolves with an empty `messageId`. The key is trimmed at each send. A key, an `idempotencyKey` or a `userAgent` that holds a character an HTTP header cannot carry (a line break or another control character other than a tab, or a character above U+00FF) throws an `Error` before any request, and its message names which one and none of its value. `ResendTransport.send` checks a message's `headers` by the rules for names and values in [header fields](#header-fields), though not against the fields the service writes, and throws the same way: a reply through Resend whose message id holds a line break is refused rather than sent in `In-Reply-To` and `References`.
|
|
71
91
|
|
|
72
92
|
A send is tried again only on the terms of Resend's [errors](https://resend.com/docs/api-reference/errors) and [rate limit](https://resend.com/docs/api-reference/rate-limit) pages, as `retryWaitSeconds` decides:
|
|
73
93
|
|
|
@@ -87,6 +107,10 @@ The wait is the answer's `retry-after` when it has one, else as many seconds as
|
|
|
87
107
|
|
|
88
108
|
A model names the tools' arguments and the channel's blocks, so `emailSend` and `emailChannel` pass on an attachment only as `content`, a `data:` address or, through Resend, an `http` or `https` address. They refuse any other before anything is sent, reading no file and fetching no address: the tool answers `{ success: false, error }`, the adapter throws an `Error`, and the message names the attachment's filename, never its path.
|
|
89
109
|
|
|
110
|
+
They send each attachment as they checked it: a copy of its own `filename`, `content`, `path` and `contentType`, each read once, with a Buffer's bytes copied. They refuse the same way an attachment that is not an object, one that gives any of those four through a getter or a setter, and one whose `filename` or `contentType` is not a string. Any other property of an attachment is left out.
|
|
111
|
+
|
|
112
|
+
The subject, the bodies and the message id a reply names must be text. Through SMTP, nodemailer reads the file or fetches the address an object body names into the message, and writes an object subject or message id marked `prepared` into the headers as it is. So `sendEmail` and `replyToEmail`, whoever calls them, throw a `TypeError` that names the field, never its value, before anything is sent on either transport: `subject`, `body` and the reply's `messageId` must be strings, and `html` a string when given (`null` leaves the HTML part out). `emailSend` and `emailReply` answer it as `{ success: false, error }`, and the adapter throws it.
|
|
113
|
+
|
|
90
114
|
## API
|
|
91
115
|
|
|
92
116
|
| Export | What it is |
|
|
@@ -46,7 +46,10 @@ export declare class EmailChannelAdapter {
|
|
|
46
46
|
* Sends `content` to `conversationId`, or replies when it names `replyToMessageId` (a reply carries no attachments).
|
|
47
47
|
* Its `document` and `image` blocks become attachments, each with the block's `content` or its `url` as the path, and
|
|
48
48
|
* one that is not `content`, a `data:` address or, through Resend, an `http(s)` address throws an `Error` naming its
|
|
49
|
-
* filename before anything is sent, a reply included
|
|
49
|
+
* filename before anything is sent, a reply included; what is sent is the copy `requireAgentAttachments` made of
|
|
50
|
+
* each attachment, so a Buffer is sent as the bytes it held then. A text block's `text`, an HTML block's `html` (or
|
|
51
|
+
* its `text`), the `subject` in `platformOptions` and `replyToMessageId` must be strings when given: otherwise the
|
|
52
|
+
* service throws a `TypeError` naming the field before anything is sent.
|
|
50
53
|
*/
|
|
51
54
|
sendMessage(conversationId: string, content: MessageContent): Promise<ChannelSendResult>;
|
|
52
55
|
sendTypingIndicator(_conversationId: string, _isTyping: boolean): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailChannelAdapter.d.ts","sourceRoot":"","sources":["../src/EmailChannelAdapter.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AACrC,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACvC,MAAM,MAAM,uB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AS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvE,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAW;IAC7C,QAAQ,CAAC,WAAW,WAAW;IAC/B,QAAQ,CAAC,YAAY,EAAE,SAAS,iBAAiB,EAAE,CAEjD;IAEF,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,QAAQ,CAAuC;IACvD,OAAO,CAAC,YAAY,CAAuB;gBAE/B,OAAO,EAAE,YAAY;IAI3B,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAK/B,iBAAiB,IAAI,qBAAqB;IAc1C;;;;;;;;OAQG;IACG,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAyCxF,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrF,EAAE,CAAC,OAAO,EAAE,mBAAmB,EAAE,WAAW,CAAC,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAI;CAI/E"}
|
|
@@ -50,7 +50,10 @@ class EmailChannelAdapter {
|
|
|
50
50
|
* Sends `content` to `conversationId`, or replies when it names `replyToMessageId` (a reply carries no attachments).
|
|
51
51
|
* Its `document` and `image` blocks become attachments, each with the block's `content` or its `url` as the path, and
|
|
52
52
|
* one that is not `content`, a `data:` address or, through Resend, an `http(s)` address throws an `Error` naming its
|
|
53
|
-
* filename before anything is sent, a reply included
|
|
53
|
+
* filename before anything is sent, a reply included; what is sent is the copy `requireAgentAttachments` made of
|
|
54
|
+
* each attachment, so a Buffer is sent as the bytes it held then. A text block's `text`, an HTML block's `html` (or
|
|
55
|
+
* its `text`), the `subject` in `platformOptions` and `replyToMessageId` must be strings when given: otherwise the
|
|
56
|
+
* service throws a `TypeError` naming the field before anything is sent.
|
|
54
57
|
*/
|
|
55
58
|
async sendMessage(conversationId, content) {
|
|
56
59
|
const textBlock = content.blocks.find((b) => b.type === 'text');
|
|
@@ -70,8 +73,9 @@ class EmailChannelAdapter {
|
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
|
-
// A model writes these blocks: an attachment this process would read or fetch stops the message here
|
|
74
|
-
|
|
76
|
+
// A model writes these blocks: an attachment this process would read or fetch stops the message here, and what is
|
|
77
|
+
// sent is the copy the check made.
|
|
78
|
+
const checked = (0, agentAttachments_js_1.requireAgentAttachments)(attachments, this.service.transport === 'resend');
|
|
75
79
|
if (content.replyToMessageId) {
|
|
76
80
|
const result = await this.service.replyToEmail(content.replyToMessageId, text, html);
|
|
77
81
|
return { messageId: result.messageId, timestamp: new Date().toISOString() };
|
|
@@ -81,7 +85,7 @@ class EmailChannelAdapter {
|
|
|
81
85
|
subject,
|
|
82
86
|
body: text,
|
|
83
87
|
html,
|
|
84
|
-
attachments:
|
|
88
|
+
attachments: checked !== undefined && checked.length > 0 ? checked : undefined,
|
|
85
89
|
});
|
|
86
90
|
return { messageId: result.messageId, timestamp: new Date().toISOString() };
|
|
87
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailChannelAdapter.js","sourceRoot":"","sources":["../src/EmailChannelAdapter.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;GAEG;;;AAGH,+DAAgE;AAiChE,MAAa,mBAAmB;IAY9B,YAAY,OAAqB;QAXxB,aAAQ,GAAoB,OAAO,CAAC;QACpC,gBAAW,GAAG,OAAO,CAAC;QACtB,iBAAY,GAAiC;YACpD,MAAM,EAAE,WAAW,EAAE,WA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,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC;QAE1F,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YACrF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;QAC9E,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;YAC1C,EAAE,EAAE,cAAc;YAClB,OAAO;YACP,IAAI,EAAE,IAAI;YACV,IAAI;YACJ,WAAW,EAAE,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;SAC/E,CAAC,CAAC;QAEH,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,eAAuB,EAAE,SAAkB;QACnE,2CAA2C;IAC7C,CAAC;IAED,EAAE,CAAC,OAA4B,EAAE,WAAgC;QAC/D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAxGD,kDAwGC"}
|
package/dist/EmailService.d.ts
CHANGED
|
@@ -43,6 +43,14 @@ export interface SendEmailOptions {
|
|
|
43
43
|
bcc?: string;
|
|
44
44
|
/** Resend's Idempotency-Key for this message; SMTP ignores it. */
|
|
45
45
|
idempotencyKey?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Header fields added to the message, by name, such as `List-Unsubscribe` and `List-Unsubscribe-Post`: through Resend
|
|
48
|
+
* the request's `headers`, through SMTP fields nodemailer writes into the message. A name is printable US-ASCII with no
|
|
49
|
+
* space or colon, given once in any case, and a value is a string with no line break or other control character than
|
|
50
|
+
* the tab. A field the service writes itself is refused, in any case: `From`, `To`, `Cc`, `Bcc`, `Reply-To`, `Subject`,
|
|
51
|
+
* `Date`, `Message-ID`, `MIME-Version` and any `Content-` field.
|
|
52
|
+
*/
|
|
53
|
+
headers?: Record<string, string>;
|
|
46
54
|
}
|
|
47
55
|
export interface EmailMessage {
|
|
48
56
|
messageId: string;
|
|
@@ -86,6 +94,18 @@ export declare class EmailService {
|
|
|
86
94
|
* from the developer's code and never from a model's output. The `emailSend` tool and the channel adapter accept only
|
|
87
95
|
* `content`, `data:` addresses and, through Resend, `http(s)` addresses, and refuse any other attachment before
|
|
88
96
|
* sending.
|
|
97
|
+
*
|
|
98
|
+
* `subject` and `body` must be strings, and `html` a string when it is given (`null` sends no HTML part, as
|
|
99
|
+
* `undefined` does): any other value throws a `TypeError` naming the field, never its value, before either transport
|
|
100
|
+
* is used. An object body would have nodemailer read the file its `path` names or fetch the address its `href` names
|
|
101
|
+
* into the message, and an object subject marked `prepared` would be written into the headers as it is.
|
|
102
|
+
*
|
|
103
|
+
* `headers` adds fields to the message and never replaces one the service writes. It must be a plain object of names
|
|
104
|
+
* and values: a name printable US-ASCII with no space or colon, given once in any case, and none of `From`, `To`,
|
|
105
|
+
* `Cc`, `Bcc`, `Reply-To`, `Subject`, `Date`, `Message-ID`, `MIME-Version` or a `Content-` field, in any case; a value
|
|
106
|
+
* a string with no line break or other control character than the tab. Anything else throws an `Error` that names the
|
|
107
|
+
* field, or its place when its name is at fault, and none of its value, before either transport is used. Each value is
|
|
108
|
+
* read once, and the fields are sent as read.
|
|
89
109
|
*/
|
|
90
110
|
sendEmail(options: SendEmailOptions): Promise<{
|
|
91
111
|
messageId: string;
|
|
@@ -96,6 +116,14 @@ export declare class EmailService {
|
|
|
96
116
|
codes: string[];
|
|
97
117
|
messageId: string;
|
|
98
118
|
}>;
|
|
119
|
+
/**
|
|
120
|
+
* Replies to the message whose Message-ID is `messageId`, reading its sender, subject and References through IMAP,
|
|
121
|
+
* and sends `body` with `html`, when given, through the transport that sends, threaded with `In-Reply-To` and
|
|
122
|
+
* `References`. `messageId` and `body` must be strings, and `html` a string when it is given (`null` sends no HTML
|
|
123
|
+
* part): any other value throws a `TypeError` naming the field, never its value, before the original is read or
|
|
124
|
+
* anything is sent. Besides the bodies' files and addresses (see `sendEmail`), an object message id marked `prepared`
|
|
125
|
+
* would be written into the `In-Reply-To` header as it is.
|
|
126
|
+
*/
|
|
99
127
|
replyToEmail(messageId: string, body: string, html?: string): Promise<{
|
|
100
128
|
messageId: string;
|
|
101
129
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailService.d.ts","sourceRoot":"","sources":["../src/EmailService.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"EmailService.d.ts","sourceRoot":"","sources":["../src/EmailService.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQ1D,sGAAsG;AACtG,MAAM,WAAW,WAAW;IAC1B,0GAA0G;IAC1G,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,wFAAwF;IACxF,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,iIAAiI;IACjI,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE;QACL,IAAI,EA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|
|
44
44
|
const nodemailer = __importStar(require("nodemailer"));
|
|
45
45
|
const imapflow_1 = require("imapflow");
|
|
46
46
|
const ResendTransport_js_1 = require("./ResendTransport.js");
|
|
47
|
+
const messageHeaders_js_1 = require("./messageHeaders.js");
|
|
48
|
+
const messageText_js_1 = require("./messageText.js");
|
|
47
49
|
// ---------------------------------------------------------------------------
|
|
48
50
|
// Service
|
|
49
51
|
// ---------------------------------------------------------------------------
|
|
@@ -115,19 +117,37 @@ class EmailService {
|
|
|
115
117
|
* from the developer's code and never from a model's output. The `emailSend` tool and the channel adapter accept only
|
|
116
118
|
* `content`, `data:` addresses and, through Resend, `http(s)` addresses, and refuse any other attachment before
|
|
117
119
|
* sending.
|
|
120
|
+
*
|
|
121
|
+
* `subject` and `body` must be strings, and `html` a string when it is given (`null` sends no HTML part, as
|
|
122
|
+
* `undefined` does): any other value throws a `TypeError` naming the field, never its value, before either transport
|
|
123
|
+
* is used. An object body would have nodemailer read the file its `path` names or fetch the address its `href` names
|
|
124
|
+
* into the message, and an object subject marked `prepared` would be written into the headers as it is.
|
|
125
|
+
*
|
|
126
|
+
* `headers` adds fields to the message and never replaces one the service writes. It must be a plain object of names
|
|
127
|
+
* and values: a name printable US-ASCII with no space or colon, given once in any case, and none of `From`, `To`,
|
|
128
|
+
* `Cc`, `Bcc`, `Reply-To`, `Subject`, `Date`, `Message-ID`, `MIME-Version` or a `Content-` field, in any case; a value
|
|
129
|
+
* a string with no line break or other control character than the tab. Anything else throws an `Error` that names the
|
|
130
|
+
* field, or its place when its name is at fault, and none of its value, before either transport is used. Each value is
|
|
131
|
+
* read once, and the fields are sent as read.
|
|
118
132
|
*/
|
|
119
133
|
async sendEmail(options) {
|
|
120
134
|
this.requireRunning();
|
|
135
|
+
// Each is read once, so the value checked is the value sent.
|
|
136
|
+
const subject = (0, messageText_js_1.requireText)('subject', options.subject);
|
|
137
|
+
const body = (0, messageText_js_1.requireText)('body', options.body);
|
|
138
|
+
const html = (0, messageText_js_1.optionalText)('html', options.html);
|
|
139
|
+
const headers = (0, messageHeaders_js_1.requireAddedHeaders)(options.headers);
|
|
121
140
|
if (this.resend) {
|
|
122
141
|
return this.resend.send({
|
|
123
142
|
from: this.config.from,
|
|
124
143
|
to: options.to,
|
|
125
|
-
subject
|
|
126
|
-
text:
|
|
127
|
-
html
|
|
144
|
+
subject,
|
|
145
|
+
text: body,
|
|
146
|
+
html,
|
|
128
147
|
replyTo: options.replyTo,
|
|
129
148
|
cc: options.cc,
|
|
130
149
|
bcc: options.bcc,
|
|
150
|
+
headers,
|
|
131
151
|
idempotencyKey: options.idempotencyKey,
|
|
132
152
|
attachments: options.attachments,
|
|
133
153
|
});
|
|
@@ -137,12 +157,15 @@ class EmailService {
|
|
|
137
157
|
const info = await this.transporter.sendMail({
|
|
138
158
|
from: this.config.from ?? this.config.smtp.user,
|
|
139
159
|
to: options.to,
|
|
140
|
-
subject
|
|
141
|
-
text:
|
|
142
|
-
html
|
|
160
|
+
subject,
|
|
161
|
+
text: body,
|
|
162
|
+
html,
|
|
143
163
|
replyTo: options.replyTo,
|
|
144
164
|
cc: options.cc,
|
|
145
165
|
bcc: options.bcc,
|
|
166
|
+
// A list, so nodemailer adds each field under its own name: an object with `key` and `value` properties would be
|
|
167
|
+
// read as one field named by its `key`.
|
|
168
|
+
headers: headers === undefined ? undefined : Object.entries(headers).map(([key, value]) => ({ key, value })),
|
|
146
169
|
attachments: options.attachments?.map((a) => ({
|
|
147
170
|
filename: a.filename,
|
|
148
171
|
content: a.content,
|
|
@@ -305,10 +328,21 @@ class EmailService {
|
|
|
305
328
|
}
|
|
306
329
|
}
|
|
307
330
|
// ── Reply to Email ──
|
|
331
|
+
/**
|
|
332
|
+
* Replies to the message whose Message-ID is `messageId`, reading its sender, subject and References through IMAP,
|
|
333
|
+
* and sends `body` with `html`, when given, through the transport that sends, threaded with `In-Reply-To` and
|
|
334
|
+
* `References`. `messageId` and `body` must be strings, and `html` a string when it is given (`null` sends no HTML
|
|
335
|
+
* part): any other value throws a `TypeError` naming the field, never its value, before the original is read or
|
|
336
|
+
* anything is sent. Besides the bodies' files and addresses (see `sendEmail`), an object message id marked `prepared`
|
|
337
|
+
* would be written into the `In-Reply-To` header as it is.
|
|
338
|
+
*/
|
|
308
339
|
async replyToEmail(messageId, body, html) {
|
|
309
340
|
this.requireRunning();
|
|
310
341
|
if (!this.transporter && !this.resend)
|
|
311
342
|
throw new Error('No transport initialized');
|
|
343
|
+
(0, messageText_js_1.requireText)('messageId', messageId);
|
|
344
|
+
(0, messageText_js_1.requireText)('body', body);
|
|
345
|
+
html = (0, messageText_js_1.optionalText)('html', html);
|
|
312
346
|
// Fetch the original message to get reply headers
|
|
313
347
|
const client = await this.getImapClient();
|
|
314
348
|
let originalFrom = '';
|
package/dist/EmailService.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailService.js","sourceRoot":"","sources":["../src/EmailService.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uDAAyC;AACzC,uCAAoC;AACpC,6DAAuD;AAmEvD,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,MAAa,YAAY;IAMvB,YAAY,MAAmB;QAJvB,gBAAW,GAAkC,IAAI,CAAC;QAClD,WAAM,GAA2B,IAAI,CAAC;QACtC,YAAO,GAAG,KAAK,CAAC;QAGtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YAC5F,IAAI,CAAC,MAAM,GAAG,IAAI,oCAAe,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACtD,IAAI,C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BACD,IAAI,IAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,EAAE,CAAC;4BACvD,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;wBAC1E,CAAC;wBACD,sCAAsC;wBACtC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;oBACnE,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAEO,qBAAqB,CAAC,KAAa;QACzC,OAAO,KAAK;aACT,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,mBAAmB;aAC1C,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACvF,CAAC;IAEO,cAAc;QACpB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACrE,CAAC;CACF;AAleD,oCAkeC"}
|
|
@@ -52,7 +52,11 @@ export interface OutgoingEmail {
|
|
|
52
52
|
replyTo?: string;
|
|
53
53
|
cc?: string;
|
|
54
54
|
bcc?: string;
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Header fields added to the message, such as `In-Reply-To` and `References` for a reply. A name is printable US-ASCII
|
|
57
|
+
* with no space or colon, given once in any case, and a value a string with no line break or other control character
|
|
58
|
+
* than the tab; `send` refuses anything else before any request.
|
|
59
|
+
*/
|
|
56
60
|
headers?: Record<string, string>;
|
|
57
61
|
/**
|
|
58
62
|
* Resend's `Idempotency-Key`: a second request under the same key within 24 hours delivers nothing more. At most 256
|
|
@@ -87,12 +91,13 @@ export declare class ResendTransport {
|
|
|
87
91
|
/**
|
|
88
92
|
* Sends one message: the key read once and trimmed, then `POST /emails`, tried again on Resend's terms while the
|
|
89
93
|
* deadline allows. Throws an `Error` before any request when the key, the idempotency key or the User-Agent holds a
|
|
90
|
-
* character an HTTP header cannot carry,
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
94
|
+
* character an HTTP header cannot carry, or when the message's `headers` are not a plain object of names and values
|
|
95
|
+
* that a header field can hold (see `OutgoingEmail.headers`), with a message that names the field and none of its
|
|
96
|
+
* value; `EmailApiError` for a refusal; and what `fetch` throws for a connection that fails (`TypeError`) or the
|
|
97
|
+
* deadline (`TimeoutError`), so a caller can tell them apart. A 2xx answer always resolves, since Resend has taken the
|
|
98
|
+
* email: its `messageId` is the empty string when the answer names no id or its body cannot be read before the
|
|
99
|
+
* deadline. An attachment from a `data:` address or a file on this host is read first, before the deadline starts; a
|
|
100
|
+
* file that cannot be read throws its own error before any request.
|
|
96
101
|
*/
|
|
97
102
|
send(message: OutgoingEmail): Promise<{
|
|
98
103
|
messageId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResendTransport.d.ts","sourceRoot":"","sources":["../src/ResendTransport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"ResendTransport.d.ts","sourceRoot":"","sources":["../src/ResendTransport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4BH;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAkB,CAAC;AAK9C,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IAChC,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iGAAiG;IACjG,SAAS,CAAC,EAAE,MAAM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KG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGnG;AAyFD,0BAA0B;AAC1B,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;gBAE5B,OAAO,EAAE,aAAa;IAIlC;;;;;;;;;;OAUG;IACG,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CA0BnE"}
|
package/dist/ResendTransport.js
CHANGED
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.ResendTransport = exports.EmailApiError = exports.REMOTE_ADDRESS = void 0;
|
|
10
10
|
exports.retryWaitSeconds = retryWaitSeconds;
|
|
11
11
|
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const messageHeaders_js_1 = require("./messageHeaders.js");
|
|
12
13
|
/** Resend's API origin. */
|
|
13
14
|
const RESEND_API = 'https://api.resend.com';
|
|
14
15
|
/** The `User-Agent` sent when the caller names none: Resend refuses a request without one. */
|
|
@@ -120,8 +121,11 @@ async function attachmentOf(attachment) {
|
|
|
120
121
|
shaped.content_type = attachment.contentType;
|
|
121
122
|
return shaped;
|
|
122
123
|
}
|
|
123
|
-
/**
|
|
124
|
-
|
|
124
|
+
/**
|
|
125
|
+
* The request's JSON body: the fields Resend's send call names, and only those the message carries, with the header
|
|
126
|
+
* fields as `send` checked them.
|
|
127
|
+
*/
|
|
128
|
+
async function bodyOf(message, fields) {
|
|
125
129
|
const body = { from: message.from, to: [message.to], subject: message.subject, text: message.text };
|
|
126
130
|
if (message.html !== undefined)
|
|
127
131
|
body.html = message.html;
|
|
@@ -131,8 +135,8 @@ async function bodyOf(message) {
|
|
|
131
135
|
body.cc = message.cc;
|
|
132
136
|
if (message.bcc !== undefined)
|
|
133
137
|
body.bcc = message.bcc;
|
|
134
|
-
if (
|
|
135
|
-
body.headers =
|
|
138
|
+
if (fields !== undefined)
|
|
139
|
+
body.headers = fields;
|
|
136
140
|
if (message.attachments !== undefined && message.attachments.length > 0)
|
|
137
141
|
body.attachments = await Promise.all(message.attachments.map(attachmentOf));
|
|
138
142
|
return body;
|
|
@@ -154,12 +158,13 @@ class ResendTransport {
|
|
|
154
158
|
/**
|
|
155
159
|
* Sends one message: the key read once and trimmed, then `POST /emails`, tried again on Resend's terms while the
|
|
156
160
|
* deadline allows. Throws an `Error` before any request when the key, the idempotency key or the User-Agent holds a
|
|
157
|
-
* character an HTTP header cannot carry,
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
161
|
+
* character an HTTP header cannot carry, or when the message's `headers` are not a plain object of names and values
|
|
162
|
+
* that a header field can hold (see `OutgoingEmail.headers`), with a message that names the field and none of its
|
|
163
|
+
* value; `EmailApiError` for a refusal; and what `fetch` throws for a connection that fails (`TypeError`) or the
|
|
164
|
+
* deadline (`TimeoutError`), so a caller can tell them apart. A 2xx answer always resolves, since Resend has taken the
|
|
165
|
+
* email: its `messageId` is the empty string when the answer names no id or its body cannot be read before the
|
|
166
|
+
* deadline. An attachment from a `data:` address or a file on this host is read first, before the deadline starts; a
|
|
167
|
+
* file that cannot be read throws its own error before any request.
|
|
163
168
|
*/
|
|
164
169
|
async send(message) {
|
|
165
170
|
// String() keeps the coercion a template literal gave a key answered outside TypeScript, such as a Buffer.
|
|
@@ -169,7 +174,9 @@ class ResendTransport {
|
|
|
169
174
|
requireHeaderValue(userAgent, 'The User-Agent');
|
|
170
175
|
if (message.idempotencyKey !== undefined)
|
|
171
176
|
requireHeaderValue(message.idempotencyKey, 'The idempotency key');
|
|
172
|
-
|
|
177
|
+
// The message's own header fields, read once and checked, so the fields checked are the fields sent.
|
|
178
|
+
const fields = (0, messageHeaders_js_1.requireHeaders)(message.headers);
|
|
179
|
+
const body = JSON.stringify(await bodyOf(message, fields));
|
|
173
180
|
const timeoutMs = this.options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
174
181
|
const maxRetries = this.options.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
175
182
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResendTransport.js","sourceRoot":"","sources":["../src/ResendTransport.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"ResendTransport.js","sourceRoot":"","sources":["../src/ResendTransport.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA4HH,4CAGC;AA7HD,+CAA4C;AAC5C,2DAAqD;AAErD,2BAA2B;AAC3B,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAE5C,8FAA8F;AAC9F,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAEvD,yGAAyG;AACzG,MAAM,kBAAkB,GAAG,KAAM,CAAC;AAElC,0EAA0E;AAC1E,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,iHAAiH;AACjH,MAAM,UAAU,GAAG,yBAAyB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAEzD;;;GAGG;AACU,QAAA,cAAc,GAAG,eAAe,CAAC;AAE9C,uEAAuE;AACvE,MAAM,YAAY,GAAG,SAAS,CAAC;AA6D/B,oIAAoI;AACpI,MAAa,aAAc,SAAQ,KAAK;IAatC,YAAY,MAAc,EAAE,IAAY,EAAE,iBAAgC;QACxE,KAAK,CAAC,iCAAiC,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;QAb3D,2BAA2B;QAClB,SAAI,GAAG,eAAe,CAAC;QAa9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;CACF;AAnBD,s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G,CAAC,GAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACjC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;YAC9F,IAAI,MAAM,CAAC,EAAE;gBAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/D,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC;YACtC,MAAM,IAAI,GAAG,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAClH,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,IAAI,QAAQ;gBAAE,MAAM,KAAK,CAAC;YACvE,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;CACF;AA5CD,0CA4CC"}
|
|
@@ -3,21 +3,37 @@
|
|
|
3
3
|
* whose arguments a model writes. `EmailService.sendEmail` reads a file path on this host, and through SMTP fetches an
|
|
4
4
|
* `http:` or `https:` address from this host, so text that steers an agent could have it mail any file the process can
|
|
5
5
|
* read, or the answer of an address only this host reaches. The two surfaces pass on only what neither transport reads
|
|
6
|
-
* or fetches here.
|
|
6
|
+
* or fetches here, and they send the copy the check made, so what is sent is what was checked.
|
|
7
7
|
*/
|
|
8
|
+
/** One attachment as the check read it: its own values, each read once, with a Buffer's bytes copied. */
|
|
9
|
+
export interface CheckedAttachment {
|
|
10
|
+
/** The name the message gives the file. */
|
|
11
|
+
filename?: string;
|
|
12
|
+
/** The file's content: text, or a new Buffer holding the bytes the caller gave. */
|
|
13
|
+
content?: string | Buffer;
|
|
14
|
+
/** A `data:` address, or an `http(s)` address when the service sends through Resend. */
|
|
15
|
+
path?: string;
|
|
16
|
+
/** The content's type; the transport works it out from the filename or the path when it is not given. */
|
|
17
|
+
contentType?: string;
|
|
18
|
+
}
|
|
8
19
|
/**
|
|
9
|
-
*
|
|
10
|
-
* anything is sent and without reading the file or fetching
|
|
11
|
-
*
|
|
12
|
-
*
|
|
20
|
+
* Checks the attachments an agent named and returns the copies the surface sends, or throws an `Error` when one would
|
|
21
|
+
* make this process read a file or fetch an address, before anything is sent and without reading the file or fetching
|
|
22
|
+
* the address. Each attachment must be an object, and the check reads its own `filename`, `content`, `path` and
|
|
23
|
+
* `contentType` once each, refusing one given through a getter or a setter: a copy holds those values alone, so a value
|
|
24
|
+
* read again later, or any other property, never reaches a transport. An attachment passes when its `content`, if
|
|
25
|
+
* given, is a string or a Buffer (copied into a new Buffer), its `path`, if given, is a `data:` address, or an `http:`
|
|
26
|
+
* or `https:` address while the service sends through Resend, whose servers fetch it, and its `filename` and
|
|
27
|
+
* `contentType`, if given, are strings (`null` leaves either out). A path is checked even next to `content`, since
|
|
13
28
|
* nodemailer reads `path` first, and `content` of any other kind is refused, since nodemailer reads the `path` or
|
|
14
29
|
* fetches the `href` of a content object. The message names the attachment's `filename`, or its place in the list when
|
|
15
30
|
* it has none, and the rule, never its path.
|
|
16
31
|
*
|
|
17
|
-
* @param attachments The attachments as the surface took them. `undefined` or `null` passes
|
|
18
|
-
* send. Any other value that is not a list is refused, since nodemailer takes a single attachment object
|
|
19
|
-
* one and reads its `path`.
|
|
32
|
+
* @param attachments The attachments as the surface took them. `undefined` or `null` passes as `undefined`, since there
|
|
33
|
+
* is nothing to send. Any other value that is not a list is refused, since nodemailer takes a single attachment object
|
|
34
|
+
* as a list of one and reads its `path`.
|
|
20
35
|
* @param throughResend Whether the service sends through Resend, as `EmailService.transport` tells.
|
|
36
|
+
* @returns The copies, in the order given, or `undefined` for no attachments.
|
|
21
37
|
*/
|
|
22
|
-
export declare function requireAgentAttachments(attachments: unknown, throughResend: boolean):
|
|
38
|
+
export declare function requireAgentAttachments(attachments: unknown, throughResend: boolean): CheckedAttachment[] | undefined;
|
|
23
39
|
//# sourceMappingURL=agentAttachments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentAttachments.d.ts","sourceRoot":"","sources":["../src/agentAttachments.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"agentAttachments.d.ts","sourceRoot":"","sources":["../src/agentAttachments.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,yGAAyG;AACzG,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yGAAyG;IACzG,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA8CD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,iBAAiB,EAAE,GAAG,SAAS,CAMrH"}
|
package/dist/agentAttachments.js
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* whose arguments a model writes. `EmailService.sendEmail` reads a file path on this host, and through SMTP fetches an
|
|
5
5
|
* `http:` or `https:` address from this host, so text that steers an agent could have it mail any file the process can
|
|
6
6
|
* read, or the answer of an address only this host reaches. The two surfaces pass on only what neither transport reads
|
|
7
|
-
* or fetches here.
|
|
7
|
+
* or fetches here, and they send the copy the check made, so what is sent is what was checked.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.requireAgentAttachments = requireAgentAttachments;
|
|
11
|
+
const node_util_1 = require("node:util");
|
|
11
12
|
const ResendTransport_js_1 = require("./ResendTransport.js");
|
|
12
13
|
/**
|
|
13
14
|
* A `data:` address up to the comma that ends its header. nodemailer decodes a path only in this form, with `data:` in
|
|
@@ -18,33 +19,86 @@ const DATA_ADDRESS = /^data:[^,]*,/;
|
|
|
18
19
|
const THROUGH_RESEND = 'an attachment takes its content as a string, a data: address or an http(s) address; files on this machine are not read';
|
|
19
20
|
/** The rule a refusal names when the service sends through SMTP. */
|
|
20
21
|
const THROUGH_SMTP = 'through SMTP an attachment takes its content as a string or a data: address; files on this machine are not read and addresses are not fetched';
|
|
22
|
+
/** The properties the check reads from an attachment and copies, in this order; any other property is left out. */
|
|
23
|
+
const COPIED = ['filename', 'content', 'path', 'contentType'];
|
|
24
|
+
/** The error a refusal throws: it names the attachment and the reason, never a path. */
|
|
25
|
+
function refused(named, reason) {
|
|
26
|
+
return new Error(`The attachment ${named} was refused: ${reason}`);
|
|
27
|
+
}
|
|
28
|
+
/** Checks one attachment and returns its copy, or throws the refusal. */
|
|
29
|
+
function checkOne(attachment, index, throughResend) {
|
|
30
|
+
let named = `number ${index + 1}`;
|
|
31
|
+
if (typeof attachment !== 'object' || attachment === null || Array.isArray(attachment)) {
|
|
32
|
+
throw refused(named, 'give it as an object');
|
|
33
|
+
}
|
|
34
|
+
const own = {};
|
|
35
|
+
for (const field of COPIED) {
|
|
36
|
+
// An own data property is read once here; a getter could answer this check one value and the send another.
|
|
37
|
+
const descriptor = Object.getOwnPropertyDescriptor(attachment, field);
|
|
38
|
+
if (descriptor === undefined)
|
|
39
|
+
continue;
|
|
40
|
+
if (!('value' in descriptor)) {
|
|
41
|
+
throw refused(named, `give its ${field} as a value, not through a getter or a setter`);
|
|
42
|
+
}
|
|
43
|
+
own[field] = descriptor.value;
|
|
44
|
+
if (field === 'filename' && typeof own.filename === 'string' && own.filename !== '') {
|
|
45
|
+
named = JSON.stringify(own.filename);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const { filename, content, path, contentType } = own;
|
|
49
|
+
const rule = throughResend ? THROUGH_RESEND : THROUGH_SMTP;
|
|
50
|
+
const copy = {};
|
|
51
|
+
if (typeof filename === 'string')
|
|
52
|
+
copy.filename = filename;
|
|
53
|
+
else if (filename !== undefined && filename !== null)
|
|
54
|
+
throw refused(named, 'give its filename as a string');
|
|
55
|
+
// nodemailer reads the path of any content object, a Buffer's own included, so a Buffer is copied into a new one.
|
|
56
|
+
if (typeof content === 'string')
|
|
57
|
+
copy.content = content;
|
|
58
|
+
else if (Buffer.isBuffer(content) && node_util_1.types.isUint8Array(content))
|
|
59
|
+
copy.content = Buffer.from(content);
|
|
60
|
+
else if (content !== undefined)
|
|
61
|
+
throw refused(named, rule);
|
|
62
|
+
if (typeof path === 'string' && (DATA_ADDRESS.test(path) || (throughResend && ResendTransport_js_1.REMOTE_ADDRESS.test(path)))) {
|
|
63
|
+
copy.path = path;
|
|
64
|
+
}
|
|
65
|
+
else if (path !== undefined) {
|
|
66
|
+
throw refused(named, rule);
|
|
67
|
+
}
|
|
68
|
+
// nodemailer writes an object header value marked `prepared` into the part's headers as it is.
|
|
69
|
+
if (typeof contentType === 'string')
|
|
70
|
+
copy.contentType = contentType;
|
|
71
|
+
else if (contentType !== undefined && contentType !== null)
|
|
72
|
+
throw refused(named, 'give its contentType as a string');
|
|
73
|
+
return copy;
|
|
74
|
+
}
|
|
21
75
|
/**
|
|
22
|
-
*
|
|
23
|
-
* anything is sent and without reading the file or fetching
|
|
24
|
-
*
|
|
25
|
-
*
|
|
76
|
+
* Checks the attachments an agent named and returns the copies the surface sends, or throws an `Error` when one would
|
|
77
|
+
* make this process read a file or fetch an address, before anything is sent and without reading the file or fetching
|
|
78
|
+
* the address. Each attachment must be an object, and the check reads its own `filename`, `content`, `path` and
|
|
79
|
+
* `contentType` once each, refusing one given through a getter or a setter: a copy holds those values alone, so a value
|
|
80
|
+
* read again later, or any other property, never reaches a transport. An attachment passes when its `content`, if
|
|
81
|
+
* given, is a string or a Buffer (copied into a new Buffer), its `path`, if given, is a `data:` address, or an `http:`
|
|
82
|
+
* or `https:` address while the service sends through Resend, whose servers fetch it, and its `filename` and
|
|
83
|
+
* `contentType`, if given, are strings (`null` leaves either out). A path is checked even next to `content`, since
|
|
26
84
|
* nodemailer reads `path` first, and `content` of any other kind is refused, since nodemailer reads the `path` or
|
|
27
85
|
* fetches the `href` of a content object. The message names the attachment's `filename`, or its place in the list when
|
|
28
86
|
* it has none, and the rule, never its path.
|
|
29
87
|
*
|
|
30
|
-
* @param attachments The attachments as the surface took them. `undefined` or `null` passes
|
|
31
|
-
* send. Any other value that is not a list is refused, since nodemailer takes a single attachment object
|
|
32
|
-
* one and reads its `path`.
|
|
88
|
+
* @param attachments The attachments as the surface took them. `undefined` or `null` passes as `undefined`, since there
|
|
89
|
+
* is nothing to send. Any other value that is not a list is refused, since nodemailer takes a single attachment object
|
|
90
|
+
* as a list of one and reads its `path`.
|
|
33
91
|
* @param throughResend Whether the service sends through Resend, as `EmailService.transport` tells.
|
|
92
|
+
* @returns The copies, in the order given, or `undefined` for no attachments.
|
|
34
93
|
*/
|
|
35
94
|
function requireAgentAttachments(attachments, throughResend) {
|
|
36
95
|
if (attachments === undefined || attachments === null)
|
|
37
|
-
return;
|
|
96
|
+
return undefined;
|
|
38
97
|
if (!Array.isArray(attachments))
|
|
39
98
|
throw new Error('The attachments were refused: give them as a list');
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (contentPasses && pathPasses)
|
|
45
|
-
continue;
|
|
46
|
-
const named = typeof filename === 'string' && filename !== '' ? JSON.stringify(filename) : `number ${index + 1}`;
|
|
47
|
-
throw new Error(`The attachment ${named} was refused: ${throughResend ? THROUGH_RESEND : THROUGH_SMTP}`);
|
|
48
|
-
}
|
|
99
|
+
const checked = [];
|
|
100
|
+
for (const [index, attachment] of attachments.entries())
|
|
101
|
+
checked.push(checkOne(attachment, index, throughResend));
|
|
102
|
+
return checked;
|
|
49
103
|
}
|
|
50
104
|
//# sourceMappingURL=agentAttachments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentAttachments.js","sourceRoot":"","sources":["../src/agentAttachments.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"agentAttachments.js","sourceRoot":"","sources":["../src/agentAttachments.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAgGH,0DAMC;AApGD,yCAAkC;AAClC,6DAAsD;AAEtD;;;GAGG;AACH,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC,sEAAsE;AACtE,MAAM,cAAc,GAAG,wHAAwH,CAAC;AAEhJ,oEAAoE;AACpE,MAAM,YAAY,GAChB,+IAA+I,CAAC;AAElJ,mHAAmH;AACnH,MAAM,MAAM,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,CAAU,CAAC;AAcvE,wFAAwF;AACxF,SAAS,OAAO,CAAC,KAAa,EAAE,MAAc;IAC5C,OAAO,IAAI,KAAK,CAAC,kBAAkB,KAAK,iBAAiB,MAAM,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,yEAAyE;AACzE,SAAS,QAAQ,CAAC,UAAmB,EAAE,KAAa,EAAE,aAAsB;IAC1E,IAAI,KAAK,GAAG,UAAU,KAAK,GAAG,CAAC,EAAE,CAAC;IAClC,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACvF,MAAM,OAAO,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,GAAG,GAAqF,EAAE,CAAC;IACjG,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,2GAA2G;QAC3G,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAA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CAAC,CAAC;IAC3D,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,mCAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1G,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;SAAM,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,+FAA+F;IAC/F,IAAI,OAAO,WAAW,KAAK,QAAQ;QAAE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;SAC/D,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI;QAAE,MAAM,OAAO,CAAC,KAAK,EAAE,kCAAkC,CAAC,CAAC;IACrH,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,uBAAuB,CAAC,WAAoB,EAAE,aAAsB;IAClF,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACxE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACtG,MAAM,OAAO,GAAwB,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE;QAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IAClH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The check of the header fields a message carries beside its own: `EmailService.sendEmail` runs it on
|
|
3
|
+
* `SendEmailOptions.headers` before either transport is used, and `ResendTransport.send` on `OutgoingEmail.headers`
|
|
4
|
+
* before any request. A name must be RFC 5322's and a value a string with no line break or other control character, so
|
|
5
|
+
* nothing given can end one field and start another. nodemailer turns a line break in a string value into a space, but
|
|
6
|
+
* writes an object value marked `prepared` into the message as it is; Resend's API takes the fields as JSON and documents
|
|
7
|
+
* no check of its own.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Checks the header fields a message carries and returns them as read, or throws an `Error` before anything is sent.
|
|
11
|
+
* `undefined` and `null` pass as `undefined`, and so does an object with no fields, since there is nothing to add. Any
|
|
12
|
+
* other value must be a plain object of names and values, whose own fields are read once each, in order: a name must be
|
|
13
|
+
* printable US-ASCII with no space or colon, and differ in more than case from every name before it; a value must be a
|
|
14
|
+
* string holding no control character other than the tab, and no line or paragraph separator. The error names the
|
|
15
|
+
* field, or its place when the name is at fault, and none of its value.
|
|
16
|
+
*
|
|
17
|
+
* @param headers The fields as the caller gave them.
|
|
18
|
+
* @returns A new object holding the fields as they were read, or `undefined` for none.
|
|
19
|
+
*/
|
|
20
|
+
export declare function requireHeaders(headers: unknown): Record<string, string> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* `requireHeaders` for the fields a caller adds to `EmailService.sendEmail`, which also refuses, in any case, a field the
|
|
23
|
+
* service writes itself: `From`, `To`, `Cc`, `Bcc`, `Reply-To`, `Subject`, `Date`, `Message-ID`, `MIME-Version` and any
|
|
24
|
+
* `Content-` field. An added field never replaces one of the service's, and the refusal says so, where nodemailer would
|
|
25
|
+
* keep one of the two in silence.
|
|
26
|
+
*
|
|
27
|
+
* @param headers The fields as the caller gave them.
|
|
28
|
+
* @returns A new object holding the fields as they were read, or `undefined` for none.
|
|
29
|
+
*/
|
|
30
|
+
export declare function requireAddedHeaders(headers: unknown): Record<string, string> | undefined;
|
|
31
|
+
//# sourceMappingURL=messageHeaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageHeaders.d.ts","sourceRoot":"","sources":["../src/messageHeaders.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuDH;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAEnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAExF"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview The check of the header fields a message carries beside its own: `EmailService.sendEmail` runs it on
|
|
4
|
+
* `SendEmailOptions.headers` before either transport is used, and `ResendTransport.send` on `OutgoingEmail.headers`
|
|
5
|
+
* before any request. A name must be RFC 5322's and a value a string with no line break or other control character, so
|
|
6
|
+
* nothing given can end one field and start another. nodemailer turns a line break in a string value into a space, but
|
|
7
|
+
* writes an object value marked `prepared` into the message as it is; Resend's API takes the fields as JSON and documents
|
|
8
|
+
* no check of its own.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.requireHeaders = requireHeaders;
|
|
12
|
+
exports.requireAddedHeaders = requireAddedHeaders;
|
|
13
|
+
/** A field name: printable US-ASCII characters other than the colon, at least one (RFC 5322 section 2.2). */
|
|
14
|
+
const FIELD_NAME = /^[\x21-\x39\x3b-\x7e]+$/;
|
|
15
|
+
/**
|
|
16
|
+
* A character no value may hold: a control character other than the tab, CR and LF among them, which RFC 5322 section
|
|
17
|
+
* 2.2 keeps out of a field body except to fold it, and the Unicode line and paragraph separators, which some readers take
|
|
18
|
+
* for a line break.
|
|
19
|
+
*/
|
|
20
|
+
const NOT_IN_A_VALUE = /[\x00-\x08\x0a-\x1f\x7f-\x9f\u2028\u2029]/;
|
|
21
|
+
/**
|
|
22
|
+
* The fields `EmailService.sendEmail` writes into a message itself, in lowercase: `From`, `To` and `Subject` always,
|
|
23
|
+
* `Cc`, `Bcc` and `Reply-To` from its options, and `Date`, `Message-ID` and `MIME-Version`, which each transport writes.
|
|
24
|
+
*/
|
|
25
|
+
const WRITTEN_BY_THE_SERVICE = new Set(['from', 'to', 'cc', 'bcc', 'reply-to', 'subject', 'date', 'message-id', 'mime-version']);
|
|
26
|
+
/** A MIME field of the body, such as `Content-Type`, which each transport writes for the body it composes. */
|
|
27
|
+
const CONTENT_FIELD = /^content-/i;
|
|
28
|
+
/** The error a refusal throws: it names the field, or its place when the name is at fault, and never its value. */
|
|
29
|
+
function refused(named, reason) {
|
|
30
|
+
return new Error(`The header ${named} was refused: ${reason}`);
|
|
31
|
+
}
|
|
32
|
+
/** The check both exports run; `refuseWritten` adds the rule against the fields the service writes. */
|
|
33
|
+
function checkedFields(headers, refuseWritten) {
|
|
34
|
+
if (headers === undefined || headers === null)
|
|
35
|
+
return undefined;
|
|
36
|
+
const prototype = typeof headers === 'object' ? Object.getPrototypeOf(headers) : undefined;
|
|
37
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
38
|
+
throw new Error('The headers were refused: give them as an object of names and values');
|
|
39
|
+
}
|
|
40
|
+
const fields = [];
|
|
41
|
+
const earlier = new Map();
|
|
42
|
+
// Each value is read here once, so a getter cannot answer this check one value and a transport another.
|
|
43
|
+
for (const [place, [name, value]] of Object.entries(headers).entries()) {
|
|
44
|
+
if (!FIELD_NAME.test(name)) {
|
|
45
|
+
throw refused(`number ${place + 1}`, 'give its name as printable US-ASCII characters with no space or colon');
|
|
46
|
+
}
|
|
47
|
+
const named = JSON.stringify(name);
|
|
48
|
+
const lowercase = name.toLowerCase();
|
|
49
|
+
const same = earlier.get(lowercase);
|
|
50
|
+
if (same !== undefined)
|
|
51
|
+
throw refused(named, `it names the same field as ${JSON.stringify(same)}`);
|
|
52
|
+
earlier.set(lowercase, name);
|
|
53
|
+
if (refuseWritten && (WRITTEN_BY_THE_SERVICE.has(lowercase) || CONTENT_FIELD.test(name))) {
|
|
54
|
+
throw refused(named, 'the service writes that field itself');
|
|
55
|
+
}
|
|
56
|
+
if (typeof value !== 'string')
|
|
57
|
+
throw refused(named, 'give its value as a string');
|
|
58
|
+
if (NOT_IN_A_VALUE.test(value))
|
|
59
|
+
throw refused(named, 'its value holds a line break or another control character');
|
|
60
|
+
fields.push([name, value]);
|
|
61
|
+
}
|
|
62
|
+
return fields.length > 0 ? Object.fromEntries(fields) : undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Checks the header fields a message carries and returns them as read, or throws an `Error` before anything is sent.
|
|
66
|
+
* `undefined` and `null` pass as `undefined`, and so does an object with no fields, since there is nothing to add. Any
|
|
67
|
+
* other value must be a plain object of names and values, whose own fields are read once each, in order: a name must be
|
|
68
|
+
* printable US-ASCII with no space or colon, and differ in more than case from every name before it; a value must be a
|
|
69
|
+
* string holding no control character other than the tab, and no line or paragraph separator. The error names the
|
|
70
|
+
* field, or its place when the name is at fault, and none of its value.
|
|
71
|
+
*
|
|
72
|
+
* @param headers The fields as the caller gave them.
|
|
73
|
+
* @returns A new object holding the fields as they were read, or `undefined` for none.
|
|
74
|
+
*/
|
|
75
|
+
function requireHeaders(headers) {
|
|
76
|
+
return checkedFields(headers, false);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `requireHeaders` for the fields a caller adds to `EmailService.sendEmail`, which also refuses, in any case, a field the
|
|
80
|
+
* service writes itself: `From`, `To`, `Cc`, `Bcc`, `Reply-To`, `Subject`, `Date`, `Message-ID`, `MIME-Version` and any
|
|
81
|
+
* `Content-` field. An added field never replaces one of the service's, and the refusal says so, where nodemailer would
|
|
82
|
+
* keep one of the two in silence.
|
|
83
|
+
*
|
|
84
|
+
* @param headers The fields as the caller gave them.
|
|
85
|
+
* @returns A new object holding the fields as they were read, or `undefined` for none.
|
|
86
|
+
*/
|
|
87
|
+
function requireAddedHeaders(headers) {
|
|
88
|
+
return checkedFields(headers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MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAC7C,OAAO,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,OAAgB;IAClD,OAAO,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The check that a message's subject, its bodies and the message id a reply names are text, which
|
|
3
|
+
* `EmailService.sendEmail` and `EmailService.replyToEmail` run before either transport sees them. nodemailer takes an
|
|
4
|
+
* object as a body and reads the file its `path` names, or fetches the address its `href` names, into the message,
|
|
5
|
+
* and it writes an object header value marked `prepared` into the message as it is, line breaks included. A model
|
|
6
|
+
* writes the tools' arguments and the channel's blocks as JSON, so such an object reaches the service whatever the
|
|
7
|
+
* TypeScript types say.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Returns `value` when it is a string, and otherwise throws a `TypeError` that names `field` and never the value.
|
|
11
|
+
*
|
|
12
|
+
* @param field The field's name as the caller wrote it, such as `body`.
|
|
13
|
+
* @param value The value the caller gave.
|
|
14
|
+
*/
|
|
15
|
+
export declare function requireText(field: string, value: unknown): string;
|
|
16
|
+
/**
|
|
17
|
+
* Returns `value` when it is a string and `undefined` when it is `undefined` or `null`, which nodemailer leaves out as
|
|
18
|
+
* no part, and otherwise throws a `TypeError` that names `field` and never the value.
|
|
19
|
+
*
|
|
20
|
+
* @param field The field's name as the caller wrote it, such as `html`.
|
|
21
|
+
* @param value The value the caller gave.
|
|
22
|
+
*/
|
|
23
|
+
export declare function optionalText(field: string, value: unknown): string | undefined;
|
|
24
|
+
//# sourceMappingURL=messageText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageText.d.ts","sourceRoot":"","sources":["../src/messageText.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAGjE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI9E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview The check that a message's subject, its bodies and the message id a reply names are text, which
|
|
4
|
+
* `EmailService.sendEmail` and `EmailService.replyToEmail` run before either transport sees them. nodemailer takes an
|
|
5
|
+
* object as a body and reads the file its `path` names, or fetches the address its `href` names, into the message,
|
|
6
|
+
* and it writes an object header value marked `prepared` into the message as it is, line breaks included. A model
|
|
7
|
+
* writes the tools' arguments and the channel's blocks as JSON, so such an object reaches the service whatever the
|
|
8
|
+
* TypeScript types say.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.requireText = requireText;
|
|
12
|
+
exports.optionalText = optionalText;
|
|
13
|
+
/**
|
|
14
|
+
* Returns `value` when it is a string, and otherwise throws a `TypeError` that names `field` and never the value.
|
|
15
|
+
*
|
|
16
|
+
* @param field The field's name as the caller wrote it, such as `body`.
|
|
17
|
+
* @param value The value the caller gave.
|
|
18
|
+
*/
|
|
19
|
+
function requireText(field, value) {
|
|
20
|
+
if (typeof value === 'string')
|
|
21
|
+
return value;
|
|
22
|
+
throw new TypeError(`The ${field} was refused: give it as a string`);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns `value` when it is a string and `undefined` when it is `undefined` or `null`, which nodemailer leaves out as
|
|
26
|
+
* no part, and otherwise throws a `TypeError` that names `field` and never the value.
|
|
27
|
+
*
|
|
28
|
+
* @param field The field's name as the caller wrote it, such as `html`.
|
|
29
|
+
* @param value The value the caller gave.
|
|
30
|
+
*/
|
|
31
|
+
function optionalText(field, value) {
|
|
32
|
+
if (value === undefined || value === null)
|
|
33
|
+
return undefined;
|
|
34
|
+
if (typeof value === 'string')
|
|
35
|
+
return value;
|
|
36
|
+
throw new TypeError(`The ${field} was refused: give it as a string or leave it out`);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=messageText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageText.js","sourceRoot":"","sources":["../src/messageText.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAQH,kCAGC;AASD,oCAIC;AAtBD;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,KAAa,EAAE,KAAc;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,IAAI,SAAS,CAAC,OAAO,KAAK,mCAAmC,CAAC,CAAC;AACvE,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,KAAa,EAAE,KAAc;IACxD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,IAAI,SAAS,CAAC,OAAO,KAAK,mDAAmD,CAAC,CAAC;AACvF,CAAC"}
|
package/dist/tools/reply.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ export declare class EmailReplyTool {
|
|
|
27
27
|
required: string[];
|
|
28
28
|
};
|
|
29
29
|
constructor(service: EmailService);
|
|
30
|
+
/**
|
|
31
|
+
* Sends the reply through `EmailService.replyToEmail`. A `messageId` or `body` that is not a string, or an `html`
|
|
32
|
+
* that is given and is not one, is refused before the original is read or anything is sent, with
|
|
33
|
+
* `{ success: false, error }` naming the field.
|
|
34
|
+
*/
|
|
30
35
|
execute(args: {
|
|
31
36
|
messageId: string;
|
|
32
37
|
body: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../src/tools/reply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,qBAAa,cAAc;IAmBb,OAAO,CAAC,OAAO;IAlB3B,QAAQ,CAAC,EAAE,gBAAgB;IAC3B,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,WAAW,oBAAoB;IACxC,QAAQ,CAAC,WAAW,gHAAgH;IACpI,QAAQ,CAAC,QAAQ,mBAAmB;IACpC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,QAAQ;IAE/B,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;MAQlB;gBAEkB,OAAO,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../src/tools/reply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,qBAAa,cAAc;IAmBb,OAAO,CAAC,OAAO;IAlB3B,QAAQ,CAAC,EAAE,gBAAgB;IAC3B,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,WAAW,oBAAoB;IACxC,QAAQ,CAAC,WAAW,gHAAgH;IACpI,QAAQ,CAAC,QAAQ,mBAAmB;IACpC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,QAAQ;IAE/B,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;MAQlB;gBAEkB,OAAO,EAAE,YAAY;IAEzC;;;;OAIG;IACG,OAAO,CAAC,IAAI,EAAE;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAQ9D"}
|
package/dist/tools/reply.js
CHANGED
|
@@ -21,6 +21,11 @@ class EmailReplyTool {
|
|
|
21
21
|
required: ['messageId', 'body'],
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Sends the reply through `EmailService.replyToEmail`. A `messageId` or `body` that is not a string, or an `html`
|
|
26
|
+
* that is given and is not one, is refused before the original is read or anything is sent, with
|
|
27
|
+
* `{ success: false, error }` naming the field.
|
|
28
|
+
*/
|
|
24
29
|
async execute(args) {
|
|
25
30
|
try {
|
|
26
31
|
const result = await this.service.replyToEmail(args.messageId, args.body, args.html);
|
package/dist/tools/reply.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reply.js","sourceRoot":"","sources":["../../src/tools/reply.ts"],"names":[],"mappings":";;;AAGA,MAAa,cAAc;IAmBzB,YAAoB,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QAlBhC,OAAE,GAAG,YAAY,CAAC;QAClB,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,gBAAW,GAAG,4GAA4G,CAAC;QAC3H,aAAQ,GAAG,eAAe,CAAC;QAC3B,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,IAAI,CAAC;QAEtB,gBAAW,GAAG;YACrB,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;gBACjF,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE;gBAC9D,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;aAClE;YACD,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,CA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CAAC,OAAO,CAAC,IAIb;QACC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACrF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AAtCD,wCAsCC"}
|
package/dist/tools/send.d.ts
CHANGED
|
@@ -53,7 +53,11 @@ export declare class EmailSendTool {
|
|
|
53
53
|
constructor(service: EmailService);
|
|
54
54
|
/**
|
|
55
55
|
* Sends the email. An attachment passes only as `content`, a `data:` address or, through Resend, an `http(s)`
|
|
56
|
-
* address: any other is refused before anything is sent, with `{ success: false, error }` naming its filename
|
|
56
|
+
* address: any other is refused before anything is sent, with `{ success: false, error }` naming its filename, and
|
|
57
|
+
* what is sent is the copy `requireAgentAttachments` made of each attachment's own `filename`, `content`, `path`
|
|
58
|
+
* and `contentType`. A `subject` or `body` that is not a string, or an `html` that is given and is not one, is
|
|
59
|
+
* refused the same way, with an error naming the field, since `EmailService.sendEmail` checks them before either
|
|
60
|
+
* transport is used.
|
|
57
61
|
*/
|
|
58
62
|
execute(args: {
|
|
59
63
|
to: string;
|
package/dist/tools/send.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/tools/send.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,qBAAa,aAAa;IAgCZ,OAAO,CAAC,OAAO;IA/B3B,QAAQ,CAAC,EAAE,eAAe;IAC1B,QAAQ,CAAC,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AG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAe9D"}
|
package/dist/tools/send.js
CHANGED
|
@@ -37,17 +37,21 @@ class EmailSendTool {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Sends the email. An attachment passes only as `content`, a `data:` address or, through Resend, an `http(s)`
|
|
40
|
-
* address: any other is refused before anything is sent, with `{ success: false, error }` naming its filename
|
|
40
|
+
* address: any other is refused before anything is sent, with `{ success: false, error }` naming its filename, and
|
|
41
|
+
* what is sent is the copy `requireAgentAttachments` made of each attachment's own `filename`, `content`, `path`
|
|
42
|
+
* and `contentType`. A `subject` or `body` that is not a string, or an `html` that is given and is not one, is
|
|
43
|
+
* refused the same way, with an error naming the field, since `EmailService.sendEmail` checks them before either
|
|
44
|
+
* transport is used.
|
|
41
45
|
*/
|
|
42
46
|
async execute(args) {
|
|
43
47
|
try {
|
|
44
|
-
(0, agentAttachments_js_1.requireAgentAttachments)(args.attachments, this.service.transport === 'resend');
|
|
48
|
+
const attachments = (0, agentAttachments_js_1.requireAgentAttachments)(args.attachments, this.service.transport === 'resend');
|
|
45
49
|
const result = await this.service.sendEmail({
|
|
46
50
|
to: args.to,
|
|
47
51
|
subject: args.subject,
|
|
48
52
|
body: args.body,
|
|
49
53
|
html: args.html,
|
|
50
|
-
attachments
|
|
54
|
+
attachments,
|
|
51
55
|
});
|
|
52
56
|
return { success: true, data: result };
|
|
53
57
|
}
|
package/dist/tools/send.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../src/tools/send.ts"],"names":[],"mappings":";;;AAEA,gEAAiE;AAEjE,MAAa,aAAa;IAgCxB,YAAoB,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QA/BhC,OAAE,GAAG,WAAW,CAAC;QACjB,SAAI,GAAG,WAAW,CAAC;QACnB,gBAAW,GAAG,YAAY,CAAC;QAC3B,gBAAW,GAAG,+FA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,IAAI,CAAC,OAAO;gBACrB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW;aACZ,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AA/DD,sCA+DC"}
|
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
|
|
3
3
|
"id": "com.framers.channels.email",
|
|
4
4
|
"name": "Email Channel Extension",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.3.0",
|
|
6
6
|
"description": "Bidirectional email integration: send through SMTP or Resend's HTTPS API, and read, search, extract verification codes and reply through IMAP.",
|
|
7
7
|
"categories": ["channel", "communication"],
|
|
8
8
|
"platforms": ["email"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framers/agentos-ext-channel-email",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Email channel adapter for AgentOS: send through SMTP or Resend's HTTPS API, and read, search, extract codes and reply through IMAP.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@types/node": "^20.0.0",
|
|
26
26
|
"typescript": "^5.0.0",
|
|
27
27
|
"vitest": "^3.2.7",
|
|
28
|
-
"@framers/agentos": "^0.13.
|
|
28
|
+
"@framers/agentos": "^0.13.134"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|