Class BowireScriptSession

Namespace
Kuestenlogik.Bowire.Scripting
Assembly
Kuestenlogik.Bowire.dll

The pre-request and post-response scripts of one run (#672): the runner, the values scripts share across the run (ctx.vars.captured) and the sandbox limits from configuration. Used by bowire test, and since #1059 by bowire call and the MCP tool bowire.invoke.

public sealed class BowireScriptSession
Inheritance
BowireScriptSession
Inherited Members

Constructors

BowireScriptSession(BowireScriptLimits, IBowireScriptRunner?)

The pre-request and post-response scripts of one run (#672): the runner, the values scripts share across the run (ctx.vars.captured) and the sandbox limits from configuration. Used by bowire test, and since #1059 by bowire call and the MCP tool bowire.invoke.

public BowireScriptSession(BowireScriptLimits limits, IBowireScriptRunner? runner)

Parameters

limits BowireScriptLimits
runner IBowireScriptRunner

Properties

CollectionVarsJson

#1111 — ctx.vars.collection for the run, as a JSON object: the caller seeds it from the collection or flow and may store it after.

public string CollectionVarsJson { get; set; }

Property Value

string

SendRequest

#1111 — how a script's ctx.sendRequest goes out (see Through(BowireProtocolRegistry)); null: it fails, saying it is not available here.

public Func<BowireScriptSendRequest, CancellationToken, Task<BowireScriptSendResponse>>? SendRequest { get; set; }

Property Value

Func<BowireScriptSendRequest, CancellationToken, Task<BowireScriptSendResponse>>

Methods

FromConfiguration(IConfiguration?)

The installed runner, with limits read from Bowire:Scripting:*.

public static BowireScriptSession FromConfiguration(IConfiguration? cfg)

Parameters

cfg IConfiguration

Returns

BowireScriptSession

RunPost(string, string, string, string, BowireScriptRequest, BowireScriptResponse, IDictionary<string, string>, ICollection<string>)

Run source against the response. Returns the failure to report, or null.

public string? RunPost(string source, string protocol, string service, string method, BowireScriptRequest request, BowireScriptResponse response, IDictionary<string, string> environment, ICollection<string> log)

Parameters

source string
protocol string
service string
method string
request BowireScriptRequest
response BowireScriptResponse
environment IDictionary<string, string>
log ICollection<string>

Returns

string

RunPostAsync(string, string, string, string, BowireScriptRequest, BowireScriptResponse, IDictionary<string, string>, ICollection<string>, CancellationToken)

public Task<string?> RunPostAsync(string source, string protocol, string service, string method, BowireScriptRequest request, BowireScriptResponse response, IDictionary<string, string> environment, ICollection<string> log, CancellationToken ct = default)

Parameters

source string
protocol string
service string
method string
request BowireScriptRequest
response BowireScriptResponse
environment IDictionary<string, string>
log ICollection<string>
ct CancellationToken

Returns

Task<string>

RunPre(string, string, string, string, BowireScriptRequest, IDictionary<string, string>, ICollection<string>)

Run source before the call. Returns the failure to report, or null. Without an installed engine a script is a failure, never skipped: a run that ignored it would report a request that was not the one tested.

public string? RunPre(string source, string protocol, string service, string method, BowireScriptRequest request, IDictionary<string, string> environment, ICollection<string> log)

Parameters

source string
protocol string
service string
method string
request BowireScriptRequest
environment IDictionary<string, string>
log ICollection<string>

Returns

string

RunPreAsync(string, string, string, string, BowireScriptRequest, IDictionary<string, string>, ICollection<string>, CancellationToken)

public Task<string?> RunPreAsync(string source, string protocol, string service, string method, BowireScriptRequest request, IDictionary<string, string> environment, ICollection<string> log, CancellationToken ct = default)

Parameters

source string
protocol string
service string
method string
request BowireScriptRequest
environment IDictionary<string, string>
log ICollection<string>
ct CancellationToken

Returns

Task<string>

ShapeOf(string?)

public static string ShapeOf(string? protocol)

Parameters

protocol string

Returns

string