diff --git a/examples/getstarted/package.json b/examples/getstarted/package.json index cf27b70cc5..6ae1e1df8c 100644 --- a/examples/getstarted/package.json +++ b/examples/getstarted/package.json @@ -12,16 +12,16 @@ "strapi": "strapi" }, "dependencies": { - "@strapi/plugin-documentation": "4.3.4", - "@strapi/plugin-graphql": "4.3.4", - "@strapi/plugin-i18n": "4.3.4", - "@strapi/custom-fields": "4.3.4", - "@strapi/plugin-sentry": "4.3.4", - "@strapi/plugin-users-permissions": "4.3.4", - "@strapi/provider-email-mailgun": "4.3.4", - "@strapi/provider-upload-aws-s3": "4.3.4", - "@strapi/provider-upload-cloudinary": "4.3.4", - "@strapi/strapi": "4.3.4", + "@strapi/plugin-documentation": "4.3.6", + "@strapi/plugin-graphql": "4.3.6", + "@strapi/plugin-i18n": "4.3.6", + "@strapi/custom-fields": "4.3.6", + "@strapi/plugin-sentry": "4.3.6", + "@strapi/plugin-users-permissions": "4.3.6", + "@strapi/provider-email-mailgun": "4.3.6", + "@strapi/provider-upload-aws-s3": "4.3.6", + "@strapi/provider-upload-cloudinary": "4.3.6", + "@strapi/strapi": "4.3.6", "@vscode/sqlite3": "5.0.8", "better-sqlite3": "7.4.6", "lodash": "4.17.21", diff --git a/packages/core/content-type-builder/admin/src/components/DataManagerProvider/utils/cleanData.js b/packages/core/content-type-builder/admin/src/components/DataManagerProvider/utils/cleanData.js index c5c067b9d5..1b07bb0034 100644 --- a/packages/core/content-type-builder/admin/src/components/DataManagerProvider/utils/cleanData.js +++ b/packages/core/content-type-builder/admin/src/components/DataManagerProvider/utils/cleanData.js @@ -94,6 +94,11 @@ const formatAttributes = (attributes, mainDataUID) => { acc[name] = removeNullKeys(formattedRelationAttribute); } + if (currentAttribute.customField) { + const customFieldAttribute = { ...currentAttribute, type: 'customField' }; + acc[name] = removeNullKeys(customFieldAttribute); + } + return acc; }, {}); }; diff --git a/packages/core/content-type-builder/server/services/constants.js b/packages/core/content-type-builder/server/services/constants.js index 1cf48f59c0..89a0fa9f6a 100644 --- a/packages/core/content-type-builder/server/services/constants.js +++ b/packages/core/content-type-builder/server/services/constants.js @@ -29,6 +29,7 @@ const DEFAULT_TYPES = [ 'boolean', 'relation', + 'customField', ]; const VALID_UID_TARGETS = ['string', 'text']; diff --git a/packages/core/content-type-builder/server/services/schema-builder/component-builder.js b/packages/core/content-type-builder/server/services/schema-builder/component-builder.js index 202f53c755..589cdb394c 100644 --- a/packages/core/content-type-builder/server/services/schema-builder/component-builder.js +++ b/packages/core/content-type-builder/server/services/schema-builder/component-builder.js @@ -8,7 +8,6 @@ const { nameToSlug, nameToCollectionName } = require('@strapi/utils'); const { ApplicationError } = require('@strapi/utils').errors; const { isConfigurable } = require('../../utils/attributes'); const createSchemaHandler = require('./schema-handler'); -const convertCustomFieldType = require('./utils/convert-custom-field-type'); module.exports = function createComponentBuilder() { return { @@ -33,15 +32,12 @@ module.exports = function createComponentBuilder() { * create a component in the tmpComponent map */ createComponent(infos) { - const { attributes } = infos; const uid = this.createComponentUID(infos); if (this.components.has(uid)) { throw new ApplicationError('component.alreadyExists'); } - convertCustomFieldType(attributes); - const handler = createSchemaHandler({ dir: path.join(strapi.dirs.app.components, nameToSlug(infos.category)), filename: `${nameToSlug(infos.displayName)}.json`, @@ -76,13 +72,12 @@ module.exports = function createComponentBuilder() { * create a component in the tmpComponent map */ editComponent(infos) { - const { uid, attributes } = infos; + const { uid } = infos; if (!this.components.has(uid)) { throw new ApplicationError('component.notFound'); } - convertCustomFieldType(attributes); const component = this.components.get(uid); const [, nameUID] = uid.split('.'); diff --git a/packages/core/content-type-builder/server/services/schema-builder/content-type-builder.js b/packages/core/content-type-builder/server/services/schema-builder/content-type-builder.js index 427bd0ed24..667a5a2d4c 100644 --- a/packages/core/content-type-builder/server/services/schema-builder/content-type-builder.js +++ b/packages/core/content-type-builder/server/services/schema-builder/content-type-builder.js @@ -8,7 +8,6 @@ const { ApplicationError } = require('@strapi/utils').errors; const { isRelation, isConfigurable } = require('../../utils/attributes'); const { typeKinds } = require('../constants'); const createSchemaHandler = require('./schema-handler'); -const convertCustomFieldType = require('./utils/convert-custom-field-type'); const reuseUnsetPreviousProperties = (newAttribute, oldAttribute) => { _.defaults( @@ -72,15 +71,12 @@ module.exports = function createComponentBuilder() { * @returns {object} new content type */ createContentType(infos) { - const { attributes } = infos; const uid = createContentTypeUID(infos); if (this.contentTypes.has(uid)) { throw new ApplicationError('contentType.alreadyExists'); } - convertCustomFieldType(attributes); - const contentType = createSchemaHandler({ modelName: infos.singularName, dir: path.join( @@ -133,14 +129,12 @@ module.exports = function createComponentBuilder() { }, editContentType(infos) { - const { uid, attributes } = infos; + const { uid } = infos; if (!this.contentTypes.has(uid)) { throw new ApplicationError('contentType.notFound'); } - convertCustomFieldType(attributes); - const contentType = this.contentTypes.get(uid); const oldAttributes = contentType.schema.attributes; diff --git a/packages/plugins/custom-fields/package.json b/packages/plugins/custom-fields/package.json index 926fcf27a4..4f4f6ebad7 100644 --- a/packages/plugins/custom-fields/package.json +++ b/packages/plugins/custom-fields/package.json @@ -1,6 +1,6 @@ { "name": "@strapi/custom-fields", - "version": "4.3.4", + "version": "4.3.6", "description": "Strapi maintained Custom Fields", "strapi": { "name": "custom-fields",