UNPKG

1.72 kBTypeScriptView Raw
1import { Handler } from "../handler";
2
3export type DynamoDBStreamHandler = Handler<DynamoDBStreamEvent, void>;
4
5// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_AttributeValue.html
6export interface AttributeValue {
7 B?: string | undefined;
8 BS?: string[] | undefined;
9 BOOL?: boolean | undefined;
10 L?: AttributeValue[] | undefined;
11 M?: { [id: string]: AttributeValue } | undefined;
12 N?: string | undefined;
13 NS?: string[] | undefined;
14 NULL?: boolean | undefined;
15 S?: string | undefined;
16 SS?: string[] | undefined;
17}
18
19// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html
20export interface StreamRecord {
21 ApproximateCreationDateTime?: number | undefined;
22 Keys?: { [key: string]: AttributeValue } | undefined;
23 NewImage?: { [key: string]: AttributeValue } | undefined;
24 OldImage?: { [key: string]: AttributeValue } | undefined;
25 SequenceNumber?: string | undefined;
26 SizeBytes?: number | undefined;
27 StreamViewType?: 'KEYS_ONLY' | 'NEW_IMAGE' | 'OLD_IMAGE' | 'NEW_AND_OLD_IMAGES' | undefined;
28}
29
30// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_Record.html
31export interface DynamoDBRecord {
32 awsRegion?: string | undefined;
33 dynamodb?: StreamRecord | undefined;
34 eventID?: string | undefined;
35 eventName?: 'INSERT' | 'MODIFY' | 'REMOVE' | undefined;
36 eventSource?: string | undefined;
37 eventSourceARN?: string | undefined;
38 eventVersion?: string | undefined;
39 userIdentity?: any;
40}
41
42// http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-ddb-update
43export interface DynamoDBStreamEvent {
44 Records: DynamoDBRecord[];
45}