feat(scripts): add typed Parameters.Get<T>() helpers for script API
Replace raw dictionary casting with ScriptParameters wrapper that provides Get<T>, Get<T?>, Get<T[]>, and Get<List<T>> with clear error messages, numeric conversion, and JsonElement support for Inbound API parameters.
This commit is contained in:
@@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ScadaLink.Commons.Interfaces.Services;
|
||||
using ScadaLink.Commons.Messages.ScriptExecution;
|
||||
using ScadaLink.Commons.Types;
|
||||
using ScadaLink.HealthMonitoring;
|
||||
using ScadaLink.SiteRuntime.Scripts;
|
||||
|
||||
@@ -100,7 +101,7 @@ public class ScriptExecutionActor : ReceiveActor
|
||||
var globals = new ScriptGlobals
|
||||
{
|
||||
Instance = context,
|
||||
Parameters = parameters ?? new Dictionary<string, object?>(),
|
||||
Parameters = new ScriptParameters(parameters ?? new Dictionary<string, object?>()),
|
||||
CancellationToken = cts.Token
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user