@@ -27,7 +27,7 @@ export declare interface FileOptions {
27
27
maxAge ?: number ;
28
28
root ?: string ;
29
29
lastModified ?: boolean | string ;
30
- headers ?: { } ;
30
+ headers ?: { [ key : string ] : string } ;
31
31
cacheControl ?: boolean | string ;
32
32
private ?: boolean ;
33
33
}
@@ -36,10 +36,10 @@ export declare interface App {
36
36
[ namespace : string ] : HandlerFunction ;
37
37
}
38
38
39
- export declare type Middleware = ( req : Request , res : Response , next : Middleware ) => void ;
39
+ export declare type Middleware = ( req : Request , res : Response , next : ( ) => void ) => void ;
40
40
export declare type ErrorHandlingMiddleware = ( error : Error , req : Request , res : Response , next : ErrorHandlingMiddleware ) => void ;
41
41
export declare type ErrorCallback = ( error ?: Error ) => void ;
42
- export declare type HandlerFunction = ( req ? : Request , res ? : Response , next ?: NextFunction ) => void | { } | Promise < { } > ;
42
+ export declare type HandlerFunction = ( req : Request , res : Response , next ?: NextFunction ) => void | any | Promise < any > ;
43
43
export declare type LoggerFunction = ( message : string ) => void ;
44
44
export declare type NextFunction = ( ) => void ;
45
45
export declare type TimestampFunction = ( ) => string ;
@@ -80,7 +80,7 @@ export declare interface LoggerOptions {
80
80
rules ?: SamplingOptions [ ] ;
81
81
} ;
82
82
serializers ?: {
83
- [ name : string ] : ( req : Request ) => { } ;
83
+ [ name : string ] : ( prop : any ) => any ;
84
84
} ;
85
85
stack ?: boolean ;
86
86
}
@@ -100,17 +100,21 @@ export declare class Request {
100
100
app : API ;
101
101
version : string ;
102
102
id : string ;
103
- params : { } ;
103
+ params : {
104
+ [ key : string ] : string | undefined ;
105
+ } ;
104
106
method : string ;
105
107
path : string ;
106
108
query : {
107
- [ key : string ] : string ;
109
+ [ key : string ] : string | undefined ;
108
110
} ;
109
111
headers : {
110
- [ key : string ] : string ;
112
+ [ key : string ] : string | undefined ;
111
113
} ;
112
- rawHeaders ?: { } ;
113
- body : { } | string ;
114
+ rawHeaders ?: {
115
+ [ key : string ] : string | undefined ;
116
+ } ;
117
+ body : any ;
114
118
rawBody : string ;
115
119
route : '' ;
116
120
requestContext : APIGatewayEventRequestContext ;
@@ -119,8 +123,8 @@ export declare class Request {
119
123
stageVariables : { [ name : string ] : string } | null ;
120
124
auth : {
121
125
[ key : string ] : any ;
122
- type : 'Bearer' | 'Basic' | 'OAuth' | 'Digest' ;
123
- value : string ;
126
+ type : 'Bearer' | 'Basic' | 'OAuth' | 'Digest' | 'none' ;
127
+ value : string | null ;
124
128
} ;
125
129
cookies : {
126
130
[ key : string ] : CookieOptions ;
@@ -141,15 +145,18 @@ export declare class Request {
141
145
error : LoggerFunction ;
142
146
fatal : LoggerFunction ;
143
147
} ;
148
+
149
+ [ key : string ] : any ;
144
150
}
145
151
146
152
export declare class Response {
147
153
status ( code : number ) : this;
154
+ sendStatus ( code : number ) : void ;
148
155
header ( key : string , value : string ) : this;
149
156
getHeader ( key : string ) : string ;
150
157
hasHeader ( key : string ) : boolean ;
151
158
removeHeader ( key : string ) : this;
152
- getLink ( s3Path : string , expires ?: number , callback ?: ( err , data ) => void ) ;
159
+ getLink ( s3Path : string , expires ?: number , callback ?: ErrorCallback ) : Promise < string > ;
153
160
send ( body : any ) : void ;
154
161
json ( body : any ) : void ;
155
162
jsonp ( body : any ) : void ;
@@ -159,16 +166,16 @@ export declare class Response {
159
166
redirect ( status : number , path : string ) : void ;
160
167
redirect ( path : string ) : void ;
161
168
cors ( options : CorsOptions ) : this;
162
- error ( message : string , detail ?: any ) ;
163
- error ( code : number , message : string , detail ?: any ) ;
169
+ error ( message : string , detail ?: any ) : void ;
170
+ error ( code : number , message : string , detail ?: any ) : void ;
164
171
cookie ( name : string , value : string , options ?: CookieOptions ) : this;
165
172
clearCookie ( name : string , options ?: CookieOptions ) : this;
166
173
etag ( enable ?: boolean ) : this;
167
174
cache ( age ?: boolean | number | string , private ?: boolean ) : this;
168
175
modified ( date : boolean | string | Date ) : this;
169
176
attachment ( fileName ?: string ) : this;
170
- download ( file : string | Buffer , fileName ?: string , options ?: FileOptions , callback ?: ErrorCallback ) ;
171
- sendFile ( file : string | Buffer , options ?: FileOptions , callback ?: ErrorCallback ) ;
177
+ download ( file : string | Buffer , fileName ?: string , options ?: FileOptions , callback ?: ErrorCallback ) : void ;
178
+ sendFile ( file : string | Buffer , options ?: FileOptions , callback ?: ErrorCallback ) : Promise < void > ;
172
179
}
173
180
174
181
export declare class API {
@@ -197,10 +204,10 @@ export declare class API {
197
204
198
205
199
206
200
- use ( path : string , ...middleware : Middleware [ ] ) ;
201
- use ( paths : string [ ] , ...middleware : Middleware [ ] ) ;
202
- use ( ...middleware : Middleware [ ] ) ;
203
- use ( ...errorHandlingMiddleware : ErrorHandlingMiddleware [ ] ) ;
207
+ use ( path : string , ...middleware : Middleware [ ] ) : void ;
208
+ use ( paths : string [ ] , ...middleware : Middleware [ ] ) : void ;
209
+ use ( ...middleware : Middleware [ ] ) : void ;
210
+ use ( ...errorHandlingMiddleware : ErrorHandlingMiddleware [ ] ) : void ;
204
211
205
212
finally ( callback : FinallyFunction ) : void ;
206
213
0 commit comments