From 9fb4ab18b394a9aec15afee86d80588dbba834f1 Mon Sep 17 00:00:00 2001 From: rafaelsouzaf Date: Fri, 8 Dec 2017 19:44:37 -0300 Subject: [PATCH] Replace Dictionary by Map supported in es6 --- types/hapi/v17/definitions/request/request.d.ts | 8 ++++---- types/hapi/v17/definitions/response/response-object.d.ts | 2 +- .../hapi/v17/definitions/route/route-options-payload.d.ts | 2 +- types/hapi/v17/definitions/route/route-options.d.ts | 6 +++--- types/hapi/v17/definitions/server/server-auth.d.ts | 2 +- types/hapi/v17/definitions/server/server-inject.d.ts | 2 +- types/hapi/v17/definitions/server/server-options.d.ts | 2 +- types/hapi/v17/definitions/server/server-state.d.ts | 4 ++-- types/hapi/v17/definitions/server/server.d.ts | 6 +++--- types/hapi/v17/definitions/util/util.d.ts | 6 ------ 10 files changed, 17 insertions(+), 23 deletions(-) diff --git a/types/hapi/v17/definitions/request/request.d.ts b/types/hapi/v17/definitions/request/request.d.ts index 2a92b8a142..992a117b7d 100644 --- a/types/hapi/v17/definitions/request/request.d.ts +++ b/types/hapi/v17/definitions/request/request.d.ts @@ -61,7 +61,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: Util.Dictionary; + readonly headers: Map; /** * Request information: @@ -105,7 +105,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: Util.Dictionary; + readonly params: Map; /** * An array containing all the path params values in the order they appeared in the path. @@ -131,7 +131,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: Util.Dictionary; + readonly pre: Map; /** * Access: read / write (see limitations below). @@ -142,7 +142,7 @@ export interface Request extends Podium { /** * Same as pre but represented as the response object created by the pre method. */ - readonly preResponses: Util.Dictionary; + readonly preResponses: Map; /** * 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). diff --git a/types/hapi/v17/definitions/response/response-object.d.ts b/types/hapi/v17/definitions/response/response-object.d.ts index 71415c0b33..40b827d31b 100644 --- a/types/hapi/v17/definitions/response/response-object.d.ts +++ b/types/hapi/v17/definitions/response/response-object.d.ts @@ -52,7 +52,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: Util.Dictionary; + readonly headers: Map; /** * 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 c48d09aa0c..79efc0d144 100644 --- a/types/hapi/v17/definitions/route/route-options-payload.d.ts +++ b/types/hapi/v17/definitions/route/route-options-payload.d.ts @@ -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?: Util.Dictionary; + compression?: Map; /** * Default value: 'application/json'. diff --git a/types/hapi/v17/definitions/route/route-options.d.ts b/types/hapi/v17/definitions/route/route-options.d.ts index daf0005ddd..8284f9b21a 100644 --- a/types/hapi/v17/definitions/route/route-options.d.ts +++ b/types/hapi/v17/definitions/route/route-options.d.ts @@ -27,7 +27,7 @@ export interface RouteOptions { * Application-specific route configuration state. Should not be used by plugins which should use options.plugins[name] instead. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionsapp) */ - app?: object; + app?: any; /** * Route authentication configuration. Value can be: @@ -65,7 +65,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?: Util.Dictionary; + compression?: Map; /** * Default value: false (no CORS headers). @@ -180,7 +180,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?: Util.Dictionary; + plugins?: Map; /** * 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 d49b12439d..56e13edc8d 100644 --- a/types/hapi/v17/definitions/server/server-auth.d.ts +++ b/types/hapi/v17/definitions/server/server-auth.d.ts @@ -27,7 +27,7 @@ export interface ServerAuth { * returned from its implementation function. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverauthapi) */ - api: Util.Dictionary; + api: Map; /** * Contains the default authentication configuration is a default strategy was set via diff --git a/types/hapi/v17/definitions/server/server-inject.d.ts b/types/hapi/v17/definitions/server/server-inject.d.ts index 21ba1a8afa..e398e1915e 100644 --- a/types/hapi/v17/definitions/server/server-inject.d.ts +++ b/types/hapi/v17/definitions/server/server-inject.d.ts @@ -25,7 +25,7 @@ import * as Shot from "shot"; export interface ServerInjectOptions extends Shot.RequestOptions { credentials?: object; artifacts?: object; - app?: object; + app?: any; plugins?: PluginsStates; allowInternals?: boolean; } diff --git a/types/hapi/v17/definitions/server/server-options.d.ts b/types/hapi/v17/definitions/server/server-options.d.ts index dd96c8ea3a..4273a01988 100644 --- a/types/hapi/v17/definitions/server/server-options.d.ts +++ b/types/hapi/v17/definitions/server/server-options.d.ts @@ -26,7 +26,7 @@ export interface ServerOptions { * Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serveroptionsapp) */ - app?: object; + app?: any; /** * Default value: true. diff --git a/types/hapi/v17/definitions/server/server-state.d.ts b/types/hapi/v17/definitions/server/server-state.d.ts index 32107b8f07..bfc9568c51 100644 --- a/types/hapi/v17/definitions/server/server-state.d.ts +++ b/types/hapi/v17/definitions/server/server-state.d.ts @@ -39,7 +39,7 @@ export interface ServerState { /** * An array containing the names of all configued cookies. */ - readonly names: Util.Dictionary; + readonly names: string[]; /** * Same as calling [server.state()](https://github.com/hapijs/hapi/blob/master/API.md#server.state()). @@ -67,6 +67,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): Util.Dictionary; + parse(header: string): Map; } diff --git a/types/hapi/v17/definitions/server/server.d.ts b/types/hapi/v17/definitions/server/server.d.ts index 44ab2a5280..4b82f4a8b4 100644 --- a/types/hapi/v17/definitions/server/server.d.ts +++ b/types/hapi/v17/definitions/server/server.d.ts @@ -65,7 +65,7 @@ export class Server extends Podium { * Initialized with an empty object. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverapp) */ - app?: object; + app?: any; /** * Server Auth: properties and methods @@ -104,7 +104,7 @@ export class Server extends Podium { */ event(events: ServerEventsApplication): void; event(events: ServerEventsApplication[]): void; - + /** * Access: podium public interface. * The server events emitter. Utilizes the podium with support for event criteria validation, channels, and filters. @@ -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: Util.Dictionary; + readonly methods: Map; /** * 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 f92b23bb4d..9e2264a257 100644 --- a/types/hapi/v17/definitions/util/util.d.ts +++ b/types/hapi/v17/definitions/util/util.d.ts @@ -1,11 +1,5 @@ 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; - }