Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
combine(hook1, hook2, hook3);
// $ExpectType Hook>
debug('label', 'abc.def', 'ghi.jkl');
// $ExpectType Hook>
dePopulate();
// $ExpectType Hook>
disablePagination();
// $ExpectType Hook>
disallow('external', 'server');
// $ExpectType Hook>
discard('abc', 'def');
// $ExpectType Hook>
discardQuery('abc', 'def');
softDelete({
removeData: async () => ({})
});
const commentResolvers: ResolverMap = {
joins: {
author: $select => async comment => {
const authors = await service1.find({
query: { id: comment.userId, $select: $select || ['name'] },
paginate: false
});
comment.author = authors[0];
find: auth.hooks.authenticate('jwt'),
get: auth.hooks.authenticate('jwt'),
create: local.hooks.hashPassword(),
update: [
auth.hooks.authenticate('jwt'),
local.hooks.hashPassword()
],
patch: [
auth.hooks.authenticate('jwt'),
local.hooks.hashPassword()
],
remove: auth.hooks.authenticate('jwt'),
};
exports.after = {
all: when(hook => hook.provider, discard('password')),
create: emailVerification, // send email to verify the email addr ],
};
function emailVerification(hook, next) {
const user = hook.result;
console.log('-- Sending email to verify new user\'s email addr');
console.log(`Dear ${user.username}, please click this link to verify your email addr.`);
console.log(` http://localhost:3030/socket/verify/${user.verifyToken}`);
next(null, hook);
}
find: auth.hooks.authenticate('jwt'),
get: auth.hooks.authenticate('jwt'),
create: local.hooks.hashPassword(),
update: [
auth.hooks.authenticate('jwt'),
local.hooks.hashPassword()
],
patch: [
auth.hooks.authenticate('jwt'),
local.hooks.hashPassword()
],
remove: auth.hooks.authenticate('jwt'),
};
exports.after = {
all: when(hook => hook.provider, discard('password')),
create: emailVerification, // send email to verify the email addr ],
};
function emailVerification(hook, next) {
const user = hook.result;
console.log('-- Sending email to verify new user\'s email addr');
console.log(`Dear ${user.username}, please click this link to verify your email addr.`);
console.log(` http://localhost:3030/socket/verify/${user.verifyToken}`);
next(null, hook);
}
// Application hooks that run for every service
// const logger = require('./hooks/logger');
const { discard } = require('feathers-hooks-common');
module.exports = {
before: {
all: [],
find: [],
get: [],
create: [
discard('_id', '__v')
],
update: [
discard('_id', '__v')
],
patch: [
discard('_id', '__v')
],
remove: []
},
after: {
all: [
// logger()
],
find: [],
get: [],
module.exports = {
before: {
all: [],
find: [],
get: [ ...restrict ],
create: [ hashPassword() ],
update: [ ...restrict, hashPassword() ],
patch: [ ...restrict, hashPassword() ],
remove: [ ...restrict ]
},
after: {
all: [
commonHooks.when(
hook => hook.params.provider,
commonHooks.discard('password')
)
],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
after: {
all: [
xss({fields: xssFields}),
populate({schema: userSchema}),
populate({schema: categoriesSchema}),
populate({schema: candosSchema}),
populate({schema: commentsSchema}),
keepDeletedDataFields({
fields: [
'_id',
'deleted',
'createdAt',
'updatedAt'
]
}),
discard('wasSeeded')
],
find: [
when(isSingleItem(),
getAssociatedCanDos()
),
populate({schema: organizationSchema}),
thumbnails(thumbs)
],
get: [
getAssociatedCanDos(),
populate({schema: organizationSchema}),
thumbnails(thumbs)
],
create: [
createMentionNotifications(),
notifyFollowers(),
'resetShortToken',
'resetExpires'
)),
preventDisabledAdmin(),
loopItems(setUserInitials)
],
remove: [
...restrict
]
},
after: {
all: [
commonHooks.when(
hook => hook.params.provider,
commonHooks.discard('password', '_computed', 'verifyExpires', 'resetExpires', 'verifyChanges')
),
],
find: [
commonHooks.populate({ schema }),
commonHooks.serialize(serializeSchema),
],
get: [
commonHooks.populate({ schema }),
commonHooks.serialize(serializeSchema),
],
create: [
sendVerificationEmail(),
verifyHooks.removeVerification()
],
update: [
commonHooks.populate({ schema }),
module.exports = {
before: {
all: [],
find: [ authenticate('jwt') ],
get: [ ...restrict ],
create: [ hashPassword() ],
update: [ ...restrict, hashPassword() ],
patch: [ ...restrict, hashPassword() ],
remove: [ ...restrict ]
},
after: {
all: [
commonHooks.when(
hook => hook.params.provider,
commonHooks.discard('password')
)
],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
remove: [
authenticate('jwt'),
unless(isProvider('server'),
unless(isModerator(),
isVerified(),
restrictToOwner()
)
)
]
},
after: {
all: [
xss({ fields: xssFields }),
keepDeletedDataFields(),
discard('wasSeeded')
],
find: [
populate({ schema: userSchema }),
protect('content', 'badgeIds'),
concealBlacklistedData({
data: {
content: 'Comments of this blacklisted user are not visible.',
contentExcerpt: 'Comments of this blacklisted user are not visible.',
hasMore: false
}
})
],
get: [
populate({ schema: userSchema }),
concealBlacklistedData({
data: {