-
-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Fusion 15 base project structure. (#7743)
- Loading branch information
1 parent
2493c90
commit b521e35
Showing
96 changed files
with
952 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)..\'))" /> | ||
|
||
</Project> |
50 changes: 50 additions & 0 deletions
50
src/HotChocolate/Fusion-vnext/HotChocolate.Fusion-vnext.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1718E238-A6E5-42AE-A2D6-A0580457D486}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Execution", "src\Fusion.Execution\HotChocolate.Fusion.Execution.csproj", "{1566D098-4146-4ECF-9F45-EA43D88EEAA9}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F7DA6A87-1AFE-479A-B138-96C32439ABF5}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Execution.Tests", "test\Fusion.Execution.Tests\HotChocolate.Fusion.Execution.Tests.csproj", "{51749890-1860-46CD-B872-3E790C44A876}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Composition", "src\Fusion.Composition\HotChocolate.Fusion.Composition.csproj", "{6524E2C7-12A0-4987-B146-46C077B46DC0}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Composition.Tests", "test\Fusion.Composition.Tests\HotChocolate.Fusion.Composition.Tests.csproj", "{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{1566D098-4146-4ECF-9F45-EA43D88EEAA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1566D098-4146-4ECF-9F45-EA43D88EEAA9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1566D098-4146-4ECF-9F45-EA43D88EEAA9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1566D098-4146-4ECF-9F45-EA43D88EEAA9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{51749890-1860-46CD-B872-3E790C44A876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{51749890-1860-46CD-B872-3E790C44A876}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{51749890-1860-46CD-B872-3E790C44A876}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{51749890-1860-46CD-B872-3E790C44A876}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{6524E2C7-12A0-4987-B146-46C077B46DC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6524E2C7-12A0-4987-B146-46C077B46DC0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6524E2C7-12A0-4987-B146-46C077B46DC0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6524E2C7-12A0-4987-B146-46C077B46DC0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{1566D098-4146-4ECF-9F45-EA43D88EEAA9} = {1718E238-A6E5-42AE-A2D6-A0580457D486} | ||
{51749890-1860-46CD-B872-3E790C44A876} = {F7DA6A87-1AFE-479A-B138-96C32439ABF5} | ||
{6524E2C7-12A0-4987-B146-46C077B46DC0} = {1718E238-A6E5-42AE-A2D6-A0580457D486} | ||
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9} = {F7DA6A87-1AFE-479A-B138-96C32439ABF5} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)..\'))" /> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Nullable.props', '$(MSBuildThisFileDirectory)..\'))" /> | ||
|
||
<PropertyGroup> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<NoWarn>$(NoWarn);CA1812</NoWarn> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<IsAotCompatible>true</IsAotCompatible> | ||
</PropertyGroup> | ||
|
||
</Project> |
8 changes: 8 additions & 0 deletions
8
src/HotChocolate/Fusion-vnext/src/Fusion.Composition/HotChocolate.Fusion.Composition.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>HotChocolate.Fusion.Composition.Tests</AssemblyName> | ||
<RootNamespace>HotChocolate.Composition</RootNamespace> | ||
</PropertyGroup> | ||
|
||
</Project> |
7 changes: 1 addition & 6 deletions
7
...tion/HotChocolate.Fusion.Execution.csproj → ...tion/HotChocolate.Fusion.Execution.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Planning/IOperationNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using HotChocolate.Language; | ||
|
||
namespace HotChocolate.Fusion.Planning; | ||
|
||
public interface IOperationNode | ||
{ | ||
ISyntaxNode ToSyntaxNode(); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Planning/ISelection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using HotChocolate.Fusion.Types.Collections; | ||
using HotChocolate.Language; | ||
|
||
namespace HotChocolate.Fusion.Planning; | ||
|
||
public interface ISelection : IOperationNode | ||
{ | ||
SelectionSet? SelectionSet { get; } | ||
|
||
DirectiveCollection Directives { get; } | ||
|
||
new ISelectionNode ToSyntaxNode(); | ||
} |
40 changes: 40 additions & 0 deletions
40
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Planning/InlineFragment.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using HotChocolate.Fusion.Types; | ||
using HotChocolate.Fusion.Types.Collections; | ||
using HotChocolate.Language; | ||
|
||
namespace HotChocolate.Fusion.Planning; | ||
|
||
public sealed class InlineFragment : ISelection | ||
{ | ||
public InlineFragment( | ||
ICompositeNamedType type, | ||
DirectiveCollection directives, | ||
SelectionSet selectionSet) | ||
{ | ||
Type = type; | ||
Directives = directives; | ||
SelectionSet = selectionSet; | ||
} | ||
|
||
public ICompositeNamedType Type { get; } | ||
|
||
public DirectiveCollection Directives { get; } | ||
|
||
|
||
public SelectionSet SelectionSet { get; } | ||
|
||
public InlineFragmentNode ToSyntaxNode() | ||
{ | ||
return new InlineFragmentNode( | ||
null, | ||
new NamedTypeNode(new NameNode(Type.Name)), | ||
Directives.ToSyntaxNodes(), | ||
SelectionSet.ToSyntaxNode()); | ||
} | ||
|
||
ISelectionNode ISelection.ToSyntaxNode() | ||
=> ToSyntaxNode(); | ||
|
||
ISyntaxNode IOperationNode.ToSyntaxNode() | ||
=> ToSyntaxNode(); | ||
} |
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Planning/Nodes/FieldPlanNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using HotChocolate.Fusion.Types; | ||
using HotChocolate.Language; | ||
|
||
namespace HotChocolate.Fusion.Planning; | ||
|
||
public class FieldPlanNode : SelectionPlanNode | ||
{ | ||
public FieldPlanNode( | ||
FieldNode fieldNode, | ||
CompositeOutputField field) | ||
: base(field.Type.NamedType(), fieldNode.SelectionSet?.Selections) | ||
{ | ||
FieldNode = fieldNode; | ||
Field = field; | ||
ResponseName = FieldNode.Alias?.Value ?? field.Name; | ||
} | ||
|
||
public string ResponseName { get; } | ||
|
||
public FieldNode FieldNode { get; } | ||
|
||
public CompositeOutputField Field { get; } | ||
} |
6 changes: 6 additions & 0 deletions
6
...tChocolate/Fusion-vnext/src/Fusion.Execution/Planning/Nodes/IOperationPlanNodeProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace HotChocolate.Fusion.Planning; | ||
|
||
public interface IOperationPlanNodeProvider | ||
{ | ||
public IReadOnlyList<OperationPlanNode> Operations { get; } | ||
} |
46 changes: 46 additions & 0 deletions
46
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Planning/Nodes/OperationPlanNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using HotChocolate.Fusion.Types; | ||
using HotChocolate.Language; | ||
|
||
namespace HotChocolate.Fusion.Planning; | ||
|
||
/// <summary> | ||
/// Represents an operation to resolve data from a specific source schema. | ||
/// </summary> | ||
public sealed class OperationPlanNode : SelectionPlanNode, IOperationPlanNodeProvider | ||
{ | ||
private List<OperationPlanNode>? _operations; | ||
|
||
public OperationPlanNode( | ||
string schemaName, | ||
ICompositeNamedType declaringType, | ||
SelectionSetNode selectionSet, | ||
PlanNode? parent = null) | ||
: base(declaringType, selectionSet.Selections) | ||
{ | ||
SchemaName = schemaName; | ||
Parent = parent; | ||
} | ||
|
||
public OperationPlanNode( | ||
string schemaName, | ||
ICompositeNamedType declaringType, | ||
IReadOnlyList<ISelectionNode> selections, | ||
PlanNode? parent = null) | ||
: base(declaringType, selections) | ||
{ | ||
SchemaName = schemaName; | ||
Parent = parent; | ||
} | ||
|
||
public string SchemaName { get; } | ||
|
||
public IReadOnlyList<OperationPlanNode> Operations | ||
=> _operations ?? (IReadOnlyList<OperationPlanNode>)Array.Empty<OperationPlanNode>(); | ||
|
||
public void AddOperation(OperationPlanNode operation) | ||
{ | ||
ArgumentNullException.ThrowIfNull(operation); | ||
(_operations ??= []).Add(operation); | ||
operation.Parent = this; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Planning/Nodes/PlanNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace HotChocolate.Fusion.Planning; | ||
|
||
public abstract class PlanNode | ||
{ | ||
public PlanNode? Parent { get; internal set; } | ||
} |
16 changes: 16 additions & 0 deletions
16
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Planning/Nodes/RootPlanNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace HotChocolate.Fusion.Planning; | ||
|
||
public class RootPlanNode : PlanNode, IOperationPlanNodeProvider | ||
{ | ||
private readonly List<OperationPlanNode> _operations = new(); | ||
|
||
public IReadOnlyList<OperationPlanNode> Operations | ||
=> _operations; | ||
|
||
public void AddOperation(OperationPlanNode operation) | ||
{ | ||
ArgumentNullException.ThrowIfNull(operation); | ||
_operations.Add(operation); | ||
operation.Parent = this; | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Planning/Nodes/SelectionPlanNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using HotChocolate.Fusion.Types; | ||
using HotChocolate.Language; | ||
|
||
namespace HotChocolate.Fusion.Planning; | ||
|
||
/// <summary> | ||
/// The base class for plan nodes that can have child selections. | ||
/// </summary> | ||
public abstract class SelectionPlanNode : PlanNode | ||
{ | ||
private List<CompositeDirective>? _directives; | ||
private List<SelectionPlanNode>? _selections; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of <see cref="SelectionPlanNode"/>. | ||
/// </summary> | ||
/// <param name="declaringType"> | ||
/// The type on which this selection is declared on. | ||
/// </param> | ||
/// <param name="selectionNodes"> | ||
/// The child selection syntax nodes of this selection. | ||
/// </param> | ||
protected SelectionPlanNode( | ||
ICompositeNamedType declaringType, | ||
IReadOnlyList<ISelectionNode>? selectionNodes) | ||
{ | ||
DeclaringType = declaringType; | ||
IsEntity = declaringType.IsEntity(); | ||
SelectionNodes = selectionNodes; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the type on which this selection is declared on. | ||
/// </summary> | ||
public ICompositeNamedType DeclaringType { get; } | ||
|
||
/// <summary> | ||
/// Defines if the selection is declared on an entity type. | ||
/// </summary> | ||
public bool IsEntity { get; } | ||
|
||
/// <summary> | ||
/// Gets the directives that are annotated to this selection. | ||
/// </summary> | ||
public IReadOnlyList<CompositeDirective> Directives | ||
=> _directives ?? (IReadOnlyList<CompositeDirective>)Array.Empty<CompositeDirective>(); | ||
|
||
/// <summary> | ||
/// Gets the child selection syntax nodes of this selection. | ||
/// </summary> | ||
public IReadOnlyList<ISelectionNode>? SelectionNodes { get; } | ||
|
||
/// <summary> | ||
/// Gets the child selections of this selection. | ||
/// </summary> | ||
public IReadOnlyList<SelectionPlanNode> Selections | ||
=> _selections ?? (IReadOnlyList<SelectionPlanNode>)Array.Empty<SelectionPlanNode>(); | ||
|
||
/// <summary> | ||
/// Adds a child selection to this selection. | ||
/// </summary> | ||
/// <param name="selection"> | ||
/// The child selection that shall be added. | ||
/// </param> | ||
public void AddSelection(SelectionPlanNode selection) | ||
{ | ||
ArgumentNullException.ThrowIfNull(selection); | ||
(_selections ??= []).Add(selection); | ||
selection.Parent = this; | ||
} | ||
|
||
/// <summary> | ||
/// Adds a directive to the selection. | ||
/// </summary> | ||
/// <param name="directive"> | ||
/// The directive that shall be added. | ||
/// </param> | ||
public void AddDirective(CompositeDirective directive) | ||
{ | ||
ArgumentNullException.ThrowIfNull(directive); | ||
(_directives ??= []).Add(directive); | ||
} | ||
} |
Oops, something went wrong.