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:
Joseph Doherty
2026-03-22 15:47:18 -04:00
parent a0e036fb6b
commit 161dc406ed
10 changed files with 672 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging.Abstractions;
using ScadaLink.Commons.Types;
using ScadaLink.SiteRuntime.Scripts;
namespace ScadaLink.SiteRuntime.Tests.Scripts;
@@ -236,7 +237,7 @@ public class SandboxTests
var globals = new ScriptGlobals
{
Instance = null!,
Parameters = new Dictionary<string, object?>(),
Parameters = new ScriptParameters(),
CancellationToken = cts.Token
};
@@ -266,7 +267,7 @@ public class SandboxTests
var globals = new ScriptGlobals
{
Instance = null!,
Parameters = new Dictionary<string, object?>(),
Parameters = new ScriptParameters(),
CancellationToken = cts.Token
};