resolveQuery
Resolves and transforms context.params.query using a map of resolver functions. Each property in the resolver object receives the current query value and can return a transformed value. Runs before next() in the hook pipeline.
import { } from 'feathers-utils/resolvers';Example
import { resolveQuery, defaults } from 'feathers-utils/resolvers'
app.service('users').hooks({
before: {
find: [resolveQuery({ active: defaults(true) })]
}
})Type declaration
Show Type Declarations
/**
* Resolves and transforms `context.params.query` using a map of resolver functions.
* Each property in the resolver object receives the current query value and can return
* a transformed value. Runs before `next()` in the hook pipeline.
*
* @example
* ```ts
*
*
* app.service('users').hooks({
* before: {
* find: [resolveQuery({ active: defaults(true) })]
* }
* })
* ```
*/
export declare const resolveQuery: <H extends HookContext>(
resolvers: ResolverObject<any, H>,
) => {
(context: H, next: NextFunction): Promise<void>
(context: H): Promisable<H>
}| Argument | Type | Description |
|---|---|---|
| resolvers | ResolverObject<any, H> |
| type | methods | multi |
|---|---|---|
| before, around | find, get, create, update, patch, remove | yes |
Resolver Helpers
| Resolver | Description |
|---|---|
defaults | Returns a resolver property that sets a default value when the current value
is |
fromPredicate | Adapts an existing predicate function (like |
lowercase | Returns a resolver property that converts string values to lowercase. Non-string values are passed through unchanged. |
omit | Returns a resolver property that removes the field by returning |
setNow | Returns a resolver property that sets the field to the current timestamp
( |
trim | Returns a resolver property that trims whitespace from string values. Non-string values are passed through unchanged. |
Conditions
| Condition | Description |
|---|
