diff --git a/types/hapi/v17/definitions/request/request.d.ts b/types/hapi/v17/definitions/request/request.d.ts index a9a8c8b6d2..5fe1a63f5b 100644 --- a/types/hapi/v17/definitions/request/request.d.ts +++ b/types/hapi/v17/definitions/request/request.d.ts @@ -140,7 +140,7 @@ export interface Request extends Podium { /** * By default the object outputted from node's URL parse() method. Might also be set indirectly via request.setUrl in which case it may be a string (if url is set to an object with the query attribute as an unparsed string). */ - readonly query: object; + readonly query: any; /** * An object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended. diff --git a/types/hapi/v17/definitions/response/response-events.d.ts b/types/hapi/v17/definitions/response/response-events.d.ts index 469009087c..e5dcb43d30 100644 --- a/types/hapi/v17/definitions/response/response-events.d.ts +++ b/types/hapi/v17/definitions/response/response-events.d.ts @@ -11,14 +11,9 @@ export interface ResponseEvents extends Podium { /** * 'peek' - emitted for each chunk of data written back to the client connection. The event method signature is function(chunk, encoding). - */ - on(criteria: 'peak', listener: Function): void; - once(criteria: 'peak', listener: Function): void; - - /** * 'finish' - emitted when the response finished writing but before the client response connection is ended. The event method signature is function (). */ - on(criteria: 'finish', listener: Function): void; - once(criteria: 'finish', listener: Function): void; + on(criteria: 'peek' | 'finish', listener: Function): void; + once(criteria: 'peek' | 'finish', listener: Function): void; } diff --git a/types/hapi/v17/definitions/server/server-ext.d.ts b/types/hapi/v17/definitions/server/server-ext.d.ts index 02853a2888..809f4ddc61 100644 --- a/types/hapi/v17/definitions/server/server-ext.d.ts +++ b/types/hapi/v17/definitions/server/server-ext.d.ts @@ -9,7 +9,7 @@ import {Lifecycle, Server} from "hapi"; * For context [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverextevents) * For context [See docs](https://github.com/hapijs/hapi/blob/master/API.md#request-lifecycle) */ -export type ServerExtType = 'onPreStart' | 'onPostStart' | 'onPreStop' | 'onPostStop'; +export type ServerExtType = 'onRequest' | 'onPreStart' | 'onPostStart' | 'onPreStop' | 'onPostStop'| 'onPreResponse'; /** * The extension point event name for Request @@ -41,7 +41,7 @@ export type ServerExtRequestType = 'onRequest'; */ export interface ServerExtEventsObject { type: ServerExtType; - method: ServerExtPointFunction | ServerExtPointFunction[]; + method: ServerExtPointFunction | ServerExtPointFunction[] | Function; options?: ServerExtOptions; } @@ -68,7 +68,7 @@ export interface ServerExtEventsObject { */ export interface ServerExtEventsRequestObject { type: ServerExtRequestType; - method: RequestExtPointFunction | RequestExtPointFunction[]; + method: Lifecycle.Method | Lifecycle.Method[]; options?: ServerExtOptions; } @@ -76,10 +76,6 @@ export interface ServerExtPointFunction { (server: Server): void; } -export interface RequestExtPointFunction extends Lifecycle.Method { - -} - /** * An object with the following: * * before - a string or array of strings of plugin names this method must execute before (on the same event). Otherwise, extension methods are executed in the order added. diff --git a/types/hapi/v17/definitions/server/server.d.ts b/types/hapi/v17/definitions/server/server.d.ts index 1f3654b1be..b7ac0e908f 100644 --- a/types/hapi/v17/definitions/server/server.d.ts +++ b/types/hapi/v17/definitions/server/server.d.ts @@ -2,22 +2,22 @@ import * as http from "http"; import * as zlib from "zlib"; import * as Podium from "podium"; import { + Lifecycle, PayloadCompressionDecoderSettings, Plugin, PluginsListRegistered, Request, - RequestExtPointFunction, RequestRoute, ResponseToolkit, RouteCompressionEncoderSettings, - ServerAuth, ServerCache, + ServerAuth, + ServerCache, ServerEvents, ServerEventsApplication, ServerExtEventsObject, ServerExtEventsRequestObject, ServerExtOptions, ServerExtPointFunction, - ServerExtRequestType, ServerExtType, ServerInfo, ServerInjectOptions, @@ -343,10 +343,8 @@ export class Server extends Podium { * @return Return value: none. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverextevent-method-options) */ - ext(event: ServerExtType, method: ServerExtPointFunction): void; - ext(event: ServerExtType, method: ServerExtPointFunction, options: ServerExtOptions): void; - ext(event: ServerExtRequestType, method: RequestExtPointFunction): void; - ext(event: ServerExtRequestType, method: RequestExtPointFunction, options: ServerExtOptions): void; + ext(event: ServerExtType, method: ServerExtPointFunction | Lifecycle.Method | Function): void; + ext(event: ServerExtType, method: ServerExtPointFunction | Lifecycle.Method | Function, options: ServerExtOptions): void; /** * Initializes the server (starts the caches, finalizes plugin registration) but does not start listening on the connection port.