feathers-utils
v7.0.0
Published
Some utils for projects using '@feathersjs/feathers'
Downloads
6,276
Readme
feathers-utils
NOTE: This is the version for Feathers v5. For Feathers v4 use feathers-utils v1
Installation
npm i feathers-utils
Usage
Hooks
checkMulti
: throws if the request is multi data, but the servicesallowsMulti(method)
returnsfalse
createRelated
: simply create related items from a hook.forEach
onDelete
: simply remove/set null related items from a hook.paramsForServer
paramsFromClient
parseFields
removeRelated
: simple remove related items from a hook. Basicallycascade
at feathers level.runPerItem
: run a function for every item. Meant formulti:true
.setData
: map properties fromcontext
todata
. Something likeuserId: context.params.user.id
Mixins
mixins/debounceMixin
&mixins/DebouncedStore
Utils
defineHooks
filterQuery
flattenQuery
deflattenQuery
getItemsIsArray(context)
: returns{ items: any[], isArray: boolean }
getPaginate
isMulti(context) => Boolean
: returns true, iffind
,create/patch/remove
: multiisPaginated
markHookForSkip
: add hookName tocontext.params.skipHooks
- also seeshouldSkip
mergeQuery
: deeply merges queriesmergeArrays
: merges arrays with intersection optionspushSet
: if existing array: push, else setsetQueryKeySafely
setResultEmpty
shouldSkip
: checkscontext.params.skipHooks
for'all' | '${hookName}' | '${type}:${hookName}'
- also seemarkHookForSkip