Skip to content

Commit

Permalink
Merge remote-tracking branch 'joshkel/type-updates'
Browse files Browse the repository at this point in the history
  • Loading branch information
devinivy committed Jan 13, 2023
2 parents 95ad58f + d7582ee commit 6232cb7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/types/response.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export interface ResponseObject extends Podium {
* Only available after calling the response.redirect() method.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-responsetemporaryistemporary)
*/
temporary(isTemporary: boolean): ResponseObject;
temporary(isTemporary?: boolean): ResponseObject;

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

/**
* 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'
Expand All @@ -335,7 +335,7 @@ export interface ResponseObject extends Podium {
* Only available after calling the response.redirect() method.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-responserewritableisrewritable)
*/
rewritable(isRewritable: boolean): ResponseObject;
rewritable(isRewritable?: boolean): ResponseObject;
}

/**
Expand Down
17 changes: 14 additions & 3 deletions lib/types/route.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ export interface RouteOptionsCors {
* if true, allows user credentials to be sent ('Access-Control-Allow-Credentials'). Defaults to false.
*/
credentials?: boolean | undefined;
/**
* the status code used for CORS preflight responses, either 200 or 204. Defaults to 200.
*/
preflightStatusCode?: 200 | 204;
}

/**
Expand Down Expand Up @@ -309,6 +313,13 @@ export interface RouteOptionsPayload {
*/
parse?: boolean | 'gunzip' | undefined;

/**
* @default to 'error'.
* Sets handling of incoming payload that may contain a prototype poisoning security attack.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionspayloadprotoaction)
*/
protoAction?: 'error' | 'remove' | 'ignore';

/**
* @default to 10000 (10 seconds).
* 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)
Expand Down Expand Up @@ -497,15 +508,15 @@ export interface RouteOptionsSecureObject {
/**
* the max-age portion of the header, as a number. Default is 15768000.
*/
maxAge: number;
maxAge?: number;
/**
* a boolean specifying whether to add the includeSubDomains flag to the header.
*/
includeSubDomains: boolean;
includeSubDomains?: boolean;
/**
* 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.
*/
preload: boolean;
preload?: boolean;
} | undefined;
/**
* controls the 'X-Frame-Options' header
Expand Down
17 changes: 15 additions & 2 deletions lib/types/server/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export interface ServerOptions {
* false.
*/
debug?: false | {
log?: string[] | false | undefined;
request?: string[] | false | undefined;
log?: string | string[] | false | undefined;
request?: string | string[] | false | undefined;
} | undefined;

/**
Expand Down Expand Up @@ -152,6 +152,19 @@ export interface ServerOptions {
*/
mime?: MimosOptions | undefined;

/**
* @default { cleanStop: true }
* Defines server handling of server operations.
*/
operations?: {
/**
* @default true
* If true, the server keeps track of open connections and properly closes them when the server is stopped.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serveroptionsoperations)
*/
cleanStop?: boolean;
}

/**
* @default {}.
* 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
Expand Down
2 changes: 1 addition & 1 deletion lib/types/server/server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ export class Server<A = ServerApplicationState> {
* * path - the route path.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-servertablehost)
*/
table(host?: string | undefined): RequestRoute[];
table(host?: string | string[] | undefined): RequestRoute[];

/**
* Registers a server validation module used to compile raw validation rules into validation schemas for all routes.
Expand Down
2 changes: 2 additions & 0 deletions lib/types/server/state.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export interface ServerStateCookieOptions {
strictHeader?: boolean | undefined;
/** used by proxy plugins (e.g. h2o2). */
passThrough?: any | undefined;
/** a function using the signature `async function(definition, request)` used to override a request-specific cookie settings */
contextualize?(definition: ServerStateCookieOptions, request: Request): void | Promise<void>;
}

/**
Expand Down

0 comments on commit 6232cb7

Please sign in to comment.