UNPKG

2.45 kBTypeScriptView Raw
1import { Handler } from "../handler";
2
3export type SESHandler = Handler<SESEvent, void>;
4
5// SES event
6export interface SESMailHeader {
7 name: string;
8 value: string;
9}
10
11export interface SESMailCommonHeaders {
12 returnPath: string;
13 from?: string[] | undefined;
14 date: string;
15 to?: string[] | undefined;
16 cc?: string[] | undefined;
17 bcc?: string[] | undefined;
18 sender?: string[] | undefined;
19 replyTo?: string[] | undefined;
20 messageId: string;
21 subject?: string | undefined;
22}
23
24export interface SESMail {
25 timestamp: string;
26 source: string;
27 messageId: string;
28 destination: string[];
29 headersTruncated: boolean;
30 headers: SESMailHeader[];
31 commonHeaders: SESMailCommonHeaders;
32}
33
34export interface SESReceiptStatus {
35 status: "PASS" | "FAIL" | "GRAY" | "PROCESSING_FAILED" | "DISABLED";
36}
37
38export interface SESReceiptS3Action {
39 type: "S3";
40 topicArn?: string | undefined;
41 bucketName: string;
42 objectKey: string;
43}
44
45export interface SESReceiptSnsAction {
46 type: "SNS";
47 topicArn: string;
48}
49
50export interface SESReceiptBounceAction {
51 type: "Bounce";
52 topicArn?: string | undefined;
53 smtpReplyCode: string;
54 statusCode: string;
55 message: string;
56 sender: string;
57}
58
59export interface SESReceiptLambdaAction {
60 type: "Lambda";
61 topicArn?: string | undefined;
62 functionArn: string;
63 invocationType: string;
64}
65
66export interface SESReceiptStopAction {
67 type: "Stop";
68 topicArn?: string | undefined;
69}
70
71export interface SESReceiptWorkMailAction {
72 type: "WorkMail";
73 topicArn?: string | undefined;
74 organizationArn: string;
75}
76
77export interface SESReceipt {
78 timestamp: string;
79 processingTimeMillis: number;
80 recipients: string[];
81 spamVerdict: SESReceiptStatus;
82 virusVerdict: SESReceiptStatus;
83 spfVerdict: SESReceiptStatus;
84 dkimVerdict: SESReceiptStatus;
85 dmarcVerdict: SESReceiptStatus;
86 dmarcPolicy?: "none" | "quarantine" | "reject" | undefined;
87 action:
88 | SESReceiptS3Action
89 | SESReceiptSnsAction
90 | SESReceiptBounceAction
91 | SESReceiptLambdaAction
92 | SESReceiptStopAction
93 | SESReceiptWorkMailAction;
94}
95
96export interface SESMessage {
97 mail: SESMail;
98 receipt: SESReceipt;
99}
100
101export interface SESEventRecord {
102 eventSource: string;
103 eventVersion: string;
104 ses: SESMessage;
105}
106
107export interface SESEvent {
108 Records: SESEventRecord[];
109}