forked from middyjs/middy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
middlewares.d.ts
130 lines (115 loc) · 3.46 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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 ISecretsManagerOptions {
cache?: boolean;
cacheExpiryInMillis?: number;
secrets: { [key: string]: string; };
awsSdkOptions?: Partial<SSM.Types.ClientConfiguration>;
throwOnFailedCall?: boolean;
}
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;
}
interface IHTTPSecurityHeadersOptions {
dnsPrefetchControl?: {
allow?: Boolean
},
expectCT?: {
enforce?: Boolean,
maxAge?: Number
},
frameguard?: {
action?: String
},
hidePoweredBy?: {
setTo: String
},
hsts?: {
maxAge?: Number,
includeSubDomains?: Boolean,
preload?: Boolean
},
ieNoOpen?: {
action?: String
},
noSniff?: {
action?: String
},
referrerPolicy?: {
policy?: String
},
xssFilter?: Object
}
declare const cache: middy.Middleware<ICacheOptions>;
declare const cors: middy.Middleware<ICorsOptions>;
declare const doNotWaitForEmptyEventLoop: middy.Middleware<IDoNotWaitForEmtpyEventLoopOptions>;
declare const httpContentNegotiation: middy.Middleware<IHTTPContentNegotiationOptions>;
declare const httpErrorHandler: middy.Middleware<IHTTPErrorHandlerOptions>;
declare const httpEventNormalizer: middy.Middleware<never>;
declare const httpHeaderNormalizer: middy.Middleware<IHTTPHeaderNormalizerOptions>;
declare const httpPartialResponse: middy.Middleware<IHTTPPartialResponseOptions>;
declare const jsonBodyParser: middy.Middleware<never>;
declare const s3KeyNormalizer: middy.Middleware<never>;
declare const secretsManager: middy.Middleware<ISecretsManagerOptions>;
declare const ssm: middy.Middleware<ISSMOptions>;
declare const validator: middy.Middleware<IValidatorOptions>;
declare const urlEncodeBodyParser: middy.Middleware<IURLEncodeBodyParserOptions>;
declare const warmup: middy.Middleware<IWarmupOptions>;
declare const httpSecurityHeaders: middy.Middleware<IHTTPSecurityHeadersOptions>;
export as namespace middlewares;