11import { outputJson , readJson } from "fs-extra" ;
22import { VariantAnalysisScannedRepositoryState } from "../shared/variant-analysis" ;
33import { VariantAnalysisScannedRepositoryStateDto } from "./repo-states-dto" ;
4- import { mapRepoStateToDto } from "./repo-states-dto-mapper" ;
5- import { mapRepoStateToDomainModel } from "./repo-states-domain-mapper" ;
4+ import { mapRepoStatesToDto } from "./repo-states-dto-mapper" ;
5+ import { mapRepoStatesToDomainModel } from "./repo-states-domain-mapper" ;
66
77export const REPO_STATES_FILENAME = "repo_states.json" ;
88
99export async function writeRepoStates (
1010 storagePath : string ,
1111 repoStates : Record < number , VariantAnalysisScannedRepositoryState > ,
1212) : Promise < void > {
13- // Map from repoStates Domain type to the repoStates Data type
14- const repoStatesData = Object . fromEntries (
15- Object . entries ( repoStates ) . map ( ( [ key , value ] ) => {
16- return [ key , mapRepoStateToDto ( value ) ] ;
17- } ) ,
18- ) ;
19-
13+ const repoStatesData = mapRepoStatesToDto ( repoStates ) ;
2014 await outputJson ( storagePath , repoStatesData ) ;
2115}
2216
@@ -29,12 +23,7 @@ export async function readRepoStates(
2923 VariantAnalysisScannedRepositoryStateDto
3024 > = await readJson ( storagePath ) ;
3125
32- // Map from repoStates Data type to the repoStates Domain type
33- const repoStates = Object . fromEntries (
34- Object . entries ( repoStatesData ) . map ( ( [ key , value ] ) => {
35- return [ key , mapRepoStateToDomainModel ( value ) ] ;
36- } ) ,
37- ) ;
26+ const repoStates = mapRepoStatesToDomainModel ( repoStatesData ) ;
3827
3928 return repoStates ;
4029 } catch ( e ) {
0 commit comments