Skip to content

Commit afd7c0e

Browse files
Mikeclaude
andcommitted
feat(FRACT-710): Implement GraphQL ConnectionType ServiceType
Add complete GraphQL connection implementation following ServiceTypeOption pattern: - New project: Services.Connections.GraphQL - GraphQLConnectionConfiguration with GraphQL-specific options - GraphQLProtocol TypeOption for HttpProtocols collection - IGraphQLConnectionFactory interface - GraphQLConnectionFactory using HttpConnection internally - GraphQLConnectionType as ServiceTypeOption for ConnectionTypes - GraphQLDataCommandTranslator for query/mutation translation - GraphQLServiceLogger for connection logging GraphQL connections use POST requests with JSON payloads containing GraphQL operations, supporting queries, mutations, and basic introspection. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f10e5db commit afd7c0e

8 files changed

Lines changed: 1156 additions & 0 deletions
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<ImplicitUsings>disable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<!-- Enable generator debugging -->
8+
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
9+
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)generated</CompilerGeneratedFilesOutputPath>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<ProjectReference Include="..\FractalDataWorks.Collections.SourceGenerators\FractalDataWorks.Collections.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
14+
<ProjectReference Include="..\FractalDataWorks.Configuration.SourceGenerators\FractalDataWorks.Configuration.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="all" />
15+
<ProjectReference Include="..\FractalDataWorks.Configuration.Persistence\FractalDataWorks.Configuration.Persistence.csproj" />
16+
<ProjectReference Include="..\FractalDataWorks.MessageLogging.Abstractions\FractalDataWorks.MessageLogging.Abstractions.csproj" />
17+
<ProjectReference Include="..\FractalDataWorks.MessageLogging.SourceGenerators\FractalDataWorks.MessageLogging.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
18+
<ProjectReference Include="..\FractalDataWorks.Services.Connections.Abstractions\FractalDataWorks.Services.Connections.Abstractions.csproj" />
19+
<ProjectReference Include="..\FractalDataWorks.Services.Connections.Http.Abstractions\FractalDataWorks.Services.Connections.Http.Abstractions.csproj" />
20+
<ProjectReference Include="..\FractalDataWorks.Services.Connections.Http\FractalDataWorks.Services.Connections.Http.csproj" />
21+
<ProjectReference Include="..\FractalDataWorks.Services.Connections\FractalDataWorks.Services.Connections.csproj" />
22+
<ProjectReference Include="..\FractalDataWorks.Services\FractalDataWorks.Services.csproj" />
23+
<ProjectReference Include="..\FractalDataWorks.Services.Abstractions\FractalDataWorks.Services.Abstractions.csproj" />
24+
<ProjectReference Include="..\FractalDataWorks.Data.Abstractions\FractalDataWorks.Data.Abstractions.csproj" />
25+
<ProjectReference Include="..\FractalDataWorks.Commands.Data.Abstractions\FractalDataWorks.Commands.Data.Abstractions.csproj" />
26+
<ProjectReference Include="..\FractalDataWorks.Commands.Data\FractalDataWorks.Commands.Data.csproj" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
31+
<PackageReference Include="Microsoft.Extensions.Http" />
32+
</ItemGroup>
33+
34+
</Project>
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using FractalDataWorks.Configuration;
4+
using FractalDataWorks.Services.Abstractions;
5+
using FractalDataWorks.Services.Connections.Abstractions;
6+
7+
namespace FractalDataWorks.Services.Connections.GraphQL;
8+
9+
/// <summary>
10+
/// Configuration class for GraphQL connections.
11+
/// Provides GraphQL-specific configuration options.
12+
/// </summary>
13+
[ManagedConfiguration(
14+
Schema = "cfg",
15+
TableName = "GraphQLConnection",
16+
ServiceCategory = "Connection",
17+
ServiceType = "GraphQL")]
18+
public sealed partial class GraphQLConnectionConfiguration : ConfigurationBase<GraphQLConnectionConfiguration>, IConnectionConfiguration
19+
{
20+
/// <inheritdoc/>
21+
public override string SectionName => "GenericConnections:GraphQL";
22+
23+
/// <inheritdoc/>
24+
public string ConnectionType { get; init; } = "GraphQL";
25+
26+
/// <inheritdoc/>
27+
public IServiceLifetime Lifetime { get; init; } = ServiceLifetimes.Scoped;
28+
29+
/// <inheritdoc/>
30+
public string? SecretManagerName { get; init; }
31+
32+
/// <inheritdoc/>
33+
public string? SecretKeyName { get; init; }
34+
35+
/// <inheritdoc/>
36+
public string? AuthenticationName { get; init; }
37+
38+
/// <summary>
39+
/// Gets the base URL for the GraphQL endpoint.
40+
/// </summary>
41+
public string BaseUrl { get; init; } = string.Empty;
42+
43+
/// <summary>
44+
/// Gets the GraphQL endpoint path.
45+
/// Defaults to "/graphql".
46+
/// </summary>
47+
public string EndpointPath { get; init; } = "/graphql";
48+
49+
/// <summary>
50+
/// Gets the timeout for HTTP requests in seconds.
51+
/// </summary>
52+
public int TimeoutSeconds { get; init; } = 30;
53+
54+
/// <summary>
55+
/// Gets the default content type for GraphQL requests.
56+
/// Defaults to "application/json".
57+
/// </summary>
58+
public string ContentType { get; init; } = "application/json";
59+
60+
/// <summary>
61+
/// Gets the Accept header value for GraphQL requests.
62+
/// Defaults to "application/json".
63+
/// </summary>
64+
public string AcceptHeader { get; init; } = "application/json";
65+
66+
/// <summary>
67+
/// Gets the User-Agent header value for GraphQL requests.
68+
/// </summary>
69+
public string UserAgent { get; init; } = "FractalDataWorks-GraphQL-Client/1.0";
70+
71+
/// <summary>
72+
/// Gets additional HTTP headers to include with all requests.
73+
/// </summary>
74+
public IReadOnlyDictionary<string, string> Headers { get; init; } = new Dictionary<string, string>(StringComparer.Ordinal);
75+
76+
/// <summary>
77+
/// Gets a value indicating whether to enable introspection queries.
78+
/// Defaults to true.
79+
/// </summary>
80+
public bool EnableIntrospection { get; init; } = true;
81+
82+
/// <summary>
83+
/// Gets a value indicating whether to enable batching multiple queries.
84+
/// Defaults to false.
85+
/// </summary>
86+
public bool EnableBatching { get; init; } = false;
87+
88+
/// <summary>
89+
/// Gets the maximum batch size for batched queries.
90+
/// Defaults to 10.
91+
/// </summary>
92+
public int MaxBatchSize { get; init; } = 10;
93+
94+
/// <summary>
95+
/// Gets a value indicating whether to use GET for queries (POST for mutations).
96+
/// Defaults to false (use POST for all operations).
97+
/// </summary>
98+
public bool UseGetForQueries { get; init; } = false;
99+
100+
/// <summary>
101+
/// Gets a value indicating whether to validate SSL certificates.
102+
/// Defaults to true for security.
103+
/// </summary>
104+
public bool ValidateSslCertificate { get; init; } = true;
105+
106+
/// <summary>
107+
/// Gets the WebSocket URL for subscriptions.
108+
/// If not set, subscriptions are not supported.
109+
/// </summary>
110+
public string? WebSocketUrl { get; init; }
111+
}

0 commit comments

Comments
 (0)