Init CollectionFilesService
[arvados-workbench2.git] / src / services / collection-files-service / collection-files-service.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { CollectionService } from "../collection-service/collection-service";
6 import { parseKeepManifestText } from "./collection-manifest-parser";
7 import { mapManifestToCollectionFilesTree } from "./collection-manifest-mapper";
8
9 export class CollectionFilesService {
10     
11     constructor(private collectionService: CollectionService) { }
12
13     getFiles(collectionUuid: string) {
14         return this.collectionService
15             .get(collectionUuid)
16             .then(collection =>
17                 mapManifestToCollectionFilesTree(
18                     parseKeepManifestText(
19                         collection.manifestText
20                     )
21                 )
22             );
23     }
24
25 }