chore: fix dev hooks (#1006)
This commit is contained in:
@@ -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)],
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
Reference in New Issue
Block a user