ff0f812e00
Pure Dart A1a artifact domain slice mirroring web/src/artifacts.js and artifactNavigation.js: record parsing, capture facts, stage/visit grouping, public attribution, kind vocabulary, summaries, viewer paging and safe artifact url resolution. Tests mirror the domain directory; nothing is wired into a screen or transport.
45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
import 'package:pipelines_app/core/api_gateway.dart';
|
|
|
|
/// A minimal recorded [stage artifact], named so tests read like the web
|
|
/// client's fixtures. Every field the server records is present.
|
|
JsonMap artifact(
|
|
String name, {
|
|
String? url,
|
|
String contentType = '',
|
|
int sizeBytes = 0,
|
|
Map<String, dynamic> extra = const <String, dynamic>{},
|
|
}) {
|
|
return <String, dynamic>{
|
|
'name': name,
|
|
'url': url ?? '/artifacts/1/1/$name',
|
|
'content_type': contentType,
|
|
'size_bytes': sizeBytes,
|
|
...extra,
|
|
};
|
|
}
|
|
|
|
/// A minimal recorded step. [includeArtifacts] false omits the field entirely
|
|
/// (an unavailable capture); a null [artifacts] records an explicit null.
|
|
JsonMap step({
|
|
String stage = 'review',
|
|
int sequence = 1,
|
|
String status = 'completed',
|
|
int visit = 1,
|
|
List<JsonMap>? artifacts,
|
|
bool includeArtifacts = true,
|
|
int? skipped,
|
|
int? truncated,
|
|
List<JsonMap>? repairs,
|
|
}) {
|
|
return <String, dynamic>{
|
|
'stage': stage,
|
|
'sequence': sequence,
|
|
'status': status,
|
|
'control': <String, dynamic>{'visit': visit},
|
|
if (includeArtifacts) 'artifacts': artifacts,
|
|
'artifacts_skipped': ?skipped,
|
|
'artifacts_truncated': ?truncated,
|
|
'session_export_repairs': ?repairs,
|
|
};
|
|
}
|