Hooks
| Hook | Description |
|---|---|
cache | Caches |
checkMulti | Checks if the |
checkRequired | Validates that the specified fields exist on |
combine | Sequentially executes multiple hooks, passing the updated context from one to the next. Returns a single hook function that runs the entire chain. If any hook throws, the error is annotated with the current hook context. |
createRelated | Creates related records in other services after a successful |
debug | Logs the current hook context to the console for debugging purposes. Displays timestamp, service path, method, type, id, data, query, result, and any additional param fields you specify. |
disablePagination | Disables pagination when |
disallow | Prevents access to a service method completely or for specific transports. When called without arguments, the method is blocked for all callers. When called with transport names, only those transports are blocked. |
iff | Conditionally executes a series of hooks when the predicate is truthy.
The predicate can be a boolean value or a sync/async function.
Supports an |
iffElse | Executes one array of hooks when the predicate is truthy, or another array when it is falsy.
The predicate can be a boolean or a sync/async function.
Unlike |
onDelete | |
paramsForServer | Client-side hook that moves whitelisted |
paramsFromClient | Server-side hook that extracts whitelisted properties from |
preventChanges | Prevents |
setData | Sets a property on each item in |
setField | Sets a field on the hook context (e.g. |
setResult | Sets a property on each item in |
setSlug | Extracts URL route parameters (slugs) and sets them on |
skippable | Wraps a hook so it can be conditionally skipped based on a predicate.
When the predicate returns |
softDelete | Marks items as deleted instead of physically removing them. On |
stashBefore | Stashes the current value of a record into |
throwIf | Throws a |
throwIfIsMulti | Throws a |
throwIfIsProvider | Throws a |
transformData | Transforms each item in |
transformQuery | Transforms |
transformResult | Transforms each item in |
traverse | Recursively walks and transforms fields in record(s) using |
unless | Executes a series of hooks when the predicate is falsy --- the inverse of |
