diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index c4421ca625..b711a9cddf 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -990,6 +990,22 @@ export interface Route { } export interface RouteOptions { + name?: string; + + path?: string | RegExp; + + url?: string | RegExp; + + urlParamPattern?: RegExp; + + contentType?: string | string[]; + + version?: string; + + versions?: string[]; +} + +export interface MountOptions { name: string; method: string; @@ -1071,6 +1087,11 @@ export namespace plugins { */ log: Logger; + /** + * The event from the server which initiates the + * log, one of 'pre', 'routed', or 'after' + */ + event: 'pre' | 'routed' | 'after'; /** * Restify server. If passed in, causes server to emit 'auditlog' event after audit logs are flushed */ diff --git a/types/restify/restify-tests.ts b/types/restify/restify-tests.ts index 7e80e5290f..6427fb7869 100644 --- a/types/restify/restify-tests.ts +++ b/types/restify/restify-tests.ts @@ -142,7 +142,7 @@ server.use(restify.plugins.throttle({ } })); -server.on('after', restify.plugins.auditLogger({ log: {} as Logger })); +server.on('after', restify.plugins.auditLogger({ event: 'after', log: {} as Logger })); server.on('after', (req: restify.Request, res: restify.Response, route: restify.Route, err: any) => { route.spec.method === 'GET'; @@ -150,7 +150,7 @@ server.on('after', (req: restify.Request, res: restify.Response, route: restify. route.spec.path === '/some/path'; route.spec.path === /\/some\/path\/.*/; route.spec.versions === ['v1']; - restify.plugins.auditLogger({ log: {} as Logger })(req, res, route, err); + restify.plugins.auditLogger({ event: 'after', log: {} as Logger })(req, res, route, err); }); ( restify).defaultResponseHeaders = function(this: restify.Request, data: any) {