agents
Version:
A home for your AI agents
96 lines (94 loc) • 3.07 kB
TypeScript
import {
F as ChannelMessageSurface,
I as ChannelMessageSurfaceInput,
S as ChannelEmailIngress,
d as ChannelRoute,
n as Channel
} from "../channel-Bnm4S7T2.js";
import { Email } from "postal-mime";
//#region src/channels/adapters/email/email-surface.d.ts
type EmailSurfaceAddress =
| string
| {
email: string;
name: string;
};
type EmailSurfaceRecipients =
| EmailSurfaceAddress
| readonly EmailSurfaceAddress[];
type EmailMessageAddress = {
from: EmailSurfaceAddress;
to: EmailSurfaceRecipients;
replyTo?: EmailSurfaceAddress;
cc?: EmailSurfaceRecipients;
bcc?: EmailSurfaceRecipients;
headers?: Readonly<Record<string, string>>;
subject?: string;
inReplyTo?: string;
references?: readonly string[];
};
type EmailMessageSurface = ChannelMessageSurface<string, EmailMessageAddress>;
type EmailMessageSurfaceInput = ChannelMessageSurfaceInput<EmailMessageAddress>;
//#endregion
//#region src/channels/adapters/email/inbound-email.d.ts
/** Parsed, provider-specific email retained while selecting an application route. */
type InboundEmailRaw = Email;
type InboundEmailOptions = {
/** Only accept messages delivered to this address. */ to?: string /** Only accept these envelope senders. */;
from?:
| string
| readonly string[] /** Outbound sender to retain in normalized reply surfaces. */;
replyFrom?: EmailSurfaceAddress;
};
/** Parse Workers Email events into normalized Channel ingress events. */
declare function inboundEmail(
options?: InboundEmailOptions
): ChannelEmailIngress<InboundEmailRaw>;
//#endregion
//#region src/channels/adapters/email/email.d.ts
type EmailAddress = EmailSurfaceAddress;
type EmailRecipients = EmailSurfaceRecipients;
type ChannelEmailMessage = {
from: EmailAddress;
to: EmailAddress | EmailAddress[];
subject: string;
text: string;
replyTo?: EmailAddress;
cc?: EmailAddress | EmailAddress[];
bcc?: EmailAddress | EmailAddress[];
headers?: Record<string, string>;
};
/** The structural subset of a Cloudflare Email Service binding used here. */
interface EmailSendBinding {
send(message: ChannelEmailMessage): Promise<{
messageId: string;
}>;
}
/** Configuration for an email Channel. */
type EmailChannelOptions = {
binding: EmailSendBinding;
from: EmailAddress /** Subject used when a message does not provide a title. */;
defaultTitle?: string /** Select an application route from the event, parsed email, and Host context. */;
route?: ChannelRoute<InboundEmailRaw> /** Override inferred Workers Email ingress addresses. */;
inbound?: InboundEmailOptions;
};
/** Create a configured email Channel. */
declare function email(options: EmailChannelOptions): Channel<InboundEmailRaw>;
//#endregion
export {
ChannelEmailMessage,
EmailAddress,
EmailChannelOptions,
EmailMessageAddress,
EmailMessageSurface,
EmailMessageSurfaceInput,
EmailRecipients,
EmailSendBinding,
EmailSurfaceAddress,
EmailSurfaceRecipients,
InboundEmailOptions,
InboundEmailRaw,
email,
inboundEmail
};
//# sourceMappingURL=email.d.ts.map