From 1817900976bb91cd62698726ffbc2c5c3c8ba243 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Tue, 1 Apr 2025 11:44:27 +0200 Subject: [PATCH 01/36] Updated management API endpoint and model for data type references to align with that used for documents, media etc. --- .../ReferencedByDataTypeController.cs | 47 +++++ .../DataType/ReferencesDataTypeController.cs | 3 +- .../RelationTypePresentationFactory.cs | 9 +- ...TrackedReferenceViewModelsMapDefinition.cs | 45 +++++ src/Umbraco.Cms.Api.Management/OpenApi.json | 191 ++++++++++++++++++ .../ContentTypeReferenceResponseModel.cs | 6 + ...umentTypePropertyReferenceResponseModel.cs | 6 + ...MediaTypePropertyReferenceResponseModel.cs | 6 + ...emberTypePropertyReferenceResponseModel.cs | 6 + src/Umbraco.Core/Constants-ReferenceTypes.cs | 25 +++ src/Umbraco.Core/Models/RelationItemModel.cs | 4 +- .../Repositories/IDataTypeRepository.cs | 1 - src/Umbraco.Core/Services/DataTypeService.cs | 132 ++++++++++++ src/Umbraco.Core/Services/IDataTypeService.cs | 18 ++ .../Builders/MediaTypeBuilder.cs | 1 + .../Services/DataTypeServiceTests.cs | 39 ++++ 16 files changed, 533 insertions(+), 6 deletions(-) create mode 100644 src/Umbraco.Cms.Api.Management/Controllers/DataType/References/ReferencedByDataTypeController.cs create mode 100644 src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypeReferenceResponseModel.cs create mode 100644 src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyReferenceResponseModel.cs create mode 100644 src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyReferenceResponseModel.cs create mode 100644 src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyReferenceResponseModel.cs create mode 100644 src/Umbraco.Core/Constants-ReferenceTypes.cs diff --git a/src/Umbraco.Cms.Api.Management/Controllers/DataType/References/ReferencedByDataTypeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/DataType/References/ReferencedByDataTypeController.cs new file mode 100644 index 000000000000..809a45a724a5 --- /dev/null +++ b/src/Umbraco.Cms.Api.Management/Controllers/DataType/References/ReferencedByDataTypeController.cs @@ -0,0 +1,47 @@ +using Asp.Versioning; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Umbraco.Cms.Api.Common.ViewModels.Pagination; +using Umbraco.Cms.Api.Management.Controllers.DataType; +using Umbraco.Cms.Api.Management.Factories; +using Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; +using Umbraco.Cms.Core.Models; +using Umbraco.Cms.Core.Services; + +namespace Umbraco.Cms.Api.Management.Controllers.DateType.References; + +[ApiVersion("1.0")] +public class ReferencedByDataTypeController : DataTypeControllerBase +{ + private readonly IDataTypeService _dataTypeService; + private readonly IRelationTypePresentationFactory _relationTypePresentationFactory; + + public ReferencedByDataTypeController(IDataTypeService dataTypeService, IRelationTypePresentationFactory relationTypePresentationFactory) + { + _dataTypeService = dataTypeService; + _relationTypePresentationFactory = relationTypePresentationFactory; + } + + /// + /// Gets a paged list of references for the current data type, so you can see where is is being used. + /// + [HttpGet("{id:guid}/referenced-by")] + [MapToApiVersion("1.0")] + [ProducesResponseType(typeof(PagedViewModel), StatusCodes.Status200OK)] + public async Task>> ReferencedBy( + CancellationToken cancellationToken, + Guid id, + int skip = 0, + int take = 20) + { + PagedModel relationItems = await _dataTypeService.GetPagedRelationsAsync(id, skip, take); + + var pagedViewModel = new PagedViewModel + { + Total = relationItems.Total, + Items = await _relationTypePresentationFactory.CreateReferenceResponseModelsAsync(relationItems.Items), + }; + + return pagedViewModel; + } +} diff --git a/src/Umbraco.Cms.Api.Management/Controllers/DataType/ReferencesDataTypeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/DataType/ReferencesDataTypeController.cs index c25586e93cad..0eee28e49b80 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/DataType/ReferencesDataTypeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/DataType/ReferencesDataTypeController.cs @@ -1,4 +1,4 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Umbraco.Cms.Api.Management.Factories; @@ -10,6 +10,7 @@ namespace Umbraco.Cms.Api.Management.Controllers.DataType; [ApiVersion("1.0")] +[Obsolete("Please use ReferencedByDataTypeController and the referenced-by endpoint. Scheduled for removal in Umbraco 17.")] public class ReferencesDataTypeController : DataTypeControllerBase { private readonly IDataTypeService _dataTypeService; diff --git a/src/Umbraco.Cms.Api.Management/Factories/RelationTypePresentationFactory.cs b/src/Umbraco.Cms.Api.Management/Factories/RelationTypePresentationFactory.cs index a6fb1cbae85f..8fc2309b0f21 100644 --- a/src/Umbraco.Cms.Api.Management/Factories/RelationTypePresentationFactory.cs +++ b/src/Umbraco.Cms.Api.Management/Factories/RelationTypePresentationFactory.cs @@ -56,9 +56,12 @@ public async Task> CreateReferenceResponseM IReferenceResponseModel[] result = relationItemModelsCollection.Select(relationItemModel => relationItemModel.NodeType switch { - Constants.UdiEntityType.Document => MapDocumentReference(relationItemModel, slimEntities), - Constants.UdiEntityType.Media => _umbracoMapper.Map(relationItemModel), - Constants.UdiEntityType.Member => _umbracoMapper.Map(relationItemModel), + Constants.ReferenceType.Document => MapDocumentReference(relationItemModel, slimEntities), + Constants.ReferenceType.Media => _umbracoMapper.Map(relationItemModel), + Constants.ReferenceType.Member => _umbracoMapper.Map(relationItemModel), + Constants.ReferenceType.DocumentTypeProperty => _umbracoMapper.Map(relationItemModel), + Constants.ReferenceType.MediaTypeProperty => _umbracoMapper.Map(relationItemModel), + Constants.ReferenceType.MemberTypeProperty => _umbracoMapper.Map(relationItemModel), _ => _umbracoMapper.Map(relationItemModel), }).WhereNotNull().ToArray(); diff --git a/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs b/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs index e9f2700f5ad2..9143ba810ddc 100644 --- a/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs +++ b/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs @@ -12,6 +12,9 @@ public void DefineMaps(IUmbracoMapper mapper) mapper.Define((source, context) => new DocumentReferenceResponseModel(), Map); mapper.Define((source, context) => new MediaReferenceResponseModel(), Map); mapper.Define((source, context) => new MemberReferenceResponseModel(), Map); + mapper.Define((source, context) => new DocumentTypePropertyReferenceResponseModel(), Map); + mapper.Define((source, context) => new MediaTypePropertyReferenceResponseModel(), Map); + mapper.Define((source, context) => new MemberTypePropertyReferenceResponseModel(), Map); mapper.Define((source, context) => new DefaultReferenceResponseModel(), Map); mapper.Define((source, context) => new ReferenceByIdModel(), Map); mapper.Define((source, context) => new ReferenceByIdModel(), Map); @@ -57,6 +60,48 @@ private void Map(RelationItemModel source, MemberReferenceResponseModel target, }; } + // Umbraco.Code.MapAll + private void Map(RelationItemModel source, DocumentTypePropertyReferenceResponseModel target, MapperContext context) + { + target.Id = source.NodeKey; + target.Name = source.NodeName; + target.Alias = source.NodeAlias; + target.DocumentType = new TrackedReferenceDocumentType + { + Alias = source.ContentTypeAlias, + Icon = source.ContentTypeIcon, + Name = source.ContentTypeName, + }; + } + + // Umbraco.Code.MapAll + private void Map(RelationItemModel source, MediaTypePropertyReferenceResponseModel target, MapperContext context) + { + target.Id = source.NodeKey; + target.Name = source.NodeName; + target.Alias = source.NodeAlias; + target.MediaType = new TrackedReferenceMediaType + { + Alias = source.ContentTypeAlias, + Icon = source.ContentTypeIcon, + Name = source.ContentTypeName, + }; + } + + // Umbraco.Code.MapAll + private void Map(RelationItemModel source, MemberTypePropertyReferenceResponseModel target, MapperContext context) + { + target.Id = source.NodeKey; + target.Name = source.NodeName; + target.Alias = source.NodeAlias; + target.MemberType = new TrackedReferenceMemberType + { + Alias = source.ContentTypeAlias, + Icon = source.ContentTypeIcon, + Name = source.ContentTypeName, + }; + } + // Umbraco.Code.MapAll private void Map(RelationItemModel source, DefaultReferenceResponseModel target, MapperContext context) { diff --git a/src/Umbraco.Cms.Api.Management/OpenApi.json b/src/Umbraco.Cms.Api.Management/OpenApi.json index 44a69ccc957e..b49d19f18468 100644 --- a/src/Umbraco.Cms.Api.Management/OpenApi.json +++ b/src/Umbraco.Cms.Api.Management/OpenApi.json @@ -816,6 +816,70 @@ ] } }, + "/umbraco/management/api/v1/data-type/{id}/referenced-by": { + "get": { + "tags": [ + "Data Type" + ], + "operationId": "GetDataTypeByIdReferencedBy", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "name": "skip", + "in": "query", + "schema": { + "type": "integer", + "format": "int32", + "default": 0 + } + }, + { + "name": "take", + "in": "query", + "schema": { + "type": "integer", + "format": "int32", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/PagedIReferenceResponseModel" + } + ] + } + } + } + }, + "401": { + "description": "The resource is protected and requires an authentication token" + }, + "403": { + "description": "The authenticated user does not have access to this resource" + } + }, + "security": [ + { + "Backoffice User": [ ] + } + ] + } + }, "/umbraco/management/api/v1/data-type/{id}/references": { "get": { "tags": [ @@ -872,6 +936,7 @@ "description": "The authenticated user does not have access to this resource" } }, + "deprecated": true, "security": [ { "Backoffice User": [ ] @@ -37705,6 +37770,45 @@ }, "additionalProperties": false }, + "DocumentTypePropertyReferenceResponseModel": { + "required": [ + "$type", + "documentType", + "id" + ], + "type": "object", + "properties": { + "$type": { + "type": "string" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "name": { + "type": "string", + "nullable": true + }, + "alias": { + "type": "string", + "nullable": true + }, + "documentType": { + "oneOf": [ + { + "$ref": "#/components/schemas/TrackedReferenceDocumentTypeModel" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "$type", + "mapping": { + "DocumentTypePropertyReferenceResponseModel": "#/components/schemas/DocumentTypePropertyReferenceResponseModel" + } + } + }, "DocumentTypePropertyTypeContainerResponseModel": { "required": [ "id", @@ -39769,6 +39873,45 @@ }, "additionalProperties": false }, + "MediaTypePropertyReferenceResponseModel": { + "required": [ + "$type", + "id", + "mediaType" + ], + "type": "object", + "properties": { + "$type": { + "type": "string" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "name": { + "type": "string", + "nullable": true + }, + "alias": { + "type": "string", + "nullable": true + }, + "mediaType": { + "oneOf": [ + { + "$ref": "#/components/schemas/TrackedReferenceMediaTypeModel" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "$type", + "mapping": { + "MediaTypePropertyReferenceResponseModel": "#/components/schemas/MediaTypePropertyReferenceResponseModel" + } + } + }, "MediaTypePropertyTypeContainerResponseModel": { "required": [ "id", @@ -40547,6 +40690,45 @@ }, "additionalProperties": false }, + "MemberTypePropertyReferenceResponseModel": { + "required": [ + "$type", + "id", + "memberType" + ], + "type": "object", + "properties": { + "$type": { + "type": "string" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "name": { + "type": "string", + "nullable": true + }, + "alias": { + "type": "string", + "nullable": true + }, + "memberType": { + "oneOf": [ + { + "$ref": "#/components/schemas/TrackedReferenceMemberTypeModel" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "$type", + "mapping": { + "MemberTypePropertyReferenceResponseModel": "#/components/schemas/MemberTypePropertyReferenceResponseModel" + } + } + }, "MemberTypePropertyTypeContainerResponseModel": { "required": [ "id", @@ -41754,11 +41936,20 @@ { "$ref": "#/components/schemas/DocumentReferenceResponseModel" }, + { + "$ref": "#/components/schemas/DocumentTypePropertyReferenceResponseModel" + }, { "$ref": "#/components/schemas/MediaReferenceResponseModel" }, + { + "$ref": "#/components/schemas/MediaTypePropertyReferenceResponseModel" + }, { "$ref": "#/components/schemas/MemberReferenceResponseModel" + }, + { + "$ref": "#/components/schemas/MemberTypePropertyReferenceResponseModel" } ] } diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypeReferenceResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypeReferenceResponseModel.cs new file mode 100644 index 000000000000..f13cf28ccdbb --- /dev/null +++ b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypeReferenceResponseModel.cs @@ -0,0 +1,6 @@ +namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; + +public abstract class ContentTypePropertyReferenceResponseModel : ReferenceResponseModel +{ + public string? Alias { get; set; } +} diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyReferenceResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyReferenceResponseModel.cs new file mode 100644 index 000000000000..00cca40bdef3 --- /dev/null +++ b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyReferenceResponseModel.cs @@ -0,0 +1,6 @@ +namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; + +public class DocumentTypePropertyReferenceResponseModel : ContentTypePropertyReferenceResponseModel +{ + public TrackedReferenceDocumentType DocumentType { get; set; } = new(); +} diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyReferenceResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyReferenceResponseModel.cs new file mode 100644 index 000000000000..7c14cec50d1f --- /dev/null +++ b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyReferenceResponseModel.cs @@ -0,0 +1,6 @@ +namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; + +public class MediaTypePropertyReferenceResponseModel : ContentTypePropertyReferenceResponseModel +{ + public TrackedReferenceMediaType MediaType { get; set; } = new(); +} diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyReferenceResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyReferenceResponseModel.cs new file mode 100644 index 000000000000..423309bf00dd --- /dev/null +++ b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyReferenceResponseModel.cs @@ -0,0 +1,6 @@ +namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; + +public class MemberTypePropertyReferenceResponseModel : ContentTypePropertyReferenceResponseModel +{ + public TrackedReferenceMemberType MemberType { get; set; } = new(); +} diff --git a/src/Umbraco.Core/Constants-ReferenceTypes.cs b/src/Umbraco.Core/Constants-ReferenceTypes.cs new file mode 100644 index 000000000000..638bde29c02b --- /dev/null +++ b/src/Umbraco.Core/Constants-ReferenceTypes.cs @@ -0,0 +1,25 @@ +namespace Umbraco.Cms.Core; + +public static partial class Constants +{ + /// + /// Defines reference tyoes. + /// + /// + /// Reference types are used to identify the type of entity that is being referenced when exposing references + /// between Umbraco entities. + /// These are used in the management API and backoffice to indicate and warn editors when working with an entity, + /// as to what other entities depend on it. + /// These consist of references managed by Umbraco relations (e.g. document, media and member). + /// But also references that come from schema (e.g. data type usage on content types). + /// + public static class ReferenceType + { + public const string Document = UdiEntityType.Document; + public const string Media = UdiEntityType.Media; + public const string Member = UdiEntityType.Member; + public const string DocumentTypeProperty = "document-type-property"; + public const string MediaTypeProperty = "media-type-property"; + public const string MemberTypeProperty = "member-type-property"; + } +} diff --git a/src/Umbraco.Core/Models/RelationItemModel.cs b/src/Umbraco.Core/Models/RelationItemModel.cs index a05c8f65918f..e4e0e28d86f4 100644 --- a/src/Umbraco.Core/Models/RelationItemModel.cs +++ b/src/Umbraco.Core/Models/RelationItemModel.cs @@ -1,9 +1,11 @@ -namespace Umbraco.Cms.Core.Models; +namespace Umbraco.Cms.Core.Models; public class RelationItemModel { public Guid NodeKey { get; set; } + public string? NodeAlias { get; set; } + public string? NodeName { get; set; } public string? NodeType { get; set; } diff --git a/src/Umbraco.Core/Persistence/Repositories/IDataTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/IDataTypeRepository.cs index ad113533d8d9..f0babf61f378 100644 --- a/src/Umbraco.Core/Persistence/Repositories/IDataTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/IDataTypeRepository.cs @@ -24,6 +24,5 @@ public interface IDataTypeRepository : IReadWriteQueryRepository /// /// /// - IReadOnlyDictionary> FindListViewUsages(int id) => throw new NotImplementedException(); } diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs index f22948968a56..73aa18f04431 100644 --- a/src/Umbraco.Core/Services/DataTypeService.cs +++ b/src/Umbraco.Core/Services/DataTypeService.cs @@ -25,12 +25,15 @@ public class DataTypeService : RepositoryService, IDataTypeService private readonly IDataTypeRepository _dataTypeRepository; private readonly IDataTypeContainerRepository _dataTypeContainerRepository; private readonly IContentTypeRepository _contentTypeRepository; + private readonly IMediaTypeRepository _mediaTypeRepository; + private readonly IMemberTypeRepository _memberTypeRepository; private readonly IAuditRepository _auditRepository; private readonly IIOHelper _ioHelper; private readonly IDataTypeContainerService _dataTypeContainerService; private readonly IUserIdKeyResolver _userIdKeyResolver; private readonly Lazy _idKeyMap; + [Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")] public DataTypeService( ICoreScopeProvider provider, ILoggerFactory loggerFactory, @@ -41,12 +44,41 @@ public DataTypeService( IContentTypeRepository contentTypeRepository, IIOHelper ioHelper, Lazy idKeyMap) + : this( + provider, + loggerFactory, + eventMessagesFactory, + dataTypeRepository, + dataValueEditorFactory, + auditRepository, + contentTypeRepository, + StaticServiceProvider.Instance.GetRequiredService(), + StaticServiceProvider.Instance.GetRequiredService(), + ioHelper, + idKeyMap) + { + } + + public DataTypeService( + ICoreScopeProvider provider, + ILoggerFactory loggerFactory, + IEventMessagesFactory eventMessagesFactory, + IDataTypeRepository dataTypeRepository, + IDataValueEditorFactory dataValueEditorFactory, + IAuditRepository auditRepository, + IContentTypeRepository contentTypeRepository, + IMediaTypeRepository mediaTypeRepository, + IMemberTypeRepository memberTypeRepositor, + IIOHelper ioHelper, + Lazy idKeyMap) : base(provider, loggerFactory, eventMessagesFactory) { _dataValueEditorFactory = dataValueEditorFactory; _dataTypeRepository = dataTypeRepository; _auditRepository = auditRepository; _contentTypeRepository = contentTypeRepository; + _mediaTypeRepository = mediaTypeRepository; + _memberTypeRepository = memberTypeRepositor; _ioHelper = ioHelper; _idKeyMap = idKeyMap; @@ -703,12 +735,112 @@ public async Task>, DataTyp return await Task.FromResult(Attempt.SucceedWithStatus(DataTypeOperationStatus.Success, usages)); } + /// public IReadOnlyDictionary> GetListViewReferences(int id) { using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true); return _dataTypeRepository.FindListViewUsages(id); } + /// + public Task> GetPagedRelationsAsync(Guid key, int skip, int take) + { + using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true); + + IDataType? dataType = GetDataTypeFromRepository(key); + if (dataType == null) + { + // Is an unexpected response, but returning an empty collection aligns with how we handle retrieval of concrete Umbraco + // relations based on documents, media and members. + return Task.FromResult(new PagedModel()); + } + + // We don't really need true paging here, as the number of data type relations will be small compared to what there could + // potentially by for concrete Umbraco relations based on documents, media and members. + // So we'll retrieve all usages for the data type and construct a paged response. + // This allows us to re-use the existing repository methods used for GetReferencesAsync and GetListViewReferences. + IReadOnlyDictionary> usages = _dataTypeRepository.FindUsages(dataType.Id); + IReadOnlyDictionary> listViewUsages = _dataTypeRepository.FindListViewUsages(dataType.Id); + + // Combine the property and list view usages into a single collection of property aliases and content type UDIs. + IList<(string PropertyAlias, Udi Udi)> combinedUsages = usages + .SelectMany(kvp => kvp.Value.Select(value => (value, kvp.Key))) + .Concat(listViewUsages.SelectMany(kvp => kvp.Value.Select(value => (value, kvp.Key)))) + .ToList(); + + var totalItems = combinedUsages.Count; + + // Create the page of items. + IEnumerable<(string PropertyAlias, Udi Udi)> pagedUsages = combinedUsages + .OrderBy(x => x.Udi.EntityType) // Document types first, then media types, then member types. + .ThenBy(x => x.PropertyAlias) + .Skip(skip) + .Take(take); + + // Get the content types for the UDIs referenced in the page of items to construct the response from. + // They could be document, media or member types. + IEnumerable documentTypes = GetContentTypes( + pagedUsages, + Constants.UdiEntityType.DocumentType, + _contentTypeRepository); + IEnumerable mediaTypes = GetContentTypes( + pagedUsages, + Constants.UdiEntityType.MediaType, + _mediaTypeRepository); + IEnumerable memberTypes = GetContentTypes( + pagedUsages, + Constants.UdiEntityType.MemberType, + _memberTypeRepository); + var contentTypes = documentTypes.Concat(mediaTypes).Concat(memberTypes).ToList(); + + IEnumerable relations = pagedUsages + .Select(x => + { + // Get the matching content type so we can populate the content type and property details. + IContentTypeComposition contentType = contentTypes.Single(y => y.Key == ((GuidUdi)x.Udi).Guid); + + string nodeType = x.Udi.EntityType switch + { + Constants.UdiEntityType.DocumentType => Constants.ReferenceType.DocumentTypeProperty, + Constants.UdiEntityType.MediaType => Constants.ReferenceType.MediaTypeProperty, + Constants.UdiEntityType.MemberType => Constants.ReferenceType.MemberTypeProperty, + _ => throw new ArgumentOutOfRangeException(nameof(x.Udi.EntityType)), + }; + + // Look-up the property details from the property alias. This will be null for a list view reference. + IPropertyType? propertyType = contentType.PropertyTypes.SingleOrDefault(y => y.Alias == x.PropertyAlias); + return new RelationItemModel + { + ContentTypeAlias = contentType.Alias, + ContentTypeIcon = contentType.Icon, + ContentTypeName = contentType.Name, + NodeType = nodeType, + NodeName = propertyType?.Name ?? x.PropertyAlias, + NodeAlias = x.PropertyAlias, + NodeKey = propertyType?.Key ?? Guid.Empty, + }; + }); + + var pagedModel = new PagedModel(totalItems, relations); + return Task.FromResult(pagedModel); + } + + private static IEnumerable GetContentTypes( + IEnumerable<(string PropertyAlias, Udi Udi)> dataTypeUsages, + string entityType, + IContentTypeRepositoryBase repository) + where T : IContentTypeComposition + { + Guid[] contentTypeKeys = dataTypeUsages + .Where(x => x.Udi is GuidUdi && x.Udi.EntityType == entityType) + .Select(x => ((GuidUdi)x.Udi).Guid) + .Distinct() + .ToArray(); + return contentTypeKeys.Length > 0 + ? repository.GetMany(contentTypeKeys) + : []; + } + /// public IEnumerable ValidateConfigurationData(IDataType dataType) { diff --git a/src/Umbraco.Core/Services/IDataTypeService.cs b/src/Umbraco.Core/Services/IDataTypeService.cs index 3a4576552c2f..0f2f58ceb837 100644 --- a/src/Umbraco.Core/Services/IDataTypeService.cs +++ b/src/Umbraco.Core/Services/IDataTypeService.cs @@ -18,6 +18,7 @@ public interface IDataTypeService : IService [Obsolete("Please use GetReferencesAsync. Will be deleted in V15.")] IReadOnlyDictionary> GetReferences(int id); + [Obsolete("Please use GetPagedRelationsAsync. Scheduled for removal in Umbraco 17.")] IReadOnlyDictionary> GetListViewReferences(int id) => throw new NotImplementedException(); /// @@ -25,8 +26,25 @@ public interface IDataTypeService : IService /// /// The guid Id of the /// + [Obsolete("Please use GetPagedRelationsAsync. Scheduled for removal in Umbraco 17.")] Task>, DataTypeOperationStatus>> GetReferencesAsync(Guid id); + /// + /// Gets a paged result of items which are in relation with the current data type. + /// + /// The identifier of the data type to retrieve relations for. + /// The amount of items to skip + /// The amount of items to take. + /// A paged result of objects. + /// + /// Note that the model and method signature here aligns with with how we handle retrieval of concrete Umbraco + /// relations based on documents, media and members in . + /// The intention is that we align data type relations with these so they can be handled polymorphically at the management API + /// and backoffice UI level. + /// + Task> GetPagedRelationsAsync(Guid key, int skip, int take) + => Task.FromResult(new PagedModel()); + [Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")] Attempt?> CreateContainer(int parentId, Guid key, string name, int userId = Constants.Security.SuperUserId); diff --git a/tests/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs b/tests/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs index dcde82b47d4c..6439899955a5 100644 --- a/tests/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs +++ b/tests/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs @@ -139,6 +139,7 @@ public static MediaType CreateSimpleMediaType( var mediaType = builder .WithAlias(alias) .WithName(name) + .WithIcon("icon-picture") .WithParentContentType(parent) .AddPropertyGroup() .WithAlias(propertyGroupAlias) diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs index 1c2b46137b3c..659c75b048e7 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs @@ -30,6 +30,8 @@ public class DataTypeServiceTests : UmbracoIntegrationTest private IContentTypeService ContentTypeService => GetRequiredService(); + private IMediaTypeService MediaTypeService => GetRequiredService(); + private IFileService FileService => GetRequiredService(); private IConfigurationEditorJsonSerializer ConfigurationEditorJsonSerializer => @@ -446,4 +448,41 @@ public async Task Cannot_Delete_NonDeletable_DataType(string dataTypeKey) Assert.IsFalse(result.Success); Assert.AreEqual(DataTypeOperationStatus.NonDeletable, result.Status); } + + [Test] + public async Task DataTypeService_Can_Get_References() + { + IEnumerable dataTypeDefinitions = await DataTypeService.GetByEditorAliasAsync(Constants.PropertyEditors.Aliases.RichText); + + IContentType documentType = ContentTypeBuilder.CreateSimpleContentType("umbTextpage", "Text Page"); + ContentTypeService.Save(documentType); + + IMediaType mediaType = MediaTypeBuilder.CreateSimpleMediaType("umbMediaItem", "Media Item"); + MediaTypeService.Save(mediaType); + + documentType = ContentTypeService.Get(documentType.Id); + Assert.IsNotNull(documentType.PropertyTypes.SingleOrDefault(pt => pt.PropertyEditorAlias is Constants.PropertyEditors.Aliases.RichText)); + + mediaType = MediaTypeService.Get(mediaType.Id); + Assert.IsNotNull(mediaType.PropertyTypes.SingleOrDefault(pt => pt.PropertyEditorAlias is Constants.PropertyEditors.Aliases.RichText)); + + var definition = dataTypeDefinitions.First(); + var definitionKey = definition.Key; + PagedModel result = await DataTypeService.GetPagedRelationsAsync(definitionKey, 0, 10); + Assert.AreEqual(2, result.Total); + + RelationItemModel firstResult = result.Items.First(); + Assert.AreEqual("umbTextpage", firstResult.ContentTypeAlias); + Assert.AreEqual("Text Page", firstResult.ContentTypeName); + Assert.AreEqual("icon-document", firstResult.ContentTypeIcon); + Assert.AreEqual("bodyText", firstResult.NodeAlias); + Assert.AreEqual("Body text", firstResult.NodeName); + + RelationItemModel secondResult = result.Items.Skip(1).First(); + Assert.AreEqual("umbMediaItem", secondResult.ContentTypeAlias); + Assert.AreEqual("Media Item", secondResult.ContentTypeName); + Assert.AreEqual("icon-picture", secondResult.ContentTypeIcon); + Assert.AreEqual("bodyText", secondResult.NodeAlias); + Assert.AreEqual("Body text", secondResult.NodeName); + } } From d53b446972737663c738653087243b6ad2d3f8d0 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Tue, 1 Apr 2025 14:37:16 +0200 Subject: [PATCH 02/36] Refactoring. --- src/Umbraco.Core/Services/DataTypeService.cs | 33 +++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs index 73aa18f04431..789772daebee 100644 --- a/src/Umbraco.Core/Services/DataTypeService.cs +++ b/src/Umbraco.Core/Services/DataTypeService.cs @@ -758,7 +758,7 @@ public Task> GetPagedRelationsAsync(Guid key, int // We don't really need true paging here, as the number of data type relations will be small compared to what there could // potentially by for concrete Umbraco relations based on documents, media and members. // So we'll retrieve all usages for the data type and construct a paged response. - // This allows us to re-use the existing repository methods used for GetReferencesAsync and GetListViewReferences. + // This allows us to re-use the existing repository methods used for FindUsages and FindListViewUsages. IReadOnlyDictionary> usages = _dataTypeRepository.FindUsages(dataType.Id); IReadOnlyDictionary> listViewUsages = _dataTypeRepository.FindListViewUsages(dataType.Id); @@ -779,19 +779,7 @@ public Task> GetPagedRelationsAsync(Guid key, int // Get the content types for the UDIs referenced in the page of items to construct the response from. // They could be document, media or member types. - IEnumerable documentTypes = GetContentTypes( - pagedUsages, - Constants.UdiEntityType.DocumentType, - _contentTypeRepository); - IEnumerable mediaTypes = GetContentTypes( - pagedUsages, - Constants.UdiEntityType.MediaType, - _mediaTypeRepository); - IEnumerable memberTypes = GetContentTypes( - pagedUsages, - Constants.UdiEntityType.MemberType, - _memberTypeRepository); - var contentTypes = documentTypes.Concat(mediaTypes).Concat(memberTypes).ToList(); + IList contentTypes = GetReferencedContentTypes(pagedUsages); IEnumerable relations = pagedUsages .Select(x => @@ -825,6 +813,23 @@ public Task> GetPagedRelationsAsync(Guid key, int return Task.FromResult(pagedModel); } + private IList GetReferencedContentTypes(IEnumerable<(string PropertyAlias, Udi Udi)> pagedUsages) + { + IEnumerable documentTypes = GetContentTypes( + pagedUsages, + Constants.UdiEntityType.DocumentType, + _contentTypeRepository); + IEnumerable mediaTypes = GetContentTypes( + pagedUsages, + Constants.UdiEntityType.MediaType, + _mediaTypeRepository); + IEnumerable memberTypes = GetContentTypes( + pagedUsages, + Constants.UdiEntityType.MemberType, + _memberTypeRepository); + return documentTypes.Concat(mediaTypes).Concat(memberTypes).ToList(); + } + private static IEnumerable GetContentTypes( IEnumerable<(string PropertyAlias, Udi Udi)> dataTypeUsages, string entityType, From 4ac16318a719d7c3b444a1a4238d794fe73d79bc Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Tue, 1 Apr 2025 14:58:19 +0200 Subject: [PATCH 03/36] Update src/Umbraco.Core/Constants-ReferenceTypes.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/Umbraco.Core/Constants-ReferenceTypes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Constants-ReferenceTypes.cs b/src/Umbraco.Core/Constants-ReferenceTypes.cs index 638bde29c02b..c76de94733bc 100644 --- a/src/Umbraco.Core/Constants-ReferenceTypes.cs +++ b/src/Umbraco.Core/Constants-ReferenceTypes.cs @@ -3,7 +3,7 @@ namespace Umbraco.Cms.Core; public static partial class Constants { /// - /// Defines reference tyoes. + /// Defines reference types. /// /// /// Reference types are used to identify the type of entity that is being referenced when exposing references From a07feb4fabb12ba61cd0105d1c18ebf1128fee57 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Tue, 1 Apr 2025 15:01:36 +0200 Subject: [PATCH 04/36] Fixed typos. --- .../DataType/References/ReferencedByDataTypeController.cs | 2 +- src/Umbraco.Core/Services/DataTypeService.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Cms.Api.Management/Controllers/DataType/References/ReferencedByDataTypeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/DataType/References/ReferencedByDataTypeController.cs index 809a45a724a5..6f8c14fb7adb 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/DataType/References/ReferencedByDataTypeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/DataType/References/ReferencedByDataTypeController.cs @@ -8,7 +8,7 @@ using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Services; -namespace Umbraco.Cms.Api.Management.Controllers.DateType.References; +namespace Umbraco.Cms.Api.Management.Controllers.DataType.References; [ApiVersion("1.0")] public class ReferencedByDataTypeController : DataTypeControllerBase diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs index 789772daebee..f41b7dbcab14 100644 --- a/src/Umbraco.Core/Services/DataTypeService.cs +++ b/src/Umbraco.Core/Services/DataTypeService.cs @@ -68,7 +68,7 @@ public DataTypeService( IAuditRepository auditRepository, IContentTypeRepository contentTypeRepository, IMediaTypeRepository mediaTypeRepository, - IMemberTypeRepository memberTypeRepositor, + IMemberTypeRepository memberTypeRepository, IIOHelper ioHelper, Lazy idKeyMap) : base(provider, loggerFactory, eventMessagesFactory) @@ -78,7 +78,7 @@ public DataTypeService( _auditRepository = auditRepository; _contentTypeRepository = contentTypeRepository; _mediaTypeRepository = mediaTypeRepository; - _memberTypeRepository = memberTypeRepositor; + _memberTypeRepository = memberTypeRepository; _ioHelper = ioHelper; _idKeyMap = idKeyMap; From 09e2f7f522ab5a19a0791891934ee76d7ebc1993 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 1 Apr 2025 19:38:04 +0200 Subject: [PATCH 05/36] generate server models --- .../src/external/backend-api/src/sdk.gen.ts | 29 +++++++++++++++- .../src/external/backend-api/src/types.gen.ts | 34 ++++++++++++++++++- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/external/backend-api/src/sdk.gen.ts b/src/Umbraco.Web.UI.Client/src/external/backend-api/src/sdk.gen.ts index ae4012fb627a..365ba7222dda 100644 --- a/src/Umbraco.Web.UI.Client/src/external/backend-api/src/sdk.gen.ts +++ b/src/Umbraco.Web.UI.Client/src/external/backend-api/src/sdk.gen.ts @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { GetCultureData, GetCultureResponse, PostDataTypeData, PostDataTypeResponse, GetDataTypeByIdData, GetDataTypeByIdResponse, DeleteDataTypeByIdData, DeleteDataTypeByIdResponse, PutDataTypeByIdData, PutDataTypeByIdResponse, PostDataTypeByIdCopyData, PostDataTypeByIdCopyResponse, GetDataTypeByIdIsUsedData, GetDataTypeByIdIsUsedResponse, PutDataTypeByIdMoveData, PutDataTypeByIdMoveResponse, GetDataTypeByIdReferencesData, GetDataTypeByIdReferencesResponse, GetDataTypeConfigurationResponse, PostDataTypeFolderData, PostDataTypeFolderResponse, GetDataTypeFolderByIdData, GetDataTypeFolderByIdResponse, DeleteDataTypeFolderByIdData, DeleteDataTypeFolderByIdResponse, PutDataTypeFolderByIdData, PutDataTypeFolderByIdResponse, GetFilterDataTypeData, GetFilterDataTypeResponse, GetItemDataTypeData, GetItemDataTypeResponse, GetItemDataTypeSearchData, GetItemDataTypeSearchResponse, GetTreeDataTypeAncestorsData, GetTreeDataTypeAncestorsResponse, GetTreeDataTypeChildrenData, GetTreeDataTypeChildrenResponse, GetTreeDataTypeRootData, GetTreeDataTypeRootResponse, GetDictionaryData, GetDictionaryResponse, PostDictionaryData, PostDictionaryResponse, GetDictionaryByIdData, GetDictionaryByIdResponse, DeleteDictionaryByIdData, DeleteDictionaryByIdResponse, PutDictionaryByIdData, PutDictionaryByIdResponse, GetDictionaryByIdExportData, GetDictionaryByIdExportResponse, PutDictionaryByIdMoveData, PutDictionaryByIdMoveResponse, PostDictionaryImportData, PostDictionaryImportResponse, GetItemDictionaryData, GetItemDictionaryResponse, GetTreeDictionaryAncestorsData, GetTreeDictionaryAncestorsResponse, GetTreeDictionaryChildrenData, GetTreeDictionaryChildrenResponse, GetTreeDictionaryRootData, GetTreeDictionaryRootResponse, GetCollectionDocumentByIdData, GetCollectionDocumentByIdResponse, PostDocumentData, PostDocumentResponse, GetDocumentByIdData, GetDocumentByIdResponse, DeleteDocumentByIdData, DeleteDocumentByIdResponse, PutDocumentByIdData, PutDocumentByIdResponse, GetDocumentByIdAuditLogData, GetDocumentByIdAuditLogResponse, PostDocumentByIdCopyData, PostDocumentByIdCopyResponse, GetDocumentByIdDomainsData, GetDocumentByIdDomainsResponse, PutDocumentByIdDomainsData, PutDocumentByIdDomainsResponse, PutDocumentByIdMoveData, PutDocumentByIdMoveResponse, PutDocumentByIdMoveToRecycleBinData, PutDocumentByIdMoveToRecycleBinResponse, GetDocumentByIdNotificationsData, GetDocumentByIdNotificationsResponse, PutDocumentByIdNotificationsData, PutDocumentByIdNotificationsResponse, PostDocumentByIdPublicAccessData, PostDocumentByIdPublicAccessResponse, DeleteDocumentByIdPublicAccessData, DeleteDocumentByIdPublicAccessResponse, GetDocumentByIdPublicAccessData, GetDocumentByIdPublicAccessResponse, PutDocumentByIdPublicAccessData, PutDocumentByIdPublicAccessResponse, PutDocumentByIdPublishData, PutDocumentByIdPublishResponse, PutDocumentByIdPublishWithDescendantsData, PutDocumentByIdPublishWithDescendantsResponse, GetDocumentByIdPublishedData, GetDocumentByIdPublishedResponse, GetDocumentByIdReferencedByData, GetDocumentByIdReferencedByResponse, GetDocumentByIdReferencedDescendantsData, GetDocumentByIdReferencedDescendantsResponse, PutDocumentByIdUnpublishData, PutDocumentByIdUnpublishResponse, PutDocumentByIdValidateData, PutDocumentByIdValidateResponse, PutUmbracoManagementApiV11DocumentByIdValidate11Data, PutUmbracoManagementApiV11DocumentByIdValidate11Response, GetDocumentAreReferencedData, GetDocumentAreReferencedResponse, GetDocumentConfigurationResponse, PutDocumentSortData, PutDocumentSortResponse, GetDocumentUrlsData, GetDocumentUrlsResponse, PostDocumentValidateData, PostDocumentValidateResponse, GetItemDocumentData, GetItemDocumentResponse, GetItemDocumentSearchData, GetItemDocumentSearchResponse, DeleteRecycleBinDocumentResponse, DeleteRecycleBinDocumentByIdData, DeleteRecycleBinDocumentByIdResponse, GetRecycleBinDocumentByIdOriginalParentData, GetRecycleBinDocumentByIdOriginalParentResponse, PutRecycleBinDocumentByIdRestoreData, PutRecycleBinDocumentByIdRestoreResponse, GetRecycleBinDocumentChildrenData, GetRecycleBinDocumentChildrenResponse, GetRecycleBinDocumentRootData, GetRecycleBinDocumentRootResponse, GetTreeDocumentAncestorsData, GetTreeDocumentAncestorsResponse, GetTreeDocumentChildrenData, GetTreeDocumentChildrenResponse, GetTreeDocumentRootData, GetTreeDocumentRootResponse, PostDocumentBlueprintData, PostDocumentBlueprintResponse, GetDocumentBlueprintByIdData, GetDocumentBlueprintByIdResponse, DeleteDocumentBlueprintByIdData, DeleteDocumentBlueprintByIdResponse, PutDocumentBlueprintByIdData, PutDocumentBlueprintByIdResponse, PutDocumentBlueprintByIdMoveData, PutDocumentBlueprintByIdMoveResponse, PostDocumentBlueprintFolderData, PostDocumentBlueprintFolderResponse, GetDocumentBlueprintFolderByIdData, GetDocumentBlueprintFolderByIdResponse, DeleteDocumentBlueprintFolderByIdData, DeleteDocumentBlueprintFolderByIdResponse, PutDocumentBlueprintFolderByIdData, PutDocumentBlueprintFolderByIdResponse, PostDocumentBlueprintFromDocumentData, PostDocumentBlueprintFromDocumentResponse, GetItemDocumentBlueprintData, GetItemDocumentBlueprintResponse, GetTreeDocumentBlueprintAncestorsData, GetTreeDocumentBlueprintAncestorsResponse, GetTreeDocumentBlueprintChildrenData, GetTreeDocumentBlueprintChildrenResponse, GetTreeDocumentBlueprintRootData, GetTreeDocumentBlueprintRootResponse, PostDocumentTypeData, PostDocumentTypeResponse, GetDocumentTypeByIdData, GetDocumentTypeByIdResponse, DeleteDocumentTypeByIdData, DeleteDocumentTypeByIdResponse, PutDocumentTypeByIdData, PutDocumentTypeByIdResponse, GetDocumentTypeByIdAllowedChildrenData, GetDocumentTypeByIdAllowedChildrenResponse, GetDocumentTypeByIdBlueprintData, GetDocumentTypeByIdBlueprintResponse, GetDocumentTypeByIdCompositionReferencesData, GetDocumentTypeByIdCompositionReferencesResponse, PostDocumentTypeByIdCopyData, PostDocumentTypeByIdCopyResponse, GetDocumentTypeByIdExportData, GetDocumentTypeByIdExportResponse, PutDocumentTypeByIdImportData, PutDocumentTypeByIdImportResponse, PutDocumentTypeByIdMoveData, PutDocumentTypeByIdMoveResponse, GetDocumentTypeAllowedAtRootData, GetDocumentTypeAllowedAtRootResponse, PostDocumentTypeAvailableCompositionsData, PostDocumentTypeAvailableCompositionsResponse, GetDocumentTypeConfigurationResponse, PostDocumentTypeFolderData, PostDocumentTypeFolderResponse, GetDocumentTypeFolderByIdData, GetDocumentTypeFolderByIdResponse, DeleteDocumentTypeFolderByIdData, DeleteDocumentTypeFolderByIdResponse, PutDocumentTypeFolderByIdData, PutDocumentTypeFolderByIdResponse, PostDocumentTypeImportData, PostDocumentTypeImportResponse, GetItemDocumentTypeData, GetItemDocumentTypeResponse, GetItemDocumentTypeSearchData, GetItemDocumentTypeSearchResponse, GetTreeDocumentTypeAncestorsData, GetTreeDocumentTypeAncestorsResponse, GetTreeDocumentTypeChildrenData, GetTreeDocumentTypeChildrenResponse, GetTreeDocumentTypeRootData, GetTreeDocumentTypeRootResponse, GetDocumentVersionData, GetDocumentVersionResponse, GetDocumentVersionByIdData, GetDocumentVersionByIdResponse, PutDocumentVersionByIdPreventCleanupData, PutDocumentVersionByIdPreventCleanupResponse, PostDocumentVersionByIdRollbackData, PostDocumentVersionByIdRollbackResponse, PostDynamicRootQueryData, PostDynamicRootQueryResponse, GetDynamicRootStepsResponse, GetHealthCheckGroupData, GetHealthCheckGroupResponse, GetHealthCheckGroupByNameData, GetHealthCheckGroupByNameResponse, PostHealthCheckGroupByNameCheckData, PostHealthCheckGroupByNameCheckResponse, PostHealthCheckExecuteActionData, PostHealthCheckExecuteActionResponse, GetHelpData, GetHelpResponse, GetImagingResizeUrlsData, GetImagingResizeUrlsResponse, GetImportAnalyzeData, GetImportAnalyzeResponse, GetIndexerData, GetIndexerResponse, GetIndexerByIndexNameData, GetIndexerByIndexNameResponse, PostIndexerByIndexNameRebuildData, PostIndexerByIndexNameRebuildResponse, GetInstallSettingsResponse, PostInstallSetupData, PostInstallSetupResponse, PostInstallValidateDatabaseData, PostInstallValidateDatabaseResponse, GetItemLanguageData, GetItemLanguageResponse, GetItemLanguageDefaultResponse, GetLanguageData, GetLanguageResponse, PostLanguageData, PostLanguageResponse, GetLanguageByIsoCodeData, GetLanguageByIsoCodeResponse, DeleteLanguageByIsoCodeData, DeleteLanguageByIsoCodeResponse, PutLanguageByIsoCodeData, PutLanguageByIsoCodeResponse, GetLogViewerLevelData, GetLogViewerLevelResponse, GetLogViewerLevelCountData, GetLogViewerLevelCountResponse, GetLogViewerLogData, GetLogViewerLogResponse, GetLogViewerMessageTemplateData, GetLogViewerMessageTemplateResponse, GetLogViewerSavedSearchData, GetLogViewerSavedSearchResponse, PostLogViewerSavedSearchData, PostLogViewerSavedSearchResponse, GetLogViewerSavedSearchByNameData, GetLogViewerSavedSearchByNameResponse, DeleteLogViewerSavedSearchByNameData, DeleteLogViewerSavedSearchByNameResponse, GetLogViewerValidateLogsSizeData, GetLogViewerValidateLogsSizeResponse, GetManifestManifestResponse, GetManifestManifestPrivateResponse, GetManifestManifestPublicResponse, GetCollectionMediaData, GetCollectionMediaResponse, GetItemMediaData, GetItemMediaResponse, GetItemMediaSearchData, GetItemMediaSearchResponse, PostMediaData, PostMediaResponse, GetMediaByIdData, GetMediaByIdResponse, DeleteMediaByIdData, DeleteMediaByIdResponse, PutMediaByIdData, PutMediaByIdResponse, GetMediaByIdAuditLogData, GetMediaByIdAuditLogResponse, PutMediaByIdMoveData, PutMediaByIdMoveResponse, PutMediaByIdMoveToRecycleBinData, PutMediaByIdMoveToRecycleBinResponse, GetMediaByIdReferencedByData, GetMediaByIdReferencedByResponse, GetMediaByIdReferencedDescendantsData, GetMediaByIdReferencedDescendantsResponse, PutMediaByIdValidateData, PutMediaByIdValidateResponse, GetMediaAreReferencedData, GetMediaAreReferencedResponse, GetMediaConfigurationResponse, PutMediaSortData, PutMediaSortResponse, GetMediaUrlsData, GetMediaUrlsResponse, PostMediaValidateData, PostMediaValidateResponse, DeleteRecycleBinMediaResponse, DeleteRecycleBinMediaByIdData, DeleteRecycleBinMediaByIdResponse, GetRecycleBinMediaByIdOriginalParentData, GetRecycleBinMediaByIdOriginalParentResponse, PutRecycleBinMediaByIdRestoreData, PutRecycleBinMediaByIdRestoreResponse, GetRecycleBinMediaChildrenData, GetRecycleBinMediaChildrenResponse, GetRecycleBinMediaRootData, GetRecycleBinMediaRootResponse, GetTreeMediaAncestorsData, GetTreeMediaAncestorsResponse, GetTreeMediaChildrenData, GetTreeMediaChildrenResponse, GetTreeMediaRootData, GetTreeMediaRootResponse, GetItemMediaTypeData, GetItemMediaTypeResponse, GetItemMediaTypeAllowedData, GetItemMediaTypeAllowedResponse, GetItemMediaTypeFoldersData, GetItemMediaTypeFoldersResponse, GetItemMediaTypeSearchData, GetItemMediaTypeSearchResponse, PostMediaTypeData, PostMediaTypeResponse, GetMediaTypeByIdData, GetMediaTypeByIdResponse, DeleteMediaTypeByIdData, DeleteMediaTypeByIdResponse, PutMediaTypeByIdData, PutMediaTypeByIdResponse, GetMediaTypeByIdAllowedChildrenData, GetMediaTypeByIdAllowedChildrenResponse, GetMediaTypeByIdCompositionReferencesData, GetMediaTypeByIdCompositionReferencesResponse, PostMediaTypeByIdCopyData, PostMediaTypeByIdCopyResponse, GetMediaTypeByIdExportData, GetMediaTypeByIdExportResponse, PutMediaTypeByIdImportData, PutMediaTypeByIdImportResponse, PutMediaTypeByIdMoveData, PutMediaTypeByIdMoveResponse, GetMediaTypeAllowedAtRootData, GetMediaTypeAllowedAtRootResponse, PostMediaTypeAvailableCompositionsData, PostMediaTypeAvailableCompositionsResponse, GetMediaTypeConfigurationResponse, PostMediaTypeFolderData, PostMediaTypeFolderResponse, GetMediaTypeFolderByIdData, GetMediaTypeFolderByIdResponse, DeleteMediaTypeFolderByIdData, DeleteMediaTypeFolderByIdResponse, PutMediaTypeFolderByIdData, PutMediaTypeFolderByIdResponse, PostMediaTypeImportData, PostMediaTypeImportResponse, GetTreeMediaTypeAncestorsData, GetTreeMediaTypeAncestorsResponse, GetTreeMediaTypeChildrenData, GetTreeMediaTypeChildrenResponse, GetTreeMediaTypeRootData, GetTreeMediaTypeRootResponse, GetFilterMemberData, GetFilterMemberResponse, GetItemMemberData, GetItemMemberResponse, GetItemMemberSearchData, GetItemMemberSearchResponse, PostMemberData, PostMemberResponse, GetMemberByIdData, GetMemberByIdResponse, DeleteMemberByIdData, DeleteMemberByIdResponse, PutMemberByIdData, PutMemberByIdResponse, GetMemberByIdReferencedByData, GetMemberByIdReferencedByResponse, GetMemberByIdReferencedDescendantsData, GetMemberByIdReferencedDescendantsResponse, PutMemberByIdValidateData, PutMemberByIdValidateResponse, GetMemberAreReferencedData, GetMemberAreReferencedResponse, GetMemberConfigurationResponse, PostMemberValidateData, PostMemberValidateResponse, GetItemMemberGroupData, GetItemMemberGroupResponse, GetMemberGroupData, GetMemberGroupResponse, PostMemberGroupData, PostMemberGroupResponse, GetMemberGroupByIdData, GetMemberGroupByIdResponse, DeleteMemberGroupByIdData, DeleteMemberGroupByIdResponse, PutMemberGroupByIdData, PutMemberGroupByIdResponse, GetTreeMemberGroupRootData, GetTreeMemberGroupRootResponse, GetItemMemberTypeData, GetItemMemberTypeResponse, GetItemMemberTypeSearchData, GetItemMemberTypeSearchResponse, PostMemberTypeData, PostMemberTypeResponse, GetMemberTypeByIdData, GetMemberTypeByIdResponse, DeleteMemberTypeByIdData, DeleteMemberTypeByIdResponse, PutMemberTypeByIdData, PutMemberTypeByIdResponse, GetMemberTypeByIdCompositionReferencesData, GetMemberTypeByIdCompositionReferencesResponse, PostMemberTypeByIdCopyData, PostMemberTypeByIdCopyResponse, PostMemberTypeAvailableCompositionsData, PostMemberTypeAvailableCompositionsResponse, GetMemberTypeConfigurationResponse, GetTreeMemberTypeRootData, GetTreeMemberTypeRootResponse, PostModelsBuilderBuildResponse, GetModelsBuilderDashboardResponse, GetModelsBuilderStatusResponse, GetObjectTypesData, GetObjectTypesResponse, GetOembedQueryData, GetOembedQueryResponse, PostPackageByNameRunMigrationData, PostPackageByNameRunMigrationResponse, GetPackageConfigurationResponse, GetPackageCreatedData, GetPackageCreatedResponse, PostPackageCreatedData, PostPackageCreatedResponse, GetPackageCreatedByIdData, GetPackageCreatedByIdResponse, DeletePackageCreatedByIdData, DeletePackageCreatedByIdResponse, PutPackageCreatedByIdData, PutPackageCreatedByIdResponse, GetPackageCreatedByIdDownloadData, GetPackageCreatedByIdDownloadResponse, GetPackageMigrationStatusData, GetPackageMigrationStatusResponse, GetItemPartialViewData, GetItemPartialViewResponse, PostPartialViewData, PostPartialViewResponse, GetPartialViewByPathData, GetPartialViewByPathResponse, DeletePartialViewByPathData, DeletePartialViewByPathResponse, PutPartialViewByPathData, PutPartialViewByPathResponse, PutPartialViewByPathRenameData, PutPartialViewByPathRenameResponse, PostPartialViewFolderData, PostPartialViewFolderResponse, GetPartialViewFolderByPathData, GetPartialViewFolderByPathResponse, DeletePartialViewFolderByPathData, DeletePartialViewFolderByPathResponse, GetPartialViewSnippetData, GetPartialViewSnippetResponse, GetPartialViewSnippetByIdData, GetPartialViewSnippetByIdResponse, GetTreePartialViewAncestorsData, GetTreePartialViewAncestorsResponse, GetTreePartialViewChildrenData, GetTreePartialViewChildrenResponse, GetTreePartialViewRootData, GetTreePartialViewRootResponse, DeletePreviewResponse, PostPreviewResponse, GetProfilingStatusResponse, PutProfilingStatusData, PutProfilingStatusResponse, GetPropertyTypeIsUsedData, GetPropertyTypeIsUsedResponse, PostPublishedCacheRebuildResponse, GetPublishedCacheRebuildStatusResponse, PostPublishedCacheReloadResponse, GetRedirectManagementData, GetRedirectManagementResponse, GetRedirectManagementByIdData, GetRedirectManagementByIdResponse, DeleteRedirectManagementByIdData, DeleteRedirectManagementByIdResponse, GetRedirectManagementStatusResponse, PostRedirectManagementStatusData, PostRedirectManagementStatusResponse, GetRelationByRelationTypeIdData, GetRelationByRelationTypeIdResponse, GetItemRelationTypeData, GetItemRelationTypeResponse, GetRelationTypeData, GetRelationTypeResponse, GetRelationTypeByIdData, GetRelationTypeByIdResponse, GetItemScriptData, GetItemScriptResponse, PostScriptData, PostScriptResponse, GetScriptByPathData, GetScriptByPathResponse, DeleteScriptByPathData, DeleteScriptByPathResponse, PutScriptByPathData, PutScriptByPathResponse, PutScriptByPathRenameData, PutScriptByPathRenameResponse, PostScriptFolderData, PostScriptFolderResponse, GetScriptFolderByPathData, GetScriptFolderByPathResponse, DeleteScriptFolderByPathData, DeleteScriptFolderByPathResponse, GetTreeScriptAncestorsData, GetTreeScriptAncestorsResponse, GetTreeScriptChildrenData, GetTreeScriptChildrenResponse, GetTreeScriptRootData, GetTreeScriptRootResponse, GetSearcherData, GetSearcherResponse, GetSearcherBySearcherNameQueryData, GetSearcherBySearcherNameQueryResponse, GetSecurityConfigurationResponse, PostSecurityForgotPasswordData, PostSecurityForgotPasswordResponse, PostSecurityForgotPasswordResetData, PostSecurityForgotPasswordResetResponse, PostSecurityForgotPasswordVerifyData, PostSecurityForgotPasswordVerifyResponse, GetSegmentData, GetSegmentResponse, GetServerConfigurationResponse, GetServerInformationResponse, GetServerStatusResponse, GetServerTroubleshootingResponse, GetServerUpgradeCheckResponse, GetItemStaticFileData, GetItemStaticFileResponse, GetTreeStaticFileAncestorsData, GetTreeStaticFileAncestorsResponse, GetTreeStaticFileChildrenData, GetTreeStaticFileChildrenResponse, GetTreeStaticFileRootData, GetTreeStaticFileRootResponse, GetItemStylesheetData, GetItemStylesheetResponse, PostStylesheetData, PostStylesheetResponse, GetStylesheetByPathData, GetStylesheetByPathResponse, DeleteStylesheetByPathData, DeleteStylesheetByPathResponse, PutStylesheetByPathData, PutStylesheetByPathResponse, PutStylesheetByPathRenameData, PutStylesheetByPathRenameResponse, PostStylesheetFolderData, PostStylesheetFolderResponse, GetStylesheetFolderByPathData, GetStylesheetFolderByPathResponse, DeleteStylesheetFolderByPathData, DeleteStylesheetFolderByPathResponse, GetTreeStylesheetAncestorsData, GetTreeStylesheetAncestorsResponse, GetTreeStylesheetChildrenData, GetTreeStylesheetChildrenResponse, GetTreeStylesheetRootData, GetTreeStylesheetRootResponse, GetTagData, GetTagResponse, GetTelemetryData, GetTelemetryResponse, GetTelemetryLevelResponse, PostTelemetryLevelData, PostTelemetryLevelResponse, GetItemTemplateData, GetItemTemplateResponse, GetItemTemplateSearchData, GetItemTemplateSearchResponse, PostTemplateData, PostTemplateResponse, GetTemplateByIdData, GetTemplateByIdResponse, DeleteTemplateByIdData, DeleteTemplateByIdResponse, PutTemplateByIdData, PutTemplateByIdResponse, GetTemplateConfigurationResponse, PostTemplateQueryExecuteData, PostTemplateQueryExecuteResponse, GetTemplateQuerySettingsResponse, GetTreeTemplateAncestorsData, GetTreeTemplateAncestorsResponse, GetTreeTemplateChildrenData, GetTreeTemplateChildrenResponse, GetTreeTemplateRootData, GetTreeTemplateRootResponse, PostTemporaryFileData, PostTemporaryFileResponse, GetTemporaryFileByIdData, GetTemporaryFileByIdResponse, DeleteTemporaryFileByIdData, DeleteTemporaryFileByIdResponse, GetTemporaryFileConfigurationResponse, PostUpgradeAuthorizeResponse, GetUpgradeSettingsResponse, GetFilterUserData, GetFilterUserResponse, GetItemUserData, GetItemUserResponse, PostUserData, PostUserResponse, DeleteUserData, DeleteUserResponse, GetUserData, GetUserResponse, GetUserByIdData, GetUserByIdResponse, DeleteUserByIdData, DeleteUserByIdResponse, PutUserByIdData, PutUserByIdResponse, GetUserById2FaData, GetUserById2FaResponse, DeleteUserById2FaByProviderNameData, DeleteUserById2FaByProviderNameResponse, GetUserByIdCalculateStartNodesData, GetUserByIdCalculateStartNodesResponse, PostUserByIdChangePasswordData, PostUserByIdChangePasswordResponse, PostUserByIdClientCredentialsData, PostUserByIdClientCredentialsResponse, GetUserByIdClientCredentialsData, GetUserByIdClientCredentialsResponse, DeleteUserByIdClientCredentialsByClientIdData, DeleteUserByIdClientCredentialsByClientIdResponse, PostUserByIdResetPasswordData, PostUserByIdResetPasswordResponse, DeleteUserAvatarByIdData, DeleteUserAvatarByIdResponse, PostUserAvatarByIdData, PostUserAvatarByIdResponse, GetUserConfigurationResponse, GetUserCurrentResponse, GetUserCurrent2FaResponse, DeleteUserCurrent2FaByProviderNameData, DeleteUserCurrent2FaByProviderNameResponse, PostUserCurrent2FaByProviderNameData, PostUserCurrent2FaByProviderNameResponse, GetUserCurrent2FaByProviderNameData, GetUserCurrent2FaByProviderNameResponse, PostUserCurrentAvatarData, PostUserCurrentAvatarResponse, PostUserCurrentChangePasswordData, PostUserCurrentChangePasswordResponse, GetUserCurrentConfigurationResponse, GetUserCurrentLoginProvidersResponse, GetUserCurrentPermissionsData, GetUserCurrentPermissionsResponse, GetUserCurrentPermissionsDocumentData, GetUserCurrentPermissionsDocumentResponse, GetUserCurrentPermissionsMediaData, GetUserCurrentPermissionsMediaResponse, PostUserDisableData, PostUserDisableResponse, PostUserEnableData, PostUserEnableResponse, PostUserInviteData, PostUserInviteResponse, PostUserInviteCreatePasswordData, PostUserInviteCreatePasswordResponse, PostUserInviteResendData, PostUserInviteResendResponse, PostUserInviteVerifyData, PostUserInviteVerifyResponse, PostUserSetUserGroupsData, PostUserSetUserGroupsResponse, PostUserUnlockData, PostUserUnlockResponse, PostUserDataData, PostUserDataResponse, GetUserDataData, GetUserDataResponse, PutUserDataData, PutUserDataResponse, GetUserDataByIdData, GetUserDataByIdResponse, GetFilterUserGroupData, GetFilterUserGroupResponse, GetItemUserGroupData, GetItemUserGroupResponse, DeleteUserGroupData, DeleteUserGroupResponse, PostUserGroupData, PostUserGroupResponse, GetUserGroupData, GetUserGroupResponse, GetUserGroupByIdData, GetUserGroupByIdResponse, DeleteUserGroupByIdData, DeleteUserGroupByIdResponse, PutUserGroupByIdData, PutUserGroupByIdResponse, DeleteUserGroupByIdUsersData, DeleteUserGroupByIdUsersResponse, PostUserGroupByIdUsersData, PostUserGroupByIdUsersResponse, GetItemWebhookData, GetItemWebhookResponse, GetWebhookData, GetWebhookResponse, PostWebhookData, PostWebhookResponse, GetWebhookByIdData, GetWebhookByIdResponse, DeleteWebhookByIdData, DeleteWebhookByIdResponse, PutWebhookByIdData, PutWebhookByIdResponse, GetWebhookByIdLogsData, GetWebhookByIdLogsResponse, GetWebhookEventsData, GetWebhookEventsResponse, GetWebhookLogsData, GetWebhookLogsResponse } from './types.gen'; +import type { GetCultureData, GetCultureResponse, PostDataTypeData, PostDataTypeResponse, GetDataTypeByIdData, GetDataTypeByIdResponse, DeleteDataTypeByIdData, DeleteDataTypeByIdResponse, PutDataTypeByIdData, PutDataTypeByIdResponse, PostDataTypeByIdCopyData, PostDataTypeByIdCopyResponse, GetDataTypeByIdIsUsedData, GetDataTypeByIdIsUsedResponse, PutDataTypeByIdMoveData, PutDataTypeByIdMoveResponse, GetDataTypeByIdReferencedByData, GetDataTypeByIdReferencedByResponse, GetDataTypeByIdReferencesData, GetDataTypeByIdReferencesResponse, GetDataTypeConfigurationResponse, PostDataTypeFolderData, PostDataTypeFolderResponse, GetDataTypeFolderByIdData, GetDataTypeFolderByIdResponse, DeleteDataTypeFolderByIdData, DeleteDataTypeFolderByIdResponse, PutDataTypeFolderByIdData, PutDataTypeFolderByIdResponse, GetFilterDataTypeData, GetFilterDataTypeResponse, GetItemDataTypeData, GetItemDataTypeResponse, GetItemDataTypeSearchData, GetItemDataTypeSearchResponse, GetTreeDataTypeAncestorsData, GetTreeDataTypeAncestorsResponse, GetTreeDataTypeChildrenData, GetTreeDataTypeChildrenResponse, GetTreeDataTypeRootData, GetTreeDataTypeRootResponse, GetDictionaryData, GetDictionaryResponse, PostDictionaryData, PostDictionaryResponse, GetDictionaryByIdData, GetDictionaryByIdResponse, DeleteDictionaryByIdData, DeleteDictionaryByIdResponse, PutDictionaryByIdData, PutDictionaryByIdResponse, GetDictionaryByIdExportData, GetDictionaryByIdExportResponse, PutDictionaryByIdMoveData, PutDictionaryByIdMoveResponse, PostDictionaryImportData, PostDictionaryImportResponse, GetItemDictionaryData, GetItemDictionaryResponse, GetTreeDictionaryAncestorsData, GetTreeDictionaryAncestorsResponse, GetTreeDictionaryChildrenData, GetTreeDictionaryChildrenResponse, GetTreeDictionaryRootData, GetTreeDictionaryRootResponse, GetCollectionDocumentByIdData, GetCollectionDocumentByIdResponse, PostDocumentData, PostDocumentResponse, GetDocumentByIdData, GetDocumentByIdResponse, DeleteDocumentByIdData, DeleteDocumentByIdResponse, PutDocumentByIdData, PutDocumentByIdResponse, GetDocumentByIdAuditLogData, GetDocumentByIdAuditLogResponse, PostDocumentByIdCopyData, PostDocumentByIdCopyResponse, GetDocumentByIdDomainsData, GetDocumentByIdDomainsResponse, PutDocumentByIdDomainsData, PutDocumentByIdDomainsResponse, PutDocumentByIdMoveData, PutDocumentByIdMoveResponse, PutDocumentByIdMoveToRecycleBinData, PutDocumentByIdMoveToRecycleBinResponse, GetDocumentByIdNotificationsData, GetDocumentByIdNotificationsResponse, PutDocumentByIdNotificationsData, PutDocumentByIdNotificationsResponse, PostDocumentByIdPublicAccessData, PostDocumentByIdPublicAccessResponse, DeleteDocumentByIdPublicAccessData, DeleteDocumentByIdPublicAccessResponse, GetDocumentByIdPublicAccessData, GetDocumentByIdPublicAccessResponse, PutDocumentByIdPublicAccessData, PutDocumentByIdPublicAccessResponse, PutDocumentByIdPublishData, PutDocumentByIdPublishResponse, PutDocumentByIdPublishWithDescendantsData, PutDocumentByIdPublishWithDescendantsResponse, GetDocumentByIdPublishedData, GetDocumentByIdPublishedResponse, GetDocumentByIdReferencedByData, GetDocumentByIdReferencedByResponse, GetDocumentByIdReferencedDescendantsData, GetDocumentByIdReferencedDescendantsResponse, PutDocumentByIdUnpublishData, PutDocumentByIdUnpublishResponse, PutDocumentByIdValidateData, PutDocumentByIdValidateResponse, PutUmbracoManagementApiV11DocumentByIdValidate11Data, PutUmbracoManagementApiV11DocumentByIdValidate11Response, GetDocumentAreReferencedData, GetDocumentAreReferencedResponse, GetDocumentConfigurationResponse, PutDocumentSortData, PutDocumentSortResponse, GetDocumentUrlsData, GetDocumentUrlsResponse, PostDocumentValidateData, PostDocumentValidateResponse, GetItemDocumentData, GetItemDocumentResponse, GetItemDocumentSearchData, GetItemDocumentSearchResponse, DeleteRecycleBinDocumentResponse, DeleteRecycleBinDocumentByIdData, DeleteRecycleBinDocumentByIdResponse, GetRecycleBinDocumentByIdOriginalParentData, GetRecycleBinDocumentByIdOriginalParentResponse, PutRecycleBinDocumentByIdRestoreData, PutRecycleBinDocumentByIdRestoreResponse, GetRecycleBinDocumentChildrenData, GetRecycleBinDocumentChildrenResponse, GetRecycleBinDocumentRootData, GetRecycleBinDocumentRootResponse, GetTreeDocumentAncestorsData, GetTreeDocumentAncestorsResponse, GetTreeDocumentChildrenData, GetTreeDocumentChildrenResponse, GetTreeDocumentRootData, GetTreeDocumentRootResponse, PostDocumentBlueprintData, PostDocumentBlueprintResponse, GetDocumentBlueprintByIdData, GetDocumentBlueprintByIdResponse, DeleteDocumentBlueprintByIdData, DeleteDocumentBlueprintByIdResponse, PutDocumentBlueprintByIdData, PutDocumentBlueprintByIdResponse, PutDocumentBlueprintByIdMoveData, PutDocumentBlueprintByIdMoveResponse, PostDocumentBlueprintFolderData, PostDocumentBlueprintFolderResponse, GetDocumentBlueprintFolderByIdData, GetDocumentBlueprintFolderByIdResponse, DeleteDocumentBlueprintFolderByIdData, DeleteDocumentBlueprintFolderByIdResponse, PutDocumentBlueprintFolderByIdData, PutDocumentBlueprintFolderByIdResponse, PostDocumentBlueprintFromDocumentData, PostDocumentBlueprintFromDocumentResponse, GetItemDocumentBlueprintData, GetItemDocumentBlueprintResponse, GetTreeDocumentBlueprintAncestorsData, GetTreeDocumentBlueprintAncestorsResponse, GetTreeDocumentBlueprintChildrenData, GetTreeDocumentBlueprintChildrenResponse, GetTreeDocumentBlueprintRootData, GetTreeDocumentBlueprintRootResponse, PostDocumentTypeData, PostDocumentTypeResponse, GetDocumentTypeByIdData, GetDocumentTypeByIdResponse, DeleteDocumentTypeByIdData, DeleteDocumentTypeByIdResponse, PutDocumentTypeByIdData, PutDocumentTypeByIdResponse, GetDocumentTypeByIdAllowedChildrenData, GetDocumentTypeByIdAllowedChildrenResponse, GetDocumentTypeByIdBlueprintData, GetDocumentTypeByIdBlueprintResponse, GetDocumentTypeByIdCompositionReferencesData, GetDocumentTypeByIdCompositionReferencesResponse, PostDocumentTypeByIdCopyData, PostDocumentTypeByIdCopyResponse, GetDocumentTypeByIdExportData, GetDocumentTypeByIdExportResponse, PutDocumentTypeByIdImportData, PutDocumentTypeByIdImportResponse, PutDocumentTypeByIdMoveData, PutDocumentTypeByIdMoveResponse, GetDocumentTypeAllowedAtRootData, GetDocumentTypeAllowedAtRootResponse, PostDocumentTypeAvailableCompositionsData, PostDocumentTypeAvailableCompositionsResponse, GetDocumentTypeConfigurationResponse, PostDocumentTypeFolderData, PostDocumentTypeFolderResponse, GetDocumentTypeFolderByIdData, GetDocumentTypeFolderByIdResponse, DeleteDocumentTypeFolderByIdData, DeleteDocumentTypeFolderByIdResponse, PutDocumentTypeFolderByIdData, PutDocumentTypeFolderByIdResponse, PostDocumentTypeImportData, PostDocumentTypeImportResponse, GetItemDocumentTypeData, GetItemDocumentTypeResponse, GetItemDocumentTypeSearchData, GetItemDocumentTypeSearchResponse, GetTreeDocumentTypeAncestorsData, GetTreeDocumentTypeAncestorsResponse, GetTreeDocumentTypeChildrenData, GetTreeDocumentTypeChildrenResponse, GetTreeDocumentTypeRootData, GetTreeDocumentTypeRootResponse, GetDocumentVersionData, GetDocumentVersionResponse, GetDocumentVersionByIdData, GetDocumentVersionByIdResponse, PutDocumentVersionByIdPreventCleanupData, PutDocumentVersionByIdPreventCleanupResponse, PostDocumentVersionByIdRollbackData, PostDocumentVersionByIdRollbackResponse, PostDynamicRootQueryData, PostDynamicRootQueryResponse, GetDynamicRootStepsResponse, GetHealthCheckGroupData, GetHealthCheckGroupResponse, GetHealthCheckGroupByNameData, GetHealthCheckGroupByNameResponse, PostHealthCheckGroupByNameCheckData, PostHealthCheckGroupByNameCheckResponse, PostHealthCheckExecuteActionData, PostHealthCheckExecuteActionResponse, GetHelpData, GetHelpResponse, GetImagingResizeUrlsData, GetImagingResizeUrlsResponse, GetImportAnalyzeData, GetImportAnalyzeResponse, GetIndexerData, GetIndexerResponse, GetIndexerByIndexNameData, GetIndexerByIndexNameResponse, PostIndexerByIndexNameRebuildData, PostIndexerByIndexNameRebuildResponse, GetInstallSettingsResponse, PostInstallSetupData, PostInstallSetupResponse, PostInstallValidateDatabaseData, PostInstallValidateDatabaseResponse, GetItemLanguageData, GetItemLanguageResponse, GetItemLanguageDefaultResponse, GetLanguageData, GetLanguageResponse, PostLanguageData, PostLanguageResponse, GetLanguageByIsoCodeData, GetLanguageByIsoCodeResponse, DeleteLanguageByIsoCodeData, DeleteLanguageByIsoCodeResponse, PutLanguageByIsoCodeData, PutLanguageByIsoCodeResponse, GetLogViewerLevelData, GetLogViewerLevelResponse, GetLogViewerLevelCountData, GetLogViewerLevelCountResponse, GetLogViewerLogData, GetLogViewerLogResponse, GetLogViewerMessageTemplateData, GetLogViewerMessageTemplateResponse, GetLogViewerSavedSearchData, GetLogViewerSavedSearchResponse, PostLogViewerSavedSearchData, PostLogViewerSavedSearchResponse, GetLogViewerSavedSearchByNameData, GetLogViewerSavedSearchByNameResponse, DeleteLogViewerSavedSearchByNameData, DeleteLogViewerSavedSearchByNameResponse, GetLogViewerValidateLogsSizeData, GetLogViewerValidateLogsSizeResponse, GetManifestManifestResponse, GetManifestManifestPrivateResponse, GetManifestManifestPublicResponse, GetCollectionMediaData, GetCollectionMediaResponse, GetItemMediaData, GetItemMediaResponse, GetItemMediaSearchData, GetItemMediaSearchResponse, PostMediaData, PostMediaResponse, GetMediaByIdData, GetMediaByIdResponse, DeleteMediaByIdData, DeleteMediaByIdResponse, PutMediaByIdData, PutMediaByIdResponse, GetMediaByIdAuditLogData, GetMediaByIdAuditLogResponse, PutMediaByIdMoveData, PutMediaByIdMoveResponse, PutMediaByIdMoveToRecycleBinData, PutMediaByIdMoveToRecycleBinResponse, GetMediaByIdReferencedByData, GetMediaByIdReferencedByResponse, GetMediaByIdReferencedDescendantsData, GetMediaByIdReferencedDescendantsResponse, PutMediaByIdValidateData, PutMediaByIdValidateResponse, GetMediaAreReferencedData, GetMediaAreReferencedResponse, GetMediaConfigurationResponse, PutMediaSortData, PutMediaSortResponse, GetMediaUrlsData, GetMediaUrlsResponse, PostMediaValidateData, PostMediaValidateResponse, DeleteRecycleBinMediaResponse, DeleteRecycleBinMediaByIdData, DeleteRecycleBinMediaByIdResponse, GetRecycleBinMediaByIdOriginalParentData, GetRecycleBinMediaByIdOriginalParentResponse, PutRecycleBinMediaByIdRestoreData, PutRecycleBinMediaByIdRestoreResponse, GetRecycleBinMediaChildrenData, GetRecycleBinMediaChildrenResponse, GetRecycleBinMediaRootData, GetRecycleBinMediaRootResponse, GetTreeMediaAncestorsData, GetTreeMediaAncestorsResponse, GetTreeMediaChildrenData, GetTreeMediaChildrenResponse, GetTreeMediaRootData, GetTreeMediaRootResponse, GetItemMediaTypeData, GetItemMediaTypeResponse, GetItemMediaTypeAllowedData, GetItemMediaTypeAllowedResponse, GetItemMediaTypeFoldersData, GetItemMediaTypeFoldersResponse, GetItemMediaTypeSearchData, GetItemMediaTypeSearchResponse, PostMediaTypeData, PostMediaTypeResponse, GetMediaTypeByIdData, GetMediaTypeByIdResponse, DeleteMediaTypeByIdData, DeleteMediaTypeByIdResponse, PutMediaTypeByIdData, PutMediaTypeByIdResponse, GetMediaTypeByIdAllowedChildrenData, GetMediaTypeByIdAllowedChildrenResponse, GetMediaTypeByIdCompositionReferencesData, GetMediaTypeByIdCompositionReferencesResponse, PostMediaTypeByIdCopyData, PostMediaTypeByIdCopyResponse, GetMediaTypeByIdExportData, GetMediaTypeByIdExportResponse, PutMediaTypeByIdImportData, PutMediaTypeByIdImportResponse, PutMediaTypeByIdMoveData, PutMediaTypeByIdMoveResponse, GetMediaTypeAllowedAtRootData, GetMediaTypeAllowedAtRootResponse, PostMediaTypeAvailableCompositionsData, PostMediaTypeAvailableCompositionsResponse, GetMediaTypeConfigurationResponse, PostMediaTypeFolderData, PostMediaTypeFolderResponse, GetMediaTypeFolderByIdData, GetMediaTypeFolderByIdResponse, DeleteMediaTypeFolderByIdData, DeleteMediaTypeFolderByIdResponse, PutMediaTypeFolderByIdData, PutMediaTypeFolderByIdResponse, PostMediaTypeImportData, PostMediaTypeImportResponse, GetTreeMediaTypeAncestorsData, GetTreeMediaTypeAncestorsResponse, GetTreeMediaTypeChildrenData, GetTreeMediaTypeChildrenResponse, GetTreeMediaTypeRootData, GetTreeMediaTypeRootResponse, GetFilterMemberData, GetFilterMemberResponse, GetItemMemberData, GetItemMemberResponse, GetItemMemberSearchData, GetItemMemberSearchResponse, PostMemberData, PostMemberResponse, GetMemberByIdData, GetMemberByIdResponse, DeleteMemberByIdData, DeleteMemberByIdResponse, PutMemberByIdData, PutMemberByIdResponse, GetMemberByIdReferencedByData, GetMemberByIdReferencedByResponse, GetMemberByIdReferencedDescendantsData, GetMemberByIdReferencedDescendantsResponse, PutMemberByIdValidateData, PutMemberByIdValidateResponse, GetMemberAreReferencedData, GetMemberAreReferencedResponse, GetMemberConfigurationResponse, PostMemberValidateData, PostMemberValidateResponse, GetItemMemberGroupData, GetItemMemberGroupResponse, GetMemberGroupData, GetMemberGroupResponse, PostMemberGroupData, PostMemberGroupResponse, GetMemberGroupByIdData, GetMemberGroupByIdResponse, DeleteMemberGroupByIdData, DeleteMemberGroupByIdResponse, PutMemberGroupByIdData, PutMemberGroupByIdResponse, GetTreeMemberGroupRootData, GetTreeMemberGroupRootResponse, GetItemMemberTypeData, GetItemMemberTypeResponse, GetItemMemberTypeSearchData, GetItemMemberTypeSearchResponse, PostMemberTypeData, PostMemberTypeResponse, GetMemberTypeByIdData, GetMemberTypeByIdResponse, DeleteMemberTypeByIdData, DeleteMemberTypeByIdResponse, PutMemberTypeByIdData, PutMemberTypeByIdResponse, GetMemberTypeByIdCompositionReferencesData, GetMemberTypeByIdCompositionReferencesResponse, PostMemberTypeByIdCopyData, PostMemberTypeByIdCopyResponse, PostMemberTypeAvailableCompositionsData, PostMemberTypeAvailableCompositionsResponse, GetMemberTypeConfigurationResponse, GetTreeMemberTypeRootData, GetTreeMemberTypeRootResponse, PostModelsBuilderBuildResponse, GetModelsBuilderDashboardResponse, GetModelsBuilderStatusResponse, GetObjectTypesData, GetObjectTypesResponse, GetOembedQueryData, GetOembedQueryResponse, PostPackageByNameRunMigrationData, PostPackageByNameRunMigrationResponse, GetPackageConfigurationResponse, GetPackageCreatedData, GetPackageCreatedResponse, PostPackageCreatedData, PostPackageCreatedResponse, GetPackageCreatedByIdData, GetPackageCreatedByIdResponse, DeletePackageCreatedByIdData, DeletePackageCreatedByIdResponse, PutPackageCreatedByIdData, PutPackageCreatedByIdResponse, GetPackageCreatedByIdDownloadData, GetPackageCreatedByIdDownloadResponse, GetPackageMigrationStatusData, GetPackageMigrationStatusResponse, GetItemPartialViewData, GetItemPartialViewResponse, PostPartialViewData, PostPartialViewResponse, GetPartialViewByPathData, GetPartialViewByPathResponse, DeletePartialViewByPathData, DeletePartialViewByPathResponse, PutPartialViewByPathData, PutPartialViewByPathResponse, PutPartialViewByPathRenameData, PutPartialViewByPathRenameResponse, PostPartialViewFolderData, PostPartialViewFolderResponse, GetPartialViewFolderByPathData, GetPartialViewFolderByPathResponse, DeletePartialViewFolderByPathData, DeletePartialViewFolderByPathResponse, GetPartialViewSnippetData, GetPartialViewSnippetResponse, GetPartialViewSnippetByIdData, GetPartialViewSnippetByIdResponse, GetTreePartialViewAncestorsData, GetTreePartialViewAncestorsResponse, GetTreePartialViewChildrenData, GetTreePartialViewChildrenResponse, GetTreePartialViewRootData, GetTreePartialViewRootResponse, DeletePreviewResponse, PostPreviewResponse, GetProfilingStatusResponse, PutProfilingStatusData, PutProfilingStatusResponse, GetPropertyTypeIsUsedData, GetPropertyTypeIsUsedResponse, PostPublishedCacheRebuildResponse, GetPublishedCacheRebuildStatusResponse, PostPublishedCacheReloadResponse, GetRedirectManagementData, GetRedirectManagementResponse, GetRedirectManagementByIdData, GetRedirectManagementByIdResponse, DeleteRedirectManagementByIdData, DeleteRedirectManagementByIdResponse, GetRedirectManagementStatusResponse, PostRedirectManagementStatusData, PostRedirectManagementStatusResponse, GetRelationByRelationTypeIdData, GetRelationByRelationTypeIdResponse, GetItemRelationTypeData, GetItemRelationTypeResponse, GetRelationTypeData, GetRelationTypeResponse, GetRelationTypeByIdData, GetRelationTypeByIdResponse, GetItemScriptData, GetItemScriptResponse, PostScriptData, PostScriptResponse, GetScriptByPathData, GetScriptByPathResponse, DeleteScriptByPathData, DeleteScriptByPathResponse, PutScriptByPathData, PutScriptByPathResponse, PutScriptByPathRenameData, PutScriptByPathRenameResponse, PostScriptFolderData, PostScriptFolderResponse, GetScriptFolderByPathData, GetScriptFolderByPathResponse, DeleteScriptFolderByPathData, DeleteScriptFolderByPathResponse, GetTreeScriptAncestorsData, GetTreeScriptAncestorsResponse, GetTreeScriptChildrenData, GetTreeScriptChildrenResponse, GetTreeScriptRootData, GetTreeScriptRootResponse, GetSearcherData, GetSearcherResponse, GetSearcherBySearcherNameQueryData, GetSearcherBySearcherNameQueryResponse, GetSecurityConfigurationResponse, PostSecurityForgotPasswordData, PostSecurityForgotPasswordResponse, PostSecurityForgotPasswordResetData, PostSecurityForgotPasswordResetResponse, PostSecurityForgotPasswordVerifyData, PostSecurityForgotPasswordVerifyResponse, GetSegmentData, GetSegmentResponse, GetServerConfigurationResponse, GetServerInformationResponse, GetServerStatusResponse, GetServerTroubleshootingResponse, GetServerUpgradeCheckResponse, GetItemStaticFileData, GetItemStaticFileResponse, GetTreeStaticFileAncestorsData, GetTreeStaticFileAncestorsResponse, GetTreeStaticFileChildrenData, GetTreeStaticFileChildrenResponse, GetTreeStaticFileRootData, GetTreeStaticFileRootResponse, GetItemStylesheetData, GetItemStylesheetResponse, PostStylesheetData, PostStylesheetResponse, GetStylesheetByPathData, GetStylesheetByPathResponse, DeleteStylesheetByPathData, DeleteStylesheetByPathResponse, PutStylesheetByPathData, PutStylesheetByPathResponse, PutStylesheetByPathRenameData, PutStylesheetByPathRenameResponse, PostStylesheetFolderData, PostStylesheetFolderResponse, GetStylesheetFolderByPathData, GetStylesheetFolderByPathResponse, DeleteStylesheetFolderByPathData, DeleteStylesheetFolderByPathResponse, GetTreeStylesheetAncestorsData, GetTreeStylesheetAncestorsResponse, GetTreeStylesheetChildrenData, GetTreeStylesheetChildrenResponse, GetTreeStylesheetRootData, GetTreeStylesheetRootResponse, GetTagData, GetTagResponse, GetTelemetryData, GetTelemetryResponse, GetTelemetryLevelResponse, PostTelemetryLevelData, PostTelemetryLevelResponse, GetItemTemplateData, GetItemTemplateResponse, GetItemTemplateSearchData, GetItemTemplateSearchResponse, PostTemplateData, PostTemplateResponse, GetTemplateByIdData, GetTemplateByIdResponse, DeleteTemplateByIdData, DeleteTemplateByIdResponse, PutTemplateByIdData, PutTemplateByIdResponse, GetTemplateConfigurationResponse, PostTemplateQueryExecuteData, PostTemplateQueryExecuteResponse, GetTemplateQuerySettingsResponse, GetTreeTemplateAncestorsData, GetTreeTemplateAncestorsResponse, GetTreeTemplateChildrenData, GetTreeTemplateChildrenResponse, GetTreeTemplateRootData, GetTreeTemplateRootResponse, PostTemporaryFileData, PostTemporaryFileResponse, GetTemporaryFileByIdData, GetTemporaryFileByIdResponse, DeleteTemporaryFileByIdData, DeleteTemporaryFileByIdResponse, GetTemporaryFileConfigurationResponse, PostUpgradeAuthorizeResponse, GetUpgradeSettingsResponse, GetFilterUserData, GetFilterUserResponse, GetItemUserData, GetItemUserResponse, PostUserData, PostUserResponse, DeleteUserData, DeleteUserResponse, GetUserData, GetUserResponse, GetUserByIdData, GetUserByIdResponse, DeleteUserByIdData, DeleteUserByIdResponse, PutUserByIdData, PutUserByIdResponse, GetUserById2FaData, GetUserById2FaResponse, DeleteUserById2FaByProviderNameData, DeleteUserById2FaByProviderNameResponse, GetUserByIdCalculateStartNodesData, GetUserByIdCalculateStartNodesResponse, PostUserByIdChangePasswordData, PostUserByIdChangePasswordResponse, PostUserByIdClientCredentialsData, PostUserByIdClientCredentialsResponse, GetUserByIdClientCredentialsData, GetUserByIdClientCredentialsResponse, DeleteUserByIdClientCredentialsByClientIdData, DeleteUserByIdClientCredentialsByClientIdResponse, PostUserByIdResetPasswordData, PostUserByIdResetPasswordResponse, DeleteUserAvatarByIdData, DeleteUserAvatarByIdResponse, PostUserAvatarByIdData, PostUserAvatarByIdResponse, GetUserConfigurationResponse, GetUserCurrentResponse, GetUserCurrent2FaResponse, DeleteUserCurrent2FaByProviderNameData, DeleteUserCurrent2FaByProviderNameResponse, PostUserCurrent2FaByProviderNameData, PostUserCurrent2FaByProviderNameResponse, GetUserCurrent2FaByProviderNameData, GetUserCurrent2FaByProviderNameResponse, PostUserCurrentAvatarData, PostUserCurrentAvatarResponse, PostUserCurrentChangePasswordData, PostUserCurrentChangePasswordResponse, GetUserCurrentConfigurationResponse, GetUserCurrentLoginProvidersResponse, GetUserCurrentPermissionsData, GetUserCurrentPermissionsResponse, GetUserCurrentPermissionsDocumentData, GetUserCurrentPermissionsDocumentResponse, GetUserCurrentPermissionsMediaData, GetUserCurrentPermissionsMediaResponse, PostUserDisableData, PostUserDisableResponse, PostUserEnableData, PostUserEnableResponse, PostUserInviteData, PostUserInviteResponse, PostUserInviteCreatePasswordData, PostUserInviteCreatePasswordResponse, PostUserInviteResendData, PostUserInviteResendResponse, PostUserInviteVerifyData, PostUserInviteVerifyResponse, PostUserSetUserGroupsData, PostUserSetUserGroupsResponse, PostUserUnlockData, PostUserUnlockResponse, PostUserDataData, PostUserDataResponse, GetUserDataData, GetUserDataResponse, PutUserDataData, PutUserDataResponse, GetUserDataByIdData, GetUserDataByIdResponse, GetFilterUserGroupData, GetFilterUserGroupResponse, GetItemUserGroupData, GetItemUserGroupResponse, DeleteUserGroupData, DeleteUserGroupResponse, PostUserGroupData, PostUserGroupResponse, GetUserGroupData, GetUserGroupResponse, GetUserGroupByIdData, GetUserGroupByIdResponse, DeleteUserGroupByIdData, DeleteUserGroupByIdResponse, PutUserGroupByIdData, PutUserGroupByIdResponse, DeleteUserGroupByIdUsersData, DeleteUserGroupByIdUsersResponse, PostUserGroupByIdUsersData, PostUserGroupByIdUsersResponse, GetItemWebhookData, GetItemWebhookResponse, GetWebhookData, GetWebhookResponse, PostWebhookData, PostWebhookResponse, GetWebhookByIdData, GetWebhookByIdResponse, DeleteWebhookByIdData, DeleteWebhookByIdResponse, PutWebhookByIdData, PutWebhookByIdResponse, GetWebhookByIdLogsData, GetWebhookByIdLogsResponse, GetWebhookEventsData, GetWebhookEventsResponse, GetWebhookLogsData, GetWebhookLogsResponse } from './types.gen'; export class CultureService { /** @@ -194,6 +194,33 @@ export class DataTypeService { } /** + * @param data The data for the request. + * @param data.id + * @param data.skip + * @param data.take + * @returns unknown OK + * @throws ApiError + */ + public static getDataTypeByIdReferencedBy(data: GetDataTypeByIdReferencedByData): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/umbraco/management/api/v1/data-type/{id}/referenced-by', + path: { + id: data.id + }, + query: { + skip: data.skip, + take: data.take + }, + errors: { + 401: 'The resource is protected and requires an authentication token', + 403: 'The authenticated user does not have access to this resource' + } + }); + } + + /** + * @deprecated * @param data The data for the request. * @param data.id * @returns unknown OK diff --git a/src/Umbraco.Web.UI.Client/src/external/backend-api/src/types.gen.ts b/src/Umbraco.Web.UI.Client/src/external/backend-api/src/types.gen.ts index a1a97aa80d41..e46bfcf65523 100644 --- a/src/Umbraco.Web.UI.Client/src/external/backend-api/src/types.gen.ts +++ b/src/Umbraco.Web.UI.Client/src/external/backend-api/src/types.gen.ts @@ -769,6 +769,14 @@ export type DocumentTypeItemResponseModel = { description?: (string) | null; }; +export type DocumentTypePropertyReferenceResponseModel = { + $type: string; + id: string; + name?: (string) | null; + alias?: (string) | null; + documentType: (TrackedReferenceDocumentTypeModel); +}; + export type DocumentTypePropertyTypeContainerResponseModel = { id: string; parent?: ((ReferenceByIdModel) | null); @@ -1277,6 +1285,14 @@ export type MediaTypeItemResponseModel = { icon?: (string) | null; }; +export type MediaTypePropertyReferenceResponseModel = { + $type: string; + id: string; + name?: (string) | null; + alias?: (string) | null; + mediaType: (TrackedReferenceMediaTypeModel); +}; + export type MediaTypePropertyTypeContainerResponseModel = { id: string; parent?: ((ReferenceByIdModel) | null); @@ -1459,6 +1475,14 @@ export type MemberTypeItemResponseModel = { icon?: (string) | null; }; +export type MemberTypePropertyReferenceResponseModel = { + $type: string; + id: string; + name?: (string) | null; + alias?: (string) | null; + memberType: (TrackedReferenceMemberTypeModel); +}; + export type MemberTypePropertyTypeContainerResponseModel = { id: string; parent?: ((ReferenceByIdModel) | null); @@ -1759,7 +1783,7 @@ export type PagedIndexResponseModel = { export type PagedIReferenceResponseModel = { total: number; - items: Array<(DefaultReferenceResponseModel | DocumentReferenceResponseModel | MediaReferenceResponseModel | MemberReferenceResponseModel)>; + items: Array<(DefaultReferenceResponseModel | DocumentReferenceResponseModel | DocumentTypePropertyReferenceResponseModel | MediaReferenceResponseModel | MediaTypePropertyReferenceResponseModel | MemberReferenceResponseModel | MemberTypePropertyReferenceResponseModel)>; }; export type PagedLanguageResponseModel = { @@ -2994,6 +3018,14 @@ export type PutDataTypeByIdMoveData = { export type PutDataTypeByIdMoveResponse = (string); +export type GetDataTypeByIdReferencedByData = { + id: string; + skip?: number; + take?: number; +}; + +export type GetDataTypeByIdReferencedByResponse = ((PagedIReferenceResponseModel)); + export type GetDataTypeByIdReferencesData = { id: string; }; From 43c0d3974bdcf855e4f7c634bd91d52601970005 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 1 Apr 2025 20:13:28 +0200 Subject: [PATCH 06/36] add extension slot --- .../views/info/workspace-view-data-type-info.element.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/workspace-view-data-type-info.element.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/workspace-view-data-type-info.element.ts index 81e6eb9046c0..0d4753c6c749 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/workspace-view-data-type-info.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/workspace-view-data-type-info.element.ts @@ -47,6 +47,8 @@ export class UmbWorkspaceViewDataTypeInfoElement extends UmbLitElement implement override render() { return html`
+ +
From 77b30d784ea2bf5ae58f3662ca41116dd92d7a08 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 1 Apr 2025 20:38:18 +0200 Subject: [PATCH 07/36] register data type reference info app --- .../src/packages/data-type/manifests.ts | 2 + ...-references-workspace-view-info.element.ts | 141 ++++++++++++++++++ .../data-type/reference/info-app/manifests.ts | 18 +++ .../packages/data-type/reference/manifests.ts | 3 +- .../data-type-reference.repository.ts | 35 ++--- .../data-type-reference.server.data.ts | 73 +++++++-- 6 files changed, 231 insertions(+), 41 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/manifests.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/manifests.ts index 1f24894c99fe..e2085b25ad23 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/manifests.ts @@ -3,6 +3,7 @@ import { manifests as dataTypeRootManifest } from './data-type-root/manifests.js import { manifests as entityActions } from './entity-actions/manifests.js'; import { manifests as menuManifests } from './menu/manifests.js'; import { manifests as modalManifests } from './modals/manifests.js'; +import { manifests as referenceManifests } from './reference/manifests.js'; import { manifests as repositoryManifests } from './repository/manifests.js'; import { manifests as searchProviderManifests } from './search/manifests.js'; import { manifests as treeManifests } from './tree/manifests.js'; @@ -15,6 +16,7 @@ export const manifests: Array = ...entityActions, ...menuManifests, ...modalManifests, + ...referenceManifests, ...repositoryManifests, ...searchProviderManifests, ...treeManifests, diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts new file mode 100644 index 000000000000..4afc5b7ed580 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts @@ -0,0 +1,141 @@ +import { UmbDataTypeReferenceRepository } from '../repository/index.js'; +import { css, customElement, html, nothing, repeat, state } from '@umbraco-cms/backoffice/external/lit'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; +import type { UmbReferenceItemModel } from '@umbraco-cms/backoffice/relations'; +import type { UUIPaginationEvent } from '@umbraco-cms/backoffice/external/uui'; +import type { UmbEntityUnique } from '@umbraco-cms/backoffice/entity'; +import { UMB_ENTITY_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace'; + +@customElement('umb-entity-references-workspace-info-app') +export class UmbEntityReferencesWorkspaceInfoAppElement extends UmbLitElement { + @state() + private _currentPage = 1; + + @state() + private _total = 0; + + @state() + private _items?: Array = []; + + #itemsPerPage = 10; + #referenceRepository = new UmbDataTypeReferenceRepository(this); + #unique?: UmbEntityUnique; + #workspaceContext?: typeof UMB_ENTITY_WORKSPACE_CONTEXT.TYPE; + + constructor() { + super(); + + this.consumeContext(UMB_ENTITY_WORKSPACE_CONTEXT, (context) => { + this.#workspaceContext = context; + this.#observeUnique(); + }); + } + + #observeUnique() { + this.observe( + this.#workspaceContext?.unique, + (unique) => { + if (!unique) { + this.#unique = undefined; + this._items = []; + return; + } + + if (this.#unique === unique) { + return; + } + + this.#unique = unique; + this.#getReferences(); + }, + 'umbEntityReferencesUniqueObserver', + ); + } + + async #getReferences() { + if (!this.#unique) { + throw new Error('Data Type unique is required'); + } + + const { data } = await this.#referenceRepository.requestReferencedBy( + this.#unique, + (this._currentPage - 1) * this.#itemsPerPage, + this.#itemsPerPage, + ); + if (!data) return; + + this._total = data.total; + this._items = data.items; + } + + #onPageChange(event: UUIPaginationEvent) { + if (this._currentPage === event.target.current) return; + this._currentPage = event.target.current; + + this.#getReferences(); + } + + override render() { + if (!this._items?.length) return nothing; + return html` + + ${this.#renderItems()} ${this.#renderReferencePagination()} + + `; + } + + #renderItems() { + if (!this._items) return; + return html` + + ${repeat( + this._items, + (item) => item.unique, + (item) => html``, + )} + + `; + } + + #renderReferencePagination() { + if (!this._total) return nothing; + + const totalPages = Math.ceil(this._total / this.#itemsPerPage); + if (totalPages <= 1) return nothing; + + return html` + + `; + } + + static override styles = [ + UmbTextStyles, + css` + :host { + display: contents; + } + + uui-pagination { + flex: 1; + display: inline-block; + } + + .pagination { + display: flex; + justify-content: center; + margin-top: var(--uui-size-space-4); + } + `, + ]; +} + +export { UmbEntityReferencesWorkspaceInfoAppElement as element }; + +declare global { + interface HTMLElementTagNameMap { + 'umb-entity-references-workspace-info-app': UmbEntityReferencesWorkspaceInfoAppElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/manifests.ts new file mode 100644 index 000000000000..de4605183f7a --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/manifests.ts @@ -0,0 +1,18 @@ +import { UMB_DATA_TYPE_WORKSPACE_ALIAS } from '../../workspace/constants.js'; +import { UMB_WORKSPACE_CONDITION_ALIAS } from '@umbraco-cms/backoffice/workspace'; + +export const manifests: Array = [ + { + type: 'workspaceInfoApp', + name: 'Data Type References Workspace Info App', + alias: 'Umb.WorkspaceInfoApp.DataType.References', + element: () => import('./entity-references-workspace-view-info.element.js'), + weight: 90, + conditions: [ + { + alias: UMB_WORKSPACE_CONDITION_ALIAS, + match: UMB_DATA_TYPE_WORKSPACE_ALIAS, + }, + ], + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/manifests.ts index 4ac6fbdcb2ff..cad6350ec827 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/manifests.ts @@ -1,3 +1,4 @@ import { manifests as repositoryManifests } from './repository/manifests.js'; +import { manifests as infoAppManifests } from './info-app/manifests.js'; -export const manifests: Array = [...repositoryManifests]; +export const manifests: Array = [...repositoryManifests, ...infoAppManifests]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/repository/data-type-reference.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/repository/data-type-reference.repository.ts index 89d330d6c03b..336b914ca49c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/repository/data-type-reference.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/repository/data-type-reference.repository.ts @@ -1,17 +1,9 @@ import { UmbDataTypeReferenceServerDataSource } from './data-type-reference.server.data.js'; -import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; -import type { DataTypeReferenceResponseModel } from '@umbraco-cms/backoffice/external/backend-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; +import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; +import type { UmbEntityReferenceRepository } from '@umbraco-cms/backoffice/relations'; -export type UmbDataTypeReferenceModel = { - unique: string; - entityType: string | null; - name: string | null; - icon: string | null; - properties: Array<{ name: string; alias: string }>; -}; - -export class UmbDataTypeReferenceRepository extends UmbControllerBase { +export class UmbDataTypeReferenceRepository extends UmbControllerBase implements UmbEntityReferenceRepository { #referenceSource: UmbDataTypeReferenceServerDataSource; constructor(host: UmbControllerHost) { @@ -19,24 +11,15 @@ export class UmbDataTypeReferenceRepository extends UmbControllerBase { this.#referenceSource = new UmbDataTypeReferenceServerDataSource(this); } - async requestReferencedBy(unique: string) { + async requestReferencedBy(unique: string, skip = 0, take = 20) { if (!unique) throw new Error(`unique is required`); + return this.#referenceSource.getReferencedBy(unique, skip, take); + } - const { data } = await this.#referenceSource.getReferencedBy(unique); - if (!data) return; - - return data.map(mapper); + async requestAreReferenced(uniques: Array, skip = 0, take = 20) { + if (!uniques || uniques.length === 0) throw new Error(`uniques is required`); + return this.#referenceSource.getAreReferenced(uniques, skip, take); } } -const mapper = (item: DataTypeReferenceResponseModel): UmbDataTypeReferenceModel => { - return { - unique: item.contentType.id, - entityType: item.contentType.type, - name: item.contentType.name, - icon: item.contentType.icon, - properties: item.properties, - }; -}; - export default UmbDataTypeReferenceRepository; diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/repository/data-type-reference.server.data.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/repository/data-type-reference.server.data.ts index b94f270e188b..d858d68c069e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/repository/data-type-reference.server.data.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/repository/data-type-reference.server.data.ts @@ -1,30 +1,75 @@ -import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources'; import { DataTypeService } from '@umbraco-cms/backoffice/external/backend-api'; -import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; +import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources'; +import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; +import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity'; +import type { UmbEntityReferenceDataSource, UmbReferenceItemModel } from '@umbraco-cms/backoffice/relations'; +import type { UmbPagedModel, UmbDataSourceResponse } from '@umbraco-cms/backoffice/repository'; +import { UmbManagementApiDataMapper } from '@umbraco-cms/backoffice/repository'; /** * @class UmbDataTypeReferenceServerDataSource - * @implements {RepositoryDetailDataSource} + * @implements {UmbEntityReferenceDataSource} */ -export class UmbDataTypeReferenceServerDataSource { - #host: UmbControllerHost; +export class UmbDataTypeReferenceServerDataSource extends UmbControllerBase implements UmbEntityReferenceDataSource { + #dataMapper = new UmbManagementApiDataMapper(this); /** - * Creates an instance of UmbDataTypeReferenceServerDataSource. - * @param {UmbControllerHost} host - The controller host for this controller to be appended to + * Fetches the item for the given unique from the server + * @param {string} unique - The unique identifier of the item to fetch + * @param {number} skip - The number of items to skip + * @param {number} take - The number of items to take + * @returns {Promise>>} - Items that are referenced by the given unique * @memberof UmbDataTypeReferenceServerDataSource */ - constructor(host: UmbControllerHost) { - this.#host = host; + async getReferencedBy( + unique: string, + skip = 0, + take = 20, + ): Promise>> { + const { data, error } = await tryExecuteAndNotify( + this, + DataTypeService.getDataTypeByIdReferencedBy({ id: unique, skip, take }), + ); + + if (data) { + const promises = data.items.map(async (item) => { + return this.#dataMapper.map({ + forDataModel: item.$type, + data: item, + fallback: async () => { + return { + ...item, + unique: item.id, + entityType: 'unknown', + }; + }, + }); + }); + + const items = await Promise.all(promises); + + return { data: { items, total: data.total } }; + } + + return { data, error }; } /** - * Fetches the item for the given unique from the server - * @param {string} id - * @returns {*} + * Checks if the items are referenced by other items + * @param {Array} uniques - The unique identifiers of the items to fetch + * @param {number} skip - The number of items to skip + * @param {number} take - The number of items to take + * @returns {Promise>>} - Items that are referenced by other items * @memberof UmbDataTypeReferenceServerDataSource */ - async getReferencedBy(id: string) { - return await tryExecuteAndNotify(this.#host, DataTypeService.getDataTypeByIdReferences({ id })); + async getAreReferenced( + uniques: Array, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + skip: number = 0, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + take: number = 20, + ): Promise>> { + console.warn('getAreReferenced is not implemented for DataTypeReferenceServerDataSource'); + return { data: { items: [], total: 0 } }; } } From ba8a7b8c62b264bfe656853cbc9371adfc9f73b0 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 1 Apr 2025 21:07:25 +0200 Subject: [PATCH 08/36] add reference data mappers --- ...-references-workspace-view-info.element.ts | 1 + ...e-workspace-view-info-reference.element.ts | 124 ------------------ .../workspace-view-data-type-info.element.ts | 5 - .../documents/document-types/manifests.ts | 2 + ...ference-response.management-api.mapping.ts | 27 ++++ .../document-types/property-type/entity.ts | 3 + .../document-types/property-type/manifests.ts | 12 ++ .../document-types/property-type/types.ts | 11 ++ .../src/packages/media/media/manifests.ts | 2 + .../media/media/property-type/entity.ts | 3 + .../media/media/property-type/manifests.ts | 12 ++ ...ference-response.management-api.mapping.ts | 26 ++++ .../media/media/property-type/types.ts | 11 ++ .../packages/members/member-type/manifests.ts | 2 + .../member-type/property-type/entity.ts | 3 + .../member-type/property-type/manifests.ts | 12 ++ ...ference-response.management-api.mapping.ts | 26 ++++ .../member-type/property-type/types.ts | 11 ++ 18 files changed, 164 insertions(+), 129 deletions(-) delete mode 100644 src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/data-type-workspace-view-info-reference.element.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-reference-response.management-api.mapping.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/entity.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/manifests.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/types.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/entity.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/manifests.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/media-type-property-type-reference-response.management-api.mapping.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/types.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/entity.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/manifests.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-reference-response.management-api.mapping.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/types.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts index 4afc5b7ed580..bff1f3e0d8cf 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts @@ -67,6 +67,7 @@ export class UmbEntityReferencesWorkspaceInfoAppElement extends UmbLitElement { this._total = data.total; this._items = data.items; + debugger; } #onPageChange(event: UUIPaginationEvent) { diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/data-type-workspace-view-info-reference.element.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/data-type-workspace-view-info-reference.element.ts deleted file mode 100644 index a1f0d2476fb4..000000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/data-type-workspace-view-info-reference.element.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { UmbDataTypeReferenceRepository } from '../../../reference/index.js'; -import type { UmbDataTypeReferenceModel } from '../../../reference/index.js'; -import { css, html, customElement, state, repeat, property, when } from '@umbraco-cms/backoffice/external/lit'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; -import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import { UMB_WORKSPACE_MODAL } from '@umbraco-cms/backoffice/workspace'; -import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; -import type { UmbModalRouteBuilder } from '@umbraco-cms/backoffice/router'; - -const elementName = 'umb-data-type-workspace-view-info-reference'; - -@customElement(elementName) -export class UmbDataTypeWorkspaceViewInfoReferenceElement extends UmbLitElement { - #referenceRepository = new UmbDataTypeReferenceRepository(this); - - #routeBuilder?: UmbModalRouteBuilder; - - @property() - dataTypeUnique = ''; - - @state() - private _loading = true; - - @state() - private _items?: Array = []; - - constructor() { - super(); - - new UmbModalRouteRegistrationController(this, UMB_WORKSPACE_MODAL) - .addAdditionalPath(':entityType') - .onSetup((params) => { - return { data: { entityType: params.entityType, preset: {} } }; - }) - .observeRouteBuilder((routeBuilder) => { - this.#routeBuilder = routeBuilder; - }); - } - - protected override firstUpdated() { - this.#getReferences(); - } - - async #getReferences() { - this._loading = true; - - const items = await this.#referenceRepository.requestReferencedBy(this.dataTypeUnique); - if (!items) return; - - this._items = items; - this._loading = false; - } - - override render() { - return html` - - ${when( - this._loading, - () => html``, - () => this.#renderItems(), - )} - - `; - } - - #getEditPath(item: UmbDataTypeReferenceModel) { - // TODO: [LK] Ask NL for a reminder on how the route constants work. - return this.#routeBuilder && item.entityType - ? this.#routeBuilder({ entityType: item.entityType }) + `edit/${item.unique}` - : '#'; - } - - #renderItems() { - if (!this._items?.length) return html`

${this.localize.term('references_DataTypeNoReferences')}

`; - return html` - - - Name - Type - - Referenced by - - - ${repeat( - this._items, - (item) => item.unique, - (item) => html` - - - - - - - ${item.entityType} - ${item.properties.map((prop) => prop.name).join(', ')} - - `, - )} - - `; - } - - static override styles = [ - UmbTextStyles, - css` - :host { - display: contents; - } - uui-table-cell { - color: var(--uui-color-text-alt); - } - `, - ]; -} - -export { UmbDataTypeWorkspaceViewInfoReferenceElement as element }; - -declare global { - interface HTMLElementTagNameMap { - [elementName]: UmbDataTypeWorkspaceViewInfoReferenceElement; - } -} diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/workspace-view-data-type-info.element.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/workspace-view-data-type-info.element.ts index 0d4753c6c749..e6814696a8e3 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/workspace-view-data-type-info.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/views/info/workspace-view-data-type-info.element.ts @@ -4,8 +4,6 @@ import { css, html, customElement, state } from '@umbraco-cms/backoffice/externa import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import type { UmbWorkspaceViewElement } from '@umbraco-cms/backoffice/workspace'; -import './data-type-workspace-view-info-reference.element.js'; - @customElement('umb-workspace-view-data-type-info') export class UmbWorkspaceViewDataTypeInfoElement extends UmbLitElement implements UmbWorkspaceViewElement { @state() @@ -48,9 +46,6 @@ export class UmbWorkspaceViewDataTypeInfoElement extends UmbLitElement implement return html`
- -
${this.#renderGeneralInfo()}
`; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/manifests.ts index 3562f9d6a7c9..1fea74a75581 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/manifests.ts @@ -1,6 +1,7 @@ import { manifests as entityActionsManifests } from './entity-actions/manifests.js'; import { manifests as menuManifests } from './menu/manifests.js'; import { manifests as propertyEditorManifests } from './property-editors/manifests.js'; +import { manifests as propertyTypeManifests } from './property-type/manifests.js'; import { manifests as repositoryManifests } from './repository/manifests.js'; import { manifests as searchManifests } from './search/manifests.js'; import { manifests as treeManifests } from './tree/manifests.js'; @@ -11,6 +12,7 @@ export const manifests: Array = ...entityActionsManifests, ...menuManifests, ...propertyEditorManifests, + ...propertyTypeManifests, ...repositoryManifests, ...searchManifests, ...treeManifests, diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-reference-response.management-api.mapping.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-reference-response.management-api.mapping.ts new file mode 100644 index 000000000000..660257daa6e4 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-reference-response.management-api.mapping.ts @@ -0,0 +1,27 @@ +import type { UmbDocumentTypePropertyTypeReferenceModel } from './types.js'; +import { UMB_DOCUMENT_TYPE_PROPERTY_TYPE_ENTITY_TYPE } from './entity.js'; +import type { DocumentTypePropertyReferenceResponseModel } from '@umbraco-cms/backoffice/external/backend-api'; +import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; +import type { UmbDataSourceDataMapping } from '@umbraco-cms/backoffice/repository'; + +export class UmbDocumentTypePropertyTypeReferenceResponseManagementApiDataMapping + extends UmbControllerBase + implements + UmbDataSourceDataMapping +{ + async map(data: DocumentTypePropertyReferenceResponseModel): Promise { + return { + alias: data.alias!, + documentType: { + alias: data.documentType.alias!, + icon: data.documentType.icon!, + name: data.documentType.name!, + }, + entityType: UMB_DOCUMENT_TYPE_PROPERTY_TYPE_ENTITY_TYPE, + name: data.name!, + unique: data.id, + }; + } +} + +export { UmbDocumentTypePropertyTypeReferenceResponseManagementApiDataMapping as api }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/entity.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/entity.ts new file mode 100644 index 000000000000..be229d94cd7d --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/entity.ts @@ -0,0 +1,3 @@ +export const UMB_DOCUMENT_TYPE_PROPERTY_TYPE_ENTITY_TYPE = 'document-type-property-type'; + +export type UmbDocumentTypePropertyTypeEntityType = typeof UMB_DOCUMENT_TYPE_PROPERTY_TYPE_ENTITY_TYPE; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/manifests.ts new file mode 100644 index 000000000000..0887901147f7 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/manifests.ts @@ -0,0 +1,12 @@ +import { UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS } from '@umbraco-cms/backoffice/repository'; + +export const manifests: Array = [ + { + type: 'dataSourceDataMapping', + alias: 'Umb.DataSourceDataMapping.ManagementApi.DocumentTypePropertyTypeReferenceResponse', + name: 'Document Type Property Type Reference Response Management Api Data Mapping', + api: () => import('./document-type-property-type-reference-response.management-api.mapping.js'), + forDataSource: UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS, + forDataModel: 'DocumentTypePropertyReferenceResponseModel', + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/types.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/types.ts new file mode 100644 index 000000000000..b9cade8c7b90 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/types.ts @@ -0,0 +1,11 @@ +import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity'; + +export interface UmbDocumentTypePropertyTypeReferenceModel extends UmbEntityModel { + alias: string; + documentType: { + alias: string; + icon: string; + name: string; + }; + name: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/manifests.ts index 45d54199b1a8..e58d4a45ede4 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/manifests.ts @@ -7,6 +7,7 @@ import { manifests as itemManifests } from './item/manifests.js'; import { manifests as menuManifests } from './menu/manifests.js'; import { manifests as modalManifests } from './modals/manifests.js'; import { manifests as propertyEditorsManifests } from './property-editors/manifests.js'; +import { manifests as propertyTypeManifests } from './property-type/manifests.js'; import { manifests as recycleBinManifests } from './recycle-bin/manifests.js'; import { manifests as referenceManifests } from './reference/manifests.js'; import { manifests as repositoryManifests } from './repository/manifests.js'; @@ -26,6 +27,7 @@ export const manifests: Array = [ ...menuManifests, ...modalManifests, ...propertyEditorsManifests, + ...propertyTypeManifests, ...recycleBinManifests, ...referenceManifests, ...repositoryManifests, diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/entity.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/entity.ts new file mode 100644 index 000000000000..7614ba1a740f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/entity.ts @@ -0,0 +1,3 @@ +export const UMB_MEDIA_TYPE_PROPERTY_TYPE_ENTITY_TYPE = 'media-type-property-type'; + +export type UmbMediaTypePropertyTypeEntityType = typeof UMB_MEDIA_TYPE_PROPERTY_TYPE_ENTITY_TYPE; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/manifests.ts new file mode 100644 index 000000000000..076db92b10e5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/manifests.ts @@ -0,0 +1,12 @@ +import { UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS } from '@umbraco-cms/backoffice/repository'; + +export const manifests: Array = [ + { + type: 'dataSourceDataMapping', + alias: 'Umb.DataSourceDataMapping.ManagementApi.MediaTypePropertyTypeReferenceResponse', + name: 'Media Type Property Type Reference Response Management Api Data Mapping', + api: () => import('./media-type-property-type-reference-response.management-api.mapping.js'), + forDataSource: UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS, + forDataModel: 'MediaTypePropertyReferenceResponseModel', + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/media-type-property-type-reference-response.management-api.mapping.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/media-type-property-type-reference-response.management-api.mapping.ts new file mode 100644 index 000000000000..a8448cb7e9c5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/media-type-property-type-reference-response.management-api.mapping.ts @@ -0,0 +1,26 @@ +import type { UmbMediaTypePropertyTypeReferenceModel } from './types.js'; +import { UMB_MEDIA_TYPE_PROPERTY_TYPE_ENTITY_TYPE } from './entity.js'; +import type { MediaTypePropertyReferenceResponseModel } from '@umbraco-cms/backoffice/external/backend-api'; +import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; +import type { UmbDataSourceDataMapping } from '@umbraco-cms/backoffice/repository'; + +export class UmbMediaTypePropertyTypeReferenceResponseManagementApiDataMapping + extends UmbControllerBase + implements UmbDataSourceDataMapping +{ + async map(data: MediaTypePropertyReferenceResponseModel): Promise { + return { + alias: data.alias!, + mediaType: { + alias: data.mediaType.alias!, + icon: data.mediaType.icon!, + name: data.mediaType.name!, + }, + entityType: UMB_MEDIA_TYPE_PROPERTY_TYPE_ENTITY_TYPE, + name: data.name!, + unique: data.id, + }; + } +} + +export { UmbMediaTypePropertyTypeReferenceResponseManagementApiDataMapping as api }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/types.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/types.ts new file mode 100644 index 000000000000..b24452d820ef --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/types.ts @@ -0,0 +1,11 @@ +import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity'; + +export interface UmbMediaTypePropertyTypeReferenceModel extends UmbEntityModel { + alias: string; + mediaType: { + alias: string; + icon: string; + name: string; + }; + name: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/manifests.ts index 96b4dceda1fa..ba33f43db6f2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/manifests.ts @@ -1,5 +1,6 @@ import { manifests as entityActionsManifests } from './entity-actions/manifests.js'; import { manifests as menuManifests } from './menu/manifests.js'; +import { manifests as propertyTypeManifests } from './property-type/manifests.js'; import { manifests as repositoryManifests } from './repository/manifests.js'; import { manifests as searchManifests } from './search/manifests.js'; import { manifests as treeManifests } from './tree/manifests.js'; @@ -11,6 +12,7 @@ import './components/index.js'; export const manifests: Array = [ ...entityActionsManifests, ...menuManifests, + ...propertyTypeManifests, ...repositoryManifests, ...searchManifests, ...treeManifests, diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/entity.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/entity.ts new file mode 100644 index 000000000000..dd0d0a29e0a0 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/entity.ts @@ -0,0 +1,3 @@ +export const UMB_MEMBER_TYPE_PROPERTY_TYPE_ENTITY_TYPE = 'member-type-property-type'; + +export type UmbMemberTypePropertyTypeEntityType = typeof UMB_MEMBER_TYPE_PROPERTY_TYPE_ENTITY_TYPE; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/manifests.ts new file mode 100644 index 000000000000..9abb22602ae9 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/manifests.ts @@ -0,0 +1,12 @@ +import { UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS } from '@umbraco-cms/backoffice/repository'; + +export const manifests: Array = [ + { + type: 'dataSourceDataMapping', + alias: 'Umb.DataSourceDataMapping.ManagementApi.MemberTypePropertyTypeReferenceResponse', + name: 'Member Type Property Type Reference Response Management Api Data Mapping', + api: () => import('./member-type-property-type-reference-response.management-api.mapping.js'), + forDataSource: UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS, + forDataModel: 'MemberTypePropertyReferenceResponseModel', + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-reference-response.management-api.mapping.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-reference-response.management-api.mapping.ts new file mode 100644 index 000000000000..6432e366cf69 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-reference-response.management-api.mapping.ts @@ -0,0 +1,26 @@ +import type { UmbMemberTypePropertyTypeReferenceModel } from './types.js'; +import { UMB_MEMBER_TYPE_PROPERTY_TYPE_ENTITY_TYPE } from './entity.js'; +import type { MemberTypePropertyReferenceResponseModel } from '@umbraco-cms/backoffice/external/backend-api'; +import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; +import type { UmbDataSourceDataMapping } from '@umbraco-cms/backoffice/repository'; + +export class UmbMemberTypePropertyTypeReferenceResponseManagementApiDataMapping + extends UmbControllerBase + implements UmbDataSourceDataMapping +{ + async map(data: MemberTypePropertyReferenceResponseModel): Promise { + return { + alias: data.alias!, + memberType: { + alias: data.memberType.alias!, + icon: data.memberType.icon!, + name: data.memberType.name!, + }, + entityType: UMB_MEMBER_TYPE_PROPERTY_TYPE_ENTITY_TYPE, + name: data.name!, + unique: data.id, + }; + } +} + +export { UmbMemberTypePropertyTypeReferenceResponseManagementApiDataMapping as api }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/types.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/types.ts new file mode 100644 index 000000000000..b875e1503b6c --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/types.ts @@ -0,0 +1,11 @@ +import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity'; + +export interface UmbMemberTypePropertyTypeReferenceModel extends UmbEntityModel { + alias: string; + memberType: { + alias: string; + icon: string; + name: string; + }; + name: string; +} From 56e0e64e1ae712d262b137d14a419856abd1d4df Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 2 Apr 2025 09:34:36 +0200 Subject: [PATCH 09/36] Added id to tracked reference content type response. --- .../TrackedReferenceViewModelsMapDefinition.cs | 6 ++++++ .../TrackedReferences/TrackedReferenceContentType.cs | 4 +++- .../Mapping/RelationModelMapDefinition.cs | 3 ++- .../Repositories/Implement/RelationRepository.cs | 3 +++ .../Implement/TrackedReferencesRepository.cs | 10 ++++++++++ .../Services/DataTypeServiceTests.cs | 2 ++ 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs b/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs index 9143ba810ddc..da9b08844976 100644 --- a/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs +++ b/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs @@ -28,6 +28,7 @@ private void Map(RelationItemModel source, DocumentReferenceResponseModel target target.Published = source.NodePublished; target.DocumentType = new TrackedReferenceDocumentType { + Id = source.ContentTypeKey, Alias = source.ContentTypeAlias, Icon = source.ContentTypeIcon, Name = source.ContentTypeName, @@ -41,6 +42,7 @@ private void Map(RelationItemModel source, MediaReferenceResponseModel target, M target.Name = source.NodeName; target.MediaType = new TrackedReferenceMediaType { + Id = source.ContentTypeKey, Alias = source.ContentTypeAlias, Icon = source.ContentTypeIcon, Name = source.ContentTypeName, @@ -54,6 +56,7 @@ private void Map(RelationItemModel source, MemberReferenceResponseModel target, target.Name = source.NodeName; target.MemberType = new TrackedReferenceMemberType { + Id = source.ContentTypeKey, Alias = source.ContentTypeAlias, Icon = source.ContentTypeIcon, Name = source.ContentTypeName, @@ -68,6 +71,7 @@ private void Map(RelationItemModel source, DocumentTypePropertyReferenceResponse target.Alias = source.NodeAlias; target.DocumentType = new TrackedReferenceDocumentType { + Id = source.ContentTypeKey, Alias = source.ContentTypeAlias, Icon = source.ContentTypeIcon, Name = source.ContentTypeName, @@ -82,6 +86,7 @@ private void Map(RelationItemModel source, MediaTypePropertyReferenceResponseMod target.Alias = source.NodeAlias; target.MediaType = new TrackedReferenceMediaType { + Id = source.ContentTypeKey, Alias = source.ContentTypeAlias, Icon = source.ContentTypeIcon, Name = source.ContentTypeName, @@ -96,6 +101,7 @@ private void Map(RelationItemModel source, MemberTypePropertyReferenceResponseMo target.Alias = source.NodeAlias; target.MemberType = new TrackedReferenceMemberType { + Id = source.ContentTypeKey, Alias = source.ContentTypeAlias, Icon = source.ContentTypeIcon, Name = source.ContentTypeName, diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/TrackedReferenceContentType.cs b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/TrackedReferenceContentType.cs index 31456abada1a..15ac365e41e2 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/TrackedReferenceContentType.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/TrackedReferenceContentType.cs @@ -1,7 +1,9 @@ -namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; +namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; public abstract class TrackedReferenceContentType { + public Guid Id { get; set; } + public string? Icon { get; set; } public string? Alias { get; set; } diff --git a/src/Umbraco.Infrastructure/Mapping/RelationModelMapDefinition.cs b/src/Umbraco.Infrastructure/Mapping/RelationModelMapDefinition.cs index 8ace25c07f57..1f0c986e0d7c 100644 --- a/src/Umbraco.Infrastructure/Mapping/RelationModelMapDefinition.cs +++ b/src/Umbraco.Infrastructure/Mapping/RelationModelMapDefinition.cs @@ -1,4 +1,4 @@ -using Umbraco.Cms.Core.Mapping; +using Umbraco.Cms.Core.Mapping; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; @@ -19,6 +19,7 @@ private void Map(RelationItemDto source, RelationItemModel target, MapperContext target.RelationTypeName = source.RelationTypeName; target.RelationTypeIsBidirectional = source.RelationTypeIsBidirectional; target.RelationTypeIsDependency = source.RelationTypeIsDependency; + target.ContentTypeKey = source.ChildContentTypeKey; target.ContentTypeAlias = source.ChildContentTypeAlias; target.ContentTypeIcon = source.ChildContentTypeIcon; target.ContentTypeName = source.ChildContentTypeName; diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RelationRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RelationRepository.cs index a38bf4547ff6..2786bbfd1e45 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RelationRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RelationRepository.cs @@ -475,6 +475,9 @@ internal class RelationItemDto [Column(Name = "nodeObjectType")] public Guid ChildNodeObjectType { get; set; } + [Column(Name = "contentTypeKey")] + public Guid ChildContentTypeKey { get; set; } + [Column(Name = "contentTypeIcon")] public string? ChildContentTypeIcon { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TrackedReferencesRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TrackedReferencesRepository.cs index 2b7a43589c01..ff3b671a5cc3 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TrackedReferencesRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TrackedReferencesRepository.cs @@ -34,6 +34,7 @@ public IEnumerable GetPagedItemsWithRelations(int[] ids, long page "[n].[text] as nodeName", "[n].[nodeObjectType] as nodeObjectType", "[d].[published] as nodePublished", + "[ctn].[uniqueId] as contentTypeKey", "[ct].[icon] as contentTypeIcon", "[ct].[alias] as contentTypeAlias", "[ctn].[text] as contentTypeName", @@ -163,6 +164,7 @@ public IEnumerable GetPagedDescendantsInReferences( "[n].[text] as nodeName", "[n].[nodeObjectType] as nodeObjectType", "[d].[published] as nodePublished", + "[ctn].[uniqueId] as contentTypeKey", "[ct].[icon] as contentTypeIcon", "[ct].[alias] as contentTypeAlias", "[ctn].[text] as contentTypeName", @@ -225,6 +227,7 @@ public IEnumerable GetPagedRelationsForItem(int id, long pageIndex "[n].[text] as nodeName", "[n].[nodeObjectType] as nodeObjectType", "[d].[published] as nodePublished", + "[ctn].[uniqueId] as contentTypeKey", "[ct].[icon] as contentTypeIcon", "[ct].[alias] as contentTypeAlias", "[ctn].[text] as contentTypeName", @@ -285,6 +288,7 @@ public IEnumerable GetPagedRelationsForItem( "[n].[text] as nodeName", "[n].[nodeObjectType] as nodeObjectType", "[d].[published] as nodePublished", + "[ctn].[uniqueId] as contentTypeKey", "[ct].[icon] as contentTypeIcon", "[ct].[alias] as contentTypeAlias", "[ctn].[text] as contentTypeName", @@ -360,6 +364,7 @@ public IEnumerable GetPagedRelationsForItem( "[n].[uniqueId] as nodeKey", "[n].[text] as nodeName", "[n].[nodeObjectType] as nodeObjectType", + "[ctn].[uniqueId] as contentTypeKey", "[ct].[icon] as contentTypeIcon", "[ct].[alias] as contentTypeAlias", "[ctn].[text] as contentTypeName", @@ -426,6 +431,7 @@ public IEnumerable GetPagedItemsWithRelations( "[n].[uniqueId] as nodeKey", "[n].[text] as nodeName", "[n].[nodeObjectType] as nodeObjectType", + "[ctn].[uniqueId] as contentTypeKey", "[ct].[icon] as contentTypeIcon", "[ct].[alias] as contentTypeAlias", "[ctn].[text] as contentTypeName", @@ -544,6 +550,7 @@ public IEnumerable GetPagedDescendantsInReferences(Guid paren "[n].[text] as nodeName", "[n].[nodeObjectType] as nodeObjectType", "[d].[published] as nodePublished", + "[ctn].[uniqueId] as contentTypeKey", "[ct].[icon] as contentTypeIcon", "[ct].[alias] as contentTypeAlias", "[ctn].[text] as contentTypeName", @@ -620,6 +627,7 @@ public IEnumerable GetPagedItemsWithRelations( "[n].[uniqueId] as nodeKey", "[n].[text] as nodeName", "[n].[nodeObjectType] as nodeObjectType", + "[ctn].[uniqueId] as contentTypeKey", "[ct].[icon] as contentTypeIcon", "[ct].[alias] as contentTypeAlias", "[ctn].[text] as contentTypeName", @@ -698,6 +706,7 @@ public IEnumerable GetPagedDescendantsInReferences( "[n].[uniqueId] as nodeKey", "[n].[text] as nodeName", "[n].[nodeObjectType] as nodeObjectType", + "[ctn].[uniqueId] as contentTypeKey", "[ct].[icon] as contentTypeIcon", "[ct].[alias] as contentTypeAlias", "[ctn].[text] as contentTypeName", @@ -786,6 +795,7 @@ private RelationItem MapDtoToEntity(RelationItemDto dto) RelationTypeName = dto.RelationTypeName, RelationTypeIsBidirectional = dto.RelationTypeIsBidirectional, RelationTypeIsDependency = dto.RelationTypeIsDependency, + ContentTypeKey = dto.ChildContentTypeKey, ContentTypeAlias = dto.ChildContentTypeAlias, ContentTypeIcon = dto.ChildContentTypeIcon, ContentTypeName = dto.ChildContentTypeName, diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs index 659c75b048e7..92a1567a4f33 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs @@ -475,6 +475,7 @@ public async Task DataTypeService_Can_Get_References() Assert.AreEqual("umbTextpage", firstResult.ContentTypeAlias); Assert.AreEqual("Text Page", firstResult.ContentTypeName); Assert.AreEqual("icon-document", firstResult.ContentTypeIcon); + Assert.AreEqual(documentType.Key, firstResult.ContentTypeKey); Assert.AreEqual("bodyText", firstResult.NodeAlias); Assert.AreEqual("Body text", firstResult.NodeName); @@ -482,6 +483,7 @@ public async Task DataTypeService_Can_Get_References() Assert.AreEqual("umbMediaItem", secondResult.ContentTypeAlias); Assert.AreEqual("Media Item", secondResult.ContentTypeName); Assert.AreEqual("icon-picture", secondResult.ContentTypeIcon); + Assert.AreEqual(mediaType.Key, secondResult.ContentTypeKey); Assert.AreEqual("bodyText", secondResult.NodeAlias); Assert.AreEqual("Body text", secondResult.NodeName); } From 8963db3217dca1c9b4566ca4f06d07872fc3e787 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 2 Apr 2025 09:36:19 +0200 Subject: [PATCH 10/36] Updated OpenApi.json. --- src/Umbraco.Cms.Api.Management/OpenApi.json | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Umbraco.Cms.Api.Management/OpenApi.json b/src/Umbraco.Cms.Api.Management/OpenApi.json index b49d19f18468..06ab75e1b5f9 100644 --- a/src/Umbraco.Cms.Api.Management/OpenApi.json +++ b/src/Umbraco.Cms.Api.Management/OpenApi.json @@ -44587,8 +44587,15 @@ "additionalProperties": false }, "TrackedReferenceDocumentTypeModel": { + "required": [ + "id" + ], "type": "object", "properties": { + "id": { + "type": "string", + "format": "uuid" + }, "icon": { "type": "string", "nullable": true @@ -44605,8 +44612,15 @@ "additionalProperties": false }, "TrackedReferenceMediaTypeModel": { + "required": [ + "id" + ], "type": "object", "properties": { + "id": { + "type": "string", + "format": "uuid" + }, "icon": { "type": "string", "nullable": true @@ -44623,8 +44637,15 @@ "additionalProperties": false }, "TrackedReferenceMemberTypeModel": { + "required": [ + "id" + ], "type": "object", "properties": { + "id": { + "type": "string", + "format": "uuid" + }, "icon": { "type": "string", "nullable": true From ad20cac99a976db6e2fa9cc373f59c8151adba27 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 2 Apr 2025 09:43:20 +0200 Subject: [PATCH 11/36] Added missing updates. --- src/Umbraco.Core/Models/RelationItem.cs | 3 +++ src/Umbraco.Core/Models/RelationItemModel.cs | 2 ++ src/Umbraco.Core/Services/DataTypeService.cs | 1 + 3 files changed, 6 insertions(+) diff --git a/src/Umbraco.Core/Models/RelationItem.cs b/src/Umbraco.Core/Models/RelationItem.cs index a865e7cc2fbf..41fde0e867be 100644 --- a/src/Umbraco.Core/Models/RelationItem.cs +++ b/src/Umbraco.Core/Models/RelationItem.cs @@ -23,6 +23,9 @@ public class RelationItem [DataMember(Name = "published")] public bool? NodePublished { get; set; } + [DataMember(Name = "contentTypeKey")] + public Guid ContentTypeKey { get; set; } + [DataMember(Name = "icon")] public string? ContentTypeIcon { get; set; } diff --git a/src/Umbraco.Core/Models/RelationItemModel.cs b/src/Umbraco.Core/Models/RelationItemModel.cs index e4e0e28d86f4..1ca3bb9e111e 100644 --- a/src/Umbraco.Core/Models/RelationItemModel.cs +++ b/src/Umbraco.Core/Models/RelationItemModel.cs @@ -12,6 +12,8 @@ public class RelationItemModel public bool? NodePublished { get; set; } + public Guid ContentTypeKey { get; set; } + public string? ContentTypeIcon { get; set; } public string? ContentTypeAlias { get; set; } diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs index f41b7dbcab14..89b24732d788 100644 --- a/src/Umbraco.Core/Services/DataTypeService.cs +++ b/src/Umbraco.Core/Services/DataTypeService.cs @@ -799,6 +799,7 @@ public Task> GetPagedRelationsAsync(Guid key, int IPropertyType? propertyType = contentType.PropertyTypes.SingleOrDefault(y => y.Alias == x.PropertyAlias); return new RelationItemModel { + ContentTypeKey = contentType.Key, ContentTypeAlias = contentType.Alias, ContentTypeIcon = contentType.Icon, ContentTypeName = contentType.Name, From 7518ab44bc2a2edd795cbcfc23d905b8adba58f7 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 2 Apr 2025 11:24:50 +0200 Subject: [PATCH 12/36] generate new models --- .../src/external/backend-api/src/types.gen.ts | 3 +++ .../src/mocks/data/tracked-reference.data.ts | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/external/backend-api/src/types.gen.ts b/src/Umbraco.Web.UI.Client/src/external/backend-api/src/types.gen.ts index e46bfcf65523..60f36415ae10 100644 --- a/src/Umbraco.Web.UI.Client/src/external/backend-api/src/types.gen.ts +++ b/src/Umbraco.Web.UI.Client/src/external/backend-api/src/types.gen.ts @@ -2428,18 +2428,21 @@ export type TemporaryFileResponseModel = { }; export type TrackedReferenceDocumentTypeModel = { + id: string; icon?: (string) | null; alias?: (string) | null; name?: (string) | null; }; export type TrackedReferenceMediaTypeModel = { + id: string; icon?: (string) | null; alias?: (string) | null; name?: (string) | null; }; export type TrackedReferenceMemberTypeModel = { + id: string; icon?: (string) | null; alias?: (string) | null; name?: (string) | null; diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/tracked-reference.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/tracked-reference.data.ts index 1137b79c4791..5b79b027e3b6 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/data/tracked-reference.data.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/tracked-reference.data.ts @@ -6,7 +6,10 @@ import type { } from '@umbraco-cms/backoffice/external/backend-api'; export const items: Array< - DefaultReferenceResponseModel | DocumentReferenceResponseModel | MediaReferenceResponseModel | MemberReferenceResponseModel + | DefaultReferenceResponseModel + | DocumentReferenceResponseModel + | MediaReferenceResponseModel + | MemberReferenceResponseModel > = [ { $type: 'DocumentReferenceResponseModel', @@ -17,8 +20,9 @@ export const items: Array< alias: 'blogPost', icon: 'icon-document', name: 'Simple Document Type', + id: 'simple-document-type-id', }, - variants: [] + variants: [], } satisfies DocumentReferenceResponseModel, { $type: 'DocumentReferenceResponseModel', @@ -29,8 +33,9 @@ export const items: Array< alias: 'imageBlock', icon: 'icon-settings', name: 'Image Block', + id: 'image-block-id', }, - variants: [] + variants: [], } satisfies DocumentReferenceResponseModel, { $type: 'MediaReferenceResponseModel', @@ -40,6 +45,7 @@ export const items: Array< alias: 'image', icon: 'icon-picture', name: 'Image', + id: 'media-type-id', }, } satisfies MediaReferenceResponseModel, { From 242106330cea2d60517a21a504739dede86c00c4 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 2 Apr 2025 11:32:34 +0200 Subject: [PATCH 13/36] update models --- ...ent-type-property-type-item-ref.element.ts | 78 +++++++++++++++++++ ...ference-response.management-api.mapping.ts | 1 + .../document-types/property-type/types.ts | 1 + ...ference-response.management-api.mapping.ts | 7 +- .../documents/documents/reference/types.ts | 8 +- .../packages/media/media-types/manifests.ts | 10 ++- .../property-type/entity.ts | 0 .../property-type/manifests.ts | 0 ...ference-response.management-api.mapping.ts | 1 + .../property-type/types.ts | 1 + .../src/packages/media/media/manifests.ts | 2 - ...ference-response.management-api.mapping.ts | 7 +- .../media/media/reference/repository/types.ts | 8 +- ...ference-response.management-api.mapping.ts | 1 + .../member-type/property-type/types.ts | 1 + ...ference-response.management-api.mapping.ts | 7 +- .../member/reference/repository/types.ts | 8 +- 17 files changed, 120 insertions(+), 21 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-item-ref.element.ts rename src/Umbraco.Web.UI.Client/src/packages/media/{media => media-types}/property-type/entity.ts (100%) rename src/Umbraco.Web.UI.Client/src/packages/media/{media => media-types}/property-type/manifests.ts (100%) rename src/Umbraco.Web.UI.Client/src/packages/media/{media => media-types}/property-type/media-type-property-type-reference-response.management-api.mapping.ts (97%) rename src/Umbraco.Web.UI.Client/src/packages/media/{media => media-types}/property-type/types.ts (93%) diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-item-ref.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-item-ref.element.ts new file mode 100644 index 000000000000..2b59eacad737 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-item-ref.element.ts @@ -0,0 +1,78 @@ +import { UMB_DOCUMENT_TYPE_ENTITY_TYPE } from '../entity.js'; +import { UMB_EDIT_DOCUMENT_TYPE_WORKSPACE_PATH_PATTERN } from '../paths.js'; +import type { UmbDocumentTypePropertyTypeReferenceModel } from './types.js'; +import { customElement, html, ifDefined, nothing, property, state } from '@umbraco-cms/backoffice/external/lit'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; +import { UMB_WORKSPACE_MODAL } from '@umbraco-cms/backoffice/workspace'; + +@customElement('umb-document-type-property-type-item-ref') +export class UmbDocumentTypePropertyTypeItemRefElement extends UmbLitElement { + @property({ type: Object }) + item?: UmbDocumentTypePropertyTypeReferenceModel; + + @property({ type: Boolean }) + readonly = false; + + @property({ type: Boolean }) + standalone = false; + + @state() + _editPath = ''; + + constructor() { + super(); + + new UmbModalRouteRegistrationController(this, UMB_WORKSPACE_MODAL) + .addUniquePaths(['unique']) + .onSetup(() => { + return { data: { entityType: UMB_DOCUMENT_TYPE_ENTITY_TYPE, preset: {} } }; + }) + .observeRouteBuilder((routeBuilder) => { + this._editPath = routeBuilder({}); + }); + } + + #getHref() { + if (!this.item?.unique) return; + const path = UMB_EDIT_DOCUMENT_TYPE_WORKSPACE_PATH_PATTERN.generateLocal({ unique: this.item.documentType.unique }); + return `${this._editPath}/${path}`; + } + + #getName() { + return this.item?.documentType.name ?? 'Unknown Document Type'; + } + + #getDetail() { + return this.item?.name + ' (' + this.item?.alias + ')'; + } + + override render() { + if (!this.item) return nothing; + + return html` + + + ${this.#renderIcon()} + + `; + } + + #renderIcon() { + if (!this.item?.documentType.icon) return nothing; + return html``; + } +} + +export { UmbDocumentTypePropertyTypeItemRefElement as element }; + +declare global { + interface HTMLElementTagNameMap { + 'umb-document-type-property-type-item-ref': UmbDocumentTypePropertyTypeItemRefElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-reference-response.management-api.mapping.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-reference-response.management-api.mapping.ts index 660257daa6e4..f0e1c574c238 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-reference-response.management-api.mapping.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-reference-response.management-api.mapping.ts @@ -16,6 +16,7 @@ export class UmbDocumentTypePropertyTypeReferenceResponseManagementApiDataMappin alias: data.documentType.alias!, icon: data.documentType.icon!, name: data.documentType.name!, + unique: data.documentType.id, }, entityType: UMB_DOCUMENT_TYPE_PROPERTY_TYPE_ENTITY_TYPE, name: data.name!, diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/types.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/types.ts index b9cade8c7b90..8668fbd8ba59 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/types.ts @@ -6,6 +6,7 @@ export interface UmbDocumentTypePropertyTypeReferenceModel extends UmbEntityMode alias: string; icon: string; name: string; + unique: string; }; name: string; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/reference/repository/document-reference-response.management-api.mapping.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/reference/repository/document-reference-response.management-api.mapping.ts index 5dc5b0875444..ecc3b4fd23ae 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/reference/repository/document-reference-response.management-api.mapping.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/reference/repository/document-reference-response.management-api.mapping.ts @@ -14,9 +14,10 @@ export class UmbDocumentReferenceResponseManagementApiDataMapping async map(data: DocumentReferenceResponseModel): Promise { return { documentType: { - alias: data.documentType.alias, - icon: data.documentType.icon, - name: data.documentType.name, + alias: data.documentType.alias!, + icon: data.documentType.icon!, + name: data.documentType.name!, + unique: data.documentType.id, }, entityType: UMB_DOCUMENT_ENTITY_TYPE, id: data.id, diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/reference/types.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/reference/types.ts index 90496f5d8778..efd670dd1f77 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/reference/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/reference/types.ts @@ -1,6 +1,5 @@ import type { UmbDocumentItemVariantModel } from '../item/types.js'; import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity'; -import type { TrackedReferenceDocumentTypeModel } from '@umbraco-cms/backoffice/external/backend-api'; export interface UmbDocumentReferenceModel extends UmbEntityModel { /** @@ -23,6 +22,11 @@ export interface UmbDocumentReferenceModel extends UmbEntityModel { * @memberof UmbDocumentReferenceModel */ published?: boolean | null; - documentType: TrackedReferenceDocumentTypeModel; + documentType: { + alias: string; + icon: string; + name: string; + unique: string; + }; variants: Array; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/manifests.ts index 49a80defb64c..a1a7a478c8b7 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/manifests.ts @@ -1,18 +1,20 @@ import { manifests as entityActionsManifests } from './entity-actions/manifests.js'; import { manifests as menuManifests } from './menu/manifests.js'; +import { manifests as propertyEditorUiManifests } from './property-editors/manifests.js'; +import { manifests as propertyTypeManifests } from './property-type/manifests.js'; import { manifests as repositoryManifests } from './repository/manifests.js'; +import { manifests as searchManifests } from './search/manifests.js'; import { manifests as treeManifests } from './tree/manifests.js'; import { manifests as workspaceManifests } from './workspace/manifests.js'; -import { manifests as propertyEditorUiManifests } from './property-editors/manifests.js'; -import { manifests as searchManifests } from './search/manifests.js'; import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry'; export const manifests: Array = [ ...entityActionsManifests, ...menuManifests, + ...propertyEditorUiManifests, + ...propertyTypeManifests, ...repositoryManifests, + ...searchManifests, ...treeManifests, ...workspaceManifests, - ...propertyEditorUiManifests, - ...searchManifests, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/entity.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/entity.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/entity.ts rename to src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/entity.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/manifests.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/manifests.ts rename to src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/manifests.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/media-type-property-type-reference-response.management-api.mapping.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/media-type-property-type-reference-response.management-api.mapping.ts similarity index 97% rename from src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/media-type-property-type-reference-response.management-api.mapping.ts rename to src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/media-type-property-type-reference-response.management-api.mapping.ts index a8448cb7e9c5..32d62a1d543c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/media-type-property-type-reference-response.management-api.mapping.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/media-type-property-type-reference-response.management-api.mapping.ts @@ -15,6 +15,7 @@ export class UmbMediaTypePropertyTypeReferenceResponseManagementApiDataMapping alias: data.mediaType.alias!, icon: data.mediaType.icon!, name: data.mediaType.name!, + unique: data.mediaType.id, }, entityType: UMB_MEDIA_TYPE_PROPERTY_TYPE_ENTITY_TYPE, name: data.name!, diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/types.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/types.ts similarity index 93% rename from src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/types.ts rename to src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/types.ts index b24452d820ef..b314e7cf6ffa 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/property-type/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/types.ts @@ -6,6 +6,7 @@ export interface UmbMediaTypePropertyTypeReferenceModel extends UmbEntityModel { alias: string; icon: string; name: string; + unique: string; }; name: string; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/manifests.ts index e58d4a45ede4..45d54199b1a8 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/manifests.ts @@ -7,7 +7,6 @@ import { manifests as itemManifests } from './item/manifests.js'; import { manifests as menuManifests } from './menu/manifests.js'; import { manifests as modalManifests } from './modals/manifests.js'; import { manifests as propertyEditorsManifests } from './property-editors/manifests.js'; -import { manifests as propertyTypeManifests } from './property-type/manifests.js'; import { manifests as recycleBinManifests } from './recycle-bin/manifests.js'; import { manifests as referenceManifests } from './reference/manifests.js'; import { manifests as repositoryManifests } from './repository/manifests.js'; @@ -27,7 +26,6 @@ export const manifests: Array = [ ...menuManifests, ...modalManifests, ...propertyEditorsManifests, - ...propertyTypeManifests, ...recycleBinManifests, ...referenceManifests, ...repositoryManifests, diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/reference/repository/media-reference-response.management-api.mapping.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/reference/repository/media-reference-response.management-api.mapping.ts index e9c29762e576..34a7a83d7a9c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/reference/repository/media-reference-response.management-api.mapping.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/reference/repository/media-reference-response.management-api.mapping.ts @@ -13,9 +13,10 @@ export class UmbMediaReferenceResponseManagementApiDataMapping entityType: UMB_MEDIA_ENTITY_TYPE, id: data.id, mediaType: { - alias: data.mediaType.alias, - icon: data.mediaType.icon, - name: data.mediaType.name, + alias: data.mediaType.alias!, + icon: data.mediaType.icon!, + name: data.mediaType.name!, + unique: data.mediaType.id, }, name: data.name, // TODO: this is a hardcoded array until the server can return the correct variants array diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/reference/repository/types.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/reference/repository/types.ts index 69220e630167..fa9ef9899090 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/reference/repository/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/reference/repository/types.ts @@ -1,6 +1,5 @@ import type { UmbMediaItemVariantModel } from '../../repository/item/types.js'; import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity'; -import type { TrackedReferenceMediaTypeModel } from '@umbraco-cms/backoffice/external/backend-api'; export interface UmbMediaReferenceModel extends UmbEntityModel { /** @@ -23,6 +22,11 @@ export interface UmbMediaReferenceModel extends UmbEntityModel { * @memberof UmbMediaReferenceModel */ published?: boolean | null; - mediaType: TrackedReferenceMediaTypeModel; + mediaType: { + alias: string; + icon: string; + name: string; + unique: string; + }; variants: Array; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-reference-response.management-api.mapping.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-reference-response.management-api.mapping.ts index 6432e366cf69..7da323873156 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-reference-response.management-api.mapping.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-reference-response.management-api.mapping.ts @@ -15,6 +15,7 @@ export class UmbMemberTypePropertyTypeReferenceResponseManagementApiDataMapping alias: data.memberType.alias!, icon: data.memberType.icon!, name: data.memberType.name!, + unique: data.memberType.id, }, entityType: UMB_MEMBER_TYPE_PROPERTY_TYPE_ENTITY_TYPE, name: data.name!, diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/types.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/types.ts index b875e1503b6c..566b91fe2478 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/types.ts @@ -6,6 +6,7 @@ export interface UmbMemberTypePropertyTypeReferenceModel extends UmbEntityModel alias: string; icon: string; name: string; + unique: string; }; name: string; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member/reference/repository/member-reference-response.management-api.mapping.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member/reference/repository/member-reference-response.management-api.mapping.ts index e6418503e81f..408774eca08a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/member/reference/repository/member-reference-response.management-api.mapping.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member/reference/repository/member-reference-response.management-api.mapping.ts @@ -12,9 +12,10 @@ export class UmbMemberReferenceResponseManagementApiDataMapping return { entityType: UMB_MEMBER_ENTITY_TYPE, memberType: { - alias: data.memberType.alias, - icon: data.memberType.icon, - name: data.memberType.name, + alias: data.memberType.alias!, + icon: data.memberType.icon!, + name: data.memberType.name!, + unique: data.memberType.id, }, name: data.name, // TODO: this is a hardcoded array until the server can return the correct variants array diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member/reference/repository/types.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member/reference/repository/types.ts index bc62433db504..c63aad90ce95 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/member/reference/repository/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member/reference/repository/types.ts @@ -1,6 +1,5 @@ import type { UmbMemberItemVariantModel } from '../../item/types.js'; import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity'; -import type { TrackedReferenceMemberTypeModel } from '@umbraco-cms/backoffice/external/backend-api'; export interface UmbMemberReferenceModel extends UmbEntityModel { /** @@ -9,6 +8,11 @@ export interface UmbMemberReferenceModel extends UmbEntityModel { * @memberof UmbMemberReferenceModel */ name?: string | null; - memberType: TrackedReferenceMemberTypeModel; + memberType: { + alias: string; + icon: string; + name: string; + unique: string; + }; variants: Array; } From 9743ca40f69bb8e67e9798fa253a2693c9733c71 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 2 Apr 2025 11:50:59 +0200 Subject: [PATCH 14/36] register ref item --- .../documents/document-types/property-type/manifests.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/manifests.ts index 0887901147f7..a3d1728ab83c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/manifests.ts @@ -1,3 +1,4 @@ +import { UMB_DOCUMENT_TYPE_PROPERTY_TYPE_ENTITY_TYPE } from './entity.js'; import { UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS } from '@umbraco-cms/backoffice/repository'; export const manifests: Array = [ @@ -9,4 +10,11 @@ export const manifests: Array = [ forDataSource: UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS, forDataModel: 'DocumentTypePropertyReferenceResponseModel', }, + { + type: 'entityItemRef', + alias: 'Umb.EntityItemRef.DocumentTypePropertyType', + name: 'Document Type Property Type Entity Item Reference', + element: () => import('./document-type-property-type-item-ref.element.js'), + forEntityTypes: [UMB_DOCUMENT_TYPE_PROPERTY_TYPE_ENTITY_TYPE], + }, ]; From 9a65fdc56ac5601eea30f9d48ce1797a7f5e5da4 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 2 Apr 2025 11:51:06 +0200 Subject: [PATCH 15/36] remove debugger --- .../info-app/entity-references-workspace-view-info.element.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts index bff1f3e0d8cf..4afc5b7ed580 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts @@ -67,7 +67,6 @@ export class UmbEntityReferencesWorkspaceInfoAppElement extends UmbLitElement { this._total = data.total; this._items = data.items; - debugger; } #onPageChange(event: UUIPaginationEvent) { From 2476186dd0ba1ffa93495b2410d7a110db45ff2d Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 2 Apr 2025 11:51:21 +0200 Subject: [PATCH 16/36] render types --- .../document-type-property-type-item-ref.element.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-item-ref.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-item-ref.element.ts index 2b59eacad737..a841c162c983 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-item-ref.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/property-type/document-type-property-type-item-ref.element.ts @@ -40,11 +40,13 @@ export class UmbDocumentTypePropertyTypeItemRefElement extends UmbLitElement { } #getName() { - return this.item?.documentType.name ?? 'Unknown Document Type'; + const documentTypeName = this.item?.documentType.name ?? 'Unknown'; + return `Document Type: ${documentTypeName}`; } #getDetail() { - return this.item?.name + ' (' + this.item?.alias + ')'; + const propertyTypeDetails = this.item?.name ? this.item.name + ' (' + this.item.alias + ')' : 'Unknown'; + return `Property Type: ${propertyTypeDetails}`; } override render() { From d6a0ef38333c2af04ad1a9b97c820bfb4e5c0102 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 2 Apr 2025 11:55:05 +0200 Subject: [PATCH 17/36] register member type property type ref --- .../member-type/property-type/manifests.ts | 8 ++ ...ber-type-property-type-item-ref.element.ts | 80 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-item-ref.element.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/manifests.ts index 9abb22602ae9..541bb833c4a0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/manifests.ts @@ -1,3 +1,4 @@ +import { UMB_MEMBER_TYPE_PROPERTY_TYPE_ENTITY_TYPE } from './entity.js'; import { UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS } from '@umbraco-cms/backoffice/repository'; export const manifests: Array = [ @@ -9,4 +10,11 @@ export const manifests: Array = [ forDataSource: UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS, forDataModel: 'MemberTypePropertyReferenceResponseModel', }, + { + type: 'entityItemRef', + alias: 'Umb.EntityItemRef.MemberTypePropertyType', + name: 'Member Type Property Type Entity Item Reference', + element: () => import('./member-type-property-type-item-ref.element.js'), + forEntityTypes: [UMB_MEMBER_TYPE_PROPERTY_TYPE_ENTITY_TYPE], + }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-item-ref.element.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-item-ref.element.ts new file mode 100644 index 000000000000..e55489b82a60 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-type/property-type/member-type-property-type-item-ref.element.ts @@ -0,0 +1,80 @@ +import { UMB_MEMBER_TYPE_ENTITY_TYPE } from '../entity.js'; +import { UMB_EDIT_MEMBER_TYPE_WORKSPACE_PATH_PATTERN } from '../paths.js'; +import type { UmbMemberTypePropertyTypeReferenceModel } from './types.js'; +import { customElement, html, ifDefined, nothing, property, state } from '@umbraco-cms/backoffice/external/lit'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; +import { UMB_WORKSPACE_MODAL } from '@umbraco-cms/backoffice/workspace'; + +@customElement('umb-member-type-property-type-item-ref') +export class UmbMemberTypePropertyTypeItemRefElement extends UmbLitElement { + @property({ type: Object }) + item?: UmbMemberTypePropertyTypeReferenceModel; + + @property({ type: Boolean }) + readonly = false; + + @property({ type: Boolean }) + standalone = false; + + @state() + _editPath = ''; + + constructor() { + super(); + + new UmbModalRouteRegistrationController(this, UMB_WORKSPACE_MODAL) + .addUniquePaths(['unique']) + .onSetup(() => { + return { data: { entityType: UMB_MEMBER_TYPE_ENTITY_TYPE, preset: {} } }; + }) + .observeRouteBuilder((routeBuilder) => { + this._editPath = routeBuilder({}); + }); + } + + #getHref() { + if (!this.item?.unique) return; + const path = UMB_EDIT_MEMBER_TYPE_WORKSPACE_PATH_PATTERN.generateLocal({ unique: this.item.memberType.unique }); + return `${this._editPath}/${path}`; + } + + #getName() { + const memberTypeName = this.item?.memberType.name ?? 'Unknown'; + return `Member Type: ${memberTypeName}`; + } + + #getDetail() { + const propertyTypeDetails = this.item?.name ? this.item.name + ' (' + this.item.alias + ')' : 'Unknown'; + return `Property Type: ${propertyTypeDetails}`; + } + + override render() { + if (!this.item) return nothing; + + return html` + + + ${this.#renderIcon()} + + `; + } + + #renderIcon() { + if (!this.item?.memberType.icon) return nothing; + return html``; + } +} + +export { UmbMemberTypePropertyTypeItemRefElement as element }; + +declare global { + interface HTMLElementTagNameMap { + 'umb-member-type-property-type-item-ref': UmbMemberTypePropertyTypeItemRefElement; + } +} From bd910b86f45db5d45ecfec4819c38316f3e8756c Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 2 Apr 2025 12:00:02 +0200 Subject: [PATCH 18/36] register media type property type ref --- .../media-types/property-type/manifests.ts | 8 ++ ...dia-type-property-type-item-ref.element.ts | 80 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/media-type-property-type-item-ref.element.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/manifests.ts index 076db92b10e5..c554695c5004 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/manifests.ts @@ -1,3 +1,4 @@ +import { UMB_MEDIA_TYPE_PROPERTY_TYPE_ENTITY_TYPE } from './entity.js'; import { UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS } from '@umbraco-cms/backoffice/repository'; export const manifests: Array = [ @@ -9,4 +10,11 @@ export const manifests: Array = [ forDataSource: UMB_MANAGEMENT_API_DATA_SOURCE_ALIAS, forDataModel: 'MediaTypePropertyReferenceResponseModel', }, + { + type: 'entityItemRef', + alias: 'Umb.EntityItemRef.MediaTypePropertyType', + name: 'Media Type Property Type Entity Item Reference', + element: () => import('./media-type-property-type-item-ref.element.js'), + forEntityTypes: [UMB_MEDIA_TYPE_PROPERTY_TYPE_ENTITY_TYPE], + }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/media-type-property-type-item-ref.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/media-type-property-type-item-ref.element.ts new file mode 100644 index 000000000000..76bb1176a5b3 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/property-type/media-type-property-type-item-ref.element.ts @@ -0,0 +1,80 @@ +import { UMB_MEDIA_TYPE_ENTITY_TYPE } from '../entity.js'; +import { UMB_EDIT_MEDIA_TYPE_WORKSPACE_PATH_PATTERN } from '../paths.js'; +import type { UmbMediaTypePropertyTypeReferenceModel } from './types.js'; +import { customElement, html, ifDefined, nothing, property, state } from '@umbraco-cms/backoffice/external/lit'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; +import { UMB_WORKSPACE_MODAL } from '@umbraco-cms/backoffice/workspace'; + +@customElement('umb-media-type-property-type-item-ref') +export class UmbMediaTypePropertyTypeItemRefElement extends UmbLitElement { + @property({ type: Object }) + item?: UmbMediaTypePropertyTypeReferenceModel; + + @property({ type: Boolean }) + readonly = false; + + @property({ type: Boolean }) + standalone = false; + + @state() + _editPath = ''; + + constructor() { + super(); + + new UmbModalRouteRegistrationController(this, UMB_WORKSPACE_MODAL) + .addUniquePaths(['unique']) + .onSetup(() => { + return { data: { entityType: UMB_MEDIA_TYPE_ENTITY_TYPE, preset: {} } }; + }) + .observeRouteBuilder((routeBuilder) => { + this._editPath = routeBuilder({}); + }); + } + + #getHref() { + if (!this.item?.unique) return; + const path = UMB_EDIT_MEDIA_TYPE_WORKSPACE_PATH_PATTERN.generateLocal({ unique: this.item.mediaType.unique }); + return `${this._editPath}/${path}`; + } + + #getName() { + const mediaTypeName = this.item?.mediaType.name ?? 'Unknown'; + return `Media Type: ${mediaTypeName}`; + } + + #getDetail() { + const propertyTypeDetails = this.item?.name ? this.item.name + ' (' + this.item.alias + ')' : 'Unknown'; + return `Property Type: ${propertyTypeDetails}`; + } + + override render() { + if (!this.item) return nothing; + + return html` + + + ${this.#renderIcon()} + + `; + } + + #renderIcon() { + if (!this.item?.mediaType.icon) return nothing; + return html``; + } +} + +export { UmbMediaTypePropertyTypeItemRefElement as element }; + +declare global { + interface HTMLElementTagNameMap { + 'umb-media-type-property-type-item-ref': UmbMediaTypePropertyTypeItemRefElement; + } +} From 2007ee5893bdffab2cfc2b70c99e44649bd6718a Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 2 Apr 2025 12:20:12 +0200 Subject: [PATCH 19/36] Renamed model and constants from code review feedback. --- .../Factories/RelationTypePresentationFactory.cs | 6 +++--- .../TrackedReferenceViewModelsMapDefinition.cs | 12 ++++++------ ...ContentTypePropertyTypeReferenceResponseModel.cs} | 2 +- ...ocumentTypePropertyTypeReferenceResponseModel.cs} | 2 +- ...> MediaTypePropertyTypeReferenceResponseModel.cs} | 2 +- ... MemberTypePropertyTypeReferenceResponseModel.cs} | 2 +- src/Umbraco.Core/Constants-ReferenceTypes.cs | 6 +++--- src/Umbraco.Core/Services/DataTypeService.cs | 6 +++--- 8 files changed, 19 insertions(+), 19 deletions(-) rename src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/{ContentTypeReferenceResponseModel.cs => ContentTypePropertyTypeReferenceResponseModel.cs} (54%) rename src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/{DocumentTypePropertyReferenceResponseModel.cs => DocumentTypePropertyTypeReferenceResponseModel.cs} (57%) rename src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/{MediaTypePropertyReferenceResponseModel.cs => MediaTypePropertyTypeReferenceResponseModel.cs} (57%) rename src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/{MemberTypePropertyReferenceResponseModel.cs => MemberTypePropertyTypeReferenceResponseModel.cs} (57%) diff --git a/src/Umbraco.Cms.Api.Management/Factories/RelationTypePresentationFactory.cs b/src/Umbraco.Cms.Api.Management/Factories/RelationTypePresentationFactory.cs index 8fc2309b0f21..40bcf9f04c16 100644 --- a/src/Umbraco.Cms.Api.Management/Factories/RelationTypePresentationFactory.cs +++ b/src/Umbraco.Cms.Api.Management/Factories/RelationTypePresentationFactory.cs @@ -59,9 +59,9 @@ public async Task> CreateReferenceResponseM Constants.ReferenceType.Document => MapDocumentReference(relationItemModel, slimEntities), Constants.ReferenceType.Media => _umbracoMapper.Map(relationItemModel), Constants.ReferenceType.Member => _umbracoMapper.Map(relationItemModel), - Constants.ReferenceType.DocumentTypeProperty => _umbracoMapper.Map(relationItemModel), - Constants.ReferenceType.MediaTypeProperty => _umbracoMapper.Map(relationItemModel), - Constants.ReferenceType.MemberTypeProperty => _umbracoMapper.Map(relationItemModel), + Constants.ReferenceType.DocumentTypePropertyType => _umbracoMapper.Map(relationItemModel), + Constants.ReferenceType.MediaTypePropertyType => _umbracoMapper.Map(relationItemModel), + Constants.ReferenceType.MemberTypePropertyType => _umbracoMapper.Map(relationItemModel), _ => _umbracoMapper.Map(relationItemModel), }).WhereNotNull().ToArray(); diff --git a/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs b/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs index da9b08844976..c4efca308829 100644 --- a/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs +++ b/src/Umbraco.Cms.Api.Management/Mapping/TrackedReferences/TrackedReferenceViewModelsMapDefinition.cs @@ -12,9 +12,9 @@ public void DefineMaps(IUmbracoMapper mapper) mapper.Define((source, context) => new DocumentReferenceResponseModel(), Map); mapper.Define((source, context) => new MediaReferenceResponseModel(), Map); mapper.Define((source, context) => new MemberReferenceResponseModel(), Map); - mapper.Define((source, context) => new DocumentTypePropertyReferenceResponseModel(), Map); - mapper.Define((source, context) => new MediaTypePropertyReferenceResponseModel(), Map); - mapper.Define((source, context) => new MemberTypePropertyReferenceResponseModel(), Map); + mapper.Define((source, context) => new DocumentTypePropertyTypeReferenceResponseModel(), Map); + mapper.Define((source, context) => new MediaTypePropertyTypeReferenceResponseModel(), Map); + mapper.Define((source, context) => new MemberTypePropertyTypeReferenceResponseModel(), Map); mapper.Define((source, context) => new DefaultReferenceResponseModel(), Map); mapper.Define((source, context) => new ReferenceByIdModel(), Map); mapper.Define((source, context) => new ReferenceByIdModel(), Map); @@ -64,7 +64,7 @@ private void Map(RelationItemModel source, MemberReferenceResponseModel target, } // Umbraco.Code.MapAll - private void Map(RelationItemModel source, DocumentTypePropertyReferenceResponseModel target, MapperContext context) + private void Map(RelationItemModel source, DocumentTypePropertyTypeReferenceResponseModel target, MapperContext context) { target.Id = source.NodeKey; target.Name = source.NodeName; @@ -79,7 +79,7 @@ private void Map(RelationItemModel source, DocumentTypePropertyReferenceResponse } // Umbraco.Code.MapAll - private void Map(RelationItemModel source, MediaTypePropertyReferenceResponseModel target, MapperContext context) + private void Map(RelationItemModel source, MediaTypePropertyTypeReferenceResponseModel target, MapperContext context) { target.Id = source.NodeKey; target.Name = source.NodeName; @@ -94,7 +94,7 @@ private void Map(RelationItemModel source, MediaTypePropertyReferenceResponseMod } // Umbraco.Code.MapAll - private void Map(RelationItemModel source, MemberTypePropertyReferenceResponseModel target, MapperContext context) + private void Map(RelationItemModel source, MemberTypePropertyTypeReferenceResponseModel target, MapperContext context) { target.Id = source.NodeKey; target.Name = source.NodeName; diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypeReferenceResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypePropertyTypeReferenceResponseModel.cs similarity index 54% rename from src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypeReferenceResponseModel.cs rename to src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypePropertyTypeReferenceResponseModel.cs index f13cf28ccdbb..83dc6a1a7a5f 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypeReferenceResponseModel.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/ContentTypePropertyTypeReferenceResponseModel.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; -public abstract class ContentTypePropertyReferenceResponseModel : ReferenceResponseModel +public abstract class ContentTypePropertyTypeReferenceResponseModel : ReferenceResponseModel { public string? Alias { get; set; } } diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyReferenceResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyTypeReferenceResponseModel.cs similarity index 57% rename from src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyReferenceResponseModel.cs rename to src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyTypeReferenceResponseModel.cs index 00cca40bdef3..b2ef3e4a0ad2 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyReferenceResponseModel.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/DocumentTypePropertyTypeReferenceResponseModel.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; -public class DocumentTypePropertyReferenceResponseModel : ContentTypePropertyReferenceResponseModel +public class DocumentTypePropertyTypeReferenceResponseModel : ContentTypePropertyTypeReferenceResponseModel { public TrackedReferenceDocumentType DocumentType { get; set; } = new(); } diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyReferenceResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyTypeReferenceResponseModel.cs similarity index 57% rename from src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyReferenceResponseModel.cs rename to src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyTypeReferenceResponseModel.cs index 7c14cec50d1f..1baf6476545f 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyReferenceResponseModel.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MediaTypePropertyTypeReferenceResponseModel.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; -public class MediaTypePropertyReferenceResponseModel : ContentTypePropertyReferenceResponseModel +public class MediaTypePropertyTypeReferenceResponseModel : ContentTypePropertyTypeReferenceResponseModel { public TrackedReferenceMediaType MediaType { get; set; } = new(); } diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyReferenceResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyTypeReferenceResponseModel.cs similarity index 57% rename from src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyReferenceResponseModel.cs rename to src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyTypeReferenceResponseModel.cs index 423309bf00dd..199a4b0ba18d 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyReferenceResponseModel.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/TrackedReferences/MemberTypePropertyTypeReferenceResponseModel.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Api.Management.ViewModels.TrackedReferences; -public class MemberTypePropertyReferenceResponseModel : ContentTypePropertyReferenceResponseModel +public class MemberTypePropertyTypeReferenceResponseModel : ContentTypePropertyTypeReferenceResponseModel { public TrackedReferenceMemberType MemberType { get; set; } = new(); } diff --git a/src/Umbraco.Core/Constants-ReferenceTypes.cs b/src/Umbraco.Core/Constants-ReferenceTypes.cs index c76de94733bc..b006a0d59007 100644 --- a/src/Umbraco.Core/Constants-ReferenceTypes.cs +++ b/src/Umbraco.Core/Constants-ReferenceTypes.cs @@ -18,8 +18,8 @@ public static class ReferenceType public const string Document = UdiEntityType.Document; public const string Media = UdiEntityType.Media; public const string Member = UdiEntityType.Member; - public const string DocumentTypeProperty = "document-type-property"; - public const string MediaTypeProperty = "media-type-property"; - public const string MemberTypeProperty = "member-type-property"; + public const string DocumentTypePropertyType = "document-type-property-type"; + public const string MediaTypePropertyType = "media-type-property-type"; + public const string MemberTypePropertyType = "member-type-property-type"; } } diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs index 89b24732d788..4420fa8d9a96 100644 --- a/src/Umbraco.Core/Services/DataTypeService.cs +++ b/src/Umbraco.Core/Services/DataTypeService.cs @@ -789,9 +789,9 @@ public Task> GetPagedRelationsAsync(Guid key, int string nodeType = x.Udi.EntityType switch { - Constants.UdiEntityType.DocumentType => Constants.ReferenceType.DocumentTypeProperty, - Constants.UdiEntityType.MediaType => Constants.ReferenceType.MediaTypeProperty, - Constants.UdiEntityType.MemberType => Constants.ReferenceType.MemberTypeProperty, + Constants.UdiEntityType.DocumentType => Constants.ReferenceType.DocumentTypePropertyType, + Constants.UdiEntityType.MediaType => Constants.ReferenceType.MediaTypePropertyType, + Constants.UdiEntityType.MemberType => Constants.ReferenceType.MemberTypePropertyType, _ => throw new ArgumentOutOfRangeException(nameof(x.Udi.EntityType)), }; From 7174a39c4cd2a610d9170e0b112293b43665b61e Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 2 Apr 2025 13:11:32 +0200 Subject: [PATCH 20/36] register reference workspace info app kind --- .../data-type/reference/info-app/manifests.ts | 7 ++- .../packages/relations/relations/manifests.ts | 2 + ...-references-workspace-view-info.element.ts | 54 ++++++++++++++----- ...ity-references-workspace-view-info.kind.ts | 14 +++++ .../reference/workspace-info-app/manifests.ts | 5 ++ .../reference/workspace-info-app/types.ts | 17 ++++++ 6 files changed, 83 insertions(+), 16 deletions(-) rename src/Umbraco.Web.UI.Client/src/packages/{data-type/reference/info-app => relations/relations/reference/workspace-info-app}/entity-references-workspace-view-info.element.ts (69%) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/relations/relations/reference/workspace-info-app/entity-references-workspace-view-info.kind.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/relations/relations/reference/workspace-info-app/manifests.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/relations/relations/reference/workspace-info-app/types.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/manifests.ts index de4605183f7a..aceb9124a20e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/manifests.ts @@ -1,18 +1,21 @@ import { UMB_DATA_TYPE_WORKSPACE_ALIAS } from '../../workspace/constants.js'; +import { UMB_DATA_TYPE_REFERENCE_REPOSITORY_ALIAS } from '../constants.js'; import { UMB_WORKSPACE_CONDITION_ALIAS } from '@umbraco-cms/backoffice/workspace'; export const manifests: Array = [ { type: 'workspaceInfoApp', + kind: 'entityReferences', name: 'Data Type References Workspace Info App', alias: 'Umb.WorkspaceInfoApp.DataType.References', - element: () => import('./entity-references-workspace-view-info.element.js'), - weight: 90, conditions: [ { alias: UMB_WORKSPACE_CONDITION_ALIAS, match: UMB_DATA_TYPE_WORKSPACE_ALIAS, }, ], + meta: { + referenceRepositoryAlias: UMB_DATA_TYPE_REFERENCE_REPOSITORY_ALIAS, + }, }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/relations/relations/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/relations/relations/manifests.ts index fceac92145e1..1d63998360b2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/relations/relations/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/relations/relations/manifests.ts @@ -3,6 +3,7 @@ import { manifests as bulkTrashManifests } from './entity-actions/bulk-trash/man import { manifests as collectionManifests } from './collection/manifests.js'; import { manifests as deleteManifests } from './entity-actions/delete/manifests.js'; import { manifests as trashManifests } from './entity-actions/trash/manifests.js'; +import { manifests as workspaceInfoAppManifests } from './reference/workspace-info-app/manifests.js'; import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry'; export const manifests: Array = [ @@ -11,4 +12,5 @@ export const manifests: Array = ...collectionManifests, ...deleteManifests, ...trashManifests, + ...workspaceInfoAppManifests, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts b/src/Umbraco.Web.UI.Client/src/packages/relations/relations/reference/workspace-info-app/entity-references-workspace-view-info.element.ts similarity index 69% rename from src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts rename to src/Umbraco.Web.UI.Client/src/packages/relations/relations/reference/workspace-info-app/entity-references-workspace-view-info.element.ts index 4afc5b7ed580..89a1bbaf4d36 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/data-type/reference/info-app/entity-references-workspace-view-info.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/relations/relations/reference/workspace-info-app/entity-references-workspace-view-info.element.ts @@ -1,14 +1,25 @@ -import { UmbDataTypeReferenceRepository } from '../repository/index.js'; -import { css, customElement, html, nothing, repeat, state } from '@umbraco-cms/backoffice/external/lit'; +import type { UmbEntityReferenceRepository, UmbReferenceItemModel } from '../types.js'; +import type { ManifestWorkspaceInfoAppEntityReferencesKind } from './types.js'; +import { css, customElement, html, nothing, property, repeat, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbReferenceItemModel } from '@umbraco-cms/backoffice/relations'; import type { UUIPaginationEvent } from '@umbraco-cms/backoffice/external/uui'; import type { UmbEntityUnique } from '@umbraco-cms/backoffice/entity'; import { UMB_ENTITY_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace'; +import { createExtensionApiByAlias } from '@umbraco-cms/backoffice/extension-registry'; @customElement('umb-entity-references-workspace-info-app') export class UmbEntityReferencesWorkspaceInfoAppElement extends UmbLitElement { + @property({ type: Object }) + private _manifest?: ManifestWorkspaceInfoAppEntityReferencesKind | undefined; + public get manifest(): ManifestWorkspaceInfoAppEntityReferencesKind | undefined { + return this._manifest; + } + public set manifest(value: ManifestWorkspaceInfoAppEntityReferencesKind | undefined) { + this._manifest = value; + this.#init(); + } + @state() private _currentPage = 1; @@ -19,7 +30,7 @@ export class UmbEntityReferencesWorkspaceInfoAppElement extends UmbLitElement { private _items?: Array = []; #itemsPerPage = 10; - #referenceRepository = new UmbDataTypeReferenceRepository(this); + #referenceRepository?: UmbEntityReferenceRepository; #unique?: UmbEntityUnique; #workspaceContext?: typeof UMB_ENTITY_WORKSPACE_CONTEXT.TYPE; @@ -32,6 +43,22 @@ export class UmbEntityReferencesWorkspaceInfoAppElement extends UmbLitElement { }); } + async #init() { + if (!this._manifest) return; + const referenceRepositoryAlias = this._manifest.meta.referenceRepositoryAlias; + + if (!referenceRepositoryAlias) { + throw new Error('Reference repository alias is required'); + } + + this.#referenceRepository = await createExtensionApiByAlias( + this, + referenceRepositoryAlias, + ); + + this.#getReferences(); + } + #observeUnique() { this.observe( this.#workspaceContext?.unique, @@ -54,9 +81,8 @@ export class UmbEntityReferencesWorkspaceInfoAppElement extends UmbLitElement { } async #getReferences() { - if (!this.#unique) { - throw new Error('Data Type unique is required'); - } + if (!this.#unique) return; + if (!this.#referenceRepository) return; const { data } = await this.#referenceRepository.requestReferencedBy( this.#unique, @@ -105,7 +131,7 @@ export class UmbEntityReferencesWorkspaceInfoAppElement extends UmbLitElement { if (totalPages <= 1) return nothing; return html` -