chore: fix dev hooks (#1006)

This commit is contained in:
Dan Ribbens
2022-08-26 11:11:21 -04:00
committed by GitHub
parent 4aa5500593
commit cf2eb3e482
2 changed files with 12 additions and 4 deletions

View File

@@ -1,11 +1,15 @@
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
import { CollectionConfig } from '../../../../src/collections/config/types'; import { CollectionConfig } from '../../../../src/collections/config/types';
import { openAccess } from '../../../helpers/configHelpers';
export const hooksSlug = 'hooks'; export const hooksSlug = 'hooks';
const Hooks: CollectionConfig = { const Hooks: CollectionConfig = {
slug: hooksSlug, slug: hooksSlug,
access: openAccess, access: {
read: () => true,
create: () => true,
delete: () => true,
update: () => true,
},
hooks: { hooks: {
beforeValidate: [({ data }) => validateHookOrder('collectionBeforeValidate', data)], beforeValidate: [({ data }) => validateHookOrder('collectionBeforeValidate', data)],
beforeChange: [({ data }) => validateHookOrder('collectionBeforeChange', data)], beforeChange: [({ data }) => validateHookOrder('collectionBeforeChange', data)],

View File

@@ -1,6 +1,5 @@
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
import { CollectionConfig } from '../../../../src/collections/config/types'; import { CollectionConfig } from '../../../../src/collections/config/types';
import { openAccess } from '../../../helpers/configHelpers';
const validateFieldTransformAction = (hook: string, value) => { const validateFieldTransformAction = (hook: string, value) => {
if (value !== undefined && value !== null && !Array.isArray(value)) { if (value !== undefined && value !== null && !Array.isArray(value)) {
@@ -12,7 +11,12 @@ const validateFieldTransformAction = (hook: string, value) => {
export const transformSlug = 'transforms'; export const transformSlug = 'transforms';
const TransformHooks: CollectionConfig = { const TransformHooks: CollectionConfig = {
slug: transformSlug, slug: transformSlug,
access: openAccess, access: {
read: () => true,
create: () => true,
delete: () => true,
update: () => true,
},
fields: [ fields: [
{ {
name: 'transform', name: 'transform',