Skip to content

context

Reads the call itself — method, type, path, id, service — or the context as a whole, rather than one of its payloads.

NameCategoryDescription
debug
hooks

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.

checkContext
utils

Validates that the hook context matches the expected type(s) and method(s). Throws an error if the context is invalid, preventing hooks from running in unsupported configurations. Typically used internally by other hooks. Also narrows the context type based on the passed options.

The options form takes the same criteria as isContexttype, method, path and id — and reports every one of them that did not match. Only type, method and path narrow the context type.

contextToJson
utils

Converts a FeathersJS HookContext to a plain JSON object by calling toJSON() if available. This is important when using lodash get/has on the context, since the HookContext class uses getters that may not be enumerable.

isContext
predicates

Returns a predicate that checks whether the hook context matches the given criteria. You can filter by path (service name), type (before/after/around/error), method (find/get/create/update/patch/remove) and/or id (the record a get/update/patch/remove addresses, null for the multi variants).

See all tags for the full vocabulary.

Released under the MIT License.