@@ -92,11 +92,25 @@ export declare type ErrorHandlingMiddleware<
9292 > ,
9393 TBody = any
9494> = (
95+ /**
96+ * The error that was thrown or passed to res.error()
97+ */
9598 error : Error ,
99+ /**
100+ * The request object
101+ */
96102 req : Request < TContext , TQuery , TParams , TBody > ,
103+ /**
104+ * The response object. Call res.send() or return a value to send a response.
105+ * The error will continue through the error middleware chain until a response is sent.
106+ */
97107 res : Response < TResponse > ,
108+ /**
109+ * Call next() to continue to the next error middleware.
110+ * Note: next(error) is not supported - the error parameter will be ignored.
111+ */
98112 next : NextFunction
99- ) => void ;
113+ ) => void | Promise < void | TResponse > | TResponse ;
100114
101115export type METHODS =
102116 | 'GET'
@@ -142,23 +156,32 @@ export declare interface LoggerOptions {
142156 customKey ?: string ;
143157 errorLogging ?: boolean ;
144158 detail ?: boolean ;
145- level ?: string ;
159+ level ?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'none' ;
146160 levels ?: {
147- [ key : string ] : string ;
161+ [ key : string ] : number ;
148162 } ;
149163 messageKey ?: string ;
150164 nested ?: boolean ;
151165 timestamp ?: boolean | TimestampFunction ;
152- sampling ?: {
153- target ?: number ;
154- rate ?: number ;
155- period ?: number ;
156- rules ?: SamplingOptions [ ] ;
157- } ;
166+ sampling ?:
167+ | boolean
168+ | {
169+ target ?: number ;
170+ rate ?: number ;
171+ period ?: number ;
172+ rules ?: SamplingOptions [ ] ;
173+ } ;
158174 serializers ?: {
159- [ name : string ] : ( prop : any ) => any ;
175+ main ?: ( req : Request ) => object ;
176+ req ?: ( req : Request ) => object ;
177+ res ?: ( res : Response ) => object ;
178+ context ?: ( context : Context ) => object ;
179+ custom ?: ( custom : any ) => object ;
160180 } ;
161181 stack ?: boolean ;
182+ timer ?: boolean ;
183+ multiValue ?: boolean ;
184+ log ?: ( message : string ) => void ;
162185}
163186
164187export interface Options {
@@ -214,7 +237,7 @@ export declare class Request<
214237 } ;
215238 body : TBody ;
216239 rawBody : string ;
217- route : '' ;
240+ route : string ;
218241 requestContext : TContext ;
219242 isBase64Encoded : boolean ;
220243 pathParameters : { [ name : string ] : string } | null ;
@@ -235,6 +258,12 @@ export declare class Request<
235258 clientType : 'desktop' | 'mobile' | 'tv' | 'tablet' | 'unknown' ;
236259 clientCountry : string ;
237260 namespace : App ;
261+ /**
262+ * Alias for namespace
263+ */
264+ ns : App ;
265+ interface : 'apigateway' | 'alb' ;
266+ payloadVersion ?: string ;
238267
239268 log : {
240269 trace : LoggerFunction ;
@@ -249,6 +278,8 @@ export declare class Request<
249278}
250279
251280export declare class Response < TResponse = any > {
281+ app : API ;
282+
252283 status ( code : number ) : this;
253284 sendStatus ( code : number ) : void ;
254285 header ( key : string , value ?: string | Array < string > , append ?: boolean ) : this;
0 commit comments