295150751f
The Test Run sandbox and Monaco analysis modelled a script API that had drifted from the site runtime's ScriptGlobals, so real scripts failed to compile in Test Run. Realign both to the runtime surface (Instance/Scripts/ExternalSystem/Attributes/Children/Parent) and drop the duplicate ScriptHost stub so the two cannot diverge again. - Script calls (Scripts.CallShared, Instance.CallScript, Route.To().Call) accept an anonymous object instead of a hand-built dictionary, via a shared ScriptArgs normalizer; existing dictionary calls still compile. - Test Run can optionally bind to a deployed instance, so Instance/ Attributes/CallScript route to it cross-site; adds site-side RouteToGetAttributes/RouteToSetAttributes handlers. - Adds Test Run panels to the API method and template script editors. - Fixes the TestDatabaseQuery seed script, which queried a table that never existed. Also commits unrelated in-progress work already in the tree: the health monitoring report loop, site streaming changes, and the Admin/Design data-connection and SMTP page reorganization.
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Routing;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using ScadaLink.Security;
|
|
|
|
namespace ScadaLink.CentralUI.ScriptAnalysis;
|
|
|
|
public static class ScriptAnalysisEndpoints
|
|
{
|
|
public static IEndpointRouteBuilder MapScriptAnalysisEndpoints(this IEndpointRouteBuilder endpoints)
|
|
{
|
|
var group = endpoints.MapGroup("/api/script-analysis")
|
|
.RequireAuthorization(AuthorizationPolicies.RequireDesign);
|
|
|
|
group.MapPost("/diagnostics", (DiagnoseRequest req, ScriptAnalysisService svc) =>
|
|
Results.Ok(svc.Diagnose(req)));
|
|
|
|
group.MapPost("/completions", async (CompletionsRequest req, ScriptAnalysisService svc) =>
|
|
Results.Ok(await svc.CompleteAsync(req)));
|
|
|
|
group.MapPost("/hover", (HoverRequest req, ScriptAnalysisService svc) =>
|
|
Results.Ok(svc.Hover(req)));
|
|
|
|
group.MapPost("/signature-help", (SignatureHelpRequest req, ScriptAnalysisService svc) =>
|
|
Results.Ok(svc.SignatureHelp(req)));
|
|
|
|
group.MapPost("/format", (FormatRequest req, ScriptAnalysisService svc) =>
|
|
Results.Ok(svc.Format(req)));
|
|
|
|
group.MapPost("/inlay-hints", (InlayHintsRequest req, ScriptAnalysisService svc) =>
|
|
Results.Ok(svc.InlayHints(req)));
|
|
|
|
group.MapPost("/run", async (SandboxRunRequest req, ScriptAnalysisService svc, HttpContext http) =>
|
|
Results.Ok(await svc.RunInSandboxAsync(req, http.RequestAborted)));
|
|
|
|
return endpoints;
|
|
}
|
|
}
|