@strapi/content-type-builder 5.0.0-rc.9 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/_chunks/{ListView-BUKiiZrv.js → ListView-DNrG3LP8.js} +12 -11
  2. package/dist/_chunks/ListView-DNrG3LP8.js.map +1 -0
  3. package/dist/_chunks/{ListView-B33vu6Br.mjs → ListView-DzU2cU42.mjs} +12 -11
  4. package/dist/_chunks/ListView-DzU2cU42.mjs.map +1 -0
  5. package/dist/_chunks/{index-Hl6JWkwo.js → index-BOYSLPpG.js} +104 -179
  6. package/dist/_chunks/index-BOYSLPpG.js.map +1 -0
  7. package/dist/_chunks/{index-CCJpNwsW.mjs → index-BgNIUYf6.mjs} +108 -183
  8. package/dist/_chunks/index-BgNIUYf6.mjs.map +1 -0
  9. package/dist/_chunks/{index-nJaZni0J.js → index-Bp9_1YUM.js} +146 -5
  10. package/dist/_chunks/index-Bp9_1YUM.js.map +1 -0
  11. package/dist/_chunks/{index-BxeoMEGY.mjs → index-N6VHEZs0.mjs} +156 -16
  12. package/dist/_chunks/index-N6VHEZs0.mjs.map +1 -0
  13. package/dist/admin/index.js +5 -2
  14. package/dist/admin/index.js.map +1 -1
  15. package/dist/admin/index.mjs +4 -2
  16. package/dist/admin/src/components/FormModal/attributes/form.d.ts +1 -1
  17. package/dist/admin/src/components/FormModal/utils/relations.d.ts +2 -2
  18. package/dist/admin/src/components/FormModalNavigationProvider/constants.d.ts +1 -0
  19. package/dist/admin/src/components/SelectCategory.d.ts +2 -1
  20. package/dist/admin/src/contexts/FormModalNavigationContext.d.ts +2 -0
  21. package/dist/admin/src/exports.d.ts +15 -0
  22. package/dist/admin/src/index.d.ts +1 -0
  23. package/dist/admin/src/utils/parseDateValue.d.ts +1 -0
  24. package/dist/admin/src/utils/timeFormat.d.ts +16 -0
  25. package/dist/server/index.js +91 -54
  26. package/dist/server/index.js.map +1 -1
  27. package/dist/server/index.mjs +92 -55
  28. package/dist/server/index.mjs.map +1 -1
  29. package/dist/server/src/controllers/validation/model-schema.d.ts.map +1 -1
  30. package/dist/server/src/services/builder.d.ts +4 -0
  31. package/dist/server/src/services/builder.d.ts.map +1 -1
  32. package/dist/server/src/services/constants.d.ts +0 -1
  33. package/dist/server/src/services/constants.d.ts.map +1 -1
  34. package/dist/server/src/services/schema-builder/content-type-builder.d.ts.map +1 -1
  35. package/package.json +9 -8
  36. package/dist/_chunks/ListView-B33vu6Br.mjs.map +0 -1
  37. package/dist/_chunks/ListView-BUKiiZrv.js.map +0 -1
  38. package/dist/_chunks/index-BxeoMEGY.mjs.map +0 -1
  39. package/dist/_chunks/index-CCJpNwsW.mjs.map +0 -1
  40. package/dist/_chunks/index-Hl6JWkwo.js.map +0 -1
  41. package/dist/_chunks/index-nJaZni0J.js.map +0 -1
  42. package/strapi-server.js +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-N6VHEZs0.mjs","sources":["../../admin/src/constants.ts","../../admin/src/pluginId.ts","../../admin/src/utils/getRelationType.ts","../../admin/src/utils/makeUnique.ts","../../admin/src/components/DataManagerProvider/constants.ts","../../admin/src/components/DataManagerProvider/utils/retrieveComponentsFromSchema.ts","../../admin/src/components/DataManagerProvider/reducer.ts","../../admin/src/utils/nameToSlug.ts","../../admin/src/components/FormModal/constants.ts","../../admin/src/components/FormModal/utils/createUid.ts","../../admin/src/components/FormModal/utils/customFieldDefaultOptionsReducer.ts","../../admin/src/components/FormModal/utils/relations.ts","../../admin/src/components/FormModal/reducer.ts","../../admin/src/reducers.ts","../../admin/src/utils/formAPI.ts","../../admin/src/utils/prefixPluginTranslations.ts","../../admin/src/components/AutoReloadOverlayBlocker.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PERMISSIONS = {\n // This permission regards the main component (App) and is used to tell\n // If the plugin link should be displayed in the menu\n // And also if the plugin is accessible. This use case is found when a user types the url of the\n // plugin directly in the browser\n main: [{ action: 'plugin::content-type-builder.read', subject: null }],\n};\n\nexport const MAX_COMPONENT_DEPTH = 6;\n","import pluginPkg from '../../package.json';\n\nexport const pluginId = pluginPkg.name.replace(/^@strapi\\//i, '');\n","import type { Schema } from '@strapi/types';\n\n/**\n *\n * Retrieves the relation type\n */\nexport const getRelationType = (\n relation: Schema.Attribute.RelationKind.WithTarget | undefined,\n targetAttribute?: string | null\n) => {\n const hasNotTargetAttribute = targetAttribute === undefined || targetAttribute === null;\n\n if (relation === 'oneToOne' && hasNotTargetAttribute) {\n return 'oneWay';\n }\n\n if (relation === 'oneToMany' && hasNotTargetAttribute) {\n return 'manyWay';\n }\n\n return relation;\n};\n","const makeUnique = <T extends string>(array: T[]): T[] => [...new Set(array)];\n\nexport { makeUnique };\n","export const ADD_ATTRIBUTE = 'ContentTypeBuilder/DataManagerProvider/ADD_ATTRIBUTE';\nexport const ADD_CUSTOM_FIELD_ATTRIBUTE =\n 'ContentTypeBuilder/DataManagerProvider/ADD_CUSTOM_FIELD_ATTRIBUTE';\nexport const ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE =\n 'ContentTypeBuilder/DataManagerProvider/ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE';\nexport const CHANGE_DYNAMIC_ZONE_COMPONENTS =\n 'ContentTypeBuilder/DataManagerProvider/CHANGE_DYNAMIC_ZONE_COMPONENTS';\nexport const CREATE_SCHEMA = 'ContentTypeBuilder/DataManagerProvider/CREATE_SCHEMA';\nexport const CREATE_COMPONENT_SCHEMA =\n 'ContentTypeBuilder/DataManagerProvider/CREATE_COMPONENT_SCHEMA';\nexport const DELETE_NOT_SAVED_TYPE = 'ContentTypeBuilder/DataManagerProvider/DELETE_NOT_SAVED_TYPE';\nexport const EDIT_ATTRIBUTE = 'ContentTypeBuilder/DataManagerProvider/EDIT_ATTRIBUTE';\nexport const EDIT_CUSTOM_FIELD_ATTRIBUTE =\n 'ContentTypeBuilder/DataManagerProvider/EDIT_CUSTOM_FIELD_ATTRIBUTE';\nexport const GET_DATA_SUCCEEDED = 'ContentTypeBuilder/DataManagerProvider/GET_DATA_SUCCEEDED';\nexport const RELOAD_PLUGIN = 'ContentTypeBuilder/DataManagerProvider/RELOAD_PLUGIN';\nexport const REMOVE_FIELD_FROM_DISPLAYED_COMPONENT =\n 'ContentTypeBuilder/DataManagerProvider/REMOVE_FIELD_FROM_DISPLAYED_COMPONENT';\nexport const REMOVE_COMPONENT_FROM_DYNAMIC_ZONE =\n 'ContentTypeBuilder/DataManagerProvider/REMOVE_COMPONENT_FROM_DYNAMIC_ZONE';\nexport const REMOVE_FIELD = 'ContentTypeBuilder/DataManagerProvider/REMOVE_FIELD';\nexport const SET_MODIFIED_DATA = 'ContentTypeBuilder/DataManagerProvider/SET_MODIFIED_DATA';\nexport const UPDATE_SCHEMA = 'ContentTypeBuilder/DataManagerProvider/UPDATE_SCHEMA';\nexport const UPDATE_INITIAL_STATE = 'ContentTypeBuilder/DataManagerProvider/UPDATE_INITIAL_STATE';\n","import get from 'lodash/get';\n\nimport { makeUnique } from '../../../utils/makeUnique';\n\nimport type { AttributeType, Components } from '../../../types';\nimport type { Internal } from '@strapi/types';\n\nconst retrieveComponentsFromSchema = (\n attributes: AttributeType[],\n allComponentsData: Components\n): Internal.UID.Component[] => {\n const allComponents: Internal.UID.Component[] = attributes.reduce((acc: any, current) => {\n const type = current.type;\n if (type === 'component') {\n const currentComponentName = current.component;\n // Push the existing compo\n acc.push(currentComponentName);\n\n const currentComponentAttributes = get(\n allComponentsData,\n [currentComponentName, 'schema', 'attributes'],\n []\n );\n\n // Retrieve the nested ones\n acc.push(...retrieveComponentsFromSchema(currentComponentAttributes, allComponentsData));\n }\n\n if (type === 'dynamiczone') {\n const dynamicZoneComponents = current.components;\n const componentsFromDZComponents = dynamicZoneComponents.reduce((acc2: any, currentUid) => {\n const compoAttrs = get(allComponentsData, [currentUid, 'schema', 'attributes'], []);\n\n return [...acc2, ...retrieveComponentsFromSchema(compoAttrs, allComponentsData)];\n }, []);\n\n return [...acc, ...dynamicZoneComponents, ...componentsFromDZComponents];\n }\n\n return acc;\n }, []);\n\n return makeUnique<Internal.UID.Component>(allComponents);\n};\n\nexport { retrieveComponentsFromSchema };\n","import produce, { current } from 'immer';\nimport get from 'lodash/get';\nimport set from 'lodash/set';\n\nimport { getRelationType } from '../../utils/getRelationType';\nimport { makeUnique } from '../../utils/makeUnique';\n\nimport * as actions from './constants';\nimport { retrieveComponentsFromSchema } from './utils/retrieveComponentsFromSchema';\n\nimport type { DataManagerStateType, ContentType, AttributeType, Component } from '../../types';\nimport type { Internal, Schema } from '@strapi/types';\n\n// TODO: Define all possible actions based on type\nexport type Action = {\n type: string;\n uid?: string;\n mainDataKey: 'component' | 'components' | 'contentTypes' | 'contentType';\n schemaType: 'component' | 'contentType';\n attributeToRemoveName?: string;\n [key: string]: any;\n};\n\nconst initialState: DataManagerStateType = {\n components: {},\n contentTypes: {},\n initialComponents: {},\n initialContentTypes: {},\n initialData: {},\n modifiedData: {\n components: {},\n contentTypes: {},\n },\n reservedNames: {},\n isLoading: true,\n isLoadingForDataToBeSet: true,\n};\n\nconst ONE_SIDE_RELATIONS = ['oneWay', 'manyWay'];\n\nconst getOppositeRelation = (originalRelation?: Schema.Attribute.RelationKind.WithTarget) => {\n if (originalRelation === 'manyToOne') {\n return 'oneToMany';\n }\n\n if (originalRelation === 'oneToMany') {\n return 'manyToOne';\n }\n\n return originalRelation;\n};\n\nconst findAttributeIndex = (schema: any, attributeToFind?: string) => {\n return schema.schema.attributes.findIndex(\n ({ name }: { name: string }) => name === attributeToFind\n );\n};\n\nconst reducer = (state = initialState, action: Action) =>\n produce(state, (draftState: any) => {\n switch (action.type) {\n case actions.ADD_ATTRIBUTE: {\n const {\n attributeToSet: { name, ...rest },\n forTarget,\n targetUid,\n } = action;\n delete rest.createComponent;\n\n const pathToDataToEdit = ['component', 'contentType'].includes(forTarget)\n ? [forTarget]\n : [forTarget, targetUid];\n\n const currentAttributes = get(\n state,\n ['modifiedData', ...pathToDataToEdit, 'schema', 'attributes'],\n []\n ).slice();\n\n // Add the createdAttribute\n const updatedAttributes = [...currentAttributes, { ...rest, name }];\n\n set(\n draftState,\n ['modifiedData', ...pathToDataToEdit, 'schema', 'attributes'],\n updatedAttributes\n );\n\n if (action.shouldAddComponentToData) {\n const componentToAddUID = rest.component;\n const componentToAdd = state.components[componentToAddUID];\n const isTemporaryComponent = componentToAdd?.isTemporary;\n const hasComponentAlreadyBeenAdded =\n state.modifiedData.components?.[componentToAddUID] !== undefined;\n\n if (isTemporaryComponent || hasComponentAlreadyBeenAdded) {\n break;\n }\n\n // Initialize modifiedData.components if it is undefined\n if (!draftState.modifiedData.components) {\n draftState.modifiedData.components = {};\n }\n\n // Add the added component to the modifiedData.components\n draftState.modifiedData.components[componentToAddUID] = componentToAdd;\n\n const nestedComponents = retrieveComponentsFromSchema(\n componentToAdd.schema.attributes as AttributeType[],\n state.components\n );\n\n // We dont' need to set the already added components otherwise all modifications will be lost so we need to only add the not modified ones\n const nestedComponentsToAddInModifiedData = nestedComponents.filter(\n (compoUID: Internal.UID.Component) => {\n return get(state, ['modifiedData', 'components', compoUID]) === undefined;\n }\n );\n\n nestedComponentsToAddInModifiedData.forEach((compoUID: Internal.UID.Component) => {\n const compoSchema = get(state, ['components', compoUID], {}) as Component;\n const isTemporary = compoSchema.isTemporary || false;\n\n // If the nested component has not been saved we don't need to add them as they are already in the state\n if (!isTemporary) {\n if (!draftState.modifiedData.components) {\n draftState.modifiedData.components = {};\n }\n draftState.modifiedData.components[compoUID] = compoSchema;\n }\n });\n\n break;\n }\n\n const isCreatingRelationAttribute = rest.type === 'relation';\n\n if (isCreatingRelationAttribute) {\n const target = rest.target;\n const targetAttribute = rest.targetAttribute || null;\n const relation = rest.relation;\n const relationType = getRelationType(relation, targetAttribute);\n const currentUid = get(state, ['modifiedData', ...pathToDataToEdit, 'uid']);\n\n // When the user in creating a relation with the same content type we need to create another attribute\n // that is the opposite of the created one\n if (\n rest.type === 'relation' &&\n relationType !== 'oneWay' &&\n relationType !== 'manyWay' &&\n target === currentUid\n ) {\n const oppositeAttribute = {\n name: targetAttribute,\n relation: getOppositeRelation(relationType),\n target,\n targetAttribute: name,\n type: 'relation',\n } as AttributeType;\n\n if (rest.private) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n oppositeAttribute.private = rest.private;\n }\n\n const attributesToSet = [...updatedAttributes, oppositeAttribute];\n\n set(\n draftState,\n ['modifiedData', ...pathToDataToEdit, 'schema', 'attributes'],\n attributesToSet\n );\n }\n }\n\n break;\n }\n case actions.ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE: {\n const { dynamicZoneTarget, componentsToAdd } = action;\n\n const dzAttributeIndex = findAttributeIndex(\n state.modifiedData.contentType,\n dynamicZoneTarget\n );\n\n componentsToAdd.forEach((componentUid: Internal.UID.Component) => {\n if (\n !draftState.modifiedData.contentType?.schema.attributes[dzAttributeIndex].components\n ) {\n draftState.modifiedData.contentType.schema.attributes[dzAttributeIndex].components = [];\n }\n draftState.modifiedData.contentType.schema.attributes[dzAttributeIndex].components.push(\n componentUid\n );\n });\n\n break;\n }\n case actions.ADD_CUSTOM_FIELD_ATTRIBUTE: {\n const {\n attributeToSet: { name, ...rest },\n forTarget,\n targetUid,\n } = action;\n\n const pathToDataToEdit = ['component', 'contentType'].includes(forTarget)\n ? [forTarget]\n : [forTarget, targetUid];\n\n const currentAttributes = get(\n state,\n ['modifiedData', ...pathToDataToEdit, 'schema', 'attributes'],\n []\n ).slice();\n\n // Add the createdAttribute\n const updatedAttributes = [...currentAttributes, { ...rest, name }];\n\n set(\n draftState,\n ['modifiedData', ...pathToDataToEdit, 'schema', 'attributes'],\n updatedAttributes\n );\n\n break;\n }\n case actions.CHANGE_DYNAMIC_ZONE_COMPONENTS: {\n const { dynamicZoneTarget, newComponents } = action;\n\n const dzAttributeIndex = findAttributeIndex(\n state.modifiedData.contentType,\n dynamicZoneTarget\n );\n\n const currentDZComponents =\n (state.modifiedData.contentType?.schema.attributes[dzAttributeIndex]).components;\n\n const updatedComponents = makeUnique([...currentDZComponents, ...newComponents]);\n\n (draftState.modifiedData.contentType?.schema.attributes[dzAttributeIndex]).components =\n updatedComponents;\n\n // Retrieve all the components that needs to be added to the modifiedData.components\n const nestedComponents = retrieveComponentsFromSchema(\n current(draftState.modifiedData.contentType.schema.attributes),\n state.components\n );\n\n // We dont' need to set the already added components otherwise all modifications will be lost so we need to only add the not modified ones\n const nestedComponentsToAddInModifiedData = nestedComponents.filter((compoUID) => {\n return get(state, ['modifiedData', 'components', compoUID]) === undefined;\n });\n\n nestedComponentsToAddInModifiedData.forEach((compoUID: Internal.UID.Component) => {\n const compoSchema = get(state, ['components', compoUID], {}) as Component;\n const isTemporary = compoSchema.isTemporary || false;\n\n // If the nested component has not been saved we don't need to add them as they are already in the state\n if (!isTemporary) {\n if (!draftState.modifiedData.components) {\n draftState.modifiedData.components = {};\n }\n draftState.modifiedData.components[compoUID] = compoSchema;\n }\n });\n\n break;\n }\n case actions.CREATE_COMPONENT_SCHEMA: {\n const newSchema: Component = {\n uid: action.uid as Internal.UID.Component,\n isTemporary: true,\n category: action.componentCategory,\n schema: {\n ...action.data,\n attributes: [],\n },\n };\n draftState.components[action.uid as string] = newSchema;\n\n if (action.shouldAddComponentToData) {\n draftState.modifiedData.components[action.uid as string] = newSchema;\n }\n\n break;\n }\n case actions.CREATE_SCHEMA: {\n const newSchema: ContentType = {\n uid: action.uid as Internal.UID.ContentType,\n isTemporary: true,\n schema: {\n ...action.data,\n attributes: [],\n },\n };\n\n draftState.contentTypes[action.uid as string] = newSchema;\n\n break;\n }\n case actions.EDIT_ATTRIBUTE: {\n const {\n attributeToSet: { name, ...rest },\n forTarget,\n targetUid,\n initialAttribute,\n } = action;\n\n const initialAttributeName = initialAttribute.name;\n const pathToDataToEdit = ['component', 'contentType'].includes(forTarget)\n ? [forTarget]\n : [forTarget, targetUid];\n\n const initialAttributeIndex = findAttributeIndex(\n get(state, ['modifiedData', ...pathToDataToEdit]),\n initialAttributeName\n );\n\n const isEditingRelation = rest.type === 'relation';\n\n if (!isEditingRelation) {\n set(\n draftState,\n ['modifiedData', ...pathToDataToEdit, 'schema', 'attributes', initialAttributeIndex],\n action.attributeToSet\n );\n\n break;\n }\n\n const updatedAttributes: AttributeType[] = get(state, [\n 'modifiedData',\n ...pathToDataToEdit,\n 'schema',\n 'attributes',\n ]).slice();\n\n // First create the current relation attribute updated\n const toSet = {\n name,\n relation: rest.relation,\n target: rest.target,\n targetAttribute: rest.targetAttribute,\n type: 'relation',\n } as AttributeType;\n\n if (rest.private) {\n toSet.private = rest.private;\n }\n\n if (rest.pluginOptions) {\n toSet.pluginOptions = rest.pluginOptions;\n }\n\n const currentAttributeIndex = updatedAttributes.findIndex((value: AttributeType) => {\n return value.name !== undefined && value.name === initialAttribute.name;\n });\n\n // First set it in the updatedAttributes\n if (currentAttributeIndex !== -1) {\n updatedAttributes.splice(currentAttributeIndex, 1, toSet);\n }\n\n let oppositeAttributeNameToRemove: string | null = null;\n let oppositeAttributeNameToUpdate: string | null = null;\n let oppositeAttributeToCreate: AttributeType | null = null;\n let initialOppositeAttribute = null;\n\n const currentUid = get(state, ['modifiedData', ...pathToDataToEdit, 'uid']);\n const didChangeTargetRelation = initialAttribute.target !== rest.target;\n const didCreateInternalRelation = rest.target === currentUid;\n const relationType = getRelationType(rest.relation, rest.targetAttribute);\n const initialRelationType = getRelationType(\n initialAttribute.relation,\n initialAttribute.targetAttribute\n );\n const hadInternalRelation = initialAttribute.target === currentUid;\n const didChangeRelationType = initialRelationType !== relationType;\n const shouldRemoveOppositeAttributeBecauseOfTargetChange =\n didChangeTargetRelation &&\n !didCreateInternalRelation &&\n hadInternalRelation &&\n isEditingRelation;\n const shouldRemoveOppositeAttributeBecauseOfRelationTypeChange =\n didChangeRelationType &&\n hadInternalRelation &&\n ['oneWay', 'manyWay'].includes(relationType!) &&\n isEditingRelation;\n const shouldUpdateOppositeAttributeBecauseOfRelationTypeChange =\n !ONE_SIDE_RELATIONS.includes(initialRelationType!) &&\n !ONE_SIDE_RELATIONS.includes(relationType!) &&\n hadInternalRelation &&\n didCreateInternalRelation &&\n isEditingRelation;\n const shouldCreateOppositeAttributeBecauseOfRelationTypeChange =\n ONE_SIDE_RELATIONS.includes(initialRelationType!) &&\n !ONE_SIDE_RELATIONS.includes(relationType!) &&\n hadInternalRelation &&\n didCreateInternalRelation &&\n isEditingRelation;\n const shouldCreateOppositeAttributeBecauseOfTargetChange =\n didChangeTargetRelation &&\n didCreateInternalRelation &&\n !ONE_SIDE_RELATIONS.includes(relationType!);\n\n // Store opposite attribute name to remove at the end of the loop\n if (\n shouldRemoveOppositeAttributeBecauseOfTargetChange ||\n shouldRemoveOppositeAttributeBecauseOfRelationTypeChange\n ) {\n oppositeAttributeNameToRemove = initialAttribute.targetAttribute;\n }\n\n // In case of oneWay or manyWay relation there isn't an opposite attribute\n if (oppositeAttributeNameToRemove) {\n const indexToRemove = updatedAttributes.findIndex(\n (value) => value.name === oppositeAttributeNameToRemove\n );\n\n updatedAttributes.splice(indexToRemove, 1);\n }\n\n // In order to preserve plugin options need to get the initial opposite attribute settings\n if (!shouldRemoveOppositeAttributeBecauseOfTargetChange) {\n const initialTargetContentType = get(state, [\n 'initialContentTypes',\n initialAttribute.target,\n ]);\n\n if (initialTargetContentType) {\n const oppositeAttributeIndex = findAttributeIndex(\n initialTargetContentType,\n initialAttribute.targetAttribute\n );\n\n initialOppositeAttribute = get(state, [\n 'initialContentTypes',\n initialAttribute.target,\n 'schema',\n 'attributes',\n oppositeAttributeIndex,\n ]);\n }\n }\n\n // Create the opposite attribute\n if (\n shouldCreateOppositeAttributeBecauseOfRelationTypeChange ||\n shouldCreateOppositeAttributeBecauseOfTargetChange\n ) {\n oppositeAttributeToCreate = {\n name: rest.targetAttribute,\n relation: getOppositeRelation(relationType),\n target: rest.target,\n targetAttribute: name,\n type: 'relation',\n } as AttributeType;\n\n if (rest.private) {\n oppositeAttributeToCreate.private = rest.private;\n }\n\n if (initialOppositeAttribute && initialOppositeAttribute.pluginOptions) {\n oppositeAttributeToCreate.pluginOptions = initialOppositeAttribute.pluginOptions;\n }\n\n const indexOfInitialAttribute = updatedAttributes.findIndex(\n ({ name }) => name === initialAttribute.name\n );\n const indexOfUpdatedAttribute = updatedAttributes.findIndex(\n ({ name: attrName }) => name === attrName\n );\n\n const indexToInsert =\n (indexOfInitialAttribute === -1 ? indexOfUpdatedAttribute : indexOfInitialAttribute) +\n 1;\n\n updatedAttributes.splice(indexToInsert, 0, oppositeAttributeToCreate);\n }\n\n if (shouldUpdateOppositeAttributeBecauseOfRelationTypeChange) {\n oppositeAttributeNameToUpdate = initialAttribute.targetAttribute;\n\n oppositeAttributeToCreate = {\n name: rest.targetAttribute,\n relation: getOppositeRelation(relationType),\n target: rest.target,\n targetAttribute: name,\n type: 'relation',\n } as AttributeType;\n\n if (rest.private) {\n oppositeAttributeToCreate.private = rest.private;\n }\n\n if (initialOppositeAttribute && initialOppositeAttribute.pluginOptions) {\n oppositeAttributeToCreate.pluginOptions = initialOppositeAttribute.pluginOptions;\n }\n\n if (oppositeAttributeNameToUpdate) {\n const indexToUpdate = updatedAttributes.findIndex(\n ({ name }) => name === oppositeAttributeNameToUpdate\n );\n\n updatedAttributes.splice(indexToUpdate, 1, oppositeAttributeToCreate);\n }\n }\n\n set(\n draftState,\n ['modifiedData', ...pathToDataToEdit, 'schema', 'attributes'],\n updatedAttributes\n );\n\n break;\n }\n case actions.EDIT_CUSTOM_FIELD_ATTRIBUTE: {\n const { forTarget, targetUid, initialAttribute, attributeToSet } = action;\n\n const initialAttributeName = initialAttribute.name;\n const pathToDataToEdit = ['component', 'contentType'].includes(forTarget)\n ? [forTarget]\n : [forTarget, targetUid];\n\n const initialAttributeIndex = findAttributeIndex(\n get(state, ['modifiedData', ...pathToDataToEdit]),\n initialAttributeName\n );\n\n set(\n draftState,\n ['modifiedData', ...pathToDataToEdit, 'schema', 'attributes', initialAttributeIndex],\n attributeToSet\n );\n\n break;\n }\n case actions.GET_DATA_SUCCEEDED: {\n draftState.components = action.components;\n draftState.initialComponents = action.components;\n draftState.initialContentTypes = action.contentTypes;\n draftState.contentTypes = action.contentTypes;\n draftState.reservedNames = action.reservedNames;\n draftState.isLoading = false;\n break;\n }\n case actions.UPDATE_INITIAL_STATE: {\n draftState.initialData = draftState.modifiedData;\n\n break;\n }\n case actions.DELETE_NOT_SAVED_TYPE: {\n // Doing so will also reset the modified and the initial data\n draftState.contentTypes = state.initialContentTypes;\n draftState.components = state.initialComponents;\n\n break;\n }\n case actions.RELOAD_PLUGIN: {\n return initialState;\n }\n case actions.REMOVE_COMPONENT_FROM_DYNAMIC_ZONE: {\n const dzAttributeIndex = findAttributeIndex(state.modifiedData.contentType, action.dzName);\n draftState.modifiedData.contentType.schema.attributes[dzAttributeIndex].components.splice(\n action.componentToRemoveIndex,\n 1\n );\n\n break;\n }\n case actions.REMOVE_FIELD: {\n const { mainDataKey, attributeToRemoveName } = action;\n const pathToAttributes = ['modifiedData', mainDataKey, 'schema', 'attributes'];\n const attributeToRemoveIndex = findAttributeIndex(\n state.modifiedData[mainDataKey],\n attributeToRemoveName\n );\n\n const pathToAttributeToRemove = [...pathToAttributes, attributeToRemoveIndex];\n const attributeToRemoveData = get(state, pathToAttributeToRemove);\n const isRemovingRelationAttribute = attributeToRemoveData.type === 'relation';\n // Only content types can have relations with themselves since\n // components can only have oneWay or manyWay relations\n const canTheAttributeToRemoveHaveARelationWithItself = mainDataKey === 'contentType';\n\n if (isRemovingRelationAttribute && canTheAttributeToRemoveHaveARelationWithItself) {\n const { target, relation, targetAttribute } = attributeToRemoveData;\n const relationType = getRelationType(relation, targetAttribute);\n\n const uid = state.modifiedData.contentType?.uid;\n const shouldRemoveOppositeAttribute =\n target === uid && !ONE_SIDE_RELATIONS.includes(relationType!);\n\n if (shouldRemoveOppositeAttribute) {\n const attributes: AttributeType[] =\n state.modifiedData[mainDataKey]?.schema.attributes.slice();\n const nextAttributes = attributes.filter((attribute) => {\n if (attribute.name === attributeToRemoveName) {\n return false;\n }\n\n if (attribute.target === uid && attribute.targetAttribute === attributeToRemoveName) {\n return false;\n }\n\n return true;\n });\n\n draftState.modifiedData[mainDataKey].schema.attributes = nextAttributes;\n\n break;\n }\n }\n\n // Find all uid fields that have the targetField set to the field we are removing\n\n const uidFieldsToUpdate: string[] = state.modifiedData[\n mainDataKey\n ]!.schema.attributes.slice().reduce((acc: string[], current: AttributeType) => {\n if (current.type !== 'uid') {\n return acc;\n }\n\n if (current.targetField !== attributeToRemoveName) {\n return acc;\n }\n\n acc.push(current.name as string);\n\n return acc;\n }, []);\n\n uidFieldsToUpdate.forEach((fieldName) => {\n const fieldIndex = findAttributeIndex(state.modifiedData[mainDataKey], fieldName);\n\n delete draftState.modifiedData[mainDataKey]?.schema.attributes[fieldIndex].targetField;\n });\n\n draftState.modifiedData[mainDataKey]?.schema.attributes.splice(attributeToRemoveIndex, 1);\n\n break;\n }\n case actions.REMOVE_FIELD_FROM_DISPLAYED_COMPONENT: {\n const { attributeToRemoveName, componentUid } = action;\n\n const attributeToRemoveIndex = findAttributeIndex(\n state.modifiedData.components?.[componentUid],\n attributeToRemoveName\n );\n\n draftState.modifiedData.components?.[componentUid]?.schema?.attributes?.splice(\n attributeToRemoveIndex,\n 1\n );\n\n break;\n }\n case actions.SET_MODIFIED_DATA: {\n draftState.isLoadingForDataToBeSet = false;\n draftState.initialData = action.schemaToSet;\n draftState.modifiedData = action.schemaToSet;\n\n // Reset the state with the initial data\n // All created components and content types will be lost\n if (!action.hasJustCreatedSchema) {\n draftState.components = state.initialComponents;\n draftState.contentTypes = state.initialContentTypes;\n }\n\n break;\n }\n case actions.UPDATE_SCHEMA: {\n const {\n data: { displayName, category, icon, kind },\n schemaType,\n uid,\n } = action;\n\n draftState.modifiedData[schemaType].schema.displayName = displayName;\n\n if (action.schemaType === 'component') {\n draftState.modifiedData.component.category = category;\n draftState.modifiedData.component.schema.icon = icon;\n const addedComponent = current(draftState.modifiedData.component);\n draftState.components[uid as string] = addedComponent;\n\n break;\n }\n\n draftState.modifiedData.contentType.schema.kind = kind;\n\n break;\n }\n default:\n return draftState;\n }\n });\n\nexport { initialState, reducer };\n","import slugify from '@sindresorhus/slugify';\n\nexport const nameToSlug = (name: string) => slugify(name, { separator: '-' });\n","export const ON_CHANGE = 'ContentTypeBuilder/FormModal/ON_CHANGE';\nexport const ON_CHANGE_RELATION_TARGET = 'ContentTypeBuilder/FormModal/ON_CHANGE_RELATION_TARGET';\nexport const ON_CHANGE_RELATION_TYPE = 'ContentTypeBuilder/FormModal/ON_CHANGE_RELATION_TYPE';\nexport const RESET_PROPS = 'ContentTypeBuilder/FormModal/RESET_PROPS';\nexport const RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO =\n 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO';\nexport const RESET_PROPS_AND_SAVE_CURRENT_DATA =\n 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA';\nexport const RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ =\n 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ';\nexport const SET_DATA_TO_EDIT = 'ContentTypeBuilder/FormModal/SET_DATA_TO_EDIT';\nexport const SET_ATTRIBUTE_DATA_SCHEMA = 'ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA';\nexport const SET_CUSTOM_FIELD_DATA_SCHEMA =\n 'ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA';\nexport const SET_DYNAMIC_ZONE_DATA_SCHEMA =\n 'ContentTypeBuilder/FormModal/SET_DYNAMIC_ZONE_DATA_SCHEMA';\nexport const SET_ERRORS = 'ContentTypeBuilder/FormModal/SET_ERRORS';\n","import { nameToSlug } from '../../../utils/nameToSlug';\n\nimport type { Internal } from '@strapi/types';\n\nconst createUid = (name: string): Internal.UID.ContentType => {\n const modelName = nameToSlug(name);\n return `api::${modelName}.${modelName}`;\n};\n\n// From `content-type-builder/services/Components/createComponentUid`\nconst createComponentUid = (name: string, category: string): Internal.UID.Component => {\n return `${nameToSlug(category)}.${nameToSlug(name)}`;\n};\n\nexport { createComponentUid, createUid };\n","export const customFieldDefaultOptionsReducer = (acc: any, option: any) => {\n if (option.items) {\n return option.items.reduce(customFieldDefaultOptionsReducer, acc);\n }\n\n if ('defaultValue' in option) {\n const { name, defaultValue } = option;\n acc.push({ name, defaultValue });\n }\n\n return acc;\n};\n","/* eslint-disable no-confusing-arrow */\n\nimport type { Schema } from '@strapi/types';\n\nconst shouldPluralizeName = (nature: Schema.Attribute.RelationKind.Any) =>\n ['manyToMany', 'oneToMany', 'manyWay'].includes(nature) ? 2 : 1;\n\nconst shouldPluralizeTargetAttribute = (nature: Schema.Attribute.RelationKind.Any) =>\n ['manyToMany', 'manyToOne'].includes(nature) ? 2 : 1;\n\nexport { shouldPluralizeName, shouldPluralizeTargetAttribute };\n","import { produce } from 'immer';\nimport set from 'lodash/set';\nimport snakeCase from 'lodash/snakeCase';\nimport pluralize from 'pluralize';\n\nimport { getRelationType } from '../../utils/getRelationType';\nimport { nameToSlug } from '../../utils/nameToSlug';\n\nimport * as actions from './constants';\nimport { createComponentUid } from './utils/createUid';\nimport { customFieldDefaultOptionsReducer } from './utils/customFieldDefaultOptionsReducer';\nimport { shouldPluralizeName, shouldPluralizeTargetAttribute } from './utils/relations';\n\nimport type { AnyAction } from '@reduxjs/toolkit';\n\nconst initialState: any = {\n formErrors: {},\n modifiedData: {},\n initialData: {},\n componentToCreate: {},\n isCreatingComponentWhileAddingAField: false,\n};\n\nconst reducer = (state = initialState, action: AnyAction) =>\n // eslint-disable-next-line consistent-return\n produce(state, (draftState: any) => {\n switch (action.type) {\n case actions.ON_CHANGE: {\n const { keys, value } = action;\n const obj = state.modifiedData;\n const hasDefaultValue = Boolean(obj.default);\n\n // There is no need to remove the default key if the default value isn't defined\n if (hasDefaultValue && keys.length === 1 && keys.includes('type')) {\n const previousType = obj.type;\n\n if (previousType && ['date', 'datetime', 'time'].includes(previousType)) {\n // return obj.updateIn(keys, () => value).remove('default');\n delete draftState.modifiedData.default;\n }\n }\n\n set(draftState, ['modifiedData', ...keys], value);\n\n break;\n }\n case actions.ON_CHANGE_RELATION_TARGET: {\n const {\n target: {\n oneThatIsCreatingARelationWithAnother,\n selectedContentTypeFriendlyName,\n targetContentTypeAllowedRelations,\n value,\n },\n } = action;\n // Special case for the admin user...\n let didChangeRelationTypeBecauseOfRestrictedRelation = false;\n let changedRelationType = null;\n\n set(draftState, ['modifiedData', 'target'], value);\n\n const modifiedData = state.modifiedData;\n\n // Don't change the relation type if the allowed relations are not restricted\n // TODO: replace with an obj { relation: 'x', bidirctional: true|false } when BE ready\n if (Array.isArray(targetContentTypeAllowedRelations)) {\n const currentRelationType = getRelationType(\n modifiedData.relation,\n modifiedData.targetAttribute\n );\n\n if (!targetContentTypeAllowedRelations.includes(currentRelationType)) {\n const relationToSet = targetContentTypeAllowedRelations[0];\n didChangeRelationTypeBecauseOfRestrictedRelation = true;\n changedRelationType = relationToSet;\n\n if (relationToSet === 'oneWay') {\n set(draftState, ['modifiedData', 'relation'], 'oneToOne');\n } else if (relationToSet === 'manyWay') {\n set(draftState, ['modifiedData', 'relation'], 'oneToMany');\n } else {\n set(draftState, ['modifiedData', 'relation'], relationToSet);\n }\n }\n }\n\n let nameToSet;\n\n if (didChangeRelationTypeBecauseOfRestrictedRelation) {\n nameToSet = pluralize(\n snakeCase(nameToSlug(selectedContentTypeFriendlyName)),\n shouldPluralizeName(changedRelationType)\n );\n } else {\n nameToSet = pluralize(\n snakeCase(nameToSlug(selectedContentTypeFriendlyName)),\n\n shouldPluralizeName(modifiedData.relation)\n );\n }\n\n set(draftState, ['modifiedData', 'name'], nameToSet);\n\n const currentTargetAttribute = state.modifiedData.targetAttribute;\n\n if (currentTargetAttribute === null) {\n break;\n }\n\n // Changing the target and the relation is either oneWay or manyWay\n // Case when we need to change the relation to oneWay (ex: admin user)\n if (\n didChangeRelationTypeBecauseOfRestrictedRelation &&\n ['oneWay', 'manyWay'].includes(changedRelationType)\n ) {\n set(draftState, ['modifiedData', 'targetAttribute'], null);\n\n break;\n }\n\n const targetAttributeToSet = pluralize(\n snakeCase(nameToSlug(oneThatIsCreatingARelationWithAnother)),\n shouldPluralizeTargetAttribute(modifiedData.relation)\n );\n\n set(draftState, ['modifiedData', 'targetAttribute'], targetAttributeToSet);\n\n break;\n }\n case actions.ON_CHANGE_RELATION_TYPE: {\n const {\n target: { oneThatIsCreatingARelationWithAnother, value },\n } = action;\n\n const currentName = state.modifiedData.name;\n\n // Switching from oneWay\n if (!['oneWay', 'manyWay'].includes(value)) {\n set(draftState, ['modifiedData', 'relation'], value);\n const currentTargetAttribute = state.modifiedData.targetAttribute;\n\n set(\n draftState,\n ['modifiedData', 'name'],\n pluralize(snakeCase(nameToSlug(currentName)), shouldPluralizeName(value))\n );\n\n set(\n draftState,\n ['modifiedData', 'targetAttribute'],\n pluralize(\n currentTargetAttribute ||\n snakeCase(nameToSlug(oneThatIsCreatingARelationWithAnother)),\n shouldPluralizeTargetAttribute(value)\n )\n );\n\n break;\n }\n\n if (value === 'oneWay') {\n set(draftState, ['modifiedData', 'relation'], 'oneToOne');\n set(draftState, ['modifiedData', 'targetAttribute'], null);\n set(draftState, ['modifiedData', 'name'], pluralize(snakeCase(currentName), 1));\n\n break;\n }\n\n // manyWay\n set(draftState, ['modifiedData', 'relation'], 'oneToMany');\n set(draftState, ['modifiedData', 'targetAttribute'], null);\n set(draftState, ['modifiedData', 'name'], pluralize(snakeCase(currentName), 2));\n\n break;\n }\n\n case actions.RESET_PROPS:\n return initialState;\n case actions.RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO: {\n // This is run when the user doesn't want to create a new component\n\n const nextState = {\n ...initialState,\n modifiedData: {\n type: 'component',\n repeatable: true,\n ...action.options,\n },\n };\n\n return nextState;\n }\n case actions.RESET_PROPS_AND_SAVE_CURRENT_DATA: {\n // This is run when the user has created a new component\n const componentToCreate = state.modifiedData.componentToCreate;\n const modifiedData = {\n displayName: componentToCreate.displayName,\n type: 'component',\n repeatable: false,\n ...action.options,\n component: createComponentUid(componentToCreate.displayName, componentToCreate.category),\n };\n\n const nextState = {\n ...initialState,\n componentToCreate,\n modifiedData,\n isCreatingComponentWhileAddingAField: state.modifiedData.createComponent,\n };\n\n return nextState;\n }\n case actions.RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ: {\n const createdDZ = state.modifiedData;\n const dataToSet = {\n ...createdDZ,\n createComponent: true,\n componentToCreate: { type: 'component' },\n };\n\n return { ...initialState, modifiedData: dataToSet };\n }\n case actions.SET_DATA_TO_EDIT: {\n draftState.modifiedData = action.data;\n draftState.initialData = action.data;\n break;\n }\n case actions.SET_ATTRIBUTE_DATA_SCHEMA: {\n const {\n attributeType,\n isEditing,\n modifiedDataToSetForEditing,\n nameToSetForRelation,\n targetUid,\n step,\n options = {},\n } = action;\n\n if (isEditing) {\n draftState.modifiedData = modifiedDataToSetForEditing;\n draftState.initialData = modifiedDataToSetForEditing;\n\n break;\n }\n\n let dataToSet;\n\n if (attributeType === 'component') {\n if (step === '1') {\n dataToSet = {\n type: 'component',\n createComponent: true,\n componentToCreate: { type: 'component' },\n };\n } else {\n dataToSet = {\n ...options,\n type: 'component',\n repeatable: true,\n };\n }\n } else if (attributeType === 'dynamiczone') {\n dataToSet = {\n ...options,\n type: 'dynamiczone',\n components: [],\n };\n } else if (attributeType === 'text') {\n dataToSet = { ...options, type: 'string' };\n } else if (attributeType === 'number' || attributeType === 'date') {\n dataToSet = options;\n } else if (attributeType === 'media') {\n dataToSet = {\n allowedTypes: ['images', 'files', 'videos', 'audios'],\n type: 'media',\n multiple: true,\n ...options,\n };\n } else if (attributeType === 'enumeration') {\n dataToSet = { ...options, type: 'enumeration', enum: [] };\n } else if (attributeType === 'relation') {\n dataToSet = {\n name: snakeCase(nameToSetForRelation),\n relation: 'oneToOne',\n targetAttribute: null,\n target: targetUid,\n type: 'relation',\n };\n } else {\n dataToSet = { ...options, type: attributeType, default: null };\n }\n\n draftState.modifiedData = dataToSet;\n\n break;\n }\n case actions.SET_CUSTOM_FIELD_DATA_SCHEMA: {\n const { customField, isEditing, modifiedDataToSetForEditing, options = {} } = action;\n\n if (isEditing) {\n draftState.modifiedData = modifiedDataToSetForEditing;\n draftState.initialData = modifiedDataToSetForEditing;\n\n break;\n }\n\n draftState.modifiedData = { ...options, type: customField.type };\n\n const allOptions = [\n ...(customField?.options?.base || []),\n ...(customField?.options?.advanced || []),\n ];\n\n const optionDefaults = allOptions.reduce(customFieldDefaultOptionsReducer, []);\n\n if (optionDefaults.length) {\n optionDefaults.forEach(({ name, defaultValue }: { name: string; defaultValue: string }) =>\n set(draftState.modifiedData, name, defaultValue)\n );\n }\n\n break;\n }\n case actions.SET_DYNAMIC_ZONE_DATA_SCHEMA: {\n draftState.modifiedData = action.attributeToEdit;\n draftState.initialData = action.attributeToEdit;\n break;\n }\n case actions.SET_ERRORS: {\n draftState.formErrors = action.errors;\n break;\n }\n default:\n return draftState;\n }\n });\n\nexport { initialState, reducer };\n","import { reducer } from './components/DataManagerProvider/reducer';\nimport { reducer as formModalReducer } from './components/FormModal/reducer';\nimport { pluginId } from './pluginId';\n\nexport const reducers = {\n [`${pluginId}_formModal`]: formModalReducer,\n [`${pluginId}_dataManagerProvider`]: reducer,\n};\n","import cloneDeep from 'lodash/cloneDeep';\nimport get from 'lodash/get';\nimport * as yup from 'yup';\n// TODO V5 Convert any into real types\nexport const formsAPI: any = {\n components: {\n inputs: {} as Record<string, any>,\n add({ id, component }: { id: string; component: any }) {\n if (!this.inputs[id]) {\n this.inputs[id] = component;\n }\n },\n },\n types: {\n attribute: {\n // test: {\n // validators: [],\n // form: {\n // advanced: [\n // /* cb */\n // ],\n // base: [\n // /* cb */\n // ],\n // },\n // },\n },\n contentType: {\n validators: [],\n form: {\n advanced: [],\n base: [],\n },\n },\n component: {\n validators: [],\n form: {\n advanced: [],\n base: [],\n },\n },\n },\n contentTypeSchemaMutations: [],\n addContentTypeSchemaMutation(cb: any) {\n this.contentTypeSchemaMutations.push(cb);\n },\n extendContentType({ validator, form: { advanced, base } }: any) {\n const { contentType } = this.types;\n\n contentType.validators.push(validator);\n contentType.form.advanced.push(advanced);\n contentType.form.base.push(base);\n },\n extendFields(fields: any, { validator, form: { advanced, base } }: any) {\n const formType = this.types.attribute;\n\n fields.forEach((field: any) => {\n if (!formType[field]) {\n formType[field] = {\n validators: [],\n form: {\n advanced: [\n /* cb */\n ],\n base: [\n /* cb */\n ],\n },\n };\n }\n\n formType[field].validators.push(validator);\n formType[field].form.advanced.push(advanced);\n formType[field].form.base.push(base);\n });\n },\n\n getAdvancedForm(target: any, props = null) {\n const sectionsToAdd = get(this.types, [...target, 'form', 'advanced'], []).reduce(\n (acc: any, current: any) => {\n const sections = current(props);\n\n return [...acc, ...sections];\n },\n []\n );\n\n return sectionsToAdd;\n },\n\n makeCustomFieldValidator(attributeShape: any, validator: any, ...validatorArgs: any) {\n // When no validator, return the attribute shape\n if (!validator) return attributeShape;\n\n // Otherwise extend the shape with the provided validator\n return attributeShape.shape({ options: yup.object().shape(validator(validatorArgs)) });\n },\n\n makeValidator(target: any, initShape: any, ...args: any) {\n const validators = get(this.types, [...target, 'validators'], []);\n\n const pluginOptionsShape = validators.reduce((acc: any, current: any) => {\n const pluginOptionShape = current(args);\n\n return { ...acc, ...pluginOptionShape };\n }, {});\n\n return initShape.shape({ pluginOptions: yup.object().shape(pluginOptionsShape) });\n },\n mutateContentTypeSchema(data: Record<string, unknown>, initialData: Record<string, unknown>) {\n let enhancedData: any = cloneDeep(data);\n\n const refData: any = cloneDeep(initialData);\n\n this.contentTypeSchemaMutations.forEach((cb: any) => {\n enhancedData = cb(enhancedData, refData);\n });\n\n return enhancedData;\n },\n};\n","type TradOptions = Record<string, string>;\n\nconst prefixPluginTranslations = (trad: TradOptions, pluginId: string): TradOptions => {\n if (!pluginId) {\n throw new TypeError(\"pluginId can't be empty\");\n }\n return Object.keys(trad).reduce((acc, current) => {\n acc[`${pluginId}.${current}`] = trad[current];\n return acc;\n }, {} as TradOptions);\n};\n\nexport { prefixPluginTranslations };\n","import * as React from 'react';\n\nimport { Box, Flex, Typography, Link } from '@strapi/design-system';\nimport { Clock, ArrowClockwise } from '@strapi/icons';\nimport { createPortal } from 'react-dom';\nimport { MessageDescriptor, useIntl } from 'react-intl';\nimport { styled, keyframes } from 'styled-components';\n\n/**\n * TODO: realistically a lot of this logic is isolated to the `core/admin` package.\n * However, we want to expose the `useAutoReloadOverlayBlocker` hook to the plugins.\n *\n * Therefore, in V5 we should move this logic back to the `core/admin` package & export\n * the hook from that package and re-export here. For now, let's keep it all together\n * because it's easier to diagnose and we're not using a million refs because we don't\n * understand what's going on.\n */\nexport interface AutoReloadOverlayBlockerConfig {\n title?: string;\n description?: string;\n icon?: 'reload' | 'time';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Context\n * -----------------------------------------------------------------------------------------------*/\n\nexport interface AutoReloadOverlayBlockerContextValue {\n lockAppWithAutoreload?: (config?: AutoReloadOverlayBlockerConfig) => void;\n unlockAppWithAutoreload?: () => void;\n}\n\nconst AutoReloadOverlayBlockerContext = React.createContext<AutoReloadOverlayBlockerContextValue>(\n {}\n);\n\n/* -------------------------------------------------------------------------------------------------\n * Provider\n * -----------------------------------------------------------------------------------------------*/\n\nexport interface AutoReloadOverlayBlockerProviderProps {\n children: React.ReactNode;\n}\n\nconst MAX_ELAPSED_TIME = 30 * 1000;\n\nconst AutoReloadOverlayBlockerProvider = ({ children }: AutoReloadOverlayBlockerProviderProps) => {\n const [isOpen, setIsOpen] = React.useState(false);\n const [config, setConfig] = React.useState<AutoReloadOverlayBlockerConfig>({});\n const [failed, setFailed] = React.useState(false);\n\n const lockAppWithAutoreload = React.useCallback((config: AutoReloadOverlayBlockerConfig = {}) => {\n setIsOpen(true);\n setConfig(config);\n }, []);\n\n const unlockAppWithAutoreload = React.useCallback(() => {\n setIsOpen(false);\n setConfig({});\n }, []);\n\n // eslint-disable-next-line consistent-return\n React.useEffect(() => {\n if (isOpen) {\n const timeout = setTimeout(() => {\n setFailed(true);\n }, MAX_ELAPSED_TIME);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [isOpen]);\n\n let displayedIcon = config?.icon || 'reload';\n\n let description = {\n id: config?.description || 'components.OverlayBlocker.description',\n defaultMessage:\n \"You're using a feature that needs the server to restart. The page will reload automatically.\",\n };\n\n let title = {\n id: config?.title || 'components.OverlayBlocker.title',\n defaultMessage: 'Waiting for restart',\n };\n\n if (failed) {\n displayedIcon = 'time';\n\n description = {\n id: 'components.OverlayBlocker.description.serverError',\n defaultMessage: 'The server should have restarted, please check your logs in the terminal.',\n };\n\n title = {\n id: 'components.OverlayBlocker.title.serverError',\n defaultMessage: 'The restart is taking longer than expected',\n };\n }\n\n const autoReloadValue = React.useMemo(\n () => ({\n lockAppWithAutoreload,\n unlockAppWithAutoreload,\n }),\n [lockAppWithAutoreload, unlockAppWithAutoreload]\n );\n\n return (\n <AutoReloadOverlayBlockerContext.Provider value={autoReloadValue}>\n <Blocker\n displayedIcon={displayedIcon}\n isOpen={isOpen}\n description={description}\n title={title}\n />\n {children}\n </AutoReloadOverlayBlockerContext.Provider>\n );\n};\n\ninterface BlockerProps {\n displayedIcon: string;\n description: MessageDescriptor;\n isOpen: boolean;\n title: MessageDescriptor;\n}\n\nconst Blocker = ({ displayedIcon, description, title, isOpen }: BlockerProps) => {\n const { formatMessage } = useIntl();\n\n // eslint-disable-next-line no-undef\n return isOpen && globalThis?.document?.body\n ? createPortal(\n <Overlay id=\"autoReloadOverlayBlocker\" direction=\"column\" alignItems=\"center\" gap={6}>\n <Flex direction=\"column\" alignItems=\"center\" gap={2}>\n <Typography tag=\"h1\" variant=\"alpha\">\n {formatMessage(title)}\n </Typography>\n <Typography tag=\"h2\" textColor=\"neutral600\" fontSize={4} fontWeight=\"regular\">\n {formatMessage(description)}\n </Typography>\n </Flex>\n {displayedIcon === 'reload' && (\n <IconBox padding={6} background=\"primary100\" borderColor=\"primary200\">\n <LoaderReload width=\"3.6rem\" height=\"3.6rem\" />\n </IconBox>\n )}\n {displayedIcon === 'time' && (\n <IconBox padding={6} background=\"primary100\" borderColor=\"primary200\">\n <Clock width=\"4rem\" height=\"4rem\" />\n </IconBox>\n )}\n <Box marginTop={2}>\n <Link href=\"https://docs.strapi.io\" isExternal>\n {formatMessage({\n id: 'global.documentation',\n defaultMessage: 'Read the documentation',\n })}\n </Link>\n </Box>\n </Overlay>,\n // eslint-disable-next-line no-undef\n globalThis.document.body\n )\n : null;\n};\n\nconst rotation = keyframes`\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(359deg);\n }\n `;\n\nconst LoaderReload = styled(ArrowClockwise)`\n animation: ${rotation} 1s infinite linear;\n`;\n\nconst Overlay = styled(Flex)`\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n /* TODO: set this up in the theme for consistence z-index values */\n z-index: 1140;\n padding-top: 16rem;\n\n & > * {\n position: relative;\n z-index: 1;\n }\n\n &:before {\n content: '';\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: ${({ theme }) => theme.colors.neutral0};\n opacity: 0.9;\n }\n`;\n\nconst IconBox = styled(Box)`\n border-radius: 50%;\n svg {\n > path {\n fill: ${({ theme }) => theme.colors.primary600} !important;\n }\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * Hook\n * -----------------------------------------------------------------------------------------------*/\n\nconst useAutoReloadOverlayBlocker = () => React.useContext(AutoReloadOverlayBlockerContext);\n\nexport { AutoReloadOverlayBlockerProvider, useAutoReloadOverlayBlocker };\n","import { Layout } from '@strapi/icons';\n\nimport pluginPkg from '../../package.json';\n\nimport { PERMISSIONS } from './constants';\nimport { pluginId } from './pluginId';\nimport { reducers } from './reducers';\nimport { formsAPI } from './utils/formAPI';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n\nconst name = pluginPkg.strapi.name;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n app.addReducers(reducers);\n app.addMenuLink({\n to: `plugins/${pluginId}`,\n icon: Layout,\n intlLabel: {\n id: `${pluginId}.plugin.name`,\n defaultMessage: 'Content Types Builder',\n },\n permissions: PERMISSIONS.main,\n Component: () => import('./pages/App'),\n position: 5,\n });\n\n app.registerPlugin({\n id: pluginId,\n name,\n // Internal APIs exposed by the CTB for the other plugins to use\n apis: {\n forms: formsAPI,\n },\n });\n },\n bootstrap() {},\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n\nexport * from './exports';\n"],"names":["current","initialState","name","reducer","actions.ADD_ATTRIBUTE","actions.ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE","actions.ADD_CUSTOM_FIELD_ATTRIBUTE","actions.CHANGE_DYNAMIC_ZONE_COMPONENTS","actions.CREATE_COMPONENT_SCHEMA","actions.CREATE_SCHEMA","actions.EDIT_ATTRIBUTE","actions.EDIT_CUSTOM_FIELD_ATTRIBUTE","actions.GET_DATA_SUCCEEDED","actions.UPDATE_INITIAL_STATE","actions.DELETE_NOT_SAVED_TYPE","actions.RELOAD_PLUGIN","actions.REMOVE_COMPONENT_FROM_DYNAMIC_ZONE","actions.REMOVE_FIELD","actions.REMOVE_FIELD_FROM_DISPLAYED_COMPONENT","actions.SET_MODIFIED_DATA","actions.UPDATE_SCHEMA","produce","actions.ON_CHANGE","actions.ON_CHANGE_RELATION_TARGET","actions.ON_CHANGE_RELATION_TYPE","actions.RESET_PROPS","actions.RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO","actions.RESET_PROPS_AND_SAVE_CURRENT_DATA","actions.RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ","actions.SET_DATA_TO_EDIT","actions.SET_ATTRIBUTE_DATA_SCHEMA","actions.SET_CUSTOM_FIELD_DATA_SCHEMA","actions.SET_DYNAMIC_ZONE_DATA_SCHEMA","actions.SET_ERRORS","formModalReducer","pluginId","config","description"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzB,MAAM,CAAC,EAAE,QAAQ,qCAAqC,SAAS,MAAM;AACvE;AAEO,MAAM,sBAAsB;ACN5B,MAAM,WAAW,UAAU,KAAK,QAAQ,eAAe,EAAE;ACInD,MAAA,kBAAkB,CAC7B,UACA,oBACG;AACG,QAAA,wBAAwB,oBAAoB,UAAa,oBAAoB;AAE/E,MAAA,aAAa,cAAc,uBAAuB;AAC7C,WAAA;AAAA,EACT;AAEI,MAAA,aAAa,eAAe,uBAAuB;AAC9C,WAAA;AAAA,EACT;AAEO,SAAA;AACT;ACrBM,MAAA,aAAa,CAAmB,UAAoB,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC;ACArE,MAAM,gBAAgB;AACtB,MAAM,6BACX;AACK,MAAM,wCACX;AACK,MAAM,iCACX;AACK,MAAM,gBAAgB;AACtB,MAAM,0BACX;AACK,MAAM,wBAAwB;AAC9B,MAAM,iBAAiB;AACvB,MAAM,8BACX;AACK,MAAM,qBAAqB;AAC3B,MAAM,gBAAgB;AACtB,MAAM,wCACX;AACK,MAAM,qCACX;AACK,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM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GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,+BAAA,MAAA,OAAA,wBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,OAAA,EACnC,KAAK,CAAC,EAAE,SAAS,KAAA,MAAW;AACpB,iBAAA;AAAA,YACL,MAAM,yBAAyB,MAAM,QAAQ;AAAA,YAC7C;AAAA,UAAA;AAAA,QACF,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UAAA;AAAA,QACF,CACD;AAAA,MAAA,CACJ;AAAA,IAAA;AAGI,WAAA,QAAQ,QAAQ,aAAa;AAAA,EACtC;AACF;"}
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-nJaZni0J.js");
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const index = require("../_chunks/index-Bp9_1YUM.js");
3
4
  require("@strapi/icons");
4
- module.exports = index.index;
5
+ exports.default = index.index;
6
+ exports.private_AutoReloadOverlayBlockerProvider = index.AutoReloadOverlayBlockerProvider;
7
+ exports.private_useAutoReloadOverlayBlocker = index.useAutoReloadOverlayBlocker;
5
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -1,6 +1,8 @@
1
- import { I } from "../_chunks/index-BxeoMEGY.mjs";
1
+ import { K, J, u } from "../_chunks/index-N6VHEZs0.mjs";
2
2
  import "@strapi/icons";
3
3
  export {
4
- I as default
4
+ K as default,
5
+ J as private_AutoReloadOverlayBlockerProvider,
6
+ u as private_useAutoReloadOverlayBlocker
5
7
  };
6
8
  //# sourceMappingURL=index.mjs.map
@@ -255,7 +255,7 @@ export declare const attributesForm: {
255
255
  })[];
256
256
  };
257
257
  number(data: {
258
- type: "string" | "biginteger" | "decimal" | "float" | "integer";
258
+ type: "string" | "decimal" | "biginteger" | "float" | "integer";
259
259
  }): {
260
260
  sections: ({
261
261
  sectionTitle: null;
@@ -1,4 +1,4 @@
1
1
  import type { Schema } from '@strapi/types';
2
- declare const shouldPluralizeName: (nature: Schema.Attribute.RelationKind.Any) => 1 | 2;
3
- declare const shouldPluralizeTargetAttribute: (nature: Schema.Attribute.RelationKind.Any) => 1 | 2;
2
+ declare const shouldPluralizeName: (nature: Schema.Attribute.RelationKind.Any) => 2 | 1;
3
+ declare const shouldPluralizeTargetAttribute: (nature: Schema.Attribute.RelationKind.Any) => 2 | 1;
4
4
  export { shouldPluralizeName, shouldPluralizeTargetAttribute };
@@ -12,5 +12,6 @@ declare const INITIAL_STATE_DATA: {
12
12
  step: null;
13
13
  targetUid: null;
14
14
  customFieldUid: null;
15
+ activeTab: string;
15
16
  };
16
17
  export { INITIAL_STATE_DATA };
@@ -15,6 +15,7 @@ interface SelectCategoryProps {
15
15
  }) => void;
16
16
  value?: string;
17
17
  isCreating?: boolean;
18
+ dynamicZoneTarget?: string | null;
18
19
  }
19
- export declare const SelectCategory: ({ error, intlLabel, name, onChange, value, isCreating, }: SelectCategoryProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const SelectCategory: ({ error, intlLabel, name, onChange, value, isCreating, dynamicZoneTarget, }: SelectCategoryProps) => import("react/jsx-runtime").JSX.Element;
20
21
  export {};
@@ -34,5 +34,7 @@ export interface FormModalNavigationContextValue {
34
34
  kind: string;
35
35
  step: string;
36
36
  targetUid: Internal.UID.Schema;
37
+ activeTab: string;
38
+ setActiveTab: (value: React.SetStateAction<string>) => void;
37
39
  }
38
40
  export declare const FormModalNavigationContext: React.Context<FormModalNavigationContextValue>;
@@ -0,0 +1,15 @@
1
+ export {
2
+ /**
3
+ * @private
4
+ * @description This hook is private and should only be used internally.
5
+ * Pending a refactor to a more generic reload watcher outside of the content
6
+ * type builder.
7
+ */
8
+ useAutoReloadOverlayBlocker as private_useAutoReloadOverlayBlocker,
9
+ /**
10
+ * @private
11
+ * @description This provider is private and should only be used internally.
12
+ * Pending a refactor to a more generic reload watcher outside of the content
13
+ * type builder.
14
+ */
15
+ AutoReloadOverlayBlockerProvider as private_AutoReloadOverlayBlockerProvider, } from './components/AutoReloadOverlayBlocker';
@@ -14,3 +14,4 @@ declare const _default: {
14
14
  })[]>;
15
15
  };
16
16
  export default _default;
17
+ export * from './exports';
@@ -0,0 +1 @@
1
+ export declare const parseDateValue: (value: unknown) => Date | undefined;
@@ -0,0 +1,16 @@
1
+ type TimeChangeHandler = (params: {
2
+ target: {
3
+ name: string;
4
+ value: string | undefined;
5
+ type: string;
6
+ };
7
+ }) => void;
8
+ type TimeChangeParams = {
9
+ value?: string;
10
+ onChange: TimeChangeHandler;
11
+ name: string;
12
+ type: string;
13
+ };
14
+ export declare const handleTimeChange: ({ value }: TimeChangeParams) => string | undefined;
15
+ export declare const handleTimeChangeEvent: (onChange: TimeChangeHandler, name: string, type: string, time?: string) => void;
16
+ export {};
@@ -460,7 +460,6 @@ const DEFAULT_TYPES = [
460
460
  "relation"
461
461
  ];
462
462
  const VALID_UID_TARGETS = ["string", "text"];
463
- const FORBIDDEN_ATTRIBUTE_NAMES = ["__component", "__contentType"];
464
463
  const coreUids = {
465
464
  STRAPI_USER: "admin::user",
466
465
  PREFIX: "strapi::"
@@ -551,7 +550,16 @@ function createComponentBuilder() {
551
550
  const attribute = infos.attributes[key];
552
551
  if (isRelation(attribute)) {
553
552
  if (["manyToMany", "oneToOne"].includes(attribute.relation)) {
554
- attribute.dominant = true;
553
+ if (attribute.target === uid && attribute.targetAttribute !== void 0) {
554
+ const targetAttribute = infos.attributes[attribute.targetAttribute];
555
+ if (targetAttribute.dominant === void 0) {
556
+ attribute.dominant = true;
557
+ } else {
558
+ attribute.dominant = false;
559
+ }
560
+ } else {
561
+ attribute.dominant = true;
562
+ }
555
563
  }
556
564
  this.setRelation({
557
565
  key,
@@ -619,7 +627,16 @@ function createComponentBuilder() {
619
627
  const attribute = newAttributes[key];
620
628
  if (isRelation(attribute)) {
621
629
  if (["manyToMany", "oneToOne"].includes(attribute.relation)) {
622
- attribute.dominant = true;
630
+ if (attribute.target === uid && attribute.targetAttribute !== void 0) {
631
+ const targetAttribute = newAttributes[attribute.targetAttribute];
632
+ if (targetAttribute.dominant === void 0) {
633
+ attribute.dominant = true;
634
+ } else {
635
+ attribute.dominant = false;
636
+ }
637
+ } else {
638
+ attribute.dominant = true;
639
+ }
623
640
  }
624
641
  this.setRelation({
625
642
  key,
@@ -1143,50 +1160,80 @@ const componentCategories$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Obje
1143
1160
  deleteCategory,
1144
1161
  editCategory
1145
1162
  }, Symbol.toStringTag, { value: "Module" }));
1163
+ const reservedAttributes = [
1164
+ // TODO: these need to come from a centralized place so we don't break things accidentally in the future and can share them outside the CTB, for example on Strapi bootstrap prior to schema db sync
1165
+ // ID fields
1166
+ "id",
1167
+ "document_id",
1168
+ // Creator fields
1169
+ "created_at",
1170
+ "updated_at",
1171
+ "published_at",
1172
+ "created_by_id",
1173
+ "updated_by_id",
1174
+ // does not actually conflict because the fields are called *_by_id but we'll leave it to avoid confusion
1175
+ "created_by",
1176
+ "updated_by",
1177
+ // Used for Strapi functionality
1178
+ "entry_id",
1179
+ "status",
1180
+ "localizations",
1181
+ "meta",
1182
+ "locale",
1183
+ "__component",
1184
+ "__contentType",
1185
+ // We support ending with * to denote prefixes
1186
+ "strapi*",
1187
+ "_strapi*",
1188
+ "__strapi*"
1189
+ ];
1190
+ const reservedModels = [
1191
+ "boolean",
1192
+ "date",
1193
+ "date_time",
1194
+ "time",
1195
+ "upload",
1196
+ "document",
1197
+ "then",
1198
+ // no longer an issue but still restricting for being a javascript keyword
1199
+ // We support ending with * to denote prefixes
1200
+ "strapi*",
1201
+ "_strapi*",
1202
+ "__strapi*"
1203
+ ];
1146
1204
  const getReservedNames = () => {
1147
1205
  return {
1148
- // use kebab case everywhere since singularName and pluralName are validated that way
1149
- models: [
1150
- "boolean",
1151
- "date",
1152
- "date-time",
1153
- "time",
1154
- "upload",
1155
- "document",
1156
- "then"
1157
- // no longer an issue but still restricting for being a javascript keyword
1158
- ],
1159
- // attributes are compared with snake_case(name), so only snake_case is needed here and camelCase + UPPER_CASE matches will still be caught
1160
- attributes: [
1161
- // TODO: these need to come from a centralized place so we don't break things accidentally in the future and can share them outside the CTB, for example on Strapi bootstrap prior to schema db sync
1162
- // ID fields
1163
- "id",
1164
- "document_id",
1165
- // Creator fields
1166
- "created_at",
1167
- "updated_at",
1168
- "published_at",
1169
- "created_by_id",
1170
- "updated_by_id",
1171
- // does not actually conflict because the fields are called *_by_id but we'll leave it to avoid confusion
1172
- "created_by",
1173
- "updated_by",
1174
- // Used for Strapi functionality
1175
- "entry_id",
1176
- "status",
1177
- "localizations",
1178
- "meta",
1179
- "locale",
1180
- // TODO: remove these in favor of restricting the strapi_ prefix
1181
- "strapi",
1182
- "strapi_stage",
1183
- "strapi_assignee"
1184
- ]
1206
+ models: reservedModels,
1207
+ attributes: reservedAttributes
1185
1208
  };
1186
1209
  };
1210
+ const isReservedModelName = (name) => {
1211
+ const snakeCaseName = fp.snakeCase(name);
1212
+ if (reservedModels.includes(snakeCaseName)) {
1213
+ return true;
1214
+ }
1215
+ if (reservedModels.filter((key) => key.endsWith("*")).map((key) => key.slice(0, -1)).some((prefix) => snakeCaseName.startsWith(prefix))) {
1216
+ return true;
1217
+ }
1218
+ return false;
1219
+ };
1220
+ const isReservedAttributeName = (name) => {
1221
+ const snakeCaseName = fp.snakeCase(name);
1222
+ if (reservedAttributes.includes(snakeCaseName)) {
1223
+ return true;
1224
+ }
1225
+ if (reservedAttributes.filter((key) => key.endsWith("*")).map((key) => key.slice(0, -1)).some((prefix) => snakeCaseName.startsWith(prefix))) {
1226
+ return true;
1227
+ }
1228
+ return false;
1229
+ };
1187
1230
  const builder$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1188
1231
  __proto__: null,
1189
- getReservedNames
1232
+ getReservedNames,
1233
+ isReservedAttributeName,
1234
+ isReservedModelName,
1235
+ reservedAttributes,
1236
+ reservedModels
1190
1237
  }, Symbol.toStringTag, { value: "Module" }));
1191
1238
  async function clear(uid) {
1192
1239
  const { apiName, modelName } = strapi.contentTypes[uid];
@@ -1649,20 +1696,10 @@ const isConflictingKey = (key, attributes) => {
1649
1696
  });
1650
1697
  };
1651
1698
  const isForbiddenKey = (key) => {
1652
- const snakeCaseKey = fp.snakeCase(key);
1653
- const reservedNames = [
1654
- ...FORBIDDEN_ATTRIBUTE_NAMES,
1655
- ...getService("builder").getReservedNames().attributes
1656
- ];
1657
- return reservedNames.some((reserved) => {
1658
- return fp.snakeCase(reserved) === snakeCaseKey;
1659
- });
1699
+ return getService("builder").isReservedAttributeName(key);
1660
1700
  };
1661
1701
  const forbiddenValidator = () => {
1662
- const reservedNames = [
1663
- ...FORBIDDEN_ATTRIBUTE_NAMES,
1664
- ...getService("builder").getReservedNames().attributes
1665
- ];
1702
+ const reservedNames = [...getService("builder").getReservedNames().attributes];
1666
1703
  return utils.yup.mixed().test({
1667
1704
  name: "forbiddenKeys",
1668
1705
  message: `Attribute keys cannot be one of ${reservedNames.join(", ")}`,
@@ -1930,7 +1967,7 @@ const forbiddenContentTypeNameValidator = () => {
1930
1967
  if (typeof value !== "string") {
1931
1968
  return true;
1932
1969
  }
1933
- return reservedNames.every((reservedName) => fp.snakeCase(reservedName) !== fp.snakeCase(value));
1970
+ return !getService("builder").isReservedModelName(value);
1934
1971
  }
1935
1972
  };
1936
1973
  };