Implement XAiMcpServer Stuffs ...
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using xAiModels.Constants;
|
||||
using xDataService.Providers;
|
||||
using xAiModels.Models.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace xAiModels.Configurations.Entities
|
||||
{
|
||||
public class XAiMcpServerEntityConfiguration : XBaseEntityTypeConfiguration<XAiMcpServer, Guid>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<XAiMcpServer> builder)
|
||||
{
|
||||
builder.ToTable(XAiModelsConstants.XAiMcpServerTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,10 @@ namespace xAiModels.Configurations
|
||||
// XAiProject ...
|
||||
CreateMap<XAiProject, XAiProjectDto>();
|
||||
|
||||
//
|
||||
CreateMap<XAiMcpServer, XAiMcpServerDto>();
|
||||
CreateMap<XAiMcpServerDto, XAiMcpServer>();
|
||||
|
||||
//
|
||||
// XAiConversation ...
|
||||
CreateMap<XAiConversation, XAiConversationDto>();
|
||||
|
||||
@@ -5,24 +5,27 @@ namespace xAiModels.Constants
|
||||
//
|
||||
// Service Extensions Log Tag ...
|
||||
public const string XAiModelsDILogTag = "XAiModels";
|
||||
|
||||
|
||||
//
|
||||
// Table Mapping Identifiers ...
|
||||
public const string XAiVectorTable = "AiVectors";
|
||||
public const string XAiMessageTable = "AiMessages";
|
||||
public const string XAiProjectTable = "AiProjects";
|
||||
public const string XAiMcpServerTable = "AiMcpServers";
|
||||
public const string XAiConversationTable = "AiConversations";
|
||||
|
||||
//
|
||||
// GraphQL Collection Mappings ...
|
||||
public const string XAiMessageSingleName = "aiMessage";
|
||||
public const string XAiProjectSingleName = "aiProject";
|
||||
public const string XAiMcpServerSingleName = "aiMcpServer";
|
||||
public const string XAiConversationSignleName = "aiConversation";
|
||||
|
||||
public const string XAiMessageCollectionName = "aiMessages";
|
||||
public const string XAiProjectCollectionName = "AiProjectsa";
|
||||
public const string XAiMcpServerCollectionName = "aiMcpServers";
|
||||
public const string XAiConversationCollectionName = "aiConversations";
|
||||
|
||||
|
||||
public const string XAiVectorSingleName = "aiVector";
|
||||
public const string XAiVectorCollectionName = "aiVectors";
|
||||
|
||||
@@ -34,6 +37,9 @@ namespace xAiModels.Constants
|
||||
public const string XAiProjectDtoHub = "aiProjectDto";
|
||||
public const string XAiProjectEntityHub = "aiProjectEntity";
|
||||
|
||||
public const string XAiMcpServerDtoHub = "aiMcpServerDto";
|
||||
public const string XAiMcpServerEntityHub = "aiMcpServerEntity";
|
||||
|
||||
public const string XAiConversationDtoHub = "aiConversationDto";
|
||||
public const string XAiConversationEntityHub = "aiConversationEntity";
|
||||
|
||||
@@ -48,18 +54,19 @@ namespace xAiModels.Constants
|
||||
|
||||
//
|
||||
// EF Repositories Helper Extensions ...
|
||||
public const string GetXAiVectorEFRepositoryDescriptor = "GetXAiVectorEFRepositoryDescriptor";
|
||||
public const string GetXAiMessageEFRepositoryDescriptor = "GetXAiMessageEFRepositoryDescriptor";
|
||||
public const string GetXAiProjectEFRepositoryDescriptor = "GetXAiProjectEFRepositoryDescriptor";
|
||||
public const string GetXAiMcpServerEFRepositoryDescriptor = "GetXAiMcpServerEFRepositoryDescriptor";
|
||||
public const string GetXAiConversationEFRepositoryDescriptor = "GetXAiConversationEFRepositoryDescriptor";
|
||||
public const string GetXAiVectorEFRepositoryDescriptor = "GetXAiVectorEFRepositoryDescriptor";
|
||||
|
||||
//
|
||||
public const string DefaultXAiProjectTitleResourceID = "XAiPrjT";
|
||||
public const string DefaultXAiConversationTitleResourceID = "XAiCnvT";
|
||||
public const string DefaultXAiProjectDescriptionResourceID = "XAiPrjD";
|
||||
public const string DefaultXAiProjectTitleResourceID = "XAiPrjT";
|
||||
public const string DefaultXAiConversationTitleResourceID = "XAiCnvT";
|
||||
public const string DefaultXAiProjectDescriptionResourceID = "XAiPrjD";
|
||||
|
||||
//
|
||||
public const string XOpenAINoKey = "no-key-required";
|
||||
public const string XOpenAINoKey = "no-key-required";
|
||||
|
||||
//
|
||||
// Knowledge (Persistent RAG) ...
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xPushService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
|
||||
namespace xAiModels.Interfaces.Dtos
|
||||
{
|
||||
public interface IXAiMcpServerDtoHub : IXBaseDtoHub<XAiMcpServer, XAiMcpServerDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xDataService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
|
||||
namespace xAiModels.Interfaces.Dtos
|
||||
{
|
||||
public interface IXAiMcpServerRepositoryService : IXBaseRepositoryService<XAiMcpServer, XAiMcpServerDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xPushService.Interfaces;
|
||||
using xAiModels.Providers.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
|
||||
namespace xAiModels.Interfaces.Dtos
|
||||
{
|
||||
public interface IXAiMcpServerServiceProvider : IXBaseDtoProvider<XAiMcpServer, XAiMcpServerDto, Guid, XAiMcpServerDtoHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xAiModels.Interfaces.Enrichers
|
||||
{
|
||||
public interface IXAiMcpServerEnricher
|
||||
{
|
||||
Task<XAiMcpServerDto> Enrich(
|
||||
XAiMcpServer source,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<XAiMcpServerDto> Enrich(
|
||||
XAiMcpServerDto source,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<IEnumerable<XAiMcpServerDto>> EnrichRange(
|
||||
IEnumerable<XAiMcpServer> sources,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<IEnumerable<XAiMcpServerDto>> EnrichRange(
|
||||
IEnumerable<XAiMcpServerDto> sources,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xPushService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMcpServerEntityHub : IXBaseEntityHub<XAiMcpServer, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xDataService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMcpServerGraphQLTypeHelper : IXBaseGraphQLTypeHelper<XAiMcpServer, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xDataService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMcpServerKeyGenerator : IXKeyGenerator<XAiMcpServer, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
using xDataService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMcpServerRepository : IXBaseRepository<XAiMcpServer, Guid> { }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xDataService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMcpServerRepositoryEvents : IXBaseRepositoryEvents<XAiMcpServer>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xPushService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
using xAiModels.Providers.Entities;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMcpServerRepositoryProvider : IXBaseEntityProvider<XAiMcpServer, Guid, XAiMcpServerEntityHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xAiModels.Models.Dtos
|
||||
{
|
||||
public class XAiMcpServerDto : XBaseGuidIDEntityDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Owner ...
|
||||
/// </summary>
|
||||
public string OwnerId { get; set; }
|
||||
public virtual XPersonDto Owner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MCP Server Name ...
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description ...
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enabled or Disabled ...
|
||||
/// </summary>
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Environment Variables as JSON Object ...
|
||||
/// </summary>
|
||||
public string EnvironmentVariables { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Endpoint to Connect ...
|
||||
/// </summary>
|
||||
public string Endpoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Headers List as Json Object ...
|
||||
/// </summary>
|
||||
public string Headers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timout Secconds ...
|
||||
/// </summary>
|
||||
public int TimeoutSeconds { get; set; } = 30;
|
||||
|
||||
public DateTime CreatedOn { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using xModels.Base;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace xAiModels.Models.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// An MCP Server Descriptor for Adding Tools to XAI ...
|
||||
/// </summary>
|
||||
public class XAiMcpServer : XBaseGuidIDEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Owner ...
|
||||
/// </summary>
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MCP Server Name ...
|
||||
/// </summary>
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description ...
|
||||
/// </summary>
|
||||
[StringLength(1000)]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enabled or Disabled ...
|
||||
/// </summary>
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Environment Variables as JSON Object ...
|
||||
/// </summary>
|
||||
public string EnvironmentVariables { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Endpoint to Connect ...
|
||||
/// </summary>
|
||||
[StringLength(1000)]
|
||||
public string Endpoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Headers List as Json Object ...
|
||||
/// </summary>
|
||||
public string Headers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timout Secconds ...
|
||||
/// </summary>
|
||||
public int TimeoutSeconds { get; set; } = 30;
|
||||
|
||||
public DateTime CreatedOn { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using xPushService.Base;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Interfaces.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace xAiModels.Providers.Dtos
|
||||
{
|
||||
public class XAiMcpServerDtoHub : XBaseDtoHub<XAiMcpServer, XAiMcpServerDto, Guid>, IXAiMcpServerDtoHub
|
||||
{
|
||||
public XAiMcpServerDtoHub(
|
||||
ILogger<XAiMcpServerDtoHub> logger
|
||||
) : base(logger)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xDataService.Providers;
|
||||
using xAiModels.Configurations;
|
||||
using xAiModels.Interfaces.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
using xAiModels.Interfaces.Enrichers;
|
||||
|
||||
namespace xAiModels.Providers.Dtos
|
||||
{
|
||||
public class XAiMcpServerRepositoryService : XBaseRepositoryService<XAiMcpServer, XAiMcpServerDto, Guid>, IXAiMcpServerRepositoryService
|
||||
{
|
||||
private readonly IXAiMcpServerEnricher enricher;
|
||||
private readonly IXAiMcpServerRepository repository;
|
||||
|
||||
public XAiMcpServerRepositoryService(
|
||||
IXAiMcpServerRepository repository,
|
||||
IXAiMcpServerEnricher enricher
|
||||
) : base(repository, mapperProfiles: [new XAiModelMappersProfile()])
|
||||
{
|
||||
this.enricher = enricher;
|
||||
this.repository = repository;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using xPushService.Base;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Interfaces.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace xAiModels.Providers.Dtos
|
||||
{
|
||||
public class XAiMcpServerServiceProvider : XBaseDtoProvider<XAiMcpServer, XAiMcpServerDto, Guid, XAiMcpServerDtoHub>, IXAiMcpServerServiceProvider
|
||||
{
|
||||
public XAiMcpServerServiceProvider(
|
||||
IHubContext<XAiMcpServerDtoHub> hub,
|
||||
XDataServiceConfiguration dataConfiguration,
|
||||
IXAiMcpServerRepositoryService service,
|
||||
IXIdentityProvider identityProvider = null
|
||||
) : base(hub, dataConfiguration, service, identityProvider)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System.Linq;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using xAiModels.Models.Dtos;
|
||||
using System.Threading.Tasks;
|
||||
using xAiModels.Models.Entities;
|
||||
using System.Collections.Generic;
|
||||
using xIdentityService.Interfaces;
|
||||
using xAiModels.Interfaces.Enrichers;
|
||||
|
||||
namespace xAiModels.Providers.Enrichers
|
||||
{
|
||||
public class XAiMcpServerEnricher : IXAiMcpServerEnricher
|
||||
{
|
||||
private readonly IXPersonService personService;
|
||||
|
||||
public XAiMcpServerEnricher(
|
||||
IXPersonService personService
|
||||
)
|
||||
{
|
||||
this.personService = personService;
|
||||
}
|
||||
|
||||
public virtual async Task<XAiMcpServerDto> Enrich(
|
||||
XAiMcpServer source,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var result = source.MapConvert<XAiMcpServerDto, XAiMcpServer>();
|
||||
result = await Enrich(
|
||||
source: result,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual async Task<XAiMcpServerDto> Enrich(
|
||||
XAiMcpServerDto source,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
XPersonDto owner = null;
|
||||
if (!source.OwnerId.IsNullOrEmpty())
|
||||
{
|
||||
owner = await personService.GetPerson(source.OwnerId);
|
||||
}
|
||||
|
||||
//
|
||||
var result = source.MapConvert<XAiMcpServerDto, XAiMcpServerDto>();
|
||||
result.Owner = owner;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual async Task<IEnumerable<XAiMcpServerDto>> EnrichRange(
|
||||
IEnumerable<XAiMcpServer> sources,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var tasks = sources.Select(x => Enrich(x, cancellationToken));
|
||||
return await Task.WhenAll(tasks);
|
||||
}
|
||||
|
||||
public virtual async Task<IEnumerable<XAiMcpServerDto>> EnrichRange(
|
||||
IEnumerable<XAiMcpServerDto> sources,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var tasks = sources.Select(x => Enrich(x, cancellationToken));
|
||||
return await Task.WhenAll(tasks);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using xDataService.Db;
|
||||
using xDataService.Providers;
|
||||
using xDataService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiMcpServerEFRepository<TContext> : XBaseEFRepository<XAiMcpServer, Guid, TContext>, IXAiMcpServerRepository
|
||||
where TContext : XDbContext
|
||||
{
|
||||
public XAiMcpServerEFRepository(
|
||||
IXUnitOfWorks<TContext> unitOfWorks,
|
||||
XDataServiceConfiguration configuration,
|
||||
IXAiMcpServerKeyGenerator keyGenerator = null,
|
||||
IXAiMcpServerRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(unitOfWorks, configuration, keyGenerator, baseRepositoryEvents)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using xPushService.Base;
|
||||
using xAiModels.Models.Entities;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiMcpServerEntityHub : XBaseEntityHub<XAiMcpServer, Guid>, IXAiMcpServerEntityHub
|
||||
{
|
||||
public XAiMcpServerEntityHub(
|
||||
ILogger<XAiMcpServerEntityHub> logger
|
||||
) : base(logger)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using xDataService.Providers;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiMcpServerInMemoryRepository : XBaseInMemoryRepository<XAiMcpServer, Guid>, IXAiMcpServerRepository
|
||||
{
|
||||
public XAiMcpServerInMemoryRepository(
|
||||
XDataServiceConfiguration configuration,
|
||||
IXAiMcpServerKeyGenerator keyGenerator = null,
|
||||
IXAiMcpServerRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(configuration, keyGenerator, baseRepositoryEvents)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xDataService.Providers;
|
||||
using xAiModels.Models.Entities;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiMcpServerKeyGenerator : XGuidKeyGenerator<XAiMcpServer>, IXAiMcpServerKeyGenerator
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiMcpServerMongoRepository : XBaseMongoRepository<XAiMcpServer, Guid>, IXAiMcpServerRepository
|
||||
{
|
||||
public XAiMcpServerMongoRepository(
|
||||
XDataBaseConfiguration dbConfiguration,
|
||||
XDataServiceConfiguration configuration,
|
||||
string collectionName = null,
|
||||
IXAiMcpServerKeyGenerator keyGenerator = null,
|
||||
IXAiMcpServerRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(dbConfiguration, configuration, collectionName, keyGenerator, baseRepositoryEvents)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xDataService.Providers;
|
||||
using xAiModels.Models.Entities;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiMcpServerRepositoryEvents : XBaseRepositoryEvents<XAiMcpServer>, IXAiMcpServerRepositoryEvents
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using xPushService.Base;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiMcpServerRepositoryProvider : XBaseEntityProvider<XAiMcpServer, Guid, XAiMcpServerEntityHub>, IXAiMcpServerRepositoryProvider
|
||||
{
|
||||
public XAiMcpServerRepositoryProvider(
|
||||
IHubContext<XAiMcpServerEntityHub> hub,
|
||||
IXAiMcpServerRepository repository,
|
||||
XDataServiceConfiguration dataConfiguration,
|
||||
IXIdentityProvider identityProvider = null
|
||||
) : base(hub, repository, dataConfiguration, identityProvider)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using xAiModels.Constants;
|
||||
using xDataService.GraphQL;
|
||||
using xAiModels.Models.Entities;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
|
||||
namespace xAiModels.Providers.GraphQL
|
||||
{
|
||||
public class XAiMcpServerGraphQLTypeHelper : XBaseGraphQLTypeHelper<XAiMcpServer, Guid>, IXAiMcpServerGraphQLTypeHelper
|
||||
{
|
||||
public override string GetInQueryCollectionName()
|
||||
{
|
||||
return XAiModelsConstants.XAiMcpServerCollectionName;
|
||||
}
|
||||
|
||||
public override string GetInQuerySingleName()
|
||||
{
|
||||
return XAiModelsConstants.XAiMcpServerSingleName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using GraphQL.Types;
|
||||
using xDataService.GraphQL;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
|
||||
namespace xAiModels.Providers.GraphQL
|
||||
{
|
||||
public class XAiMcpServerGraphQuery : XBaseGraphQLQuery<XAiMcpServer, Guid, XAiMcpServerGraphType, GuidGraphType>
|
||||
{
|
||||
public XAiMcpServerGraphQuery(
|
||||
XDataServiceConfiguration configuration,
|
||||
IXAiMcpServerRepository repository,
|
||||
IXAiMcpServerGraphQLTypeHelper helper
|
||||
) : base(
|
||||
configuration,
|
||||
repository,
|
||||
helper
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using GraphQL.Types;
|
||||
|
||||
namespace xAiModels.Providers.GraphQL
|
||||
{
|
||||
public class XAiMcpServerGraphSchema : Schema
|
||||
{
|
||||
public XAiMcpServerGraphSchema(IServiceProvider services) : base(services)
|
||||
{
|
||||
Query = (XAiMcpServerGraphQuery)services.GetService(typeof(XAiMcpServerGraphQuery));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using xDataService.GraphQL;
|
||||
using xAiModels.Models.Entities;
|
||||
|
||||
namespace xAiModels.Providers.GraphQL
|
||||
{
|
||||
public class XAiMcpServerGraphType: XBaseGraphObjectType<XAiMcpServer, Guid>
|
||||
{
|
||||
public XAiMcpServerGraphType() : base()
|
||||
{
|
||||
Field(x => x.Name);
|
||||
Field(x => x.Enabled);
|
||||
Field(x => x.OwnerId);
|
||||
Field(x => x.Headers);
|
||||
Field(x => x.Endpoint);
|
||||
Field(x => x.CreatedOn);
|
||||
Field(x => x.UpdatedAt);
|
||||
Field(x => x.Description);
|
||||
Field(x => x.TimeoutSeconds);
|
||||
Field(x => x.EnvironmentVariables);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using xDataService.Providers;
|
||||
using xDataService.Interfaces;
|
||||
using xAiModels.Models.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xAiModels.Configurations.Entities;
|
||||
|
||||
namespace xAiModels.Providers
|
||||
{
|
||||
public class XAiMcpServerEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar
|
||||
{
|
||||
public XAiMcpServerEntityRegisterar()
|
||||
: base(nameof(XAiMcpServerEntityRegisterar))
|
||||
{
|
||||
//
|
||||
// Add Entity ...
|
||||
AddEntity<XAiMcpServer, Guid>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configure Entities ...
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder"></param>
|
||||
public override void ConfigureEntities(ModelBuilder modelBuilder)
|
||||
{
|
||||
//
|
||||
// Configure Entity Using Provided ...
|
||||
modelBuilder
|
||||
.ApplyConfigurationsFromAssembly(typeof(XAiMcpServerEntityConfiguration).Assembly);
|
||||
|
||||
//
|
||||
base.ConfigureEntities(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user