UNPKG

1.43 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;
8 BS?: string[];
9 BOOL?: boolean;
10 L?: AttributeValue[];
11 M?: { [id: string]: AttributeValue };
12 N?: string;
13 NS?: string[];
14 NULL?: boolean;
15 S?: string;
16 SS?: string[];
17}
18
19// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html
20export interface StreamRecord {
21 ApproximateCreationDateTime?: number;
22 Keys?: { [key: string]: AttributeValue };
23 NewImage?: { [key: string]: AttributeValue };
24 OldImage?: { [key: string]: AttributeValue };
25 SequenceNumber?: string;
26 SizeBytes?: number;
27 StreamViewType?: 'KEYS_ONLY' | 'NEW_IMAGE' | 'OLD_IMAGE' | 'NEW_AND_OLD_IMAGES';
28}
29
30// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_Record.html
31export interface DynamoDBRecord {
32 awsRegion?: string;
33 dynamodb?: StreamRecord;
34 eventID?: string;
35 eventName?: 'INSERT' | 'MODIFY' | 'REMOVE';
36 eventSource?: string;
37 eventSourceARN?: string;
38 eventVersion?: string;
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}