forked from middyjs/middy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
middlewares.d.ts
89 lines (76 loc) · 2.9 KB
/
middlewares.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { SSM } from 'aws-sdk'
import { Options as AjvOptions } from 'ajv'
import { HttpError } from 'http-errors'
import middy from './'
interface ICorsOptions {
origin?: string;
origins?: string[];
headers?: string;
credentials?: boolean;
}
interface ICacheOptions {
calculateCacheId?: (event: any) => Promise<string>;
getValue?: (key: string) => Promise<any>;
setValue?: (key: string) => Promise<void>;
}
interface IDoNotWaitForEmtpyEventLoopOptions {
runOnBefore?: boolean;
runOnAfter?: boolean;
runOnError?: boolean;
}
interface IHTTPContentNegotiationOptions {
parseCharsets?: boolean;
availableCharsets?: string[];
parseEncodings?: boolean;
availableEncodings?: string[];
parseLanguages?: boolean;
availableLanguages?: string[];
parseMediaTypes?: boolean;
availableMediaTypes?: string[];
failOnMismatch?: boolean;
}
interface IHTTPErrorHandlerOptions {
logger?: (error: HttpError) => void;
}
interface IHTTPHeaderNormalizerOptions {
normalizeHeaderKey?: (key: string) => string;
}
interface IHTTPPartialResponseOptions {
filteringKeyName?: string;
}
interface ISSMOptions {
cache?: boolean;
cacheExpiryInMillis?: number;
paths?: { [key: string]: string; };
names?: { [key: string]: string; };
awsSdkOptions?: Partial<SSM.Types.ClientConfiguration>;
setToContext?: boolean;
getParamNameFromPath?: (path: string, name: string, prefix: string) => string;
}
interface IValidatorOptions {
inputSchema?: any;
outputSchema?: any;
ajvOptions?: Partial<AjvOptions>;
}
interface IURLEncodeBodyParserOptions {
extended?: false;
}
interface IWarmupOptions {
isWarmingUp?: (event: any) => boolean;
onWarmup?: (event: any) => void;
}
declare function cache(opts?: ICacheOptions): middy.IMiddyMiddlewareObject;
declare function cors(opts?: ICorsOptions): middy.IMiddyMiddlewareObject;
declare function doNotWaitForEmptyEventLoop(opts?: IDoNotWaitForEmtpyEventLoopOptions): middy.IMiddyMiddlewareObject;
declare function httpContentNegotiation(opts?: IHTTPContentNegotiationOptions): middy.IMiddyMiddlewareObject;
declare function httpErrorHandler(opts?: IHTTPErrorHandlerOptions): middy.IMiddyMiddlewareObject;
declare function httpEventNormalizer(): middy.IMiddyMiddlewareObject;
declare function httpHeaderNormalizer(opts?: IHTTPHeaderNormalizerOptions): middy.IMiddyMiddlewareObject;
declare function httpPartialResponse(opts?: IHTTPPartialResponseOptions): middy.IMiddyMiddlewareObject;
declare function jsonBodyParser(): middy.IMiddyMiddlewareObject;
declare function s3KeyNormalizer(): middy.IMiddyMiddlewareObject;
declare function ssm(opts?: ISSMOptions): middy.IMiddyMiddlewareObject;
declare function validator(opts?: IValidatorOptions): middy.IMiddyMiddlewareObject;
declare function urlEncodeBodyParser(opts?: IURLEncodeBodyParserOptions): middy.IMiddyMiddlewareObject;
declare function warmup(opts?: IWarmupOptions): middy.IMiddyMiddlewareObject;
export as namespace middlewares;