logItem method

Future<Artifact> logItem(
  1. String outputPath, {
  2. Artifact? sourceArtifact,
})

Implementation

Future<Artifact> logItem(
  String outputPath, {
  Artifact? sourceArtifact,
}) async {
  final now = DateTime.now();
  final sourcePath = sourceArtifact?.path;
  final rootPath = sourceArtifact?.rootPath;
  final context = sourceArtifact?.context;
  final author = sourceArtifact?.author ?? name;
  final mimeType = outputMimeType;
  final item = Artifact(
    path: outputPath,
    createdAt: now,
    updatedAt: now,
    sourcePath: sourcePath,
    context: context,
    rootPath: rootPath,
    author: author,
    mimeType: mimeType,
  );
  return await _artifactRepository.add(item);
}