feat: fai_dart_sdk scaffold

Dart package skeleton for the F∆I gRPC client. Used by F∆I
Studio (Tier-2) and Tier-3 domain apps (DigiScout / J∆I /
Scout). Public surface — HubClient, HubEndpoint — is committed
as a typed stub so downstream apps can compile against it
immediately. Generated proto bindings land in a follow-up
commit once the codegen step (planned: tools/generate.sh
wrapping protoc-gen-dart against ../fai_platform/proto) is
wired in.

Future Forgejo path: fai/dart-sdk.

dart analyze: clean. dart test: 4/4.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-05 14:19:39 +02:00
commit d405a6a9bd
9 changed files with 216 additions and 0 deletions

14
lib/fai_dart_sdk.dart Normal file
View file

@ -0,0 +1,14 @@
/// gRPC client for the FI Platform hub.
///
/// Provides a typed Dart wrapper around the hub's gRPC services
/// (Hub, HubAdmin) defined in `fai/platform`'s `proto/fai/v1/`
/// directory. Used by FI Studio and any Tier-3 Dart/Flutter
/// app (DigiScout, JI, Scout, ) that wants to talk to a hub.
///
/// Status (2026-05-05): scaffold only. Generated proto bindings
/// land in `lib/src/generated/` once the codegen step is wired
/// in (`tools/generate.sh`). Until then, [HubClient] is a stub
/// type that documents the intended surface.
library;
export 'src/hub_client.dart';

43
lib/src/hub_client.dart Normal file
View file

@ -0,0 +1,43 @@
// HubClient typed wrapper around the FI Hub gRPC service.
//
// Status (2026-05-05): scaffold. The generated proto bindings
// from `fai/platform`'s proto/fai/v1/ directory will populate
// the actual RPC implementations under `lib/src/generated/`
// once the codegen tooling is wired (planned: a small
// `tools/generate.sh` script that runs `protoc` with
// `protoc-gen-dart` against the platform repo's protos).
/// Connection coordinates for a hub endpoint.
class HubEndpoint {
/// Hostname or IP. Defaults to localhost for the canonical
/// `fai serve` setup.
final String host;
/// gRPC port. Defaults to 50051.
final int port;
/// When true, use TLS. Phase 1+ will add credential support.
final bool secure;
const HubEndpoint({
this.host = '127.0.0.1',
this.port = 50051,
this.secure = false,
});
@override
String toString() => '${secure ? "https" : "http"}://$host:$port';
}
/// Stub client interface. The real implementation will arrive
/// when proto codegen is wired in. Studio uses this type as the
/// future-stable surface; the mock data layer in
/// `fai_studio/lib/data/mock.dart` is the placeholder until then.
class HubClient {
final HubEndpoint endpoint;
HubClient({this.endpoint = const HubEndpoint()});
/// Closes the underlying channel. No-op while stubbed.
Future<void> close() async {}
}