diff --git a/README.md b/README.md index de6fe05..b4d29fe 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,9 @@ app.service('posts').hooks({ | `keyHere` | The primary or secondary key for this entry

**required if `params` is not complex (most of the time)**
**Type:** `String` | | `keyThere` | The primary or secondary key for the referenced entry/entries

**required if `keyHere` is defined**
**Type:** `String` | | `asArray` | Is the referenced item a single entry or an array of entries?

**optional - default:** `true`
**Type:** `Boolean` -| `requestPerItem` | Decided wether your `params` object/function runs against each item individually or bundled. Most of the time you don't need this.

**optional - default:
- `false`** (if `keyHere` and `keyThere` are defined)
- **`true`** (if `keyHere` and `keyThere` are not defined)
**Type:** `String` +| `requestPerItem` | Decided wether your `params` object/function runs against each item individually or bundled. Most of the time you don't need this.

**optional - default:
- `false`** (if `keyHere` and `keyThere` are defined)
- **`true`** (if `keyHere` and `keyThere` are not defined)
**Type:** `Boolean` | `catchOnError` | Wether the hook continues populating, if an error occurs (e.g. because of missing authentication) or throws. Also can be set on the prior options

**optional - default:** `false`
**Type:**: `Boolean` | -| `params` | Additional params to be passed to the underlying service.
You can mutate the passed `params` object or return a newly created `params` object which gets merged deeply
Merged deeply after the params are generated internally.
**ProTip #1:** You can use this for adding a '$select' property or passing authentication and user data from 'context' to 'params' to restrict accesss
**ProTip #2:** If you don't define `keyHere` and `keyThere` or set `requestPerItem` to `true` the function has access to the _`this` keyword_ being the individual item the request will be made for.
**ProTip #3**: You can skip a `requestPerItem` if it returns `undefined`.
**ProTip #4**: The hook whats for async functions!

**optional - default:** `{}`
**Possible types:**
- `Object`: _will be merged with params - simple requests_
- `Function(params, context, { path, service }) => params`: _needs to return the `params` or a new one which gets merged deeply - more complex_
- `Function(params, context, { path, service }) => Promise`
- `[Object | Function]` | +| `params` | Additional params to be passed to the underlying service.
You can mutate the passed `params` object or return a newly created `params` object which gets merged deeply
Merged deeply after the params are generated internally.
**ProTip #1:** You can use this for adding a '$select' property or passing authentication and user data from 'context' to 'params' to restrict accesss
**ProTip #2:** If you don't define `keyHere` and `keyThere` or set `requestPerItem` to `true` the function has access to the _`this` keyword_ being the individual item the request will be made for.
**ProTip #3**: You can skip a `requestPerItem` if it returns `undefined`.
**ProTip #4**: The hook whats for async functions!

**optional - default:** `{}`
**Possible types:**
- `Object`: _will be merged with params - simple requests_
- `Function(params, context, { path, service }) => params`: _needs to return the `params` or a new one which gets merged deeply - more complex_
- `Function(params, context, { path, service }) => Promise`
- `[Object \| Function]` | ## Multiple Populates ```js