feat: getFlowDefinition wrapper + FlowInputDef DTO (v0.15.0)

Surface the new platform RPC `GetFlowDefinition` as a typed
Dart method so Studio (and other GUI clients) can render an
input form before calling `runSavedFlow`. Each declared input
arrives as a `FlowInputDef` with the verbatim type tag from
the flow YAML — usually `text`, `bytes`, `json`, or `file`.

Regenerated proto bindings to pick up the new
`GetFlowDefinitionRequest`, `FlowDefinition`, and
`FlowInputSpec` message types.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-09 10:12:59 +02:00
parent 193f59302a
commit 1e98ab9ccf
5 changed files with 255 additions and 1 deletions

View file

@ -466,6 +466,19 @@ class HubClient {
return r.flows;
}
/// Return the parsed input schema of a saved flow so a GUI
/// client can render an input form before calling
/// [runSavedFlow]. Each entry's `type` is the verbatim type
/// tag from the flow YAML (`text`, `bytes`, `json`, `file`,
/// or anything else the flow author put there).
Future<List<FlowInputDef>> getFlowDefinition(String name) async {
final req = pb.GetFlowDefinitionRequest()..name = name;
final resp = await _admin.getFlowDefinition(req);
return resp.inputs
.map((spec) => FlowInputDef(name: spec.name, type: spec.type))
.toList();
}
/// Run a saved flow by name with the supplied named inputs.
/// Two input shapes are supported in the same call so a
/// flow that mixes text and binary inputs (e.g. extract
@ -503,3 +516,17 @@ class HubClient {
await _channel.shutdown();
}
}
/// One declared input in a saved flow's `inputs:` section.
/// Returned by [HubClient.getFlowDefinition] so GUI clients
/// can build a typed run-flow form. The [type] field carries
/// the flow YAML's verbatim type tag — opaque to the SDK so
/// the type system can grow without an SDK release.
class FlowInputDef {
/// Input key (the name the flow YAML uses).
final String name;
/// Type tag typically `text`, `bytes`, `json`, or `file`.
final String type;
const FlowInputDef({required this.name, required this.type});
}