Skip to content

Commit 6232cb7

Browse files
committed
Merge remote-tracking branch 'joshkel/type-updates'
2 parents 95ad58f + d7582ee commit 6232cb7

File tree

5 files changed

+35
-9
lines changed

5 files changed

+35
-9
lines changed

lib/types/response.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export interface ResponseObject extends Podium {
316316
* Only available after calling the response.redirect() method.
317317
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-responsetemporaryistemporary)
318318
*/
319-
temporary(isTemporary: boolean): ResponseObject;
319+
temporary(isTemporary?: boolean): ResponseObject;
320320

321321
/**
322322
* Sets the status code to 301 or 308 (based on the response.rewritable() setting) where:
@@ -325,7 +325,7 @@ export interface ResponseObject extends Podium {
325325
* Only available after calling the response.redirect() method.
326326
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-responsepermanentispermanent)
327327
*/
328-
permanent(isPermanent: boolean): ResponseObject;
328+
permanent(isPermanent?: boolean): ResponseObject;
329329

330330
/**
331331
* Sets the status code to 301/302 for rewritable (allows changing the request method from 'POST' to 'GET') or 307/308 for non-rewritable (does not allow changing the request method from 'POST'
@@ -335,7 +335,7 @@ export interface ResponseObject extends Podium {
335335
* Only available after calling the response.redirect() method.
336336
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-responserewritableisrewritable)
337337
*/
338-
rewritable(isRewritable: boolean): ResponseObject;
338+
rewritable(isRewritable?: boolean): ResponseObject;
339339
}
340340

341341
/**

lib/types/route.d.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ export interface RouteOptionsCors {
187187
* if true, allows user credentials to be sent ('Access-Control-Allow-Credentials'). Defaults to false.
188188
*/
189189
credentials?: boolean | undefined;
190+
/**
191+
* the status code used for CORS preflight responses, either 200 or 204. Defaults to 200.
192+
*/
193+
preflightStatusCode?: 200 | 204;
190194
}
191195

192196
/**
@@ -309,6 +313,13 @@ export interface RouteOptionsPayload {
309313
*/
310314
parse?: boolean | 'gunzip' | undefined;
311315

316+
/**
317+
* @default to 'error'.
318+
* Sets handling of incoming payload that may contain a prototype poisoning security attack.
319+
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionspayloadprotoaction)
320+
*/
321+
protoAction?: 'error' | 'remove' | 'ignore';
322+
312323
/**
313324
* @default to 10000 (10 seconds).
314325
* Payload reception timeout in milliseconds. Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408)
@@ -497,15 +508,15 @@ export interface RouteOptionsSecureObject {
497508
/**
498509
* the max-age portion of the header, as a number. Default is 15768000.
499510
*/
500-
maxAge: number;
511+
maxAge?: number;
501512
/**
502513
* a boolean specifying whether to add the includeSubDomains flag to the header.
503514
*/
504-
includeSubDomains: boolean;
515+
includeSubDomains?: boolean;
505516
/**
506517
* a boolean specifying whether to add the 'preload' flag (used to submit domains inclusion in Chrome's HTTP Strict Transport Security (HSTS) preload list) to the header.
507518
*/
508-
preload: boolean;
519+
preload?: boolean;
509520
} | undefined;
510521
/**
511522
* controls the 'X-Frame-Options' header

lib/types/server/options.d.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ export interface ServerOptions {
8888
* false.
8989
*/
9090
debug?: false | {
91-
log?: string[] | false | undefined;
92-
request?: string[] | false | undefined;
91+
log?: string | string[] | false | undefined;
92+
request?: string | string[] | false | undefined;
9393
} | undefined;
9494

9595
/**
@@ -152,6 +152,19 @@ export interface ServerOptions {
152152
*/
153153
mime?: MimosOptions | undefined;
154154

155+
/**
156+
* @default { cleanStop: true }
157+
* Defines server handling of server operations.
158+
*/
159+
operations?: {
160+
/**
161+
* @default true
162+
* If true, the server keeps track of open connections and properly closes them when the server is stopped.
163+
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serveroptionsoperations)
164+
*/
165+
cleanStop?: boolean;
166+
}
167+
155168
/**
156169
* @default {}.
157170
* Plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the

lib/types/server/server.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ export class Server<A = ServerApplicationState> {
626626
* * path - the route path.
627627
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-servertablehost)
628628
*/
629-
table(host?: string | undefined): RequestRoute[];
629+
table(host?: string | string[] | undefined): RequestRoute[];
630630

631631
/**
632632
* Registers a server validation module used to compile raw validation rules into validation schemas for all routes.

lib/types/server/state.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export interface ServerStateCookieOptions {
6666
strictHeader?: boolean | undefined;
6767
/** used by proxy plugins (e.g. h2o2). */
6868
passThrough?: any | undefined;
69+
/** a function using the signature `async function(definition, request)` used to override a request-specific cookie settings */
70+
contextualize?(definition: ServerStateCookieOptions, request: Request): void | Promise<void>;
6971
}
7072

7173
/**

0 commit comments

Comments
 (0)