resolveResult
Resolves and transforms context.result using a map of resolver functions. Each property in the resolver object receives the current value and can return a transformed value. Runs after next() in the hook pipeline.
import { } from 'feathers-utils/resolvers';Example
import { resolveResult, omit } from 'feathers-utils/resolvers'
app.service('users').hooks({
after: {
all: [resolveResult({ password: omit() })]
}
})Type declaration
Show Type Declarations
type Result<H extends HookContext> = AnyFallback<
ResultSingleHookContext<H>,
Record<string, any>
>
/**
* Resolves and transforms `context.result` using a map of resolver functions.
* Each property in the resolver object receives the current value and can return
* a transformed value. Runs after `next()` in the hook pipeline.
*
* @example
* ```ts
*
*
* app.service('users').hooks({
* after: {
* all: [resolveResult({ password: omit() })]
* }
* })
* ```
*/
export declare const resolveResult: <
H extends HookContext = HookContext,
R = Result<H>,
>(
resolvers: ResolverObject<R, H>,
) => {
(context: H, next: NextFunction): Promise<void>
(context: H): Promisable<void>
}| Argument | Type | Description |
|---|---|---|
| resolvers | ResolverObject<R, H> |
| type | methods | multi |
|---|---|---|
| after, 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 |
|---|
