-
Notifications
You must be signed in to change notification settings - Fork 660
/
configure.d.ts
56 lines (46 loc) · 1.48 KB
/
configure.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { RequestListener } from 'http';
import { Handler } from 'aws-lambda';
import { Logger } from './logger';
import Framework from './frameworks';
type EventSources = 'AWS_SNS' | 'AWS_DYNAMODB' | 'AWS_EVENTBRIDGE' | 'AWS_SQS' | 'AWS_KINESIS_DATA_STREAM' | 'AWS_S3' | 'AWS_STEP_FUNCTIONS';
interface EventSource {
getRequest?: any; // TODO:
getResponse?: any; // TODO:
}
interface ProxyParams {
app: RequestListener;
binaryMimeTypes?: string[];
binarySettings?: BinarySettings;
}
interface BinarySettings {
isBinary?: Function | boolean;
contentTypes?: string[];
}
interface LogSettings {
level: string;
}
interface ConfigureParams {
app: RequestListener;
logSettings?: LogSettings;
log?: Logger;
framework?: Framework;
binaryMimeTypes?: string[];
binarySettings?: BinarySettings;
resolutionMode?: string;
eventSourceName?: string;
eventSource?: EventSource; // TODO:
eventSourceRoutes?: { [key in EventSources]?: string };
respondWithErrors?: boolean;
}
interface BinarySettings {
isBinary?: Function | boolean;
contentTypes?: string[];
}
export interface ConfigureResult<TEvent = any, TResult = any> {
handler: Handler<TEvent, TResult>;
log: Logger;
proxy: (proxyParams: ProxyParams) => Promise<Object>;
}
declare function configure<TEvent = any, TResult = any>(configureParams: ConfigureParams): Handler<TEvent, TResult> & ConfigureResult<TEvent, TResult>;
// declare function proxy(proxyParams: ProxyParams): Promise<any>
export default configure;