diff --git a/types/hapi/v17/definitions/request/request.d.ts b/types/hapi/v17/definitions/request/request.d.ts index e22d1ed391..a9a8c8b6d2 100644 --- a/types/hapi/v17/definitions/request/request.d.ts +++ b/types/hapi/v17/definitions/request/request.d.ts @@ -54,7 +54,7 @@ export interface Request extends Podium { * The raw request headers (references request.raw.req.headers). * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-requestheaders) */ - readonly headers: Map; + readonly headers: Util.Dictionary; /** * Request information: @@ -98,7 +98,7 @@ export interface Request extends Podium { /** * An object where each key is a path parameter name with matching value as described in [Path parameters](https://github.com/hapijs/hapi/blob/master/API.md#path-parameters). */ - readonly params: Map; + readonly params: Util.Dictionary; /** * An array containing all the path params values in the order they appeared in the path. @@ -124,7 +124,7 @@ export interface Request extends Podium { /** * An object where each key is the name assigned by a route pre-handler methods function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses. */ - readonly pre: Map; + readonly pre: Util.Dictionary; /** * Access: read / write (see limitations below). @@ -135,7 +135,7 @@ export interface Request extends Podium { /** * Same as pre but represented as the response object created by the pre method. */ - readonly preResponses: Map; + readonly preResponses: Util.Dictionary; /** * 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). @@ -168,7 +168,7 @@ export interface Request extends Podium { /** * An object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ - readonly state: Map; + readonly state: Util.Dictionary; /** * The parsed request URI. diff --git a/types/hapi/v17/definitions/response/response-object.d.ts b/types/hapi/v17/definitions/response/response-object.d.ts index 28afdbba0a..378fee420f 100644 --- a/types/hapi/v17/definitions/response/response-object.d.ts +++ b/types/hapi/v17/definitions/response/response-object.d.ts @@ -1,5 +1,5 @@ import * as Podium from "podium"; -import {Json, Lifecycle, PluginsStates, ResponseEvents, ResponseSettings, ServerStateCookieOptions} from "hapi"; +import {Json, Lifecycle, PluginsStates, ResponseEvents, ResponseSettings, ServerStateCookieOptions, Util} from "hapi"; /** * Object where: @@ -48,7 +48,7 @@ export interface ResponseObject extends Podium { * Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepared for transmission. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-responseheaders) */ - readonly headers: Map; + readonly headers: Util.Dictionary; /** * Default value: {}. diff --git a/types/hapi/v17/definitions/route/route-options-payload.d.ts b/types/hapi/v17/definitions/route/route-options-payload.d.ts index 5213f2c230..a13db35c32 100644 --- a/types/hapi/v17/definitions/route/route-options-payload.d.ts +++ b/types/hapi/v17/definitions/route/route-options-payload.d.ts @@ -1,4 +1,4 @@ -import {Lifecycle} from "hapi"; +import {Lifecycle, Util} from "hapi"; /** * The value must be one of: @@ -38,7 +38,7 @@ export interface RouteOptionsPayload { * An object where each key is a content-encoding name and each value is an object with the desired decoder settings. Note that encoder settings are set in compression. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionspayloadcompression) */ - compression?: Map; + compression?: Util.Dictionary; /** * Default value: 'application/json'. diff --git a/types/hapi/v17/definitions/route/route-options-response.d.ts b/types/hapi/v17/definitions/route/route-options-response.d.ts index 64318af3d9..a1c4d71a75 100644 --- a/types/hapi/v17/definitions/route/route-options-response.d.ts +++ b/types/hapi/v17/definitions/route/route-options-response.d.ts @@ -1,4 +1,4 @@ -import {Lifecycle} from "hapi"; +import {Lifecycle, Util} from "hapi"; import {ValidationOptions} from "joi"; /** @@ -79,6 +79,6 @@ export interface RouteOptionsResponse { * status is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionsresponsestatus) */ - status?: Map; + status?: Util.Dictionary; } diff --git a/types/hapi/v17/definitions/route/route-options.d.ts b/types/hapi/v17/definitions/route/route-options.d.ts index a1fc8814ec..2bc2542f4a 100644 --- a/types/hapi/v17/definitions/route/route-options.d.ts +++ b/types/hapi/v17/definitions/route/route-options.d.ts @@ -9,7 +9,8 @@ import { RouteOptionsPreArray, RouteOptionsResponse, RouteOptionsSecure, - RouteOptionsValidate + RouteOptionsValidate, + Util } from "hapi"; /** @@ -66,7 +67,7 @@ export interface RouteOptions { * An object where each key is a content-encoding name and each value is an object with the desired encoder settings. Note that decoder settings are set in compression. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionscompression) */ - compression?: Map; + compression?: Util.Dictionary; /** * Default value: false (no CORS headers). @@ -181,7 +182,7 @@ export interface RouteOptions { * Plugin-specific configuration. plugins is an object where each key is a plugin name and the value is the plugin configuration. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionsplugins) */ - plugins?: Map; + plugins?: Util.Dictionary; /** * Default value: none. diff --git a/types/hapi/v17/definitions/server/server-auth.d.ts b/types/hapi/v17/definitions/server/server-auth.d.ts index c52a0a3cda..0d0bafc7e1 100644 --- a/types/hapi/v17/definitions/server/server-auth.d.ts +++ b/types/hapi/v17/definitions/server/server-auth.d.ts @@ -1,4 +1,4 @@ -import {Request, RouteOptionsAccess, ServerAuthScheme} from "hapi"; +import {Request, RouteOptionsAccess, ServerAuthScheme, Util} from "hapi"; /** * The authentication credentials object @@ -24,7 +24,7 @@ export interface ServerAuth { * returned from its implementation function. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverauthapi) */ - api: Map; + api: Util.Dictionary; /** * Contains the default authentication configuration is a default strategy was set via diff --git a/types/hapi/v17/definitions/server/server-state.d.ts b/types/hapi/v17/definitions/server/server-state.d.ts index e09937f32e..f233956a29 100644 --- a/types/hapi/v17/definitions/server/server-state.d.ts +++ b/types/hapi/v17/definitions/server/server-state.d.ts @@ -1,4 +1,4 @@ -import {ServerStateCookieOptions} from "hapi"; +import {ServerStateCookieOptions, Util} from "hapi"; /** * A single object or an array of object where each contains: @@ -66,6 +66,6 @@ export interface ServerState { * Note that this utility uses the server configuration but does not change the server state. It is provided for manual cookie parsing (e.g. when server parsing is disabled). * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-async-serverstatesparseheader) */ - parse(header: string): Map; + parse(header: string): Util.Dictionary; } diff --git a/types/hapi/v17/definitions/server/server.d.ts b/types/hapi/v17/definitions/server/server.d.ts index 4b82f4a8b4..2af9a5edf0 100644 --- a/types/hapi/v17/definitions/server/server.d.ts +++ b/types/hapi/v17/definitions/server/server.d.ts @@ -162,7 +162,7 @@ export class Server extends Podium { * server method name is an object property. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-servermethods */ - readonly methods: Map; + readonly methods: Util.Dictionary; /** * Provides access to the server MIME database used for setting content-type information. The object must not be diff --git a/types/hapi/v17/definitions/util/util.d.ts b/types/hapi/v17/definitions/util/util.d.ts index 9e2264a257..f92b23bb4d 100644 --- a/types/hapi/v17/definitions/util/util.d.ts +++ b/types/hapi/v17/definitions/util/util.d.ts @@ -1,5 +1,11 @@ export namespace Util { + + export interface Dictionary { + [key: string]: T; + } + export type HTTP_METHODS_PARTIAL_LOWERCASE = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options'; export type HTTP_METHODS_PARTIAL = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | HTTP_METHODS_PARTIAL_LOWERCASE; export type HTTP_METHODS = 'HEAD' | 'head' | HTTP_METHODS_PARTIAL; + }