Skip to content

Commit 9abfd86

Browse files
committed
Update catbox. Closes hapijs#4041
1 parent c1f3bdb commit 9abfd86

File tree

2 files changed

+36
-49
lines changed

2 files changed

+36
-49
lines changed

API.md

Lines changed: 35 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Sets up server-side caching providers. Every server includes a default cache for
6161
application state. By default, a simple memory-based cache is created which has limited capacity
6262
and capabilities.
6363

64-
**hapi** uses [**catbox**](https://github.com/hapijs/catbox) for its cache implementation which
64+
**hapi** uses [**catbox**](https://hapi.dev/family/catbox/api) for its cache implementation which
6565
includes support for common storage solutions (e.g. Redis, MongoDB, Memcached, Riak, among others).
6666
Caching is only utilized if [methods](#server.methods) and [plugins](#plugins) explicitly store
6767
their state in the cache.
@@ -70,7 +70,7 @@ The server cache configuration only defines the storage container itself. The co
7070
assigned one or more (array):
7171

7272
- a class or prototype function (usually obtained by calling `require()` on a **catbox** strategy
73-
such as `require('@hapi/catbox-redis')`). A new **catbox** [client](https://github.com/hapijs/catbox#client)
73+
such as `require('@hapi/catbox-redis')`). A new **catbox** [client](https://hapi.dev/family/catbox/api#client)
7474
will be created internally using this constructor.
7575

7676
- a configuration object with the following:
@@ -166,38 +166,29 @@ Default value: `{ sampleInterval: 0 }`.
166166

167167
Server excessive load handling limits where:
168168

169-
- `sampleInterval` - the frequency of sampling in milliseconds. When set to `0`, the other load
170-
options are ignored. Defaults to `0` (no sampling).
169+
- `sampleInterval` - the frequency of sampling in milliseconds. When set to `0`, the other load options are ignored. Defaults to `0` (no sampling).
171170

172-
- `maxHeapUsedBytes` - maximum V8 heap size over which incoming requests are rejected with an HTTP
173-
Server Timeout (503) response. Defaults to `0` (no limit).
171+
- `maxHeapUsedBytes` - maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to `0` (no limit).
174172

175-
- `maxRssBytes` - maximum process RSS size over which incoming requests are rejected with an HTTP
176-
Server Timeout (503) response. Defaults to `0` (no limit).
173+
- `maxRssBytes` - maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to `0` (no limit).
177174

178-
- `maxEventLoopDelay` - maximum event loop delay duration in milliseconds over which incoming
179-
requests are rejected with an HTTP Server Timeout (503) response. Defaults to `0` (no limit).
175+
- `maxEventLoopDelay` - maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to `0` (no limit).
180176

181177
#### <a name="server.options.mime" /> `server.options.mime`
182178

183179
Default value: none.
184180

185-
Options passed to the [**mimos**](https://github.com/hapijs/mimos) module when generating the mime
186-
database used by the server (and accessed via [`server.mime`](#server.mime)):
181+
Options passed to the [**mimos**](https://hapi.dev/family/mimos/api) module when generating the mime database used by the server (and accessed via [`server.mime`](#server.mime)):
187182

188-
- `override` - an object hash that is merged into the built in mime information specified
189-
[here](https://github.com/jshttp/mime-db). Each key value pair represents a single mime object.
190-
Each override value must contain:
183+
- `override` - an object hash that is merged into the built in mime information specified [here](https://github.com/jshttp/mime-db). Each key value pair represents a single mime object. Each override value must contain:
191184

192185
- `key` - the lower-cased mime-type string (e.g. `'application/javascript'`).
193186

194-
- `value` - an object following the specifications outlined [here](https://github.com/jshttp/mime-db#data-structure).
195-
Additional values include:
187+
- `value` - an object following the specifications outlined [here](https://github.com/jshttp/mime-db#data-structure). Additional values include:
196188

197189
- `type` - specify the `type` value of result objects, defaults to `key`.
198190

199-
- `predicate` - method with signature `function(mime)` when this mime type is found in the
200-
database, this function will execute to allows customizations.
191+
- `predicate` - method with signature `function(mime)` when this mime type is found in the database, this function will execute to allows customizations.
201192

202193
```js
203194
const options = {
@@ -438,7 +429,7 @@ console.log(server.decorations.toolkit); // ['success']
438429

439430
Access: **podium** public interface.
440431

441-
The server events emitter. Utilizes the [**podium**](https://github.com/hapijs/podium) with support
432+
The server events emitter. Utilizes the [**podium**](https://hapi.dev/family/podium/api) with support
442433
for event criteria validation, channels, and filters.
443434

444435
Use the following methods to interact with `server.events`:
@@ -1162,7 +1153,7 @@ exports.plugin = {
11621153

11631154
Provisions a cache segment within the server cache facility where:
11641155

1165-
- `options` - [**catbox** policy](https://github.com/hapijs/catbox#policy) configuration where:
1156+
- `options` - [**catbox** policy](https://hapi.dev/family/catbox/api#policy) configuration where:
11661157

11671158
- `expiresIn` - relative expiration expressed in the number of milliseconds since the item was
11681159
saved in the cache. Cannot be used together with `expiresAt`.
@@ -1214,6 +1205,8 @@ Provisions a cache segment within the server cache facility where:
12141205
- `shared` - if `true`, allows multiple cache provisions to share the same segment. Default to
12151206
`false`.
12161207

1208+
Return value: a [**catbox** policy](https://hapi.dev/family/catbox/api#policy) object.
1209+
12171210
```js
12181211
const Hapi = require('@hapi/hapi');
12191212

@@ -1513,7 +1506,7 @@ Register custom application events where:
15131506
registrations, only the first configuration is used. Defaults to `false` (a duplicate
15141507
registration will throw an error).
15151508

1516-
- a [**podium**](https://github.com/hapijs/podium) emitter object.
1509+
- a [**podium**](https://hapi.dev/family/podium/api) emitter object.
15171510

15181511
- an array containing any of the above.
15191512

@@ -1847,7 +1840,7 @@ Injects a request into the server simulating an incoming HTTP request without ma
18471840
socket connection. Injection is useful for testing purposes as well as for invoking routing logic
18481841
internally without the overhead and limitations of the network stack.
18491842

1850-
The method utilizes the [**shot**](https://github.com/hapijs/shot) module for performing
1843+
The method utilizes the [**shot**](https://hapi.dev/family/shot/api) module for performing
18511844
injections, with some additional options and response properties:
18521845

18531846
- `options` - can be assigned a string with the requested URI, or an object with:
@@ -2453,24 +2446,24 @@ across multiple requests. Registers a cookie definitions where:
24532446
- `'base64'` - string value is encoded using Base64.
24542447
- `'base64json'` - object value is JSON-stringified then encoded using Base64.
24552448
- `'form'` - object value is encoded using the _x-www-form-urlencoded_ method.
2456-
- `'iron'` - Encrypts and sign the value using [**iron**](https://github.com/hueniverse/iron).
2449+
- `'iron'` - Encrypts and sign the value using [**iron**](https://hapi.dev/family/iron/api).
24572450

24582451
- `sign` - an object used to calculate an HMAC for cookie integrity validation. This does not provide privacy, only a mean to verify that the cookie value was generated by the server. Redundant when `'iron'` encoding is used. Options are:
24592452

2460-
- `integrity` - algorithm options. Defaults to [`require('iron').defaults.integrity`](https://github.com/hueniverse/iron#options).
2453+
- `integrity` - algorithm options. Defaults to [`require('iron').defaults.integrity`](https://hapi.dev/family/iron/api/#options).
24612454
- `password` - password used for HMAC key generation (must be at least 32 characters long).
24622455

24632456
- `password` - password used for `'iron'` encoding (must be at least 32 characters long).
24642457

2465-
- `iron` - options for `'iron'` encoding. Defaults to [`require('iron').defaults`](https://github.com/hueniverse/iron#options).
2458+
- `iron` - options for `'iron'` encoding. Defaults to [`require('iron').defaults`](https://hapi.dev/family/iron/api/#options).
24662459

24672460
- `ignoreErrors` - if `true`, errors are ignored and treated as missing cookies.
24682461

24692462
- `clearInvalid` - if `true`, automatically instruct the client to remove invalid cookies. Defaults to `false`.
24702463

24712464
- `strictHeader` - if `false`, allows any cookie value including values in violation of [RFC 6265](https://tools.ietf.org/html/rfc6265). Defaults to `true`.
24722465

2473-
- `passThrough` - used by proxy plugins (e.g. [**h2o2**](https://github.com/hapijs/h2o2)).
2466+
- `passThrough` - used by proxy plugins (e.g. [**h2o2**](https://hapi.dev/family/h2o2/api)).
24742467

24752468
- `contextualize` - a function using the signature `async function(definition, request)` used to override a request-specific cookie settings where:
24762469

@@ -2711,7 +2704,7 @@ The authentication mode. Available values:
27112704
Default value: `false`, unless the scheme requires payload authentication.
27122705

27132706
If set, the incoming request payload is authenticated after it is processed. Requires a strategy
2714-
with payload authentication support (e.g. [Hawk](#https://github.com/hueniverse/hawk)). Cannot be
2707+
with payload authentication support (e.g. [Hawk](https://hapi.dev/family/hawk/api)). Cannot be
27152708
set to a value other than `'required'` when the scheme sets the authentication `options.payload` to
27162709
`true`.
27172710

@@ -2884,7 +2877,7 @@ string payload or escaping it after stringification. Supports the following:
28842877

28852878
- `suffix` - string suffix added after conversion to JSON string. Defaults to no suffix.
28862879

2887-
- `escape` - calls [`Hoek.jsonEscape()`](https://github.com/hapijs/hoek/blob/master/API.md#escapejsonstring)
2880+
- `escape` - calls [`Hoek.jsonEscape()`](https://hapi.dev/family/hoek/api/#escapejsonstring)
28882881
after conversion to JSON string. Defaults to `false`.
28892882

28902883
### <a name="route.options.jsonp" /> `route.options.jsonp`
@@ -3003,7 +2996,7 @@ The processed payload format. The value must be one of:
30032996
`headers` properties. Note that payload streams for multipart payloads are a synthetic interface
30042997
created on top of the entire mutlipart content loaded into memory. To avoid loading large
30052998
multipart payloads into memory, set [`parse`](#route.options.payload.parse) to `false` and handle
3006-
the multipart payload in the handler using a streaming parser (e.g. [**pez**](https://github.com/hapijs/pez)).
2999+
the multipart payload in the handler using a streaming parser (e.g. [**pez**](https://hapi.dev/family/pez/api)).
30073000

30083001
- `'file'` - the incoming payload is written to temporary file in the directory specified by the
30093002
[`uploads`](#route.options.payload.uploads) settings. If the payload is 'multipart/form-data' and
@@ -3184,12 +3177,7 @@ If `true`, applies the validation rule changes to the response payload.
31843177

31853178
Default value: none.
31863179

3187-
[**joi**](https://github.com/hapijs/joi) options object pass to the validation function. Useful to
3188-
set global options such as `stripUnknown` or `abortEarly` (the complete list is available
3189-
[here](https://github.com/hapijs/joi/blob/master/API.md#validatevalue-schema-options-callback)).
3190-
If a custom validation function is defined via [`schema`](#route.options.response.schema) or
3191-
[`status`](#route.options.response.status) then `options` can an arbitrary object that will be
3192-
passed to this function as the second argument.
3180+
[**joi**](https://hapi.dev/family/joi/api) options object pass to the validation function. Useful to set global options such as `stripUnknown` or `abortEarly`. If a custom validation function is defined via [`schema`](#route.options.response.schema) or [`status`](#route.options.response.status) then `options` can an arbitrary object that will be passed to this function as the second argument.
31933181

31943182
#### <a name="route.options.response.ranges" /> `route.options.response.ranges`
31953183

@@ -3213,7 +3201,7 @@ The default response payload validation rules (for all non-error responses) expr
32133201

32143202
- `false` - no payload allowed.
32153203

3216-
- a [**joi**](https://github.com/hapijs/joi) validation object. The [`options`](#route.options.response.options)
3204+
- a [**joi**](https://hapi.dev/family/joi/api) validation object. The [`options`](#route.options.response.options)
32173205
along with the request context (`{ headers, params, query, payload, state, app, auth }`) are passed to
32183206
the validation function.
32193207

@@ -3376,7 +3364,7 @@ Validation rules for incoming request headers:
33763364

33773365
- `true` - any headers allowed (no validation performed).
33783366

3379-
- a [**joi**](https://github.com/hapijs/joi) validation object.
3367+
- a [**joi**](https://hapi.dev/family/joi/api) validation object.
33803368

33813369
- a validation function using the signature `async function(value, options)` where:
33823370

@@ -3393,9 +3381,8 @@ Note that all header field names must be in lowercase to match the headers norma
33933381

33943382
Default value: none.
33953383

3396-
An options object passed to the [**joi**](https://github.com/hapijs/joi) rules or the custom
3397-
validation methods. Used for setting global options such as `stripUnknown` or `abortEarly` (the
3398-
complete list is available [here](https://github.com/hapijs/joi/blob/master/API.md#validatevalue-schema-options-callback)).
3384+
An options object passed to the [**joi**](https://hapi.dev/family/joi/api) rules or the custom
3385+
validation methods. Used for setting global options such as `stripUnknown` or `abortEarly`.
33993386

34003387
If a custom validation function (see `headers`, `params`, `query`, or `payload` above) is defined
34013388
then `options` can an arbitrary object that will be passed to this function as the second
@@ -3422,7 +3409,7 @@ extracting any parameters, and storing them in [`request.params`](#request.param
34223409

34233410
- `true` - any path parameter value allowed (no validation performed).
34243411

3425-
- a [**joi**](https://github.com/hapijs/joi) validation object.
3412+
- a [**joi**](https://hapi.dev/family/joi/api) validation object.
34263413

34273414
- a validation function using the signature `async function(value, options)` where:
34283415

@@ -3447,7 +3434,7 @@ Validation rules for incoming request payload (request body), where:
34473434

34483435
- `false` - no payload allowed.
34493436

3450-
- a [**joi**](https://github.com/hapijs/joi) validation object.
3437+
- a [**joi**](https://hapi.dev/family/joi/api) validation object.
34513438
- Note that empty payloads are represented by a `null` value. If a validation schema is
34523439
provided and empty payload are allowed, the schema must be explicitly defined by setting the
34533440
rule to a **joi** schema with `null` allowed (e.g.
@@ -3478,7 +3465,7 @@ Validation rules for incoming request URI query component (the key-value part of
34783465

34793466
- `false` - no query parameter value allowed.
34803467

3481-
- a [**joi**](https://github.com/hapijs/joi) validation object.
3468+
- a [**joi**](https://hapi.dev/family/joi/api) validation object.
34823469

34833470
- a validation function using the signature `async function(value, options)` where:
34843471

@@ -3503,7 +3490,7 @@ Validation rules for incoming cookies. The `cookie` header is parsed and decoded
35033490

35043491
- `false` - no cookies allowed.
35053492

3506-
- a [**joi**](https://github.com/hapijs/joi) validation object.
3493+
- a [**joi**](https://hapi.dev/family/joi/api) validation object.
35073494

35083495
- a validation function using the signature `async function(value, options)` where:
35093496

@@ -3656,7 +3643,7 @@ The return value must be one of:
36563643
- `Buffer` object
36573644
- `Error` object
36583645
- plain `Error`.
3659-
- a [`Boom`](https://github.com/hapijs/boom) object.
3646+
- a [`Boom`](https://hapi.dev/family/boom/api) object.
36603647
- `Stream` object
36613648
- must be compatible with the "streams2" API and not be in `objectMode`.
36623649
- if the stream object has a `statusCode` property, that status code will be used as
@@ -3764,7 +3751,7 @@ values:
37643751

37653752
#### Errors
37663753

3767-
**hapi** uses the [**boom**](https://github.com/hapijs/boom) error library for all its internal
3754+
**hapi** uses the [**boom**](https://hapi.dev/family/boom/api) error library for all its internal
37683755
error generation. **boom** provides an expressive interface to return HTTP errors. Any error
37693756
thrown by a [lifecycle method](#lifecycle-methods) is converted into a **boom** object and defaults to status
37703757
code `500` if the error is not already a **boom** object.
@@ -3846,7 +3833,7 @@ const handler = function (request, h) {
38463833

38473834
When a different error representation is desired, such as an HTML page or a different payload
38483835
format, the `'onPreResponse'` extension point may be used to identify errors and replace them with
3849-
a different response object, as in this example using [Vision's](https://github.com/hapijs/vision)
3836+
a different response object, as in this example using [Vision's](https://hapi.dev/family/vision/api)
38503837
`.view()` [response toolkit](#response-toolkit) property.
38513838

38523839
```js

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@hapi/boom": "9.x.x",
2121
"@hapi/bounce": "2.x.x",
2222
"@hapi/call": "8.x.x",
23-
"@hapi/catbox": "11.x.x",
23+
"@hapi/catbox": "^11.1.0",
2424
"@hapi/catbox-memory": "5.x.x",
2525
"@hapi/heavy": "7.x.x",
2626
"@hapi/hoek": "9.x.x",

0 commit comments

Comments
 (0)