* feat: add afterOperation hook for Find operation * docs: change #afterOperation to #afteroperation * chore: extract afterOperation in function * chore: implement afterChange in operations * docs: use proper CollectionAfterOperationHook * chore: remove outdated info * chore: types afterOperation hook * chore: improves afterOperation tests * docs: updates description of afterOperation hook * chore: improve typings * chore: improve types * chore: rename index.tsx => index.ts --------- Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com> Co-authored-by: Alessio Gravili <alessio@gravili.de>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { buildConfigWithDefaults } from '../buildConfigWithDefaults';
|
|
import TransformHooks from './collections/Transform';
|
|
import Hooks, { hooksSlug } from './collections/Hook';
|
|
import NestedAfterReadHooks from './collections/NestedAfterReadHooks';
|
|
import ChainingHooks from './collections/ChainingHooks';
|
|
import Relations from './collections/Relations';
|
|
import AfterOperation from './collections/AfterOperation';
|
|
import Users, { seedHooksUsers } from './collections/Users';
|
|
import ContextHooks from './collections/ContextHooks';
|
|
|
|
export default buildConfigWithDefaults({
|
|
collections: [
|
|
AfterOperation,
|
|
ContextHooks,
|
|
TransformHooks,
|
|
Hooks,
|
|
NestedAfterReadHooks,
|
|
ChainingHooks,
|
|
Relations,
|
|
Users,
|
|
],
|
|
onInit: async (payload) => {
|
|
await seedHooksUsers(payload);
|
|
await payload.create({
|
|
collection: hooksSlug,
|
|
data: {
|
|
check: 'update',
|
|
fieldBeforeValidate: false,
|
|
collectionBeforeValidate: false,
|
|
fieldBeforeChange: false,
|
|
collectionBeforeChange: false,
|
|
fieldAfterChange: false,
|
|
collectionAfterChange: false,
|
|
collectionBeforeRead: false,
|
|
fieldAfterRead: false,
|
|
collectionAfterRead: false,
|
|
},
|
|
});
|
|
},
|
|
});
|