forked from serverlessworkflow/synapse
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
66 changed files
with
1,836 additions
and
515 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,17 @@ | ||
using Hylo.Api.Http; | ||
using Synapse.Resources; | ||
|
||
namespace Synapse.Api.Core.Http.Controllers; | ||
|
||
/// <summary> | ||
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="WorkflowAgent"/>s | ||
/// </summary> | ||
[Route("api/core/v1/workflow-agents")] | ||
public class WorkflowAgentsController | ||
: ClusterResourceApiController<WorkflowAgent> | ||
{ | ||
|
||
/// <inheritdoc/> | ||
public WorkflowAgentsController(IMediator mediator) : base(mediator) { } | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
src/api/core/http/Controllers/WorkflowDslExtensionsController.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,17 @@ | ||
using Hylo.Api.Http; | ||
using Synapse.Resources; | ||
|
||
namespace Synapse.Api.Core.Http.Controllers; | ||
|
||
/// <summary> | ||
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="WorkflowDslExtension"/>s | ||
/// </summary> | ||
[Route("api/core/v1/workflow-dsl-extensions")] | ||
public class WorkflowDslExtensionsController | ||
: ClusterResourceApiController<WorkflowDslExtension> | ||
{ | ||
|
||
/// <inheritdoc/> | ||
public WorkflowDslExtensionsController(IMediator mediator) : base(mediator) { } | ||
|
||
} |
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,17 @@ | ||
using Hylo.Api.Http; | ||
using Synapse.Resources; | ||
|
||
namespace Synapse.Api.Core.Http.Controllers; | ||
|
||
/// <summary> | ||
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="WorkflowDsl"/>s | ||
/// </summary> | ||
[Route("api/core/v1/workflow-dsls")] | ||
public class WorkflowDslsController | ||
: ClusterResourceApiController<WorkflowDsl> | ||
{ | ||
|
||
/// <inheritdoc/> | ||
public WorkflowDslsController(IMediator mediator) : base(mediator) { } | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
src/api/core/http/Controllers/WorkflowInstancesController.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,17 @@ | ||
using Hylo.Api.Http; | ||
using Synapse.Resources; | ||
|
||
namespace Synapse.Api.Core.Http.Controllers; | ||
|
||
/// <summary> | ||
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="WorkflowInstance"/>s | ||
/// </summary> | ||
[Route("api/core/v1/workflow-instances")] | ||
public class WorkflowInstancesController | ||
: ClusterResourceApiController<WorkflowInstance> | ||
{ | ||
|
||
/// <inheritdoc/> | ||
public WorkflowInstancesController(IMediator mediator) : base(mediator) { } | ||
|
||
} |
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,17 @@ | ||
using Hylo.Api.Http; | ||
using Synapse.Resources; | ||
|
||
namespace Synapse.Api.Core.Http.Controllers; | ||
|
||
/// <summary> | ||
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="Workflow"/>s | ||
/// </summary> | ||
[Route("api/core/v1/workflows")] | ||
public class WorkflowsController | ||
: NamespacedResourceApiController<Workflow> | ||
{ | ||
|
||
/// <inheritdoc/> | ||
public WorkflowsController(IMediator mediator) : base(mediator) { } | ||
|
||
} |
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,12 @@ | ||
{ | ||
"profiles": { | ||
"Synapse.Api.Core": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "https://localhost:49854;http://localhost:49855" | ||
} | ||
} | ||
} |
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,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<GenerateDocumentationFile>True</GenerateDocumentationFile> | ||
<VersionPrefix>0.1.0</VersionPrefix> | ||
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion> | ||
<FileVersion>$(VersionPrefix)</FileVersion> | ||
<NeutralLanguage>en</NeutralLanguage> | ||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | ||
<Copyright>Copyright © 2023-Present The Synapse Authors. All rights reserved.</Copyright> | ||
<PackageProjectUrl>https://github.com/serverlessworkflow/synapse</PackageProjectUrl> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/serverlessworkflow/synapse</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<OutputType>Library</OutputType> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\core\Synapse.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Hylo.Api.Http" Version="0.4.0" /> | ||
<PackageReference Include="MediatR" Version="12.0.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,3 @@ | ||
global using Hylo; | ||
global using Microsoft.AspNetCore.Mvc; | ||
global using MediatR; |
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,36 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: agents.synapse-wfms.io | ||
spec: | ||
scope: Namespaced | ||
group: synapse-wfms.io | ||
names: | ||
kind: WorkflowAgent | ||
singular: workflow-agent | ||
plural: workflow-agents | ||
shortNames: | ||
- wfa | ||
- agent | ||
versions: | ||
- name: v1 | ||
served: true | ||
storage: true | ||
subResources: | ||
status: {} | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
properties: | ||
spec: | ||
type: object | ||
properties: | ||
supportedDsls: | ||
type: array | ||
uniqueItems: true | ||
minItems: 1 | ||
items: | ||
type: string | ||
required: [ 'supportedDsls' ] | ||
status: | ||
type: object |
13 changes: 7 additions & 6 deletions
13
.../Assets/Definitions/workflow-process.yaml → ...Assets/Definitions/workflow-instance.yaml
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 |
---|---|---|
|
@@ -62,4 +62,4 @@ public static class Definitions | |
|
||
} | ||
|
||
} | ||
} |
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,26 @@ | ||
namespace Synapse; | ||
|
||
/// <summary> | ||
/// Defines extensions for <see cref="WorkflowAgentProcessRule"/>s | ||
/// </summary> | ||
public static class WorkflowAgentProcessRuleExtensions | ||
{ | ||
|
||
/// <summary> | ||
/// Determines whether or not the <see cref="WorkflowAgentProcessRule"/> applies to the specified <see cref="WorkflowInstance"/> | ||
/// </summary> | ||
/// <param name="rule">The <see cref="WorkflowAgentProcessRule"/> to check</param> | ||
/// <param name="workflowVersion">The <see cref="WorkflowVersion"/> that defines the <see cref="WorkflowInstance"/> to check</param> | ||
/// <param name="instance">The <see cref="WorkflowInstance"/> to check</param> | ||
/// <returns>A boolean indicating whether or not the <see cref="WorkflowAgentProcessRule"/> applies to the specified <see cref="WorkflowInstance"/></returns> | ||
public static bool AppliesTo(this WorkflowAgentProcessRule rule, WorkflowVersion workflowVersion, WorkflowInstance instance) | ||
{ | ||
if (rule == null) throw new ArgumentNullException(nameof(rule)); | ||
if (workflowVersion == null) throw new ArgumentNullException(nameof(workflowVersion)); | ||
if (instance == null) throw new ArgumentNullException(nameof(instance)); | ||
if (!rule.SupportedLanguages.Contains(workflowVersion.Name)) return false; | ||
if (rule.Selectors != null && rule.Selectors.Any()) return rule.Selectors.All(s => s.Selects(instance)); | ||
return true; | ||
} | ||
|
||
} |
Oops, something went wrong.