-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
1 parent
618f4e8
commit 97a9619
Showing
13 changed files
with
202 additions
and
32 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
src/activities/Elsa.Activities.Email/Activities/SendEmail/EmailAttachment.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,5 @@ | ||
// ReSharper disable once CheckNamespace | ||
namespace Elsa.Activities.Email | ||
{ | ||
public record EmailAttachment(byte[] Content, string? FileName, string? ContentType); | ||
} |
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
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
34 changes: 34 additions & 0 deletions
34
src/activities/Elsa.Activities.Email/Handlers/ConfigureJavaScriptEngine.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,34 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Elsa.Scripting.JavaScript.Extensions; | ||
using Elsa.Scripting.JavaScript.Messages; | ||
using Elsa.Services; | ||
using Elsa.Services.WorkflowStorage; | ||
using MediatR; | ||
using Microsoft.Extensions.Configuration; | ||
using NodaTime; | ||
|
||
namespace Elsa.Activities.Email.Handlers | ||
{ | ||
public class ConfigureJavaScriptEngine : INotificationHandler<EvaluatingJavaScriptExpression> | ||
{ | ||
private readonly IConfiguration _configuration; | ||
private readonly IActivityTypeService _activityTypeService; | ||
private readonly IWorkflowStorageService _workflowStorageService; | ||
|
||
public ConfigureJavaScriptEngine(IConfiguration configuration, IActivityTypeService activityTypeService, IWorkflowStorageService workflowStorageService) | ||
{ | ||
_configuration = configuration; | ||
_activityTypeService = activityTypeService; | ||
_workflowStorageService = workflowStorageService; | ||
} | ||
|
||
public Task Handle(EvaluatingJavaScriptExpression notification, CancellationToken cancellationToken) | ||
{ | ||
var engine = notification.Engine; | ||
|
||
engine.RegisterType<EmailAttachment>(); | ||
return Task.CompletedTask; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/activities/Elsa.Activities.Email/Handlers/EmailTypeDefinitionProvider.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,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Elsa.Scripting.JavaScript.Services; | ||
|
||
namespace Elsa.Activities.Email.Handlers | ||
{ | ||
public class EmailTypeDefinitionProvider : TypeDefinitionProvider | ||
{ | ||
public override IEnumerable<Type> CollectTypes(TypeDefinitionContext context) | ||
{ | ||
return new[] { typeof(EmailAttachment) }; | ||
} | ||
} | ||
} |
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 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.ComponentModel; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace System.Runtime.CompilerServices | ||
{ | ||
/// <summary> | ||
/// Reserved to be used by the compiler for tracking metadata. | ||
/// This class should not be used by developers in source code. | ||
/// </summary> | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
internal static class IsExternalInit | ||
{ | ||
} | ||
} |
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
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
10 changes: 10 additions & 0 deletions
10
src/scripting/Elsa.Scripting.JavaScript/Extensions/EngineExtensions.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,10 @@ | ||
using Jint; | ||
using Jint.Runtime.Interop; | ||
|
||
namespace Elsa.Scripting.JavaScript.Extensions | ||
{ | ||
public static class EngineExtensions | ||
{ | ||
public static void RegisterType<T>(this Engine engine) => engine.SetValue(typeof(T).Name, TypeReference.CreateTypeReference(engine, typeof(T))); | ||
} | ||
} |
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